fig-tree-evaluator 2.23.2 → 3.0.0-preview.10

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/build/index.d.ts CHANGED
@@ -1,279 +1,957 @@
1
- /// <reference types="node" />
2
- import { Client } from 'pg';
3
- import { Database } from 'sqlite';
4
- import { AxiosStatic } from 'axios';
5
- import { RequestInfo, RequestInit, Response } from 'node-fetch';
6
- export { dequal } from 'dequal/lite';
7
-
8
- interface CacheOptions {
9
- maxSize?: number;
10
- maxTime?: number;
11
- }
12
- interface Store {
13
- [key: string]: {
14
- result: EvaluatorOutput;
15
- timestamp: number;
16
- };
1
+ declare const version = "3.0.0-preview.10";
2
+
3
+ interface HttpRequest {
4
+ url: string;
5
+ method: 'get' | 'post';
6
+ headers: Record<string, string>;
7
+ body?: unknown;
8
+ signal: AbortSignal;
17
9
  }
18
- declare class FigTreeCache {
19
- private store;
20
- private queue;
21
- private maxSize;
22
- private maxTime;
23
- constructor(options?: CacheOptions);
24
- useCache: (shouldUseCache: boolean, action: UnknownFunction, ...args: unknown[]) => Promise<EvaluatorOutput>;
25
- getMax: () => number;
26
- setMax: (size: number) => void;
27
- getMaxTime: () => number;
28
- setMaxTime: (time: number) => void;
29
- getCache: () => Store;
30
- setCache: (cache: Store) => Store;
31
- private resizeCache;
32
- }
33
-
34
- interface QueryInput {
35
- query: string;
36
- values?: (string | number | boolean)[] | object;
37
- single?: boolean;
38
- flatten?: boolean;
39
- }
40
- type QueryOutput = Exclude<EvaluatorOutput, undefined>;
41
- interface SQLConnection {
42
- query: (input: QueryInput) => Promise<QueryOutput>;
43
- }
44
-
45
- type BasicType = 'any' | 'string' | 'boolean' | 'number' | 'array' | 'object' | 'null' | 'undefined';
46
- type LiteralType = {
47
- literal: (string | undefined)[];
48
- };
49
- type ExpectedType = BasicType | LiteralType | BasicType[];
50
- type TypeCheckInput = {
51
- name?: string;
52
- value: unknown;
53
- expectedType: ExpectedType;
10
+ interface HttpClient {
11
+ request(req: HttpRequest): Promise<unknown>;
12
+ }
13
+ interface SqlRequest {
14
+ text: string;
15
+ values?: unknown[] | Record<string, unknown>;
16
+ signal?: AbortSignal;
17
+ }
18
+ interface SqlConnection {
19
+ query(req: SqlRequest): Promise<Record<string, unknown>[]>;
20
+ }
21
+ interface CacheStore {
22
+ get(key: string): unknown | Promise<unknown>;
23
+ set(key: string, value: unknown): void;
24
+ delete(key: string): void;
25
+ clear(): void;
26
+ }
27
+
28
+ declare const ErrorCodes: {
29
+ readonly typeCheck: "type-check";
30
+ readonly operatorFailure: "operator-failure";
31
+ readonly requestTimeout: "request-timeout";
32
+ readonly httpStatus: "http-status";
33
+ readonly invalidResponse: "invalid-response";
34
+ readonly graphQLErrors: "graphql-errors";
35
+ readonly sqlError: "sql-error";
36
+ readonly requestFailure: "request-failure";
37
+ readonly nonFiniteResult: "non-finite-result";
38
+ readonly escapedHandle: "escaped-handle";
39
+ readonly emptyAggregate: "empty-aggregate";
40
+ readonly missingDataPath: "missing-data-path";
41
+ readonly missingRequired: "missing-required";
42
+ readonly timeout: "timeout";
43
+ readonly aborted: "aborted";
44
+ readonly malformedNode: "malformed-node";
45
+ readonly unknownOperator: "unknown-operator";
46
+ readonly unknownFragment: "unknown-fragment";
47
+ readonly unknownNodeKey: "unknown-node-key";
48
+ readonly unrecognizedIdentifier: "unrecognized-identifier";
49
+ readonly positionalArity: "positional-arity";
50
+ readonly invalidVars: "invalid-vars";
51
+ readonly invalidReference: "invalid-reference";
52
+ readonly invalidAs: "invalid-as";
53
+ readonly unresolvedVar: "unresolved-var";
54
+ readonly unresolvedParam: "unresolved-param";
55
+ readonly unresolvedBinding: "unresolved-binding";
56
+ readonly bareVars: "bare-vars";
57
+ readonly varCycle: "var-cycle";
58
+ readonly depthCeiling: "depth-ceiling";
59
+ readonly maxDepthExceeded: "max-depth";
60
+ readonly maxNodesExceeded: "max-nodes";
61
+ readonly returnsMismatch: "returns-mismatch";
62
+ readonly operatorValidate: "operator-validate";
63
+ readonly uselessModifier: "useless-modifier";
64
+ readonly unreferencedVar: "unreferenced-var";
65
+ readonly shadowedVar: "shadowed-var";
66
+ readonly deadBinding: "dead-binding";
67
+ readonly fallbackMismatch: "fallback-mismatch";
68
+ readonly unboundToken: "unbound-token";
69
+ readonly unusedSubstitution: "unused-substitution";
70
+ readonly inertReferenceToken: "inert-reference-token";
71
+ readonly invalidDefinition: "invalid-definition";
72
+ readonly invalidName: "invalid-name";
73
+ readonly reservedName: "reserved-name";
74
+ readonly invalidNullPolicy: "invalid-null-policy";
75
+ readonly duplicateOperator: "duplicate-operator";
76
+ readonly fragmentCycle: "fragment-cycle";
77
+ readonly invalidOptions: "invalid-options";
54
78
  };
79
+ type KnownErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
80
+ type FigTreeErrorCode = KnownErrorCode | (string & {});
81
+ type KnownFallbackErrorCode = (typeof ErrorCodes)['typeCheck' | 'operatorFailure' | 'requestTimeout' | 'httpStatus' | 'invalidResponse' | 'graphQLErrors' | 'sqlError' | 'requestFailure' | 'nonFiniteResult' | 'escapedHandle' | 'emptyAggregate' | 'missingDataPath' | 'missingRequired' | 'timeout'];
82
+ type FallbackErrorCode = KnownFallbackErrorCode | (string & {});
55
83
 
56
- interface HttpClient {
57
- get: (req: Omit<HttpRequest, 'method'>) => Promise<unknown>;
58
- post: (req: Omit<HttpRequest, 'method'>) => Promise<unknown>;
59
- throwError: (err: unknown) => void;
84
+ type Severity = 'error' | 'warning';
85
+ interface Issue {
86
+ severity: Severity;
87
+ code: FigTreeErrorCode;
88
+ message: string;
89
+ path: (string | number)[];
90
+ operator?: string;
91
+ fragment?: string;
92
+ parameter?: string;
93
+ suggestion?: string;
60
94
  }
61
- interface HttpRequest {
62
- url: string;
63
- params?: {
64
- [key: string]: string;
95
+ interface ValidationResult {
96
+ valid: boolean;
97
+ issues: Issue[];
98
+ }
99
+
100
+ declare const LAZY_HANDLE: unique symbol;
101
+ interface LazyValue<T = unknown> {
102
+ readonly [LAZY_HANDLE]: true;
103
+ evaluate(): Promise<T>;
104
+ }
105
+ interface Settlement {
106
+ index: number;
107
+ ok: boolean;
108
+ value?: unknown;
109
+ error?: unknown;
110
+ }
111
+ type SettlementStream = AsyncIterable<Settlement> & {
112
+ readonly [LAZY_HANDLE]: true;
113
+ length: number;
114
+ };
115
+ interface PerElement<T = unknown> {
116
+ readonly [LAZY_HANDLE]: true;
117
+ evaluate(index: number): Promise<T>;
118
+ settle(): SettlementStream;
119
+ }
120
+ type TraceEvent = {
121
+ type: string;
122
+ [key: string]: unknown;
123
+ };
124
+ interface OperatorContext {
125
+ signal: AbortSignal;
126
+ options: Readonly<EvaluationOptions>;
127
+ cache: {
128
+ memo<T>(key: unknown, fn: () => Promise<T>): Promise<T>;
129
+ };
130
+ trace: {
131
+ note(event: TraceEvent): void;
65
132
  };
66
- data?: Record<string, unknown>;
67
- headers?: Record<string, unknown>;
68
- method?: 'get' | 'post';
69
133
  }
70
134
 
71
- interface GraphQLConnection {
72
- endpoint: string;
73
- headers?: {
74
- [key: string]: string;
135
+ type TraceStatus = 'value' | 'failed' | 'fallback' | 'cancelled' | 'skipped';
136
+ type TraceKind = 'operator' | 'fragment' | 'reference' | 'literal' | 'skeleton';
137
+ interface TraceNode {
138
+ path: (string | number)[];
139
+ source?: {
140
+ fragment: string;
75
141
  };
76
- httpClient?: HttpClient;
142
+ kind: TraceKind;
143
+ operator?: string;
144
+ ref?: string;
145
+ var?: string;
146
+ status: TraceStatus;
147
+ value?: unknown;
148
+ error?: FigTreeError;
149
+ events?: TraceEvent[];
150
+ children?: TraceNode[];
151
+ elapsed?: number;
152
+ warnings?: Issue[];
153
+ }
154
+ interface CacheTraceEvent {
155
+ type: 'cache';
156
+ hit: boolean;
157
+ }
158
+ interface RequestTraceEvent {
159
+ type: 'request';
160
+ method: string;
161
+ url: string;
162
+ headers: string[];
77
163
  }
164
+ interface QueryTraceEvent {
165
+ type: 'query';
166
+ text: string;
167
+ }
168
+ interface RenderTraceEvent {
169
+ type: 'render';
170
+ token: string;
171
+ rendered: 'literal' | 'placeholder' | 'empty' | 'gap-closed';
172
+ }
173
+ interface KeyOverwriteTraceEvent {
174
+ type: 'key-overwrite';
175
+ key: string;
176
+ }
177
+ interface ShieldedFallbackTraceEvent {
178
+ type: 'shielded-fallback';
179
+ }
180
+ type KnownTraceEvent = CacheTraceEvent | RequestTraceEvent | QueryTraceEvent | RenderTraceEvent | KeyOverwriteTraceEvent | ShieldedFallbackTraceEvent;
78
181
 
79
- declare const operatorAliases: OperatorAliases;
182
+ interface FallbackError {
183
+ code: FallbackErrorCode;
184
+ message: string;
185
+ path: (string | number)[];
186
+ operator?: string;
187
+ fragment?: string;
188
+ fragmentPath?: (string | number)[];
189
+ errorData?: Record<string, unknown>;
190
+ }
191
+ interface FigTreeErrorInit {
192
+ code: FigTreeErrorCode;
193
+ message: string;
194
+ path: (string | number)[];
195
+ operator?: string;
196
+ fragment?: string;
197
+ fragmentPath?: (string | number)[];
198
+ errorData?: Record<string, unknown>;
199
+ related?: FigTreeError[];
200
+ cause?: unknown;
201
+ issues?: Issue[];
202
+ trace?: TraceNode;
203
+ }
204
+ declare class FigTreeError extends Error {
205
+ code: FigTreeErrorCode;
206
+ path: (string | number)[];
207
+ operator?: string;
208
+ fragment?: string;
209
+ fragmentPath?: (string | number)[];
210
+ errorData?: Record<string, unknown>;
211
+ related?: FigTreeError[];
212
+ cause?: unknown;
213
+ issues?: Issue[];
214
+ trace?: TraceNode;
215
+ constructor(init: FigTreeErrorInit);
216
+ prettyPrint(): string;
217
+ }
218
+ declare const isFigTreeError: (input: unknown) => input is FigTreeError;
80
219
 
81
- 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", "SQL", "GRAPHQL", "BUILD_OBJECT", "MATCH", "CUSTOM_FUNCTIONS", "PASSTHRU"];
82
- type Operator = (typeof Operators)[number];
83
- type OperatorAlias = keyof typeof operatorAliases;
84
- type OperatorAliases = Record<string, Operator>;
85
- type Fragments = Record<string, Fragment>;
86
- type UnknownFunction = (...args: any[]) => EvaluatorOutput;
87
- interface FigTreeOptions {
88
- data?: Record<string, unknown>;
89
- objects?: Record<string, unknown>;
90
- functions?: Record<string, UnknownFunction | FunctionDefinition>;
91
- fragments?: Fragments;
92
- httpClient?: HttpClient;
93
- graphQLConnection?: GraphQLConnection;
94
- sqlConnection?: SQLConnection;
95
- baseEndpoint?: string;
96
- headers?: {
97
- [key: string]: string;
98
- };
99
- returnErrorAsString?: boolean;
100
- nullEqualsUndefined?: boolean;
101
- caseInsensitive?: boolean;
102
- allowJSONStringInput?: boolean;
103
- noShorthand?: boolean;
104
- skipRuntimeTypeCheck?: boolean;
105
- evaluateFullObject?: boolean;
106
- excludeOperators?: OperatorAlias[];
107
- useCache?: boolean;
108
- maxCacheSize?: number;
109
- maxCacheTime?: number;
110
- supportDeprecatedValueNodes?: boolean;
111
- }
112
- interface FigTreeConfig {
113
- options: FigTreeOptions;
114
- operators: OperatorReference;
115
- operatorAliases: OperatorAliases;
116
- typeChecker: (...args: TypeCheckInput[] | [TypeCheckInput[]]) => void;
117
- resolvedAliasNodes: {
118
- [key: string]: EvaluatorOutput;
119
- };
120
- cache: FigTreeCache;
121
- httpClient?: HttpClient;
122
- graphQLClient?: HttpClient;
123
- }
124
- type OutputType = 'string' | 'number' | 'boolean' | 'bool' | 'array';
125
- interface OperatorNode {
126
- operator: OperatorAlias;
127
- outputType?: OutputType;
128
- children?: EvaluatorNode[];
129
- fallback?: EvaluatorNode;
130
- useCache?: boolean;
131
- [key: string]: EvaluatorNode;
220
+ type BasicType = 'any' | 'string' | 'number' | 'boolean' | 'array' | 'object' | 'null' | 'integer';
221
+ type LiteralType = {
222
+ literal: readonly (string | number | boolean)[];
223
+ };
224
+ type ExpectedType = BasicType | LiteralType | readonly BasicType[];
225
+ interface Constraints {
226
+ length?: number;
227
+ homogeneous?: readonly BasicType[];
228
+ elementShape?: Record<string, TypeDeclaration>;
132
229
  }
133
- interface FragmentNode {
134
- fragment: string;
135
- parameters?: Record<string, EvaluatorNode>;
136
- [key: string]: EvaluatorNode;
230
+ interface TypeDeclaration {
231
+ type?: ExpectedType;
232
+ required?: boolean;
233
+ constraints?: Constraints;
137
234
  }
138
- interface FragmentData {
139
- description?: string;
140
- parameters?: FragmentParameterMetadata[];
141
- textColor?: string;
142
- backgroundColor?: string;
235
+ type TypeCheckResult = {
236
+ ok: true;
237
+ } | {
238
+ ok: false;
239
+ expected: string;
240
+ actual: string;
241
+ };
242
+
243
+ declare const validateHelpers: Readonly<{
244
+ parsePath: (path: string) => PathSegment[];
245
+ resolvePath: (source: unknown, path: string | PathSegment[]) => ResolveResult;
246
+ checkType: (value: unknown, expected: ExpectedType) => TypeCheckResult;
247
+ checkConstraints: (value: unknown, constraints: Constraints) => TypeCheckResult;
248
+ describeType: (value: unknown) => string;
249
+ renderText: (value: unknown) => string;
250
+ isTruthy: (value: unknown) => boolean;
251
+ }>;
252
+ type ValidateHelpers = typeof validateHelpers;
253
+
254
+ interface FallbackCoverage {
255
+ uncovered: CoverageFinding[];
256
+ covered: CoveredFinding[];
143
257
  }
144
- interface FunctionDefinition {
145
- function: UnknownFunction;
146
- description?: string;
147
- argsDefault?: unknown[];
148
- inputDefault?: unknown;
149
- textColor?: string;
150
- backgroundColor?: string;
151
- }
152
- type Fragment = (EvaluatorNode & {
153
- metadata?: FragmentData;
154
- }) | null;
155
- type EvaluatorOutput = string | boolean | number | object | null | undefined | Array<EvaluatorOutput>;
156
- type EvaluatorNode = OperatorNode | FragmentNode | EvaluatorOutput;
157
- type OperatorObject = {
158
- propertyAliases: Record<string, string>;
159
- operatorData: OperatorData;
160
- evaluate: EvaluateMethod;
161
- parseChildren: ParseChildrenMethod;
258
+ interface CoverageFinding {
259
+ path: (string | number)[];
260
+ code: FigTreeErrorCode;
261
+ message: string;
262
+ certainty: 'may' | 'always';
263
+ operator?: string;
264
+ parameter?: string;
265
+ fragment?: string;
266
+ fragmentPath?: (string | number)[];
267
+ }
268
+ interface CoveredFinding extends CoverageFinding {
269
+ coveredBy: (string | number)[];
270
+ coveredByFragmentPath?: (string | number)[];
271
+ givesNull?: true;
272
+ }
273
+ interface FallbackCoverageOptions {
274
+ strictNumbers?: boolean;
275
+ }
276
+ interface OperatorAnalysis {
277
+ failures?: FailureRule[];
278
+ external?: true;
279
+ output?: DeclaredOutput;
280
+ }
281
+ interface FailureRule {
282
+ code: FallbackErrorCode;
283
+ parameter?: string;
284
+ when?: Record<string, FailureTest>;
285
+ options?: Record<string, unknown>;
286
+ may?: true;
287
+ overflow?: true;
288
+ }
289
+ type FailureTest = string | number | boolean | null | {
290
+ type: ExpectedType;
291
+ } | {
292
+ below: number;
293
+ } | {
294
+ empty: true;
295
+ } | {
296
+ supplied: boolean;
297
+ } | {
298
+ invalid: true;
299
+ } | {
300
+ some: FailureTest;
301
+ } | {
302
+ not: FailureTest;
162
303
  };
163
- type EvaluateMethod = (expression: OperatorNode, config: FigTreeConfig) => Promise<EvaluatorOutput>;
164
- type ParseChildrenMethod = (expression: OperatorNode, config: FigTreeConfig) => OperatorNode;
165
- type OperatorReference = {
166
- [key in Operator]: OperatorObject;
304
+ type DeclaredOutput = ExpectedType | {
305
+ type: 'number' | 'integer';
306
+ min?: number;
307
+ max?: number;
308
+ } | {
309
+ type: 'string' | 'array';
310
+ minLength?: number;
311
+ } | {
312
+ param: string;
313
+ } | {
314
+ elementOf: string;
315
+ } | {
316
+ kindOf: string;
317
+ } | {
318
+ arrayOf: DeclaredOutput;
319
+ minLength?: number;
320
+ } | {
321
+ oneOf: DeclaredOutput[];
322
+ } | {
323
+ typeNamedBy: string;
324
+ } | {
325
+ byParam: string;
326
+ cases: Record<string, DeclaredOutput>;
327
+ otherwise?: DeclaredOutput;
328
+ } | {
329
+ firstNonNull: string;
330
+ } | {
331
+ sum: string;
332
+ } | {
333
+ product: string;
334
+ } | {
335
+ difference: [string, string];
336
+ } | {
337
+ abs: string;
338
+ } | {
339
+ min: string;
340
+ } | {
341
+ max: string;
167
342
  };
168
- interface OperatorParameterMetadata {
343
+
344
+ type TypeOf<T> = T extends 'string' ? string : T extends 'number' | 'integer' ? number : T extends 'boolean' ? boolean : T extends 'array' ? unknown[] : T extends 'object' ? Record<string, unknown> : T extends 'null' ? null : T extends 'any' ? unknown : T extends {
345
+ literal: readonly (infer M)[];
346
+ } ? M : T extends readonly (infer B)[] ? TypeOf<B> : unknown;
347
+ type DeclaredType<P> = P extends {
348
+ type: infer T;
349
+ } ? T : 'any';
350
+ type KeepsNull<P> = P extends {
351
+ nullPolicy: 'value';
352
+ } ? true : P extends {
353
+ nullPolicy: NullPolicyValue;
354
+ } ? false : P extends {
355
+ nullPolicy: (...args: any) => any;
356
+ } ? true : false;
357
+ type Delivered<P> = KeepsNull<P> extends true ? TypeOf<DeclaredType<P>> : Exclude<TypeOf<DeclaredType<P>>, null>;
358
+ type Truthy<P> = P extends {
359
+ type: 'array';
360
+ } ? boolean[] : P extends {
361
+ type: 'object';
362
+ } ? Record<string, boolean> : boolean;
363
+ type ParamValue<P> = P extends {
364
+ evaluation: 'structural';
365
+ } ? TypeOf<DeclaredType<P>> : P extends {
366
+ evaluation: 'race';
367
+ } ? SettlementStream : P extends {
368
+ evaluation: 'lazyElements';
369
+ } ? LazyValue[] : P extends {
370
+ evaluation: 'lazyEntries';
371
+ } ? Record<string, LazyValue> : P extends {
372
+ evaluation: 'perElement';
373
+ } ? PerElement<P extends {
374
+ truthiness: true;
375
+ } ? boolean : Delivered<P>> : P extends {
376
+ evaluation: 'lazy';
377
+ } ? LazyValue<Delivered<P>> : P extends {
378
+ truthiness: true;
379
+ } ? Truthy<P> : Delivered<P>;
380
+ type IsHolder<P> = P extends {
381
+ replacesNullAt: readonly string[];
382
+ } ? true : false;
383
+ type IsOptional<P> = P extends {
384
+ default: unknown;
385
+ } ? false : P extends {
386
+ required: false;
387
+ } ? true : false;
388
+ type BodyKeys<D> = {
389
+ [K in keyof D]: IsHolder<D[K]> extends true ? never : K;
390
+ }[keyof D];
391
+ type OptionalKeys<D> = {
392
+ [K in BodyKeys<D>]: IsOptional<D[K]> extends true ? K : never;
393
+ }[BodyKeys<D>];
394
+ type RequiredKeys<D> = Exclude<BodyKeys<D>, OptionalKeys<D>>;
395
+ type Simplify<T> = {
396
+ [K in keyof T]: T[K];
397
+ } & {};
398
+ type ResolvedParams<D extends ParameterDeclarations = ParameterDeclarations> = Simplify<{
399
+ [K in RequiredKeys<D>]: ParamValue<D[K]>;
400
+ } & {
401
+ [K in OptionalKeys<D>]?: ParamValue<D[K]>;
402
+ }>;
403
+
404
+ type EvaluationMode = 'eager' | 'race' | 'lazy' | 'lazyElements' | 'lazyEntries' | 'perElement' | 'structural';
405
+ declare const OPERATOR_CATEGORIES: readonly ["logic", "comparison", "math", "string", "array", "data", "io", "other"];
406
+ type OperatorCategory = (typeof OPERATOR_CATEGORIES)[number];
407
+ type NullPolicyValue = 'propagate' | 'value';
408
+ type ConditionalNullPolicy = (selectorValue: any) => NullPolicyValue;
409
+ type NullPolicy = NullPolicyValue | ConditionalNullPolicy;
410
+ interface CompiledNullPolicy {
411
+ selector: string;
412
+ table: {
413
+ value: string | number | boolean;
414
+ policy: NullPolicyValue;
415
+ }[];
416
+ }
417
+ declare const EvaluationData: unique symbol;
418
+ type OperatorEvaluate = (params: Record<string, unknown>, context: OperatorContext) => unknown;
419
+ interface ValidateFinding {
420
+ severity: Severity;
421
+ message: string;
422
+ parameter?: string;
423
+ }
424
+ type OperatorValidate = (literalParams: Record<string, unknown>, helpers: ValidateHelpers) => ValidateFinding[];
425
+ interface ParameterDeclaration extends TypeDeclaration {
426
+ default?: unknown;
427
+ description?: string;
428
+ metadata?: Record<string, unknown>;
429
+ evaluation?: EvaluationMode;
430
+ over?: string;
431
+ truthiness?: boolean;
432
+ nullPolicy?: NullPolicy;
433
+ elementNullPolicy?: NullPolicyValue;
434
+ replacesNullAt?: readonly string[];
435
+ }
436
+ type ParameterDeclarations = Record<string, ParameterDeclaration>;
437
+ interface OperatorDefinition<P extends ParameterDeclarations = ParameterDeclarations> {
169
438
  name: string;
439
+ alias?: string;
440
+ category: OperatorCategory;
170
441
  description: string;
171
- aliases: string[];
172
- required: boolean;
442
+ metadata?: Record<string, unknown>;
443
+ parameters: P;
444
+ positionalParams?: readonly string[];
445
+ timeoutParam?: string;
446
+ cache?: true;
447
+ validate?: OperatorValidate;
448
+ analysis?: OperatorAnalysis;
449
+ evaluate: (params: ResolvedParams<P>, context: OperatorContext) => unknown;
450
+ returns?: ExpectedType;
451
+ }
452
+ declare const VALIDATED_OPERATOR: unique symbol;
453
+ interface ValidatedParameter {
173
454
  type: ExpectedType;
455
+ required: boolean;
174
456
  default?: unknown;
457
+ description?: string;
458
+ metadata?: Record<string, unknown>;
459
+ evaluation: EvaluationMode;
460
+ truthiness: boolean;
461
+ nullPolicy: NullPolicyValue | CompiledNullPolicy;
462
+ elementNullPolicy?: NullPolicyValue;
463
+ constraints?: Constraints;
464
+ over?: string;
465
+ replacesNullAt?: string[];
175
466
  }
176
- interface FragmentParameterMetadata {
467
+ interface ValidatedOperatorDefinition {
468
+ readonly [VALIDATED_OPERATOR]: true;
177
469
  name: string;
178
- type: string | string[];
179
- required: boolean;
470
+ alias?: string;
471
+ category: OperatorCategory;
472
+ description: string;
473
+ metadata?: Record<string, unknown>;
474
+ parameters: Record<string, ValidatedParameter>;
475
+ positionalParams?: string[];
476
+ restParam: string | null;
477
+ resolution: ResolutionPlan;
478
+ deliversLazily: boolean;
479
+ timeoutParam: string | null;
480
+ cache: boolean;
481
+ fingerprint: string;
482
+ validate?: OperatorValidate;
483
+ analysis?: OperatorAnalysis;
484
+ evaluate: OperatorEvaluate;
485
+ returns: ExpectedType;
486
+ }
487
+ type DeclarationEntry = readonly [name: string, declared: ValidatedParameter];
488
+ interface ResolutionPlan {
489
+ readonly entries: readonly DeclarationEntry[];
490
+ readonly whole: readonly DeclarationEntry[];
491
+ readonly perElement: readonly DeclarationEntry[];
492
+ }
493
+
494
+ declare const isTruthy: (value: unknown) => boolean;
495
+
496
+ declare const compareValues: (a: number | string, b: number | string) => -1 | 0 | 1;
497
+
498
+ declare const ARRAY = "<array>";
499
+ declare const OBJECT = "<object>";
500
+ declare const renderText: (value: unknown) => string;
501
+
502
+ declare const WILDCARD: unique symbol;
503
+ type Wildcard = typeof WILDCARD;
504
+ type PathSegment = string | number | Wildcard;
505
+ interface ResolveResult {
506
+ found: boolean;
507
+ value: unknown;
508
+ }
509
+ declare const parsePath: (path: string) => PathSegment[];
510
+ declare const resolvePath: (source: unknown, path: string | PathSegment[]) => ResolveResult;
511
+
512
+ declare const deepEqual: (foo: any, bar: any) => boolean;
513
+
514
+ declare const NAMESPACE_TOKENS: {
515
+ readonly data: "data";
516
+ readonly d: "data";
517
+ readonly vars: "vars";
518
+ readonly v: "vars";
519
+ readonly params: "params";
520
+ readonly p: "params";
521
+ readonly element: "element";
522
+ readonly e: "element";
523
+ readonly index: "index";
524
+ readonly i: "index";
525
+ readonly error: "error";
526
+ readonly err: "error";
527
+ };
528
+ type ReferenceNamespace = (typeof NAMESPACE_TOKENS)[keyof typeof NAMESPACE_TOKENS];
529
+ type ReferenceRecognition = {
530
+ kind: 'reference';
531
+ namespace: ReferenceNamespace;
532
+ segments: PathSegment[];
533
+ drill: string;
534
+ binding?: string;
535
+ } | {
536
+ kind: 'invalid';
537
+ namespace: ReferenceNamespace;
538
+ reason: string;
539
+ code?: string;
540
+ } | {
541
+ kind: 'unrecognized';
542
+ } | {
543
+ kind: 'plain';
544
+ };
545
+ interface ReferenceScope {
546
+ bindings?: readonly string[];
547
+ }
548
+
549
+ type ObjectClass = {
550
+ kind: 'operator';
551
+ } | {
552
+ kind: 'fragment';
553
+ } | {
554
+ kind: 'shorthand';
555
+ key: string;
556
+ } | {
557
+ kind: 'plain';
558
+ } | {
559
+ kind: 'malformed';
560
+ message: string;
561
+ };
562
+ interface PositionalShape {
563
+ positionalParams?: readonly string[];
564
+ restParam: string | null;
565
+ }
566
+ interface PositionalLayout {
567
+ bound: number;
568
+ restAt: number | null;
569
+ }
570
+
571
+ interface FragmentParameterDeclaration extends TypeDeclaration {
572
+ default?: unknown;
573
+ description?: string;
574
+ metadata?: Record<string, unknown>;
575
+ }
576
+ interface FragmentDefinition {
577
+ expression: unknown;
578
+ parameters?: Record<string, FragmentParameterDeclaration>;
180
579
  description?: string;
580
+ metadata?: Record<string, unknown>;
581
+ }
582
+ interface FragmentParameter {
583
+ type: ExpectedType;
584
+ required: boolean;
181
585
  default?: unknown;
586
+ description?: string;
587
+ metadata?: Record<string, unknown>;
588
+ constraints?: Constraints;
182
589
  }
183
- interface OperatorData {
184
- description: string;
185
- aliases: string[];
186
- parameters: OperatorParameterMetadata[];
590
+
591
+ type EvaluationOptions = Omit<FigTreeOptions, 'operators' | 'fragments'>;
592
+ type CallOptions = Pick<FigTreeOptions, 'data' | 'signal' | 'timeout' | 'trace'>;
593
+ type OnlyCallOptions<CallOpts> = CallOpts & {
594
+ [Key in Exclude<keyof CallOpts, keyof CallOptions>]: never;
595
+ };
596
+ interface FigTreeOptions {
597
+ data?: Record<string, unknown>;
598
+ fragments?: Record<string, FragmentDefinition>;
599
+ operators?: (ValidatedOperatorDefinition | ValidatedOperatorDefinition[])[];
600
+ operatorDefaults?: {
601
+ [operator: string]: {
602
+ noCache?: true;
603
+ fallback?: unknown;
604
+ [param: string]: unknown;
605
+ };
606
+ };
607
+ http?: {
608
+ baseEndpoint?: string;
609
+ headers?: Record<string, string>;
610
+ };
611
+ graphQL?: {
612
+ endpoint?: string;
613
+ headers?: Record<string, string>;
614
+ };
615
+ strictDataPaths?: boolean;
616
+ maxDepth?: number;
617
+ maxNodes?: number;
618
+ timeout?: number;
619
+ signal?: AbortSignal;
620
+ cache?: {
621
+ store?: CacheStore;
622
+ maxSize?: number;
623
+ maxTime?: number;
624
+ };
625
+ trace?: boolean;
187
626
  }
188
- type OperatorMetadata = OperatorData & {
189
- name: Operator;
190
- parseChildren: ParseChildrenMethod;
627
+ type OptionsUpdate = {
628
+ [Key in keyof FigTreeOptions]?: (Key extends MergedBlock ? Removable<NonNullable<FigTreeOptions[Key]>> : FigTreeOptions[Key]) | null;
191
629
  };
192
- type FragmentMetadata = FragmentData & {
193
- name: string;
630
+ type MergedBlock = 'fragments' | 'operatorDefaults' | 'http' | 'graphQL' | 'cache';
631
+ type Removable<Block> = {
632
+ [Key in keyof Block]?: Block[Key] | null;
194
633
  };
195
- type CustomFunctionMetadata = {
196
- name: string;
197
- numRequiredArgs: number;
198
- } & Omit<FunctionDefinition, 'function'>;
199
-
200
- declare class FigTreeEvaluator {
201
- private options;
202
- private operators;
203
- private operatorAliases;
204
- private cache;
205
- private graphQLClient?;
206
- private httpClient?;
207
- constructor(options?: FigTreeOptions);
208
- private typeChecker;
209
- evaluate(expression: EvaluatorNode, options?: FigTreeOptions): Promise<EvaluatorOutput>;
210
- isFigTreeExpression(expression: EvaluatorNode): boolean;
211
- getOptions(): FigTreeOptions;
212
- updateOptions(options: FigTreeOptions): void;
213
- getCache: () => Store;
214
- setCache: (cache: Store) => Store;
215
- getOperators(): readonly OperatorMetadata[];
216
- getFragments(): readonly FragmentMetadata[];
217
- getCustomFunctions(): readonly CustomFunctionMetadata[];
218
- getConfig(): {
219
- options: FigTreeOptions;
220
- operators: OperatorReference;
221
- operatorAliases: OperatorAliases;
222
- typeChecker: (...args: TypeCheckInput[] | [TypeCheckInput[]]) => void;
223
- resolvedAliasNodes: {};
224
- cache: FigTreeCache;
225
- graphQLClient: HttpClient | undefined;
226
- httpClient: HttpClient | undefined;
634
+ interface EvaluationResult {
635
+ result: unknown;
636
+ trace: TraceNode;
637
+ }
638
+ type NoOptions = Record<never, never>;
639
+ type Merge<Instance, Call> = Omit<Instance, keyof Call> & Call;
640
+ type ResultShape<O> = O extends {
641
+ trace: true;
642
+ } ? EvaluationResult : unknown;
643
+
644
+ interface Dependencies {
645
+ data: {
646
+ paths: string[];
647
+ dynamic: boolean;
227
648
  };
228
- getVersion: () => string;
649
+ operators: string[];
650
+ fragments: string[];
651
+ }
652
+ interface ParameterInfo extends ValidatedParameter {
653
+ hostDefault?: unknown;
654
+ }
655
+ interface OperatorInfo extends Omit<ValidatedOperatorDefinition, typeof VALIDATED_OPERATOR | 'evaluate' | 'validate' | 'deliversLazily' | 'resolution' | 'fingerprint' | 'parameters'> {
656
+ parameters: Record<string, ParameterInfo>;
657
+ hasValidate: boolean;
658
+ hostNoCache?: true;
659
+ hostFallback?: unknown;
660
+ }
661
+ interface FragmentInfo {
662
+ name: string;
663
+ description?: string;
664
+ metadata?: Record<string, unknown>;
665
+ parameters: Record<string, FragmentParameter>;
666
+ returns: ExpectedType;
667
+ warnings: Issue[];
668
+ dependencies: Dependencies;
669
+ caches: boolean;
229
670
  }
230
- declare const evaluateExpression: (expression: EvaluatorNode, options?: FigTreeOptions) => Promise<EvaluatorOutput>;
231
671
 
232
- declare class FigTreeError extends Error {
233
- operator?: Operator;
672
+ declare class FigTree<InstanceOpts extends FigTreeOptions = NoOptions> {
673
+ private state;
674
+ private readonly results;
675
+ readonly version = "3.0.0-preview.10";
676
+ constructor(options?: InstanceOpts);
677
+ updateOptions(options?: OptionsUpdate): void;
678
+ clearCache(): void;
679
+ getOptions(): EvaluationOptions;
680
+ getOperators(): OperatorInfo[];
681
+ getFragments(): FragmentInfo[];
682
+ validate(expression: unknown, options?: CallOptions): ValidationResult;
683
+ getDependencies(expression: unknown): Dependencies;
684
+ isEvaluable(expression: unknown): boolean;
685
+ evaluate<CallOpts extends CallOptions = NoOptions>(expression: unknown, options?: OnlyCallOptions<CallOpts>): Promise<ResultShape<Merge<InstanceOpts, CallOpts>>>;
686
+ compile(expression: unknown): CompiledExpression<InstanceOpts>;
687
+ }
688
+ declare class CompiledExpression<InstanceOpts extends FigTreeOptions = NoOptions> {
689
+ #private;
690
+ private constructor();
691
+ get expression(): unknown;
692
+ get issues(): readonly Issue[];
693
+ get hasErrors(): boolean;
694
+ evaluate<CallOpts extends CallOptions = NoOptions>(options?: OnlyCallOptions<CallOpts>): Promise<ResultShape<Merge<InstanceOpts, CallOpts>>>;
695
+ getDependencies(): Dependencies;
696
+ }
697
+
698
+ declare function defineOperator(definition: ValidatedOperatorDefinition): ValidatedOperatorDefinition;
699
+ declare function defineOperator<const P extends ParameterDeclarations>(definition: OperatorDefinition<P>): ValidatedOperatorDefinition;
700
+
701
+ declare const coreOperators: ValidatedOperatorDefinition[];
702
+
703
+ interface OperatorFailureInit {
704
+ code?: FallbackErrorCode;
234
705
  errorData?: Record<string, unknown>;
235
- expression?: EvaluatorNode;
236
- prettyPrint: string;
237
- constructor(error: Error & {
238
- errorData?: Record<string, unknown>;
239
- }, operator?: Operator, name?: string, expression?: EvaluatorNode);
240
706
  }
241
- declare const isFigTreeError: (input: unknown) => input is FigTreeError;
707
+ declare class OperatorFailure extends Error {
708
+ code?: FallbackErrorCode;
709
+ errorData?: Record<string, unknown>;
710
+ constructor(message: string, init?: OperatorFailureInit);
711
+ }
712
+ declare const isOperatorFailure: (input: unknown) => input is OperatorFailure;
242
713
 
243
- declare const SQLNodePostgres: (client: Client) => {
244
- query: ({ query, values }: QueryInput) => Promise<QueryOutput>;
245
- };
246
- declare const SQLite: (db: Database) => {
247
- query: ({ query, values }: QueryInput) => Promise<any[]>;
248
- };
714
+ declare const httpOperators: (client?: HttpClient) => ValidatedOperatorDefinition[];
715
+ declare const sqlOperators: (connection: SqlConnection) => ValidatedOperatorDefinition[];
249
716
 
250
- type Fetch = (input: URL | string | RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
251
- declare const AxiosClient: (axios: AxiosStatic) => {
252
- get: (req: Omit<HttpRequest, 'method'>) => Promise<any>;
253
- post: (req: Omit<HttpRequest, 'method'>) => Promise<any>;
254
- throwError: (err: unknown) => never;
255
- };
256
- declare const FetchClient: (fetch: Fetch) => {
257
- get: (req: Omit<HttpRequest, 'method'>) => Promise<any>;
258
- post: (req: Omit<HttpRequest, 'method'>) => Promise<any>;
259
- throwError: (err: unknown) => never;
717
+ type FetchLike = (input: string, init?: {
718
+ method?: string;
719
+ headers?: Record<string, string>;
720
+ body?: string;
721
+ signal?: AbortSignal;
722
+ }) => Promise<FetchResponseLike>;
723
+ interface FetchResponseLike {
724
+ ok: boolean;
725
+ status: number;
726
+ statusText: string;
727
+ url: string;
728
+ text(): Promise<string>;
729
+ }
730
+ interface AxiosLike {
731
+ (config: {
732
+ url: string;
733
+ method: 'get' | 'post';
734
+ headers?: Record<string, string>;
735
+ data?: unknown;
736
+ signal?: AbortSignal;
737
+ }): Promise<{
738
+ data: unknown;
739
+ status: number;
740
+ statusText: string;
741
+ }>;
742
+ isAxiosError(payload: unknown): payload is AxiosErrorLike;
743
+ }
744
+ interface AxiosErrorLike {
745
+ message: string;
746
+ config?: {
747
+ url?: string;
748
+ };
749
+ response?: {
750
+ status: number;
751
+ statusText: string;
752
+ data: unknown;
753
+ };
754
+ }
755
+ declare class FetchClient implements HttpClient {
756
+ private readonly supplied?;
757
+ constructor(fetchImpl?: FetchLike);
758
+ request: (req: HttpRequest) => Promise<unknown>;
759
+ }
760
+ declare class AxiosClient implements HttpClient {
761
+ private readonly axios;
762
+ constructor(axios: AxiosLike);
763
+ request: (req: HttpRequest) => Promise<unknown>;
764
+ }
765
+
766
+ interface PgClientLike {
767
+ query(config: {
768
+ text: string;
769
+ values?: unknown[];
770
+ }): Promise<{
771
+ rows: Record<string, unknown>[];
772
+ }>;
773
+ }
774
+ interface SqliteDatabaseLike {
775
+ all(sql: string, params?: unknown[] | Record<string, unknown>): Promise<Record<string, unknown>[]>;
776
+ }
777
+ declare class PostgresConnection implements SqlConnection {
778
+ private readonly client;
779
+ constructor(client: PgClientLike);
780
+ query: (req: SqlRequest) => Promise<Record<string, unknown>[]>;
781
+ }
782
+ declare class SQLiteConnection implements SqlConnection {
783
+ private readonly db;
784
+ constructor(db: SqliteDatabaseLike);
785
+ query: (req: SqlRequest) => Promise<Record<string, unknown>[]>;
786
+ }
787
+
788
+ interface HttpFailureInfo {
789
+ status: number;
790
+ statusText: string;
791
+ url: string;
792
+ response: unknown;
793
+ }
794
+ declare const httpFailure: (info: HttpFailureInfo) => OperatorFailure;
795
+ declare const sqlFailure: (driver: string, error: unknown) => OperatorFailure;
796
+
797
+ type Json = null | boolean | number | string | Json[] | {
798
+ [key: string]: Json;
260
799
  };
800
+ type Path = (string | number)[];
261
801
 
262
- declare const preProcessShorthand: (expression: EvaluatorNode, fragments: Fragments | undefined, functionNames: string[], useShorthand?: boolean) => EvaluatorNode | FragmentNode;
802
+ type NodeMap = Record<string, InspectNode>;
803
+ type InspectNode = {
804
+ order: number;
805
+ path: Path;
806
+ } & ({
807
+ kind: 'constant';
808
+ value: Json;
809
+ } | {
810
+ kind: 'reference';
811
+ reference: string;
812
+ authored: string;
813
+ binding?: string;
814
+ } | {
815
+ kind: 'operator';
816
+ vars?: NodeMap;
817
+ operator: string;
818
+ params: NodeMap;
819
+ fallback?: InspectNode;
820
+ timeoutFallback?: Json;
821
+ noCache?: true;
822
+ hostDefaults?: string[];
823
+ } | {
824
+ kind: 'fragmentCall';
825
+ vars?: NodeMap;
826
+ fragment: string;
827
+ resolved: boolean;
828
+ argumentsMode: 'static' | 'dynamic';
829
+ parameters?: NodeMap | InspectNode;
830
+ fallback?: InspectNode;
831
+ timeoutFallback?: Json;
832
+ noCache?: true;
833
+ } | {
834
+ kind: 'skeleton';
835
+ vars?: NodeMap;
836
+ shape: Json;
837
+ holes: {
838
+ at: Path;
839
+ node: InspectNode;
840
+ }[];
841
+ } | {
842
+ kind: 'elements';
843
+ elements: InspectNode[];
844
+ } | {
845
+ kind: 'entries';
846
+ vars?: NodeMap;
847
+ entries: NodeMap;
848
+ } | {
849
+ kind: 'invalid';
850
+ raw: Json;
851
+ });
263
852
 
264
- declare const isOperatorNode: (input: EvaluatorNode) => input is OperatorNode;
265
- declare const isFragmentNode: (input: EvaluatorNode) => input is FragmentNode;
266
- declare const standardiseOperatorName: (name: string) => string;
267
- declare const truncateString: (string: string, length?: number) => string;
268
- declare const isAliasString: (value: string) => boolean;
269
- declare const isObject: (input: unknown) => input is object;
270
- declare const isFigTreeExpression: (expression: EvaluatorNode) => boolean;
853
+ type InspectIssue = Issue & {
854
+ order?: number;
855
+ };
856
+ interface InspectDependencies {
857
+ dataPaths: string[];
858
+ dynamic: boolean;
859
+ operators: string[];
860
+ fragments: string[];
861
+ }
862
+ interface InspectReport {
863
+ version: string;
864
+ expression: Json;
865
+ options: Record<string, Json>;
866
+ canonicalForm: InspectNode;
867
+ issues: InspectIssue[];
868
+ timeoutShielded: boolean;
869
+ nodeCount: number;
870
+ maxDepth: number;
871
+ dependencies: InspectDependencies;
872
+ own: {
873
+ nodeCount: number;
874
+ maxDepth: number;
875
+ dependencies: InspectDependencies;
876
+ };
877
+ }
878
+ declare const inspect: <InstanceOpts extends FigTreeOptions>(compiled: CompiledExpression<InstanceOpts>, options?: CallOptions) => InspectReport;
271
879
 
272
- declare const convertV1ToV2: (expression: EvaluatorNode, figTree: FigTreeEvaluator) => string | number | boolean | Record<string, unknown> | null | undefined;
273
- declare const isV1Node: (node: EvaluatorNode) => node is OperatorNode;
880
+ interface OperatorHints {
881
+ displayName: string;
882
+ docUrl: string;
883
+ backgroundColor: string;
884
+ textColor: string;
885
+ seeds?: {
886
+ [parameter: string]: unknown;
887
+ };
888
+ }
889
+ type FragmentHints = Omit<OperatorHints, 'docUrl'> & {
890
+ docUrl?: string;
891
+ };
892
+ interface CategoryHints {
893
+ displayName: string;
894
+ order: number;
895
+ backgroundColor: string;
896
+ textColor: string;
897
+ }
898
+ type OperatorHintMap = {
899
+ [operator: string]: OperatorHints;
900
+ };
901
+ type CategoryHintMap = {
902
+ [category in OperatorCategory]: CategoryHints;
903
+ };
904
+ type TypeSeeds = {
905
+ [type in BasicType]: unknown;
906
+ };
274
907
 
275
- declare const convertToShorthand: (expression: EvaluatorNode, figTree: FigTreeEvaluator, arrayThreshold?: number) => EvaluatorNode;
908
+ interface MigrationIssue {
909
+ code: 'split-trailing-empty' | 'remainder-sign' | 'template-numbering' | 'named-token-source' | 'response-collapse' | 'computed-delimiter' | 'computed-branches' | 'graphql-relative-url' | 'output-type' | 'missing-data-fallback' | 'unprefixed-parameter' | 'cache-opt-in' | 'instance-case-insensitive' | 'values-cut' | 'fallback-converted' | 'malformed-entry' | 'unreachable-branches' | 'overridden-value' | 'discarded-expression' | 'fragment-shorthand-payload' | 'shadowed-argument' | 'unknown-argument' | 'name-renamed' | 'unknown-parameter-type' | 'default-outside-type' | 'unused-output-type' | 'deciding-value' | 'drilled-substitution-token' | 'number-mapping' | 'template-escape' | 'computed-dollar-template' | 'custom-function-call' | 'computed-function-name' | 'computed-arguments' | 'body-override' | 'computed-fragment-name' | 'replaced-output-type' | 'computed-children' | 'unknown-operator' | 'unconvertible-input';
910
+ tag: 'non-convertible' | 'intentional-semantic-change' | 'lossy-default';
911
+ path: (string | number)[];
912
+ message: string;
913
+ }
914
+ interface MigrationResult {
915
+ expression: unknown;
916
+ issues: MigrationIssue[];
917
+ }
918
+ interface FragmentMigrationResult {
919
+ fragments: Record<string, FragmentDefinition>;
920
+ issues: MigrationIssue[];
921
+ }
922
+ interface V2Options {
923
+ fragments?: Record<string, unknown>;
924
+ functions?: readonly string[] | Record<string, unknown>;
925
+ evaluateFullObject?: boolean;
926
+ noShorthand?: boolean;
927
+ caseInsensitive?: boolean;
928
+ useCache?: boolean;
929
+ }
276
930
 
277
- declare const convertFromShorthand: (expression: EvaluatorNode, figTree: FigTreeEvaluator) => EvaluatorNode;
931
+ interface Registry {
932
+ getOperators(): readonly {
933
+ name: string;
934
+ alias?: string;
935
+ positionalParams?: readonly string[];
936
+ restParam: string | null;
937
+ }[];
938
+ getFragments(): readonly {
939
+ name: string;
940
+ }[];
941
+ }
942
+ type Spelling = 'preserve' | 'canonical' | 'alias';
943
+ interface NameOptions {
944
+ referenceNames?: Spelling;
945
+ }
946
+ interface CanonicalOptions extends NameOptions {
947
+ operatorNames?: Spelling;
948
+ referencesAsGet?: boolean;
949
+ }
950
+ interface ShorthandOptions extends NameOptions {
951
+ operatorNames?: Spelling;
952
+ arguments?: 'positional' | 'named';
953
+ getAsReference?: boolean;
954
+ }
278
955
 
279
- export { AxiosClient, type BasicType, type CustomFunctionMetadata, type EvaluatorNode, type EvaluatorOutput, type ExpectedType, FetchClient, type FigTreeConfig, FigTreeError, FigTreeEvaluator, type FigTreeOptions, type Fragment, type FragmentMetadata, type FragmentNode, type FragmentParameterMetadata, type Fragments, type FunctionDefinition, type GraphQLConnection, type LiteralType, type Operator, type OperatorAlias, type OperatorData, type OperatorMetadata, type OperatorNode, type OperatorParameterMetadata, type OutputType, SQLNodePostgres, SQLite, type UnknownFunction, convertFromShorthand, convertToShorthand, convertV1ToV2, evaluateExpression, isAliasString, isFigTreeError, isFigTreeExpression, isFragmentNode, isObject, isOperatorNode, isV1Node, preProcessShorthand, standardiseOperatorName, truncateString };
956
+ export { ARRAY, AxiosClient, CompiledExpression, ErrorCodes, EvaluationData, FetchClient, FigTree, FigTreeError, OBJECT, OPERATOR_CATEGORIES, OperatorFailure, PostgresConnection, SQLiteConnection, WILDCARD, compareValues, coreOperators, deepEqual, defineOperator, httpFailure, httpOperators, inspect, isFigTreeError, isOperatorFailure, isTruthy, parsePath, renderText, resolvePath, sqlFailure, sqlOperators, version };
957
+ export type { AxiosErrorLike, AxiosLike, BasicType, CacheStore, CacheTraceEvent, CallOptions, CanonicalOptions, CategoryHintMap, CategoryHints, CompiledNullPolicy, ConditionalNullPolicy, Constraints, CoverageFinding, CoveredFinding, DeclaredOutput, Dependencies, EvaluationMode, EvaluationOptions, EvaluationResult, ExpectedType, FailureRule, FailureTest, FallbackCoverage, FallbackCoverageOptions, FallbackError, FallbackErrorCode, FetchLike, FetchResponseLike, FigTreeErrorCode, FigTreeErrorInit, FigTreeOptions, FragmentDefinition, FragmentHints, FragmentInfo, FragmentMigrationResult, FragmentParameter, FragmentParameterDeclaration, HttpClient, HttpFailureInfo, HttpRequest, InspectDependencies, InspectIssue, InspectNode, InspectReport, Issue, KeyOverwriteTraceEvent, KnownTraceEvent, LazyValue, LiteralType, Merge, MigrationIssue, MigrationResult, NameOptions, NoOptions, NullPolicy, NullPolicyValue, ObjectClass, OnlyCallOptions, OperatorAnalysis, OperatorCategory, OperatorContext, OperatorDefinition, OperatorEvaluate, OperatorFailureInit, OperatorHintMap, OperatorHints, OperatorInfo, OperatorValidate, OptionsUpdate, ParamValue, ParameterDeclaration, ParameterDeclarations, ParameterInfo, PathSegment, PerElement, PgClientLike, PositionalLayout, PositionalShape, QueryTraceEvent, ReferenceNamespace, ReferenceRecognition, ReferenceScope, Registry, RenderTraceEvent, RequestTraceEvent, ResolveResult, ResolvedParams, ResultShape, Settlement, SettlementStream, Severity, ShieldedFallbackTraceEvent, ShorthandOptions, Spelling, SqlConnection, SqlRequest, SqliteDatabaseLike, TraceEvent, TraceKind, TraceNode, TraceStatus, TypeCheckResult, TypeDeclaration, TypeOf, TypeSeeds, V2Options, ValidateFinding, ValidateHelpers, ValidatedOperatorDefinition, ValidatedParameter, ValidationResult, Wildcard };