@openforis/arena-core 3.2.2 → 3.2.4
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/dist/app/appInfo.d.ts +5 -1
- package/dist/app/appInfo.js.map +1 -1
- package/dist/app/appInfos.d.ts +19 -0
- package/dist/app/appInfos.js +27 -0
- package/dist/app/appInfos.js.map +1 -0
- package/dist/app/index.d.ts +2 -1
- package/dist/app/index.js +3 -0
- package/dist/app/index.js.map +1 -1
- package/dist/esm/app/appInfo.js.map +1 -1
- package/dist/esm/app/appInfos.js +24 -0
- package/dist/esm/app/appInfos.js.map +1 -0
- package/dist/esm/app/index.js +1 -1
- package/dist/esm/app/index.js.map +1 -1
- package/dist/esm/expression/context.js.map +1 -1
- package/dist/esm/expression/javascript/evaluator.js +3 -16
- package/dist/esm/expression/javascript/evaluator.js.map +1 -1
- package/dist/esm/expression/javascript/parser/expressionNodesFinder.js +68 -0
- package/dist/esm/expression/javascript/parser/expressionNodesFinder.js.map +1 -0
- package/dist/esm/geo/points/transform.js +3 -10
- package/dist/esm/geo/points/transform.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/node/nodes.js +14 -12
- package/dist/esm/node/nodes.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/evaluator.js +19 -1
- package/dist/esm/nodeDefExpressionEvaluator/evaluator.js.map +1 -1
- package/dist/esm/nodeDefExpressionEvaluator/functions.js +53 -0
- package/dist/esm/nodeDefExpressionEvaluator/functions.js.map +1 -1
- package/dist/esm/record/_records/recordGetters.js +19 -0
- package/dist/esm/record/_records/recordGetters.js.map +1 -1
- package/dist/esm/record/record.js.map +1 -1
- package/dist/esm/record/recordExpressionEvaluator/functions.js +14 -0
- package/dist/esm/record/recordExpressionEvaluator/functions.js.map +1 -1
- package/dist/esm/record/recordExpressionEvaluator/recordExpressionEvaluator.js +9 -1
- package/dist/esm/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordExpressionEvaluationContext.js +1 -0
- package/dist/esm/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js +5 -3
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.js +6 -4
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js +2 -2
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js +11 -3
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js +46 -21
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js +15 -6
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +5 -5
- package/dist/esm/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js +22 -1
- package/dist/esm/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js +111 -8
- package/dist/esm/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
- package/dist/esm/record/recordNodesUpdater/recordUpdateResult.js +10 -0
- package/dist/esm/record/recordNodesUpdater/recordUpdateResult.js.map +1 -1
- package/dist/esm/record/recordUpdater.js +62 -9
- package/dist/esm/record/recordUpdater.js.map +1 -1
- package/dist/esm/record/records.js +3 -1
- package/dist/esm/record/records.js.map +1 -1
- package/dist/esm/survey/survey.js +2 -0
- package/dist/esm/survey/survey.js.map +1 -1
- package/dist/esm/survey/surveys/dependencies.js +67 -32
- package/dist/esm/survey/surveys/dependencies.js.map +1 -1
- package/dist/esm/survey/surveys/index.js +2 -1
- package/dist/esm/survey/surveys/index.js.map +1 -1
- package/dist/esm/utils/_objects/isEqual.js +2 -0
- package/dist/esm/utils/_objects/isEqual.js.map +1 -1
- package/dist/esm/utils/lruCache.js +50 -0
- package/dist/esm/utils/lruCache.js.map +1 -0
- package/dist/expression/context.d.ts +5 -0
- package/dist/expression/context.js.map +1 -1
- package/dist/expression/javascript/evaluator.js +3 -16
- package/dist/expression/javascript/evaluator.js.map +1 -1
- package/dist/expression/javascript/parser/expressionNodesFinder.d.ts +13 -0
- package/dist/expression/javascript/parser/expressionNodesFinder.js +73 -0
- package/dist/expression/javascript/parser/expressionNodesFinder.js.map +1 -0
- package/dist/geo/points/transform.js +3 -10
- package/dist/geo/points/transform.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/nodes.d.ts +18 -5
- package/dist/node/nodes.js +14 -12
- package/dist/node/nodes.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/context.d.ts +4 -0
- package/dist/nodeDefExpressionEvaluator/context.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/evaluator.d.ts +9 -1
- package/dist/nodeDefExpressionEvaluator/evaluator.js +19 -1
- package/dist/nodeDefExpressionEvaluator/evaluator.js.map +1 -1
- package/dist/nodeDefExpressionEvaluator/functions.js +53 -0
- package/dist/nodeDefExpressionEvaluator/functions.js.map +1 -1
- package/dist/record/_records/recordGetters.d.ts +10 -0
- package/dist/record/_records/recordGetters.js +22 -1
- package/dist/record/_records/recordGetters.js.map +1 -1
- package/dist/record/record.d.ts +1 -1
- package/dist/record/record.js.map +1 -1
- package/dist/record/recordExpressionEvaluator/functions.js +14 -0
- package/dist/record/recordExpressionEvaluator/functions.js.map +1 -1
- package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.d.ts +8 -0
- package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.js +9 -1
- package/dist/record/recordExpressionEvaluator/recordExpressionEvaluator.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.d.ts +6 -0
- package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.js +1 -0
- package/dist/record/recordNodesUpdater/recordExpressionEvaluationContext.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js +5 -3
- package/dist/record/recordNodesUpdater/recordNodeDependentsApplicableUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.d.ts +2 -3
- package/dist/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.js +5 -3
- package/dist/record/recordNodesUpdater/recordNodeDependentsBooleanUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js +2 -2
- package/dist/record/recordNodesUpdater/recordNodeDependentsCodeAttributesUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js +11 -3
- package/dist/record/recordNodesUpdater/recordNodeDependentsCountUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js +45 -20
- package/dist/record/recordNodesUpdater/recordNodeDependentsDefaultValuesUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js +15 -6
- package/dist/record/recordNodesUpdater/recordNodeDependentsFileNamesEvaluator.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js +4 -4
- package/dist/record/recordNodesUpdater/recordNodeDependentsRequiredUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.d.ts +19 -0
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js +24 -1
- package/dist/record/recordNodesUpdater/recordNodesDependentsUpdaterCommons.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordNodesUpdater.d.ts +8 -1
- package/dist/record/recordNodesUpdater/recordNodesUpdater.js +107 -4
- package/dist/record/recordNodesUpdater/recordNodesUpdater.js.map +1 -1
- package/dist/record/recordNodesUpdater/recordUpdateResult.d.ts +5 -0
- package/dist/record/recordNodesUpdater/recordUpdateResult.js +10 -0
- package/dist/record/recordNodesUpdater/recordUpdateResult.js.map +1 -1
- package/dist/record/recordUpdater.d.ts +10 -2
- package/dist/record/recordUpdater.js +61 -8
- package/dist/record/recordUpdater.js.map +1 -1
- package/dist/record/records.d.ts +3 -1
- package/dist/record/records.js +2 -0
- package/dist/record/records.js.map +1 -1
- package/dist/survey/survey.d.ts +3 -1
- package/dist/survey/survey.js +2 -0
- package/dist/survey/survey.js.map +1 -1
- package/dist/survey/surveys/dependencies.d.ts +10 -0
- package/dist/survey/surveys/dependencies.js +69 -33
- package/dist/survey/surveys/dependencies.js.map +1 -1
- package/dist/survey/surveys/index.d.ts +2 -1
- package/dist/survey/surveys/index.js +1 -0
- package/dist/survey/surveys/index.js.map +1 -1
- package/dist/utils/_objects/isEqual.d.ts +3 -1
- package/dist/utils/_objects/isEqual.js +2 -0
- package/dist/utils/_objects/isEqual.js.map +1 -1
- package/dist/utils/lruCache.d.ts +18 -0
- package/dist/utils/lruCache.js +54 -0
- package/dist/utils/lruCache.js.map +1 -0
- package/package.json +1 -1
package/dist/app/appInfo.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export type ArenaAppPlatform = 'android' | 'ios' | 'web';
|
|
1
2
|
export interface ArenaAppInfo {
|
|
3
|
+
/**
|
|
4
|
+
* Id of the app (e.g. "arena" for Arena, "am" for Arena Mobile; see AppInfos.appIds)
|
|
5
|
+
*/
|
|
2
6
|
appId: string;
|
|
3
7
|
version: string;
|
|
4
|
-
platform?:
|
|
8
|
+
platform?: ArenaAppPlatform;
|
|
5
9
|
}
|
package/dist/app/appInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appInfo.js","sourceRoot":"","sources":["../../src/app/appInfo.ts"],"names":[],"mappings":"","sourcesContent":["export interface ArenaAppInfo {\n appId: string\n version: string\n platform?:
|
|
1
|
+
{"version":3,"file":"appInfo.js","sourceRoot":"","sources":["../../src/app/appInfo.ts"],"names":[],"mappings":"","sourcesContent":["export type ArenaAppPlatform = 'android' | 'ios' | 'web'\n\nexport interface ArenaAppInfo {\n /**\n * Id of the app (e.g. \"arena\" for Arena, \"am\" for Arena Mobile; see AppInfos.appIds)\n */\n appId: string\n version: string\n platform?: ArenaAppPlatform\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ArenaAppInfo } from './appInfo';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the label of the app with the specified id (e.g. "Arena", "Arena Mobile"); the id itself if unknown.
|
|
4
|
+
*/
|
|
5
|
+
declare const getAppIdLabel: (appId: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the label of the app (see getAppIdLabel), or undefined if the app info is not specified.
|
|
8
|
+
*/
|
|
9
|
+
declare const getLabel: (appInfo: ArenaAppInfo | undefined) => string | undefined;
|
|
10
|
+
export declare const AppInfos: {
|
|
11
|
+
appIds: {
|
|
12
|
+
readonly arena: 'arena';
|
|
13
|
+
readonly arenaMobile: 'am';
|
|
14
|
+
readonly arenaMobileV1: 'arena-mobile';
|
|
15
|
+
};
|
|
16
|
+
getAppIdLabel: typeof getAppIdLabel;
|
|
17
|
+
getLabel: typeof getLabel;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppInfos = void 0;
|
|
4
|
+
const appIds = {
|
|
5
|
+
arena: 'arena',
|
|
6
|
+
arenaMobile: 'am',
|
|
7
|
+
arenaMobileV1: 'arena-mobile', // first version of Arena Mobile, deprecated
|
|
8
|
+
};
|
|
9
|
+
const labelsByAppId = {
|
|
10
|
+
[appIds.arena]: 'Arena',
|
|
11
|
+
[appIds.arenaMobile]: 'Arena Mobile',
|
|
12
|
+
[appIds.arenaMobileV1]: 'Arena Mobile',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Returns the label of the app with the specified id (e.g. "Arena", "Arena Mobile"); the id itself if unknown.
|
|
16
|
+
*/
|
|
17
|
+
const getAppIdLabel = (appId) => { var _a; return (_a = labelsByAppId[appId]) !== null && _a !== void 0 ? _a : appId; };
|
|
18
|
+
/**
|
|
19
|
+
* Returns the label of the app (see getAppIdLabel), or undefined if the app info is not specified.
|
|
20
|
+
*/
|
|
21
|
+
const getLabel = (appInfo) => appInfo ? getAppIdLabel(appInfo.appId) : undefined;
|
|
22
|
+
exports.AppInfos = {
|
|
23
|
+
appIds,
|
|
24
|
+
getAppIdLabel,
|
|
25
|
+
getLabel,
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=appInfos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appInfos.js","sourceRoot":"","sources":["../../src/app/appInfos.ts"],"names":[],"mappings":";;;AAEA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,cAAc,EAAE,4CAA4C;CACnE,CAAA;AAEV,MAAM,aAAa,GAAgC;IACjD,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO;IACvB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,cAAc;IACpC,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,cAAc;CACvC,CAAA;AAED;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,KAAa,EAAU,EAAE,wBAAC,aAAa,CAAC,KAAK,CAAC,mCAAI,KAAK,GAAA,CAAA;AAE9E;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAiC,EAAsB,EAAE,CACzE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAEvC,QAAA,QAAQ,GAAG;IACtB,MAAM;IACN,aAAa;IACb,QAAQ;CACT,CAAA","sourcesContent":["import { ArenaAppInfo } from './appInfo'\n\nconst appIds = {\n arena: 'arena',\n arenaMobile: 'am',\n arenaMobileV1: 'arena-mobile', // first version of Arena Mobile, deprecated\n} as const\n\nconst labelsByAppId: { [appId: string]: string } = {\n [appIds.arena]: 'Arena',\n [appIds.arenaMobile]: 'Arena Mobile',\n [appIds.arenaMobileV1]: 'Arena Mobile',\n}\n\n/**\n * Returns the label of the app with the specified id (e.g. \"Arena\", \"Arena Mobile\"); the id itself if unknown.\n */\nconst getAppIdLabel = (appId: string): string => labelsByAppId[appId] ?? appId\n\n/**\n * Returns the label of the app (see getAppIdLabel), or undefined if the app info is not specified.\n */\nconst getLabel = (appInfo: ArenaAppInfo | undefined): string | undefined =>\n appInfo ? getAppIdLabel(appInfo.appId) : undefined\n\nexport const AppInfos = {\n appIds,\n getAppIdLabel,\n getLabel,\n}\n"]}
|
package/dist/app/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { ArenaAppInfo } from './appInfo';
|
|
1
|
+
export type { ArenaAppInfo, ArenaAppPlatform } from './appInfo';
|
|
2
|
+
export { AppInfos } from './appInfos';
|
package/dist/app/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AppInfos = void 0;
|
|
4
|
+
var appInfos_1 = require("./appInfos");
|
|
5
|
+
Object.defineProperty(exports, "AppInfos", { enumerable: true, get: function () { return appInfos_1.AppInfos; } });
|
|
3
6
|
//# sourceMappingURL=index.js.map
|
package/dist/app/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"","sourcesContent":["export type { ArenaAppInfo } from './appInfo'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":";;;AACA,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA","sourcesContent":["export type { ArenaAppInfo, ArenaAppPlatform } from './appInfo'\nexport { AppInfos } from './appInfos'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appInfo.js","sourceRoot":"","sources":["../../../src/app/appInfo.ts"],"names":[],"mappings":"","sourcesContent":["export interface ArenaAppInfo {\n appId: string\n version: string\n platform?:
|
|
1
|
+
{"version":3,"file":"appInfo.js","sourceRoot":"","sources":["../../../src/app/appInfo.ts"],"names":[],"mappings":"","sourcesContent":["export type ArenaAppPlatform = 'android' | 'ios' | 'web'\n\nexport interface ArenaAppInfo {\n /**\n * Id of the app (e.g. \"arena\" for Arena, \"am\" for Arena Mobile; see AppInfos.appIds)\n */\n appId: string\n version: string\n platform?: ArenaAppPlatform\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const appIds = {
|
|
2
|
+
arena: 'arena',
|
|
3
|
+
arenaMobile: 'am',
|
|
4
|
+
arenaMobileV1: 'arena-mobile', // first version of Arena Mobile, deprecated
|
|
5
|
+
};
|
|
6
|
+
const labelsByAppId = {
|
|
7
|
+
[appIds.arena]: 'Arena',
|
|
8
|
+
[appIds.arenaMobile]: 'Arena Mobile',
|
|
9
|
+
[appIds.arenaMobileV1]: 'Arena Mobile',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Returns the label of the app with the specified id (e.g. "Arena", "Arena Mobile"); the id itself if unknown.
|
|
13
|
+
*/
|
|
14
|
+
const getAppIdLabel = (appId) => { var _a; return (_a = labelsByAppId[appId]) !== null && _a !== void 0 ? _a : appId; };
|
|
15
|
+
/**
|
|
16
|
+
* Returns the label of the app (see getAppIdLabel), or undefined if the app info is not specified.
|
|
17
|
+
*/
|
|
18
|
+
const getLabel = (appInfo) => appInfo ? getAppIdLabel(appInfo.appId) : undefined;
|
|
19
|
+
export const AppInfos = {
|
|
20
|
+
appIds,
|
|
21
|
+
getAppIdLabel,
|
|
22
|
+
getLabel,
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=appInfos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appInfos.js","sourceRoot":"","sources":["../../../src/app/appInfos.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,cAAc,EAAE,4CAA4C;CACnE,CAAA;AAEV,MAAM,aAAa,GAAgC;IACjD,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO;IACvB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,cAAc;IACpC,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,cAAc;CACvC,CAAA;AAED;;GAEG;AACH,MAAM,aAAa,GAAG,CAAC,KAAa,EAAU,EAAE,wBAAC,aAAa,CAAC,KAAK,CAAC,mCAAI,KAAK,GAAA,CAAA;AAE9E;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAiC,EAAsB,EAAE,CACzE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAEpD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,MAAM;IACN,aAAa;IACb,QAAQ;CACT,CAAA","sourcesContent":["import { ArenaAppInfo } from './appInfo'\n\nconst appIds = {\n arena: 'arena',\n arenaMobile: 'am',\n arenaMobileV1: 'arena-mobile', // first version of Arena Mobile, deprecated\n} as const\n\nconst labelsByAppId: { [appId: string]: string } = {\n [appIds.arena]: 'Arena',\n [appIds.arenaMobile]: 'Arena Mobile',\n [appIds.arenaMobileV1]: 'Arena Mobile',\n}\n\n/**\n * Returns the label of the app with the specified id (e.g. \"Arena\", \"Arena Mobile\"); the id itself if unknown.\n */\nconst getAppIdLabel = (appId: string): string => labelsByAppId[appId] ?? appId\n\n/**\n * Returns the label of the app (see getAppIdLabel), or undefined if the app info is not specified.\n */\nconst getLabel = (appInfo: ArenaAppInfo | undefined): string | undefined =>\n appInfo ? getAppIdLabel(appInfo.appId) : undefined\n\nexport const AppInfos = {\n appIds,\n getAppIdLabel,\n getLabel,\n}\n"]}
|
package/dist/esm/app/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { AppInfos } from './appInfos';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"","sourcesContent":["export type { ArenaAppInfo } from './appInfo'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA","sourcesContent":["export type { ArenaAppInfo, ArenaAppPlatform } from './appInfo'\nexport { AppInfos } from './appInfos'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/expression/context.ts"],"names":[],"mappings":"","sourcesContent":["import { LanguageCode } from '../language'\n\nexport interface ArenaExpressionContext {\n object?: any\n evaluateToNode?: boolean\n includeAnalysis?: boolean\n /**\n * client timezone offset in minutes as returned by the Date.getTimezoneOffset function\n */\n timezoneOffset?: number\n /**\n * language selected in the client app, used by language-aware expression functions (e.g. numberToWords)\n */\n lang?: LanguageCode\n}\n"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/expression/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ArenaAppInfo } from '../app'\nimport { LanguageCode } from '../language'\n\nexport interface ArenaExpressionContext {\n object?: any\n evaluateToNode?: boolean\n includeAnalysis?: boolean\n /**\n * client timezone offset in minutes as returned by the Date.getTimezoneOffset function\n */\n timezoneOffset?: number\n /**\n * language selected in the client app, used by language-aware expression functions (e.g. numberToWords)\n */\n lang?: LanguageCode\n /**\n * info about the app running the evaluation (used by the appId, appIdLabel, appVersion and appPlatform expression functions)\n */\n appInfo?: ArenaAppInfo\n}\n"]}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { ExpressionNodeType } from '../node';
|
|
11
11
|
import { SystemError, SystemErrorKeys } from '../../error';
|
|
12
|
+
import { LRUCache } from '../../utils/lruCache';
|
|
12
13
|
import { functionsDefault } from './functionsDefault';
|
|
13
14
|
import { ArrayEvaluator } from './node/array';
|
|
14
15
|
import { BinaryEvaluator } from './node/binary';
|
|
@@ -37,23 +38,9 @@ const defaultEvaluators = {
|
|
|
37
38
|
};
|
|
38
39
|
// Parsed expressions cache: the same expressions are evaluated many times (e.g. for every node during a record update).
|
|
39
40
|
// The cached expression nodes are shared, so evaluators must never modify them.
|
|
40
|
-
const
|
|
41
|
-
const parsedExpressionsCache = new Map();
|
|
41
|
+
const parsedExpressionsCache = new LRUCache(1000);
|
|
42
42
|
const expressionParser = new JavascriptExpressionParser();
|
|
43
|
-
export const parseExpression = (expression) =>
|
|
44
|
-
let expressionNode = parsedExpressionsCache.get(expression);
|
|
45
|
-
if (!expressionNode) {
|
|
46
|
-
expressionNode = expressionParser.parse(expression);
|
|
47
|
-
if (parsedExpressionsCache.size >= PARSED_EXPRESSIONS_CACHE_MAX_SIZE) {
|
|
48
|
-
// evict the oldest entry (Map keeps insertion order)
|
|
49
|
-
const oldestExpression = parsedExpressionsCache.keys().next().value;
|
|
50
|
-
if (oldestExpression !== undefined)
|
|
51
|
-
parsedExpressionsCache.delete(oldestExpression);
|
|
52
|
-
}
|
|
53
|
-
parsedExpressionsCache.set(expression, expressionNode);
|
|
54
|
-
}
|
|
55
|
-
return expressionNode;
|
|
56
|
-
};
|
|
43
|
+
export const parseExpression = (expression) => parsedExpressionsCache.getOrCompute(expression, () => expressionParser.parse(expression));
|
|
57
44
|
export class JavascriptExpressionEvaluator {
|
|
58
45
|
constructor(functions = {}, evaluators = {}) {
|
|
59
46
|
this.evaluators = Object.assign(Object.assign({}, defaultEvaluators), evaluators);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../../../src/expression/javascript/evaluator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAgE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC1G,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../../../src/expression/javascript/evaluator.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAgE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC1G,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM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,UAAkB,EAA2C,EAAE,CAC7F,sBAAsB,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAA;AAE3F,MAAM,OAAO,6BAA6B;IAIxC,YAAY,SAAS,GAAgC,EAAE,EAAE,UAAU,GAAkB,EAAE;QACrF,IAAI,CAAC,UAAU,mCAAQ,iBAAiB,GAAK,UAAU,CAAE,CAAA;QACzD,IAAI,CAAC,SAAS,mCAAQ,gBAAgB,GAAK,SAAS,CAAE,CAAA;IACxD,CAAC;IAEK,QAAQ,CAAC,UAAkB,EAAE,OAAW;;YAC5C,OAAO,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,OAAO,aAAP,OAAO,cAAP,OAAO,GAAK,EAAQ,CAAC,CAAA;QAC7E,CAAC;KAAA;IAEK,YAAY,CAAC,cAAuD,EAAE,OAAU;;YACpF,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAA;YAE/B,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;YAC3C,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnB,MAAM,IAAI,WAAW,CAAC,eAAe,CAAC,UAAU,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;YACrF,CAAC;YACD,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;QAClE,CAAC;KAAA;CACF","sourcesContent":["import { ArenaExpressionContext } from '../context'\nimport { ArenaExpressionEvaluator } from '../evaluator'\nimport { ArenaExpressionFunctions } from '../function'\nimport { ArenaExpressionNode, ArenaExpressionNodeEvaluatorConstructor, ExpressionNodeType } from '../node'\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { LRUCache } from '../../utils/lruCache'\n\nimport { functionsDefault } from './functionsDefault'\nimport { ArrayEvaluator } from './node/array'\nimport { BinaryEvaluator } from './node/binary'\nimport { CallEvaluator } from './node/call'\nimport { CompoundEvaluator } from './node/compound'\nimport { ConditionalEvaluator } from './node/conditional'\nimport { IdentifierEvaluator } from './node/identifier'\nimport { LiteralEvaluator } from './node/literal'\nimport { MemberEvaluator } from './node/member'\nimport { SequenceEvaluator } from './node/sequence'\nimport { ThisEvaluator } from './node/this'\nimport { UnaryEvaluator } from './node/unary'\nimport { JavascriptExpressionParser } from './parser/parser'\n\ntype Evaluators<C extends ArenaExpressionContext> = {\n [nodeType in ExpressionNodeType]?: ArenaExpressionNodeEvaluatorConstructor<C, ArenaExpressionNode<ExpressionNodeType>>\n}\n\nconst defaultEvaluators = {\n [ExpressionNodeType.Array]: ArrayEvaluator,\n [ExpressionNodeType.Binary]: BinaryEvaluator,\n [ExpressionNodeType.Call]: CallEvaluator,\n [ExpressionNodeType.Compound]: CompoundEvaluator,\n [ExpressionNodeType.Conditional]: ConditionalEvaluator,\n [ExpressionNodeType.Identifier]: IdentifierEvaluator,\n [ExpressionNodeType.Literal]: LiteralEvaluator,\n [ExpressionNodeType.Member]: MemberEvaluator,\n [ExpressionNodeType.Sequence]: SequenceEvaluator,\n [ExpressionNodeType.This]: ThisEvaluator,\n [ExpressionNodeType.Unary]: UnaryEvaluator,\n}\n\n// Parsed expressions cache: the same expressions are evaluated many times (e.g. for every node during a record update).\n// The cached expression nodes are shared, so evaluators must never modify them.\nconst parsedExpressionsCache = new LRUCache<string, ArenaExpressionNode<ExpressionNodeType>>(1000)\nconst expressionParser = new JavascriptExpressionParser()\n\nexport const parseExpression = (expression: string): ArenaExpressionNode<ExpressionNodeType> =>\n parsedExpressionsCache.getOrCompute(expression, () => expressionParser.parse(expression))\n\nexport class JavascriptExpressionEvaluator<C extends ArenaExpressionContext> implements ArenaExpressionEvaluator<C> {\n functions: ArenaExpressionFunctions<C>\n evaluators: Evaluators<C>\n\n constructor(functions: ArenaExpressionFunctions<C> = {}, evaluators: Evaluators<C> = {}) {\n this.evaluators = { ...defaultEvaluators, ...evaluators }\n this.functions = { ...functionsDefault, ...functions }\n }\n\n async evaluate(expression: string, context?: C): Promise<any> {\n return this.evaluateNode(parseExpression(expression), context ?? ({} as C))\n }\n\n async evaluateNode(expressionNode: ArenaExpressionNode<ExpressionNodeType>, context: C): Promise<any> {\n const { type } = expressionNode\n\n const NodeEvaluator = this.evaluators[type]\n if (!NodeEvaluator) {\n throw new SystemError(SystemErrorKeys.expression.unsupportedFunctionType, { type })\n }\n return new NodeEvaluator(this, context).evaluate(expressionNode)\n }\n}\n"]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ExpressionNodeType } from '../../node';
|
|
2
|
+
import { LRUCache } from '../../../utils/lruCache';
|
|
3
|
+
import { JavascriptExpressionParser } from './parser';
|
|
4
|
+
const parser = new JavascriptExpressionParser();
|
|
5
|
+
/**
|
|
6
|
+
* Visits the specified expression node and all its descendants (arguments, operands, compound bodies...).
|
|
7
|
+
*/
|
|
8
|
+
const visit = (value, visitor) => {
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
for (const item of value)
|
|
11
|
+
visit(item, visitor);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (!value || typeof value !== 'object')
|
|
15
|
+
return;
|
|
16
|
+
const expressionNode = value;
|
|
17
|
+
if (expressionNode.type) {
|
|
18
|
+
visitor(expressionNode);
|
|
19
|
+
}
|
|
20
|
+
for (const child of Object.values(expressionNode)) {
|
|
21
|
+
visit(child, visitor);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const visitExpression = (expression, visitor) => {
|
|
25
|
+
try {
|
|
26
|
+
visit(parser.parse(expression), visitor);
|
|
27
|
+
}
|
|
28
|
+
catch (_a) {
|
|
29
|
+
// invalid expression (reported by the expression validator)
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Finds the names of the functions called in the specified expression (e.g. "now" in "now() > date_attr").
|
|
34
|
+
* Returns an empty set if the expression is empty or cannot be parsed.
|
|
35
|
+
* @param expression - The expression to search in.
|
|
36
|
+
* @returns The names of the called functions.
|
|
37
|
+
*/
|
|
38
|
+
export const findFunctionCallNames = (expression) => {
|
|
39
|
+
const names = new Set();
|
|
40
|
+
if (!expression)
|
|
41
|
+
return names;
|
|
42
|
+
visitExpression(expression, (expressionNode) => {
|
|
43
|
+
if (expressionNode.type === ExpressionNodeType.Call &&
|
|
44
|
+
expressionNode.callee.type === ExpressionNodeType.Identifier) {
|
|
45
|
+
names.add(expressionNode.callee.name);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return names;
|
|
49
|
+
};
|
|
50
|
+
const usesThisCache = new LRUCache(1000);
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if the specified expression uses the "this" keyword (results are cached by expression, up to 1000).
|
|
53
|
+
* @param expression - The expression to search in.
|
|
54
|
+
* @returns True if "this" is used in the expression.
|
|
55
|
+
*/
|
|
56
|
+
export const expressionUsesThis = (expression) => {
|
|
57
|
+
if (!expression)
|
|
58
|
+
return false;
|
|
59
|
+
return usesThisCache.getOrCompute(expression, () => {
|
|
60
|
+
let result = false;
|
|
61
|
+
visitExpression(expression, (expressionNode) => {
|
|
62
|
+
if (expressionNode.type === ExpressionNodeType.This)
|
|
63
|
+
result = true;
|
|
64
|
+
});
|
|
65
|
+
return result;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=expressionNodesFinder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressionNodesFinder.js","sourceRoot":"","sources":["../../../../../src/expression/javascript/parser/expressionNodesFinder.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAErD,MAAM,MAAM,GAAG,IAAI,0BAA0B,EAAE,CA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AAM,CAAC,IAAI,CAAC,CAAA;QACvC,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAkB,IAAI,CAAC,CAAA;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAqC,EAAW,EAAE;IACnF,IAAI,CAAC,UAAU;QAAE,OAAO,KAAK,CAAA;IAC7B,OAAO,aAAa,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE;QACjD,IAAI,MAAM,GAAG,KAAK,CAAA;QAClB,eAAe,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,EAAE;YAC7C,IAAI,cAAc,CAAC,IAAI,KAAK,kBAAkB,CAAC,IAAI;gBAAE,MAAM,GAAG,IAAI,CAAA;QACpE,CAAC,CAAC,CAAA;QACF,OAAO,MAAM,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { ArenaAnyExpressionNode, ExpressionNodeType } from '../../node'\nimport { LRUCache } from '../../../utils/lruCache'\nimport { JavascriptExpressionParser } from './parser'\n\nconst parser = new JavascriptExpressionParser()\n\n/**\n * Visits the specified expression node and all its descendants (arguments, operands, compound bodies...).\n */\nconst visit = (value: unknown, visitor: (expressionNode: ArenaAnyExpressionNode) => void): void => {\n if (Array.isArray(value)) {\n for (const item of value) visit(item, visitor)\n return\n }\n if (!value || typeof value !== 'object') return\n\n const expressionNode = value as ArenaAnyExpressionNode\n if (expressionNode.type) {\n visitor(expressionNode)\n }\n for (const child of Object.values(expressionNode)) {\n visit(child, visitor)\n }\n}\n\nconst visitExpression = (expression: string, visitor: (expressionNode: ArenaAnyExpressionNode) => void): void => {\n try {\n visit(parser.parse(expression), visitor)\n } catch {\n // invalid expression (reported by the expression validator)\n }\n}\n\n/**\n * Finds the names of the functions called in the specified expression (e.g. \"now\" in \"now() > date_attr\").\n * Returns an empty set if the expression is empty or cannot be parsed.\n * @param expression - The expression to search in.\n * @returns The names of the called functions.\n */\nexport const findFunctionCallNames = (expression: string | undefined | null): Set<string> => {\n const names = new Set<string>()\n if (!expression) return names\n visitExpression(expression, (expressionNode) => {\n if (\n expressionNode.type === ExpressionNodeType.Call &&\n expressionNode.callee.type === ExpressionNodeType.Identifier\n ) {\n names.add(expressionNode.callee.name)\n }\n })\n return names\n}\n\nconst usesThisCache = new LRUCache<string, boolean>(1000)\n\n/**\n * Returns true if the specified expression uses the \"this\" keyword (results are cached by expression, up to 1000).\n * @param expression - The expression to search in.\n * @returns True if \"this\" is used in the expression.\n */\nexport const expressionUsesThis = (expression: string | undefined | null): boolean => {\n if (!expression) return false\n return usesThisCache.getOrCompute(expression, () => {\n let result = false\n visitExpression(expression, (expressionNode) => {\n if (expressionNode.type === ExpressionNodeType.This) result = true\n })\n return result\n })\n}\n"]}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import proj4 from 'proj4';
|
|
2
2
|
import { SystemError, SystemErrorKeys } from '../../error';
|
|
3
|
+
import { LRUCache } from '../../utils/lruCache';
|
|
3
4
|
import { DEFAULT_SRS_INDEX } from '../../srs';
|
|
4
5
|
import { PointFactory } from '../pointFactory';
|
|
5
6
|
import { isFilled } from './isFilled';
|
|
6
7
|
import { getSrs } from './getSrs';
|
|
7
8
|
// proj4 parses both WKT strings every time it is called with them: cache the converters by WKT pair
|
|
8
|
-
const convertersCache = new
|
|
9
|
-
const getConverter = (wktFrom, wktTo) => {
|
|
10
|
-
const key = `${wktFrom}\n${wktTo}`;
|
|
11
|
-
let converter = convertersCache.get(key);
|
|
12
|
-
if (!converter) {
|
|
13
|
-
converter = proj4(wktFrom, wktTo);
|
|
14
|
-
convertersCache.set(key, converter);
|
|
15
|
-
}
|
|
16
|
-
return converter;
|
|
17
|
-
};
|
|
9
|
+
const convertersCache = new LRUCache(100);
|
|
10
|
+
const getConverter = (wktFrom, wktTo) => convertersCache.getOrCompute(`${wktFrom}\n${wktTo}`, () => proj4(wktFrom, wktTo));
|
|
18
11
|
/**
|
|
19
12
|
* Transforms the specified point from one SRS into another, throwing a SystemError with the reason when it cannot.
|
|
20
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../../src/geo/points/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAiB,MAAM,WAAW,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,oGAAoG;AACpG,MAAM,eAAe,GAAG,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../../src/geo/points/transform.ts"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAiB,MAAM,WAAW,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,oGAAoG;AACpG,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAoB,GAAG,CAAC,CAAA;AAE5D,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,KAAa,EAAa,EAAE,CACjE,eAAe,CAAC,YAAY,CAAC,GAAG,OAAO,KAAK,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK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,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAG,CAAA;IACnF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,WAAW,CACnB,eAAe,CAAC,GAAG,CAAC,eAAe,EACnC,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,EAC1C,EAAE,KAAK,EAAE,KAAK,EAAE,CACjB,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAoC,EACpC,SAAiB,EACjB,QAAQ,GAAkB,iBAAiB,EACxB,EAAE;IACrB,IAAI,CAAC;QACH,OAAO,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;IACrD,CAAC;eAAO,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC,CAAA","sourcesContent":["import proj4, { type Converter } from 'proj4'\n\nimport { SystemError, SystemErrorKeys } from '../../error'\nimport { LRUCache } from '../../utils/lruCache'\nimport { DEFAULT_SRS_INDEX, ArenaSRSIndex } from '../../srs'\nimport { ArenaPoint } from '../point'\nimport { PointFactory } from '../pointFactory'\nimport { isFilled } from './isFilled'\nimport { getSrs } from './getSrs'\n\n// proj4 parses both WKT strings every time it is called with them: cache the converters by WKT pair\nconst convertersCache = new LRUCache<string, Converter>(100)\n\nconst getConverter = (wktFrom: string, wktTo: string): Converter =>\n convertersCache.getOrCompute(`${wktFrom}\\n${wktTo}`, () => proj4(wktFrom, wktTo))\n\n/**\n * Transforms the specified point from one SRS into another, throwing a SystemError with the reason when it cannot.\n *\n * @param point - The point to transform.\n * @param srsCodeTo - The SRS code to transform the point into.\n * @param srsIndex - SRSs indexed by SRS code.\n * @returns The transformed point (the point itself if it is already in the target SRS).\n * @throws {SystemError} `geo.pointNotFilled`, `geo.srsNotFound` (with the `code` param) or `geo.transformFailed`.\n */\nexport const transformOrThrow = (\n point: ArenaPoint | null | undefined,\n srsCodeTo: string,\n srsIndex: ArenaSRSIndex = DEFAULT_SRS_INDEX\n): ArenaPoint => {\n if (!isFilled(point)) throw new SystemError(SystemErrorKeys.geo.pointNotFilled)\n\n const { srs: srsCodeFrom } = point\n\n if (srsCodeFrom === srsCodeTo) {\n // projection is not needed\n return point\n }\n const srsFrom = getSrs({ code: srsCodeFrom, srsIndex })\n if (!srsFrom) throw new SystemError(SystemErrorKeys.geo.srsNotFound, { code: srsCodeFrom })\n\n const srsTo = getSrs({ code: srsCodeTo, srsIndex })\n if (!srsTo) throw new SystemError(SystemErrorKeys.geo.srsNotFound, { code: srsCodeTo })\n\n try {\n const { x, y } = point\n const [long, lat] = getConverter(srsFrom.wkt, srsTo.wkt).forward([Number(x), Number(y)])\n\n return PointFactory.createInstance({ ...point, srs: srsCodeTo, x: long, y: lat })\n } catch (error) {\n throw new SystemError(\n SystemErrorKeys.geo.transformFailed,\n { srsFrom: srsCodeFrom, srsTo: srsCodeTo },\n { cause: error }\n )\n }\n}\n\n/**\n * Transforms the specified point from one SRS into another.\n * Use `transformOrThrow` to know why a point cannot be transformed.\n *\n * @param point - The point to transform.\n * @param srsCodeTo - The SRS code to transform the point into.\n * @param srsIndex - SRSs indexed by SRS code.\n * @returns The transformed point, or null if the point is not filled, an SRS is unknown or the transformation fails.\n */\nexport const transform = (\n point: ArenaPoint | null | undefined,\n srsCodeTo: string,\n srsIndex: ArenaSRSIndex = DEFAULT_SRS_INDEX\n): ArenaPoint | null => {\n try {\n return transformOrThrow(point, srsCodeTo, srsIndex)\n } catch {\n return null\n }\n}\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AppInfos } from './app';
|
|
1
2
|
export { Authorizer, AuthGroupName, createDefaultAuthGroups, UserStatus, Permission, UserTitle, UserFactory, Users, } from './auth';
|
|
2
3
|
export { CategoryFactory, CategoryItemFactory, CategoryLevelFactory } from './category';
|
|
3
4
|
export { Categories, CategoryItems } from './category';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,KAAK,GACN,MAAM,QAAQ,CAAA;AAwBf,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAUvF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAU5E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,wBAAwB,GACzB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAsBrB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAU5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAM1E,OAAO,EAAE,uBAAuB,E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ACnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEjF,OAAO,EACL,MAAM,EACN,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,KAAK,EACL,QAAQ,GACT,MAAM,SAAS,CAAA;AAUhB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAc,CAAA","sourcesContent":["export type { ArenaAppInfo } from './app'\n\nexport {\n Authorizer,\n AuthGroupName,\n createDefaultAuthGroups,\n UserStatus,\n Permission,\n UserTitle,\n UserFactory,\n Users,\n} from './auth'\nexport type {\n ArenaAuthGroup,\n ArenaUser,\n ArenaUserAuthGroup,\n ArenaUserAuthGroupProps,\n ArenaAuthToken,\n ArenaUserAuthTokenPayload,\n ArenaUserAuthTokenService,\n ArenaUserPrefs,\n ArenaUserPrefSurveys,\n ArenaUserProps,\n ArenaUserAuthRefreshToken,\n ArenaUserAuthRefreshTokenProps,\n ArenaUserAuthRefreshTokenPayload,\n ArenaUserService,\n ArenaUserTokenPayload,\n ArenaDownloadAuthTokenPayload,\n ArenaUserGroup,\n ArenaUserGroupProps,\n ArenaUserGroupQualifier,\n ArenaUserInvitation,\n} from './auth'\n\nexport { CategoryFactory, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryProps,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\n ArenaChainNodeDefAggregate,\n ArenaChainNodeDefAggregateProps,\n} from './chain'\n\nexport { TraverseMethod } from './common'\nexport type { ArenaObject, ArenaService, ArenaDictionary, ArenaFactory, ArenaI18n } from './common'\n\nexport type { ArenaFlatDataExportOptions, ArenaExportInfoFactoryParams, ArenaExportInfo } from './dataExport'\nexport {\n FlatDataExportDefaultOptions,\n FlatDataExportOption,\n FlatDataFiles,\n FlatDataExportModel,\n FlatDataExportColumnDataType,\n ArenaExportFile,\n ArenaExportInfoFactory,\n ArenaExportType,\n UniqueFileNamesGenerator,\n} from './dataExport'\n\nexport { DataQueryMode, DataQuerySummaries } from './dataQuery'\nexport type { ArenaDataQuery, ArenaDataQuerySummary, ArenaDataQuerySummaryProps } from './dataQuery'\n\nexport { SystemError, SystemErrorKeys } from './error'\n\nexport {\n ExpressionNodeType,\n ExpressionNodeEvaluator,\n ExpressionVariable,\n JavascriptExpressionEvaluator,\n JavascriptExpressionParser,\n} from './expression'\nexport type {\n ArenaArrayExpression,\n ArenaBinaryExpression,\n ArenaCallExpression,\n ArenaCompoundExpression,\n ArenaConditionalExpression,\n ArenaExpressionContext,\n ArenaExpressionEvaluator,\n ArenaExpressionFunction,\n ArenaExpressionFunctions,\n ArenaAnyExpressionNode,\n ArenaExpressionNode,\n ArenaExpressionNodeEvaluatorConstructor,\n ArenaMemberExpression,\n ArenaIdentifierExpression,\n ArenaLiteralExpression,\n ArenaSequenceExpression,\n ArenaThisExpression,\n ArenaUnaryExpression,\n} from './expression'\n\nexport { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp'\nexport type { ArenaExtraPropDef, ArenaExtraPropDefs } from './extraProp'\n\nexport { PointFactory, Points } from './geo'\nexport type {\n ArenaAreaOfInterest,\n ArenaAreaOfInterestDescriptor,\n ArenaGeoPolygonFeature,\n ArenaGeoTrackFeature,\n ArenaGeoTrackFeatureProperties,\n ArenaPoint,\n} from './geo'\n\nexport { JobBase, JobEventType, JobStatus } from './job'\nexport type { ArenaJob, ArenaJobContext, ArenaJobEvent, ArenaJobSerialized, ArenaJobTxClient } from './job'\n\nexport { LanguageCode, Languages, LanguagesISO639part2 } from './language'\nexport type { ArenaLabels } from './language'\n\nexport type { ArenaLogger } from './logger'\n\nexport type { ArenaMessage } from './message'\nexport { MessageNotificationType, MessagePropsKey, MessageStatus, MessageTargetUserType, Messages } from './message'\n\nexport {\n RecordNodeFactory,\n RecordNodeKeys,\n RecordNodeMetaKeys,\n RecordNodes,\n RecordNodeValueFormatter,\n RecordNodeValues,\n} from './node'\nexport type {\n ArenaRecordNode,\n ArenaRecordNodeMeta,\n ArenaRecordNodePointer,\n ArenaRecordNodeRefData,\n ArenaRecordNodesMap,\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\n ArenaRecordNodeValueTaxon,\n} from './node'\n\nexport {\n NodeDefCountType,\n NodeDefExpressionFactory,\n NodeDefType,\n NodeDefFactory,\n NodeDefs,\n NodeDefEntityRenderType,\n NodeDefFileType,\n NodeDefTextInputType,\n NodeDefTextRenderType,\n FormHeaderColor,\n} from './nodeDef'\n\nexport { NodeDefExpressionEvaluator, NodeDefExpressionValidator } from './nodeDefExpressionEvaluator'\nexport type {\n ArenaAreaOfInterestProvider,\n ArenaCategoryItemProvider,\n ArenaTaxonProvider,\n} from './nodeDefExpressionEvaluator'\n\nexport type {\n ArenaNodeDef,\n ArenaAnyNodeDef,\n ArenaNodeDefLayout,\n ArenaNodeDefMeta,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n ArenaNodeDefBoolean,\n ArenaNodeDefBooleanProps,\n ArenaNodeDefCode,\n ArenaNodeDefCodeLayout,\n ArenaNodeDefCodeProps,\n ArenaCoordinateAdditionalField,\n ArenaNodeDefCoordinate,\n ArenaNodeDefCoordinateProps,\n ArenaNodeDefDate,\n ArenaNodeDefDecimal,\n ArenaNodeDefDecimalProps,\n ArenaNodeDefEntity,\n ArenaNodeDefEntityChildPosition,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n ArenaNodeDefEntityProps,\n ArenaNodeDefPrintOrientation,\n ArenaNodeDefFile,\n ArenaNodeDefFileProps,\n ArenaNodeDefGeo,\n ArenaNodeDefGeoProps,\n ArenaNodeDefFormHeader,\n ArenaNodeDefFormHeaderProps,\n ArenaNodeDefInteger,\n ArenaNodeDefPropsAdvanced,\n ArenaNodeDefTaxon,\n ArenaNodeDefTaxonProps,\n ArenaNodeDefText,\n ArenaNodeDefTextProps,\n ArenaNodeDefTextLayout,\n ArenaNodeDefTime,\n ArenaNodeDefTimeProps,\n ArenaNodeDefCountExpression,\n ArenaNodeDefExpression,\n ArenaNodeDefExpressionFactoryParams,\n ArenaNodeDefMap,\n ArenaNodeDefValidations,\n} from './nodeDef'\n\nexport {\n RecordNodePointers,\n RecordCloner,\n RecordFactory,\n RecordFixer,\n Records,\n RECORD_STEP_DEFAULT,\n RecordStepAnalysisCode,\n RecordStepCleansingCode,\n RecordStepEntryCode,\n RecordStepNames,\n RecordSteps,\n RecordStepsList,\n RecordExpressionEvaluator,\n RecordNodesUpdater,\n RecordPrettyPrinter,\n RecordUpdater,\n RecordUpdateResult,\n RecordValidator,\n RecordValidations,\n} from './record'\nexport type {\n ArenaAttributeValidatorParams,\n ArenaAttributesValidatorParams,\n ArenaRecordNodeCreateParams,\n ArenaRecordNodesUpdateParams,\n ArenaRecord,\n ArenaRecordExpressionContext,\n ArenaRecordExpressionEvaluationContext,\n ArenaRecordService,\n ArenaRecordStep,\n ArenaRecordSummary,\n ArenaRecordUpdateOptions,\n ArenaRecordValidatorParams,\n ArenaSortedAttributesValidatorParams,\n} from './record'\n\nexport { ServiceRegistry, ServiceType } from './registry'\nexport type { ArenaServiceTypeMap } from './registry'\n\nexport { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs'\nexport type { ArenaSRS, ArenaSRSIndex } from './srs'\n\nexport {\n NodeDefsFixer,\n SurveyDocImages,\n SurveyDocImageFactory,\n SurveyDocPlace,\n SurveyDependencyType,\n SurveyFactory,\n SurveyFileFactory,\n SurveyFileType,\n SurveyRefDataFactory,\n SurveySecurityProp,\n Surveys,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n defaultCycle,\n} from './survey'\nexport type {\n ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependency,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageFactoryParams,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileFactoryParams,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveyRefData,\n ArenaSurveySecurity,\n ArenaSurveyService,\n ArenaSurveyOrSummary,\n ArenaSurveySummary,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\n} from './taxonomy'\n\nexport { SurveyBuilder, SurveyObjectBuilders } from './tests/builder/surveyBuilder'\nexport { RecordBuilder, RecordNodeBuilders } from './tests/builder/recordBuilder'\n\nexport {\n Arrays,\n DateFormats,\n Dates,\n FileNames,\n FileProcessor,\n Numbers,\n Objects,\n Promises,\n Queue,\n RetryProcessor,\n Strings,\n UnitOfTime,\n UUIDs,\n Versions,\n} from './utils'\n\nexport type {\n ArenaFileProcessorChunk,\n ArenaFileProcessorConstructorArgs,\n ArenaFileProcessorUriChunk,\n ArenaMutationOptions,\n ArenaParsedVersion,\n} from './utils'\n\nexport {\n FieldValidators,\n ValidationFactory,\n ValidationResultFactory,\n ValidationResults,\n Validations,\n ValidationSeverity,\n Validator,\n ValidatorErrorKeys,\n} from './validation'\nexport type {\n ArenaDissocFieldValidationOptions,\n ArenaFieldValidator,\n ArenaValidation,\n ArenaValidationFields,\n ArenaValidationResult,\n ArenaValidationCounts,\n} from './validation'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EACL,UAAU,EACV,aAAa,EACb,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,KAAK,GACN,MAAM,QAAQ,CAAA;AAwBf,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAUvF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAU5E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,wBAAwB,GACzB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAG/D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAEtD,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,cAAc,CAAA;AAsBrB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAU5C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxD,OAAO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AqB,EAAE,MAAM,YAAY,CAAA;AAanH,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACnF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAEjF,OAAO,EACL,MAAM,EACN,WAAW,EACX,KAAK,EACL,SAAS,EACT,aAAa,EACb,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,cAAc,EACd,OAAO,EACP,UAAU,EACV,KAAK,EACL,QAAQ,GACT,MAAM,SAAS,CAAA;AAUhB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,kBAAkB,GACnB,MAAM,cAAc,CAAA","sourcesContent":["export type { ArenaAppInfo, ArenaAppPlatform } from './app'\nexport { AppInfos } from './app'\n\nexport {\n Authorizer,\n AuthGroupName,\n createDefaultAuthGroups,\n UserStatus,\n Permission,\n UserTitle,\n UserFactory,\n Users,\n} from './auth'\nexport type {\n ArenaAuthGroup,\n ArenaUser,\n ArenaUserAuthGroup,\n ArenaUserAuthGroupProps,\n ArenaAuthToken,\n ArenaUserAuthTokenPayload,\n ArenaUserAuthTokenService,\n ArenaUserPrefs,\n ArenaUserPrefSurveys,\n ArenaUserProps,\n ArenaUserAuthRefreshToken,\n ArenaUserAuthRefreshTokenProps,\n ArenaUserAuthRefreshTokenPayload,\n ArenaUserService,\n ArenaUserTokenPayload,\n ArenaDownloadAuthTokenPayload,\n ArenaUserGroup,\n ArenaUserGroupProps,\n ArenaUserGroupQualifier,\n ArenaUserInvitation,\n} from './auth'\n\nexport { CategoryFactory, CategoryItemFactory, CategoryLevelFactory } from './category'\nexport type {\n ArenaCategoryItemProps,\n ArenaCategory,\n ArenaCategoryItem,\n ArenaCategoryLevel,\n ArenaCategoryLevelProps,\n ArenaCategoryProps,\n} from './category'\n\nexport { Categories, CategoryItems } from './category'\n\nexport { ChainFactory, ChainStatusExec, ChainNodeDefFactory } from './chain'\nexport type {\n ArenaChain,\n ArenaChainProps,\n ArenaChainNodeDef,\n ArenaChainNodeDefProps,\n ArenaChainNodeDefAggregate,\n ArenaChainNodeDefAggregateProps,\n} from './chain'\n\nexport { TraverseMethod } from './common'\nexport type { ArenaObject, ArenaService, ArenaDictionary, ArenaFactory, ArenaI18n } from './common'\n\nexport type { ArenaFlatDataExportOptions, ArenaExportInfoFactoryParams, ArenaExportInfo } from './dataExport'\nexport {\n FlatDataExportDefaultOptions,\n FlatDataExportOption,\n FlatDataFiles,\n FlatDataExportModel,\n FlatDataExportColumnDataType,\n ArenaExportFile,\n ArenaExportInfoFactory,\n ArenaExportType,\n UniqueFileNamesGenerator,\n} from './dataExport'\n\nexport { DataQueryMode, DataQuerySummaries } from './dataQuery'\nexport type { ArenaDataQuery, ArenaDataQuerySummary, ArenaDataQuerySummaryProps } from './dataQuery'\n\nexport { SystemError, SystemErrorKeys } from './error'\n\nexport {\n ExpressionNodeType,\n ExpressionNodeEvaluator,\n ExpressionVariable,\n JavascriptExpressionEvaluator,\n JavascriptExpressionParser,\n} from './expression'\nexport type {\n ArenaArrayExpression,\n ArenaBinaryExpression,\n ArenaCallExpression,\n ArenaCompoundExpression,\n ArenaConditionalExpression,\n ArenaExpressionContext,\n ArenaExpressionEvaluator,\n ArenaExpressionFunction,\n ArenaExpressionFunctions,\n ArenaAnyExpressionNode,\n ArenaExpressionNode,\n ArenaExpressionNodeEvaluatorConstructor,\n ArenaMemberExpression,\n ArenaIdentifierExpression,\n ArenaLiteralExpression,\n ArenaSequenceExpression,\n ArenaThisExpression,\n ArenaUnaryExpression,\n} from './expression'\n\nexport { ExtraPropDataType, ExtraPropsDataGenerator } from './extraProp'\nexport type { ArenaExtraPropDef, ArenaExtraPropDefs } from './extraProp'\n\nexport { PointFactory, Points } from './geo'\nexport type {\n ArenaAreaOfInterest,\n ArenaAreaOfInterestDescriptor,\n ArenaGeoPolygonFeature,\n ArenaGeoTrackFeature,\n ArenaGeoTrackFeatureProperties,\n ArenaPoint,\n} from './geo'\n\nexport { JobBase, JobEventType, JobStatus } from './job'\nexport type { ArenaJob, ArenaJobContext, ArenaJobEvent, ArenaJobSerialized, ArenaJobTxClient } from './job'\n\nexport { LanguageCode, Languages, LanguagesISO639part2 } from './language'\nexport type { ArenaLabels } from './language'\n\nexport type { ArenaLogger } from './logger'\n\nexport type { ArenaMessage } from './message'\nexport { MessageNotificationType, MessagePropsKey, MessageStatus, MessageTargetUserType, Messages } from './message'\n\nexport {\n RecordNodeFactory,\n RecordNodeKeys,\n RecordNodeMetaKeys,\n RecordNodes,\n RecordNodeValueFormatter,\n RecordNodeValues,\n} from './node'\nexport type {\n ArenaRecordNode,\n ArenaRecordNodeMeta,\n ArenaRecordNodePointer,\n ArenaRecordNodeRefData,\n ArenaRecordNodesMap,\n ArenaRecordNodeUpdateOptions,\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\n ArenaRecordNodeValueTaxon,\n} from './node'\n\nexport {\n NodeDefCountType,\n NodeDefExpressionFactory,\n NodeDefType,\n NodeDefFactory,\n NodeDefs,\n NodeDefEntityRenderType,\n NodeDefFileType,\n NodeDefTextInputType,\n NodeDefTextRenderType,\n FormHeaderColor,\n} from './nodeDef'\n\nexport { NodeDefExpressionEvaluator, NodeDefExpressionValidator } from './nodeDefExpressionEvaluator'\nexport type {\n ArenaAreaOfInterestProvider,\n ArenaCategoryItemProvider,\n ArenaTaxonProvider,\n} from './nodeDefExpressionEvaluator'\n\nexport type {\n ArenaNodeDef,\n ArenaAnyNodeDef,\n ArenaNodeDefLayout,\n ArenaNodeDefMeta,\n ArenaNodeDefProps,\n ArenaNodeDefPropsWithLayout,\n ArenaNodeDefBoolean,\n ArenaNodeDefBooleanProps,\n ArenaNodeDefCode,\n ArenaNodeDefCodeLayout,\n ArenaNodeDefCodeProps,\n ArenaCoordinateAdditionalField,\n ArenaNodeDefCoordinate,\n ArenaNodeDefCoordinateProps,\n ArenaNodeDefDate,\n ArenaNodeDefDecimal,\n ArenaNodeDefDecimalProps,\n ArenaNodeDefEntity,\n ArenaNodeDefEntityChildPosition,\n ArenaNodeDefEntityLayout,\n ArenaNodeDefEntityLayoutChildItem,\n ArenaNodeDefEntityProps,\n ArenaNodeDefPrintOrientation,\n ArenaNodeDefFile,\n ArenaNodeDefFileProps,\n ArenaNodeDefGeo,\n ArenaNodeDefGeoProps,\n ArenaNodeDefFormHeader,\n ArenaNodeDefFormHeaderProps,\n ArenaNodeDefInteger,\n ArenaNodeDefPropsAdvanced,\n ArenaNodeDefTaxon,\n ArenaNodeDefTaxonProps,\n ArenaNodeDefText,\n ArenaNodeDefTextProps,\n ArenaNodeDefTextLayout,\n ArenaNodeDefTime,\n ArenaNodeDefTimeProps,\n ArenaNodeDefCountExpression,\n ArenaNodeDefExpression,\n ArenaNodeDefExpressionFactoryParams,\n ArenaNodeDefMap,\n ArenaNodeDefValidations,\n} from './nodeDef'\n\nexport {\n RecordNodePointers,\n RecordCloner,\n RecordFactory,\n RecordFixer,\n Records,\n RECORD_STEP_DEFAULT,\n RecordStepAnalysisCode,\n RecordStepCleansingCode,\n RecordStepEntryCode,\n RecordStepNames,\n RecordSteps,\n RecordStepsList,\n RecordExpressionEvaluator,\n RecordNodesUpdater,\n RecordPrettyPrinter,\n RecordUpdater,\n RecordUpdateResult,\n RecordValidator,\n RecordValidations,\n} from './record'\nexport type {\n ArenaAttributeValidatorParams,\n ArenaAttributesValidatorParams,\n ArenaRecordNodeCreateParams,\n ArenaRecordNodesUpdateParams,\n ArenaRecord,\n ArenaRecordExpressionContext,\n ArenaRecordExpressionEvaluationContext,\n ArenaRecordService,\n ArenaRecordStep,\n ArenaRecordSummary,\n ArenaRecordUpdateOptions,\n ArenaRecordValidatorParams,\n ArenaSortedAttributesValidatorParams,\n} from './record'\n\nexport { ServiceRegistry, ServiceType } from './registry'\nexport type { ArenaServiceTypeMap } from './registry'\n\nexport { DEFAULT_SRS, DEFAULT_SRS_INDEX, SRSFactory } from './srs'\nexport type { ArenaSRS, ArenaSRSIndex } from './srs'\n\nexport {\n NodeDefsFixer,\n SurveyDocImages,\n SurveyDocImageFactory,\n SurveyDocPlace,\n SurveyDependencyType,\n SurveyFactory,\n SurveyFileFactory,\n SurveyFileType,\n SurveyRefDataFactory,\n SurveySecurityProp,\n Surveys,\n surveyDocImagePropKeys,\n surveySecurityDefaults,\n defaultCycle,\n} from './survey'\nexport type {\n ArenaSurvey,\n ArenaSurveyCycle,\n ArenaSurveyDependency,\n ArenaSurveyDependencyGraph,\n ArenaSurveyDocImage,\n ArenaSurveyDocImageFactoryParams,\n ArenaSurveyDocImageProps,\n ArenaSurveyFile,\n ArenaSurveyFileFactoryParams,\n ArenaSurveyFileProps,\n ArenaSurveyNodeDefsIndex,\n ArenaSurveyProps,\n ArenaSurveyRefData,\n ArenaSurveySecurity,\n ArenaSurveyService,\n ArenaSurveyOrSummary,\n ArenaSurveySummary,\n} from './survey'\n\nexport { Taxa, Taxonomies, TaxonomyFactory, TaxonFactory, TaxonGenerator, VernacularNameFactory } from './taxonomy'\nexport type {\n ArenaVernacularNameParams,\n ArenaTaxonomyFactoryParams,\n ArenaTaxonFactoryParams,\n ArenaTaxonomy,\n ArenaVernacularNameProps,\n ArenaVernacularName,\n ArenaTaxonProps,\n ArenaTaxon,\n ArenaTaxonomyProps,\n} from './taxonomy'\n\nexport { SurveyBuilder, SurveyObjectBuilders } from './tests/builder/surveyBuilder'\nexport { RecordBuilder, RecordNodeBuilders } from './tests/builder/recordBuilder'\n\nexport {\n Arrays,\n DateFormats,\n Dates,\n FileNames,\n FileProcessor,\n Numbers,\n Objects,\n Promises,\n Queue,\n RetryProcessor,\n Strings,\n UnitOfTime,\n UUIDs,\n Versions,\n} from './utils'\n\nexport type {\n ArenaFileProcessorChunk,\n ArenaFileProcessorConstructorArgs,\n ArenaFileProcessorUriChunk,\n ArenaMutationOptions,\n ArenaParsedVersion,\n} from './utils'\n\nexport {\n FieldValidators,\n ValidationFactory,\n ValidationResultFactory,\n ValidationResults,\n Validations,\n ValidationSeverity,\n Validator,\n ValidatorErrorKeys,\n} from './validation'\nexport type {\n ArenaDissocFieldValidationOptions,\n ArenaFieldValidator,\n ArenaValidation,\n ArenaValidationFields,\n ArenaValidationResult,\n ArenaValidationCounts,\n} from './validation'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAa3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAa3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA","sourcesContent":["export type { ArenaRecordNode, ArenaRecordNodeMeta, ArenaRecordNodeRefData, ArenaRecordNodesMap } from './node'\n\nexport { RecordNodeKeys, RecordNodeMetaKeys } from './node'\n\nexport type { ArenaRecordNodePointer } from './nodePointer'\n\nexport type {\n ArenaRecordNodeValue,\n ArenaRecordNodeValueCode,\n ArenaRecordNodeValueCoordinate,\n ArenaRecordNodeValueFile,\n ArenaRecordNodeValueGeo,\n ArenaRecordNodeValueTaxon,\n} from './nodeValue'\n\nexport { RecordNodeFactory } from './factory'\n\nexport { RecordNodes } from './nodes'\nexport type { ArenaRecordNodeUpdateOptions } from './nodes'\n\nexport { RecordNodeValueFormatter } from './nodeValueFormatter'\n\nexport { RecordNodeValues } from './nodeValues'\n"]}
|
package/dist/esm/node/nodes.js
CHANGED
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { NodeDefCountType, NodeDefs } from '../nodeDef';
|
|
13
13
|
import { Dates, Objects } from '../utils';
|
|
14
|
+
const getDateModified = (options) => { var _a; return (_a = options === null || options === void 0 ? void 0 : options.dateModified) !== null && _a !== void 0 ? _a : Dates.nowFormattedForStorage(); };
|
|
14
15
|
const isRoot = (node) => !node.parentUuid;
|
|
15
16
|
const areEqual = (nodeA, nodeB) => nodeA.uuid === nodeB.uuid;
|
|
16
17
|
const isChildApplicable = (node, nodeDefUuid) => {
|
|
@@ -55,7 +56,7 @@ const isQualifierValueApplied = (node) => { var _a; var _b; return (_b = (_a = n
|
|
|
55
56
|
const isValueBlank = (node) => Objects.isEmpty(node.value);
|
|
56
57
|
const isValueNotBlank = (node) => Objects.isNotEmpty(node.value);
|
|
57
58
|
const hasUserInputValue = (node) => node && !isValueBlank(node) && !isDefaultValueApplied(node) && !isQualifierValueApplied(node);
|
|
58
|
-
const assocChildApplicability = (node, nodeDefUuid, applicable) => {
|
|
59
|
+
const assocChildApplicability = (node, nodeDefUuid, applicable, options) => {
|
|
59
60
|
var _a;
|
|
60
61
|
const childApplicability = Object.assign({}, (_a = node.meta) === null || _a === void 0 ? void 0 : _a.childApplicability);
|
|
61
62
|
if (!applicable) {
|
|
@@ -64,7 +65,7 @@ const assocChildApplicability = (node, nodeDefUuid, applicable) => {
|
|
|
64
65
|
else {
|
|
65
66
|
delete childApplicability[nodeDefUuid];
|
|
66
67
|
}
|
|
67
|
-
return Object.assign(Object.assign({}, node), { meta: Object.assign(Object.assign({}, node.meta), { childApplicability }), updated: true, dateModified:
|
|
68
|
+
return Object.assign(Object.assign({}, node), { meta: Object.assign(Object.assign({}, node.meta), { childApplicability }), updated: true, dateModified: getDateModified(options) });
|
|
68
69
|
};
|
|
69
70
|
const dissocChildApplicability = (node, nodeDefUuid) => {
|
|
70
71
|
var _a;
|
|
@@ -72,7 +73,7 @@ const dissocChildApplicability = (node, nodeDefUuid) => {
|
|
|
72
73
|
delete childApplicability[nodeDefUuid];
|
|
73
74
|
return Object.assign(Object.assign({}, node), { meta: Object.assign(Object.assign({}, node.meta), { childApplicability }) });
|
|
74
75
|
};
|
|
75
|
-
const updateMetaDictionary = ({ node, nodeDefUuid, propName, propValue, defaultValue = true, sideEffect, }) => {
|
|
76
|
+
const updateMetaDictionary = ({ node, nodeDefUuid, propName, propValue, defaultValue = true, sideEffect, dateModified, }) => {
|
|
76
77
|
var _a, _b;
|
|
77
78
|
const nodeUpdated = sideEffect ? node : Object.assign({}, node);
|
|
78
79
|
const metaOriginal = (_a = nodeUpdated.meta) !== null && _a !== void 0 ? _a : {};
|
|
@@ -89,15 +90,15 @@ const updateMetaDictionary = ({ node, nodeDefUuid, propName, propValue, defaultV
|
|
|
89
90
|
meta[propName] = dictionary;
|
|
90
91
|
nodeUpdated.meta = meta;
|
|
91
92
|
nodeUpdated.updated = true;
|
|
92
|
-
nodeUpdated.dateModified =
|
|
93
|
+
nodeUpdated.dateModified = getDateModified({ dateModified });
|
|
93
94
|
return nodeUpdated;
|
|
94
95
|
};
|
|
95
96
|
function assocChildEditable(node, nodeDefUuid, editable, options) {
|
|
96
|
-
const { sideEffect = false } = options !== null && options !== void 0 ? options : {};
|
|
97
|
-
return updateMetaDictionary({ node, nodeDefUuid, propName: 'cEdit', propValue: editable, sideEffect });
|
|
97
|
+
const { sideEffect = false, dateModified } = options !== null && options !== void 0 ? options : {};
|
|
98
|
+
return updateMetaDictionary({ node, nodeDefUuid, propName: 'cEdit', propValue: editable, sideEffect, dateModified });
|
|
98
99
|
}
|
|
99
100
|
const assocChildRequired = (node, nodeDefUuid, required, options) => {
|
|
100
|
-
const { sideEffect = false } = options !== null && options !== void 0 ? options : {};
|
|
101
|
+
const { sideEffect = false, dateModified } = options !== null && options !== void 0 ? options : {};
|
|
101
102
|
return updateMetaDictionary({
|
|
102
103
|
node,
|
|
103
104
|
nodeDefUuid,
|
|
@@ -105,15 +106,16 @@ const assocChildRequired = (node, nodeDefUuid, required, options) => {
|
|
|
105
106
|
propValue: required,
|
|
106
107
|
defaultValue: false,
|
|
107
108
|
sideEffect,
|
|
109
|
+
dateModified,
|
|
108
110
|
});
|
|
109
111
|
};
|
|
110
112
|
function assocChildVisible(node, nodeDefUuid, visible, options) {
|
|
111
|
-
const { sideEffect = false } = options !== null && options !== void 0 ? options : {};
|
|
112
|
-
return updateMetaDictionary({ node, nodeDefUuid, propName: 'cVis', propValue: visible, sideEffect });
|
|
113
|
+
const { sideEffect = false, dateModified } = options !== null && options !== void 0 ? options : {};
|
|
114
|
+
return updateMetaDictionary({ node, nodeDefUuid, propName: 'cVis', propValue: visible, sideEffect, dateModified });
|
|
113
115
|
}
|
|
114
116
|
const assocChildrenCount = (params) => {
|
|
115
117
|
var _a, _b;
|
|
116
|
-
const { node, nodeDefUuid, count, countType } = params;
|
|
118
|
+
const { node, nodeDefUuid, count, countType, dateModified } = params;
|
|
117
119
|
const countIndex = Object.assign({}, (countType === NodeDefCountType.max ? (_a = node.meta) === null || _a === void 0 ? void 0 : _a.childrenMaxCount : (_b = node.meta) === null || _b === void 0 ? void 0 : _b.childrenMinCount));
|
|
118
120
|
if (Number.isNaN(count)) {
|
|
119
121
|
delete countIndex[nodeDefUuid];
|
|
@@ -128,7 +130,7 @@ const assocChildrenCount = (params) => {
|
|
|
128
130
|
else {
|
|
129
131
|
metaUpdated.childrenMinCount = countIndex;
|
|
130
132
|
}
|
|
131
|
-
return Object.assign(Object.assign({}, node), { meta: metaUpdated, updated: true, dateModified:
|
|
133
|
+
return Object.assign(Object.assign({}, node), { meta: metaUpdated, updated: true, dateModified: getDateModified({ dateModified }) });
|
|
132
134
|
};
|
|
133
135
|
const assocChildrenMaxCount = (params) => assocChildrenCount(Object.assign(Object.assign({}, params), { countType: NodeDefCountType.max }));
|
|
134
136
|
const assocChildrenMinCount = (params) => assocChildrenCount(Object.assign(Object.assign({}, params), { countType: NodeDefCountType.min }));
|
|
@@ -153,7 +155,7 @@ function assocValue(node, value, options) {
|
|
|
153
155
|
const nodeUpdated = sideEffect ? node : Object.assign({}, node);
|
|
154
156
|
nodeUpdated.value = value;
|
|
155
157
|
nodeUpdated.updated = true;
|
|
156
|
-
nodeUpdated.dateModified =
|
|
158
|
+
nodeUpdated.dateModified = getDateModified(options);
|
|
157
159
|
if (isDefaultValueApplied(nodeUpdated) || isQualifierValueApplied(nodeUpdated)) {
|
|
158
160
|
// reset defaultValueApplied and qualifierValueApplied flags
|
|
159
161
|
const metaOriginal = (_a = nodeUpdated.meta) !== null && _a !== void 0 ? _a : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../src/node/nodes.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAgB,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAIzC,MAAM,MAAM,GAAG,CAAC,IAAqB,EAAW,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAA;AAEnE,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAE,KAAsB,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAA;AAEvG,MAAM,iBAAiB,GAAG,CAAC,IAAqB,EAAE,WAAmB,EAAW,EAAE;;IAChF,sFAAsF;IACtF,OAAO,CAAA,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,kBAAkB,0CAAG,WAAW,CAAC,MAAK,KAAK,CAAA;AAC/D,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,IAAqB,EAAE,WAAmB,EAAW,EA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B,qBAAqB;IACrB,qBAAqB;IACrB,UAAU;IACV,iBAAiB;IACjB,UAAU;CACX,CAAA","sourcesContent":["import { ArenaDictionary } from '../common'\nimport { ArenaNodeDef, NodeDefCountType, NodeDefs } from '../nodeDef'\nimport { Dates, Objects } from '../utils'\nimport { ArenaMutationOptions } from '../utils/mutationOptions'\nimport { ArenaRecordNode } from './node'\n\nconst isRoot = (node: ArenaRecordNode): boolean => !node.parentUuid\n\nconst areEqual = (nodeA: ArenaRecordNode, nodeB: ArenaRecordNode): boolean => nodeA.uuid === nodeB.uuid\n\nconst isChildApplicable = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child applicability is not defined for a node definition, consider it applicable\n return node.meta?.childApplicability?.[nodeDefUuid] !== false\n}\n\nconst isChildEditable = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child editability is not defined for a node definition, consider it editable\n return node.meta?.cEdit?.[nodeDefUuid] !== false\n}\n\nconst isChildVisible = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child visibility is not defined for a node definition, consider it visible\n return node.meta?.cVis?.[nodeDefUuid] !== false\n}\n\nconst isChildRequired = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child \"required if\" condition is not defined or not met for a node definition, consider it not required\n return node.meta?.cReq?.[nodeDefUuid] === true\n}\n\nconst getChildrenMinOrMaxCount = (params: {\n parentNode: ArenaRecordNode\n nodeDef: ArenaNodeDef<any>\n countType: NodeDefCountType\n}): number => {\n const { parentNode, nodeDef, countType } = params\n const countIndex =\n countType === NodeDefCountType.max ? parentNode.meta?.childrenMaxCount : parentNode.meta?.childrenMinCount\n\n const count = countIndex?.[nodeDef.uuid]\n if (!Objects.isEmpty(count)) return count!\n\n // count can be a constant value, specified in the node def min/max count prop\n const nodeDefCount =\n countType === NodeDefCountType.max ? NodeDefs.getMaxCount(nodeDef) : NodeDefs.getMinCount(nodeDef)\n // count expressions (array) are evaluated into the parent node meta (childrenMinCount/childrenMaxCount)\n return nodeDefCount && !Array.isArray(nodeDefCount) ? Number(nodeDefCount) : Number.NaN\n}\n\nconst getChildrenMaxCount = (params: { parentNode: ArenaRecordNode; nodeDef: ArenaNodeDef<any> }): number =>\n getChildrenMinOrMaxCount({ ...params, countType: NodeDefCountType.max })\n\nconst getChildrenMinCount = (params: { parentNode: ArenaRecordNode; nodeDef: ArenaNodeDef<any> }): number =>\n getChildrenMinOrMaxCount({ ...params, countType: NodeDefCountType.min })\n\nconst getHierarchy = (node: ArenaRecordNode): string[] => [...(node.meta?.h ?? [])]\n\nconst getHierarchyCode = (node: ArenaRecordNode): string[] => [...(node.meta?.hCode ?? [])]\n\nconst mergeNodes = (target: ArenaRecordNode, ...sources: ArenaRecordNode[] | object[]): ArenaRecordNode =>\n Objects.deepMerge(target, ...sources) as unknown as ArenaRecordNode\n\nconst isDefaultValueApplied = (node: ArenaRecordNode): boolean => node?.meta?.defaultValueApplied ?? false\n\nconst isQualifierValueApplied = (node: ArenaRecordNode): boolean => node?.meta?.qualifierValueApplied ?? false\n\nconst isValueBlank = (node: ArenaRecordNode): boolean => Objects.isEmpty(node.value)\n\nconst isValueNotBlank = (node: ArenaRecordNode): boolean => Objects.isNotEmpty(node.value)\n\nconst hasUserInputValue = (node: ArenaRecordNode): boolean =>\n node && !isValueBlank(node) && !isDefaultValueApplied(node) && !isQualifierValueApplied(node)\n\nconst assocChildApplicability = (node: ArenaRecordNode, nodeDefUuid: string, applicable: boolean): ArenaRecordNode => {\n const childApplicability = { ...node.meta?.childApplicability }\n if (!applicable) {\n childApplicability[nodeDefUuid] = applicable\n } else {\n delete childApplicability[nodeDefUuid]\n }\n return {\n ...node,\n meta: { ...node.meta, childApplicability },\n updated: true,\n dateModified: Dates.nowFormattedForStorage(),\n }\n}\n\nconst dissocChildApplicability = (node: ArenaRecordNode, nodeDefUuid: string) => {\n const childApplicability = { ...node.meta?.childApplicability }\n delete childApplicability[nodeDefUuid]\n return {\n ...node,\n meta: { ...node.meta, childApplicability },\n }\n}\n\ntype MetaBooleanDictionaryProp = 'childApplicability' | 'cEdit' | 'cVis' | 'cReq'\n\nconst updateMetaDictionary = ({\n node,\n nodeDefUuid,\n propName,\n propValue,\n defaultValue = true,\n sideEffect,\n}: {\n node: ArenaRecordNode\n nodeDefUuid: string\n propName: MetaBooleanDictionaryProp\n propValue: boolean\n defaultValue?: boolean\n sideEffect: boolean\n}): ArenaRecordNode => {\n const nodeUpdated = sideEffect ? node : { ...node }\n const metaOriginal = nodeUpdated.meta ?? {}\n const meta = sideEffect ? metaOriginal : { ...metaOriginal }\n const existingDictionary: ArenaDictionary<boolean> = meta[propName] ?? {}\n const dictionary = sideEffect ? existingDictionary : { ...existingDictionary }\n if (propValue === defaultValue) {\n // default value: not stored\n delete dictionary[nodeDefUuid]\n } else {\n dictionary[nodeDefUuid] = propValue\n }\n meta[propName] = dictionary\n nodeUpdated.meta = meta\n nodeUpdated.updated = true\n nodeUpdated.dateModified = Dates.nowFormattedForStorage()\n return nodeUpdated\n}\n\nfunction assocChildEditable(\n node: ArenaRecordNode,\n nodeDefUuid: string,\n editable: boolean,\n options?: ArenaMutationOptions\n): ArenaRecordNode {\n const { sideEffect = false } = options ?? {}\n return updateMetaDictionary({ node, nodeDefUuid, propName: 'cEdit', propValue: editable, sideEffect })\n}\n\nconst assocChildRequired = (\n node: ArenaRecordNode,\n nodeDefUuid: string,\n required: boolean,\n options?: ArenaMutationOptions\n): ArenaRecordNode => {\n const { sideEffect = false } = options ?? {}\n return updateMetaDictionary({\n node,\n nodeDefUuid,\n propName: 'cReq',\n propValue: required,\n defaultValue: false,\n sideEffect,\n })\n}\n\nfunction assocChildVisible(\n node: ArenaRecordNode,\n nodeDefUuid: string,\n visible: boolean,\n options?: ArenaMutationOptions\n): ArenaRecordNode {\n const { sideEffect = false } = options ?? {}\n return updateMetaDictionary({ node, nodeDefUuid, propName: 'cVis', propValue: visible, sideEffect })\n}\n\nconst assocChildrenCount = (params: {\n node: ArenaRecordNode\n nodeDefUuid: string\n count: number\n countType: NodeDefCountType\n}): ArenaRecordNode => {\n const { node, nodeDefUuid, count, countType } = params\n const countIndex = {\n ...(countType === NodeDefCountType.max ? node.meta?.childrenMaxCount : node.meta?.childrenMinCount),\n }\n if (Number.isNaN(count)) {\n delete countIndex[nodeDefUuid]\n } else {\n countIndex[nodeDefUuid] = count\n }\n const metaUpdated = { ...node.meta }\n if (countType === NodeDefCountType.max) {\n metaUpdated.childrenMaxCount = countIndex\n } else {\n metaUpdated.childrenMinCount = countIndex\n }\n return {\n ...node,\n meta: metaUpdated,\n updated: true,\n dateModified: Dates.nowFormattedForStorage(),\n }\n}\n\nconst assocChildrenMaxCount = (params: {\n node: ArenaRecordNode\n nodeDefUuid: string\n count: number\n}): ArenaRecordNode => assocChildrenCount({ ...params, countType: NodeDefCountType.max })\n\nconst assocChildrenMinCount = (params: {\n node: ArenaRecordNode\n nodeDefUuid: string\n count: number\n}): ArenaRecordNode => assocChildrenCount({ ...params, countType: NodeDefCountType.min })\n\nconst clearStatusFlagsInPlace = (node: ArenaRecordNode): ArenaRecordNode => {\n // do not use \"delete\": it would switch the node object to the (much bigger) V8 dictionary mode\n if (node.created !== undefined) node.created = undefined\n if (node.deleted !== undefined) node.deleted = undefined\n if (node.updated !== undefined) node.updated = undefined\n return node\n}\n\nconst omitStatusFlags = (node: ArenaRecordNode): ArenaRecordNode => {\n const { created: _created, deleted: _deleted, updated: _updated, ...nodeCleaned } = node\n return nodeCleaned\n}\n\nconst removeStatusFlags = ({\n node,\n sideEffect = false,\n}: {\n node: ArenaRecordNode\n sideEffect?: boolean\n}): ArenaRecordNode => (sideEffect ? clearStatusFlagsInPlace(node) : omitStatusFlags(node))\n\nfunction assocValue(node: ArenaRecordNode, value: any, options?: ArenaMutationOptions): ArenaRecordNode {\n const { sideEffect = false } = options ?? {}\n const nodeUpdated = sideEffect ? node : { ...node }\n nodeUpdated.value = value\n nodeUpdated.updated = true\n nodeUpdated.dateModified = Dates.nowFormattedForStorage()\n if (isDefaultValueApplied(nodeUpdated) || isQualifierValueApplied(nodeUpdated)) {\n // reset defaultValueApplied and qualifierValueApplied flags\n const metaOriginal = nodeUpdated.meta ?? {}\n const meta = sideEffect ? metaOriginal : { ...metaOriginal }\n nodeUpdated.meta = { ...meta, defaultValueApplied: false, qualifierValueApplied: false }\n }\n return nodeUpdated\n}\n\nexport const RecordNodes = {\n isRoot,\n areEqual,\n isChildApplicable,\n isChildEditable,\n isChildVisible,\n isChildRequired,\n getChildrenMinOrMaxCount,\n getChildrenMaxCount,\n getChildrenMinCount,\n getHierarchy,\n getHierarchyCode,\n isDefaultValueApplied,\n isQualifierValueApplied,\n isValueBlank,\n isValueNotBlank,\n hasUserInputValue,\n // update\n assocChildApplicability,\n dissocChildApplicability,\n assocChildEditable,\n assocChildVisible,\n assocChildRequired,\n assocChildrenCount,\n assocChildrenMaxCount,\n assocChildrenMinCount,\n mergeNodes,\n removeStatusFlags,\n assocValue,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../src/node/nodes.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAgB,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAezC,MAAM,eAAe,GAAG,CAAC,OAAsC,EAAU,EAAE,wBACzE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,mCAAI,KAAK,CAAC,sBAAsB,EAAE,GAAA,CAAA;AAEzD,MAAM,MAAM,GAAG,CAAC,IAAqB,EAAW,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAA;AAEnE,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAE,KAAsB,EAAW,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAA;AAEvG,MAAM,iBAAiB,GAAG,CAAC,IAAqB,EAAE,WAAmB,EAAW,EAAE;;IAChF,sFAAsF;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AAM;IACN,QAAQ;IACR,iBAAiB;IACjB,eAAe;IACf,cAAc;IACd,eAAe;IACf,wBAAwB;IACxB,mBAAmB;IACnB,mBAAmB;IACnB,YAAY;IACZ,gBAAgB;IAChB,qBAAqB;IACrB,uBAAuB;IACvB,YAAY;IACZ,eAAe;IACf,iBAAiB;IACjB,SAAS;IACT,uBAAuB;IACvB,wBAAwB;IACxB,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,UAAU;IACV,iBAAiB;IACjB,UAAU;CACX,CAAA","sourcesContent":["import { ArenaDictionary } from '../common'\nimport { ArenaNodeDef, NodeDefCountType, NodeDefs } from '../nodeDef'\nimport { Dates, Objects } from '../utils'\nimport { ArenaMutationOptions } from '../utils/mutationOptions'\nimport { ArenaRecordNode } from './node'\n\n/**\n * Options of the node update functions.\n */\nexport interface ArenaRecordNodeUpdateOptions extends ArenaMutationOptions {\n /**\n * Date of the modification (formatted for storage); the same date is used for all the nodes modified in the same record update.\n * @default now\n */\n dateModified?: string\n}\n\nconst getDateModified = (options?: ArenaRecordNodeUpdateOptions): string =>\n options?.dateModified ?? Dates.nowFormattedForStorage()\n\nconst isRoot = (node: ArenaRecordNode): boolean => !node.parentUuid\n\nconst areEqual = (nodeA: ArenaRecordNode, nodeB: ArenaRecordNode): boolean => nodeA.uuid === nodeB.uuid\n\nconst isChildApplicable = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child applicability is not defined for a node definition, consider it applicable\n return node.meta?.childApplicability?.[nodeDefUuid] !== false\n}\n\nconst isChildEditable = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child editability is not defined for a node definition, consider it editable\n return node.meta?.cEdit?.[nodeDefUuid] !== false\n}\n\nconst isChildVisible = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child visibility is not defined for a node definition, consider it visible\n return node.meta?.cVis?.[nodeDefUuid] !== false\n}\n\nconst isChildRequired = (node: ArenaRecordNode, nodeDefUuid: string): boolean => {\n // if child \"required if\" condition is not defined or not met for a node definition, consider it not required\n return node.meta?.cReq?.[nodeDefUuid] === true\n}\n\nconst getChildrenMinOrMaxCount = (params: {\n parentNode: ArenaRecordNode\n nodeDef: ArenaNodeDef<any>\n countType: NodeDefCountType\n}): number => {\n const { parentNode, nodeDef, countType } = params\n const countIndex =\n countType === NodeDefCountType.max ? parentNode.meta?.childrenMaxCount : parentNode.meta?.childrenMinCount\n\n const count = countIndex?.[nodeDef.uuid]\n if (!Objects.isEmpty(count)) return count!\n\n // count can be a constant value, specified in the node def min/max count prop\n const nodeDefCount =\n countType === NodeDefCountType.max ? NodeDefs.getMaxCount(nodeDef) : NodeDefs.getMinCount(nodeDef)\n // count expressions (array) are evaluated into the parent node meta (childrenMinCount/childrenMaxCount)\n return nodeDefCount && !Array.isArray(nodeDefCount) ? Number(nodeDefCount) : Number.NaN\n}\n\nconst getChildrenMaxCount = (params: { parentNode: ArenaRecordNode; nodeDef: ArenaNodeDef<any> }): number =>\n getChildrenMinOrMaxCount({ ...params, countType: NodeDefCountType.max })\n\nconst getChildrenMinCount = (params: { parentNode: ArenaRecordNode; nodeDef: ArenaNodeDef<any> }): number =>\n getChildrenMinOrMaxCount({ ...params, countType: NodeDefCountType.min })\n\nconst getHierarchy = (node: ArenaRecordNode): string[] => [...(node.meta?.h ?? [])]\n\nconst getHierarchyCode = (node: ArenaRecordNode): string[] => [...(node.meta?.hCode ?? [])]\n\nconst mergeNodes = (target: ArenaRecordNode, ...sources: ArenaRecordNode[] | object[]): ArenaRecordNode =>\n Objects.deepMerge(target, ...sources) as unknown as ArenaRecordNode\n\nconst isDefaultValueApplied = (node: ArenaRecordNode): boolean => node?.meta?.defaultValueApplied ?? false\n\nconst isQualifierValueApplied = (node: ArenaRecordNode): boolean => node?.meta?.qualifierValueApplied ?? false\n\nconst isValueBlank = (node: ArenaRecordNode): boolean => Objects.isEmpty(node.value)\n\nconst isValueNotBlank = (node: ArenaRecordNode): boolean => Objects.isNotEmpty(node.value)\n\nconst hasUserInputValue = (node: ArenaRecordNode): boolean =>\n node && !isValueBlank(node) && !isDefaultValueApplied(node) && !isQualifierValueApplied(node)\n\nconst assocChildApplicability = (\n node: ArenaRecordNode,\n nodeDefUuid: string,\n applicable: boolean,\n options?: Omit<ArenaRecordNodeUpdateOptions, 'sideEffect'>\n): ArenaRecordNode => {\n const childApplicability = { ...node.meta?.childApplicability }\n if (!applicable) {\n childApplicability[nodeDefUuid] = applicable\n } else {\n delete childApplicability[nodeDefUuid]\n }\n return {\n ...node,\n meta: { ...node.meta, childApplicability },\n updated: true,\n dateModified: getDateModified(options),\n }\n}\n\nconst dissocChildApplicability = (node: ArenaRecordNode, nodeDefUuid: string) => {\n const childApplicability = { ...node.meta?.childApplicability }\n delete childApplicability[nodeDefUuid]\n return {\n ...node,\n meta: { ...node.meta, childApplicability },\n }\n}\n\ntype MetaBooleanDictionaryProp = 'childApplicability' | 'cEdit' | 'cVis' | 'cReq'\n\nconst updateMetaDictionary = ({\n node,\n nodeDefUuid,\n propName,\n propValue,\n defaultValue = true,\n sideEffect,\n dateModified,\n}: {\n node: ArenaRecordNode\n nodeDefUuid: string\n propName: MetaBooleanDictionaryProp\n propValue: boolean\n defaultValue?: boolean\n sideEffect: boolean\n dateModified?: string\n}): ArenaRecordNode => {\n const nodeUpdated = sideEffect ? node : { ...node }\n const metaOriginal = nodeUpdated.meta ?? {}\n const meta = sideEffect ? metaOriginal : { ...metaOriginal }\n const existingDictionary: ArenaDictionary<boolean> = meta[propName] ?? {}\n const dictionary = sideEffect ? existingDictionary : { ...existingDictionary }\n if (propValue === defaultValue) {\n // default value: not stored\n delete dictionary[nodeDefUuid]\n } else {\n dictionary[nodeDefUuid] = propValue\n }\n meta[propName] = dictionary\n nodeUpdated.meta = meta\n nodeUpdated.updated = true\n nodeUpdated.dateModified = getDateModified({ dateModified })\n return nodeUpdated\n}\n\nfunction assocChildEditable(\n node: ArenaRecordNode,\n nodeDefUuid: string,\n editable: boolean,\n options?: ArenaRecordNodeUpdateOptions\n): ArenaRecordNode {\n const { sideEffect = false, dateModified } = options ?? {}\n return updateMetaDictionary({ node, nodeDefUuid, propName: 'cEdit', propValue: editable, sideEffect, dateModified })\n}\n\nconst assocChildRequired = (\n node: ArenaRecordNode,\n nodeDefUuid: string,\n required: boolean,\n options?: ArenaRecordNodeUpdateOptions\n): ArenaRecordNode => {\n const { sideEffect = false, dateModified } = options ?? {}\n return updateMetaDictionary({\n node,\n nodeDefUuid,\n propName: 'cReq',\n propValue: required,\n defaultValue: false,\n sideEffect,\n dateModified,\n })\n}\n\nfunction assocChildVisible(\n node: ArenaRecordNode,\n nodeDefUuid: string,\n visible: boolean,\n options?: ArenaRecordNodeUpdateOptions\n): ArenaRecordNode {\n const { sideEffect = false, dateModified } = options ?? {}\n return updateMetaDictionary({ node, nodeDefUuid, propName: 'cVis', propValue: visible, sideEffect, dateModified })\n}\n\nconst assocChildrenCount = (params: {\n node: ArenaRecordNode\n nodeDefUuid: string\n count: number\n countType: NodeDefCountType\n dateModified?: string\n}): ArenaRecordNode => {\n const { node, nodeDefUuid, count, countType, dateModified } = params\n const countIndex = {\n ...(countType === NodeDefCountType.max ? node.meta?.childrenMaxCount : node.meta?.childrenMinCount),\n }\n if (Number.isNaN(count)) {\n delete countIndex[nodeDefUuid]\n } else {\n countIndex[nodeDefUuid] = count\n }\n const metaUpdated = { ...node.meta }\n if (countType === NodeDefCountType.max) {\n metaUpdated.childrenMaxCount = countIndex\n } else {\n metaUpdated.childrenMinCount = countIndex\n }\n return {\n ...node,\n meta: metaUpdated,\n updated: true,\n dateModified: getDateModified({ dateModified }),\n }\n}\n\nconst assocChildrenMaxCount = (params: {\n node: ArenaRecordNode\n nodeDefUuid: string\n count: number\n dateModified?: string\n}): ArenaRecordNode => assocChildrenCount({ ...params, countType: NodeDefCountType.max })\n\nconst assocChildrenMinCount = (params: {\n node: ArenaRecordNode\n nodeDefUuid: string\n count: number\n dateModified?: string\n}): ArenaRecordNode => assocChildrenCount({ ...params, countType: NodeDefCountType.min })\n\nconst clearStatusFlagsInPlace = (node: ArenaRecordNode): ArenaRecordNode => {\n // do not use \"delete\": it would switch the node object to the (much bigger) V8 dictionary mode\n if (node.created !== undefined) node.created = undefined\n if (node.deleted !== undefined) node.deleted = undefined\n if (node.updated !== undefined) node.updated = undefined\n return node\n}\n\nconst omitStatusFlags = (node: ArenaRecordNode): ArenaRecordNode => {\n const { created: _created, deleted: _deleted, updated: _updated, ...nodeCleaned } = node\n return nodeCleaned\n}\n\nconst removeStatusFlags = ({\n node,\n sideEffect = false,\n}: {\n node: ArenaRecordNode\n sideEffect?: boolean\n}): ArenaRecordNode => (sideEffect ? clearStatusFlagsInPlace(node) : omitStatusFlags(node))\n\nfunction assocValue(node: ArenaRecordNode, value: any, options?: ArenaRecordNodeUpdateOptions): ArenaRecordNode {\n const { sideEffect = false } = options ?? {}\n const nodeUpdated = sideEffect ? node : { ...node }\n nodeUpdated.value = value\n nodeUpdated.updated = true\n nodeUpdated.dateModified = getDateModified(options)\n if (isDefaultValueApplied(nodeUpdated) || isQualifierValueApplied(nodeUpdated)) {\n // reset defaultValueApplied and qualifierValueApplied flags\n const metaOriginal = nodeUpdated.meta ?? {}\n const meta = sideEffect ? metaOriginal : { ...metaOriginal }\n nodeUpdated.meta = { ...meta, defaultValueApplied: false, qualifierValueApplied: false }\n }\n return nodeUpdated\n}\n\nexport const RecordNodes = {\n isRoot,\n areEqual,\n isChildApplicable,\n isChildEditable,\n isChildVisible,\n isChildRequired,\n getChildrenMinOrMaxCount,\n getChildrenMaxCount,\n getChildrenMinCount,\n getHierarchy,\n getHierarchyCode,\n isDefaultValueApplied,\n isQualifierValueApplied,\n isValueBlank,\n isValueNotBlank,\n hasUserInputValue,\n // update\n assocChildApplicability,\n dissocChildApplicability,\n assocChildEditable,\n assocChildVisible,\n assocChildRequired,\n assocChildrenCount,\n assocChildrenMaxCount,\n assocChildrenMinCount,\n mergeNodes,\n removeStatusFlags,\n assocValue,\n}\n"]}
|