oak-domain 5.0.1 → 5.0.2
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/base-app-domain/ActionAuth/Schema.d.ts +4 -21
- package/lib/base-app-domain/ActionAuth/Storage.js +1 -0
- package/lib/base-app-domain/I18n/Storage.js +1 -0
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +0 -56
- package/lib/base-app-domain/OperEntity/Schema.d.ts +0 -56
- package/lib/base-app-domain/Path/Schema.d.ts +0 -4
- package/lib/base-app-domain/Path/Storage.js +1 -0
- package/lib/base-app-domain/Relation/Schema.d.ts +0 -6
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +4 -21
- package/lib/base-app-domain/RelationAuth/Storage.js +1 -0
- package/lib/base-app-domain/User/Style.js +2 -2
- package/lib/compiler/dependencyBuilder.d.ts +2 -6
- package/lib/compiler/dependencyBuilder.js +38 -26
- package/lib/entities/ActionAuth.js +3 -0
- package/lib/entities/I18n.js +3 -0
- package/lib/entities/Path.js +3 -0
- package/lib/entities/RelationAuth.js +3 -0
- package/lib/entities/User.js +4 -4
- package/lib/types/RowStore.d.ts +0 -1
- package/lib/types/RowStore.js +2 -15
- package/lib/utils/money.d.ts +1 -1
- package/lib/utils/money.js +2 -2
- package/lib/utils/operationResult.d.ts +2 -0
- package/lib/utils/operationResult.js +19 -0
- package/package.json +1 -1
- package/src/entities/ActionAuth.ts +44 -41
- package/src/entities/I18n.ts +3 -0
- package/src/entities/Path.ts +46 -43
- package/src/entities/RelationAuth.ts +47 -44
- package/src/entities/User.ts +13 -8
|
@@ -113,16 +113,10 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "relationId" | "
|
|
|
113
113
|
} | {
|
|
114
114
|
relation?: never;
|
|
115
115
|
relationId?: ForeignKey<"relation">;
|
|
116
|
-
}) &
|
|
117
|
-
pathId?: never;
|
|
118
|
-
path: Path.CreateSingleOperation;
|
|
119
|
-
} | {
|
|
120
|
-
pathId: ForeignKey<"path">;
|
|
121
|
-
path?: Path.UpdateOperation;
|
|
122
|
-
} | {
|
|
116
|
+
}) & {
|
|
123
117
|
path?: never;
|
|
124
118
|
pathId: ForeignKey<"path">;
|
|
125
|
-
})
|
|
119
|
+
}) & {
|
|
126
120
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
127
121
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
128
122
|
};
|
|
@@ -141,19 +135,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId" | "
|
|
|
141
135
|
} | {
|
|
142
136
|
relation?: never;
|
|
143
137
|
relationId?: ForeignKey<"relation"> | null;
|
|
144
|
-
}) &
|
|
145
|
-
path?: Path.CreateSingleOperation;
|
|
146
|
-
pathId?: never;
|
|
147
|
-
} | {
|
|
148
|
-
path?: Path.UpdateOperation;
|
|
149
|
-
pathId?: never;
|
|
150
|
-
} | {
|
|
151
|
-
path?: Path.RemoveOperation;
|
|
152
|
-
pathId?: never;
|
|
153
|
-
} | {
|
|
138
|
+
}) & {
|
|
154
139
|
path?: never;
|
|
155
140
|
pathId?: ForeignKey<"path">;
|
|
156
|
-
})
|
|
141
|
+
}) & {
|
|
157
142
|
[k: string]: any;
|
|
158
143
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
159
144
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
@@ -161,8 +146,6 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId" | "
|
|
|
161
146
|
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
162
147
|
export type RemoveOperationData = {} & (({
|
|
163
148
|
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
164
|
-
}) & ({
|
|
165
|
-
path?: Path.UpdateOperation | Path.RemoveOperation;
|
|
166
149
|
}));
|
|
167
150
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
168
151
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
@@ -166,37 +166,13 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|
|
166
166
|
modi?: never;
|
|
167
167
|
modiId: ForeignKey<"modi">;
|
|
168
168
|
})) & ({
|
|
169
|
-
entity?: never;
|
|
170
|
-
entityId?: never;
|
|
171
|
-
actionAuth: ActionAuth.CreateSingleOperation;
|
|
172
|
-
} | {
|
|
173
|
-
entity: "actionAuth";
|
|
174
|
-
entityId: ForeignKey<"ActionAuth">;
|
|
175
|
-
actionAuth?: ActionAuth.UpdateOperation;
|
|
176
|
-
} | {
|
|
177
169
|
entity: "actionAuth";
|
|
178
170
|
entityId: ForeignKey<"ActionAuth">;
|
|
179
171
|
actionAuth?: never;
|
|
180
|
-
} | {
|
|
181
|
-
entity?: never;
|
|
182
|
-
entityId?: never;
|
|
183
|
-
i18n: I18n.CreateSingleOperation;
|
|
184
|
-
} | {
|
|
185
|
-
entity: "i18n";
|
|
186
|
-
entityId: ForeignKey<"I18n">;
|
|
187
|
-
i18n?: I18n.UpdateOperation;
|
|
188
172
|
} | {
|
|
189
173
|
entity: "i18n";
|
|
190
174
|
entityId: ForeignKey<"I18n">;
|
|
191
175
|
i18n?: never;
|
|
192
|
-
} | {
|
|
193
|
-
entity?: never;
|
|
194
|
-
entityId?: never;
|
|
195
|
-
path: Path.CreateSingleOperation;
|
|
196
|
-
} | {
|
|
197
|
-
entity: "path";
|
|
198
|
-
entityId: ForeignKey<"Path">;
|
|
199
|
-
path?: Path.UpdateOperation;
|
|
200
176
|
} | {
|
|
201
177
|
entity: "path";
|
|
202
178
|
entityId: ForeignKey<"Path">;
|
|
@@ -213,14 +189,6 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|
|
213
189
|
entity: "relation";
|
|
214
190
|
entityId: ForeignKey<"Relation">;
|
|
215
191
|
relation?: never;
|
|
216
|
-
} | {
|
|
217
|
-
entity?: never;
|
|
218
|
-
entityId?: never;
|
|
219
|
-
relationAuth: RelationAuth.CreateSingleOperation;
|
|
220
|
-
} | {
|
|
221
|
-
entity: "relationAuth";
|
|
222
|
-
entityId: ForeignKey<"RelationAuth">;
|
|
223
|
-
relationAuth?: RelationAuth.UpdateOperation;
|
|
224
192
|
} | {
|
|
225
193
|
entity: "relationAuth";
|
|
226
194
|
entityId: ForeignKey<"RelationAuth">;
|
|
@@ -294,25 +262,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|
|
294
262
|
modi?: never;
|
|
295
263
|
modiId?: ForeignKey<"modi">;
|
|
296
264
|
})) & ({
|
|
297
|
-
actionAuth?: ActionAuth.CreateSingleOperation | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
|
298
|
-
entityId?: never;
|
|
299
|
-
entity?: never;
|
|
300
|
-
} | {
|
|
301
|
-
i18n?: I18n.CreateSingleOperation | I18n.UpdateOperation | I18n.RemoveOperation;
|
|
302
|
-
entityId?: never;
|
|
303
|
-
entity?: never;
|
|
304
|
-
} | {
|
|
305
|
-
path?: Path.CreateSingleOperation | Path.UpdateOperation | Path.RemoveOperation;
|
|
306
|
-
entityId?: never;
|
|
307
|
-
entity?: never;
|
|
308
|
-
} | {
|
|
309
265
|
relation?: Relation.CreateSingleOperation | Relation.UpdateOperation | Relation.RemoveOperation;
|
|
310
266
|
entityId?: never;
|
|
311
267
|
entity?: never;
|
|
312
|
-
} | {
|
|
313
|
-
relationAuth?: RelationAuth.CreateSingleOperation | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
|
314
|
-
entityId?: never;
|
|
315
|
-
entity?: never;
|
|
316
268
|
} | {
|
|
317
269
|
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
|
318
270
|
entityId?: never;
|
|
@@ -348,15 +300,7 @@ export type UpdateOperation = OakOperation<"update" | string, UpdateOperationDat
|
|
|
348
300
|
export type RemoveOperationData = {} & (({
|
|
349
301
|
modi?: Modi.UpdateOperation | Modi.RemoveOperation;
|
|
350
302
|
})) & ({
|
|
351
|
-
actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
|
352
|
-
} | {
|
|
353
|
-
i18n?: I18n.UpdateOperation | I18n.RemoveOperation;
|
|
354
|
-
} | {
|
|
355
|
-
path?: Path.UpdateOperation | Path.RemoveOperation;
|
|
356
|
-
} | {
|
|
357
303
|
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
358
|
-
} | {
|
|
359
|
-
relationAuth?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
|
360
304
|
} | {
|
|
361
305
|
user?: User.UpdateOperation | User.RemoveOperation;
|
|
362
306
|
} | {
|
|
@@ -163,37 +163,13 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|
|
163
163
|
oper?: never;
|
|
164
164
|
operId: ForeignKey<"oper">;
|
|
165
165
|
})) & ({
|
|
166
|
-
entity?: never;
|
|
167
|
-
entityId?: never;
|
|
168
|
-
actionAuth: ActionAuth.CreateSingleOperation;
|
|
169
|
-
} | {
|
|
170
|
-
entity: "actionAuth";
|
|
171
|
-
entityId: ForeignKey<"ActionAuth">;
|
|
172
|
-
actionAuth?: ActionAuth.UpdateOperation;
|
|
173
|
-
} | {
|
|
174
166
|
entity: "actionAuth";
|
|
175
167
|
entityId: ForeignKey<"ActionAuth">;
|
|
176
168
|
actionAuth?: never;
|
|
177
|
-
} | {
|
|
178
|
-
entity?: never;
|
|
179
|
-
entityId?: never;
|
|
180
|
-
i18n: I18n.CreateSingleOperation;
|
|
181
|
-
} | {
|
|
182
|
-
entity: "i18n";
|
|
183
|
-
entityId: ForeignKey<"I18n">;
|
|
184
|
-
i18n?: I18n.UpdateOperation;
|
|
185
169
|
} | {
|
|
186
170
|
entity: "i18n";
|
|
187
171
|
entityId: ForeignKey<"I18n">;
|
|
188
172
|
i18n?: never;
|
|
189
|
-
} | {
|
|
190
|
-
entity?: never;
|
|
191
|
-
entityId?: never;
|
|
192
|
-
path: Path.CreateSingleOperation;
|
|
193
|
-
} | {
|
|
194
|
-
entity: "path";
|
|
195
|
-
entityId: ForeignKey<"Path">;
|
|
196
|
-
path?: Path.UpdateOperation;
|
|
197
173
|
} | {
|
|
198
174
|
entity: "path";
|
|
199
175
|
entityId: ForeignKey<"Path">;
|
|
@@ -210,14 +186,6 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|
|
210
186
|
entity: "relation";
|
|
211
187
|
entityId: ForeignKey<"Relation">;
|
|
212
188
|
relation?: never;
|
|
213
|
-
} | {
|
|
214
|
-
entity?: never;
|
|
215
|
-
entityId?: never;
|
|
216
|
-
relationAuth: RelationAuth.CreateSingleOperation;
|
|
217
|
-
} | {
|
|
218
|
-
entity: "relationAuth";
|
|
219
|
-
entityId: ForeignKey<"RelationAuth">;
|
|
220
|
-
relationAuth?: RelationAuth.UpdateOperation;
|
|
221
189
|
} | {
|
|
222
190
|
entity: "relationAuth";
|
|
223
191
|
entityId: ForeignKey<"RelationAuth">;
|
|
@@ -285,25 +253,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|
|
285
253
|
oper?: never;
|
|
286
254
|
operId?: ForeignKey<"oper">;
|
|
287
255
|
})) & ({
|
|
288
|
-
actionAuth?: ActionAuth.CreateSingleOperation | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
|
289
|
-
entityId?: never;
|
|
290
|
-
entity?: never;
|
|
291
|
-
} | {
|
|
292
|
-
i18n?: I18n.CreateSingleOperation | I18n.UpdateOperation | I18n.RemoveOperation;
|
|
293
|
-
entityId?: never;
|
|
294
|
-
entity?: never;
|
|
295
|
-
} | {
|
|
296
|
-
path?: Path.CreateSingleOperation | Path.UpdateOperation | Path.RemoveOperation;
|
|
297
|
-
entityId?: never;
|
|
298
|
-
entity?: never;
|
|
299
|
-
} | {
|
|
300
256
|
relation?: Relation.CreateSingleOperation | Relation.UpdateOperation | Relation.RemoveOperation;
|
|
301
257
|
entityId?: never;
|
|
302
258
|
entity?: never;
|
|
303
|
-
} | {
|
|
304
|
-
relationAuth?: RelationAuth.CreateSingleOperation | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
|
305
|
-
entityId?: never;
|
|
306
|
-
entity?: never;
|
|
307
259
|
} | {
|
|
308
260
|
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
|
309
261
|
entityId?: never;
|
|
@@ -337,15 +289,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|
|
337
289
|
};
|
|
338
290
|
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
339
291
|
export type RemoveOperationData = {} & ({
|
|
340
|
-
actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
|
341
|
-
} | {
|
|
342
|
-
i18n?: I18n.UpdateOperation | I18n.RemoveOperation;
|
|
343
|
-
} | {
|
|
344
|
-
path?: Path.UpdateOperation | Path.RemoveOperation;
|
|
345
|
-
} | {
|
|
346
292
|
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
347
|
-
} | {
|
|
348
|
-
relationAuth?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
|
349
293
|
} | {
|
|
350
294
|
user?: User.UpdateOperation | User.RemoveOperation;
|
|
351
295
|
} | {
|
|
@@ -112,8 +112,6 @@ export type SelectOperation<P extends Object = Projection> = OakSelection<"selec
|
|
|
112
112
|
export type Selection<P extends Object = Projection> = SelectOperation<P>;
|
|
113
113
|
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
|
114
114
|
export type CreateOperationData = FormCreateData<OpSchema> & {
|
|
115
|
-
actionAuth$path?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">>>;
|
|
116
|
-
relationAuth$path?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">>>;
|
|
117
115
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
118
116
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
119
117
|
};
|
|
@@ -122,8 +120,6 @@ export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperati
|
|
|
122
120
|
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
123
121
|
export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
124
122
|
[k: string]: any;
|
|
125
|
-
actionAuth$path?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">>>;
|
|
126
|
-
relationAuth$path?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">>>;
|
|
127
123
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
128
124
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
129
125
|
};
|
|
@@ -145,9 +145,6 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|
|
145
145
|
entityId?: string;
|
|
146
146
|
[K: string]: any;
|
|
147
147
|
}) & {
|
|
148
|
-
actionAuth$relation?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">>>;
|
|
149
|
-
relationAuth$sourceRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">>>;
|
|
150
|
-
relationAuth$destRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">>>;
|
|
151
148
|
userEntityClaim$relation?: OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">> | OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">>>;
|
|
152
149
|
userRelation$relation?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">>>;
|
|
153
150
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
@@ -158,9 +155,6 @@ export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperati
|
|
|
158
155
|
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
159
156
|
export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
160
157
|
[k: string]: any;
|
|
161
|
-
actionAuth$relation?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">>>;
|
|
162
|
-
relationAuth$sourceRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">>>;
|
|
163
|
-
relationAuth$destRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">>>;
|
|
164
158
|
userEntityClaim$relation?: OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<UserEntityClaim.RemoveOperation["action"], Omit<UserEntityClaim.RemoveOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">> | OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<UserEntityClaim.RemoveOperation["action"], Omit<UserEntityClaim.RemoveOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">>>;
|
|
165
159
|
userRelation$relation?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">>>;
|
|
166
160
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
@@ -118,16 +118,10 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "sourceRelationI
|
|
|
118
118
|
} | {
|
|
119
119
|
sourceRelation?: never;
|
|
120
120
|
sourceRelationId: ForeignKey<"sourceRelation">;
|
|
121
|
-
}) &
|
|
122
|
-
pathId?: never;
|
|
123
|
-
path: Path.CreateSingleOperation;
|
|
124
|
-
} | {
|
|
125
|
-
pathId: ForeignKey<"path">;
|
|
126
|
-
path?: Path.UpdateOperation;
|
|
127
|
-
} | {
|
|
121
|
+
}) & {
|
|
128
122
|
path?: never;
|
|
129
123
|
pathId: ForeignKey<"path">;
|
|
130
|
-
}
|
|
124
|
+
} & ({
|
|
131
125
|
destRelationId?: never;
|
|
132
126
|
destRelation: Relation.CreateSingleOperation;
|
|
133
127
|
} | {
|
|
@@ -155,19 +149,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "sourceRelationI
|
|
|
155
149
|
} | {
|
|
156
150
|
sourceRelation?: never;
|
|
157
151
|
sourceRelationId?: ForeignKey<"sourceRelation">;
|
|
158
|
-
}) &
|
|
159
|
-
path?: Path.CreateSingleOperation;
|
|
160
|
-
pathId?: never;
|
|
161
|
-
} | {
|
|
162
|
-
path?: Path.UpdateOperation;
|
|
163
|
-
pathId?: never;
|
|
164
|
-
} | {
|
|
165
|
-
path?: Path.RemoveOperation;
|
|
166
|
-
pathId?: never;
|
|
167
|
-
} | {
|
|
152
|
+
}) & {
|
|
168
153
|
path?: never;
|
|
169
154
|
pathId?: ForeignKey<"path">;
|
|
170
|
-
}
|
|
155
|
+
} & ({
|
|
171
156
|
destRelation?: Relation.CreateSingleOperation;
|
|
172
157
|
destRelationId?: never;
|
|
173
158
|
} | {
|
|
@@ -187,8 +172,6 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "sourceRelationI
|
|
|
187
172
|
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
188
173
|
export type RemoveOperationData = {} & (({
|
|
189
174
|
sourceRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
190
|
-
}) & ({
|
|
191
|
-
path?: Path.UpdateOperation | Path.RemoveOperation;
|
|
192
175
|
}) & ({
|
|
193
176
|
destRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
194
177
|
}));
|
|
@@ -9,6 +9,7 @@ const ts = tslib_1.__importStar(require("typescript"));
|
|
|
9
9
|
const string_1 = require("../utils/string");
|
|
10
10
|
const env_1 = require("./env");
|
|
11
11
|
const fs_extra_1 = require("fs-extra");
|
|
12
|
+
const lodash_1 = require("lodash");
|
|
12
13
|
const { factory } = ts;
|
|
13
14
|
/**
|
|
14
15
|
* 构建项目依赖关系图
|
|
@@ -17,19 +18,15 @@ const { factory } = ts;
|
|
|
17
18
|
*/
|
|
18
19
|
function analyzeDepedency(cwd) {
|
|
19
20
|
const depGraph = {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
nodes: {},
|
|
22
|
+
dependencies: {},
|
|
22
23
|
ascOrder: [],
|
|
23
24
|
};
|
|
24
|
-
function analyzeOne(dir, name
|
|
25
|
-
const node = {
|
|
26
|
-
name,
|
|
27
|
-
parent,
|
|
28
|
-
};
|
|
25
|
+
function analyzeOne(dir, name) {
|
|
29
26
|
if (name) {
|
|
30
|
-
depGraph.
|
|
31
|
-
|
|
32
|
-
depGraph.
|
|
27
|
+
if (!depGraph.nodes[name]) {
|
|
28
|
+
depGraph.nodes[name] = 1;
|
|
29
|
+
depGraph.dependencies[name] = {};
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
let dependencies = [];
|
|
@@ -42,7 +39,7 @@ function analyzeDepedency(cwd) {
|
|
|
42
39
|
else {
|
|
43
40
|
const depConfigJsFile = join(dir, 'lib', 'configuration', 'dependency.js');
|
|
44
41
|
if ((0, fs_1.existsSync)(depConfigJsFile)) {
|
|
45
|
-
dependencies = require(depConfigJsFile);
|
|
42
|
+
dependencies = require(depConfigJsFile).default;
|
|
46
43
|
}
|
|
47
44
|
else {
|
|
48
45
|
// 没有依赖文件,直接返回
|
|
@@ -50,11 +47,10 @@ function analyzeDepedency(cwd) {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
dependencies.forEach((dep) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
(0, assert_1.default)(name);
|
|
50
|
+
if (name) {
|
|
51
|
+
depGraph.dependencies[name][dep] = 1;
|
|
56
52
|
}
|
|
57
|
-
|
|
53
|
+
if (!depGraph.nodes[dep]) {
|
|
58
54
|
let dir2 = join(cwd, 'node_modules', dep);
|
|
59
55
|
if (!(0, fs_1.existsSync)(dir2)) {
|
|
60
56
|
dir2 = join(dir, 'node_modules', dep);
|
|
@@ -62,15 +58,33 @@ function analyzeDepedency(cwd) {
|
|
|
62
58
|
throw new Error(`找不到依赖包${dep}的安装位置,当前包是${dir}`);
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
|
-
analyzeOne(dir2, dep
|
|
61
|
+
analyzeOne(dir2, dep);
|
|
66
62
|
}
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
65
|
analyzeOne(cwd, '');
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
// 输出一个依赖关系从底向上的序列,类似于图中的反向遍历算法
|
|
67
|
+
do {
|
|
68
|
+
const deps = Object.keys(depGraph.nodes);
|
|
69
|
+
if (deps.length === 0) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
const freeNodes = [];
|
|
73
|
+
for (const n of deps) {
|
|
74
|
+
if (Object.keys(depGraph.dependencies[n]).length === 0) {
|
|
75
|
+
freeNodes.push(n);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
(0, assert_1.default)(freeNodes.length > 0, '依赖关系成环!');
|
|
79
|
+
freeNodes.forEach((n) => {
|
|
80
|
+
(0, lodash_1.unset)(depGraph.nodes, n);
|
|
81
|
+
(0, lodash_1.unset)(depGraph.dependencies, n);
|
|
82
|
+
for (const n2 in depGraph.dependencies) {
|
|
83
|
+
(0, lodash_1.unset)(depGraph.dependencies[n2], n);
|
|
84
|
+
}
|
|
85
|
+
depGraph.ascOrder.push(n);
|
|
86
|
+
});
|
|
87
|
+
} while (true);
|
|
74
88
|
return depGraph;
|
|
75
89
|
}
|
|
76
90
|
exports.analyzeDepedency = analyzeDepedency;
|
|
@@ -141,8 +155,7 @@ function outputPolyfillDts(dependencies, briefNames, sourceFile, printer, filena
|
|
|
141
155
|
factory.createIntersectionTypeNode([
|
|
142
156
|
featureTypeNode,
|
|
143
157
|
...briefNames.map((ele) => factory.createTypeReferenceNode(factory.createIdentifier(`${(0, string_1.firstLetterUpperCase)(ele)}FeatureDict`), [
|
|
144
|
-
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)
|
|
145
|
-
factory.createTypeReferenceNode(factory.createIdentifier("BackendRuntimeContext"), undefined)
|
|
158
|
+
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)
|
|
146
159
|
]))
|
|
147
160
|
])
|
|
148
161
|
]
|
|
@@ -153,8 +166,7 @@ function outputPolyfillDts(dependencies, briefNames, sourceFile, printer, filena
|
|
|
153
166
|
type: factory.createIntersectionTypeNode([
|
|
154
167
|
featureType,
|
|
155
168
|
...briefNames.map((ele) => factory.createTypeReferenceNode(factory.createIdentifier(`${(0, string_1.firstLetterUpperCase)(ele)}FeatureDict`), [
|
|
156
|
-
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)
|
|
157
|
-
factory.createTypeReferenceNode(factory.createIdentifier("BackendRuntimeContext"), undefined)
|
|
169
|
+
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)
|
|
158
170
|
]))
|
|
159
171
|
])
|
|
160
172
|
});
|
|
@@ -266,8 +278,8 @@ function outputRuntimeCxt(dependencies, briefNames, sourceFile, printer, filenam
|
|
|
266
278
|
}
|
|
267
279
|
function outputDependentContext(depGraph, printer, filename) {
|
|
268
280
|
// 目前只支持单向依赖,未来可以利用mixin来实现多类的继承
|
|
269
|
-
|
|
270
|
-
let root = depGraph.
|
|
281
|
+
// assert(depGraph.roots.length <= 1);
|
|
282
|
+
let root = depGraph.ascOrder.length > 0 ? depGraph.ascOrder[depGraph.ascOrder.length - 1] : 'oak-frontend-base';
|
|
271
283
|
const statements = [
|
|
272
284
|
factory.createExportDeclaration(undefined, false, factory.createNamedExports([
|
|
273
285
|
factory.createExportSpecifier(false, undefined, factory.createIdentifier("BackendRuntimeContext")),
|
package/lib/entities/I18n.js
CHANGED
package/lib/entities/Path.js
CHANGED
package/lib/entities/User.js
CHANGED
|
@@ -26,7 +26,7 @@ exports.entityDesc = {
|
|
|
26
26
|
normal: '正常',
|
|
27
27
|
merged: '已被合并',
|
|
28
28
|
},
|
|
29
|
-
}
|
|
29
|
+
},
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
32
|
style: {
|
|
@@ -37,7 +37,7 @@ exports.entityDesc = {
|
|
|
37
37
|
userState: {
|
|
38
38
|
normal: '#112233',
|
|
39
39
|
merged: '#223344',
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
43
|
};
|
package/lib/types/RowStore.d.ts
CHANGED
|
@@ -14,6 +14,5 @@ export declare abstract class RowStore<ED extends EntityDict> {
|
|
|
14
14
|
abstract registerOperationRewriter(rewriter: OperationRewriter<ED, AsyncContext<ED> | SyncContext<ED>, SelectOption>): void;
|
|
15
15
|
abstract registerSelectionRewriter(rewriter: SelectionRewriter<ED, AsyncContext<ED> | SyncContext<ED>, OperateOption>): void;
|
|
16
16
|
getSchema(): StorageSchema<ED>;
|
|
17
|
-
mergeOperationResult(result: OperationResult<ED>, toBeMerged: OperationResult<ED>): void;
|
|
18
17
|
mergeMultipleResults(toBeMerged: OperationResult<ED>[]): OperationResult<ED>;
|
|
19
18
|
}
|
package/lib/types/RowStore.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RowStore = void 0;
|
|
4
|
-
const
|
|
4
|
+
const operationResult_1 = require("../utils/operationResult");
|
|
5
5
|
class RowStore {
|
|
6
6
|
storageSchema;
|
|
7
7
|
constructor(storageSchema) {
|
|
@@ -10,22 +10,9 @@ class RowStore {
|
|
|
10
10
|
getSchema() {
|
|
11
11
|
return this.storageSchema;
|
|
12
12
|
}
|
|
13
|
-
mergeOperationResult(result, toBeMerged) {
|
|
14
|
-
for (const entity in toBeMerged) {
|
|
15
|
-
for (const action in toBeMerged[entity]) {
|
|
16
|
-
const value = (0, lodash_1.get)(result, `${entity}.${action}`);
|
|
17
|
-
if (typeof value === 'number') {
|
|
18
|
-
(0, lodash_1.set)(result, `${entity}.${action}`, value + toBeMerged[entity][action]);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
(0, lodash_1.set)(result, `${entity}.${action}`, toBeMerged[entity][action]);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
13
|
mergeMultipleResults(toBeMerged) {
|
|
27
14
|
const result = {};
|
|
28
|
-
toBeMerged.forEach(ele =>
|
|
15
|
+
toBeMerged.forEach(ele => (0, operationResult_1.mergeOperationResult)(result, ele));
|
|
29
16
|
return result;
|
|
30
17
|
}
|
|
31
18
|
}
|
package/lib/utils/money.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const ToCent: (float: number) => number;
|
|
2
2
|
declare const ToYuan: (int: number) => number;
|
|
3
3
|
declare const StringToCent: (value: string, allowNegative?: true) => number | undefined;
|
|
4
|
-
declare const CentToString: (value: number) => string | undefined;
|
|
4
|
+
declare const CentToString: (value: number, fixed?: number) => string | undefined;
|
|
5
5
|
declare const ThousandCont: (value: number, decimalPlaces?: number) => string | undefined;
|
|
6
6
|
export { ToCent, ToYuan, StringToCent, CentToString, ThousandCont };
|
package/lib/utils/money.js
CHANGED
|
@@ -16,9 +16,9 @@ const StringToCent = (value, allowNegative) => {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
exports.StringToCent = StringToCent;
|
|
19
|
-
const CentToString = (value) => {
|
|
19
|
+
const CentToString = (value, fixed) => {
|
|
20
20
|
if (typeof value === 'number') {
|
|
21
|
-
return
|
|
21
|
+
return ToYuan(value).toFixed(fixed);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
exports.CentToString = CentToString;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeOperationResult = void 0;
|
|
4
|
+
const lodash_1 = require("../utils/lodash");
|
|
5
|
+
function mergeOperationResult(result, toBeMerged) {
|
|
6
|
+
for (const entity in toBeMerged) {
|
|
7
|
+
for (const action in toBeMerged[entity]) {
|
|
8
|
+
const value = (0, lodash_1.get)(result, `${entity}.${action}`);
|
|
9
|
+
if (typeof value === 'number') {
|
|
10
|
+
(0, lodash_1.set)(result, `${entity}.${action}`, value + toBeMerged[entity][action]);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
(0, lodash_1.set)(result, `${entity}.${action}`, toBeMerged[entity][action]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
exports.mergeOperationResult = mergeOperationResult;
|
package/package.json
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
import { EntityShape } from '../types/Entity';
|
|
2
|
-
import { Schema as Relation } from './Relation';
|
|
3
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
-
import { Schema as Path } from './Path';
|
|
5
|
-
|
|
6
|
-
type Actions = string[];
|
|
7
|
-
|
|
8
|
-
export interface Schema extends EntityShape {
|
|
9
|
-
relation?: Relation;
|
|
10
|
-
path: Path;
|
|
11
|
-
deActions: Actions;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
15
|
-
locales: {
|
|
16
|
-
zh_CN: {
|
|
17
|
-
name: '用户授权',
|
|
18
|
-
attr: {
|
|
19
|
-
relation: '关系',
|
|
20
|
-
path: '路径',
|
|
21
|
-
deActions: '目标对象动作',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
indexes: [
|
|
26
|
-
{
|
|
27
|
-
name: 'index_relation_path',
|
|
28
|
-
attributes: [
|
|
29
|
-
{
|
|
30
|
-
name: 'relation',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'path',
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
config: {
|
|
37
|
-
unique: true,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
|
|
1
|
+
import { EntityShape } from '../types/Entity';
|
|
2
|
+
import { Schema as Relation } from './Relation';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
import { Schema as Path } from './Path';
|
|
5
|
+
|
|
6
|
+
type Actions = string[];
|
|
7
|
+
|
|
8
|
+
export interface Schema extends EntityShape {
|
|
9
|
+
relation?: Relation;
|
|
10
|
+
path: Path;
|
|
11
|
+
deActions: Actions;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
15
|
+
locales: {
|
|
16
|
+
zh_CN: {
|
|
17
|
+
name: '用户授权',
|
|
18
|
+
attr: {
|
|
19
|
+
relation: '关系',
|
|
20
|
+
path: '路径',
|
|
21
|
+
deActions: '目标对象动作',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
indexes: [
|
|
26
|
+
{
|
|
27
|
+
name: 'index_relation_path',
|
|
28
|
+
attributes: [
|
|
29
|
+
{
|
|
30
|
+
name: 'relation',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'path',
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
config: {
|
|
37
|
+
unique: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
configuration: {
|
|
42
|
+
static: true,
|
|
43
|
+
}
|
|
44
|
+
};
|
package/src/entities/I18n.ts
CHANGED
package/src/entities/Path.ts
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import { String, Boolean, Text } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
-
|
|
5
|
-
export interface Schema extends EntityShape {
|
|
6
|
-
destEntity: String<32>;
|
|
7
|
-
value: String<256>;
|
|
8
|
-
recursive: Boolean;
|
|
9
|
-
sourceEntity: String<32>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
-
indexes: [
|
|
14
|
-
{
|
|
15
|
-
name: 'index_source_dest_path',
|
|
16
|
-
attributes: [
|
|
17
|
-
{
|
|
18
|
-
name: 'sourceEntity',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: 'value',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: 'destEntity',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
config: {
|
|
28
|
-
unique: true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
locales: {
|
|
33
|
-
zh_CN: {
|
|
34
|
-
name: '关系路径',
|
|
35
|
-
attr: {
|
|
36
|
-
sourceEntity: '源对象',
|
|
37
|
-
value: '路径(从dest到source)',
|
|
38
|
-
destEntity: '目标对象',
|
|
39
|
-
recursive: '是否递归(目标对象)',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
|
|
1
|
+
import { String, Boolean, Text } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
|
|
5
|
+
export interface Schema extends EntityShape {
|
|
6
|
+
destEntity: String<32>;
|
|
7
|
+
value: String<256>;
|
|
8
|
+
recursive: Boolean;
|
|
9
|
+
sourceEntity: String<32>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
+
indexes: [
|
|
14
|
+
{
|
|
15
|
+
name: 'index_source_dest_path',
|
|
16
|
+
attributes: [
|
|
17
|
+
{
|
|
18
|
+
name: 'sourceEntity',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'value',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'destEntity',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
config: {
|
|
28
|
+
unique: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
locales: {
|
|
33
|
+
zh_CN: {
|
|
34
|
+
name: '关系路径',
|
|
35
|
+
attr: {
|
|
36
|
+
sourceEntity: '源对象',
|
|
37
|
+
value: '路径(从dest到source)',
|
|
38
|
+
destEntity: '目标对象',
|
|
39
|
+
recursive: '是否递归(目标对象)',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
configuration: {
|
|
44
|
+
static: true,
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { Schema as Relation } from './Relation';
|
|
4
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
-
import { Schema as Path } from './Path';
|
|
6
|
-
|
|
7
|
-
// destRelation需要有sourceRelation才能授权/除权
|
|
8
|
-
export interface Schema extends EntityShape {
|
|
9
|
-
sourceRelation: Relation;
|
|
10
|
-
path: Path;
|
|
11
|
-
destRelation: Relation;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
15
|
-
indexes: [
|
|
16
|
-
{
|
|
17
|
-
name: 'index_entity_relation_path',
|
|
18
|
-
attributes: [
|
|
19
|
-
{
|
|
20
|
-
name: 'sourceRelation',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'path',
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: 'destRelation',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
config: {
|
|
30
|
-
unique: true,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
locales: {
|
|
35
|
-
zh_CN: {
|
|
36
|
-
name: '用户授权',
|
|
37
|
-
attr: {
|
|
38
|
-
sourceRelation: '源关系',
|
|
39
|
-
path: '路径',
|
|
40
|
-
destRelation: '目标关系',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
}
|
|
44
|
-
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { Schema as Relation } from './Relation';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
+
import { Schema as Path } from './Path';
|
|
6
|
+
|
|
7
|
+
// destRelation需要有sourceRelation才能授权/除权
|
|
8
|
+
export interface Schema extends EntityShape {
|
|
9
|
+
sourceRelation: Relation;
|
|
10
|
+
path: Path;
|
|
11
|
+
destRelation: Relation;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
15
|
+
indexes: [
|
|
16
|
+
{
|
|
17
|
+
name: 'index_entity_relation_path',
|
|
18
|
+
attributes: [
|
|
19
|
+
{
|
|
20
|
+
name: 'sourceRelation',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'path',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'destRelation',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
config: {
|
|
30
|
+
unique: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
locales: {
|
|
35
|
+
zh_CN: {
|
|
36
|
+
name: '用户授权',
|
|
37
|
+
attr: {
|
|
38
|
+
sourceRelation: '源关系',
|
|
39
|
+
path: '路径',
|
|
40
|
+
destRelation: '目标关系',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
configuration: {
|
|
45
|
+
static: true,
|
|
46
|
+
}
|
|
47
|
+
};
|
package/src/entities/User.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { String,
|
|
1
|
+
import { String, Text } from '../types/DataType';
|
|
2
2
|
import { EntityShape } from '../types/Entity';
|
|
3
3
|
import { ActionDef } from '../types/Action';
|
|
4
4
|
import { EntityDesc } from '../types/EntityDesc';
|
|
@@ -22,9 +22,14 @@ export const UserActionDef: ActionDef<UserAction, UserState> = {
|
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export const entityDesc: EntityDesc<
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export const entityDesc: EntityDesc<
|
|
26
|
+
Schema,
|
|
27
|
+
Action,
|
|
28
|
+
'',
|
|
29
|
+
{
|
|
30
|
+
userState: UserState;
|
|
31
|
+
}
|
|
32
|
+
> = {
|
|
28
33
|
locales: {
|
|
29
34
|
zh_CN: {
|
|
30
35
|
name: '用户',
|
|
@@ -43,7 +48,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|
|
43
48
|
normal: '正常',
|
|
44
49
|
merged: '已被合并',
|
|
45
50
|
},
|
|
46
|
-
}
|
|
51
|
+
},
|
|
47
52
|
},
|
|
48
53
|
},
|
|
49
54
|
style: {
|
|
@@ -54,7 +59,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|
|
54
59
|
userState: {
|
|
55
60
|
normal: '#112233',
|
|
56
61
|
merged: '#223344',
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
60
65
|
};
|