oak-domain 2.4.0 → 2.4.2
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/actions/action.d.ts +16 -16
- package/lib/actions/action.js +17 -17
- package/lib/actions/relation.d.ts +5 -5
- package/lib/actions/relation.js +38 -38
- package/lib/base-app-domain/ActionDefDict.d.ts +5 -5
- package/lib/base-app-domain/ActionDefDict.js +7 -7
- package/lib/base-app-domain/EntityDict.d.ts +12 -12
- package/lib/base-app-domain/EntityDict.js +2 -2
- package/lib/base-app-domain/Modi/Action.d.ts +10 -10
- package/lib/base-app-domain/Modi/Action.js +14 -14
- package/lib/base-app-domain/Modi/Schema.d.ts +146 -146
- package/lib/base-app-domain/Modi/Schema.js +2 -2
- package/lib/base-app-domain/Modi/Storage.d.ts +3 -3
- package/lib/base-app-domain/Modi/Storage.js +60 -60
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +162 -162
- package/lib/base-app-domain/ModiEntity/Schema.js +2 -2
- package/lib/base-app-domain/ModiEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/ModiEntity/Storage.js +26 -26
- package/lib/base-app-domain/Oper/Schema.d.ts +144 -144
- package/lib/base-app-domain/Oper/Schema.js +2 -2
- package/lib/base-app-domain/Oper/Storage.d.ts +3 -3
- package/lib/base-app-domain/Oper/Storage.js +29 -29
- package/lib/base-app-domain/OperEntity/Schema.d.ts +178 -178
- package/lib/base-app-domain/OperEntity/Schema.js +2 -2
- package/lib/base-app-domain/OperEntity/Storage.d.ts +3 -3
- package/lib/base-app-domain/OperEntity/Storage.js +26 -26
- package/lib/base-app-domain/Storage.d.ts +3 -3
- package/lib/base-app-domain/Storage.js +15 -15
- package/lib/base-app-domain/User/Schema.d.ts +128 -128
- package/lib/base-app-domain/User/Schema.js +2 -2
- package/lib/base-app-domain/User/Storage.d.ts +3 -3
- package/lib/base-app-domain/User/Storage.js +25 -25
- package/lib/base-app-domain/_SubQuery.d.ts +36 -36
- package/lib/base-app-domain/_SubQuery.js +2 -2
- package/lib/base-app-domain/index.d.ts +3 -3
- package/lib/base-app-domain/index.js +6 -6
- package/lib/checkers/index.d.ts +5 -5
- package/lib/checkers/index.js +15 -15
- package/lib/compiler/env.d.ts +11 -11
- package/lib/compiler/env.js +39 -39
- package/lib/compiler/schemalBuilder.d.ts +2 -2
- package/lib/compiler/schemalBuilder.js +3303 -3301
- package/lib/compiler/uiBuilder.d.ts +1 -1
- package/lib/compiler/uiBuilder.js +3 -3
- package/lib/entities/Modi.d.ts +11 -11
- package/lib/entities/Modi.js +46 -46
- package/lib/entities/ModiEntity.d.ts +8 -8
- package/lib/entities/ModiEntity.js +15 -15
- package/lib/entities/Oper.d.ts +10 -10
- package/lib/entities/Oper.js +17 -17
- package/lib/entities/OperEntity.d.ts +8 -8
- package/lib/entities/OperEntity.js +15 -15
- package/lib/entities/User.d.ts +7 -7
- package/lib/entities/User.js +12 -12
- package/lib/store/AsyncRowStore.d.ts +48 -48
- package/lib/store/AsyncRowStore.js +183 -183
- package/lib/store/CascadeStore.d.ts +91 -91
- package/lib/store/CascadeStore.js +1590 -1594
- package/lib/store/SyncRowStore.d.ts +29 -29
- package/lib/store/SyncRowStore.js +48 -48
- package/lib/store/TriggerExecutor.d.ts +32 -32
- package/lib/store/TriggerExecutor.js +527 -527
- package/lib/store/actionDef.d.ts +9 -9
- package/lib/store/actionDef.js +333 -135
- package/lib/store/checker.d.ts +13 -13
- package/lib/store/checker.js +498 -498
- package/lib/store/filter.d.ts +109 -109
- package/lib/store/filter.js +893 -893
- package/lib/store/modi.d.ts +13 -13
- package/lib/store/modi.js +198 -198
- package/lib/store/relation.d.ts +13 -13
- package/lib/store/relation.js +66 -66
- package/lib/store/selection.d.ts +7 -7
- package/lib/store/selection.js +235 -235
- package/lib/triggers/index.d.ts +6 -6
- package/lib/triggers/index.js +11 -11
- package/lib/triggers/modi.d.ts +5 -5
- package/lib/triggers/modi.js +72 -72
- package/lib/types/Action.d.ts +18 -18
- package/lib/types/Action.js +2 -2
- package/lib/types/AppLoader.d.ts +11 -11
- package/lib/types/AppLoader.js +10 -10
- package/lib/types/Aspect.d.ts +12 -12
- package/lib/types/Aspect.js +4 -4
- package/lib/types/Auth.d.ts +66 -66
- package/lib/types/Auth.js +2 -2
- package/lib/types/Connector.d.ts +26 -26
- package/lib/types/Connector.js +9 -9
- package/lib/types/Context.d.ts +7 -7
- package/lib/types/Context.js +3 -3
- package/lib/types/DataType.d.ts +18 -18
- package/lib/types/DataType.js +5 -5
- package/lib/types/Demand.d.ts +77 -77
- package/lib/types/Demand.js +9 -9
- package/lib/types/Endpoint.d.ts +11 -10
- package/lib/types/Endpoint.js +3 -3
- package/lib/types/Entity.d.ts +183 -176
- package/lib/types/Entity.js +14 -14
- package/lib/types/Exception.d.ts +98 -88
- package/lib/types/Exception.js +283 -267
- package/lib/types/Expression.d.ts +163 -163
- package/lib/types/Expression.js +427 -427
- package/lib/types/Geo.d.ts +18 -18
- package/lib/types/Geo.js +2 -2
- package/lib/types/Locale.d.ts +24 -24
- package/lib/types/Locale.js +2 -2
- package/lib/types/Logger.d.ts +5 -5
- package/lib/types/Logger.js +3 -3
- package/lib/types/Polyfill.d.ts +23 -23
- package/lib/types/Polyfill.js +2 -2
- package/lib/types/Port.d.ts +17 -17
- package/lib/types/Port.js +2 -2
- package/lib/types/RowStore.d.ts +12 -12
- package/lib/types/RowStore.js +34 -34
- package/lib/types/Storage.d.ts +56 -56
- package/lib/types/Storage.js +2 -2
- package/lib/types/Timer.d.ts +13 -13
- package/lib/types/Timer.js +2 -2
- package/lib/types/Trigger.d.ts +100 -100
- package/lib/types/Trigger.js +39 -39
- package/lib/types/Txn.d.ts +2 -2
- package/lib/types/Txn.js +3 -3
- package/lib/types/Watcher.d.ts +19 -19
- package/lib/types/Watcher.js +4 -4
- package/lib/types/index.d.ts +21 -21
- package/lib/types/index.js +24 -24
- package/lib/types/schema/DataTypes.d.ts +32 -32
- package/lib/types/schema/DataTypes.js +3 -3
- package/lib/utils/SimpleConnector.d.ts +30 -30
- package/lib/utils/SimpleConnector.js +117 -117
- package/lib/utils/assert.d.ts +5 -5
- package/lib/utils/assert.js +9 -9
- package/lib/utils/concurrent.d.ts +15 -15
- package/lib/utils/concurrent.js +89 -89
- package/lib/utils/cron.d.ts +1 -1
- package/lib/utils/cron.js +18 -18
- package/lib/utils/date.d.ts +1 -1
- package/lib/utils/date.js +18 -18
- package/lib/utils/geo.d.ts +4 -4
- package/lib/utils/geo.js +24 -24
- package/lib/utils/lodash.d.ts +20 -20
- package/lib/utils/lodash.js +55 -55
- package/lib/utils/random/random.d.ts +1 -1
- package/lib/utils/random/random.js +24 -24
- package/lib/utils/random/random.mp.d.ts +1 -1
- package/lib/utils/random/random.mp.js +25 -25
- package/lib/utils/random/random.web.d.ts +1 -1
- package/lib/utils/random/random.web.js +17 -17
- package/lib/utils/string.d.ts +22 -22
- package/lib/utils/string.js +70 -70
- package/lib/utils/uuid.d.ts +12 -12
- package/lib/utils/uuid.js +194 -194
- package/lib/utils/validator.d.ts +23 -23
- package/lib/utils/validator.js +123 -123
- package/package.json +48 -48
- package/src/entities/Modi.ts +68 -68
- package/src/entities/ModiEntity.ts +24 -24
- package/src/entities/Oper.ts +28 -28
- package/src/entities/OperEntity.ts +24 -24
- package/src/entities/User.ts +19 -19
package/lib/triggers/modi.js
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var triggers = [
|
|
5
|
-
{
|
|
6
|
-
name: '当modi被应用时,将相应的operate完成',
|
|
7
|
-
entity: 'modi',
|
|
8
|
-
action: 'apply',
|
|
9
|
-
when: 'after',
|
|
10
|
-
fn: function (_a, context, option) {
|
|
11
|
-
var operation = _a.operation;
|
|
12
|
-
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
13
|
-
var filter, modies, modies_1, modies_1_1, modi, targetEntity, id, action, data, filter_1, e_1_1;
|
|
14
|
-
var e_1, _b;
|
|
15
|
-
return tslib_1.__generator(this, function (_c) {
|
|
16
|
-
switch (_c.label) {
|
|
17
|
-
case 0:
|
|
18
|
-
filter = operation.filter;
|
|
19
|
-
return [4 /*yield*/, context.select('modi', {
|
|
20
|
-
data: {
|
|
21
|
-
id: 1,
|
|
22
|
-
action: 1,
|
|
23
|
-
data: 1,
|
|
24
|
-
filter: 1,
|
|
25
|
-
targetEntity: 1,
|
|
26
|
-
},
|
|
27
|
-
filter: filter,
|
|
28
|
-
}, option)];
|
|
29
|
-
case 1:
|
|
30
|
-
modies = _c.sent();
|
|
31
|
-
_c.label = 2;
|
|
32
|
-
case 2:
|
|
33
|
-
_c.trys.push([2, 7, 8, 9]);
|
|
34
|
-
modies_1 = tslib_1.__values(modies), modies_1_1 = modies_1.next();
|
|
35
|
-
_c.label = 3;
|
|
36
|
-
case 3:
|
|
37
|
-
if (!!modies_1_1.done) return [3 /*break*/, 6];
|
|
38
|
-
modi = modies_1_1.value;
|
|
39
|
-
targetEntity = modi.targetEntity, id = modi.id, action = modi.action, data = modi.data, filter_1 = modi.filter;
|
|
40
|
-
return [4 /*yield*/, context.operate(targetEntity, {
|
|
41
|
-
id: id,
|
|
42
|
-
action: action,
|
|
43
|
-
data: data,
|
|
44
|
-
filter: filter_1,
|
|
45
|
-
}, Object.assign({}, option, {
|
|
46
|
-
blockTrigger: true,
|
|
47
|
-
}))];
|
|
48
|
-
case 4:
|
|
49
|
-
_c.sent();
|
|
50
|
-
_c.label = 5;
|
|
51
|
-
case 5:
|
|
52
|
-
modies_1_1 = modies_1.next();
|
|
53
|
-
return [3 /*break*/, 3];
|
|
54
|
-
case 6: return [3 /*break*/, 9];
|
|
55
|
-
case 7:
|
|
56
|
-
e_1_1 = _c.sent();
|
|
57
|
-
e_1 = { error: e_1_1 };
|
|
58
|
-
return [3 /*break*/, 9];
|
|
59
|
-
case 8:
|
|
60
|
-
try {
|
|
61
|
-
if (modies_1_1 && !modies_1_1.done && (_b = modies_1.return)) _b.call(modies_1);
|
|
62
|
-
}
|
|
63
|
-
finally { if (e_1) throw e_1.error; }
|
|
64
|
-
return [7 /*endfinally*/];
|
|
65
|
-
case 9: return [2 /*return*/, modies.length];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
exports.default = triggers;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var triggers = [
|
|
5
|
+
{
|
|
6
|
+
name: '当modi被应用时,将相应的operate完成',
|
|
7
|
+
entity: 'modi',
|
|
8
|
+
action: 'apply',
|
|
9
|
+
when: 'after',
|
|
10
|
+
fn: function (_a, context, option) {
|
|
11
|
+
var operation = _a.operation;
|
|
12
|
+
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
13
|
+
var filter, modies, modies_1, modies_1_1, modi, targetEntity, id, action, data, filter_1, e_1_1;
|
|
14
|
+
var e_1, _b;
|
|
15
|
+
return tslib_1.__generator(this, function (_c) {
|
|
16
|
+
switch (_c.label) {
|
|
17
|
+
case 0:
|
|
18
|
+
filter = operation.filter;
|
|
19
|
+
return [4 /*yield*/, context.select('modi', {
|
|
20
|
+
data: {
|
|
21
|
+
id: 1,
|
|
22
|
+
action: 1,
|
|
23
|
+
data: 1,
|
|
24
|
+
filter: 1,
|
|
25
|
+
targetEntity: 1,
|
|
26
|
+
},
|
|
27
|
+
filter: filter,
|
|
28
|
+
}, option)];
|
|
29
|
+
case 1:
|
|
30
|
+
modies = _c.sent();
|
|
31
|
+
_c.label = 2;
|
|
32
|
+
case 2:
|
|
33
|
+
_c.trys.push([2, 7, 8, 9]);
|
|
34
|
+
modies_1 = tslib_1.__values(modies), modies_1_1 = modies_1.next();
|
|
35
|
+
_c.label = 3;
|
|
36
|
+
case 3:
|
|
37
|
+
if (!!modies_1_1.done) return [3 /*break*/, 6];
|
|
38
|
+
modi = modies_1_1.value;
|
|
39
|
+
targetEntity = modi.targetEntity, id = modi.id, action = modi.action, data = modi.data, filter_1 = modi.filter;
|
|
40
|
+
return [4 /*yield*/, context.operate(targetEntity, {
|
|
41
|
+
id: id,
|
|
42
|
+
action: action,
|
|
43
|
+
data: data,
|
|
44
|
+
filter: filter_1,
|
|
45
|
+
}, Object.assign({}, option, {
|
|
46
|
+
blockTrigger: true,
|
|
47
|
+
}))];
|
|
48
|
+
case 4:
|
|
49
|
+
_c.sent();
|
|
50
|
+
_c.label = 5;
|
|
51
|
+
case 5:
|
|
52
|
+
modies_1_1 = modies_1.next();
|
|
53
|
+
return [3 /*break*/, 3];
|
|
54
|
+
case 6: return [3 /*break*/, 9];
|
|
55
|
+
case 7:
|
|
56
|
+
e_1_1 = _c.sent();
|
|
57
|
+
e_1 = { error: e_1_1 };
|
|
58
|
+
return [3 /*break*/, 9];
|
|
59
|
+
case 8:
|
|
60
|
+
try {
|
|
61
|
+
if (modies_1_1 && !modies_1_1.done && (_b = modies_1.return)) _b.call(modies_1);
|
|
62
|
+
}
|
|
63
|
+
finally { if (e_1) throw e_1.error; }
|
|
64
|
+
return [7 /*endfinally*/];
|
|
65
|
+
case 9: return [2 /*return*/, modies.length];
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
exports.default = triggers;
|
package/lib/types/Action.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CascadeRelationItem, EntityDict } from "./Entity";
|
|
2
|
-
import { GenericAction } from '../actions/action';
|
|
3
|
-
export declare type Action = string;
|
|
4
|
-
export declare type State = string;
|
|
5
|
-
export declare type ActionDef<A extends Action, S extends State> = {
|
|
6
|
-
stm: {
|
|
7
|
-
[a in A]: [p: S | S[], n: S];
|
|
8
|
-
};
|
|
9
|
-
is?: S;
|
|
10
|
-
};
|
|
11
|
-
export declare type ActionDictOfEntityDict<E extends EntityDict> = {
|
|
12
|
-
[T in keyof E]?: {
|
|
13
|
-
[A in keyof E[T]['OpSchema']]?: ActionDef<string, string>;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export declare type CascadeActionAuth<A extends Action = ''> = {
|
|
17
|
-
[K in A | GenericAction]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[];
|
|
18
|
-
};
|
|
1
|
+
import { CascadeRelationItem, EntityDict } from "./Entity";
|
|
2
|
+
import { GenericAction } from '../actions/action';
|
|
3
|
+
export declare type Action = string;
|
|
4
|
+
export declare type State = string;
|
|
5
|
+
export declare type ActionDef<A extends Action, S extends State> = {
|
|
6
|
+
stm: {
|
|
7
|
+
[a in A]: [p: S | S[], n: S];
|
|
8
|
+
};
|
|
9
|
+
is?: S;
|
|
10
|
+
};
|
|
11
|
+
export declare type ActionDictOfEntityDict<E extends EntityDict> = {
|
|
12
|
+
[T in keyof E]?: {
|
|
13
|
+
[A in keyof E[T]['OpSchema']]?: ActionDef<string, string>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare type CascadeActionAuth<A extends Action = ''> = {
|
|
17
|
+
[K in A | GenericAction]?: CascadeRelationItem | (CascadeRelationItem | CascadeRelationItem[])[];
|
|
18
|
+
};
|
package/lib/types/Action.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/types/AppLoader.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AsyncContext, AsyncRowStore } from "../store/AsyncRowStore";
|
|
2
|
-
import { EntityDict } from "./Entity";
|
|
3
|
-
export declare abstract class AppLoader<ED extends EntityDict, Cxt extends AsyncContext<ED>> {
|
|
4
|
-
protected path: string;
|
|
5
|
-
constructor(path: string);
|
|
6
|
-
abstract execAspect(name: string, context: Cxt, params?: any): Promise<any>;
|
|
7
|
-
abstract initialize(dropIfExists?: boolean): Promise<void>;
|
|
8
|
-
abstract mount(): Promise<void>;
|
|
9
|
-
abstract unmount(): Promise<void>;
|
|
10
|
-
abstract getStore(): AsyncRowStore<ED, Cxt>;
|
|
11
|
-
}
|
|
1
|
+
import { AsyncContext, AsyncRowStore } from "../store/AsyncRowStore";
|
|
2
|
+
import { EntityDict } from "./Entity";
|
|
3
|
+
export declare abstract class AppLoader<ED extends EntityDict, Cxt extends AsyncContext<ED>> {
|
|
4
|
+
protected path: string;
|
|
5
|
+
constructor(path: string);
|
|
6
|
+
abstract execAspect(name: string, context: Cxt, params?: any): Promise<any>;
|
|
7
|
+
abstract initialize(dropIfExists?: boolean): Promise<void>;
|
|
8
|
+
abstract mount(): Promise<void>;
|
|
9
|
+
abstract unmount(): Promise<void>;
|
|
10
|
+
abstract getStore(): AsyncRowStore<ED, Cxt>;
|
|
11
|
+
}
|
package/lib/types/AppLoader.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppLoader = void 0;
|
|
4
|
-
var AppLoader = /** @class */ (function () {
|
|
5
|
-
function AppLoader(path) {
|
|
6
|
-
this.path = path;
|
|
7
|
-
}
|
|
8
|
-
return AppLoader;
|
|
9
|
-
}());
|
|
10
|
-
exports.AppLoader = AppLoader;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppLoader = void 0;
|
|
4
|
+
var AppLoader = /** @class */ (function () {
|
|
5
|
+
function AppLoader(path) {
|
|
6
|
+
this.path = path;
|
|
7
|
+
}
|
|
8
|
+
return AppLoader;
|
|
9
|
+
}());
|
|
10
|
+
exports.AppLoader = AppLoader;
|
package/lib/types/Aspect.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { EntityDict } from "./Entity";
|
|
2
|
-
import { OpRecord } from "./Entity";
|
|
3
|
-
import { AsyncContext } from "../store/AsyncRowStore";
|
|
4
|
-
export interface Aspect<ED extends EntityDict, Cxt extends AsyncContext<ED>> {
|
|
5
|
-
(params: any, context: Cxt): Promise<any>;
|
|
6
|
-
}
|
|
7
|
-
export interface AspectWrapper<ED extends EntityDict, Cxt extends AsyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>> {
|
|
8
|
-
exec: <T extends keyof AD>(name: T, params: Parameters<AD[T]>[0]) => Promise<{
|
|
9
|
-
result: Awaited<ReturnType<AD[T]>>;
|
|
10
|
-
opRecords: OpRecord<ED>[];
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
1
|
+
import { EntityDict } from "./Entity";
|
|
2
|
+
import { OpRecord } from "./Entity";
|
|
3
|
+
import { AsyncContext } from "../store/AsyncRowStore";
|
|
4
|
+
export interface Aspect<ED extends EntityDict, Cxt extends AsyncContext<ED>> {
|
|
5
|
+
(params: any, context: Cxt): Promise<any>;
|
|
6
|
+
}
|
|
7
|
+
export interface AspectWrapper<ED extends EntityDict, Cxt extends AsyncContext<ED>, AD extends Record<string, Aspect<ED, Cxt>>> {
|
|
8
|
+
exec: <T extends keyof AD>(name: T, params: Parameters<AD[T]>[0]) => Promise<{
|
|
9
|
+
result: Awaited<ReturnType<AD[T]>>;
|
|
10
|
+
opRecords: OpRecord<ED>[];
|
|
11
|
+
}>;
|
|
12
|
+
}
|
package/lib/types/Aspect.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
;
|
|
4
|
-
;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
;
|
|
4
|
+
;
|
package/lib/types/Auth.d.ts
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { CascadeActionAuth, CascadeRelationAuth } from ".";
|
|
2
|
-
import { AsyncContext } from "../store/AsyncRowStore";
|
|
3
|
-
import { SyncContext } from "../store/SyncRowStore";
|
|
4
|
-
import { EntityDict, OperateOption, SelectOption } from "../types/Entity";
|
|
5
|
-
export declare type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation';
|
|
6
|
-
/**
|
|
7
|
-
* conditionalFilter是指该action发生时,operation所操作的行中有满足conditionalFilter的行
|
|
8
|
-
* 被转化成trigger的filter条件,详细可看trigger中的说明
|
|
9
|
-
*/
|
|
10
|
-
export declare type DataChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
11
|
-
priority?: number;
|
|
12
|
-
type: 'data';
|
|
13
|
-
entity: T;
|
|
14
|
-
action: Omit<ED[T]['Action'], 'remove'> | Array<Omit<ED[T]['Action'], 'remove'>>;
|
|
15
|
-
checker: (data: ED[T]['Create']['data'] | ED[T]['Update']['data'], context: Cxt) => void | Promise<void>;
|
|
16
|
-
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter'] | Promise<ED[T]['Selection']['filter']>);
|
|
17
|
-
};
|
|
18
|
-
export declare type RowChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
19
|
-
priority?: number;
|
|
20
|
-
type: 'row';
|
|
21
|
-
entity: T;
|
|
22
|
-
action: Omit<ED[T]['Action'], 'create'> | Array<Omit<ED[T]['Action'], 'create'>>;
|
|
23
|
-
filter: ED[T]['Selection']['filter'] | ((operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => ED[T]['Selection']['filter'] | Promise<ED[T]['Selection']['filter']>);
|
|
24
|
-
errMsg?: string;
|
|
25
|
-
inconsistentRows?: {
|
|
26
|
-
entity: keyof ED;
|
|
27
|
-
selection: (filter?: ED[T]['Selection']['filter']) => ED[keyof ED]['Selection'];
|
|
28
|
-
};
|
|
29
|
-
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter'] | Promise<ED[T]['Update']['filter']>);
|
|
30
|
-
};
|
|
31
|
-
export declare type RelationChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
32
|
-
priority?: number;
|
|
33
|
-
type: 'relation';
|
|
34
|
-
entity: T;
|
|
35
|
-
when?: 'after';
|
|
36
|
-
action: ED[T]['Action'] | Array<ED[T]['Action']>;
|
|
37
|
-
relationFilter: (operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => ED[T]['Selection']['filter'] | Promise<ED[T]['Selection']['filter']>;
|
|
38
|
-
errMsg: string;
|
|
39
|
-
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter'] | Promise<ED[T]['Selection']['filter']>);
|
|
40
|
-
};
|
|
41
|
-
export declare type LogicalChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
42
|
-
priority?: number;
|
|
43
|
-
type: 'logical';
|
|
44
|
-
when?: 'after';
|
|
45
|
-
entity: T;
|
|
46
|
-
action: ED[T]['Action'] | Array<ED[T]['Action']>;
|
|
47
|
-
checker: (operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => void | Promise<void>;
|
|
48
|
-
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter']);
|
|
49
|
-
};
|
|
50
|
-
export declare type LogicalRelationChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
51
|
-
priority?: number;
|
|
52
|
-
type: 'logicalRelation';
|
|
53
|
-
when?: 'after';
|
|
54
|
-
entity: T;
|
|
55
|
-
action: ED[T]['Action'] | Array<ED[T]['Action']>;
|
|
56
|
-
checker: (operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => void | Promise<void>;
|
|
57
|
-
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter']);
|
|
58
|
-
};
|
|
59
|
-
export declare type Checker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = DataChecker<ED, T, Cxt> | RowChecker<ED, T, Cxt> | RelationChecker<ED, T, Cxt> | LogicalChecker<ED, T, Cxt> | LogicalRelationChecker<ED, T, Cxt>;
|
|
60
|
-
export declare type AuthDef<ED extends EntityDict, T extends keyof ED> = {
|
|
61
|
-
relationAuth?: CascadeRelationAuth<NonNullable<ED[T]['Relation']>>;
|
|
62
|
-
actionAuth?: CascadeActionAuth<ED[T]['Action']>;
|
|
63
|
-
};
|
|
64
|
-
export declare type AuthDefDict<ED extends EntityDict> = {
|
|
65
|
-
[K in keyof ED]?: AuthDef<ED, K>;
|
|
66
|
-
};
|
|
1
|
+
import { CascadeActionAuth, CascadeRelationAuth } from ".";
|
|
2
|
+
import { AsyncContext } from "../store/AsyncRowStore";
|
|
3
|
+
import { SyncContext } from "../store/SyncRowStore";
|
|
4
|
+
import { EntityDict, OperateOption, SelectOption } from "../types/Entity";
|
|
5
|
+
export declare type CheckerType = 'relation' | 'row' | 'data' | 'logical' | 'logicalRelation';
|
|
6
|
+
/**
|
|
7
|
+
* conditionalFilter是指该action发生时,operation所操作的行中有满足conditionalFilter的行
|
|
8
|
+
* 被转化成trigger的filter条件,详细可看trigger中的说明
|
|
9
|
+
*/
|
|
10
|
+
export declare type DataChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
11
|
+
priority?: number;
|
|
12
|
+
type: 'data';
|
|
13
|
+
entity: T;
|
|
14
|
+
action: Omit<ED[T]['Action'], 'remove'> | Array<Omit<ED[T]['Action'], 'remove'>>;
|
|
15
|
+
checker: (data: ED[T]['Create']['data'] | ED[T]['Update']['data'], context: Cxt) => void | Promise<void>;
|
|
16
|
+
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter'] | Promise<ED[T]['Selection']['filter']>);
|
|
17
|
+
};
|
|
18
|
+
export declare type RowChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
19
|
+
priority?: number;
|
|
20
|
+
type: 'row';
|
|
21
|
+
entity: T;
|
|
22
|
+
action: Omit<ED[T]['Action'], 'create'> | Array<Omit<ED[T]['Action'], 'create'>>;
|
|
23
|
+
filter: ED[T]['Selection']['filter'] | ((operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => ED[T]['Selection']['filter'] | Promise<ED[T]['Selection']['filter']>);
|
|
24
|
+
errMsg?: string;
|
|
25
|
+
inconsistentRows?: {
|
|
26
|
+
entity: keyof ED;
|
|
27
|
+
selection: (filter?: ED[T]['Selection']['filter']) => ED[keyof ED]['Selection'];
|
|
28
|
+
};
|
|
29
|
+
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter'] | Promise<ED[T]['Update']['filter']>);
|
|
30
|
+
};
|
|
31
|
+
export declare type RelationChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
32
|
+
priority?: number;
|
|
33
|
+
type: 'relation';
|
|
34
|
+
entity: T;
|
|
35
|
+
when?: 'after';
|
|
36
|
+
action: ED[T]['Action'] | Array<ED[T]['Action']>;
|
|
37
|
+
relationFilter: (operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => ED[T]['Selection']['filter'] | Promise<ED[T]['Selection']['filter']>;
|
|
38
|
+
errMsg: string;
|
|
39
|
+
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter'] | Promise<ED[T]['Selection']['filter']>);
|
|
40
|
+
};
|
|
41
|
+
export declare type LogicalChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
42
|
+
priority?: number;
|
|
43
|
+
type: 'logical';
|
|
44
|
+
when?: 'after';
|
|
45
|
+
entity: T;
|
|
46
|
+
action: ED[T]['Action'] | Array<ED[T]['Action']>;
|
|
47
|
+
checker: (operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => void | Promise<void>;
|
|
48
|
+
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter']);
|
|
49
|
+
};
|
|
50
|
+
export declare type LogicalRelationChecker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = {
|
|
51
|
+
priority?: number;
|
|
52
|
+
type: 'logicalRelation';
|
|
53
|
+
when?: 'after';
|
|
54
|
+
entity: T;
|
|
55
|
+
action: ED[T]['Action'] | Array<ED[T]['Action']>;
|
|
56
|
+
checker: (operation: ED[T]['Operation'] | ED[T]['Selection'], context: Cxt, option: OperateOption | SelectOption) => void | Promise<void>;
|
|
57
|
+
conditionalFilter?: ED[T]['Update']['filter'] | ((operation: ED[T]['Operation'], context: Cxt, option: OperateOption) => ED[T]['Update']['filter']);
|
|
58
|
+
};
|
|
59
|
+
export declare type Checker<ED extends EntityDict, T extends keyof ED, Cxt extends AsyncContext<ED> | SyncContext<ED>> = DataChecker<ED, T, Cxt> | RowChecker<ED, T, Cxt> | RelationChecker<ED, T, Cxt> | LogicalChecker<ED, T, Cxt> | LogicalRelationChecker<ED, T, Cxt>;
|
|
60
|
+
export declare type AuthDef<ED extends EntityDict, T extends keyof ED> = {
|
|
61
|
+
relationAuth?: CascadeRelationAuth<NonNullable<ED[T]['Relation']>>;
|
|
62
|
+
actionAuth?: CascadeActionAuth<ED[T]['Action']>;
|
|
63
|
+
};
|
|
64
|
+
export declare type AuthDefDict<ED extends EntityDict> = {
|
|
65
|
+
[K in keyof ED]?: AuthDef<ED, K>;
|
|
66
|
+
};
|
package/lib/types/Auth.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/types/Connector.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IncomingHttpHeaders } from "http";
|
|
3
|
-
import { AsyncContext, AsyncRowStore } from "../store/AsyncRowStore";
|
|
4
|
-
import { SyncContext } from "../store/SyncRowStore";
|
|
5
|
-
import { EntityDict, OpRecord } from "./Entity";
|
|
6
|
-
import { OakException } from "./Exception";
|
|
7
|
-
export declare abstract class Connector<ED extends EntityDict, BackCxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>> {
|
|
8
|
-
abstract callAspect(name: string, params: any, context: FrontCxt): Promise<{
|
|
9
|
-
result: any;
|
|
10
|
-
opRecords: OpRecord<ED>[];
|
|
11
|
-
}>;
|
|
12
|
-
abstract getRouter(): string;
|
|
13
|
-
abstract parseRequest(headers: IncomingHttpHeaders, body: any, store: AsyncRowStore<ED, BackCxt>): Promise<{
|
|
14
|
-
name: string;
|
|
15
|
-
params: any;
|
|
16
|
-
context: BackCxt;
|
|
17
|
-
}>;
|
|
18
|
-
abstract serializeResult(result: any, context: BackCxt, headers: IncomingHttpHeaders, body: any): {
|
|
19
|
-
body: any;
|
|
20
|
-
headers?: Record<string, any>;
|
|
21
|
-
};
|
|
22
|
-
abstract serializeException(exception: OakException, headers: IncomingHttpHeaders, body: any): {
|
|
23
|
-
body: any;
|
|
24
|
-
headers?: Record<string, any>;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IncomingHttpHeaders } from "http";
|
|
3
|
+
import { AsyncContext, AsyncRowStore } from "../store/AsyncRowStore";
|
|
4
|
+
import { SyncContext } from "../store/SyncRowStore";
|
|
5
|
+
import { EntityDict, OpRecord } from "./Entity";
|
|
6
|
+
import { OakException } from "./Exception";
|
|
7
|
+
export declare abstract class Connector<ED extends EntityDict, BackCxt extends AsyncContext<ED>, FrontCxt extends SyncContext<ED>> {
|
|
8
|
+
abstract callAspect(name: string, params: any, context: FrontCxt): Promise<{
|
|
9
|
+
result: any;
|
|
10
|
+
opRecords: OpRecord<ED>[];
|
|
11
|
+
}>;
|
|
12
|
+
abstract getRouter(): string;
|
|
13
|
+
abstract parseRequest(headers: IncomingHttpHeaders, body: any, store: AsyncRowStore<ED, BackCxt>): Promise<{
|
|
14
|
+
name: string;
|
|
15
|
+
params: any;
|
|
16
|
+
context: BackCxt;
|
|
17
|
+
}>;
|
|
18
|
+
abstract serializeResult(result: any, context: BackCxt, headers: IncomingHttpHeaders, body: any): {
|
|
19
|
+
body: any;
|
|
20
|
+
headers?: Record<string, any>;
|
|
21
|
+
};
|
|
22
|
+
abstract serializeException(exception: OakException, headers: IncomingHttpHeaders, body: any): {
|
|
23
|
+
body: any;
|
|
24
|
+
headers?: Record<string, any>;
|
|
25
|
+
};
|
|
26
|
+
}
|
package/lib/types/Connector.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Connector = void 0;
|
|
4
|
-
var Connector = /** @class */ (function () {
|
|
5
|
-
function Connector() {
|
|
6
|
-
}
|
|
7
|
-
return Connector;
|
|
8
|
-
}());
|
|
9
|
-
exports.Connector = Connector;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Connector = void 0;
|
|
4
|
+
var Connector = /** @class */ (function () {
|
|
5
|
+
function Connector() {
|
|
6
|
+
}
|
|
7
|
+
return Connector;
|
|
8
|
+
}());
|
|
9
|
+
exports.Connector = Connector;
|
package/lib/types/Context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface Context {
|
|
2
|
-
getCurrentTxnId(): string | undefined;
|
|
3
|
-
getCurrentUserId(allowUnloggedIn?: boolean): string | undefined;
|
|
4
|
-
isRoot(): boolean;
|
|
5
|
-
allowUserUpdate(): boolean;
|
|
6
|
-
toString(): string;
|
|
7
|
-
}
|
|
1
|
+
export interface Context {
|
|
2
|
+
getCurrentTxnId(): string | undefined;
|
|
3
|
+
getCurrentUserId(allowUnloggedIn?: boolean): string | undefined;
|
|
4
|
+
isRoot(): boolean;
|
|
5
|
+
allowUserUpdate(): boolean;
|
|
6
|
+
toString(): string;
|
|
7
|
+
}
|
package/lib/types/Context.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
;
|
package/lib/types/DataType.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Geo, SingleGeo } from "./Geo";
|
|
2
|
-
export declare type Int<L extends 1 | 2 | 4 | 8> = number;
|
|
3
|
-
export declare type Uint<L extends 1 | 2 | 4 | 8> = number;
|
|
4
|
-
export declare type Double<P extends number, S extends number> = number;
|
|
5
|
-
export declare type Float<P extends number, S extends number> = number;
|
|
6
|
-
export declare type String<L extends number> = string;
|
|
7
|
-
export declare type Text = string;
|
|
8
|
-
export declare type Image = string;
|
|
9
|
-
export declare type File = string;
|
|
10
|
-
export declare type Datetime = number | Date;
|
|
11
|
-
export declare type Boolean = boolean;
|
|
12
|
-
export declare type PrimaryKey = string;
|
|
13
|
-
export declare type ForeignKey<E extends string> = string;
|
|
14
|
-
export declare type Sequence = string;
|
|
15
|
-
export { Geo, SingleGeo } from './Geo';
|
|
16
|
-
export declare type DataTypes = number | string | Datetime | Geo | Object | SingleGeo;
|
|
17
|
-
export declare const types: string[];
|
|
18
|
-
export declare const unIndexedTypes: string[];
|
|
1
|
+
import { Geo, SingleGeo } from "./Geo";
|
|
2
|
+
export declare type Int<L extends 1 | 2 | 4 | 8> = number;
|
|
3
|
+
export declare type Uint<L extends 1 | 2 | 4 | 8> = number;
|
|
4
|
+
export declare type Double<P extends number, S extends number> = number;
|
|
5
|
+
export declare type Float<P extends number, S extends number> = number;
|
|
6
|
+
export declare type String<L extends number> = string;
|
|
7
|
+
export declare type Text = string;
|
|
8
|
+
export declare type Image = string;
|
|
9
|
+
export declare type File = string;
|
|
10
|
+
export declare type Datetime = number | Date;
|
|
11
|
+
export declare type Boolean = boolean;
|
|
12
|
+
export declare type PrimaryKey = string;
|
|
13
|
+
export declare type ForeignKey<E extends string> = string;
|
|
14
|
+
export declare type Sequence = string;
|
|
15
|
+
export { Geo, SingleGeo } from './Geo';
|
|
16
|
+
export declare type DataTypes = number | string | Datetime | Geo | Object | SingleGeo;
|
|
17
|
+
export declare const types: string[];
|
|
18
|
+
export declare const unIndexedTypes: string[];
|
package/lib/types/DataType.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unIndexedTypes = exports.types = void 0;
|
|
4
|
-
exports.types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo'];
|
|
5
|
-
exports.unIndexedTypes = ['Text', 'Image', 'File', 'Object'];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unIndexedTypes = exports.types = void 0;
|
|
4
|
+
exports.types = ['Int', 'Uint', 'Double', 'Float', 'String', 'Text', 'Datetime', 'Boolean', 'Image', 'File', 'Geo', 'SingleGeo'];
|
|
5
|
+
exports.unIndexedTypes = ['Text', 'Image', 'File', 'Object'];
|