1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-26 20:48:30 +09:00
misskey/src/remote/activitypub/act/index.ts
2018-04-02 04:15:27 +09:00

23 lines
554 B
TypeScript

import create from './create';
import createObject from '../create';
import Resolver from '../resolver';
export default (actor, value) => {
return new Resolver().resolve(value).then(resolved => Promise.all(resolved.map(async promisedResult => {
const { resolver, object } = await promisedResult;
const created = await (await createObject(resolver, actor, [object]))[0];
if (created !== null) {
return created;
}
switch (object.type) {
case 'Create':
return create(resolver, actor, object);
default:
return null;
}
})));
};