@nmshd/runtime 1.2.7 → 1.2.11

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.7",
331
- build: "22",
332
- date: "2021-12-28T17:46:08+00:00",
333
- commit: "d41ef8c47ab5e5633fb077cac667f1a77ee17fdc",
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.10","@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.11",
331
+ build: "26",
332
+ date: "2022-01-04T10:02:05+00:00",
333
+ commit: "983cadd9b210c4fc12b1184cfa7b316e767c8d37",
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;
@@ -24927,6 +24937,43 @@ function escapeJsonPtr(str) {
24927
24937
  }
24928
24938
 
24929
24939
 
24940
+ /***/ }),
24941
+
24942
+ /***/ "./node_modules/json-stringify-safe/stringify.js":
24943
+ /*!*******************************************************!*\
24944
+ !*** ./node_modules/json-stringify-safe/stringify.js ***!
24945
+ \*******************************************************/
24946
+ /***/ ((module, exports) => {
24947
+
24948
+ exports = module.exports = stringify
24949
+ exports.getSerialize = serializer
24950
+
24951
+ function stringify(obj, replacer, spaces, cycleReplacer) {
24952
+ return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
24953
+ }
24954
+
24955
+ function serializer(replacer, cycleReplacer) {
24956
+ var stack = [], keys = []
24957
+
24958
+ if (cycleReplacer == null) cycleReplacer = function(key, value) {
24959
+ if (stack[0] === value) return "[Circular ~]"
24960
+ return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
24961
+ }
24962
+
24963
+ return function(key, value) {
24964
+ if (stack.length > 0) {
24965
+ var thisPos = stack.indexOf(this)
24966
+ ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
24967
+ ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
24968
+ if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
24969
+ }
24970
+ else stack.push(value)
24971
+
24972
+ return replacer == null ? value : replacer.call(this, key, value)
24973
+ }
24974
+ }
24975
+
24976
+
24930
24977
  /***/ }),
24931
24978
 
24932
24979
  /***/ "./node_modules/lodash.get/index.js":
@@ -27391,17 +27438,16 @@ function padStart(input, n) {
27391
27438
  n = 2;
27392
27439
  }
27393
27440
 
27394
- var minus = input < 0 ? "-" : "";
27395
- var target = minus ? input * -1 : input;
27396
- var result;
27441
+ var isNeg = input < 0;
27442
+ var padded;
27397
27443
 
27398
- if (target.toString().length < n) {
27399
- result = ("0".repeat(n) + target).slice(-n);
27444
+ if (isNeg) {
27445
+ padded = "-" + ("" + -input).padStart(n, "0");
27400
27446
  } else {
27401
- result = target.toString();
27447
+ padded = ("" + input).padStart(n, "0");
27402
27448
  }
27403
27449
 
27404
- return "" + minus + result;
27450
+ return padded;
27405
27451
  }
27406
27452
  function parseInteger(string) {
27407
27453
  if (isUndefined(string) || string === null || string === "") {
@@ -29023,7 +29069,27 @@ var Settings = /*#__PURE__*/function () {
29023
29069
  return Settings;
29024
29070
  }();
29025
29071
 
29026
- var _excluded = ["base"];
29072
+ var _excluded = ["base"],
29073
+ _excluded2 = ["padTo", "floor"];
29074
+
29075
+ var intlLFCache = {};
29076
+
29077
+ function getCachedLF(locString, opts) {
29078
+ if (opts === void 0) {
29079
+ opts = {};
29080
+ }
29081
+
29082
+ var key = JSON.stringify([locString, opts]);
29083
+ var dtf = intlLFCache[key];
29084
+
29085
+ if (!dtf) {
29086
+ dtf = new Intl.ListFormat(locString, opts);
29087
+ intlLFCache[key] = dtf;
29088
+ }
29089
+
29090
+ return dtf;
29091
+ }
29092
+
29027
29093
  var intlDTCache = {};
29028
29094
 
29029
29095
  function getCachedDTF(locString, opts) {
@@ -29192,10 +29258,15 @@ var PolyNumberFormatter = /*#__PURE__*/function () {
29192
29258
  this.padTo = opts.padTo || 0;
29193
29259
  this.floor = opts.floor || false;
29194
29260
 
29195
- if (!forceSimple) {
29196
- var intlOpts = {
29261
+ opts.padTo;
29262
+ opts.floor;
29263
+ var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2);
29264
+
29265
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
29266
+ var intlOpts = _extends({
29197
29267
  useGrouping: false
29198
- };
29268
+ }, opts);
29269
+
29199
29270
  if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
29200
29271
  this.inf = getCachedINF(intl, intlOpts);
29201
29272
  }
@@ -29389,8 +29460,7 @@ var Locale = /*#__PURE__*/function () {
29389
29460
 
29390
29461
  var _proto4 = Locale.prototype;
29391
29462
 
29392
- _proto4.listingMode = function listingMode(defaultOK) {
29393
-
29463
+ _proto4.listingMode = function listingMode() {
29394
29464
  var isActuallyEn = this.isEnglish();
29395
29465
  var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
29396
29466
  return isActuallyEn && hasNoWeirdness ? "en" : "intl";
@@ -29570,6 +29640,14 @@ var Locale = /*#__PURE__*/function () {
29570
29640
  return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
29571
29641
  };
29572
29642
 
29643
+ _proto4.listFormatter = function listFormatter(opts) {
29644
+ if (opts === void 0) {
29645
+ opts = {};
29646
+ }
29647
+
29648
+ return getCachedLF(this.intl, opts);
29649
+ };
29650
+
29573
29651
  _proto4.isEnglish = function isEnglish() {
29574
29652
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
29575
29653
  };
@@ -30315,6 +30393,48 @@ var Duration = /*#__PURE__*/function () {
30315
30393
 
30316
30394
  return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
30317
30395
  }
30396
+ /**
30397
+ * Returns a string representation of a Duration with all units included
30398
+ * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. See {@link Intl.NumberFormat}.
30399
+ * @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`.
30400
+ * @example
30401
+ * ```js
30402
+ * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
30403
+ * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
30404
+ * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
30405
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
30406
+ * ```
30407
+ */
30408
+ ;
30409
+
30410
+ _proto.toHuman = function toHuman(opts) {
30411
+ var _this = this;
30412
+
30413
+ if (opts === void 0) {
30414
+ opts = {};
30415
+ }
30416
+
30417
+ var l = orderedUnits$1.map(function (unit) {
30418
+ var val = _this.values[unit];
30419
+
30420
+ if (isUndefined(val)) {
30421
+ return null;
30422
+ }
30423
+
30424
+ return _this.loc.numberFormatter(_extends({
30425
+ style: "unit",
30426
+ unitDisplay: "long"
30427
+ }, opts, {
30428
+ unit: unit.slice(0, -1)
30429
+ })).format(val);
30430
+ }).filter(function (n) {
30431
+ return n;
30432
+ });
30433
+ return this.loc.listFormatter(_extends({
30434
+ type: "conjunction",
30435
+ style: opts.listStyle || "narrow"
30436
+ }, opts)).format(l);
30437
+ }
30318
30438
  /**
30319
30439
  * Returns a JavaScript object with this Duration's values.
30320
30440
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
@@ -32852,51 +32972,67 @@ function toTechFormat(dt, format, allowZ) {
32852
32972
  allowZ: allowZ,
32853
32973
  forceSimple: true
32854
32974
  }).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
32975
+ }
32857
32976
 
32977
+ function _toISODate(o, extended) {
32978
+ var longFormat = o.c.year > 9999 || o.c.year < 0;
32979
+ var c = "";
32980
+ if (longFormat && o.c.year >= 0) c += "+";
32981
+ c += padStart(o.c.year, longFormat ? 6 : 4);
32982
+
32983
+ if (extended) {
32984
+ c += "-";
32985
+ c += padStart(o.c.month);
32986
+ c += "-";
32987
+ c += padStart(o.c.day);
32988
+ } else {
32989
+ c += padStart(o.c.month);
32990
+ c += padStart(o.c.day);
32991
+ }
32992
+
32993
+ return c;
32994
+ }
32858
32995
 
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";
32996
+ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
32997
+ var c = padStart(o.c.hour);
32874
32998
 
32875
- if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
32876
- fmt += format === "basic" ? "ss" : ":ss";
32999
+ if (extended) {
33000
+ c += ":";
33001
+ c += padStart(o.c.minute);
32877
33002
 
32878
- if (!suppressMilliseconds || dt.millisecond !== 0) {
32879
- fmt += ".SSS";
33003
+ if (o.c.second !== 0 || !suppressSeconds) {
33004
+ c += ":";
32880
33005
  }
33006
+ } else {
33007
+ c += padStart(o.c.minute);
32881
33008
  }
32882
33009
 
32883
- if ((includeZone || includeOffset) && spaceZone) {
32884
- fmt += " ";
32885
- }
33010
+ if (o.c.second !== 0 || !suppressSeconds) {
33011
+ c += padStart(o.c.second);
32886
33012
 
32887
- if (includeZone) {
32888
- fmt += "z";
32889
- } else if (includeOffset) {
32890
- fmt += format === "basic" ? "ZZZ" : "ZZ";
33013
+ if (o.c.millisecond !== 0 || !suppressMilliseconds) {
33014
+ c += ".";
33015
+ c += padStart(o.c.millisecond, 3);
33016
+ }
32891
33017
  }
32892
33018
 
32893
- var str = toTechFormat(dt, fmt);
32894
-
32895
- if (includePrefix) {
32896
- str = "T" + str;
33019
+ if (includeOffset) {
33020
+ if (o.isOffsetFixed && o.offset === 0) {
33021
+ c += "Z";
33022
+ } else if (o.o < 0) {
33023
+ c += "-";
33024
+ c += padStart(Math.trunc(-o.o / 60));
33025
+ c += ":";
33026
+ c += padStart(Math.trunc(-o.o % 60));
33027
+ } else {
33028
+ c += "+";
33029
+ c += padStart(Math.trunc(o.o / 60));
33030
+ c += ":";
33031
+ c += padStart(Math.trunc(o.o % 60));
33032
+ }
32897
33033
  }
32898
33034
 
32899
- return str;
33035
+ return c;
32900
33036
  } // defaults for unspecified units in the supported calendars
32901
33037
 
32902
33038
 
@@ -33091,9 +33227,9 @@ var DateTime = /*#__PURE__*/function () {
33091
33227
  var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
33092
33228
 
33093
33229
  if (unchanged) {
33094
- var _ref2 = [config.old.c, config.old.o];
33095
- c = _ref2[0];
33096
- o = _ref2[1];
33230
+ var _ref = [config.old.c, config.old.o];
33231
+ c = _ref[0];
33232
+ o = _ref[1];
33097
33233
  } else {
33098
33234
  var ot = zone.offset(this.ts);
33099
33235
  c = tsToObj(this.ts, ot);
@@ -33763,11 +33899,11 @@ var DateTime = /*#__PURE__*/function () {
33763
33899
  ;
33764
33900
 
33765
33901
  _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;
33902
+ var _ref2 = _temp === void 0 ? {} : _temp,
33903
+ _ref2$keepLocalTime = _ref2.keepLocalTime,
33904
+ keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime,
33905
+ _ref2$keepCalendarTim = _ref2.keepCalendarTime,
33906
+ keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim;
33771
33907
 
33772
33908
  zone = normalizeZone(zone, Settings.defaultZone);
33773
33909
 
@@ -33802,10 +33938,10 @@ var DateTime = /*#__PURE__*/function () {
33802
33938
  ;
33803
33939
 
33804
33940
  _proto.reconfigure = function reconfigure(_temp2) {
33805
- var _ref4 = _temp2 === void 0 ? {} : _temp2,
33806
- locale = _ref4.locale,
33807
- numberingSystem = _ref4.numberingSystem,
33808
- outputCalendar = _ref4.outputCalendar;
33941
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
33942
+ locale = _ref3.locale,
33943
+ numberingSystem = _ref3.numberingSystem,
33944
+ outputCalendar = _ref3.outputCalendar;
33809
33945
 
33810
33946
  var loc = this.loc.clone({
33811
33947
  locale: locale,
@@ -33908,7 +34044,7 @@ var DateTime = /*#__PURE__*/function () {
33908
34044
  * See {@link DateTime#plus}
33909
34045
  * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
33910
34046
  @return {DateTime}
33911
- */
34047
+ */
33912
34048
  ;
33913
34049
 
33914
34050
  _proto.minus = function minus(duration) {
@@ -34073,7 +34209,7 @@ var DateTime = /*#__PURE__*/function () {
34073
34209
  * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
34074
34210
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
34075
34211
  * @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'
34212
+ * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
34077
34213
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
34078
34214
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
34079
34215
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
@@ -34081,16 +34217,28 @@ var DateTime = /*#__PURE__*/function () {
34081
34217
  */
34082
34218
  ;
34083
34219
 
34084
- _proto.toISO = function toISO(opts) {
34085
- if (opts === void 0) {
34086
- opts = {};
34087
- }
34220
+ _proto.toISO = function toISO(_temp3) {
34221
+ var _ref4 = _temp3 === void 0 ? {} : _temp3,
34222
+ _ref4$format = _ref4.format,
34223
+ format = _ref4$format === void 0 ? "extended" : _ref4$format,
34224
+ _ref4$suppressSeconds = _ref4.suppressSeconds,
34225
+ suppressSeconds = _ref4$suppressSeconds === void 0 ? false : _ref4$suppressSeconds,
34226
+ _ref4$suppressMillise = _ref4.suppressMilliseconds,
34227
+ suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
34228
+ _ref4$includeOffset = _ref4.includeOffset,
34229
+ includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset;
34088
34230
 
34089
34231
  if (!this.isValid) {
34090
34232
  return null;
34091
34233
  }
34092
34234
 
34093
- return this.toISODate(opts) + "T" + this.toISOTime(opts);
34235
+ var ext = format === "extended";
34236
+
34237
+ var c = _toISODate(this, ext);
34238
+
34239
+ c += "T";
34240
+ c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);
34241
+ return c;
34094
34242
  }
34095
34243
  /**
34096
34244
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
@@ -34102,18 +34250,16 @@ var DateTime = /*#__PURE__*/function () {
34102
34250
  */
34103
34251
  ;
34104
34252
 
34105
- _proto.toISODate = function toISODate(_temp3) {
34106
- var _ref5 = _temp3 === void 0 ? {} : _temp3,
34253
+ _proto.toISODate = function toISODate(_temp4) {
34254
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
34107
34255
  _ref5$format = _ref5.format,
34108
34256
  format = _ref5$format === void 0 ? "extended" : _ref5$format;
34109
34257
 
34110
- var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd";
34111
-
34112
- if (this.year > 9999) {
34113
- fmt = "+" + fmt;
34258
+ if (!this.isValid) {
34259
+ return null;
34114
34260
  }
34115
34261
 
34116
- return toTechFormat(this, fmt);
34262
+ return _toISODate(this, format === "extended");
34117
34263
  }
34118
34264
  /**
34119
34265
  * Returns an ISO 8601-compliant string representation of this DateTime's week date
@@ -34141,8 +34287,8 @@ var DateTime = /*#__PURE__*/function () {
34141
34287
  */
34142
34288
  ;
34143
34289
 
34144
- _proto.toISOTime = function toISOTime(_temp4) {
34145
- var _ref6 = _temp4 === void 0 ? {} : _temp4,
34290
+ _proto.toISOTime = function toISOTime(_temp5) {
34291
+ var _ref6 = _temp5 === void 0 ? {} : _temp5,
34146
34292
  _ref6$suppressMillise = _ref6.suppressMilliseconds,
34147
34293
  suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise,
34148
34294
  _ref6$suppressSeconds = _ref6.suppressSeconds,
@@ -34154,16 +34300,15 @@ var DateTime = /*#__PURE__*/function () {
34154
34300
  _ref6$format = _ref6.format,
34155
34301
  format = _ref6$format === void 0 ? "extended" : _ref6$format;
34156
34302
 
34157
- return toTechTimeFormat(this, {
34158
- suppressSeconds: suppressSeconds,
34159
- suppressMilliseconds: suppressMilliseconds,
34160
- includeOffset: includeOffset,
34161
- includePrefix: includePrefix,
34162
- format: format
34163
- });
34303
+ if (!this.isValid) {
34304
+ return null;
34305
+ }
34306
+
34307
+ var c = includePrefix ? "T" : "";
34308
+ return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
34164
34309
  }
34165
34310
  /**
34166
- * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC
34311
+ * Returns an RFC 2822-compatible string representation of this DateTime
34167
34312
  * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
34168
34313
  * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
34169
34314
  * @return {string}
@@ -34174,7 +34319,7 @@ var DateTime = /*#__PURE__*/function () {
34174
34319
  return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
34175
34320
  }
34176
34321
  /**
34177
- * Returns a string representation of this DateTime appropriate for use in HTTP headers.
34322
+ * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
34178
34323
  * Specifically, the string conforms to RFC 1123.
34179
34324
  * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
34180
34325
  * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
@@ -34194,7 +34339,11 @@ var DateTime = /*#__PURE__*/function () {
34194
34339
  ;
34195
34340
 
34196
34341
  _proto.toSQLDate = function toSQLDate() {
34197
- return toTechFormat(this, "yyyy-MM-dd");
34342
+ if (!this.isValid) {
34343
+ return null;
34344
+ }
34345
+
34346
+ return _toISODate(this, true);
34198
34347
  }
34199
34348
  /**
34200
34349
  * Returns a string representation of this DateTime appropriate for use in SQL Time
@@ -34209,18 +34358,26 @@ var DateTime = /*#__PURE__*/function () {
34209
34358
  */
34210
34359
  ;
34211
34360
 
34212
- _proto.toSQLTime = function toSQLTime(_temp5) {
34213
- var _ref7 = _temp5 === void 0 ? {} : _temp5,
34361
+ _proto.toSQLTime = function toSQLTime(_temp6) {
34362
+ var _ref7 = _temp6 === void 0 ? {} : _temp6,
34214
34363
  _ref7$includeOffset = _ref7.includeOffset,
34215
34364
  includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
34216
34365
  _ref7$includeZone = _ref7.includeZone,
34217
34366
  includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone;
34218
34367
 
34219
- return toTechTimeFormat(this, {
34220
- includeOffset: includeOffset,
34221
- includeZone: includeZone,
34222
- spaceZone: true
34223
- });
34368
+ var fmt = "HH:mm:ss.SSS";
34369
+
34370
+ if (includeZone || includeOffset) {
34371
+ fmt += " ";
34372
+
34373
+ if (includeZone) {
34374
+ fmt += "z";
34375
+ } else if (includeOffset) {
34376
+ fmt += "ZZ";
34377
+ }
34378
+ }
34379
+
34380
+ return toTechFormat(this, fmt, true);
34224
34381
  }
34225
34382
  /**
34226
34383
  * Returns a string representation of this DateTime appropriate for use in SQL DateTime
@@ -34424,10 +34581,10 @@ var DateTime = /*#__PURE__*/function () {
34424
34581
  _proto.hasSame = function hasSame(otherDateTime, unit) {
34425
34582
  if (!this.isValid) return false;
34426
34583
  var inputMs = otherDateTime.valueOf();
34427
- var otherZoneDateTime = this.setZone(otherDateTime.zone, {
34584
+ var adjustedToZone = this.setZone(otherDateTime.zone, {
34428
34585
  keepLocalTime: true
34429
34586
  });
34430
- return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit);
34587
+ return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
34431
34588
  }
34432
34589
  /**
34433
34590
  * Equality check
@@ -35226,7 +35383,7 @@ function friendlyDateTime(dateTimeish) {
35226
35383
  }
35227
35384
  }
35228
35385
 
35229
- var VERSION = "2.2.0";
35386
+ var VERSION = "2.3.0";
35230
35387
 
35231
35388
  exports.DateTime = DateTime;
35232
35389
  exports.Duration = Duration;