oak-domain 5.1.30 → 5.1.32
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/compiler/dependencyBuilder.js +2 -3
- package/lib/compiler/localeBuilder.d.ts +0 -1
- package/lib/compiler/routerBuilder.js +1 -2
- package/lib/compiler/schemalBuilder.js +12 -12
- package/lib/store/AsyncRowStore.d.ts +0 -1
- package/lib/store/CascadeStore.d.ts +1 -1
- package/lib/store/CascadeStore.js +2 -2
- package/lib/store/IntrinsicCheckers.js +1 -2
- package/lib/store/IntrinsicLogics.js +1 -2
- package/lib/store/RelationAuth.js +2 -2
- package/lib/store/checker.js +4 -5
- package/lib/store/filter.js +12 -13
- package/lib/store/modi.js +5 -6
- package/lib/store/relation.js +1 -2
- package/lib/timers/oper.js +1 -2
- package/lib/timers/vaccum.js +1 -2
- package/lib/types/AppLoader.d.ts +0 -1
- package/lib/types/Connector.d.ts +0 -1
- package/lib/types/Demand.js +2 -2
- package/lib/types/Endpoint.d.ts +0 -1
- package/lib/types/Exception.js +2 -2
- package/lib/types/Expression.js +12 -13
- package/lib/types/Timer.d.ts +1 -0
- package/lib/utils/SimpleConnector.d.ts +2 -3
- package/lib/utils/assert.d.ts +0 -1
- package/lib/utils/date.js +1 -2
- package/lib/utils/domain.js +1 -2
- package/lib/utils/executor.js +1 -2
- package/lib/utils/geo.js +5 -6
- package/lib/utils/lodash.js +3 -3
- package/lib/utils/module/combine.common.js +1 -1
- package/lib/utils/module/combine.dev.d.ts +1 -1
- package/lib/utils/module/combine.dev.js +1 -1
- package/lib/utils/module/combine.prod.js +1 -1
- package/lib/utils/module/combine.server.d.ts +1 -1
- package/lib/utils/module/combine.server.js +1 -1
- package/lib/utils/money.d.ts +1 -1
- package/lib/utils/money.js +32 -21
- package/lib/utils/operationResult.js +1 -2
- package/lib/utils/projection.js +2 -3
- package/lib/utils/random/random.js +1 -2
- package/lib/utils/random/random.mp.d.ts +1 -1
- package/lib/utils/random/random.mp.js +1 -2
- package/lib/utils/random/random.native.d.ts +1 -1
- package/lib/utils/random/random.native.js +1 -2
- package/lib/utils/random/random.web.d.ts +1 -1
- package/lib/utils/random/random.web.js +1 -2
- package/lib/utils/relationPath.js +3 -4
- package/lib/utils/row.js +2 -3
- package/lib/utils/string.js +4 -4
- package/lib/utils/url/index.d.ts +0 -1
- package/lib/utils/url/index.native.d.ts +4 -3
- package/lib/utils/url/index.web.d.ts +4 -3
- package/lib/utils/url/whatwg-url/lib/URL-impl.d.ts +15 -8
- package/lib/utils/url/whatwg-url/lib/infra.js +4 -5
- package/lib/utils/url/whatwg-url/lib/urlencoded.d.ts +1 -2
- package/lib/utils/url/whatwg-url/lib/utils.d.ts +1 -1
- package/lib/utils/uuid.js +10 -11
- package/lib/utils/validator.js +3 -3
- package/lib/utils/version.js +2 -3
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.analyzeDepedency =
|
|
3
|
+
exports.analyzeDepedency = analyzeDepedency;
|
|
4
|
+
exports.default = buildDependency;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
7
|
const path_1 = require("path");
|
|
@@ -87,7 +88,6 @@ function analyzeDepedency(cwd) {
|
|
|
87
88
|
} while (true);
|
|
88
89
|
return depGraph;
|
|
89
90
|
}
|
|
90
|
-
exports.analyzeDepedency = analyzeDepedency;
|
|
91
91
|
function join(...paths) {
|
|
92
92
|
const path = (0, path_1.join)(...paths);
|
|
93
93
|
return path.replaceAll('\\', '/');
|
|
@@ -1030,4 +1030,3 @@ function buildDependency(rebuild) {
|
|
|
1030
1030
|
tryCopyModuleTemplateFiles(cwd, dependencies, briefNames, printer, rebuild);
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
|
-
exports.default = buildDependency;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildRouter =
|
|
3
|
+
exports.buildRouter = buildRouter;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const fs_extra_1 = require("fs-extra");
|
|
@@ -254,4 +254,3 @@ function buildRouter(projectDir, startupDir, watch) {
|
|
|
254
254
|
watchDir(projectDir, startupDir, type);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
exports.buildRouter = buildRouter;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAnalizedSchema = void 0;
|
|
4
|
+
exports.constructAttributes = constructAttributes;
|
|
5
|
+
exports.translateLocaleObject = translateLocaleObject;
|
|
6
|
+
exports.registerIgnoredForeignKeyMap = registerIgnoredForeignKeyMap;
|
|
7
|
+
exports.registerFreeEntities = registerFreeEntities;
|
|
8
|
+
exports.registerIgnoredRelationPathMap = registerIgnoredRelationPathMap;
|
|
9
|
+
exports.registerFixedDestinationPathMap = registerFixedDestinationPathMap;
|
|
10
|
+
exports.registerDeducedRelationMap = registerDeducedRelationMap;
|
|
11
|
+
exports.analyzeEntities = analyzeEntities;
|
|
12
|
+
exports.buildSchemaBackup = buildSchemaBackup;
|
|
13
|
+
exports.getProjectionKeys = getProjectionKeys;
|
|
14
|
+
exports.buildSchema = buildSchema;
|
|
4
15
|
const tslib_1 = require("tslib");
|
|
5
16
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
17
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
@@ -4072,7 +4083,6 @@ function constructAttributes(entity) {
|
|
|
4072
4083
|
});
|
|
4073
4084
|
return result;
|
|
4074
4085
|
}
|
|
4075
|
-
exports.constructAttributes = constructAttributes;
|
|
4076
4086
|
function translateLocaleObject(locale) {
|
|
4077
4087
|
const result = {};
|
|
4078
4088
|
locale.properties.forEach((ele) => {
|
|
@@ -4091,7 +4101,6 @@ function translateLocaleObject(locale) {
|
|
|
4091
4101
|
});
|
|
4092
4102
|
return result;
|
|
4093
4103
|
}
|
|
4094
|
-
exports.translateLocaleObject = translateLocaleObject;
|
|
4095
4104
|
function outputLocale(outputDir, printer) {
|
|
4096
4105
|
const locales = {};
|
|
4097
4106
|
const entities = [];
|
|
@@ -4366,7 +4375,6 @@ let FIXED_FOR_ALL_DESTINATION_PATH_ENTITIES = [];
|
|
|
4366
4375
|
function registerIgnoredForeignKeyMap(map) {
|
|
4367
4376
|
IGNORED_FOREIGN_KEY_MAP = map;
|
|
4368
4377
|
}
|
|
4369
|
-
exports.registerIgnoredForeignKeyMap = registerIgnoredForeignKeyMap;
|
|
4370
4378
|
/**
|
|
4371
4379
|
* 此函数不再使用
|
|
4372
4380
|
* @param map
|
|
@@ -4376,7 +4384,6 @@ function registerFreeEntities(selectFreeEntities = [], createFreeEntities = [],
|
|
|
4376
4384
|
CREATE_FREE_ENTITIES = createFreeEntities;
|
|
4377
4385
|
UPDATE_FREE_ENTITIES = updateFreeEntities;
|
|
4378
4386
|
}
|
|
4379
|
-
exports.registerFreeEntities = registerFreeEntities;
|
|
4380
4387
|
/**
|
|
4381
4388
|
* 此函数不再使用
|
|
4382
4389
|
* @param map
|
|
@@ -4386,7 +4393,6 @@ function registerIgnoredRelationPathMap(map) {
|
|
|
4386
4393
|
IGNORED_RELATION_PATH_MAP[(0, string_1.firstLetterUpperCase)(k)] = map[k];
|
|
4387
4394
|
}
|
|
4388
4395
|
}
|
|
4389
|
-
exports.registerIgnoredRelationPathMap = registerIgnoredRelationPathMap;
|
|
4390
4396
|
/**
|
|
4391
4397
|
* 很多路径虽然最后指向同一对象,但不能封掉,封了会导致查询的时候找不到对应的路径path
|
|
4392
4398
|
* @param map
|
|
@@ -4404,7 +4410,6 @@ function registerFixedDestinationPathMap(map) {
|
|
|
4404
4410
|
}
|
|
4405
4411
|
}
|
|
4406
4412
|
}
|
|
4407
|
-
exports.registerFixedDestinationPathMap = registerFixedDestinationPathMap;
|
|
4408
4413
|
/**
|
|
4409
4414
|
* 此函数不再使用
|
|
4410
4415
|
* @param map
|
|
@@ -4423,7 +4428,6 @@ function registerDeducedRelationMap(map) {
|
|
|
4423
4428
|
DEDUCED_RELATION_MAP[entity] = map[k];
|
|
4424
4429
|
}
|
|
4425
4430
|
}
|
|
4426
|
-
exports.registerDeducedRelationMap = registerDeducedRelationMap;
|
|
4427
4431
|
/**
|
|
4428
4432
|
* 输出所有和User相关的对象的后继
|
|
4429
4433
|
* 此函数不再使用
|
|
@@ -4929,7 +4933,6 @@ function analyzeEntities(inputDir, relativePath) {
|
|
|
4929
4933
|
analyzeInModi();
|
|
4930
4934
|
uniqRelationships();
|
|
4931
4935
|
}
|
|
4932
|
-
exports.analyzeEntities = analyzeEntities;
|
|
4933
4936
|
function buildSchemaBackup(outputDir) {
|
|
4934
4937
|
addReverseRelationship();
|
|
4935
4938
|
// setRelationEntities();
|
|
@@ -4948,7 +4951,6 @@ function buildSchemaBackup(outputDir) {
|
|
|
4948
4951
|
outputPackageJson(outputDir);
|
|
4949
4952
|
}
|
|
4950
4953
|
}
|
|
4951
|
-
exports.buildSchemaBackup = buildSchemaBackup;
|
|
4952
4954
|
function _getAggrKey(entity, foreignKey) {
|
|
4953
4955
|
const aggrKey = `${entity}$${foreignKey}`;
|
|
4954
4956
|
if (process.env.COMPLING_AS_LIB) {
|
|
@@ -5688,7 +5690,6 @@ function getProjectionKeys(entity) {
|
|
|
5688
5690
|
}
|
|
5689
5691
|
return [...new Set([...keys, ...getOpProjectionKeys(entity)])];
|
|
5690
5692
|
}
|
|
5691
|
-
exports.getProjectionKeys = getProjectionKeys;
|
|
5692
5693
|
function _outputSchema(outputDir, printer) {
|
|
5693
5694
|
for (const entity in Schema) {
|
|
5694
5695
|
const statements = [
|
|
@@ -5723,4 +5724,3 @@ function buildSchema(outputDir) {
|
|
|
5723
5724
|
outputStyleDict(outputDir, printer);
|
|
5724
5725
|
outputIndexTs(outputDir);
|
|
5725
5726
|
}
|
|
5726
|
-
exports.buildSchema = buildSchema;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult, ClusterInfo, OakException } from "../types";
|
|
3
2
|
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
4
3
|
import { IncomingHttpHeaders } from "http";
|
|
@@ -35,7 +35,7 @@ export declare abstract class CascadeStore<ED extends EntityDict & BaseEntityDic
|
|
|
35
35
|
protected abstract aggregateAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, aggregation: ED[T]['Aggregation'], context: Cxt, option: OP): Promise<AggregationResult<ED[T]['Schema']>>;
|
|
36
36
|
protected destructCascadeSelect<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED> | AsyncContext<ED>>(entity: T, projection2: ED[T]['Projection'], context: Cxt, cascadeSelectFn: <T2 extends keyof ED>(entity2: T2, selection: ED[T2]['Selection'], context: Cxt, op: OP) => Partial<ED[T2]['Schema']>[] | Promise<Partial<ED[T2]['Schema']>[]>, aggregateFn: <T2 extends keyof ED>(entity2: T2, aggregation: ED[T2]['Aggregation'], context: Cxt, op: OP) => AggregationResult<ED[T2]['Schema']> | Promise<AggregationResult<ED[T2]['Schema']>>, option: OP, selectionId?: string): {
|
|
37
37
|
projection: ED[T]["Projection"];
|
|
38
|
-
cascadeSelectionFns: ((result: Partial<ED[T][
|
|
38
|
+
cascadeSelectionFns: ((result: Partial<ED[T]["Schema"]>[]) => Promise<void> | void)[];
|
|
39
39
|
};
|
|
40
40
|
/**
|
|
41
41
|
* 级联更新
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CascadeStore =
|
|
3
|
+
exports.CascadeStore = void 0;
|
|
4
|
+
exports.polishSelection = polishSelection;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
7
|
const Entity_1 = require("../types/Entity");
|
|
@@ -285,7 +286,6 @@ function polishSelection(schema, entity, selection, context, option) {
|
|
|
285
286
|
});
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
|
-
exports.polishSelection = polishSelection;
|
|
289
289
|
/**这个用来处理级联的select和update,对不同能力的 */
|
|
290
290
|
class CascadeStore extends RowStore_1.RowStore {
|
|
291
291
|
constructor(storageSchema) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeIntrinsicCheckers =
|
|
3
|
+
exports.makeIntrinsicCheckers = makeIntrinsicCheckers;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const lodash_1 = require("../utils/lodash");
|
|
@@ -398,4 +398,3 @@ function makeIntrinsicCheckers(schema, actionDefDict, attrUpdateMatrix) {
|
|
|
398
398
|
}
|
|
399
399
|
return checkers;
|
|
400
400
|
}
|
|
401
|
-
exports.makeIntrinsicCheckers = makeIntrinsicCheckers;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeIntrinsicLogics =
|
|
3
|
+
exports.makeIntrinsicLogics = makeIntrinsicLogics;
|
|
4
4
|
const triggers_1 = require("./triggers");
|
|
5
5
|
const modi_1 = require("./modi");
|
|
6
6
|
const IntrinsicCheckers_1 = require("./IntrinsicCheckers");
|
|
@@ -42,4 +42,3 @@ function makeIntrinsicLogics(schema, actionDefDict, attrUpdateMatrix) {
|
|
|
42
42
|
watchers,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
exports.makeIntrinsicLogics = makeIntrinsicLogics;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RelationAuth = void 0;
|
|
4
|
+
exports.getUserRelationsByActions = getUserRelationsByActions;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
7
|
const types_1 = require("../types");
|
|
@@ -1243,4 +1244,3 @@ async function getUserRelationsByActions(params, context) {
|
|
|
1243
1244
|
userEntities,
|
|
1244
1245
|
};
|
|
1245
1246
|
}
|
|
1246
|
-
exports.getUserRelationsByActions = getUserRelationsByActions;
|
package/lib/store/checker.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.translateCheckerInAsyncContext = translateCheckerInAsyncContext;
|
|
4
|
+
exports.translateCheckerInSyncContext = translateCheckerInSyncContext;
|
|
5
|
+
exports.createRemoveCheckers = createRemoveCheckers;
|
|
6
|
+
exports.createCreateCheckers = createCreateCheckers;
|
|
4
7
|
const tslib_1 = require("tslib");
|
|
5
8
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
9
|
const filter_1 = require("../store/filter");
|
|
@@ -127,7 +130,6 @@ function translateCheckerInAsyncContext(checker, schema) {
|
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
exports.translateCheckerInAsyncContext = translateCheckerInAsyncContext;
|
|
131
133
|
function translateCheckerInSyncContext(checker, schema) {
|
|
132
134
|
const { entity, type } = checker;
|
|
133
135
|
const when = 'before'; // 现在create的relation改成提前的expression检查了,原先是先插入再后检查,性能不行,而且select也需要实现前检查
|
|
@@ -186,7 +188,6 @@ function translateCheckerInSyncContext(checker, schema) {
|
|
|
186
188
|
}
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
|
-
exports.translateCheckerInSyncContext = translateCheckerInSyncContext;
|
|
190
191
|
/**
|
|
191
192
|
* 对对象的删除,检查其是否会产生其他行上的空指针,不允许这种情况的出现
|
|
192
193
|
* @param schema
|
|
@@ -331,7 +332,6 @@ function createRemoveCheckers(schema) {
|
|
|
331
332
|
}
|
|
332
333
|
return checkers;
|
|
333
334
|
}
|
|
334
|
-
exports.createRemoveCheckers = createRemoveCheckers;
|
|
335
335
|
function checkAttributeLegal(schema, entity, data) {
|
|
336
336
|
const { attributes } = schema[entity];
|
|
337
337
|
for (const attr in data) {
|
|
@@ -478,4 +478,3 @@ function createCreateCheckers(schema) {
|
|
|
478
478
|
}
|
|
479
479
|
return checkers;
|
|
480
480
|
}
|
|
481
|
-
exports.createCreateCheckers = createCreateCheckers;
|
package/lib/store/filter.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.translateCreateDataToFilter = translateCreateDataToFilter;
|
|
4
|
+
exports.combineFilters = combineFilters;
|
|
5
|
+
exports.judgeValueRelation = judgeValueRelation;
|
|
6
|
+
exports.analyzeFilterRelation = analyzeFilterRelation;
|
|
7
|
+
exports.contains = contains;
|
|
8
|
+
exports.getRelevantIds = getRelevantIds;
|
|
9
|
+
exports.same = same;
|
|
10
|
+
exports.makeTreeAncestorFilter = makeTreeAncestorFilter;
|
|
11
|
+
exports.makeTreeDescendantFilter = makeTreeDescendantFilter;
|
|
12
|
+
exports.checkFilterContains = checkFilterContains;
|
|
13
|
+
exports.checkFilterRepel = checkFilterRepel;
|
|
14
|
+
exports.translateFilterToObjectPredicate = translateFilterToObjectPredicate;
|
|
4
15
|
const tslib_1 = require("tslib");
|
|
5
16
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
17
|
const types_1 = require("../types");
|
|
@@ -36,7 +47,6 @@ function translateCreateDataToFilter(schema, entity, data, allowUnrecoganized) {
|
|
|
36
47
|
}
|
|
37
48
|
return data2;
|
|
38
49
|
}
|
|
39
|
-
exports.translateCreateDataToFilter = translateCreateDataToFilter;
|
|
40
50
|
/**
|
|
41
51
|
* 尽量合并外键的连接,防止在数据库中join的对象过多
|
|
42
52
|
* @param entity
|
|
@@ -484,7 +494,6 @@ function combineFilters(entity, schema, filters, union) {
|
|
|
484
494
|
}
|
|
485
495
|
return addFilterSegment(entity, schema, ...filters);
|
|
486
496
|
}
|
|
487
|
-
exports.combineFilters = combineFilters;
|
|
488
497
|
/**
|
|
489
498
|
* 在以下判断相容或相斥的过程中,相容/相斥的事实标准是:满足两个条件的查询集合是否被包容/互斥,但如果两个filter在逻辑上相容或者相斥,在事实上不一定相容或者相斥
|
|
490
499
|
* 例如:{ a: 1 } 和 { a: { $ne: 1 } } 是明显不相容的查询,但如果数据为空集,则这两个查询并不能否定其相容
|
|
@@ -903,7 +912,6 @@ function judgeValueRelation(value1, value2, contained) {
|
|
|
903
912
|
return false;
|
|
904
913
|
}
|
|
905
914
|
}
|
|
906
|
-
exports.judgeValueRelation = judgeValueRelation;
|
|
907
915
|
/**
|
|
908
916
|
* 判断filter条件对compared条件上的attr键值的条件是否相容或相斥
|
|
909
917
|
* @param entity
|
|
@@ -1292,7 +1300,6 @@ function analyzeFilterRelation(entity, schema, filter, compared, contained) {
|
|
|
1292
1300
|
sureAttributes,
|
|
1293
1301
|
};
|
|
1294
1302
|
}
|
|
1295
|
-
exports.analyzeFilterRelation = analyzeFilterRelation;
|
|
1296
1303
|
/** 判断filter条件对compared条件是否相容或相斥
|
|
1297
1304
|
* @param entity
|
|
1298
1305
|
* @param schema
|
|
@@ -1364,7 +1371,6 @@ function contains(entity, schema, filter, contained) {
|
|
|
1364
1371
|
return judgeFilterRelation(entity, schema, filter, contained, true);
|
|
1365
1372
|
// return false;
|
|
1366
1373
|
}
|
|
1367
|
-
exports.contains = contains;
|
|
1368
1374
|
/**
|
|
1369
1375
|
* 判断filter1和filter2是否相斥,即filter1和filter2查询的结果一定没有交集
|
|
1370
1376
|
* filter1 = {
|
|
@@ -1465,7 +1471,6 @@ function getRelevantIds(filter) {
|
|
|
1465
1471
|
}
|
|
1466
1472
|
return result;
|
|
1467
1473
|
}
|
|
1468
|
-
exports.getRelevantIds = getRelevantIds;
|
|
1469
1474
|
/**
|
|
1470
1475
|
* 判断两个过滤条件是否完全一致
|
|
1471
1476
|
* @param entity
|
|
@@ -1480,7 +1485,6 @@ function same(entity, schema, filter1, filter2) {
|
|
|
1480
1485
|
}
|
|
1481
1486
|
return filter1.id === filter2.id;
|
|
1482
1487
|
}
|
|
1483
|
-
exports.same = same;
|
|
1484
1488
|
/**
|
|
1485
1489
|
* 寻找在树形结构中满足条件的数据行的上层数据
|
|
1486
1490
|
* 例如在area表中,如果“杭州市”满足这一条件,则希望查到更高层的“浙江省”和“中国”,即可构造出满足条件的filter
|
|
@@ -1521,7 +1525,6 @@ function makeTreeAncestorFilter(entity, parentKey, filter, level = 1, includeAll
|
|
|
1521
1525
|
}
|
|
1522
1526
|
return currentLevelInFilter;
|
|
1523
1527
|
}
|
|
1524
|
-
exports.makeTreeAncestorFilter = makeTreeAncestorFilter;
|
|
1525
1528
|
/**
|
|
1526
1529
|
* 寻找在树形结构中满足条件的数据行的下层数据
|
|
1527
1530
|
* 例如在area表中,如果“杭州市”满足这一条件,则希望查到更低层的“西湖区”,即可构造出满足条件的filter
|
|
@@ -1556,7 +1559,6 @@ function makeTreeDescendantFilter(entity, parentKey, filter, level = 1, includeA
|
|
|
1556
1559
|
}
|
|
1557
1560
|
return currentLevelInFilter;
|
|
1558
1561
|
}
|
|
1559
|
-
exports.makeTreeDescendantFilter = makeTreeDescendantFilter;
|
|
1560
1562
|
function checkDeduceFilters(dfc, context) {
|
|
1561
1563
|
const { $and, $or } = dfc;
|
|
1562
1564
|
if ($and) {
|
|
@@ -1642,7 +1644,6 @@ function checkFilterContains(entity, context, contained, filter, dataCompare, wa
|
|
|
1642
1644
|
}
|
|
1643
1645
|
return false;
|
|
1644
1646
|
}
|
|
1645
|
-
exports.checkFilterContains = checkFilterContains;
|
|
1646
1647
|
function checkFilterRepel(entity, context, filter1, filter2, dataCompare, warningOnDataCompare) {
|
|
1647
1648
|
(0, assert_1.default)(filter2);
|
|
1648
1649
|
const schema = context.getSchema();
|
|
@@ -1658,7 +1659,6 @@ function checkFilterRepel(entity, context, filter1, filter2, dataCompare, warnin
|
|
|
1658
1659
|
}
|
|
1659
1660
|
return false;
|
|
1660
1661
|
}
|
|
1661
|
-
exports.checkFilterRepel = checkFilterRepel;
|
|
1662
1662
|
/**
|
|
1663
1663
|
* 有的场景下将filter当成非结构化属性存储,又想支持对其查询,此时必须将查询的filter进行转换,处理其中$开头的escape
|
|
1664
1664
|
* 只要filter是查询数据的标准子集,查询应当能返回true
|
|
@@ -1682,7 +1682,6 @@ function translateFilterToObjectPredicate(filter) {
|
|
|
1682
1682
|
copyInner(filter, translated);
|
|
1683
1683
|
return translated;
|
|
1684
1684
|
}
|
|
1685
|
-
exports.translateFilterToObjectPredicate = translateFilterToObjectPredicate;
|
|
1686
1685
|
/* export function getCascadeEntityFilter<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(
|
|
1687
1686
|
filter: NonNullable<ED[T]['Filter']>,
|
|
1688
1687
|
attr: keyof NonNullable<ED[T]['Filter']>
|
package/lib/store/modi.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createOperationsFromModies = createOperationsFromModies;
|
|
4
|
+
exports.applyModis = applyModis;
|
|
5
|
+
exports.abandonModis = abandonModis;
|
|
6
|
+
exports.createModiRelatedCheckers = createModiRelatedCheckers;
|
|
7
|
+
exports.createModiRelatedTriggers = createModiRelatedTriggers;
|
|
4
8
|
const tslib_1 = require("tslib");
|
|
5
9
|
const types_1 = require("../types");
|
|
6
10
|
const action_1 = require("../actions/action");
|
|
@@ -20,7 +24,6 @@ function createOperationsFromModies(modies) {
|
|
|
20
24
|
};
|
|
21
25
|
});
|
|
22
26
|
}
|
|
23
|
-
exports.createOperationsFromModies = createOperationsFromModies;
|
|
24
27
|
async function applyModis(filter, context, option) {
|
|
25
28
|
const closeMode = context.openRootMode();
|
|
26
29
|
const result = await context.operate('modi', {
|
|
@@ -42,7 +45,6 @@ async function applyModis(filter, context, option) {
|
|
|
42
45
|
closeMode();
|
|
43
46
|
return result;
|
|
44
47
|
}
|
|
45
|
-
exports.applyModis = applyModis;
|
|
46
48
|
async function abandonModis(filter, context, option) {
|
|
47
49
|
const closeMode = context.openRootMode();
|
|
48
50
|
const result = context.operate('modi', {
|
|
@@ -64,7 +66,6 @@ async function abandonModis(filter, context, option) {
|
|
|
64
66
|
closeMode();
|
|
65
67
|
return result;
|
|
66
68
|
}
|
|
67
|
-
exports.abandonModis = abandonModis;
|
|
68
69
|
function createModiRelatedCheckers(schema) {
|
|
69
70
|
const checkers = [];
|
|
70
71
|
for (const entity in schema) {
|
|
@@ -169,7 +170,6 @@ function createModiRelatedCheckers(schema) {
|
|
|
169
170
|
}
|
|
170
171
|
return checkers;
|
|
171
172
|
}
|
|
172
|
-
exports.createModiRelatedCheckers = createModiRelatedCheckers;
|
|
173
173
|
function createModiRelatedTriggers(schema) {
|
|
174
174
|
const triggers = [];
|
|
175
175
|
for (const entity in schema) {
|
|
@@ -253,4 +253,3 @@ function createModiRelatedTriggers(schema) {
|
|
|
253
253
|
};
|
|
254
254
|
return triggers.concat([applyTrigger]);
|
|
255
255
|
}
|
|
256
|
-
exports.createModiRelatedTriggers = createModiRelatedTriggers;
|
package/lib/store/relation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.judgeRelation =
|
|
3
|
+
exports.judgeRelation = judgeRelation;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
6
|
const Demand_1 = require("../types/Demand");
|
|
@@ -71,4 +71,3 @@ function judgeRelation(schema, entity, attr, allowUnrecognized) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
exports.judgeRelation = judgeRelation;
|
package/lib/timers/oper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vaccumOper =
|
|
3
|
+
exports.vaccumOper = vaccumOper;
|
|
4
4
|
const Entity_1 = require("../types/Entity");
|
|
5
5
|
const vaccum_1 = require("./vaccum");
|
|
6
6
|
const filter_1 = require("../store/filter");
|
|
@@ -61,4 +61,3 @@ async function vaccumOper(option, context) {
|
|
|
61
61
|
...rest,
|
|
62
62
|
}, context);
|
|
63
63
|
}
|
|
64
|
-
exports.vaccumOper = vaccumOper;
|
package/lib/timers/vaccum.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vaccumEntities =
|
|
3
|
+
exports.vaccumEntities = vaccumEntities;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
6
|
const fs_1 = require("fs");
|
|
@@ -108,4 +108,3 @@ async function vaccumEntities(option, context) {
|
|
|
108
108
|
}, { deletePhysically: true });
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
exports.vaccumEntities = vaccumEntities;
|
package/lib/types/AppLoader.d.ts
CHANGED
package/lib/types/Connector.d.ts
CHANGED
package/lib/types/Demand.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUB_QUERY_PREDICATE_KEYWORD = exports.
|
|
3
|
+
exports.SUB_QUERY_PREDICATE_KEYWORD = exports.EXPRESSION_PREFIX = void 0;
|
|
4
|
+
exports.isRefAttrNode = isRefAttrNode;
|
|
4
5
|
exports.EXPRESSION_PREFIX = '$expr';
|
|
5
6
|
function isRefAttrNode(node) {
|
|
6
7
|
return node.hasOwnProperty('#attr') || (node.hasOwnProperty('#refId') && node.hasOwnProperty('#refAttr'));
|
|
7
8
|
}
|
|
8
|
-
exports.isRefAttrNode = isRefAttrNode;
|
|
9
9
|
;
|
|
10
10
|
exports.SUB_QUERY_PREDICATE_KEYWORD = '#sqp';
|
package/lib/types/Endpoint.d.ts
CHANGED
package/lib/types/Exception.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.OakApplicationHasToUpgrade = exports.OakSocketConnectException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakDataInvisibleException = exports.OakOperationUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakSignatureVerificationException = exports.OakClockDriftException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakPartialSuccess = exports.OakMakeSureByMySelfException = exports.OakRequestTimeoutException = exports.OakException = void 0;
|
|
4
|
+
exports.makeException = makeException;
|
|
4
5
|
const relation_1 = require("../store/relation");
|
|
5
6
|
const lodash_1 = require("../utils/lodash");
|
|
6
7
|
class OakException extends Error {
|
|
@@ -559,4 +560,3 @@ function makeException(data) {
|
|
|
559
560
|
return e;
|
|
560
561
|
}
|
|
561
562
|
}
|
|
562
|
-
exports.makeException = makeException;
|
package/lib/types/Expression.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isGeoExpression = isGeoExpression;
|
|
4
|
+
exports.isDateExpression = isDateExpression;
|
|
5
|
+
exports.isLogicExpression = isLogicExpression;
|
|
6
|
+
exports.isBoolExpression = isBoolExpression;
|
|
7
|
+
exports.isCompareExpression = isCompareExpression;
|
|
8
|
+
exports.isMathExpression = isMathExpression;
|
|
9
|
+
exports.isStringExpression = isStringExpression;
|
|
10
|
+
exports.isAggrExpression = isAggrExpression;
|
|
11
|
+
exports.isExpression = isExpression;
|
|
12
|
+
exports.opMultipleParams = opMultipleParams;
|
|
13
|
+
exports.execOp = execOp;
|
|
14
|
+
exports.getAttrRefInExpression = getAttrRefInExpression;
|
|
4
15
|
const tslib_1 = require("tslib");
|
|
5
16
|
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
17
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
@@ -52,7 +63,6 @@ function isGeoExpression(expression) {
|
|
|
52
63
|
}
|
|
53
64
|
return false;
|
|
54
65
|
}
|
|
55
|
-
exports.isGeoExpression = isGeoExpression;
|
|
56
66
|
function isDateExpression(expression) {
|
|
57
67
|
if (Object.keys(expression).length == 1) {
|
|
58
68
|
const op = Object.keys(expression)[0];
|
|
@@ -63,7 +73,6 @@ function isDateExpression(expression) {
|
|
|
63
73
|
}
|
|
64
74
|
return false;
|
|
65
75
|
}
|
|
66
|
-
exports.isDateExpression = isDateExpression;
|
|
67
76
|
function isLogicExpression(expression) {
|
|
68
77
|
if (Object.keys(expression).length == 1) {
|
|
69
78
|
const op = Object.keys(expression)[0];
|
|
@@ -73,7 +82,6 @@ function isLogicExpression(expression) {
|
|
|
73
82
|
}
|
|
74
83
|
return false;
|
|
75
84
|
}
|
|
76
|
-
exports.isLogicExpression = isLogicExpression;
|
|
77
85
|
function isBoolExpression(expression) {
|
|
78
86
|
if (Object.keys(expression).length == 1) {
|
|
79
87
|
const op = Object.keys(expression)[0];
|
|
@@ -83,7 +91,6 @@ function isBoolExpression(expression) {
|
|
|
83
91
|
}
|
|
84
92
|
return false;
|
|
85
93
|
}
|
|
86
|
-
exports.isBoolExpression = isBoolExpression;
|
|
87
94
|
function isCompareExpression(expression) {
|
|
88
95
|
if (Object.keys(expression).length == 1) {
|
|
89
96
|
const op = Object.keys(expression)[0];
|
|
@@ -94,7 +101,6 @@ function isCompareExpression(expression) {
|
|
|
94
101
|
}
|
|
95
102
|
return false;
|
|
96
103
|
}
|
|
97
|
-
exports.isCompareExpression = isCompareExpression;
|
|
98
104
|
function isMathExpression(expression) {
|
|
99
105
|
if (Object.keys(expression).length == 1) {
|
|
100
106
|
const op = Object.keys(expression)[0];
|
|
@@ -105,7 +111,6 @@ function isMathExpression(expression) {
|
|
|
105
111
|
}
|
|
106
112
|
return false;
|
|
107
113
|
}
|
|
108
|
-
exports.isMathExpression = isMathExpression;
|
|
109
114
|
function isStringExpression(expression) {
|
|
110
115
|
if (Object.keys(expression).length == 1) {
|
|
111
116
|
const op = Object.keys(expression)[0];
|
|
@@ -115,7 +120,6 @@ function isStringExpression(expression) {
|
|
|
115
120
|
}
|
|
116
121
|
return false;
|
|
117
122
|
}
|
|
118
|
-
exports.isStringExpression = isStringExpression;
|
|
119
123
|
function isAggrExpression(expression) {
|
|
120
124
|
if (Object.keys(expression).length == 1) {
|
|
121
125
|
const op = Object.keys(expression)[0];
|
|
@@ -125,17 +129,14 @@ function isAggrExpression(expression) {
|
|
|
125
129
|
}
|
|
126
130
|
return false;
|
|
127
131
|
}
|
|
128
|
-
exports.isAggrExpression = isAggrExpression;
|
|
129
132
|
function isExpression(expression) {
|
|
130
133
|
return typeof expression === 'object' && Object.keys(expression).length === 1 && Object.keys(expression)[0].startsWith('$');
|
|
131
134
|
}
|
|
132
|
-
exports.isExpression = isExpression;
|
|
133
135
|
function opMultipleParams(op) {
|
|
134
136
|
return !['$year', '$month', '$weekday', '$weekOfYear', '$day', '$dayOfMonth',
|
|
135
137
|
'$dayOfWeek', '$dayOfYear', '$not', '$true', '$false', '$abs',
|
|
136
138
|
'$round', '$floor', '$ceil', '$$max', '$$min', '$$sum', '$$avg', '$$count'].includes(op);
|
|
137
139
|
}
|
|
138
|
-
exports.opMultipleParams = opMultipleParams;
|
|
139
140
|
function execOp(op, params) {
|
|
140
141
|
switch (op) {
|
|
141
142
|
case '$gt': {
|
|
@@ -350,7 +351,6 @@ function execOp(op, params) {
|
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
353
|
}
|
|
353
|
-
exports.execOp = execOp;
|
|
354
354
|
/**
|
|
355
355
|
* 检查一个表达式,并分析其涉及到的属性
|
|
356
356
|
* @param expression
|
|
@@ -391,4 +391,3 @@ function getAttrRefInExpression(expression) {
|
|
|
391
391
|
check(expression);
|
|
392
392
|
return result;
|
|
393
393
|
}
|
|
394
|
-
exports.getAttrRefInExpression = getAttrRefInExpression;
|
package/lib/types/Timer.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Watcher } from './Watcher';
|
|
|
6
6
|
import { Namespace } from 'socket.io';
|
|
7
7
|
type FreeRoutineFn<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>> = (context: Cxt, env: {
|
|
8
8
|
socket: Namespace;
|
|
9
|
+
contextBuilder: () => Promise<Cxt>;
|
|
9
10
|
}) => Promise<OperationResult<ED>>;
|
|
10
11
|
type FreeTimerFn<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>> = (context: Cxt) => Promise<OperationResult<ED>>;
|
|
11
12
|
export type FreeRoutine<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED>> = {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IncomingHttpHeaders } from "http";
|
|
3
2
|
import { SyncContext } from '../store/SyncRowStore';
|
|
4
3
|
import { Connector, EntityDict, OakException, OpRecord } from "../types";
|
|
@@ -36,7 +35,7 @@ export default class SimpleConnector<ED extends EntityDict & BaseEntityDict, Fro
|
|
|
36
35
|
opRecords: any;
|
|
37
36
|
message: string | null;
|
|
38
37
|
} | {
|
|
39
|
-
result: ReadableStream<Uint8Array
|
|
38
|
+
result: ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
|
40
39
|
message: string | null;
|
|
41
40
|
opRecords?: undefined;
|
|
42
41
|
}>;
|
|
@@ -45,7 +44,7 @@ export default class SimpleConnector<ED extends EntityDict & BaseEntityDict, Fro
|
|
|
45
44
|
opRecords: any;
|
|
46
45
|
message: string | null;
|
|
47
46
|
} | {
|
|
48
|
-
result: ReadableStream<Uint8Array
|
|
47
|
+
result: ReadableStream<Uint8Array<ArrayBuffer>> | null;
|
|
49
48
|
message: string | null;
|
|
50
49
|
opRecords?: undefined;
|
|
51
50
|
}>;
|
package/lib/utils/assert.d.ts
CHANGED
package/lib/utils/date.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.excelStringToDate =
|
|
3
|
+
exports.excelStringToDate = excelStringToDate;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
6
|
function excelStringToDate(str) {
|
|
@@ -15,4 +15,3 @@ function excelStringToDate(str) {
|
|
|
15
15
|
}
|
|
16
16
|
return Date.parse(str);
|
|
17
17
|
}
|
|
18
|
-
exports.excelStringToDate = excelStringToDate;
|