@memberjunction/global 6.2.0-edge.5 → 6.2.0-edge.7

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.
Files changed (102) hide show
  1. package/README.md +8 -4
  2. package/dist/ClassFactory.d.ts +30 -0
  3. package/dist/ClassFactory.d.ts.map +1 -1
  4. package/dist/ClassFactory.js +69 -5
  5. package/dist/ClassFactory.js.map +1 -1
  6. package/dist/KeyedSerialTaskQueue.d.ts +18 -1
  7. package/dist/KeyedSerialTaskQueue.d.ts.map +1 -1
  8. package/dist/KeyedSerialTaskQueue.js +24 -3
  9. package/dist/KeyedSerialTaskQueue.js.map +1 -1
  10. package/dist/SQLExpressionValidator.d.ts +34 -9
  11. package/dist/SQLExpressionValidator.d.ts.map +1 -1
  12. package/dist/SQLExpressionValidator.js +58 -17
  13. package/dist/SQLExpressionValidator.js.map +1 -1
  14. package/dist/SQLScreeningScanner.d.ts +28 -2
  15. package/dist/SQLScreeningScanner.d.ts.map +1 -1
  16. package/dist/SQLScreeningScanner.js +166 -23
  17. package/dist/SQLScreeningScanner.js.map +1 -1
  18. package/dist/SafeExpressionEvaluator.d.ts +93 -109
  19. package/dist/SafeExpressionEvaluator.d.ts.map +1 -1
  20. package/dist/SafeExpressionEvaluator.js +494 -346
  21. package/dist/SafeExpressionEvaluator.js.map +1 -1
  22. package/dist/__tests__/ClassFactory.collision.test.js +110 -0
  23. package/dist/__tests__/ClassFactory.collision.test.js.map +1 -1
  24. package/dist/__tests__/ClassFactory.test.js +21 -0
  25. package/dist/__tests__/ClassFactory.test.js.map +1 -1
  26. package/dist/__tests__/FieldSecurityEgressCompliance.test.d.ts +2 -0
  27. package/dist/__tests__/FieldSecurityEgressCompliance.test.d.ts.map +1 -0
  28. package/dist/__tests__/FieldSecurityEgressCompliance.test.js +228 -0
  29. package/dist/__tests__/FieldSecurityEgressCompliance.test.js.map +1 -0
  30. package/dist/__tests__/FieldTransformEngine.screen.test.d.ts +2 -0
  31. package/dist/__tests__/FieldTransformEngine.screen.test.d.ts.map +1 -0
  32. package/dist/__tests__/FieldTransformEngine.screen.test.js +41 -0
  33. package/dist/__tests__/FieldTransformEngine.screen.test.js.map +1 -0
  34. package/dist/__tests__/FieldTransformEngine.security.test.d.ts +2 -0
  35. package/dist/__tests__/FieldTransformEngine.security.test.d.ts.map +1 -0
  36. package/dist/__tests__/FieldTransformEngine.security.test.js +74 -0
  37. package/dist/__tests__/FieldTransformEngine.security.test.js.map +1 -0
  38. package/dist/__tests__/KeyedSerialTaskQueue.test.js +92 -0
  39. package/dist/__tests__/KeyedSerialTaskQueue.test.js.map +1 -1
  40. package/dist/__tests__/PlatformStringCompliance.baseline.d.ts +10 -0
  41. package/dist/__tests__/PlatformStringCompliance.baseline.d.ts.map +1 -0
  42. package/dist/__tests__/PlatformStringCompliance.baseline.js +12 -0
  43. package/dist/__tests__/PlatformStringCompliance.baseline.js.map +1 -0
  44. package/dist/__tests__/PlatformStringCompliance.test.d.ts +8 -0
  45. package/dist/__tests__/PlatformStringCompliance.test.d.ts.map +1 -0
  46. package/dist/__tests__/PlatformStringCompliance.test.js +152 -0
  47. package/dist/__tests__/PlatformStringCompliance.test.js.map +1 -0
  48. package/dist/__tests__/ProofOfPossession.test.d.ts +2 -0
  49. package/dist/__tests__/ProofOfPossession.test.d.ts.map +1 -0
  50. package/dist/__tests__/ProofOfPossession.test.js +123 -0
  51. package/dist/__tests__/ProofOfPossession.test.js.map +1 -0
  52. package/dist/__tests__/SQLExpressionValidator.dialect.test.d.ts +2 -0
  53. package/dist/__tests__/SQLExpressionValidator.dialect.test.d.ts.map +1 -0
  54. package/dist/__tests__/SQLExpressionValidator.dialect.test.js +183 -0
  55. package/dist/__tests__/SQLExpressionValidator.dialect.test.js.map +1 -0
  56. package/dist/__tests__/SQLScreeningScanner.tokens.test.d.ts +2 -0
  57. package/dist/__tests__/SQLScreeningScanner.tokens.test.d.ts.map +1 -0
  58. package/dist/__tests__/SQLScreeningScanner.tokens.test.js +82 -0
  59. package/dist/__tests__/SQLScreeningScanner.tokens.test.js.map +1 -0
  60. package/dist/__tests__/SafeExpressionEvaluator.allowlist.test.d.ts +2 -0
  61. package/dist/__tests__/SafeExpressionEvaluator.allowlist.test.d.ts.map +1 -0
  62. package/dist/__tests__/SafeExpressionEvaluator.allowlist.test.js +200 -0
  63. package/dist/__tests__/SafeExpressionEvaluator.allowlist.test.js.map +1 -0
  64. package/dist/__tests__/SafeExpressionEvaluator.security.test.js +11 -0
  65. package/dist/__tests__/SafeExpressionEvaluator.security.test.js.map +1 -1
  66. package/dist/__tests__/SafeExpressionEvaluator.test.js +4 -2
  67. package/dist/__tests__/SafeExpressionEvaluator.test.js.map +1 -1
  68. package/dist/__tests__/UUIDCompliance.test.js +3 -4
  69. package/dist/__tests__/UUIDCompliance.test.js.map +1 -1
  70. package/dist/__tests__/UserScopedCacheKey.test.d.ts +2 -0
  71. package/dist/__tests__/UserScopedCacheKey.test.d.ts.map +1 -0
  72. package/dist/__tests__/UserScopedCacheKey.test.js +25 -0
  73. package/dist/__tests__/UserScopedCacheKey.test.js.map +1 -0
  74. package/dist/fieldRules/FieldTransformEngine.d.ts +12 -1
  75. package/dist/fieldRules/FieldTransformEngine.d.ts.map +1 -1
  76. package/dist/fieldRules/FieldTransformEngine.js +21 -8
  77. package/dist/fieldRules/FieldTransformEngine.js.map +1 -1
  78. package/dist/fieldRules/SafeTransformAstEvaluator.d.ts +16 -0
  79. package/dist/fieldRules/SafeTransformAstEvaluator.d.ts.map +1 -0
  80. package/dist/fieldRules/SafeTransformAstEvaluator.js +797 -0
  81. package/dist/fieldRules/SafeTransformAstEvaluator.js.map +1 -0
  82. package/dist/fieldRules/index.d.ts +1 -0
  83. package/dist/fieldRules/index.d.ts.map +1 -1
  84. package/dist/fieldRules/index.js +1 -0
  85. package/dist/fieldRules/index.js.map +1 -1
  86. package/dist/index.d.ts +2 -0
  87. package/dist/index.d.ts.map +1 -1
  88. package/dist/index.js +2 -0
  89. package/dist/index.js.map +1 -1
  90. package/dist/util/BinaryEncoding.d.ts +2 -0
  91. package/dist/util/BinaryEncoding.d.ts.map +1 -1
  92. package/dist/util/BinaryEncoding.js +3 -5
  93. package/dist/util/BinaryEncoding.js.map +1 -1
  94. package/dist/util/ProofOfPossession.d.ts +68 -0
  95. package/dist/util/ProofOfPossession.d.ts.map +1 -0
  96. package/dist/util/ProofOfPossession.js +163 -0
  97. package/dist/util/ProofOfPossession.js.map +1 -0
  98. package/dist/util/UserScopedCacheKey.d.ts +42 -0
  99. package/dist/util/UserScopedCacheKey.d.ts.map +1 -0
  100. package/dist/util/UserScopedCacheKey.js +49 -0
  101. package/dist/util/UserScopedCacheKey.js.map +1 -0
  102. package/package.json +1 -1
@@ -9,31 +9,54 @@
9
9
  * @author MemberJunction.com
10
10
  * @since 2.76.0
11
11
  */
12
+ /** One approved global: whether it may be called by bare name, and which of its methods may be called. */
13
+ export interface ApprovedExpressionGlobal {
14
+ /** `true` when the global itself may be called: `Number(x)`, `parseInt(x)`. */
15
+ readonly Callable: boolean;
16
+ /** Methods that may be called on the global by dotted name: `Math.max(a, b)`. */
17
+ readonly Methods: ReadonlySet<string>;
18
+ }
12
19
  /**
13
- * Namespace globals whose listed methods a condition may CALL, keyed by namespace name.
20
+ * **The approved globals — the only host globals an expression can reach.**
14
21
  *
15
- * Both halves of `Math.abs(x)` are fixed identifiers in the AST, so admitting them adds no dynamic
16
- * lookup: the four invariants that close the sandbox escape — literal-only computed keys, no
17
- * `constructor`/`__proto__`/`prototype`, a closed non-computed call surface with no
18
- * `call`/`apply`/`bind`, and screened free identifiers — are all untouched by this list.
22
+ * This is the single list reviewers should check. Every other free identifier in an expression must
23
+ * be an evaluation-context key or an arrow-function parameter in scope; anything else is refused
24
+ * before compilation (see {@link SafeExpressionEvaluator.ScreenExpression}).
25
+ *
26
+ * An approved global is usable ONLY in call position — `Math.max(a, b)`, `Number(x)` — never as a
27
+ * bare value, a property read (`Math.PI`), or a callback (`items.map(Number)`). That rule is what
28
+ * stops a function being handed to code that calls it with attacker-chosen arguments: two confirmed
29
+ * bypasses of the earlier denylist did exactly that (`a.reduce(fetch)` and
30
+ * `p.reduce(Object.assign)`).
19
31
  *
20
- * Every entry is a pure value function. `Math.random` is deliberately absent (a condition that
21
- * evaluates differently on each run is not a guard), as are `Object.assign`,
22
- * `Object.defineProperty` and `Object.setPrototypeOf`, which mutate.
32
+ * Every listed member is a pure function of its arguments. Deliberately absent: `Object.assign`,
33
+ * `Object.defineProperty`, `Object.getPrototypeOf`/`setPrototypeOf` (mutate or open the prototype
34
+ * chain), `Math.random` (a guard that changes per run is not a guard), `String.fromCharCode`, and
35
+ * every host API (`fetch`, `setTimeout`, `require`, `process`, ...).
36
+ *
37
+ * Both halves of `Math.abs(x)` are fixed identifiers in the AST, so admitting them adds no dynamic
38
+ * lookup.
39
+ */
40
+ export declare const APPROVED_EXPRESSION_GLOBALS: ReadonlyMap<string, ApprovedExpressionGlobal>;
41
+ /**
42
+ * Global names that are VALUES, not functions, and may appear anywhere a value can: `x === undefined`.
43
+ * Each is a non-writable primitive, so referencing one cannot reach host code.
44
+ */
45
+ export declare const APPROVED_VALUE_GLOBALS: ReadonlySet<string>;
46
+ /**
47
+ * Namespace globals whose listed methods an expression may CALL, keyed by namespace name.
48
+ * Derived from {@link APPROVED_EXPRESSION_GLOBALS}.
23
49
  */
24
50
  export declare const SAFE_GLOBAL_NAMESPACE_METHODS: ReadonlyMap<string, ReadonlySet<string>>;
25
51
  /**
26
- * Global functions a condition may call by bare name — the coercions and numeric predicates that
27
- * authored specs use (`Number(payload.count) > 3`, `isNaN(payload.count)`).
52
+ * Global functions an expression may call by bare name (`Number(payload.count) > 3`).
53
+ * Derived from {@link APPROVED_EXPRESSION_GLOBALS}.
28
54
  */
29
55
  export declare const SAFE_GLOBAL_CALLABLES: ReadonlySet<string>;
30
56
  /**
31
- * Every global name a condition may reference, as a namespace or as a bare callable.
32
- *
33
- * **This is the single source of truth for the ambient globals of the condition dialect.** It lives
34
- * beside the policy screen that enforces it so a caller validating conditions ahead of evaluation
35
- * (`ai-core-plus`'s task-graph door) cannot bless a name the runtime would refuse — the failure mode
36
- * that shipped once already, where the door's own list and the evaluator disagreed silently.
57
+ * Every global name an expression may reference (in call position), as a namespace or as a bare
58
+ * callable. Derived from {@link APPROVED_EXPRESSION_GLOBALS}, so a caller validating conditions ahead
59
+ * of evaluation (`ai-core-plus`'s task-graph door) cannot bless a name the runtime would refuse.
37
60
  */
38
61
  export declare const SAFE_EXPRESSION_GLOBALS: ReadonlySet<string>;
39
62
  /**
@@ -58,17 +81,19 @@ export interface ExpressionEvaluationResult {
58
81
  * - Logical: &&, ||, !
59
82
  * - Property access: dot notation (e.g., payload.customer.name), including optional chaining (`?.`)
60
83
  * - Array access: bracket notation with a literal index/key (e.g., items[0])
61
- * - Safe methods: .length, .includes(), .startsWith(), .endsWith()
62
- * - Array methods: .some(), .every(), .find(), .filter()
63
- * - Safe globals: the namespaces and bare callables in {@link SAFE_EXPRESSION_GLOBALS}
84
+ * - Safe methods: .length, .includes(), .startsWith(), .endsWith(), .split(), .slice(), ...
85
+ * - Array methods: .some(), .every(), .find(), .filter(), .map(), .reduce() — the callback must be
86
+ * an inline arrow function (`items.some(i => i.price > 100)`, never `items.some(fn)`)
87
+ * - Approved globals, in call position only: {@link APPROVED_EXPRESSION_GLOBALS}
64
88
  * (e.g. `Math.abs(output.delta) < 5`, `Number(payload.count) > 3`, `Object.keys(payload).length`)
65
89
  * - Type checking: typeof
66
90
  *
67
91
  * Safety is enforced by parsing the expression to an AST and walking it against
68
- * an ALLOWLIST of node types before it is compiled — an unlisted construct
69
- * (computed member access with a non-literal key, `.constructor`/`__proto__`
70
- * access, any call outside the safe-method and safe-global lists, host-global
71
- * identifiers, etc.) is rejected at validation time and never reaches the compiler. A structural
92
+ * an ALLOWLIST before it is compiled. Node types, operators, methods and free identifiers are
93
+ * all allowlisted: a free identifier must be a context key, an arrow parameter in scope, or an
94
+ * approved global used as a call. An unlisted construct (computed member access with a non-literal
95
+ * key, `.constructor`/`__proto__` access, any call outside the safe-method and approved-global
96
+ * lists, any other identifier, etc.) is rejected at validation time and never reaches the compiler. A structural
72
97
  * allowlist cannot be defeated by string concatenation the way a textual
73
98
  * denylist can, and it does not over-reject data that merely mentions a reserved
74
99
  * word (e.g. `name == 'constructor'` is a legal comparison).
@@ -99,96 +124,47 @@ export interface ExpressionEvaluationResult {
99
124
  * ```
100
125
  */
101
126
  export declare class SafeExpressionEvaluator {
102
- /**
103
- * Identifiers that must never resolve to a host global. Because the compiled
104
- * function runs in global scope, a bare `process`/`Function`/`globalThis`/…
105
- * would reach the real global object; identifiers are atomic AST tokens, so a
106
- * name that is split with string concatenation parses as separate identifiers
107
- * or an operator and is caught by the structural rules instead.
108
- * @private
109
- */
110
- private static readonly DANGEROUS_IDENTIFIERS;
111
- /**
112
- * Property names that open the prototype chain / constructor climb. Denied on
113
- * both dotted (`x.constructor`) and literal-bracket (`x["constructor"]`) access.
114
- * @private
115
- */
116
- private static readonly DANGEROUS_PROPERTY_NAMES;
117
- /** Binary operators the evaluator permits. `instanceof`/`in`/bitwise are excluded. @private */
118
- private static readonly ALLOWED_BINARY_OPERATORS;
119
- /** Unary operators the evaluator permits. `delete`/`void` are excluded. @private */
120
- private static readonly ALLOWED_UNARY_OPERATORS;
121
127
  /**
122
128
  * Cache for compiled expressions to improve performance on repeated evaluations
123
129
  * @private
124
130
  */
125
131
  private readonly _compiledExpressionCache;
126
- /**
127
- * Safe methods that can be called on objects
128
- * @private
129
- */
130
- private static readonly SAFE_METHODS;
131
132
  /**
132
133
  * Evaluates a boolean expression against a context object
133
134
  *
134
135
  * @param {string} expression - The boolean expression to evaluate
135
- * @param {Record<string, any>} context - The context object containing variables
136
+ * @param {Record<string, any>} [context={}] - The context object containing variables. Its keys
137
+ * are the only free names the expression may use; a key named like an approved global
138
+ * shadows it (see {@link ScreenExpression}).
136
139
  * @param {boolean} [enableDiagnostics=false] - Whether to include diagnostic information
137
140
  *
138
141
  * @returns {ExpressionEvaluationResult} The evaluation result
139
142
  */
140
- Evaluate(expression: string, context: Record<string, any>, enableDiagnostics?: boolean): ExpressionEvaluationResult;
143
+ Evaluate(expression: string, context?: Record<string, any>, enableDiagnostics?: boolean): ExpressionEvaluationResult;
141
144
  /** @deprecated Use {@link Evaluate}. */
142
- evaluate(expression: string, context: Record<string, any>, enableDiagnostics?: boolean): ExpressionEvaluationResult;
145
+ evaluate(expression: string, context?: Record<string, any>, enableDiagnostics?: boolean): ExpressionEvaluationResult;
143
146
  /**
144
- * Validates an expression for safety by parsing it and walking the AST against
145
- * an allowlist. Returns an error message if any construct is not permitted.
147
+ * Screens an expression against the allowlist WITHOUT compiling or running it. Returns the
148
+ * rejection message, or `null` when every construct is permitted.
146
149
  *
147
- * @param {string} expression - The expression to validate
150
+ * This is the single policy gate for every place MemberJunction compiles a user- or LLM-authored
151
+ * expression: {@link Evaluate}, {@link ValidateSyntax}, and the field-rule / integration formula
152
+ * engine (`FieldTransformEngine`), which passes `['value', 'fields']`.
148
153
  *
149
- * @returns {string | null} Error message if invalid, null if valid
154
+ * A context key or arrow parameter named like an approved global (`Math`, `JSON`, ...) shadows
155
+ * it and is screened as data, so `Math.abs(x)` with a `Math` context key is refused because
156
+ * `abs` is not a safe instance method. Do not pass approved-global names as context keys.
150
157
  *
151
- * @private
152
- */
153
- private validateExpression;
154
- /** Builds the standard rejection message. @private */
155
- private forbidden;
156
- /**
157
- * Walks an AST node against the allowlist. Returns an error message on the first
158
- * disallowed construct, or null if the entire subtree is permitted.
159
- * @private
160
- */
161
- private checkNode;
162
- /**
163
- * Member access is allowed for dotted property reads and literal-key bracket
164
- * reads, but never for a computed key built at runtime (the string-concat
165
- * escape route) or a prototype-chain property.
166
- * @private
167
- */
168
- private checkMemberExpression;
169
- /**
170
- * A call is admitted only when its callee is a FIXED name on one of two allowlists: a bare
171
- * safe global (`parseInt(...)`) or a dotted method that is either a safe instance method or a
172
- * method of a safe global namespace (`Math.abs(...)`). Everything else — a computed callee, an
173
- * unlisted bare identifier (`eval(...)`, `Function(...)`), a call on a call's result that is
174
- * not itself a safe method — is rejected.
175
- * @private
176
- */
177
- private checkCallExpression;
178
- /**
179
- * Whether `<receiver>.<method>()` names a permitted call: a safe instance method on any value,
180
- * or a method of a safe global namespace when the receiver is that namespace by bare name.
181
- * @private
158
+ * @param expression the expression to screen
159
+ * @param allowedIdentifiers the names the expression may reference as values — the evaluation
160
+ * context keys. Pass `null` only when they are not yet known (authoring-time syntax
161
+ * checks); free identifiers are then left for evaluation time to decide, while approved
162
+ * globals used as values, callbacks that are not inline arrows, and every structural rule
163
+ * are still enforced.
182
164
  */
183
- private isCallableMethod;
184
- /** Walks a call's arguments; spreads are rejected outright. @private */
185
- private checkCallArguments;
186
- /**
187
- * Arrow functions are permitted only as callback arguments to the safe array
188
- * methods; parameters must be simple identifiers and the body an expression.
189
- * @private
190
- */
191
- private checkArrowFunction;
165
+ static ScreenExpression(expression: string, allowedIdentifiers: Iterable<string> | null): string | null;
166
+ /** Counts parentheses textually; used only to word the error for an expression that failed to parse. @private */
167
+ private static hasUnbalancedParentheses;
192
168
  /**
193
169
  * Creates a safe context object with only allowed properties
194
170
  *
@@ -212,6 +188,11 @@ export declare class SafeExpressionEvaluator {
212
188
  /**
213
189
  * Safely clones a value for use in evaluation context
214
190
  *
191
+ * Functions are never carried into the context: a context should hold data, and a function
192
+ * reachable from an expression is one more thing that could be invoked. A function value
193
+ * becomes `undefined`, and function-valued properties are dropped from plain objects and
194
+ * class instances alike.
195
+ *
215
196
  * @param {any} value - The value to clone
216
197
  *
217
198
  * @returns {any} The cloned value
@@ -229,32 +210,35 @@ export declare class SafeExpressionEvaluator {
229
210
  * is a perfectly good condition that simply has no data yet. A submit-time check built on
230
211
  * `evaluate` therefore refuses every legitimate condition.
231
212
  *
232
- * So this compiles and never runs. The expression goes through the same policy screen
233
- * `evaluate` applies (the AST allowlist), then the same function body is BUILT and discarded —
234
- * never invoked. Values are never consulted, which is precisely the property wanted: unknown
213
+ * So this parses and never runs. The expression goes through the same policy screen
214
+ * `evaluate` applies (the AST allowlist), then the same function body `evaluate` compiles is
215
+ * parsed in strict mode — never compiled, never invoked. Values are never consulted, which is precisely the property wanted: unknown
235
216
  * identifiers, absent properties and undefined chains all PASS, because none of them is a syntax
236
- * error and whether they resolve is a question about a run that has not happened yet.
217
+ * error and whether they resolve is a question about a run that has not happened yet. Pass
218
+ * `contextKeys` when the evaluation context's keys ARE known, and unknown identifiers are refused
219
+ * here exactly as {@link Evaluate} would refuse them.
237
220
  *
238
- * **Compilation is not evaluation**, and the distinction is load-bearing for safety: `Function`
239
- * parses the body and returns; nothing in the expression executes. The policy screen still runs
240
- * first, so the constructs `evaluate` refuses are refused here too — those produce a permanent
241
- * runtime refusal, and an author is better told now.
221
+ * **Parsing is not evaluation**, and the distinction is load-bearing for safety: no code is
222
+ * constructed from the expression here, so nothing in it can execute. The policy screen still
223
+ * runs first, so the constructs `evaluate` refuses are refused here too — those produce a
224
+ * permanent runtime refusal, and an author is better told now.
242
225
  *
243
- * `Undecidable` is the honest third answer. A host that forbids dynamic compilation (a strict
244
- * CSP without `unsafe-eval`) cannot answer the question at all, and a validator that read that
245
- * as "invalid" would refuse every condition in the browser. Callers should treat it as a pass.
226
+ * Because nothing is compiled, the answer does not depend on the host allowing dynamic code (a
227
+ * strict CSP without `unsafe-eval`). `Undecidable` is kept in the result type for callers that
228
+ * check it, and is no longer returned.
246
229
  *
247
230
  * @param expression the expression to check
248
- * @returns `Valid: true` when it parses; `Valid: false` with `Error` when it definitely does
249
- * not; `Valid: true` with `Undecidable: true` when this environment cannot compile
231
+ * @param contextKeys the names the expression may reference, when known; omitted, free
232
+ * identifiers are left for evaluation time (see {@link ScreenExpression})
233
+ * @returns `Valid: true` when it parses; `Valid: false` with `Error` when it does not
250
234
  */
251
- ValidateSyntax(expression: string): {
235
+ ValidateSyntax(expression: string, contextKeys?: Iterable<string>): {
252
236
  Valid: boolean;
253
237
  Error?: string;
254
238
  Undecidable?: boolean;
255
239
  };
256
240
  /** @deprecated Use {@link ValidateSyntax}. */
257
- validateSyntax(expression: string): {
241
+ validateSyntax(expression: string, contextKeys?: Iterable<string>): {
258
242
  Valid: boolean;
259
243
  Error?: string;
260
244
  Undecidable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"SafeExpressionEvaluator.d.ts","sourceRoot":"","sources":["../src/SafeExpressionEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAuBH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAUjF,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAEpD,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAGtD,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,cAAc,EAAE,MAAM,CAAC;KAC1B,CAAC;CACL;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,qBAAa,uBAAuB;IAChC;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAK1C;IAEH;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAE7C;IAEH,+FAA+F;IAC/F,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,wBAAwB,CAE7C;IAEH,oFAAoF;IACpF,OAAO,CAAC,MAAM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