oak-domain 2.2.0 → 2.3.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.
@@ -2,7 +2,7 @@ import { String } from "../../types/DataType";
2
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
- import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
5
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
6
  import { Action, ParticularAction, IState } from "./Action";
7
7
  import * as ModiEntity from "../ModiEntity/Schema";
8
8
  import * as OperEntity from "../OperEntity/Schema";
@@ -27,7 +27,9 @@ export declare type Schema = EntityShape & {
27
27
  extra?: Object | null;
28
28
  iState?: IState | null;
29
29
  modiEntity$modi?: Array<ModiEntity.Schema>;
30
+ modiEntity$modi$$aggr?: AggregationResult<ModiEntity.Schema>;
30
31
  operEntity$entity?: Array<OperEntity.Schema>;
32
+ operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
31
33
  } & {
32
34
  [A in ExpressionKey]?: any;
33
35
  };
@@ -49,7 +51,7 @@ export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
49
51
  export declare type Projection = {
50
52
  "#id"?: NodeId;
51
53
  [k: string]: any;
52
- id: number;
54
+ id?: number;
53
55
  $$createAt$$?: number;
54
56
  $$updateAt$$?: number;
55
57
  $$seq$$?: number;
@@ -64,29 +66,13 @@ export declare type Projection = {
64
66
  modiEntity$modi?: ModiEntity.Selection & {
65
67
  $entity: "modiEntity";
66
68
  };
69
+ modiEntity$modi$$aggr?: ModiEntity.Aggregation & {
70
+ $entity: "modiEntity";
71
+ };
67
72
  operEntity$entity?: OperEntity.Selection & {
68
73
  $entity: "operEntity";
69
74
  };
70
- } & Partial<ExprOp<OpAttr | string>>;
71
- export declare type ExportProjection = {
72
- "#id"?: NodeId;
73
- [k: string]: any;
74
- id?: string;
75
- $$createAt$$?: string;
76
- $$updateAt$$?: string;
77
- $$seq$$?: string;
78
- targetEntity?: string;
79
- entity?: string;
80
- entityId?: string;
81
- action?: string;
82
- data?: string;
83
- filter?: string;
84
- extra?: string;
85
- iState?: string;
86
- modiEntity$modi?: ModiEntity.Exportation & {
87
- $entity: "modiEntity";
88
- };
89
- operEntity$entity?: OperEntity.Exportation & {
75
+ operEntity$entity$$aggr?: OperEntity.Aggregation & {
90
76
  $entity: "operEntity";
91
77
  };
92
78
  } & Partial<ExprOp<OpAttr | string>>;
@@ -121,7 +107,7 @@ export declare type SortNode = {
121
107
  export declare type Sorter = SortNode[];
122
108
  export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
123
109
  export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
124
- export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
110
+ export declare type Aggregation = Omit<DeduceAggregation<Schema, Projection, Filter, Sorter>, "id">;
125
111
  export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
126
112
  entity?: string;
127
113
  entityId?: string;
@@ -150,6 +136,7 @@ export declare type EntityDef = {
150
136
  OpSchema: OpSchema;
151
137
  Action: OakMakeAction<Action> | string;
152
138
  Selection: Selection;
139
+ Aggregation: Aggregation;
153
140
  Operation: Operation;
154
141
  Create: CreateOperation;
155
142
  Update: UpdateOperation;
@@ -2,7 +2,7 @@ import { String, ForeignKey } from "../../types/DataType";
2
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
- import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
5
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
6
6
  import { AppendOnlyAction } from "../../actions/action";
7
7
  import * as Modi from "../Modi/Schema";
8
8
  import * as User from "../User/Schema";
@@ -36,7 +36,7 @@ export declare type Filter<E = Q_EnumValue<"user" | string>> = MakeFilter<AttrFi
36
36
  export declare type Projection = {
37
37
  "#id"?: NodeId;
38
38
  [k: string]: any;
39
- id: number;
39
+ id?: number;
40
40
  $$createAt$$?: number;
41
41
  $$updateAt$$?: number;
42
42
  $$seq$$?: number;
@@ -46,19 +46,6 @@ export declare type Projection = {
46
46
  entityId?: number;
47
47
  user?: User.Projection;
48
48
  } & Partial<ExprOp<OpAttr | string>>;
49
- export declare type ExportProjection = {
50
- "#id"?: NodeId;
51
- [k: string]: any;
52
- id?: string;
53
- $$createAt$$?: string;
54
- $$updateAt$$?: string;
55
- $$seq$$?: string;
56
- modiId?: string;
57
- modi?: Modi.ExportProjection;
58
- entity?: string;
59
- entityId?: string;
60
- user?: User.ExportProjection;
61
- } & Partial<ExprOp<OpAttr | string>>;
62
49
  declare type ModiEntityIdProjection = OneOf<{
63
50
  id: number;
64
51
  }>;
@@ -96,7 +83,7 @@ export declare type SortNode = {
96
83
  export declare type Sorter = SortNode[];
97
84
  export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
98
85
  export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
99
- export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
86
+ export declare type Aggregation = Omit<DeduceAggregation<Schema, Projection, Filter, Sorter>, "id">;
100
87
  export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "modiId">> & (({
101
88
  modiId?: never;
102
89
  modi: Modi.CreateSingleOperation;
@@ -166,6 +153,7 @@ export declare type EntityDef = {
166
153
  OpSchema: OpSchema;
167
154
  Action: OakMakeAction<AppendOnlyAction> | string;
168
155
  Selection: Selection;
156
+ Aggregation: Aggregation;
169
157
  Operation: Operation;
170
158
  Create: CreateOperation;
171
159
  Update: UpdateOperation;
@@ -2,7 +2,7 @@ import { String, ForeignKey } from "../../types/DataType";
2
2
  import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
3
3
  import { OneOf } from "../../types/Polyfill";
4
4
  import * as SubQuery from "../_SubQuery";
5
- import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
5
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
6
  import { AppendOnlyAction } from "../../actions/action";
7
7
  import * as User from "../User/Schema";
8
8
  import * as OperEntity from "../OperEntity/Schema";
@@ -22,6 +22,7 @@ export declare type Schema = EntityShape & {
22
22
  operatorId?: ForeignKey<"user"> | null;
23
23
  operator?: User.Schema | null;
24
24
  operEntity$oper?: Array<OperEntity.Schema>;
25
+ operEntity$oper$$aggr?: AggregationResult<OperEntity.Schema>;
25
26
  } & {
26
27
  [A in ExpressionKey]?: any;
27
28
  };
@@ -41,7 +42,7 @@ export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
41
42
  export declare type Projection = {
42
43
  "#id"?: NodeId;
43
44
  [k: string]: any;
44
- id: number;
45
+ id?: number;
45
46
  $$createAt$$?: number;
46
47
  $$updateAt$$?: number;
47
48
  $$seq$$?: number;
@@ -54,21 +55,7 @@ export declare type Projection = {
54
55
  operEntity$oper?: OperEntity.Selection & {
55
56
  $entity: "operEntity";
56
57
  };
57
- } & Partial<ExprOp<OpAttr | string>>;
58
- export declare type ExportProjection = {
59
- "#id"?: NodeId;
60
- [k: string]: any;
61
- id?: string;
62
- $$createAt$$?: string;
63
- $$updateAt$$?: string;
64
- $$seq$$?: string;
65
- action?: string;
66
- data?: string;
67
- filter?: string;
68
- extra?: string;
69
- operatorId?: string;
70
- operator?: User.ExportProjection;
71
- operEntity$oper?: OperEntity.Exportation & {
58
+ operEntity$oper$$aggr?: OperEntity.Aggregation & {
72
59
  $entity: "operEntity";
73
60
  };
74
61
  } & Partial<ExprOp<OpAttr | string>>;
@@ -102,7 +89,7 @@ export declare type SortNode = {
102
89
  export declare type Sorter = SortNode[];
103
90
  export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
104
91
  export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
105
- export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
92
+ export declare type Aggregation = Omit<DeduceAggregation<Schema, Projection, Filter, Sorter>, "id">;
106
93
  export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "operatorId">> & (({
107
94
  operatorId?: never;
108
95
  operator?: User.CreateSingleOperation;
@@ -148,6 +135,7 @@ export declare type EntityDef = {
148
135
  OpSchema: OpSchema;
149
136
  Action: OakMakeAction<AppendOnlyAction> | string;
150
137
  Selection: Selection;
138
+ Aggregation: Aggregation;
151
139
  Operation: Operation;
152
140
  Create: CreateOperation;
153
141
  Update: UpdateOperation;
@@ -2,7 +2,7 @@ import { String, ForeignKey } from "../../types/DataType";
2
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
- import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
5
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
6
6
  import { AppendOnlyAction } from "../../actions/action";
7
7
  import * as Oper from "../Oper/Schema";
8
8
  import * as Modi from "../Modi/Schema";
@@ -39,7 +39,7 @@ export declare type Filter<E = Q_EnumValue<"modi" | "user" | string>> = MakeFilt
39
39
  export declare type Projection = {
40
40
  "#id"?: NodeId;
41
41
  [k: string]: any;
42
- id: number;
42
+ id?: number;
43
43
  $$createAt$$?: number;
44
44
  $$updateAt$$?: number;
45
45
  $$seq$$?: number;
@@ -50,20 +50,6 @@ export declare type Projection = {
50
50
  modi?: Modi.Projection;
51
51
  user?: User.Projection;
52
52
  } & Partial<ExprOp<OpAttr | string>>;
53
- export declare type ExportProjection = {
54
- "#id"?: NodeId;
55
- [k: string]: any;
56
- id?: string;
57
- $$createAt$$?: string;
58
- $$updateAt$$?: string;
59
- $$seq$$?: string;
60
- operId?: string;
61
- oper?: Oper.ExportProjection;
62
- entity?: string;
63
- entityId?: string;
64
- modi?: Modi.ExportProjection;
65
- user?: User.ExportProjection;
66
- } & Partial<ExprOp<OpAttr | string>>;
67
53
  declare type OperEntityIdProjection = OneOf<{
68
54
  id: number;
69
55
  }>;
@@ -106,7 +92,7 @@ export declare type SortNode = {
106
92
  export declare type Sorter = SortNode[];
107
93
  export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
108
94
  export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
109
- export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
95
+ export declare type Aggregation = Omit<DeduceAggregation<Schema, Projection, Filter, Sorter>, "id">;
110
96
  export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "operId">> & (({
111
97
  operId?: never;
112
98
  oper: Oper.CreateSingleOperation;
@@ -183,6 +169,7 @@ export declare type EntityDef = {
183
169
  OpSchema: OpSchema;
184
170
  Action: OakMakeAction<AppendOnlyAction> | string;
185
171
  Selection: Selection;
172
+ Aggregation: Aggregation;
186
173
  Operation: Operation;
187
174
  Create: CreateOperation;
188
175
  Update: UpdateOperation;
@@ -2,7 +2,7 @@ import { String, Text } from "../../types/DataType";
2
2
  import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
3
3
  import { OneOf } from "../../types/Polyfill";
4
4
  import * as SubQuery from "../_SubQuery";
5
- import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
5
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
6
  import { GenericAction, RelationAction } from "../../actions/action";
7
7
  import * as Oper from "../Oper/Schema";
8
8
  import * as OperEntity from "../OperEntity/Schema";
@@ -18,8 +18,11 @@ export declare type Schema = EntityShape & {
18
18
  nickname?: String<64> | null;
19
19
  password?: Text | null;
20
20
  oper$operator?: Array<Oper.Schema>;
21
+ oper$operator$$aggr?: AggregationResult<Oper.Schema>;
21
22
  operEntity$entity?: Array<OperEntity.Schema>;
23
+ operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
22
24
  modiEntity$entity?: Array<ModiEntity.Schema>;
25
+ modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
23
26
  } & {
24
27
  [A in ExpressionKey]?: any;
25
28
  };
@@ -36,7 +39,7 @@ export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
36
39
  export declare type Projection = {
37
40
  "#id"?: NodeId;
38
41
  [k: string]: any;
39
- id: number;
42
+ id?: number;
40
43
  $$createAt$$?: number;
41
44
  $$updateAt$$?: number;
42
45
  $$seq$$?: number;
@@ -46,30 +49,19 @@ export declare type Projection = {
46
49
  oper$operator?: Oper.Selection & {
47
50
  $entity: "oper";
48
51
  };
52
+ oper$operator$$aggr?: Oper.Aggregation & {
53
+ $entity: "oper";
54
+ };
49
55
  operEntity$entity?: OperEntity.Selection & {
50
56
  $entity: "operEntity";
51
57
  };
58
+ operEntity$entity$$aggr?: OperEntity.Aggregation & {
59
+ $entity: "operEntity";
60
+ };
52
61
  modiEntity$entity?: ModiEntity.Selection & {
53
62
  $entity: "modiEntity";
54
63
  };
55
- } & Partial<ExprOp<OpAttr | string>>;
56
- export declare type ExportProjection = {
57
- "#id"?: NodeId;
58
- [k: string]: any;
59
- id?: string;
60
- $$createAt$$?: string;
61
- $$updateAt$$?: string;
62
- $$seq$$?: string;
63
- name?: string;
64
- nickname?: string;
65
- password?: string;
66
- oper$operator?: Oper.Exportation & {
67
- $entity: "oper";
68
- };
69
- operEntity$entity?: OperEntity.Exportation & {
70
- $entity: "operEntity";
71
- };
72
- modiEntity$entity?: ModiEntity.Exportation & {
64
+ modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
73
65
  $entity: "modiEntity";
74
66
  };
75
67
  } & Partial<ExprOp<OpAttr | string>>;
@@ -100,7 +92,7 @@ export declare type SortNode = {
100
92
  export declare type Sorter = SortNode[];
101
93
  export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
102
94
  export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
103
- export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
95
+ export declare type Aggregation = Omit<DeduceAggregation<Schema, Projection, Filter, Sorter>, "id">;
104
96
  export declare type CreateOperationData = FormCreateData<OpSchema> & {
105
97
  oper$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
106
98
  operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
@@ -127,6 +119,7 @@ export declare type EntityDef = {
127
119
  OpSchema: OpSchema;
128
120
  Action: OakMakeAction<GenericAction | RelationAction> | string;
129
121
  Selection: Selection;
122
+ Aggregation: Aggregation;
130
123
  Operation: Operation;
131
124
  Create: CreateOperation;
132
125
  Update: UpdateOperation;
@@ -1,5 +1,5 @@
1
1
  import { EntityDict } from '../base-app-domain';
2
2
  import { AsyncContext } from '../store/AsyncRowStore';
3
3
  import { SyncContext } from '../store/SyncRowStore';
4
- import { StorageSchema, EntityDict as BaseEntityDict } from '../types';
5
- export declare function createDynamicCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>): import("../types").RowChecker<ED, keyof ED, Cxt>[];
4
+ import { StorageSchema, EntityDict as BaseEntityDict, Checker } from '../types';
5
+ export declare function createDynamicCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>): Checker<ED, keyof ED, Cxt>[];
@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createDynamicCheckers = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var checker_1 = require("../store/checker");
4
6
  var modi_1 = require("../store/modi");
5
7
  function createDynamicCheckers(schema) {
6
- return (0, modi_1.createModiRelatedCheckers)(schema);
8
+ var checkers = [];
9
+ checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, modi_1.createModiRelatedCheckers)(schema)), false));
10
+ checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createRelationHierarchyCheckers)(schema)), false));
11
+ return checkers;
7
12
  }
8
13
  exports.createDynamicCheckers = createDynamicCheckers;