@aws-lambda-powertools/jmespath 0.0.0-alpha.0 → 2.0.4

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.
Files changed (97) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +214 -5
  3. package/lib/cjs/Expression.d.ts +19 -0
  4. package/lib/cjs/Expression.d.ts.map +1 -0
  5. package/lib/cjs/Expression.js +38 -0
  6. package/lib/cjs/Functions.d.ts +242 -0
  7. package/lib/cjs/Functions.d.ts.map +1 -0
  8. package/lib/cjs/Functions.js +597 -0
  9. package/lib/cjs/Lexer.d.ts +19 -0
  10. package/lib/cjs/Lexer.d.ts.map +1 -0
  11. package/lib/cjs/Lexer.js +271 -0
  12. package/lib/cjs/ParsedResult.d.ts +15 -0
  13. package/lib/cjs/ParsedResult.d.ts.map +1 -0
  14. package/lib/cjs/ParsedResult.js +33 -0
  15. package/lib/cjs/Parser.d.ts +35 -0
  16. package/lib/cjs/Parser.d.ts.map +1 -0
  17. package/lib/cjs/Parser.js +506 -0
  18. package/lib/cjs/PowertoolsFunctions.d.ts +36 -0
  19. package/lib/cjs/PowertoolsFunctions.d.ts.map +1 -0
  20. package/lib/cjs/PowertoolsFunctions.js +69 -0
  21. package/lib/cjs/TreeInterpreter.d.ts +28 -0
  22. package/lib/cjs/TreeInterpreter.d.ts.map +1 -0
  23. package/lib/cjs/TreeInterpreter.js +313 -0
  24. package/lib/cjs/ast.d.ts +185 -0
  25. package/lib/cjs/ast.d.ts.map +1 -0
  26. package/lib/cjs/ast.js +275 -0
  27. package/lib/cjs/constants.d.ts +60 -0
  28. package/lib/cjs/constants.d.ts.map +1 -0
  29. package/lib/cjs/constants.js +96 -0
  30. package/lib/cjs/envelopes.d.ts +69 -0
  31. package/lib/cjs/envelopes.d.ts.map +1 -0
  32. package/lib/cjs/envelopes.js +90 -0
  33. package/lib/cjs/errors.d.ts +183 -0
  34. package/lib/cjs/errors.d.ts.map +1 -0
  35. package/lib/cjs/errors.js +206 -0
  36. package/lib/cjs/index.d.ts +3 -0
  37. package/lib/cjs/index.d.ts.map +1 -0
  38. package/lib/cjs/index.js +15 -0
  39. package/lib/cjs/package.json +1 -0
  40. package/lib/cjs/search.d.ts +50 -0
  41. package/lib/cjs/search.d.ts.map +1 -0
  42. package/lib/cjs/search.js +55 -0
  43. package/lib/cjs/types.d.ts +88 -0
  44. package/lib/cjs/types.d.ts.map +1 -0
  45. package/lib/cjs/types.js +2 -0
  46. package/lib/cjs/utils.d.ts +87 -0
  47. package/lib/cjs/utils.d.ts.map +1 -0
  48. package/lib/cjs/utils.js +282 -0
  49. package/lib/esm/Expression.d.ts +19 -0
  50. package/lib/esm/Expression.d.ts.map +1 -0
  51. package/lib/esm/Expression.js +35 -0
  52. package/lib/esm/Functions.d.ts +242 -0
  53. package/lib/esm/Functions.d.ts.map +1 -0
  54. package/lib/esm/Functions.js +594 -0
  55. package/lib/esm/Lexer.d.ts +19 -0
  56. package/lib/esm/Lexer.d.ts.map +1 -0
  57. package/lib/esm/Lexer.js +268 -0
  58. package/lib/esm/ParsedResult.d.ts +15 -0
  59. package/lib/esm/ParsedResult.d.ts.map +1 -0
  60. package/lib/esm/ParsedResult.js +30 -0
  61. package/lib/esm/Parser.d.ts +35 -0
  62. package/lib/esm/Parser.d.ts.map +1 -0
  63. package/lib/esm/Parser.js +503 -0
  64. package/lib/esm/PowertoolsFunctions.d.ts +36 -0
  65. package/lib/esm/PowertoolsFunctions.d.ts.map +1 -0
  66. package/lib/esm/PowertoolsFunctions.js +66 -0
  67. package/lib/esm/TreeInterpreter.d.ts +28 -0
  68. package/lib/esm/TreeInterpreter.d.ts.map +1 -0
  69. package/lib/esm/TreeInterpreter.js +310 -0
  70. package/lib/esm/ast.d.ts +185 -0
  71. package/lib/esm/ast.d.ts.map +1 -0
  72. package/lib/esm/ast.js +251 -0
  73. package/lib/esm/constants.d.ts +60 -0
  74. package/lib/esm/constants.d.ts.map +1 -0
  75. package/lib/esm/constants.js +88 -0
  76. package/lib/esm/envelopes.d.ts +69 -0
  77. package/lib/esm/envelopes.d.ts.map +1 -0
  78. package/lib/esm/envelopes.js +74 -0
  79. package/lib/esm/errors.d.ts +183 -0
  80. package/lib/esm/errors.d.ts.map +1 -0
  81. package/lib/esm/errors.js +195 -0
  82. package/lib/esm/index.d.ts +3 -0
  83. package/lib/esm/index.d.ts.map +1 -0
  84. package/lib/esm/index.js +2 -0
  85. package/lib/esm/package.json +1 -0
  86. package/lib/esm/search.d.ts +50 -0
  87. package/lib/esm/search.d.ts.map +1 -0
  88. package/lib/esm/search.js +52 -0
  89. package/lib/esm/types.d.ts +88 -0
  90. package/lib/esm/types.d.ts.map +1 -0
  91. package/lib/esm/types.js +1 -0
  92. package/lib/esm/utils.d.ts +87 -0
  93. package/lib/esm/utils.d.ts.map +1 -0
  94. package/lib/esm/utils.js +275 -0
  95. package/package.json +51 -12
  96. package/lib/index.d.ts +0 -0
  97. package/lib/index.js +0 -4
@@ -0,0 +1,597 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.Functions = void 0;
10
+ const typeutils_1 = require("@aws-lambda-powertools/commons/typeutils");
11
+ const errors_js_1 = require("./errors.js");
12
+ const utils_js_1 = require("./utils.js");
13
+ /**
14
+ * A class that contains the built-in JMESPath functions.
15
+ *
16
+ * The built-in functions are implemented as methods on the Functions class.
17
+ * Each method is decorated with the `@Function.signature()` decorator to enforce the
18
+ * arity and types of the arguments passed to the function at runtime.
19
+ *
20
+ * You can extend the Functions class to add custom functions by creating a new class
21
+ * that extends Functions and adding new methods to it.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { search } from '@aws-lambda-powertools/jmespath';
26
+ * import { Functions } from '@aws-lambda-powertools/jmespath/functions';
27
+ *
28
+ * class MyFunctions extends Functions {
29
+ * ⁣@Functions.signature({
30
+ * argumentsSpecs: [['number'], ['number']],
31
+ * variadic: true,
32
+ * })
33
+ * public funcMyMethod(args: Array<number>): unknown {
34
+ * // ...
35
+ * }
36
+ * }
37
+ *
38
+ * const myFunctions = new MyFunctions();
39
+ *
40
+ * search('myMethod(@)', {}, { customFunctions: new MyFunctions() });
41
+ * ```
42
+ */
43
+ class Functions {
44
+ constructor() {
45
+ this.methods = new Set();
46
+ }
47
+ /**
48
+ * Get the absolute value of the provided number.
49
+ *
50
+ * @param args The number to get the absolute value of
51
+ */
52
+ funcAbs(args) {
53
+ return Math.abs(args);
54
+ }
55
+ /**
56
+ * Calculate the average of the numbers in the provided array.
57
+ *
58
+ * @param args The numbers to average
59
+ */
60
+ funcAvg(args) {
61
+ return args.reduce((a, b) => a + b, 0) / args.length;
62
+ }
63
+ /**
64
+ * Get the ceiling of the provided number.
65
+ *
66
+ * @param args The number to get the ceiling of
67
+ */
68
+ funcCeil(args) {
69
+ return Math.ceil(args);
70
+ }
71
+ /**
72
+ * Determine if the given value is contained in the provided array or string.
73
+ *
74
+ * @param haystack The array or string to check
75
+ * @param needle The value to check for
76
+ */
77
+ funcContains(haystack, needle) {
78
+ return haystack.includes(needle);
79
+ }
80
+ /**
81
+ * Determines if the provided string ends with the provided suffix.
82
+ *
83
+ * @param str The string to check
84
+ * @param suffix The suffix to check for
85
+ */
86
+ funcEndsWith(str, suffix) {
87
+ return str.endsWith(suffix);
88
+ }
89
+ /**
90
+ * Get the floor of the provided number.
91
+ *
92
+ * @param args The number to get the floor of
93
+ */
94
+ funcFloor(args) {
95
+ return Math.floor(args);
96
+ }
97
+ /**
98
+ * Join the provided array into a single string.
99
+ *
100
+ * @param separator The separator to use
101
+ * @param items The array of itmes to join
102
+ */
103
+ funcJoin(separator, items) {
104
+ return items.join(separator);
105
+ }
106
+ /**
107
+ * Get the keys of the provided object.
108
+ *
109
+ * @param arg The object to get the keys of
110
+ */
111
+ funcKeys(arg) {
112
+ return Object.keys(arg);
113
+ }
114
+ /**
115
+ * Get the number of items in the provided item.
116
+ *
117
+ * @param arg The array to get the length of
118
+ */
119
+ funcLength(arg) {
120
+ if ((0, typeutils_1.isRecord)(arg)) {
121
+ return Object.keys(arg).length;
122
+ }
123
+ else {
124
+ return arg.length;
125
+ }
126
+ }
127
+ /**
128
+ * Map the provided function over the provided array.
129
+ *
130
+ * @param expression The expression to map over the array
131
+ * @param args The array to map the expression over
132
+ */
133
+ funcMap(expression, args) {
134
+ return args.map((arg) => {
135
+ return expression.visit(arg) || null;
136
+ });
137
+ }
138
+ /**
139
+ * Get the maximum value in the provided array.
140
+ *
141
+ * @param arg The array to get the maximum value of
142
+ */
143
+ funcMax(arg) {
144
+ if (arg.length === 0) {
145
+ return null;
146
+ // The signature decorator already enforces that all elements are of the same type
147
+ }
148
+ else if ((0, typeutils_1.isNumber)(arg[0])) {
149
+ return Math.max(...arg);
150
+ }
151
+ else {
152
+ // local compare function to handle string comparison
153
+ return arg.reduce((a, b) => (a > b ? a : b));
154
+ }
155
+ }
156
+ /**
157
+ * Get the item in the provided array that has the maximum value when the provided expression is evaluated.
158
+ *
159
+ * @param args The array of items to get the maximum value of
160
+ * @param expression The expression to evaluate for each item in the array
161
+ */
162
+ funcMaxBy(args, expression) {
163
+ if (args.length === 0) {
164
+ return null;
165
+ }
166
+ const visitedArgs = args.map((arg) => ({
167
+ arg,
168
+ visited: expression.visit(arg),
169
+ }));
170
+ const max = visitedArgs.reduce((max, current) => {
171
+ const type = (0, typeutils_1.getType)(current.visited);
172
+ if (type !== 'string' && type !== 'number') {
173
+ throw new errors_js_1.JMESPathTypeError({
174
+ currentValue: current.visited,
175
+ expectedTypes: ['string'],
176
+ actualType: type,
177
+ });
178
+ }
179
+ if (max.visited === current.visited) {
180
+ return max;
181
+ }
182
+ else {
183
+ // We can safely cast visited to number | string here because we've already
184
+ // checked the type at runtime above and we know that it's either a number or a string
185
+ return max.visited >
186
+ current.visited
187
+ ? max
188
+ : current;
189
+ }
190
+ }, visitedArgs[0]);
191
+ return max.arg;
192
+ }
193
+ /**
194
+ * Merge the provided objects into a single object.
195
+ *
196
+ * Note that this is a shallow merge and will not merge nested objects.
197
+ *
198
+ * @param args The objects to merge
199
+ */
200
+ funcMerge(...args) {
201
+ return args.reduce((a, b) => ({ ...a, ...b }), {});
202
+ }
203
+ /**
204
+ * Get the minimum value in the provided array.
205
+ *
206
+ * @param arg The array to get the minimum value of
207
+ */
208
+ funcMin(arg) {
209
+ if (arg.length === 0) {
210
+ return null;
211
+ // The signature decorator already enforces that all elements are of the same type
212
+ }
213
+ else if ((0, typeutils_1.isNumber)(arg[0])) {
214
+ return Math.min(...arg);
215
+ }
216
+ else {
217
+ return arg.reduce((a, b) => (a < b ? a : b));
218
+ }
219
+ }
220
+ /**
221
+ * Get the item in the provided array that has the minimum value when the provided expression is evaluated.
222
+ *
223
+ * @param args The array of items to get the minimum value of
224
+ * @param expression The expression to evaluate for each item in the array
225
+ */
226
+ funcMinBy(args, expression) {
227
+ if (args.length === 0) {
228
+ return null;
229
+ }
230
+ const visitedArgs = args.map((arg) => ({
231
+ arg,
232
+ visited: expression.visit(arg),
233
+ }));
234
+ const min = visitedArgs.reduce((min, current) => {
235
+ const type = (0, typeutils_1.getType)(current.visited);
236
+ if (type !== 'string' && type !== 'number') {
237
+ throw new errors_js_1.JMESPathTypeError({
238
+ currentValue: current.visited,
239
+ expectedTypes: ['string'],
240
+ actualType: type,
241
+ });
242
+ }
243
+ if (min.visited === current.visited) {
244
+ return min;
245
+ }
246
+ else {
247
+ // We can safely cast visited to number | string here because we've already
248
+ // checked the type at runtime above and we know that it's either a number or a string
249
+ return min.visited <
250
+ current.visited
251
+ ? min
252
+ : current;
253
+ }
254
+ }, visitedArgs[0]);
255
+ return min.arg;
256
+ }
257
+ /**
258
+ * Get the first argument that does not evaluate to null.
259
+ * If all arguments evaluate to null, then null is returned.
260
+ *
261
+ * @param args The keys of the items to check
262
+ */
263
+ funcNotNull(...args) {
264
+ return args.find((arg) => !Object.is(arg, null)) || null;
265
+ }
266
+ /**
267
+ * Reverses the provided string or array.
268
+ *
269
+ * @param arg The string or array to reverse
270
+ */
271
+ funcReverse(arg) {
272
+ return Array.isArray(arg)
273
+ ? arg.reverse()
274
+ : arg.split('').reverse().join('');
275
+ }
276
+ /**
277
+ * Sort the provided array.
278
+ *
279
+ * @param arg The array to sort
280
+ */
281
+ funcSort(arg) {
282
+ return arg.sort((a, b) => {
283
+ if (typeof a === 'string') {
284
+ // We can safely cast a and b to string here because the signature decorator
285
+ // already enforces that all elements are of the same type
286
+ return a.localeCompare(b);
287
+ }
288
+ // We can safely cast a and b to number here because the signature decorator
289
+ // already enforces that all elements are of the same type, so if they're not strings
290
+ // then they must be numbers
291
+ return a - b;
292
+ });
293
+ }
294
+ /**
295
+ * Sort the provided array by the provided expression.
296
+ *
297
+ * @param args The array to sort
298
+ * @param expression The expression to sort by
299
+ */
300
+ funcSortBy(args, expression) {
301
+ return args
302
+ .map((value, index) => {
303
+ const visited = expression.visit(value);
304
+ const type = (0, typeutils_1.getType)(visited);
305
+ if (type !== 'string' && type !== 'number') {
306
+ throw new errors_js_1.JMESPathTypeError({
307
+ currentValue: visited,
308
+ expectedTypes: ['string'],
309
+ actualType: (0, typeutils_1.getType)(visited),
310
+ });
311
+ }
312
+ return {
313
+ value,
314
+ index,
315
+ visited,
316
+ };
317
+ })
318
+ .sort((a, b) => {
319
+ if (a.visited === b.visited) {
320
+ return a.index - b.index; // Make the sort stable
321
+ }
322
+ else {
323
+ // We can safely cast visited to number | string here because we've already
324
+ // checked the type at runtime above and we know that it's either a number or a string
325
+ return a.visited > b.visited
326
+ ? 1
327
+ : -1;
328
+ }
329
+ })
330
+ .map(({ value }) => value); // Extract the original values
331
+ }
332
+ /**
333
+ * Determines if the provided string starts with the provided prefix.
334
+ *
335
+ * @param str The string to check
336
+ * @param prefix The prefix to check for
337
+ */
338
+ funcStartsWith(str, prefix) {
339
+ return str.startsWith(prefix);
340
+ }
341
+ /**
342
+ * Sum the provided numbers.
343
+ *
344
+ * @param args The numbers to sum
345
+ */
346
+ funcSum(args) {
347
+ return args.reduce((a, b) => a + b, 0);
348
+ }
349
+ /**
350
+ * Convert the provided value to an array.
351
+ *
352
+ * If the provided value is an array, then it is returned.
353
+ * Otherwise, the value is wrapped in an array and returned.
354
+ *
355
+ * @param arg The items to convert to an array
356
+ */
357
+ funcToArray(arg) {
358
+ return Array.isArray(arg) ? arg : [arg];
359
+ }
360
+ /**
361
+ * Convert the provided value to a number.
362
+ *
363
+ * If the provided value is a number, then it is returned.
364
+ * Otherwise, the value is converted to a number and returned.
365
+ *
366
+ * If the value cannot be converted to a number, then null is returned.
367
+ *
368
+ * @param arg The value to convert to a number
369
+ */
370
+ funcToNumber(arg) {
371
+ if (typeof arg === 'number') {
372
+ return arg;
373
+ }
374
+ else if (typeof arg === 'string') {
375
+ const num = Number(arg);
376
+ return Number.isNaN(num) ? null : num;
377
+ }
378
+ else {
379
+ return null;
380
+ }
381
+ }
382
+ /**
383
+ * Convert the provided value to a string.
384
+ *
385
+ * If the provided value is a string, then it is returned.
386
+ * Otherwise, the value is converted to a string and returned.
387
+ *
388
+ * @param arg The value to convert to a string
389
+ */
390
+ funcToString(arg) {
391
+ return typeof arg === 'string' ? arg : JSON.stringify(arg);
392
+ }
393
+ /**
394
+ * Get the type of the provided value.
395
+ *
396
+ * @param arg The value to check the type of
397
+ */
398
+ funcType(arg) {
399
+ return (0, typeutils_1.getType)(arg);
400
+ }
401
+ /**
402
+ * Get the values of the provided object.
403
+ *
404
+ * @param arg The object to get the values of
405
+ */
406
+ funcValues(arg) {
407
+ return Object.values(arg);
408
+ }
409
+ introspectMethods(scope) {
410
+ const prototype = Object.getPrototypeOf(this);
411
+ const ownName = prototype.constructor.name;
412
+ const methods = new Set();
413
+ if (ownName !== 'Functions') {
414
+ for (const method of prototype.introspectMethods(scope)) {
415
+ methods.add(method);
416
+ }
417
+ }
418
+ // This block is executed for every class in the inheritance chain
419
+ for (const method of Object.getOwnPropertyNames(Object.getPrototypeOf(this))) {
420
+ method !== 'constructor' &&
421
+ method.startsWith('func') &&
422
+ methods.add(method);
423
+ }
424
+ // This block will be executed only if the scope is the outermost class
425
+ if (this.methods) {
426
+ for (const method of methods) {
427
+ this.methods.add(method);
428
+ }
429
+ }
430
+ return methods;
431
+ }
432
+ /**
433
+ * Decorator to enforce the signature of a function at runtime.
434
+ *
435
+ * The signature decorator enforces the arity and types of the arguments
436
+ * passed to a function at runtime. If the arguments do not match the
437
+ * expected arity or types errors are thrown.
438
+ *
439
+ * @example
440
+ * ```typescript
441
+ * import { PowertoolsFunctions } from '@aws-lambda-powertools/jmespath/functions';
442
+ *
443
+ * class MyFunctions extends Functions {
444
+ * ⁣@Functions.signature({
445
+ * argumentsSpecs: [['number'], ['number']],
446
+ * variadic: true,
447
+ * })
448
+ * public funcMyMethod(args: Array<number>): unknown {
449
+ * // ...
450
+ * }
451
+ * }
452
+ * ```
453
+ *
454
+ * @param options The options for the signature decorator
455
+ */
456
+ static signature(options) {
457
+ return (_target, _propertyKey, descriptor) => {
458
+ const originalMethod = descriptor.value;
459
+ // Use a function() {} instead of an () => {} arrow function so that we can
460
+ // access `myClass` as `this` in a decorated `myClass.myMethod()`.
461
+ descriptor.value = function (args) {
462
+ const { variadic, argumentsSpecs } = options;
463
+ (0, utils_js_1.arityCheck)(args, argumentsSpecs, variadic);
464
+ (0, utils_js_1.typeCheck)(args, argumentsSpecs);
465
+ return originalMethod.apply(this, args);
466
+ };
467
+ return descriptor;
468
+ };
469
+ }
470
+ }
471
+ exports.Functions = Functions;
472
+ __decorate([
473
+ Functions.signature({ argumentsSpecs: [['number']] })
474
+ ], Functions.prototype, "funcAbs", null);
475
+ __decorate([
476
+ Functions.signature({
477
+ argumentsSpecs: [['array-number']],
478
+ })
479
+ ], Functions.prototype, "funcAvg", null);
480
+ __decorate([
481
+ Functions.signature({ argumentsSpecs: [['number']] })
482
+ ], Functions.prototype, "funcCeil", null);
483
+ __decorate([
484
+ Functions.signature({
485
+ argumentsSpecs: [['array', 'string'], ['any']],
486
+ })
487
+ ], Functions.prototype, "funcContains", null);
488
+ __decorate([
489
+ Functions.signature({
490
+ argumentsSpecs: [['string'], ['string']],
491
+ })
492
+ ], Functions.prototype, "funcEndsWith", null);
493
+ __decorate([
494
+ Functions.signature({ argumentsSpecs: [['number']] })
495
+ ], Functions.prototype, "funcFloor", null);
496
+ __decorate([
497
+ Functions.signature({
498
+ argumentsSpecs: [['string'], ['array-string']],
499
+ })
500
+ ], Functions.prototype, "funcJoin", null);
501
+ __decorate([
502
+ Functions.signature({
503
+ argumentsSpecs: [['object']],
504
+ })
505
+ ], Functions.prototype, "funcKeys", null);
506
+ __decorate([
507
+ Functions.signature({
508
+ argumentsSpecs: [['array', 'string', 'object']],
509
+ })
510
+ ], Functions.prototype, "funcLength", null);
511
+ __decorate([
512
+ Functions.signature({
513
+ argumentsSpecs: [['any'], ['array']],
514
+ })
515
+ ], Functions.prototype, "funcMap", null);
516
+ __decorate([
517
+ Functions.signature({
518
+ argumentsSpecs: [['array-number', 'array-string']],
519
+ })
520
+ ], Functions.prototype, "funcMax", null);
521
+ __decorate([
522
+ Functions.signature({
523
+ argumentsSpecs: [['array'], ['expression']],
524
+ })
525
+ ], Functions.prototype, "funcMaxBy", null);
526
+ __decorate([
527
+ Functions.signature({
528
+ argumentsSpecs: [['object']],
529
+ variadic: true,
530
+ })
531
+ ], Functions.prototype, "funcMerge", null);
532
+ __decorate([
533
+ Functions.signature({
534
+ argumentsSpecs: [['array-number', 'array-string']],
535
+ })
536
+ ], Functions.prototype, "funcMin", null);
537
+ __decorate([
538
+ Functions.signature({
539
+ argumentsSpecs: [['array'], ['expression']],
540
+ })
541
+ ], Functions.prototype, "funcMinBy", null);
542
+ __decorate([
543
+ Functions.signature({
544
+ argumentsSpecs: [[]],
545
+ variadic: true,
546
+ })
547
+ ], Functions.prototype, "funcNotNull", null);
548
+ __decorate([
549
+ Functions.signature({
550
+ argumentsSpecs: [['string', 'array']],
551
+ })
552
+ ], Functions.prototype, "funcReverse", null);
553
+ __decorate([
554
+ Functions.signature({
555
+ argumentsSpecs: [['array-number', 'array-string']],
556
+ })
557
+ ], Functions.prototype, "funcSort", null);
558
+ __decorate([
559
+ Functions.signature({
560
+ argumentsSpecs: [['array'], ['expression']],
561
+ })
562
+ ], Functions.prototype, "funcSortBy", null);
563
+ __decorate([
564
+ Functions.signature({
565
+ argumentsSpecs: [['string'], ['string']],
566
+ })
567
+ ], Functions.prototype, "funcStartsWith", null);
568
+ __decorate([
569
+ Functions.signature({
570
+ argumentsSpecs: [['array-number']],
571
+ })
572
+ ], Functions.prototype, "funcSum", null);
573
+ __decorate([
574
+ Functions.signature({
575
+ argumentsSpecs: [['any']],
576
+ })
577
+ ], Functions.prototype, "funcToArray", null);
578
+ __decorate([
579
+ Functions.signature({
580
+ argumentsSpecs: [['any']],
581
+ })
582
+ ], Functions.prototype, "funcToNumber", null);
583
+ __decorate([
584
+ Functions.signature({
585
+ argumentsSpecs: [['any']],
586
+ })
587
+ ], Functions.prototype, "funcToString", null);
588
+ __decorate([
589
+ Functions.signature({
590
+ argumentsSpecs: [['any']],
591
+ })
592
+ ], Functions.prototype, "funcType", null);
593
+ __decorate([
594
+ Functions.signature({
595
+ argumentsSpecs: [['object']],
596
+ })
597
+ ], Functions.prototype, "funcValues", null);
@@ -0,0 +1,19 @@
1
+ import type { Token } from './types.js';
2
+ /**
3
+ * A lexer for JMESPath expressions.
4
+ *
5
+ * This lexer tokenizes a JMESPath expression into a sequence of tokens.
6
+ */
7
+ declare class Lexer {
8
+ #private;
9
+ /**
10
+ * Tokenize a JMESPath expression.
11
+ *
12
+ * This method is a generator that yields tokens for the given expression.
13
+ *
14
+ * @param expression The JMESPath expression to tokenize.
15
+ */
16
+ tokenize(expression: string): Generator<Token>;
17
+ }
18
+ export { Lexer };
19
+ //# sourceMappingURL=Lexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Lexer.d.ts","sourceRoot":"","sources":["../../src/Lexer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,cAAM,KAAK;;IAOT;;;;;;OAMG;IACK,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC;CAgVvD;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}