oak-domain 1.0.3 → 1.1.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.
- package/lib/OakError.js +2 -16
- package/lib/actions/action.d.ts +9 -1
- package/lib/actions/action.js +6 -2
- package/lib/base-app-domain/ActionDefDict.d.ts +5 -0
- package/lib/base-app-domain/ActionDefDict.js +7 -0
- package/lib/base-app-domain/EntityDict.d.ts +12 -0
- package/lib/base-app-domain/EntityDict.js +2 -0
- package/lib/base-app-domain/Modi/Action.d.ts +10 -0
- package/lib/base-app-domain/Modi/Action.js +14 -0
- package/lib/base-app-domain/Modi/Schema.d.ts +161 -0
- package/lib/base-app-domain/Modi/Schema.js +2 -0
- package/lib/base-app-domain/Modi/Storage.d.ts +3 -0
- package/lib/base-app-domain/Modi/Storage.js +60 -0
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +179 -0
- package/lib/base-app-domain/ModiEntity/Schema.js +2 -0
- package/lib/base-app-domain/ModiEntity/Storage.d.ts +3 -0
- package/lib/base-app-domain/ModiEntity/Storage.js +26 -0
- package/lib/base-app-domain/Oper/Schema.d.ts +158 -0
- package/lib/base-app-domain/Oper/Schema.js +2 -0
- package/lib/base-app-domain/Oper/Storage.d.ts +3 -0
- package/lib/base-app-domain/Oper/Storage.js +29 -0
- package/lib/base-app-domain/OperEntity/Schema.d.ts +196 -0
- package/lib/base-app-domain/OperEntity/Schema.js +2 -0
- package/lib/base-app-domain/OperEntity/Storage.d.ts +3 -0
- package/lib/base-app-domain/OperEntity/Storage.js +26 -0
- package/lib/base-app-domain/Storage.d.ts +3 -0
- package/lib/base-app-domain/Storage.js +15 -0
- package/lib/base-app-domain/User/Schema.d.ts +140 -0
- package/lib/base-app-domain/User/Schema.js +2 -0
- package/lib/base-app-domain/User/Storage.d.ts +3 -0
- package/lib/base-app-domain/User/Storage.js +25 -0
- package/lib/base-app-domain/_SubQuery.d.ts +36 -0
- package/lib/base-app-domain/_SubQuery.js +2 -0
- package/lib/base-app-domain/index.d.ts +3 -0
- package/lib/base-app-domain/index.js +6 -0
- package/lib/checkers/index.d.ts +3 -0
- package/lib/checkers/index.js +8 -0
- package/lib/compiler/env.d.ts +4 -3
- package/lib/compiler/env.js +22 -9
- package/lib/compiler/schemalBuilder.js +684 -353
- package/lib/entities/Action.d.ts +12 -0
- package/lib/entities/Action.js +17 -0
- package/lib/entities/Modi.d.ts +11 -0
- package/lib/entities/Modi.js +46 -0
- package/lib/entities/ModiEntity.d.ts +8 -0
- package/lib/entities/ModiEntity.js +15 -0
- package/lib/entities/Ooperation.d.ts +12 -0
- package/lib/entities/Ooperation.js +17 -0
- package/lib/entities/Oper.d.ts +10 -0
- package/lib/entities/Oper.js +17 -0
- package/lib/entities/OperEntity.d.ts +8 -0
- package/lib/entities/OperEntity.js +15 -0
- package/lib/entities/Update.d.ts +9 -0
- package/lib/entities/Update.js +44 -0
- package/lib/entities/User.d.ts +7 -0
- package/lib/entities/User.js +12 -0
- package/lib/entities/Uupdate.d.ts +9 -0
- package/lib/entities/Uupdate.js +44 -0
- package/lib/store/CascadeStore.d.ts +31 -6
- package/lib/store/CascadeStore.js +957 -230
- package/lib/store/TriggerExecutor.d.ts +4 -3
- package/lib/store/TriggerExecutor.js +28 -100
- package/lib/store/UniversalContext.d.ts +1 -0
- package/lib/store/UniversalContext.js +10 -59
- package/lib/store/action.d.ts +6 -0
- package/lib/store/action.js +14 -0
- package/lib/store/actionDef.js +34 -51
- package/lib/store/filter.d.ts +6 -0
- package/lib/store/filter.js +60 -29
- package/lib/store/modi.d.ts +11 -0
- package/lib/store/modi.js +141 -0
- package/lib/store/projection.d.ts +7 -0
- package/lib/store/projection.js +211 -0
- package/lib/store/relation.js +2 -4
- package/lib/store/selection.d.ts +7 -0
- package/lib/store/selection.js +227 -0
- package/lib/triggers/index.d.ts +2 -0
- package/lib/triggers/index.js +5 -0
- package/lib/triggers/modi.d.ts +5 -0
- package/lib/triggers/modi.js +72 -0
- package/lib/types/Context.d.ts +1 -0
- package/lib/types/DataType.d.ts +1 -1
- package/lib/types/Entity.d.ts +29 -16
- package/lib/types/Exception.d.ts +28 -0
- package/lib/types/Exception.js +75 -23
- package/lib/types/Expression.d.ts +9 -0
- package/lib/types/Expression.js +47 -38
- package/lib/types/RowStore.d.ts +3 -3
- package/lib/types/Storage.d.ts +6 -0
- package/lib/types/Trigger.d.ts +5 -5
- package/lib/types/index.js +19 -32
- package/lib/utils/SimpleConnector.js +5 -58
- package/lib/utils/assert.js +2 -4
- package/lib/utils/concurrent.js +5 -54
- package/lib/utils/lodash.d.ts +4 -1
- package/lib/utils/lodash.js +19 -15
- package/package.json +8 -3
- package/src/entities/Modi.ts +68 -0
- package/src/entities/ModiEntity.ts +24 -0
- package/src/entities/Oper.ts +28 -0
- package/src/entities/OperEntity.ts +24 -0
- package/src/entities/User.ts +20 -0
package/lib/OakError.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.OakError = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
19
5
|
var OakError = /** @class */ (function (_super) {
|
|
20
|
-
__extends(OakError, _super);
|
|
6
|
+
tslib_1.__extends(OakError, _super);
|
|
21
7
|
function OakError(level, def, message) {
|
|
22
8
|
var _this = _super.call(this, message ? message : def && def[1]) || this;
|
|
23
9
|
_this.$$level = level;
|
package/lib/actions/action.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { ActionDef } from '../types/Action';
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type ReadOnlyAction = 'select' | 'count' | 'stat' | 'download';
|
|
3
|
+
export declare type AppendOnlyAction = ReadOnlyAction | 'create';
|
|
4
|
+
export declare type ExcludeUpdateAction = AppendOnlyAction | 'remove';
|
|
5
|
+
export declare type ExcludeRemoveAction = AppendOnlyAction | 'update';
|
|
6
|
+
export declare type GenericAction = 'update' | ExcludeUpdateAction;
|
|
7
|
+
export declare const readOnlyActions: string[];
|
|
8
|
+
export declare const appendOnlyActions: string[];
|
|
9
|
+
export declare const excludeUpdateActions: string[];
|
|
10
|
+
export declare const exludeRemoveActions: string[];
|
|
3
11
|
export declare const genericActions: string[];
|
|
4
12
|
export declare type AbleAction = 'enable' | 'disable';
|
|
5
13
|
export declare type AbleState = 'enabled' | 'disabled';
|
package/lib/actions/action.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeAbleActionDef = exports.genericActions = void 0;
|
|
4
|
-
exports.
|
|
3
|
+
exports.makeAbleActionDef = exports.genericActions = exports.exludeRemoveActions = exports.excludeUpdateActions = exports.appendOnlyActions = exports.readOnlyActions = void 0;
|
|
4
|
+
exports.readOnlyActions = ['count', 'stat', 'download', 'select'];
|
|
5
|
+
exports.appendOnlyActions = exports.readOnlyActions.concat('create');
|
|
6
|
+
exports.excludeUpdateActions = exports.appendOnlyActions.concat('remove');
|
|
7
|
+
exports.exludeRemoveActions = exports.appendOnlyActions.concat('update');
|
|
8
|
+
exports.genericActions = exports.excludeUpdateActions.concat('update');
|
|
5
9
|
var makeAbleActionDef = function (initialState) { return ({
|
|
6
10
|
stm: {
|
|
7
11
|
enable: ['disabled', 'enabled'],
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EntityDef as Modi } from "./Modi/Schema";
|
|
2
|
+
import { EntityDef as ModiEntity } from "./ModiEntity/Schema";
|
|
3
|
+
import { EntityDef as Oper } from "./Oper/Schema";
|
|
4
|
+
import { EntityDef as OperEntity } from "./OperEntity/Schema";
|
|
5
|
+
import { EntityDef as User } from "./User/Schema";
|
|
6
|
+
export declare type EntityDict = {
|
|
7
|
+
modi: Modi;
|
|
8
|
+
modiEntity: ModiEntity;
|
|
9
|
+
oper: Oper;
|
|
10
|
+
operEntity: OperEntity;
|
|
11
|
+
user: User;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionDef } from "../../types/Action";
|
|
2
|
+
import { GenericAction } from "../../actions/action";
|
|
3
|
+
export declare type IState = 'active' | 'applied' | 'abandoned';
|
|
4
|
+
export declare type IAction = 'apply' | 'abandon';
|
|
5
|
+
export declare type ParticularAction = IAction;
|
|
6
|
+
export declare type Action = GenericAction | ParticularAction;
|
|
7
|
+
export declare const actions: string[];
|
|
8
|
+
export declare const ActionDefDict: {
|
|
9
|
+
iState: ActionDef<IAction, IState>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionDefDict = exports.actions = void 0;
|
|
4
|
+
var IActionDef = {
|
|
5
|
+
stm: {
|
|
6
|
+
apply: ['active', 'applied'],
|
|
7
|
+
abandon: ['active', 'abandoned']
|
|
8
|
+
},
|
|
9
|
+
is: 'active'
|
|
10
|
+
};
|
|
11
|
+
exports.actions = ["count", "stat", "download", "select", "create", "remove", "update", "apply", "abandon"];
|
|
12
|
+
exports.ActionDefDict = {
|
|
13
|
+
iState: IActionDef
|
|
14
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { String, Datetime, PrimaryKey } 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 { Action, ParticularAction, IState } from "./Action";
|
|
7
|
+
import * as ModiEntity from "../ModiEntity/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
|
+
targetEntity: String<32>;
|
|
15
|
+
entity: String<32>;
|
|
16
|
+
entityId: String<64>;
|
|
17
|
+
action: String<16>;
|
|
18
|
+
data: Object;
|
|
19
|
+
filter?: Object | null;
|
|
20
|
+
extra?: Object | null;
|
|
21
|
+
iState?: IState | null;
|
|
22
|
+
};
|
|
23
|
+
export declare type OpAttr = keyof OpSchema;
|
|
24
|
+
export declare type Schema = {
|
|
25
|
+
id: PrimaryKey;
|
|
26
|
+
$$createAt$$: Datetime;
|
|
27
|
+
$$updateAt$$: Datetime;
|
|
28
|
+
$$deleteAt$$?: Datetime | null;
|
|
29
|
+
targetEntity: String<32>;
|
|
30
|
+
entity: String<32>;
|
|
31
|
+
entityId: String<64>;
|
|
32
|
+
action: String<16>;
|
|
33
|
+
data: Object;
|
|
34
|
+
filter?: Object | null;
|
|
35
|
+
extra?: Object | null;
|
|
36
|
+
iState?: IState | null;
|
|
37
|
+
modiEntity$modi?: Array<ModiEntity.Schema>;
|
|
38
|
+
operEntity$entity?: Array<OperEntity.Schema>;
|
|
39
|
+
} & {
|
|
40
|
+
[A in ExpressionKey]?: any;
|
|
41
|
+
};
|
|
42
|
+
declare type AttrFilter = {
|
|
43
|
+
id: Q_StringValue | SubQuery.ModiIdSubQuery;
|
|
44
|
+
$$createAt$$: Q_DateValue;
|
|
45
|
+
$$updateAt$$: Q_DateValue;
|
|
46
|
+
targetEntity: Q_StringValue;
|
|
47
|
+
entity: Q_StringValue;
|
|
48
|
+
entityId: Q_StringValue;
|
|
49
|
+
action: Q_StringValue;
|
|
50
|
+
iState: Q_EnumValue<IState>;
|
|
51
|
+
};
|
|
52
|
+
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
53
|
+
export declare type Projection = {
|
|
54
|
+
"#id"?: NodeId;
|
|
55
|
+
[k: string]: any;
|
|
56
|
+
id: 1;
|
|
57
|
+
$$createAt$$?: 1;
|
|
58
|
+
$$updateAt$$?: 1;
|
|
59
|
+
targetEntity?: 1;
|
|
60
|
+
entity?: 1;
|
|
61
|
+
entityId?: 1;
|
|
62
|
+
action?: 1;
|
|
63
|
+
data?: 1;
|
|
64
|
+
filter?: 1;
|
|
65
|
+
extra?: 1;
|
|
66
|
+
iState?: 1;
|
|
67
|
+
modiEntity$modi?: ModiEntity.Selection & {
|
|
68
|
+
$entity: "modiEntity";
|
|
69
|
+
};
|
|
70
|
+
operEntity$entity?: OperEntity.Selection & {
|
|
71
|
+
$entity: "operEntity";
|
|
72
|
+
};
|
|
73
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
74
|
+
export declare type ExportProjection = {
|
|
75
|
+
"#id"?: NodeId;
|
|
76
|
+
[k: string]: any;
|
|
77
|
+
id?: string;
|
|
78
|
+
$$createAt$$?: string;
|
|
79
|
+
$$updateAt$$?: string;
|
|
80
|
+
targetEntity?: string;
|
|
81
|
+
entity?: string;
|
|
82
|
+
entityId?: string;
|
|
83
|
+
action?: string;
|
|
84
|
+
data?: string;
|
|
85
|
+
filter?: string;
|
|
86
|
+
extra?: string;
|
|
87
|
+
iState?: string;
|
|
88
|
+
modiEntity$modi?: ModiEntity.Exportation & {
|
|
89
|
+
$entity: "modiEntity";
|
|
90
|
+
};
|
|
91
|
+
operEntity$entity?: OperEntity.Exportation & {
|
|
92
|
+
$entity: "operEntity";
|
|
93
|
+
};
|
|
94
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
95
|
+
declare type ModiIdProjection = OneOf<{
|
|
96
|
+
id: 1;
|
|
97
|
+
}>;
|
|
98
|
+
export declare type SortAttr = {
|
|
99
|
+
id: 1;
|
|
100
|
+
} | {
|
|
101
|
+
$$createAt$$: 1;
|
|
102
|
+
} | {
|
|
103
|
+
$$updateAt$$: 1;
|
|
104
|
+
} | {
|
|
105
|
+
targetEntity: 1;
|
|
106
|
+
} | {
|
|
107
|
+
entity: 1;
|
|
108
|
+
} | {
|
|
109
|
+
entityId: 1;
|
|
110
|
+
} | {
|
|
111
|
+
action: 1;
|
|
112
|
+
} | {
|
|
113
|
+
iState: 1;
|
|
114
|
+
} | {
|
|
115
|
+
[k: string]: any;
|
|
116
|
+
} | OneOf<ExprOp<OpAttr | string>>;
|
|
117
|
+
export declare type SortNode = {
|
|
118
|
+
$attr: SortAttr;
|
|
119
|
+
$direction?: "asc" | "desc";
|
|
120
|
+
};
|
|
121
|
+
export declare type Sorter = SortNode[];
|
|
122
|
+
export declare type SelectOperation<P = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
|
|
123
|
+
export declare type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
124
|
+
export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
125
|
+
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
|
126
|
+
entity?: string;
|
|
127
|
+
entityId?: string;
|
|
128
|
+
[K: string]: any;
|
|
129
|
+
}) & {
|
|
130
|
+
modiEntity$modi?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">>>;
|
|
131
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
132
|
+
};
|
|
133
|
+
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
134
|
+
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
135
|
+
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
136
|
+
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
137
|
+
[k: string]: any;
|
|
138
|
+
modiEntitys$modi?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">>>;
|
|
139
|
+
operEntitys$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
140
|
+
};
|
|
141
|
+
export declare type UpdateOperation = OakOperation<ParticularAction | "update" | string, UpdateOperationData, Filter, Sorter>;
|
|
142
|
+
export declare type RemoveOperationData = {};
|
|
143
|
+
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
144
|
+
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
145
|
+
export declare type ModiIdSubQuery = Selection<ModiIdProjection>;
|
|
146
|
+
export declare type NativeAttr = OpAttr;
|
|
147
|
+
export declare type FullAttr = NativeAttr | `modiEntitys$${number}.${ModiEntity.NativeAttr}` | `operEntitys$${number}.${OperEntity.NativeAttr}`;
|
|
148
|
+
export declare type EntityDef = {
|
|
149
|
+
Schema: Schema;
|
|
150
|
+
OpSchema: OpSchema;
|
|
151
|
+
Action: OakMakeAction<Action> | string;
|
|
152
|
+
Selection: Selection;
|
|
153
|
+
Operation: Operation;
|
|
154
|
+
Create: CreateOperation;
|
|
155
|
+
Update: UpdateOperation;
|
|
156
|
+
Remove: RemoveOperation;
|
|
157
|
+
CreateSingle: CreateSingleOperation;
|
|
158
|
+
CreateMulti: CreateMultipleOperation;
|
|
159
|
+
ParticularAction: ParticularAction;
|
|
160
|
+
};
|
|
161
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.desc = void 0;
|
|
4
|
+
var Action_1 = require("./Action");
|
|
5
|
+
exports.desc = {
|
|
6
|
+
attributes: {
|
|
7
|
+
targetEntity: {
|
|
8
|
+
type: "varchar",
|
|
9
|
+
params: {
|
|
10
|
+
length: 32
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
entity: {
|
|
14
|
+
type: "varchar",
|
|
15
|
+
params: {
|
|
16
|
+
length: 32
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
entityId: {
|
|
20
|
+
type: "varchar",
|
|
21
|
+
params: {
|
|
22
|
+
length: 64
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
action: {
|
|
26
|
+
type: "varchar",
|
|
27
|
+
params: {
|
|
28
|
+
length: 16
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
data: {
|
|
32
|
+
type: "object"
|
|
33
|
+
},
|
|
34
|
+
filter: {
|
|
35
|
+
type: "object"
|
|
36
|
+
},
|
|
37
|
+
extra: {
|
|
38
|
+
type: "object"
|
|
39
|
+
},
|
|
40
|
+
iState: {
|
|
41
|
+
type: "varchar",
|
|
42
|
+
params: {
|
|
43
|
+
length: 16
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
actionType: "crud",
|
|
48
|
+
actions: Action_1.actions,
|
|
49
|
+
indexes: [
|
|
50
|
+
{
|
|
51
|
+
name: 'index_state',
|
|
52
|
+
attributes: [
|
|
53
|
+
{
|
|
54
|
+
name: 'iState',
|
|
55
|
+
direction: 'ASC'
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
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 Modi from "../Modi/Schema";
|
|
8
|
+
import * as User from "../User/Schema";
|
|
9
|
+
export declare type OpSchema = {
|
|
10
|
+
id: PrimaryKey;
|
|
11
|
+
$$createAt$$: Datetime;
|
|
12
|
+
$$updateAt$$: Datetime;
|
|
13
|
+
$$deleteAt$$?: Datetime | null;
|
|
14
|
+
modiId: ForeignKey<"modi">;
|
|
15
|
+
entity: "user" | string;
|
|
16
|
+
entityId: String<64>;
|
|
17
|
+
};
|
|
18
|
+
export declare type OpAttr = keyof OpSchema;
|
|
19
|
+
export declare type Schema = {
|
|
20
|
+
id: PrimaryKey;
|
|
21
|
+
$$createAt$$: Datetime;
|
|
22
|
+
$$updateAt$$: Datetime;
|
|
23
|
+
$$deleteAt$$?: Datetime | null;
|
|
24
|
+
modiId: ForeignKey<"modi">;
|
|
25
|
+
entity: "user" | string;
|
|
26
|
+
entityId: String<64>;
|
|
27
|
+
modi: Modi.Schema;
|
|
28
|
+
user?: User.Schema;
|
|
29
|
+
} & {
|
|
30
|
+
[A in ExpressionKey]?: any;
|
|
31
|
+
};
|
|
32
|
+
declare type AttrFilter<E> = {
|
|
33
|
+
id: Q_StringValue | SubQuery.ModiEntityIdSubQuery;
|
|
34
|
+
$$createAt$$: Q_DateValue;
|
|
35
|
+
$$updateAt$$: Q_DateValue;
|
|
36
|
+
modiId: Q_StringValue | SubQuery.ModiIdSubQuery;
|
|
37
|
+
modi: Modi.Filter;
|
|
38
|
+
entity: E;
|
|
39
|
+
entityId: Q_StringValue;
|
|
40
|
+
user: User.Filter;
|
|
41
|
+
};
|
|
42
|
+
export declare type Filter<E = Q_EnumValue<"user" | string>> = MakeFilter<AttrFilter<E> & 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
|
+
modiId?: 1;
|
|
50
|
+
modi?: Modi.Projection;
|
|
51
|
+
entity?: 1;
|
|
52
|
+
entityId?: 1;
|
|
53
|
+
user?: User.Projection;
|
|
54
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
55
|
+
export declare type ExportProjection = {
|
|
56
|
+
"#id"?: NodeId;
|
|
57
|
+
[k: string]: any;
|
|
58
|
+
id?: string;
|
|
59
|
+
$$createAt$$?: string;
|
|
60
|
+
$$updateAt$$?: string;
|
|
61
|
+
modiId?: string;
|
|
62
|
+
modi?: Modi.ExportProjection;
|
|
63
|
+
entity?: string;
|
|
64
|
+
entityId?: string;
|
|
65
|
+
user?: User.ExportProjection;
|
|
66
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
67
|
+
declare type ModiEntityIdProjection = OneOf<{
|
|
68
|
+
id: 1;
|
|
69
|
+
}>;
|
|
70
|
+
declare type ModiIdProjection = OneOf<{
|
|
71
|
+
modiId: 1;
|
|
72
|
+
}>;
|
|
73
|
+
declare type UserIdProjection = OneOf<{
|
|
74
|
+
entityId: 1;
|
|
75
|
+
}>;
|
|
76
|
+
export declare type SortAttr = {
|
|
77
|
+
id: 1;
|
|
78
|
+
} | {
|
|
79
|
+
$$createAt$$: 1;
|
|
80
|
+
} | {
|
|
81
|
+
$$updateAt$$: 1;
|
|
82
|
+
} | {
|
|
83
|
+
modiId: 1;
|
|
84
|
+
} | {
|
|
85
|
+
modi: Modi.SortAttr;
|
|
86
|
+
} | {
|
|
87
|
+
entity: 1;
|
|
88
|
+
} | {
|
|
89
|
+
entityId: 1;
|
|
90
|
+
} | {
|
|
91
|
+
user: User.SortAttr;
|
|
92
|
+
} | {
|
|
93
|
+
[k: string]: any;
|
|
94
|
+
} | OneOf<ExprOp<OpAttr | string>>;
|
|
95
|
+
export declare type SortNode = {
|
|
96
|
+
$attr: SortAttr;
|
|
97
|
+
$direction?: "asc" | "desc";
|
|
98
|
+
};
|
|
99
|
+
export declare type Sorter = SortNode[];
|
|
100
|
+
export declare type SelectOperation<P = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
|
|
101
|
+
export declare type Selection<P = Projection> = Omit<SelectOperation<P>, "action">;
|
|
102
|
+
export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
|
|
103
|
+
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "modiId">> & (({
|
|
104
|
+
modiId?: never;
|
|
105
|
+
modi: Modi.CreateSingleOperation;
|
|
106
|
+
} | {
|
|
107
|
+
modiId: String<64>;
|
|
108
|
+
modi?: Modi.UpdateOperation;
|
|
109
|
+
} | {
|
|
110
|
+
modiId: String<64>;
|
|
111
|
+
})) & ({
|
|
112
|
+
entity?: never;
|
|
113
|
+
entityId?: never;
|
|
114
|
+
user: User.CreateSingleOperation;
|
|
115
|
+
} | {
|
|
116
|
+
entity: "user";
|
|
117
|
+
entityId: String<64>;
|
|
118
|
+
user: User.UpdateOperation;
|
|
119
|
+
} | {
|
|
120
|
+
entity: "user";
|
|
121
|
+
entityId: String<64>;
|
|
122
|
+
} | {
|
|
123
|
+
entity?: string;
|
|
124
|
+
entityId?: string;
|
|
125
|
+
[K: string]: any;
|
|
126
|
+
});
|
|
127
|
+
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
128
|
+
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
129
|
+
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
130
|
+
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId" | "modiId">> & (({
|
|
131
|
+
modi: Modi.CreateSingleOperation;
|
|
132
|
+
modiId?: never;
|
|
133
|
+
} | {
|
|
134
|
+
modi: Modi.UpdateOperation;
|
|
135
|
+
modiId?: never;
|
|
136
|
+
} | {
|
|
137
|
+
modi: Modi.RemoveOperation;
|
|
138
|
+
modiId?: never;
|
|
139
|
+
} | {
|
|
140
|
+
modi?: never;
|
|
141
|
+
modiId?: String<64> | null;
|
|
142
|
+
})) & ({
|
|
143
|
+
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
|
144
|
+
entityId?: never;
|
|
145
|
+
entity?: never;
|
|
146
|
+
} | {
|
|
147
|
+
entity?: ("user" | string) | null;
|
|
148
|
+
entityId?: String<64> | null;
|
|
149
|
+
}) & {
|
|
150
|
+
[k: string]: any;
|
|
151
|
+
};
|
|
152
|
+
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
153
|
+
export declare type RemoveOperationData = {} & (({
|
|
154
|
+
modi?: Modi.UpdateOperation | Modi.RemoveOperation;
|
|
155
|
+
})) & ({
|
|
156
|
+
user?: User.UpdateOperation | User.RemoveOperation;
|
|
157
|
+
} | {
|
|
158
|
+
[k: string]: any;
|
|
159
|
+
});
|
|
160
|
+
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
161
|
+
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
|
|
162
|
+
export declare type ModiIdSubQuery = Selection<ModiIdProjection>;
|
|
163
|
+
export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
|
164
|
+
export declare type ModiEntityIdSubQuery = Selection<ModiEntityIdProjection>;
|
|
165
|
+
export declare type NativeAttr = OpAttr | `modi.${Modi.NativeAttr}` | `entity.${User.NativeAttr}`;
|
|
166
|
+
export declare type FullAttr = NativeAttr;
|
|
167
|
+
export declare type EntityDef = {
|
|
168
|
+
Schema: Schema;
|
|
169
|
+
OpSchema: OpSchema;
|
|
170
|
+
Action: OakMakeAction<AppendOnlyAction> | string;
|
|
171
|
+
Selection: Selection;
|
|
172
|
+
Operation: Operation;
|
|
173
|
+
Create: CreateOperation;
|
|
174
|
+
Update: UpdateOperation;
|
|
175
|
+
Remove: RemoveOperation;
|
|
176
|
+
CreateSingle: CreateSingleOperation;
|
|
177
|
+
CreateMulti: CreateMultipleOperation;
|
|
178
|
+
};
|
|
179
|
+
export {};
|
|
@@ -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
|
+
modiId: {
|
|
8
|
+
type: "ref",
|
|
9
|
+
ref: "modi"
|
|
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
|
+
};
|