@marianmeres/http-utils 1.19.0 → 1.21.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
@@ -104,6 +104,7 @@ class HTTP_STATUS {
104
104
  static CONFLICT = HTTP_STATUS.ERROR_CLIENT.CONFLICT.CODE;
105
105
  static GONE = HTTP_STATUS.ERROR_CLIENT.GONE.CODE;
106
106
  static UNPROCESSABLE_CONTENT = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.CODE;
107
+ static TOO_MANY_REQUESTS = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.CODE;
107
108
  // 5xx
108
109
  static INTERNAL_SERVER_ERROR = HTTP_STATUS.ERROR_SERVER.INTERNAL_SERVER_ERROR.CODE;
109
110
  static NOT_IMPLEMENTED = HTTP_STATUS.ERROR_SERVER.NOT_IMPLEMENTED.CODE;
@@ -179,6 +180,11 @@ class UnprocessableContent extends HttpError {
179
180
  status = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.CODE;
180
181
  statusText = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.TEXT;
181
182
  }
183
+ class TooManyRequests extends HttpError {
184
+ name = 'HttpTooManyRequestsError';
185
+ status = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.CODE;
186
+ statusText = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.TEXT;
187
+ }
182
188
  class ImATeapot extends HttpError {
183
189
  name = 'HttpImATeapotError';
184
190
  status = HTTP_STATUS.ERROR_CLIENT.IM_A_TEAPOT.CODE;
@@ -218,6 +224,7 @@ const HTTP_ERROR = {
218
224
  Gone,
219
225
  ImATeapot,
220
226
  UnprocessableContent,
227
+ TooManyRequests,
221
228
  // server
222
229
  InternalServerError,
223
230
  NotImplemented,
@@ -235,6 +242,7 @@ const _wellKnownCtorMap = {
235
242
  '410': Gone,
236
243
  '418': ImATeapot,
237
244
  '422': UnprocessableContent,
245
+ '429': TooManyRequests,
238
246
  //
239
247
  '500': InternalServerError,
240
248
  '501': NotImplemented,
package/dist/index.js CHANGED
@@ -102,6 +102,7 @@ class HTTP_STATUS {
102
102
  static CONFLICT = HTTP_STATUS.ERROR_CLIENT.CONFLICT.CODE;
103
103
  static GONE = HTTP_STATUS.ERROR_CLIENT.GONE.CODE;
104
104
  static UNPROCESSABLE_CONTENT = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.CODE;
105
+ static TOO_MANY_REQUESTS = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.CODE;
105
106
  // 5xx
106
107
  static INTERNAL_SERVER_ERROR = HTTP_STATUS.ERROR_SERVER.INTERNAL_SERVER_ERROR.CODE;
107
108
  static NOT_IMPLEMENTED = HTTP_STATUS.ERROR_SERVER.NOT_IMPLEMENTED.CODE;
@@ -177,6 +178,11 @@ class UnprocessableContent extends HttpError {
177
178
  status = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.CODE;
178
179
  statusText = HTTP_STATUS.ERROR_CLIENT.UNPROCESSABLE_CONTENT.TEXT;
179
180
  }
181
+ class TooManyRequests extends HttpError {
182
+ name = 'HttpTooManyRequestsError';
183
+ status = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.CODE;
184
+ statusText = HTTP_STATUS.ERROR_CLIENT.TOO_MANY_REQUESTS.TEXT;
185
+ }
180
186
  class ImATeapot extends HttpError {
181
187
  name = 'HttpImATeapotError';
182
188
  status = HTTP_STATUS.ERROR_CLIENT.IM_A_TEAPOT.CODE;
@@ -216,6 +222,7 @@ const HTTP_ERROR = {
216
222
  Gone,
217
223
  ImATeapot,
218
224
  UnprocessableContent,
225
+ TooManyRequests,
219
226
  // server
220
227
  InternalServerError,
221
228
  NotImplemented,
@@ -233,6 +240,7 @@ const _wellKnownCtorMap = {
233
240
  '410': Gone,
234
241
  '418': ImATeapot,
235
242
  '422': UnprocessableContent,
243
+ '429': TooManyRequests,
236
244
  //
237
245
  '500': InternalServerError,
238
246
  '501': NotImplemented,
package/dist/status.d.ts CHANGED
@@ -271,6 +271,7 @@ export declare class HTTP_STATUS {
271
271
  static readonly CONFLICT: number;
272
272
  static readonly GONE: number;
273
273
  static readonly UNPROCESSABLE_CONTENT: number;
274
+ static readonly TOO_MANY_REQUESTS: number;
274
275
  static readonly INTERNAL_SERVER_ERROR: number;
275
276
  static readonly NOT_IMPLEMENTED: number;
276
277
  static readonly SERVICE_UNAVAILABLE: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/http-utils",
3
- "version": "1.19.0",
3
+ "version": "1.21.0",
4
4
  "description": "Misc DRY http fetch related helpers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",