getProjection函数 cache.getCurrentUserId传入true
This commit is contained in:
parent
64aec594c8
commit
a116d34acb
|
|
@ -12,7 +12,7 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict, Cxt extends A
|
|||
private contextBuilder?;
|
||||
constructor(aspectWrapper: AspectWrapper<ED, Cxt, AD>, contextBuilder: () => FrontCxt, store: CacheStore<ED, FrontCxt>);
|
||||
getSchema(): import("oak-domain/lib/types").StorageSchema<ED>;
|
||||
getCurrentUserId(): string | undefined;
|
||||
getCurrentUserId(allowUnloggedIn?: boolean): string | undefined;
|
||||
exec<K extends keyof AD>(name: K, params: Parameters<AD[K]>[0], callback?: (result: Awaited<ReturnType<AD[K]>>, opRecords?: OpRecord<ED>[]) => void): Promise<{
|
||||
result: Awaited<ReturnType<AD[K]>>;
|
||||
message: string | null | undefined;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ var Cache = /** @class */ (function (_super) {
|
|||
Cache.prototype.getSchema = function () {
|
||||
return this.cacheStore.getSchema();
|
||||
};
|
||||
Cache.prototype.getCurrentUserId = function () {
|
||||
Cache.prototype.getCurrentUserId = function (allowUnloggedIn) {
|
||||
var context = this.contextBuilder && this.contextBuilder();
|
||||
return context === null || context === void 0 ? void 0 : context.getCurrentUserId();
|
||||
return context === null || context === void 0 ? void 0 : context.getCurrentUserId(allowUnloggedIn);
|
||||
};
|
||||
Cache.prototype.exec = function (name, params, callback) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ var Node = /** @class */ (function (_super) {
|
|||
var e_1, _a, e_2, _b;
|
||||
var projection = typeof this.projection === 'function' ? this.projection() : (this.projection && (0, lodash_1.cloneDeep)(this.projection));
|
||||
// 根据actions和cascadeActions的定义,将对应的projection构建出来
|
||||
var userId = this.cache.getCurrentUserId();
|
||||
var userId = this.cache.getCurrentUserId(true);
|
||||
if (userId && projection) {
|
||||
if (this.actions) {
|
||||
var actions = typeof this.actions === 'function' ? this.actions() : this.actions;
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ export class Cache<
|
|||
return this.cacheStore.getSchema();
|
||||
}
|
||||
|
||||
getCurrentUserId() {
|
||||
getCurrentUserId(allowUnloggedIn?: boolean) {
|
||||
const context = this.contextBuilder && this.contextBuilder();
|
||||
return context?.getCurrentUserId();
|
||||
return context?.getCurrentUserId(allowUnloggedIn);
|
||||
}
|
||||
|
||||
async exec<K extends keyof AD>(
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ abstract class Node<
|
|||
protected getProjection(): ED[T]['Selection']['data'] | undefined {
|
||||
const projection = typeof this.projection === 'function' ? (this.projection as Function)() : (this.projection && cloneDeep(this.projection));
|
||||
// 根据actions和cascadeActions的定义,将对应的projection构建出来
|
||||
const userId = this.cache.getCurrentUserId();
|
||||
const userId = this.cache.getCurrentUserId(true);
|
||||
if (userId && projection) {
|
||||
if (this.actions) {
|
||||
const actions = typeof this.actions === 'function' ? this.actions() : this.actions;
|
||||
|
|
|
|||
Loading…
Reference in New Issue