@nhtio/encoder 1.20251230.0 → 1.20260611.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.
- package/{exceptions-ieVRrxe4.mjs → exceptions-WJOP87c3.mjs} +2 -2
- package/{exceptions-ieVRrxe4.mjs.map → exceptions-WJOP87c3.mjs.map} +1 -1
- package/{exceptions-_w2PUPD0.js → exceptions-ryQGeNU_.js} +2 -2
- package/{exceptions-_w2PUPD0.js.map → exceptions-ryQGeNU_.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
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as isObject, a as isArray, b as isSet, c as isMap, d as isLuxonSystemZone, e as isLuxonInterval, f as isLuxonDuration, g as isLuxonDateTime,
|
|
1
|
+
import { i as isObject, a as isArray, b as isSet, c as isMap, d as isLuxonSystemZone, e as isLuxonInterval, f as isLuxonDuration, g as isLuxonDateTime, h as isPhoneObject, j as isTypedArray, k as isBigIntTypedArray, l as isPrimitive, m as isUniterableObject, n as isError, o as isBigInt, p as isUnsafeInteger, q as isNegativeInfinity, r as isPositiveInfinity, s as isNegativeZero, I as Info, t as Interval, D as DateTime, u as Duration, P as Phone } from "./type_guards-UkDoe__i.mjs";
|
|
2
2
|
import { FunctionSerializer } from "./function_serializer.mjs";
|
|
3
|
-
import { E as E_UNENCODABLE_VALUE, a as E_CIRCULAR_REFERENCE, b as E_ENCODING_FAILED, B as BaseException, c as E_UNDECODABLE_VALUE, d as E_NOT_AN_ENCODED_VALUE, e as E_INVALID_VERSION, f as E_INCOMPATIBLE_VERSION } from "./exceptions-
|
|
3
|
+
import { E as E_UNENCODABLE_VALUE, a as E_CIRCULAR_REFERENCE, b as E_ENCODING_FAILED, B as BaseException, c as E_UNDECODABLE_VALUE, d as E_NOT_AN_ENCODED_VALUE, e as E_INVALID_VERSION, f as E_INCOMPATIBLE_VERSION } from "./exceptions-WJOP87c3.mjs";
|
|
4
4
|
var re = { exports: {} };
|
|
5
5
|
var constants;
|
|
6
6
|
var hasRequiredConstants;
|
|
@@ -3025,14 +3025,12 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
3025
3025
|
throw new E_CIRCULAR_REFERENCE();
|
|
3026
3026
|
}
|
|
3027
3027
|
seen.add(value);
|
|
3028
|
-
const dto = value
|
|
3029
|
-
value.loc.locale
|
|
3030
|
-
);
|
|
3028
|
+
const dto = value;
|
|
3031
3029
|
return {
|
|
3032
3030
|
_t: "luxon:DateTime",
|
|
3033
3031
|
_s: toStructuredData(
|
|
3034
3032
|
{
|
|
3035
|
-
v: dto.
|
|
3033
|
+
v: dto.toMillis(),
|
|
3036
3034
|
z: dto.zoneName,
|
|
3037
3035
|
l: dto.locale,
|
|
3038
3036
|
c: dto.outputCalendar,
|
|
@@ -3224,13 +3222,16 @@ const fromStructuredData = (data) => {
|
|
|
3224
3222
|
}
|
|
3225
3223
|
case "luxon:DateTime": {
|
|
3226
3224
|
const obj = fromStructuredData(data._s);
|
|
3227
|
-
|
|
3228
|
-
// setZone: true,
|
|
3225
|
+
const options2 = {
|
|
3229
3226
|
zone: obj.z,
|
|
3230
3227
|
locale: obj.l,
|
|
3231
3228
|
outputCalendar: obj.c,
|
|
3232
3229
|
numberingSystem: obj.n
|
|
3233
|
-
}
|
|
3230
|
+
};
|
|
3231
|
+
if (typeof obj.v !== "number") {
|
|
3232
|
+
return DateTime.fromRFC2822(obj.v, options2);
|
|
3233
|
+
}
|
|
3234
|
+
return DateTime.fromMillis(obj.v, options2);
|
|
3234
3235
|
}
|
|
3235
3236
|
case "luxon:Duration": {
|
|
3236
3237
|
const obj = fromStructuredData(data._s);
|
|
@@ -3267,11 +3268,11 @@ const { parse: $parse, stringify: $stringify } = JSON;
|
|
|
3267
3268
|
const options = { json: true, lossy: true };
|
|
3268
3269
|
const parse = (str) => deserialize($parse(str));
|
|
3269
3270
|
const stringify = (any) => $stringify(serialize(any, options));
|
|
3270
|
-
const version = "1.
|
|
3271
|
+
const version = "1.20260611.0";
|
|
3271
3272
|
const encode = (what) => {
|
|
3272
3273
|
const structured = toStructuredData(what);
|
|
3273
3274
|
const serialized = serialize(structured, { lossy: true, json: true });
|
|
3274
|
-
const json = stringify({ version: "1.
|
|
3275
|
+
const json = stringify({ version: "1.20260611.0", serialized });
|
|
3275
3276
|
return utoa(json);
|
|
3276
3277
|
};
|
|
3277
3278
|
const decode = (base64) => {
|
|
@@ -3282,11 +3283,11 @@ const decode = (base64) => {
|
|
|
3282
3283
|
throw new E_NOT_AN_ENCODED_VALUE(base64);
|
|
3283
3284
|
}
|
|
3284
3285
|
const { version: payloadVersion, serialized } = parsed;
|
|
3285
|
-
if (semverExports.valid("1.
|
|
3286
|
+
if (semverExports.valid("1.20260611.0")) {
|
|
3286
3287
|
if (!semverExports.valid(semverExports.coerce(payloadVersion))) {
|
|
3287
3288
|
throw new E_INVALID_VERSION(payloadVersion);
|
|
3288
3289
|
}
|
|
3289
|
-
if (semverExports.gt(semverExports.coerce(payloadVersion), "1.
|
|
3290
|
+
if (semverExports.gt(semverExports.coerce(payloadVersion), "1.20260611.0")) {
|
|
3290
3291
|
throw new E_INCOMPATIBLE_VERSION(payloadVersion);
|
|
3291
3292
|
}
|
|
3292
3293
|
}
|