@nmshd/runtime 1.2.8 → 1.2.12

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.
@@ -327,11 +327,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
327
327
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
328
328
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
329
329
  exports.buildInformation = {
330
- version: "1.2.8",
331
- build: "23",
332
- date: "2021-12-29T14:42:22+00:00",
333
- commit: "6d24f2c871967626b8b84d122d3a1e5294ee4a0c",
334
- dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.11","@nmshd/content":"1.1.2","@nmshd/crypto":"1.0.6","@nmshd/transport":"1.1.3","ajv":"^8.8.2","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.2","luxon":"^2.2.0","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
330
+ version: "1.2.12",
331
+ build: "27",
332
+ date: "2022-01-11T08:20:35+00:00",
333
+ commit: "1d2fdee12e0673b3e7dfbed11a83f6f500a5b313",
334
+ dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.0.2","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.11","@nmshd/content":"1.1.2","@nmshd/crypto":"1.0.6","@nmshd/transport":"1.1.5","ajv":"^8.8.2","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.2","json-stringify-safe":"^5.0.1","luxon":"^2.3.0","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
335
335
  libraries: {
336
336
  serval: ts_serval_1.buildInformation,
337
337
  consumption: consumption_1.buildInformation,
@@ -3746,6 +3746,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
3746
3746
  exports.RuntimeErrors = void 0;
3747
3747
  const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
3748
3748
  class General {
3749
+ unknown(message, data) {
3750
+ return new ts_utils_1.ApplicationError("error.runtime.unknown", message, data);
3751
+ }
3749
3752
  alreadyInitialized() {
3750
3753
  return new ts_utils_1.ApplicationError("error.runtime.alreadyInitialized", "The runtime is already initialized. The init method can only be executed once.");
3751
3754
  }
@@ -5921,15 +5924,19 @@ exports.LoadPeerTokenRequest = {
5921
5924
  /*!*****************************************!*\
5922
5925
  !*** ./dist/useCases/common/UseCase.js ***!
5923
5926
  \*****************************************/
5924
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5927
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5925
5928
 
5926
5929
  "use strict";
5927
5930
 
5931
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5932
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5933
+ };
5928
5934
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5929
5935
  exports.UseCase = void 0;
5930
5936
  const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
5931
5937
  const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/@js-soft/ts-utils/dist/index.js");
5932
5938
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
5939
+ const json_stringify_safe_1 = __importDefault(__webpack_require__(/*! json-stringify-safe */ "./node_modules/json-stringify-safe/stringify.js"));
5933
5940
  const PlatformErrorCodes_1 = __webpack_require__(/*! ./PlatformErrorCodes */ "./dist/useCases/common/PlatformErrorCodes.js");
5934
5941
  const RuntimeErrors_1 = __webpack_require__(/*! ./RuntimeErrors */ "./dist/useCases/common/RuntimeErrors.js");
5935
5942
  class UseCase {
@@ -5947,20 +5954,23 @@ class UseCase {
5947
5954
  return await this.executeInternal(request);
5948
5955
  }
5949
5956
  catch (e) {
5950
- if (!(e instanceof Error)) {
5951
- throw e;
5952
- }
5953
- return this.resultFromError(e);
5957
+ return this.failingResultFromUnknownError(e);
5954
5958
  }
5955
5959
  }
5956
- resultFromError(error) {
5960
+ failingResultFromUnknownError(error) {
5961
+ if (!(error instanceof Error)) {
5962
+ return ts_utils_1.Result.fail(RuntimeErrors_1.RuntimeErrors.general.unknown(`An unknown object was thrown in a UseCase: ${(0, json_stringify_safe_1.default)(error)}`, error));
5963
+ }
5957
5964
  if (error instanceof transport_1.RequestError) {
5958
5965
  return this.handleRequestError(error);
5959
5966
  }
5960
5967
  if (error instanceof ts_serval_1.ServalError) {
5961
5968
  return this.handleServalError(error);
5962
5969
  }
5963
- throw error;
5970
+ if (error instanceof ts_utils_1.ApplicationError) {
5971
+ return ts_utils_1.Result.fail(error);
5972
+ }
5973
+ return ts_utils_1.Result.fail(RuntimeErrors_1.RuntimeErrors.general.unknown(`An error was thrown in a UseCase: ${error.message}`, error));
5964
5974
  }
5965
5975
  handleServalError(error) {
5966
5976
  let runtimeError;
@@ -5986,7 +5996,7 @@ class UseCase {
5986
5996
  if (PlatformErrorCodes_1.PlatformErrorCodes.isUnexpectedError(error)) {
5987
5997
  return ts_utils_1.Result.fail(new ts_utils_1.ApplicationError(error.code, error.message));
5988
5998
  }
5989
- throw error;
5999
+ return ts_utils_1.Result.fail(error);
5990
6000
  }
5991
6001
  validationFailed(validationResult) {
5992
6002
  var _a, _b, _c;
@@ -11658,7 +11668,7 @@ class RelationshipTemplateMapper {
11658
11668
  createdBy: template.cache.createdBy.toString(),
11659
11669
  createdByDevice: template.cache.createdByDevice.toString(),
11660
11670
  createdAt: template.cache.createdAt.toString(),
11661
- content: template.cache.content,
11671
+ content: template.cache.content.toJSON(),
11662
11672
  expiresAt: (_a = template.cache.expiresAt) === null || _a === void 0 ? void 0 : _a.toString(),
11663
11673
  maxNumberOfRelationships: template.cache.maxNumberOfRelationships
11664
11674
  };
@@ -12212,19 +12222,21 @@ class RelationshipMapper {
12212
12222
  return relationships.map((r) => this.toRelationshipDTO(r));
12213
12223
  }
12214
12224
  static toRelationshipChangeRequestDTO(change) {
12225
+ var _a;
12215
12226
  return {
12216
12227
  createdBy: change.createdBy.toString(),
12217
12228
  createdByDevice: change.createdByDevice.toString(),
12218
12229
  createdAt: change.createdAt.toString(),
12219
- content: change.content
12230
+ content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
12220
12231
  };
12221
12232
  }
12222
12233
  static toRelationshipChangeResponseDTO(change) {
12234
+ var _a;
12223
12235
  return {
12224
12236
  createdBy: change.createdBy.toString(),
12225
12237
  createdByDevice: change.createdByDevice.toString(),
12226
12238
  createdAt: change.createdAt.toString(),
12227
- content: change.content
12239
+ content: (_a = change.content) === null || _a === void 0 ? void 0 : _a.toJSON()
12228
12240
  };
12229
12241
  }
12230
12242
  static toRelationshipChangeDTO(change) {
@@ -24927,6 +24939,43 @@ function escapeJsonPtr(str) {
24927
24939
  }
24928
24940
 
24929
24941
 
24942
+ /***/ }),
24943
+
24944
+ /***/ "./node_modules/json-stringify-safe/stringify.js":
24945
+ /*!*******************************************************!*\
24946
+ !*** ./node_modules/json-stringify-safe/stringify.js ***!
24947
+ \*******************************************************/
24948
+ /***/ ((module, exports) => {
24949
+
24950
+ exports = module.exports = stringify
24951
+ exports.getSerialize = serializer
24952
+
24953
+ function stringify(obj, replacer, spaces, cycleReplacer) {
24954
+ return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
24955
+ }
24956
+
24957
+ function serializer(replacer, cycleReplacer) {
24958
+ var stack = [], keys = []
24959
+
24960
+ if (cycleReplacer == null) cycleReplacer = function(key, value) {
24961
+ if (stack[0] === value) return "[Circular ~]"
24962
+ return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
24963
+ }
24964
+
24965
+ return function(key, value) {
24966
+ if (stack.length > 0) {
24967
+ var thisPos = stack.indexOf(this)
24968
+ ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
24969
+ ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
24970
+ if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
24971
+ }
24972
+ else stack.push(value)
24973
+
24974
+ return replacer == null ? value : replacer.call(this, key, value)
24975
+ }
24976
+ }
24977
+
24978
+
24930
24979
  /***/ }),
24931
24980
 
24932
24981
  /***/ "./node_modules/lodash.get/index.js":
@@ -27391,17 +27440,16 @@ function padStart(input, n) {
27391
27440
  n = 2;
27392
27441
  }
27393
27442
 
27394
- var minus = input < 0 ? "-" : "";
27395
- var target = minus ? input * -1 : input;
27396
- var result;
27443
+ var isNeg = input < 0;
27444
+ var padded;
27397
27445
 
27398
- if (target.toString().length < n) {
27399
- result = ("0".repeat(n) + target).slice(-n);
27446
+ if (isNeg) {
27447
+ padded = "-" + ("" + -input).padStart(n, "0");
27400
27448
  } else {
27401
- result = target.toString();
27449
+ padded = ("" + input).padStart(n, "0");
27402
27450
  }
27403
27451
 
27404
- return "" + minus + result;
27452
+ return padded;
27405
27453
  }
27406
27454
  function parseInteger(string) {
27407
27455
  if (isUndefined(string) || string === null || string === "") {
@@ -29023,7 +29071,27 @@ var Settings = /*#__PURE__*/function () {
29023
29071
  return Settings;
29024
29072
  }();
29025
29073
 
29026
- var _excluded = ["base"];
29074
+ var _excluded = ["base"],
29075
+ _excluded2 = ["padTo", "floor"];
29076
+
29077
+ var intlLFCache = {};
29078
+
29079
+ function getCachedLF(locString, opts) {
29080
+ if (opts === void 0) {
29081
+ opts = {};
29082
+ }
29083
+
29084
+ var key = JSON.stringify([locString, opts]);
29085
+ var dtf = intlLFCache[key];
29086
+
29087
+ if (!dtf) {
29088
+ dtf = new Intl.ListFormat(locString, opts);
29089
+ intlLFCache[key] = dtf;
29090
+ }
29091
+
29092
+ return dtf;
29093
+ }
29094
+
29027
29095
  var intlDTCache = {};
29028
29096
 
29029
29097
  function getCachedDTF(locString, opts) {
@@ -29192,10 +29260,15 @@ var PolyNumberFormatter = /*#__PURE__*/function () {
29192
29260
  this.padTo = opts.padTo || 0;
29193
29261
  this.floor = opts.floor || false;
29194
29262
 
29195
- if (!forceSimple) {
29196
- var intlOpts = {
29263
+ opts.padTo;
29264
+ opts.floor;
29265
+ var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2);
29266
+
29267
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
29268
+ var intlOpts = _extends({
29197
29269
  useGrouping: false
29198
- };
29270
+ }, opts);
29271
+
29199
29272
  if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
29200
29273
  this.inf = getCachedINF(intl, intlOpts);
29201
29274
  }
@@ -29389,8 +29462,7 @@ var Locale = /*#__PURE__*/function () {
29389
29462
 
29390
29463
  var _proto4 = Locale.prototype;
29391
29464
 
29392
- _proto4.listingMode = function listingMode(defaultOK) {
29393
-
29465
+ _proto4.listingMode = function listingMode() {
29394
29466
  var isActuallyEn = this.isEnglish();
29395
29467
  var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
29396
29468
  return isActuallyEn && hasNoWeirdness ? "en" : "intl";
@@ -29570,6 +29642,14 @@ var Locale = /*#__PURE__*/function () {
29570
29642
  return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
29571
29643
  };
29572
29644
 
29645
+ _proto4.listFormatter = function listFormatter(opts) {
29646
+ if (opts === void 0) {
29647
+ opts = {};
29648
+ }
29649
+
29650
+ return getCachedLF(this.intl, opts);
29651
+ };
29652
+
29573
29653
  _proto4.isEnglish = function isEnglish() {
29574
29654
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
29575
29655
  };
@@ -30315,6 +30395,48 @@ var Duration = /*#__PURE__*/function () {
30315
30395
 
30316
30396
  return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
30317
30397
  }
30398
+ /**
30399
+ * Returns a string representation of a Duration with all units included
30400
+ * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. See {@link Intl.NumberFormat}.
30401
+ * @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`.
30402
+ * @example
30403
+ * ```js
30404
+ * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
30405
+ * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
30406
+ * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
30407
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
30408
+ * ```
30409
+ */
30410
+ ;
30411
+
30412
+ _proto.toHuman = function toHuman(opts) {
30413
+ var _this = this;
30414
+
30415
+ if (opts === void 0) {
30416
+ opts = {};
30417
+ }
30418
+
30419
+ var l = orderedUnits$1.map(function (unit) {
30420
+ var val = _this.values[unit];
30421
+
30422
+ if (isUndefined(val)) {
30423
+ return null;
30424
+ }
30425
+
30426
+ return _this.loc.numberFormatter(_extends({
30427
+ style: "unit",
30428
+ unitDisplay: "long"
30429
+ }, opts, {
30430
+ unit: unit.slice(0, -1)
30431
+ })).format(val);
30432
+ }).filter(function (n) {
30433
+ return n;
30434
+ });
30435
+ return this.loc.listFormatter(_extends({
30436
+ type: "conjunction",
30437
+ style: opts.listStyle || "narrow"
30438
+ }, opts)).format(l);
30439
+ }
30318
30440
  /**
30319
30441
  * Returns a JavaScript object with this Duration's values.
30320
30442
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
@@ -32852,51 +32974,67 @@ function toTechFormat(dt, format, allowZ) {
32852
32974
  allowZ: allowZ,
32853
32975
  forceSimple: true
32854
32976
  }).formatDateTimeFromString(dt, format) : null;
32855
- } // technical time formats (e.g. the time part of ISO 8601), take some options
32856
- // and this commonizes their handling
32977
+ }
32978
+
32979
+ function _toISODate(o, extended) {
32980
+ var longFormat = o.c.year > 9999 || o.c.year < 0;
32981
+ var c = "";
32982
+ if (longFormat && o.c.year >= 0) c += "+";
32983
+ c += padStart(o.c.year, longFormat ? 6 : 4);
32984
+
32985
+ if (extended) {
32986
+ c += "-";
32987
+ c += padStart(o.c.month);
32988
+ c += "-";
32989
+ c += padStart(o.c.day);
32990
+ } else {
32991
+ c += padStart(o.c.month);
32992
+ c += padStart(o.c.day);
32993
+ }
32857
32994
 
32995
+ return c;
32996
+ }
32858
32997
 
32859
- function toTechTimeFormat(dt, _ref) {
32860
- var _ref$suppressSeconds = _ref.suppressSeconds,
32861
- suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds,
32862
- _ref$suppressMillisec = _ref.suppressMilliseconds,
32863
- suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec,
32864
- includeOffset = _ref.includeOffset,
32865
- _ref$includePrefix = _ref.includePrefix,
32866
- includePrefix = _ref$includePrefix === void 0 ? false : _ref$includePrefix,
32867
- _ref$includeZone = _ref.includeZone,
32868
- includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone,
32869
- _ref$spaceZone = _ref.spaceZone,
32870
- spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone,
32871
- _ref$format = _ref.format,
32872
- format = _ref$format === void 0 ? "extended" : _ref$format;
32873
- var fmt = format === "basic" ? "HHmm" : "HH:mm";
32998
+ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
32999
+ var c = padStart(o.c.hour);
32874
33000
 
32875
- if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
32876
- fmt += format === "basic" ? "ss" : ":ss";
33001
+ if (extended) {
33002
+ c += ":";
33003
+ c += padStart(o.c.minute);
32877
33004
 
32878
- if (!suppressMilliseconds || dt.millisecond !== 0) {
32879
- fmt += ".SSS";
33005
+ if (o.c.second !== 0 || !suppressSeconds) {
33006
+ c += ":";
32880
33007
  }
33008
+ } else {
33009
+ c += padStart(o.c.minute);
32881
33010
  }
32882
33011
 
32883
- if ((includeZone || includeOffset) && spaceZone) {
32884
- fmt += " ";
32885
- }
33012
+ if (o.c.second !== 0 || !suppressSeconds) {
33013
+ c += padStart(o.c.second);
32886
33014
 
32887
- if (includeZone) {
32888
- fmt += "z";
32889
- } else if (includeOffset) {
32890
- fmt += format === "basic" ? "ZZZ" : "ZZ";
33015
+ if (o.c.millisecond !== 0 || !suppressMilliseconds) {
33016
+ c += ".";
33017
+ c += padStart(o.c.millisecond, 3);
33018
+ }
32891
33019
  }
32892
33020
 
32893
- var str = toTechFormat(dt, fmt);
32894
-
32895
- if (includePrefix) {
32896
- str = "T" + str;
33021
+ if (includeOffset) {
33022
+ if (o.isOffsetFixed && o.offset === 0) {
33023
+ c += "Z";
33024
+ } else if (o.o < 0) {
33025
+ c += "-";
33026
+ c += padStart(Math.trunc(-o.o / 60));
33027
+ c += ":";
33028
+ c += padStart(Math.trunc(-o.o % 60));
33029
+ } else {
33030
+ c += "+";
33031
+ c += padStart(Math.trunc(o.o / 60));
33032
+ c += ":";
33033
+ c += padStart(Math.trunc(o.o % 60));
33034
+ }
32897
33035
  }
32898
33036
 
32899
- return str;
33037
+ return c;
32900
33038
  } // defaults for unspecified units in the supported calendars
32901
33039
 
32902
33040
 
@@ -33091,9 +33229,9 @@ var DateTime = /*#__PURE__*/function () {
33091
33229
  var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
33092
33230
 
33093
33231
  if (unchanged) {
33094
- var _ref2 = [config.old.c, config.old.o];
33095
- c = _ref2[0];
33096
- o = _ref2[1];
33232
+ var _ref = [config.old.c, config.old.o];
33233
+ c = _ref[0];
33234
+ o = _ref[1];
33097
33235
  } else {
33098
33236
  var ot = zone.offset(this.ts);
33099
33237
  c = tsToObj(this.ts, ot);
@@ -33763,11 +33901,11 @@ var DateTime = /*#__PURE__*/function () {
33763
33901
  ;
33764
33902
 
33765
33903
  _proto.setZone = function setZone(zone, _temp) {
33766
- var _ref3 = _temp === void 0 ? {} : _temp,
33767
- _ref3$keepLocalTime = _ref3.keepLocalTime,
33768
- keepLocalTime = _ref3$keepLocalTime === void 0 ? false : _ref3$keepLocalTime,
33769
- _ref3$keepCalendarTim = _ref3.keepCalendarTime,
33770
- keepCalendarTime = _ref3$keepCalendarTim === void 0 ? false : _ref3$keepCalendarTim;
33904
+ var _ref2 = _temp === void 0 ? {} : _temp,
33905
+ _ref2$keepLocalTime = _ref2.keepLocalTime,
33906
+ keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime,
33907
+ _ref2$keepCalendarTim = _ref2.keepCalendarTime,
33908
+ keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim;
33771
33909
 
33772
33910
  zone = normalizeZone(zone, Settings.defaultZone);
33773
33911
 
@@ -33802,10 +33940,10 @@ var DateTime = /*#__PURE__*/function () {
33802
33940
  ;
33803
33941
 
33804
33942
  _proto.reconfigure = function reconfigure(_temp2) {
33805
- var _ref4 = _temp2 === void 0 ? {} : _temp2,
33806
- locale = _ref4.locale,
33807
- numberingSystem = _ref4.numberingSystem,
33808
- outputCalendar = _ref4.outputCalendar;
33943
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
33944
+ locale = _ref3.locale,
33945
+ numberingSystem = _ref3.numberingSystem,
33946
+ outputCalendar = _ref3.outputCalendar;
33809
33947
 
33810
33948
  var loc = this.loc.clone({
33811
33949
  locale: locale,
@@ -33908,7 +34046,7 @@ var DateTime = /*#__PURE__*/function () {
33908
34046
  * See {@link DateTime#plus}
33909
34047
  * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
33910
34048
  @return {DateTime}
33911
- */
34049
+ */
33912
34050
  ;
33913
34051
 
33914
34052
  _proto.minus = function minus(duration) {
@@ -34073,7 +34211,7 @@ var DateTime = /*#__PURE__*/function () {
34073
34211
  * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
34074
34212
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
34075
34213
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
34076
- * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
34214
+ * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
34077
34215
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
34078
34216
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
34079
34217
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
@@ -34081,16 +34219,28 @@ var DateTime = /*#__PURE__*/function () {
34081
34219
  */
34082
34220
  ;
34083
34221
 
34084
- _proto.toISO = function toISO(opts) {
34085
- if (opts === void 0) {
34086
- opts = {};
34087
- }
34222
+ _proto.toISO = function toISO(_temp3) {
34223
+ var _ref4 = _temp3 === void 0 ? {} : _temp3,
34224
+ _ref4$format = _ref4.format,
34225
+ format = _ref4$format === void 0 ? "extended" : _ref4$format,
34226
+ _ref4$suppressSeconds = _ref4.suppressSeconds,
34227
+ suppressSeconds = _ref4$suppressSeconds === void 0 ? false : _ref4$suppressSeconds,
34228
+ _ref4$suppressMillise = _ref4.suppressMilliseconds,
34229
+ suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
34230
+ _ref4$includeOffset = _ref4.includeOffset,
34231
+ includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset;
34088
34232
 
34089
34233
  if (!this.isValid) {
34090
34234
  return null;
34091
34235
  }
34092
34236
 
34093
- return this.toISODate(opts) + "T" + this.toISOTime(opts);
34237
+ var ext = format === "extended";
34238
+
34239
+ var c = _toISODate(this, ext);
34240
+
34241
+ c += "T";
34242
+ c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);
34243
+ return c;
34094
34244
  }
34095
34245
  /**
34096
34246
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
@@ -34102,18 +34252,16 @@ var DateTime = /*#__PURE__*/function () {
34102
34252
  */
34103
34253
  ;
34104
34254
 
34105
- _proto.toISODate = function toISODate(_temp3) {
34106
- var _ref5 = _temp3 === void 0 ? {} : _temp3,
34255
+ _proto.toISODate = function toISODate(_temp4) {
34256
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
34107
34257
  _ref5$format = _ref5.format,
34108
34258
  format = _ref5$format === void 0 ? "extended" : _ref5$format;
34109
34259
 
34110
- var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd";
34111
-
34112
- if (this.year > 9999) {
34113
- fmt = "+" + fmt;
34260
+ if (!this.isValid) {
34261
+ return null;
34114
34262
  }
34115
34263
 
34116
- return toTechFormat(this, fmt);
34264
+ return _toISODate(this, format === "extended");
34117
34265
  }
34118
34266
  /**
34119
34267
  * Returns an ISO 8601-compliant string representation of this DateTime's week date
@@ -34141,8 +34289,8 @@ var DateTime = /*#__PURE__*/function () {
34141
34289
  */
34142
34290
  ;
34143
34291
 
34144
- _proto.toISOTime = function toISOTime(_temp4) {
34145
- var _ref6 = _temp4 === void 0 ? {} : _temp4,
34292
+ _proto.toISOTime = function toISOTime(_temp5) {
34293
+ var _ref6 = _temp5 === void 0 ? {} : _temp5,
34146
34294
  _ref6$suppressMillise = _ref6.suppressMilliseconds,
34147
34295
  suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise,
34148
34296
  _ref6$suppressSeconds = _ref6.suppressSeconds,
@@ -34154,16 +34302,15 @@ var DateTime = /*#__PURE__*/function () {
34154
34302
  _ref6$format = _ref6.format,
34155
34303
  format = _ref6$format === void 0 ? "extended" : _ref6$format;
34156
34304
 
34157
- return toTechTimeFormat(this, {
34158
- suppressSeconds: suppressSeconds,
34159
- suppressMilliseconds: suppressMilliseconds,
34160
- includeOffset: includeOffset,
34161
- includePrefix: includePrefix,
34162
- format: format
34163
- });
34305
+ if (!this.isValid) {
34306
+ return null;
34307
+ }
34308
+
34309
+ var c = includePrefix ? "T" : "";
34310
+ return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
34164
34311
  }
34165
34312
  /**
34166
- * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC
34313
+ * Returns an RFC 2822-compatible string representation of this DateTime
34167
34314
  * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
34168
34315
  * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
34169
34316
  * @return {string}
@@ -34174,7 +34321,7 @@ var DateTime = /*#__PURE__*/function () {
34174
34321
  return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
34175
34322
  }
34176
34323
  /**
34177
- * Returns a string representation of this DateTime appropriate for use in HTTP headers.
34324
+ * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
34178
34325
  * Specifically, the string conforms to RFC 1123.
34179
34326
  * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
34180
34327
  * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
@@ -34194,7 +34341,11 @@ var DateTime = /*#__PURE__*/function () {
34194
34341
  ;
34195
34342
 
34196
34343
  _proto.toSQLDate = function toSQLDate() {
34197
- return toTechFormat(this, "yyyy-MM-dd");
34344
+ if (!this.isValid) {
34345
+ return null;
34346
+ }
34347
+
34348
+ return _toISODate(this, true);
34198
34349
  }
34199
34350
  /**
34200
34351
  * Returns a string representation of this DateTime appropriate for use in SQL Time
@@ -34209,18 +34360,26 @@ var DateTime = /*#__PURE__*/function () {
34209
34360
  */
34210
34361
  ;
34211
34362
 
34212
- _proto.toSQLTime = function toSQLTime(_temp5) {
34213
- var _ref7 = _temp5 === void 0 ? {} : _temp5,
34363
+ _proto.toSQLTime = function toSQLTime(_temp6) {
34364
+ var _ref7 = _temp6 === void 0 ? {} : _temp6,
34214
34365
  _ref7$includeOffset = _ref7.includeOffset,
34215
34366
  includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
34216
34367
  _ref7$includeZone = _ref7.includeZone,
34217
34368
  includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone;
34218
34369
 
34219
- return toTechTimeFormat(this, {
34220
- includeOffset: includeOffset,
34221
- includeZone: includeZone,
34222
- spaceZone: true
34223
- });
34370
+ var fmt = "HH:mm:ss.SSS";
34371
+
34372
+ if (includeZone || includeOffset) {
34373
+ fmt += " ";
34374
+
34375
+ if (includeZone) {
34376
+ fmt += "z";
34377
+ } else if (includeOffset) {
34378
+ fmt += "ZZ";
34379
+ }
34380
+ }
34381
+
34382
+ return toTechFormat(this, fmt, true);
34224
34383
  }
34225
34384
  /**
34226
34385
  * Returns a string representation of this DateTime appropriate for use in SQL DateTime
@@ -34424,10 +34583,10 @@ var DateTime = /*#__PURE__*/function () {
34424
34583
  _proto.hasSame = function hasSame(otherDateTime, unit) {
34425
34584
  if (!this.isValid) return false;
34426
34585
  var inputMs = otherDateTime.valueOf();
34427
- var otherZoneDateTime = this.setZone(otherDateTime.zone, {
34586
+ var adjustedToZone = this.setZone(otherDateTime.zone, {
34428
34587
  keepLocalTime: true
34429
34588
  });
34430
- return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit);
34589
+ return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
34431
34590
  }
34432
34591
  /**
34433
34592
  * Equality check
@@ -35226,7 +35385,7 @@ function friendlyDateTime(dateTimeish) {
35226
35385
  }
35227
35386
  }
35228
35387
 
35229
- var VERSION = "2.2.0";
35388
+ var VERSION = "2.3.0";
35230
35389
 
35231
35390
  exports.DateTime = DateTime;
35232
35391
  exports.Duration = Duration;