@nhtio/encoder 0.1.0-master-258fa72f → 0.1.0-master-cf69c10e
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/{exceptions-DsdZSw0_.mjs → exceptions-B6LwiRSz.mjs} +2 -2
- package/{exceptions-DsdZSw0_.mjs.map → exceptions-B6LwiRSz.mjs.map} +1 -1
- package/{exceptions-BQHu3Twy.js → exceptions-CvP1Ipcx.js} +2 -2
- package/{exceptions-BQHu3Twy.js.map → exceptions-CvP1Ipcx.js.map} +1 -1
- package/exceptions.cjs +1 -1
- package/exceptions.mjs +1 -1
- package/index.cjs +13 -12
- package/index.cjs.map +1 -1
- package/index.mjs +14 -13
- package/index.mjs.map +1 -1
- package/package.json +1 -2
|
@@ -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 ${"0.1.0-master-
|
|
160
|
+
const message = `Encoded data version ${version} is not compatible with the current version ${"0.1.0-master-cf69c10e"}.`;
|
|
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-
|
|
177
|
+
//# sourceMappingURL=exceptions-B6LwiRSz.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions-
|
|
1
|
+
{"version":3,"file":"exceptions-B6LwiRSz.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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 +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 ${"0.1.0-master-
|
|
161
|
+
const message = `Encoded data version ${version} is not compatible with the current version ${"0.1.0-master-cf69c10e"}.`;
|
|
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-
|
|
176
|
+
//# sourceMappingURL=exceptions-CvP1Ipcx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions-
|
|
1
|
+
{"version":3,"file":"exceptions-CvP1Ipcx.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;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,KAA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;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,uBAAW;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-
|
|
3
|
+
const exceptions = require("./exceptions-CvP1Ipcx.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
package/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const type_guards = require("./type_guards-BWmHnIpZ.js");
|
|
4
4
|
const function_serializer = require("./function_serializer.cjs");
|
|
5
|
-
const exceptions = require("./exceptions-
|
|
5
|
+
const exceptions = require("./exceptions-CvP1Ipcx.js");
|
|
6
6
|
var re = { exports: {} };
|
|
7
7
|
var constants;
|
|
8
8
|
var hasRequiredConstants;
|
|
@@ -3027,14 +3027,12 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
3027
3027
|
throw new exceptions.E_CIRCULAR_REFERENCE();
|
|
3028
3028
|
}
|
|
3029
3029
|
seen.add(value);
|
|
3030
|
-
const dto = value
|
|
3031
|
-
value.loc.locale
|
|
3032
|
-
);
|
|
3030
|
+
const dto = value;
|
|
3033
3031
|
return {
|
|
3034
3032
|
_t: "luxon:DateTime",
|
|
3035
3033
|
_s: toStructuredData(
|
|
3036
3034
|
{
|
|
3037
|
-
v: dto.
|
|
3035
|
+
v: dto.toMillis(),
|
|
3038
3036
|
z: dto.zoneName,
|
|
3039
3037
|
l: dto.locale,
|
|
3040
3038
|
c: dto.outputCalendar,
|
|
@@ -3226,13 +3224,16 @@ const fromStructuredData = (data) => {
|
|
|
3226
3224
|
}
|
|
3227
3225
|
case "luxon:DateTime": {
|
|
3228
3226
|
const obj = fromStructuredData(data._s);
|
|
3229
|
-
|
|
3230
|
-
// setZone: true,
|
|
3227
|
+
const options2 = {
|
|
3231
3228
|
zone: obj.z,
|
|
3232
3229
|
locale: obj.l,
|
|
3233
3230
|
outputCalendar: obj.c,
|
|
3234
3231
|
numberingSystem: obj.n
|
|
3235
|
-
}
|
|
3232
|
+
};
|
|
3233
|
+
if (typeof obj.v !== "number") {
|
|
3234
|
+
return type_guards.DateTime.fromRFC2822(obj.v, options2);
|
|
3235
|
+
}
|
|
3236
|
+
return type_guards.DateTime.fromMillis(obj.v, options2);
|
|
3236
3237
|
}
|
|
3237
3238
|
case "luxon:Duration": {
|
|
3238
3239
|
const obj = fromStructuredData(data._s);
|
|
@@ -3269,11 +3270,11 @@ const { parse: $parse, stringify: $stringify } = JSON;
|
|
|
3269
3270
|
const options = { json: true, lossy: true };
|
|
3270
3271
|
const parse = (str) => deserialize($parse(str));
|
|
3271
3272
|
const stringify = (any) => $stringify(serialize(any, options));
|
|
3272
|
-
const version = "0.1.0-master-
|
|
3273
|
+
const version = "0.1.0-master-cf69c10e";
|
|
3273
3274
|
const encode = (what) => {
|
|
3274
3275
|
const structured = toStructuredData(what);
|
|
3275
3276
|
const serialized = serialize(structured, { lossy: true, json: true });
|
|
3276
|
-
const json = stringify({ version: "0.1.0-master-
|
|
3277
|
+
const json = stringify({ version: "0.1.0-master-cf69c10e", serialized });
|
|
3277
3278
|
return utoa(json);
|
|
3278
3279
|
};
|
|
3279
3280
|
const decode = (base64) => {
|
|
@@ -3284,11 +3285,11 @@ const decode = (base64) => {
|
|
|
3284
3285
|
throw new exceptions.E_NOT_AN_ENCODED_VALUE(base64);
|
|
3285
3286
|
}
|
|
3286
3287
|
const { version: payloadVersion, serialized } = parsed;
|
|
3287
|
-
if (semverExports.valid("0.1.0-master-
|
|
3288
|
+
if (semverExports.valid("0.1.0-master-cf69c10e")) {
|
|
3288
3289
|
if (!semverExports.valid(semverExports.coerce(payloadVersion))) {
|
|
3289
3290
|
throw new exceptions.E_INVALID_VERSION(payloadVersion);
|
|
3290
3291
|
}
|
|
3291
|
-
if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-
|
|
3292
|
+
if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-cf69c10e")) {
|
|
3292
3293
|
throw new exceptions.E_INCOMPATIBLE_VERSION(payloadVersion);
|
|
3293
3294
|
}
|
|
3294
3295
|
}
|