fig-tree-evaluator 2.23.2 → 3.0.0-preview.2
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 +214 -148
- package/build/chunks/shared.js +1 -0
- package/build/editor-hints/index.d.ts +35 -0
- package/build/editor-hints/index.js +1 -0
- package/build/format/index.d.ts +86 -0
- package/build/format/index.js +1 -0
- package/build/index.d.ts +783 -240
- package/build/index.js +1 -0
- package/build/migrate/index.d.ts +55 -0
- package/build/migrate/index.js +1 -0
- package/package.json +97 -50
- package/CHANGELOG.md +0 -134
- package/build/index.cjs.js +0 -1
- package/build/index.esm.js +0 -1
package/build/index.d.ts
CHANGED
|
@@ -1,279 +1,822 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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.2";
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
type FigTreeErrorCode = string;
|
|
29
|
+
declare const ErrorCodes: {
|
|
30
|
+
readonly unknownOperator: "unknown-operator";
|
|
31
|
+
readonly typeCheck: "type-check";
|
|
32
|
+
readonly operatorFailure: "operator-failure";
|
|
33
|
+
readonly timeout: "timeout";
|
|
34
|
+
readonly requestTimeout: "request-timeout";
|
|
35
|
+
readonly aborted: "aborted";
|
|
36
|
+
readonly unknownNodeKey: "unknown-node-key";
|
|
37
|
+
readonly unresolvedVar: "unresolved-var";
|
|
38
|
+
readonly unrecognizedIdentifier: "unrecognized-identifier";
|
|
39
|
+
readonly depthCeiling: "depth-ceiling";
|
|
40
|
+
readonly nonFiniteResult: "non-finite-result";
|
|
41
|
+
readonly escapedHandle: "escaped-handle";
|
|
42
|
+
readonly emptyAggregate: "empty-aggregate";
|
|
43
|
+
readonly malformedNode: "malformed-node";
|
|
44
|
+
readonly unknownFragment: "unknown-fragment";
|
|
45
|
+
readonly positionalArity: "positional-arity";
|
|
46
|
+
readonly invalidVars: "invalid-vars";
|
|
47
|
+
readonly invalidReference: "invalid-reference";
|
|
48
|
+
readonly uselessModifier: "useless-modifier";
|
|
49
|
+
readonly unreferencedVar: "unreferenced-var";
|
|
50
|
+
readonly missingRequired: "missing-required";
|
|
51
|
+
readonly unresolvedParam: "unresolved-param";
|
|
52
|
+
readonly unresolvedBinding: "unresolved-binding";
|
|
53
|
+
readonly deadBinding: "dead-binding";
|
|
54
|
+
readonly invalidAs: "invalid-as";
|
|
55
|
+
readonly maxDepthExceeded: "max-depth";
|
|
56
|
+
readonly maxNodesExceeded: "max-nodes";
|
|
57
|
+
readonly returnsMismatch: "returns-mismatch";
|
|
58
|
+
readonly operatorValidate: "operator-validate";
|
|
59
|
+
readonly missingDataPath: "missing-data-path";
|
|
60
|
+
readonly shadowedVar: "shadowed-var";
|
|
61
|
+
readonly varCycle: "var-cycle";
|
|
62
|
+
readonly bareVars: "bare-vars";
|
|
63
|
+
readonly fragmentCycle: "fragment-cycle";
|
|
64
|
+
readonly unboundToken: "unbound-token";
|
|
65
|
+
readonly unusedSubstitution: "unused-substitution";
|
|
66
|
+
readonly tokenRenumber: "token-renumber";
|
|
67
|
+
readonly inertReferenceToken: "inert-reference-token";
|
|
68
|
+
readonly invalidDefinition: "invalid-definition";
|
|
69
|
+
readonly invalidName: "invalid-name";
|
|
70
|
+
readonly reservedName: "reserved-name";
|
|
71
|
+
readonly invalidNullPolicy: "invalid-null-policy";
|
|
72
|
+
readonly duplicateOperator: "duplicate-operator";
|
|
73
|
+
readonly invalidOptions: "invalid-options";
|
|
54
74
|
};
|
|
55
75
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
type Severity = 'error' | 'warning' | 'hint';
|
|
77
|
+
interface Issue {
|
|
78
|
+
severity: Severity;
|
|
79
|
+
code: FigTreeErrorCode;
|
|
80
|
+
message: string;
|
|
81
|
+
path: (string | number)[];
|
|
82
|
+
operator?: string;
|
|
83
|
+
fragment?: string;
|
|
84
|
+
parameter?: string;
|
|
85
|
+
suggestion?: string;
|
|
60
86
|
}
|
|
61
|
-
interface
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
};
|
|
66
|
-
data?: Record<string, unknown>;
|
|
67
|
-
headers?: Record<string, unknown>;
|
|
68
|
-
method?: 'get' | 'post';
|
|
87
|
+
interface ValidationResult {
|
|
88
|
+
valid: boolean;
|
|
89
|
+
issues: Issue[];
|
|
90
|
+
timeoutShielded: boolean;
|
|
69
91
|
}
|
|
70
92
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
declare const LAZY_HANDLE: unique symbol;
|
|
94
|
+
interface LazyValue<T = unknown> {
|
|
95
|
+
readonly [LAZY_HANDLE]: true;
|
|
96
|
+
evaluate(): Promise<T>;
|
|
97
|
+
}
|
|
98
|
+
interface Settlement {
|
|
99
|
+
index: number;
|
|
100
|
+
ok: boolean;
|
|
101
|
+
value?: unknown;
|
|
102
|
+
error?: unknown;
|
|
103
|
+
}
|
|
104
|
+
type SettlementStream = AsyncIterable<Settlement> & {
|
|
105
|
+
readonly [LAZY_HANDLE]: true;
|
|
106
|
+
length: number;
|
|
107
|
+
};
|
|
108
|
+
interface PerElement<T = unknown> {
|
|
109
|
+
readonly [LAZY_HANDLE]: true;
|
|
110
|
+
evaluate(index: number): Promise<T>;
|
|
111
|
+
settle(): SettlementStream;
|
|
112
|
+
}
|
|
113
|
+
type TraceEvent = {
|
|
114
|
+
type: string;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
};
|
|
117
|
+
interface OperatorContext {
|
|
118
|
+
signal: AbortSignal;
|
|
119
|
+
options: Readonly<EvaluationOptions>;
|
|
120
|
+
cache: {
|
|
121
|
+
memo<T>(key: unknown, fn: () => Promise<T>): Promise<T>;
|
|
122
|
+
};
|
|
123
|
+
trace: {
|
|
124
|
+
note(event: TraceEvent): void;
|
|
75
125
|
};
|
|
76
|
-
httpClient?: HttpClient;
|
|
77
126
|
}
|
|
78
127
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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;
|
|
128
|
+
type TraceStatus = 'value' | 'failed' | 'fallback' | 'cancelled' | 'skipped';
|
|
129
|
+
type TraceKind = 'operator' | 'fragment' | 'reference' | 'literal' | 'skeleton';
|
|
130
|
+
interface TraceNode {
|
|
131
|
+
path: (string | number)[];
|
|
132
|
+
source?: {
|
|
133
|
+
fragment: string;
|
|
119
134
|
};
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
children?:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
[key: string]: EvaluatorNode;
|
|
135
|
+
kind: TraceKind;
|
|
136
|
+
operator?: string;
|
|
137
|
+
ref?: string;
|
|
138
|
+
var?: string;
|
|
139
|
+
status: TraceStatus;
|
|
140
|
+
value?: unknown;
|
|
141
|
+
error?: FigTreeError;
|
|
142
|
+
events?: TraceEvent[];
|
|
143
|
+
children?: TraceNode[];
|
|
144
|
+
elapsed?: number;
|
|
145
|
+
warnings?: Issue[];
|
|
132
146
|
}
|
|
133
|
-
interface
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
[key: string]: EvaluatorNode;
|
|
147
|
+
interface CacheTraceEvent {
|
|
148
|
+
type: 'cache';
|
|
149
|
+
hit: boolean;
|
|
137
150
|
}
|
|
138
|
-
interface
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
151
|
+
interface RequestTraceEvent {
|
|
152
|
+
type: 'request';
|
|
153
|
+
method: string;
|
|
154
|
+
url: string;
|
|
155
|
+
headers: string[];
|
|
143
156
|
}
|
|
144
|
-
interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
interface QueryTraceEvent {
|
|
158
|
+
type: 'query';
|
|
159
|
+
text: string;
|
|
160
|
+
}
|
|
161
|
+
interface RenderTraceEvent {
|
|
162
|
+
type: 'render';
|
|
163
|
+
token: string;
|
|
164
|
+
rendered: 'literal' | 'placeholder' | 'empty' | 'gap-closed';
|
|
165
|
+
}
|
|
166
|
+
interface KeyOverwriteTraceEvent {
|
|
167
|
+
type: 'key-overwrite';
|
|
168
|
+
key: string;
|
|
169
|
+
}
|
|
170
|
+
interface ShieldedFallbackTraceEvent {
|
|
171
|
+
type: 'shielded-fallback';
|
|
172
|
+
}
|
|
173
|
+
type KnownTraceEvent = CacheTraceEvent | RequestTraceEvent | QueryTraceEvent | RenderTraceEvent | KeyOverwriteTraceEvent | ShieldedFallbackTraceEvent;
|
|
174
|
+
|
|
175
|
+
interface FigTreeErrorInit {
|
|
176
|
+
code: FigTreeErrorCode;
|
|
177
|
+
message: string;
|
|
178
|
+
path: (string | number)[];
|
|
179
|
+
holePath?: (string | number)[];
|
|
180
|
+
operator?: string;
|
|
181
|
+
fragment?: string;
|
|
182
|
+
fragmentPath?: (string | number)[];
|
|
183
|
+
errorData?: Record<string, unknown>;
|
|
184
|
+
related?: FigTreeError[];
|
|
185
|
+
cause?: unknown;
|
|
186
|
+
issues?: Issue[];
|
|
187
|
+
trace?: TraceNode;
|
|
188
|
+
}
|
|
189
|
+
declare class FigTreeError extends Error {
|
|
190
|
+
code: FigTreeErrorCode;
|
|
191
|
+
path: (string | number)[];
|
|
192
|
+
holePath?: (string | number)[];
|
|
193
|
+
operator?: string;
|
|
194
|
+
fragment?: string;
|
|
195
|
+
fragmentPath?: (string | number)[];
|
|
196
|
+
errorData?: Record<string, unknown>;
|
|
197
|
+
related?: FigTreeError[];
|
|
198
|
+
cause?: unknown;
|
|
199
|
+
issues?: Issue[];
|
|
200
|
+
trace?: TraceNode;
|
|
201
|
+
constructor(init: FigTreeErrorInit);
|
|
202
|
+
prettyPrint(): string;
|
|
203
|
+
}
|
|
204
|
+
declare const isFigTreeError: (input: unknown) => input is FigTreeError;
|
|
205
|
+
|
|
206
|
+
type BasicType = 'any' | 'string' | 'number' | 'boolean' | 'array' | 'object' | 'null' | 'integer';
|
|
207
|
+
type LiteralType = {
|
|
208
|
+
literal: readonly (string | number | boolean)[];
|
|
162
209
|
};
|
|
163
|
-
type
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
210
|
+
type ExpectedType = BasicType | LiteralType | readonly BasicType[];
|
|
211
|
+
interface Constraints {
|
|
212
|
+
length?: number;
|
|
213
|
+
homogeneous?: readonly BasicType[];
|
|
214
|
+
elementShape?: Record<string, TypeDeclaration>;
|
|
215
|
+
}
|
|
216
|
+
interface TypeDeclaration {
|
|
217
|
+
type?: ExpectedType;
|
|
218
|
+
required?: boolean;
|
|
219
|
+
constraints?: Constraints;
|
|
220
|
+
}
|
|
221
|
+
type TypeCheckResult = {
|
|
222
|
+
ok: true;
|
|
223
|
+
} | {
|
|
224
|
+
ok: false;
|
|
225
|
+
expected: string;
|
|
226
|
+
actual: string;
|
|
167
227
|
};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
228
|
+
|
|
229
|
+
declare const validateHelpers: Readonly<{
|
|
230
|
+
parsePath: (path: string) => PathSegment[];
|
|
231
|
+
resolvePath: (source: unknown, path: string | PathSegment[]) => ResolveResult;
|
|
232
|
+
checkType: (value: unknown, expected: ExpectedType) => TypeCheckResult;
|
|
233
|
+
checkConstraints: (value: unknown, constraints: Constraints) => TypeCheckResult;
|
|
234
|
+
describeType: (value: unknown) => string;
|
|
235
|
+
renderText: (value: unknown) => string;
|
|
236
|
+
isTruthy: (value: unknown) => boolean;
|
|
237
|
+
}>;
|
|
238
|
+
type ValidateHelpers = typeof validateHelpers;
|
|
239
|
+
|
|
240
|
+
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 {
|
|
241
|
+
literal: readonly (infer M)[];
|
|
242
|
+
} ? M : T extends readonly (infer B)[] ? TypeOf<B> : unknown;
|
|
243
|
+
type DeclaredType<P> = P extends {
|
|
244
|
+
type: infer T;
|
|
245
|
+
} ? T : 'any';
|
|
246
|
+
type KeepsNull<P> = P extends {
|
|
247
|
+
nullPolicy: 'value';
|
|
248
|
+
} ? true : P extends {
|
|
249
|
+
nullPolicy: NullPolicyValue;
|
|
250
|
+
} ? false : P extends {
|
|
251
|
+
nullPolicy: (...args: any) => any;
|
|
252
|
+
} ? true : false;
|
|
253
|
+
type Delivered<P> = KeepsNull<P> extends true ? TypeOf<DeclaredType<P>> : Exclude<TypeOf<DeclaredType<P>>, null>;
|
|
254
|
+
type Truthy<P> = P extends {
|
|
255
|
+
type: 'array';
|
|
256
|
+
} ? boolean[] : P extends {
|
|
257
|
+
type: 'object';
|
|
258
|
+
} ? Record<string, boolean> : boolean;
|
|
259
|
+
type ParamValue<P> = P extends {
|
|
260
|
+
evaluation: 'structural';
|
|
261
|
+
} ? TypeOf<DeclaredType<P>> : P extends {
|
|
262
|
+
evaluation: 'race';
|
|
263
|
+
} ? SettlementStream : P extends {
|
|
264
|
+
evaluation: 'lazyElements';
|
|
265
|
+
} ? LazyValue[] : P extends {
|
|
266
|
+
evaluation: 'lazyEntries';
|
|
267
|
+
} ? Record<string, LazyValue> : P extends {
|
|
268
|
+
evaluation: 'perElement';
|
|
269
|
+
} ? PerElement<P extends {
|
|
270
|
+
truthiness: true;
|
|
271
|
+
} ? boolean : Delivered<P>> : P extends {
|
|
272
|
+
evaluation: 'lazy';
|
|
273
|
+
} ? LazyValue<Delivered<P>> : P extends {
|
|
274
|
+
truthiness: true;
|
|
275
|
+
} ? Truthy<P> : Delivered<P>;
|
|
276
|
+
type IsHolder<P> = P extends {
|
|
277
|
+
replacesNullAt: readonly string[];
|
|
278
|
+
} ? true : false;
|
|
279
|
+
type IsOptional<P> = P extends {
|
|
280
|
+
default: unknown;
|
|
281
|
+
} ? false : P extends {
|
|
282
|
+
required: false;
|
|
283
|
+
} ? true : false;
|
|
284
|
+
type BodyKeys<D> = {
|
|
285
|
+
[K in keyof D]: IsHolder<D[K]> extends true ? never : K;
|
|
286
|
+
}[keyof D];
|
|
287
|
+
type OptionalKeys<D> = {
|
|
288
|
+
[K in BodyKeys<D>]: IsOptional<D[K]> extends true ? K : never;
|
|
289
|
+
}[BodyKeys<D>];
|
|
290
|
+
type RequiredKeys<D> = Exclude<BodyKeys<D>, OptionalKeys<D>>;
|
|
291
|
+
type Simplify<T> = {
|
|
292
|
+
[K in keyof T]: T[K];
|
|
293
|
+
} & {};
|
|
294
|
+
type ResolvedParams<D extends ParameterDeclarations = ParameterDeclarations> = Simplify<{
|
|
295
|
+
[K in RequiredKeys<D>]: ParamValue<D[K]>;
|
|
296
|
+
} & {
|
|
297
|
+
[K in OptionalKeys<D>]?: ParamValue<D[K]>;
|
|
298
|
+
}>;
|
|
299
|
+
|
|
300
|
+
type EvaluationMode = 'eager' | 'race' | 'lazy' | 'lazyElements' | 'lazyEntries' | 'perElement' | 'structural';
|
|
301
|
+
declare const OPERATOR_CATEGORIES: readonly ["logic", "comparison", "math", "string", "array", "data", "io", "other"];
|
|
302
|
+
type OperatorCategory = (typeof OPERATOR_CATEGORIES)[number];
|
|
303
|
+
type NullPolicyValue = 'propagate' | 'value';
|
|
304
|
+
type ConditionalNullPolicy = (selectorValue: any) => NullPolicyValue;
|
|
305
|
+
type NullPolicy = NullPolicyValue | ConditionalNullPolicy;
|
|
306
|
+
interface CompiledNullPolicy {
|
|
307
|
+
selector: string;
|
|
308
|
+
table: {
|
|
309
|
+
value: string | number | boolean;
|
|
310
|
+
policy: NullPolicyValue;
|
|
311
|
+
}[];
|
|
312
|
+
}
|
|
313
|
+
declare const EvaluationData: unique symbol;
|
|
314
|
+
type OperatorEvaluate = (params: Record<string, unknown>, context: OperatorContext) => unknown;
|
|
315
|
+
interface ValidateFinding {
|
|
316
|
+
severity: Severity;
|
|
317
|
+
message: string;
|
|
318
|
+
parameter?: string;
|
|
319
|
+
}
|
|
320
|
+
type OperatorValidate = (literalParams: Record<string, unknown>, helpers: ValidateHelpers) => ValidateFinding[];
|
|
321
|
+
interface ParameterDeclaration extends TypeDeclaration {
|
|
174
322
|
default?: unknown;
|
|
323
|
+
description?: string;
|
|
324
|
+
metadata?: Record<string, unknown>;
|
|
325
|
+
evaluation?: EvaluationMode;
|
|
326
|
+
over?: string;
|
|
327
|
+
truthiness?: boolean;
|
|
328
|
+
nullPolicy?: NullPolicy;
|
|
329
|
+
elementNullPolicy?: NullPolicyValue;
|
|
330
|
+
replacesNullAt?: readonly string[];
|
|
175
331
|
}
|
|
176
|
-
|
|
332
|
+
type ParameterDeclarations = Record<string, ParameterDeclaration>;
|
|
333
|
+
interface OperatorDefinition<P extends ParameterDeclarations = ParameterDeclarations> {
|
|
177
334
|
name: string;
|
|
178
|
-
|
|
335
|
+
alias?: string;
|
|
336
|
+
category: OperatorCategory;
|
|
337
|
+
description: string;
|
|
338
|
+
metadata?: Record<string, unknown>;
|
|
339
|
+
parameters: P;
|
|
340
|
+
positionalParams?: readonly string[];
|
|
341
|
+
timeoutParam?: string;
|
|
342
|
+
useCache?: boolean;
|
|
343
|
+
cache?: 'auto' | 'manual';
|
|
344
|
+
validate?: OperatorValidate;
|
|
345
|
+
evaluate: (params: ResolvedParams<P>, context: OperatorContext) => unknown;
|
|
346
|
+
returns?: ExpectedType;
|
|
347
|
+
}
|
|
348
|
+
declare const VALIDATED_OPERATOR: unique symbol;
|
|
349
|
+
interface ValidatedParameter {
|
|
350
|
+
type: ExpectedType;
|
|
179
351
|
required: boolean;
|
|
180
|
-
description?: string;
|
|
181
352
|
default?: unknown;
|
|
353
|
+
description?: string;
|
|
354
|
+
metadata?: Record<string, unknown>;
|
|
355
|
+
evaluation: EvaluationMode;
|
|
356
|
+
truthiness: boolean;
|
|
357
|
+
nullPolicy: NullPolicyValue | CompiledNullPolicy;
|
|
358
|
+
elementNullPolicy?: NullPolicyValue;
|
|
359
|
+
constraints?: Constraints;
|
|
360
|
+
over?: string;
|
|
361
|
+
replacesNullAt?: string[];
|
|
182
362
|
}
|
|
183
|
-
interface
|
|
363
|
+
interface ValidatedOperatorDefinition {
|
|
364
|
+
readonly [VALIDATED_OPERATOR]: true;
|
|
365
|
+
name: string;
|
|
366
|
+
alias?: string;
|
|
367
|
+
category: OperatorCategory;
|
|
184
368
|
description: string;
|
|
185
|
-
|
|
186
|
-
parameters:
|
|
369
|
+
metadata?: Record<string, unknown>;
|
|
370
|
+
parameters: Record<string, ValidatedParameter>;
|
|
371
|
+
positionalParams?: string[];
|
|
372
|
+
restParam: string | null;
|
|
373
|
+
resolution: ResolutionPlan;
|
|
374
|
+
deliversLazily: boolean;
|
|
375
|
+
timeoutParam: string | null;
|
|
376
|
+
useCache: boolean;
|
|
377
|
+
cache: 'auto' | 'manual';
|
|
378
|
+
fingerprint: string;
|
|
379
|
+
validate?: OperatorValidate;
|
|
380
|
+
evaluate: OperatorEvaluate;
|
|
381
|
+
returns: ExpectedType;
|
|
382
|
+
}
|
|
383
|
+
type DeclarationEntry = readonly [name: string, declared: ValidatedParameter];
|
|
384
|
+
interface ResolutionPlan {
|
|
385
|
+
readonly entries: readonly DeclarationEntry[];
|
|
386
|
+
readonly whole: readonly DeclarationEntry[];
|
|
387
|
+
readonly perElement: readonly DeclarationEntry[];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
declare const isTruthy: (value: unknown) => boolean;
|
|
391
|
+
|
|
392
|
+
declare const compareValues: (a: number | string, b: number | string) => -1 | 0 | 1;
|
|
393
|
+
|
|
394
|
+
declare const ARRAY = "<array>";
|
|
395
|
+
declare const OBJECT = "<object>";
|
|
396
|
+
declare const renderText: (value: unknown) => string;
|
|
397
|
+
|
|
398
|
+
declare const WILDCARD: unique symbol;
|
|
399
|
+
type Wildcard = typeof WILDCARD;
|
|
400
|
+
type PathSegment = string | number | Wildcard;
|
|
401
|
+
interface ResolveResult {
|
|
402
|
+
found: boolean;
|
|
403
|
+
value: unknown;
|
|
187
404
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
405
|
+
declare const parsePath: (path: string) => PathSegment[];
|
|
406
|
+
declare const resolvePath: (source: unknown, path: string | PathSegment[]) => ResolveResult;
|
|
407
|
+
|
|
408
|
+
declare const deepEqual: (foo: any, bar: any) => boolean;
|
|
409
|
+
|
|
410
|
+
type ReferenceNamespace = 'data' | 'vars' | 'params' | 'element' | 'index';
|
|
411
|
+
|
|
412
|
+
type ReferenceRecognition = {
|
|
413
|
+
kind: 'reference';
|
|
414
|
+
namespace: ReferenceNamespace;
|
|
415
|
+
segments: PathSegment[];
|
|
416
|
+
drill: string;
|
|
417
|
+
} | {
|
|
418
|
+
kind: 'invalid';
|
|
419
|
+
namespace: ReferenceNamespace;
|
|
420
|
+
reason: string;
|
|
421
|
+
code?: string;
|
|
422
|
+
} | {
|
|
423
|
+
kind: 'unrecognized';
|
|
424
|
+
} | {
|
|
425
|
+
kind: 'plain';
|
|
191
426
|
};
|
|
192
|
-
|
|
193
|
-
|
|
427
|
+
|
|
428
|
+
type ObjectClass = {
|
|
429
|
+
kind: 'operator';
|
|
430
|
+
} | {
|
|
431
|
+
kind: 'fragment';
|
|
432
|
+
} | {
|
|
433
|
+
kind: 'shorthand';
|
|
434
|
+
key: string;
|
|
435
|
+
} | {
|
|
436
|
+
kind: 'plain';
|
|
437
|
+
} | {
|
|
438
|
+
kind: 'malformed';
|
|
439
|
+
message: string;
|
|
194
440
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
441
|
+
interface PositionalShape {
|
|
442
|
+
positionalParams?: readonly string[];
|
|
443
|
+
restParam: string | null;
|
|
444
|
+
}
|
|
445
|
+
interface PositionalLayout {
|
|
446
|
+
bound: number;
|
|
447
|
+
restAt: number | null;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface FragmentParameterDeclaration extends TypeDeclaration {
|
|
451
|
+
default?: unknown;
|
|
452
|
+
description?: string;
|
|
453
|
+
metadata?: Record<string, unknown>;
|
|
454
|
+
}
|
|
455
|
+
interface FragmentDefinition {
|
|
456
|
+
expression: unknown;
|
|
457
|
+
parameters?: Record<string, FragmentParameterDeclaration>;
|
|
458
|
+
description?: string;
|
|
459
|
+
metadata?: Record<string, unknown>;
|
|
460
|
+
}
|
|
461
|
+
interface FragmentParameter {
|
|
462
|
+
type: ExpectedType;
|
|
463
|
+
required: boolean;
|
|
464
|
+
default?: unknown;
|
|
465
|
+
description?: string;
|
|
466
|
+
metadata?: Record<string, unknown>;
|
|
467
|
+
constraints?: Constraints;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
type EvaluationOptions = Omit<FigTreeOptions, 'operators' | 'fragments'>;
|
|
471
|
+
type CallOptions = Pick<FigTreeOptions, 'data' | 'signal' | 'timeout' | 'mode' | 'trace'>;
|
|
472
|
+
type OnlyCallOptions<CallOpts> = CallOpts & {
|
|
473
|
+
[Key in Exclude<keyof CallOpts, keyof CallOptions>]: never;
|
|
474
|
+
};
|
|
475
|
+
interface FigTreeOptions {
|
|
476
|
+
data?: Record<string, unknown>;
|
|
477
|
+
fragments?: Record<string, FragmentDefinition>;
|
|
478
|
+
operators?: (ValidatedOperatorDefinition | ValidatedOperatorDefinition[])[];
|
|
479
|
+
operatorDefaults?: {
|
|
480
|
+
[operator: string]: {
|
|
481
|
+
[param: string]: unknown;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
http?: {
|
|
485
|
+
baseEndpoint?: string;
|
|
486
|
+
headers?: Record<string, string>;
|
|
487
|
+
};
|
|
488
|
+
graphQL?: {
|
|
489
|
+
endpoint?: string;
|
|
490
|
+
headers?: Record<string, string>;
|
|
491
|
+
};
|
|
492
|
+
strictDataPaths?: boolean;
|
|
493
|
+
maxDepth?: number;
|
|
494
|
+
maxNodes?: number;
|
|
495
|
+
timeout?: number;
|
|
496
|
+
signal?: AbortSignal;
|
|
497
|
+
useCache?: boolean;
|
|
498
|
+
cache?: {
|
|
499
|
+
store?: CacheStore;
|
|
500
|
+
maxSize?: number;
|
|
501
|
+
maxTime?: number;
|
|
227
502
|
};
|
|
228
|
-
|
|
503
|
+
runtimeTypeCheck?: boolean;
|
|
504
|
+
mode?: 'throw' | 'report';
|
|
505
|
+
trace?: boolean;
|
|
229
506
|
}
|
|
230
|
-
|
|
507
|
+
interface EvaluationResult {
|
|
508
|
+
result: unknown;
|
|
509
|
+
errors: FigTreeError[];
|
|
510
|
+
trace?: TraceNode;
|
|
511
|
+
}
|
|
512
|
+
type NoOptions = Record<never, never>;
|
|
513
|
+
type Merge<Instance, Call> = Omit<Instance, keyof Call> & Call;
|
|
514
|
+
type ResultShape<O> = O extends {
|
|
515
|
+
mode: 'report';
|
|
516
|
+
} | {
|
|
517
|
+
trace: true;
|
|
518
|
+
} ? EvaluationResult : unknown;
|
|
231
519
|
|
|
232
|
-
|
|
233
|
-
|
|
520
|
+
interface Dependencies {
|
|
521
|
+
data: {
|
|
522
|
+
paths: string[];
|
|
523
|
+
dynamic: boolean;
|
|
524
|
+
};
|
|
525
|
+
operators: string[];
|
|
526
|
+
fragments: string[];
|
|
527
|
+
}
|
|
528
|
+
interface ParameterInfo extends ValidatedParameter {
|
|
529
|
+
instanceDefault?: unknown;
|
|
530
|
+
}
|
|
531
|
+
interface OperatorInfo extends Omit<ValidatedOperatorDefinition, typeof VALIDATED_OPERATOR | 'evaluate' | 'validate' | 'deliversLazily' | 'resolution' | 'fingerprint' | 'parameters'> {
|
|
532
|
+
parameters: Record<string, ParameterInfo>;
|
|
533
|
+
hasValidate: boolean;
|
|
534
|
+
instanceUseCache?: boolean;
|
|
535
|
+
instanceFallback?: unknown;
|
|
536
|
+
}
|
|
537
|
+
interface FragmentInfo {
|
|
538
|
+
name: string;
|
|
539
|
+
description?: string;
|
|
540
|
+
metadata?: Record<string, unknown>;
|
|
541
|
+
parameters: Record<string, FragmentParameter>;
|
|
542
|
+
returns: ExpectedType;
|
|
543
|
+
warnings: Issue[];
|
|
544
|
+
dependencies: Dependencies;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
declare class FigTree<InstanceOpts extends FigTreeOptions = NoOptions> {
|
|
548
|
+
private state;
|
|
549
|
+
private readonly results;
|
|
550
|
+
readonly version = "3.0.0-preview.2";
|
|
551
|
+
constructor(options?: InstanceOpts);
|
|
552
|
+
updateOptions(options?: FigTreeOptions): void;
|
|
553
|
+
clearCache(): void;
|
|
554
|
+
getOptions(): EvaluationOptions;
|
|
555
|
+
getOperators(): OperatorInfo[];
|
|
556
|
+
getFragments(): FragmentInfo[];
|
|
557
|
+
validate(expression: unknown, options?: CallOptions): ValidationResult;
|
|
558
|
+
getDependencies(expression: unknown): Dependencies;
|
|
559
|
+
isEvaluable(expression: unknown): boolean;
|
|
560
|
+
evaluate<CallOpts extends CallOptions = NoOptions>(expression: unknown, options?: OnlyCallOptions<CallOpts>): Promise<ResultShape<Merge<InstanceOpts, CallOpts>>>;
|
|
561
|
+
compile(expression: unknown): CompiledExpression<InstanceOpts>;
|
|
562
|
+
}
|
|
563
|
+
declare class CompiledExpression<InstanceOpts extends FigTreeOptions = NoOptions> {
|
|
564
|
+
#private;
|
|
565
|
+
private constructor();
|
|
566
|
+
get expression(): unknown;
|
|
567
|
+
get issues(): readonly Issue[];
|
|
568
|
+
get hasErrors(): boolean;
|
|
569
|
+
evaluate<CallOpts extends CallOptions = NoOptions>(options?: OnlyCallOptions<CallOpts>): Promise<ResultShape<Merge<InstanceOpts, CallOpts>>>;
|
|
570
|
+
getDependencies(): Dependencies;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
declare function defineOperator(definition: ValidatedOperatorDefinition): ValidatedOperatorDefinition;
|
|
574
|
+
declare function defineOperator<const P extends ParameterDeclarations>(definition: OperatorDefinition<P>): ValidatedOperatorDefinition;
|
|
575
|
+
|
|
576
|
+
declare const coreOperators: ValidatedOperatorDefinition[];
|
|
577
|
+
|
|
578
|
+
interface OperatorFailureInit {
|
|
579
|
+
code?: string;
|
|
234
580
|
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
581
|
}
|
|
241
|
-
declare
|
|
582
|
+
declare class OperatorFailure extends Error {
|
|
583
|
+
code?: string;
|
|
584
|
+
errorData?: Record<string, unknown>;
|
|
585
|
+
constructor(message: string, init?: OperatorFailureInit);
|
|
586
|
+
}
|
|
587
|
+
declare const isOperatorFailure: (input: unknown) => input is OperatorFailure;
|
|
242
588
|
|
|
243
|
-
declare const
|
|
244
|
-
|
|
245
|
-
};
|
|
246
|
-
declare const SQLite: (db: Database) => {
|
|
247
|
-
query: ({ query, values }: QueryInput) => Promise<any[]>;
|
|
248
|
-
};
|
|
589
|
+
declare const httpOperators: (client?: HttpClient) => ValidatedOperatorDefinition[];
|
|
590
|
+
declare const sqlOperators: (connection: SqlConnection) => ValidatedOperatorDefinition[];
|
|
249
591
|
|
|
250
|
-
type
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
592
|
+
type FetchLike = (input: string, init?: {
|
|
593
|
+
method?: string;
|
|
594
|
+
headers?: Record<string, string>;
|
|
595
|
+
body?: string;
|
|
596
|
+
signal?: AbortSignal;
|
|
597
|
+
}) => Promise<FetchResponseLike>;
|
|
598
|
+
interface FetchResponseLike {
|
|
599
|
+
ok: boolean;
|
|
600
|
+
status: number;
|
|
601
|
+
statusText: string;
|
|
602
|
+
url: string;
|
|
603
|
+
text(): Promise<string>;
|
|
604
|
+
}
|
|
605
|
+
interface AxiosLike {
|
|
606
|
+
(config: {
|
|
607
|
+
url: string;
|
|
608
|
+
method: 'get' | 'post';
|
|
609
|
+
headers?: Record<string, string>;
|
|
610
|
+
data?: unknown;
|
|
611
|
+
signal?: AbortSignal;
|
|
612
|
+
}): Promise<{
|
|
613
|
+
data: unknown;
|
|
614
|
+
status: number;
|
|
615
|
+
statusText: string;
|
|
616
|
+
}>;
|
|
617
|
+
isAxiosError(payload: unknown): payload is AxiosErrorLike;
|
|
618
|
+
}
|
|
619
|
+
interface AxiosErrorLike {
|
|
620
|
+
message: string;
|
|
621
|
+
config?: {
|
|
622
|
+
url?: string;
|
|
623
|
+
};
|
|
624
|
+
response?: {
|
|
625
|
+
status: number;
|
|
626
|
+
statusText: string;
|
|
627
|
+
data: unknown;
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
declare class FetchClient implements HttpClient {
|
|
631
|
+
private readonly supplied?;
|
|
632
|
+
constructor(fetchImpl?: FetchLike);
|
|
633
|
+
request: (req: HttpRequest) => Promise<unknown>;
|
|
634
|
+
}
|
|
635
|
+
declare class AxiosClient implements HttpClient {
|
|
636
|
+
private readonly axios;
|
|
637
|
+
constructor(axios: AxiosLike);
|
|
638
|
+
request: (req: HttpRequest) => Promise<unknown>;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
interface PgClientLike {
|
|
642
|
+
query(config: {
|
|
643
|
+
text: string;
|
|
644
|
+
values?: unknown[];
|
|
645
|
+
}): Promise<{
|
|
646
|
+
rows: Record<string, unknown>[];
|
|
647
|
+
}>;
|
|
648
|
+
}
|
|
649
|
+
interface SqliteDatabaseLike {
|
|
650
|
+
all(sql: string, params?: unknown[] | Record<string, unknown>): Promise<Record<string, unknown>[]>;
|
|
651
|
+
}
|
|
652
|
+
declare class PostgresConnection implements SqlConnection {
|
|
653
|
+
private readonly client;
|
|
654
|
+
constructor(client: PgClientLike);
|
|
655
|
+
query: (req: SqlRequest) => Promise<Record<string, unknown>[]>;
|
|
656
|
+
}
|
|
657
|
+
declare class SQLiteConnection implements SqlConnection {
|
|
658
|
+
private readonly db;
|
|
659
|
+
constructor(db: SqliteDatabaseLike);
|
|
660
|
+
query: (req: SqlRequest) => Promise<Record<string, unknown>[]>;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
type Json = null | boolean | number | string | Json[] | {
|
|
664
|
+
[key: string]: Json;
|
|
260
665
|
};
|
|
666
|
+
type Path = (string | number)[];
|
|
261
667
|
|
|
262
|
-
|
|
668
|
+
type NodeMap = Record<string, InspectNode>;
|
|
669
|
+
type InspectNode = {
|
|
670
|
+
order: number;
|
|
671
|
+
path: Path;
|
|
672
|
+
} & ({
|
|
673
|
+
kind: 'constant';
|
|
674
|
+
value: Json;
|
|
675
|
+
} | {
|
|
676
|
+
kind: 'reference';
|
|
677
|
+
reference: string;
|
|
678
|
+
authored: string;
|
|
679
|
+
binding?: string;
|
|
680
|
+
} | {
|
|
681
|
+
kind: 'operator';
|
|
682
|
+
vars?: NodeMap;
|
|
683
|
+
operator: string;
|
|
684
|
+
params: NodeMap;
|
|
685
|
+
fallback?: InspectNode;
|
|
686
|
+
timeoutFallback?: Json;
|
|
687
|
+
useCache?: boolean;
|
|
688
|
+
instanceDefaults?: string[];
|
|
689
|
+
} | {
|
|
690
|
+
kind: 'fragmentCall';
|
|
691
|
+
vars?: NodeMap;
|
|
692
|
+
fragment: string;
|
|
693
|
+
resolved: boolean;
|
|
694
|
+
argumentsMode: 'static' | 'dynamic';
|
|
695
|
+
parameters?: NodeMap | InspectNode;
|
|
696
|
+
fallback?: InspectNode;
|
|
697
|
+
timeoutFallback?: Json;
|
|
698
|
+
} | {
|
|
699
|
+
kind: 'skeleton';
|
|
700
|
+
vars?: NodeMap;
|
|
701
|
+
shape: Json;
|
|
702
|
+
holes: {
|
|
703
|
+
at: Path;
|
|
704
|
+
node: InspectNode;
|
|
705
|
+
}[];
|
|
706
|
+
} | {
|
|
707
|
+
kind: 'elements';
|
|
708
|
+
elements: InspectNode[];
|
|
709
|
+
} | {
|
|
710
|
+
kind: 'entries';
|
|
711
|
+
vars?: NodeMap;
|
|
712
|
+
entries: NodeMap;
|
|
713
|
+
} | {
|
|
714
|
+
kind: 'invalid';
|
|
715
|
+
raw: Json;
|
|
716
|
+
});
|
|
263
717
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
718
|
+
type InspectIssue = Issue & {
|
|
719
|
+
order?: number;
|
|
720
|
+
};
|
|
721
|
+
interface InspectDependencies {
|
|
722
|
+
dataPaths: string[];
|
|
723
|
+
dynamic: boolean;
|
|
724
|
+
operators: string[];
|
|
725
|
+
fragments: string[];
|
|
726
|
+
}
|
|
727
|
+
interface InspectReport {
|
|
728
|
+
version: string;
|
|
729
|
+
expression: Json;
|
|
730
|
+
options: Record<string, Json>;
|
|
731
|
+
canonicalForm: InspectNode;
|
|
732
|
+
issues: InspectIssue[];
|
|
733
|
+
timeoutShielded: boolean;
|
|
734
|
+
nodeCount: number;
|
|
735
|
+
maxDepth: number;
|
|
736
|
+
dependencies: InspectDependencies;
|
|
737
|
+
own: {
|
|
738
|
+
nodeCount: number;
|
|
739
|
+
maxDepth: number;
|
|
740
|
+
dependencies: InspectDependencies;
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
declare const inspect: <InstanceOpts extends FigTreeOptions>(compiled: CompiledExpression<InstanceOpts>, options?: CallOptions) => InspectReport;
|
|
271
744
|
|
|
272
|
-
|
|
273
|
-
|
|
745
|
+
interface OperatorHints {
|
|
746
|
+
displayName: string;
|
|
747
|
+
docUrl: string;
|
|
748
|
+
backgroundColor: string;
|
|
749
|
+
textColor: string;
|
|
750
|
+
seeds?: {
|
|
751
|
+
[parameter: string]: unknown;
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
type FragmentHints = Omit<OperatorHints, 'docUrl'> & {
|
|
755
|
+
docUrl?: string;
|
|
756
|
+
};
|
|
757
|
+
interface CategoryHints {
|
|
758
|
+
displayName: string;
|
|
759
|
+
order: number;
|
|
760
|
+
backgroundColor: string;
|
|
761
|
+
textColor: string;
|
|
762
|
+
}
|
|
763
|
+
type OperatorHintMap = {
|
|
764
|
+
[operator: string]: OperatorHints;
|
|
765
|
+
};
|
|
766
|
+
type CategoryHintMap = {
|
|
767
|
+
[category in OperatorCategory]: CategoryHints;
|
|
768
|
+
};
|
|
769
|
+
type TypeSeeds = {
|
|
770
|
+
[type in BasicType]: unknown;
|
|
771
|
+
};
|
|
274
772
|
|
|
275
|
-
|
|
773
|
+
interface MigrationIssue {
|
|
774
|
+
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' | 'instance-case-insensitive' | 'values-cut' | 'fallback-converted' | 'malformed-entry' | 'unreachable-branches' | 'overridden-value' | 'discarded-expression' | 'fragment-shorthand-payload' | 'shadowed-argument' | 'unknown-argument' | 'fragment-use-cache' | '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';
|
|
775
|
+
tag: 'non-convertible' | 'intentional-semantic-change' | 'lossy-default';
|
|
776
|
+
path: (string | number)[];
|
|
777
|
+
message: string;
|
|
778
|
+
}
|
|
779
|
+
interface MigrationResult {
|
|
780
|
+
expression: unknown;
|
|
781
|
+
issues: MigrationIssue[];
|
|
782
|
+
}
|
|
783
|
+
interface FragmentMigrationResult {
|
|
784
|
+
fragments: Record<string, FragmentDefinition>;
|
|
785
|
+
issues: MigrationIssue[];
|
|
786
|
+
}
|
|
787
|
+
interface V2Options {
|
|
788
|
+
fragments?: Record<string, unknown>;
|
|
789
|
+
functions?: readonly string[] | Record<string, unknown>;
|
|
790
|
+
evaluateFullObject?: boolean;
|
|
791
|
+
noShorthand?: boolean;
|
|
792
|
+
caseInsensitive?: boolean;
|
|
793
|
+
useCache?: boolean;
|
|
794
|
+
}
|
|
276
795
|
|
|
277
|
-
|
|
796
|
+
interface Registry {
|
|
797
|
+
getOperators(): readonly {
|
|
798
|
+
name: string;
|
|
799
|
+
alias?: string;
|
|
800
|
+
positionalParams?: readonly string[];
|
|
801
|
+
restParam: string | null;
|
|
802
|
+
}[];
|
|
803
|
+
getFragments(): readonly {
|
|
804
|
+
name: string;
|
|
805
|
+
}[];
|
|
806
|
+
}
|
|
807
|
+
type Spelling = 'preserve' | 'canonical' | 'alias';
|
|
808
|
+
interface NameOptions {
|
|
809
|
+
referenceNames?: Spelling;
|
|
810
|
+
}
|
|
811
|
+
interface CanonicalOptions extends NameOptions {
|
|
812
|
+
operatorNames?: Spelling;
|
|
813
|
+
referencesAsGet?: boolean;
|
|
814
|
+
}
|
|
815
|
+
interface ShorthandOptions extends NameOptions {
|
|
816
|
+
operatorNames?: Spelling;
|
|
817
|
+
arguments?: 'positional' | 'named';
|
|
818
|
+
getAsReference?: boolean;
|
|
819
|
+
}
|
|
278
820
|
|
|
279
|
-
export {
|
|
821
|
+
export { ARRAY, AxiosClient, CompiledExpression, ErrorCodes, EvaluationData, FetchClient, FigTree, FigTreeError, OBJECT, OPERATOR_CATEGORIES, OperatorFailure, PostgresConnection, SQLiteConnection, WILDCARD, compareValues, coreOperators, deepEqual, defineOperator, httpOperators, inspect, isFigTreeError, isOperatorFailure, isTruthy, parsePath, renderText, resolvePath, sqlOperators, version };
|
|
822
|
+
export type { AxiosErrorLike, AxiosLike, BasicType, CacheStore, CacheTraceEvent, CallOptions, CanonicalOptions, CategoryHintMap, CategoryHints, CompiledNullPolicy, ConditionalNullPolicy, Constraints, Dependencies, EvaluationMode, EvaluationOptions, EvaluationResult, ExpectedType, FetchLike, FetchResponseLike, FigTreeErrorCode, FigTreeErrorInit, FigTreeOptions, FragmentDefinition, FragmentHints, FragmentInfo, FragmentMigrationResult, FragmentParameter, FragmentParameterDeclaration, HttpClient, HttpRequest, InspectDependencies, InspectIssue, InspectNode, InspectReport, Issue, KeyOverwriteTraceEvent, KnownTraceEvent, LazyValue, LiteralType, Merge, MigrationIssue, MigrationResult, NameOptions, NoOptions, NullPolicy, NullPolicyValue, ObjectClass, OnlyCallOptions, OperatorCategory, OperatorContext, OperatorDefinition, OperatorEvaluate, OperatorFailureInit, OperatorHintMap, OperatorHints, OperatorInfo, OperatorValidate, ParamValue, ParameterDeclaration, ParameterDeclarations, ParameterInfo, PathSegment, PerElement, PgClientLike, PositionalLayout, PositionalShape, QueryTraceEvent, ReferenceNamespace, ReferenceRecognition, 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 };
|