@webpieces/core-util 0.4.612 → 0.4.614

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/core-util",
3
- "version": "0.4.612",
3
+ "version": "0.4.614",
4
4
  "description": "Utility functions for WebPieces - works in browser and Node.js",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -63,7 +63,7 @@ export declare class HttpUnauthorizedError extends HttpError {
63
63
  /**
64
64
  * HttpTooManyRequestsError - 429 Too Many Requests.
65
65
  *
66
- * The one member of the HttpError ladder that never made it over from trytami. Without it, apps are
66
+ * The one member of the HttpError ladder that never made it over from the production service this ladder was ported from. Without it, apps are
67
67
  * forced back to `err.code === 429` — the exact untyped pattern this ladder exists to replace.
68
68
  */
69
69
  export declare class HttpTooManyRequestsError extends HttpError {
@@ -96,7 +96,7 @@ exports.HttpUnauthorizedError = HttpUnauthorizedError;
96
96
  /**
97
97
  * HttpTooManyRequestsError - 429 Too Many Requests.
98
98
  *
99
- * The one member of the HttpError ladder that never made it over from trytami. Without it, apps are
99
+ * The one member of the HttpError ladder that never made it over from the production service this ladder was ported from. Without it, apps are
100
100
  * forced back to `err.code === 429` — the exact untyped pattern this ladder exists to replace.
101
101
  */
102
102
  class HttpTooManyRequestsError extends HttpError {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACH,MAAa,aAAa;IACf,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,KAAK,CAAU;IACf,WAAW,CAAU;IACrB,IAAI,CAAU;IACd,eAAe,CAAU;IACzB,SAAS,CAAU;CAC7B;AARD,sCAQC;AAED;;;GAGG;AACH,MAAa,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAS;IACb,OAAO,CAAU;IACR,S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CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACJ;AAND,0DAMC;AAED;;;GAGG;AACH,MAAa,eAAgB,SAAQ,SAAS;IAG/B;IAFX,YACI,OAAe,EACR,cAAc,EAAE,EACvB,KAAa;QAEb,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAH/B,gBAAW,GAAX,WAAW,CAAK;QAIvB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACJ;AAVD,0CAUC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,aAAc,SAAQ,SAAS;IACjC,SAAS,CAAU;IAE1B,YAAY,OAAe,EAAE,SAAkB,EAAE,KAAa;QAC1D,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACJ;AATD,sCASC;AAED;;;;;;;;;;;GAWG;AACH,MAAa,YAAa,SAAQ,KAAK;IACnC,YAAY,OAAe,EAAE,KAAa;QACtC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACJ;AAND,oCAMC","sourcesContent":["/**\n * HTTP Error classes for webpieces-ts.\n * These errors are used throughout the framework for consistent error handling.\n */\n\n/**\n * ProtocolError - Data class for error response body.\n * This is what gets serialized and sent to the client.\n */\nexport class ProtocolError {\n public message?: string;\n public subType?: string;\n public field?: string;\n public waitSeconds?: number;\n public name?: string;\n public guiAlertMessage?: string;\n public errorCode?: string;\n}\n\n/**\n * HttpError - Base error class with HTTP status code.\n * All specific HTTP errors extend this class.\n */\nexport class HttpError extends Error {\n public code: number;\n public subType?: string;\n public readonly httpCause?: Error;\n\n constructor(\n message: string,\n code: number,\n subType?: string,\n cause?: Error,\n ) {\n super(message);\n this.code = code;\n this.subType = subType;\n this.httpCause = cause;\n }\n}\n\n// Error subtype constants\nexport const ENTITY_NOT_FOUND = 'EntityNotFoundError';\nexport const WRONG_LOGIN_TYPE = 'wrongLoginType';\nexport const WRONG_LOGIN = 'wronglogin';\nexport const NOT_APPROVED = 'notapproved';\nexport const EMAIL_NOT_CONFIRMED = 'email_not_confirmed';\nexport const WRONG_DOMAIN = 'wrongdomain';\nexport const WRONG_COMPANY = 'wrongcompany';\nexport const NO_REG_CODE = 'noregcode';\n\n/**\n * HttpNotFoundError - 404 Not Found.\n */\nexport class HttpNotFoundError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 404, undefined, cause);\n this.name = ENTITY_NOT_FOUND;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * EndpointNotFoundError - 404 for missing endpoints.\n */\nexport class EndpointNotFoundError extends HttpNotFoundError {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'EndpointNotFoundError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpBadRequestError - 400 Bad Request.\n * Used for validation errors with optional field and GUI message.\n */\nexport class HttpBadRequestError extends HttpError {\n public field?: string;\n public guiMessage?: string;\n\n constructor(message: string, field?: string, guiMessage?: string, cause?: Error) {\n super(message, 400, undefined, cause);\n this.name = 'BadRequest';\n this.field = field;\n this.guiMessage = guiMessage;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpUnauthorizedError - 401 Unauthorized.\n */\nexport class HttpUnauthorizedError extends HttpError {\n constructor(message: string, subType?: string, cause?: Error) {\n super(message, 401, subType, cause);\n this.name = 'Unauthorized';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpTooManyRequestsError - 429 Too Many Requests.\n *\n * The one member of the HttpError ladder that never made it over from trytami. Without it, apps are\n * forced back to `err.code === 429` — the exact untyped pattern this ladder exists to replace.\n */\nexport class HttpTooManyRequestsError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 429, undefined, cause);\n this.name = 'TooManyRequests';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpForbiddenError - 403 Forbidden.\n */\nexport class HttpForbiddenError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 403, undefined, cause);\n this.name = 'Forbidden';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpTimeoutError - 408 Request Timeout.\n */\nexport class HttpTimeoutError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 408, undefined, cause);\n this.name = 'Timeout';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpBadGatewayError - 502 Bad Gateway.\n */\nexport class HttpBadGatewayError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 502, undefined, cause);\n this.name = 'HttpBadGatewayError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpGatewayTimeoutError - 504 Gateway Timeout.\n * SHOULD NOT BE USED SERVER SIDE SINCE ALBs will return 504 and it will not be translated\n * to json body 'ProtocolError'.\n */\nexport class HttpGatewayTimeoutError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 504, undefined, cause);\n this.name = 'HttpGatewayTimeoutError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpInternalServerError - 500 Internal Server Error.\n */\nexport class HttpInternalServerError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 500, undefined, cause);\n this.name = 'InternalServerError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpVendorError - 598 Vendor Error.\n * Custom status code for vendor/external service errors with retry hint.\n */\nexport class HttpVendorError extends HttpError {\n constructor(\n message: string,\n public waitSeconds = 30,\n cause?: Error,\n ) {\n super(message, 598, undefined, cause);\n this.name = 'VendorError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpUserError - User validation error with 2xx status code.\n *\n * Uses HTTP 266 (non-standard 2xx code) intentionally because:\n * 1. User validation errors are \"successful\" from server perspective - user just made a mistake\n * 2. Browser DevTools show 4xx/5xx codes in RED, which is confusing for user validation\n * 3. Allows error to propagate up the stack via throw without triggering error monitoring\n * 4. Avoids polluting logs with \"errors\" that are actually expected user behavior\n *\n * This is a deliberate design pattern - do NOT change to 4xx codes.\n * Examples: \"Email already exists\", \"Invalid password format\", \"Required field missing\"\n */\nexport class HttpUserError extends HttpError {\n public errorCode?: string;\n\n constructor(message: string, errorCode?: string, cause?: Error) {\n super(message, 266, 'USER_ERROR', cause);\n this.name = 'UserError';\n this.errorCode = errorCode;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * OfflineError - the request never reached a server.\n *\n * Offline, DNS failure, connection refused, CORS preflight rejected: `fetch` itself rejected, so no\n * Response — and therefore no HTTP status — ever existed. That is precisely why this extends `Error`\n * and NOT `HttpError`: an `HttpError` carries a `code` and means \"the server replied with a failure\",\n * a different situation a caller usually retries differently. Subclassing it would give this a bogus\n * status and make it match `instanceof HttpError` ladders that must not catch a transport reject.\n *\n * The original failure (a raw `TypeError: Failed to fetch`, or undici's coded reject) is always\n * preserved as `cause`, so a caller that wants the underlying detail can still reach it.\n */\nexport class OfflineError extends Error {\n constructor(message: string, cause?: Error) {\n super(message, { cause });\n this.name = 'OfflineError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util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AAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACJ;AAND,oCAMC","sourcesContent":["/**\n * HTTP Error classes for webpieces-ts.\n * These errors are used throughout the framework for consistent error handling.\n */\n\n/**\n * ProtocolError - Data class for error response body.\n * This is what gets serialized and sent to the client.\n */\nexport class ProtocolError {\n public message?: string;\n public subType?: string;\n public field?: string;\n public waitSeconds?: number;\n public name?: string;\n public guiAlertMessage?: string;\n public errorCode?: string;\n}\n\n/**\n * HttpError - Base error class with HTTP status code.\n * All specific HTTP errors extend this class.\n */\nexport class HttpError extends Error {\n public code: number;\n public subType?: string;\n public readonly httpCause?: Error;\n\n constructor(\n message: string,\n code: number,\n subType?: string,\n cause?: Error,\n ) {\n super(message);\n this.code = code;\n this.subType = subType;\n this.httpCause = cause;\n }\n}\n\n// Error subtype constants\nexport const ENTITY_NOT_FOUND = 'EntityNotFoundError';\nexport const WRONG_LOGIN_TYPE = 'wrongLoginType';\nexport const WRONG_LOGIN = 'wronglogin';\nexport const NOT_APPROVED = 'notapproved';\nexport const EMAIL_NOT_CONFIRMED = 'email_not_confirmed';\nexport const WRONG_DOMAIN = 'wrongdomain';\nexport const WRONG_COMPANY = 'wrongcompany';\nexport const NO_REG_CODE = 'noregcode';\n\n/**\n * HttpNotFoundError - 404 Not Found.\n */\nexport class HttpNotFoundError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 404, undefined, cause);\n this.name = ENTITY_NOT_FOUND;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * EndpointNotFoundError - 404 for missing endpoints.\n */\nexport class EndpointNotFoundError extends HttpNotFoundError {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'EndpointNotFoundError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpBadRequestError - 400 Bad Request.\n * Used for validation errors with optional field and GUI message.\n */\nexport class HttpBadRequestError extends HttpError {\n public field?: string;\n public guiMessage?: string;\n\n constructor(message: string, field?: string, guiMessage?: string, cause?: Error) {\n super(message, 400, undefined, cause);\n this.name = 'BadRequest';\n this.field = field;\n this.guiMessage = guiMessage;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpUnauthorizedError - 401 Unauthorized.\n */\nexport class HttpUnauthorizedError extends HttpError {\n constructor(message: string, subType?: string, cause?: Error) {\n super(message, 401, subType, cause);\n this.name = 'Unauthorized';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpTooManyRequestsError - 429 Too Many Requests.\n *\n * The one member of the HttpError ladder that never made it over from the production service this ladder was ported from. Without it, apps are\n * forced back to `err.code === 429` — the exact untyped pattern this ladder exists to replace.\n */\nexport class HttpTooManyRequestsError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 429, undefined, cause);\n this.name = 'TooManyRequests';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpForbiddenError - 403 Forbidden.\n */\nexport class HttpForbiddenError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 403, undefined, cause);\n this.name = 'Forbidden';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpTimeoutError - 408 Request Timeout.\n */\nexport class HttpTimeoutError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 408, undefined, cause);\n this.name = 'Timeout';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpBadGatewayError - 502 Bad Gateway.\n */\nexport class HttpBadGatewayError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 502, undefined, cause);\n this.name = 'HttpBadGatewayError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpGatewayTimeoutError - 504 Gateway Timeout.\n * SHOULD NOT BE USED SERVER SIDE SINCE ALBs will return 504 and it will not be translated\n * to json body 'ProtocolError'.\n */\nexport class HttpGatewayTimeoutError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 504, undefined, cause);\n this.name = 'HttpGatewayTimeoutError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpInternalServerError - 500 Internal Server Error.\n */\nexport class HttpInternalServerError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 500, undefined, cause);\n this.name = 'InternalServerError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpVendorError - 598 Vendor Error.\n * Custom status code for vendor/external service errors with retry hint.\n */\nexport class HttpVendorError extends HttpError {\n constructor(\n message: string,\n public waitSeconds = 30,\n cause?: Error,\n ) {\n super(message, 598, undefined, cause);\n this.name = 'VendorError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpUserError - User validation error with 2xx status code.\n *\n * Uses HTTP 266 (non-standard 2xx code) intentionally because:\n * 1. User validation errors are \"successful\" from server perspective - user just made a mistake\n * 2. Browser DevTools show 4xx/5xx codes in RED, which is confusing for user validation\n * 3. Allows error to propagate up the stack via throw without triggering error monitoring\n * 4. Avoids polluting logs with \"errors\" that are actually expected user behavior\n *\n * This is a deliberate design pattern - do NOT change to 4xx codes.\n * Examples: \"Email already exists\", \"Invalid password format\", \"Required field missing\"\n */\nexport class HttpUserError extends HttpError {\n public errorCode?: string;\n\n constructor(message: string, errorCode?: string, cause?: Error) {\n super(message, 266, 'USER_ERROR', cause);\n this.name = 'UserError';\n this.errorCode = errorCode;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * OfflineError - the request never reached a server.\n *\n * Offline, DNS failure, connection refused, CORS preflight rejected: `fetch` itself rejected, so no\n * Response — and therefore no HTTP status — ever existed. That is precisely why this extends `Error`\n * and NOT `HttpError`: an `HttpError` carries a `code` and means \"the server replied with a failure\",\n * a different situation a caller usually retries differently. Subclassing it would give this a bogus\n * status and make it match `instanceof HttpError` ladders that must not catch a transport reject.\n *\n * The original failure (a raw `TypeError: Failed to fetch`, or undici's coded reject) is always\n * preserved as `cause`, so a caller that wants the underlying detail can still reach it.\n */\nexport class OfflineError extends Error {\n constructor(message: string, cause?: Error) {\n super(message, { cause });\n this.name = 'OfflineError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n"]}