From 28b44dd68cb6eb5ce9ce6f6d91bc9535eab15963 Mon Sep 17 00:00:00 2001 From: Xc Date: Mon, 12 Jun 2023 19:32:26 +0800 Subject: [PATCH 1/9] 2.6.10-dev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d12c3c..59e93dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oak-domain", - "version": "2.6.9", + "version": "2.6.10", "author": { "name": "XuChang" }, From 96637ffac82d2df59912c472fbd2dc9952b1d69b Mon Sep 17 00:00:00 2001 From: wenjiarui Date: Mon, 26 Jun 2023 13:41:39 +0800 Subject: [PATCH 2/9] =?UTF-8?q?exportExcel=E6=94=AF=E6=8C=81=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E8=A1=A8=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/types/Port.d.ts | 7 ++++--- src/types/Port.ts | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index 8e0519a..36e71d6 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -1,12 +1,13 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict } from "./Entity"; -export declare type Exportation = { +export declare type Exportation = { name: string; id: string; entity: T; projection: ED[T]['Selection']['data']; - headers: K[]; - fn: (data: ED[T]['Schema']) => Partial>; + headers?: string[]; + makeHeaders?: (dataList: Partial[]) => string[]; + fn: (data: ED[T]['Schema']) => Partial>; }; export declare type Importation = { name: string; diff --git a/src/types/Port.ts b/src/types/Port.ts index bb35b31..cf1f49c 100644 --- a/src/types/Port.ts +++ b/src/types/Port.ts @@ -2,13 +2,14 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { SyncContext } from "../store/SyncRowStore"; import { EntityDict } from "./Entity"; -export type Exportation = { +export type Exportation = { name: string; id: string; entity: T; projection: ED[T]['Selection']['data']; - headers: K[]; - fn: (data: ED[T]['Schema']) => Partial>; + headers?: string[]; + makeHeaders?: (dataList: Partial[]) => string[]; + fn: (data: ED[T]['Schema']) => Partial>; }; export type Importation = { @@ -17,5 +18,5 @@ export type Importation>[], context: AsyncContext, option?: Record ) => Promise; + fn: (data: Partial>[], context: AsyncContext, option?: Record) => Promise; }; \ No newline at end of file From cfdbe7f868cffc7cb5a9ff8f145cb31acbe4513a Mon Sep 17 00:00:00 2001 From: wenjiarui Date: Mon, 26 Jun 2023 18:03:38 +0800 Subject: [PATCH 3/9] =?UTF-8?q?exportexcel=E5=A2=9E=E5=8A=A0context?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/types/Port.d.ts | 2 +- src/types/Port.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index 36e71d6..17b281b 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -7,7 +7,7 @@ export declare type Exportation = { projection: ED[T]['Selection']['data']; headers?: string[]; makeHeaders?: (dataList: Partial[]) => string[]; - fn: (data: ED[T]['Schema']) => Partial>; + fn: (data: ED[T]['Schema'], context: AsyncContext) => Promise>>; }; export declare type Importation = { name: string; diff --git a/src/types/Port.ts b/src/types/Port.ts index cf1f49c..91666ec 100644 --- a/src/types/Port.ts +++ b/src/types/Port.ts @@ -9,7 +9,7 @@ export type Exportation = { projection: ED[T]['Selection']['data']; headers?: string[]; makeHeaders?: (dataList: Partial[]) => string[]; - fn: (data: ED[T]['Schema']) => Partial>; + fn: (data: ED[T]['Schema'], context: AsyncContext) => Promise>>; }; export type Importation = { From 780dbc80ecbff8e8bd66ab61460600ee89209ed8 Mon Sep 17 00:00:00 2001 From: wenjiarui Date: Mon, 26 Jun 2023 18:43:17 +0800 Subject: [PATCH 4/9] =?UTF-8?q?export=E5=A2=9E=E5=8A=A0properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/types/Port.d.ts | 2 +- src/types/Port.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index 17b281b..551a0a3 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -7,7 +7,7 @@ export declare type Exportation = { projection: ED[T]['Selection']['data']; headers?: string[]; makeHeaders?: (dataList: Partial[]) => string[]; - fn: (data: ED[T]['Schema'], context: AsyncContext) => Promise>>; + fn: (data: ED[T]['Schema'], context: AsyncContext, properties?: Record) => Promise>>; }; export declare type Importation = { name: string; diff --git a/src/types/Port.ts b/src/types/Port.ts index 91666ec..3e42b3c 100644 --- a/src/types/Port.ts +++ b/src/types/Port.ts @@ -9,7 +9,7 @@ export type Exportation = { projection: ED[T]['Selection']['data']; headers?: string[]; makeHeaders?: (dataList: Partial[]) => string[]; - fn: (data: ED[T]['Schema'], context: AsyncContext) => Promise>>; + fn: (data: ED[T]['Schema'], context: AsyncContext, properties?: Record) => Promise>>; }; export type Importation = { From ed14051fe995433b6f608fc5cac6d39341ca0f92 Mon Sep 17 00:00:00 2001 From: wenjiarui Date: Wed, 28 Jun 2023 10:19:40 +0800 Subject: [PATCH 5/9] =?UTF-8?q?export=E5=85=BC=E5=AE=B9=E6=97=A7=E5=86=99?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/actions/action.d.ts | 16 ++-- lib/actions/relation.d.ts | 2 +- lib/base-app-domain/ActionAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/EntityDict.d.ts | 2 +- lib/base-app-domain/Modi/Action.d.ts | 8 +- lib/base-app-domain/Modi/Schema.d.ts | 48 +++++----- lib/base-app-domain/ModiEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Oper/Schema.d.ts | 52 +++++----- lib/base-app-domain/OperEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Relation/Schema.d.ts | 48 +++++----- lib/base-app-domain/RelationAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/User/Action.d.ts | 8 +- lib/base-app-domain/User/Schema.d.ts | 48 +++++----- .../UserEntityGrant/Schema.d.ts | 48 +++++----- lib/base-app-domain/UserRelation/Schema.d.ts | 56 +++++------ lib/base-app-domain/_SubQuery.d.ts | 20 ++-- lib/entities/ActionAuth.d.ts | 2 +- lib/entities/RelationAuth.d.ts | 2 +- lib/store/TriggerExecutor.d.ts | 2 +- lib/timers/oper.d.ts | 2 +- lib/timers/vaccum.d.ts | 4 +- lib/types/Action.d.ts | 14 +-- lib/types/Auth.d.ts | 18 ++-- lib/types/DataType.d.ts | 34 +++---- lib/types/Demand.d.ts | 46 ++++----- lib/types/Endpoint.d.ts | 2 +- lib/types/Entity.d.ts | 94 +++++++++---------- lib/types/Expression.d.ts | 28 +++--- lib/types/Geo.d.ts | 12 +-- lib/types/Locale.d.ts | 10 +- lib/types/Polyfill.d.ts | 18 ++-- lib/types/Port.d.ts | 6 +- lib/types/RowStore.d.ts | 6 +- lib/types/Storage.d.ts | 8 +- lib/types/Style.d.ts | 4 +- lib/types/Timer.d.ts | 6 +- lib/types/Trigger.d.ts | 10 +- lib/types/Watcher.d.ts | 4 +- lib/types/schema/DataTypes.d.ts | 14 +-- lib/utils/concurrent.d.ts | 2 +- lib/utils/uuid.d.ts | 2 +- lib/utils/validator.d.ts | 4 +- src/types/Port.ts | 6 +- 43 files changed, 488 insertions(+), 488 deletions(-) diff --git a/lib/actions/action.d.ts b/lib/actions/action.d.ts index 7bec7e8..05b9e4f 100644 --- a/lib/actions/action.d.ts +++ b/lib/actions/action.d.ts @@ -1,16 +1,16 @@ import { ActionDef } from '../types/Action'; -export declare type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; -export declare type AppendOnlyAction = ReadOnlyAction | 'create'; -export declare type ExcludeUpdateAction = AppendOnlyAction | 'remove'; -export declare type ExcludeRemoveAction = AppendOnlyAction | 'update'; -export declare type GenericAction = 'update' | ExcludeUpdateAction; -export declare type RelationAction = 'grant' | 'revoke'; +export type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; +export type AppendOnlyAction = ReadOnlyAction | 'create'; +export type ExcludeUpdateAction = AppendOnlyAction | 'remove'; +export type ExcludeRemoveAction = AppendOnlyAction | 'update'; +export type GenericAction = 'update' | ExcludeUpdateAction; +export type RelationAction = 'grant' | 'revoke'; export declare const readOnlyActions: string[]; export declare const appendOnlyActions: string[]; export declare const excludeUpdateActions: string[]; export declare const exludeRemoveActions: string[]; export declare const genericActions: string[]; export declare const relationActions: string[]; -export declare type AbleAction = 'enable' | 'disable'; -export declare type AbleState = 'enabled' | 'disabled'; +export type AbleAction = 'enable' | 'disable'; +export type AbleState = 'enabled' | 'disabled'; export declare const makeAbleActionDef: (initialState?: AbleState) => ActionDef; diff --git a/lib/actions/relation.d.ts b/lib/actions/relation.d.ts index a53fb29..1f379bb 100644 --- a/lib/actions/relation.d.ts +++ b/lib/actions/relation.d.ts @@ -1,5 +1,5 @@ import { CascadeRelationItem, RelationHierarchy, EntityDict } from "../types/Entity"; -export declare type GenericRelation = 'owner'; +export type GenericRelation = 'owner'; export declare function convertHierarchyToAuth(entity: T, hierarchy: RelationHierarchy>): { [K in NonNullable]?: CascadeRelationItem; }; diff --git a/lib/base-app-domain/ActionAuth/Schema.d.ts b/lib/base-app-domain/ActionAuth/Schema.d.ts index 7b7aad0..16b65df 100644 --- a/lib/base-app-domain/ActionAuth/Schema.d.ts +++ b/lib/base-app-domain/ActionAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -declare type Actions = string[]; -export declare type OpSchema = EntityShape & { +type Actions = string[]; +export type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deActions: Actions; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.ActionAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ declare type AttrFilter = { destEntity: Q_StringValue; deActions: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type ActionAuthIdProjection = OneOf<{ +type ActionAuthIdProjection = OneOf<{ id: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ relationId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type RelationIdSubQuery = Selection; -export declare type ActionAuthIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type RelationIdSubQuery = Selection; +export type ActionAuthIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/EntityDict.d.ts b/lib/base-app-domain/EntityDict.d.ts index 73937b9..4f8ea25 100644 --- a/lib/base-app-domain/EntityDict.d.ts +++ b/lib/base-app-domain/EntityDict.d.ts @@ -8,7 +8,7 @@ import { EntityDef as RelationAuth } from "./RelationAuth/Schema"; import { EntityDef as User } from "./User/Schema"; import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema"; import { EntityDef as UserRelation } from "./UserRelation/Schema"; -export declare type EntityDict = { +export type EntityDict = { actionAuth: ActionAuth; modi: Modi; modiEntity: ModiEntity; diff --git a/lib/base-app-domain/Modi/Action.d.ts b/lib/base-app-domain/Modi/Action.d.ts index 0cae5fa..ecb0a21 100644 --- a/lib/base-app-domain/Modi/Action.d.ts +++ b/lib/base-app-domain/Modi/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction } from "../../actions/action"; -export declare type IState = 'active' | 'applied' | 'abandoned' | string; -export declare type IAction = 'apply' | 'abandon' | string; -export declare type ParticularAction = IAction; -export declare type Action = GenericAction | ParticularAction | string; +export type IState = 'active' | 'applied' | 'abandoned' | string; +export type IAction = 'apply' | 'abandon' | string; +export type ParticularAction = IAction; +export type Action = GenericAction | ParticularAction | string; export declare const actions: string[]; export declare const ActionDefDict: { iState: ActionDef; diff --git a/lib/base-app-domain/Modi/Schema.d.ts b/lib/base-app-domain/Modi/Schema.d.ts index 30dc913..8607bf1 100644 --- a/lib/base-app-domain/Modi/Schema.d.ts +++ b/lib/base-app-domain/Modi/Schema.d.ts @@ -5,7 +5,7 @@ import * as SubQuery from "../_SubQuery"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity"; import { Action, ParticularAction, IState } from "./Action"; import * as ModiEntity from "../ModiEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -15,8 +15,8 @@ export declare type OpSchema = EntityShape & { extra?: Object | null; iState?: IState | null; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -30,7 +30,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.ModiIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ declare type AttrFilter = { extra: Object; iState: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -67,10 +67,10 @@ export declare type Projection = { $entity: "modiEntity"; }; } & Partial>; -declare type ModiIdProjection = OneOf<{ +type ModiIdProjection = OneOf<{ id: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -91,34 +91,34 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & ({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; }) & { modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData & { +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {}; -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type ModiIdSubQuery = Selection; -export declare type EntityDef = { +export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {}; +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type ModiIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/ModiEntity/Schema.d.ts b/lib/base-app-domain/ModiEntity/Schema.d.ts index 3b27a68..7ed5bc0 100644 --- a/lib/base-app-domain/ModiEntity/Schema.d.ts +++ b/lib/base-app-domain/ModiEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.ModiEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ declare type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export declare type Filter> = MakeFilter & ExprOp>; -export declare type Projection = { +export type Filter> = MakeFilter & ExprOp>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export declare type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -declare type ModiEntityIdProjection = OneOf<{ +type ModiEntityIdProjection = OneOf<{ id: number; }>; -declare type ModiIdProjection = OneOf<{ +type ModiIdProjection = OneOf<{ modiId: number; }>; -declare type ActionAuthIdProjection = OneOf<{ +type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ entityId: number; }>; -declare type RelationAuthIdProjection = OneOf<{ +type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ entityId: number; }>; -declare type UserEntityGrantIdProjection = OneOf<{ +type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -declare type UserRelationIdProjection = OneOf<{ +type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ modiId?: never; modi: Modi.CreateSingleOperation; } | { @@ -208,10 +208,10 @@ export declare type CreateOperationData = FormCreateData; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ modi: Modi.CreateSingleOperation; modiId?: never; } | { @@ -253,8 +253,8 @@ export declare type UpdateOperationData = FormUpdateData; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ modi?: Modi.UpdateOperation | Modi.RemoveOperation; })) & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; @@ -271,17 +271,17 @@ export declare type RemoveOperationData = {} & (({ } | { [k: string]: any; }); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type ModiIdSubQuery = Selection; -export declare type ActionAuthIdSubQuery = Selection; -export declare type RelationIdSubQuery = Selection; -export declare type RelationAuthIdSubQuery = Selection; -export declare type UserIdSubQuery = Selection; -export declare type UserEntityGrantIdSubQuery = Selection; -export declare type UserRelationIdSubQuery = Selection; -export declare type ModiEntityIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type ModiIdSubQuery = Selection; +export type ActionAuthIdSubQuery = Selection; +export type RelationIdSubQuery = Selection; +export type RelationAuthIdSubQuery = Selection; +export type UserIdSubQuery = Selection; +export type UserEntityGrantIdSubQuery = Selection; +export type UserRelationIdSubQuery = Selection; +export type ModiEntityIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Oper/Schema.d.ts b/lib/base-app-domain/Oper/Schema.d.ts index 781eb05..06d73c8 100644 --- a/lib/base-app-domain/Oper/Schema.d.ts +++ b/lib/base-app-domain/Oper/Schema.d.ts @@ -6,7 +6,7 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { AppendOnlyAction } from "../../actions/action"; import * as User from "../User/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -14,8 +14,8 @@ export declare type OpSchema = EntityShape & { operatorId?: ForeignKey<"user"> | null; targetEntity: String<32>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -28,7 +28,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.OperIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -41,8 +41,8 @@ declare type AttrFilter = { operator: User.Filter; targetEntity: Q_StringValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -63,13 +63,13 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type OperIdProjection = OneOf<{ +type OperIdProjection = OneOf<{ id: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ operatorId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ operatorId?: never; operator?: User.CreateSingleOperation; } | { @@ -107,10 +107,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ operator: User.CreateSingleOperation; operatorId?: never; } | { @@ -126,15 +126,15 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ operator?: User.UpdateOperation | User.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserIdSubQuery = Selection; -export declare type OperIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserIdSubQuery = Selection; +export type OperIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/OperEntity/Schema.d.ts b/lib/base-app-domain/OperEntity/Schema.d.ts index e3ca574..c9200bd 100644 --- a/lib/base-app-domain/OperEntity/Schema.d.ts +++ b/lib/base-app-domain/OperEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.OperEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ declare type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export declare type Filter> = MakeFilter & ExprOp>; -export declare type Projection = { +export type Filter> = MakeFilter & ExprOp>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export declare type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -declare type OperEntityIdProjection = OneOf<{ +type OperEntityIdProjection = OneOf<{ id: number; }>; -declare type OperIdProjection = OneOf<{ +type OperIdProjection = OneOf<{ operId: number; }>; -declare type ActionAuthIdProjection = OneOf<{ +type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ entityId: number; }>; -declare type RelationAuthIdProjection = OneOf<{ +type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ entityId: number; }>; -declare type UserEntityGrantIdProjection = OneOf<{ +type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -declare type UserRelationIdProjection = OneOf<{ +type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ operId?: never; oper: Oper.CreateSingleOperation; } | { @@ -205,10 +205,10 @@ export declare type CreateOperationData = FormCreateData; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ oper: Oper.CreateSingleOperation; operId?: never; } | { @@ -244,8 +244,8 @@ export declare type UpdateOperationData = FormUpdateData; -export declare type RemoveOperationData = {} & ({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; } | { relation?: Relation.UpdateOperation | Relation.RemoveOperation; @@ -260,17 +260,17 @@ export declare type RemoveOperationData = {} & ({ } | { [k: string]: any; }); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type OperIdSubQuery = Selection; -export declare type ActionAuthIdSubQuery = Selection; -export declare type RelationIdSubQuery = Selection; -export declare type RelationAuthIdSubQuery = Selection; -export declare type UserIdSubQuery = Selection; -export declare type UserEntityGrantIdSubQuery = Selection; -export declare type UserRelationIdSubQuery = Selection; -export declare type OperEntityIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type OperIdSubQuery = Selection; +export type ActionAuthIdSubQuery = Selection; +export type RelationIdSubQuery = Selection; +export type RelationAuthIdSubQuery = Selection; +export type UserIdSubQuery = Selection; +export type UserEntityGrantIdSubQuery = Selection; +export type UserRelationIdSubQuery = Selection; +export type OperEntityIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Relation/Schema.d.ts b/lib/base-app-domain/Relation/Schema.d.ts index fbf5182..6fdc81c 100644 --- a/lib/base-app-domain/Relation/Schema.d.ts +++ b/lib/base-app-domain/Relation/Schema.d.ts @@ -9,14 +9,14 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; display: String<32>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; @@ -34,7 +34,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.RelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ declare type AttrFilter = { name: Q_StringValue; display: Q_StringValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -87,10 +87,10 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ id: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -109,15 +109,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & ({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -128,10 +128,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData & { +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData & { [k: string]: any; actionAuth$relation?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation>; relationAuth$relation?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation>; @@ -139,12 +139,12 @@ export declare type UpdateOperationData = FormUpdateData & { modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {}; -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type RelationIdSubQuery = Selection; -export declare type EntityDef = { +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {}; +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type RelationIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/RelationAuth/Schema.d.ts b/lib/base-app-domain/RelationAuth/Schema.d.ts index 447ab6d..1573262 100644 --- a/lib/base-app-domain/RelationAuth/Schema.d.ts +++ b/lib/base-app-domain/RelationAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -declare type Relations = string[]; -export declare type OpSchema = EntityShape & { +type Relations = string[]; +export type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deRelations: Relations; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.RelationAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ declare type AttrFilter = { destEntity: Q_StringValue; deRelations: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type RelationAuthIdProjection = OneOf<{ +type RelationAuthIdProjection = OneOf<{ id: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ relationId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type RelationIdSubQuery = Selection; -export declare type RelationAuthIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type RelationIdSubQuery = Selection; +export type RelationAuthIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/User/Action.d.ts b/lib/base-app-domain/User/Action.d.ts index 84cc307..46ad254 100644 --- a/lib/base-app-domain/User/Action.d.ts +++ b/lib/base-app-domain/User/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction, RelationAction } from "../../actions/action"; -export declare type UserAction = 'mergeTo' | string; -export declare type UserState = 'normal' | 'merged' | string; -export declare type ParticularAction = UserAction; -export declare type Action = GenericAction | ParticularAction | RelationAction | string; +export type UserAction = 'mergeTo' | string; +export type UserState = 'normal' | 'merged' | string; +export type ParticularAction = UserAction; +export type Action = GenericAction | ParticularAction | RelationAction | string; export declare const actions: string[]; export declare const ActionDefDict: { userState: ActionDef; diff --git a/lib/base-app-domain/User/Schema.d.ts b/lib/base-app-domain/User/Schema.d.ts index ce598a7..d71b44c 100644 --- a/lib/base-app-domain/User/Schema.d.ts +++ b/lib/base-app-domain/User/Schema.d.ts @@ -9,15 +9,15 @@ import * as Oper from "../Oper/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; userState?: UserState | null; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; @@ -37,7 +37,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.UserIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -49,8 +49,8 @@ declare type AttrFilter = { ref: Filter; userState: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -94,11 +94,11 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ id: number; refId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ refId?: never; ref?: CreateSingleOperation; } | { @@ -144,10 +144,10 @@ export declare type CreateOperationData = FormCreateData modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ ref: CreateSingleOperation; refId?: never; } | { @@ -167,14 +167,14 @@ export declare type UpdateOperationData = FormUpdateData modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ ref?: UpdateOperation | RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserEntityGrant/Schema.d.ts b/lib/base-app-domain/UserEntityGrant/Schema.d.ts index 6334c2e..2d28afe 100644 --- a/lib/base-app-domain/UserEntityGrant/Schema.d.ts +++ b/lib/base-app-domain/UserEntityGrant/Schema.d.ts @@ -6,13 +6,13 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { GenericAction } from "../../actions/action"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; @@ -23,7 +23,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -32,8 +32,8 @@ declare type AttrFilter = { entityId: Q_StringValue; relation: Q_StringValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -56,10 +56,10 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type UserEntityGrantIdProjection = OneOf<{ +type UserEntityGrantIdProjection = OneOf<{ id: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -76,15 +76,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & ({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -92,20 +92,20 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData & { +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {}; -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserEntityGrantIdSubQuery = Selection; -export declare type EntityDef = { +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {}; +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserEntityGrantIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserRelation/Schema.d.ts b/lib/base-app-domain/UserRelation/Schema.d.ts index 319fa71..ff97ead 100644 --- a/lib/base-app-domain/UserRelation/Schema.d.ts +++ b/lib/base-app-domain/UserRelation/Schema.d.ts @@ -8,12 +8,12 @@ import * as User from "../User/Schema"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; user: User.Schema; @@ -25,7 +25,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.UserRelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -35,8 +35,8 @@ declare type AttrFilter = { relationId: Q_StringValue | SubQuery.RelationIdSubQuery; relation: Relation.Filter; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -60,16 +60,16 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type UserRelationIdProjection = OneOf<{ +type UserRelationIdProjection = OneOf<{ id: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ userId: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ relationId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ userId?: never; user: User.CreateSingleOperation; } | { @@ -116,10 +116,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ user: User.CreateSingleOperation; userId?: never; } | { @@ -148,18 +148,18 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ user?: User.UpdateOperation | User.RemoveOperation; }) & ({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserIdSubQuery = Selection; -export declare type RelationIdSubQuery = Selection; -export declare type UserRelationIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserIdSubQuery = Selection; +export type RelationIdSubQuery = Selection; +export type UserRelationIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/_SubQuery.d.ts b/lib/base-app-domain/_SubQuery.d.ts index d69d357..c719b6f 100644 --- a/lib/base-app-domain/_SubQuery.d.ts +++ b/lib/base-app-domain/_SubQuery.d.ts @@ -8,36 +8,36 @@ import * as RelationAuth from "./RelationAuth/Schema"; import * as User from "./User/Schema"; import * as UserEntityGrant from "./UserEntityGrant/Schema"; import * as UserRelation from "./UserRelation/Schema"; -export declare type ActionAuthIdSubQuery = { +export type ActionAuthIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.ActionAuthIdSubQuery & { entity: "actionAuth"; }) | any; }; -export declare type ModiIdSubQuery = { +export type ModiIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiIdSubQuery & { entity: "modiEntity"; }) | (Modi.ModiIdSubQuery & { entity: "modi"; }) | any; }; -export declare type ModiEntityIdSubQuery = { +export type ModiEntityIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiEntityIdSubQuery & { entity: "modiEntity"; }) | any; }; -export declare type OperIdSubQuery = { +export type OperIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperIdSubQuery & { entity: "operEntity"; }) | (Oper.OperIdSubQuery & { entity: "oper"; }) | any; }; -export declare type OperEntityIdSubQuery = { +export type OperEntityIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperEntityIdSubQuery & { entity: "operEntity"; }) | any; }; -export declare type RelationIdSubQuery = { +export type RelationIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.RelationIdSubQuery & { entity: "actionAuth"; }) | (RelationAuth.RelationIdSubQuery & { @@ -48,12 +48,12 @@ export declare type RelationIdSubQuery = { entity: "relation"; }) | any; }; -export declare type RelationAuthIdSubQuery = { +export type RelationAuthIdSubQuery = { [K in "$in" | "$nin"]?: (RelationAuth.RelationAuthIdSubQuery & { entity: "relationAuth"; }) | any; }; -export declare type UserIdSubQuery = { +export type UserIdSubQuery = { [K in "$in" | "$nin"]?: (Oper.UserIdSubQuery & { entity: "oper"; }) | (User.UserIdSubQuery & { @@ -64,12 +64,12 @@ export declare type UserIdSubQuery = { entity: "user"; }) | any; }; -export declare type UserEntityGrantIdSubQuery = { +export type UserEntityGrantIdSubQuery = { [K in "$in" | "$nin"]?: (UserEntityGrant.UserEntityGrantIdSubQuery & { entity: "userEntityGrant"; }) | any; }; -export declare type UserRelationIdSubQuery = { +export type UserRelationIdSubQuery = { [K in "$in" | "$nin"]?: (UserRelation.UserRelationIdSubQuery & { entity: "userRelation"; }) | any; diff --git a/lib/entities/ActionAuth.d.ts b/lib/entities/ActionAuth.d.ts index c57a16c..9944266 100644 --- a/lib/entities/ActionAuth.d.ts +++ b/lib/entities/ActionAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -declare type Actions = string[]; +type Actions = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/entities/RelationAuth.d.ts b/lib/entities/RelationAuth.d.ts index dc79db5..8529abb 100644 --- a/lib/entities/RelationAuth.d.ts +++ b/lib/entities/RelationAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -declare type Relations = string[]; +type Relations = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/store/TriggerExecutor.d.ts b/lib/store/TriggerExecutor.d.ts index d63a7ed..77253f7 100644 --- a/lib/store/TriggerExecutor.d.ts +++ b/lib/store/TriggerExecutor.d.ts @@ -16,7 +16,7 @@ export declare class TriggerExecutor { private contextBuilder; constructor(contextBuilder: (cxtString: string) => Promise>, logger?: Logger); registerChecker>(checker: Checker): void; - getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[] | undefined; + getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[]; registerTrigger>(trigger: Trigger): void; unregisterTrigger>(trigger: Trigger): void; private preCommitTrigger; diff --git a/lib/timers/oper.d.ts b/lib/timers/oper.d.ts index 9eebe95..0e7e3ac 100644 --- a/lib/timers/oper.d.ts +++ b/lib/timers/oper.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -export declare type VaccumOperOption = { +export type VaccumOperOption = { aliveLine: number; excludeOpers?: { [T in keyof ED]?: ED[T]['Action'][]; diff --git a/lib/timers/vaccum.d.ts b/lib/timers/vaccum.d.ts index bd3ef80..b354f19 100644 --- a/lib/timers/vaccum.d.ts +++ b/lib/timers/vaccum.d.ts @@ -1,12 +1,12 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -declare type VaccumOptionEntity = { +type VaccumOptionEntity = { entity: T; filter?: ED[T]['Selection']['filter']; aliveLine: number; }; -declare type VaccumOption = { +type VaccumOption = { entities: Array>; backupDir?: string; zip?: boolean; diff --git a/lib/types/Action.d.ts b/lib/types/Action.d.ts index 1dc6ee7..e646b40 100644 --- a/lib/types/Action.d.ts +++ b/lib/types/Action.d.ts @@ -1,20 +1,20 @@ import { CascadeRelationItem, EntityDict } from "./Entity"; import { GenericAction } from '../actions/action'; -export declare type Action = string; -export declare type State = string; -export declare type ActionDef = { +export type Action = string; +export type State = string; +export type ActionDef = { stm: { [a in A]: [p: S | S[], n: S]; }; is?: S; }; -export declare type ActionDictOfEntityDict = { +export type ActionDictOfEntityDict = { [T in keyof E]?: { [A in keyof E[T]['OpSchema']]?: ActionDef; }; }; -export declare type CascadeActionItem = CascadeRelationItem; -export declare type CascadeActionAuth = { +export type CascadeActionItem = CascadeRelationItem; +export type CascadeActionAuth = { [K in A | GenericAction]?: CascadeActionItem | (CascadeActionItem | CascadeActionItem[])[]; }; -export declare type ActionOnRemove = 'setNull' | 'remove'; +export type ActionOnRemove = 'setNull' | 'remove'; diff --git a/lib/types/Auth.d.ts b/lib/types/Auth.d.ts index 2023c39..c7c86d6 100644 --- a/lib/types/Auth.d.ts +++ b/lib/types/Auth.d.ts @@ -2,12 +2,12 @@ import { CascadeActionAuth, CascadeRelationAuth, ActionOnRemove, SyncOrAsync } f import { AsyncContext } from "../store/AsyncRowStore"; import { SyncContext } from "../store/SyncRowStore"; import { EntityDict, OperateOption, SelectOption } from "../types/Entity"; -export declare type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; +export type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; /** * conditionalFilter是指该action发生时,operation所操作的行中有满足conditionalFilter的行 * 被转化成trigger的filter条件,详细可看trigger中的说明 */ -export declare type DataChecker | SyncContext> = { +export type DataChecker | SyncContext> = { priority?: number; type: 'data'; entity: T; @@ -15,7 +15,7 @@ export declare type DataChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type RowChecker | SyncContext> = { +export type RowChecker | SyncContext> = { priority?: number; type: 'row'; entity: T; @@ -28,7 +28,7 @@ export declare type RowChecker SyncOrAsync); }; -export declare type RelationChecker | SyncContext> = { +export type RelationChecker | SyncContext> = { priority?: number; type: 'relation'; entity: T; @@ -38,7 +38,7 @@ export declare type RelationChecker string); conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type LogicalChecker | SyncContext> = { +export type LogicalChecker | SyncContext> = { priority?: number; type: 'logical'; when?: 'after'; @@ -47,7 +47,7 @@ export declare type LogicalChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type LogicalRelationChecker | SyncContext> = { +export type LogicalRelationChecker | SyncContext> = { priority?: number; type: 'logicalRelation'; when?: 'after'; @@ -56,14 +56,14 @@ export declare type LogicalRelationChecker any | Promise; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; -export declare type AuthDef = { +export type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; +export type AuthDef = { relationAuth?: CascadeRelationAuth>; actionAuth?: CascadeActionAuth; cascadeRemove?: { [E in (keyof ED | keyof ED[T]['Schema'] | '@entity')]?: ActionOnRemove; }; }; -export declare type AuthDefDict = { +export type AuthDefDict = { [K in keyof ED]?: AuthDef; }; diff --git a/lib/types/DataType.d.ts b/lib/types/DataType.d.ts index e3b63be..df83a90 100644 --- a/lib/types/DataType.d.ts +++ b/lib/types/DataType.d.ts @@ -1,21 +1,21 @@ import { Geo, SingleGeo } from "./Geo"; -export declare type Int = number; -export declare type Uint = number; -export declare type Double

= number; -export declare type Float

= number; -export declare type String = string; -export declare type Text = string; -export declare type Image = string; -export declare type File = string; -export declare type Datetime = number | Date; -export declare type Day = number | Date; -export declare type Time = number | Date; -export declare type Boolean = boolean; -export declare type Price = number; -export declare type PrimaryKey = string; -export declare type ForeignKey = string; -export declare type Sequence = string; +export type Int = number; +export type Uint = number; +export type Double

= number; +export type Float

= number; +export type String = string; +export type Text = string; +export type Image = string; +export type File = string; +export type Datetime = number | Date; +export type Day = number | Date; +export type Time = number | Date; +export type Boolean = boolean; +export type Price = number; +export type PrimaryKey = string; +export type ForeignKey = string; +export type Sequence = string; export { Geo, SingleGeo } from './Geo'; -export declare type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; +export type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; export declare const types: string[]; export declare const unIndexedTypes: string[]; diff --git a/lib/types/Demand.d.ts b/lib/types/Demand.d.ts index c2605fe..041672f 100644 --- a/lib/types/Demand.d.ts +++ b/lib/types/Demand.d.ts @@ -1,12 +1,12 @@ import { RefOrExpression } from "./Expression"; import { OneOf } from "./Polyfill"; export declare const EXPRESSION_PREFIX = "$expr"; -export declare type NodeId = `node-${number}`; -export declare type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; -export declare type ExprOp = { +export type NodeId = `node-${number}`; +export type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; +export type ExprOp = { [K in ExpressionKey]: RefOrExpression; }; -export declare type Q_NumberComparisonValue = number | OneOf<{ +export type Q_NumberComparisonValue = number | OneOf<{ $gt: number; $lt: number; $gte: number; @@ -17,7 +17,7 @@ export declare type Q_NumberComparisonValue = number | OneOf<{ $nin: number[]; $between: [number, number]; }>; -export declare type Q_StringComparisonValue = string | OneOf<{ +export type Q_StringComparisonValue = string | OneOf<{ $gt: string; $lt: string; $gte: string; @@ -30,44 +30,44 @@ export declare type Q_StringComparisonValue = string | OneOf<{ $in: string[]; $nin: string[]; }>; -export declare type Q_BooleanComparisonValue = boolean; -export declare type Q_DateComparisonValue = Q_NumberComparisonValue; -export declare type Q_EnumComparisonValue = E | OneOf<{ +export type Q_BooleanComparisonValue = boolean; +export type Q_DateComparisonValue = Q_NumberComparisonValue; +export type Q_EnumComparisonValue = E | OneOf<{ $in: E[]; $nin: E[]; }>; -export declare type Q_ExistsValue = { +export type Q_ExistsValue = { $exists: boolean; }; -export declare type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; -export declare type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; -export declare type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; -export declare type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; -export declare type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; -export declare type Q_State = S | { +export type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; +export type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; +export type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; +export type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; +export type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; +export type Q_State = S | { $in: S[]; } | { $nin: S[]; } | Q_ExistsValue; -export declare type Q_FullTextValue = { +export type Q_FullTextValue = { $search: string; $language?: 'zh_CN' | 'en_US'; }; -export declare type Q_FullTextKey = '$text'; -export declare type FulltextFilter = { +export type Q_FullTextKey = '$text'; +export type FulltextFilter = { [F in Q_FullTextKey]?: Q_FullTextValue; }; -declare type Q_LogicKey = '$and' | '$or'; -declare type Q_LinearLogicKey = '$not'; -export declare type MakeFilterWrapper = { +type Q_LogicKey = '$and' | '$or'; +type Q_LinearLogicKey = '$not'; +export type MakeFilterWrapper = { [Q in Q_LogicKey]?: Array>; } & { [Q in Q_LinearLogicKey]?: MakeFilterWrapper; } & Partial; -export declare type MakeFilter = { +export type MakeFilter = { '#id'?: NodeId; } & MakeFilterWrapper; -export declare type RefAttr = { +export type RefAttr = { '#attr': A; } | { '#refId': NodeId; diff --git a/lib/types/Endpoint.d.ts b/lib/types/Endpoint.d.ts index 42e425b..fa5415e 100644 --- a/lib/types/Endpoint.d.ts +++ b/lib/types/Endpoint.d.ts @@ -8,4 +8,4 @@ export interface EndpointItem, headers: IncomingHttpHeaders, req: IncomingMessage, body?: any) => Promise; } -export declare type Endpoint> = EndpointItem | EndpointItem[]; +export type Endpoint> = EndpointItem | EndpointItem[]; diff --git a/lib/types/Entity.d.ts b/lib/types/Entity.d.ts index 31a972f..08546ae 100644 --- a/lib/types/Entity.d.ts +++ b/lib/types/Entity.d.ts @@ -1,12 +1,12 @@ import { ReadOnlyAction } from '../actions/action'; import { PrimaryKey, Sequence } from './DataType'; -declare type TriggerDataAttributeType = '$$triggerData$$'; -declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; -declare type PrimaryKeyAttributeType = 'id'; -declare type CreateAtAttributeType = '$$createAt$$'; -declare type UpdateAtAttributeType = '$$updateAt$$'; -declare type DeleteAtAttributeType = '$$deleteAt$$'; -declare type SeqAttributeType = '$$seq$$'; +type TriggerDataAttributeType = '$$triggerData$$'; +type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; +type PrimaryKeyAttributeType = 'id'; +type CreateAtAttributeType = '$$createAt$$'; +type UpdateAtAttributeType = '$$updateAt$$'; +type DeleteAtAttributeType = '$$deleteAt$$'; +type SeqAttributeType = '$$seq$$'; export declare const TriggerDataAttribute = "$$triggerData$$"; export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$"; export declare const PrimaryKeyAttribute = "id"; @@ -14,14 +14,14 @@ export declare const CreateAtAttribute = "$$createAt$$"; export declare const UpdateAtAttribute = "$$updateAt$$"; export declare const DeleteAtAttribute = "$$deleteAt$$"; export declare const SeqAttribute = "$$seq$$"; -export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; +export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; export declare const initinctiveAttributes: string[]; -declare type FilterPart = { +type FilterPart = { filter?: A extends 'create' ? undefined : F; indexFrom?: A extends 'create' ? undefined : number; count?: A extends 'create' ? undefined : number; }; -export declare type SelectOption = { +export type SelectOption = { dontCollect?: boolean; blockTrigger?: true; obscure?: boolean; @@ -29,7 +29,7 @@ export declare type SelectOption = { includedDeleted?: true; dummy?: 1; }; -export declare type OperateOption = { +export type OperateOption = { blockTrigger?: true; dontCollect?: boolean; dontCreateOper?: boolean; @@ -40,19 +40,19 @@ export declare type OperateOption = { deletePhysically?: boolean; dummy?: 1; }; -export declare type FormUpdateData = Partial<{ +export type FormUpdateData = Partial<{ [K in keyof Omit]: SH[K] | null; }>; -export declare type FormCreateData = Partial> & { +export type FormCreateData = Partial> & { id: string; }; -export declare type Operation = { +export type Operation = { id: string; action: A; data: D; sorter?: S; } & FilterPart; -export declare type Selection = { +export type Selection = { id?: string; action: A; data: D; @@ -68,7 +68,7 @@ export interface EntityShape { export interface GeneralEntityShape extends EntityShape { [K: string]: any; } -export declare type MakeAction = A; +export type MakeAction = A; export interface EntityDef { Schema: GeneralEntityShape; OpSchema: GeneralEntityShape; @@ -90,79 +90,79 @@ export interface EntityDict { export interface OtmSubProjection extends Omit, 'action'> { $entity: string; } -export declare type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; -export declare type DeduceAggregationData

= { +export type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; +export type DeduceAggregationData

= { [A in AggregationOp]?: P; } & { '#aggr'?: P; }; -export declare type AggregationResult = Array<{ +export type AggregationResult = Array<{ [A in AggregationOp]?: number | string; } & { '#data'?: Partial; }>; -export declare type AttrFilter = { +export type AttrFilter = { [K in keyof SH]?: any; }; -declare type SortAttr = { +type SortAttr = { [K: string]: any; }; -declare type SorterItem = { +type SorterItem = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -declare type Sorter = Array; -declare type Filter = { +type Sorter = Array; +type Filter = { [K: string]: any; }; -declare type Projection = { +type Projection = { [K: string]: any; }; -export declare type DeduceAggregation

= Omit, F, S>, 'action'>; -declare type CreateOperationData = { +export type DeduceAggregation

= Omit, F, S>, 'action'>; +type CreateOperationData = { id: string; [K: string]: any; }; -declare type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; -declare type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; -declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -declare type UpdateOperationData = { +type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; +type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; +type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +type UpdateOperationData = { id?: never; [k: string]: any; }; -export declare type UpdateOperation = Operation; -declare type RemoveOperationData = { +export type UpdateOperation = Operation; +type RemoveOperationData = { [k: string]: any; }; -export declare type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; -export declare type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type CreateOpResult = { +export type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; +export type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; +export type CreateOpResult = { a: 'c'; e: T; d: ED[T]['OpSchema'] | ED[T]['OpSchema'][]; }; -export declare type UpdateOpResult = { +export type UpdateOpResult = { a: 'u'; e: T; d: UpdateOperationData; f?: Filter; }; -export declare type RemoveOpResult = { +export type RemoveOpResult = { a: 'r'; e: T; f?: Filter; }; -export declare type RelationHierarchy = { +export type RelationHierarchy = { [K in R]?: R[]; }; -export declare type CascadeRelationItem = { +export type CascadeRelationItem = { cascadePath: string; relations?: string[]; }; -export declare type CascadeRelationAuth = { +export type CascadeRelationAuth = { [K in R]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[]; }; -export declare type SelectOpResult = { +export type SelectOpResult = { a: 's'; d: { [T in keyof ED]?: { @@ -170,16 +170,16 @@ export declare type SelectOpResult = { }; }; }; -export declare type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; -export declare type OperationResult = { +export type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; +export type OperationResult = { [K in keyof ED]?: { [A in ED[K]['Action']]?: number; }; }; -export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; -export declare type Configuration = { +export type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; +export type Configuration = { actionType?: ActionType; static?: boolean; }; -export declare type OtmKey = K | `${K}$${number}`; +export type OtmKey = K | `${K}$${number}`; export {}; diff --git a/lib/types/Expression.d.ts b/lib/types/Expression.d.ts index cdeb126..a379eb8 100644 --- a/lib/types/Expression.d.ts +++ b/lib/types/Expression.d.ts @@ -1,8 +1,8 @@ import { RefAttr } from "./Demand"; import { Geo } from "./Geo"; -export declare type RefOrExpression = RefAttr | Expression; -declare type MathType = RefOrExpression | number; -declare type StringType = RefOrExpression | string; +export type RefOrExpression = RefAttr | Expression; +type MathType = RefOrExpression | number; +type StringType = RefOrExpression | string; interface Add { $add: (MathType)[]; } @@ -30,8 +30,8 @@ interface Ceil { interface Pow { $pow: [MathType, MathType]; } -declare type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; -declare type CmpType = RefOrExpression | string | number; +type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; +type CmpType = RefOrExpression | string | number; interface Gt { $gt: [CmpType, CmpType]; } @@ -59,14 +59,14 @@ interface EndsWith { interface Includes { $includes: [RefOrExpression | string, RefOrExpression | string]; } -declare type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; +type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; interface BoolTrue { $true: Expression; } interface BoolFalse { $false: Expression; } -declare type BoolExpression = BoolTrue | BoolFalse; +type BoolExpression = BoolTrue | BoolFalse; interface LogicAnd { $and: Expression[]; } @@ -76,7 +76,7 @@ interface LogicOr { interface LogicNot { $not: Expression; } -declare type LogicExpression = LogicAnd | LogicOr | LogicNot; +type LogicExpression = LogicAnd | LogicOr | LogicNot; interface DateYear { $year: RefOrExpression | Date | number; } @@ -110,18 +110,18 @@ interface DateCeiling { interface DateFloor { $dateFloor: [RefOrExpression | Date | number, 'y' | 'M' | 'd' | 'h' | 'm' | 's']; } -declare type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; +type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; interface StringConcat { $concat: StringType[]; } -declare type StringExpression = StringConcat; +type StringExpression = StringConcat; interface GeoContains { $contains: [RefOrExpression | Geo, RefOrExpression | Geo]; } interface GeoDistance { $distance: [RefOrExpression | Geo, RefOrExpression | Geo]; } -declare type GeoExpression = GeoContains | GeoDistance; +type GeoExpression = GeoContains | GeoDistance; interface AggrCountExpression { $$count: RefOrExpression; } @@ -137,9 +137,9 @@ interface AggrMinExpression { interface AggrAvgExpression { $$avg: RefOrExpression; } -export declare type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; -export declare type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; -export declare type ExpressionConstant = Geo | number | Date | string | boolean; +export type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; +export type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; +export type ExpressionConstant = Geo | number | Date | string | boolean; export declare function isGeoExpression(expression: any): expression is GeoExpression; export declare function isDateExpression(expression: any): expression is DateExpression; export declare function isLogicExpression(expression: any): expression is LogicExpression; diff --git a/lib/types/Geo.d.ts b/lib/types/Geo.d.ts index 1747c3f..f1ce57e 100644 --- a/lib/types/Geo.d.ts +++ b/lib/types/Geo.d.ts @@ -1,8 +1,8 @@ -export declare type Point = [number, number]; -export declare type Path = Array; -export declare type Polygon = Array; -export declare type Circle = [Point, number]; -export declare type SingleGeo = { +export type Point = [number, number]; +export type Path = Array; +export type Polygon = Array; +export type Circle = [Point, number]; +export type SingleGeo = { type: 'point'; coordinate: Point; } | { @@ -15,4 +15,4 @@ export declare type SingleGeo = { type: 'circle'; coordinate: Circle; }; -export declare type Geo = SingleGeo | SingleGeo[]; +export type Geo = SingleGeo | SingleGeo[]; diff --git a/lib/types/Locale.d.ts b/lib/types/Locale.d.ts index daac80a..9a75128 100644 --- a/lib/types/Locale.d.ts +++ b/lib/types/Locale.d.ts @@ -1,17 +1,17 @@ import { EntityShape } from "./Entity"; -declare type Language = 'zh_CN' | 'en_US'; -declare type LocaleOfSchema> = { +type Language = 'zh_CN' | 'en_US'; +type LocaleOfSchema> = { [A in keyof Required>]: string; }; -declare type LocaleOfStringEnum = { +type LocaleOfStringEnum = { [K in A]: string; }; -declare type LocaleOfValue> = { +type LocaleOfValue> = { [K in keyof V]: { [K2 in V[K]]: string; }; }; -export declare type LocaleDef, Ac extends string, R extends string, V extends Record> = { +export type LocaleDef, Ac extends string, R extends string, V extends Record> = { [L in Language]?: { name: string; attr: LocaleOfSchema & { diff --git a/lib/types/Polyfill.d.ts b/lib/types/Polyfill.d.ts index a31122b..a176b92 100644 --- a/lib/types/Polyfill.d.ts +++ b/lib/types/Polyfill.d.ts @@ -1,24 +1,24 @@ -export declare type OmitInferKey = { +export type OmitInferKey = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export declare type OmitInferValue = { +export type OmitInferValue = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export declare type ValueOf = Obj[keyof Obj]; -export declare type OneOnly = { +export type ValueOf = Obj[keyof Obj]; +export type OneOnly = { [key in Exclude]?: undefined; } & Pick; -export declare type OneOfByKey = { +export type OneOfByKey = { [key in keyof Obj]: OneOnly; }; -export declare type OneOf = ValueOf>; -declare type IsOptional = { +export type OneOf = ValueOf>; +type IsOptional = { [K1 in Exclude]: T[K1]; } & { K?: T[K]; } extends T ? K : never; -export declare type OptionalKeys = { +export type OptionalKeys = { [K in keyof T]: IsOptional; }[keyof T]; -export declare type SyncOrAsync = T | Promise; +export type SyncOrAsync = T | Promise; export {}; diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index 551a0a3..bab4f65 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -1,15 +1,15 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict } from "./Entity"; -export declare type Exportation = { +export type Exportation = { name: string; id: string; entity: T; projection: ED[T]['Selection']['data']; headers?: string[]; makeHeaders?: (dataList: Partial[]) => string[]; - fn: (data: ED[T]['Schema'], context: AsyncContext, properties?: Record) => Promise>>; + fn: (data: ED[T]['Schema'], context?: AsyncContext, properties?: Record) => Promise>> | Partial>; }; -export declare type Importation = { +export type Importation = { name: string; id: string; entity: T; diff --git a/lib/types/RowStore.d.ts b/lib/types/RowStore.d.ts index 03940e1..48407a3 100644 --- a/lib/types/RowStore.d.ts +++ b/lib/types/RowStore.d.ts @@ -1,10 +1,10 @@ import { OperationResult, EntityDict } from './Entity'; import { StorageSchema } from './Storage'; -export declare type TxnOption = { +export type TxnOption = { isolationLevel: 'repeatable read' | 'serializable'; }; -export declare type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; -export declare type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; +export type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; +export type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; export declare abstract class RowStore { protected storageSchema: StorageSchema; constructor(storageSchema: StorageSchema); diff --git a/lib/types/Storage.d.ts b/lib/types/Storage.d.ts index 946b4d2..3944003 100644 --- a/lib/types/Storage.d.ts +++ b/lib/types/Storage.d.ts @@ -1,7 +1,7 @@ import { ActionType } from '.'; import { EntityDict, EntityShape, InstinctiveAttributes } from './Entity'; import { DataType, DataTypeParams } from './schema/DataTypes'; -export declare type Ref = 'ref'; +export type Ref = 'ref'; export interface Column { name: keyof SH | `${string}State`; size?: number; @@ -28,12 +28,12 @@ export interface Attribute { sequenceStart?: number; enumeration?: string[]; } -export declare type Attributes = Omit<{ +export type Attributes = Omit<{ [attrName in keyof SH]: Attribute; }, InstinctiveAttributes>; export interface EntityConfig { } -export declare type UniqConstraint = { +export type UniqConstraint = { attributes: Array; type?: string; }; @@ -52,6 +52,6 @@ export interface StorageDesc { relation?: string[]; view?: true; } -export declare type StorageSchema = { +export type StorageSchema = { [K in keyof ED]: StorageDesc; }; diff --git a/lib/types/Style.d.ts b/lib/types/Style.d.ts index 2c643b1..2fb60be 100644 --- a/lib/types/Style.d.ts +++ b/lib/types/Style.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from './Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; -declare type ThemeColor = 'default' | 'success' | 'warning' | 'error'; -export declare type ColorDict = { +type ThemeColor = 'default' | 'success' | 'warning' | 'error'; +export type ColorDict = { [T in keyof ED]?: { [A in keyof ED[T]['OpSchema']]?: { [E in ED[T]['OpSchema'][A]]?: ThemeColor | `#${string}`; diff --git a/lib/types/Timer.d.ts b/lib/types/Timer.d.ts index 6fb8f24..911d879 100644 --- a/lib/types/Timer.d.ts +++ b/lib/types/Timer.d.ts @@ -1,12 +1,12 @@ import { RecurrenceRule, RecurrenceSpecDateRange, RecurrenceSpecObjLit } from 'node-schedule'; import { EntityDict } from './Entity'; import { AsyncContext } from '../store/AsyncRowStore'; -declare type RoutineFn> = (context: Cxt) => Promise; -export declare type Routine> = { +type RoutineFn> = (context: Cxt) => Promise; +export type Routine> = { name: string; fn: RoutineFn; }; -export declare type Timer> = { +export type Timer> = { name: string; cron: RecurrenceRule | RecurrenceSpecDateRange | RecurrenceSpecObjLit | Date | string | number; fn: RoutineFn; diff --git a/lib/types/Trigger.d.ts b/lib/types/Trigger.d.ts index efe1037..40ba8e6 100644 --- a/lib/types/Trigger.d.ts +++ b/lib/types/Trigger.d.ts @@ -33,7 +33,7 @@ export interface CreateTriggerCrossTxn | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; +export type CreateTrigger | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; /** * update trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -55,7 +55,7 @@ export interface UpdateTriggerCrossTxn | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; +export type UpdateTrigger | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; /** * 同update trigger一样,remove trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -76,7 +76,7 @@ export interface RemoveTriggerCrossTxn | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; +export type RemoveTrigger | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; export interface SelectTriggerBase extends TriggerBase { action: 'select'; } @@ -97,8 +97,8 @@ export interface SelectTriggerAfter[]; }, context: Cxt, params?: SelectOption) => Promise | number; } -export declare type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; -export declare type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; +export type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; +export type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; export interface TriggerEntityShape extends EntityShape { $$triggerData$$?: { name: string; diff --git a/lib/types/Watcher.d.ts b/lib/types/Watcher.d.ts index fccbd9c..0fe8135 100644 --- a/lib/types/Watcher.d.ts +++ b/lib/types/Watcher.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict, OperationResult } from "./Entity"; -declare type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; +type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; export interface BBWatcher { name: string; entity: T; @@ -15,5 +15,5 @@ export interface WBWatcher Promise); fn: (context: Cxt, data: Partial[]) => Promise>; } -export declare type Watcher> = BBWatcher | WBWatcher; +export type Watcher> = BBWatcher | WBWatcher; export {}; diff --git a/lib/types/schema/DataTypes.d.ts b/lib/types/schema/DataTypes.d.ts index b6479f5..72e0f83 100644 --- a/lib/types/schema/DataTypes.d.ts +++ b/lib/types/schema/DataTypes.d.ts @@ -1,28 +1,28 @@ /** * Column types used for @PrimaryGeneratedColumn() decorator. */ -export declare type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; +export type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; /** * Column types where spatial properties are used. */ -export declare type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; +export type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; /** * Column types where precision and scale properties are used. */ -export declare type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; +export type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; /** * Column types where column length is used. */ -export declare type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; -export declare type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; +export type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; +export type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; /** * All other regular column types. */ -export declare type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; +export type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; /** * Any column type column can be. */ -export declare type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; +export type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; export interface DataTypeParams { length?: number; width?: number; diff --git a/lib/utils/concurrent.d.ts b/lib/utils/concurrent.d.ts index c44feca..57d929b 100644 --- a/lib/utils/concurrent.d.ts +++ b/lib/utils/concurrent.d.ts @@ -1,4 +1,4 @@ -declare type Mode = 'S' | 'X'; +type Mode = 'S' | 'X'; /** * 模拟一个读写锁,用于同步。 * 注意,千万不要发生自己等自己 diff --git a/lib/utils/uuid.d.ts b/lib/utils/uuid.d.ts index 1d7ed56..595afb7 100644 --- a/lib/utils/uuid.d.ts +++ b/lib/utils/uuid.d.ts @@ -3,7 +3,7 @@ export declare function sequentialUuid({ random }: { }): string; export declare function shrinkUuidTo32Bytes(uuid: string): string; export declare function expandUuidTo36Bytes(uuidShrinked: string): string; -export declare type GenerateIdOption = { +export type GenerateIdOption = { shuffle?: boolean; }; export declare function generateNewIdAsync(option?: GenerateIdOption): Promise; diff --git a/lib/utils/validator.d.ts b/lib/utils/validator.d.ts index 08a892a..ee8269c 100644 --- a/lib/utils/validator.d.ts +++ b/lib/utils/validator.d.ts @@ -1,6 +1,6 @@ import { EntityDict } from "../types"; -declare type ValidatorFunction = (text: string, size?: number) => string | boolean; -declare type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; +type ValidatorFunction = (text: string, size?: number) => string | boolean; +type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; export declare const isMobile: ValidatorFunction; export declare const isPassword: ValidatorFunction; export declare const isCaptcha: ValidatorFunction; diff --git a/src/types/Port.ts b/src/types/Port.ts index 3e42b3c..d4e2f84 100644 --- a/src/types/Port.ts +++ b/src/types/Port.ts @@ -2,14 +2,14 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { SyncContext } from "../store/SyncRowStore"; import { EntityDict } from "./Entity"; -export type Exportation = { +export type Exportation = { name: string; id: string; entity: T; projection: ED[T]['Selection']['data']; - headers?: string[]; + headers?: K[]; makeHeaders?: (dataList: Partial[]) => string[]; - fn: (data: ED[T]['Schema'], context: AsyncContext, properties?: Record) => Promise>>; + fn: (data: ED[T]['Schema'], context?: AsyncContext, properties?: Record) => Promise>> | Partial>; }; export type Importation = { From 1c454e7c2685766a4fd8e8c5aa5c20422129636b Mon Sep 17 00:00:00 2001 From: wangwenchen <920960949@qq.com> Date: Thu, 29 Jun 2023 16:01:02 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/types/Port.d.ts | 2 +- lib/utils/money.js | 2 +- src/utils/money.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index bab4f65..d6f617b 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -5,7 +5,7 @@ export type Exportation[]) => string[]; fn: (data: ED[T]['Schema'], context?: AsyncContext, properties?: Record) => Promise>> | Partial>; }; diff --git a/lib/utils/money.js b/lib/utils/money.js index def3365..2305a30 100644 --- a/lib/utils/money.js +++ b/lib/utils/money.js @@ -34,7 +34,7 @@ var ThousandCont = function (value) { if (value1) { result = value1 + result; } - result = result + '.' + numArr[1]; + result = numArr[1] ? result + '.' + numArr[1] : result; return result; }; exports.ThousandCont = ThousandCont; diff --git a/src/utils/money.ts b/src/utils/money.ts index ba80952..9d77fdc 100644 --- a/src/utils/money.ts +++ b/src/utils/money.ts @@ -34,7 +34,7 @@ const ThousandCont: (value: number) => string | undefined = (value) => { if (value1) { result = value1 + result; } - result = result + '.' + numArr[1]; + result = numArr[1] ? result + '.' + numArr[1] : result; return result; }; From 9a0ee21d0c15b81b7b035eb3eb53512395e3a14f Mon Sep 17 00:00:00 2001 From: "Xc@centOs" Date: Fri, 7 Jul 2023 10:50:46 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E5=BC=82=E5=B8=B8=E7=9A=84=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/actions/action.d.ts | 16 ++-- lib/actions/relation.d.ts | 2 +- lib/base-app-domain/ActionAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/EntityDict.d.ts | 2 +- lib/base-app-domain/Modi/Action.d.ts | 8 +- lib/base-app-domain/Modi/Schema.d.ts | 48 +++++----- lib/base-app-domain/ModiEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Oper/Schema.d.ts | 52 +++++----- lib/base-app-domain/OperEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Relation/Schema.d.ts | 48 +++++----- lib/base-app-domain/RelationAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/User/Action.d.ts | 8 +- lib/base-app-domain/User/Schema.d.ts | 48 +++++----- .../UserEntityGrant/Schema.d.ts | 48 +++++----- lib/base-app-domain/UserRelation/Schema.d.ts | 56 +++++------ lib/base-app-domain/_SubQuery.d.ts | 20 ++-- lib/entities/ActionAuth.d.ts | 2 +- lib/entities/RelationAuth.d.ts | 2 +- lib/store/TriggerExecutor.d.ts | 2 +- lib/store/actionDef.js | 88 +++++++++-------- lib/timers/oper.d.ts | 2 +- lib/timers/vaccum.d.ts | 4 +- lib/types/Action.d.ts | 14 +-- lib/types/Auth.d.ts | 18 ++-- lib/types/DataType.d.ts | 34 +++---- lib/types/Demand.d.ts | 46 ++++----- lib/types/Endpoint.d.ts | 2 +- lib/types/Entity.d.ts | 94 +++++++++---------- lib/types/Expression.d.ts | 28 +++--- lib/types/Geo.d.ts | 12 +-- lib/types/Locale.d.ts | 10 +- lib/types/Polyfill.d.ts | 18 ++-- lib/types/Port.d.ts | 4 +- lib/types/RowStore.d.ts | 6 +- lib/types/Storage.d.ts | 8 +- lib/types/Style.d.ts | 4 +- lib/types/Timer.d.ts | 6 +- lib/types/Trigger.d.ts | 10 +- lib/types/Watcher.d.ts | 4 +- lib/types/schema/DataTypes.d.ts | 14 +-- lib/utils/concurrent.d.ts | 2 +- lib/utils/uuid.d.ts | 2 +- lib/utils/validator.d.ts | 4 +- src/store/actionDef.ts | 28 +++--- 44 files changed, 551 insertions(+), 533 deletions(-) diff --git a/lib/actions/action.d.ts b/lib/actions/action.d.ts index 05b9e4f..7bec7e8 100644 --- a/lib/actions/action.d.ts +++ b/lib/actions/action.d.ts @@ -1,16 +1,16 @@ import { ActionDef } from '../types/Action'; -export type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; -export type AppendOnlyAction = ReadOnlyAction | 'create'; -export type ExcludeUpdateAction = AppendOnlyAction | 'remove'; -export type ExcludeRemoveAction = AppendOnlyAction | 'update'; -export type GenericAction = 'update' | ExcludeUpdateAction; -export type RelationAction = 'grant' | 'revoke'; +export declare type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; +export declare type AppendOnlyAction = ReadOnlyAction | 'create'; +export declare type ExcludeUpdateAction = AppendOnlyAction | 'remove'; +export declare type ExcludeRemoveAction = AppendOnlyAction | 'update'; +export declare type GenericAction = 'update' | ExcludeUpdateAction; +export declare type RelationAction = 'grant' | 'revoke'; export declare const readOnlyActions: string[]; export declare const appendOnlyActions: string[]; export declare const excludeUpdateActions: string[]; export declare const exludeRemoveActions: string[]; export declare const genericActions: string[]; export declare const relationActions: string[]; -export type AbleAction = 'enable' | 'disable'; -export type AbleState = 'enabled' | 'disabled'; +export declare type AbleAction = 'enable' | 'disable'; +export declare type AbleState = 'enabled' | 'disabled'; export declare const makeAbleActionDef: (initialState?: AbleState) => ActionDef; diff --git a/lib/actions/relation.d.ts b/lib/actions/relation.d.ts index 1f379bb..a53fb29 100644 --- a/lib/actions/relation.d.ts +++ b/lib/actions/relation.d.ts @@ -1,5 +1,5 @@ import { CascadeRelationItem, RelationHierarchy, EntityDict } from "../types/Entity"; -export type GenericRelation = 'owner'; +export declare type GenericRelation = 'owner'; export declare function convertHierarchyToAuth(entity: T, hierarchy: RelationHierarchy>): { [K in NonNullable]?: CascadeRelationItem; }; diff --git a/lib/base-app-domain/ActionAuth/Schema.d.ts b/lib/base-app-domain/ActionAuth/Schema.d.ts index 16b65df..7b7aad0 100644 --- a/lib/base-app-domain/ActionAuth/Schema.d.ts +++ b/lib/base-app-domain/ActionAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -type Actions = string[]; -export type OpSchema = EntityShape & { +declare type Actions = string[]; +export declare type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deActions: Actions; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.ActionAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ type AttrFilter = { destEntity: Q_StringValue; deActions: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type ActionAuthIdProjection = OneOf<{ +declare type ActionAuthIdProjection = OneOf<{ id: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ relationId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export type CreateOperationData = FormCreateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export type UpdateOperationData = FormUpdateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type RelationIdSubQuery = Selection; -export type ActionAuthIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type RelationIdSubQuery = Selection; +export declare type ActionAuthIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/EntityDict.d.ts b/lib/base-app-domain/EntityDict.d.ts index 4f8ea25..73937b9 100644 --- a/lib/base-app-domain/EntityDict.d.ts +++ b/lib/base-app-domain/EntityDict.d.ts @@ -8,7 +8,7 @@ import { EntityDef as RelationAuth } from "./RelationAuth/Schema"; import { EntityDef as User } from "./User/Schema"; import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema"; import { EntityDef as UserRelation } from "./UserRelation/Schema"; -export type EntityDict = { +export declare type EntityDict = { actionAuth: ActionAuth; modi: Modi; modiEntity: ModiEntity; diff --git a/lib/base-app-domain/Modi/Action.d.ts b/lib/base-app-domain/Modi/Action.d.ts index ecb0a21..0cae5fa 100644 --- a/lib/base-app-domain/Modi/Action.d.ts +++ b/lib/base-app-domain/Modi/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction } from "../../actions/action"; -export type IState = 'active' | 'applied' | 'abandoned' | string; -export type IAction = 'apply' | 'abandon' | string; -export type ParticularAction = IAction; -export type Action = GenericAction | ParticularAction | string; +export declare type IState = 'active' | 'applied' | 'abandoned' | string; +export declare type IAction = 'apply' | 'abandon' | string; +export declare type ParticularAction = IAction; +export declare type Action = GenericAction | ParticularAction | string; export declare const actions: string[]; export declare const ActionDefDict: { iState: ActionDef; diff --git a/lib/base-app-domain/Modi/Schema.d.ts b/lib/base-app-domain/Modi/Schema.d.ts index 8607bf1..30dc913 100644 --- a/lib/base-app-domain/Modi/Schema.d.ts +++ b/lib/base-app-domain/Modi/Schema.d.ts @@ -5,7 +5,7 @@ import * as SubQuery from "../_SubQuery"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity"; import { Action, ParticularAction, IState } from "./Action"; import * as ModiEntity from "../ModiEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -15,8 +15,8 @@ export type OpSchema = EntityShape & { extra?: Object | null; iState?: IState | null; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -30,7 +30,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.ModiIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ type AttrFilter = { extra: Object; iState: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -67,10 +67,10 @@ export type Projection = { $entity: "modiEntity"; }; } & Partial>; -type ModiIdProjection = OneOf<{ +declare type ModiIdProjection = OneOf<{ id: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -91,34 +91,34 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & ({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; }) & { modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type ModiIdSubQuery = Selection; -export type EntityDef = { +export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type ModiIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/ModiEntity/Schema.d.ts b/lib/base-app-domain/ModiEntity/Schema.d.ts index 7ed5bc0..3b27a68 100644 --- a/lib/base-app-domain/ModiEntity/Schema.d.ts +++ b/lib/base-app-domain/ModiEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.ModiEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export type Filter> = MakeFilter & ExprOp>; -export type Projection = { +export declare type Filter> = MakeFilter & ExprOp>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -type ModiEntityIdProjection = OneOf<{ +declare type ModiEntityIdProjection = OneOf<{ id: number; }>; -type ModiIdProjection = OneOf<{ +declare type ModiIdProjection = OneOf<{ modiId: number; }>; -type ActionAuthIdProjection = OneOf<{ +declare type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ entityId: number; }>; -type RelationAuthIdProjection = OneOf<{ +declare type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ entityId: number; }>; -type UserEntityGrantIdProjection = OneOf<{ +declare type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -type UserRelationIdProjection = OneOf<{ +declare type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ modiId?: never; modi: Modi.CreateSingleOperation; } | { @@ -208,10 +208,10 @@ export type CreateOperationData = FormCreateData; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ modi: Modi.CreateSingleOperation; modiId?: never; } | { @@ -253,8 +253,8 @@ export type UpdateOperationData = FormUpdateData; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ modi?: Modi.UpdateOperation | Modi.RemoveOperation; })) & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; @@ -271,17 +271,17 @@ export type RemoveOperationData = {} & (({ } | { [k: string]: any; }); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type ModiIdSubQuery = Selection; -export type ActionAuthIdSubQuery = Selection; -export type RelationIdSubQuery = Selection; -export type RelationAuthIdSubQuery = Selection; -export type UserIdSubQuery = Selection; -export type UserEntityGrantIdSubQuery = Selection; -export type UserRelationIdSubQuery = Selection; -export type ModiEntityIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type ModiIdSubQuery = Selection; +export declare type ActionAuthIdSubQuery = Selection; +export declare type RelationIdSubQuery = Selection; +export declare type RelationAuthIdSubQuery = Selection; +export declare type UserIdSubQuery = Selection; +export declare type UserEntityGrantIdSubQuery = Selection; +export declare type UserRelationIdSubQuery = Selection; +export declare type ModiEntityIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Oper/Schema.d.ts b/lib/base-app-domain/Oper/Schema.d.ts index 06d73c8..781eb05 100644 --- a/lib/base-app-domain/Oper/Schema.d.ts +++ b/lib/base-app-domain/Oper/Schema.d.ts @@ -6,7 +6,7 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { AppendOnlyAction } from "../../actions/action"; import * as User from "../User/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -14,8 +14,8 @@ export type OpSchema = EntityShape & { operatorId?: ForeignKey<"user"> | null; targetEntity: String<32>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -28,7 +28,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.OperIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -41,8 +41,8 @@ type AttrFilter = { operator: User.Filter; targetEntity: Q_StringValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -63,13 +63,13 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type OperIdProjection = OneOf<{ +declare type OperIdProjection = OneOf<{ id: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ operatorId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ operatorId?: never; operator?: User.CreateSingleOperation; } | { @@ -107,10 +107,10 @@ export type CreateOperationData = FormCreateData> & })) & { operEntity$oper?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ operator: User.CreateSingleOperation; operatorId?: never; } | { @@ -126,15 +126,15 @@ export type UpdateOperationData = FormUpdateData> & [k: string]: any; operEntity$oper?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ operator?: User.UpdateOperation | User.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserIdSubQuery = Selection; -export type OperIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserIdSubQuery = Selection; +export declare type OperIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/OperEntity/Schema.d.ts b/lib/base-app-domain/OperEntity/Schema.d.ts index c9200bd..e3ca574 100644 --- a/lib/base-app-domain/OperEntity/Schema.d.ts +++ b/lib/base-app-domain/OperEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.OperEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export type Filter> = MakeFilter & ExprOp>; -export type Projection = { +export declare type Filter> = MakeFilter & ExprOp>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -type OperEntityIdProjection = OneOf<{ +declare type OperEntityIdProjection = OneOf<{ id: number; }>; -type OperIdProjection = OneOf<{ +declare type OperIdProjection = OneOf<{ operId: number; }>; -type ActionAuthIdProjection = OneOf<{ +declare type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ entityId: number; }>; -type RelationAuthIdProjection = OneOf<{ +declare type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ entityId: number; }>; -type UserEntityGrantIdProjection = OneOf<{ +declare type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -type UserRelationIdProjection = OneOf<{ +declare type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ operId?: never; oper: Oper.CreateSingleOperation; } | { @@ -205,10 +205,10 @@ export type CreateOperationData = FormCreateData; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ oper: Oper.CreateSingleOperation; operId?: never; } | { @@ -244,8 +244,8 @@ export type UpdateOperationData = FormUpdateData; -export type RemoveOperationData = {} & ({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; } | { relation?: Relation.UpdateOperation | Relation.RemoveOperation; @@ -260,17 +260,17 @@ export type RemoveOperationData = {} & ({ } | { [k: string]: any; }); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type OperIdSubQuery = Selection; -export type ActionAuthIdSubQuery = Selection; -export type RelationIdSubQuery = Selection; -export type RelationAuthIdSubQuery = Selection; -export type UserIdSubQuery = Selection; -export type UserEntityGrantIdSubQuery = Selection; -export type UserRelationIdSubQuery = Selection; -export type OperEntityIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type OperIdSubQuery = Selection; +export declare type ActionAuthIdSubQuery = Selection; +export declare type RelationIdSubQuery = Selection; +export declare type RelationAuthIdSubQuery = Selection; +export declare type UserIdSubQuery = Selection; +export declare type UserEntityGrantIdSubQuery = Selection; +export declare type UserRelationIdSubQuery = Selection; +export declare type OperEntityIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Relation/Schema.d.ts b/lib/base-app-domain/Relation/Schema.d.ts index 6fdc81c..fbf5182 100644 --- a/lib/base-app-domain/Relation/Schema.d.ts +++ b/lib/base-app-domain/Relation/Schema.d.ts @@ -9,14 +9,14 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; display: String<32>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; @@ -34,7 +34,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.RelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ type AttrFilter = { name: Q_StringValue; display: Q_StringValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -87,10 +87,10 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ id: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -109,15 +109,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & ({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -128,10 +128,10 @@ export type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { [k: string]: any; actionAuth$relation?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation>; relationAuth$relation?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation>; @@ -139,12 +139,12 @@ export type UpdateOperationData = FormUpdateData & { modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type RelationIdSubQuery = Selection; -export type EntityDef = { +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type RelationIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/RelationAuth/Schema.d.ts b/lib/base-app-domain/RelationAuth/Schema.d.ts index 1573262..447ab6d 100644 --- a/lib/base-app-domain/RelationAuth/Schema.d.ts +++ b/lib/base-app-domain/RelationAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -type Relations = string[]; -export type OpSchema = EntityShape & { +declare type Relations = string[]; +export declare type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deRelations: Relations; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.RelationAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ type AttrFilter = { destEntity: Q_StringValue; deRelations: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type RelationAuthIdProjection = OneOf<{ +declare type RelationAuthIdProjection = OneOf<{ id: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ relationId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export type CreateOperationData = FormCreateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export type UpdateOperationData = FormUpdateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type RelationIdSubQuery = Selection; -export type RelationAuthIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type RelationIdSubQuery = Selection; +export declare type RelationAuthIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/User/Action.d.ts b/lib/base-app-domain/User/Action.d.ts index 46ad254..84cc307 100644 --- a/lib/base-app-domain/User/Action.d.ts +++ b/lib/base-app-domain/User/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction, RelationAction } from "../../actions/action"; -export type UserAction = 'mergeTo' | string; -export type UserState = 'normal' | 'merged' | string; -export type ParticularAction = UserAction; -export type Action = GenericAction | ParticularAction | RelationAction | string; +export declare type UserAction = 'mergeTo' | string; +export declare type UserState = 'normal' | 'merged' | string; +export declare type ParticularAction = UserAction; +export declare type Action = GenericAction | ParticularAction | RelationAction | string; export declare const actions: string[]; export declare const ActionDefDict: { userState: ActionDef; diff --git a/lib/base-app-domain/User/Schema.d.ts b/lib/base-app-domain/User/Schema.d.ts index d71b44c..ce598a7 100644 --- a/lib/base-app-domain/User/Schema.d.ts +++ b/lib/base-app-domain/User/Schema.d.ts @@ -9,15 +9,15 @@ import * as Oper from "../Oper/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; userState?: UserState | null; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; @@ -37,7 +37,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.UserIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -49,8 +49,8 @@ type AttrFilter = { ref: Filter; userState: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -94,11 +94,11 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ id: number; refId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ refId?: never; ref?: CreateSingleOperation; } | { @@ -144,10 +144,10 @@ export type CreateOperationData = FormCreateData> & (({ modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ ref: CreateSingleOperation; refId?: never; } | { @@ -167,14 +167,14 @@ export type UpdateOperationData = FormUpdateData> & (({ modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ ref?: UpdateOperation | RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserEntityGrant/Schema.d.ts b/lib/base-app-domain/UserEntityGrant/Schema.d.ts index 2d28afe..6334c2e 100644 --- a/lib/base-app-domain/UserEntityGrant/Schema.d.ts +++ b/lib/base-app-domain/UserEntityGrant/Schema.d.ts @@ -6,13 +6,13 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { GenericAction } from "../../actions/action"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; @@ -23,7 +23,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -32,8 +32,8 @@ type AttrFilter = { entityId: Q_StringValue; relation: Q_StringValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -56,10 +56,10 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type UserEntityGrantIdProjection = OneOf<{ +declare type UserEntityGrantIdProjection = OneOf<{ id: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -76,15 +76,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & ({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -92,20 +92,20 @@ export type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserEntityGrantIdSubQuery = Selection; -export type EntityDef = { +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserEntityGrantIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserRelation/Schema.d.ts b/lib/base-app-domain/UserRelation/Schema.d.ts index ff97ead..319fa71 100644 --- a/lib/base-app-domain/UserRelation/Schema.d.ts +++ b/lib/base-app-domain/UserRelation/Schema.d.ts @@ -8,12 +8,12 @@ import * as User from "../User/Schema"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; user: User.Schema; @@ -25,7 +25,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.UserRelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -35,8 +35,8 @@ type AttrFilter = { relationId: Q_StringValue | SubQuery.RelationIdSubQuery; relation: Relation.Filter; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -60,16 +60,16 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type UserRelationIdProjection = OneOf<{ +declare type UserRelationIdProjection = OneOf<{ id: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ userId: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ relationId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ userId?: never; user: User.CreateSingleOperation; } | { @@ -116,10 +116,10 @@ export type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ user: User.CreateSingleOperation; userId?: never; } | { @@ -148,18 +148,18 @@ export type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ user?: User.UpdateOperation | User.RemoveOperation; }) & ({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserIdSubQuery = Selection; -export type RelationIdSubQuery = Selection; -export type UserRelationIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserIdSubQuery = Selection; +export declare type RelationIdSubQuery = Selection; +export declare type UserRelationIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/_SubQuery.d.ts b/lib/base-app-domain/_SubQuery.d.ts index c719b6f..d69d357 100644 --- a/lib/base-app-domain/_SubQuery.d.ts +++ b/lib/base-app-domain/_SubQuery.d.ts @@ -8,36 +8,36 @@ import * as RelationAuth from "./RelationAuth/Schema"; import * as User from "./User/Schema"; import * as UserEntityGrant from "./UserEntityGrant/Schema"; import * as UserRelation from "./UserRelation/Schema"; -export type ActionAuthIdSubQuery = { +export declare type ActionAuthIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.ActionAuthIdSubQuery & { entity: "actionAuth"; }) | any; }; -export type ModiIdSubQuery = { +export declare type ModiIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiIdSubQuery & { entity: "modiEntity"; }) | (Modi.ModiIdSubQuery & { entity: "modi"; }) | any; }; -export type ModiEntityIdSubQuery = { +export declare type ModiEntityIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiEntityIdSubQuery & { entity: "modiEntity"; }) | any; }; -export type OperIdSubQuery = { +export declare type OperIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperIdSubQuery & { entity: "operEntity"; }) | (Oper.OperIdSubQuery & { entity: "oper"; }) | any; }; -export type OperEntityIdSubQuery = { +export declare type OperEntityIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperEntityIdSubQuery & { entity: "operEntity"; }) | any; }; -export type RelationIdSubQuery = { +export declare type RelationIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.RelationIdSubQuery & { entity: "actionAuth"; }) | (RelationAuth.RelationIdSubQuery & { @@ -48,12 +48,12 @@ export type RelationIdSubQuery = { entity: "relation"; }) | any; }; -export type RelationAuthIdSubQuery = { +export declare type RelationAuthIdSubQuery = { [K in "$in" | "$nin"]?: (RelationAuth.RelationAuthIdSubQuery & { entity: "relationAuth"; }) | any; }; -export type UserIdSubQuery = { +export declare type UserIdSubQuery = { [K in "$in" | "$nin"]?: (Oper.UserIdSubQuery & { entity: "oper"; }) | (User.UserIdSubQuery & { @@ -64,12 +64,12 @@ export type UserIdSubQuery = { entity: "user"; }) | any; }; -export type UserEntityGrantIdSubQuery = { +export declare type UserEntityGrantIdSubQuery = { [K in "$in" | "$nin"]?: (UserEntityGrant.UserEntityGrantIdSubQuery & { entity: "userEntityGrant"; }) | any; }; -export type UserRelationIdSubQuery = { +export declare type UserRelationIdSubQuery = { [K in "$in" | "$nin"]?: (UserRelation.UserRelationIdSubQuery & { entity: "userRelation"; }) | any; diff --git a/lib/entities/ActionAuth.d.ts b/lib/entities/ActionAuth.d.ts index 9944266..c57a16c 100644 --- a/lib/entities/ActionAuth.d.ts +++ b/lib/entities/ActionAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -type Actions = string[]; +declare type Actions = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/entities/RelationAuth.d.ts b/lib/entities/RelationAuth.d.ts index 8529abb..dc79db5 100644 --- a/lib/entities/RelationAuth.d.ts +++ b/lib/entities/RelationAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -type Relations = string[]; +declare type Relations = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/store/TriggerExecutor.d.ts b/lib/store/TriggerExecutor.d.ts index 77253f7..d63a7ed 100644 --- a/lib/store/TriggerExecutor.d.ts +++ b/lib/store/TriggerExecutor.d.ts @@ -16,7 +16,7 @@ export declare class TriggerExecutor { private contextBuilder; constructor(contextBuilder: (cxtString: string) => Promise>, logger?: Logger); registerChecker>(checker: Checker): void; - getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[]; + getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[] | undefined; registerTrigger>(trigger: Trigger): void; unregisterTrigger>(trigger: Trigger): void; private preCommitTrigger; diff --git a/lib/store/actionDef.js b/lib/store/actionDef.js index 4994337..159797f 100644 --- a/lib/store/actionDef.js +++ b/lib/store/actionDef.js @@ -50,34 +50,48 @@ function makeIntrinsicWatchers(schema) { return watchers; } function checkUniqueBetweenRows(rows, uniqAttrs) { + var e_1, _a, e_2, _b; // 先检查这些行本身之间有无unique冲突 - var uniqRows = (0, lodash_1.uniqBy)(rows, function (d) { - var e_1, _a; - var s = ''; - try { - for (var uniqAttrs_1 = tslib_1.__values(uniqAttrs), uniqAttrs_1_1 = uniqAttrs_1.next(); !uniqAttrs_1_1.done; uniqAttrs_1_1 = uniqAttrs_1.next()) { - var a = uniqAttrs_1_1.value; - if (d[a] === null || d[a] === undefined) { - s + d.id; - } - else { - s + "-".concat(d[a]); - } - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { + var dict = {}; + try { + for (var rows_1 = tslib_1.__values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) { + var row = rows_1_1.value; + var s = ''; try { - if (uniqAttrs_1_1 && !uniqAttrs_1_1.done && (_a = uniqAttrs_1.return)) _a.call(uniqAttrs_1); + for (var uniqAttrs_1 = (e_2 = void 0, tslib_1.__values(uniqAttrs)), uniqAttrs_1_1 = uniqAttrs_1.next(); !uniqAttrs_1_1.done; uniqAttrs_1_1 = uniqAttrs_1.next()) { + var a = uniqAttrs_1_1.value; + if (row[a] === null || row[a] === undefined) { + s + row.id; + } + else { + s + "-".concat(row[a]); + } + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (uniqAttrs_1_1 && !uniqAttrs_1_1.done && (_b = uniqAttrs_1.return)) _b.call(uniqAttrs_1); + } + finally { if (e_2) throw e_2.error; } + } + if (dict[s]) { + throw new types_1.OakUniqueViolationException([{ + id: row.id, + attrs: uniqAttrs, + }]); + } + else { + dict[s] = 1; } - finally { if (e_1) throw e_1.error; } } - return s; - }); - if (uniqRows.length < rows.length) { - throw new types_1.OakUniqueViolationException([{ - attrs: uniqAttrs, - }]); + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1); + } + finally { if (e_1) throw e_1.error; } } } function checkCountLessThan(count, uniqAttrs, than, id) { @@ -190,7 +204,7 @@ function analyzeActionDefDict(schema, actionDefDict) { } } var _loop_2 = function (entity) { - var e_2, _e; + var e_3, _e; var indexes = schema[entity].indexes; if (indexes) { var _loop_4 = function (index) { @@ -221,7 +235,7 @@ function analyzeActionDefDict(schema, actionDefDict) { type: 'logical', priority: 20, checker: function (operation, context) { - var e_3, _a, e_4, _b, _c; + var e_4, _a, e_5, _b, _c; var _d = operation, data = _d.data, operationFilter = _d.filter; var attrs = Object.keys(data); var refAttrs = (0, lodash_1.intersection)(attrs, uniqAttrs_2); @@ -230,7 +244,7 @@ function analyzeActionDefDict(schema, actionDefDict) { return; } try { - for (var refAttrs_1 = (e_3 = void 0, tslib_1.__values(refAttrs)), refAttrs_1_1 = refAttrs_1.next(); !refAttrs_1_1.done; refAttrs_1_1 = refAttrs_1.next()) { + for (var refAttrs_1 = (e_4 = void 0, tslib_1.__values(refAttrs)), refAttrs_1_1 = refAttrs_1.next(); !refAttrs_1_1.done; refAttrs_1_1 = refAttrs_1.next()) { var attr = refAttrs_1_1.value; // 如果有更新为null值,不用再检查约束 if (data[attr] === null || data[attr] === undefined) { @@ -238,12 +252,12 @@ function analyzeActionDefDict(schema, actionDefDict) { } } } - catch (e_3_1) { e_3 = { error: e_3_1 }; } + catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (refAttrs_1_1 && !refAttrs_1_1.done && (_a = refAttrs_1.return)) _a.call(refAttrs_1); } - finally { if (e_3) throw e_3.error; } + finally { if (e_4) throw e_4.error; } } if (refAttrs.length === uniqAttrs_2.length) { // 如果更新了全部属性,直接检查 @@ -254,12 +268,12 @@ function analyzeActionDefDict(schema, actionDefDict) { $not: operationFilter, }]), }, { dontCollect: true }); - var checkCount = checkCountLessThan(count, uniqAttrs_2); + var checkCount = checkCountLessThan(count, uniqAttrs_2, 0, operationFilter === null || operationFilter === void 0 ? void 0 : operationFilter.id); // 更新的行只能有一行 var rowCount = context.count(entity, { filter: operationFilter, }, { dontCollect: true }); - var checkRowCount = checkCountLessThan(rowCount, uniqAttrs_2, 1); + var checkRowCount = checkCountLessThan(rowCount, uniqAttrs_2, 1, operationFilter === null || operationFilter === void 0 ? void 0 : operationFilter.id); // 如果更新的行数为零似乎也可以,但这应该不可能出现吧,by Xc 20230131 if (checkRowCount instanceof Promise) { return Promise.all([checkCount, checkRowCount]).then(function () { return undefined; }); @@ -268,19 +282,19 @@ function analyzeActionDefDict(schema, actionDefDict) { // 否则需要结合本行现有的属性来进行检查 var projection = { id: 1 }; try { - for (var uniqAttrs_3 = (e_4 = void 0, tslib_1.__values(uniqAttrs_2)), uniqAttrs_3_1 = uniqAttrs_3.next(); !uniqAttrs_3_1.done; uniqAttrs_3_1 = uniqAttrs_3.next()) { + for (var uniqAttrs_3 = (e_5 = void 0, tslib_1.__values(uniqAttrs_2)), uniqAttrs_3_1 = uniqAttrs_3.next(); !uniqAttrs_3_1.done; uniqAttrs_3_1 = uniqAttrs_3.next()) { var attr = uniqAttrs_3_1.value; Object.assign(projection, (_c = {}, _c[attr] = 1, _c)); } } - catch (e_4_1) { e_4 = { error: e_4_1 }; } + catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { try { if (uniqAttrs_3_1 && !uniqAttrs_3_1.done && (_b = uniqAttrs_3.return)) _b.call(uniqAttrs_3); } - finally { if (e_4) throw e_4.error; } + finally { if (e_5) throw e_5.error; } } var checkWithRows = function (rows2) { var rows22 = rows2.map(function (ele) { return Object.assign(ele, data); }); @@ -306,17 +320,17 @@ function analyzeActionDefDict(schema, actionDefDict) { } }; try { - for (var indexes_1 = (e_2 = void 0, tslib_1.__values(indexes)), indexes_1_1 = indexes_1.next(); !indexes_1_1.done; indexes_1_1 = indexes_1.next()) { + for (var indexes_1 = (e_3 = void 0, tslib_1.__values(indexes)), indexes_1_1 = indexes_1.next(); !indexes_1_1.done; indexes_1_1 = indexes_1.next()) { var index = indexes_1_1.value; _loop_4(index); } } - catch (e_2_1) { e_2 = { error: e_2_1 }; } + catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (indexes_1_1 && !indexes_1_1.done && (_e = indexes_1.return)) _e.call(indexes_1); } - finally { if (e_2) throw e_2.error; } + finally { if (e_3) throw e_3.error; } } } }; diff --git a/lib/timers/oper.d.ts b/lib/timers/oper.d.ts index 0e7e3ac..9eebe95 100644 --- a/lib/timers/oper.d.ts +++ b/lib/timers/oper.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -export type VaccumOperOption = { +export declare type VaccumOperOption = { aliveLine: number; excludeOpers?: { [T in keyof ED]?: ED[T]['Action'][]; diff --git a/lib/timers/vaccum.d.ts b/lib/timers/vaccum.d.ts index b354f19..bd3ef80 100644 --- a/lib/timers/vaccum.d.ts +++ b/lib/timers/vaccum.d.ts @@ -1,12 +1,12 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -type VaccumOptionEntity = { +declare type VaccumOptionEntity = { entity: T; filter?: ED[T]['Selection']['filter']; aliveLine: number; }; -type VaccumOption = { +declare type VaccumOption = { entities: Array>; backupDir?: string; zip?: boolean; diff --git a/lib/types/Action.d.ts b/lib/types/Action.d.ts index e646b40..1dc6ee7 100644 --- a/lib/types/Action.d.ts +++ b/lib/types/Action.d.ts @@ -1,20 +1,20 @@ import { CascadeRelationItem, EntityDict } from "./Entity"; import { GenericAction } from '../actions/action'; -export type Action = string; -export type State = string; -export type ActionDef = { +export declare type Action = string; +export declare type State = string; +export declare type ActionDef = { stm: { [a in A]: [p: S | S[], n: S]; }; is?: S; }; -export type ActionDictOfEntityDict = { +export declare type ActionDictOfEntityDict = { [T in keyof E]?: { [A in keyof E[T]['OpSchema']]?: ActionDef; }; }; -export type CascadeActionItem = CascadeRelationItem; -export type CascadeActionAuth = { +export declare type CascadeActionItem = CascadeRelationItem; +export declare type CascadeActionAuth = { [K in A | GenericAction]?: CascadeActionItem | (CascadeActionItem | CascadeActionItem[])[]; }; -export type ActionOnRemove = 'setNull' | 'remove'; +export declare type ActionOnRemove = 'setNull' | 'remove'; diff --git a/lib/types/Auth.d.ts b/lib/types/Auth.d.ts index c7c86d6..2023c39 100644 --- a/lib/types/Auth.d.ts +++ b/lib/types/Auth.d.ts @@ -2,12 +2,12 @@ import { CascadeActionAuth, CascadeRelationAuth, ActionOnRemove, SyncOrAsync } f import { AsyncContext } from "../store/AsyncRowStore"; import { SyncContext } from "../store/SyncRowStore"; import { EntityDict, OperateOption, SelectOption } from "../types/Entity"; -export type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; +export declare type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; /** * conditionalFilter是指该action发生时,operation所操作的行中有满足conditionalFilter的行 * 被转化成trigger的filter条件,详细可看trigger中的说明 */ -export type DataChecker | SyncContext> = { +export declare type DataChecker | SyncContext> = { priority?: number; type: 'data'; entity: T; @@ -15,7 +15,7 @@ export type DataChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type RowChecker | SyncContext> = { +export declare type RowChecker | SyncContext> = { priority?: number; type: 'row'; entity: T; @@ -28,7 +28,7 @@ export type RowChecker SyncOrAsync); }; -export type RelationChecker | SyncContext> = { +export declare type RelationChecker | SyncContext> = { priority?: number; type: 'relation'; entity: T; @@ -38,7 +38,7 @@ export type RelationChecker string); conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type LogicalChecker | SyncContext> = { +export declare type LogicalChecker | SyncContext> = { priority?: number; type: 'logical'; when?: 'after'; @@ -47,7 +47,7 @@ export type LogicalChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type LogicalRelationChecker | SyncContext> = { +export declare type LogicalRelationChecker | SyncContext> = { priority?: number; type: 'logicalRelation'; when?: 'after'; @@ -56,14 +56,14 @@ export type LogicalRelationChecker any | Promise; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; -export type AuthDef = { +export declare type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; +export declare type AuthDef = { relationAuth?: CascadeRelationAuth>; actionAuth?: CascadeActionAuth; cascadeRemove?: { [E in (keyof ED | keyof ED[T]['Schema'] | '@entity')]?: ActionOnRemove; }; }; -export type AuthDefDict = { +export declare type AuthDefDict = { [K in keyof ED]?: AuthDef; }; diff --git a/lib/types/DataType.d.ts b/lib/types/DataType.d.ts index df83a90..e3b63be 100644 --- a/lib/types/DataType.d.ts +++ b/lib/types/DataType.d.ts @@ -1,21 +1,21 @@ import { Geo, SingleGeo } from "./Geo"; -export type Int = number; -export type Uint = number; -export type Double

= number; -export type Float

= number; -export type String = string; -export type Text = string; -export type Image = string; -export type File = string; -export type Datetime = number | Date; -export type Day = number | Date; -export type Time = number | Date; -export type Boolean = boolean; -export type Price = number; -export type PrimaryKey = string; -export type ForeignKey = string; -export type Sequence = string; +export declare type Int = number; +export declare type Uint = number; +export declare type Double

= number; +export declare type Float

= number; +export declare type String = string; +export declare type Text = string; +export declare type Image = string; +export declare type File = string; +export declare type Datetime = number | Date; +export declare type Day = number | Date; +export declare type Time = number | Date; +export declare type Boolean = boolean; +export declare type Price = number; +export declare type PrimaryKey = string; +export declare type ForeignKey = string; +export declare type Sequence = string; export { Geo, SingleGeo } from './Geo'; -export type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; +export declare type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; export declare const types: string[]; export declare const unIndexedTypes: string[]; diff --git a/lib/types/Demand.d.ts b/lib/types/Demand.d.ts index 041672f..c2605fe 100644 --- a/lib/types/Demand.d.ts +++ b/lib/types/Demand.d.ts @@ -1,12 +1,12 @@ import { RefOrExpression } from "./Expression"; import { OneOf } from "./Polyfill"; export declare const EXPRESSION_PREFIX = "$expr"; -export type NodeId = `node-${number}`; -export type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; -export type ExprOp = { +export declare type NodeId = `node-${number}`; +export declare type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; +export declare type ExprOp = { [K in ExpressionKey]: RefOrExpression; }; -export type Q_NumberComparisonValue = number | OneOf<{ +export declare type Q_NumberComparisonValue = number | OneOf<{ $gt: number; $lt: number; $gte: number; @@ -17,7 +17,7 @@ export type Q_NumberComparisonValue = number | OneOf<{ $nin: number[]; $between: [number, number]; }>; -export type Q_StringComparisonValue = string | OneOf<{ +export declare type Q_StringComparisonValue = string | OneOf<{ $gt: string; $lt: string; $gte: string; @@ -30,44 +30,44 @@ export type Q_StringComparisonValue = string | OneOf<{ $in: string[]; $nin: string[]; }>; -export type Q_BooleanComparisonValue = boolean; -export type Q_DateComparisonValue = Q_NumberComparisonValue; -export type Q_EnumComparisonValue = E | OneOf<{ +export declare type Q_BooleanComparisonValue = boolean; +export declare type Q_DateComparisonValue = Q_NumberComparisonValue; +export declare type Q_EnumComparisonValue = E | OneOf<{ $in: E[]; $nin: E[]; }>; -export type Q_ExistsValue = { +export declare type Q_ExistsValue = { $exists: boolean; }; -export type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; -export type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; -export type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; -export type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; -export type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; -export type Q_State = S | { +export declare type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; +export declare type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; +export declare type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; +export declare type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; +export declare type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; +export declare type Q_State = S | { $in: S[]; } | { $nin: S[]; } | Q_ExistsValue; -export type Q_FullTextValue = { +export declare type Q_FullTextValue = { $search: string; $language?: 'zh_CN' | 'en_US'; }; -export type Q_FullTextKey = '$text'; -export type FulltextFilter = { +export declare type Q_FullTextKey = '$text'; +export declare type FulltextFilter = { [F in Q_FullTextKey]?: Q_FullTextValue; }; -type Q_LogicKey = '$and' | '$or'; -type Q_LinearLogicKey = '$not'; -export type MakeFilterWrapper = { +declare type Q_LogicKey = '$and' | '$or'; +declare type Q_LinearLogicKey = '$not'; +export declare type MakeFilterWrapper = { [Q in Q_LogicKey]?: Array>; } & { [Q in Q_LinearLogicKey]?: MakeFilterWrapper; } & Partial; -export type MakeFilter = { +export declare type MakeFilter = { '#id'?: NodeId; } & MakeFilterWrapper; -export type RefAttr = { +export declare type RefAttr = { '#attr': A; } | { '#refId': NodeId; diff --git a/lib/types/Endpoint.d.ts b/lib/types/Endpoint.d.ts index fa5415e..42e425b 100644 --- a/lib/types/Endpoint.d.ts +++ b/lib/types/Endpoint.d.ts @@ -8,4 +8,4 @@ export interface EndpointItem, headers: IncomingHttpHeaders, req: IncomingMessage, body?: any) => Promise; } -export type Endpoint> = EndpointItem | EndpointItem[]; +export declare type Endpoint> = EndpointItem | EndpointItem[]; diff --git a/lib/types/Entity.d.ts b/lib/types/Entity.d.ts index 08546ae..31a972f 100644 --- a/lib/types/Entity.d.ts +++ b/lib/types/Entity.d.ts @@ -1,12 +1,12 @@ import { ReadOnlyAction } from '../actions/action'; import { PrimaryKey, Sequence } from './DataType'; -type TriggerDataAttributeType = '$$triggerData$$'; -type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; -type PrimaryKeyAttributeType = 'id'; -type CreateAtAttributeType = '$$createAt$$'; -type UpdateAtAttributeType = '$$updateAt$$'; -type DeleteAtAttributeType = '$$deleteAt$$'; -type SeqAttributeType = '$$seq$$'; +declare type TriggerDataAttributeType = '$$triggerData$$'; +declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; +declare type PrimaryKeyAttributeType = 'id'; +declare type CreateAtAttributeType = '$$createAt$$'; +declare type UpdateAtAttributeType = '$$updateAt$$'; +declare type DeleteAtAttributeType = '$$deleteAt$$'; +declare type SeqAttributeType = '$$seq$$'; export declare const TriggerDataAttribute = "$$triggerData$$"; export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$"; export declare const PrimaryKeyAttribute = "id"; @@ -14,14 +14,14 @@ export declare const CreateAtAttribute = "$$createAt$$"; export declare const UpdateAtAttribute = "$$updateAt$$"; export declare const DeleteAtAttribute = "$$deleteAt$$"; export declare const SeqAttribute = "$$seq$$"; -export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; +export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; export declare const initinctiveAttributes: string[]; -type FilterPart = { +declare type FilterPart = { filter?: A extends 'create' ? undefined : F; indexFrom?: A extends 'create' ? undefined : number; count?: A extends 'create' ? undefined : number; }; -export type SelectOption = { +export declare type SelectOption = { dontCollect?: boolean; blockTrigger?: true; obscure?: boolean; @@ -29,7 +29,7 @@ export type SelectOption = { includedDeleted?: true; dummy?: 1; }; -export type OperateOption = { +export declare type OperateOption = { blockTrigger?: true; dontCollect?: boolean; dontCreateOper?: boolean; @@ -40,19 +40,19 @@ export type OperateOption = { deletePhysically?: boolean; dummy?: 1; }; -export type FormUpdateData = Partial<{ +export declare type FormUpdateData = Partial<{ [K in keyof Omit]: SH[K] | null; }>; -export type FormCreateData = Partial> & { +export declare type FormCreateData = Partial> & { id: string; }; -export type Operation = { +export declare type Operation = { id: string; action: A; data: D; sorter?: S; } & FilterPart; -export type Selection = { +export declare type Selection = { id?: string; action: A; data: D; @@ -68,7 +68,7 @@ export interface EntityShape { export interface GeneralEntityShape extends EntityShape { [K: string]: any; } -export type MakeAction = A; +export declare type MakeAction = A; export interface EntityDef { Schema: GeneralEntityShape; OpSchema: GeneralEntityShape; @@ -90,79 +90,79 @@ export interface EntityDict { export interface OtmSubProjection extends Omit, 'action'> { $entity: string; } -export type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; -export type DeduceAggregationData

= { +export declare type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; +export declare type DeduceAggregationData

= { [A in AggregationOp]?: P; } & { '#aggr'?: P; }; -export type AggregationResult = Array<{ +export declare type AggregationResult = Array<{ [A in AggregationOp]?: number | string; } & { '#data'?: Partial; }>; -export type AttrFilter = { +export declare type AttrFilter = { [K in keyof SH]?: any; }; -type SortAttr = { +declare type SortAttr = { [K: string]: any; }; -type SorterItem = { +declare type SorterItem = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -type Sorter = Array; -type Filter = { +declare type Sorter = Array; +declare type Filter = { [K: string]: any; }; -type Projection = { +declare type Projection = { [K: string]: any; }; -export type DeduceAggregation

= Omit, F, S>, 'action'>; -type CreateOperationData = { +export declare type DeduceAggregation

= Omit, F, S>, 'action'>; +declare type CreateOperationData = { id: string; [K: string]: any; }; -type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; -type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; -type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -type UpdateOperationData = { +declare type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; +declare type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; +declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +declare type UpdateOperationData = { id?: never; [k: string]: any; }; -export type UpdateOperation = Operation; -type RemoveOperationData = { +export declare type UpdateOperation = Operation; +declare type RemoveOperationData = { [k: string]: any; }; -export type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; -export type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; -export type CreateOpResult = { +export declare type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; +export declare type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type CreateOpResult = { a: 'c'; e: T; d: ED[T]['OpSchema'] | ED[T]['OpSchema'][]; }; -export type UpdateOpResult = { +export declare type UpdateOpResult = { a: 'u'; e: T; d: UpdateOperationData; f?: Filter; }; -export type RemoveOpResult = { +export declare type RemoveOpResult = { a: 'r'; e: T; f?: Filter; }; -export type RelationHierarchy = { +export declare type RelationHierarchy = { [K in R]?: R[]; }; -export type CascadeRelationItem = { +export declare type CascadeRelationItem = { cascadePath: string; relations?: string[]; }; -export type CascadeRelationAuth = { +export declare type CascadeRelationAuth = { [K in R]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[]; }; -export type SelectOpResult = { +export declare type SelectOpResult = { a: 's'; d: { [T in keyof ED]?: { @@ -170,16 +170,16 @@ export type SelectOpResult = { }; }; }; -export type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; -export type OperationResult = { +export declare type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; +export declare type OperationResult = { [K in keyof ED]?: { [A in ED[K]['Action']]?: number; }; }; -export type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; -export type Configuration = { +export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; +export declare type Configuration = { actionType?: ActionType; static?: boolean; }; -export type OtmKey = K | `${K}$${number}`; +export declare type OtmKey = K | `${K}$${number}`; export {}; diff --git a/lib/types/Expression.d.ts b/lib/types/Expression.d.ts index a379eb8..cdeb126 100644 --- a/lib/types/Expression.d.ts +++ b/lib/types/Expression.d.ts @@ -1,8 +1,8 @@ import { RefAttr } from "./Demand"; import { Geo } from "./Geo"; -export type RefOrExpression = RefAttr | Expression; -type MathType = RefOrExpression | number; -type StringType = RefOrExpression | string; +export declare type RefOrExpression = RefAttr | Expression; +declare type MathType = RefOrExpression | number; +declare type StringType = RefOrExpression | string; interface Add { $add: (MathType)[]; } @@ -30,8 +30,8 @@ interface Ceil { interface Pow { $pow: [MathType, MathType]; } -type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; -type CmpType = RefOrExpression | string | number; +declare type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; +declare type CmpType = RefOrExpression | string | number; interface Gt { $gt: [CmpType, CmpType]; } @@ -59,14 +59,14 @@ interface EndsWith { interface Includes { $includes: [RefOrExpression | string, RefOrExpression | string]; } -type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; +declare type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; interface BoolTrue { $true: Expression; } interface BoolFalse { $false: Expression; } -type BoolExpression = BoolTrue | BoolFalse; +declare type BoolExpression = BoolTrue | BoolFalse; interface LogicAnd { $and: Expression[]; } @@ -76,7 +76,7 @@ interface LogicOr { interface LogicNot { $not: Expression; } -type LogicExpression = LogicAnd | LogicOr | LogicNot; +declare type LogicExpression = LogicAnd | LogicOr | LogicNot; interface DateYear { $year: RefOrExpression | Date | number; } @@ -110,18 +110,18 @@ interface DateCeiling { interface DateFloor { $dateFloor: [RefOrExpression | Date | number, 'y' | 'M' | 'd' | 'h' | 'm' | 's']; } -type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; +declare type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; interface StringConcat { $concat: StringType[]; } -type StringExpression = StringConcat; +declare type StringExpression = StringConcat; interface GeoContains { $contains: [RefOrExpression | Geo, RefOrExpression | Geo]; } interface GeoDistance { $distance: [RefOrExpression | Geo, RefOrExpression | Geo]; } -type GeoExpression = GeoContains | GeoDistance; +declare type GeoExpression = GeoContains | GeoDistance; interface AggrCountExpression { $$count: RefOrExpression; } @@ -137,9 +137,9 @@ interface AggrMinExpression { interface AggrAvgExpression { $$avg: RefOrExpression; } -export type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; -export type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; -export type ExpressionConstant = Geo | number | Date | string | boolean; +export declare type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; +export declare type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; +export declare type ExpressionConstant = Geo | number | Date | string | boolean; export declare function isGeoExpression(expression: any): expression is GeoExpression; export declare function isDateExpression(expression: any): expression is DateExpression; export declare function isLogicExpression(expression: any): expression is LogicExpression; diff --git a/lib/types/Geo.d.ts b/lib/types/Geo.d.ts index f1ce57e..1747c3f 100644 --- a/lib/types/Geo.d.ts +++ b/lib/types/Geo.d.ts @@ -1,8 +1,8 @@ -export type Point = [number, number]; -export type Path = Array; -export type Polygon = Array; -export type Circle = [Point, number]; -export type SingleGeo = { +export declare type Point = [number, number]; +export declare type Path = Array; +export declare type Polygon = Array; +export declare type Circle = [Point, number]; +export declare type SingleGeo = { type: 'point'; coordinate: Point; } | { @@ -15,4 +15,4 @@ export type SingleGeo = { type: 'circle'; coordinate: Circle; }; -export type Geo = SingleGeo | SingleGeo[]; +export declare type Geo = SingleGeo | SingleGeo[]; diff --git a/lib/types/Locale.d.ts b/lib/types/Locale.d.ts index 9a75128..daac80a 100644 --- a/lib/types/Locale.d.ts +++ b/lib/types/Locale.d.ts @@ -1,17 +1,17 @@ import { EntityShape } from "./Entity"; -type Language = 'zh_CN' | 'en_US'; -type LocaleOfSchema> = { +declare type Language = 'zh_CN' | 'en_US'; +declare type LocaleOfSchema> = { [A in keyof Required>]: string; }; -type LocaleOfStringEnum = { +declare type LocaleOfStringEnum = { [K in A]: string; }; -type LocaleOfValue> = { +declare type LocaleOfValue> = { [K in keyof V]: { [K2 in V[K]]: string; }; }; -export type LocaleDef, Ac extends string, R extends string, V extends Record> = { +export declare type LocaleDef, Ac extends string, R extends string, V extends Record> = { [L in Language]?: { name: string; attr: LocaleOfSchema & { diff --git a/lib/types/Polyfill.d.ts b/lib/types/Polyfill.d.ts index a176b92..a31122b 100644 --- a/lib/types/Polyfill.d.ts +++ b/lib/types/Polyfill.d.ts @@ -1,24 +1,24 @@ -export type OmitInferKey = { +export declare type OmitInferKey = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export type OmitInferValue = { +export declare type OmitInferValue = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export type ValueOf = Obj[keyof Obj]; -export type OneOnly = { +export declare type ValueOf = Obj[keyof Obj]; +export declare type OneOnly = { [key in Exclude]?: undefined; } & Pick; -export type OneOfByKey = { +export declare type OneOfByKey = { [key in keyof Obj]: OneOnly; }; -export type OneOf = ValueOf>; -type IsOptional = { +export declare type OneOf = ValueOf>; +declare type IsOptional = { [K1 in Exclude]: T[K1]; } & { K?: T[K]; } extends T ? K : never; -export type OptionalKeys = { +export declare type OptionalKeys = { [K in keyof T]: IsOptional; }[keyof T]; -export type SyncOrAsync = T | Promise; +export declare type SyncOrAsync = T | Promise; export {}; diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index d6f617b..0c65b45 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict } from "./Entity"; -export type Exportation = { +export declare type Exportation = { name: string; id: string; entity: T; @@ -9,7 +9,7 @@ export type Exportation[]) => string[]; fn: (data: ED[T]['Schema'], context?: AsyncContext, properties?: Record) => Promise>> | Partial>; }; -export type Importation = { +export declare type Importation = { name: string; id: string; entity: T; diff --git a/lib/types/RowStore.d.ts b/lib/types/RowStore.d.ts index 48407a3..03940e1 100644 --- a/lib/types/RowStore.d.ts +++ b/lib/types/RowStore.d.ts @@ -1,10 +1,10 @@ import { OperationResult, EntityDict } from './Entity'; import { StorageSchema } from './Storage'; -export type TxnOption = { +export declare type TxnOption = { isolationLevel: 'repeatable read' | 'serializable'; }; -export type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; -export type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; +export declare type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; +export declare type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; export declare abstract class RowStore { protected storageSchema: StorageSchema; constructor(storageSchema: StorageSchema); diff --git a/lib/types/Storage.d.ts b/lib/types/Storage.d.ts index 3944003..946b4d2 100644 --- a/lib/types/Storage.d.ts +++ b/lib/types/Storage.d.ts @@ -1,7 +1,7 @@ import { ActionType } from '.'; import { EntityDict, EntityShape, InstinctiveAttributes } from './Entity'; import { DataType, DataTypeParams } from './schema/DataTypes'; -export type Ref = 'ref'; +export declare type Ref = 'ref'; export interface Column { name: keyof SH | `${string}State`; size?: number; @@ -28,12 +28,12 @@ export interface Attribute { sequenceStart?: number; enumeration?: string[]; } -export type Attributes = Omit<{ +export declare type Attributes = Omit<{ [attrName in keyof SH]: Attribute; }, InstinctiveAttributes>; export interface EntityConfig { } -export type UniqConstraint = { +export declare type UniqConstraint = { attributes: Array; type?: string; }; @@ -52,6 +52,6 @@ export interface StorageDesc { relation?: string[]; view?: true; } -export type StorageSchema = { +export declare type StorageSchema = { [K in keyof ED]: StorageDesc; }; diff --git a/lib/types/Style.d.ts b/lib/types/Style.d.ts index 2fb60be..2c643b1 100644 --- a/lib/types/Style.d.ts +++ b/lib/types/Style.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from './Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; -type ThemeColor = 'default' | 'success' | 'warning' | 'error'; -export type ColorDict = { +declare type ThemeColor = 'default' | 'success' | 'warning' | 'error'; +export declare type ColorDict = { [T in keyof ED]?: { [A in keyof ED[T]['OpSchema']]?: { [E in ED[T]['OpSchema'][A]]?: ThemeColor | `#${string}`; diff --git a/lib/types/Timer.d.ts b/lib/types/Timer.d.ts index 911d879..6fb8f24 100644 --- a/lib/types/Timer.d.ts +++ b/lib/types/Timer.d.ts @@ -1,12 +1,12 @@ import { RecurrenceRule, RecurrenceSpecDateRange, RecurrenceSpecObjLit } from 'node-schedule'; import { EntityDict } from './Entity'; import { AsyncContext } from '../store/AsyncRowStore'; -type RoutineFn> = (context: Cxt) => Promise; -export type Routine> = { +declare type RoutineFn> = (context: Cxt) => Promise; +export declare type Routine> = { name: string; fn: RoutineFn; }; -export type Timer> = { +export declare type Timer> = { name: string; cron: RecurrenceRule | RecurrenceSpecDateRange | RecurrenceSpecObjLit | Date | string | number; fn: RoutineFn; diff --git a/lib/types/Trigger.d.ts b/lib/types/Trigger.d.ts index 40ba8e6..efe1037 100644 --- a/lib/types/Trigger.d.ts +++ b/lib/types/Trigger.d.ts @@ -33,7 +33,7 @@ export interface CreateTriggerCrossTxn | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; +export declare type CreateTrigger | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; /** * update trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -55,7 +55,7 @@ export interface UpdateTriggerCrossTxn | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; +export declare type UpdateTrigger | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; /** * 同update trigger一样,remove trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -76,7 +76,7 @@ export interface RemoveTriggerCrossTxn | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; +export declare type RemoveTrigger | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; export interface SelectTriggerBase extends TriggerBase { action: 'select'; } @@ -97,8 +97,8 @@ export interface SelectTriggerAfter[]; }, context: Cxt, params?: SelectOption) => Promise | number; } -export type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; -export type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; +export declare type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; +export declare type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; export interface TriggerEntityShape extends EntityShape { $$triggerData$$?: { name: string; diff --git a/lib/types/Watcher.d.ts b/lib/types/Watcher.d.ts index 0fe8135..fccbd9c 100644 --- a/lib/types/Watcher.d.ts +++ b/lib/types/Watcher.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict, OperationResult } from "./Entity"; -type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; +declare type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; export interface BBWatcher { name: string; entity: T; @@ -15,5 +15,5 @@ export interface WBWatcher Promise); fn: (context: Cxt, data: Partial[]) => Promise>; } -export type Watcher> = BBWatcher | WBWatcher; +export declare type Watcher> = BBWatcher | WBWatcher; export {}; diff --git a/lib/types/schema/DataTypes.d.ts b/lib/types/schema/DataTypes.d.ts index 72e0f83..b6479f5 100644 --- a/lib/types/schema/DataTypes.d.ts +++ b/lib/types/schema/DataTypes.d.ts @@ -1,28 +1,28 @@ /** * Column types used for @PrimaryGeneratedColumn() decorator. */ -export type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; +export declare type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; /** * Column types where spatial properties are used. */ -export type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; +export declare type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; /** * Column types where precision and scale properties are used. */ -export type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; +export declare type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; /** * Column types where column length is used. */ -export type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; -export type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; +export declare type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; +export declare type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; /** * All other regular column types. */ -export type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; +export declare type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; /** * Any column type column can be. */ -export type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; +export declare type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; export interface DataTypeParams { length?: number; width?: number; diff --git a/lib/utils/concurrent.d.ts b/lib/utils/concurrent.d.ts index 57d929b..c44feca 100644 --- a/lib/utils/concurrent.d.ts +++ b/lib/utils/concurrent.d.ts @@ -1,4 +1,4 @@ -type Mode = 'S' | 'X'; +declare type Mode = 'S' | 'X'; /** * 模拟一个读写锁,用于同步。 * 注意,千万不要发生自己等自己 diff --git a/lib/utils/uuid.d.ts b/lib/utils/uuid.d.ts index 595afb7..1d7ed56 100644 --- a/lib/utils/uuid.d.ts +++ b/lib/utils/uuid.d.ts @@ -3,7 +3,7 @@ export declare function sequentialUuid({ random }: { }): string; export declare function shrinkUuidTo32Bytes(uuid: string): string; export declare function expandUuidTo36Bytes(uuidShrinked: string): string; -export type GenerateIdOption = { +export declare type GenerateIdOption = { shuffle?: boolean; }; export declare function generateNewIdAsync(option?: GenerateIdOption): Promise; diff --git a/lib/utils/validator.d.ts b/lib/utils/validator.d.ts index ee8269c..08a892a 100644 --- a/lib/utils/validator.d.ts +++ b/lib/utils/validator.d.ts @@ -1,6 +1,6 @@ import { EntityDict } from "../types"; -type ValidatorFunction = (text: string, size?: number) => string | boolean; -type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; +declare type ValidatorFunction = (text: string, size?: number) => string | boolean; +declare type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; export declare const isMobile: ValidatorFunction; export declare const isPassword: ValidatorFunction; export declare const isCaptcha: ValidatorFunction; diff --git a/src/store/actionDef.ts b/src/store/actionDef.ts index 2605131..b4fc991 100644 --- a/src/store/actionDef.ts +++ b/src/store/actionDef.ts @@ -53,22 +53,26 @@ function makeIntrinsicWatchers(schema: StorageSchema) function checkUniqueBetweenRows(rows: Record[], uniqAttrs: string[]) { // 先检查这些行本身之间有无unique冲突 - const uniqRows = uniqBy(rows, (d) => { + const dict: Record = {}; + for (const row of rows) { let s = ''; for (const a of uniqAttrs) { - if (d[a as string] === null || d[a as string] === undefined) { - s + d.id; + if (row[a] === null || row[a] === undefined) { + s + row.id; } else { - s + `-${d[a as string]}`; + s + `-${row[a]}`; } } - return s; - }); - if (uniqRows.length < rows.length) { - throw new OakUniqueViolationException([{ - attrs: uniqAttrs, - }]); + if (dict[s]) { + throw new OakUniqueViolationException([{ + id: row.id, + attrs: uniqAttrs, + }]); + } + else { + dict[s] = 1; + } } } @@ -245,13 +249,13 @@ export function analyzeActionDefDict Date: Tue, 18 Jul 2023 21:56:35 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E5=A4=84=E5=BC=82=E5=B8=B8=E7=9A=84=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/actions/action.d.ts | 16 ++-- lib/actions/relation.d.ts | 2 +- lib/base-app-domain/ActionAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/EntityDict.d.ts | 2 +- lib/base-app-domain/Modi/Action.d.ts | 8 +- lib/base-app-domain/Modi/Schema.d.ts | 48 +++++----- lib/base-app-domain/ModiEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Oper/Schema.d.ts | 52 +++++----- lib/base-app-domain/OperEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Relation/Schema.d.ts | 48 +++++----- lib/base-app-domain/RelationAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/User/Action.d.ts | 8 +- lib/base-app-domain/User/Schema.d.ts | 48 +++++----- .../UserEntityGrant/Schema.d.ts | 48 +++++----- lib/base-app-domain/UserRelation/Schema.d.ts | 56 +++++------ lib/base-app-domain/_SubQuery.d.ts | 20 ++-- lib/entities/ActionAuth.d.ts | 2 +- lib/entities/RelationAuth.d.ts | 2 +- lib/store/TriggerExecutor.d.ts | 2 +- lib/store/actionDef.js | 2 +- lib/timers/oper.d.ts | 2 +- lib/timers/vaccum.d.ts | 4 +- lib/types/Action.d.ts | 14 +-- lib/types/Auth.d.ts | 18 ++-- lib/types/DataType.d.ts | 34 +++---- lib/types/Demand.d.ts | 46 ++++----- lib/types/Endpoint.d.ts | 2 +- lib/types/Entity.d.ts | 94 +++++++++---------- lib/types/Expression.d.ts | 28 +++--- lib/types/Geo.d.ts | 12 +-- lib/types/Locale.d.ts | 10 +- lib/types/Polyfill.d.ts | 18 ++-- lib/types/Port.d.ts | 4 +- lib/types/RowStore.d.ts | 6 +- lib/types/Storage.d.ts | 8 +- lib/types/Style.d.ts | 4 +- lib/types/Timer.d.ts | 6 +- lib/types/Trigger.d.ts | 10 +- lib/types/Watcher.d.ts | 4 +- lib/types/schema/DataTypes.d.ts | 14 +-- lib/utils/concurrent.d.ts | 2 +- lib/utils/uuid.d.ts | 2 +- lib/utils/validator.d.ts | 4 +- src/store/actionDef.ts | 8 +- 44 files changed, 489 insertions(+), 489 deletions(-) diff --git a/lib/actions/action.d.ts b/lib/actions/action.d.ts index 7bec7e8..05b9e4f 100644 --- a/lib/actions/action.d.ts +++ b/lib/actions/action.d.ts @@ -1,16 +1,16 @@ import { ActionDef } from '../types/Action'; -export declare type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; -export declare type AppendOnlyAction = ReadOnlyAction | 'create'; -export declare type ExcludeUpdateAction = AppendOnlyAction | 'remove'; -export declare type ExcludeRemoveAction = AppendOnlyAction | 'update'; -export declare type GenericAction = 'update' | ExcludeUpdateAction; -export declare type RelationAction = 'grant' | 'revoke'; +export type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; +export type AppendOnlyAction = ReadOnlyAction | 'create'; +export type ExcludeUpdateAction = AppendOnlyAction | 'remove'; +export type ExcludeRemoveAction = AppendOnlyAction | 'update'; +export type GenericAction = 'update' | ExcludeUpdateAction; +export type RelationAction = 'grant' | 'revoke'; export declare const readOnlyActions: string[]; export declare const appendOnlyActions: string[]; export declare const excludeUpdateActions: string[]; export declare const exludeRemoveActions: string[]; export declare const genericActions: string[]; export declare const relationActions: string[]; -export declare type AbleAction = 'enable' | 'disable'; -export declare type AbleState = 'enabled' | 'disabled'; +export type AbleAction = 'enable' | 'disable'; +export type AbleState = 'enabled' | 'disabled'; export declare const makeAbleActionDef: (initialState?: AbleState) => ActionDef; diff --git a/lib/actions/relation.d.ts b/lib/actions/relation.d.ts index a53fb29..1f379bb 100644 --- a/lib/actions/relation.d.ts +++ b/lib/actions/relation.d.ts @@ -1,5 +1,5 @@ import { CascadeRelationItem, RelationHierarchy, EntityDict } from "../types/Entity"; -export declare type GenericRelation = 'owner'; +export type GenericRelation = 'owner'; export declare function convertHierarchyToAuth(entity: T, hierarchy: RelationHierarchy>): { [K in NonNullable]?: CascadeRelationItem; }; diff --git a/lib/base-app-domain/ActionAuth/Schema.d.ts b/lib/base-app-domain/ActionAuth/Schema.d.ts index 7b7aad0..16b65df 100644 --- a/lib/base-app-domain/ActionAuth/Schema.d.ts +++ b/lib/base-app-domain/ActionAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -declare type Actions = string[]; -export declare type OpSchema = EntityShape & { +type Actions = string[]; +export type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deActions: Actions; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.ActionAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ declare type AttrFilter = { destEntity: Q_StringValue; deActions: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type ActionAuthIdProjection = OneOf<{ +type ActionAuthIdProjection = OneOf<{ id: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ relationId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type RelationIdSubQuery = Selection; -export declare type ActionAuthIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type RelationIdSubQuery = Selection; +export type ActionAuthIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/EntityDict.d.ts b/lib/base-app-domain/EntityDict.d.ts index 73937b9..4f8ea25 100644 --- a/lib/base-app-domain/EntityDict.d.ts +++ b/lib/base-app-domain/EntityDict.d.ts @@ -8,7 +8,7 @@ import { EntityDef as RelationAuth } from "./RelationAuth/Schema"; import { EntityDef as User } from "./User/Schema"; import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema"; import { EntityDef as UserRelation } from "./UserRelation/Schema"; -export declare type EntityDict = { +export type EntityDict = { actionAuth: ActionAuth; modi: Modi; modiEntity: ModiEntity; diff --git a/lib/base-app-domain/Modi/Action.d.ts b/lib/base-app-domain/Modi/Action.d.ts index 0cae5fa..ecb0a21 100644 --- a/lib/base-app-domain/Modi/Action.d.ts +++ b/lib/base-app-domain/Modi/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction } from "../../actions/action"; -export declare type IState = 'active' | 'applied' | 'abandoned' | string; -export declare type IAction = 'apply' | 'abandon' | string; -export declare type ParticularAction = IAction; -export declare type Action = GenericAction | ParticularAction | string; +export type IState = 'active' | 'applied' | 'abandoned' | string; +export type IAction = 'apply' | 'abandon' | string; +export type ParticularAction = IAction; +export type Action = GenericAction | ParticularAction | string; export declare const actions: string[]; export declare const ActionDefDict: { iState: ActionDef; diff --git a/lib/base-app-domain/Modi/Schema.d.ts b/lib/base-app-domain/Modi/Schema.d.ts index 30dc913..8607bf1 100644 --- a/lib/base-app-domain/Modi/Schema.d.ts +++ b/lib/base-app-domain/Modi/Schema.d.ts @@ -5,7 +5,7 @@ import * as SubQuery from "../_SubQuery"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity"; import { Action, ParticularAction, IState } from "./Action"; import * as ModiEntity from "../ModiEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -15,8 +15,8 @@ export declare type OpSchema = EntityShape & { extra?: Object | null; iState?: IState | null; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -30,7 +30,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.ModiIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ declare type AttrFilter = { extra: Object; iState: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -67,10 +67,10 @@ export declare type Projection = { $entity: "modiEntity"; }; } & Partial>; -declare type ModiIdProjection = OneOf<{ +type ModiIdProjection = OneOf<{ id: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -91,34 +91,34 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & ({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; }) & { modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData & { +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {}; -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type ModiIdSubQuery = Selection; -export declare type EntityDef = { +export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {}; +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type ModiIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/ModiEntity/Schema.d.ts b/lib/base-app-domain/ModiEntity/Schema.d.ts index 3b27a68..7ed5bc0 100644 --- a/lib/base-app-domain/ModiEntity/Schema.d.ts +++ b/lib/base-app-domain/ModiEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.ModiEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ declare type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export declare type Filter> = MakeFilter & ExprOp>; -export declare type Projection = { +export type Filter> = MakeFilter & ExprOp>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export declare type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -declare type ModiEntityIdProjection = OneOf<{ +type ModiEntityIdProjection = OneOf<{ id: number; }>; -declare type ModiIdProjection = OneOf<{ +type ModiIdProjection = OneOf<{ modiId: number; }>; -declare type ActionAuthIdProjection = OneOf<{ +type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ entityId: number; }>; -declare type RelationAuthIdProjection = OneOf<{ +type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ entityId: number; }>; -declare type UserEntityGrantIdProjection = OneOf<{ +type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -declare type UserRelationIdProjection = OneOf<{ +type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ modiId?: never; modi: Modi.CreateSingleOperation; } | { @@ -208,10 +208,10 @@ export declare type CreateOperationData = FormCreateData; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ modi: Modi.CreateSingleOperation; modiId?: never; } | { @@ -253,8 +253,8 @@ export declare type UpdateOperationData = FormUpdateData; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ modi?: Modi.UpdateOperation | Modi.RemoveOperation; })) & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; @@ -271,17 +271,17 @@ export declare type RemoveOperationData = {} & (({ } | { [k: string]: any; }); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type ModiIdSubQuery = Selection; -export declare type ActionAuthIdSubQuery = Selection; -export declare type RelationIdSubQuery = Selection; -export declare type RelationAuthIdSubQuery = Selection; -export declare type UserIdSubQuery = Selection; -export declare type UserEntityGrantIdSubQuery = Selection; -export declare type UserRelationIdSubQuery = Selection; -export declare type ModiEntityIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type ModiIdSubQuery = Selection; +export type ActionAuthIdSubQuery = Selection; +export type RelationIdSubQuery = Selection; +export type RelationAuthIdSubQuery = Selection; +export type UserIdSubQuery = Selection; +export type UserEntityGrantIdSubQuery = Selection; +export type UserRelationIdSubQuery = Selection; +export type ModiEntityIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Oper/Schema.d.ts b/lib/base-app-domain/Oper/Schema.d.ts index 781eb05..06d73c8 100644 --- a/lib/base-app-domain/Oper/Schema.d.ts +++ b/lib/base-app-domain/Oper/Schema.d.ts @@ -6,7 +6,7 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { AppendOnlyAction } from "../../actions/action"; import * as User from "../User/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -14,8 +14,8 @@ export declare type OpSchema = EntityShape & { operatorId?: ForeignKey<"user"> | null; targetEntity: String<32>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -28,7 +28,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.OperIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -41,8 +41,8 @@ declare type AttrFilter = { operator: User.Filter; targetEntity: Q_StringValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -63,13 +63,13 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type OperIdProjection = OneOf<{ +type OperIdProjection = OneOf<{ id: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ operatorId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ operatorId?: never; operator?: User.CreateSingleOperation; } | { @@ -107,10 +107,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ operator: User.CreateSingleOperation; operatorId?: never; } | { @@ -126,15 +126,15 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ operator?: User.UpdateOperation | User.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserIdSubQuery = Selection; -export declare type OperIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserIdSubQuery = Selection; +export type OperIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/OperEntity/Schema.d.ts b/lib/base-app-domain/OperEntity/Schema.d.ts index e3ca574..c9200bd 100644 --- a/lib/base-app-domain/OperEntity/Schema.d.ts +++ b/lib/base-app-domain/OperEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.OperEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ declare type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export declare type Filter> = MakeFilter & ExprOp>; -export declare type Projection = { +export type Filter> = MakeFilter & ExprOp>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export declare type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -declare type OperEntityIdProjection = OneOf<{ +type OperEntityIdProjection = OneOf<{ id: number; }>; -declare type OperIdProjection = OneOf<{ +type OperIdProjection = OneOf<{ operId: number; }>; -declare type ActionAuthIdProjection = OneOf<{ +type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ entityId: number; }>; -declare type RelationAuthIdProjection = OneOf<{ +type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ entityId: number; }>; -declare type UserEntityGrantIdProjection = OneOf<{ +type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -declare type UserRelationIdProjection = OneOf<{ +type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ operId?: never; oper: Oper.CreateSingleOperation; } | { @@ -205,10 +205,10 @@ export declare type CreateOperationData = FormCreateData; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ oper: Oper.CreateSingleOperation; operId?: never; } | { @@ -244,8 +244,8 @@ export declare type UpdateOperationData = FormUpdateData; -export declare type RemoveOperationData = {} & ({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; } | { relation?: Relation.UpdateOperation | Relation.RemoveOperation; @@ -260,17 +260,17 @@ export declare type RemoveOperationData = {} & ({ } | { [k: string]: any; }); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type OperIdSubQuery = Selection; -export declare type ActionAuthIdSubQuery = Selection; -export declare type RelationIdSubQuery = Selection; -export declare type RelationAuthIdSubQuery = Selection; -export declare type UserIdSubQuery = Selection; -export declare type UserEntityGrantIdSubQuery = Selection; -export declare type UserRelationIdSubQuery = Selection; -export declare type OperEntityIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type OperIdSubQuery = Selection; +export type ActionAuthIdSubQuery = Selection; +export type RelationIdSubQuery = Selection; +export type RelationAuthIdSubQuery = Selection; +export type UserIdSubQuery = Selection; +export type UserEntityGrantIdSubQuery = Selection; +export type UserRelationIdSubQuery = Selection; +export type OperEntityIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Relation/Schema.d.ts b/lib/base-app-domain/Relation/Schema.d.ts index fbf5182..6fdc81c 100644 --- a/lib/base-app-domain/Relation/Schema.d.ts +++ b/lib/base-app-domain/Relation/Schema.d.ts @@ -9,14 +9,14 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; display: String<32>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; @@ -34,7 +34,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.RelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ declare type AttrFilter = { name: Q_StringValue; display: Q_StringValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -87,10 +87,10 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ id: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -109,15 +109,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & ({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -128,10 +128,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData & { +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData & { [k: string]: any; actionAuth$relation?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation>; relationAuth$relation?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation>; @@ -139,12 +139,12 @@ export declare type UpdateOperationData = FormUpdateData & { modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {}; -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type RelationIdSubQuery = Selection; -export declare type EntityDef = { +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {}; +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type RelationIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/RelationAuth/Schema.d.ts b/lib/base-app-domain/RelationAuth/Schema.d.ts index 447ab6d..1573262 100644 --- a/lib/base-app-domain/RelationAuth/Schema.d.ts +++ b/lib/base-app-domain/RelationAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -declare type Relations = string[]; -export declare type OpSchema = EntityShape & { +type Relations = string[]; +export type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deRelations: Relations; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.RelationAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ declare type AttrFilter = { destEntity: Q_StringValue; deRelations: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type RelationAuthIdProjection = OneOf<{ +type RelationAuthIdProjection = OneOf<{ id: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ relationId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type RelationIdSubQuery = Selection; -export declare type RelationAuthIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type RelationIdSubQuery = Selection; +export type RelationAuthIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/User/Action.d.ts b/lib/base-app-domain/User/Action.d.ts index 84cc307..46ad254 100644 --- a/lib/base-app-domain/User/Action.d.ts +++ b/lib/base-app-domain/User/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction, RelationAction } from "../../actions/action"; -export declare type UserAction = 'mergeTo' | string; -export declare type UserState = 'normal' | 'merged' | string; -export declare type ParticularAction = UserAction; -export declare type Action = GenericAction | ParticularAction | RelationAction | string; +export type UserAction = 'mergeTo' | string; +export type UserState = 'normal' | 'merged' | string; +export type ParticularAction = UserAction; +export type Action = GenericAction | ParticularAction | RelationAction | string; export declare const actions: string[]; export declare const ActionDefDict: { userState: ActionDef; diff --git a/lib/base-app-domain/User/Schema.d.ts b/lib/base-app-domain/User/Schema.d.ts index ce598a7..d71b44c 100644 --- a/lib/base-app-domain/User/Schema.d.ts +++ b/lib/base-app-domain/User/Schema.d.ts @@ -9,15 +9,15 @@ import * as Oper from "../Oper/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; userState?: UserState | null; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; @@ -37,7 +37,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.UserIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -49,8 +49,8 @@ declare type AttrFilter = { ref: Filter; userState: Q_EnumValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -94,11 +94,11 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ id: number; refId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ refId?: never; ref?: CreateSingleOperation; } | { @@ -144,10 +144,10 @@ export declare type CreateOperationData = FormCreateData modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ ref: CreateSingleOperation; refId?: never; } | { @@ -167,14 +167,14 @@ export declare type UpdateOperationData = FormUpdateData modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ ref?: UpdateOperation | RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserEntityGrant/Schema.d.ts b/lib/base-app-domain/UserEntityGrant/Schema.d.ts index 6334c2e..2d28afe 100644 --- a/lib/base-app-domain/UserEntityGrant/Schema.d.ts +++ b/lib/base-app-domain/UserEntityGrant/Schema.d.ts @@ -6,13 +6,13 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { GenericAction } from "../../actions/action"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; @@ -23,7 +23,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -32,8 +32,8 @@ declare type AttrFilter = { entityId: Q_StringValue; relation: Q_StringValue; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -56,10 +56,10 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type UserEntityGrantIdProjection = OneOf<{ +type UserEntityGrantIdProjection = OneOf<{ id: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -76,15 +76,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & ({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -92,20 +92,20 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData & { +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {}; -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserEntityGrantIdSubQuery = Selection; -export declare type EntityDef = { +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {}; +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserEntityGrantIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserRelation/Schema.d.ts b/lib/base-app-domain/UserRelation/Schema.d.ts index 319fa71..ff97ead 100644 --- a/lib/base-app-domain/UserRelation/Schema.d.ts +++ b/lib/base-app-domain/UserRelation/Schema.d.ts @@ -8,12 +8,12 @@ import * as User from "../User/Schema"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export declare type OpSchema = EntityShape & { +export type OpSchema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; }; -export declare type OpAttr = keyof OpSchema; -export declare type Schema = EntityShape & { +export type OpAttr = keyof OpSchema; +export type Schema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; user: User.Schema; @@ -25,7 +25,7 @@ export declare type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -declare type AttrFilter = { +type AttrFilter = { id: Q_StringValue | SubQuery.UserRelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -35,8 +35,8 @@ declare type AttrFilter = { relationId: Q_StringValue | SubQuery.RelationIdSubQuery; relation: Relation.Filter; }; -export declare type Filter = MakeFilter>; -export declare type Projection = { +export type Filter = MakeFilter>; +export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -60,16 +60,16 @@ export declare type Projection = { $entity: "operEntity"; }; } & Partial>; -declare type UserRelationIdProjection = OneOf<{ +type UserRelationIdProjection = OneOf<{ id: number; }>; -declare type UserIdProjection = OneOf<{ +type UserIdProjection = OneOf<{ userId: number; }>; -declare type RelationIdProjection = OneOf<{ +type RelationIdProjection = OneOf<{ relationId: number; }>; -export declare type SortAttr = { +export type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export declare type SortAttr = { } | { [k: string]: any; } | OneOf>; -export declare type SortNode = { +export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export declare type Sorter = SortNode[]; -export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export declare type Selection

= Omit, "action">; -export declare type Aggregation = DeduceAggregation; -export declare type CreateOperationData = FormCreateData> & (({ +export type Sorter = SortNode[]; +export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export type Selection

= Omit, "action">; +export type Aggregation = DeduceAggregation; +export type CreateOperationData = FormCreateData> & (({ userId?: never; user: User.CreateSingleOperation; } | { @@ -116,10 +116,10 @@ export declare type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export declare type CreateMultipleOperation = OakOperation<"create", Array>; -export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export declare type UpdateOperationData = FormUpdateData> & (({ +export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export type CreateMultipleOperation = OakOperation<"create", Array>; +export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export type UpdateOperationData = FormUpdateData> & (({ user: User.CreateSingleOperation; userId?: never; } | { @@ -148,18 +148,18 @@ export declare type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export declare type RemoveOperationData = {} & (({ +export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export type RemoveOperationData = {} & (({ user?: User.UpdateOperation | User.RemoveOperation; }) & ({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type UserIdSubQuery = Selection; -export declare type RelationIdSubQuery = Selection; -export declare type UserRelationIdSubQuery = Selection; -export declare type EntityDef = { +export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export type UserIdSubQuery = Selection; +export type RelationIdSubQuery = Selection; +export type UserRelationIdSubQuery = Selection; +export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/_SubQuery.d.ts b/lib/base-app-domain/_SubQuery.d.ts index d69d357..c719b6f 100644 --- a/lib/base-app-domain/_SubQuery.d.ts +++ b/lib/base-app-domain/_SubQuery.d.ts @@ -8,36 +8,36 @@ import * as RelationAuth from "./RelationAuth/Schema"; import * as User from "./User/Schema"; import * as UserEntityGrant from "./UserEntityGrant/Schema"; import * as UserRelation from "./UserRelation/Schema"; -export declare type ActionAuthIdSubQuery = { +export type ActionAuthIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.ActionAuthIdSubQuery & { entity: "actionAuth"; }) | any; }; -export declare type ModiIdSubQuery = { +export type ModiIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiIdSubQuery & { entity: "modiEntity"; }) | (Modi.ModiIdSubQuery & { entity: "modi"; }) | any; }; -export declare type ModiEntityIdSubQuery = { +export type ModiEntityIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiEntityIdSubQuery & { entity: "modiEntity"; }) | any; }; -export declare type OperIdSubQuery = { +export type OperIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperIdSubQuery & { entity: "operEntity"; }) | (Oper.OperIdSubQuery & { entity: "oper"; }) | any; }; -export declare type OperEntityIdSubQuery = { +export type OperEntityIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperEntityIdSubQuery & { entity: "operEntity"; }) | any; }; -export declare type RelationIdSubQuery = { +export type RelationIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.RelationIdSubQuery & { entity: "actionAuth"; }) | (RelationAuth.RelationIdSubQuery & { @@ -48,12 +48,12 @@ export declare type RelationIdSubQuery = { entity: "relation"; }) | any; }; -export declare type RelationAuthIdSubQuery = { +export type RelationAuthIdSubQuery = { [K in "$in" | "$nin"]?: (RelationAuth.RelationAuthIdSubQuery & { entity: "relationAuth"; }) | any; }; -export declare type UserIdSubQuery = { +export type UserIdSubQuery = { [K in "$in" | "$nin"]?: (Oper.UserIdSubQuery & { entity: "oper"; }) | (User.UserIdSubQuery & { @@ -64,12 +64,12 @@ export declare type UserIdSubQuery = { entity: "user"; }) | any; }; -export declare type UserEntityGrantIdSubQuery = { +export type UserEntityGrantIdSubQuery = { [K in "$in" | "$nin"]?: (UserEntityGrant.UserEntityGrantIdSubQuery & { entity: "userEntityGrant"; }) | any; }; -export declare type UserRelationIdSubQuery = { +export type UserRelationIdSubQuery = { [K in "$in" | "$nin"]?: (UserRelation.UserRelationIdSubQuery & { entity: "userRelation"; }) | any; diff --git a/lib/entities/ActionAuth.d.ts b/lib/entities/ActionAuth.d.ts index c57a16c..9944266 100644 --- a/lib/entities/ActionAuth.d.ts +++ b/lib/entities/ActionAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -declare type Actions = string[]; +type Actions = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/entities/RelationAuth.d.ts b/lib/entities/RelationAuth.d.ts index dc79db5..8529abb 100644 --- a/lib/entities/RelationAuth.d.ts +++ b/lib/entities/RelationAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -declare type Relations = string[]; +type Relations = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/store/TriggerExecutor.d.ts b/lib/store/TriggerExecutor.d.ts index d63a7ed..77253f7 100644 --- a/lib/store/TriggerExecutor.d.ts +++ b/lib/store/TriggerExecutor.d.ts @@ -16,7 +16,7 @@ export declare class TriggerExecutor { private contextBuilder; constructor(contextBuilder: (cxtString: string) => Promise>, logger?: Logger); registerChecker>(checker: Checker): void; - getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[] | undefined; + getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[]; registerTrigger>(trigger: Trigger): void; unregisterTrigger>(trigger: Trigger): void; private preCommitTrigger; diff --git a/lib/store/actionDef.js b/lib/store/actionDef.js index 159797f..0b928dc 100644 --- a/lib/store/actionDef.js +++ b/lib/store/actionDef.js @@ -124,7 +124,7 @@ function checkUnique(entity, row, context, uniqAttrs, extraFilter) { // 说明有null值,不需要检查约束 return; } - var filter2 = extraFilter ? (0, filter_1.addFilterSegment)([filter, extraFilter]) : filter; + var filter2 = extraFilter ? (0, filter_1.addFilterSegment)(filter, extraFilter) : filter; var count = context.count(entity, { filter: filter2 }, { dontCollect: true }); return checkCountLessThan(count, uniqAttrs, 0, row.id); } diff --git a/lib/timers/oper.d.ts b/lib/timers/oper.d.ts index 9eebe95..0e7e3ac 100644 --- a/lib/timers/oper.d.ts +++ b/lib/timers/oper.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -export declare type VaccumOperOption = { +export type VaccumOperOption = { aliveLine: number; excludeOpers?: { [T in keyof ED]?: ED[T]['Action'][]; diff --git a/lib/timers/vaccum.d.ts b/lib/timers/vaccum.d.ts index bd3ef80..b354f19 100644 --- a/lib/timers/vaccum.d.ts +++ b/lib/timers/vaccum.d.ts @@ -1,12 +1,12 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -declare type VaccumOptionEntity = { +type VaccumOptionEntity = { entity: T; filter?: ED[T]['Selection']['filter']; aliveLine: number; }; -declare type VaccumOption = { +type VaccumOption = { entities: Array>; backupDir?: string; zip?: boolean; diff --git a/lib/types/Action.d.ts b/lib/types/Action.d.ts index 1dc6ee7..e646b40 100644 --- a/lib/types/Action.d.ts +++ b/lib/types/Action.d.ts @@ -1,20 +1,20 @@ import { CascadeRelationItem, EntityDict } from "./Entity"; import { GenericAction } from '../actions/action'; -export declare type Action = string; -export declare type State = string; -export declare type ActionDef = { +export type Action = string; +export type State = string; +export type ActionDef = { stm: { [a in A]: [p: S | S[], n: S]; }; is?: S; }; -export declare type ActionDictOfEntityDict = { +export type ActionDictOfEntityDict = { [T in keyof E]?: { [A in keyof E[T]['OpSchema']]?: ActionDef; }; }; -export declare type CascadeActionItem = CascadeRelationItem; -export declare type CascadeActionAuth = { +export type CascadeActionItem = CascadeRelationItem; +export type CascadeActionAuth = { [K in A | GenericAction]?: CascadeActionItem | (CascadeActionItem | CascadeActionItem[])[]; }; -export declare type ActionOnRemove = 'setNull' | 'remove'; +export type ActionOnRemove = 'setNull' | 'remove'; diff --git a/lib/types/Auth.d.ts b/lib/types/Auth.d.ts index 2023c39..c7c86d6 100644 --- a/lib/types/Auth.d.ts +++ b/lib/types/Auth.d.ts @@ -2,12 +2,12 @@ import { CascadeActionAuth, CascadeRelationAuth, ActionOnRemove, SyncOrAsync } f import { AsyncContext } from "../store/AsyncRowStore"; import { SyncContext } from "../store/SyncRowStore"; import { EntityDict, OperateOption, SelectOption } from "../types/Entity"; -export declare type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; +export type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; /** * conditionalFilter是指该action发生时,operation所操作的行中有满足conditionalFilter的行 * 被转化成trigger的filter条件,详细可看trigger中的说明 */ -export declare type DataChecker | SyncContext> = { +export type DataChecker | SyncContext> = { priority?: number; type: 'data'; entity: T; @@ -15,7 +15,7 @@ export declare type DataChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type RowChecker | SyncContext> = { +export type RowChecker | SyncContext> = { priority?: number; type: 'row'; entity: T; @@ -28,7 +28,7 @@ export declare type RowChecker SyncOrAsync); }; -export declare type RelationChecker | SyncContext> = { +export type RelationChecker | SyncContext> = { priority?: number; type: 'relation'; entity: T; @@ -38,7 +38,7 @@ export declare type RelationChecker string); conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type LogicalChecker | SyncContext> = { +export type LogicalChecker | SyncContext> = { priority?: number; type: 'logical'; when?: 'after'; @@ -47,7 +47,7 @@ export declare type LogicalChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type LogicalRelationChecker | SyncContext> = { +export type LogicalRelationChecker | SyncContext> = { priority?: number; type: 'logicalRelation'; when?: 'after'; @@ -56,14 +56,14 @@ export declare type LogicalRelationChecker any | Promise; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export declare type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; -export declare type AuthDef = { +export type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; +export type AuthDef = { relationAuth?: CascadeRelationAuth>; actionAuth?: CascadeActionAuth; cascadeRemove?: { [E in (keyof ED | keyof ED[T]['Schema'] | '@entity')]?: ActionOnRemove; }; }; -export declare type AuthDefDict = { +export type AuthDefDict = { [K in keyof ED]?: AuthDef; }; diff --git a/lib/types/DataType.d.ts b/lib/types/DataType.d.ts index e3b63be..df83a90 100644 --- a/lib/types/DataType.d.ts +++ b/lib/types/DataType.d.ts @@ -1,21 +1,21 @@ import { Geo, SingleGeo } from "./Geo"; -export declare type Int = number; -export declare type Uint = number; -export declare type Double

= number; -export declare type Float

= number; -export declare type String = string; -export declare type Text = string; -export declare type Image = string; -export declare type File = string; -export declare type Datetime = number | Date; -export declare type Day = number | Date; -export declare type Time = number | Date; -export declare type Boolean = boolean; -export declare type Price = number; -export declare type PrimaryKey = string; -export declare type ForeignKey = string; -export declare type Sequence = string; +export type Int = number; +export type Uint = number; +export type Double

= number; +export type Float

= number; +export type String = string; +export type Text = string; +export type Image = string; +export type File = string; +export type Datetime = number | Date; +export type Day = number | Date; +export type Time = number | Date; +export type Boolean = boolean; +export type Price = number; +export type PrimaryKey = string; +export type ForeignKey = string; +export type Sequence = string; export { Geo, SingleGeo } from './Geo'; -export declare type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; +export type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; export declare const types: string[]; export declare const unIndexedTypes: string[]; diff --git a/lib/types/Demand.d.ts b/lib/types/Demand.d.ts index c2605fe..041672f 100644 --- a/lib/types/Demand.d.ts +++ b/lib/types/Demand.d.ts @@ -1,12 +1,12 @@ import { RefOrExpression } from "./Expression"; import { OneOf } from "./Polyfill"; export declare const EXPRESSION_PREFIX = "$expr"; -export declare type NodeId = `node-${number}`; -export declare type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; -export declare type ExprOp = { +export type NodeId = `node-${number}`; +export type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; +export type ExprOp = { [K in ExpressionKey]: RefOrExpression; }; -export declare type Q_NumberComparisonValue = number | OneOf<{ +export type Q_NumberComparisonValue = number | OneOf<{ $gt: number; $lt: number; $gte: number; @@ -17,7 +17,7 @@ export declare type Q_NumberComparisonValue = number | OneOf<{ $nin: number[]; $between: [number, number]; }>; -export declare type Q_StringComparisonValue = string | OneOf<{ +export type Q_StringComparisonValue = string | OneOf<{ $gt: string; $lt: string; $gte: string; @@ -30,44 +30,44 @@ export declare type Q_StringComparisonValue = string | OneOf<{ $in: string[]; $nin: string[]; }>; -export declare type Q_BooleanComparisonValue = boolean; -export declare type Q_DateComparisonValue = Q_NumberComparisonValue; -export declare type Q_EnumComparisonValue = E | OneOf<{ +export type Q_BooleanComparisonValue = boolean; +export type Q_DateComparisonValue = Q_NumberComparisonValue; +export type Q_EnumComparisonValue = E | OneOf<{ $in: E[]; $nin: E[]; }>; -export declare type Q_ExistsValue = { +export type Q_ExistsValue = { $exists: boolean; }; -export declare type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; -export declare type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; -export declare type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; -export declare type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; -export declare type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; -export declare type Q_State = S | { +export type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; +export type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; +export type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; +export type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; +export type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; +export type Q_State = S | { $in: S[]; } | { $nin: S[]; } | Q_ExistsValue; -export declare type Q_FullTextValue = { +export type Q_FullTextValue = { $search: string; $language?: 'zh_CN' | 'en_US'; }; -export declare type Q_FullTextKey = '$text'; -export declare type FulltextFilter = { +export type Q_FullTextKey = '$text'; +export type FulltextFilter = { [F in Q_FullTextKey]?: Q_FullTextValue; }; -declare type Q_LogicKey = '$and' | '$or'; -declare type Q_LinearLogicKey = '$not'; -export declare type MakeFilterWrapper = { +type Q_LogicKey = '$and' | '$or'; +type Q_LinearLogicKey = '$not'; +export type MakeFilterWrapper = { [Q in Q_LogicKey]?: Array>; } & { [Q in Q_LinearLogicKey]?: MakeFilterWrapper; } & Partial; -export declare type MakeFilter = { +export type MakeFilter = { '#id'?: NodeId; } & MakeFilterWrapper; -export declare type RefAttr = { +export type RefAttr = { '#attr': A; } | { '#refId': NodeId; diff --git a/lib/types/Endpoint.d.ts b/lib/types/Endpoint.d.ts index 42e425b..fa5415e 100644 --- a/lib/types/Endpoint.d.ts +++ b/lib/types/Endpoint.d.ts @@ -8,4 +8,4 @@ export interface EndpointItem, headers: IncomingHttpHeaders, req: IncomingMessage, body?: any) => Promise; } -export declare type Endpoint> = EndpointItem | EndpointItem[]; +export type Endpoint> = EndpointItem | EndpointItem[]; diff --git a/lib/types/Entity.d.ts b/lib/types/Entity.d.ts index 31a972f..08546ae 100644 --- a/lib/types/Entity.d.ts +++ b/lib/types/Entity.d.ts @@ -1,12 +1,12 @@ import { ReadOnlyAction } from '../actions/action'; import { PrimaryKey, Sequence } from './DataType'; -declare type TriggerDataAttributeType = '$$triggerData$$'; -declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; -declare type PrimaryKeyAttributeType = 'id'; -declare type CreateAtAttributeType = '$$createAt$$'; -declare type UpdateAtAttributeType = '$$updateAt$$'; -declare type DeleteAtAttributeType = '$$deleteAt$$'; -declare type SeqAttributeType = '$$seq$$'; +type TriggerDataAttributeType = '$$triggerData$$'; +type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; +type PrimaryKeyAttributeType = 'id'; +type CreateAtAttributeType = '$$createAt$$'; +type UpdateAtAttributeType = '$$updateAt$$'; +type DeleteAtAttributeType = '$$deleteAt$$'; +type SeqAttributeType = '$$seq$$'; export declare const TriggerDataAttribute = "$$triggerData$$"; export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$"; export declare const PrimaryKeyAttribute = "id"; @@ -14,14 +14,14 @@ export declare const CreateAtAttribute = "$$createAt$$"; export declare const UpdateAtAttribute = "$$updateAt$$"; export declare const DeleteAtAttribute = "$$deleteAt$$"; export declare const SeqAttribute = "$$seq$$"; -export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; +export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; export declare const initinctiveAttributes: string[]; -declare type FilterPart = { +type FilterPart = { filter?: A extends 'create' ? undefined : F; indexFrom?: A extends 'create' ? undefined : number; count?: A extends 'create' ? undefined : number; }; -export declare type SelectOption = { +export type SelectOption = { dontCollect?: boolean; blockTrigger?: true; obscure?: boolean; @@ -29,7 +29,7 @@ export declare type SelectOption = { includedDeleted?: true; dummy?: 1; }; -export declare type OperateOption = { +export type OperateOption = { blockTrigger?: true; dontCollect?: boolean; dontCreateOper?: boolean; @@ -40,19 +40,19 @@ export declare type OperateOption = { deletePhysically?: boolean; dummy?: 1; }; -export declare type FormUpdateData = Partial<{ +export type FormUpdateData = Partial<{ [K in keyof Omit]: SH[K] | null; }>; -export declare type FormCreateData = Partial> & { +export type FormCreateData = Partial> & { id: string; }; -export declare type Operation = { +export type Operation = { id: string; action: A; data: D; sorter?: S; } & FilterPart; -export declare type Selection = { +export type Selection = { id?: string; action: A; data: D; @@ -68,7 +68,7 @@ export interface EntityShape { export interface GeneralEntityShape extends EntityShape { [K: string]: any; } -export declare type MakeAction = A; +export type MakeAction = A; export interface EntityDef { Schema: GeneralEntityShape; OpSchema: GeneralEntityShape; @@ -90,79 +90,79 @@ export interface EntityDict { export interface OtmSubProjection extends Omit, 'action'> { $entity: string; } -export declare type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; -export declare type DeduceAggregationData

= { +export type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; +export type DeduceAggregationData

= { [A in AggregationOp]?: P; } & { '#aggr'?: P; }; -export declare type AggregationResult = Array<{ +export type AggregationResult = Array<{ [A in AggregationOp]?: number | string; } & { '#data'?: Partial; }>; -export declare type AttrFilter = { +export type AttrFilter = { [K in keyof SH]?: any; }; -declare type SortAttr = { +type SortAttr = { [K: string]: any; }; -declare type SorterItem = { +type SorterItem = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -declare type Sorter = Array; -declare type Filter = { +type Sorter = Array; +type Filter = { [K: string]: any; }; -declare type Projection = { +type Projection = { [K: string]: any; }; -export declare type DeduceAggregation

= Omit, F, S>, 'action'>; -declare type CreateOperationData = { +export type DeduceAggregation

= Omit, F, S>, 'action'>; +type CreateOperationData = { id: string; [K: string]: any; }; -declare type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; -declare type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; -declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -declare type UpdateOperationData = { +type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; +type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; +type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +type UpdateOperationData = { id?: never; [k: string]: any; }; -export declare type UpdateOperation = Operation; -declare type RemoveOperationData = { +export type UpdateOperation = Operation; +type RemoveOperationData = { [k: string]: any; }; -export declare type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; -export declare type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; -export declare type CreateOpResult = { +export type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; +export type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; +export type CreateOpResult = { a: 'c'; e: T; d: ED[T]['OpSchema'] | ED[T]['OpSchema'][]; }; -export declare type UpdateOpResult = { +export type UpdateOpResult = { a: 'u'; e: T; d: UpdateOperationData; f?: Filter; }; -export declare type RemoveOpResult = { +export type RemoveOpResult = { a: 'r'; e: T; f?: Filter; }; -export declare type RelationHierarchy = { +export type RelationHierarchy = { [K in R]?: R[]; }; -export declare type CascadeRelationItem = { +export type CascadeRelationItem = { cascadePath: string; relations?: string[]; }; -export declare type CascadeRelationAuth = { +export type CascadeRelationAuth = { [K in R]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[]; }; -export declare type SelectOpResult = { +export type SelectOpResult = { a: 's'; d: { [T in keyof ED]?: { @@ -170,16 +170,16 @@ export declare type SelectOpResult = { }; }; }; -export declare type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; -export declare type OperationResult = { +export type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; +export type OperationResult = { [K in keyof ED]?: { [A in ED[K]['Action']]?: number; }; }; -export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; -export declare type Configuration = { +export type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; +export type Configuration = { actionType?: ActionType; static?: boolean; }; -export declare type OtmKey = K | `${K}$${number}`; +export type OtmKey = K | `${K}$${number}`; export {}; diff --git a/lib/types/Expression.d.ts b/lib/types/Expression.d.ts index cdeb126..a379eb8 100644 --- a/lib/types/Expression.d.ts +++ b/lib/types/Expression.d.ts @@ -1,8 +1,8 @@ import { RefAttr } from "./Demand"; import { Geo } from "./Geo"; -export declare type RefOrExpression = RefAttr | Expression; -declare type MathType = RefOrExpression | number; -declare type StringType = RefOrExpression | string; +export type RefOrExpression = RefAttr | Expression; +type MathType = RefOrExpression | number; +type StringType = RefOrExpression | string; interface Add { $add: (MathType)[]; } @@ -30,8 +30,8 @@ interface Ceil { interface Pow { $pow: [MathType, MathType]; } -declare type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; -declare type CmpType = RefOrExpression | string | number; +type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; +type CmpType = RefOrExpression | string | number; interface Gt { $gt: [CmpType, CmpType]; } @@ -59,14 +59,14 @@ interface EndsWith { interface Includes { $includes: [RefOrExpression | string, RefOrExpression | string]; } -declare type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; +type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; interface BoolTrue { $true: Expression; } interface BoolFalse { $false: Expression; } -declare type BoolExpression = BoolTrue | BoolFalse; +type BoolExpression = BoolTrue | BoolFalse; interface LogicAnd { $and: Expression[]; } @@ -76,7 +76,7 @@ interface LogicOr { interface LogicNot { $not: Expression; } -declare type LogicExpression = LogicAnd | LogicOr | LogicNot; +type LogicExpression = LogicAnd | LogicOr | LogicNot; interface DateYear { $year: RefOrExpression | Date | number; } @@ -110,18 +110,18 @@ interface DateCeiling { interface DateFloor { $dateFloor: [RefOrExpression | Date | number, 'y' | 'M' | 'd' | 'h' | 'm' | 's']; } -declare type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; +type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; interface StringConcat { $concat: StringType[]; } -declare type StringExpression = StringConcat; +type StringExpression = StringConcat; interface GeoContains { $contains: [RefOrExpression | Geo, RefOrExpression | Geo]; } interface GeoDistance { $distance: [RefOrExpression | Geo, RefOrExpression | Geo]; } -declare type GeoExpression = GeoContains | GeoDistance; +type GeoExpression = GeoContains | GeoDistance; interface AggrCountExpression { $$count: RefOrExpression; } @@ -137,9 +137,9 @@ interface AggrMinExpression { interface AggrAvgExpression { $$avg: RefOrExpression; } -export declare type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; -export declare type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; -export declare type ExpressionConstant = Geo | number | Date | string | boolean; +export type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; +export type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; +export type ExpressionConstant = Geo | number | Date | string | boolean; export declare function isGeoExpression(expression: any): expression is GeoExpression; export declare function isDateExpression(expression: any): expression is DateExpression; export declare function isLogicExpression(expression: any): expression is LogicExpression; diff --git a/lib/types/Geo.d.ts b/lib/types/Geo.d.ts index 1747c3f..f1ce57e 100644 --- a/lib/types/Geo.d.ts +++ b/lib/types/Geo.d.ts @@ -1,8 +1,8 @@ -export declare type Point = [number, number]; -export declare type Path = Array; -export declare type Polygon = Array; -export declare type Circle = [Point, number]; -export declare type SingleGeo = { +export type Point = [number, number]; +export type Path = Array; +export type Polygon = Array; +export type Circle = [Point, number]; +export type SingleGeo = { type: 'point'; coordinate: Point; } | { @@ -15,4 +15,4 @@ export declare type SingleGeo = { type: 'circle'; coordinate: Circle; }; -export declare type Geo = SingleGeo | SingleGeo[]; +export type Geo = SingleGeo | SingleGeo[]; diff --git a/lib/types/Locale.d.ts b/lib/types/Locale.d.ts index daac80a..9a75128 100644 --- a/lib/types/Locale.d.ts +++ b/lib/types/Locale.d.ts @@ -1,17 +1,17 @@ import { EntityShape } from "./Entity"; -declare type Language = 'zh_CN' | 'en_US'; -declare type LocaleOfSchema> = { +type Language = 'zh_CN' | 'en_US'; +type LocaleOfSchema> = { [A in keyof Required>]: string; }; -declare type LocaleOfStringEnum = { +type LocaleOfStringEnum = { [K in A]: string; }; -declare type LocaleOfValue> = { +type LocaleOfValue> = { [K in keyof V]: { [K2 in V[K]]: string; }; }; -export declare type LocaleDef, Ac extends string, R extends string, V extends Record> = { +export type LocaleDef, Ac extends string, R extends string, V extends Record> = { [L in Language]?: { name: string; attr: LocaleOfSchema & { diff --git a/lib/types/Polyfill.d.ts b/lib/types/Polyfill.d.ts index a31122b..a176b92 100644 --- a/lib/types/Polyfill.d.ts +++ b/lib/types/Polyfill.d.ts @@ -1,24 +1,24 @@ -export declare type OmitInferKey = { +export type OmitInferKey = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export declare type OmitInferValue = { +export type OmitInferValue = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export declare type ValueOf = Obj[keyof Obj]; -export declare type OneOnly = { +export type ValueOf = Obj[keyof Obj]; +export type OneOnly = { [key in Exclude]?: undefined; } & Pick; -export declare type OneOfByKey = { +export type OneOfByKey = { [key in keyof Obj]: OneOnly; }; -export declare type OneOf = ValueOf>; -declare type IsOptional = { +export type OneOf = ValueOf>; +type IsOptional = { [K1 in Exclude]: T[K1]; } & { K?: T[K]; } extends T ? K : never; -export declare type OptionalKeys = { +export type OptionalKeys = { [K in keyof T]: IsOptional; }[keyof T]; -export declare type SyncOrAsync = T | Promise; +export type SyncOrAsync = T | Promise; export {}; diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index 0c65b45..d6f617b 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict } from "./Entity"; -export declare type Exportation = { +export type Exportation = { name: string; id: string; entity: T; @@ -9,7 +9,7 @@ export declare type Exportation[]) => string[]; fn: (data: ED[T]['Schema'], context?: AsyncContext, properties?: Record) => Promise>> | Partial>; }; -export declare type Importation = { +export type Importation = { name: string; id: string; entity: T; diff --git a/lib/types/RowStore.d.ts b/lib/types/RowStore.d.ts index 03940e1..48407a3 100644 --- a/lib/types/RowStore.d.ts +++ b/lib/types/RowStore.d.ts @@ -1,10 +1,10 @@ import { OperationResult, EntityDict } from './Entity'; import { StorageSchema } from './Storage'; -export declare type TxnOption = { +export type TxnOption = { isolationLevel: 'repeatable read' | 'serializable'; }; -export declare type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; -export declare type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; +export type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; +export type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; export declare abstract class RowStore { protected storageSchema: StorageSchema; constructor(storageSchema: StorageSchema); diff --git a/lib/types/Storage.d.ts b/lib/types/Storage.d.ts index 946b4d2..3944003 100644 --- a/lib/types/Storage.d.ts +++ b/lib/types/Storage.d.ts @@ -1,7 +1,7 @@ import { ActionType } from '.'; import { EntityDict, EntityShape, InstinctiveAttributes } from './Entity'; import { DataType, DataTypeParams } from './schema/DataTypes'; -export declare type Ref = 'ref'; +export type Ref = 'ref'; export interface Column { name: keyof SH | `${string}State`; size?: number; @@ -28,12 +28,12 @@ export interface Attribute { sequenceStart?: number; enumeration?: string[]; } -export declare type Attributes = Omit<{ +export type Attributes = Omit<{ [attrName in keyof SH]: Attribute; }, InstinctiveAttributes>; export interface EntityConfig { } -export declare type UniqConstraint = { +export type UniqConstraint = { attributes: Array; type?: string; }; @@ -52,6 +52,6 @@ export interface StorageDesc { relation?: string[]; view?: true; } -export declare type StorageSchema = { +export type StorageSchema = { [K in keyof ED]: StorageDesc; }; diff --git a/lib/types/Style.d.ts b/lib/types/Style.d.ts index 2c643b1..2fb60be 100644 --- a/lib/types/Style.d.ts +++ b/lib/types/Style.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from './Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; -declare type ThemeColor = 'default' | 'success' | 'warning' | 'error'; -export declare type ColorDict = { +type ThemeColor = 'default' | 'success' | 'warning' | 'error'; +export type ColorDict = { [T in keyof ED]?: { [A in keyof ED[T]['OpSchema']]?: { [E in ED[T]['OpSchema'][A]]?: ThemeColor | `#${string}`; diff --git a/lib/types/Timer.d.ts b/lib/types/Timer.d.ts index 6fb8f24..911d879 100644 --- a/lib/types/Timer.d.ts +++ b/lib/types/Timer.d.ts @@ -1,12 +1,12 @@ import { RecurrenceRule, RecurrenceSpecDateRange, RecurrenceSpecObjLit } from 'node-schedule'; import { EntityDict } from './Entity'; import { AsyncContext } from '../store/AsyncRowStore'; -declare type RoutineFn> = (context: Cxt) => Promise; -export declare type Routine> = { +type RoutineFn> = (context: Cxt) => Promise; +export type Routine> = { name: string; fn: RoutineFn; }; -export declare type Timer> = { +export type Timer> = { name: string; cron: RecurrenceRule | RecurrenceSpecDateRange | RecurrenceSpecObjLit | Date | string | number; fn: RoutineFn; diff --git a/lib/types/Trigger.d.ts b/lib/types/Trigger.d.ts index efe1037..40ba8e6 100644 --- a/lib/types/Trigger.d.ts +++ b/lib/types/Trigger.d.ts @@ -33,7 +33,7 @@ export interface CreateTriggerCrossTxn | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; +export type CreateTrigger | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; /** * update trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -55,7 +55,7 @@ export interface UpdateTriggerCrossTxn | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; +export type UpdateTrigger | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; /** * 同update trigger一样,remove trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -76,7 +76,7 @@ export interface RemoveTriggerCrossTxn | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; +export type RemoveTrigger | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; export interface SelectTriggerBase extends TriggerBase { action: 'select'; } @@ -97,8 +97,8 @@ export interface SelectTriggerAfter[]; }, context: Cxt, params?: SelectOption) => Promise | number; } -export declare type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; -export declare type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; +export type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; +export type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; export interface TriggerEntityShape extends EntityShape { $$triggerData$$?: { name: string; diff --git a/lib/types/Watcher.d.ts b/lib/types/Watcher.d.ts index fccbd9c..0fe8135 100644 --- a/lib/types/Watcher.d.ts +++ b/lib/types/Watcher.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict, OperationResult } from "./Entity"; -declare type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; +type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; export interface BBWatcher { name: string; entity: T; @@ -15,5 +15,5 @@ export interface WBWatcher Promise); fn: (context: Cxt, data: Partial[]) => Promise>; } -export declare type Watcher> = BBWatcher | WBWatcher; +export type Watcher> = BBWatcher | WBWatcher; export {}; diff --git a/lib/types/schema/DataTypes.d.ts b/lib/types/schema/DataTypes.d.ts index b6479f5..72e0f83 100644 --- a/lib/types/schema/DataTypes.d.ts +++ b/lib/types/schema/DataTypes.d.ts @@ -1,28 +1,28 @@ /** * Column types used for @PrimaryGeneratedColumn() decorator. */ -export declare type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; +export type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; /** * Column types where spatial properties are used. */ -export declare type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; +export type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; /** * Column types where precision and scale properties are used. */ -export declare type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; +export type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; /** * Column types where column length is used. */ -export declare type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; -export declare type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; +export type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; +export type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; /** * All other regular column types. */ -export declare type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; +export type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; /** * Any column type column can be. */ -export declare type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; +export type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; export interface DataTypeParams { length?: number; width?: number; diff --git a/lib/utils/concurrent.d.ts b/lib/utils/concurrent.d.ts index c44feca..57d929b 100644 --- a/lib/utils/concurrent.d.ts +++ b/lib/utils/concurrent.d.ts @@ -1,4 +1,4 @@ -declare type Mode = 'S' | 'X'; +type Mode = 'S' | 'X'; /** * 模拟一个读写锁,用于同步。 * 注意,千万不要发生自己等自己 diff --git a/lib/utils/uuid.d.ts b/lib/utils/uuid.d.ts index 1d7ed56..595afb7 100644 --- a/lib/utils/uuid.d.ts +++ b/lib/utils/uuid.d.ts @@ -3,7 +3,7 @@ export declare function sequentialUuid({ random }: { }): string; export declare function shrinkUuidTo32Bytes(uuid: string): string; export declare function expandUuidTo36Bytes(uuidShrinked: string): string; -export declare type GenerateIdOption = { +export type GenerateIdOption = { shuffle?: boolean; }; export declare function generateNewIdAsync(option?: GenerateIdOption): Promise; diff --git a/lib/utils/validator.d.ts b/lib/utils/validator.d.ts index 08a892a..ee8269c 100644 --- a/lib/utils/validator.d.ts +++ b/lib/utils/validator.d.ts @@ -1,6 +1,6 @@ import { EntityDict } from "../types"; -declare type ValidatorFunction = (text: string, size?: number) => string | boolean; -declare type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; +type ValidatorFunction = (text: string, size?: number) => string | boolean; +type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; export declare const isMobile: ValidatorFunction; export declare const isPassword: ValidatorFunction; export declare const isCaptcha: ValidatorFunction; diff --git a/src/store/actionDef.ts b/src/store/actionDef.ts index b4fc991..f6264f8 100644 --- a/src/store/actionDef.ts +++ b/src/store/actionDef.ts @@ -114,7 +114,7 @@ function checkUnique | AsyncC // 说明有null值,不需要检查约束 return; } - const filter2 = extraFilter ? addFilterSegment([filter, extraFilter]) : filter; + const filter2 = extraFilter ? addFilterSegment(filter, extraFilter) : filter; const count = context.count(entity, { filter: filter2 }, { dontCollect: true }); return checkCountLessThan(count, uniqAttrs, 0, row.id) } @@ -203,7 +203,7 @@ export function analyzeActionDefDict { const { data } = operation; - + if (data instanceof Array) { checkUniqueBetweenRows(data, uniqAttrs); const checkResult = data.map( @@ -262,7 +262,7 @@ export function analyzeActionDefDict undefined ); - } + } } // 否则需要结合本行现有的属性来进行检查 const projection = { id: 1 }; @@ -287,7 +287,7 @@ export function analyzeActionDefDict undefined ); - } + } }; const currentRows = context.select(entity, { From 884e3e1016d9a6680023254e4d071bbb272bf245 Mon Sep 17 00:00:00 2001 From: Xc Date: Tue, 18 Jul 2023 21:59:22 +0800 Subject: [PATCH 9/9] build --- lib/actions/action.d.ts | 16 ++-- lib/actions/relation.d.ts | 2 +- lib/base-app-domain/ActionAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/EntityDict.d.ts | 2 +- lib/base-app-domain/Modi/Action.d.ts | 8 +- lib/base-app-domain/Modi/Schema.d.ts | 48 +++++----- lib/base-app-domain/ModiEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Oper/Schema.d.ts | 52 +++++----- lib/base-app-domain/OperEntity/Schema.d.ts | 76 +++++++-------- lib/base-app-domain/Relation/Schema.d.ts | 48 +++++----- lib/base-app-domain/RelationAuth/Schema.d.ts | 54 +++++------ lib/base-app-domain/User/Action.d.ts | 8 +- lib/base-app-domain/User/Schema.d.ts | 48 +++++----- .../UserEntityGrant/Schema.d.ts | 48 +++++----- lib/base-app-domain/UserRelation/Schema.d.ts | 56 +++++------ lib/base-app-domain/_SubQuery.d.ts | 20 ++-- lib/entities/ActionAuth.d.ts | 2 +- lib/entities/RelationAuth.d.ts | 2 +- lib/store/TriggerExecutor.d.ts | 2 +- lib/timers/oper.d.ts | 2 +- lib/timers/vaccum.d.ts | 4 +- lib/types/Action.d.ts | 14 +-- lib/types/Auth.d.ts | 18 ++-- lib/types/DataType.d.ts | 34 +++---- lib/types/Demand.d.ts | 46 ++++----- lib/types/Endpoint.d.ts | 2 +- lib/types/Entity.d.ts | 94 +++++++++---------- lib/types/Expression.d.ts | 28 +++--- lib/types/Geo.d.ts | 12 +-- lib/types/Locale.d.ts | 10 +- lib/types/Polyfill.d.ts | 18 ++-- lib/types/Port.d.ts | 4 +- lib/types/RowStore.d.ts | 6 +- lib/types/Storage.d.ts | 8 +- lib/types/Style.d.ts | 4 +- lib/types/Timer.d.ts | 6 +- lib/types/Trigger.d.ts | 10 +- lib/types/Watcher.d.ts | 4 +- lib/types/schema/DataTypes.d.ts | 14 +-- lib/utils/concurrent.d.ts | 2 +- lib/utils/uuid.d.ts | 2 +- lib/utils/validator.d.ts | 4 +- 42 files changed, 484 insertions(+), 484 deletions(-) diff --git a/lib/actions/action.d.ts b/lib/actions/action.d.ts index 05b9e4f..7bec7e8 100644 --- a/lib/actions/action.d.ts +++ b/lib/actions/action.d.ts @@ -1,16 +1,16 @@ import { ActionDef } from '../types/Action'; -export type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; -export type AppendOnlyAction = ReadOnlyAction | 'create'; -export type ExcludeUpdateAction = AppendOnlyAction | 'remove'; -export type ExcludeRemoveAction = AppendOnlyAction | 'update'; -export type GenericAction = 'update' | ExcludeUpdateAction; -export type RelationAction = 'grant' | 'revoke'; +export declare type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download' | 'aggregate'; +export declare type AppendOnlyAction = ReadOnlyAction | 'create'; +export declare type ExcludeUpdateAction = AppendOnlyAction | 'remove'; +export declare type ExcludeRemoveAction = AppendOnlyAction | 'update'; +export declare type GenericAction = 'update' | ExcludeUpdateAction; +export declare type RelationAction = 'grant' | 'revoke'; export declare const readOnlyActions: string[]; export declare const appendOnlyActions: string[]; export declare const excludeUpdateActions: string[]; export declare const exludeRemoveActions: string[]; export declare const genericActions: string[]; export declare const relationActions: string[]; -export type AbleAction = 'enable' | 'disable'; -export type AbleState = 'enabled' | 'disabled'; +export declare type AbleAction = 'enable' | 'disable'; +export declare type AbleState = 'enabled' | 'disabled'; export declare const makeAbleActionDef: (initialState?: AbleState) => ActionDef; diff --git a/lib/actions/relation.d.ts b/lib/actions/relation.d.ts index 1f379bb..a53fb29 100644 --- a/lib/actions/relation.d.ts +++ b/lib/actions/relation.d.ts @@ -1,5 +1,5 @@ import { CascadeRelationItem, RelationHierarchy, EntityDict } from "../types/Entity"; -export type GenericRelation = 'owner'; +export declare type GenericRelation = 'owner'; export declare function convertHierarchyToAuth(entity: T, hierarchy: RelationHierarchy>): { [K in NonNullable]?: CascadeRelationItem; }; diff --git a/lib/base-app-domain/ActionAuth/Schema.d.ts b/lib/base-app-domain/ActionAuth/Schema.d.ts index 16b65df..7b7aad0 100644 --- a/lib/base-app-domain/ActionAuth/Schema.d.ts +++ b/lib/base-app-domain/ActionAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -type Actions = string[]; -export type OpSchema = EntityShape & { +declare type Actions = string[]; +export declare type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deActions: Actions; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.ActionAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ type AttrFilter = { destEntity: Q_StringValue; deActions: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type ActionAuthIdProjection = OneOf<{ +declare type ActionAuthIdProjection = OneOf<{ id: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ relationId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export type CreateOperationData = FormCreateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export type UpdateOperationData = FormUpdateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type RelationIdSubQuery = Selection; -export type ActionAuthIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type RelationIdSubQuery = Selection; +export declare type ActionAuthIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/EntityDict.d.ts b/lib/base-app-domain/EntityDict.d.ts index 4f8ea25..73937b9 100644 --- a/lib/base-app-domain/EntityDict.d.ts +++ b/lib/base-app-domain/EntityDict.d.ts @@ -8,7 +8,7 @@ import { EntityDef as RelationAuth } from "./RelationAuth/Schema"; import { EntityDef as User } from "./User/Schema"; import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema"; import { EntityDef as UserRelation } from "./UserRelation/Schema"; -export type EntityDict = { +export declare type EntityDict = { actionAuth: ActionAuth; modi: Modi; modiEntity: ModiEntity; diff --git a/lib/base-app-domain/Modi/Action.d.ts b/lib/base-app-domain/Modi/Action.d.ts index ecb0a21..0cae5fa 100644 --- a/lib/base-app-domain/Modi/Action.d.ts +++ b/lib/base-app-domain/Modi/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction } from "../../actions/action"; -export type IState = 'active' | 'applied' | 'abandoned' | string; -export type IAction = 'apply' | 'abandon' | string; -export type ParticularAction = IAction; -export type Action = GenericAction | ParticularAction | string; +export declare type IState = 'active' | 'applied' | 'abandoned' | string; +export declare type IAction = 'apply' | 'abandon' | string; +export declare type ParticularAction = IAction; +export declare type Action = GenericAction | ParticularAction | string; export declare const actions: string[]; export declare const ActionDefDict: { iState: ActionDef; diff --git a/lib/base-app-domain/Modi/Schema.d.ts b/lib/base-app-domain/Modi/Schema.d.ts index 8607bf1..30dc913 100644 --- a/lib/base-app-domain/Modi/Schema.d.ts +++ b/lib/base-app-domain/Modi/Schema.d.ts @@ -5,7 +5,7 @@ import * as SubQuery from "../_SubQuery"; import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity"; import { Action, ParticularAction, IState } from "./Action"; import * as ModiEntity from "../ModiEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -15,8 +15,8 @@ export type OpSchema = EntityShape & { extra?: Object | null; iState?: IState | null; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; @@ -30,7 +30,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.ModiIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ type AttrFilter = { extra: Object; iState: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -67,10 +67,10 @@ export type Projection = { $entity: "modiEntity"; }; } & Partial>; -type ModiIdProjection = OneOf<{ +declare type ModiIdProjection = OneOf<{ id: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -91,34 +91,34 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & ({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; }) & { modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type ModiIdSubQuery = Selection; -export type EntityDef = { +export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type ModiIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/ModiEntity/Schema.d.ts b/lib/base-app-domain/ModiEntity/Schema.d.ts index 7ed5bc0..3b27a68 100644 --- a/lib/base-app-domain/ModiEntity/Schema.d.ts +++ b/lib/base-app-domain/ModiEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { modiId: ForeignKey<"modi">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.ModiEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export type Filter> = MakeFilter & ExprOp>; -export type Projection = { +export declare type Filter> = MakeFilter & ExprOp>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -type ModiEntityIdProjection = OneOf<{ +declare type ModiEntityIdProjection = OneOf<{ id: number; }>; -type ModiIdProjection = OneOf<{ +declare type ModiIdProjection = OneOf<{ modiId: number; }>; -type ActionAuthIdProjection = OneOf<{ +declare type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ entityId: number; }>; -type RelationAuthIdProjection = OneOf<{ +declare type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ entityId: number; }>; -type UserEntityGrantIdProjection = OneOf<{ +declare type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -type UserRelationIdProjection = OneOf<{ +declare type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ modiId?: never; modi: Modi.CreateSingleOperation; } | { @@ -208,10 +208,10 @@ export type CreateOperationData = FormCreateData; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ modi: Modi.CreateSingleOperation; modiId?: never; } | { @@ -253,8 +253,8 @@ export type UpdateOperationData = FormUpdateData; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ modi?: Modi.UpdateOperation | Modi.RemoveOperation; })) & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; @@ -271,17 +271,17 @@ export type RemoveOperationData = {} & (({ } | { [k: string]: any; }); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type ModiIdSubQuery = Selection; -export type ActionAuthIdSubQuery = Selection; -export type RelationIdSubQuery = Selection; -export type RelationAuthIdSubQuery = Selection; -export type UserIdSubQuery = Selection; -export type UserEntityGrantIdSubQuery = Selection; -export type UserRelationIdSubQuery = Selection; -export type ModiEntityIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type ModiIdSubQuery = Selection; +export declare type ActionAuthIdSubQuery = Selection; +export declare type RelationIdSubQuery = Selection; +export declare type RelationAuthIdSubQuery = Selection; +export declare type UserIdSubQuery = Selection; +export declare type UserEntityGrantIdSubQuery = Selection; +export declare type UserRelationIdSubQuery = Selection; +export declare type ModiEntityIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Oper/Schema.d.ts b/lib/base-app-domain/Oper/Schema.d.ts index 06d73c8..781eb05 100644 --- a/lib/base-app-domain/Oper/Schema.d.ts +++ b/lib/base-app-domain/Oper/Schema.d.ts @@ -6,7 +6,7 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { AppendOnlyAction } from "../../actions/action"; import * as User from "../User/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -14,8 +14,8 @@ export type OpSchema = EntityShape & { operatorId?: ForeignKey<"user"> | null; targetEntity: String<32>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { action: String<16>; data: Object; filter?: Object | null; @@ -28,7 +28,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.OperIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -41,8 +41,8 @@ type AttrFilter = { operator: User.Filter; targetEntity: Q_StringValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -63,13 +63,13 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type OperIdProjection = OneOf<{ +declare type OperIdProjection = OneOf<{ id: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ operatorId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ operatorId?: never; operator?: User.CreateSingleOperation; } | { @@ -107,10 +107,10 @@ export type CreateOperationData = FormCreateData> & })) & { operEntity$oper?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ operator: User.CreateSingleOperation; operatorId?: never; } | { @@ -126,15 +126,15 @@ export type UpdateOperationData = FormUpdateData> & [k: string]: any; operEntity$oper?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ operator?: User.UpdateOperation | User.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserIdSubQuery = Selection; -export type OperIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserIdSubQuery = Selection; +export declare type OperIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/OperEntity/Schema.d.ts b/lib/base-app-domain/OperEntity/Schema.d.ts index c9200bd..e3ca574 100644 --- a/lib/base-app-domain/OperEntity/Schema.d.ts +++ b/lib/base-app-domain/OperEntity/Schema.d.ts @@ -11,13 +11,13 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as User from "../User/Schema"; import * as UserEntityGrant from "../UserEntityGrant/Schema"; import * as UserRelation from "../UserRelation/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { operId: ForeignKey<"oper">; entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string; entityId: String<64>; @@ -31,7 +31,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.OperEntityIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -47,8 +47,8 @@ type AttrFilter = { userEntityGrant: UserEntityGrant.Filter; userRelation: UserRelation.Filter; }; -export type Filter> = MakeFilter & ExprOp>; -export type Projection = { +export declare type Filter> = MakeFilter & ExprOp>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -66,31 +66,31 @@ export type Projection = { userEntityGrant?: UserEntityGrant.Projection; userRelation?: UserRelation.Projection; } & Partial>; -type OperEntityIdProjection = OneOf<{ +declare type OperEntityIdProjection = OneOf<{ id: number; }>; -type OperIdProjection = OneOf<{ +declare type OperIdProjection = OneOf<{ operId: number; }>; -type ActionAuthIdProjection = OneOf<{ +declare type ActionAuthIdProjection = OneOf<{ entityId: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ entityId: number; }>; -type RelationAuthIdProjection = OneOf<{ +declare type RelationAuthIdProjection = OneOf<{ entityId: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ entityId: number; }>; -type UserEntityGrantIdProjection = OneOf<{ +declare type UserEntityGrantIdProjection = OneOf<{ entityId: number; }>; -type UserRelationIdProjection = OneOf<{ +declare type UserRelationIdProjection = OneOf<{ entityId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ operId?: never; oper: Oper.CreateSingleOperation; } | { @@ -205,10 +205,10 @@ export type CreateOperationData = FormCreateData; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ oper: Oper.CreateSingleOperation; operId?: never; } | { @@ -244,8 +244,8 @@ export type UpdateOperationData = FormUpdateData; -export type RemoveOperationData = {} & ({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & ({ actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation; } | { relation?: Relation.UpdateOperation | Relation.RemoveOperation; @@ -260,17 +260,17 @@ export type RemoveOperationData = {} & ({ } | { [k: string]: any; }); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type OperIdSubQuery = Selection; -export type ActionAuthIdSubQuery = Selection; -export type RelationIdSubQuery = Selection; -export type RelationAuthIdSubQuery = Selection; -export type UserIdSubQuery = Selection; -export type UserEntityGrantIdSubQuery = Selection; -export type UserRelationIdSubQuery = Selection; -export type OperEntityIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type OperIdSubQuery = Selection; +export declare type ActionAuthIdSubQuery = Selection; +export declare type RelationIdSubQuery = Selection; +export declare type RelationAuthIdSubQuery = Selection; +export declare type UserIdSubQuery = Selection; +export declare type UserEntityGrantIdSubQuery = Selection; +export declare type UserRelationIdSubQuery = Selection; +export declare type OperEntityIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/Relation/Schema.d.ts b/lib/base-app-domain/Relation/Schema.d.ts index 6fdc81c..fbf5182 100644 --- a/lib/base-app-domain/Relation/Schema.d.ts +++ b/lib/base-app-domain/Relation/Schema.d.ts @@ -9,14 +9,14 @@ import * as RelationAuth from "../RelationAuth/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; display: String<32>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { entity: String<32>; entityId: String<64>; name: String<32>; @@ -34,7 +34,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.RelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -44,8 +44,8 @@ type AttrFilter = { name: Q_StringValue; display: Q_StringValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -87,10 +87,10 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ id: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -109,15 +109,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & ({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -128,10 +128,10 @@ export type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { [k: string]: any; actionAuth$relation?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation>; relationAuth$relation?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation | OakOperation<"create", Omit[]> | Array> | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation>; @@ -139,12 +139,12 @@ export type UpdateOperationData = FormUpdateData & { modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type RelationIdSubQuery = Selection; -export type EntityDef = { +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type RelationIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/RelationAuth/Schema.d.ts b/lib/base-app-domain/RelationAuth/Schema.d.ts index 1573262..447ab6d 100644 --- a/lib/base-app-domain/RelationAuth/Schema.d.ts +++ b/lib/base-app-domain/RelationAuth/Schema.d.ts @@ -7,15 +7,15 @@ import { GenericAction } from "../../actions/action"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -type Relations = string[]; -export type OpSchema = EntityShape & { +declare type Relations = string[]; +export declare type OpSchema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; deRelations: Relations; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { relationId: ForeignKey<"relation">; path: String<256>; destEntity: String<32>; @@ -28,7 +28,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.RelationAuthIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -39,8 +39,8 @@ type AttrFilter = { destEntity: Q_StringValue; deRelations: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -65,13 +65,13 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type RelationAuthIdProjection = OneOf<{ +declare type RelationAuthIdProjection = OneOf<{ id: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ relationId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -92,15 +92,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ relationId?: never; relation: Relation.CreateSingleOperation; } | { @@ -112,10 +112,10 @@ export type CreateOperationData = FormCreateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ relation: Relation.CreateSingleOperation; relationId?: never; } | { @@ -132,15 +132,15 @@ export type UpdateOperationData = FormUpdateData> & modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type RelationIdSubQuery = Selection; -export type RelationAuthIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type RelationIdSubQuery = Selection; +export declare type RelationAuthIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/User/Action.d.ts b/lib/base-app-domain/User/Action.d.ts index 46ad254..84cc307 100644 --- a/lib/base-app-domain/User/Action.d.ts +++ b/lib/base-app-domain/User/Action.d.ts @@ -1,9 +1,9 @@ import { ActionDef } from "../../types/Action"; import { GenericAction, RelationAction } from "../../actions/action"; -export type UserAction = 'mergeTo' | string; -export type UserState = 'normal' | 'merged' | string; -export type ParticularAction = UserAction; -export type Action = GenericAction | ParticularAction | RelationAction | string; +export declare type UserAction = 'mergeTo' | string; +export declare type UserState = 'normal' | 'merged' | string; +export declare type ParticularAction = UserAction; +export declare type Action = GenericAction | ParticularAction | RelationAction | string; export declare const actions: string[]; export declare const ActionDefDict: { userState: ActionDef; diff --git a/lib/base-app-domain/User/Schema.d.ts b/lib/base-app-domain/User/Schema.d.ts index d71b44c..ce598a7 100644 --- a/lib/base-app-domain/User/Schema.d.ts +++ b/lib/base-app-domain/User/Schema.d.ts @@ -9,15 +9,15 @@ import * as Oper from "../Oper/Schema"; import * as UserRelation from "../UserRelation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; refId?: ForeignKey<"user"> | null; userState?: UserState | null; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { name?: String<16> | null; nickname?: String<64> | null; password?: Text | null; @@ -37,7 +37,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.UserIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -49,8 +49,8 @@ type AttrFilter = { ref: Filter; userState: Q_EnumValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -94,11 +94,11 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ id: number; refId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -121,15 +121,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ refId?: never; ref?: CreateSingleOperation; } | { @@ -144,10 +144,10 @@ export type CreateOperationData = FormCreateData> & (({ modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ ref: CreateSingleOperation; refId?: never; } | { @@ -167,14 +167,14 @@ export type UpdateOperationData = FormUpdateData> & (({ modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ ref?: UpdateOperation | RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserEntityGrant/Schema.d.ts b/lib/base-app-domain/UserEntityGrant/Schema.d.ts index 2d28afe..6334c2e 100644 --- a/lib/base-app-domain/UserEntityGrant/Schema.d.ts +++ b/lib/base-app-domain/UserEntityGrant/Schema.d.ts @@ -6,13 +6,13 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper import { GenericAction } from "../../actions/action"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { entity: String<32>; entityId: String<64>; relation: String<32>; @@ -23,7 +23,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -32,8 +32,8 @@ type AttrFilter = { entityId: Q_StringValue; relation: Q_StringValue; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -56,10 +56,10 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type UserEntityGrantIdProjection = OneOf<{ +declare type UserEntityGrantIdProjection = OneOf<{ id: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -76,15 +76,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & ({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; @@ -92,20 +92,20 @@ export type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData & { +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$entity?: OakOperation<"create", Omit[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {}; -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserEntityGrantIdSubQuery = Selection; -export type EntityDef = { +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {}; +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserEntityGrantIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/UserRelation/Schema.d.ts b/lib/base-app-domain/UserRelation/Schema.d.ts index ff97ead..319fa71 100644 --- a/lib/base-app-domain/UserRelation/Schema.d.ts +++ b/lib/base-app-domain/UserRelation/Schema.d.ts @@ -8,12 +8,12 @@ import * as User from "../User/Schema"; import * as Relation from "../Relation/Schema"; import * as ModiEntity from "../ModiEntity/Schema"; import * as OperEntity from "../OperEntity/Schema"; -export type OpSchema = EntityShape & { +export declare type OpSchema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; }; -export type OpAttr = keyof OpSchema; -export type Schema = EntityShape & { +export declare type OpAttr = keyof OpSchema; +export declare type Schema = EntityShape & { userId: ForeignKey<"user">; relationId: ForeignKey<"relation">; user: User.Schema; @@ -25,7 +25,7 @@ export type Schema = EntityShape & { } & { [A in ExpressionKey]?: any; }; -type AttrFilter = { +declare type AttrFilter = { id: Q_StringValue | SubQuery.UserRelationIdSubQuery; $$createAt$$: Q_DateValue; $$seq$$: Q_StringValue; @@ -35,8 +35,8 @@ type AttrFilter = { relationId: Q_StringValue | SubQuery.RelationIdSubQuery; relation: Relation.Filter; }; -export type Filter = MakeFilter>; -export type Projection = { +export declare type Filter = MakeFilter>; +export declare type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; @@ -60,16 +60,16 @@ export type Projection = { $entity: "operEntity"; }; } & Partial>; -type UserRelationIdProjection = OneOf<{ +declare type UserRelationIdProjection = OneOf<{ id: number; }>; -type UserIdProjection = OneOf<{ +declare type UserIdProjection = OneOf<{ userId: number; }>; -type RelationIdProjection = OneOf<{ +declare type RelationIdProjection = OneOf<{ relationId: number; }>; -export type SortAttr = { +export declare type SortAttr = { id: number; } | { $$createAt$$: number; @@ -88,15 +88,15 @@ export type SortAttr = { } | { [k: string]: any; } | OneOf>; -export type SortNode = { +export declare type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -export type Sorter = SortNode[]; -export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; -export type Selection

= Omit, "action">; -export type Aggregation = DeduceAggregation; -export type CreateOperationData = FormCreateData> & (({ +export declare type Sorter = SortNode[]; +export declare type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; +export declare type Selection

= Omit, "action">; +export declare type Aggregation = DeduceAggregation; +export declare type CreateOperationData = FormCreateData> & (({ userId?: never; user: User.CreateSingleOperation; } | { @@ -116,10 +116,10 @@ export type CreateOperationData = FormCreateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; -export type CreateMultipleOperation = OakOperation<"create", Array>; -export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -export type UpdateOperationData = FormUpdateData> & (({ +export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>; +export declare type CreateMultipleOperation = OakOperation<"create", Array>; +export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +export declare type UpdateOperationData = FormUpdateData> & (({ user: User.CreateSingleOperation; userId?: never; } | { @@ -148,18 +148,18 @@ export type UpdateOperationData = FormUpdateData[]> | Array>>; operEntity$entity?: OakOperation<"create", Omit[]> | Array>>; }; -export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; -export type RemoveOperationData = {} & (({ +export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>; +export declare type RemoveOperationData = {} & (({ user?: User.UpdateOperation | User.RemoveOperation; }) & ({ relation?: Relation.UpdateOperation | Relation.RemoveOperation; })); -export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; -export type Operation = CreateOperation | UpdateOperation | RemoveOperation; -export type UserIdSubQuery = Selection; -export type RelationIdSubQuery = Selection; -export type UserRelationIdSubQuery = Selection; -export type EntityDef = { +export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; +export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type UserIdSubQuery = Selection; +export declare type RelationIdSubQuery = Selection; +export declare type UserRelationIdSubQuery = Selection; +export declare type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; diff --git a/lib/base-app-domain/_SubQuery.d.ts b/lib/base-app-domain/_SubQuery.d.ts index c719b6f..d69d357 100644 --- a/lib/base-app-domain/_SubQuery.d.ts +++ b/lib/base-app-domain/_SubQuery.d.ts @@ -8,36 +8,36 @@ import * as RelationAuth from "./RelationAuth/Schema"; import * as User from "./User/Schema"; import * as UserEntityGrant from "./UserEntityGrant/Schema"; import * as UserRelation from "./UserRelation/Schema"; -export type ActionAuthIdSubQuery = { +export declare type ActionAuthIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.ActionAuthIdSubQuery & { entity: "actionAuth"; }) | any; }; -export type ModiIdSubQuery = { +export declare type ModiIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiIdSubQuery & { entity: "modiEntity"; }) | (Modi.ModiIdSubQuery & { entity: "modi"; }) | any; }; -export type ModiEntityIdSubQuery = { +export declare type ModiEntityIdSubQuery = { [K in "$in" | "$nin"]?: (ModiEntity.ModiEntityIdSubQuery & { entity: "modiEntity"; }) | any; }; -export type OperIdSubQuery = { +export declare type OperIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperIdSubQuery & { entity: "operEntity"; }) | (Oper.OperIdSubQuery & { entity: "oper"; }) | any; }; -export type OperEntityIdSubQuery = { +export declare type OperEntityIdSubQuery = { [K in "$in" | "$nin"]?: (OperEntity.OperEntityIdSubQuery & { entity: "operEntity"; }) | any; }; -export type RelationIdSubQuery = { +export declare type RelationIdSubQuery = { [K in "$in" | "$nin"]?: (ActionAuth.RelationIdSubQuery & { entity: "actionAuth"; }) | (RelationAuth.RelationIdSubQuery & { @@ -48,12 +48,12 @@ export type RelationIdSubQuery = { entity: "relation"; }) | any; }; -export type RelationAuthIdSubQuery = { +export declare type RelationAuthIdSubQuery = { [K in "$in" | "$nin"]?: (RelationAuth.RelationAuthIdSubQuery & { entity: "relationAuth"; }) | any; }; -export type UserIdSubQuery = { +export declare type UserIdSubQuery = { [K in "$in" | "$nin"]?: (Oper.UserIdSubQuery & { entity: "oper"; }) | (User.UserIdSubQuery & { @@ -64,12 +64,12 @@ export type UserIdSubQuery = { entity: "user"; }) | any; }; -export type UserEntityGrantIdSubQuery = { +export declare type UserEntityGrantIdSubQuery = { [K in "$in" | "$nin"]?: (UserEntityGrant.UserEntityGrantIdSubQuery & { entity: "userEntityGrant"; }) | any; }; -export type UserRelationIdSubQuery = { +export declare type UserRelationIdSubQuery = { [K in "$in" | "$nin"]?: (UserRelation.UserRelationIdSubQuery & { entity: "userRelation"; }) | any; diff --git a/lib/entities/ActionAuth.d.ts b/lib/entities/ActionAuth.d.ts index 9944266..c57a16c 100644 --- a/lib/entities/ActionAuth.d.ts +++ b/lib/entities/ActionAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -type Actions = string[]; +declare type Actions = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/entities/RelationAuth.d.ts b/lib/entities/RelationAuth.d.ts index 8529abb..dc79db5 100644 --- a/lib/entities/RelationAuth.d.ts +++ b/lib/entities/RelationAuth.d.ts @@ -1,7 +1,7 @@ import { String } from '../types/DataType'; import { EntityShape } from '../types/Entity'; import { Schema as Relation } from './Relation'; -type Relations = string[]; +declare type Relations = string[]; export interface Schema extends EntityShape { relation: Relation; path: String<256>; diff --git a/lib/store/TriggerExecutor.d.ts b/lib/store/TriggerExecutor.d.ts index 77253f7..d63a7ed 100644 --- a/lib/store/TriggerExecutor.d.ts +++ b/lib/store/TriggerExecutor.d.ts @@ -16,7 +16,7 @@ export declare class TriggerExecutor { private contextBuilder; constructor(contextBuilder: (cxtString: string) => Promise>, logger?: Logger); registerChecker>(checker: Checker): void; - getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[]; + getCheckers(entity: T, action: ED[T]['Action'], checkerTypes?: CheckerType[]): Trigger>[] | undefined; registerTrigger>(trigger: Trigger): void; unregisterTrigger>(trigger: Trigger): void; private preCommitTrigger; diff --git a/lib/timers/oper.d.ts b/lib/timers/oper.d.ts index 0e7e3ac..9eebe95 100644 --- a/lib/timers/oper.d.ts +++ b/lib/timers/oper.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -export type VaccumOperOption = { +export declare type VaccumOperOption = { aliveLine: number; excludeOpers?: { [T in keyof ED]?: ED[T]['Action'][]; diff --git a/lib/timers/vaccum.d.ts b/lib/timers/vaccum.d.ts index b354f19..bd3ef80 100644 --- a/lib/timers/vaccum.d.ts +++ b/lib/timers/vaccum.d.ts @@ -1,12 +1,12 @@ import { EntityDict } from '../types/Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; import { AsyncContext } from '../store/AsyncRowStore'; -type VaccumOptionEntity = { +declare type VaccumOptionEntity = { entity: T; filter?: ED[T]['Selection']['filter']; aliveLine: number; }; -type VaccumOption = { +declare type VaccumOption = { entities: Array>; backupDir?: string; zip?: boolean; diff --git a/lib/types/Action.d.ts b/lib/types/Action.d.ts index e646b40..1dc6ee7 100644 --- a/lib/types/Action.d.ts +++ b/lib/types/Action.d.ts @@ -1,20 +1,20 @@ import { CascadeRelationItem, EntityDict } from "./Entity"; import { GenericAction } from '../actions/action'; -export type Action = string; -export type State = string; -export type ActionDef = { +export declare type Action = string; +export declare type State = string; +export declare type ActionDef = { stm: { [a in A]: [p: S | S[], n: S]; }; is?: S; }; -export type ActionDictOfEntityDict = { +export declare type ActionDictOfEntityDict = { [T in keyof E]?: { [A in keyof E[T]['OpSchema']]?: ActionDef; }; }; -export type CascadeActionItem = CascadeRelationItem; -export type CascadeActionAuth = { +export declare type CascadeActionItem = CascadeRelationItem; +export declare type CascadeActionAuth = { [K in A | GenericAction]?: CascadeActionItem | (CascadeActionItem | CascadeActionItem[])[]; }; -export type ActionOnRemove = 'setNull' | 'remove'; +export declare type ActionOnRemove = 'setNull' | 'remove'; diff --git a/lib/types/Auth.d.ts b/lib/types/Auth.d.ts index c7c86d6..2023c39 100644 --- a/lib/types/Auth.d.ts +++ b/lib/types/Auth.d.ts @@ -2,12 +2,12 @@ import { CascadeActionAuth, CascadeRelationAuth, ActionOnRemove, SyncOrAsync } f import { AsyncContext } from "../store/AsyncRowStore"; import { SyncContext } from "../store/SyncRowStore"; import { EntityDict, OperateOption, SelectOption } from "../types/Entity"; -export type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; +export declare type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation'; /** * conditionalFilter是指该action发生时,operation所操作的行中有满足conditionalFilter的行 * 被转化成trigger的filter条件,详细可看trigger中的说明 */ -export type DataChecker | SyncContext> = { +export declare type DataChecker | SyncContext> = { priority?: number; type: 'data'; entity: T; @@ -15,7 +15,7 @@ export type DataChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type RowChecker | SyncContext> = { +export declare type RowChecker | SyncContext> = { priority?: number; type: 'row'; entity: T; @@ -28,7 +28,7 @@ export type RowChecker SyncOrAsync); }; -export type RelationChecker | SyncContext> = { +export declare type RelationChecker | SyncContext> = { priority?: number; type: 'relation'; entity: T; @@ -38,7 +38,7 @@ export type RelationChecker string); conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type LogicalChecker | SyncContext> = { +export declare type LogicalChecker | SyncContext> = { priority?: number; type: 'logical'; when?: 'after'; @@ -47,7 +47,7 @@ export type LogicalChecker SyncOrAsync; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type LogicalRelationChecker | SyncContext> = { +export declare type LogicalRelationChecker | SyncContext> = { priority?: number; type: 'logicalRelation'; when?: 'after'; @@ -56,14 +56,14 @@ export type LogicalRelationChecker any | Promise; conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => SyncOrAsync); }; -export type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; -export type AuthDef = { +export declare type Checker | SyncContext> = DataChecker | RowChecker | RelationChecker | LogicalChecker | LogicalRelationChecker; +export declare type AuthDef = { relationAuth?: CascadeRelationAuth>; actionAuth?: CascadeActionAuth; cascadeRemove?: { [E in (keyof ED | keyof ED[T]['Schema'] | '@entity')]?: ActionOnRemove; }; }; -export type AuthDefDict = { +export declare type AuthDefDict = { [K in keyof ED]?: AuthDef; }; diff --git a/lib/types/DataType.d.ts b/lib/types/DataType.d.ts index df83a90..e3b63be 100644 --- a/lib/types/DataType.d.ts +++ b/lib/types/DataType.d.ts @@ -1,21 +1,21 @@ import { Geo, SingleGeo } from "./Geo"; -export type Int = number; -export type Uint = number; -export type Double

= number; -export type Float

= number; -export type String = string; -export type Text = string; -export type Image = string; -export type File = string; -export type Datetime = number | Date; -export type Day = number | Date; -export type Time = number | Date; -export type Boolean = boolean; -export type Price = number; -export type PrimaryKey = string; -export type ForeignKey = string; -export type Sequence = string; +export declare type Int = number; +export declare type Uint = number; +export declare type Double

= number; +export declare type Float

= number; +export declare type String = string; +export declare type Text = string; +export declare type Image = string; +export declare type File = string; +export declare type Datetime = number | Date; +export declare type Day = number | Date; +export declare type Time = number | Date; +export declare type Boolean = boolean; +export declare type Price = number; +export declare type PrimaryKey = string; +export declare type ForeignKey = string; +export declare type Sequence = string; export { Geo, SingleGeo } from './Geo'; -export type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; +export declare type DataTypes = number | string | Datetime | Day | Time | Geo | Object | SingleGeo; export declare const types: string[]; export declare const unIndexedTypes: string[]; diff --git a/lib/types/Demand.d.ts b/lib/types/Demand.d.ts index 041672f..c2605fe 100644 --- a/lib/types/Demand.d.ts +++ b/lib/types/Demand.d.ts @@ -1,12 +1,12 @@ import { RefOrExpression } from "./Expression"; import { OneOf } from "./Polyfill"; export declare const EXPRESSION_PREFIX = "$expr"; -export type NodeId = `node-${number}`; -export type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; -export type ExprOp = { +export declare type NodeId = `node-${number}`; +export declare type ExpressionKey = '$expr' | '$expr1' | '$expr2' | '$expr3' | '$expr4' | '$expr5' | '$expr6' | '$expr7' | '$expr8' | '$expr9' | '$expr10' | '$expr11' | '$expr12' | '$expr13' | '$expr14' | '$expr15' | '$expr16' | '$expr17' | '$expr18' | '$expr19' | '$expr20'; +export declare type ExprOp = { [K in ExpressionKey]: RefOrExpression; }; -export type Q_NumberComparisonValue = number | OneOf<{ +export declare type Q_NumberComparisonValue = number | OneOf<{ $gt: number; $lt: number; $gte: number; @@ -17,7 +17,7 @@ export type Q_NumberComparisonValue = number | OneOf<{ $nin: number[]; $between: [number, number]; }>; -export type Q_StringComparisonValue = string | OneOf<{ +export declare type Q_StringComparisonValue = string | OneOf<{ $gt: string; $lt: string; $gte: string; @@ -30,44 +30,44 @@ export type Q_StringComparisonValue = string | OneOf<{ $in: string[]; $nin: string[]; }>; -export type Q_BooleanComparisonValue = boolean; -export type Q_DateComparisonValue = Q_NumberComparisonValue; -export type Q_EnumComparisonValue = E | OneOf<{ +export declare type Q_BooleanComparisonValue = boolean; +export declare type Q_DateComparisonValue = Q_NumberComparisonValue; +export declare type Q_EnumComparisonValue = E | OneOf<{ $in: E[]; $nin: E[]; }>; -export type Q_ExistsValue = { +export declare type Q_ExistsValue = { $exists: boolean; }; -export type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; -export type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; -export type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; -export type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; -export type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; -export type Q_State = S | { +export declare type Q_NumberValue = Q_NumberComparisonValue | Q_ExistsValue; +export declare type Q_StringValue = Q_StringComparisonValue | Q_ExistsValue; +export declare type Q_BooleanValue = Q_BooleanComparisonValue | Q_ExistsValue; +export declare type Q_DateValue = Q_DateComparisonValue | Q_ExistsValue; +export declare type Q_EnumValue = Q_EnumComparisonValue | Q_ExistsValue; +export declare type Q_State = S | { $in: S[]; } | { $nin: S[]; } | Q_ExistsValue; -export type Q_FullTextValue = { +export declare type Q_FullTextValue = { $search: string; $language?: 'zh_CN' | 'en_US'; }; -export type Q_FullTextKey = '$text'; -export type FulltextFilter = { +export declare type Q_FullTextKey = '$text'; +export declare type FulltextFilter = { [F in Q_FullTextKey]?: Q_FullTextValue; }; -type Q_LogicKey = '$and' | '$or'; -type Q_LinearLogicKey = '$not'; -export type MakeFilterWrapper = { +declare type Q_LogicKey = '$and' | '$or'; +declare type Q_LinearLogicKey = '$not'; +export declare type MakeFilterWrapper = { [Q in Q_LogicKey]?: Array>; } & { [Q in Q_LinearLogicKey]?: MakeFilterWrapper; } & Partial; -export type MakeFilter = { +export declare type MakeFilter = { '#id'?: NodeId; } & MakeFilterWrapper; -export type RefAttr = { +export declare type RefAttr = { '#attr': A; } | { '#refId': NodeId; diff --git a/lib/types/Endpoint.d.ts b/lib/types/Endpoint.d.ts index fa5415e..42e425b 100644 --- a/lib/types/Endpoint.d.ts +++ b/lib/types/Endpoint.d.ts @@ -8,4 +8,4 @@ export interface EndpointItem, headers: IncomingHttpHeaders, req: IncomingMessage, body?: any) => Promise; } -export type Endpoint> = EndpointItem | EndpointItem[]; +export declare type Endpoint> = EndpointItem | EndpointItem[]; diff --git a/lib/types/Entity.d.ts b/lib/types/Entity.d.ts index 08546ae..31a972f 100644 --- a/lib/types/Entity.d.ts +++ b/lib/types/Entity.d.ts @@ -1,12 +1,12 @@ import { ReadOnlyAction } from '../actions/action'; import { PrimaryKey, Sequence } from './DataType'; -type TriggerDataAttributeType = '$$triggerData$$'; -type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; -type PrimaryKeyAttributeType = 'id'; -type CreateAtAttributeType = '$$createAt$$'; -type UpdateAtAttributeType = '$$updateAt$$'; -type DeleteAtAttributeType = '$$deleteAt$$'; -type SeqAttributeType = '$$seq$$'; +declare type TriggerDataAttributeType = '$$triggerData$$'; +declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; +declare type PrimaryKeyAttributeType = 'id'; +declare type CreateAtAttributeType = '$$createAt$$'; +declare type UpdateAtAttributeType = '$$updateAt$$'; +declare type DeleteAtAttributeType = '$$deleteAt$$'; +declare type SeqAttributeType = '$$seq$$'; export declare const TriggerDataAttribute = "$$triggerData$$"; export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$"; export declare const PrimaryKeyAttribute = "id"; @@ -14,14 +14,14 @@ export declare const CreateAtAttribute = "$$createAt$$"; export declare const UpdateAtAttribute = "$$updateAt$$"; export declare const DeleteAtAttribute = "$$deleteAt$$"; export declare const SeqAttribute = "$$seq$$"; -export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; +export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType; export declare const initinctiveAttributes: string[]; -type FilterPart = { +declare type FilterPart = { filter?: A extends 'create' ? undefined : F; indexFrom?: A extends 'create' ? undefined : number; count?: A extends 'create' ? undefined : number; }; -export type SelectOption = { +export declare type SelectOption = { dontCollect?: boolean; blockTrigger?: true; obscure?: boolean; @@ -29,7 +29,7 @@ export type SelectOption = { includedDeleted?: true; dummy?: 1; }; -export type OperateOption = { +export declare type OperateOption = { blockTrigger?: true; dontCollect?: boolean; dontCreateOper?: boolean; @@ -40,19 +40,19 @@ export type OperateOption = { deletePhysically?: boolean; dummy?: 1; }; -export type FormUpdateData = Partial<{ +export declare type FormUpdateData = Partial<{ [K in keyof Omit]: SH[K] | null; }>; -export type FormCreateData = Partial> & { +export declare type FormCreateData = Partial> & { id: string; }; -export type Operation = { +export declare type Operation = { id: string; action: A; data: D; sorter?: S; } & FilterPart; -export type Selection = { +export declare type Selection = { id?: string; action: A; data: D; @@ -68,7 +68,7 @@ export interface EntityShape { export interface GeneralEntityShape extends EntityShape { [K: string]: any; } -export type MakeAction = A; +export declare type MakeAction = A; export interface EntityDef { Schema: GeneralEntityShape; OpSchema: GeneralEntityShape; @@ -90,79 +90,79 @@ export interface EntityDict { export interface OtmSubProjection extends Omit, 'action'> { $entity: string; } -export type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; -export type DeduceAggregationData

= { +export declare type AggregationOp = `#max-${number}` | `#min-${number}` | `#avg-${number}` | `#count-${number}` | `#sum-${number}`; +export declare type DeduceAggregationData

= { [A in AggregationOp]?: P; } & { '#aggr'?: P; }; -export type AggregationResult = Array<{ +export declare type AggregationResult = Array<{ [A in AggregationOp]?: number | string; } & { '#data'?: Partial; }>; -export type AttrFilter = { +export declare type AttrFilter = { [K in keyof SH]?: any; }; -type SortAttr = { +declare type SortAttr = { [K: string]: any; }; -type SorterItem = { +declare type SorterItem = { $attr: SortAttr; $direction?: "asc" | "desc"; }; -type Sorter = Array; -type Filter = { +declare type Sorter = Array; +declare type Filter = { [K: string]: any; }; -type Projection = { +declare type Projection = { [K: string]: any; }; -export type DeduceAggregation

= Omit, F, S>, 'action'>; -type CreateOperationData = { +export declare type DeduceAggregation

= Omit, F, S>, 'action'>; +declare type CreateOperationData = { id: string; [K: string]: any; }; -type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; -type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; -type CreateOperation = CreateSingleOperation | CreateMultipleOperation; -type UpdateOperationData = { +declare type CreateSingleOperation = Operation<'create', CreateOperationData, undefined, undefined>; +declare type CreateMultipleOperation = Operation<'create', Array, undefined, undefined>; +declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation; +declare type UpdateOperationData = { id?: never; [k: string]: any; }; -export type UpdateOperation = Operation; -type RemoveOperationData = { +export declare type UpdateOperation = Operation; +declare type RemoveOperationData = { [k: string]: any; }; -export type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; -export type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; -export type CreateOpResult = { +export declare type RemoveOperation = Operation<'remove', RemoveOperationData, Filter, Sorter>; +export declare type CUDOperation = CreateOperation | UpdateOperation | RemoveOperation; +export declare type CreateOpResult = { a: 'c'; e: T; d: ED[T]['OpSchema'] | ED[T]['OpSchema'][]; }; -export type UpdateOpResult = { +export declare type UpdateOpResult = { a: 'u'; e: T; d: UpdateOperationData; f?: Filter; }; -export type RemoveOpResult = { +export declare type RemoveOpResult = { a: 'r'; e: T; f?: Filter; }; -export type RelationHierarchy = { +export declare type RelationHierarchy = { [K in R]?: R[]; }; -export type CascadeRelationItem = { +export declare type CascadeRelationItem = { cascadePath: string; relations?: string[]; }; -export type CascadeRelationAuth = { +export declare type CascadeRelationAuth = { [K in R]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[]; }; -export type SelectOpResult = { +export declare type SelectOpResult = { a: 's'; d: { [T in keyof ED]?: { @@ -170,16 +170,16 @@ export type SelectOpResult = { }; }; }; -export type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; -export type OperationResult = { +export declare type OpRecord = CreateOpResult | UpdateOpResult | RemoveOpResult | SelectOpResult; +export declare type OperationResult = { [K in keyof ED]?: { [A in ED[K]['Action']]?: number; }; }; -export type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; -export type Configuration = { +export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud'; +export declare type Configuration = { actionType?: ActionType; static?: boolean; }; -export type OtmKey = K | `${K}$${number}`; +export declare type OtmKey = K | `${K}$${number}`; export {}; diff --git a/lib/types/Expression.d.ts b/lib/types/Expression.d.ts index a379eb8..cdeb126 100644 --- a/lib/types/Expression.d.ts +++ b/lib/types/Expression.d.ts @@ -1,8 +1,8 @@ import { RefAttr } from "./Demand"; import { Geo } from "./Geo"; -export type RefOrExpression = RefAttr | Expression; -type MathType = RefOrExpression | number; -type StringType = RefOrExpression | string; +export declare type RefOrExpression = RefAttr | Expression; +declare type MathType = RefOrExpression | number; +declare type StringType = RefOrExpression | string; interface Add { $add: (MathType)[]; } @@ -30,8 +30,8 @@ interface Ceil { interface Pow { $pow: [MathType, MathType]; } -type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; -type CmpType = RefOrExpression | string | number; +declare type MathExpression = Add | Subtract | Multiply | Divide | Abs | Round | Floor | Ceil | Pow; +declare type CmpType = RefOrExpression | string | number; interface Gt { $gt: [CmpType, CmpType]; } @@ -59,14 +59,14 @@ interface EndsWith { interface Includes { $includes: [RefOrExpression | string, RefOrExpression | string]; } -type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; +declare type CompareExpression = Lt | Gt | Lte | Gte | Eq | Ne | StartsWith | EndsWith | Includes; interface BoolTrue { $true: Expression; } interface BoolFalse { $false: Expression; } -type BoolExpression = BoolTrue | BoolFalse; +declare type BoolExpression = BoolTrue | BoolFalse; interface LogicAnd { $and: Expression[]; } @@ -76,7 +76,7 @@ interface LogicOr { interface LogicNot { $not: Expression; } -type LogicExpression = LogicAnd | LogicOr | LogicNot; +declare type LogicExpression = LogicAnd | LogicOr | LogicNot; interface DateYear { $year: RefOrExpression | Date | number; } @@ -110,18 +110,18 @@ interface DateCeiling { interface DateFloor { $dateFloor: [RefOrExpression | Date | number, 'y' | 'M' | 'd' | 'h' | 'm' | 's']; } -type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; +declare type DateExpression = DateYear | DateMonth | DateWeekday | DateWeekOfYear | DateDay | DateDayOfYear | DateDayOfMonth | DateDayOfWeek | DateDiff | DateCeiling | DateFloor; interface StringConcat { $concat: StringType[]; } -type StringExpression = StringConcat; +declare type StringExpression = StringConcat; interface GeoContains { $contains: [RefOrExpression | Geo, RefOrExpression | Geo]; } interface GeoDistance { $distance: [RefOrExpression | Geo, RefOrExpression | Geo]; } -type GeoExpression = GeoContains | GeoDistance; +declare type GeoExpression = GeoContains | GeoDistance; interface AggrCountExpression { $$count: RefOrExpression; } @@ -137,9 +137,9 @@ interface AggrMinExpression { interface AggrAvgExpression { $$avg: RefOrExpression; } -export type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; -export type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; -export type ExpressionConstant = Geo | number | Date | string | boolean; +export declare type AggrExpression = AggrAvgExpression | AggrCountExpression | AggrSumExpression | AggrMaxExpression | AggrMinExpression; +export declare type Expression = GeoExpression | DateExpression | LogicExpression | BoolExpression | CompareExpression | MathExpression | StringExpression | AggrExpression; +export declare type ExpressionConstant = Geo | number | Date | string | boolean; export declare function isGeoExpression(expression: any): expression is GeoExpression; export declare function isDateExpression(expression: any): expression is DateExpression; export declare function isLogicExpression(expression: any): expression is LogicExpression; diff --git a/lib/types/Geo.d.ts b/lib/types/Geo.d.ts index f1ce57e..1747c3f 100644 --- a/lib/types/Geo.d.ts +++ b/lib/types/Geo.d.ts @@ -1,8 +1,8 @@ -export type Point = [number, number]; -export type Path = Array; -export type Polygon = Array; -export type Circle = [Point, number]; -export type SingleGeo = { +export declare type Point = [number, number]; +export declare type Path = Array; +export declare type Polygon = Array; +export declare type Circle = [Point, number]; +export declare type SingleGeo = { type: 'point'; coordinate: Point; } | { @@ -15,4 +15,4 @@ export type SingleGeo = { type: 'circle'; coordinate: Circle; }; -export type Geo = SingleGeo | SingleGeo[]; +export declare type Geo = SingleGeo | SingleGeo[]; diff --git a/lib/types/Locale.d.ts b/lib/types/Locale.d.ts index 9a75128..daac80a 100644 --- a/lib/types/Locale.d.ts +++ b/lib/types/Locale.d.ts @@ -1,17 +1,17 @@ import { EntityShape } from "./Entity"; -type Language = 'zh_CN' | 'en_US'; -type LocaleOfSchema> = { +declare type Language = 'zh_CN' | 'en_US'; +declare type LocaleOfSchema> = { [A in keyof Required>]: string; }; -type LocaleOfStringEnum = { +declare type LocaleOfStringEnum = { [K in A]: string; }; -type LocaleOfValue> = { +declare type LocaleOfValue> = { [K in keyof V]: { [K2 in V[K]]: string; }; }; -export type LocaleDef, Ac extends string, R extends string, V extends Record> = { +export declare type LocaleDef, Ac extends string, R extends string, V extends Record> = { [L in Language]?: { name: string; attr: LocaleOfSchema & { diff --git a/lib/types/Polyfill.d.ts b/lib/types/Polyfill.d.ts index a176b92..a31122b 100644 --- a/lib/types/Polyfill.d.ts +++ b/lib/types/Polyfill.d.ts @@ -1,24 +1,24 @@ -export type OmitInferKey = { +export declare type OmitInferKey = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export type OmitInferValue = { +export declare type OmitInferValue = { [K in keyof T as T extends R ? never : K]: T[K]; }; -export type ValueOf = Obj[keyof Obj]; -export type OneOnly = { +export declare type ValueOf = Obj[keyof Obj]; +export declare type OneOnly = { [key in Exclude]?: undefined; } & Pick; -export type OneOfByKey = { +export declare type OneOfByKey = { [key in keyof Obj]: OneOnly; }; -export type OneOf = ValueOf>; -type IsOptional = { +export declare type OneOf = ValueOf>; +declare type IsOptional = { [K1 in Exclude]: T[K1]; } & { K?: T[K]; } extends T ? K : never; -export type OptionalKeys = { +export declare type OptionalKeys = { [K in keyof T]: IsOptional; }[keyof T]; -export type SyncOrAsync = T | Promise; +export declare type SyncOrAsync = T | Promise; export {}; diff --git a/lib/types/Port.d.ts b/lib/types/Port.d.ts index d6f617b..0c65b45 100644 --- a/lib/types/Port.d.ts +++ b/lib/types/Port.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict } from "./Entity"; -export type Exportation = { +export declare type Exportation = { name: string; id: string; entity: T; @@ -9,7 +9,7 @@ export type Exportation[]) => string[]; fn: (data: ED[T]['Schema'], context?: AsyncContext, properties?: Record) => Promise>> | Partial>; }; -export type Importation = { +export declare type Importation = { name: string; id: string; entity: T; diff --git a/lib/types/RowStore.d.ts b/lib/types/RowStore.d.ts index 48407a3..03940e1 100644 --- a/lib/types/RowStore.d.ts +++ b/lib/types/RowStore.d.ts @@ -1,10 +1,10 @@ import { OperationResult, EntityDict } from './Entity'; import { StorageSchema } from './Storage'; -export type TxnOption = { +export declare type TxnOption = { isolationLevel: 'repeatable read' | 'serializable'; }; -export type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; -export type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; +export declare type SelectionRewriter = (schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) => void; +export declare type OperationRewriter = (schema: StorageSchema, entity: keyof ED, operate: ED[keyof ED]['Operation']) => void; export declare abstract class RowStore { protected storageSchema: StorageSchema; constructor(storageSchema: StorageSchema); diff --git a/lib/types/Storage.d.ts b/lib/types/Storage.d.ts index 3944003..946b4d2 100644 --- a/lib/types/Storage.d.ts +++ b/lib/types/Storage.d.ts @@ -1,7 +1,7 @@ import { ActionType } from '.'; import { EntityDict, EntityShape, InstinctiveAttributes } from './Entity'; import { DataType, DataTypeParams } from './schema/DataTypes'; -export type Ref = 'ref'; +export declare type Ref = 'ref'; export interface Column { name: keyof SH | `${string}State`; size?: number; @@ -28,12 +28,12 @@ export interface Attribute { sequenceStart?: number; enumeration?: string[]; } -export type Attributes = Omit<{ +export declare type Attributes = Omit<{ [attrName in keyof SH]: Attribute; }, InstinctiveAttributes>; export interface EntityConfig { } -export type UniqConstraint = { +export declare type UniqConstraint = { attributes: Array; type?: string; }; @@ -52,6 +52,6 @@ export interface StorageDesc { relation?: string[]; view?: true; } -export type StorageSchema = { +export declare type StorageSchema = { [K in keyof ED]: StorageDesc; }; diff --git a/lib/types/Style.d.ts b/lib/types/Style.d.ts index 2fb60be..2c643b1 100644 --- a/lib/types/Style.d.ts +++ b/lib/types/Style.d.ts @@ -1,7 +1,7 @@ import { EntityDict } from './Entity'; import { EntityDict as BaseEntityDict } from '../base-app-domain'; -type ThemeColor = 'default' | 'success' | 'warning' | 'error'; -export type ColorDict = { +declare type ThemeColor = 'default' | 'success' | 'warning' | 'error'; +export declare type ColorDict = { [T in keyof ED]?: { [A in keyof ED[T]['OpSchema']]?: { [E in ED[T]['OpSchema'][A]]?: ThemeColor | `#${string}`; diff --git a/lib/types/Timer.d.ts b/lib/types/Timer.d.ts index 911d879..6fb8f24 100644 --- a/lib/types/Timer.d.ts +++ b/lib/types/Timer.d.ts @@ -1,12 +1,12 @@ import { RecurrenceRule, RecurrenceSpecDateRange, RecurrenceSpecObjLit } from 'node-schedule'; import { EntityDict } from './Entity'; import { AsyncContext } from '../store/AsyncRowStore'; -type RoutineFn> = (context: Cxt) => Promise; -export type Routine> = { +declare type RoutineFn> = (context: Cxt) => Promise; +export declare type Routine> = { name: string; fn: RoutineFn; }; -export type Timer> = { +export declare type Timer> = { name: string; cron: RecurrenceRule | RecurrenceSpecDateRange | RecurrenceSpecObjLit | Date | string | number; fn: RoutineFn; diff --git a/lib/types/Trigger.d.ts b/lib/types/Trigger.d.ts index 40ba8e6..efe1037 100644 --- a/lib/types/Trigger.d.ts +++ b/lib/types/Trigger.d.ts @@ -33,7 +33,7 @@ export interface CreateTriggerCrossTxn | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; +export declare type CreateTrigger | SyncContext> = CreateTriggerInTxn | CreateTriggerCrossTxn; /** * update trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -55,7 +55,7 @@ export interface UpdateTriggerCrossTxn | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; +export declare type UpdateTrigger | SyncContext> = UpdateTriggerInTxn | UpdateTriggerCrossTxn; /** * 同update trigger一样,remove trigger如果带有filter,说明只对存在限定条件的行起作用。此时系统在进行相应动作时, * 会判定当前动作的filter条件和trigger所定义的filter是否有交集(即有同时满足两个条件的行) @@ -76,7 +76,7 @@ export interface RemoveTriggerCrossTxn | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; +export declare type RemoveTrigger | SyncContext> = RemoveTriggerInTxn | RemoveTriggerCrossTxn; export interface SelectTriggerBase extends TriggerBase { action: 'select'; } @@ -97,8 +97,8 @@ export interface SelectTriggerAfter[]; }, context: Cxt, params?: SelectOption) => Promise | number; } -export type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; -export type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; +export declare type SelectTrigger | SyncContext> = SelectTriggerBefore | SelectTriggerAfter; +export declare type Trigger | SyncContext> = CreateTrigger | UpdateTrigger | RemoveTrigger | SelectTrigger; export interface TriggerEntityShape extends EntityShape { $$triggerData$$?: { name: string; diff --git a/lib/types/Watcher.d.ts b/lib/types/Watcher.d.ts index 0fe8135..fccbd9c 100644 --- a/lib/types/Watcher.d.ts +++ b/lib/types/Watcher.d.ts @@ -1,6 +1,6 @@ import { AsyncContext } from "../store/AsyncRowStore"; import { EntityDict, OperationResult } from "./Entity"; -type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; +declare type ActionData = ED[T]['Update']['data'] | ED[T]['Remove']['data']; export interface BBWatcher { name: string; entity: T; @@ -15,5 +15,5 @@ export interface WBWatcher Promise); fn: (context: Cxt, data: Partial[]) => Promise>; } -export type Watcher> = BBWatcher | WBWatcher; +export declare type Watcher> = BBWatcher | WBWatcher; export {}; diff --git a/lib/types/schema/DataTypes.d.ts b/lib/types/schema/DataTypes.d.ts index 72e0f83..b6479f5 100644 --- a/lib/types/schema/DataTypes.d.ts +++ b/lib/types/schema/DataTypes.d.ts @@ -1,28 +1,28 @@ /** * Column types used for @PrimaryGeneratedColumn() decorator. */ -export type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; +export declare type PrimaryGeneratedColumnType = "int" | "int2" | "int4" | "int8" | "integer" | "tinyint" | "smallint" | "mediumint" | "bigint" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "number"; /** * Column types where spatial properties are used. */ -export type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; +export declare type SpatialColumnType = "geometry" | "geography" | "st_geometry" | "st_point"; /** * Column types where precision and scale properties are used. */ -export type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; +export declare type WithPrecisionColumnType = "float" | "double" | "dec" | "decimal" | "smalldecimal" | "fixed" | "numeric" | "real" | "double precision" | "number" | "datetime" | "datetime2" | "datetimeoffset" | "time" | "time with time zone" | "time without time zone" | "timestamp" | "timestamp without time zone" | "timestamp with time zone" | "timestamp with local time zone"; /** * Column types where column length is used. */ -export type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; -export type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; +export declare type WithLengthColumnType = "character varying" | "varying character" | "char varying" | "nvarchar" | "national varchar" | "character" | "native character" | "varchar" | "char" | "nchar" | "national char" | "varchar2" | "nvarchar2" | "alphanum" | "shorttext" | "raw" | "binary" | "varbinary" | "string"; +export declare type WithWidthColumnType = "tinyint" | "smallint" | "mediumint" | "int" | "bigint"; /** * All other regular column types. */ -export type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; +export declare type SimpleColumnType = "simple-array" | "simple-json" | "simple-enum" | "int2" | "integer" | "int4" | "int8" | "int64" | "unsigned big int" | "float" | "float4" | "float8" | "smallmoney" | "money" | "boolean" | "bool" | "tinyblob" | "tinytext" | "mediumblob" | "mediumtext" | "blob" | "text" | "ntext" | "citext" | "hstore" | "longblob" | "longtext" | "alphanum" | "shorttext" | "bytes" | "bytea" | "long" | "raw" | "long raw" | "bfile" | "clob" | "nclob" | "image" | "timetz" | "timestamptz" | "timestamp with local time zone" | "smalldatetime" | "date" | "interval year to month" | "interval day to second" | "interval" | "year" | "seconddate" | "point" | "line" | "lseg" | "box" | "circle" | "path" | "polygon" | "geography" | "geometry" | "linestring" | "multipoint" | "multilinestring" | "multipolygon" | "geometrycollection" | "st_geometry" | "st_point" | "int4range" | "int8range" | "numrange" | "tsrange" | "tstzrange" | "daterange" | "enum" | "set" | "cidr" | "inet" | "macaddr" | "bit" | "bit varying" | "varbit" | "tsvector" | "tsquery" | "uuid" | "xml" | "json" | "jsonb" | "varbinary" | "hierarchyid" | "sql_variant" | "rowid" | "urowid" | "uniqueidentifier" | "rowversion" | "array" | "cube" | "ltree" | "object" | "array" | "function" | "sequence"; /** * Any column type column can be. */ -export type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; +export declare type DataType = WithPrecisionColumnType | WithLengthColumnType | WithWidthColumnType | SpatialColumnType | SimpleColumnType; export interface DataTypeParams { length?: number; width?: number; diff --git a/lib/utils/concurrent.d.ts b/lib/utils/concurrent.d.ts index 57d929b..c44feca 100644 --- a/lib/utils/concurrent.d.ts +++ b/lib/utils/concurrent.d.ts @@ -1,4 +1,4 @@ -type Mode = 'S' | 'X'; +declare type Mode = 'S' | 'X'; /** * 模拟一个读写锁,用于同步。 * 注意,千万不要发生自己等自己 diff --git a/lib/utils/uuid.d.ts b/lib/utils/uuid.d.ts index 595afb7..1d7ed56 100644 --- a/lib/utils/uuid.d.ts +++ b/lib/utils/uuid.d.ts @@ -3,7 +3,7 @@ export declare function sequentialUuid({ random }: { }): string; export declare function shrinkUuidTo32Bytes(uuid: string): string; export declare function expandUuidTo36Bytes(uuidShrinked: string): string; -export type GenerateIdOption = { +export declare type GenerateIdOption = { shuffle?: boolean; }; export declare function generateNewIdAsync(option?: GenerateIdOption): Promise; diff --git a/lib/utils/validator.d.ts b/lib/utils/validator.d.ts index ee8269c..08a892a 100644 --- a/lib/utils/validator.d.ts +++ b/lib/utils/validator.d.ts @@ -1,6 +1,6 @@ import { EntityDict } from "../types"; -type ValidatorFunction = (text: string, size?: number) => string | boolean; -type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; +declare type ValidatorFunction = (text: string, size?: number) => string | boolean; +declare type ValidatorMoneyFunction = (text: string, zero?: boolean) => string | boolean; export declare const isMobile: ValidatorFunction; export declare const isPassword: ValidatorFunction; export declare const isCaptcha: ValidatorFunction;