@nhtio/encoder 1.20260611.0 → 1.20260624.1

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.
@@ -157,7 +157,7 @@ class E_INCOMPATIBLE_VERSION extends BaseException {
157
157
  * @param version - The incompatible version string from the encoded data.
158
158
  */
159
159
  constructor(version) {
160
- const message = `Encoded data version ${version} is not compatible with the current version ${"1.20260611.0"}.`;
160
+ const message = `Encoded data version ${version} is not compatible with the current version ${"1.20260624.1"}.`;
161
161
  super(message, {
162
162
  code: E_INCOMPATIBLE_VERSION.code,
163
163
  status: E_INCOMPATIBLE_VERSION.status
@@ -174,4 +174,4 @@ export {
174
174
  E_INVALID_VERSION as e,
175
175
  E_INCOMPATIBLE_VERSION as f
176
176
  };
177
- //# sourceMappingURL=exceptions-WJOP87c3.mjs.map
177
+ //# sourceMappingURL=exceptions-CqtGXEDJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exceptions-WJOP87c3.mjs","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nexport interface ErrorOptions {\n cause?: unknown\n}\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":[],"mappings":"AAWO,MAAM,sBAAsB,MAAM;AAAA;AAAA;AAAA;AAAA,EAavC;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,YAAY,SAAkB,SAA6D;AACzF,UAAM,SAAS,OAAO;AAEtB,UAAM,mBAAmB,KAAK;AAE9B,SAAK,OAAO,iBAAiB;AAC7B,SAAK,UAAU,WAAW,iBAAiB,WAAW;AACtD,SAAK,SAAS,SAAS,UAAU,iBAAiB,UAAU;AAE5D,UAAM,OAAO,SAAS,QAAQ,iBAAiB;AAC/C,QAAI,SAAS,QAAW;AACtB,WAAK,OAAO;AAAA,IACd;AAEA,UAAM,OAAO,iBAAiB;AAC9B,QAAI,SAAS,QAAW;AACtB,WAAK,OAAO;AAAA,IACd;AAEA,UAAM,kBAAkB,MAAM,gBAAgB;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAK,OAAO,WAAW,IAAI;AACzB,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW;AACT,QAAI,KAAK,MAAM;AACb,aAAO,GAAG,KAAK,IAAI,KAAK,KAAK,IAAI,MAAM,KAAK,OAAO;AAAA,IACrD;AACA,WAAO,GAAG,KAAK,IAAI,KAAK,KAAK,OAAO;AAAA,EACtC;AACF;AAMO,MAAM,4BAA4B,cAAc;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;AACzB,UAAM,UAAU,UAAU,KAAK;AAC/B,UAAM,SAAS;AAAA,MACb,MAAM,uBAAuB;AAAA,MAC7B,QAAQ,uBAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;AAKO,MAAM,0BAA0B,cAAc;AAAA,EACnD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,YAAY,SAAiB;AAC3B,UAAM,UAAU,oBAAoB,OAAO;AAC3C,UAAM,SAAS;AAAA,MACb,MAAM,kBAAkB;AAAA,MACxB,QAAQ,kBAAkB;AAAA,IAAA,CAC3B;AAAA,EACH;AACF;AAMO,MAAM,+BAA+B,cAAc;AAAA,EACxD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA,EACd,OAAO,OACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,YAAY,SAAiB;AAC3B,UAAM,UAAU,wBAAwB,OAAO,+CAA+C,cAAW;AACzG,UAAM,SAAS;AAAA,MACb,MAAM,uBAAuB;AAAA,MAC7B,QAAQ,uBAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;"}
1
+ {"version":3,"file":"exceptions-CqtGXEDJ.mjs","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nexport interface ErrorOptions {\n cause?: unknown\n}\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":[],"mappings":"AAWO,MAAM,sBAAsB,MAAM;AAAA;AAAA;AAAA;AAAA,EAavC;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,YAAY,SAAkB,SAA6D;AACzF,UAAM,SAAS,OAAO;AAEtB,UAAM,mBAAmB,KAAK;AAE9B,SAAK,OAAO,iBAAiB;AAC7B,SAAK,UAAU,WAAW,iBAAiB,WAAW;AACtD,SAAK,SAAS,SAAS,UAAU,iBAAiB,UAAU;AAE5D,UAAM,OAAO,SAAS,QAAQ,iBAAiB;AAC/C,QAAI,SAAS,QAAW;AACtB,WAAK,OAAO;AAAA,IACd;AAEA,UAAM,OAAO,iBAAiB;AAC9B,QAAI,SAAS,QAAW;AACtB,WAAK,OAAO;AAAA,IACd;AAEA,UAAM,kBAAkB,MAAM,gBAAgB;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,KAAK,OAAO,WAAW,IAAI;AACzB,WAAO,KAAK,YAAY;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,WAAW;AACT,QAAI,KAAK,MAAM;AACb,aAAO,GAAG,KAAK,IAAI,KA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ACH;AACF;AAMO,MAAM,+BAA+B,cAAc;AAAA,EACxD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,YAAY,OAAe;AACzB,UAAM,UAAU,UAAU,KAAK;AAC/B,UAAM,SAAS;AAAA,MACb,MAAM,uBAAuB;AAAA,MAC7B,QAAQ,uBAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;AAKO,MAAM,0BAA0B,cAAc;AAAA,EACnD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOd,YAAY,SAAiB;AAC3B,UAAM,UAAU,oBAAoB,OAAO;AAC3C,UAAM,SAAS;AAAA,MACb,MAAM,kBAAkB;AAAA,MACxB,QAAQ,kBAAkB;AAAA,IAAA,CAC3B;AAAA,EACH;AACF;AAMO,MAAM,+BAA+B,cAAc;AAAA,EACxD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA,EACd,OAAO,OACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,YAAY,SAAiB;AAC3B,UAAM,UAAU,wBAAwB,OAAO,+CAA+C,cAAW;AACzG,UAAM,SAAS;AAAA,MACb,MAAM,uBAAuB;AAAA,MAC7B,QAAQ,uBAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;"}
@@ -158,7 +158,7 @@ class E_INCOMPATIBLE_VERSION extends BaseException {
158
158
  * @param version - The incompatible version string from the encoded data.
159
159
  */
160
160
  constructor(version) {
161
- const message = `Encoded data version ${version} is not compatible with the current version ${"1.20260611.0"}.`;
161
+ const message = `Encoded data version ${version} is not compatible with the current version ${"1.20260624.1"}.`;
162
162
  super(message, {
163
163
  code: E_INCOMPATIBLE_VERSION.code,
164
164
  status: E_INCOMPATIBLE_VERSION.status
@@ -173,4 +173,4 @@ exports.E_INVALID_VERSION = E_INVALID_VERSION;
173
173
  exports.E_NOT_AN_ENCODED_VALUE = E_NOT_AN_ENCODED_VALUE;
174
174
  exports.E_UNDECODABLE_VALUE = E_UNDECODABLE_VALUE;
175
175
  exports.E_UNENCODABLE_VALUE = E_UNENCODABLE_VALUE;
176
- //# sourceMappingURL=exceptions-ryQGeNU_.js.map
176
+ //# sourceMappingURL=exceptions-Dzfa7_NT.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exceptions-ryQGeNU_.js","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nexport interface ErrorOptions {\n cause?: unknown\n}\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":[],"mappings":";AAWO,MAAM,sBAAsB,MAAM;AAAA;AAAA;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AAAA,IAAA,CAC3B;AAAA,EACH;AACF;AAMO,MAAM,+BAA+B,cAAc;AAAA,EACxD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA,EACd,OAAO,OACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,YAAY,SAAiB;AAC3B,UAAM,UAAU,wBAAwB,OAAO,+CAA+C,cAAW;AACzG,UAAM,SAAS;AAAA,MACb,MAAM,uBAAuB;AAAA,MAC7B,QAAQ,uBAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;;;;;;;;;"}
1
+ {"version":3,"file":"exceptions-Dzfa7_NT.js","sources":["../src/private/exceptions.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n\nexport interface ErrorOptions {\n cause?: unknown\n}\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 ${__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AAAA;AAAA;AAAA,EAOd,YAAY,SAAiB;AAC3B,UAAM,UAAU,oBAAoB,OAAO;AAC3C,UAAM,SAAS;AAAA,MACb,MAAM,kBAAkB;AAAA,MACxB,QAAQ,kBAAkB;AAAA,IAAA,CAC3B;AAAA,EACH;AACF;AAMO,MAAM,+BAA+B,cAAc;AAAA,EACxD,OAAO,SAAS;AAAA,EAChB,OAAO,OAAO;AAAA,EACd,OAAO,OACL;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,YAAY,SAAiB;AAC3B,UAAM,UAAU,wBAAwB,OAAO,+CAA+C,cAAW;AACzG,UAAM,SAAS;AAAA,MACb,MAAM,uBAAuB;AAAA,MAC7B,QAAQ,uBAAuB;AAAA,IAAA,CAChC;AAAA,EACH;AACF;;;;;;;;;"}
package/exceptions.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const exceptions = require("./exceptions-ryQGeNU_.js");
3
+ const exceptions = require("./exceptions-Dzfa7_NT.js");
4
4
  exports.E_CIRCULAR_REFERENCE = exceptions.E_CIRCULAR_REFERENCE;
5
5
  exports.E_ENCODING_FAILED = exceptions.E_ENCODING_FAILED;
6
6
  exports.E_INCOMPATIBLE_VERSION = exceptions.E_INCOMPATIBLE_VERSION;
package/exceptions.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a, b, f, e, d, c, E } from "./exceptions-WJOP87c3.mjs";
1
+ import { a, b, f, e, d, c, E } from "./exceptions-CqtGXEDJ.mjs";
2
2
  export {
3
3
  a as E_CIRCULAR_REFERENCE,
4
4
  b as E_ENCODING_FAILED,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const type_guards = require("./type_guards-BWmHnIpZ.js");
3
+ const type_guards = require("./type_guards-D1YzZ13G.js");
4
4
  class FunctionSerializer {
5
5
  #namedBindings;
6
6
  #argNames;
@@ -1,4 +1,4 @@
1
- import { i as isObject } from "./type_guards-UkDoe__i.mjs";
1
+ import { i as isObject } from "./type_guards-DMqlMT2e.mjs";
2
2
  class FunctionSerializer {
3
3
  #namedBindings;
4
4
  #argNames;
package/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const type_guards = require("./type_guards-BWmHnIpZ.js");
3
+ const type_guards = require("./type_guards-D1YzZ13G.js");
4
4
  const function_serializer = require("./function_serializer.cjs");
5
- const exceptions = require("./exceptions-ryQGeNU_.js");
5
+ const exceptions = require("./exceptions-Dzfa7_NT.js");
6
6
  var re = { exports: {} };
7
7
  var constants;
8
8
  var hasRequiredConstants;
@@ -2730,6 +2730,16 @@ const atou = (base64) => {
2730
2730
  }
2731
2731
  return decodeURIComponent(escape(binary));
2732
2732
  };
2733
+ const registry = /* @__PURE__ */ new Map();
2734
+ const registerClass = (ctor) => {
2735
+ if (typeof ctor.name !== "string" || ctor.name === "") {
2736
+ throw new TypeError("Cannot register an anonymous class — give it an explicit name.");
2737
+ }
2738
+ registry.set(ctor.name, ctor);
2739
+ };
2740
+ const getRegisteredClass = (name) => {
2741
+ return registry.get(name);
2742
+ };
2733
2743
  const VOID = -1;
2734
2744
  const PRIMITIVE = 0;
2735
2745
  const ARRAY = 1;
@@ -2938,6 +2948,13 @@ const serialize = (value, { json, lossy } = {}) => {
2938
2948
  const stripUndefinedValuesFromObject = (obj) => {
2939
2949
  return Object.fromEntries(Object.entries(obj).filter(([_, value]) => value !== void 0));
2940
2950
  };
2951
+ const fixedOffsetToZoneName = (fixed) => {
2952
+ const sign = fixed >= 0 ? "+" : "-";
2953
+ const abs = Math.abs(fixed);
2954
+ const hours = Math.floor(abs / 60);
2955
+ const minutes = abs % 60;
2956
+ return minutes === 0 ? `UTC${sign}${hours}` : `UTC${sign}${hours}:${String(minutes).padStart(2, "0")}`;
2957
+ };
2941
2958
  const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
2942
2959
  switch (true) {
2943
2960
  case type_guards.isNegativeZero(value): {
@@ -3027,7 +3044,19 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
3027
3044
  throw new exceptions.E_CIRCULAR_REFERENCE();
3028
3045
  }
3029
3046
  seen.add(value);
3030
- const dto = value;
3047
+ const dto = value instanceof type_guards.DateTime ? value : typeof value.toMillis === "function" ? value : (() => {
3048
+ const raw = value;
3049
+ const zone = raw._zone && typeof raw._zone.zoneName === "string" ? raw._zone.zoneName : raw._zone && typeof raw._zone.fixed === "number" ? fixedOffsetToZoneName(raw._zone.fixed) : void 0;
3050
+ const locale = raw.loc && typeof raw.loc.locale === "string" ? raw.loc.locale : void 0;
3051
+ const outputCalendar = raw.loc && typeof raw.loc.outputCalendar === "string" ? raw.loc.outputCalendar : void 0;
3052
+ const numberingSystem = raw.loc && typeof raw.loc.numberingSystem === "string" ? raw.loc.numberingSystem : void 0;
3053
+ return type_guards.DateTime.fromMillis(typeof raw.ts === "number" ? raw.ts : 0, {
3054
+ zone,
3055
+ locale,
3056
+ outputCalendar,
3057
+ numberingSystem
3058
+ });
3059
+ })();
3031
3060
  return {
3032
3061
  _t: "luxon:DateTime",
3033
3062
  _s: toStructuredData(
@@ -3047,16 +3076,27 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
3047
3076
  throw new exceptions.E_CIRCULAR_REFERENCE();
3048
3077
  }
3049
3078
  seen.add(value);
3079
+ const dur = value instanceof type_guards.Duration ? value : typeof value.get === "function" ? value : (() => {
3080
+ const raw = value;
3081
+ const locale = raw.loc && typeof raw.loc.locale === "string" ? raw.loc.locale : void 0;
3082
+ const rawValues = raw.values && typeof raw.values === "object" ? raw.values : {};
3083
+ const values = Object.fromEntries(
3084
+ Object.entries(rawValues).filter(
3085
+ ([, val]) => typeof val === "number" && Number.isFinite(val)
3086
+ )
3087
+ );
3088
+ return type_guards.Duration.fromObject(values, { locale });
3089
+ })();
3050
3090
  const dto = {
3051
- years: value.years,
3052
- quarters: value.quarters,
3053
- months: value.months,
3054
- weeks: value.weeks,
3055
- days: value.days,
3056
- hours: value.hours,
3057
- minutes: value.minutes,
3058
- seconds: value.seconds,
3059
- milliseconds: value.milliseconds
3091
+ years: dur.years,
3092
+ quarters: dur.quarters,
3093
+ months: dur.months,
3094
+ weeks: dur.weeks,
3095
+ days: dur.days,
3096
+ hours: dur.hours,
3097
+ minutes: dur.minutes,
3098
+ seconds: dur.seconds,
3099
+ milliseconds: dur.milliseconds
3060
3100
  };
3061
3101
  Object.entries(dto).forEach(([key, val]) => {
3062
3102
  if (Number.isNaN(val) || val === 0) {
@@ -3073,8 +3113,17 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
3073
3113
  throw new exceptions.E_CIRCULAR_REFERENCE();
3074
3114
  }
3075
3115
  seen.add(value);
3076
- const start = value.start ? value.start.toISO({ extendedZone: true }) : null;
3077
- const end = value.end ? value.end.toISO({ extendedZone: true }) : null;
3116
+ const iv = value instanceof type_guards.Interval ? value : typeof value.toISO === "function" ? value : (() => {
3117
+ const raw = value;
3118
+ const startMs = raw.s && typeof raw.s.ts === "number" ? raw.s.ts : null;
3119
+ const endMs = raw.e && typeof raw.e.ts === "number" ? raw.e.ts : null;
3120
+ return type_guards.Interval.fromDateTimes(
3121
+ startMs !== null ? type_guards.DateTime.fromMillis(startMs) : type_guards.DateTime.invalid("missing start"),
3122
+ endMs !== null ? type_guards.DateTime.fromMillis(endMs) : type_guards.DateTime.invalid("missing end")
3123
+ );
3124
+ })();
3125
+ const start = iv.start ? iv.start.toISO({ extendedZone: true }) : null;
3126
+ const end = iv.end ? iv.end.toISO({ extendedZone: true }) : null;
3078
3127
  if (!start || !end) {
3079
3128
  throw new exceptions.E_UNENCODABLE_VALUE(value);
3080
3129
  }
@@ -3136,6 +3185,25 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
3136
3185
  _s: utoa(JSON.stringify(value.map((item) => toStructuredData(item, seen))))
3137
3186
  };
3138
3187
  }
3188
+ case type_guards.isCustomEncodable(value): {
3189
+ if (seen.has(value)) {
3190
+ throw new exceptions.E_CIRCULAR_REFERENCE();
3191
+ }
3192
+ seen.add(value);
3193
+ const className = value.constructor.name;
3194
+ try {
3195
+ const snapshot = value[type_guards.ENCODE_METHOD]();
3196
+ return {
3197
+ _t: `custom:${className}`,
3198
+ _s: toStructuredData(snapshot, seen)
3199
+ };
3200
+ } catch (e) {
3201
+ if (e instanceof exceptions.BaseException) {
3202
+ throw e;
3203
+ }
3204
+ throw new exceptions.E_ENCODING_FAILED(value, e);
3205
+ }
3206
+ }
3139
3207
  case type_guards.isObject(value): {
3140
3208
  if (seen.has(value)) {
3141
3209
  throw new exceptions.E_CIRCULAR_REFERENCE();
@@ -3262,19 +3330,44 @@ const fromStructuredData = (data) => {
3262
3330
  throw err2;
3263
3331
  }
3264
3332
  }
3265
- default:
3333
+ default: {
3334
+ if (data._t.startsWith("custom:")) {
3335
+ const className = data._t.slice("custom:".length);
3336
+ const ctor = getRegisteredClass(className);
3337
+ if (!ctor) {
3338
+ const err2 = new exceptions.E_UNDECODABLE_VALUE(data._t);
3339
+ err2.cause = new Error(
3340
+ `No class registered for "${className}". Call registerClass(${className}) before decoding.`
3341
+ );
3342
+ throw err2;
3343
+ }
3344
+ try {
3345
+ const snapshot = fromStructuredData(data._s);
3346
+ return ctor[type_guards.DECODE_METHOD](snapshot);
3347
+ } catch (e) {
3348
+ if (e instanceof exceptions.BaseException) {
3349
+ throw e;
3350
+ }
3351
+ const err2 = new exceptions.E_UNDECODABLE_VALUE(data._t);
3352
+ if (e instanceof Error) {
3353
+ err2.cause = e;
3354
+ }
3355
+ throw err2;
3356
+ }
3357
+ }
3266
3358
  throw new exceptions.E_UNDECODABLE_VALUE(data._t);
3359
+ }
3267
3360
  }
3268
3361
  };
3269
3362
  const { parse: $parse, stringify: $stringify } = JSON;
3270
3363
  const options = { json: true, lossy: true };
3271
3364
  const parse = (str) => deserialize($parse(str));
3272
3365
  const stringify = (any) => $stringify(serialize(any, options));
3273
- const version = "1.20260611.0";
3366
+ const version = "1.20260624.1";
3274
3367
  const encode = (what) => {
3275
3368
  const structured = toStructuredData(what);
3276
3369
  const serialized = serialize(structured, { lossy: true, json: true });
3277
- const json = stringify({ version: "1.20260611.0", serialized });
3370
+ const json = stringify({ version: "1.20260624.1", serialized });
3278
3371
  return utoa(json);
3279
3372
  };
3280
3373
  const decode = (base64) => {
@@ -3285,11 +3378,11 @@ const decode = (base64) => {
3285
3378
  throw new exceptions.E_NOT_AN_ENCODED_VALUE(base64);
3286
3379
  }
3287
3380
  const { version: payloadVersion, serialized } = parsed;
3288
- if (semverExports.valid("1.20260611.0")) {
3381
+ if (semverExports.valid("1.20260624.1")) {
3289
3382
  if (!semverExports.valid(semverExports.coerce(payloadVersion))) {
3290
3383
  throw new exceptions.E_INVALID_VERSION(payloadVersion);
3291
3384
  }
3292
- if (semverExports.gt(semverExports.coerce(payloadVersion), "1.20260611.0")) {
3385
+ if (semverExports.gt(semverExports.coerce(payloadVersion), "1.20260624.1")) {
3293
3386
  throw new exceptions.E_INCOMPATIBLE_VERSION(payloadVersion);
3294
3387
  }
3295
3388
  }
@@ -3304,7 +3397,10 @@ const decode = (base64) => {
3304
3397
  throw exception;
3305
3398
  }
3306
3399
  };
3400
+ exports.DECODE_METHOD = type_guards.DECODE_METHOD;
3401
+ exports.ENCODE_METHOD = type_guards.ENCODE_METHOD;
3307
3402
  exports.decode = decode;
3308
3403
  exports.encode = encode;
3404
+ exports.registerClass = registerClass;
3309
3405
  exports.version = version;
3310
3406
  //# sourceMappingURL=index.cjs.map