fig-tree-evaluator 2.9.0 → 2.11.0
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/README.md +104 -8
- package/build/index.cjs.js +1 -0
- package/build/index.d.ts +121 -4
- package/build/index.esm.js +1 -0
- package/package.json +12 -3
- package/build/FigTreeEvaluator.d.ts +0 -26
- package/build/FigTreeEvaluator.js +0 -121
- package/build/cache.d.ts +0 -27
- package/build/cache.js +0 -63
- package/build/evaluate.d.ts +0 -2
- package/build/evaluate.js +0 -87
- package/build/helpers.d.ts +0 -23
- package/build/helpers.js +0 -137
- package/build/index.js +0 -29
- package/build/operators/AND/data.d.ts +0 -4
- package/build/operators/AND/data.js +0 -22
- package/build/operators/AND/index.d.ts +0 -1
- package/build/operators/AND/index.js +0 -5
- package/build/operators/AND/operator.d.ts +0 -3
- package/build/operators/AND/operator.js +0 -53
- package/build/operators/BUILD_OBJECT/data.d.ts +0 -4
- package/build/operators/BUILD_OBJECT/data.js +0 -22
- package/build/operators/BUILD_OBJECT/index.d.ts +0 -1
- package/build/operators/BUILD_OBJECT/index.js +0 -17
- package/build/operators/BUILD_OBJECT/operator.d.ts +0 -2
- package/build/operators/BUILD_OBJECT/operator.js +0 -64
- package/build/operators/CONDITIONAL/data.d.ts +0 -4
- package/build/operators/CONDITIONAL/data.js +0 -36
- package/build/operators/CONDITIONAL/index.d.ts +0 -1
- package/build/operators/CONDITIONAL/index.js +0 -17
- package/build/operators/CONDITIONAL/operator.d.ts +0 -2
- package/build/operators/CONDITIONAL/operator.js +0 -59
- package/build/operators/COUNT/data.d.ts +0 -4
- package/build/operators/COUNT/data.js +0 -22
- package/build/operators/COUNT/index.d.ts +0 -1
- package/build/operators/COUNT/index.js +0 -17
- package/build/operators/COUNT/operator.d.ts +0 -2
- package/build/operators/COUNT/operator.js +0 -52
- package/build/operators/CUSTOM_FUNCTIONS/data.d.ts +0 -4
- package/build/operators/CUSTOM_FUNCTIONS/data.js +0 -43
- package/build/operators/CUSTOM_FUNCTIONS/index.d.ts +0 -1
- package/build/operators/CUSTOM_FUNCTIONS/index.js +0 -17
- package/build/operators/CUSTOM_FUNCTIONS/operator.d.ts +0 -2
- package/build/operators/CUSTOM_FUNCTIONS/operator.js +0 -65
- package/build/operators/DIVIDE/data.d.ts +0 -4
- package/build/operators/DIVIDE/data.js +0 -43
- package/build/operators/DIVIDE/index.d.ts +0 -1
- package/build/operators/DIVIDE/index.js +0 -17
- package/build/operators/DIVIDE/operator.d.ts +0 -2
- package/build/operators/DIVIDE/operator.js +0 -63
- package/build/operators/EQUAL/data.d.ts +0 -4
- package/build/operators/EQUAL/data.js +0 -29
- package/build/operators/EQUAL/index.d.ts +0 -1
- package/build/operators/EQUAL/index.js +0 -17
- package/build/operators/EQUAL/operator.d.ts +0 -2
- package/build/operators/EQUAL/operator.js +0 -58
- package/build/operators/GET/data.d.ts +0 -4
- package/build/operators/GET/data.js +0 -50
- package/build/operators/GET/index.d.ts +0 -1
- package/build/operators/GET/index.js +0 -5
- package/build/operators/GET/operator.d.ts +0 -3
- package/build/operators/GET/operator.js +0 -91
- package/build/operators/GRAPHQL/data.d.ts +0 -4
- package/build/operators/GRAPHQL/data.js +0 -57
- package/build/operators/GRAPHQL/index.d.ts +0 -1
- package/build/operators/GRAPHQL/index.js +0 -17
- package/build/operators/GRAPHQL/operator.d.ts +0 -8
- package/build/operators/GRAPHQL/operator.js +0 -86
- package/build/operators/GREATER_THAN/data.d.ts +0 -4
- package/build/operators/GREATER_THAN/data.js +0 -29
- package/build/operators/GREATER_THAN/index.d.ts +0 -1
- package/build/operators/GREATER_THAN/index.js +0 -17
- package/build/operators/GREATER_THAN/operator.d.ts +0 -2
- package/build/operators/GREATER_THAN/operator.js +0 -54
- package/build/operators/LESS_THAN/data.d.ts +0 -4
- package/build/operators/LESS_THAN/data.js +0 -29
- package/build/operators/LESS_THAN/index.d.ts +0 -1
- package/build/operators/LESS_THAN/index.js +0 -17
- package/build/operators/LESS_THAN/operator.d.ts +0 -2
- package/build/operators/LESS_THAN/operator.js +0 -54
- package/build/operators/MATCH/data.d.ts +0 -4
- package/build/operators/MATCH/data.js +0 -29
- package/build/operators/MATCH/index.d.ts +0 -1
- package/build/operators/MATCH/index.js +0 -17
- package/build/operators/MATCH/operator.d.ts +0 -2
- package/build/operators/MATCH/operator.js +0 -72
- package/build/operators/MULTIPLY/data.d.ts +0 -4
- package/build/operators/MULTIPLY/data.js +0 -22
- package/build/operators/MULTIPLY/index.d.ts +0 -1
- package/build/operators/MULTIPLY/index.js +0 -17
- package/build/operators/MULTIPLY/operator.d.ts +0 -2
- package/build/operators/MULTIPLY/operator.js +0 -53
- package/build/operators/NOT_EQUAL/data.d.ts +0 -4
- package/build/operators/NOT_EQUAL/data.js +0 -29
- package/build/operators/NOT_EQUAL/index.d.ts +0 -1
- package/build/operators/NOT_EQUAL/index.js +0 -17
- package/build/operators/NOT_EQUAL/operator.d.ts +0 -2
- package/build/operators/NOT_EQUAL/operator.js +0 -58
- package/build/operators/OBJECT_PROPERTIES/data.d.ts +0 -4
- package/build/operators/OBJECT_PROPERTIES/data.js +0 -37
- package/build/operators/OBJECT_PROPERTIES/index.d.ts +0 -1
- package/build/operators/OBJECT_PROPERTIES/index.js +0 -17
- package/build/operators/OBJECT_PROPERTIES/operator.d.ts +0 -2
- package/build/operators/OBJECT_PROPERTIES/operator.js +0 -62
- package/build/operators/OR/data.d.ts +0 -4
- package/build/operators/OR/data.js +0 -22
- package/build/operators/OR/index.d.ts +0 -1
- package/build/operators/OR/index.js +0 -17
- package/build/operators/OR/operator.d.ts +0 -2
- package/build/operators/OR/operator.js +0 -49
- package/build/operators/PASSTHRU/data.d.ts +0 -4
- package/build/operators/PASSTHRU/data.js +0 -22
- package/build/operators/PASSTHRU/index.d.ts +0 -1
- package/build/operators/PASSTHRU/index.js +0 -17
- package/build/operators/PASSTHRU/operator.d.ts +0 -2
- package/build/operators/PASSTHRU/operator.js +0 -53
- package/build/operators/PG_SQL/data.d.ts +0 -4
- package/build/operators/PG_SQL/data.js +0 -43
- package/build/operators/PG_SQL/index.d.ts +0 -1
- package/build/operators/PG_SQL/index.js +0 -17
- package/build/operators/PG_SQL/operator.d.ts +0 -2
- package/build/operators/PG_SQL/operator.js +0 -83
- package/build/operators/PLUS/data.d.ts +0 -4
- package/build/operators/PLUS/data.js +0 -29
- package/build/operators/PLUS/index.d.ts +0 -1
- package/build/operators/PLUS/index.js +0 -17
- package/build/operators/PLUS/operator.d.ts +0 -2
- package/build/operators/PLUS/operator.js +0 -63
- package/build/operators/POST/data.d.ts +0 -4
- package/build/operators/POST/data.js +0 -50
- package/build/operators/POST/index.d.ts +0 -1
- package/build/operators/POST/index.js +0 -17
- package/build/operators/POST/operator.d.ts +0 -2
- package/build/operators/POST/operator.js +0 -72
- package/build/operators/REGEX/data.d.ts +0 -4
- package/build/operators/REGEX/data.js +0 -29
- package/build/operators/REGEX/index.d.ts +0 -1
- package/build/operators/REGEX/index.js +0 -17
- package/build/operators/REGEX/operator.d.ts +0 -2
- package/build/operators/REGEX/operator.js +0 -59
- package/build/operators/SPLIT/data.d.ts +0 -4
- package/build/operators/SPLIT/data.js +0 -43
- package/build/operators/SPLIT/index.d.ts +0 -1
- package/build/operators/SPLIT/index.js +0 -17
- package/build/operators/SPLIT/operator.d.ts +0 -2
- package/build/operators/SPLIT/operator.js +0 -69
- package/build/operators/STRING_SUBSTITUTION/data.d.ts +0 -4
- package/build/operators/STRING_SUBSTITUTION/data.js +0 -29
- package/build/operators/STRING_SUBSTITUTION/index.d.ts +0 -1
- package/build/operators/STRING_SUBSTITUTION/index.js +0 -17
- package/build/operators/STRING_SUBSTITUTION/operator.d.ts +0 -2
- package/build/operators/STRING_SUBSTITUTION/operator.js +0 -59
- package/build/operators/SUBTRACT/data.d.ts +0 -4
- package/build/operators/SUBTRACT/data.js +0 -36
- package/build/operators/SUBTRACT/index.d.ts +0 -1
- package/build/operators/SUBTRACT/index.js +0 -17
- package/build/operators/SUBTRACT/operator.d.ts +0 -2
- package/build/operators/SUBTRACT/operator.js +0 -54
- package/build/operators/_operatorAliases.json +0 -92
- package/build/operators/_operatorUtils.d.ts +0 -24
- package/build/operators/_operatorUtils.js +0 -122
- package/build/operators/index.d.ts +0 -24
- package/build/operators/index.js +0 -40
- package/build/shorthandSyntax.d.ts +0 -2
- package/build/shorthandSyntax.js +0 -55
- package/build/typeCheck.d.ts +0 -12
- package/build/typeCheck.js +0 -54
- package/build/types.d.ts +0 -96
- package/build/types.js +0 -29
- package/build/version.d.ts +0 -1
- package/build/version.js +0 -4
package/build/operators/index.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./AND"), exports);
|
|
18
|
-
__exportStar(require("./OR"), exports);
|
|
19
|
-
__exportStar(require("./EQUAL"), exports);
|
|
20
|
-
__exportStar(require("./NOT_EQUAL"), exports);
|
|
21
|
-
__exportStar(require("./PLUS"), exports);
|
|
22
|
-
__exportStar(require("./SUBTRACT"), exports);
|
|
23
|
-
__exportStar(require("./MULTIPLY"), exports);
|
|
24
|
-
__exportStar(require("./DIVIDE"), exports);
|
|
25
|
-
__exportStar(require("./GREATER_THAN"), exports);
|
|
26
|
-
__exportStar(require("./LESS_THAN"), exports);
|
|
27
|
-
__exportStar(require("./CONDITIONAL"), exports);
|
|
28
|
-
__exportStar(require("./REGEX"), exports);
|
|
29
|
-
__exportStar(require("./OBJECT_PROPERTIES"), exports);
|
|
30
|
-
__exportStar(require("./STRING_SUBSTITUTION"), exports);
|
|
31
|
-
__exportStar(require("./COUNT"), exports);
|
|
32
|
-
__exportStar(require("./SPLIT"), exports);
|
|
33
|
-
__exportStar(require("./PG_SQL"), exports);
|
|
34
|
-
__exportStar(require("./GRAPHQL"), exports);
|
|
35
|
-
__exportStar(require("./GET"), exports);
|
|
36
|
-
__exportStar(require("./POST"), exports);
|
|
37
|
-
__exportStar(require("./BUILD_OBJECT"), exports);
|
|
38
|
-
__exportStar(require("./MATCH"), exports);
|
|
39
|
-
__exportStar(require("./CUSTOM_FUNCTIONS"), exports);
|
|
40
|
-
__exportStar(require("./PASSTHRU"), exports);
|
package/build/shorthandSyntax.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.preProcessShorthand = void 0;
|
|
7
|
-
const helpers_1 = require("./helpers");
|
|
8
|
-
const _operatorAliases_json_1 = __importDefault(require("./operators/_operatorAliases.json"));
|
|
9
|
-
const operatorAliases = _operatorAliases_json_1.default;
|
|
10
|
-
const functionStringRegex = /(\$[^()]+)\((.*)\)/;
|
|
11
|
-
const preProcessShorthand = (expression, fragments = {}, useShorthand = true) => {
|
|
12
|
-
if (!useShorthand)
|
|
13
|
-
return expression;
|
|
14
|
-
if (typeof expression === 'string')
|
|
15
|
-
return processString(expression, fragments);
|
|
16
|
-
if ((0, helpers_1.isObject)(expression))
|
|
17
|
-
return processObject(expression, fragments);
|
|
18
|
-
return expression;
|
|
19
|
-
};
|
|
20
|
-
exports.preProcessShorthand = preProcessShorthand;
|
|
21
|
-
const processString = (expString, fragments) => {
|
|
22
|
-
const match = functionStringRegex.exec(expString);
|
|
23
|
-
if (!match)
|
|
24
|
-
return expString;
|
|
25
|
-
const method = match[1].trim();
|
|
26
|
-
const params = match[2].split(',').map((p) => (0, exports.preProcessShorthand)(p.trim(), fragments));
|
|
27
|
-
return buildNodeElements(method, params, fragments);
|
|
28
|
-
};
|
|
29
|
-
const processObject = (expObject, fragments) => {
|
|
30
|
-
if ((0, helpers_1.isOperatorNode)(expObject) || (0, helpers_1.isFragmentNode)(expObject))
|
|
31
|
-
return expObject;
|
|
32
|
-
const keyVals = Object.entries(expObject);
|
|
33
|
-
const aliasParams = keyVals.filter(([key]) => (0, helpers_1.isAliasString)(key));
|
|
34
|
-
const otherParams = keyVals.filter(([key]) => !(0, helpers_1.isAliasString)(key));
|
|
35
|
-
const newKeyVals = aliasParams.reduce((accObj, [alias, params]) => {
|
|
36
|
-
accObj = Object.assign(Object.assign({}, accObj), buildNodeElements(alias, params, fragments));
|
|
37
|
-
return accObj;
|
|
38
|
-
}, {});
|
|
39
|
-
return Object.assign(Object.assign({}, newKeyVals), Object.fromEntries(otherParams));
|
|
40
|
-
};
|
|
41
|
-
const buildNodeElements = (alias, params, fragments) => {
|
|
42
|
-
const aliasName = alias.slice(1);
|
|
43
|
-
const operator = (0, helpers_1.getOperatorName)(aliasName, operatorAliases);
|
|
44
|
-
if (operator) {
|
|
45
|
-
if (Array.isArray(params))
|
|
46
|
-
return { operator, children: params };
|
|
47
|
-
if ((0, helpers_1.isObject)(params) && !Object.keys(params).some((key) => (0, helpers_1.isAliasString)(key)))
|
|
48
|
-
return Object.assign({ operator }, params);
|
|
49
|
-
return { operator, children: [params] };
|
|
50
|
-
}
|
|
51
|
-
if (aliasName in fragments) {
|
|
52
|
-
return { fragment: aliasName, parameters: Object.assign({}, params) };
|
|
53
|
-
}
|
|
54
|
-
return { [alias]: params };
|
|
55
|
-
};
|
package/build/typeCheck.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type BasicType = 'any' | 'string' | 'boolean' | 'number' | 'array' | 'object' | 'null' | 'undefined';
|
|
2
|
-
export type LiteralType = {
|
|
3
|
-
literal: (string | undefined)[];
|
|
4
|
-
};
|
|
5
|
-
export type ExpectedType = BasicType | LiteralType | BasicType[];
|
|
6
|
-
export type TypeCheckInput = {
|
|
7
|
-
name?: string;
|
|
8
|
-
value: unknown;
|
|
9
|
-
expectedType: ExpectedType;
|
|
10
|
-
};
|
|
11
|
-
export declare const isLiteralType: (typeDefinition: ExpectedType) => typeDefinition is LiteralType;
|
|
12
|
-
export declare const typeCheck: (...args: TypeCheckInput[]) => true | string;
|
package/build/typeCheck.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typeCheck = exports.isLiteralType = void 0;
|
|
4
|
-
const helpers_1 = require("./helpers");
|
|
5
|
-
const isLiteralType = (typeDefinition) => (0, helpers_1.isObject)(typeDefinition) && 'literal' in typeDefinition;
|
|
6
|
-
exports.isLiteralType = isLiteralType;
|
|
7
|
-
const typeCheckItem = ({ value, name, expectedType }) => {
|
|
8
|
-
if ((0, exports.isLiteralType)(expectedType)) {
|
|
9
|
-
const { literal } = expectedType;
|
|
10
|
-
return literal.includes(value)
|
|
11
|
-
? true
|
|
12
|
-
: makeErrorString(name, value, `Literal(${literal
|
|
13
|
-
.map((val) => (val === undefined ? `undefined` : `"${val}"`))
|
|
14
|
-
.join(', ')})`);
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(expectedType)) {
|
|
17
|
-
return expectedType.some((type) => typeCheckItem({ value, name, expectedType: type }) === true)
|
|
18
|
-
? true
|
|
19
|
-
: makeErrorString(name, value, expectedType.join('|'));
|
|
20
|
-
}
|
|
21
|
-
const checker = typeCheckMap[expectedType];
|
|
22
|
-
return checker(value) ? true : makeErrorString(name, value, expectedType);
|
|
23
|
-
};
|
|
24
|
-
const typeCheck = (...args) => {
|
|
25
|
-
const errorStrings = [];
|
|
26
|
-
args.forEach((item) => {
|
|
27
|
-
const result = typeCheckItem(item);
|
|
28
|
-
if (result !== true)
|
|
29
|
-
errorStrings.push(result);
|
|
30
|
-
});
|
|
31
|
-
return errorStrings.length > 0 ? errorStrings.join('\n') : true;
|
|
32
|
-
};
|
|
33
|
-
exports.typeCheck = typeCheck;
|
|
34
|
-
const typeCheckMap = {
|
|
35
|
-
any: (value) => value !== undefined,
|
|
36
|
-
string: (value) => typeof value === 'string',
|
|
37
|
-
number: (value) => typeof value === 'number',
|
|
38
|
-
boolean: (value) => typeof value === 'boolean',
|
|
39
|
-
array: (value) => Array.isArray(value),
|
|
40
|
-
null: (value) => value === null,
|
|
41
|
-
object: (value) => (0, helpers_1.isObject)(value),
|
|
42
|
-
undefined: (value) => value === undefined,
|
|
43
|
-
};
|
|
44
|
-
const makeErrorString = (name, value, type) => {
|
|
45
|
-
if (value === undefined && !!name)
|
|
46
|
-
return `- Missing required property "${name}" (type: ${type})`;
|
|
47
|
-
if (name !== undefined)
|
|
48
|
-
return `- Property "${name}" (value: ${stringifyValue(value)}) is not of type: ${type}`;
|
|
49
|
-
return `- ${stringifyValue(value)} is not of type: ${type}`;
|
|
50
|
-
};
|
|
51
|
-
const stringifyValue = (value) => {
|
|
52
|
-
const stringValue = value === undefined || Number.isNaN(value) ? String(value) : JSON.stringify(value);
|
|
53
|
-
return (0, helpers_1.truncateString)(stringValue, 50);
|
|
54
|
-
};
|
package/build/types.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import FigTreeCache from './cache';
|
|
2
|
-
import { Client } from 'pg';
|
|
3
|
-
import { GraphQLConnection } from './operators';
|
|
4
|
-
import operatorAliases from './operators/_operatorAliases.json';
|
|
5
|
-
import { ExpectedType, TypeCheckInput } from './typeCheck';
|
|
6
|
-
export declare const Operators: readonly ["AND", "OR", "EQUAL", "NOT_EQUAL", "PLUS", "SUBTRACT", "MULTIPLY", "DIVIDE", "GREATER_THAN", "LESS_THAN", "CONDITIONAL", "REGEX", "OBJECT_PROPERTIES", "STRING_SUBSTITUTION", "SPLIT", "COUNT", "GET", "POST", "PG_SQL", "GRAPHQL", "BUILD_OBJECT", "MATCH", "CUSTOM_FUNCTIONS", "PASSTHRU"];
|
|
7
|
-
export type Operator = (typeof Operators)[number];
|
|
8
|
-
export type OperatorAlias = keyof typeof operatorAliases;
|
|
9
|
-
export type OperatorAliases = Record<OperatorAlias, Operator>;
|
|
10
|
-
export type Fragments = Record<string, Fragment>;
|
|
11
|
-
export type UnknownFunction = (...args: any[]) => EvaluatorOutput;
|
|
12
|
-
export interface FigTreeOptions {
|
|
13
|
-
data?: object;
|
|
14
|
-
objects?: object;
|
|
15
|
-
functions?: Record<string, UnknownFunction>;
|
|
16
|
-
fragments?: Fragments;
|
|
17
|
-
pgConnection?: Client;
|
|
18
|
-
graphQLConnection?: GraphQLConnection;
|
|
19
|
-
baseEndpoint?: string;
|
|
20
|
-
headers?: {
|
|
21
|
-
[key: string]: string;
|
|
22
|
-
};
|
|
23
|
-
returnErrorAsString?: boolean;
|
|
24
|
-
nullEqualsUndefined?: boolean;
|
|
25
|
-
allowJSONStringInput?: boolean;
|
|
26
|
-
noShorthand?: boolean;
|
|
27
|
-
skipRuntimeTypeCheck?: boolean;
|
|
28
|
-
evaluateFullObject?: boolean;
|
|
29
|
-
excludeOperators?: OperatorAlias[];
|
|
30
|
-
useCache?: boolean;
|
|
31
|
-
maxCacheSize?: number;
|
|
32
|
-
maxCacheTime?: number;
|
|
33
|
-
supportDeprecatedValueNodes?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface FigTreeConfig {
|
|
36
|
-
options: FigTreeOptions;
|
|
37
|
-
operators: OperatorReference;
|
|
38
|
-
operatorAliases: OperatorAliases;
|
|
39
|
-
typeChecker: (...args: TypeCheckInput[] | [TypeCheckInput[]]) => void;
|
|
40
|
-
resolvedAliasNodes: {
|
|
41
|
-
[key: string]: EvaluatorOutput;
|
|
42
|
-
};
|
|
43
|
-
cache: FigTreeCache;
|
|
44
|
-
}
|
|
45
|
-
export type OutputType = 'string' | 'number' | 'boolean' | 'bool' | 'array';
|
|
46
|
-
export interface OperatorNode {
|
|
47
|
-
operator: OperatorAlias;
|
|
48
|
-
outputType?: OutputType;
|
|
49
|
-
children?: EvaluatorNode[];
|
|
50
|
-
fallback?: EvaluatorNode;
|
|
51
|
-
useCache?: boolean;
|
|
52
|
-
[key: string]: EvaluatorNode;
|
|
53
|
-
}
|
|
54
|
-
export interface FragmentNode {
|
|
55
|
-
fragment: string;
|
|
56
|
-
parameters?: Record<string, EvaluatorNode>;
|
|
57
|
-
[key: string]: EvaluatorNode;
|
|
58
|
-
}
|
|
59
|
-
export interface FragmentMetadata {
|
|
60
|
-
description?: string;
|
|
61
|
-
parameters?: Record<string, {
|
|
62
|
-
type: string | string[];
|
|
63
|
-
required: boolean;
|
|
64
|
-
}>;
|
|
65
|
-
}
|
|
66
|
-
export type Fragment = (EvaluatorNode & {
|
|
67
|
-
metadata?: FragmentMetadata;
|
|
68
|
-
}) | null;
|
|
69
|
-
export type EvaluatorOutput = string | boolean | number | object | null | undefined | Array<EvaluatorOutput>;
|
|
70
|
-
export type EvaluatorNode = OperatorNode | FragmentNode | EvaluatorOutput;
|
|
71
|
-
export type OperatorObject = {
|
|
72
|
-
propertyAliases: Record<string, string>;
|
|
73
|
-
operatorData: OperatorData;
|
|
74
|
-
evaluate: EvaluateMethod;
|
|
75
|
-
parseChildren: ParseChildrenMethod;
|
|
76
|
-
};
|
|
77
|
-
export type EvaluateMethod = (expression: OperatorNode, config: FigTreeConfig) => Promise<EvaluatorOutput>;
|
|
78
|
-
export type ParseChildrenMethod = (expression: OperatorNode, config: FigTreeConfig) => OperatorNode | Promise<OperatorNode>;
|
|
79
|
-
export type OperatorReference = {
|
|
80
|
-
[key in Operator]: OperatorObject;
|
|
81
|
-
};
|
|
82
|
-
export type Parameter = {
|
|
83
|
-
name: string;
|
|
84
|
-
description: string;
|
|
85
|
-
aliases: string[];
|
|
86
|
-
required: boolean;
|
|
87
|
-
type: ExpectedType;
|
|
88
|
-
};
|
|
89
|
-
export interface OperatorData {
|
|
90
|
-
description: string;
|
|
91
|
-
aliases: string[];
|
|
92
|
-
parameters: Parameter[];
|
|
93
|
-
}
|
|
94
|
-
export interface OperatorMetadata extends OperatorData {
|
|
95
|
-
operator: Operator;
|
|
96
|
-
}
|
package/build/types.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Operators = void 0;
|
|
4
|
-
exports.Operators = [
|
|
5
|
-
'AND',
|
|
6
|
-
'OR',
|
|
7
|
-
'EQUAL',
|
|
8
|
-
'NOT_EQUAL',
|
|
9
|
-
'PLUS',
|
|
10
|
-
'SUBTRACT',
|
|
11
|
-
'MULTIPLY',
|
|
12
|
-
'DIVIDE',
|
|
13
|
-
'GREATER_THAN',
|
|
14
|
-
'LESS_THAN',
|
|
15
|
-
'CONDITIONAL',
|
|
16
|
-
'REGEX',
|
|
17
|
-
'OBJECT_PROPERTIES',
|
|
18
|
-
'STRING_SUBSTITUTION',
|
|
19
|
-
'SPLIT',
|
|
20
|
-
'COUNT',
|
|
21
|
-
'GET',
|
|
22
|
-
'POST',
|
|
23
|
-
'PG_SQL',
|
|
24
|
-
'GRAPHQL',
|
|
25
|
-
'BUILD_OBJECT',
|
|
26
|
-
'MATCH',
|
|
27
|
-
'CUSTOM_FUNCTIONS',
|
|
28
|
-
'PASSTHRU',
|
|
29
|
-
];
|
package/build/version.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const version = "2.9.0";
|
package/build/version.js
DELETED