@nhtio/encoder 0.1.0-master-a0341ac6 → 0.1.0-master-e7b311e8
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-X2-2FICz.js → exceptions-CHv3uWrN.js} +2 -2
- package/{exceptions-X2-2FICz.js.map → exceptions-CHv3uWrN.js.map} +1 -1
- package/{exceptions-D4huZrDN.mjs → exceptions-DX4Wrk6C.mjs} +2 -2
- package/{exceptions-D4huZrDN.mjs.map → exceptions-DX4Wrk6C.mjs.map} +1 -1
- package/exceptions.cjs +1 -1
- package/exceptions.mjs +1 -1
- package/index.cjs +11 -8
- package/index.cjs.map +1 -1
- package/index.mjs +11 -8
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as isObject, a as isCustomEncodable, E as ENCODE_METHOD, b as isArray, c as isSet, d as isMap, e as isLuxonSystemZone, f as isLuxonInterval, I as Interval, D as DateTime, g as isLuxonDuration, h as Duration, j as isLuxonDateTime, k as isPhoneObject, l as isTypedArray, m as isBigIntTypedArray, n as isPrimitive, o as isUniterableObject, p as isError, q as isBigInt, r as isUnsafeInteger, s as isNegativeInfinity, t as isPositiveInfinity, u as isNegativeZero, v as DECODE_METHOD, w as Info, P as Phone } from "./type_guards-DMqlMT2e.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-DX4Wrk6C.mjs";
|
|
4
4
|
var re = { exports: {} };
|
|
5
5
|
var constants;
|
|
6
6
|
var hasRequiredConstants;
|
|
@@ -3077,10 +3077,13 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
|
|
|
3077
3077
|
const dur = value instanceof Duration ? value : typeof value.get === "function" ? value : (() => {
|
|
3078
3078
|
const raw = value;
|
|
3079
3079
|
const locale = raw.loc && typeof raw.loc.locale === "string" ? raw.loc.locale : void 0;
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3080
|
+
const rawValues = raw.values && typeof raw.values === "object" ? raw.values : {};
|
|
3081
|
+
const values = Object.fromEntries(
|
|
3082
|
+
Object.entries(rawValues).filter(
|
|
3083
|
+
([, val]) => typeof val === "number" && Number.isFinite(val)
|
|
3084
|
+
)
|
|
3083
3085
|
);
|
|
3086
|
+
return Duration.fromObject(values, { locale });
|
|
3084
3087
|
})();
|
|
3085
3088
|
const dto = {
|
|
3086
3089
|
years: dur.years,
|
|
@@ -3358,11 +3361,11 @@ const { parse: $parse, stringify: $stringify } = JSON;
|
|
|
3358
3361
|
const options = { json: true, lossy: true };
|
|
3359
3362
|
const parse = (str) => deserialize($parse(str));
|
|
3360
3363
|
const stringify = (any) => $stringify(serialize(any, options));
|
|
3361
|
-
const version = "0.1.0-master-
|
|
3364
|
+
const version = "0.1.0-master-e7b311e8";
|
|
3362
3365
|
const encode = (what) => {
|
|
3363
3366
|
const structured = toStructuredData(what);
|
|
3364
3367
|
const serialized = serialize(structured, { lossy: true, json: true });
|
|
3365
|
-
const json = stringify({ version: "0.1.0-master-
|
|
3368
|
+
const json = stringify({ version: "0.1.0-master-e7b311e8", serialized });
|
|
3366
3369
|
return utoa(json);
|
|
3367
3370
|
};
|
|
3368
3371
|
const decode = (base64) => {
|
|
@@ -3373,11 +3376,11 @@ const decode = (base64) => {
|
|
|
3373
3376
|
throw new E_NOT_AN_ENCODED_VALUE(base64);
|
|
3374
3377
|
}
|
|
3375
3378
|
const { version: payloadVersion, serialized } = parsed;
|
|
3376
|
-
if (semverExports.valid("0.1.0-master-
|
|
3379
|
+
if (semverExports.valid("0.1.0-master-e7b311e8")) {
|
|
3377
3380
|
if (!semverExports.valid(semverExports.coerce(payloadVersion))) {
|
|
3378
3381
|
throw new E_INVALID_VERSION(payloadVersion);
|
|
3379
3382
|
}
|
|
3380
|
-
if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-
|
|
3383
|
+
if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-e7b311e8")) {
|
|
3381
3384
|
throw new E_INCOMPATIBLE_VERSION(payloadVersion);
|
|
3382
3385
|
}
|
|
3383
3386
|
}
|