From 09fe64e422049c3d39c929fa04606772ee3df731 Mon Sep 17 00:00:00 2001 From: "Xc@centOs" Date: Fri, 28 Jun 2024 15:42:40 +0800 Subject: [PATCH] =?UTF-8?q?path=E5=A2=9E=E5=8A=A0=E4=BA=86desc=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/base-app-domain/Path/Schema.d.ts | 6 ++++++ lib/base-app-domain/Path/Storage.js | 6 ++++++ lib/entities/Path.d.ts | 1 + lib/entities/Path.js | 5 +++-- lib/store/IntrinsicCheckers.js | 8 ++++---- lib/utils/assert.d.ts | 1 - lib/utils/relationPath.js | 2 +- src/entities/Path.ts | 6 ++++-- 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/lib/base-app-domain/Path/Schema.d.ts b/lib/base-app-domain/Path/Schema.d.ts index a3e3b5a..eae583a 100644 --- a/lib/base-app-domain/Path/Schema.d.ts +++ b/lib/base-app-domain/Path/Schema.d.ts @@ -12,6 +12,7 @@ export type OpSchema = EntityShape & { value: String<256>; recursive: Boolean; sourceEntity: String<32>; + desc?: String<256> | null; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { @@ -19,6 +20,7 @@ export type Schema = EntityShape & { value: String<256>; recursive: Boolean; sourceEntity: String<32>; + desc?: String<256> | null; actionAuth$path?: Array; actionAuth$path$$aggr?: AggregationResult; relationAuth$path?: Array; @@ -39,6 +41,7 @@ type AttrFilter = { value: Q_StringValue; recursive: Q_BooleanValue; sourceEntity: Q_StringValue; + desc: Q_StringValue; actionAuth$path: ActionAuth.Filter & SubQueryPredicateMetadata; relationAuth$path: RelationAuth.Filter & SubQueryPredicateMetadata; modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata; @@ -56,6 +59,7 @@ export type Projection = { value?: number; recursive?: number; sourceEntity?: number; + desc?: number; actionAuth$path?: ActionAuth.Selection & { $entity: "actionAuth"; }; @@ -100,6 +104,8 @@ export type SortAttr = { recursive: number; } | { sourceEntity: number; +} | { + desc: number; } | { [k: string]: any; } | OneOf>; diff --git a/lib/base-app-domain/Path/Storage.js b/lib/base-app-domain/Path/Storage.js index 3b491b5..bf49609 100644 --- a/lib/base-app-domain/Path/Storage.js +++ b/lib/base-app-domain/Path/Storage.js @@ -28,6 +28,12 @@ exports.desc = { params: { length: 32 } + }, + desc: { + type: "varchar", + params: { + length: 256 + } } }, static: true, diff --git a/lib/entities/Path.d.ts b/lib/entities/Path.d.ts index 4e983a4..5e8f6d8 100644 --- a/lib/entities/Path.d.ts +++ b/lib/entities/Path.d.ts @@ -5,4 +5,5 @@ export interface Schema extends EntityShape { value: String<256>; recursive: Boolean; sourceEntity: String<32>; + desc?: String<256>; } diff --git a/lib/entities/Path.js b/lib/entities/Path.js index 19dfbef..94379f5 100644 --- a/lib/entities/Path.js +++ b/lib/entities/Path.js @@ -26,9 +26,10 @@ const entityDesc = { name: '关系路径', attr: { sourceEntity: '源对象', - value: '路径(从dest到source)', + value: '路径', destEntity: '目标对象', - recursive: '是否递归(目标对象)', + recursive: '是否递归', + desc: '描述', }, }, }, diff --git a/lib/store/IntrinsicCheckers.js b/lib/store/IntrinsicCheckers.js index 9dbb086..256bfe5 100644 --- a/lib/store/IntrinsicCheckers.js +++ b/lib/store/IntrinsicCheckers.js @@ -79,7 +79,7 @@ function createUniqueCheckers(schema) { entity, action: 'create', type: 'logicalData', - priority: types_1.CHECKER_MAX_PRIORITY, // 优先级要放在最低,所有前置的checker/trigger将数据完整之后再在这里检测 + priority: types_1.CHECKER_MAX_PRIORITY, checker: (operation, context) => { const { data } = operation; if (data instanceof Array) { @@ -95,9 +95,9 @@ function createUniqueCheckers(schema) { } }, { entity, - action: 'update', // 只检查update,其它状态转换的action应该不会涉及unique约束的属性 + action: 'update', type: 'logicalData', - priority: types_1.CHECKER_MAX_PRIORITY, // 优先级要放在最低,所有前置的checker/trigger将数据完整之后再在这里检测 + priority: types_1.CHECKER_MAX_PRIORITY, checker: (operation, context) => { const { data, filter: operationFilter } = operation; if (data) { @@ -227,7 +227,7 @@ function createActionTransformerCheckers(actionDefDict) { action: 'create', type: 'logical', entity, - priority: 10, // 优先级要高,先于真正的data检查进行 + priority: 10, checker: (operation) => { const { data } = operation; if (data instanceof Array) { diff --git a/lib/utils/assert.d.ts b/lib/utils/assert.d.ts index 932ffd1..c502695 100644 --- a/lib/utils/assert.d.ts +++ b/lib/utils/assert.d.ts @@ -1,4 +1,3 @@ -/// /** * 防止assert打包体积过大,从这里引用 */ diff --git a/lib/utils/relationPath.js b/lib/utils/relationPath.js index 03a5133..00c7c5e 100644 --- a/lib/utils/relationPath.js +++ b/lib/utils/relationPath.js @@ -60,7 +60,7 @@ function destructRelationPath(schema, entity, path, relationFilter, recursive) { }, filter: relationFilter, } // as ED['userRelation']['Selection'] - }, // as ED[keyof ED]['Selection']['data'], + }, getData: (d) => { return d.userRelation$entity; }, diff --git a/src/entities/Path.ts b/src/entities/Path.ts index 1b75bd1..0b0427e 100644 --- a/src/entities/Path.ts +++ b/src/entities/Path.ts @@ -7,6 +7,7 @@ export interface Schema extends EntityShape { value: String<256>; recursive: Boolean; sourceEntity: String<32>; + desc?: String<256>; }; const entityDesc: EntityDesc = { @@ -34,9 +35,10 @@ const entityDesc: EntityDesc = { name: '关系路径', attr: { sourceEntity: '源对象', - value: '路径(从dest到source)', + value: '路径', destEntity: '目标对象', - recursive: '是否递归(目标对象)', + recursive: '是否递归', + desc: '描述', }, }, },