@math.gl/expressions 4.2.0-alpha.5
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/LICENSE +140 -0
- package/README.md +12 -0
- package/dist/dggs.cjs +54 -0
- package/dist/dggs.cjs.map +6 -0
- package/dist/dggs.d.ts +18 -0
- package/dist/dggs.d.ts.map +1 -0
- package/dist/dggs.js +42 -0
- package/dist/dggs.js.map +1 -0
- package/dist/expression-eval.d.ts +103 -0
- package/dist/expression-eval.d.ts.map +1 -0
- package/dist/expression-eval.js +298 -0
- package/dist/expression-eval.js.map +1 -0
- package/dist/function-libraries.d.ts +75 -0
- package/dist/function-libraries.d.ts.map +1 -0
- package/dist/function-libraries.js +98 -0
- package/dist/function-libraries.js.map +1 -0
- package/dist/function-registry.d.ts +93 -0
- package/dist/function-registry.d.ts.map +1 -0
- package/dist/function-registry.js +131 -0
- package/dist/function-registry.js.map +1 -0
- package/dist/get.d.ts +9 -0
- package/dist/get.d.ts.map +1 -0
- package/dist/get.js +32 -0
- package/dist/get.js.map +1 -0
- package/dist/index.cjs +473 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/parse-expression-string.d.ts +21 -0
- package/dist/parse-expression-string.d.ts.map +1 -0
- package/dist/parse-expression-string.js +61 -0
- package/dist/parse-expression-string.js.map +1 -0
- package/package.json +50 -0
- package/src/dggs.ts +62 -0
- package/src/expression-eval.ts +426 -0
- package/src/function-libraries.ts +168 -0
- package/src/function-registry.ts +163 -0
- package/src/get.ts +37 -0
- package/src/index.ts +26 -0
- package/src/parse-expression-string.ts +80 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
const FUNCTION_NAME_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
5
|
+
const DISALLOWED_FUNCTION_NAMES = new Set(['__proto__', 'prototype', 'constructor']);
|
|
6
|
+
/**
|
|
7
|
+
* An isolated collection of named functions available to expression evaluators.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Registries are instance scoped. Registering a function does not affect other
|
|
11
|
+
* registries or evaluators that do not receive the registry.
|
|
12
|
+
*
|
|
13
|
+
* Function names must be valid JavaScript-style identifiers so they can be
|
|
14
|
+
* called directly from JSEP expressions.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const registry = new ExpressionFunctionRegistry()
|
|
19
|
+
* .registerFunction('double', (value) => value * 2)
|
|
20
|
+
* .registerFunctions(BASIC_MATH_FUNCTION_LIBRARY);
|
|
21
|
+
*
|
|
22
|
+
* const evaluate = compile('double(round(value))', {registry});
|
|
23
|
+
* evaluate({value: 2.4});
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export class ExpressionFunctionRegistry {
|
|
27
|
+
/**
|
|
28
|
+
* Creates a function registry.
|
|
29
|
+
*
|
|
30
|
+
* @param functionTables - Function tables to register in order.
|
|
31
|
+
* @throws If a table contains an invalid or duplicate function name.
|
|
32
|
+
*/
|
|
33
|
+
constructor(functionTables = []) {
|
|
34
|
+
this.functions = Object.create(null);
|
|
35
|
+
for (const functionTable of functionTables) {
|
|
36
|
+
this.registerFunctions(functionTable);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Registers one named function.
|
|
41
|
+
*
|
|
42
|
+
* @param name - Identifier used to call the function from an expression.
|
|
43
|
+
* @param fn - JavaScript function invoked with evaluated expression arguments.
|
|
44
|
+
* @param options - Duplicate registration behavior.
|
|
45
|
+
* @returns This registry.
|
|
46
|
+
* @throws If the name is invalid, the value is not a function, or the name is
|
|
47
|
+
* already registered and replacement was not requested.
|
|
48
|
+
*/
|
|
49
|
+
registerFunction(name, fn, options = {}) {
|
|
50
|
+
validateFunction(name, fn);
|
|
51
|
+
if (this.hasFunction(name) && !options.replace) {
|
|
52
|
+
throw new Error(`Expression function "${name}" is already registered.`);
|
|
53
|
+
}
|
|
54
|
+
this.functions[name] = fn;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Registers all entries in a function table.
|
|
59
|
+
*
|
|
60
|
+
* @param functionTable - Map from expression identifiers to JavaScript functions.
|
|
61
|
+
* @param options - Duplicate registration behavior.
|
|
62
|
+
* @returns This registry.
|
|
63
|
+
* @throws If any entry is invalid or conflicts with an existing registration.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* Validation is atomic: no entries are registered when any entry is invalid.
|
|
67
|
+
*/
|
|
68
|
+
registerFunctions(functionTable, options = {}) {
|
|
69
|
+
const entries = Object.entries(functionTable);
|
|
70
|
+
const names = new Set();
|
|
71
|
+
for (const [name, fn] of entries) {
|
|
72
|
+
validateFunction(name, fn);
|
|
73
|
+
if (names.has(name) || (this.hasFunction(name) && !options.replace)) {
|
|
74
|
+
throw new Error(`Expression function "${name}" is already registered.`);
|
|
75
|
+
}
|
|
76
|
+
names.add(name);
|
|
77
|
+
}
|
|
78
|
+
for (const [name, fn] of entries) {
|
|
79
|
+
this.functions[name] = fn;
|
|
80
|
+
}
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Removes a registered function.
|
|
85
|
+
*
|
|
86
|
+
* @param name - Function name to remove.
|
|
87
|
+
* @returns `true` when a function was removed.
|
|
88
|
+
*/
|
|
89
|
+
unregisterFunction(name) {
|
|
90
|
+
if (!this.hasFunction(name)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
return delete this.functions[name];
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Tests whether a function is registered.
|
|
97
|
+
*
|
|
98
|
+
* @param name - Function name to inspect.
|
|
99
|
+
* @returns `true` when the registry contains the name.
|
|
100
|
+
*/
|
|
101
|
+
hasFunction(name) {
|
|
102
|
+
return Object.prototype.hasOwnProperty.call(this.functions, name);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Returns a registered function.
|
|
106
|
+
*
|
|
107
|
+
* @param name - Function name to retrieve.
|
|
108
|
+
* @returns The registered function, or `undefined`.
|
|
109
|
+
*/
|
|
110
|
+
getFunction(name) {
|
|
111
|
+
return this.functions[name];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns an immutable snapshot of all registered functions.
|
|
115
|
+
*
|
|
116
|
+
* @returns A frozen function table.
|
|
117
|
+
*/
|
|
118
|
+
getFunctionTable() {
|
|
119
|
+
return Object.freeze({ ...this.functions });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/** Validates one registry entry. */
|
|
123
|
+
function validateFunction(name, fn) {
|
|
124
|
+
if (!FUNCTION_NAME_PATTERN.test(name) || DISALLOWED_FUNCTION_NAMES.has(name)) {
|
|
125
|
+
throw new Error(`Invalid expression function name "${name}".`);
|
|
126
|
+
}
|
|
127
|
+
if (typeof fn !== 'function') {
|
|
128
|
+
throw new TypeError(`Expression function "${name}" must be a function.`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=function-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-registry.js","sourceRoot":"","sources":["../src/function-registry.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAC3D,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAcrF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,0BAA0B;IAGrC;;;;;OAKG;IACH,YAAY,iBAAuD,EAAE;QARpD,cAAS,GAAG,MAAM,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C,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,IAAY;QAC7B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,IAAY;QACtB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,gBAAgB;QACd,OAAO,MAAM,CAAC,MAAM,CAAC,EAAC,GAAG,IAAI,CAAC,SAAS,EAAC,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,oCAAoC;AACpC,SAAS,gBAAgB,CAAC,IAAY,EAAE,EAAsB;IAC5D,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7E,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,IAAI,CAAC,CAAC;IACjE,CAAC;IACD,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE,CAAC;QAC7B,MAAM,IAAI,SAAS,CAAC,wBAAwB,IAAI,uBAAuB,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
|
package/dist/get.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access properties of nested containers using dot-path notation.
|
|
3
|
+
*
|
|
4
|
+
* @param container - Object from which to read a value.
|
|
5
|
+
* @param compositeKey - Dot-separated property path.
|
|
6
|
+
* @returns The nested value, or `undefined` when the path cannot be resolved.
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(container: Record<string, unknown>, compositeKey: string): unknown;
|
|
9
|
+
//# sourceMappingURL=get.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../src/get.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAQrF"}
|
package/dist/get.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Access properties of nested containers using dot-path notation.
|
|
6
|
+
*
|
|
7
|
+
* @param container - Object from which to read a value.
|
|
8
|
+
* @param compositeKey - Dot-separated property path.
|
|
9
|
+
* @returns The nested value, or `undefined` when the path cannot be resolved.
|
|
10
|
+
*/
|
|
11
|
+
export function get(container, compositeKey) {
|
|
12
|
+
let value = container;
|
|
13
|
+
for (const key of getKeys(compositeKey)) {
|
|
14
|
+
value = isObject(value) ? value[key] : undefined;
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
/** Tests whether a value can be used for property access. */
|
|
19
|
+
function isObject(value) {
|
|
20
|
+
return value !== null && typeof value === 'object';
|
|
21
|
+
}
|
|
22
|
+
const keyMap = {};
|
|
23
|
+
/** Returns a cached list of property names for a dot-separated path. */
|
|
24
|
+
function getKeys(compositeKey) {
|
|
25
|
+
let keyList = keyMap[compositeKey];
|
|
26
|
+
if (!keyList) {
|
|
27
|
+
keyList = compositeKey.split('.');
|
|
28
|
+
keyMap[compositeKey] = keyList;
|
|
29
|
+
}
|
|
30
|
+
return keyList;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=get.js.map
|
package/dist/get.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../src/get.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CAAC,SAAkC,EAAE,YAAoB;IAC1E,IAAI,KAAK,GAAY,SAAS,CAAC;IAE/B,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;QACxC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6DAA6D;AAC7D,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACrD,CAAC;AAED,MAAM,MAAM,GAA6B,EAAE,CAAC;AAE5C,wEAAwE;AACxE,SAAS,OAAO,CAAC,YAAoB;IACnC,IAAI,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IACnC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC;IACjC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// dist/index.js
|
|
30
|
+
var index_exports = {};
|
|
31
|
+
__export(index_exports, {
|
|
32
|
+
BASIC_MATH_FUNCTION_LIBRARY: () => BASIC_MATH_FUNCTION_LIBRARY,
|
|
33
|
+
ExpressionFunctionRegistry: () => ExpressionFunctionRegistry,
|
|
34
|
+
GEOSPATIAL_FUNCTION_LIBRARY: () => GEOSPATIAL_FUNCTION_LIBRARY,
|
|
35
|
+
addBinaryOp: () => addBinaryOp,
|
|
36
|
+
addUnaryOp: () => addUnaryOp,
|
|
37
|
+
compile: () => compile,
|
|
38
|
+
compileAsync: () => compileAsync,
|
|
39
|
+
eval: () => evaluateExpression,
|
|
40
|
+
evalAsync: () => evalAsync,
|
|
41
|
+
mergeFunctionLibraries: () => mergeFunctionLibraries,
|
|
42
|
+
parse: () => parse,
|
|
43
|
+
parseExpressionString: () => parseExpressionString
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(index_exports);
|
|
46
|
+
|
|
47
|
+
// dist/function-registry.js
|
|
48
|
+
var FUNCTION_NAME_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
49
|
+
var DISALLOWED_FUNCTION_NAMES = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
50
|
+
var ExpressionFunctionRegistry = class {
|
|
51
|
+
/**
|
|
52
|
+
* Creates a function registry.
|
|
53
|
+
*
|
|
54
|
+
* @param functionTables - Function tables to register in order.
|
|
55
|
+
* @throws If a table contains an invalid or duplicate function name.
|
|
56
|
+
*/
|
|
57
|
+
constructor(functionTables = []) {
|
|
58
|
+
this.functions = /* @__PURE__ */ Object.create(null);
|
|
59
|
+
for (const functionTable of functionTables) {
|
|
60
|
+
this.registerFunctions(functionTable);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Registers one named function.
|
|
65
|
+
*
|
|
66
|
+
* @param name - Identifier used to call the function from an expression.
|
|
67
|
+
* @param fn - JavaScript function invoked with evaluated expression arguments.
|
|
68
|
+
* @param options - Duplicate registration behavior.
|
|
69
|
+
* @returns This registry.
|
|
70
|
+
* @throws If the name is invalid, the value is not a function, or the name is
|
|
71
|
+
* already registered and replacement was not requested.
|
|
72
|
+
*/
|
|
73
|
+
registerFunction(name, fn, options = {}) {
|
|
74
|
+
validateFunction(name, fn);
|
|
75
|
+
if (this.hasFunction(name) && !options.replace) {
|
|
76
|
+
throw new Error(`Expression function "${name}" is already registered.`);
|
|
77
|
+
}
|
|
78
|
+
this.functions[name] = fn;
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Registers all entries in a function table.
|
|
83
|
+
*
|
|
84
|
+
* @param functionTable - Map from expression identifiers to JavaScript functions.
|
|
85
|
+
* @param options - Duplicate registration behavior.
|
|
86
|
+
* @returns This registry.
|
|
87
|
+
* @throws If any entry is invalid or conflicts with an existing registration.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* Validation is atomic: no entries are registered when any entry is invalid.
|
|
91
|
+
*/
|
|
92
|
+
registerFunctions(functionTable, options = {}) {
|
|
93
|
+
const entries = Object.entries(functionTable);
|
|
94
|
+
const names = /* @__PURE__ */ new Set();
|
|
95
|
+
for (const [name, fn] of entries) {
|
|
96
|
+
validateFunction(name, fn);
|
|
97
|
+
if (names.has(name) || this.hasFunction(name) && !options.replace) {
|
|
98
|
+
throw new Error(`Expression function "${name}" is already registered.`);
|
|
99
|
+
}
|
|
100
|
+
names.add(name);
|
|
101
|
+
}
|
|
102
|
+
for (const [name, fn] of entries) {
|
|
103
|
+
this.functions[name] = fn;
|
|
104
|
+
}
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Removes a registered function.
|
|
109
|
+
*
|
|
110
|
+
* @param name - Function name to remove.
|
|
111
|
+
* @returns `true` when a function was removed.
|
|
112
|
+
*/
|
|
113
|
+
unregisterFunction(name) {
|
|
114
|
+
if (!this.hasFunction(name)) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return delete this.functions[name];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Tests whether a function is registered.
|
|
121
|
+
*
|
|
122
|
+
* @param name - Function name to inspect.
|
|
123
|
+
* @returns `true` when the registry contains the name.
|
|
124
|
+
*/
|
|
125
|
+
hasFunction(name) {
|
|
126
|
+
return Object.prototype.hasOwnProperty.call(this.functions, name);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Returns a registered function.
|
|
130
|
+
*
|
|
131
|
+
* @param name - Function name to retrieve.
|
|
132
|
+
* @returns The registered function, or `undefined`.
|
|
133
|
+
*/
|
|
134
|
+
getFunction(name) {
|
|
135
|
+
return this.functions[name];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns an immutable snapshot of all registered functions.
|
|
139
|
+
*
|
|
140
|
+
* @returns A frozen function table.
|
|
141
|
+
*/
|
|
142
|
+
getFunctionTable() {
|
|
143
|
+
return Object.freeze({ ...this.functions });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
function validateFunction(name, fn) {
|
|
147
|
+
if (!FUNCTION_NAME_PATTERN.test(name) || DISALLOWED_FUNCTION_NAMES.has(name)) {
|
|
148
|
+
throw new Error(`Invalid expression function name "${name}".`);
|
|
149
|
+
}
|
|
150
|
+
if (typeof fn !== "function") {
|
|
151
|
+
throw new TypeError(`Expression function "${name}" must be a function.`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// dist/expression-eval.js
|
|
156
|
+
var import_jsep = __toESM(require("jsep"), 1);
|
|
157
|
+
|
|
158
|
+
// dist/function-libraries.js
|
|
159
|
+
var import_core = require("@math.gl/core");
|
|
160
|
+
var import_geospatial = require("@math.gl/geospatial");
|
|
161
|
+
var BASIC_MATH_FUNCTION_LIBRARY = {
|
|
162
|
+
abs: Math.abs,
|
|
163
|
+
acos: import_core.acos,
|
|
164
|
+
asin: import_core.asin,
|
|
165
|
+
atan: import_core.atan,
|
|
166
|
+
ceil: Math.ceil,
|
|
167
|
+
clamp: import_core.clamp,
|
|
168
|
+
cos: import_core.cos,
|
|
169
|
+
degrees: import_core.degrees,
|
|
170
|
+
exp: Math.exp,
|
|
171
|
+
floor: Math.floor,
|
|
172
|
+
lerp: import_core.lerp,
|
|
173
|
+
log: Math.log,
|
|
174
|
+
max: Math.max,
|
|
175
|
+
min: Math.min,
|
|
176
|
+
normalizeAngle: import_core.normalizeAngle,
|
|
177
|
+
pow: Math.pow,
|
|
178
|
+
radians: import_core.radians,
|
|
179
|
+
round: Math.round,
|
|
180
|
+
safeMod: import_core.safeMod,
|
|
181
|
+
sign: Math.sign,
|
|
182
|
+
sin: import_core.sin,
|
|
183
|
+
sqrt: Math.sqrt,
|
|
184
|
+
tan: import_core.tan,
|
|
185
|
+
toDegrees: import_core.toDegrees,
|
|
186
|
+
toRadians: import_core.toRadians,
|
|
187
|
+
trunc: Math.trunc
|
|
188
|
+
};
|
|
189
|
+
var GEOSPATIAL_FUNCTION_LIBRARY = {
|
|
190
|
+
cartesianToCartographic: (cartesian, result) => import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(cartesian, result),
|
|
191
|
+
cartographicToCartesian: (cartographic, result) => import_geospatial.Ellipsoid.WGS84.cartographicToCartesian(cartographic, result),
|
|
192
|
+
eastNorthUpToFixedFrame: (origin, result) => import_geospatial.Ellipsoid.WGS84.eastNorthUpToFixedFrame(origin, result),
|
|
193
|
+
geodeticSurfaceNormal: (cartesian, result) => import_geospatial.Ellipsoid.WGS84.geodeticSurfaceNormal(cartesian, result),
|
|
194
|
+
geodeticSurfaceNormalCartographic: (cartographic, result) => import_geospatial.Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(cartographic, result),
|
|
195
|
+
isWGS84: import_geospatial.isWGS84,
|
|
196
|
+
scaleToGeocentricSurface: (cartesian, result) => import_geospatial.Ellipsoid.WGS84.scaleToGeocentricSurface(cartesian, result),
|
|
197
|
+
scaleToGeodeticSurface: (cartesian, result) => import_geospatial.Ellipsoid.WGS84.scaleToGeodeticSurface(cartesian, result),
|
|
198
|
+
toDegrees: import_core.toDegrees,
|
|
199
|
+
toRadians: import_core.toRadians,
|
|
200
|
+
transformPositionFromScaledSpace: (position, result) => import_geospatial.Ellipsoid.WGS84.transformPositionFromScaledSpace(position, result),
|
|
201
|
+
transformPositionToScaledSpace: (position, result) => import_geospatial.Ellipsoid.WGS84.transformPositionToScaledSpace(position, result)
|
|
202
|
+
};
|
|
203
|
+
function mergeFunctionLibraries(context, options) {
|
|
204
|
+
var _a, _b;
|
|
205
|
+
if (!((_a = options == null ? void 0 : options.libraries) == null ? void 0 : _a.length)) {
|
|
206
|
+
if (!(options == null ? void 0 : options.registry)) {
|
|
207
|
+
return context;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return Object.assign({}, (_b = options.registry) == null ? void 0 : _b.getFunctionTable(), ...options.libraries || [], context);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// dist/expression-eval.js
|
|
214
|
+
var DEFAULT_PRECEDENCE = {
|
|
215
|
+
"||": 1,
|
|
216
|
+
"&&": 2,
|
|
217
|
+
"|": 3,
|
|
218
|
+
"^": 4,
|
|
219
|
+
"&": 5,
|
|
220
|
+
"==": 6,
|
|
221
|
+
"!=": 6,
|
|
222
|
+
"===": 6,
|
|
223
|
+
"!==": 6,
|
|
224
|
+
"<": 7,
|
|
225
|
+
">": 7,
|
|
226
|
+
"<=": 7,
|
|
227
|
+
">=": 7,
|
|
228
|
+
"<<": 8,
|
|
229
|
+
">>": 8,
|
|
230
|
+
">>>": 8,
|
|
231
|
+
"+": 9,
|
|
232
|
+
"-": 9,
|
|
233
|
+
"*": 10,
|
|
234
|
+
"/": 10,
|
|
235
|
+
"%": 10
|
|
236
|
+
};
|
|
237
|
+
var binops = {
|
|
238
|
+
"||": (a, b) => a || b,
|
|
239
|
+
"&&": (a, b) => a && b,
|
|
240
|
+
"|": (a, b) => a | b,
|
|
241
|
+
"^": (a, b) => a ^ b,
|
|
242
|
+
"&": (a, b) => a & b,
|
|
243
|
+
"==": (a, b) => {
|
|
244
|
+
return a == b;
|
|
245
|
+
},
|
|
246
|
+
"!=": (a, b) => {
|
|
247
|
+
return a != b;
|
|
248
|
+
},
|
|
249
|
+
"===": (a, b) => a === b,
|
|
250
|
+
"!==": (a, b) => a !== b,
|
|
251
|
+
"<": (a, b) => a < b,
|
|
252
|
+
">": (a, b) => a > b,
|
|
253
|
+
"<=": (a, b) => a <= b,
|
|
254
|
+
">=": (a, b) => a >= b,
|
|
255
|
+
"<<": (a, b) => a << b,
|
|
256
|
+
">>": (a, b) => a >> b,
|
|
257
|
+
">>>": (a, b) => a >>> b,
|
|
258
|
+
"+": (a, b) => {
|
|
259
|
+
return a + b;
|
|
260
|
+
},
|
|
261
|
+
"-": (a, b) => a - b,
|
|
262
|
+
"*": (a, b) => a * b,
|
|
263
|
+
"/": (a, b) => a / b,
|
|
264
|
+
"%": (a, b) => a % b
|
|
265
|
+
};
|
|
266
|
+
var unops = {
|
|
267
|
+
"-": (a) => -a,
|
|
268
|
+
"+": (a) => {
|
|
269
|
+
return +a;
|
|
270
|
+
},
|
|
271
|
+
"~": (a) => ~a,
|
|
272
|
+
"!": (a) => !a
|
|
273
|
+
};
|
|
274
|
+
function evaluateArray(list, context) {
|
|
275
|
+
return list.map((value) => evaluate(value, context));
|
|
276
|
+
}
|
|
277
|
+
async function evaluateArrayAsync(list, context) {
|
|
278
|
+
return await Promise.all(list.map((value) => evalAsync(value, context)));
|
|
279
|
+
}
|
|
280
|
+
function evaluateMember(node, context) {
|
|
281
|
+
const object = evaluate(node.object, context);
|
|
282
|
+
const key = node.computed ? evaluate(node.property, context) : node.property.name;
|
|
283
|
+
if (/^__proto__|prototype|constructor$/.test(key)) {
|
|
284
|
+
throw new Error(`Access to member "${key}" disallowed.`);
|
|
285
|
+
}
|
|
286
|
+
return [object, object == null ? void 0 : object[key]];
|
|
287
|
+
}
|
|
288
|
+
async function evaluateMemberAsync(node, context) {
|
|
289
|
+
const object = await evalAsync(node.object, context);
|
|
290
|
+
const key = node.computed ? await evalAsync(node.property, context) : node.property.name;
|
|
291
|
+
if (/^__proto__|prototype|constructor$/.test(key)) {
|
|
292
|
+
throw new Error(`Access to member "${key}" disallowed.`);
|
|
293
|
+
}
|
|
294
|
+
return [object, object == null ? void 0 : object[key]];
|
|
295
|
+
}
|
|
296
|
+
function evaluateExpression(node, context, options) {
|
|
297
|
+
const expression = node;
|
|
298
|
+
const mergedContext = mergeFunctionLibraries(context, options);
|
|
299
|
+
switch (expression.type) {
|
|
300
|
+
case "ArrayExpression":
|
|
301
|
+
return evaluateArray(expression.elements, mergedContext);
|
|
302
|
+
case "BinaryExpression":
|
|
303
|
+
if (expression.operator === "||") {
|
|
304
|
+
return evaluate(expression.left, mergedContext) || evaluate(expression.right, mergedContext);
|
|
305
|
+
}
|
|
306
|
+
if (expression.operator === "&&") {
|
|
307
|
+
return evaluate(expression.left, mergedContext) && evaluate(expression.right, mergedContext);
|
|
308
|
+
}
|
|
309
|
+
return binops[expression.operator](evaluate(expression.left, mergedContext), evaluate(expression.right, mergedContext));
|
|
310
|
+
case "CallExpression": {
|
|
311
|
+
let caller;
|
|
312
|
+
let fn;
|
|
313
|
+
if (expression.callee.type === "MemberExpression") {
|
|
314
|
+
const member = evaluateMember(expression.callee, mergedContext);
|
|
315
|
+
caller = member[0];
|
|
316
|
+
fn = member[1];
|
|
317
|
+
} else {
|
|
318
|
+
fn = evaluate(expression.callee, mergedContext);
|
|
319
|
+
}
|
|
320
|
+
if (typeof fn !== "function") {
|
|
321
|
+
return void 0;
|
|
322
|
+
}
|
|
323
|
+
return fn.apply(caller, evaluateArray(expression.arguments, mergedContext));
|
|
324
|
+
}
|
|
325
|
+
case "ConditionalExpression":
|
|
326
|
+
return evaluate(expression.test, mergedContext) ? evaluate(expression.consequent, mergedContext) : evaluate(expression.alternate, mergedContext);
|
|
327
|
+
case "Identifier":
|
|
328
|
+
return mergedContext[expression.name];
|
|
329
|
+
case "Literal":
|
|
330
|
+
return expression.value;
|
|
331
|
+
case "MemberExpression":
|
|
332
|
+
return evaluateMember(expression, mergedContext)[1];
|
|
333
|
+
case "ThisExpression":
|
|
334
|
+
return mergedContext;
|
|
335
|
+
case "UnaryExpression":
|
|
336
|
+
return unops[expression.operator](evaluate(expression.argument, mergedContext));
|
|
337
|
+
default:
|
|
338
|
+
return void 0;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function evaluate(node, context) {
|
|
342
|
+
return evaluateExpression(node, context);
|
|
343
|
+
}
|
|
344
|
+
async function evalAsync(node, context, options) {
|
|
345
|
+
const expression = node;
|
|
346
|
+
const mergedContext = mergeFunctionLibraries(context, options);
|
|
347
|
+
switch (expression.type) {
|
|
348
|
+
case "ArrayExpression":
|
|
349
|
+
return await evaluateArrayAsync(expression.elements, mergedContext);
|
|
350
|
+
case "BinaryExpression":
|
|
351
|
+
if (expression.operator === "||") {
|
|
352
|
+
return await evalAsync(expression.left, mergedContext) || await evalAsync(expression.right, mergedContext);
|
|
353
|
+
}
|
|
354
|
+
if (expression.operator === "&&") {
|
|
355
|
+
return await evalAsync(expression.left, mergedContext) && await evalAsync(expression.right, mergedContext);
|
|
356
|
+
}
|
|
357
|
+
return binops[expression.operator](await evalAsync(expression.left, mergedContext), await evalAsync(expression.right, mergedContext));
|
|
358
|
+
case "CallExpression": {
|
|
359
|
+
let caller;
|
|
360
|
+
let fn;
|
|
361
|
+
if (expression.callee.type === "MemberExpression") {
|
|
362
|
+
const member = await evaluateMemberAsync(expression.callee, mergedContext);
|
|
363
|
+
caller = member[0];
|
|
364
|
+
fn = member[1];
|
|
365
|
+
} else {
|
|
366
|
+
fn = await evalAsync(expression.callee, mergedContext);
|
|
367
|
+
}
|
|
368
|
+
if (typeof fn !== "function") {
|
|
369
|
+
return void 0;
|
|
370
|
+
}
|
|
371
|
+
return await fn.apply(caller, await evaluateArrayAsync(expression.arguments, mergedContext));
|
|
372
|
+
}
|
|
373
|
+
case "ConditionalExpression":
|
|
374
|
+
return await evalAsync(expression.test, mergedContext) ? await evalAsync(expression.consequent, mergedContext) : await evalAsync(expression.alternate, mergedContext);
|
|
375
|
+
case "Identifier":
|
|
376
|
+
return mergedContext[expression.name];
|
|
377
|
+
case "Literal":
|
|
378
|
+
return expression.value;
|
|
379
|
+
case "MemberExpression":
|
|
380
|
+
return (await evaluateMemberAsync(expression, mergedContext))[1];
|
|
381
|
+
case "ThisExpression":
|
|
382
|
+
return mergedContext;
|
|
383
|
+
case "UnaryExpression":
|
|
384
|
+
return unops[expression.operator](await evalAsync(expression.argument, mergedContext));
|
|
385
|
+
default:
|
|
386
|
+
return void 0;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function compile(expression, options) {
|
|
390
|
+
const ast = parse(expression);
|
|
391
|
+
return (context) => evaluateExpression(ast, context, options);
|
|
392
|
+
}
|
|
393
|
+
function compileAsync(expression, options) {
|
|
394
|
+
const ast = parse(expression);
|
|
395
|
+
return (context) => evalAsync(ast, context, options);
|
|
396
|
+
}
|
|
397
|
+
function addUnaryOp(operator, fn) {
|
|
398
|
+
import_jsep.default.addUnaryOp(operator);
|
|
399
|
+
unops[operator] = fn;
|
|
400
|
+
}
|
|
401
|
+
function addBinaryOp(operator, precedenceOrFn, fn) {
|
|
402
|
+
if (fn) {
|
|
403
|
+
import_jsep.default.addBinaryOp(operator, precedenceOrFn);
|
|
404
|
+
binops[operator] = fn;
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
import_jsep.default.addBinaryOp(operator, DEFAULT_PRECEDENCE[operator] || 1);
|
|
408
|
+
binops[operator] = precedenceOrFn;
|
|
409
|
+
}
|
|
410
|
+
function parse(expression) {
|
|
411
|
+
return typeof expression === "string" ? (0, import_jsep.default)(expression) : expression;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// dist/get.js
|
|
415
|
+
function get(container, compositeKey) {
|
|
416
|
+
let value = container;
|
|
417
|
+
for (const key of getKeys(compositeKey)) {
|
|
418
|
+
value = isObject(value) ? value[key] : void 0;
|
|
419
|
+
}
|
|
420
|
+
return value;
|
|
421
|
+
}
|
|
422
|
+
function isObject(value) {
|
|
423
|
+
return value !== null && typeof value === "object";
|
|
424
|
+
}
|
|
425
|
+
var keyMap = {};
|
|
426
|
+
function getKeys(compositeKey) {
|
|
427
|
+
let keyList = keyMap[compositeKey];
|
|
428
|
+
if (!keyList) {
|
|
429
|
+
keyList = compositeKey.split(".");
|
|
430
|
+
keyMap[compositeKey] = keyList;
|
|
431
|
+
}
|
|
432
|
+
return keyList;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// dist/parse-expression-string.js
|
|
436
|
+
var cachedExpressionMap = {
|
|
437
|
+
"-": (object) => object
|
|
438
|
+
};
|
|
439
|
+
function parseExpressionString(propValue) {
|
|
440
|
+
if (propValue in cachedExpressionMap) {
|
|
441
|
+
return cachedExpressionMap[propValue];
|
|
442
|
+
}
|
|
443
|
+
const ast = parse(propValue);
|
|
444
|
+
const func = ast.type === "Identifier" ? (row) => get(row, propValue) : compileAst(ast);
|
|
445
|
+
cachedExpressionMap[propValue] = func;
|
|
446
|
+
return func;
|
|
447
|
+
}
|
|
448
|
+
function compileAst(ast) {
|
|
449
|
+
traverse(ast, (node) => {
|
|
450
|
+
if (node.type === "CallExpression") {
|
|
451
|
+
throw new Error("Function calls not allowed in expression accessors");
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return (row) => evaluateExpression(ast, row);
|
|
455
|
+
}
|
|
456
|
+
function traverse(node, visitor) {
|
|
457
|
+
if (Array.isArray(node)) {
|
|
458
|
+
node.forEach((element) => traverse(element, visitor));
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (node && typeof node === "object") {
|
|
462
|
+
if (isNodeLike(node)) {
|
|
463
|
+
visitor(node);
|
|
464
|
+
}
|
|
465
|
+
for (const key in node) {
|
|
466
|
+
traverse(node[key], visitor);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function isNodeLike(node) {
|
|
471
|
+
return "type" in node && typeof node.type === "string";
|
|
472
|
+
}
|
|
473
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/function-registry.ts", "../src/expression-eval.ts", "../src/function-libraries.ts", "../src/get.ts", "../src/parse-expression-string.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;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