oak-domain 2.4.3 → 2.5.1

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 (35) hide show
  1. package/lib/base-app-domain/ActionDefDict.d.ts +4 -1
  2. package/lib/base-app-domain/ActionDefDict.js +3 -1
  3. package/lib/base-app-domain/EntityDict.d.ts +2 -0
  4. package/lib/base-app-domain/Modi/Action.d.ts +4 -4
  5. package/lib/base-app-domain/ModiEntity/Schema.d.ts +31 -4
  6. package/lib/base-app-domain/ModiEntity/Storage.js +2 -1
  7. package/lib/base-app-domain/OperEntity/Schema.d.ts +31 -4
  8. package/lib/base-app-domain/OperEntity/Storage.js +2 -1
  9. package/lib/base-app-domain/Storage.js +3 -1
  10. package/lib/base-app-domain/User/Action.d.ts +10 -0
  11. package/lib/base-app-domain/User/Action.js +12 -0
  12. package/lib/base-app-domain/User/Schema.d.ts +60 -8
  13. package/lib/base-app-domain/User/Storage.js +12 -1
  14. package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +121 -0
  15. package/lib/base-app-domain/UserEntityGrant/Schema.js +2 -0
  16. package/lib/base-app-domain/UserEntityGrant/Storage.d.ts +3 -0
  17. package/lib/base-app-domain/UserEntityGrant/Storage.js +28 -0
  18. package/lib/base-app-domain/_SubQuery.d.ts +8 -0
  19. package/lib/checkers/index.js +1 -0
  20. package/lib/compiler/schemalBuilder.js +58 -6
  21. package/lib/entities/User.d.ts +1 -0
  22. package/lib/entities/User.js +16 -0
  23. package/lib/entities/UserEntityGrant.d.ts +7 -0
  24. package/lib/entities/UserEntityGrant.js +12 -0
  25. package/lib/store/TriggerExecutor.js +7 -2
  26. package/lib/store/checker.d.ts +13 -0
  27. package/lib/store/checker.js +228 -1
  28. package/lib/store/modi.js +33 -15
  29. package/lib/types/Auth.d.ts +3 -3
  30. package/lib/types/Storage.d.ts +1 -1
  31. package/lib/types/Trigger.d.ts +9 -0
  32. package/lib/types/Trigger.js +10 -0
  33. package/package.json +1 -1
  34. package/src/entities/User.ts +26 -1
  35. package/src/entities/UserEntityGrant.ts +24 -0
@@ -1,5 +1,8 @@
1
1
  export declare const ActionDefDict: {
2
2
  modi: {
3
- iState: import("../types").ActionDef<import("./Modi/Action").IAction, import("./Modi/Action").IState>;
3
+ iState: import("../types").ActionDef<string, string>;
4
+ };
5
+ user: {
6
+ userState: import("../types").ActionDef<string, string>;
4
7
  };
5
8
  };
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionDefDict = void 0;
4
4
  var Action_1 = require("./Modi/Action");
5
+ var Action_2 = require("./User/Action");
5
6
  exports.ActionDefDict = {
6
- modi: Action_1.ActionDefDict
7
+ modi: Action_1.ActionDefDict,
8
+ user: Action_2.ActionDefDict
7
9
  };
@@ -3,10 +3,12 @@ import { EntityDef as ModiEntity } from "./ModiEntity/Schema";
3
3
  import { EntityDef as Oper } from "./Oper/Schema";
4
4
  import { EntityDef as OperEntity } from "./OperEntity/Schema";
5
5
  import { EntityDef as User } from "./User/Schema";
6
+ import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema";
6
7
  export declare type EntityDict = {
7
8
  modi: Modi;
8
9
  modiEntity: ModiEntity;
9
10
  oper: Oper;
10
11
  operEntity: OperEntity;
11
12
  user: User;
13
+ userEntityGrant: UserEntityGrant;
12
14
  };
@@ -1,10 +1,10 @@
1
1
  import { ActionDef } from "../../types/Action";
2
2
  import { GenericAction } from "../../actions/action";
3
- export declare type IState = 'active' | 'applied' | 'abandoned';
4
- export declare type IAction = 'apply' | 'abandon';
3
+ export declare type IState = 'active' | 'applied' | 'abandoned' | string;
4
+ export declare type IAction = 'apply' | 'abandon' | string;
5
5
  export declare type ParticularAction = IAction;
6
- export declare type Action = GenericAction | ParticularAction;
6
+ export declare type Action = GenericAction | ParticularAction | string;
7
7
  export declare const actions: string[];
8
8
  export declare const ActionDefDict: {
9
- iState: ActionDef<IAction, IState>;
9
+ iState: ActionDef<string, string>;
10
10
  };
@@ -6,18 +6,20 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper
6
6
  import { AppendOnlyAction } from "../../actions/action";
7
7
  import * as Modi from "../Modi/Schema";
8
8
  import * as User from "../User/Schema";
9
+ import * as UserEntityGrant from "../UserEntityGrant/Schema";
9
10
  export declare type OpSchema = EntityShape & {
10
11
  modiId: ForeignKey<"modi">;
11
- entity: "user" | string;
12
+ entity: "user" | "userEntityGrant" | string;
12
13
  entityId: String<64>;
13
14
  };
14
15
  export declare type OpAttr = keyof OpSchema;
15
16
  export declare type Schema = EntityShape & {
16
17
  modiId: ForeignKey<"modi">;
17
- entity: "user" | string;
18
+ entity: "user" | "userEntityGrant" | string;
18
19
  entityId: String<64>;
19
20
  modi: Modi.Schema;
20
21
  user?: User.Schema;
22
+ userEntityGrant?: UserEntityGrant.Schema;
21
23
  } & {
22
24
  [A in ExpressionKey]?: any;
23
25
  };
@@ -31,8 +33,9 @@ declare type AttrFilter<E> = {
31
33
  entity: E;
32
34
  entityId: Q_StringValue;
33
35
  user: User.Filter;
36
+ userEntityGrant: UserEntityGrant.Filter;
34
37
  };
35
- export declare type Filter<E = Q_EnumValue<"user" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
38
+ export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
36
39
  export declare type Projection = {
37
40
  "#id"?: NodeId;
38
41
  [k: string]: any;
@@ -45,6 +48,7 @@ export declare type Projection = {
45
48
  entity?: number;
46
49
  entityId?: number;
47
50
  user?: User.Projection;
51
+ userEntityGrant?: UserEntityGrant.Projection;
48
52
  } & Partial<ExprOp<OpAttr | string>>;
49
53
  declare type ModiEntityIdProjection = OneOf<{
50
54
  id: number;
@@ -55,6 +59,9 @@ declare type ModiIdProjection = OneOf<{
55
59
  declare type UserIdProjection = OneOf<{
56
60
  entityId: number;
57
61
  }>;
62
+ declare type UserEntityGrantIdProjection = OneOf<{
63
+ entityId: number;
64
+ }>;
58
65
  export declare type SortAttr = {
59
66
  id: number;
60
67
  } | {
@@ -73,6 +80,8 @@ export declare type SortAttr = {
73
80
  entityId: number;
74
81
  } | {
75
82
  user: User.SortAttr;
83
+ } | {
84
+ userEntityGrant: UserEntityGrant.SortAttr;
76
85
  } | {
77
86
  [k: string]: any;
78
87
  } | OneOf<ExprOp<OpAttr | string>>;
@@ -103,6 +112,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
103
112
  } | {
104
113
  entity: "user";
105
114
  entityId: String<64>;
115
+ } | {
116
+ entity?: never;
117
+ entityId?: never;
118
+ userEntityGrant: UserEntityGrant.CreateSingleOperation;
119
+ } | {
120
+ entity: "userEntityGrant";
121
+ entityId: String<64>;
122
+ userEntityGrant: UserEntityGrant.UpdateOperation;
123
+ } | {
124
+ entity: "userEntityGrant";
125
+ entityId: String<64>;
106
126
  } | {
107
127
  entity?: string;
108
128
  entityId?: string;
@@ -128,7 +148,11 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
128
148
  entityId?: never;
129
149
  entity?: never;
130
150
  } | {
131
- entity?: ("user" | string) | null;
151
+ userEntityGrant?: UserEntityGrant.CreateSingleOperation | UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
152
+ entityId?: never;
153
+ entity?: never;
154
+ } | {
155
+ entity?: ("user" | "userEntityGrant" | string) | null;
132
156
  entityId?: String<64> | null;
133
157
  }) & {
134
158
  [k: string]: any;
@@ -138,6 +162,8 @@ export declare type RemoveOperationData = {} & (({
138
162
  modi?: Modi.UpdateOperation | Modi.RemoveOperation;
139
163
  })) & ({
140
164
  user?: User.UpdateOperation | User.RemoveOperation;
165
+ } | {
166
+ userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
141
167
  } | {
142
168
  [k: string]: any;
143
169
  });
@@ -145,6 +171,7 @@ export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData
145
171
  export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
146
172
  export declare type ModiIdSubQuery = Selection<ModiIdProjection>;
147
173
  export declare type UserIdSubQuery = Selection<UserIdProjection>;
174
+ export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
148
175
  export declare type ModiEntityIdSubQuery = Selection<ModiEntityIdProjection>;
149
176
  export declare type EntityDef = {
150
177
  Schema: Schema;
@@ -12,7 +12,8 @@ exports.desc = {
12
12
  type: "varchar",
13
13
  params: {
14
14
  length: 32
15
- }
15
+ },
16
+ ref: ["user", "userEntityGrant"]
16
17
  },
17
18
  entityId: {
18
19
  type: "varchar",
@@ -7,19 +7,21 @@ import { AppendOnlyAction } from "../../actions/action";
7
7
  import * as Oper from "../Oper/Schema";
8
8
  import * as Modi from "../Modi/Schema";
9
9
  import * as User from "../User/Schema";
10
+ import * as UserEntityGrant from "../UserEntityGrant/Schema";
10
11
  export declare type OpSchema = EntityShape & {
11
12
  operId: ForeignKey<"oper">;
12
- entity: "modi" | "user" | string;
13
+ entity: "modi" | "user" | "userEntityGrant" | string;
13
14
  entityId: String<64>;
14
15
  };
15
16
  export declare type OpAttr = keyof OpSchema;
16
17
  export declare type Schema = EntityShape & {
17
18
  operId: ForeignKey<"oper">;
18
- entity: "modi" | "user" | string;
19
+ entity: "modi" | "user" | "userEntityGrant" | string;
19
20
  entityId: String<64>;
20
21
  oper: Oper.Schema;
21
22
  modi?: Modi.Schema;
22
23
  user?: User.Schema;
24
+ userEntityGrant?: UserEntityGrant.Schema;
23
25
  } & {
24
26
  [A in ExpressionKey]?: any;
25
27
  };
@@ -34,8 +36,9 @@ declare type AttrFilter<E> = {
34
36
  entityId: Q_StringValue;
35
37
  modi: Modi.Filter;
36
38
  user: User.Filter;
39
+ userEntityGrant: UserEntityGrant.Filter;
37
40
  };
38
- export declare type Filter<E = Q_EnumValue<"modi" | "user" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
41
+ export declare type Filter<E = Q_EnumValue<"modi" | "user" | "userEntityGrant" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
39
42
  export declare type Projection = {
40
43
  "#id"?: NodeId;
41
44
  [k: string]: any;
@@ -49,6 +52,7 @@ export declare type Projection = {
49
52
  entityId?: number;
50
53
  modi?: Modi.Projection;
51
54
  user?: User.Projection;
55
+ userEntityGrant?: UserEntityGrant.Projection;
52
56
  } & Partial<ExprOp<OpAttr | string>>;
53
57
  declare type OperEntityIdProjection = OneOf<{
54
58
  id: number;
@@ -62,6 +66,9 @@ declare type ModiIdProjection = OneOf<{
62
66
  declare type UserIdProjection = OneOf<{
63
67
  entityId: number;
64
68
  }>;
69
+ declare type UserEntityGrantIdProjection = OneOf<{
70
+ entityId: number;
71
+ }>;
65
72
  export declare type SortAttr = {
66
73
  id: number;
67
74
  } | {
@@ -82,6 +89,8 @@ export declare type SortAttr = {
82
89
  modi: Modi.SortAttr;
83
90
  } | {
84
91
  user: User.SortAttr;
92
+ } | {
93
+ userEntityGrant: UserEntityGrant.SortAttr;
85
94
  } | {
86
95
  [k: string]: any;
87
96
  } | OneOf<ExprOp<OpAttr | string>>;
@@ -120,6 +129,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
120
129
  } | {
121
130
  entity: "user";
122
131
  entityId: String<64>;
132
+ } | {
133
+ entity?: never;
134
+ entityId?: never;
135
+ userEntityGrant: UserEntityGrant.CreateSingleOperation;
136
+ } | {
137
+ entity: "userEntityGrant";
138
+ entityId: String<64>;
139
+ userEntityGrant: UserEntityGrant.UpdateOperation;
140
+ } | {
141
+ entity: "userEntityGrant";
142
+ entityId: String<64>;
123
143
  } | {
124
144
  entity?: string;
125
145
  entityId?: string;
@@ -143,7 +163,11 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
143
163
  entityId?: never;
144
164
  entity?: never;
145
165
  } | {
146
- entity?: ("modi" | "user" | string) | null;
166
+ userEntityGrant?: UserEntityGrant.CreateSingleOperation | UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
167
+ entityId?: never;
168
+ entity?: never;
169
+ } | {
170
+ entity?: ("modi" | "user" | "userEntityGrant" | string) | null;
147
171
  entityId?: String<64> | null;
148
172
  }) & {
149
173
  [k: string]: any;
@@ -153,6 +177,8 @@ export declare type RemoveOperationData = {} & ({
153
177
  modi?: Modi.UpdateOperation | Modi.RemoveOperation;
154
178
  } | {
155
179
  user?: User.UpdateOperation | User.RemoveOperation;
180
+ } | {
181
+ userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
156
182
  } | {
157
183
  [k: string]: any;
158
184
  });
@@ -161,6 +187,7 @@ export declare type Operation = CreateOperation | UpdateOperation | RemoveOperat
161
187
  export declare type OperIdSubQuery = Selection<OperIdProjection>;
162
188
  export declare type ModiIdSubQuery = Selection<ModiIdProjection>;
163
189
  export declare type UserIdSubQuery = Selection<UserIdProjection>;
190
+ export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
164
191
  export declare type OperEntityIdSubQuery = Selection<OperEntityIdProjection>;
165
192
  export declare type EntityDef = {
166
193
  Schema: Schema;
@@ -12,7 +12,8 @@ exports.desc = {
12
12
  type: "varchar",
13
13
  params: {
14
14
  length: 32
15
- }
15
+ },
16
+ ref: ["modi", "user", "userEntityGrant"]
16
17
  },
17
18
  entityId: {
18
19
  type: "varchar",
@@ -6,10 +6,12 @@ var Storage_2 = require("./ModiEntity/Storage");
6
6
  var Storage_3 = require("./Oper/Storage");
7
7
  var Storage_4 = require("./OperEntity/Storage");
8
8
  var Storage_5 = require("./User/Storage");
9
+ var Storage_6 = require("./UserEntityGrant/Storage");
9
10
  exports.storageSchema = {
10
11
  modi: Storage_1.desc,
11
12
  modiEntity: Storage_2.desc,
12
13
  oper: Storage_3.desc,
13
14
  operEntity: Storage_4.desc,
14
- user: Storage_5.desc
15
+ user: Storage_5.desc,
16
+ userEntityGrant: Storage_6.desc
15
17
  };
@@ -0,0 +1,10 @@
1
+ import { ActionDef } from "../../types/Action";
2
+ import { GenericAction, RelationAction } from "../../actions/action";
3
+ export declare type UserAction = 'mergeTo' | string;
4
+ export declare type UserState = 'normal' | 'merged' | string;
5
+ export declare type ParticularAction = UserAction;
6
+ export declare type Action = GenericAction | ParticularAction | RelationAction | string;
7
+ export declare const actions: string[];
8
+ export declare const ActionDefDict: {
9
+ userState: ActionDef<string, string>;
10
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionDefDict = exports.actions = void 0;
4
+ exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "grant", "revoke", "mergeTo"];
5
+ var UserActionDef = {
6
+ stm: {
7
+ mergeTo: ['normal', 'merged']
8
+ }
9
+ };
10
+ exports.ActionDefDict = {
11
+ userState: UserActionDef
12
+ };
@@ -1,9 +1,10 @@
1
- import { String, Text } from "../../types/DataType";
2
- import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
1
+ import { String, Text, ForeignKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
3
3
  import { OneOf } from "../../types/Polyfill";
4
4
  import * as SubQuery from "../_SubQuery";
5
5
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
- import { GenericAction, RelationAction } from "../../actions/action";
6
+ import { Action, ParticularAction, UserState } from "./Action";
7
+ import { RelationAction } from "../../actions/action";
7
8
  import * as Oper from "../Oper/Schema";
8
9
  import * as OperEntity from "../OperEntity/Schema";
9
10
  import * as ModiEntity from "../ModiEntity/Schema";
@@ -11,14 +12,21 @@ export declare type OpSchema = EntityShape & {
11
12
  name?: String<16> | null;
12
13
  nickname?: String<64> | null;
13
14
  password?: Text | null;
15
+ refId?: ForeignKey<"user"> | null;
16
+ userState?: UserState | null;
14
17
  };
15
18
  export declare type OpAttr = keyof OpSchema;
16
19
  export declare type Schema = EntityShape & {
17
20
  name?: String<16> | null;
18
21
  nickname?: String<64> | null;
19
22
  password?: Text | null;
23
+ refId?: ForeignKey<"user"> | null;
24
+ userState?: UserState | null;
25
+ ref?: Schema | null;
20
26
  oper$operator?: Array<Oper.Schema>;
21
27
  oper$operator$$aggr?: AggregationResult<Oper.Schema>;
28
+ user$ref?: Array<Schema>;
29
+ user$ref$$aggr?: AggregationResult<Schema>;
22
30
  operEntity$entity?: Array<OperEntity.Schema>;
23
31
  operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
24
32
  modiEntity$entity?: Array<ModiEntity.Schema>;
@@ -34,6 +42,9 @@ declare type AttrFilter = {
34
42
  name: Q_StringValue;
35
43
  nickname: Q_StringValue;
36
44
  password: Q_StringValue;
45
+ refId: Q_StringValue | SubQuery.UserIdSubQuery;
46
+ ref: Filter;
47
+ userState: Q_EnumValue<UserState>;
37
48
  };
38
49
  export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
39
50
  export declare type Projection = {
@@ -46,12 +57,21 @@ export declare type Projection = {
46
57
  name?: number;
47
58
  nickname?: number;
48
59
  password?: number;
60
+ refId?: number;
61
+ ref?: Projection;
62
+ userState?: number;
49
63
  oper$operator?: Oper.Selection & {
50
64
  $entity: "oper";
51
65
  };
52
66
  oper$operator$$aggr?: Oper.Aggregation & {
53
67
  $entity: "oper";
54
68
  };
69
+ user$ref?: Selection & {
70
+ $entity: "user";
71
+ };
72
+ user$ref$$aggr?: Aggregation & {
73
+ $entity: "user";
74
+ };
55
75
  operEntity$entity?: OperEntity.Selection & {
56
76
  $entity: "operEntity";
57
77
  };
@@ -67,6 +87,7 @@ export declare type Projection = {
67
87
  } & Partial<ExprOp<OpAttr | string>>;
68
88
  declare type UserIdProjection = OneOf<{
69
89
  id: number;
90
+ refId: number;
70
91
  }>;
71
92
  export declare type SortAttr = {
72
93
  id: number;
@@ -82,6 +103,12 @@ export declare type SortAttr = {
82
103
  nickname: number;
83
104
  } | {
84
105
  password: number;
106
+ } | {
107
+ refId: number;
108
+ } | {
109
+ ref: SortAttr;
110
+ } | {
111
+ userState: number;
85
112
  } | {
86
113
  [k: string]: any;
87
114
  } | OneOf<ExprOp<OpAttr | string>>;
@@ -93,29 +120,53 @@ export declare type Sorter = SortNode[];
93
120
  export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
94
121
  export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
95
122
  export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
96
- export declare type CreateOperationData = FormCreateData<OpSchema> & {
123
+ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "refId">> & (({
124
+ refId?: never;
125
+ ref?: CreateSingleOperation;
126
+ } | {
127
+ refId: String<64>;
128
+ ref?: UpdateOperation;
129
+ } | {
130
+ refId?: String<64>;
131
+ })) & {
97
132
  oper$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
133
+ user$ref?: OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "ref" | "refId">, Filter> | OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">> | OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "ref" | "refId">, Filter>>;
98
134
  operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
99
135
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
100
136
  };
101
137
  export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
102
138
  export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
103
139
  export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
104
- export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
140
+ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "refId">> & (({
141
+ ref: CreateSingleOperation;
142
+ refId?: never;
143
+ } | {
144
+ ref: UpdateOperation;
145
+ refId?: never;
146
+ } | {
147
+ ref: RemoveOperation;
148
+ refId?: never;
149
+ } | {
150
+ ref?: never;
151
+ refId?: String<64> | null;
152
+ })) & {
105
153
  [k: string]: any;
106
154
  oper$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
155
+ user$ref?: UpdateOperation | RemoveOperation | OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">> | UpdateOperation | RemoveOperation>;
107
156
  operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
108
157
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
109
158
  };
110
- export declare type UpdateOperation = OakOperation<"update" | RelationAction | string, UpdateOperationData, Filter, Sorter>;
111
- export declare type RemoveOperationData = {};
159
+ export declare type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>;
160
+ export declare type RemoveOperationData = {} & (({
161
+ ref?: UpdateOperation | RemoveOperation;
162
+ }));
112
163
  export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
113
164
  export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
114
165
  export declare type UserIdSubQuery = Selection<UserIdProjection>;
115
166
  export declare type EntityDef = {
116
167
  Schema: Schema;
117
168
  OpSchema: OpSchema;
118
- Action: OakMakeAction<GenericAction | RelationAction> | string;
169
+ Action: OakMakeAction<Action | RelationAction> | string;
119
170
  Selection: Selection;
120
171
  Aggregation: Aggregation;
121
172
  Operation: Operation;
@@ -124,5 +175,6 @@ export declare type EntityDef = {
124
175
  Remove: RemoveOperation;
125
176
  CreateSingle: CreateSingleOperation;
126
177
  CreateMulti: CreateMultipleOperation;
178
+ ParticularAction: ParticularAction;
127
179
  };
128
180
  export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.desc = void 0;
4
+ var Action_1 = require("./Action");
4
5
  var action_1 = require("../../actions/action");
5
6
  exports.desc = {
6
7
  attributes: {
@@ -18,8 +19,18 @@ exports.desc = {
18
19
  },
19
20
  password: {
20
21
  type: "text"
22
+ },
23
+ refId: {
24
+ type: "ref",
25
+ ref: "user"
26
+ },
27
+ userState: {
28
+ type: "varchar",
29
+ params: {
30
+ length: 24
31
+ }
21
32
  }
22
33
  },
23
34
  actionType: "crud",
24
- actions: action_1.genericActions.concat(action_1.relationActions)
35
+ actions: Action_1.actions.concat(action_1.relationActions)
25
36
  };
@@ -0,0 +1,121 @@
1
+ import { String } 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, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
+ import { GenericAction } from "../../actions/action";
7
+ import * as OperEntity from "../OperEntity/Schema";
8
+ import * as ModiEntity from "../ModiEntity/Schema";
9
+ export declare type OpSchema = EntityShape & {
10
+ entity: String<32>;
11
+ entityId: String<64>;
12
+ relation: String<32>;
13
+ };
14
+ export declare type OpAttr = keyof OpSchema;
15
+ export declare type Schema = EntityShape & {
16
+ entity: String<32>;
17
+ entityId: String<64>;
18
+ relation: String<32>;
19
+ operEntity$entity?: Array<OperEntity.Schema>;
20
+ operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
21
+ modiEntity$entity?: Array<ModiEntity.Schema>;
22
+ modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
23
+ } & {
24
+ [A in ExpressionKey]?: any;
25
+ };
26
+ declare type AttrFilter = {
27
+ id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery;
28
+ $$createAt$$: Q_DateValue;
29
+ $$seq$$: Q_StringValue;
30
+ $$updateAt$$: Q_DateValue;
31
+ entity: Q_StringValue;
32
+ entityId: Q_StringValue;
33
+ relation: Q_StringValue;
34
+ };
35
+ export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
36
+ export declare type Projection = {
37
+ "#id"?: NodeId;
38
+ [k: string]: any;
39
+ id?: number;
40
+ $$createAt$$?: number;
41
+ $$updateAt$$?: number;
42
+ $$seq$$?: number;
43
+ entity?: number;
44
+ entityId?: number;
45
+ relation?: number;
46
+ operEntity$entity?: OperEntity.Selection & {
47
+ $entity: "operEntity";
48
+ };
49
+ operEntity$entity$$aggr?: OperEntity.Aggregation & {
50
+ $entity: "operEntity";
51
+ };
52
+ modiEntity$entity?: ModiEntity.Selection & {
53
+ $entity: "modiEntity";
54
+ };
55
+ modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
56
+ $entity: "modiEntity";
57
+ };
58
+ } & Partial<ExprOp<OpAttr | string>>;
59
+ declare type UserEntityGrantIdProjection = OneOf<{
60
+ id: number;
61
+ }>;
62
+ export declare type SortAttr = {
63
+ id: number;
64
+ } | {
65
+ $$createAt$$: number;
66
+ } | {
67
+ $$seq$$: number;
68
+ } | {
69
+ $$updateAt$$: number;
70
+ } | {
71
+ entity: number;
72
+ } | {
73
+ entityId: number;
74
+ } | {
75
+ relation: number;
76
+ } | {
77
+ [k: string]: any;
78
+ } | OneOf<ExprOp<OpAttr | string>>;
79
+ export declare type SortNode = {
80
+ $attr: SortAttr;
81
+ $direction?: "asc" | "desc";
82
+ };
83
+ export declare type Sorter = SortNode[];
84
+ export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
85
+ export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
86
+ export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
87
+ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
88
+ entity?: string;
89
+ entityId?: string;
90
+ [K: string]: any;
91
+ }) & {
92
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
93
+ modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
94
+ };
95
+ export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
96
+ export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
97
+ export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
98
+ export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
99
+ [k: string]: any;
100
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
101
+ modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
102
+ };
103
+ export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
104
+ export declare type RemoveOperationData = {};
105
+ export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
106
+ export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
107
+ export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
108
+ export declare type EntityDef = {
109
+ Schema: Schema;
110
+ OpSchema: OpSchema;
111
+ Action: OakMakeAction<GenericAction> | string;
112
+ Selection: Selection;
113
+ Aggregation: Aggregation;
114
+ Operation: Operation;
115
+ Create: CreateOperation;
116
+ Update: UpdateOperation;
117
+ Remove: RemoveOperation;
118
+ CreateSingle: CreateSingleOperation;
119
+ CreateMulti: CreateMultipleOperation;
120
+ };
121
+ 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,28 @@
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
+ entity: {
8
+ type: "varchar",
9
+ params: {
10
+ length: 32
11
+ }
12
+ },
13
+ entityId: {
14
+ type: "varchar",
15
+ params: {
16
+ length: 64
17
+ }
18
+ },
19
+ relation: {
20
+ type: "varchar",
21
+ params: {
22
+ length: 32
23
+ }
24
+ }
25
+ },
26
+ actionType: "crud",
27
+ actions: action_1.genericActions
28
+ };