@nhtio/encoder 0.1.0-master-3b237666 → 0.1.0-master-f44af99f
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-CkrSQ6oY.mjs → exceptions-C8bYu-xi.mjs} +2 -2
- package/{exceptions-CkrSQ6oY.mjs.map → exceptions-C8bYu-xi.mjs.map} +1 -1
- package/{exceptions-DYhBvDYC.js → exceptions-DiuSuXH-.js} +2 -2
- package/{exceptions-DYhBvDYC.js.map → exceptions-DiuSuXH-.js.map} +1 -1
- package/exceptions.cjs +1 -1
- package/exceptions.mjs +1 -1
- package/function_serializer.cjs +1 -1
- package/function_serializer.mjs +1 -1
- package/index.cjs +52 -25
- package/index.cjs.map +1 -1
- package/index.mjs +52 -25
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/{type_guards-Nh3b7rEF.js → type_guards-BWmHnIpZ.js} +23 -5
- package/{type_guards-Nh3b7rEF.js.map → type_guards-BWmHnIpZ.js.map} +1 -1
- package/{type_guards-BbzVmysZ.mjs → type_guards-UkDoe__i.mjs} +29 -11
- package/{type_guards-BbzVmysZ.mjs.map → type_guards-UkDoe__i.mjs.map} +1 -1
- package/type_guards.cjs +1 -1
- package/type_guards.mjs +5 -5
|
@@ -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-f44af99f"}.`;
|
|
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-C8bYu-xi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions-
|
|
1
|
+
{"version":3,"file":"exceptions-C8bYu-xi.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,EAkB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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;"}
|
|
@@ -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 ${"0.1.0-master-
|
|
161
|
+
const message = `Encoded data version ${version} is not compatible with the current version ${"0.1.0-master-f44af99f"}.`;
|
|
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-DiuSuXH-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exceptions-
|
|
1
|
+
{"version":3,"file":"exceptions-DiuSuXH-.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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
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const exceptions = require("./exceptions-
|
|
3
|
+
const exceptions = require("./exceptions-DiuSuXH-.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/function_serializer.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const type_guards = require("./type_guards-
|
|
3
|
+
const type_guards = require("./type_guards-BWmHnIpZ.js");
|
|
4
4
|
class FunctionSerializer {
|
|
5
5
|
#namedBindings;
|
|
6
6
|
#argNames;
|
package/function_serializer.mjs
CHANGED
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-
|
|
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-DiuSuXH-.js");
|
|
6
6
|
var re = { exports: {} };
|
|
7
7
|
var constants;
|
|
8
8
|
var hasRequiredConstants;
|
|
@@ -2946,6 +2946,30 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
2946
2946
|
_s: ""
|
|
2947
2947
|
};
|
|
2948
2948
|
}
|
|
2949
|
+
case type_guards.isPositiveInfinity(value): {
|
|
2950
|
+
return {
|
|
2951
|
+
_t: "js:∞",
|
|
2952
|
+
_s: ""
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
case type_guards.isNegativeInfinity(value): {
|
|
2956
|
+
return {
|
|
2957
|
+
_t: "js:-∞",
|
|
2958
|
+
_s: ""
|
|
2959
|
+
};
|
|
2960
|
+
}
|
|
2961
|
+
case type_guards.isUnsafeInteger(value): {
|
|
2962
|
+
return {
|
|
2963
|
+
_t: "js:unsafeInteger",
|
|
2964
|
+
_s: value.toString()
|
|
2965
|
+
};
|
|
2966
|
+
}
|
|
2967
|
+
case Number.isNaN(value): {
|
|
2968
|
+
return {
|
|
2969
|
+
_t: "js:NaN",
|
|
2970
|
+
_s: ""
|
|
2971
|
+
};
|
|
2972
|
+
}
|
|
2949
2973
|
case type_guards.isBigInt(value): {
|
|
2950
2974
|
return {
|
|
2951
2975
|
_t: "js:bigint",
|
|
@@ -2967,24 +2991,15 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
2967
2991
|
throw new exceptions.E_ENCODING_FAILED(value, e);
|
|
2968
2992
|
}
|
|
2969
2993
|
}
|
|
2970
|
-
case type_guards.isBigIntTypedArray(value):
|
|
2971
|
-
try {
|
|
2972
|
-
return {
|
|
2973
|
-
_t: `js:bigintTypedArray`,
|
|
2974
|
-
_s: toStructuredData(serialize(value, { lossy: true, json: true }), seen)
|
|
2975
|
-
};
|
|
2976
|
-
} catch (e) {
|
|
2977
|
-
if (e instanceof exceptions.BaseException) {
|
|
2978
|
-
throw e;
|
|
2979
|
-
}
|
|
2980
|
-
throw new exceptions.E_ENCODING_FAILED(value, e);
|
|
2981
|
-
}
|
|
2982
|
-
}
|
|
2994
|
+
case type_guards.isBigIntTypedArray(value):
|
|
2983
2995
|
case type_guards.isTypedArray(value): {
|
|
2984
2996
|
try {
|
|
2985
2997
|
return {
|
|
2986
|
-
_t: `js:
|
|
2987
|
-
_s:
|
|
2998
|
+
_t: `js:typedArray`,
|
|
2999
|
+
_s: toStructuredData({
|
|
3000
|
+
ctor: value.constructor.name,
|
|
3001
|
+
values: Array.from(value).map((v) => toStructuredData(v))
|
|
3002
|
+
})
|
|
2988
3003
|
};
|
|
2989
3004
|
} catch (e) {
|
|
2990
3005
|
if (e instanceof exceptions.BaseException) {
|
|
@@ -3120,7 +3135,7 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
3120
3135
|
seen.add(value);
|
|
3121
3136
|
return {
|
|
3122
3137
|
_t: "js:Array",
|
|
3123
|
-
_s:
|
|
3138
|
+
_s: utoa(JSON.stringify(value.map((item) => toStructuredData(item, seen))))
|
|
3124
3139
|
};
|
|
3125
3140
|
}
|
|
3126
3141
|
case type_guards.isObject(value): {
|
|
@@ -3180,15 +3195,27 @@ const fromStructuredData = (data) => {
|
|
|
3180
3195
|
});
|
|
3181
3196
|
return set;
|
|
3182
3197
|
}
|
|
3198
|
+
case "js:NaN": {
|
|
3199
|
+
return Number.NaN;
|
|
3200
|
+
}
|
|
3201
|
+
case "js:unsafeInteger": {
|
|
3202
|
+
return Number(data._s);
|
|
3203
|
+
}
|
|
3204
|
+
case "js:-∞": {
|
|
3205
|
+
return Number.NEGATIVE_INFINITY;
|
|
3206
|
+
}
|
|
3207
|
+
case "js:∞": {
|
|
3208
|
+
return Number.POSITIVE_INFINITY;
|
|
3209
|
+
}
|
|
3183
3210
|
case "js:negativeZero": {
|
|
3184
3211
|
return -0;
|
|
3185
3212
|
}
|
|
3186
3213
|
case "js:bigint": {
|
|
3187
3214
|
return BigInt(data._s);
|
|
3188
3215
|
}
|
|
3189
|
-
case "js:
|
|
3190
|
-
const
|
|
3191
|
-
return
|
|
3216
|
+
case "js:typedArray": {
|
|
3217
|
+
const { ctor, values } = fromStructuredData(data._s);
|
|
3218
|
+
return new globalThis[ctor](values.map(fromStructuredData));
|
|
3192
3219
|
}
|
|
3193
3220
|
case "js:native": {
|
|
3194
3221
|
return deserialize(data._s);
|
|
@@ -3242,11 +3269,11 @@ const { parse: $parse, stringify: $stringify } = JSON;
|
|
|
3242
3269
|
const options = { json: true, lossy: true };
|
|
3243
3270
|
const parse = (str) => deserialize($parse(str));
|
|
3244
3271
|
const stringify = (any) => $stringify(serialize(any, options));
|
|
3245
|
-
const version = "0.1.0-master-
|
|
3272
|
+
const version = "0.1.0-master-f44af99f";
|
|
3246
3273
|
const encode = (what) => {
|
|
3247
3274
|
const structured = toStructuredData(what);
|
|
3248
3275
|
const serialized = serialize(structured, { lossy: true, json: true });
|
|
3249
|
-
const json = stringify({ version: "0.1.0-master-
|
|
3276
|
+
const json = stringify({ version: "0.1.0-master-f44af99f", serialized });
|
|
3250
3277
|
return utoa(json);
|
|
3251
3278
|
};
|
|
3252
3279
|
const decode = (base64) => {
|
|
@@ -3257,11 +3284,11 @@ const decode = (base64) => {
|
|
|
3257
3284
|
throw new exceptions.E_NOT_AN_ENCODED_VALUE(base64);
|
|
3258
3285
|
}
|
|
3259
3286
|
const { version: payloadVersion, serialized } = parsed;
|
|
3260
|
-
if (semverExports.valid("0.1.0-master-
|
|
3287
|
+
if (semverExports.valid("0.1.0-master-f44af99f")) {
|
|
3261
3288
|
if (!semverExports.valid(semverExports.coerce(payloadVersion))) {
|
|
3262
3289
|
throw new exceptions.E_INVALID_VERSION(payloadVersion);
|
|
3263
3290
|
}
|
|
3264
|
-
if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-
|
|
3291
|
+
if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-f44af99f")) {
|
|
3265
3292
|
throw new exceptions.E_INCOMPATIBLE_VERSION(payloadVersion);
|
|
3266
3293
|
}
|
|
3267
3294
|
}
|