@jmespath-community/jmespath 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -8
- package/dist/cli.cjs +2816 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.mjs +857 -244
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +849 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +86 -34
- package/dist/index.d.ts +86 -34
- package/dist/index.esm.js +850 -242
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +5 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.mjs +850 -242
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +852 -273
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +5 -1
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +41 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type JSONPrimitive = string | number | boolean | null;
|
|
2
2
|
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
3
|
-
type JSONObject = {
|
|
3
|
+
type JSONObject = Readonly<{
|
|
4
4
|
[member: string]: JSONValue;
|
|
5
|
-
}
|
|
6
|
-
type JSONArray = JSONValue
|
|
5
|
+
}>;
|
|
6
|
+
type JSONArray = ReadonlyArray<JSONValue>;
|
|
7
7
|
|
|
8
8
|
declare enum Token {
|
|
9
9
|
TOK_EOF = "EOF",
|
|
@@ -159,7 +159,14 @@ type ExpressionReference = {
|
|
|
159
159
|
} & ExpressionNode;
|
|
160
160
|
|
|
161
161
|
type ScopeEntry = JSONObject;
|
|
162
|
-
|
|
162
|
+
interface Options extends LexerOptions {
|
|
163
|
+
maxDepth?: number;
|
|
164
|
+
maxNodes?: number;
|
|
165
|
+
maxOutputSize?: number;
|
|
166
|
+
allowedFunctions?: string[];
|
|
167
|
+
disallowedFunctions?: string[];
|
|
168
|
+
timeoutMs?: number;
|
|
169
|
+
}
|
|
163
170
|
|
|
164
171
|
declare enum InputArgument {
|
|
165
172
|
TYPE_NUMBER = 0,
|
|
@@ -180,7 +187,7 @@ interface InputSignature {
|
|
|
180
187
|
variadic?: boolean;
|
|
181
188
|
optional?: boolean;
|
|
182
189
|
}
|
|
183
|
-
type RuntimeFunction<T extends
|
|
190
|
+
type RuntimeFunction<T extends ReadonlyArray<JSONValue | ExpressionNode>, U> = (resolvedArgs: T) => U;
|
|
184
191
|
interface FunctionSignature {
|
|
185
192
|
_func: RuntimeFunction<any, JSONValue>;
|
|
186
193
|
_signature: InputSignature[];
|
|
@@ -237,7 +244,7 @@ interface FunctionRegistry {
|
|
|
237
244
|
clearCustomFunctions(): void;
|
|
238
245
|
}
|
|
239
246
|
declare class Runtime implements FunctionRegistry {
|
|
240
|
-
_interpreter: TreeInterpreter
|
|
247
|
+
_interpreter: TreeInterpreter;
|
|
241
248
|
_functionTable: FunctionTable;
|
|
242
249
|
private _customFunctions;
|
|
243
250
|
TYPE_NAME_TABLE: Readonly<{
|
|
@@ -254,7 +261,7 @@ declare class Runtime implements FunctionRegistry {
|
|
|
254
261
|
readonly 9: "Array<string>";
|
|
255
262
|
readonly 11: "Array<Array<any>>";
|
|
256
263
|
}>;
|
|
257
|
-
constructor(interpreter: TreeInterpreter
|
|
264
|
+
constructor(interpreter: TreeInterpreter);
|
|
258
265
|
private buildFunctionTable;
|
|
259
266
|
/**
|
|
260
267
|
* Enhanced registerFunction with backward compatibility and new options
|
|
@@ -336,14 +343,21 @@ declare class Runtime implements FunctionRegistry {
|
|
|
336
343
|
private functionZip;
|
|
337
344
|
}
|
|
338
345
|
|
|
339
|
-
declare class TreeInterpreter
|
|
346
|
+
declare class TreeInterpreter {
|
|
340
347
|
runtime: Runtime;
|
|
341
348
|
private _rootValue;
|
|
342
349
|
private _scope;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
350
|
+
private _options?;
|
|
351
|
+
private _depth;
|
|
352
|
+
private _deadline;
|
|
353
|
+
constructor(options?: Options);
|
|
354
|
+
withScope(scope: ScopeEntry): TreeInterpreter;
|
|
355
|
+
search(node: ExpressionNode, value: JSONValue, options?: Options): JSONValue;
|
|
356
|
+
private checkOutputSize;
|
|
357
|
+
private collect;
|
|
358
|
+
private evaluateProjectionItems;
|
|
346
359
|
visit(node: ExpressionNode, value: JSONValue | ExpressionNode): JSONValue | ExpressionNode | ExpressionReference;
|
|
360
|
+
private evaluateNode;
|
|
347
361
|
computeSliceParams(arrayLength: number, sliceNode: SliceNode): {
|
|
348
362
|
start: number;
|
|
349
363
|
stop: number;
|
|
@@ -353,6 +367,16 @@ declare class TreeInterpreter$1 {
|
|
|
353
367
|
slice(collection: JSONArray, start: number, end: number, step: number): JSONArray;
|
|
354
368
|
}
|
|
355
369
|
|
|
370
|
+
type NormalizePath<S extends string> = S extends `${infer Pre}[${infer Idx}]${infer Post}` ? NormalizePath<Pre extends '' ? `${Idx}${Post}` : `${Pre}.${Idx}${Post}`> : S;
|
|
371
|
+
type Split<S extends string> = S extends `${infer Head}.${infer Tail}` ? [Unquote<Head>, ...Split<Tail>] : [Unquote<S>];
|
|
372
|
+
type Unquote<S extends string> = S extends `"${infer Inner}"` ? Inner : S;
|
|
373
|
+
type IsSpecialExpression<P extends string> = P extends `${string}${'|' | '?' | '{' | '(' | '@' | '&' | '+' | '-' | '/' | '%' | '!'}${string}` ? true : false;
|
|
374
|
+
type ResolvePath<T, Segments extends string[]> = Segments extends [
|
|
375
|
+
infer Head extends string,
|
|
376
|
+
...infer Tail extends string[]
|
|
377
|
+
] ? Head extends '*' ? T extends (infer E)[] ? ResolvePath<E, Tail>[] : JSONValue : T extends (infer E)[] ? Head extends `${number}` ? ResolvePath<E, Tail> : JSONValue : T extends object ? Head extends keyof T ? undefined extends T[Head] ? ResolvePath<NonNullable<T[Head]>, Tail> | null : ResolvePath<NonNullable<T[Head]>, Tail> : JSONValue : JSONValue : T;
|
|
378
|
+
type PathValue<T, P extends string> = string extends P ? JSONValue : IsSpecialExpression<P> extends true ? JSONValue : ResolvePath<T, Split<NormalizePath<P>>>;
|
|
379
|
+
|
|
356
380
|
declare class ScopeChain {
|
|
357
381
|
private inner?;
|
|
358
382
|
private data;
|
|
@@ -361,32 +385,57 @@ declare class ScopeChain {
|
|
|
361
385
|
getValue(identifier: string): JSONValue;
|
|
362
386
|
}
|
|
363
387
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
388
|
+
type StreamSource<T = unknown> = AsyncIterable<T> | Iterable<T> | ReadableStream<T> | NodeJS.ReadableStream;
|
|
389
|
+
interface StreamOptions extends Options {
|
|
390
|
+
/**
|
|
391
|
+
* If true, splits string chunks by newline and parses each line as JSON.
|
|
392
|
+
* If 'auto', detects string lines that look like JSON objects/arrays.
|
|
393
|
+
* If false, does not parse string chunks.
|
|
394
|
+
* Defaults to 'auto'.
|
|
395
|
+
*/
|
|
396
|
+
parseJson?: boolean | 'auto';
|
|
397
|
+
/**
|
|
398
|
+
* If true, array chunks emitted by the stream are flattened so their elements
|
|
399
|
+
* are yielded individually.
|
|
400
|
+
* Defaults to true.
|
|
401
|
+
*/
|
|
402
|
+
flattenChunks?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Maximum number of results to yield before ending stream evaluation early.
|
|
405
|
+
*/
|
|
406
|
+
limit?: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Incremental Result Streaming evaluation.
|
|
410
|
+
* Evaluates a JMESPath expression incrementally over an AsyncIterable or ReadableStream source.
|
|
411
|
+
*/
|
|
412
|
+
declare function searchStream<T = JSONValue, D = unknown>(sourceOrExpression: StreamSource<D> | string | ExpressionNode, expressionOrSource: string | ExpressionNode | StreamSource<D>, options?: StreamOptions): AsyncGenerator<T, void, unknown>;
|
|
413
|
+
|
|
414
|
+
interface ValidationResult {
|
|
415
|
+
valid: boolean;
|
|
416
|
+
error?: string;
|
|
417
|
+
ast?: ExpressionNode;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
interface CompiledQuery<T = JSONValue, D = unknown> {
|
|
421
|
+
(data: D): T;
|
|
422
|
+
search: (data: D) => T;
|
|
423
|
+
searchStream: (source: StreamSource<D>, options?: StreamOptions) => AsyncGenerator<T, void, unknown>;
|
|
424
|
+
ast: ExpressionNode;
|
|
425
|
+
}
|
|
426
|
+
|
|
376
427
|
declare function compile(expression: string, options?: Options): ExpressionNode;
|
|
428
|
+
declare function compileQuery<T = JSONValue, D = unknown>(expression: string, options?: Options): CompiledQuery<T, D>;
|
|
429
|
+
declare function validate(expression: string, options?: Options): ValidationResult;
|
|
377
430
|
declare function tokenize(expression: string, options?: LexerOptions): LexerToken[];
|
|
378
|
-
declare
|
|
379
|
-
declare
|
|
380
|
-
declare const unregisterFunction: <T extends string>(name: T extends BuiltInFunctionNames ? never : T) => boolean;
|
|
381
|
-
declare const isRegistered: (name: string) => boolean;
|
|
382
|
-
declare const getRegisteredFunctions: () => string[];
|
|
383
|
-
declare const getCustomFunctions: () => string[];
|
|
384
|
-
declare const clearCustomFunctions: () => void;
|
|
385
|
-
declare function search(data: JSONValue, expression: string, options?: Options): JSONValue;
|
|
431
|
+
declare function search<T, P extends string>(data: T, expression: P, options?: Options): PathValue<T, P>;
|
|
432
|
+
declare function search<T = JSONValue, D = unknown>(data: D, expression: string, options?: Options): T;
|
|
386
433
|
declare function Scope(): ScopeChain;
|
|
387
|
-
declare const TreeInterpreter: TreeInterpreter$1;
|
|
388
434
|
declare const jmespath: {
|
|
389
435
|
compile: typeof compile;
|
|
436
|
+
compileQuery: typeof compileQuery;
|
|
437
|
+
searchStream: typeof searchStream;
|
|
438
|
+
validate: typeof validate;
|
|
390
439
|
registerFunction: (functionName: string, customFunction: RuntimeFunction<(JSONValue | ExpressionNode)[], JSONValue>, signature: InputSignature[], options?: RegisterOptions) => void;
|
|
391
440
|
register: <T extends string>(name: T extends BuiltInFunctionNames ? never : T, customFunction: RuntimeFunction<(JSONValue | ExpressionNode)[], JSONValue>, signature: InputSignature[], options?: RegisterOptions) => RegistrationResult;
|
|
392
441
|
unregisterFunction: <T extends string>(name: T extends BuiltInFunctionNames ? never : T) => boolean;
|
|
@@ -396,7 +445,7 @@ declare const jmespath: {
|
|
|
396
445
|
clearCustomFunctions: () => void;
|
|
397
446
|
search: typeof search;
|
|
398
447
|
tokenize: typeof tokenize;
|
|
399
|
-
TreeInterpreter: TreeInterpreter
|
|
448
|
+
TreeInterpreter: TreeInterpreter;
|
|
400
449
|
TYPE_ANY: InputArgument;
|
|
401
450
|
TYPE_ARRAY_NUMBER: InputArgument;
|
|
402
451
|
TYPE_ARRAY_STRING: InputArgument;
|
|
@@ -407,6 +456,9 @@ declare const jmespath: {
|
|
|
407
456
|
TYPE_NUMBER: InputArgument;
|
|
408
457
|
TYPE_OBJECT: InputArgument;
|
|
409
458
|
TYPE_STRING: InputArgument;
|
|
459
|
+
TYPE_ARRAY_ARRAY: InputArgument;
|
|
460
|
+
TYPE_ARRAY_OBJECT: InputArgument;
|
|
461
|
+
Scope: typeof Scope;
|
|
410
462
|
};
|
|
411
463
|
|
|
412
|
-
export { type BuiltInFunctionNames, type FunctionRegistry, type FunctionSignature, type InputSignature, type JSONArray, type JSONObject, type JSONPrimitive, type JSONValue, type Options, type RegisterOptions, type RegistrationResult, type RuntimeFunction,
|
|
464
|
+
export { type BuiltInFunctionNames, type CompiledQuery, type FunctionRegistry, type FunctionSignature, type InputSignature, type JSONArray, type JSONObject, type JSONPrimitive, type JSONValue, type Options, type PathValue, type RegisterOptions, type RegistrationResult, type RuntimeFunction, type StreamOptions, type StreamSource, type ValidationResult, jmespath as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type JSONPrimitive = string | number | boolean | null;
|
|
2
2
|
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
3
|
-
type JSONObject = {
|
|
3
|
+
type JSONObject = Readonly<{
|
|
4
4
|
[member: string]: JSONValue;
|
|
5
|
-
}
|
|
6
|
-
type JSONArray = JSONValue
|
|
5
|
+
}>;
|
|
6
|
+
type JSONArray = ReadonlyArray<JSONValue>;
|
|
7
7
|
|
|
8
8
|
declare enum Token {
|
|
9
9
|
TOK_EOF = "EOF",
|
|
@@ -159,7 +159,14 @@ type ExpressionReference = {
|
|
|
159
159
|
} & ExpressionNode;
|
|
160
160
|
|
|
161
161
|
type ScopeEntry = JSONObject;
|
|
162
|
-
|
|
162
|
+
interface Options extends LexerOptions {
|
|
163
|
+
maxDepth?: number;
|
|
164
|
+
maxNodes?: number;
|
|
165
|
+
maxOutputSize?: number;
|
|
166
|
+
allowedFunctions?: string[];
|
|
167
|
+
disallowedFunctions?: string[];
|
|
168
|
+
timeoutMs?: number;
|
|
169
|
+
}
|
|
163
170
|
|
|
164
171
|
declare enum InputArgument {
|
|
165
172
|
TYPE_NUMBER = 0,
|
|
@@ -180,7 +187,7 @@ interface InputSignature {
|
|
|
180
187
|
variadic?: boolean;
|
|
181
188
|
optional?: boolean;
|
|
182
189
|
}
|
|
183
|
-
type RuntimeFunction<T extends
|
|
190
|
+
type RuntimeFunction<T extends ReadonlyArray<JSONValue | ExpressionNode>, U> = (resolvedArgs: T) => U;
|
|
184
191
|
interface FunctionSignature {
|
|
185
192
|
_func: RuntimeFunction<any, JSONValue>;
|
|
186
193
|
_signature: InputSignature[];
|
|
@@ -237,7 +244,7 @@ interface FunctionRegistry {
|
|
|
237
244
|
clearCustomFunctions(): void;
|
|
238
245
|
}
|
|
239
246
|
declare class Runtime implements FunctionRegistry {
|
|
240
|
-
_interpreter: TreeInterpreter
|
|
247
|
+
_interpreter: TreeInterpreter;
|
|
241
248
|
_functionTable: FunctionTable;
|
|
242
249
|
private _customFunctions;
|
|
243
250
|
TYPE_NAME_TABLE: Readonly<{
|
|
@@ -254,7 +261,7 @@ declare class Runtime implements FunctionRegistry {
|
|
|
254
261
|
readonly 9: "Array<string>";
|
|
255
262
|
readonly 11: "Array<Array<any>>";
|
|
256
263
|
}>;
|
|
257
|
-
constructor(interpreter: TreeInterpreter
|
|
264
|
+
constructor(interpreter: TreeInterpreter);
|
|
258
265
|
private buildFunctionTable;
|
|
259
266
|
/**
|
|
260
267
|
* Enhanced registerFunction with backward compatibility and new options
|
|
@@ -336,14 +343,21 @@ declare class Runtime implements FunctionRegistry {
|
|
|
336
343
|
private functionZip;
|
|
337
344
|
}
|
|
338
345
|
|
|
339
|
-
declare class TreeInterpreter
|
|
346
|
+
declare class TreeInterpreter {
|
|
340
347
|
runtime: Runtime;
|
|
341
348
|
private _rootValue;
|
|
342
349
|
private _scope;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
350
|
+
private _options?;
|
|
351
|
+
private _depth;
|
|
352
|
+
private _deadline;
|
|
353
|
+
constructor(options?: Options);
|
|
354
|
+
withScope(scope: ScopeEntry): TreeInterpreter;
|
|
355
|
+
search(node: ExpressionNode, value: JSONValue, options?: Options): JSONValue;
|
|
356
|
+
private checkOutputSize;
|
|
357
|
+
private collect;
|
|
358
|
+
private evaluateProjectionItems;
|
|
346
359
|
visit(node: ExpressionNode, value: JSONValue | ExpressionNode): JSONValue | ExpressionNode | ExpressionReference;
|
|
360
|
+
private evaluateNode;
|
|
347
361
|
computeSliceParams(arrayLength: number, sliceNode: SliceNode): {
|
|
348
362
|
start: number;
|
|
349
363
|
stop: number;
|
|
@@ -353,6 +367,16 @@ declare class TreeInterpreter$1 {
|
|
|
353
367
|
slice(collection: JSONArray, start: number, end: number, step: number): JSONArray;
|
|
354
368
|
}
|
|
355
369
|
|
|
370
|
+
type NormalizePath<S extends string> = S extends `${infer Pre}[${infer Idx}]${infer Post}` ? NormalizePath<Pre extends '' ? `${Idx}${Post}` : `${Pre}.${Idx}${Post}`> : S;
|
|
371
|
+
type Split<S extends string> = S extends `${infer Head}.${infer Tail}` ? [Unquote<Head>, ...Split<Tail>] : [Unquote<S>];
|
|
372
|
+
type Unquote<S extends string> = S extends `"${infer Inner}"` ? Inner : S;
|
|
373
|
+
type IsSpecialExpression<P extends string> = P extends `${string}${'|' | '?' | '{' | '(' | '@' | '&' | '+' | '-' | '/' | '%' | '!'}${string}` ? true : false;
|
|
374
|
+
type ResolvePath<T, Segments extends string[]> = Segments extends [
|
|
375
|
+
infer Head extends string,
|
|
376
|
+
...infer Tail extends string[]
|
|
377
|
+
] ? Head extends '*' ? T extends (infer E)[] ? ResolvePath<E, Tail>[] : JSONValue : T extends (infer E)[] ? Head extends `${number}` ? ResolvePath<E, Tail> : JSONValue : T extends object ? Head extends keyof T ? undefined extends T[Head] ? ResolvePath<NonNullable<T[Head]>, Tail> | null : ResolvePath<NonNullable<T[Head]>, Tail> : JSONValue : JSONValue : T;
|
|
378
|
+
type PathValue<T, P extends string> = string extends P ? JSONValue : IsSpecialExpression<P> extends true ? JSONValue : ResolvePath<T, Split<NormalizePath<P>>>;
|
|
379
|
+
|
|
356
380
|
declare class ScopeChain {
|
|
357
381
|
private inner?;
|
|
358
382
|
private data;
|
|
@@ -361,32 +385,57 @@ declare class ScopeChain {
|
|
|
361
385
|
getValue(identifier: string): JSONValue;
|
|
362
386
|
}
|
|
363
387
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
388
|
+
type StreamSource<T = unknown> = AsyncIterable<T> | Iterable<T> | ReadableStream<T> | NodeJS.ReadableStream;
|
|
389
|
+
interface StreamOptions extends Options {
|
|
390
|
+
/**
|
|
391
|
+
* If true, splits string chunks by newline and parses each line as JSON.
|
|
392
|
+
* If 'auto', detects string lines that look like JSON objects/arrays.
|
|
393
|
+
* If false, does not parse string chunks.
|
|
394
|
+
* Defaults to 'auto'.
|
|
395
|
+
*/
|
|
396
|
+
parseJson?: boolean | 'auto';
|
|
397
|
+
/**
|
|
398
|
+
* If true, array chunks emitted by the stream are flattened so their elements
|
|
399
|
+
* are yielded individually.
|
|
400
|
+
* Defaults to true.
|
|
401
|
+
*/
|
|
402
|
+
flattenChunks?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Maximum number of results to yield before ending stream evaluation early.
|
|
405
|
+
*/
|
|
406
|
+
limit?: number;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Incremental Result Streaming evaluation.
|
|
410
|
+
* Evaluates a JMESPath expression incrementally over an AsyncIterable or ReadableStream source.
|
|
411
|
+
*/
|
|
412
|
+
declare function searchStream<T = JSONValue, D = unknown>(sourceOrExpression: StreamSource<D> | string | ExpressionNode, expressionOrSource: string | ExpressionNode | StreamSource<D>, options?: StreamOptions): AsyncGenerator<T, void, unknown>;
|
|
413
|
+
|
|
414
|
+
interface ValidationResult {
|
|
415
|
+
valid: boolean;
|
|
416
|
+
error?: string;
|
|
417
|
+
ast?: ExpressionNode;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
interface CompiledQuery<T = JSONValue, D = unknown> {
|
|
421
|
+
(data: D): T;
|
|
422
|
+
search: (data: D) => T;
|
|
423
|
+
searchStream: (source: StreamSource<D>, options?: StreamOptions) => AsyncGenerator<T, void, unknown>;
|
|
424
|
+
ast: ExpressionNode;
|
|
425
|
+
}
|
|
426
|
+
|
|
376
427
|
declare function compile(expression: string, options?: Options): ExpressionNode;
|
|
428
|
+
declare function compileQuery<T = JSONValue, D = unknown>(expression: string, options?: Options): CompiledQuery<T, D>;
|
|
429
|
+
declare function validate(expression: string, options?: Options): ValidationResult;
|
|
377
430
|
declare function tokenize(expression: string, options?: LexerOptions): LexerToken[];
|
|
378
|
-
declare
|
|
379
|
-
declare
|
|
380
|
-
declare const unregisterFunction: <T extends string>(name: T extends BuiltInFunctionNames ? never : T) => boolean;
|
|
381
|
-
declare const isRegistered: (name: string) => boolean;
|
|
382
|
-
declare const getRegisteredFunctions: () => string[];
|
|
383
|
-
declare const getCustomFunctions: () => string[];
|
|
384
|
-
declare const clearCustomFunctions: () => void;
|
|
385
|
-
declare function search(data: JSONValue, expression: string, options?: Options): JSONValue;
|
|
431
|
+
declare function search<T, P extends string>(data: T, expression: P, options?: Options): PathValue<T, P>;
|
|
432
|
+
declare function search<T = JSONValue, D = unknown>(data: D, expression: string, options?: Options): T;
|
|
386
433
|
declare function Scope(): ScopeChain;
|
|
387
|
-
declare const TreeInterpreter: TreeInterpreter$1;
|
|
388
434
|
declare const jmespath: {
|
|
389
435
|
compile: typeof compile;
|
|
436
|
+
compileQuery: typeof compileQuery;
|
|
437
|
+
searchStream: typeof searchStream;
|
|
438
|
+
validate: typeof validate;
|
|
390
439
|
registerFunction: (functionName: string, customFunction: RuntimeFunction<(JSONValue | ExpressionNode)[], JSONValue>, signature: InputSignature[], options?: RegisterOptions) => void;
|
|
391
440
|
register: <T extends string>(name: T extends BuiltInFunctionNames ? never : T, customFunction: RuntimeFunction<(JSONValue | ExpressionNode)[], JSONValue>, signature: InputSignature[], options?: RegisterOptions) => RegistrationResult;
|
|
392
441
|
unregisterFunction: <T extends string>(name: T extends BuiltInFunctionNames ? never : T) => boolean;
|
|
@@ -396,7 +445,7 @@ declare const jmespath: {
|
|
|
396
445
|
clearCustomFunctions: () => void;
|
|
397
446
|
search: typeof search;
|
|
398
447
|
tokenize: typeof tokenize;
|
|
399
|
-
TreeInterpreter: TreeInterpreter
|
|
448
|
+
TreeInterpreter: TreeInterpreter;
|
|
400
449
|
TYPE_ANY: InputArgument;
|
|
401
450
|
TYPE_ARRAY_NUMBER: InputArgument;
|
|
402
451
|
TYPE_ARRAY_STRING: InputArgument;
|
|
@@ -407,6 +456,9 @@ declare const jmespath: {
|
|
|
407
456
|
TYPE_NUMBER: InputArgument;
|
|
408
457
|
TYPE_OBJECT: InputArgument;
|
|
409
458
|
TYPE_STRING: InputArgument;
|
|
459
|
+
TYPE_ARRAY_ARRAY: InputArgument;
|
|
460
|
+
TYPE_ARRAY_OBJECT: InputArgument;
|
|
461
|
+
Scope: typeof Scope;
|
|
410
462
|
};
|
|
411
463
|
|
|
412
|
-
export { type BuiltInFunctionNames, type FunctionRegistry, type FunctionSignature, type InputSignature, type JSONArray, type JSONObject, type JSONPrimitive, type JSONValue, type Options, type RegisterOptions, type RegistrationResult, type RuntimeFunction,
|
|
464
|
+
export { type BuiltInFunctionNames, type CompiledQuery, type FunctionRegistry, type FunctionSignature, type InputSignature, type JSONArray, type JSONObject, type JSONPrimitive, type JSONValue, type Options, type PathValue, type RegisterOptions, type RegistrationResult, type RuntimeFunction, type StreamOptions, type StreamSource, type ValidationResult, jmespath as default };
|