oak-domain 1.0.0 → 1.1.0

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.
Files changed (102) hide show
  1. package/lib/OakError.js +2 -16
  2. package/lib/actions/action.d.ts +9 -1
  3. package/lib/actions/action.js +6 -2
  4. package/lib/base-app-domain/ActionDefDict.d.ts +5 -0
  5. package/lib/base-app-domain/ActionDefDict.js +7 -0
  6. package/lib/base-app-domain/EntityDict.d.ts +12 -0
  7. package/lib/base-app-domain/EntityDict.js +2 -0
  8. package/lib/base-app-domain/Modi/Action.d.ts +10 -0
  9. package/lib/base-app-domain/Modi/Action.js +14 -0
  10. package/lib/base-app-domain/Modi/Schema.d.ts +161 -0
  11. package/lib/base-app-domain/Modi/Schema.js +2 -0
  12. package/lib/base-app-domain/Modi/Storage.d.ts +3 -0
  13. package/lib/base-app-domain/Modi/Storage.js +60 -0
  14. package/lib/base-app-domain/ModiEntity/Schema.d.ts +179 -0
  15. package/lib/base-app-domain/ModiEntity/Schema.js +2 -0
  16. package/lib/base-app-domain/ModiEntity/Storage.d.ts +3 -0
  17. package/lib/base-app-domain/ModiEntity/Storage.js +26 -0
  18. package/lib/base-app-domain/Oper/Schema.d.ts +158 -0
  19. package/lib/base-app-domain/Oper/Schema.js +2 -0
  20. package/lib/base-app-domain/Oper/Storage.d.ts +3 -0
  21. package/lib/base-app-domain/Oper/Storage.js +29 -0
  22. package/lib/base-app-domain/OperEntity/Schema.d.ts +196 -0
  23. package/lib/base-app-domain/OperEntity/Schema.js +2 -0
  24. package/lib/base-app-domain/OperEntity/Storage.d.ts +3 -0
  25. package/lib/base-app-domain/OperEntity/Storage.js +26 -0
  26. package/lib/base-app-domain/Storage.d.ts +3 -0
  27. package/lib/base-app-domain/Storage.js +15 -0
  28. package/lib/base-app-domain/User/Schema.d.ts +140 -0
  29. package/lib/base-app-domain/User/Schema.js +2 -0
  30. package/lib/base-app-domain/User/Storage.d.ts +3 -0
  31. package/lib/base-app-domain/User/Storage.js +25 -0
  32. package/lib/base-app-domain/_SubQuery.d.ts +36 -0
  33. package/lib/base-app-domain/_SubQuery.js +2 -0
  34. package/lib/base-app-domain/index.d.ts +3 -0
  35. package/lib/base-app-domain/index.js +6 -0
  36. package/lib/checkers/index.d.ts +3 -0
  37. package/lib/checkers/index.js +8 -0
  38. package/lib/compiler/env.d.ts +4 -3
  39. package/lib/compiler/env.js +22 -9
  40. package/lib/compiler/schemalBuilder.js +689 -355
  41. package/lib/entities/Action.d.ts +12 -0
  42. package/lib/entities/Action.js +17 -0
  43. package/lib/entities/Modi.d.ts +11 -0
  44. package/lib/entities/Modi.js +46 -0
  45. package/lib/entities/ModiEntity.d.ts +8 -0
  46. package/lib/entities/ModiEntity.js +15 -0
  47. package/lib/entities/Ooperation.d.ts +12 -0
  48. package/lib/entities/Ooperation.js +17 -0
  49. package/lib/entities/Oper.d.ts +10 -0
  50. package/lib/entities/Oper.js +17 -0
  51. package/lib/entities/OperEntity.d.ts +8 -0
  52. package/lib/entities/OperEntity.js +15 -0
  53. package/lib/entities/Update.d.ts +9 -0
  54. package/lib/entities/Update.js +44 -0
  55. package/lib/entities/User.d.ts +7 -0
  56. package/lib/entities/User.js +12 -0
  57. package/lib/entities/Uupdate.d.ts +9 -0
  58. package/lib/entities/Uupdate.js +44 -0
  59. package/lib/store/CascadeStore.d.ts +31 -6
  60. package/lib/store/CascadeStore.js +957 -230
  61. package/lib/store/TriggerExecutor.d.ts +4 -3
  62. package/lib/store/TriggerExecutor.js +30 -102
  63. package/lib/store/UniversalContext.d.ts +1 -0
  64. package/lib/store/UniversalContext.js +10 -59
  65. package/lib/store/action.d.ts +6 -0
  66. package/lib/store/action.js +14 -0
  67. package/lib/store/actionDef.js +14 -47
  68. package/lib/store/filter.d.ts +6 -0
  69. package/lib/store/filter.js +60 -29
  70. package/lib/store/modi.d.ts +11 -0
  71. package/lib/store/modi.js +143 -0
  72. package/lib/store/projection.d.ts +7 -0
  73. package/lib/store/projection.js +211 -0
  74. package/lib/store/relation.js +6 -6
  75. package/lib/store/selection.d.ts +7 -0
  76. package/lib/store/selection.js +227 -0
  77. package/lib/triggers/index.d.ts +2 -0
  78. package/lib/triggers/index.js +5 -0
  79. package/lib/triggers/modi.d.ts +5 -0
  80. package/lib/triggers/modi.js +72 -0
  81. package/lib/types/Context.d.ts +1 -0
  82. package/lib/types/DataType.d.ts +1 -1
  83. package/lib/types/Entity.d.ts +29 -16
  84. package/lib/types/Exception.d.ts +28 -0
  85. package/lib/types/Exception.js +75 -23
  86. package/lib/types/Expression.d.ts +9 -0
  87. package/lib/types/Expression.js +47 -38
  88. package/lib/types/RowStore.d.ts +3 -3
  89. package/lib/types/Storage.d.ts +6 -0
  90. package/lib/types/Trigger.d.ts +5 -5
  91. package/lib/types/index.js +19 -28
  92. package/lib/utils/SimpleConnector.js +5 -58
  93. package/lib/utils/assert.js +2 -4
  94. package/lib/utils/concurrent.js +5 -54
  95. package/lib/utils/lodash.d.ts +4 -1
  96. package/lib/utils/lodash.js +19 -15
  97. package/package.json +10 -5
  98. package/src/entities/Modi.ts +68 -0
  99. package/src/entities/ModiEntity.ts +24 -0
  100. package/src/entities/Oper.ts +28 -0
  101. package/src/entities/OperEntity.ts +24 -0
  102. package/src/entities/User.ts +20 -0
@@ -0,0 +1,158 @@
1
+ import { String, Datetime, PrimaryKey, ForeignKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
3
+ import { OneOf } from "../../types/Polyfill";
4
+ import * as SubQuery from "../_SubQuery";
5
+ import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction } from "../../types/Entity";
6
+ import { AppendOnlyAction } from "../../actions/action";
7
+ import * as User from "../User/Schema";
8
+ import * as OperEntity from "../OperEntity/Schema";
9
+ export declare type OpSchema = {
10
+ id: PrimaryKey;
11
+ $$createAt$$: Datetime;
12
+ $$updateAt$$: Datetime;
13
+ $$deleteAt$$?: Datetime | null;
14
+ action: String<16>;
15
+ data: Object;
16
+ filter?: Object | null;
17
+ extra?: Object | null;
18
+ operatorId?: ForeignKey<"user"> | null;
19
+ };
20
+ export declare type OpAttr = keyof OpSchema;
21
+ export declare type Schema = {
22
+ id: PrimaryKey;
23
+ $$createAt$$: Datetime;
24
+ $$updateAt$$: Datetime;
25
+ $$deleteAt$$?: Datetime | null;
26
+ action: String<16>;
27
+ data: Object;
28
+ filter?: Object | null;
29
+ extra?: Object | null;
30
+ operatorId?: ForeignKey<"user"> | null;
31
+ operator?: User.Schema | null;
32
+ operEntity$oper?: Array<OperEntity.Schema>;
33
+ } & {
34
+ [A in ExpressionKey]?: any;
35
+ };
36
+ declare type AttrFilter = {
37
+ id: Q_StringValue | SubQuery.OperIdSubQuery;
38
+ $$createAt$$: Q_DateValue;
39
+ $$updateAt$$: Q_DateValue;
40
+ action: Q_StringValue;
41
+ operatorId: Q_StringValue | SubQuery.UserIdSubQuery;
42
+ operator: User.Filter;
43
+ };
44
+ export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
45
+ export declare type Projection = {
46
+ "#id"?: NodeId;
47
+ [k: string]: any;
48
+ id: 1;
49
+ $$createAt$$?: 1;
50
+ $$updateAt$$?: 1;
51
+ action?: 1;
52
+ data?: 1;
53
+ filter?: 1;
54
+ extra?: 1;
55
+ operatorId?: 1;
56
+ operator?: User.Projection;
57
+ operEntity$oper?: OperEntity.Selection & {
58
+ $entity: "operEntity";
59
+ };
60
+ } & Partial<ExprOp<OpAttr | string>>;
61
+ export declare type ExportProjection = {
62
+ "#id"?: NodeId;
63
+ [k: string]: any;
64
+ id?: string;
65
+ $$createAt$$?: string;
66
+ $$updateAt$$?: string;
67
+ action?: string;
68
+ data?: string;
69
+ filter?: string;
70
+ extra?: string;
71
+ operatorId?: string;
72
+ operator?: User.ExportProjection;
73
+ operEntity$oper?: OperEntity.Exportation & {
74
+ $entity: "operEntity";
75
+ };
76
+ } & Partial<ExprOp<OpAttr | string>>;
77
+ declare type OperIdProjection = OneOf<{
78
+ id: 1;
79
+ }>;
80
+ declare type UserIdProjection = OneOf<{
81
+ operatorId: 1;
82
+ }>;
83
+ export declare type SortAttr = {
84
+ id: 1;
85
+ } | {
86
+ $$createAt$$: 1;
87
+ } | {
88
+ $$updateAt$$: 1;
89
+ } | {
90
+ action: 1;
91
+ } | {
92
+ operatorId: 1;
93
+ } | {
94
+ operator: User.SortAttr;
95
+ } | {
96
+ [k: string]: any;
97
+ } | OneOf<ExprOp<OpAttr | string>>;
98
+ export declare type SortNode = {
99
+ $attr: SortAttr;
100
+ $direction?: "asc" | "desc";
101
+ };
102
+ export declare type Sorter = SortNode[];
103
+ export declare type SelectOperation<P = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
104
+ export declare type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
105
+ export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
106
+ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "operatorId">> & (({
107
+ operatorId?: never;
108
+ operator?: User.CreateSingleOperation;
109
+ } | {
110
+ operatorId: String<64>;
111
+ operator?: User.UpdateOperation;
112
+ } | {
113
+ operatorId?: String<64>;
114
+ })) & {
115
+ operEntity$oper?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">>>;
116
+ };
117
+ export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
118
+ export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
119
+ export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
120
+ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "operatorId">> & (({
121
+ operator: User.CreateSingleOperation;
122
+ operatorId?: never;
123
+ } | {
124
+ operator: User.UpdateOperation;
125
+ operatorId?: never;
126
+ } | {
127
+ operator: User.RemoveOperation;
128
+ operatorId?: never;
129
+ } | {
130
+ operator?: never;
131
+ operatorId?: String<64> | null;
132
+ })) & {
133
+ [k: string]: any;
134
+ operEntitys$oper?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">>>;
135
+ };
136
+ export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
137
+ export declare type RemoveOperationData = {} & (({
138
+ operator?: User.UpdateOperation | User.RemoveOperation;
139
+ }));
140
+ export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
141
+ export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
142
+ export declare type UserIdSubQuery = Selection<UserIdProjection>;
143
+ export declare type OperIdSubQuery = Selection<OperIdProjection>;
144
+ export declare type NativeAttr = OpAttr | `operator.${User.NativeAttr}`;
145
+ export declare type FullAttr = NativeAttr | `operEntitys$${number}.${OperEntity.NativeAttr}`;
146
+ export declare type EntityDef = {
147
+ Schema: Schema;
148
+ OpSchema: OpSchema;
149
+ Action: OakMakeAction<AppendOnlyAction> | string;
150
+ Selection: Selection;
151
+ Operation: Operation;
152
+ Create: CreateOperation;
153
+ Update: UpdateOperation;
154
+ Remove: RemoveOperation;
155
+ CreateSingle: CreateSingleOperation;
156
+ CreateMulti: CreateMultipleOperation;
157
+ };
158
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { StorageDesc } from "../../types/Storage";
2
+ import { OpSchema } from "./Schema";
3
+ export declare const desc: StorageDesc<OpSchema>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.desc = void 0;
4
+ var action_1 = require("../../actions/action");
5
+ exports.desc = {
6
+ attributes: {
7
+ action: {
8
+ type: "varchar",
9
+ params: {
10
+ length: 16
11
+ }
12
+ },
13
+ data: {
14
+ type: "object"
15
+ },
16
+ filter: {
17
+ type: "object"
18
+ },
19
+ extra: {
20
+ type: "object"
21
+ },
22
+ operatorId: {
23
+ type: "ref",
24
+ ref: "user"
25
+ }
26
+ },
27
+ actionType: "appendOnly",
28
+ actions: action_1.appendOnlyActions
29
+ };
@@ -0,0 +1,196 @@
1
+ import { String, Datetime, PrimaryKey, ForeignKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
3
+ import { OneOf } from "../../types/Polyfill";
4
+ import * as SubQuery from "../_SubQuery";
5
+ import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction } from "../../types/Entity";
6
+ import { AppendOnlyAction } from "../../actions/action";
7
+ import * as Oper from "../Oper/Schema";
8
+ import * as Modi from "../Modi/Schema";
9
+ import * as User from "../User/Schema";
10
+ export declare type OpSchema = {
11
+ id: PrimaryKey;
12
+ $$createAt$$: Datetime;
13
+ $$updateAt$$: Datetime;
14
+ $$deleteAt$$?: Datetime | null;
15
+ operId: ForeignKey<"oper">;
16
+ entity: "modi" | "user" | string;
17
+ entityId: String<64>;
18
+ };
19
+ export declare type OpAttr = keyof OpSchema;
20
+ export declare type Schema = {
21
+ id: PrimaryKey;
22
+ $$createAt$$: Datetime;
23
+ $$updateAt$$: Datetime;
24
+ $$deleteAt$$?: Datetime | null;
25
+ operId: ForeignKey<"oper">;
26
+ entity: "modi" | "user" | string;
27
+ entityId: String<64>;
28
+ oper: Oper.Schema;
29
+ modi?: Modi.Schema;
30
+ user?: User.Schema;
31
+ } & {
32
+ [A in ExpressionKey]?: any;
33
+ };
34
+ declare type AttrFilter<E> = {
35
+ id: Q_StringValue | SubQuery.OperEntityIdSubQuery;
36
+ $$createAt$$: Q_DateValue;
37
+ $$updateAt$$: Q_DateValue;
38
+ operId: Q_StringValue | SubQuery.OperIdSubQuery;
39
+ oper: Oper.Filter;
40
+ entity: E;
41
+ entityId: Q_StringValue;
42
+ modi: Modi.Filter;
43
+ user: User.Filter;
44
+ };
45
+ export declare type Filter<E = Q_EnumValue<"modi" | "user" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
46
+ export declare type Projection = {
47
+ "#id"?: NodeId;
48
+ [k: string]: any;
49
+ id: 1;
50
+ $$createAt$$?: 1;
51
+ $$updateAt$$?: 1;
52
+ operId?: 1;
53
+ oper?: Oper.Projection;
54
+ entity?: 1;
55
+ entityId?: 1;
56
+ modi?: Modi.Projection;
57
+ user?: User.Projection;
58
+ } & Partial<ExprOp<OpAttr | string>>;
59
+ export declare type ExportProjection = {
60
+ "#id"?: NodeId;
61
+ [k: string]: any;
62
+ id?: string;
63
+ $$createAt$$?: string;
64
+ $$updateAt$$?: string;
65
+ operId?: string;
66
+ oper?: Oper.ExportProjection;
67
+ entity?: string;
68
+ entityId?: string;
69
+ modi?: Modi.ExportProjection;
70
+ user?: User.ExportProjection;
71
+ } & Partial<ExprOp<OpAttr | string>>;
72
+ declare type OperEntityIdProjection = OneOf<{
73
+ id: 1;
74
+ }>;
75
+ declare type OperIdProjection = OneOf<{
76
+ operId: 1;
77
+ }>;
78
+ declare type ModiIdProjection = OneOf<{
79
+ entityId: 1;
80
+ }>;
81
+ declare type UserIdProjection = OneOf<{
82
+ entityId: 1;
83
+ }>;
84
+ export declare type SortAttr = {
85
+ id: 1;
86
+ } | {
87
+ $$createAt$$: 1;
88
+ } | {
89
+ $$updateAt$$: 1;
90
+ } | {
91
+ operId: 1;
92
+ } | {
93
+ oper: Oper.SortAttr;
94
+ } | {
95
+ entity: 1;
96
+ } | {
97
+ entityId: 1;
98
+ } | {
99
+ modi: Modi.SortAttr;
100
+ } | {
101
+ user: User.SortAttr;
102
+ } | {
103
+ [k: string]: any;
104
+ } | OneOf<ExprOp<OpAttr | string>>;
105
+ export declare type SortNode = {
106
+ $attr: SortAttr;
107
+ $direction?: "asc" | "desc";
108
+ };
109
+ export declare type Sorter = SortNode[];
110
+ export declare type SelectOperation<P = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
111
+ export declare type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
112
+ export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
113
+ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "operId">> & (({
114
+ operId?: never;
115
+ oper: Oper.CreateSingleOperation;
116
+ } | {
117
+ operId: String<64>;
118
+ })) & ({
119
+ entity?: never;
120
+ entityId?: never;
121
+ modi: Modi.CreateSingleOperation;
122
+ } | {
123
+ entity: "modi";
124
+ entityId: String<64>;
125
+ modi: Modi.UpdateOperation;
126
+ } | {
127
+ entity: "modi";
128
+ entityId: String<64>;
129
+ } | {
130
+ entity?: never;
131
+ entityId?: never;
132
+ user: User.CreateSingleOperation;
133
+ } | {
134
+ entity: "user";
135
+ entityId: String<64>;
136
+ user: User.UpdateOperation;
137
+ } | {
138
+ entity: "user";
139
+ entityId: String<64>;
140
+ } | {
141
+ entity?: string;
142
+ entityId?: string;
143
+ [K: string]: any;
144
+ });
145
+ export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
146
+ export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
147
+ export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
148
+ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId" | "operId">> & (({
149
+ oper: Oper.CreateSingleOperation;
150
+ operId?: never;
151
+ } | {
152
+ oper?: never;
153
+ operId?: String<64> | null;
154
+ })) & ({
155
+ modi?: Modi.CreateSingleOperation | Modi.UpdateOperation | Modi.RemoveOperation;
156
+ entityId?: never;
157
+ entity?: never;
158
+ } | {
159
+ user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
160
+ entityId?: never;
161
+ entity?: never;
162
+ } | {
163
+ entity?: ("modi" | "user" | string) | null;
164
+ entityId?: String<64> | null;
165
+ }) & {
166
+ [k: string]: any;
167
+ };
168
+ export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
169
+ export declare type RemoveOperationData = {} & ({
170
+ modi?: Modi.UpdateOperation | Modi.RemoveOperation;
171
+ } | {
172
+ user?: User.UpdateOperation | User.RemoveOperation;
173
+ } | {
174
+ [k: string]: any;
175
+ });
176
+ export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
177
+ export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
178
+ export declare type OperIdSubQuery = Selection<OperIdProjection>;
179
+ export declare type ModiIdSubQuery = Selection<ModiIdProjection>;
180
+ export declare type UserIdSubQuery = Selection<UserIdProjection>;
181
+ export declare type OperEntityIdSubQuery = Selection<OperEntityIdProjection>;
182
+ export declare type NativeAttr = OpAttr | `oper.${Oper.NativeAttr}` | `entity.${Modi.NativeAttr}` | `entity.${User.NativeAttr}`;
183
+ export declare type FullAttr = NativeAttr;
184
+ export declare type EntityDef = {
185
+ Schema: Schema;
186
+ OpSchema: OpSchema;
187
+ Action: OakMakeAction<AppendOnlyAction> | string;
188
+ Selection: Selection;
189
+ Operation: Operation;
190
+ Create: CreateOperation;
191
+ Update: UpdateOperation;
192
+ Remove: RemoveOperation;
193
+ CreateSingle: CreateSingleOperation;
194
+ CreateMulti: CreateMultipleOperation;
195
+ };
196
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { StorageDesc } from "../../types/Storage";
2
+ import { OpSchema } from "./Schema";
3
+ export declare const desc: StorageDesc<OpSchema>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.desc = void 0;
4
+ var action_1 = require("../../actions/action");
5
+ exports.desc = {
6
+ attributes: {
7
+ operId: {
8
+ type: "ref",
9
+ ref: "oper"
10
+ },
11
+ entity: {
12
+ type: "varchar",
13
+ params: {
14
+ length: 32
15
+ }
16
+ },
17
+ entityId: {
18
+ type: "varchar",
19
+ params: {
20
+ length: 64
21
+ }
22
+ }
23
+ },
24
+ actionType: "appendOnly",
25
+ actions: action_1.appendOnlyActions
26
+ };
@@ -0,0 +1,3 @@
1
+ import { StorageSchema } from "../types/Storage";
2
+ import { EntityDict } from "./EntityDict";
3
+ export declare const storageSchema: StorageSchema<EntityDict>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.storageSchema = void 0;
4
+ var Storage_1 = require("./Modi/Storage");
5
+ var Storage_2 = require("./ModiEntity/Storage");
6
+ var Storage_3 = require("./Oper/Storage");
7
+ var Storage_4 = require("./OperEntity/Storage");
8
+ var Storage_5 = require("./User/Storage");
9
+ exports.storageSchema = {
10
+ modi: Storage_1.desc,
11
+ modiEntity: Storage_2.desc,
12
+ oper: Storage_3.desc,
13
+ operEntity: Storage_4.desc,
14
+ user: Storage_5.desc
15
+ };
@@ -0,0 +1,140 @@
1
+ import { String, Text, Datetime, PrimaryKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
3
+ import { OneOf } from "../../types/Polyfill";
4
+ import * as SubQuery from "../_SubQuery";
5
+ import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction } from "../../types/Entity";
6
+ import { GenericAction } from "../../actions/action";
7
+ import * as Oper from "../Oper/Schema";
8
+ import * as OperEntity from "../OperEntity/Schema";
9
+ import * as ModiEntity from "../ModiEntity/Schema";
10
+ export declare type OpSchema = {
11
+ id: PrimaryKey;
12
+ $$createAt$$: Datetime;
13
+ $$updateAt$$: Datetime;
14
+ $$deleteAt$$?: Datetime | null;
15
+ name?: String<16> | null;
16
+ nickname?: String<64> | null;
17
+ password?: Text | null;
18
+ };
19
+ export declare type OpAttr = keyof OpSchema;
20
+ export declare type Schema = {
21
+ id: PrimaryKey;
22
+ $$createAt$$: Datetime;
23
+ $$updateAt$$: Datetime;
24
+ $$deleteAt$$?: Datetime | null;
25
+ name?: String<16> | null;
26
+ nickname?: String<64> | null;
27
+ password?: Text | null;
28
+ oper$operator?: Array<Oper.Schema>;
29
+ operEntity$entity?: Array<OperEntity.Schema>;
30
+ modiEntity$entity?: Array<ModiEntity.Schema>;
31
+ } & {
32
+ [A in ExpressionKey]?: any;
33
+ };
34
+ declare type AttrFilter = {
35
+ id: Q_StringValue | SubQuery.UserIdSubQuery;
36
+ $$createAt$$: Q_DateValue;
37
+ $$updateAt$$: Q_DateValue;
38
+ name: Q_StringValue;
39
+ nickname: Q_StringValue;
40
+ password: Q_StringValue;
41
+ };
42
+ export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
43
+ export declare type Projection = {
44
+ "#id"?: NodeId;
45
+ [k: string]: any;
46
+ id: 1;
47
+ $$createAt$$?: 1;
48
+ $$updateAt$$?: 1;
49
+ name?: 1;
50
+ nickname?: 1;
51
+ password?: 1;
52
+ oper$operator?: Oper.Selection & {
53
+ $entity: "oper";
54
+ };
55
+ operEntity$entity?: OperEntity.Selection & {
56
+ $entity: "operEntity";
57
+ };
58
+ modiEntity$entity?: ModiEntity.Selection & {
59
+ $entity: "modiEntity";
60
+ };
61
+ } & Partial<ExprOp<OpAttr | string>>;
62
+ export declare type ExportProjection = {
63
+ "#id"?: NodeId;
64
+ [k: string]: any;
65
+ id?: string;
66
+ $$createAt$$?: string;
67
+ $$updateAt$$?: string;
68
+ name?: string;
69
+ nickname?: string;
70
+ password?: string;
71
+ oper$operator?: Oper.Exportation & {
72
+ $entity: "oper";
73
+ };
74
+ operEntity$entity?: OperEntity.Exportation & {
75
+ $entity: "operEntity";
76
+ };
77
+ modiEntity$entity?: ModiEntity.Exportation & {
78
+ $entity: "modiEntity";
79
+ };
80
+ } & Partial<ExprOp<OpAttr | string>>;
81
+ declare type UserIdProjection = OneOf<{
82
+ id: 1;
83
+ }>;
84
+ export declare type SortAttr = {
85
+ id: 1;
86
+ } | {
87
+ $$createAt$$: 1;
88
+ } | {
89
+ $$updateAt$$: 1;
90
+ } | {
91
+ name: 1;
92
+ } | {
93
+ nickname: 1;
94
+ } | {
95
+ password: 1;
96
+ } | {
97
+ [k: string]: any;
98
+ } | OneOf<ExprOp<OpAttr | string>>;
99
+ export declare type SortNode = {
100
+ $attr: SortAttr;
101
+ $direction?: "asc" | "desc";
102
+ };
103
+ export declare type Sorter = SortNode[];
104
+ export declare type SelectOperation<P = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
105
+ export declare type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
106
+ export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
107
+ export declare type CreateOperationData = FormCreateData<OpSchema> & {
108
+ oper$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
109
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
110
+ modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
111
+ };
112
+ export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
113
+ export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
114
+ export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
115
+ export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
116
+ [k: string]: any;
117
+ opers$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
118
+ operEntitys$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
119
+ modiEntitys$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
120
+ };
121
+ export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
122
+ export declare type RemoveOperationData = {};
123
+ export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
124
+ export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
125
+ export declare type UserIdSubQuery = Selection<UserIdProjection>;
126
+ export declare type NativeAttr = OpAttr;
127
+ export declare type FullAttr = NativeAttr | `opers$${number}.${Oper.NativeAttr}` | `operEntitys$${number}.${OperEntity.NativeAttr}` | `modiEntitys$${number}.${ModiEntity.NativeAttr}`;
128
+ export declare type EntityDef = {
129
+ Schema: Schema;
130
+ OpSchema: OpSchema;
131
+ Action: OakMakeAction<GenericAction> | string;
132
+ Selection: Selection;
133
+ Operation: Operation;
134
+ Create: CreateOperation;
135
+ Update: UpdateOperation;
136
+ Remove: RemoveOperation;
137
+ CreateSingle: CreateSingleOperation;
138
+ CreateMulti: CreateMultipleOperation;
139
+ };
140
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { StorageDesc } from "../../types/Storage";
2
+ import { OpSchema } from "./Schema";
3
+ export declare const desc: StorageDesc<OpSchema>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.desc = void 0;
4
+ var action_1 = require("../../actions/action");
5
+ exports.desc = {
6
+ attributes: {
7
+ name: {
8
+ type: "varchar",
9
+ params: {
10
+ length: 16
11
+ }
12
+ },
13
+ nickname: {
14
+ type: "varchar",
15
+ params: {
16
+ length: 64
17
+ }
18
+ },
19
+ password: {
20
+ type: "text"
21
+ }
22
+ },
23
+ actionType: "crud",
24
+ actions: action_1.genericActions
25
+ };
@@ -0,0 +1,36 @@
1
+ import * as Modi from "./Modi/Schema";
2
+ import * as ModiEntity from "./ModiEntity/Schema";
3
+ import * as Oper from "./Oper/Schema";
4
+ import * as OperEntity from "./OperEntity/Schema";
5
+ import * as User from "./User/Schema";
6
+ export declare type ModiIdSubQuery = {
7
+ [K in "$in" | "$nin"]?: (ModiEntity.ModiIdSubQuery & {
8
+ entity: "modiEntity";
9
+ }) | (Modi.ModiIdSubQuery & {
10
+ entity: "modi";
11
+ }) | any;
12
+ };
13
+ export declare type ModiEntityIdSubQuery = {
14
+ [K in "$in" | "$nin"]?: (ModiEntity.ModiEntityIdSubQuery & {
15
+ entity: "modiEntity";
16
+ }) | any;
17
+ };
18
+ export declare type OperIdSubQuery = {
19
+ [K in "$in" | "$nin"]?: (OperEntity.OperIdSubQuery & {
20
+ entity: "operEntity";
21
+ }) | (Oper.OperIdSubQuery & {
22
+ entity: "oper";
23
+ }) | any;
24
+ };
25
+ export declare type OperEntityIdSubQuery = {
26
+ [K in "$in" | "$nin"]?: (OperEntity.OperEntityIdSubQuery & {
27
+ entity: "operEntity";
28
+ }) | any;
29
+ };
30
+ export declare type UserIdSubQuery = {
31
+ [K in "$in" | "$nin"]?: (Oper.UserIdSubQuery & {
32
+ entity: "oper";
33
+ }) | (User.UserIdSubQuery & {
34
+ entity: "user";
35
+ }) | any;
36
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export * from './EntityDict';
2
+ export * from './Storage';
3
+ export * from './ActionDefDict';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./EntityDict"), exports);
5
+ tslib_1.__exportStar(require("./Storage"), exports);
6
+ tslib_1.__exportStar(require("./ActionDefDict"), exports);