适配新的auth定义,以及port定义等
This commit is contained in:
parent
4a18cbefe2
commit
23a13c9436
|
|
@ -43,7 +43,7 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict, Cxt extends A
|
|||
}>, allowMiss?: boolean): Partial<ED[T]["Schema"]>[];
|
||||
private getInner;
|
||||
get<T extends keyof ED>(entity: T, selection: ED[T]['Selection'], params?: SelectOption): Partial<ED[T]["Schema"]>[];
|
||||
judgeRelation(entity: keyof ED, attr: string): string | 0 | 1 | string[] | 2;
|
||||
judgeRelation(entity: keyof ED, attr: string): string | 0 | 1 | 2 | string[];
|
||||
bindOnSync(callback: (opRecords: OpRecord<ED>[]) => void): void;
|
||||
unbindOnSync(callback: (opRecords: OpRecord<ED>[]) => void): void;
|
||||
getCachedData(): { [T in keyof ED]?: ED[T]["OpSchema"][] | undefined; };
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
|||
export declare class Port<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, AD extends CommonAspectDict<ED, Cxt> & Record<string, Aspect<ED, Cxt>>> extends Feature {
|
||||
private aspectWrapper;
|
||||
constructor(aspectWrapper: AspectWrapper<ED, Cxt, AD>);
|
||||
importEntity<T extends keyof ED>(entity: T, id: string, file: File): Promise<{
|
||||
importEntity<T extends keyof ED>(entity: T, id: string, file: File, option: Object): Promise<{
|
||||
result: Awaited<ReturnType<AD["importEntity"]>>;
|
||||
opRecords: import("oak-domain/lib/types").OpRecord<ED>[];
|
||||
}>;
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@ var Port = /** @class */ (function (_super) {
|
|||
_this.aspectWrapper = aspectWrapper;
|
||||
return _this;
|
||||
}
|
||||
Port.prototype.importEntity = function (entity, id, file) {
|
||||
Port.prototype.importEntity = function (entity, id, file, option) {
|
||||
var formData = new FormData();
|
||||
formData.set('entity', entity);
|
||||
formData.set('id', id);
|
||||
formData.set('file', file);
|
||||
formData.set('option', JSON.stringify(option));
|
||||
return this.aspectWrapper.exec('importEntity', formData);
|
||||
};
|
||||
Port.prototype.exportEntity = function (entity, id, filter) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ declare abstract class Node<ED extends EntityDict & BaseEntityDict, T extends ke
|
|||
setExecuting(executing: boolean): void;
|
||||
getParent(): SingleNode<ED, keyof ED, Cxt, FrontCxt, AD> | ListNode<ED, T, Cxt, FrontCxt, AD> | VirtualNode<ED, Cxt, FrontCxt, AD> | undefined;
|
||||
protected getProjection(): ED[T]["Selection"]["data"];
|
||||
protected judgeRelation(attr: string): string | 0 | 1 | string[] | 2;
|
||||
protected judgeRelation(attr: string): string | 0 | 1 | 2 | string[];
|
||||
protected contains(filter: ED[T]['Selection']['filter'], conditionalFilter: ED[T]['Selection']['filter']): boolean;
|
||||
protected repel(filter1: ED[T]['Selection']['filter'], filter2: ED[T]['Selection']['filter']): boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Aspect, Checker, Trigger, StorageSchema, Watcher, Routine, Timer } from 'oak-domain/lib/types';
|
||||
import { Aspect, Checker, Trigger, StorageSchema, Watcher, Routine, Timer, AuthDefDict } from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { EntityDict, Exportation, Importation } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Exportation, Importation } from 'oak-domain/lib/types/Port';
|
||||
import { Feature } from './types/Feature';
|
||||
import { BasicFeatures } from './features';
|
||||
import { ActionDictOfEntityDict } from 'oak-domain/lib/types/Action';
|
||||
|
|
@ -24,6 +25,6 @@ import { AsyncContext } from 'oak-domain/lib/store/AsyncRowStore';
|
|||
*/
|
||||
export declare function initialize<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>>(storageSchema: StorageSchema<ED>, createFeatures: (basicFeatures: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) => FD, frontendContextBuilder: (features: FD & BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) => (store: CacheStore<ED, FrontCxt>) => FrontCxt, backendContextBuilder: (contextStr?: string) => (store: DebugStore<ED, Cxt>) => Promise<Cxt>, aspectDict: AD, triggers?: Array<Trigger<ED, keyof ED, Cxt>>, checkers?: Array<Checker<ED, keyof ED, FrontCxt | Cxt>>, watchers?: Array<Watcher<ED, keyof ED, Cxt>>, timers?: Array<Timer<ED, Cxt>>, startRoutines?: Array<Routine<ED, Cxt>>, initialData?: {
|
||||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
}, actionDict?: ActionDictOfEntityDict<ED>, importations?: Importation<ED, keyof ED, any>[], exportations?: Exportation<ED, keyof ED, any>[]): {
|
||||
}, actionDict?: ActionDictOfEntityDict<ED>, authDict?: AuthDefDict<ED>, importations?: Importation<ED, keyof ED, any>[], exportations?: Exportation<ED, keyof ED, any>[]): {
|
||||
features: FD & BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ var CacheStore_1 = require("./cacheStore/CacheStore");
|
|||
* @param actionDict
|
||||
* @returns
|
||||
*/
|
||||
function initialize(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, importations, exportations) {
|
||||
function initialize(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, authDict, importations, exportations) {
|
||||
var _this = this;
|
||||
var intersected = (0, lodash_1.intersection)(Object.keys(oak_common_aspect_1.default), Object.keys(aspectDict));
|
||||
if (intersected.length > 0) {
|
||||
throw new Error("\u7528\u6237\u5B9A\u4E49\u7684aspect\u4E2D\u4E0D\u80FD\u548C\u7CFB\u7EDFaspect\u540C\u540D\uFF1A\u300C".concat(intersected.join(','), "\u300D"));
|
||||
}
|
||||
var aspectDict2 = Object.assign({}, aspectDict, oak_common_aspect_1.default);
|
||||
var checkers2 = (checkers || []).concat((0, index_1.createDynamicCheckers)(storageSchema));
|
||||
var checkers2 = (checkers || []).concat((0, index_1.createDynamicCheckers)(storageSchema, authDict));
|
||||
var triggers2 = (0, index_2.createDynamicTriggers)(storageSchema).concat(triggers || []);
|
||||
var debugStore = (0, debugStore_1.createDebugStore)(storageSchema, backendContextBuilder, triggers2, checkers2, watchers || [], timers, startRoutines, initialData, actionDict);
|
||||
var features = {};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import './utils/wx.polyfill';
|
||||
import { Aspect, Routine, Checker, Trigger, StorageSchema, Watcher, Timer } from 'oak-domain/lib/types';
|
||||
import { EntityDict, Exportation, Importation } from 'oak-domain/lib/types/Entity';
|
||||
import { Aspect, Routine, Checker, Trigger, StorageSchema, Watcher, Timer, AuthDefDict } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Exportation, Importation } from 'oak-domain/lib/types/Port';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { Feature } from './types/Feature';
|
||||
import { BasicFeatures } from './features';
|
||||
|
|
@ -12,7 +13,7 @@ import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
|||
import { CacheStore } from './cacheStore/CacheStore';
|
||||
export declare function initialize<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>>(storageSchema: StorageSchema<ED>, createFeatures: (basicFeatures: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) => FD, frontendContextBuilder: (features: FD & BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) => (store: CacheStore<ED, FrontCxt>) => FrontCxt, backendContextBuilder: (contextStr?: string) => (store: AsyncRowStore<ED, Cxt>) => Promise<Cxt>, aspectDict: AD, triggers?: Array<Trigger<ED, keyof ED, Cxt>>, checkers?: Array<Checker<ED, keyof ED, FrontCxt | Cxt>>, watchers?: Array<Watcher<ED, keyof ED, Cxt>>, timers?: Array<Timer<ED, Cxt>>, startRoutines?: Array<Routine<ED, Cxt>>, initialData?: {
|
||||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
}, actionDict?: ActionDictOfEntityDict<ED>, i18nOptions?: I18nOptions, importations?: Importation<ED, keyof ED, any>[], exportations?: Exportation<ED, keyof ED, any>[]): {
|
||||
}, actionDict?: ActionDictOfEntityDict<ED>, authDict?: AuthDefDict<ED>, i18nOptions?: I18nOptions, importations?: Importation<ED, keyof ED, any>[], exportations?: Exportation<ED, keyof ED, any>[]): {
|
||||
i18n: import("./platforms/wechatMp/i18n").I18nWechatMpRuntimeBase;
|
||||
features: FD & BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ require("./utils/wx.polyfill");
|
|||
var page_mp_1 = require("./page.mp");
|
||||
var initialize_dev_1 = require("./initialize-dev");
|
||||
var i18n_1 = require("./platforms/wechatMp/i18n");
|
||||
function initialize(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, i18nOptions, importations, exportations) {
|
||||
var features = (0, initialize_dev_1.initialize)(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict).features;
|
||||
function initialize(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, authDict, i18nOptions, importations, exportations) {
|
||||
var features = (0, initialize_dev_1.initialize)(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, authDict, importations, exportations).features;
|
||||
// 初始化i8n配置
|
||||
var i18n = (0, i18n_1.getI18next)(i18nOptions);
|
||||
Object.assign(global, {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import './utils/wx.polyfill';
|
||||
import { Aspect, Checker, Trigger, StorageSchema, Watcher, Routine, Timer } from 'oak-domain/lib/types';
|
||||
import { Aspect, Checker, Trigger, StorageSchema, Watcher, Routine, Timer, AuthDefDict } from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { EntityDict, Exportation, Importation } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Exportation, Importation } from 'oak-domain/lib/types/Port';
|
||||
import { Feature } from './types/Feature';
|
||||
import { BasicFeatures } from './features';
|
||||
import { ActionDictOfEntityDict } from 'oak-domain/lib/types/Action';
|
||||
|
|
@ -12,7 +13,7 @@ import { SyncContext } from 'oak-domain/lib/store/SyncRowStore';
|
|||
import { CacheStore } from './cacheStore/CacheStore';
|
||||
export declare function initialize<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature>>(storageSchema: StorageSchema<ED>, createFeatures: (basicFeatures: BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) => FD, frontendContextBuilder: (features: FD & BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>) => (store: CacheStore<ED, FrontCxt>) => FrontCxt, backendContextBuilder: (contextStr?: string) => (store: AsyncRowStore<ED, Cxt>) => Promise<Cxt>, aspectDict: AD, triggers?: Array<Trigger<ED, keyof ED, Cxt>>, checkers?: Array<Checker<ED, keyof ED, FrontCxt | Cxt>>, watchers?: Array<Watcher<ED, keyof ED, Cxt>>, timers?: Array<Timer<ED, Cxt>>, startRoutines?: Array<Routine<ED, Cxt>>, initialData?: {
|
||||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
}, actionDict?: ActionDictOfEntityDict<ED>, i18nOptions?: I18nOptions, importations?: Importation<ED, keyof ED, any>[], exportations?: Exportation<ED, keyof ED, any>[]): {
|
||||
}, actionDict?: ActionDictOfEntityDict<ED>, authDict?: AuthDefDict<ED>, i18nOptions?: I18nOptions, importations?: Importation<ED, keyof ED, any>[], exportations?: Exportation<ED, keyof ED, any>[]): {
|
||||
i18n: import("i18next").i18n;
|
||||
features: FD & BasicFeatures<ED, Cxt, FrontCxt, AD & CommonAspectDict<ED, Cxt>>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ require("./utils/wx.polyfill");
|
|||
var page_web_1 = require("./page.web");
|
||||
var initialize_dev_1 = require("./initialize-dev");
|
||||
var i18n_1 = require("./platforms/web/i18n");
|
||||
function initialize(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, i18nOptions, importations, exportations) {
|
||||
var features = (0, initialize_dev_1.initialize)(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict).features;
|
||||
function initialize(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, authDict, i18nOptions, importations, exportations) {
|
||||
var features = (0, initialize_dev_1.initialize)(storageSchema, createFeatures, frontendContextBuilder, backendContextBuilder, aspectDict, triggers, checkers, watchers, timers, startRoutines, initialData, actionDict, authDict, importations, exportations).features;
|
||||
// 初始化i8n配置
|
||||
var i18n = (0, i18n_1.getI18next)(i18nOptions);
|
||||
Object.assign(global, {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,12 @@ export class Port<
|
|||
this.aspectWrapper = aspectWrapper;
|
||||
}
|
||||
|
||||
importEntity<T extends keyof ED>(entity: T, id: string, file: File) {
|
||||
importEntity<T extends keyof ED>(entity: T, id: string, file: File, option: Object) {
|
||||
const formData = new FormData();
|
||||
formData.set('entity', entity as string);
|
||||
formData.set('id', id);
|
||||
formData.set('file', file);
|
||||
formData.set('option', JSON.stringify(option));
|
||||
|
||||
return this.aspectWrapper.exec('importEntity', formData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,11 @@ import {
|
|||
Watcher,
|
||||
Routine,
|
||||
Timer,
|
||||
AuthDefDict,
|
||||
} from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { EntityDict, Exportation, Importation } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Exportation, Importation } from 'oak-domain/lib/types/Port';
|
||||
import { createDynamicCheckers } from 'oak-domain/lib/checkers/index';
|
||||
import { createDynamicTriggers } from 'oak-domain/lib/triggers/index';
|
||||
|
||||
|
|
@ -63,6 +65,7 @@ export function initialize<
|
|||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
},
|
||||
actionDict?: ActionDictOfEntityDict<ED>,
|
||||
authDict?: AuthDefDict<ED>,
|
||||
importations?: Importation<ED, keyof ED, any>[],
|
||||
exportations?: Exportation<ED, keyof ED, any>[]
|
||||
) {
|
||||
|
|
@ -73,7 +76,7 @@ export function initialize<
|
|||
);
|
||||
}
|
||||
const aspectDict2 = Object.assign({}, aspectDict, commonAspectDict);
|
||||
const checkers2 = (checkers || []).concat(createDynamicCheckers<ED, Cxt | FrontCxt>(storageSchema));
|
||||
const checkers2 = (checkers || []).concat(createDynamicCheckers<ED, Cxt | FrontCxt>(storageSchema, authDict));
|
||||
const triggers2 = createDynamicTriggers<ED, Cxt>(storageSchema).concat(triggers || []);
|
||||
const debugStore = createDebugStore(
|
||||
storageSchema,
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ import {
|
|||
StorageSchema,
|
||||
Watcher,
|
||||
Timer,
|
||||
AuthDefDict,
|
||||
} from 'oak-domain/lib/types';
|
||||
import { EntityDict, Exportation, Importation } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Exportation, Importation } from 'oak-domain/lib/types/Port';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
|
||||
import { Feature } from './types/Feature';
|
||||
|
|
@ -47,6 +49,7 @@ export function initialize<
|
|||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
},
|
||||
actionDict?: ActionDictOfEntityDict<ED>,
|
||||
authDict?: AuthDefDict<ED>,
|
||||
i18nOptions?: I18nOptions,
|
||||
importations?: Importation<ED, keyof ED, any>[],
|
||||
exportations?: Exportation<ED, keyof ED, any>[]
|
||||
|
|
@ -63,7 +66,10 @@ export function initialize<
|
|||
timers,
|
||||
startRoutines,
|
||||
initialData,
|
||||
actionDict
|
||||
actionDict,
|
||||
authDict,
|
||||
importations,
|
||||
exportations
|
||||
);
|
||||
|
||||
// 初始化i8n配置
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ import {
|
|||
Watcher,
|
||||
Routine,
|
||||
Timer,
|
||||
AuthDefDict,
|
||||
} from 'oak-domain/lib/types';
|
||||
import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
||||
import { EntityDict, Exportation, Importation } from 'oak-domain/lib/types/Entity';
|
||||
import { EntityDict } from 'oak-domain/lib/types/Entity';
|
||||
import { Exportation, Importation } from 'oak-domain/lib/types/Port';
|
||||
|
||||
import { Feature } from './types/Feature';
|
||||
|
||||
|
|
@ -51,6 +53,7 @@ export function initialize<
|
|||
[T in keyof ED]?: Array<ED[T]['OpSchema']>;
|
||||
},
|
||||
actionDict?: ActionDictOfEntityDict<ED>,
|
||||
authDict?: AuthDefDict<ED>,
|
||||
i18nOptions?: I18nOptions,
|
||||
importations?: Importation<ED, keyof ED, any>[],
|
||||
exportations?: Exportation<ED, keyof ED, any>[]
|
||||
|
|
@ -68,7 +71,10 @@ export function initialize<
|
|||
timers,
|
||||
startRoutines,
|
||||
initialData,
|
||||
actionDict
|
||||
actionDict,
|
||||
authDict,
|
||||
importations,
|
||||
exportations
|
||||
);
|
||||
|
||||
// 初始化i8n配置
|
||||
|
|
|
|||
Loading…
Reference in New Issue