@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/cjs/Parser.js
CHANGED
|
@@ -10,7 +10,6 @@ const ParsedResult_js_1 = require("./ParsedResult.js");
|
|
|
10
10
|
/**
|
|
11
11
|
* Top down operator precedence parser for JMESPath.
|
|
12
12
|
*
|
|
13
|
-
* ## References
|
|
14
13
|
* The implementation of this Parser is based on the implementation of
|
|
15
14
|
* [jmespath.py](https://github.com/jmespath/jmespath.py/), which in turn
|
|
16
15
|
* is based on [Vaughan R. Pratt's "Top Down Operator Precedence"](http://dl.acm.org/citation.cfm?doid=512927.512931).
|
|
@@ -48,7 +47,7 @@ class Parser {
|
|
|
48
47
|
* The AST is cached, so if you parse the same expression multiple times,
|
|
49
48
|
* the AST will be returned from the cache.
|
|
50
49
|
*
|
|
51
|
-
* @param expression The JMESPath expression to parse.
|
|
50
|
+
* @param expression - The JMESPath expression to parse.
|
|
52
51
|
*/
|
|
53
52
|
parse(expression) {
|
|
54
53
|
const cached = this.#cache[expression];
|
|
@@ -71,7 +70,7 @@ class Parser {
|
|
|
71
70
|
/**
|
|
72
71
|
* Do the actual parsing of the expression.
|
|
73
72
|
*
|
|
74
|
-
* @param expression The JMESPath expression to parse.
|
|
73
|
+
* @param expression - The JMESPath expression to parse.
|
|
75
74
|
*/
|
|
76
75
|
#doParse(expression) {
|
|
77
76
|
try {
|
|
@@ -119,7 +118,7 @@ class Parser {
|
|
|
119
118
|
* Get the nud function for a token. This is the function that
|
|
120
119
|
* is called when a token is found at the beginning of an expression.
|
|
121
120
|
*
|
|
122
|
-
* @param tokenType The type of token to get the nud function for.
|
|
121
|
+
* @param tokenType - The type of token to get the nud function for.
|
|
123
122
|
*/
|
|
124
123
|
#getNudFunction(token) {
|
|
125
124
|
const { type: tokenType } = token;
|
|
@@ -159,7 +158,7 @@ class Parser {
|
|
|
159
158
|
*
|
|
160
159
|
* @example s."foo"
|
|
161
160
|
*
|
|
162
|
-
* @param token The token to process
|
|
161
|
+
* @param token - The token to process
|
|
163
162
|
*/
|
|
164
163
|
#processQuotedIdentifier(token) {
|
|
165
164
|
const fieldValue = (0, ast_js_1.field)(token.value);
|
|
@@ -243,7 +242,7 @@ class Parser {
|
|
|
243
242
|
* A default token is a syntax that allows you to access
|
|
244
243
|
* elements in a list or dictionary.
|
|
245
244
|
*
|
|
246
|
-
* @param token The token to process
|
|
245
|
+
* @param token - The token to process
|
|
247
246
|
*/
|
|
248
247
|
#processDefaultToken(token) {
|
|
249
248
|
if (token.type === 'eof') {
|
|
@@ -263,8 +262,8 @@ class Parser {
|
|
|
263
262
|
* Get the led function for a token. This is the function that
|
|
264
263
|
* is called when a token is found in the middle of an expression.
|
|
265
264
|
*
|
|
266
|
-
* @param tokenType The type of token to get the led function for.
|
|
267
|
-
* @param leftNode The left hand side of the expression.
|
|
265
|
+
* @param tokenType - The type of token to get the led function for.
|
|
266
|
+
* @param leftNode - The left hand side of the expression.
|
|
268
267
|
*/
|
|
269
268
|
#getLedFunction(tokenType, leftNode) {
|
|
270
269
|
switch (tokenType) {
|
|
@@ -303,7 +302,7 @@ class Parser {
|
|
|
303
302
|
*
|
|
304
303
|
* @example foo.bar
|
|
305
304
|
*
|
|
306
|
-
* @param leftNode The left hand side of the expression.
|
|
305
|
+
* @param leftNode - The left hand side of the expression.
|
|
307
306
|
*/
|
|
308
307
|
#processDotToken(leftNode) {
|
|
309
308
|
if (this.#currentToken() !== 'star') {
|
|
@@ -327,7 +326,7 @@ class Parser {
|
|
|
327
326
|
*
|
|
328
327
|
* @example foo | bar
|
|
329
328
|
*
|
|
330
|
-
* @param leftNode The left hand side of the expression.
|
|
329
|
+
* @param leftNode - The left hand side of the expression.
|
|
331
330
|
*/
|
|
332
331
|
#processPipeToken(leftNode) {
|
|
333
332
|
const right = this.#expression(constants_js_1.BINDING_POWER.pipe);
|
|
@@ -341,7 +340,7 @@ class Parser {
|
|
|
341
340
|
*
|
|
342
341
|
* @example foo || bar
|
|
343
342
|
*
|
|
344
|
-
* @param leftNode The left hand side of the expression.
|
|
343
|
+
* @param leftNode - The left hand side of the expression.
|
|
345
344
|
*/
|
|
346
345
|
#processOrToken(leftNode) {
|
|
347
346
|
const right = this.#expression(constants_js_1.BINDING_POWER.or);
|
|
@@ -355,12 +354,17 @@ class Parser {
|
|
|
355
354
|
*
|
|
356
355
|
* @example foo && bar
|
|
357
356
|
*
|
|
358
|
-
* @param leftNode The left hand side of the expression.
|
|
357
|
+
* @param leftNode - The left hand side of the expression.
|
|
359
358
|
*/
|
|
360
359
|
#processAndToken(leftNode) {
|
|
361
360
|
const right = this.#expression(constants_js_1.BINDING_POWER.and);
|
|
362
361
|
return (0, ast_js_1.andExpression)(leftNode, right);
|
|
363
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Process a left parenthesis token.
|
|
365
|
+
*
|
|
366
|
+
* @param leftNode - The left hand side of the expression.
|
|
367
|
+
*/
|
|
364
368
|
#processLParenToken(leftNode) {
|
|
365
369
|
const name = leftNode.value;
|
|
366
370
|
const args = [];
|
|
@@ -374,6 +378,11 @@ class Parser {
|
|
|
374
378
|
this.#match('rparen');
|
|
375
379
|
return (0, ast_js_1.functionExpression)(name, args);
|
|
376
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* Process a filter token.
|
|
383
|
+
*
|
|
384
|
+
* @param leftNode - The left hand side of the expression.
|
|
385
|
+
*/
|
|
377
386
|
#processFilterToken(leftNode) {
|
|
378
387
|
// Filters are projections
|
|
379
388
|
const condition = this.#expression(0);
|
|
@@ -387,11 +396,21 @@ class Parser {
|
|
|
387
396
|
}
|
|
388
397
|
return (0, ast_js_1.filterProjection)(leftNode, right, condition);
|
|
389
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Process a projection right hand side.
|
|
401
|
+
*
|
|
402
|
+
* @param leftNode - The left hand side of the expression.
|
|
403
|
+
*/
|
|
390
404
|
#processFlattenToken(leftNode) {
|
|
391
405
|
const left = (0, ast_js_1.flatten)(leftNode);
|
|
392
406
|
const right = this.#parseProjectionRhs(constants_js_1.BINDING_POWER.flatten);
|
|
393
407
|
return (0, ast_js_1.projection)(left, right);
|
|
394
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Process a left bracket token.
|
|
411
|
+
*
|
|
412
|
+
* @param leftNode - The left hand side of the expression.
|
|
413
|
+
*/
|
|
395
414
|
#processLBracketToken(leftNode) {
|
|
396
415
|
const token = this.#lookaheadToken(0);
|
|
397
416
|
if (['number', 'colon'].includes(token.type)) {
|
|
@@ -421,7 +440,7 @@ class Parser {
|
|
|
421
440
|
* the error occurred, the value of the token that caused
|
|
422
441
|
* the error, the type of the token, and an optional reason.
|
|
423
442
|
*
|
|
424
|
-
* @param options The options to use when throwing the error.
|
|
443
|
+
* @param options - The options to use when throwing the error.
|
|
425
444
|
*/
|
|
426
445
|
#throwParseError(options) {
|
|
427
446
|
const token = this.#lookaheadToken(0);
|
|
@@ -503,8 +522,8 @@ class Parser {
|
|
|
503
522
|
* Process a projection if the right hand side of the
|
|
504
523
|
* projection is a slice.
|
|
505
524
|
*
|
|
506
|
-
* @param left The left hand side of the projection.
|
|
507
|
-
* @param right The right hand side of the projection.
|
|
525
|
+
* @param left - The left hand side of the projection.
|
|
526
|
+
* @param right - The right hand side of the projection.
|
|
508
527
|
*/
|
|
509
528
|
#projectIfSlice(left, right) {
|
|
510
529
|
const idxExpression = (0, ast_js_1.indexExpression)([left, right]);
|
|
@@ -520,8 +539,8 @@ class Parser {
|
|
|
520
539
|
* two values. For example `foo == bar` compares the
|
|
521
540
|
* value of `foo` with the value of `bar`.
|
|
522
541
|
*
|
|
523
|
-
* @param left The left hand side of the comparator.
|
|
524
|
-
* @param comparatorChar The comparator character.
|
|
542
|
+
* @param left - The left hand side of the comparator.
|
|
543
|
+
* @param comparatorChar - The comparator character.
|
|
525
544
|
*/
|
|
526
545
|
#parseComparator(left, comparatorChar) {
|
|
527
546
|
return (0, ast_js_1.comparator)(comparatorChar, left, this.#expression(constants_js_1.BINDING_POWER[comparatorChar]));
|
|
@@ -579,7 +598,7 @@ class Parser {
|
|
|
579
598
|
/**
|
|
580
599
|
* Process the right hand side of a projection.
|
|
581
600
|
*
|
|
582
|
-
* @param bindingPower The binding power of the current token.
|
|
601
|
+
* @param bindingPower - The binding power of the current token.
|
|
583
602
|
*/
|
|
584
603
|
#parseProjectionRhs(bindingPower) {
|
|
585
604
|
// Parse the right hand side of the projection.
|
|
@@ -606,7 +625,7 @@ class Parser {
|
|
|
606
625
|
/**
|
|
607
626
|
* Process the right hand side of a dot expression.
|
|
608
627
|
*
|
|
609
|
-
* @param bindingPower The binding power of the current token.
|
|
628
|
+
* @param bindingPower - The binding power of the current token.
|
|
610
629
|
*/
|
|
611
630
|
#parseDotRhs(bindingPower) {
|
|
612
631
|
// From the grammar:
|
|
@@ -635,7 +654,7 @@ class Parser {
|
|
|
635
654
|
/**
|
|
636
655
|
* Process a token and throw an error if it doesn't match the expected token.
|
|
637
656
|
*
|
|
638
|
-
* @param tokenType The expected token type.
|
|
657
|
+
* @param tokenType - The expected token type.
|
|
639
658
|
*/
|
|
640
659
|
#match(tokenType) {
|
|
641
660
|
const currentToken = this.#currentToken();
|
|
@@ -661,7 +680,7 @@ class Parser {
|
|
|
661
680
|
/**
|
|
662
681
|
* Process a token and throw an error if it doesn't match the expected token.
|
|
663
682
|
*
|
|
664
|
-
* @param tokenTypes The expected token types.
|
|
683
|
+
* @param tokenTypes - The expected token types.
|
|
665
684
|
*/
|
|
666
685
|
#matchMultipleTokens(tokenTypes) {
|
|
667
686
|
const currentToken = this.#currentToken();
|
|
@@ -697,7 +716,7 @@ class Parser {
|
|
|
697
716
|
/**
|
|
698
717
|
* Look ahead in the token stream and get the type of the token
|
|
699
718
|
*
|
|
700
|
-
* @param number The number of tokens to look ahead.
|
|
719
|
+
* @param number - The number of tokens to look ahead.
|
|
701
720
|
*/
|
|
702
721
|
#lookahead(number) {
|
|
703
722
|
return this.#tokens[this.#index + number].type;
|
|
@@ -705,7 +724,7 @@ class Parser {
|
|
|
705
724
|
/**
|
|
706
725
|
* Look ahead in the token stream and get the token
|
|
707
726
|
*
|
|
708
|
-
* @param number The number of tokens to look ahead.
|
|
727
|
+
* @param number - The number of tokens to look ahead.
|
|
709
728
|
*/
|
|
710
729
|
#lookaheadToken(number) {
|
|
711
730
|
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"}
|
|
@@ -6,18 +6,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.
|
|
9
|
+
exports.PowertoolsFunctions = exports.Functions = void 0;
|
|
10
10
|
const node_zlib_1 = require("node:zlib");
|
|
11
11
|
const base64_1 = require("@aws-lambda-powertools/commons/utils/base64");
|
|
12
12
|
const Functions_js_1 = require("./Functions.js");
|
|
13
|
-
Object.defineProperty(exports, "Functions", { enumerable: true, get: function () { return Functions_js_1.Functions; } });
|
|
14
13
|
const decoder = new TextDecoder('utf-8');
|
|
15
14
|
/**
|
|
16
15
|
* Custom functions for the Powertools for AWS Lambda JMESPath module.
|
|
17
16
|
*
|
|
18
17
|
* Built-in JMESPath functions include: `powertools_json`, `powertools_base64`, `powertools_base64_gzip`
|
|
19
18
|
*
|
|
20
|
-
* You can use these functions to decode and/or deserialize JSON objects when using the {@link
|
|
19
|
+
* You can use these functions to decode and/or deserialize JSON objects when using the {@link search | `search`} function.
|
|
21
20
|
*
|
|
22
21
|
* @example
|
|
23
22
|
* ```typescript
|
|
@@ -35,9 +34,6 @@ const decoder = new TextDecoder('utf-8');
|
|
|
35
34
|
* );
|
|
36
35
|
* console.log(result); // { foo: 'bar' }
|
|
37
36
|
* ```
|
|
38
|
-
*
|
|
39
|
-
* When using the {@link envelopes.extractDataFromEnvelope} function, the PowertoolsFunctions class is automatically used.
|
|
40
|
-
*
|
|
41
37
|
*/
|
|
42
38
|
class PowertoolsFunctions extends Functions_js_1.Functions {
|
|
43
39
|
funcPowertoolsBase64(value) {
|
|
@@ -68,3 +64,5 @@ __decorate([
|
|
|
68
64
|
argumentsSpecs: [['string']],
|
|
69
65
|
})
|
|
70
66
|
], PowertoolsFunctions.prototype, "funcPowertoolsJson", null);
|
|
67
|
+
var Functions_js_2 = require("./Functions.js");
|
|
68
|
+
Object.defineProperty(exports, "Functions", { enumerable: true, get: function () { return Functions_js_2.Functions; } });
|
|
@@ -184,10 +184,10 @@ class TreeInterpreter {
|
|
|
184
184
|
}
|
|
185
185
|
try {
|
|
186
186
|
// We know that methodName is a key of this.#functions, but TypeScript
|
|
187
|
-
// doesn't know that, so we
|
|
187
|
+
// doesn't know that, so we suppress the issue to tell it that it's
|
|
188
188
|
// okay. We could use a type assertion like `as keyof Functions`, but
|
|
189
189
|
// we also want to keep the args generic, so for now we'll just ignore it.
|
|
190
|
-
// @ts-
|
|
190
|
+
// @ts-expect-error
|
|
191
191
|
return this.#functions[funcName](args);
|
|
192
192
|
}
|
|
193
193
|
catch (error) {
|
package/lib/cjs/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/cjs/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC;;;;;;;;GAQG;AACH,QAAA,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,OAAO,IAAI,EAAE,QAAQ,IAAI,KAAG,IAI5D,CAAC;AAEH;;;;;GAKG;AACH,QAAA,MAAM,WAAW,QAAO,IAGtB,CAAC;AAEH;;;;;;;GAOG;AACH,QAAA,MAAM,MAAM,GAAI,YAAY,IAAI,KAAG,IAGjC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,IAAI,EAAE,KAAG,IAIvD,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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