@aws-lambda-powertools/jmespath 2.26.1 → 2.28.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 +4 -4
- package/lib/cjs/Expression.d.ts +2 -3
- package/lib/cjs/Expression.d.ts.map +1 -1
- package/lib/cjs/Expression.js +2 -3
- package/lib/cjs/Functions.d.ts +36 -36
- package/lib/cjs/Functions.js +36 -36
- package/lib/cjs/Lexer.js +2 -2
- package/lib/cjs/ParsedResult.d.ts +2 -2
- package/lib/cjs/ParsedResult.js +2 -2
- package/lib/cjs/Parser.d.ts +1 -2
- package/lib/cjs/Parser.d.ts.map +1 -1
- package/lib/cjs/Parser.js +42 -23
- package/lib/cjs/PowertoolsFunctions.d.ts +3 -5
- package/lib/cjs/PowertoolsFunctions.d.ts.map +1 -1
- package/lib/cjs/PowertoolsFunctions.js +4 -6
- package/lib/cjs/TreeInterpreter.js +2 -2
- package/lib/cjs/ast.d.ts +35 -33
- package/lib/cjs/ast.d.ts.map +1 -1
- package/lib/cjs/ast.js +35 -33
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/envelopes.d.ts +3 -3
- package/lib/cjs/envelopes.js +3 -3
- package/lib/cjs/errors.d.ts +11 -2
- package/lib/cjs/errors.d.ts.map +1 -1
- package/lib/cjs/errors.js +11 -2
- package/lib/cjs/search.d.ts +3 -3
- package/lib/cjs/search.js +3 -3
- package/lib/cjs/types.d.ts +2 -2
- package/lib/cjs/utils.d.ts +24 -24
- package/lib/cjs/utils.js +46 -46
- package/lib/esm/Expression.d.ts +2 -3
- package/lib/esm/Expression.d.ts.map +1 -1
- package/lib/esm/Expression.js +2 -3
- package/lib/esm/Functions.d.ts +36 -36
- package/lib/esm/Functions.js +36 -36
- package/lib/esm/Lexer.js +2 -2
- package/lib/esm/ParsedResult.d.ts +2 -2
- package/lib/esm/ParsedResult.js +2 -2
- package/lib/esm/Parser.d.ts +1 -2
- package/lib/esm/Parser.d.ts.map +1 -1
- package/lib/esm/Parser.js +42 -23
- package/lib/esm/PowertoolsFunctions.d.ts +3 -5
- package/lib/esm/PowertoolsFunctions.d.ts.map +1 -1
- package/lib/esm/PowertoolsFunctions.js +3 -5
- package/lib/esm/TreeInterpreter.js +2 -2
- package/lib/esm/ast.d.ts +35 -33
- package/lib/esm/ast.d.ts.map +1 -1
- package/lib/esm/ast.js +35 -33
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/envelopes.d.ts +3 -3
- package/lib/esm/envelopes.js +3 -3
- package/lib/esm/errors.d.ts +11 -2
- package/lib/esm/errors.d.ts.map +1 -1
- package/lib/esm/errors.js +11 -2
- package/lib/esm/search.d.ts +3 -3
- package/lib/esm/search.js +3 -3
- package/lib/esm/types.d.ts +2 -2
- package/lib/esm/utils.d.ts +24 -24
- package/lib/esm/utils.js +46 -46
- package/package.json +2 -2
package/lib/esm/Parser.js
CHANGED
|
@@ -7,7 +7,6 @@ import { ParsedResult } from './ParsedResult.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Top down operator precedence parser for JMESPath.
|
|
9
9
|
*
|
|
10
|
-
* ## References
|
|
11
10
|
* The implementation of this Parser is based on the implementation of
|
|
12
11
|
* [jmespath.py](https://github.com/jmespath/jmespath.py/), which in turn
|
|
13
12
|
* is based on [Vaughan R. Pratt's "Top Down Operator Precedence"](http://dl.acm.org/citation.cfm?doid=512927.512931).
|
|
@@ -45,7 +44,7 @@ class Parser {
|
|
|
45
44
|
* The AST is cached, so if you parse the same expression multiple times,
|
|
46
45
|
* the AST will be returned from the cache.
|
|
47
46
|
*
|
|
48
|
-
* @param expression The JMESPath expression to parse.
|
|
47
|
+
* @param expression - The JMESPath expression to parse.
|
|
49
48
|
*/
|
|
50
49
|
parse(expression) {
|
|
51
50
|
const cached = this.#cache[expression];
|
|
@@ -68,7 +67,7 @@ class Parser {
|
|
|
68
67
|
/**
|
|
69
68
|
* Do the actual parsing of the expression.
|
|
70
69
|
*
|
|
71
|
-
* @param expression The JMESPath expression to parse.
|
|
70
|
+
* @param expression - The JMESPath expression to parse.
|
|
72
71
|
*/
|
|
73
72
|
#doParse(expression) {
|
|
74
73
|
try {
|
|
@@ -116,7 +115,7 @@ class Parser {
|
|
|
116
115
|
* Get the nud function for a token. This is the function that
|
|
117
116
|
* is called when a token is found at the beginning of an expression.
|
|
118
117
|
*
|
|
119
|
-
* @param tokenType The type of token to get the nud function for.
|
|
118
|
+
* @param tokenType - The type of token to get the nud function for.
|
|
120
119
|
*/
|
|
121
120
|
#getNudFunction(token) {
|
|
122
121
|
const { type: tokenType } = token;
|
|
@@ -156,7 +155,7 @@ class Parser {
|
|
|
156
155
|
*
|
|
157
156
|
* @example s."foo"
|
|
158
157
|
*
|
|
159
|
-
* @param token The token to process
|
|
158
|
+
* @param token - The token to process
|
|
160
159
|
*/
|
|
161
160
|
#processQuotedIdentifier(token) {
|
|
162
161
|
const fieldValue = field(token.value);
|
|
@@ -240,7 +239,7 @@ class Parser {
|
|
|
240
239
|
* A default token is a syntax that allows you to access
|
|
241
240
|
* elements in a list or dictionary.
|
|
242
241
|
*
|
|
243
|
-
* @param token The token to process
|
|
242
|
+
* @param token - The token to process
|
|
244
243
|
*/
|
|
245
244
|
#processDefaultToken(token) {
|
|
246
245
|
if (token.type === 'eof') {
|
|
@@ -260,8 +259,8 @@ class Parser {
|
|
|
260
259
|
* Get the led function for a token. This is the function that
|
|
261
260
|
* is called when a token is found in the middle of an expression.
|
|
262
261
|
*
|
|
263
|
-
* @param tokenType The type of token to get the led function for.
|
|
264
|
-
* @param leftNode The left hand side of the expression.
|
|
262
|
+
* @param tokenType - The type of token to get the led function for.
|
|
263
|
+
* @param leftNode - The left hand side of the expression.
|
|
265
264
|
*/
|
|
266
265
|
#getLedFunction(tokenType, leftNode) {
|
|
267
266
|
switch (tokenType) {
|
|
@@ -300,7 +299,7 @@ class Parser {
|
|
|
300
299
|
*
|
|
301
300
|
* @example foo.bar
|
|
302
301
|
*
|
|
303
|
-
* @param leftNode The left hand side of the expression.
|
|
302
|
+
* @param leftNode - The left hand side of the expression.
|
|
304
303
|
*/
|
|
305
304
|
#processDotToken(leftNode) {
|
|
306
305
|
if (this.#currentToken() !== 'star') {
|
|
@@ -324,7 +323,7 @@ class Parser {
|
|
|
324
323
|
*
|
|
325
324
|
* @example foo | bar
|
|
326
325
|
*
|
|
327
|
-
* @param leftNode The left hand side of the expression.
|
|
326
|
+
* @param leftNode - The left hand side of the expression.
|
|
328
327
|
*/
|
|
329
328
|
#processPipeToken(leftNode) {
|
|
330
329
|
const right = this.#expression(BINDING_POWER.pipe);
|
|
@@ -338,7 +337,7 @@ class Parser {
|
|
|
338
337
|
*
|
|
339
338
|
* @example foo || bar
|
|
340
339
|
*
|
|
341
|
-
* @param leftNode The left hand side of the expression.
|
|
340
|
+
* @param leftNode - The left hand side of the expression.
|
|
342
341
|
*/
|
|
343
342
|
#processOrToken(leftNode) {
|
|
344
343
|
const right = this.#expression(BINDING_POWER.or);
|
|
@@ -352,12 +351,17 @@ class Parser {
|
|
|
352
351
|
*
|
|
353
352
|
* @example foo && bar
|
|
354
353
|
*
|
|
355
|
-
* @param leftNode The left hand side of the expression.
|
|
354
|
+
* @param leftNode - The left hand side of the expression.
|
|
356
355
|
*/
|
|
357
356
|
#processAndToken(leftNode) {
|
|
358
357
|
const right = this.#expression(BINDING_POWER.and);
|
|
359
358
|
return andExpression(leftNode, right);
|
|
360
359
|
}
|
|
360
|
+
/**
|
|
361
|
+
* Process a left parenthesis token.
|
|
362
|
+
*
|
|
363
|
+
* @param leftNode - The left hand side of the expression.
|
|
364
|
+
*/
|
|
361
365
|
#processLParenToken(leftNode) {
|
|
362
366
|
const name = leftNode.value;
|
|
363
367
|
const args = [];
|
|
@@ -371,6 +375,11 @@ class Parser {
|
|
|
371
375
|
this.#match('rparen');
|
|
372
376
|
return functionExpression(name, args);
|
|
373
377
|
}
|
|
378
|
+
/**
|
|
379
|
+
* Process a filter token.
|
|
380
|
+
*
|
|
381
|
+
* @param leftNode - The left hand side of the expression.
|
|
382
|
+
*/
|
|
374
383
|
#processFilterToken(leftNode) {
|
|
375
384
|
// Filters are projections
|
|
376
385
|
const condition = this.#expression(0);
|
|
@@ -384,11 +393,21 @@ class Parser {
|
|
|
384
393
|
}
|
|
385
394
|
return filterProjection(leftNode, right, condition);
|
|
386
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Process a projection right hand side.
|
|
398
|
+
*
|
|
399
|
+
* @param leftNode - The left hand side of the expression.
|
|
400
|
+
*/
|
|
387
401
|
#processFlattenToken(leftNode) {
|
|
388
402
|
const left = flatten(leftNode);
|
|
389
403
|
const right = this.#parseProjectionRhs(BINDING_POWER.flatten);
|
|
390
404
|
return projection(left, right);
|
|
391
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* Process a left bracket token.
|
|
408
|
+
*
|
|
409
|
+
* @param leftNode - The left hand side of the expression.
|
|
410
|
+
*/
|
|
392
411
|
#processLBracketToken(leftNode) {
|
|
393
412
|
const token = this.#lookaheadToken(0);
|
|
394
413
|
if (['number', 'colon'].includes(token.type)) {
|
|
@@ -418,7 +437,7 @@ class Parser {
|
|
|
418
437
|
* the error occurred, the value of the token that caused
|
|
419
438
|
* the error, the type of the token, and an optional reason.
|
|
420
439
|
*
|
|
421
|
-
* @param options The options to use when throwing the error.
|
|
440
|
+
* @param options - The options to use when throwing the error.
|
|
422
441
|
*/
|
|
423
442
|
#throwParseError(options) {
|
|
424
443
|
const token = this.#lookaheadToken(0);
|
|
@@ -500,8 +519,8 @@ class Parser {
|
|
|
500
519
|
* Process a projection if the right hand side of the
|
|
501
520
|
* projection is a slice.
|
|
502
521
|
*
|
|
503
|
-
* @param left The left hand side of the projection.
|
|
504
|
-
* @param right The right hand side of the projection.
|
|
522
|
+
* @param left - The left hand side of the projection.
|
|
523
|
+
* @param right - The right hand side of the projection.
|
|
505
524
|
*/
|
|
506
525
|
#projectIfSlice(left, right) {
|
|
507
526
|
const idxExpression = indexExpression([left, right]);
|
|
@@ -517,8 +536,8 @@ class Parser {
|
|
|
517
536
|
* two values. For example `foo == bar` compares the
|
|
518
537
|
* value of `foo` with the value of `bar`.
|
|
519
538
|
*
|
|
520
|
-
* @param left The left hand side of the comparator.
|
|
521
|
-
* @param comparatorChar The comparator character.
|
|
539
|
+
* @param left - The left hand side of the comparator.
|
|
540
|
+
* @param comparatorChar - The comparator character.
|
|
522
541
|
*/
|
|
523
542
|
#parseComparator(left, comparatorChar) {
|
|
524
543
|
return comparator(comparatorChar, left, this.#expression(BINDING_POWER[comparatorChar]));
|
|
@@ -576,7 +595,7 @@ class Parser {
|
|
|
576
595
|
/**
|
|
577
596
|
* Process the right hand side of a projection.
|
|
578
597
|
*
|
|
579
|
-
* @param bindingPower The binding power of the current token.
|
|
598
|
+
* @param bindingPower - The binding power of the current token.
|
|
580
599
|
*/
|
|
581
600
|
#parseProjectionRhs(bindingPower) {
|
|
582
601
|
// Parse the right hand side of the projection.
|
|
@@ -603,7 +622,7 @@ class Parser {
|
|
|
603
622
|
/**
|
|
604
623
|
* Process the right hand side of a dot expression.
|
|
605
624
|
*
|
|
606
|
-
* @param bindingPower The binding power of the current token.
|
|
625
|
+
* @param bindingPower - The binding power of the current token.
|
|
607
626
|
*/
|
|
608
627
|
#parseDotRhs(bindingPower) {
|
|
609
628
|
// From the grammar:
|
|
@@ -632,7 +651,7 @@ class Parser {
|
|
|
632
651
|
/**
|
|
633
652
|
* Process a token and throw an error if it doesn't match the expected token.
|
|
634
653
|
*
|
|
635
|
-
* @param tokenType The expected token type.
|
|
654
|
+
* @param tokenType - The expected token type.
|
|
636
655
|
*/
|
|
637
656
|
#match(tokenType) {
|
|
638
657
|
const currentToken = this.#currentToken();
|
|
@@ -658,7 +677,7 @@ class Parser {
|
|
|
658
677
|
/**
|
|
659
678
|
* Process a token and throw an error if it doesn't match the expected token.
|
|
660
679
|
*
|
|
661
|
-
* @param tokenTypes The expected token types.
|
|
680
|
+
* @param tokenTypes - The expected token types.
|
|
662
681
|
*/
|
|
663
682
|
#matchMultipleTokens(tokenTypes) {
|
|
664
683
|
const currentToken = this.#currentToken();
|
|
@@ -694,7 +713,7 @@ class Parser {
|
|
|
694
713
|
/**
|
|
695
714
|
* Look ahead in the token stream and get the type of the token
|
|
696
715
|
*
|
|
697
|
-
* @param number The number of tokens to look ahead.
|
|
716
|
+
* @param number - The number of tokens to look ahead.
|
|
698
717
|
*/
|
|
699
718
|
#lookahead(number) {
|
|
700
719
|
return this.#tokens[this.#index + number].type;
|
|
@@ -702,7 +721,7 @@ class Parser {
|
|
|
702
721
|
/**
|
|
703
722
|
* Look ahead in the token stream and get the token
|
|
704
723
|
*
|
|
705
|
-
* @param number The number of tokens to look ahead.
|
|
724
|
+
* @param number - The number of tokens to look ahead.
|
|
706
725
|
*/
|
|
707
726
|
#lookaheadToken(number) {
|
|
708
727
|
return this.#tokens[this.#index + number];
|
|
@@ -5,7 +5,7 @@ import { Functions } from './Functions.js';
|
|
|
5
5
|
*
|
|
6
6
|
* Built-in JMESPath functions include: `powertools_json`, `powertools_base64`, `powertools_base64_gzip`
|
|
7
7
|
*
|
|
8
|
-
* You can use these functions to decode and/or deserialize JSON objects when using the {@link
|
|
8
|
+
* You can use these functions to decode and/or deserialize JSON objects when using the {@link search | `search`} function.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
@@ -23,14 +23,12 @@ import { Functions } from './Functions.js';
|
|
|
23
23
|
* );
|
|
24
24
|
* console.log(result); // { foo: 'bar' }
|
|
25
25
|
* ```
|
|
26
|
-
*
|
|
27
|
-
* When using the {@link envelopes.extractDataFromEnvelope} function, the PowertoolsFunctions class is automatically used.
|
|
28
|
-
*
|
|
29
26
|
*/
|
|
30
27
|
declare class PowertoolsFunctions extends Functions {
|
|
31
28
|
funcPowertoolsBase64(value: string): string;
|
|
32
29
|
funcPowertoolsBase64Gzip(value: string): string;
|
|
33
30
|
funcPowertoolsJson(value: string): JSONValue;
|
|
34
31
|
}
|
|
35
|
-
export {
|
|
32
|
+
export { Functions } from './Functions.js';
|
|
33
|
+
export { PowertoolsFunctions };
|
|
36
34
|
//# sourceMappingURL=PowertoolsFunctions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PowertoolsFunctions.d.ts","sourceRoot":"","sources":["../../src/PowertoolsFunctions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PowertoolsFunctions.d.ts","sourceRoot":"","sources":["../../src/PowertoolsFunctions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,cAAM,mBAAoB,SAAQ,SAAS;IAIlC,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO3C,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAU/C,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;CAGpD;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -13,7 +13,7 @@ const decoder = new TextDecoder('utf-8');
|
|
|
13
13
|
*
|
|
14
14
|
* Built-in JMESPath functions include: `powertools_json`, `powertools_base64`, `powertools_base64_gzip`
|
|
15
15
|
*
|
|
16
|
-
* You can use these functions to decode and/or deserialize JSON objects when using the {@link
|
|
16
|
+
* You can use these functions to decode and/or deserialize JSON objects when using the {@link search | `search`} function.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```typescript
|
|
@@ -31,9 +31,6 @@ const decoder = new TextDecoder('utf-8');
|
|
|
31
31
|
* );
|
|
32
32
|
* console.log(result); // { foo: 'bar' }
|
|
33
33
|
* ```
|
|
34
|
-
*
|
|
35
|
-
* When using the {@link envelopes.extractDataFromEnvelope} function, the PowertoolsFunctions class is automatically used.
|
|
36
|
-
*
|
|
37
34
|
*/
|
|
38
35
|
class PowertoolsFunctions extends Functions {
|
|
39
36
|
funcPowertoolsBase64(value) {
|
|
@@ -63,4 +60,5 @@ __decorate([
|
|
|
63
60
|
argumentsSpecs: [['string']],
|
|
64
61
|
})
|
|
65
62
|
], PowertoolsFunctions.prototype, "funcPowertoolsJson", null);
|
|
66
|
-
export {
|
|
63
|
+
export { Functions } from './Functions.js';
|
|
64
|
+
export { PowertoolsFunctions };
|
|
@@ -181,10 +181,10 @@ class TreeInterpreter {
|
|
|
181
181
|
}
|
|
182
182
|
try {
|
|
183
183
|
// We know that methodName is a key of this.#functions, but TypeScript
|
|
184
|
-
// doesn't know that, so we
|
|
184
|
+
// doesn't know that, so we suppress the issue to tell it that it's
|
|
185
185
|
// okay. We could use a type assertion like `as keyof Functions`, but
|
|
186
186
|
// we also want to keep the args generic, so for now we'll just ignore it.
|
|
187
|
-
// @ts-
|
|
187
|
+
// @ts-expect-error
|
|
188
188
|
return this.#functions[funcName](args);
|
|
189
189
|
}
|
|
190
190
|
catch (error) {
|
package/lib/esm/ast.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type { Node } from './types.js';
|
|
|
5
5
|
*
|
|
6
6
|
* A comparator expression is a binary expression that compares two values.
|
|
7
7
|
*
|
|
8
|
-
* @param name The name of the comparator
|
|
9
|
-
* @param first The left-hand side of the comparator
|
|
10
|
-
* @param second The right-hand side of the comparator
|
|
8
|
+
* @param name - The name of the comparator
|
|
9
|
+
* @param first - The left-hand side of the comparator
|
|
10
|
+
* @param second - The right-hand side of the comparator
|
|
11
11
|
*/
|
|
12
12
|
declare const comparator: (name: string, first: Node, second: Node) => Node;
|
|
13
13
|
/**
|
|
@@ -23,7 +23,7 @@ declare const currentNode: () => Node;
|
|
|
23
23
|
* An expression reference is a reference to another expression.
|
|
24
24
|
* In JMESPath, an expression reference is represented by the `&` symbol.
|
|
25
25
|
*
|
|
26
|
-
* @param expression The expression to reference
|
|
26
|
+
* @param expression - The expression to reference
|
|
27
27
|
*/
|
|
28
28
|
declare const expref: (expression: Node) => Node;
|
|
29
29
|
/**
|
|
@@ -35,14 +35,16 @@ declare const expref: (expression: Node) => Node;
|
|
|
35
35
|
*
|
|
36
36
|
* Custom functions can be added by extending the `Functions` class.
|
|
37
37
|
*
|
|
38
|
-
* @param name The name of the function
|
|
39
|
-
* @param args The arguments to the function
|
|
38
|
+
* @param name - The name of the function
|
|
39
|
+
* @param args - The arguments to the function
|
|
40
40
|
*/
|
|
41
41
|
declare const functionExpression: (name: string, args: Node[]) => Node;
|
|
42
42
|
/**
|
|
43
43
|
* AST node representing a field reference.
|
|
44
44
|
*
|
|
45
45
|
* A field reference is a reference to a field in an object.
|
|
46
|
+
*
|
|
47
|
+
* @param name - The name of the field
|
|
46
48
|
*/
|
|
47
49
|
declare const field: (name: JSONValue) => Node;
|
|
48
50
|
/**
|
|
@@ -55,9 +57,9 @@ declare const field: (name: JSONValue) => Node;
|
|
|
55
57
|
* For example, `people[?age > 18]` filters the `people` array based on the
|
|
56
58
|
* `age` field.
|
|
57
59
|
*
|
|
58
|
-
* @param left The left-hand side of the filter projection
|
|
59
|
-
* @param right The right-hand side of the filter projection
|
|
60
|
-
* @param comparator The comparator to use for the filter
|
|
60
|
+
* @param left - The left-hand side of the filter projection
|
|
61
|
+
* @param right - The right-hand side of the filter projection
|
|
62
|
+
* @param comparator - The comparator to use for the filter
|
|
61
63
|
*/
|
|
62
64
|
declare const filterProjection: (left: Node, right: Node, comparator: Node) => Node;
|
|
63
65
|
/**
|
|
@@ -70,7 +72,7 @@ declare const filterProjection: (left: Node, right: Node, comparator: Node) => N
|
|
|
70
72
|
* For example, `people[].name` flattens the `people` array and returns the
|
|
71
73
|
* `name` field of each object in the array.
|
|
72
74
|
*
|
|
73
|
-
* @param node The node to flatten
|
|
75
|
+
* @param node - The node to flatten
|
|
74
76
|
*/
|
|
75
77
|
declare const flatten: (node: Node) => Node;
|
|
76
78
|
/**
|
|
@@ -83,7 +85,7 @@ declare const identity: () => Node;
|
|
|
83
85
|
* An index reference is a reference to an index in an array.
|
|
84
86
|
* For example, `people[0]` references the first element in the `people` array.
|
|
85
87
|
*
|
|
86
|
-
* @param index The index to reference
|
|
88
|
+
* @param index - The index to reference
|
|
87
89
|
*/
|
|
88
90
|
declare const index: (index: JSONValue) => Node;
|
|
89
91
|
/**
|
|
@@ -91,14 +93,14 @@ declare const index: (index: JSONValue) => Node;
|
|
|
91
93
|
*
|
|
92
94
|
* An index expression holds the index and the children of the expression.
|
|
93
95
|
*
|
|
94
|
-
* @param children The children of the index expression
|
|
96
|
+
* @param children - The children of the index expression
|
|
95
97
|
*/
|
|
96
98
|
declare const indexExpression: (children: Node[]) => Node;
|
|
97
99
|
/**
|
|
98
100
|
* AST node representing a key-value pair.
|
|
99
101
|
*
|
|
100
|
-
* @param keyName The name of the key
|
|
101
|
-
* @param node The value of the key
|
|
102
|
+
* @param keyName - The name of the key
|
|
103
|
+
* @param node - The value of the key
|
|
102
104
|
*/
|
|
103
105
|
declare const keyValPair: (keyName: JSONValue, node: Node) => Node;
|
|
104
106
|
/**
|
|
@@ -106,7 +108,7 @@ declare const keyValPair: (keyName: JSONValue, node: Node) => Node;
|
|
|
106
108
|
*
|
|
107
109
|
* A literal value is a value that is not a reference to another node.
|
|
108
110
|
*
|
|
109
|
-
* @param literalValue The value of the literal
|
|
111
|
+
* @param literalValue - The value of the literal
|
|
110
112
|
*/
|
|
111
113
|
declare const literal: (literalValue: JSONValue) => Node;
|
|
112
114
|
/**
|
|
@@ -114,54 +116,54 @@ declare const literal: (literalValue: JSONValue) => Node;
|
|
|
114
116
|
*
|
|
115
117
|
* A multi-select object is a reference to multiple nodes in an object.
|
|
116
118
|
*
|
|
117
|
-
* @param nodes
|
|
119
|
+
* @param nodes - The nodes to select
|
|
118
120
|
*/
|
|
119
121
|
declare const multiSelectObject: (nodes: Node[]) => Node;
|
|
120
122
|
/**
|
|
121
123
|
* AST node representing a multi-select list.
|
|
122
124
|
*
|
|
123
|
-
* @param nodes
|
|
125
|
+
* @param nodes - The nodes to select
|
|
124
126
|
*/
|
|
125
127
|
declare const multiSelectList: (nodes: Node[]) => Node;
|
|
126
128
|
/**
|
|
127
129
|
* AST node representing an or expression.
|
|
128
130
|
*
|
|
129
|
-
* @param left The left-hand side of the or expression
|
|
130
|
-
* @param right The right-hand side of the or expression
|
|
131
|
+
* @param left - The left-hand side of the or expression
|
|
132
|
+
* @param right - The right-hand side of the or expression
|
|
131
133
|
*/
|
|
132
134
|
declare const orExpression: (left: Node, right: Node) => Node;
|
|
133
135
|
/**
|
|
134
136
|
* AST node representing an and expression.
|
|
135
137
|
*
|
|
136
|
-
* @param left The left-hand side of the and expression
|
|
137
|
-
* @param right The right-hand side of the and expression
|
|
138
|
+
* @param left - The left-hand side of the and expression
|
|
139
|
+
* @param right - The right-hand side of the and expression
|
|
138
140
|
*/
|
|
139
141
|
declare const andExpression: (left: Node, right: Node) => Node;
|
|
140
142
|
/**
|
|
141
143
|
* AST node representing a not expression.
|
|
142
144
|
*
|
|
143
|
-
* @param left The left-hand side of the not expression
|
|
144
|
-
* @param right The right-hand side of the not expression
|
|
145
|
+
* @param left - The left-hand side of the not expression
|
|
146
|
+
* @param right - The right-hand side of the not expression
|
|
145
147
|
*/
|
|
146
148
|
declare const notExpression: (expr: Node) => Node;
|
|
147
149
|
/**
|
|
148
150
|
* AST node representing a pipe expression.
|
|
149
151
|
*
|
|
150
|
-
* @param left The left-hand side of the pipe expression
|
|
151
|
-
* @param right The right-hand side of the pipe expression
|
|
152
|
+
* @param left - The left-hand side of the pipe expression
|
|
153
|
+
* @param right - The right-hand side of the pipe expression
|
|
152
154
|
*/
|
|
153
155
|
declare const pipe: (left: Node, right: Node) => Node;
|
|
154
156
|
/**
|
|
155
157
|
* AST node representing a projection.
|
|
156
158
|
*
|
|
157
|
-
* @param left The left-hand side of the projection
|
|
158
|
-
* @param right The right-hand side of the projection
|
|
159
|
+
* @param left - The left-hand side of the projection
|
|
160
|
+
* @param right - The right-hand side of the projection
|
|
159
161
|
*/
|
|
160
162
|
declare const projection: (left: Node, right: Node) => Node;
|
|
161
163
|
/**
|
|
162
164
|
* AST node representing a subexpression.
|
|
163
165
|
*
|
|
164
|
-
* @param children The children of the subexpression
|
|
166
|
+
* @param children - The children of the subexpression
|
|
165
167
|
*/
|
|
166
168
|
declare const subexpression: (children: Node[]) => Node;
|
|
167
169
|
/**
|
|
@@ -169,16 +171,16 @@ declare const subexpression: (children: Node[]) => Node;
|
|
|
169
171
|
*
|
|
170
172
|
* A slice is a reference to a range of values in an array.
|
|
171
173
|
*
|
|
172
|
-
* @param start The start of the slice
|
|
173
|
-
* @param end The end of the slice
|
|
174
|
-
* @param step The step of the slice
|
|
174
|
+
* @param start - The start of the slice
|
|
175
|
+
* @param end - The end of the slice
|
|
176
|
+
* @param step - The step of the slice
|
|
175
177
|
*/
|
|
176
178
|
declare const slice: (start: JSONValue, end: JSONValue, step: JSONValue) => Node;
|
|
177
179
|
/**
|
|
178
180
|
* AST node representing a value projection.
|
|
179
181
|
*
|
|
180
|
-
* @param left The left-hand side of the value projection
|
|
181
|
-
* @param right The right-hand side of the value projection
|
|
182
|
+
* @param left - The left-hand side of the value projection
|
|
183
|
+
* @param right - The right-hand side of the value projection
|
|
182
184
|
*/
|
|
183
185
|
declare const valueProjection: (left: Node, right: Node) => Node;
|
|
184
186
|
export { andExpression, comparator, currentNode, expref, field, filterProjection, flatten, functionExpression, identity, index, indexExpression, keyValPair, literal, multiSelectObject, multiSelectList, notExpression, orExpression, pipe, projection, slice, subexpression, valueProjection, };
|
package/lib/esm/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings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