@nhtio/encoder 0.1.0-master-258fa72f → 0.1.0-master-9b97505f

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/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
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, D as DateTime, 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, 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-DsdZSw0_.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-P-gXm8Io.mjs";
4
4
  var re = { exports: {} };
5
5
  var constants;
6
6
  var hasRequiredConstants;
@@ -3032,7 +3032,7 @@ const toStructuredData = (value, seen = /* @__PURE__ */ new WeakSet()) => {
3032
3032
  _t: "luxon:DateTime",
3033
3033
  _s: toStructuredData(
3034
3034
  {
3035
- v: dto.toRFC2822(),
3035
+ v: dto.toMillis(),
3036
3036
  z: dto.zoneName,
3037
3037
  l: dto.locale,
3038
3038
  c: dto.outputCalendar,
@@ -3224,13 +3224,16 @@ const fromStructuredData = (data) => {
3224
3224
  }
3225
3225
  case "luxon:DateTime": {
3226
3226
  const obj = fromStructuredData(data._s);
3227
- return DateTime.fromRFC2822(obj.v, {
3228
- // setZone: true,
3227
+ const options2 = {
3229
3228
  zone: obj.z,
3230
3229
  locale: obj.l,
3231
3230
  outputCalendar: obj.c,
3232
3231
  numberingSystem: obj.n
3233
- });
3232
+ };
3233
+ if (typeof obj.v !== "number") {
3234
+ return DateTime.fromRFC2822(obj.v, options2);
3235
+ }
3236
+ return DateTime.fromMillis(obj.v, options2);
3234
3237
  }
3235
3238
  case "luxon:Duration": {
3236
3239
  const obj = fromStructuredData(data._s);
@@ -3267,11 +3270,11 @@ const { parse: $parse, stringify: $stringify } = JSON;
3267
3270
  const options = { json: true, lossy: true };
3268
3271
  const parse = (str) => deserialize($parse(str));
3269
3272
  const stringify = (any) => $stringify(serialize(any, options));
3270
- const version = "0.1.0-master-258fa72f";
3273
+ const version = "0.1.0-master-9b97505f";
3271
3274
  const encode = (what) => {
3272
3275
  const structured = toStructuredData(what);
3273
3276
  const serialized = serialize(structured, { lossy: true, json: true });
3274
- const json = stringify({ version: "0.1.0-master-258fa72f", serialized });
3277
+ const json = stringify({ version: "0.1.0-master-9b97505f", serialized });
3275
3278
  return utoa(json);
3276
3279
  };
3277
3280
  const decode = (base64) => {
@@ -3282,11 +3285,11 @@ const decode = (base64) => {
3282
3285
  throw new E_NOT_AN_ENCODED_VALUE(base64);
3283
3286
  }
3284
3287
  const { version: payloadVersion, serialized } = parsed;
3285
- if (semverExports.valid("0.1.0-master-258fa72f")) {
3288
+ if (semverExports.valid("0.1.0-master-9b97505f")) {
3286
3289
  if (!semverExports.valid(semverExports.coerce(payloadVersion))) {
3287
3290
  throw new E_INVALID_VERSION(payloadVersion);
3288
3291
  }
3289
- if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-258fa72f")) {
3292
+ if (semverExports.gt(semverExports.coerce(payloadVersion), "0.1.0-master-9b97505f")) {
3290
3293
  throw new E_INCOMPATIBLE_VERSION(payloadVersion);
3291
3294
  }
3292
3295
  }