@snyk/error-catalog-nodejs-public 5.0.0 → 5.0.2

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 (36) hide show
  1. package/package.json +1 -1
  2. package/src/catalogs/Fix-error-catalog.d.ts +10 -0
  3. package/src/catalogs/Fix-error-catalog.js +21 -0
  4. package/src/catalogs/Fix-error-catalog.js.map +1 -1
  5. package/src/catalogs/IsolatedBuilds-error-catalog.d.ts +3 -0
  6. package/src/catalogs/IsolatedBuilds-error-catalog.js +7 -0
  7. package/src/catalogs/IsolatedBuilds-error-catalog.js.map +1 -1
  8. package/src/catalogs/OpenAPI-error-catalog.d.ts +8 -0
  9. package/src/catalogs/OpenAPI-error-catalog.js +17 -0
  10. package/src/catalogs/OpenAPI-error-catalog.js.map +1 -1
  11. package/src/catalogs/OpenSourceEcosystems-error-catalog.d.ts +52 -0
  12. package/src/catalogs/OpenSourceEcosystems-error-catalog.js +105 -0
  13. package/src/catalogs/OpenSourceEcosystems-error-catalog.js.map +1 -1
  14. package/src/catalogs/OpenSourceProjectIssues-error-catalog.d.ts +5 -0
  15. package/src/catalogs/OpenSourceProjectIssues-error-catalog.js +11 -0
  16. package/src/catalogs/OpenSourceProjectIssues-error-catalog.js.map +1 -1
  17. package/src/catalogs/OpenSourceProjectSnapshots-error-catalog.d.ts +5 -0
  18. package/src/catalogs/OpenSourceProjectSnapshots-error-catalog.js +11 -0
  19. package/src/catalogs/OpenSourceProjectSnapshots-error-catalog.js.map +1 -1
  20. package/src/catalogs/OpenSourceUnmanaged-error-catalog.d.ts +2 -0
  21. package/src/catalogs/OpenSourceUnmanaged-error-catalog.js +5 -0
  22. package/src/catalogs/OpenSourceUnmanaged-error-catalog.js.map +1 -1
  23. package/src/catalogs/PurlVulnerabilityFetching-error-catalog.d.ts +20 -0
  24. package/src/catalogs/PurlVulnerabilityFetching-error-catalog.js +41 -0
  25. package/src/catalogs/PurlVulnerabilityFetching-error-catalog.js.map +1 -1
  26. package/src/catalogs/SbomExport-error-catalog.d.ts +9 -0
  27. package/src/catalogs/SbomExport-error-catalog.js +19 -0
  28. package/src/catalogs/SbomExport-error-catalog.js.map +1 -1
  29. package/src/catalogs/Snyk-error-catalog.d.ts +6 -0
  30. package/src/catalogs/Snyk-error-catalog.js +13 -0
  31. package/src/catalogs/Snyk-error-catalog.js.map +1 -1
  32. package/src/problem-error.js +2 -1
  33. package/src/problem-error.js.map +1 -1
  34. package/src/types.d.ts +9 -1
  35. package/src/types.js +7 -1
  36. package/src/types.js.map +1 -1
@@ -21,6 +21,7 @@ import { ProblemError } from '../problem-error';
21
21
  * @summary Service temporarily throttled
22
22
  * @category Snyk
23
23
  * @param {string} details the specific details that causes this error
24
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
24
25
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
25
26
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
26
27
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -38,6 +39,7 @@ export declare class TooManyRequestsError extends ProblemError {
38
39
  * @summary Server error response
39
40
  * @category Snyk
40
41
  * @param {string} details the specific details that causes this error
42
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
41
43
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
42
44
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
43
45
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -52,6 +54,7 @@ export declare class NotImplementedError extends ProblemError {
52
54
  * @summary Client request cannot be processed
53
55
  * @category Snyk
54
56
  * @param {string} details the specific details that causes this error
57
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
55
58
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
56
59
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
57
60
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -69,6 +72,7 @@ export declare class BadRequestError extends ProblemError {
69
72
  * @summary Server communication error
70
73
  * @category Snyk
71
74
  * @param {string} details the specific details that causes this error
75
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
72
76
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
73
77
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
74
78
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -83,6 +87,7 @@ export declare class TimeoutError extends ProblemError {
83
87
  * @summary Authentication error
84
88
  * @category Snyk
85
89
  * @param {string} details the specific details that causes this error
90
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
86
91
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
87
92
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
88
93
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -100,6 +105,7 @@ export declare class UnauthorisedError extends ProblemError {
100
105
  * @summary Request not fulfilled due to server error
101
106
  * @category Snyk
102
107
  * @param {string} details the specific details that causes this error
108
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
103
109
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
104
110
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
105
111
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -16,6 +16,7 @@
16
16
  "use strict";
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.ServerError = exports.UnauthorisedError = exports.TimeoutError = exports.BadRequestError = exports.NotImplementedError = exports.TooManyRequestsError = void 0;
19
+ const types_1 = require("../types");
19
20
  const problem_error_1 = require("../problem-error");
20
21
  /**
21
22
  * @class
@@ -24,6 +25,7 @@ const problem_error_1 = require("../problem-error");
24
25
  * @summary Service temporarily throttled
25
26
  * @category Snyk
26
27
  * @param {string} details the specific details that causes this error
28
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
27
29
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
28
30
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
29
31
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -36,6 +38,7 @@ class TooManyRequestsError extends problem_error_1.ProblemError {
36
38
  status: 429,
37
39
  errorCode: 'SNYK-0001',
38
40
  level: 'warn',
41
+ classification: types_1.Classification.ACTIONABLE,
39
42
  instance,
40
43
  }, details, Object.assign({ links: [] }, additionalData), cause);
41
44
  this.name = this.constructor.name;
@@ -52,6 +55,7 @@ exports.TooManyRequestsError = TooManyRequestsError;
52
55
  * @summary Server error response
53
56
  * @category Snyk
54
57
  * @param {string} details the specific details that causes this error
58
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
55
59
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
56
60
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
57
61
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -64,6 +68,7 @@ class NotImplementedError extends problem_error_1.ProblemError {
64
68
  status: 501,
65
69
  errorCode: 'SNYK-0002',
66
70
  level: 'error',
71
+ classification: types_1.Classification.UNSUPPORTED,
67
72
  instance,
68
73
  }, details, Object.assign({ links: [
69
74
  'https://docs.snyk.io/snyk-api-info',
@@ -79,6 +84,7 @@ exports.NotImplementedError = NotImplementedError;
79
84
  * @summary Client request cannot be processed
80
85
  * @category Snyk
81
86
  * @param {string} details the specific details that causes this error
87
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
82
88
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
83
89
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
84
90
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -91,6 +97,7 @@ class BadRequestError extends problem_error_1.ProblemError {
91
97
  status: 400,
92
98
  errorCode: 'SNYK-0003',
93
99
  level: 'error',
100
+ classification: types_1.Classification.ACTIONABLE,
94
101
  instance,
95
102
  }, details, Object.assign({ links: [] }, additionalData), cause);
96
103
  this.name = this.constructor.name;
@@ -107,6 +114,7 @@ exports.BadRequestError = BadRequestError;
107
114
  * @summary Server communication error
108
115
  * @category Snyk
109
116
  * @param {string} details the specific details that causes this error
117
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
110
118
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
111
119
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
112
120
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -119,6 +127,7 @@ class TimeoutError extends problem_error_1.ProblemError {
119
127
  status: 504,
120
128
  errorCode: 'SNYK-0004',
121
129
  level: 'error',
130
+ classification: types_1.Classification.UNEXPECTED,
122
131
  instance,
123
132
  }, details, Object.assign({ links: [
124
133
  'https://status.snyk.io/',
@@ -134,6 +143,7 @@ exports.TimeoutError = TimeoutError;
134
143
  * @summary Authentication error
135
144
  * @category Snyk
136
145
  * @param {string} details the specific details that causes this error
146
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
137
147
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
138
148
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
139
149
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -146,6 +156,7 @@ class UnauthorisedError extends problem_error_1.ProblemError {
146
156
  status: 401,
147
157
  errorCode: 'SNYK-0005',
148
158
  level: 'error',
159
+ classification: types_1.Classification.ACTIONABLE,
149
160
  instance,
150
161
  }, details, Object.assign({ links: [] }, additionalData), cause);
151
162
  this.name = this.constructor.name;
@@ -162,6 +173,7 @@ exports.UnauthorisedError = UnauthorisedError;
162
173
  * @summary Request not fulfilled due to server error
163
174
  * @category Snyk
164
175
  * @param {string} details the specific details that causes this error
176
+ * @param {Classification} classification the error classification determining if the error is user-actionable or not
165
177
  * @param {Record<string, any>} [additionalData] a collection of relevant data specific to this error
166
178
  * @param {Error} [cause] the `Error` type that caused this error to be thrown
167
179
  * @param {string} [instance] the instance to use for this error. Overrides 'instance' metadata
@@ -174,6 +186,7 @@ class ServerError extends problem_error_1.ProblemError {
174
186
  status: 500,
175
187
  errorCode: 'SNYK-9999',
176
188
  level: 'error',
189
+ classification: types_1.Classification.UNEXPECTED,
177
190
  instance,
178
191
  }, details, Object.assign({ links: [
179
192
  'https://status.snyk.io/',
@@ -1 +1 @@
1
- {"version":3,"file":"Snyk-error-catalog.js","sourceRoot":"","sources":["../../../../../packages/error-catalog-nodejs-public/src/catalogs/Snyk-error-catalog.ts"],"names":[],"mappings":";;;AAAA,oDAAgD;AAEhD;;;;;;;;;;GAUG;AACH,MAAa,oBAAqB,SAAQ,4BAAY;IACpD,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,+BAA+B;YACtC,IAAI,EAAE,wDAAwD;YAC9D,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,MAAM;YACb,QAAQ;SACT,EACD,OAAO,kBAEL,KAAK,EAAE,EAAE,IACN,cAAc,GAEnB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AAzBD,oDAyBC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,mBAAoB,SAAQ,4BAAY;IACnD,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,uBAAuB;YAC9B,IAAI,EAAE,wDAAwD;YAC9D,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,OAAO;YACd,QAAQ;SACT,EACD,OAAO,kBAEL,KAAK,EAAE;gBACP,oCAAoC;aACnC,IACE,cAAc,GAEnB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AA3BD,kDA2BC;AAED;;;;;;;;;;GAUG;AACH,MAAa,eAAgB,SAAQ,4BAAY;IAC/C,YACI,OAAe,EACf,cAAoC,EACpC,KAA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AAED;;;;;;;;;;;;;GAaG;AACH,MAAa,WAAY,SAAQ,4BAAY;IAC3C,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,4CAA4C;YACnD,IAAI,EAAE,wDAAwD;YAC9D,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,OAAO;YACd,QAAQ;SACT,EACD,OAAO,kBAEL,KAAK,EAAE;gBACP,yBAAyB;aACxB,IACE,cAAc,GAEnB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AA3BD,kCA2BC"}
1
+ {"version":3,"file":"Snyk-error-catalog.js","sourceRoot":"","sources":["../../../../../packages/error-catalog-nodejs-public/src/catalogs/Snyk-error-catalog.ts"],"names":[],"mappings":";;;AAAA,oCAA0C;AAC1C,oDAAgD;AAEhD;;;;;;;;;;;GAWG;AACH,MAAa,oBAAqB,SAAQ,4BAAY;IACpD,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,+BAA+B;YACtC,IAAI,EAAE,wDAAwD;YAC9D,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,MAAM;YACb,cAAc,EAAE,sBAAc,CAAC,UAAU;YACzC,QAAQ;SACT,EACD,OAAO,kBAEL,KAAK,EAAE,EAAE,IACN,cAAc,GAEnB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AA1BD,oDA0BC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAoB,SAAQ,4BAAY;IACnD,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,uBAAuB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AAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AA5BD,oCA4BC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,iBAAkB,SAAQ,4BAAY;IACjD,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,wDAAwD;YAC9D,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,OAAO;YACd,cAAc,EAAE,sBAAc,CAAC,UAAU;YACzC,QAAQ;SACT,EACD,OAAO,kBAEL,KAAK,EAAE,EAAE,IACN,cAAc,GAEnB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AA1BD,8CA0BC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAa,WAAY,SAAQ,4BAAY;IAC3C,YACI,OAAe,EACf,cAAoC,EACpC,KAAa,EACb,QAAiB;QAEnB,KAAK,CACH;YACE,KAAK,EAAE,4CAA4C;YACnD,IAAI,EAAE,wDAAwD;YAC9D,MAAM,EAAE,GAAG;YACX,SAAS,EAAE,WAAW;YACtB,KAAK,EAAE,OAAO;YACd,cAAc,EAAE,sBAAc,CAAC,UAAU;YACzC,QAAQ;SACT,EACD,OAAO,kBAEL,KAAK,EAAE;gBACP,yBAAyB;aACxB,IACE,cAAc,GAEnB,KAAK,CACN,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AA5BD,kCA4BC"}
@@ -47,7 +47,7 @@ class ProblemError extends Error {
47
47
  }
48
48
  }
49
49
  toProblemJson(instance) {
50
- const payload = Object.assign({ type: this.metadata.type, title: this.metadata.title, status: this.metadata.status, errorCode: this.metadata.errorCode, detail: this.detail, instance }, this.additionalData);
50
+ const payload = Object.assign({ type: this.metadata.type, title: this.metadata.title, status: this.metadata.status, errorCode: this.metadata.errorCode, detail: this.detail, classification: this.metadata.classification, instance }, this.additionalData);
51
51
  return new types_1.ProblemJson(payload);
52
52
  }
53
53
  /**
@@ -72,6 +72,7 @@ class ProblemError extends Error {
72
72
  code: this.metadata.errorCode,
73
73
  title: this.metadata.title,
74
74
  detail: this.detail,
75
+ classification: this.metadata.classification,
75
76
  meta: Object.assign({}, this.additionalData),
76
77
  };
77
78
  if (source) {
@@ -1 +1 @@
1
- {"version":3,"file":"problem-error.js","sourceRoot":"","sources":["../../../../packages/error-catalog-nodejs-public/src/problem-error.ts"],"names":[],"mappings":";;;AAAA,mCAQiB;AACjB,+BAA0B;AAC1B,iCAAiD;AAEjD,MAAa,YAAa,SAAQ,KAAK;IAOrC,YACkB,QAAuB,EACvB,MAAc,EACd,cAAoC,EACpC,KAAa;QAE7B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QALN,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAQ;QACd,mBAAc,GAAd,cAAc,CAAsB;QACpC,UAAK,GAAL,KAAK,CAAQ;QAR/B,sLAAsL;QACtL,qJAAqJ;QACrI,wBAAmB,GAAG,IAAI,CAAC;QASzC,IAAI,cAAc,IAAI,cAAc,CAAC,iBAAiB,CAAC,EAAE;YACvD,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;SAC7C;aAAM;YACL,IAAI,CAAC,EAAE,GAAG,IAAA,SAAE,GAAE,CAAC;SAChB;IACH,CAAC;IAED,MAAM,CAAC,QAAgB,EAAE,UAAwB;QAC/C,QAAQ,UAAU,EAAE;YAClB,KAAK,oBAAY,CAAC,OAAO;gBACvB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAClC,KAAK,oBAAY,CAAC,WAAW;gBAC3B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACtC;gBACE,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,CAAC,QAAiB;QACzB,MAAM,OAAO,GAAkB;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK;aACf;YACD,MAAM,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;SAC9C,CAAC;QAEF,OAAO,IAAI,eAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF;AA1FD,oCA0FC"}
1
+ {"version":3,"file":"problem-error.js","sourceRoot":"","sources":["../../../../packages/error-catalog-nodejs-public/src/problem-error.ts"],"names":[],"mappings":";;;AAAA,mCAQiB;AACjB,+BAA0B;AAC1B,iCAAiD;AAEjD,MAAa,YAAa,SAAQ,KAAK;IAOrC,YACkB,QAAuB,EACvB,MAAc,EACd,cAAoC,EACpC,KAAa;QAE7B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QALN,aAAQ,GAAR,QAAQ,CAAe;QACvB,WAAM,GAAN,MAAM,CAAQ;QACd,mBAAc,GAAd,cAAc,CAAsB;QACpC,UAAK,GAAL,KAAK,CAAQ;QAR/B,sLAAsL;QACtL,qJAAqJ;QACrI,wBAAmB,GAAG,IAAI,CAAC;QASzC,IAAI,cAAc,IAAI,cAAc,CAAC,iBAAiB,CAAC,EAAE;YACvD,IAAI,CAAC,EAAE,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;SAC7C;aAAM;YACL,IAAI,CAAC,EAAE,GAAG,IAAA,SAAE,GAAE,CAAC;SAChB;IACH,CAAC;IAED,MAAM,CAAC,QAAgB,EAAE,UAAwB;QAC/C,QAAQ,UAAU,EAAE;YAClB,KAAK,oBAAY,CAAC,OAAO;gBACvB,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAClC,KAAK,oBAAY,CAAC,WAAW;gBAC3B,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACtC;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SAC1C;IACH,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,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,SAAS,CAAC,QAAiB;QACzB,MAAM,OAAO,GAAkB;YAC7B,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK;aACf;YACD,MAAM,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;SAC9C,CAAC;QAEF,OAAO,IAAI,eAAO,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF;AA5FD,oCA4FC"}
package/src/types.d.ts CHANGED
@@ -13,6 +13,11 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export declare enum Classification {
17
+ UNEXPECTED = "UNEXPECTED",
18
+ ACTIONABLE = "ACTIONABLE",
19
+ UNSUPPORTED = "UNSUPPORTED"
20
+ }
16
21
  export type Problem = {
17
22
  /** A URI reference that identifies the problem type. This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type. */
18
23
  type: string;
@@ -28,10 +33,12 @@ export type Problem = {
28
33
  instance?: string;
29
34
  /** The level of this error */
30
35
  level?: string;
36
+ /** Determining whether this error is a failure of Snyk to handle an operation that it was expected to, or if it derives from a requesting service producing something that cannot be handled. */
37
+ classification: Classification;
31
38
  /** Additional properties. */
32
39
  [x: string]: any;
33
40
  };
34
- export type ErrorMetadata = Pick<Problem, 'type' | 'title' | 'status' | 'errorCode' | 'level' | 'instance'>;
41
+ export type ErrorMetadata = Pick<Problem, 'type' | 'title' | 'status' | 'errorCode' | 'level' | 'instance' | 'classification'>;
35
42
  export declare enum ErrorFormats {
36
43
  JsonApi = 0,
37
44
  ProblemJson = 1
@@ -62,6 +69,7 @@ export type JsonApiErrorObject = {
62
69
  code: string;
63
70
  title: string;
64
71
  detail: string;
72
+ classification: Classification;
65
73
  source?: JsonApiErrorSource;
66
74
  meta?: {
67
75
  [x: string]: any;
package/src/types.js CHANGED
@@ -15,7 +15,13 @@
15
15
  */
16
16
  "use strict";
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.JsonApi = exports.ProblemJson = exports.ErrorFormats = void 0;
18
+ exports.JsonApi = exports.ProblemJson = exports.ErrorFormats = exports.Classification = void 0;
19
+ var Classification;
20
+ (function (Classification) {
21
+ Classification["UNEXPECTED"] = "UNEXPECTED";
22
+ Classification["ACTIONABLE"] = "ACTIONABLE";
23
+ Classification["UNSUPPORTED"] = "UNSUPPORTED";
24
+ })(Classification || (exports.Classification = Classification = {}));
19
25
  var ErrorFormats;
20
26
  (function (ErrorFormats) {
21
27
  ErrorFormats[ErrorFormats["JsonApi"] = 0] = "JsonApi";
package/src/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/error-catalog-nodejs-public/src/types.ts"],"names":[],"mappings":";;;AAwBA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,6DAAW,CAAA;AACb,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAQD,MAAa,WAAW;IACtB,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,OAAO;QACL,OAAO;YACL,cAAc,EAAE,2BAA2B;SAC5C,CAAC;IACJ,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAZD,kCAYC;AA6BD,MAAa,OAAO;IAClB,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;IAAG,CAAC;IAEvD,OAAO;QACL,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AATD,0BASC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../packages/error-catalog-nodejs-public/src/types.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,2CAAyB,CAAA;IACzB,2CAAyB,CAAA;IACzB,6CAA2B,CAAA;AAC7B,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAkCD,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,6DAAW,CAAA;AACb,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAQD,MAAa,WAAW;IACtB,YAA6B,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;IAAG,CAAC;IAEjD,OAAO;QACL,OAAO;YACL,cAAc,EAAE,2BAA2B;SAC5C,CAAC;IACJ,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAZD,kCAYC;AA8BD,MAAa,OAAO;IAClB,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;IAAG,CAAC;IAEvD,OAAO;QACL,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAVD,0BAUC"}