oak-domain 4.0.3 → 4.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.
@@ -1,214 +1,213 @@
1
- import { ForeignKey } from "../../types/DataType";
2
- import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
3
- import { OneOf } from "../../types/Polyfill";
4
- import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult } from "../../types/Entity";
5
- import { GenericAction } from "../../actions/action";
6
- import { EntityShape } from "../../types/Entity";
7
- import * as Relation from "../Relation/Schema";
8
- import * as Path from "../Path/Schema";
9
- import * as ModiEntity from "../ModiEntity/Schema";
10
- import * as OperEntity from "../OperEntity/Schema";
11
- export type OpSchema = EntityShape & {
12
- sourceRelationId: ForeignKey<"relation">;
13
- pathId: ForeignKey<"path">;
14
- destRelationId: ForeignKey<"relation">;
15
- };
16
- export type OpAttr = keyof OpSchema;
17
- export type Schema = EntityShape & {
18
- sourceRelationId: ForeignKey<"relation">;
19
- pathId: ForeignKey<"path">;
20
- destRelationId: ForeignKey<"relation">;
21
- sourceRelation: Relation.Schema;
22
- path: Path.Schema;
23
- destRelation: Relation.Schema;
24
- modiEntity$entity?: Array<ModiEntity.Schema>;
25
- modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
26
- operEntity$entity?: Array<OperEntity.Schema>;
27
- operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
28
- } & {
29
- [A in ExpressionKey]?: any;
30
- };
31
- type AttrFilter = {
32
- id: Q_StringValue;
33
- $$createAt$$: Q_DateValue;
34
- $$seq$$: Q_NumberValue;
35
- $$updateAt$$: Q_DateValue;
36
- sourceRelationId: Q_StringValue;
37
- sourceRelation: Relation.Filter;
38
- pathId: Q_StringValue;
39
- path: Path.Filter;
40
- destRelationId: Q_StringValue;
41
- destRelation: Relation.Filter;
42
- modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
43
- operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
44
- };
45
- export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
46
- export type Projection = {
47
- "#id"?: NodeId;
48
- [k: string]: any;
49
- id?: number;
50
- $$createAt$$?: number;
51
- $$updateAt$$?: number;
52
- $$seq$$?: number;
53
- sourceRelationId?: number;
54
- sourceRelation?: Relation.Projection;
55
- pathId?: number;
56
- path?: Path.Projection;
57
- destRelationId?: number;
58
- destRelation?: Relation.Projection;
59
- modiEntity$entity?: ModiEntity.Selection & {
60
- $entity: "modiEntity";
61
- };
62
- modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
63
- $entity: "modiEntity";
64
- };
65
- operEntity$entity?: OperEntity.Selection & {
66
- $entity: "operEntity";
67
- };
68
- operEntity$entity$$aggr?: OperEntity.Aggregation & {
69
- $entity: "operEntity";
70
- };
71
- } & Partial<ExprOp<OpAttr | string>>;
72
- type RelationAuthIdProjection = OneOf<{
73
- id: number;
74
- }>;
75
- type RelationIdProjection = OneOf<{
76
- sourceRelationId: number;
77
- destRelationId: number;
78
- }>;
79
- type PathIdProjection = OneOf<{
80
- pathId: number;
81
- }>;
82
- export type SortAttr = {
83
- id: number;
84
- } | {
85
- $$createAt$$: number;
86
- } | {
87
- $$seq$$: number;
88
- } | {
89
- $$updateAt$$: number;
90
- } | {
91
- sourceRelationId: number;
92
- } | {
93
- sourceRelation: Relation.SortAttr;
94
- } | {
95
- pathId: number;
96
- } | {
97
- path: Path.SortAttr;
98
- } | {
99
- destRelationId: number;
100
- } | {
101
- destRelation: Relation.SortAttr;
102
- } | {
103
- [k: string]: any;
104
- } | OneOf<ExprOp<OpAttr | string>>;
105
- export type SortNode = {
106
- $attr: SortAttr;
107
- $direction?: "asc" | "desc";
108
- };
109
- export type Sorter = SortNode[];
110
- export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
111
- export type Selection<P extends Object = Projection> = SelectOperation<P>;
112
- export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
113
- export type CreateOperationData = FormCreateData<Omit<OpSchema, "sourceRelationId" | "pathId" | "destRelationId">> & (({
114
- sourceRelationId?: never;
115
- sourceRelation: Relation.CreateSingleOperation;
116
- } | {
117
- sourceRelationId: ForeignKey<"sourceRelation">;
118
- sourceRelation?: Relation.UpdateOperation;
119
- } | {
120
- sourceRelation?: never;
121
- sourceRelationId: ForeignKey<"sourceRelation">;
122
- }) & ({
123
- pathId?: never;
124
- path: Path.CreateSingleOperation;
125
- } | {
126
- pathId: ForeignKey<"path">;
127
- path?: Path.UpdateOperation;
128
- } | {
129
- path?: never;
130
- pathId: ForeignKey<"path">;
131
- }) & ({
132
- destRelationId?: never;
133
- destRelation: Relation.CreateSingleOperation;
134
- } | {
135
- destRelationId: ForeignKey<"destRelation">;
136
- destRelation?: Relation.UpdateOperation;
137
- } | {
138
- destRelation?: never;
139
- destRelationId: ForeignKey<"destRelation">;
140
- })) & {
141
- modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
142
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
143
- };
144
- export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
145
- export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
146
- export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
147
- export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "sourceRelationId" | "pathId" | "destRelationId">> & (({
148
- sourceRelation?: Relation.CreateSingleOperation;
149
- sourceRelationId?: never;
150
- } | {
151
- sourceRelation?: Relation.UpdateOperation;
152
- sourceRelationId?: never;
153
- } | {
154
- sourceRelation?: Relation.RemoveOperation;
155
- sourceRelationId?: never;
156
- } | {
157
- sourceRelation?: never;
158
- sourceRelationId?: ForeignKey<"sourceRelation">;
159
- }) & ({
160
- path?: Path.CreateSingleOperation;
161
- pathId?: never;
162
- } | {
163
- path?: Path.UpdateOperation;
164
- pathId?: never;
165
- } | {
166
- path?: Path.RemoveOperation;
167
- pathId?: never;
168
- } | {
169
- path?: never;
170
- pathId?: ForeignKey<"path">;
171
- }) & ({
172
- destRelation?: Relation.CreateSingleOperation;
173
- destRelationId?: never;
174
- } | {
175
- destRelation?: Relation.UpdateOperation;
176
- destRelationId?: never;
177
- } | {
178
- destRelation?: Relation.RemoveOperation;
179
- destRelationId?: never;
180
- } | {
181
- destRelation?: never;
182
- destRelationId?: ForeignKey<"destRelation">;
183
- })) & {
184
- [k: string]: any;
185
- modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
186
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
187
- };
188
- export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
189
- export type RemoveOperationData = {} & (({
190
- sourceRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
191
- }) & ({
192
- path?: Path.UpdateOperation | Path.RemoveOperation;
193
- }) & ({
194
- destRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
195
- }));
196
- export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
197
- export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
198
- export type RelationIdSubQuery = Selection<RelationIdProjection>;
199
- export type PathIdSubQuery = Selection<PathIdProjection>;
200
- export type RelationAuthIdSubQuery = Selection<RelationAuthIdProjection>;
201
- export type EntityDef = {
202
- Schema: Schema;
203
- OpSchema: OpSchema;
204
- Action: OakMakeAction<GenericAction> | string;
205
- Selection: Selection;
206
- Aggregation: Aggregation;
207
- Operation: Operation;
208
- Create: CreateOperation;
209
- Update: UpdateOperation;
210
- Remove: RemoveOperation;
211
- CreateSingle: CreateSingleOperation;
212
- CreateMulti: CreateMultipleOperation;
213
- };
214
- export {};
1
+ import { ForeignKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
3
+ import { OneOf } from "../../types/Polyfill";
4
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "../../types/Entity";
5
+ import { GenericAction } from "../../actions/action";
6
+ import * as Relation from "../Relation/Schema";
7
+ import * as Path from "../Path/Schema";
8
+ import * as ModiEntity from "../ModiEntity/Schema";
9
+ import * as OperEntity from "../OperEntity/Schema";
10
+ export type OpSchema = EntityShape & {
11
+ sourceRelationId: ForeignKey<"relation">;
12
+ pathId: ForeignKey<"path">;
13
+ destRelationId: ForeignKey<"relation">;
14
+ };
15
+ export type OpAttr = keyof OpSchema;
16
+ export type Schema = EntityShape & {
17
+ sourceRelationId: ForeignKey<"relation">;
18
+ pathId: ForeignKey<"path">;
19
+ destRelationId: ForeignKey<"relation">;
20
+ sourceRelation: Relation.Schema;
21
+ path: Path.Schema;
22
+ destRelation: Relation.Schema;
23
+ modiEntity$entity?: Array<ModiEntity.Schema>;
24
+ modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
25
+ operEntity$entity?: Array<OperEntity.Schema>;
26
+ operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
27
+ } & {
28
+ [A in ExpressionKey]?: any;
29
+ };
30
+ type AttrFilter = {
31
+ id: Q_StringValue;
32
+ $$createAt$$: Q_DateValue;
33
+ $$seq$$: Q_NumberValue;
34
+ $$updateAt$$: Q_DateValue;
35
+ sourceRelationId: Q_StringValue;
36
+ sourceRelation: Relation.Filter;
37
+ pathId: Q_StringValue;
38
+ path: Path.Filter;
39
+ destRelationId: Q_StringValue;
40
+ destRelation: Relation.Filter;
41
+ modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
42
+ operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
43
+ };
44
+ export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
45
+ export type Projection = {
46
+ "#id"?: NodeId;
47
+ [k: string]: any;
48
+ id?: number;
49
+ $$createAt$$?: number;
50
+ $$updateAt$$?: number;
51
+ $$seq$$?: number;
52
+ sourceRelationId?: number;
53
+ sourceRelation?: Relation.Projection;
54
+ pathId?: number;
55
+ path?: Path.Projection;
56
+ destRelationId?: number;
57
+ destRelation?: Relation.Projection;
58
+ modiEntity$entity?: ModiEntity.Selection & {
59
+ $entity: "modiEntity";
60
+ };
61
+ modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
62
+ $entity: "modiEntity";
63
+ };
64
+ operEntity$entity?: OperEntity.Selection & {
65
+ $entity: "operEntity";
66
+ };
67
+ operEntity$entity$$aggr?: OperEntity.Aggregation & {
68
+ $entity: "operEntity";
69
+ };
70
+ } & Partial<ExprOp<OpAttr | string>>;
71
+ type RelationAuthIdProjection = OneOf<{
72
+ id: number;
73
+ }>;
74
+ type RelationIdProjection = OneOf<{
75
+ sourceRelationId: number;
76
+ destRelationId: number;
77
+ }>;
78
+ type PathIdProjection = OneOf<{
79
+ pathId: number;
80
+ }>;
81
+ export type SortAttr = {
82
+ id: number;
83
+ } | {
84
+ $$createAt$$: number;
85
+ } | {
86
+ $$seq$$: number;
87
+ } | {
88
+ $$updateAt$$: number;
89
+ } | {
90
+ sourceRelationId: number;
91
+ } | {
92
+ sourceRelation: Relation.SortAttr;
93
+ } | {
94
+ pathId: number;
95
+ } | {
96
+ path: Path.SortAttr;
97
+ } | {
98
+ destRelationId: number;
99
+ } | {
100
+ destRelation: Relation.SortAttr;
101
+ } | {
102
+ [k: string]: any;
103
+ } | OneOf<ExprOp<OpAttr | string>>;
104
+ export type SortNode = {
105
+ $attr: SortAttr;
106
+ $direction?: "asc" | "desc";
107
+ };
108
+ export type Sorter = SortNode[];
109
+ export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
110
+ export type Selection<P extends Object = Projection> = SelectOperation<P>;
111
+ export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
112
+ export type CreateOperationData = FormCreateData<Omit<OpSchema, "sourceRelationId" | "pathId" | "destRelationId">> & (({
113
+ sourceRelationId?: never;
114
+ sourceRelation: Relation.CreateSingleOperation;
115
+ } | {
116
+ sourceRelationId: ForeignKey<"sourceRelation">;
117
+ sourceRelation?: Relation.UpdateOperation;
118
+ } | {
119
+ sourceRelation?: never;
120
+ sourceRelationId: ForeignKey<"sourceRelation">;
121
+ }) & ({
122
+ pathId?: never;
123
+ path: Path.CreateSingleOperation;
124
+ } | {
125
+ pathId: ForeignKey<"path">;
126
+ path?: Path.UpdateOperation;
127
+ } | {
128
+ path?: never;
129
+ pathId: ForeignKey<"path">;
130
+ }) & ({
131
+ destRelationId?: never;
132
+ destRelation: Relation.CreateSingleOperation;
133
+ } | {
134
+ destRelationId: ForeignKey<"destRelation">;
135
+ destRelation?: Relation.UpdateOperation;
136
+ } | {
137
+ destRelation?: never;
138
+ destRelationId: ForeignKey<"destRelation">;
139
+ })) & {
140
+ modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
141
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
142
+ };
143
+ export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
144
+ export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
145
+ export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
146
+ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "sourceRelationId" | "pathId" | "destRelationId">> & (({
147
+ sourceRelation?: Relation.CreateSingleOperation;
148
+ sourceRelationId?: never;
149
+ } | {
150
+ sourceRelation?: Relation.UpdateOperation;
151
+ sourceRelationId?: never;
152
+ } | {
153
+ sourceRelation?: Relation.RemoveOperation;
154
+ sourceRelationId?: never;
155
+ } | {
156
+ sourceRelation?: never;
157
+ 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
+ } | {
168
+ path?: never;
169
+ pathId?: ForeignKey<"path">;
170
+ }) & ({
171
+ destRelation?: Relation.CreateSingleOperation;
172
+ destRelationId?: never;
173
+ } | {
174
+ destRelation?: Relation.UpdateOperation;
175
+ destRelationId?: never;
176
+ } | {
177
+ destRelation?: Relation.RemoveOperation;
178
+ destRelationId?: never;
179
+ } | {
180
+ destRelation?: never;
181
+ destRelationId?: ForeignKey<"destRelation">;
182
+ })) & {
183
+ [k: string]: any;
184
+ modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
185
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
186
+ };
187
+ export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
188
+ export type RemoveOperationData = {} & (({
189
+ sourceRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
190
+ }) & ({
191
+ path?: Path.UpdateOperation | Path.RemoveOperation;
192
+ }) & ({
193
+ destRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
194
+ }));
195
+ export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
196
+ export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
197
+ export type RelationIdSubQuery = Selection<RelationIdProjection>;
198
+ export type PathIdSubQuery = Selection<PathIdProjection>;
199
+ export type RelationAuthIdSubQuery = Selection<RelationAuthIdProjection>;
200
+ export type EntityDef = {
201
+ Schema: Schema;
202
+ OpSchema: OpSchema;
203
+ Action: OakMakeAction<GenericAction> | string;
204
+ Selection: Selection;
205
+ Aggregation: Aggregation;
206
+ Operation: Operation;
207
+ Create: CreateOperation;
208
+ Update: UpdateOperation;
209
+ Remove: RemoveOperation;
210
+ CreateSingle: CreateSingleOperation;
211
+ CreateMulti: CreateMultipleOperation;
212
+ };
213
+ export {};