@nhtio/encoder 0.1.0-master-ab456424 → 1.20251201.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.
@@ -146,7 +146,7 @@ const a = class a extends o {
146
146
  * @param version - The incompatible version string from the encoded data.
147
147
  */
148
148
  constructor(s) {
149
- const t = `Encoded data version ${s} is not compatible with the current version 0.1.0-master-ab456424.`;
149
+ const t = `Encoded data version ${s} is not compatible with the current version 1.20251201.0.`;
150
150
  super(t, {
151
151
  code: a.code,
152
152
  status: a.status
@@ -165,4 +165,4 @@ export {
165
165
  y as e,
166
166
  w as f
167
167
  };
168
- //# sourceMappingURL=exceptions-BHfZbUPp.mjs.map
168
+ //# sourceMappingURL=exceptions-BXzLxffe.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exceptions-BHfZbUPp.mjs","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Base exception class that extends the native Error class.\n * Provides a foundation for all custom exceptions with additional metadata\n * like error codes, status codes, and help descriptions.\n */\nexport class BaseException extends Error {\n /**\n * Define the error metadata as static properties to avoid\n * setting them repeatedly on the error instance\n */\n declare static help?: string\n declare static code?: string\n declare static status?: number\n declare static message?: string\n\n /**\n * Name of the class that raised the exception.\n */\n name: string\n\n /**\n * Optional help description for the error. You can use it to define additional\n * human readable information for the error.\n */\n declare help?: string\n\n /**\n * A machine readable error code. This will allow the error handling logic\n * to narrow down exceptions based upon the error code.\n */\n declare code?: string\n\n /**\n * A status code for the error. Usually helpful when converting errors\n * to HTTP responses.\n */\n status: number\n\n /**\n * Creates a new BaseException instance.\n *\n * @param message - The error message. If not provided, uses the static message from the constructor.\n * @param options - Additional options including error cause, code, and status.\n */\n constructor(message?: string, options?: ErrorOptions & { code?: string; status?: number }) {\n super(message, options)\n\n const ErrorConstructor = this.constructor as typeof BaseException\n\n this.name = ErrorConstructor.name\n this.message = message || ErrorConstructor.message || ''\n this.status = options?.status || ErrorConstructor.status || 500\n\n const code = options?.code || ErrorConstructor.code\n if (code !== undefined) {\n this.code = code\n }\n\n const help = ErrorConstructor.help\n if (help !== undefined) {\n this.help = help\n }\n\n Error.captureStackTrace(this, ErrorConstructor)\n }\n\n /**\n * Returns the constructor name for the Symbol.toStringTag property.\n *\n * @returns The name of the exception class.\n */\n get [Symbol.toStringTag]() {\n return this.constructor.name\n }\n\n /**\n * Returns a string representation of the exception.\n * Includes the error code in brackets if available.\n *\n * @returns A formatted string representation of the exception.\n */\n toString() {\n if (this.code) {\n return `${this.name} [${this.code}]: ${this.message}`\n }\n return `${this.name}: ${this.message}`\n }\n}\n\n/**\n * Exception thrown when a value cannot be encoded.\n * This indicates that the value type is not supported by the encoder.\n */\nexport class E_UNENCODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNENCODABLE_VALUE'\n\n /**\n * Creates a new E_UNENCODABLE_VALUE exception.\n *\n * @param value - The value that could not be encoded.\n */\n constructor(value: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_UNENCODABLE_VALUE.code,\n status: E_UNENCODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when encoding fails due to an underlying error.\n * This wraps the original error as the cause for better error tracing.\n */\nexport class E_ENCODING_FAILED extends BaseException {\n static status = 500\n static code = 'E_ENCODING_FAILED'\n\n /**\n * Creates a new E_ENCODING_FAILED exception.\n *\n * @param value - The value that failed to encode.\n * @param cause - The underlying error that caused the encoding to fail.\n */\n constructor(value: unknown, cause: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_ENCODING_FAILED.code,\n status: E_ENCODING_FAILED.status,\n cause,\n })\n }\n}\n\n/**\n * Exception thrown when a circular reference is detected during encoding.\n * Circular references cannot be encoded and must be avoided.\n */\nexport class E_CIRCULAR_REFERENCE extends BaseException {\n static status = 500\n static code = 'E_CIRCULAR_REFERENCE'\n\n /**\n * Creates a new E_CIRCULAR_REFERENCE exception.\n */\n constructor() {\n const message = `Circular reference detected.`\n super(message, {\n code: E_CIRCULAR_REFERENCE.code,\n status: E_CIRCULAR_REFERENCE.status,\n })\n }\n}\n\n/**\n * Exception thrown when a value with an unknown or unsupported type cannot be decoded.\n */\nexport class E_UNDECODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNDECODABLE_VALUE'\n\n /**\n * Creates a new E_UNDECODABLE_VALUE exception.\n *\n * @param type - The type string that could not be decoded.\n */\n constructor(type: string) {\n const message = `Value of type ${type} cannot be decoded.`\n super(message, {\n code: E_UNDECODABLE_VALUE.code,\n status: E_UNDECODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode a value that is not a valid encoded value.\n * This indicates the input string is not in the expected encoded format.\n */\nexport class E_NOT_AN_ENCODED_VALUE extends BaseException {\n static status = 500\n static code = 'E_NOT_AN_ENCODED_VALUE'\n\n /**\n * Creates a new E_NOT_AN_ENCODED_VALUE exception.\n *\n * @param value - The string value that is not a valid encoded value.\n */\n constructor(value: string) {\n const message = `Value \"${value}\" is not a valid encoded value.`\n super(message, {\n code: E_NOT_AN_ENCODED_VALUE.code,\n status: E_NOT_AN_ENCODED_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when an invalid version string is encountered.\n */\nexport class E_INVALID_VERSION extends BaseException {\n static status = 500\n static code = 'E_INVALID_VERSION'\n\n /**\n * Creates a new E_INVALID_VERSION exception.\n *\n * @param version - The invalid version string.\n */\n constructor(version: string) {\n const message = `Invalid version \"${version}\"`\n super(message, {\n code: E_INVALID_VERSION.code,\n status: E_INVALID_VERSION.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode data encoded with an incompatible version.\n * This typically occurs when the encoded data is from a newer version than the decoder supports.\n */\nexport class E_INCOMPATIBLE_VERSION extends BaseException {\n static status = 500\n static code = 'E_INCOMPATIBLE_VERSION'\n static help =\n 'This error indicates that the encoded value is from a version which is newer than the version of the decoder.'\n\n /**\n * Creates a new E_INCOMPATIBLE_VERSION exception.\n *\n * @param version - The incompatible version string from the encoded data.\n */\n constructor(version: string) {\n const message = `Encoded data version ${version} is not compatible with the current version ${__VERSION__}.`\n super(message, {\n code: E_INCOMPATIBLE_VERSION.code,\n status: E_INCOMPATIBLE_VERSION.status,\n })\n }\n}\n"],"names":["BaseException","message","options","__publicField","ErrorConstructor","code","help","_E_UNENCODABLE_VALUE","value","E_UNENCODABLE_VALUE","_E_ENCODING_FAILED","cause","E_ENCODING_FAILED","_E_CIRCULAR_REFERENCE","E_CIRCULAR_REFERENCE","_E_UNDECODABLE_VALUE","type","E_UNDECODABLE_VALUE","_E_NOT_AN_ENCODED_VALUE","E_NOT_AN_ENCODED_VALUE","_E_INVALID_VERSION","version","E_INVALID_VERSION","_E_INCOMPATIBLE_VERSION","E_INCOMPATIBLE_VERSION"],"mappings":";;;AAOO,MAAMA,UAAsB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuCvC,YAAYC,GAAkBC,GAA6D;AACzF,UAAMD,GAASC,CAAO;AA3BxB;AAAA;AAAA;AAAA,IAAAC,EAAA;AAkBA;AAAA;AAAA;AAAA;AAAA,IAAAA,EAAA;AAWE,UAAMC,IAAmB,KAAK;AAE9B,SAAK,OAAOA,EAAiB,MAC7B,KAAK,UAAUH,KAAWG,EAAiB,WAAW,IACtD,KAAK,UAASF,KAAA,gBAAAA,EAAS,WAAUE,EAAiB,UAAU;AAE5D,UAAMC,KAAOH,KAAA,gBAAAA,EAAS,SAAQE,EAAiB;AAC/C,IAAIC,MAAS,WACX,KAAK,OAAOA;AAGd,UAAMC,IAAOF,EAAiB;AAC9B,IAAIE,MAAS,WACX,KAAK,OAAOA,IAGd,MAAM,kBAAkB,MAAMF,CAAgB;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAK,OAAO,WAAW,IAAI;AACzB,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA;AAAA;AAAA;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ND;"}
1
+ {"version":3,"file":"exceptions-BXzLxffe.mjs","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Base exception class that extends the native Error class.\n * Provides a foundation for all custom exceptions with additional metadata\n * like error codes, status codes, and help descriptions.\n */\nexport class BaseException extends Error {\n /**\n * Define the error metadata as static properties to avoid\n * setting them repeatedly on the error instance\n */\n declare static help?: string\n declare static code?: string\n declare static status?: number\n declare static message?: string\n\n /**\n * Name of the class that raised the exception.\n */\n name: string\n\n /**\n * Optional help description for the error. You can use it to define additional\n * human readable information for the error.\n */\n declare help?: string\n\n /**\n * A machine readable error code. This will allow the error handling logic\n * to narrow down exceptions based upon the error code.\n */\n declare code?: string\n\n /**\n * A status code for the error. Usually helpful when converting errors\n * to HTTP responses.\n */\n status: number\n\n /**\n * Creates a new BaseException instance.\n *\n * @param message - The error message. If not provided, uses the static message from the constructor.\n * @param options - Additional options including error cause, code, and status.\n */\n constructor(message?: string, options?: ErrorOptions & { code?: string; status?: number }) {\n super(message, options)\n\n const ErrorConstructor = this.constructor as typeof BaseException\n\n this.name = ErrorConstructor.name\n this.message = message || ErrorConstructor.message || ''\n this.status = options?.status || ErrorConstructor.status || 500\n\n const code = options?.code || ErrorConstructor.code\n if (code !== undefined) {\n this.code = code\n }\n\n const help = ErrorConstructor.help\n if (help !== undefined) {\n this.help = help\n }\n\n Error.captureStackTrace(this, ErrorConstructor)\n }\n\n /**\n * Returns the constructor name for the Symbol.toStringTag property.\n *\n * @returns The name of the exception class.\n */\n get [Symbol.toStringTag]() {\n return this.constructor.name\n }\n\n /**\n * Returns a string representation of the exception.\n * Includes the error code in brackets if available.\n *\n * @returns A formatted string representation of the exception.\n */\n toString() {\n if (this.code) {\n return `${this.name} [${this.code}]: ${this.message}`\n }\n return `${this.name}: ${this.message}`\n }\n}\n\n/**\n * Exception thrown when a value cannot be encoded.\n * This indicates that the value type is not supported by the encoder.\n */\nexport class E_UNENCODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNENCODABLE_VALUE'\n\n /**\n * Creates a new E_UNENCODABLE_VALUE exception.\n *\n * @param value - The value that could not be encoded.\n */\n constructor(value: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_UNENCODABLE_VALUE.code,\n status: E_UNENCODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when encoding fails due to an underlying error.\n * This wraps the original error as the cause for better error tracing.\n */\nexport class E_ENCODING_FAILED extends BaseException {\n static status = 500\n static code = 'E_ENCODING_FAILED'\n\n /**\n * Creates a new E_ENCODING_FAILED exception.\n *\n * @param value - The value that failed to encode.\n * @param cause - The underlying error that caused the encoding to fail.\n */\n constructor(value: unknown, cause: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_ENCODING_FAILED.code,\n status: E_ENCODING_FAILED.status,\n cause,\n })\n }\n}\n\n/**\n * Exception thrown when a circular reference is detected during encoding.\n * Circular references cannot be encoded and must be avoided.\n */\nexport class E_CIRCULAR_REFERENCE extends BaseException {\n static status = 500\n static code = 'E_CIRCULAR_REFERENCE'\n\n /**\n * Creates a new E_CIRCULAR_REFERENCE exception.\n */\n constructor() {\n const message = `Circular reference detected.`\n super(message, {\n code: E_CIRCULAR_REFERENCE.code,\n status: E_CIRCULAR_REFERENCE.status,\n })\n }\n}\n\n/**\n * Exception thrown when a value with an unknown or unsupported type cannot be decoded.\n */\nexport class E_UNDECODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNDECODABLE_VALUE'\n\n /**\n * Creates a new E_UNDECODABLE_VALUE exception.\n *\n * @param type - The type string that could not be decoded.\n */\n constructor(type: string) {\n const message = `Value of type ${type} cannot be decoded.`\n super(message, {\n code: E_UNDECODABLE_VALUE.code,\n status: E_UNDECODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode a value that is not a valid encoded value.\n * This indicates the input string is not in the expected encoded format.\n */\nexport class E_NOT_AN_ENCODED_VALUE extends BaseException {\n static status = 500\n static code = 'E_NOT_AN_ENCODED_VALUE'\n\n /**\n * Creates a new E_NOT_AN_ENCODED_VALUE exception.\n *\n * @param value - The string value that is not a valid encoded value.\n */\n constructor(value: string) {\n const message = `Value \"${value}\" is not a valid encoded value.`\n super(message, {\n code: E_NOT_AN_ENCODED_VALUE.code,\n status: E_NOT_AN_ENCODED_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when an invalid version string is encountered.\n */\nexport class E_INVALID_VERSION extends BaseException {\n static status = 500\n static code = 'E_INVALID_VERSION'\n\n /**\n * Creates a new E_INVALID_VERSION exception.\n *\n * @param version - The invalid version string.\n */\n constructor(version: string) {\n const message = `Invalid version \"${version}\"`\n super(message, {\n code: E_INVALID_VERSION.code,\n status: E_INVALID_VERSION.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode data encoded with an incompatible version.\n * This typically occurs when the encoded data is from a newer version than the decoder supports.\n */\nexport class E_INCOMPATIBLE_VERSION extends BaseException {\n static status = 500\n static code = 'E_INCOMPATIBLE_VERSION'\n static help =\n 'This error indicates that the encoded value is from a version which is newer than the version of the decoder.'\n\n /**\n * Creates a new E_INCOMPATIBLE_VERSION exception.\n *\n * @param version - The incompatible version string from the encoded data.\n */\n constructor(version: string) {\n const message = `Encoded data version ${version} is not compatible with the current version ${__VERSION__}.`\n super(message, {\n code: E_INCOMPATIBLE_VERSION.code,\n status: E_INCOMPATIBLE_VERSION.status,\n })\n }\n}\n"],"names":["BaseException","message","options","__publicField","ErrorConstructor","code","help","_E_UNENCODABLE_VALUE","value","E_UNENCODABLE_VALUE","_E_ENCODING_FAILED","cause","E_ENCODING_FAILED","_E_CIRCULAR_REFERENCE","E_CIRCULAR_REFERENCE","_E_UNDECODABLE_VALUE","type","E_UNDECODABLE_VALUE","_E_NOT_AN_ENCODED_VALUE","E_NOT_AN_ENCODED_VALUE","_E_INVALID_VERSION","version","E_INVALID_VERSION","_E_INCOM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e,GACJ,UAAS,MAChBf,EAFWe,GAEJ,QAAO;AAFT,IAAMC,IAAND;AAqBA,MAAME,IAAN,MAAMA,UAA0BpB,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnD,YAAYqB,GAAiB;AAC3B,UAAMpB,IAAU,oBAAoBoB,CAAO;AAC3C,UAAMpB,GAAS;AAAA,MACb,MAAMmB,EAAkB;AAAA,MACxB,QAAQA,EAAkB;AAAA,IAAA,CAC3B;AAAA,EACH;AACF;AAfEjB,EADWiB,GACJ,UAAS,MAChBjB,EAFWiB,GAEJ,QAAO;AAFT,IAAME,IAANF;AAsBA,MAAMG,IAAN,MAAMA,UAA+BvB,EAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWxD,YAAYqB,GAAiB;AAC3B,UAAMpB,IAAU,wBAAwBoB,CAAO;AAC/C,UAAMpB,GAAS;AAAA,MACb,MAAMsB,EAAuB;AAAA,MAC7B,QAAQA,EAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;AAjBEpB,EADWoB,GACJ,UAAS,MAChBpB,EAFWoB,GAEJ,QAAO,2BACdpB,EAHWoB,GAGJ,QACL;AAJG,IAAMC,IAAND;"}
@@ -1,2 +1,2 @@
1
- "use strict";var S=Object.defineProperty;var k=(r,t,s)=>t in r?S(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var e=(r,t,s)=>k(r,typeof t!="symbol"?t+"":t,s);class a extends Error{constructor(s,c){super(s,c);e(this,"name");e(this,"status");const d=this.constructor;this.name=d.name,this.message=s||d.message||"",this.status=(c==null?void 0:c.status)||d.status||500;const y=(c==null?void 0:c.code)||d.code;y!==void 0&&(this.code=y);const w=d.help;w!==void 0&&(this.help=w),Error.captureStackTrace(this,d)}get[Symbol.toStringTag](){return this.constructor.name}toString(){return this.code?`${this.name} [${this.code}]: ${this.message}`:`${this.name}: ${this.message}`}}const n=class n extends a{constructor(t){const s=`Value of type ${typeof t} (${String(t)}) is not encodable.`;super(s,{code:n.code,status:n.status})}};e(n,"status",500),e(n,"code","E_UNENCODABLE_VALUE");let g=n;const u=class u extends a{constructor(t,s){const c=`Value of type ${typeof t} (${String(t)}) is not encodable.`;super(c,{code:u.code,status:u.status,cause:s})}};e(u,"status",500),e(u,"code","E_ENCODING_FAILED");let $=u;const i=class i extends a{constructor(){super("Circular reference detected.",{code:i.code,status:i.status})}};e(i,"status",500),e(i,"code","E_CIRCULAR_REFERENCE");let f=i;const h=class h extends a{constructor(t){const s=`Value of type ${t} cannot be decoded.`;super(s,{code:h.code,status:h.status})}};e(h,"status",500),e(h,"code","E_UNDECODABLE_VALUE");let p=h;const l=class l extends a{constructor(t){const s=`Value "${t}" is not a valid encoded value.`;super(s,{code:l.code,status:l.status})}};e(l,"status",500),e(l,"code","E_NOT_AN_ENCODED_VALUE");let x=l;const m=class m extends a{constructor(t){const s=`Invalid version "${t}"`;super(s,{code:m.code,status:m.status})}};e(m,"status",500),e(m,"code","E_INVALID_VERSION");let v=m;const o=class o extends a{constructor(t){const s=`Encoded data version ${t} is not compatible with the current version 0.1.0-master-ab456424.`;super(s,{code:o.code,status:o.status})}};e(o,"status",500),e(o,"code","E_INCOMPATIBLE_VERSION"),e(o,"help","This error indicates that the encoded value is from a version which is newer than the version of the decoder.");let b=o;exports.BaseException=a;exports.E_CIRCULAR_REFERENCE=f;exports.E_ENCODING_FAILED=$;exports.E_INCOMPATIBLE_VERSION=b;exports.E_INVALID_VERSION=v;exports.E_NOT_AN_ENCODED_VALUE=x;exports.E_UNDECODABLE_VALUE=p;exports.E_UNENCODABLE_VALUE=g;
2
- //# sourceMappingURL=exceptions-iBYg29S4.js.map
1
+ "use strict";var S=Object.defineProperty;var k=(r,t,s)=>t in r?S(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var e=(r,t,s)=>k(r,typeof t!="symbol"?t+"":t,s);class a extends Error{constructor(s,c){super(s,c);e(this,"name");e(this,"status");const d=this.constructor;this.name=d.name,this.message=s||d.message||"",this.status=(c==null?void 0:c.status)||d.status||500;const b=(c==null?void 0:c.code)||d.code;b!==void 0&&(this.code=b);const w=d.help;w!==void 0&&(this.help=w),Error.captureStackTrace(this,d)}get[Symbol.toStringTag](){return this.constructor.name}toString(){return this.code?`${this.name} [${this.code}]: ${this.message}`:`${this.name}: ${this.message}`}}const n=class n extends a{constructor(t){const s=`Value of type ${typeof t} (${String(t)}) is not encodable.`;super(s,{code:n.code,status:n.status})}};e(n,"status",500),e(n,"code","E_UNENCODABLE_VALUE");let g=n;const u=class u extends a{constructor(t,s){const c=`Value of type ${typeof t} (${String(t)}) is not encodable.`;super(c,{code:u.code,status:u.status,cause:s})}};e(u,"status",500),e(u,"code","E_ENCODING_FAILED");let $=u;const i=class i extends a{constructor(){super("Circular reference detected.",{code:i.code,status:i.status})}};e(i,"status",500),e(i,"code","E_CIRCULAR_REFERENCE");let f=i;const h=class h extends a{constructor(t){const s=`Value of type ${t} cannot be decoded.`;super(s,{code:h.code,status:h.status})}};e(h,"status",500),e(h,"code","E_UNDECODABLE_VALUE");let p=h;const l=class l extends a{constructor(t){const s=`Value "${t}" is not a valid encoded value.`;super(s,{code:l.code,status:l.status})}};e(l,"status",500),e(l,"code","E_NOT_AN_ENCODED_VALUE");let x=l;const m=class m extends a{constructor(t){const s=`Invalid version "${t}"`;super(s,{code:m.code,status:m.status})}};e(m,"status",500),e(m,"code","E_INVALID_VERSION");let v=m;const o=class o extends a{constructor(t){const s=`Encoded data version ${t} is not compatible with the current version 1.20251201.0.`;super(s,{code:o.code,status:o.status})}};e(o,"status",500),e(o,"code","E_INCOMPATIBLE_VERSION"),e(o,"help","This error indicates that the encoded value is from a version which is newer than the version of the decoder.");let y=o;exports.BaseException=a;exports.E_CIRCULAR_REFERENCE=f;exports.E_ENCODING_FAILED=$;exports.E_INCOMPATIBLE_VERSION=y;exports.E_INVALID_VERSION=v;exports.E_NOT_AN_ENCODED_VALUE=x;exports.E_UNDECODABLE_VALUE=p;exports.E_UNENCODABLE_VALUE=g;
2
+ //# sourceMappingURL=exceptions-pRtdSy7a.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exceptions-iBYg29S4.js","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Base exception class that extends the native Error class.\n * Provides a foundation for all custom exceptions with additional metadata\n * like error codes, status codes, and help descriptions.\n */\nexport class BaseException extends Error {\n /**\n * Define the error metadata as static properties to avoid\n * setting them repeatedly on the error instance\n */\n declare static help?: string\n declare static code?: string\n declare static status?: number\n declare static message?: string\n\n /**\n * Name of the class that raised the exception.\n */\n name: string\n\n /**\n * Optional help description for the error. You can use it to define additional\n * human readable information for the error.\n */\n declare help?: string\n\n /**\n * A machine readable error code. This will allow the error handling logic\n * to narrow down exceptions based upon the error code.\n */\n declare code?: string\n\n /**\n * A status code for the error. Usually helpful when converting errors\n * to HTTP responses.\n */\n status: number\n\n /**\n * Creates a new BaseException instance.\n *\n * @param message - The error message. If not provided, uses the static message from the constructor.\n * @param options - Additional options including error cause, code, and status.\n */\n constructor(message?: string, options?: ErrorOptions & { code?: string; status?: number }) {\n super(message, options)\n\n const ErrorConstructor = this.constructor as typeof BaseException\n\n this.name = ErrorConstructor.name\n this.message = message || ErrorConstructor.message || ''\n this.status = options?.status || ErrorConstructor.status || 500\n\n const code = options?.code || ErrorConstructor.code\n if (code !== undefined) {\n this.code = code\n }\n\n const help = ErrorConstructor.help\n if (help !== undefined) {\n this.help = help\n }\n\n Error.captureStackTrace(this, ErrorConstructor)\n }\n\n /**\n * Returns the constructor name for the Symbol.toStringTag property.\n *\n * @returns The name of the exception class.\n */\n get [Symbol.toStringTag]() {\n return this.constructor.name\n }\n\n /**\n * Returns a string representation of the exception.\n * Includes the error code in brackets if available.\n *\n * @returns A formatted string representation of the exception.\n */\n toString() {\n if (this.code) {\n return `${this.name} [${this.code}]: ${this.message}`\n }\n return `${this.name}: ${this.message}`\n }\n}\n\n/**\n * Exception thrown when a value cannot be encoded.\n * This indicates that the value type is not supported by the encoder.\n */\nexport class E_UNENCODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNENCODABLE_VALUE'\n\n /**\n * Creates a new E_UNENCODABLE_VALUE exception.\n *\n * @param value - The value that could not be encoded.\n */\n constructor(value: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_UNENCODABLE_VALUE.code,\n status: E_UNENCODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when encoding fails due to an underlying error.\n * This wraps the original error as the cause for better error tracing.\n */\nexport class E_ENCODING_FAILED extends BaseException {\n static status = 500\n static code = 'E_ENCODING_FAILED'\n\n /**\n * Creates a new E_ENCODING_FAILED exception.\n *\n * @param value - The value that failed to encode.\n * @param cause - The underlying error that caused the encoding to fail.\n */\n constructor(value: unknown, cause: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_ENCODING_FAILED.code,\n status: E_ENCODING_FAILED.status,\n cause,\n })\n }\n}\n\n/**\n * Exception thrown when a circular reference is detected during encoding.\n * Circular references cannot be encoded and must be avoided.\n */\nexport class E_CIRCULAR_REFERENCE extends BaseException {\n static status = 500\n static code = 'E_CIRCULAR_REFERENCE'\n\n /**\n * Creates a new E_CIRCULAR_REFERENCE exception.\n */\n constructor() {\n const message = `Circular reference detected.`\n super(message, {\n code: E_CIRCULAR_REFERENCE.code,\n status: E_CIRCULAR_REFERENCE.status,\n })\n }\n}\n\n/**\n * Exception thrown when a value with an unknown or unsupported type cannot be decoded.\n */\nexport class E_UNDECODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNDECODABLE_VALUE'\n\n /**\n * Creates a new E_UNDECODABLE_VALUE exception.\n *\n * @param type - The type string that could not be decoded.\n */\n constructor(type: string) {\n const message = `Value of type ${type} cannot be decoded.`\n super(message, {\n code: E_UNDECODABLE_VALUE.code,\n status: E_UNDECODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode a value that is not a valid encoded value.\n * This indicates the input string is not in the expected encoded format.\n */\nexport class E_NOT_AN_ENCODED_VALUE extends BaseException {\n static status = 500\n static code = 'E_NOT_AN_ENCODED_VALUE'\n\n /**\n * Creates a new E_NOT_AN_ENCODED_VALUE exception.\n *\n * @param value - The string value that is not a valid encoded value.\n */\n constructor(value: string) {\n const message = `Value \"${value}\" is not a valid encoded value.`\n super(message, {\n code: E_NOT_AN_ENCODED_VALUE.code,\n status: E_NOT_AN_ENCODED_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when an invalid version string is encountered.\n */\nexport class E_INVALID_VERSION extends BaseException {\n static status = 500\n static code = 'E_INVALID_VERSION'\n\n /**\n * Creates a new E_INVALID_VERSION exception.\n *\n * @param version - The invalid version string.\n */\n constructor(version: string) {\n const message = `Invalid version \"${version}\"`\n super(message, {\n code: E_INVALID_VERSION.code,\n status: E_INVALID_VERSION.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode data encoded with an incompatible version.\n * This typically occurs when the encoded data is from a newer version than the decoder supports.\n */\nexport class E_INCOMPATIBLE_VERSION extends BaseException {\n static status = 500\n static code = 'E_INCOMPATIBLE_VERSION'\n static help =\n 'This error indicates that the encoded value is from a version which is newer than the version of the decoder.'\n\n /**\n * Creates a new E_INCOMPATIBLE_VERSION exception.\n *\n * @param version - The incompatible version string from the encoded data.\n */\n constructor(version: string) {\n const message = `Encoded data version ${version} is not compatible with the current version ${__VERSION__}.`\n super(message, {\n code: E_INCOMPATIBLE_VERSION.code,\n status: E_INCOMPATIBLE_VERSION.status,\n })\n }\n}\n"],"names":["BaseException","message","options","__publicField","ErrorConstructor","code","help","_E_UNENCODABLE_VALUE","value","E_UNENCODABLE_VALUE","_E_ENCODING_FAILED","cause","E_ENCODING_FAILED","_E_CIRCULAR_REFERENCE","E_CIRCULAR_REFERENCE","_E_UNDECODABLE_VALUE","type","E_UNDECODABLE_VALUE","_E_NOT_AN_ENCODED_VALUE","E_NOT_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AAMpB,EAAS,CACb,KAAMsB,EAAuB,KAC7B,OAAQA,EAAuB,MAAA,CAChC,CACH,CACF,EAjBEpB,EADWoB,EACJ,SAAS,KAChBpB,EAFWoB,EAEJ,OAAO,0BACdpB,EAHWoB,EAGJ,OACL,iHAJG,IAAMC,EAAND"}
1
+ {"version":3,"file":"exceptions-pRtdSy7a.js","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Base exception class that extends the native Error class.\n * Provides a foundation for all custom exceptions with additional metadata\n * like error codes, status codes, and help descriptions.\n */\nexport class BaseException extends Error {\n /**\n * Define the error metadata as static properties to avoid\n * setting them repeatedly on the error instance\n */\n declare static help?: string\n declare static code?: string\n declare static status?: number\n declare static message?: string\n\n /**\n * Name of the class that raised the exception.\n */\n name: string\n\n /**\n * Optional help description for the error. You can use it to define additional\n * human readable information for the error.\n */\n declare help?: string\n\n /**\n * A machine readable error code. This will allow the error handling logic\n * to narrow down exceptions based upon the error code.\n */\n declare code?: string\n\n /**\n * A status code for the error. Usually helpful when converting errors\n * to HTTP responses.\n */\n status: number\n\n /**\n * Creates a new BaseException instance.\n *\n * @param message - The error message. If not provided, uses the static message from the constructor.\n * @param options - Additional options including error cause, code, and status.\n */\n constructor(message?: string, options?: ErrorOptions & { code?: string; status?: number }) {\n super(message, options)\n\n const ErrorConstructor = this.constructor as typeof BaseException\n\n this.name = ErrorConstructor.name\n this.message = message || ErrorConstructor.message || ''\n this.status = options?.status || ErrorConstructor.status || 500\n\n const code = options?.code || ErrorConstructor.code\n if (code !== undefined) {\n this.code = code\n }\n\n const help = ErrorConstructor.help\n if (help !== undefined) {\n this.help = help\n }\n\n Error.captureStackTrace(this, ErrorConstructor)\n }\n\n /**\n * Returns the constructor name for the Symbol.toStringTag property.\n *\n * @returns The name of the exception class.\n */\n get [Symbol.toStringTag]() {\n return this.constructor.name\n }\n\n /**\n * Returns a string representation of the exception.\n * Includes the error code in brackets if available.\n *\n * @returns A formatted string representation of the exception.\n */\n toString() {\n if (this.code) {\n return `${this.name} [${this.code}]: ${this.message}`\n }\n return `${this.name}: ${this.message}`\n }\n}\n\n/**\n * Exception thrown when a value cannot be encoded.\n * This indicates that the value type is not supported by the encoder.\n */\nexport class E_UNENCODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNENCODABLE_VALUE'\n\n /**\n * Creates a new E_UNENCODABLE_VALUE exception.\n *\n * @param value - The value that could not be encoded.\n */\n constructor(value: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_UNENCODABLE_VALUE.code,\n status: E_UNENCODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when encoding fails due to an underlying error.\n * This wraps the original error as the cause for better error tracing.\n */\nexport class E_ENCODING_FAILED extends BaseException {\n static status = 500\n static code = 'E_ENCODING_FAILED'\n\n /**\n * Creates a new E_ENCODING_FAILED exception.\n *\n * @param value - The value that failed to encode.\n * @param cause - The underlying error that caused the encoding to fail.\n */\n constructor(value: unknown, cause: unknown) {\n const message = `Value of type ${typeof value} (${String(value)}) is not encodable.`\n super(message, {\n code: E_ENCODING_FAILED.code,\n status: E_ENCODING_FAILED.status,\n cause,\n })\n }\n}\n\n/**\n * Exception thrown when a circular reference is detected during encoding.\n * Circular references cannot be encoded and must be avoided.\n */\nexport class E_CIRCULAR_REFERENCE extends BaseException {\n static status = 500\n static code = 'E_CIRCULAR_REFERENCE'\n\n /**\n * Creates a new E_CIRCULAR_REFERENCE exception.\n */\n constructor() {\n const message = `Circular reference detected.`\n super(message, {\n code: E_CIRCULAR_REFERENCE.code,\n status: E_CIRCULAR_REFERENCE.status,\n })\n }\n}\n\n/**\n * Exception thrown when a value with an unknown or unsupported type cannot be decoded.\n */\nexport class E_UNDECODABLE_VALUE extends BaseException {\n static status = 500\n static code = 'E_UNDECODABLE_VALUE'\n\n /**\n * Creates a new E_UNDECODABLE_VALUE exception.\n *\n * @param type - The type string that could not be decoded.\n */\n constructor(type: string) {\n const message = `Value of type ${type} cannot be decoded.`\n super(message, {\n code: E_UNDECODABLE_VALUE.code,\n status: E_UNDECODABLE_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode a value that is not a valid encoded value.\n * This indicates the input string is not in the expected encoded format.\n */\nexport class E_NOT_AN_ENCODED_VALUE extends BaseException {\n static status = 500\n static code = 'E_NOT_AN_ENCODED_VALUE'\n\n /**\n * Creates a new E_NOT_AN_ENCODED_VALUE exception.\n *\n * @param value - The string value that is not a valid encoded value.\n */\n constructor(value: string) {\n const message = `Value \"${value}\" is not a valid encoded value.`\n super(message, {\n code: E_NOT_AN_ENCODED_VALUE.code,\n status: E_NOT_AN_ENCODED_VALUE.status,\n })\n }\n}\n\n/**\n * Exception thrown when an invalid version string is encountered.\n */\nexport class E_INVALID_VERSION extends BaseException {\n static status = 500\n static code = 'E_INVALID_VERSION'\n\n /**\n * Creates a new E_INVALID_VERSION exception.\n *\n * @param version - The invalid version string.\n */\n constructor(version: string) {\n const message = `Invalid version \"${version}\"`\n super(message, {\n code: E_INVALID_VERSION.code,\n status: E_INVALID_VERSION.status,\n })\n }\n}\n\n/**\n * Exception thrown when attempting to decode data encoded with an incompatible version.\n * This typically occurs when the encoded data is from a newer version than the decoder supports.\n */\nexport class E_INCOMPATIBLE_VERSION extends BaseException {\n static status = 500\n static code = 'E_INCOMPATIBLE_VERSION'\n static help =\n 'This error indicates that the encoded value is from a version which is newer than the version of the decoder.'\n\n /**\n * Creates a new E_INCOMPATIBLE_VERSION exception.\n *\n * @param version - The incompatible version string from the encoded data.\n */\n constructor(version: string) {\n const message = `Encoded data version ${version} is not compatible with the current version ${__VERSION__}.`\n super(message, {\n code: E_INCOMPATIBLE_VERSION.code,\n status: E_INCOMPATIBLE_VERSION.status,\n })\n }\n}\n"],"names":["BaseException","message","options","__publicField","ErrorConstructor","code","help","_E_UNENCODABLE_VALUE","value","E_UNENCODABLE_VALUE","_E_ENCODING_FAILED","cause","E_ENCODING_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ME,EAANF,EAsBA,MAAMG,EAAN,MAAMA,UAA+BvB,CAAc,CAWxD,YAAYqB,EAAiB,CAC3B,MAAMpB,EAAU,wBAAwBoB,CAAO,4DAC/C,MAAMpB,EAAS,CACb,KAAMsB,EAAuB,KAC7B,OAAQA,EAAuB,MAAA,CAChC,CACH,CACF,EAjBEpB,EADWoB,EACJ,SAAS,KAChBpB,EAFWoB,EAEJ,OAAO,0BACdpB,EAHWoB,EAGJ,OACL,iHAJG,IAAMC,EAAND"}
package/exceptions.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./exceptions-iBYg29S4.js");exports.E_CIRCULAR_REFERENCE=E.E_CIRCULAR_REFERENCE;exports.E_ENCODING_FAILED=E.E_ENCODING_FAILED;exports.E_INCOMPATIBLE_VERSION=E.E_INCOMPATIBLE_VERSION;exports.E_INVALID_VERSION=E.E_INVALID_VERSION;exports.E_NOT_AN_ENCODED_VALUE=E.E_NOT_AN_ENCODED_VALUE;exports.E_UNDECODABLE_VALUE=E.E_UNDECODABLE_VALUE;exports.E_UNENCODABLE_VALUE=E.E_UNENCODABLE_VALUE;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./exceptions-pRtdSy7a.js");exports.E_CIRCULAR_REFERENCE=E.E_CIRCULAR_REFERENCE;exports.E_ENCODING_FAILED=E.E_ENCODING_FAILED;exports.E_INCOMPATIBLE_VERSION=E.E_INCOMPATIBLE_VERSION;exports.E_INVALID_VERSION=E.E_INVALID_VERSION;exports.E_NOT_AN_ENCODED_VALUE=E.E_NOT_AN_ENCODED_VALUE;exports.E_UNDECODABLE_VALUE=E.E_UNDECODABLE_VALUE;exports.E_UNENCODABLE_VALUE=E.E_UNENCODABLE_VALUE;
2
2
  //# sourceMappingURL=exceptions.cjs.map
package/exceptions.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as N, b as A, f as I, e as L, d as a, c as C, E as D } from "./exceptions-BHfZbUPp.mjs";
1
+ import { a as N, b as A, f as I, e as L, d as a, c as C, E as D } from "./exceptions-BXzLxffe.mjs";
2
2
  export {
3
3
  N as E_CIRCULAR_REFERENCE,
4
4
  A as E_ENCODING_FAILED,