后台context增加了sendMessage接口

This commit is contained in:
Xu Chang 2022-12-03 11:52:22 +08:00
parent 397613b639
commit 43fac8001d
3 changed files with 18 additions and 0 deletions

View File

@ -19,4 +19,5 @@ export declare class BackendRuntimeContext<ED extends EntityDict> extends AsyncC
getCurrentUserId(allowUnloggedIn?: boolean): string; getCurrentUserId(allowUnloggedIn?: boolean): string;
toString(): string; toString(): string;
isRoot(): boolean; isRoot(): boolean;
sendMessage(data: ED['message']['CreateSingle']['data']): Promise<import("oak-domain/lib/types").OperationResult<ED>>;
} }

View File

@ -188,6 +188,14 @@ var BackendRuntimeContext = /** @class */ (function (_super) {
} }
return !!this.amIRoot; return !!this.amIRoot;
}; };
BackendRuntimeContext.prototype.sendMessage = function (data) {
return this.operate('message', {
action: 'create',
data: data,
}, {
dontCollect: true,
});
};
return BackendRuntimeContext; return BackendRuntimeContext;
}(AsyncRowStore_1.AsyncContext)); }(AsyncRowStore_1.AsyncContext));
exports.BackendRuntimeContext = BackendRuntimeContext; exports.BackendRuntimeContext = BackendRuntimeContext;

View File

@ -177,4 +177,13 @@ export class BackendRuntimeContext<ED extends EntityDict> extends AsyncContext<E
} }
return !!this.amIRoot; return !!this.amIRoot;
} }
sendMessage(data: ED['message']['CreateSingle']['data']) {
return this.operate('message', {
action: 'create',
data,
}, {
dontCollect: true,
});
}
} }