@takeshape/errors 11.49.0 → 11.50.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.
@@ -0,0 +1,18 @@
1
+ import { BaseError } from './base-error';
2
+ export declare enum GuardrailErrorCode {
3
+ GeneralError = "GENERAL_ERROR",
4
+ InvalidData = "INVALID_DATA",
5
+ InvalidResponse = "INVALID_RESPONSE",
6
+ SchemaError = "SCHEMA_ERROR",
7
+ SchemaVersionMismatch = "SCHEMA_VERSION_MISMATCH",
8
+ NotEntitled = "NOT_ENTITLED"
9
+ }
10
+ export type GuardrailErrorOptions = {
11
+ reportToSentry?: boolean;
12
+ code: GuardrailErrorCode;
13
+ originalError?: unknown;
14
+ };
15
+ export declare class GuardrailError extends BaseError {
16
+ constructor(message?: string, options?: GuardrailErrorOptions);
17
+ }
18
+ //# sourceMappingURL=guardrails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guardrails.d.ts","sourceRoot":"","sources":["../../src/guardrails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAY,kBAAkB;IAC5B,YAAY,kBAAkB;IAC9B,WAAW,iBAAiB;IAC5B,eAAe,qBAAqB;IACpC,WAAW,iBAAiB;IAC5B,qBAAqB,4BAA4B;IACjD,WAAW,iBAAiB;CAC7B;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,kBAAkB,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,qBAAa,cAAe,SAAQ,SAAS;gBAEzC,OAAO,SAAqB,EAC5B,OAAO,GAAE,qBAAiE;CAW7E"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GuardrailErrorCode = exports.GuardrailError = void 0;
7
+ var _baseError = require("./base-error");
8
+ let GuardrailErrorCode = exports.GuardrailErrorCode = /*#__PURE__*/function (GuardrailErrorCode) {
9
+ GuardrailErrorCode["GeneralError"] = "GENERAL_ERROR";
10
+ GuardrailErrorCode["InvalidData"] = "INVALID_DATA";
11
+ GuardrailErrorCode["InvalidResponse"] = "INVALID_RESPONSE";
12
+ GuardrailErrorCode["SchemaError"] = "SCHEMA_ERROR";
13
+ GuardrailErrorCode["SchemaVersionMismatch"] = "SCHEMA_VERSION_MISMATCH";
14
+ GuardrailErrorCode["NotEntitled"] = "NOT_ENTITLED";
15
+ return GuardrailErrorCode;
16
+ }({});
17
+ class GuardrailError extends _baseError.BaseError {
18
+ constructor(message = 'Guardrail error.', options = {
19
+ code: GuardrailErrorCode.GeneralError
20
+ }) {
21
+ const {
22
+ code,
23
+ reportToSentry,
24
+ originalError
25
+ } = options;
26
+ super(message, {
27
+ reportToSentry,
28
+ extensions: {
29
+ code,
30
+ originalError
31
+ }
32
+ });
33
+ }
34
+ }
35
+ exports.GuardrailError = GuardrailError;
package/dist/index.d.ts CHANGED
@@ -26,4 +26,5 @@ export * from './branch-merge-error';
26
26
  export * from './schema-build';
27
27
  export * from './suspend';
28
28
  export * from './remote-graphql-schema';
29
+ export * from './guardrails';
29
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,Y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@ Object.keys(_remoteGraphqlSchema).forEach(function (key) {
310
310
  return _remoteGraphqlSchema[key];
311
311
  }
312
312
  });
313
+ });
314
+ var _guardrails = require("./guardrails");
315
+ Object.keys(_guardrails).forEach(function (key) {
316
+ if (key === "default" || key === "__esModule") return;
317
+ if (key in exports && exports[key] === _guardrails[key]) return;
318
+ Object.defineProperty(exports, key, {
319
+ enumerable: true,
320
+ get: function () {
321
+ return _guardrails[key];
322
+ }
323
+ });
313
324
  });
@@ -0,0 +1,28 @@
1
+ import { BaseError } from './base-error';
2
+ export let GuardrailErrorCode = /*#__PURE__*/function (GuardrailErrorCode) {
3
+ GuardrailErrorCode["GeneralError"] = "GENERAL_ERROR";
4
+ GuardrailErrorCode["InvalidData"] = "INVALID_DATA";
5
+ GuardrailErrorCode["InvalidResponse"] = "INVALID_RESPONSE";
6
+ GuardrailErrorCode["SchemaError"] = "SCHEMA_ERROR";
7
+ GuardrailErrorCode["SchemaVersionMismatch"] = "SCHEMA_VERSION_MISMATCH";
8
+ GuardrailErrorCode["NotEntitled"] = "NOT_ENTITLED";
9
+ return GuardrailErrorCode;
10
+ }({});
11
+ export class GuardrailError extends BaseError {
12
+ constructor(message = 'Guardrail error.', options = {
13
+ code: GuardrailErrorCode.GeneralError
14
+ }) {
15
+ const {
16
+ code,
17
+ reportToSentry,
18
+ originalError
19
+ } = options;
20
+ super(message, {
21
+ reportToSentry,
22
+ extensions: {
23
+ code,
24
+ originalError
25
+ }
26
+ });
27
+ }
28
+ }
package/es/index.js CHANGED
@@ -26,4 +26,5 @@ export * from './payment-method';
26
26
  export * from './branch-merge-error';
27
27
  export * from './schema-build';
28
28
  export * from './suspend';
29
- export * from './remote-graphql-schema';
29
+ export * from './remote-graphql-schema';
30
+ export * from './guardrails';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/errors",
3
- "version": "11.49.0",
3
+ "version": "11.50.0",
4
4
  "description": "Custom error objects.",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {