@aws-lambda-powertools/jmespath 2.3.0 → 2.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.
@@ -65,12 +65,6 @@ declare class ParseError extends JMESPathError {
65
65
  * Error thrown when an incomplete expression is encountered during parsing.
66
66
  */
67
67
  declare class IncompleteExpressionError extends ParseError {
68
- /**
69
- * Expression that was being parsed when the error occurred.
70
- *
71
- * Can be set by whatever catches the error.
72
- */
73
- expression?: string;
74
68
  constructor(options: {
75
69
  lexPosition: number;
76
70
  tokenValue: Token['value'];
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,cAAM,aAAc,SAAQ,KAAK;IAC/B;;;OAGG;IACI,UAAU,CAAC,EAAE,MAAM,CAAC;gBAER,OAAO,EAAE,MAAM;IAMlC;;;;;;;;OAQG;IACI,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;CAM/C;AAED;;GAEG;AACH,cAAM,UAAW,SAAQ,aAAa;IACpC;;OAEG;IACI,aAAa,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACI,UAAU,EAAE,MAAM,CAAC;gBAEP,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAS7D;AAED;;GAEG;AACH,cAAM,UAAW,SAAQ,aAAa;IACpC;;OAEG;IACI,WAAW,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACI,MAAM,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACI,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC;;OAEG;IACI,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;gBAEf,OAAO,EAAE;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC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EAAE,OAAO,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,MAAM,EAAE,CAAC;KACzB;IAeD,SAAS,CAAC,sBAAsB,IAAI,MAAM;CAQ3C;AAED;;;;;;GAMG;AACH,cAAM,oBAAqB,SAAQ,aAAa;gBAC3B,QAAQ,EAAE,MAAM;CAOpC;AAED,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,kBAAkB,GACnB,CAAC"}
package/lib/esm/errors.js CHANGED
@@ -2,6 +2,11 @@
2
2
  * Base class for errors thrown during expression parsing and evaluation.
3
3
  */
4
4
  class JMESPathError extends Error {
5
+ /**
6
+ * Expression that was being parsed when the error occurred.
7
+ * Can be set by whatever catches the error.
8
+ */
9
+ expression;
5
10
  constructor(message) {
6
11
  super(message);
7
12
  this.name = 'JMESPathError';
@@ -26,6 +31,14 @@ class JMESPathError extends Error {
26
31
  * Error thrown when an unknown token is encountered during the AST construction.
27
32
  */
28
33
  class LexerError extends JMESPathError {
34
+ /**
35
+ * Position in the expression where the error occurred.
36
+ */
37
+ lexerPosition;
38
+ /**
39
+ * Token value where the error occurred.
40
+ */
41
+ lexerValue;
29
42
  constructor(lexerPosition, lexerValue) {
30
43
  super('Bad jmespath expression');
31
44
  this.name = 'LexerError';
@@ -39,6 +52,22 @@ class LexerError extends JMESPathError {
39
52
  * Error thrown when an invalid or unexpected token type or value is encountered during parsing.
40
53
  */
41
54
  class ParseError extends JMESPathError {
55
+ /**
56
+ * Position in the expression where the error occurred.
57
+ */
58
+ lexPosition;
59
+ /**
60
+ * Additional information about the error.
61
+ */
62
+ reason;
63
+ /**
64
+ * Token type where the error occurred.
65
+ */
66
+ tokenType;
67
+ /**
68
+ * Token value where the error occurred.
69
+ */
70
+ tokenValue;
42
71
  constructor(options) {
43
72
  super('Invalid jmespath expression');
44
73
  this.name = 'ParseError';
@@ -92,6 +121,11 @@ class EmptyExpressionError extends JMESPathError {
92
121
  * while executing the function itself.
93
122
  */
94
123
  class FunctionError extends JMESPathError {
124
+ /**
125
+ * Function that was being executed when the error occurred.
126
+ * Can be set by whatever catches the error.
127
+ */
128
+ functionName;
95
129
  constructor(message) {
96
130
  super(message);
97
131
  this.name = 'FunctionError';
@@ -120,6 +154,8 @@ class FunctionError extends JMESPathError {
120
154
  * an `ArityError` is thrown.
121
155
  */
122
156
  class ArityError extends FunctionError {
157
+ actualArity;
158
+ expectedArity;
123
159
  constructor(options) {
124
160
  super('Invalid arity for JMESPath function');
125
161
  this.name = 'ArityError';
@@ -160,6 +196,9 @@ class VariadicArityError extends ArityError {
160
196
  * instead, this error is thrown.
161
197
  */
162
198
  class JMESPathTypeError extends FunctionError {
199
+ actualType;
200
+ currentValue;
201
+ expectedTypes;
163
202
  constructor(options) {
164
203
  super('Invalid type for JMESPath expression');
165
204
  this.name = 'JMESPathTypeError';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-lambda-powertools/jmespath",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "A type safe and modern jmespath module to parse and extract data from JSON documents using JMESPath",
5
5
  "author": {
6
6
  "name": "Amazon Web Services",
@@ -25,7 +25,7 @@
25
25
  "nodejs"
26
26
  ],
27
27
  "dependencies": {
28
- "@aws-lambda-powertools/commons": "^2.3.0"
28
+ "@aws-lambda-powertools/commons": "^2.4.0"
29
29
  },
30
30
  "main": "./lib/cjs/index.js",
31
31
  "types": "./lib/cjs/index.d.ts",