oak-domain 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/actions/action.d.ts +16 -16
- package/lib/actions/action.js +17 -17
- package/lib/actions/relation.d.ts +1 -1
- package/lib/actions/relation.js +2 -2
- package/lib/base-app-domain/ActionDefDict.d.ts +5 -5
- package/lib/base-app-domain/ActionDefDict.js +7 -7
- package/lib/base-app-domain/EntityDict.d.ts +12 -12
- package/lib/base-app-domain/EntityDict.js +2 -2
- package/lib/base-app-domain/Modi/Action.d.ts +10 -10
- package/lib/base-app-domain/Modi/Action.js +14 -14
- package/lib/base-app-domain/Modi/Schema.d.ts +161 -161
- package/lib/base-app-domain/Modi/Schema.js +2 -2
- package/lib/base-app-domain/Modi/Storage.d.ts +3 -3
- package/lib/base-app-domain/Modi/Storage.js +60 -60
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +176 -176
- package/lib/base-app-domain/ModiEntity/Schema.js +2 -2
- package/lib/base-app-domain/ModiEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/ModiEntity/Storage.js +26 -26
- package/lib/base-app-domain/Oper/Schema.d.ts +158 -158
- package/lib/base-app-domain/Oper/Schema.js +2 -2
- package/lib/base-app-domain/Oper/Storage.d.ts +3 -3
- package/lib/base-app-domain/Oper/Storage.js +29 -29
- package/lib/base-app-domain/OperEntity/Schema.d.ts +193 -193
- package/lib/base-app-domain/OperEntity/Schema.js +2 -2
- package/lib/base-app-domain/OperEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/OperEntity/Storage.js +26 -26
- package/lib/base-app-domain/Storage.d.ts +3 -3
- package/lib/base-app-domain/Storage.js +15 -15
- package/lib/base-app-domain/User/Schema.d.ts +137 -137
- package/lib/base-app-domain/User/Schema.js +2 -2
- package/lib/base-app-domain/User/Storage.d.ts +3 -3
- package/lib/base-app-domain/User/Storage.js +25 -25
- package/lib/base-app-domain/_SubQuery.d.ts +36 -36
- package/lib/base-app-domain/_SubQuery.js +2 -2
- package/lib/base-app-domain/index.d.ts +3 -3
- package/lib/base-app-domain/index.js +6 -6
- package/lib/checkers/index.d.ts +5 -5
- package/lib/checkers/index.js +8 -8
- package/lib/compiler/env.d.ts +11 -11
- package/lib/compiler/env.js +39 -39
- package/lib/compiler/schemalBuilder.d.ts +2 -2
- package/lib/compiler/schemalBuilder.js +3137 -3137
- package/lib/compiler/uiBuilder.d.ts +1 -1
- package/lib/compiler/uiBuilder.js +3 -3
- package/lib/entities/Modi.d.ts +11 -11
- package/lib/entities/Modi.js +46 -46
- package/lib/entities/ModiEntity.d.ts +8 -8
- package/lib/entities/ModiEntity.js +15 -15
- package/lib/entities/Oper.d.ts +10 -10
- package/lib/entities/Oper.js +17 -17
- package/lib/entities/OperEntity.d.ts +8 -8
- package/lib/entities/OperEntity.js +15 -15
- package/lib/entities/User.d.ts +7 -7
- package/lib/entities/User.js +12 -12
- package/lib/store/AsyncRowStore.d.ts +45 -45
- package/lib/store/AsyncRowStore.js +180 -180
- package/lib/store/CascadeStore.d.ts +89 -89
- package/lib/store/CascadeStore.js +1515 -1511
- package/lib/store/SyncRowStore.d.ts +26 -26
- package/lib/store/SyncRowStore.js +45 -45
- package/lib/store/TriggerExecutor.d.ts +32 -32
- package/lib/store/TriggerExecutor.js +470 -470
- package/lib/store/actionDef.d.ts +9 -9
- package/lib/store/actionDef.js +135 -135
- package/lib/store/checker.d.ts +6 -6
- package/lib/store/checker.js +218 -165
- package/lib/store/filter.d.ts +99 -99
- package/lib/store/filter.js +855 -855
- package/lib/store/modi.d.ts +13 -13
- package/lib/store/modi.js +172 -172
- package/lib/store/relation.d.ts +13 -13
- package/lib/store/relation.js +64 -64
- package/lib/store/selection.d.ts +7 -7
- package/lib/store/selection.js +228 -228
- package/lib/triggers/index.d.ts +6 -6
- package/lib/triggers/index.js +11 -11
- package/lib/triggers/modi.d.ts +5 -5
- package/lib/triggers/modi.js +72 -72
- package/lib/types/Action.d.ts +14 -14
- package/lib/types/Action.js +2 -2
- package/lib/types/AppLoader.d.ts +11 -11
- package/lib/types/AppLoader.js +10 -10
- package/lib/types/Aspect.d.ts +12 -12
- package/lib/types/Aspect.js +4 -4
- package/lib/types/Auth.d.ts +57 -31
- package/lib/types/Auth.js +2 -2
- package/lib/types/Connector.d.ts +26 -26
- package/lib/types/Connector.js +9 -9
- package/lib/types/Context.d.ts +6 -6
- package/lib/types/Context.js +3 -3
- package/lib/types/DataType.d.ts +18 -18
- package/lib/types/DataType.js +5 -5
- package/lib/types/Demand.d.ts +77 -77
- package/lib/types/Demand.js +9 -9
- package/lib/types/Entity.d.ts +159 -159
- package/lib/types/Entity.js +15 -15
- package/lib/types/Exception.d.ts +83 -83
- package/lib/types/Exception.js +252 -252
- package/lib/types/Expression.d.ts +141 -141
- package/lib/types/Expression.js +387 -387
- package/lib/types/Geo.d.ts +18 -18
- package/lib/types/Geo.js +2 -2
- package/lib/types/Locale.d.ts +24 -24
- package/lib/types/Locale.js +2 -2
- package/lib/types/Logger.d.ts +5 -5
- package/lib/types/Logger.js +3 -3
- package/lib/types/Polyfill.d.ts +23 -23
- package/lib/types/Polyfill.js +2 -2
- package/lib/types/RowStore.d.ts +12 -12
- package/lib/types/RowStore.js +34 -34
- package/lib/types/Storage.d.ts +55 -55
- package/lib/types/Storage.js +2 -2
- package/lib/types/Trigger.d.ts +88 -89
- package/lib/types/Trigger.js +39 -39
- package/lib/types/Txn.d.ts +2 -2
- package/lib/types/Txn.js +3 -3
- package/lib/types/Watcher.d.ts +19 -19
- package/lib/types/Watcher.js +4 -4
- package/lib/types/index.d.ts +18 -18
- package/lib/types/index.js +21 -21
- package/lib/types/schema/DataTypes.d.ts +32 -32
- package/lib/types/schema/DataTypes.js +3 -3
- package/lib/utils/SimpleConnector.d.ts +30 -30
- package/lib/utils/SimpleConnector.js +102 -102
- package/lib/utils/assert.d.ts +5 -5
- package/lib/utils/assert.js +9 -9
- package/lib/utils/concurrent.d.ts +15 -15
- package/lib/utils/concurrent.js +89 -89
- package/lib/utils/geo.d.ts +4 -4
- package/lib/utils/geo.js +24 -24
- package/lib/utils/lodash.d.ts +5 -5
- package/lib/utils/lodash.js +38 -38
- package/lib/utils/random/random.d.ts +1 -1
- package/lib/utils/random/random.js +24 -24
- package/lib/utils/random/random.mp.d.ts +1 -1
- package/lib/utils/random/random.mp.js +25 -25
- package/lib/utils/random/random.web.d.ts +1 -1
- package/lib/utils/random/random.web.js +17 -17
- package/lib/utils/string.d.ts +22 -22
- package/lib/utils/string.js +70 -70
- package/lib/utils/uuid.d.ts +12 -12
- package/lib/utils/uuid.js +182 -182
- package/lib/utils/validator.d.ts +23 -23
- package/lib/utils/validator.js +123 -123
- package/package.json +47 -47
- package/src/entities/Modi.ts +68 -68
- package/src/entities/ModiEntity.ts +24 -24
- package/src/entities/Oper.ts +28 -28
- package/src/entities/OperEntity.ts +24 -24
- package/src/entities/User.ts +19 -19
package/lib/types/Entity.d.ts
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
import { GenericAction } from '../actions/action';
|
|
2
|
-
import { ExprOp, MakeFilter, NodeId } from './Demand';
|
|
3
|
-
import { OneOf } from './Polyfill';
|
|
4
|
-
import { PrimaryKey, Sequence } from './DataType';
|
|
5
|
-
declare type TriggerDataAttributeType = '$$triggerData$$';
|
|
6
|
-
declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$';
|
|
7
|
-
declare type PrimaryKeyAttributeType = 'id';
|
|
8
|
-
declare type CreateAtAttributeType = '$$createAt$$';
|
|
9
|
-
declare type UpdateAtAttributeType = '$$updateAt$$';
|
|
10
|
-
declare type DeleteAtAttributeType = '$$deleteAt$$';
|
|
11
|
-
declare type SeqAttributeType = '$$seq$$';
|
|
12
|
-
export declare const TriggerDataAttribute = "$$triggerData$$";
|
|
13
|
-
export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$";
|
|
14
|
-
export declare const PrimaryKeyAttribute = "id";
|
|
15
|
-
export declare const CreateAtAttribute = "$$createAt$$";
|
|
16
|
-
export declare const UpdateAtAttribute = "$$updateAt$$";
|
|
17
|
-
export declare const DeleteAtAttribute = "$$deleteAt$$";
|
|
18
|
-
export declare const SeqAttribute = "$$seq$$";
|
|
19
|
-
export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType;
|
|
20
|
-
export declare const initinctiveAttributes: string[];
|
|
21
|
-
export declare type Filter<A extends string, F extends Object | undefined = undefined> = {
|
|
22
|
-
filter?: A extends 'create' ? undefined : F;
|
|
23
|
-
indexFrom?: A extends 'create' ? undefined : number;
|
|
24
|
-
count?: A extends 'create' ? undefined : number;
|
|
25
|
-
};
|
|
26
|
-
export declare type SelectOption = {
|
|
27
|
-
dontCollect?: boolean;
|
|
28
|
-
blockTrigger?: true;
|
|
29
|
-
obscure?: boolean;
|
|
30
|
-
forUpdate?: true;
|
|
31
|
-
includedDeleted?: true;
|
|
32
|
-
dummy?: 1;
|
|
33
|
-
};
|
|
34
|
-
export declare type OperateOption = {
|
|
35
|
-
blockTrigger?: true;
|
|
36
|
-
dontCollect?: boolean;
|
|
37
|
-
dontCreateOper?: boolean;
|
|
38
|
-
dontCreateModi?: boolean;
|
|
39
|
-
allowExists?: boolean;
|
|
40
|
-
modiParentId?: string;
|
|
41
|
-
modiParentEntity?: string;
|
|
42
|
-
dummy?: 1;
|
|
43
|
-
};
|
|
44
|
-
export declare type FormUpdateData<SH extends GeneralEntityShape> = Partial<{
|
|
45
|
-
[K in keyof Omit<SH, InstinctiveAttributes>]: SH[K] | null;
|
|
46
|
-
}>;
|
|
47
|
-
export declare type FormCreateData<SH extends GeneralEntityShape> = Omit<SH, InstinctiveAttributes> & {
|
|
48
|
-
id: string;
|
|
49
|
-
};
|
|
50
|
-
export declare type Operation<A extends GenericAction | string, DATA extends Object, FILTER extends Object | undefined = undefined, SORTER extends Object | undefined = undefined> = {
|
|
51
|
-
id?: string;
|
|
52
|
-
action: A;
|
|
53
|
-
data: DATA;
|
|
54
|
-
sorter?: SORTER;
|
|
55
|
-
} & Filter<A, FILTER>;
|
|
56
|
-
export declare type Selection<DATA extends Object, FILTER extends Object | undefined = undefined, SORT extends Object | undefined = undefined> = Operation<'select', DATA, FILTER, SORT>;
|
|
57
|
-
export interface EntityShape {
|
|
58
|
-
id: PrimaryKey;
|
|
59
|
-
$$seq$$: Sequence;
|
|
60
|
-
$$createAt$$: number | Date;
|
|
61
|
-
$$updateAt$$: number | Date;
|
|
62
|
-
$$deleteAt$$?: number | Date | null;
|
|
63
|
-
}
|
|
64
|
-
export interface FileCarrierEntityShape extends EntityShape {
|
|
65
|
-
}
|
|
66
|
-
interface GeneralEntityShape extends EntityShape {
|
|
67
|
-
[K: string]: any;
|
|
68
|
-
}
|
|
69
|
-
export declare type MakeAction<A extends string> = A;
|
|
70
|
-
export interface EntityDef {
|
|
71
|
-
Schema: GeneralEntityShape;
|
|
72
|
-
OpSchema: GeneralEntityShape;
|
|
73
|
-
Action: string;
|
|
74
|
-
ParticularAction?: string;
|
|
75
|
-
Selection: Omit<DeduceSelection<this['Schema']>, 'action'>;
|
|
76
|
-
Operation: DeduceOperation<this['Schema']>;
|
|
77
|
-
Create: DeduceCreateOperation<this['Schema']>;
|
|
78
|
-
CreateSingle: DeduceCreateSingleOperation<this['Schema']>;
|
|
79
|
-
CreateMulti: DeduceCreateMultipleOperation<this['Schema']>;
|
|
80
|
-
Update: DeduceUpdateOperation<this['Schema']>;
|
|
81
|
-
Remove: DeduceRemoveOperation<this['Schema']>;
|
|
82
|
-
}
|
|
83
|
-
export interface EntityDict {
|
|
84
|
-
[E: string]: EntityDef;
|
|
85
|
-
}
|
|
86
|
-
export interface OtmSubProjection extends Omit<DeduceSelection<any>, 'action'> {
|
|
87
|
-
$entity: string;
|
|
88
|
-
}
|
|
89
|
-
declare type DeduceProjection<SH extends GeneralEntityShape> = {
|
|
90
|
-
'#id'?: NodeId;
|
|
91
|
-
} & {
|
|
92
|
-
[K in keyof SH]?: number | OtmSubProjection | any;
|
|
93
|
-
} & Partial<ExprOp<keyof SH>>;
|
|
94
|
-
export declare type AttrFilter<SH extends GeneralEntityShape> = {
|
|
95
|
-
[K in keyof SH]: any;
|
|
96
|
-
};
|
|
97
|
-
export declare type DeduceFilter<SH extends GeneralEntityShape> = MakeFilter<AttrFilter<SH> & ExprOp<keyof SH>>;
|
|
98
|
-
export declare type DeduceSorterAttr<SH extends GeneralEntityShape> = OneOf<{
|
|
99
|
-
[K: string]: number | object | undefined;
|
|
100
|
-
} & ExprOp<keyof SH>>;
|
|
101
|
-
export declare type DeduceSorterItem<SH extends GeneralEntityShape> = {
|
|
102
|
-
$attr: DeduceSorterAttr<SH>;
|
|
103
|
-
$direction?: "asc" | "desc";
|
|
104
|
-
};
|
|
105
|
-
export declare type DeduceSorter<SH extends GeneralEntityShape> = Array<DeduceSorterItem<SH>>;
|
|
106
|
-
export declare type DeduceSelection<SH extends GeneralEntityShape> = Selection<DeduceProjection<SH>, DeduceFilter<SH>, DeduceSorter<SH>>;
|
|
107
|
-
export declare type DeduceCreateOperationData<SH extends GeneralEntityShape> = {
|
|
108
|
-
id: string;
|
|
109
|
-
} & {
|
|
110
|
-
[k in keyof Omit<SH, InstinctiveAttributes>]?: any;
|
|
111
|
-
};
|
|
112
|
-
export declare type DeduceCreateSingleOperation<SH extends GeneralEntityShape> = Operation<'create', DeduceCreateOperationData<SH>>;
|
|
113
|
-
export declare type DeduceCreateMultipleOperation<SH extends GeneralEntityShape> = Operation<'create', Array<DeduceCreateOperationData<SH>>>;
|
|
114
|
-
export declare type DeduceCreateOperation<SH extends GeneralEntityShape> = DeduceCreateSingleOperation<SH> | DeduceCreateMultipleOperation<SH>;
|
|
115
|
-
export declare type DeduceUpdateOperationData<SH extends GeneralEntityShape> = {
|
|
116
|
-
[k in keyof Omit<SH, InstinctiveAttributes>]?: any;
|
|
117
|
-
};
|
|
118
|
-
export declare type DeduceUpdateOperation<SH extends GeneralEntityShape> = Operation<'update' | string, DeduceUpdateOperationData<SH>, DeduceFilter<SH>, DeduceSorter<SH>>;
|
|
119
|
-
export declare type DeduceRemoveOperationData<SH extends GeneralEntityShape> = {
|
|
120
|
-
[A in keyof Omit<SH, InstinctiveAttributes>]?: any;
|
|
121
|
-
};
|
|
122
|
-
export declare type DeduceRemoveOperation<SH extends GeneralEntityShape> = Operation<'remove', DeduceRemoveOperationData<SH>, DeduceFilter<SH>, DeduceSorter<SH>>;
|
|
123
|
-
export declare type DeduceOperation<SH extends GeneralEntityShape> = DeduceCreateOperation<SH> | DeduceUpdateOperation<SH> | DeduceRemoveOperation<SH>;
|
|
124
|
-
export declare type CreateOpResult<ED extends EntityDict, T extends keyof ED> = {
|
|
125
|
-
a: 'c';
|
|
126
|
-
e: T;
|
|
127
|
-
d: ED[T]['OpSchema'] | ED[T]['OpSchema'][];
|
|
128
|
-
};
|
|
129
|
-
export declare type UpdateOpResult<ED extends EntityDict, T extends keyof ED> = {
|
|
130
|
-
a: 'u';
|
|
131
|
-
e: T;
|
|
132
|
-
d: DeduceUpdateOperationData<ED[T]['Schema']>;
|
|
133
|
-
f?: DeduceFilter<ED[T]['Schema']>;
|
|
134
|
-
};
|
|
135
|
-
export declare type RemoveOpResult<ED extends EntityDict, T extends keyof ED> = {
|
|
136
|
-
a: 'r';
|
|
137
|
-
e: T;
|
|
138
|
-
f?: DeduceFilter<ED[T]['Schema']>;
|
|
139
|
-
};
|
|
140
|
-
export declare type SelectOpResult<ED extends EntityDict> = {
|
|
141
|
-
a: 's';
|
|
142
|
-
d: {
|
|
143
|
-
[T in keyof ED]?: {
|
|
144
|
-
[ID: string]: ED[T]['OpSchema'];
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
export declare type OpRecord<ED extends EntityDict> = CreateOpResult<ED, keyof ED> | UpdateOpResult<ED, keyof ED> | RemoveOpResult<ED, keyof ED> | SelectOpResult<ED>;
|
|
149
|
-
export declare type OperationResult<ED extends EntityDict> = {
|
|
150
|
-
[K in keyof ED]?: {
|
|
151
|
-
[A in ED[K]['Action']]?: number;
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud';
|
|
155
|
-
export declare type Configuration = {
|
|
156
|
-
actionType?: ActionType;
|
|
157
|
-
static?: boolean;
|
|
158
|
-
};
|
|
159
|
-
export {};
|
|
1
|
+
import { GenericAction } from '../actions/action';
|
|
2
|
+
import { ExprOp, MakeFilter, NodeId } from './Demand';
|
|
3
|
+
import { OneOf } from './Polyfill';
|
|
4
|
+
import { PrimaryKey, Sequence } from './DataType';
|
|
5
|
+
declare type TriggerDataAttributeType = '$$triggerData$$';
|
|
6
|
+
declare type TriggerTimestampAttributeType = '$$triggerTimestamp$$';
|
|
7
|
+
declare type PrimaryKeyAttributeType = 'id';
|
|
8
|
+
declare type CreateAtAttributeType = '$$createAt$$';
|
|
9
|
+
declare type UpdateAtAttributeType = '$$updateAt$$';
|
|
10
|
+
declare type DeleteAtAttributeType = '$$deleteAt$$';
|
|
11
|
+
declare type SeqAttributeType = '$$seq$$';
|
|
12
|
+
export declare const TriggerDataAttribute = "$$triggerData$$";
|
|
13
|
+
export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$";
|
|
14
|
+
export declare const PrimaryKeyAttribute = "id";
|
|
15
|
+
export declare const CreateAtAttribute = "$$createAt$$";
|
|
16
|
+
export declare const UpdateAtAttribute = "$$updateAt$$";
|
|
17
|
+
export declare const DeleteAtAttribute = "$$deleteAt$$";
|
|
18
|
+
export declare const SeqAttribute = "$$seq$$";
|
|
19
|
+
export declare type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType;
|
|
20
|
+
export declare const initinctiveAttributes: string[];
|
|
21
|
+
export declare type Filter<A extends string, F extends Object | undefined = undefined> = {
|
|
22
|
+
filter?: A extends 'create' ? undefined : F;
|
|
23
|
+
indexFrom?: A extends 'create' ? undefined : number;
|
|
24
|
+
count?: A extends 'create' ? undefined : number;
|
|
25
|
+
};
|
|
26
|
+
export declare type SelectOption = {
|
|
27
|
+
dontCollect?: boolean;
|
|
28
|
+
blockTrigger?: true;
|
|
29
|
+
obscure?: boolean;
|
|
30
|
+
forUpdate?: true;
|
|
31
|
+
includedDeleted?: true;
|
|
32
|
+
dummy?: 1;
|
|
33
|
+
};
|
|
34
|
+
export declare type OperateOption = {
|
|
35
|
+
blockTrigger?: true;
|
|
36
|
+
dontCollect?: boolean;
|
|
37
|
+
dontCreateOper?: boolean;
|
|
38
|
+
dontCreateModi?: boolean;
|
|
39
|
+
allowExists?: boolean;
|
|
40
|
+
modiParentId?: string;
|
|
41
|
+
modiParentEntity?: string;
|
|
42
|
+
dummy?: 1;
|
|
43
|
+
};
|
|
44
|
+
export declare type FormUpdateData<SH extends GeneralEntityShape> = Partial<{
|
|
45
|
+
[K in keyof Omit<SH, InstinctiveAttributes>]: SH[K] | null;
|
|
46
|
+
}>;
|
|
47
|
+
export declare type FormCreateData<SH extends GeneralEntityShape> = Omit<SH, InstinctiveAttributes> & {
|
|
48
|
+
id: string;
|
|
49
|
+
};
|
|
50
|
+
export declare type Operation<A extends GenericAction | string, DATA extends Object, FILTER extends Object | undefined = undefined, SORTER extends Object | undefined = undefined> = {
|
|
51
|
+
id?: string;
|
|
52
|
+
action: A;
|
|
53
|
+
data: DATA;
|
|
54
|
+
sorter?: SORTER;
|
|
55
|
+
} & Filter<A, FILTER>;
|
|
56
|
+
export declare type Selection<DATA extends Object, FILTER extends Object | undefined = undefined, SORT extends Object | undefined = undefined> = Operation<'select', DATA, FILTER, SORT>;
|
|
57
|
+
export interface EntityShape {
|
|
58
|
+
id: PrimaryKey;
|
|
59
|
+
$$seq$$: Sequence;
|
|
60
|
+
$$createAt$$: number | Date;
|
|
61
|
+
$$updateAt$$: number | Date;
|
|
62
|
+
$$deleteAt$$?: number | Date | null;
|
|
63
|
+
}
|
|
64
|
+
export interface FileCarrierEntityShape extends EntityShape {
|
|
65
|
+
}
|
|
66
|
+
interface GeneralEntityShape extends EntityShape {
|
|
67
|
+
[K: string]: any;
|
|
68
|
+
}
|
|
69
|
+
export declare type MakeAction<A extends string> = A;
|
|
70
|
+
export interface EntityDef {
|
|
71
|
+
Schema: GeneralEntityShape;
|
|
72
|
+
OpSchema: GeneralEntityShape;
|
|
73
|
+
Action: string;
|
|
74
|
+
ParticularAction?: string;
|
|
75
|
+
Selection: Omit<DeduceSelection<this['Schema']>, 'action'>;
|
|
76
|
+
Operation: DeduceOperation<this['Schema']>;
|
|
77
|
+
Create: DeduceCreateOperation<this['Schema']>;
|
|
78
|
+
CreateSingle: DeduceCreateSingleOperation<this['Schema']>;
|
|
79
|
+
CreateMulti: DeduceCreateMultipleOperation<this['Schema']>;
|
|
80
|
+
Update: DeduceUpdateOperation<this['Schema']>;
|
|
81
|
+
Remove: DeduceRemoveOperation<this['Schema']>;
|
|
82
|
+
}
|
|
83
|
+
export interface EntityDict {
|
|
84
|
+
[E: string]: EntityDef;
|
|
85
|
+
}
|
|
86
|
+
export interface OtmSubProjection extends Omit<DeduceSelection<any>, 'action'> {
|
|
87
|
+
$entity: string;
|
|
88
|
+
}
|
|
89
|
+
declare type DeduceProjection<SH extends GeneralEntityShape> = {
|
|
90
|
+
'#id'?: NodeId;
|
|
91
|
+
} & {
|
|
92
|
+
[K in keyof SH]?: number | OtmSubProjection | any;
|
|
93
|
+
} & Partial<ExprOp<keyof SH>>;
|
|
94
|
+
export declare type AttrFilter<SH extends GeneralEntityShape> = {
|
|
95
|
+
[K in keyof SH]: any;
|
|
96
|
+
};
|
|
97
|
+
export declare type DeduceFilter<SH extends GeneralEntityShape> = MakeFilter<AttrFilter<SH> & ExprOp<keyof SH>>;
|
|
98
|
+
export declare type DeduceSorterAttr<SH extends GeneralEntityShape> = OneOf<{
|
|
99
|
+
[K: string]: number | object | undefined;
|
|
100
|
+
} & ExprOp<keyof SH>>;
|
|
101
|
+
export declare type DeduceSorterItem<SH extends GeneralEntityShape> = {
|
|
102
|
+
$attr: DeduceSorterAttr<SH>;
|
|
103
|
+
$direction?: "asc" | "desc";
|
|
104
|
+
};
|
|
105
|
+
export declare type DeduceSorter<SH extends GeneralEntityShape> = Array<DeduceSorterItem<SH>>;
|
|
106
|
+
export declare type DeduceSelection<SH extends GeneralEntityShape> = Selection<DeduceProjection<SH>, DeduceFilter<SH>, DeduceSorter<SH>>;
|
|
107
|
+
export declare type DeduceCreateOperationData<SH extends GeneralEntityShape> = {
|
|
108
|
+
id: string;
|
|
109
|
+
} & {
|
|
110
|
+
[k in keyof Omit<SH, InstinctiveAttributes>]?: any;
|
|
111
|
+
};
|
|
112
|
+
export declare type DeduceCreateSingleOperation<SH extends GeneralEntityShape> = Operation<'create', DeduceCreateOperationData<SH>>;
|
|
113
|
+
export declare type DeduceCreateMultipleOperation<SH extends GeneralEntityShape> = Operation<'create', Array<DeduceCreateOperationData<SH>>>;
|
|
114
|
+
export declare type DeduceCreateOperation<SH extends GeneralEntityShape> = DeduceCreateSingleOperation<SH> | DeduceCreateMultipleOperation<SH>;
|
|
115
|
+
export declare type DeduceUpdateOperationData<SH extends GeneralEntityShape> = {
|
|
116
|
+
[k in keyof Omit<SH, InstinctiveAttributes>]?: any;
|
|
117
|
+
};
|
|
118
|
+
export declare type DeduceUpdateOperation<SH extends GeneralEntityShape> = Operation<'update' | string, DeduceUpdateOperationData<SH>, DeduceFilter<SH>, DeduceSorter<SH>>;
|
|
119
|
+
export declare type DeduceRemoveOperationData<SH extends GeneralEntityShape> = {
|
|
120
|
+
[A in keyof Omit<SH, InstinctiveAttributes>]?: any;
|
|
121
|
+
};
|
|
122
|
+
export declare type DeduceRemoveOperation<SH extends GeneralEntityShape> = Operation<'remove', DeduceRemoveOperationData<SH>, DeduceFilter<SH>, DeduceSorter<SH>>;
|
|
123
|
+
export declare type DeduceOperation<SH extends GeneralEntityShape> = DeduceCreateOperation<SH> | DeduceUpdateOperation<SH> | DeduceRemoveOperation<SH>;
|
|
124
|
+
export declare type CreateOpResult<ED extends EntityDict, T extends keyof ED> = {
|
|
125
|
+
a: 'c';
|
|
126
|
+
e: T;
|
|
127
|
+
d: ED[T]['OpSchema'] | ED[T]['OpSchema'][];
|
|
128
|
+
};
|
|
129
|
+
export declare type UpdateOpResult<ED extends EntityDict, T extends keyof ED> = {
|
|
130
|
+
a: 'u';
|
|
131
|
+
e: T;
|
|
132
|
+
d: DeduceUpdateOperationData<ED[T]['Schema']>;
|
|
133
|
+
f?: DeduceFilter<ED[T]['Schema']>;
|
|
134
|
+
};
|
|
135
|
+
export declare type RemoveOpResult<ED extends EntityDict, T extends keyof ED> = {
|
|
136
|
+
a: 'r';
|
|
137
|
+
e: T;
|
|
138
|
+
f?: DeduceFilter<ED[T]['Schema']>;
|
|
139
|
+
};
|
|
140
|
+
export declare type SelectOpResult<ED extends EntityDict> = {
|
|
141
|
+
a: 's';
|
|
142
|
+
d: {
|
|
143
|
+
[T in keyof ED]?: {
|
|
144
|
+
[ID: string]: ED[T]['OpSchema'];
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
export declare type OpRecord<ED extends EntityDict> = CreateOpResult<ED, keyof ED> | UpdateOpResult<ED, keyof ED> | RemoveOpResult<ED, keyof ED> | SelectOpResult<ED>;
|
|
149
|
+
export declare type OperationResult<ED extends EntityDict> = {
|
|
150
|
+
[K in keyof ED]?: {
|
|
151
|
+
[A in ED[K]['Action']]?: number;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
export declare type ActionType = 'readOnly' | 'appendOnly' | 'excludeUpdate' | 'excludeRemove' | 'crud';
|
|
155
|
+
export declare type Configuration = {
|
|
156
|
+
actionType?: ActionType;
|
|
157
|
+
static?: boolean;
|
|
158
|
+
};
|
|
159
|
+
export {};
|
package/lib/types/Entity.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerTimestampAttribute = exports.TriggerDataAttribute = void 0;
|
|
4
|
-
exports.TriggerDataAttribute = '$$triggerData$$';
|
|
5
|
-
exports.TriggerTimestampAttribute = '$$triggerTimestamp$$';
|
|
6
|
-
exports.PrimaryKeyAttribute = 'id';
|
|
7
|
-
exports.CreateAtAttribute = '$$createAt$$';
|
|
8
|
-
exports.UpdateAtAttribute = '$$updateAt$$';
|
|
9
|
-
exports.DeleteAtAttribute = '$$deleteAt$$';
|
|
10
|
-
exports.SeqAttribute = '$$seq$$';
|
|
11
|
-
exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerTimestampAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute];
|
|
12
|
-
;
|
|
13
|
-
;
|
|
14
|
-
;
|
|
15
|
-
;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerTimestampAttribute = exports.TriggerDataAttribute = void 0;
|
|
4
|
+
exports.TriggerDataAttribute = '$$triggerData$$';
|
|
5
|
+
exports.TriggerTimestampAttribute = '$$triggerTimestamp$$';
|
|
6
|
+
exports.PrimaryKeyAttribute = 'id';
|
|
7
|
+
exports.CreateAtAttribute = '$$createAt$$';
|
|
8
|
+
exports.UpdateAtAttribute = '$$updateAt$$';
|
|
9
|
+
exports.DeleteAtAttribute = '$$deleteAt$$';
|
|
10
|
+
exports.SeqAttribute = '$$seq$$';
|
|
11
|
+
exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerTimestampAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute];
|
|
12
|
+
;
|
|
13
|
+
;
|
|
14
|
+
;
|
|
15
|
+
;
|
package/lib/types/Exception.d.ts
CHANGED
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
import { EntityDict, OpRecord } from "./Entity";
|
|
2
|
-
export declare class OakException extends Error {
|
|
3
|
-
constructor(message?: string);
|
|
4
|
-
toString(): string;
|
|
5
|
-
}
|
|
6
|
-
export declare class OakDataException extends OakException {
|
|
7
|
-
}
|
|
8
|
-
export declare class OakOperExistedException extends OakDataException {
|
|
9
|
-
}
|
|
10
|
-
export declare class OakRowUnexistedException extends OakDataException {
|
|
11
|
-
private rows;
|
|
12
|
-
constructor(rows: Array<{
|
|
13
|
-
entity: any;
|
|
14
|
-
selection: any;
|
|
15
|
-
}>);
|
|
16
|
-
toString(): string;
|
|
17
|
-
getRows(): {
|
|
18
|
-
entity: any;
|
|
19
|
-
selection: any;
|
|
20
|
-
}[];
|
|
21
|
-
}
|
|
22
|
-
export declare class OakExternalException extends Error {
|
|
23
|
-
}
|
|
24
|
-
export declare class OakUserException extends OakException {
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
export declare class OakRowInconsistencyException<ED extends EntityDict> extends OakUserException {
|
|
31
|
-
private data?;
|
|
32
|
-
constructor(data?: OpRecord<ED>, message?: string);
|
|
33
|
-
getData(): OpRecord<ED> | undefined;
|
|
34
|
-
toString(): string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 当输入的数据非法时抛此异常,attributes表示非法的属性
|
|
38
|
-
*/
|
|
39
|
-
export declare class OakInputIllegalException extends OakUserException {
|
|
40
|
-
private attributes;
|
|
41
|
-
private entity;
|
|
42
|
-
constructor(entity: string, attributes: string[], message?: string);
|
|
43
|
-
getEntity(): string;
|
|
44
|
-
getAttributes(): string[];
|
|
45
|
-
addAttributesPrefix(prefix: string): void;
|
|
46
|
-
toString(): string;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 用户权限不够时抛的异常
|
|
50
|
-
*/
|
|
51
|
-
export declare class OakUserUnpermittedException extends OakUserException {
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* 用户未登录抛的异常
|
|
55
|
-
*/
|
|
56
|
-
export declare class OakUnloggedInException extends OakUserException {
|
|
57
|
-
constructor(message?: string);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 用户未登录抛的异常
|
|
61
|
-
*/
|
|
62
|
-
export declare class OakRowLockedException extends OakUserException {
|
|
63
|
-
constructor(message?: string);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* 要插入行时,发现已经有相同的行数据
|
|
67
|
-
*/
|
|
68
|
-
export declare class OakCongruentRowExists<ED extends EntityDict, T extends keyof ED> extends OakUserException {
|
|
69
|
-
private data;
|
|
70
|
-
private entity;
|
|
71
|
-
constructor(entity: T, data: ED[T]['OpSchema'], message?: string);
|
|
72
|
-
getData(): ED[T]["OpSchema"];
|
|
73
|
-
getEntity(): T;
|
|
74
|
-
toString(): string;
|
|
75
|
-
}
|
|
76
|
-
export declare class OakDeadlock extends OakUserException {
|
|
77
|
-
constructor(message?: string | undefined);
|
|
78
|
-
}
|
|
79
|
-
export declare function makeException(data: {
|
|
80
|
-
name: string;
|
|
81
|
-
message?: string;
|
|
82
|
-
[A: string]: any;
|
|
83
|
-
}): OakException | OakExternalException | undefined;
|
|
1
|
+
import { EntityDict, OpRecord } from "./Entity";
|
|
2
|
+
export declare class OakException extends Error {
|
|
3
|
+
constructor(message?: string);
|
|
4
|
+
toString(): string;
|
|
5
|
+
}
|
|
6
|
+
export declare class OakDataException extends OakException {
|
|
7
|
+
}
|
|
8
|
+
export declare class OakOperExistedException extends OakDataException {
|
|
9
|
+
}
|
|
10
|
+
export declare class OakRowUnexistedException extends OakDataException {
|
|
11
|
+
private rows;
|
|
12
|
+
constructor(rows: Array<{
|
|
13
|
+
entity: any;
|
|
14
|
+
selection: any;
|
|
15
|
+
}>);
|
|
16
|
+
toString(): string;
|
|
17
|
+
getRows(): {
|
|
18
|
+
entity: any;
|
|
19
|
+
selection: any;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
export declare class OakExternalException extends Error {
|
|
23
|
+
}
|
|
24
|
+
export declare class OakUserException extends OakException {
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare class OakRowInconsistencyException<ED extends EntityDict> extends OakUserException {
|
|
31
|
+
private data?;
|
|
32
|
+
constructor(data?: OpRecord<ED>, message?: string);
|
|
33
|
+
getData(): OpRecord<ED> | undefined;
|
|
34
|
+
toString(): string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 当输入的数据非法时抛此异常,attributes表示非法的属性
|
|
38
|
+
*/
|
|
39
|
+
export declare class OakInputIllegalException extends OakUserException {
|
|
40
|
+
private attributes;
|
|
41
|
+
private entity;
|
|
42
|
+
constructor(entity: string, attributes: string[], message?: string);
|
|
43
|
+
getEntity(): string;
|
|
44
|
+
getAttributes(): string[];
|
|
45
|
+
addAttributesPrefix(prefix: string): void;
|
|
46
|
+
toString(): string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 用户权限不够时抛的异常
|
|
50
|
+
*/
|
|
51
|
+
export declare class OakUserUnpermittedException extends OakUserException {
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 用户未登录抛的异常
|
|
55
|
+
*/
|
|
56
|
+
export declare class OakUnloggedInException extends OakUserException {
|
|
57
|
+
constructor(message?: string);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 用户未登录抛的异常
|
|
61
|
+
*/
|
|
62
|
+
export declare class OakRowLockedException extends OakUserException {
|
|
63
|
+
constructor(message?: string);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* 要插入行时,发现已经有相同的行数据
|
|
67
|
+
*/
|
|
68
|
+
export declare class OakCongruentRowExists<ED extends EntityDict, T extends keyof ED> extends OakUserException {
|
|
69
|
+
private data;
|
|
70
|
+
private entity;
|
|
71
|
+
constructor(entity: T, data: ED[T]['OpSchema'], message?: string);
|
|
72
|
+
getData(): ED[T]["OpSchema"];
|
|
73
|
+
getEntity(): T;
|
|
74
|
+
toString(): string;
|
|
75
|
+
}
|
|
76
|
+
export declare class OakDeadlock extends OakUserException {
|
|
77
|
+
constructor(message?: string | undefined);
|
|
78
|
+
}
|
|
79
|
+
export declare function makeException(data: {
|
|
80
|
+
name: string;
|
|
81
|
+
message?: string;
|
|
82
|
+
[A: string]: any;
|
|
83
|
+
}): OakException | OakExternalException | undefined;
|