@unito/integration-sdk 1.0.21 → 1.0.22

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.
@@ -28,6 +28,9 @@ export function buildHttpError(responseStatus, message) {
28
28
  else if (responseStatus === 422) {
29
29
  httpError = new HttpErrors.UnprocessableEntityError(message);
30
30
  }
31
+ else if (responseStatus === 423) {
32
+ httpError = new HttpErrors.ProviderInstanceLockedError(message);
33
+ }
31
34
  else if (responseStatus === 429) {
32
35
  httpError = new HttpErrors.RateLimitExceededError(message);
33
36
  }
@@ -35,6 +35,8 @@ export declare class TimeoutError extends HttpError {
35
35
  }
36
36
  /**
37
37
  * Used to generate a 410 Resource Gone.
38
+ *
39
+ * @deprecated Use ProviderInstanceLockedError instead when the provider instance is locked or unavailable.
38
40
  */
39
41
  export declare class ResourceGoneError extends HttpError {
40
42
  constructor(message?: string);
@@ -45,6 +47,12 @@ export declare class ResourceGoneError extends HttpError {
45
47
  export declare class UnprocessableEntityError extends HttpError {
46
48
  constructor(message?: string);
47
49
  }
50
+ /**
51
+ * Used to generate a 423 Provider Instance Locked.
52
+ */
53
+ export declare class ProviderInstanceLockedError extends HttpError {
54
+ constructor(message?: string);
55
+ }
48
56
  /**
49
57
  * Used to generate a 429 Rate Limit Exceeded. Usually used when an operation triggers or would trigger a rate limit
50
58
  * error on the provider's side.
@@ -47,10 +47,12 @@ export class TimeoutError extends HttpError {
47
47
  }
48
48
  /**
49
49
  * Used to generate a 410 Resource Gone.
50
+ *
51
+ * @deprecated Use ProviderInstanceLockedError instead when the provider instance is locked or unavailable.
50
52
  */
51
53
  export class ResourceGoneError extends HttpError {
52
54
  constructor(message) {
53
- super(message || 'Resource gone or unavailable', 410);
55
+ super(message || 'Resource Gone', 410);
54
56
  }
55
57
  }
56
58
  /**
@@ -61,6 +63,14 @@ export class UnprocessableEntityError extends HttpError {
61
63
  super(message || 'Unprocessable Entity', 422);
62
64
  }
63
65
  }
66
+ /**
67
+ * Used to generate a 423 Provider Instance Locked.
68
+ */
69
+ export class ProviderInstanceLockedError extends HttpError {
70
+ constructor(message) {
71
+ super(message || 'Provider instance locked or unavailable', 423);
72
+ }
73
+ }
64
74
  /**
65
75
  * Used to generate a 429 Rate Limit Exceeded. Usually used when an operation triggers or would trigger a rate limit
66
76
  * error on the provider's side.
@@ -280,10 +280,12 @@ class TimeoutError extends HttpError {
280
280
  }
281
281
  /**
282
282
  * Used to generate a 410 Resource Gone.
283
+ *
284
+ * @deprecated Use ProviderInstanceLockedError instead when the provider instance is locked or unavailable.
283
285
  */
284
286
  class ResourceGoneError extends HttpError {
285
287
  constructor(message) {
286
- super(message || 'Resource gone or unavailable', 410);
288
+ super(message || 'Resource Gone', 410);
287
289
  }
288
290
  }
289
291
  /**
@@ -294,6 +296,14 @@ class UnprocessableEntityError extends HttpError {
294
296
  super(message || 'Unprocessable Entity', 422);
295
297
  }
296
298
  }
299
+ /**
300
+ * Used to generate a 423 Provider Instance Locked.
301
+ */
302
+ class ProviderInstanceLockedError extends HttpError {
303
+ constructor(message) {
304
+ super(message || 'Provider instance locked or unavailable', 423);
305
+ }
306
+ }
297
307
  /**
298
308
  * Used to generate a 429 Rate Limit Exceeded. Usually used when an operation triggers or would trigger a rate limit
299
309
  * error on the provider's side.
@@ -309,6 +319,7 @@ var httpErrors = /*#__PURE__*/Object.freeze({
309
319
  BadRequestError: BadRequestError,
310
320
  HttpError: HttpError,
311
321
  NotFoundError: NotFoundError,
322
+ ProviderInstanceLockedError: ProviderInstanceLockedError,
312
323
  RateLimitExceededError: RateLimitExceededError,
313
324
  ResourceGoneError: ResourceGoneError,
314
325
  TimeoutError: TimeoutError,
@@ -345,6 +356,9 @@ function buildHttpError(responseStatus, message) {
345
356
  else if (responseStatus === 422) {
346
357
  httpError = new UnprocessableEntityError(message);
347
358
  }
359
+ else if (responseStatus === 423) {
360
+ httpError = new ProviderInstanceLockedError(message);
361
+ }
348
362
  else if (responseStatus === 429) {
349
363
  httpError = new RateLimitExceededError(message);
350
364
  }
@@ -10,6 +10,7 @@ describe('handleErrorResponse', () => {
10
10
  assert.ok(errors.buildHttpError(408, 'timeout') instanceof httpErrors.TimeoutError);
11
11
  assert.ok(errors.buildHttpError(410, 'resource gone') instanceof httpErrors.ResourceGoneError);
12
12
  assert.ok(errors.buildHttpError(422, 'unprocessable entity') instanceof httpErrors.UnprocessableEntityError);
13
+ assert.ok(errors.buildHttpError(423, 'resource gone') instanceof httpErrors.ProviderInstanceLockedError);
13
14
  assert.ok(errors.buildHttpError(429, 'rate limit exceeded') instanceof httpErrors.RateLimitExceededError);
14
15
  assert.ok(errors.buildHttpError(500, 'internal server error') instanceof httpErrors.HttpError);
15
16
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-sdk",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Integration SDK",
5
5
  "type": "module",
6
6
  "types": "dist/src/index.d.ts",
package/src/errors.ts CHANGED
@@ -23,6 +23,8 @@ export function buildHttpError(responseStatus: number, message: string): HttpErr
23
23
  httpError = new HttpErrors.ResourceGoneError(message);
24
24
  } else if (responseStatus === 422) {
25
25
  httpError = new HttpErrors.UnprocessableEntityError(message);
26
+ } else if (responseStatus === 423) {
27
+ httpError = new HttpErrors.ProviderInstanceLockedError(message);
26
28
  } else if (responseStatus === 429) {
27
29
  httpError = new HttpErrors.RateLimitExceededError(message);
28
30
  } else {
package/src/httpErrors.ts CHANGED
@@ -53,10 +53,12 @@ export class TimeoutError extends HttpError {
53
53
 
54
54
  /**
55
55
  * Used to generate a 410 Resource Gone.
56
+ *
57
+ * @deprecated Use ProviderInstanceLockedError instead when the provider instance is locked or unavailable.
56
58
  */
57
59
  export class ResourceGoneError extends HttpError {
58
60
  constructor(message?: string) {
59
- super(message || 'Resource gone or unavailable', 410);
61
+ super(message || 'Resource Gone', 410);
60
62
  }
61
63
  }
62
64
 
@@ -69,6 +71,15 @@ export class UnprocessableEntityError extends HttpError {
69
71
  }
70
72
  }
71
73
 
74
+ /**
75
+ * Used to generate a 423 Provider Instance Locked.
76
+ */
77
+ export class ProviderInstanceLockedError extends HttpError {
78
+ constructor(message?: string) {
79
+ super(message || 'Provider instance locked or unavailable', 423);
80
+ }
81
+ }
82
+
72
83
  /**
73
84
  * Used to generate a 429 Rate Limit Exceeded. Usually used when an operation triggers or would trigger a rate limit
74
85
  * error on the provider's side.
@@ -11,6 +11,7 @@ describe('handleErrorResponse', () => {
11
11
  assert.ok(errors.buildHttpError(408, 'timeout') instanceof httpErrors.TimeoutError);
12
12
  assert.ok(errors.buildHttpError(410, 'resource gone') instanceof httpErrors.ResourceGoneError);
13
13
  assert.ok(errors.buildHttpError(422, 'unprocessable entity') instanceof httpErrors.UnprocessableEntityError);
14
+ assert.ok(errors.buildHttpError(423, 'resource gone') instanceof httpErrors.ProviderInstanceLockedError);
14
15
  assert.ok(errors.buildHttpError(429, 'rate limit exceeded') instanceof httpErrors.RateLimitExceededError);
15
16
  assert.ok(errors.buildHttpError(500, 'internal server error') instanceof httpErrors.HttpError);
16
17
  });