@marianmeres/http-utils 1.19.0 → 1.20.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.
package/dist/error.d.ts CHANGED
@@ -49,6 +49,11 @@ declare class UnprocessableContent extends HttpError {
49
49
  status: number;
50
50
  statusText: string;
51
51
  }
52
+ declare class TooManyRequests extends HttpError {
53
+ name: string;
54
+ status: number;
55
+ statusText: string;
56
+ }
52
57
  declare class ImATeapot extends HttpError {
53
58
  name: string;
54
59
  status: number;
@@ -84,6 +89,7 @@ export declare const HTTP_ERROR: {
84
89
  Gone: typeof Gone;
85
90
  ImATeapot: typeof ImATeapot;
86
91
  UnprocessableContent: typeof UnprocessableContent;
92
+ TooManyRequests: typeof TooManyRequests;
87
93
  InternalServerError: typeof InternalServerError;
88
94
  NotImplemented: typeof NotImplemented;
89
95
  BadGateway: typeof BadGateway;
package/dist/index.cjs CHANGED
@@ -179,6 +179,11 @@ class UnprocessableContent extends HttpError {
179
179
  status = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.CODE;
180
180
  statusText = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.TEXT;
181
181
  }
182
+ class TooManyRequests extends HttpError {
183
+ name = 'HttpTooManyRequestsError';
184
+ status = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.CODE;
185
+ statusText = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.TEXT;
186
+ }
182
187
  class ImATeapot extends HttpError {
183
188
  name = 'HttpImATeapotError';
184
189
  status = HTTP_STATUS.ERROR_CLIENT.IM_A_TEAPOT.CODE;
@@ -218,6 +223,7 @@ const HTTP_ERROR = {
218
223
  Gone,
219
224
  ImATeapot,
220
225
  UnprocessableContent,
226
+ TooManyRequests,
221
227
  // server
222
228
  InternalServerError,
223
229
  NotImplemented,
@@ -235,6 +241,7 @@ const _wellKnownCtorMap = {
235
241
  '410': Gone,
236
242
  '418': ImATeapot,
237
243
  '422': UnprocessableContent,
244
+ '429': TooManyRequests,
238
245
  //
239
246
  '500': InternalServerError,
240
247
  '501': NotImplemented,
package/dist/index.js CHANGED
@@ -177,6 +177,11 @@ class UnprocessableContent extends HttpError {
177
177
  status = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.CODE;
178
178
  statusText = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.TEXT;
179
179
  }
180
+ class TooManyRequests extends HttpError {
181
+ name = 'HttpTooManyRequestsError';
182
+ status = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.CODE;
183
+ statusText = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.TEXT;
184
+ }
180
185
  class ImATeapot extends HttpError {
181
186
  name = 'HttpImATeapotError';
182
187
  status = HTTP_STATUS.ERROR_CLIENT.IM_A_TEAPOT.CODE;
@@ -216,6 +221,7 @@ const HTTP_ERROR = {
216
221
  Gone,
217
222
  ImATeapot,
218
223
  UnprocessableContent,
224
+ TooManyRequests,
219
225
  // server
220
226
  InternalServerError,
221
227
  NotImplemented,
@@ -233,6 +239,7 @@ const _wellKnownCtorMap = {
233
239
  '410': Gone,
234
240
  '418': ImATeapot,
235
241
  '422': UnprocessableContent,
242
+ '429': TooManyRequests,
236
243
  //
237
244
  '500': InternalServerError,
238
245
  '501': NotImplemented,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/http-utils",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Misc DRY http fetch related helpers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",