@nmshd/transport 1.1.4 → 1.1.8

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.
@@ -15,11 +15,11 @@ exports.buildInformation = void 0;
15
15
  const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
16
16
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
17
17
  exports.buildInformation = {
18
- version: "1.1.4",
19
- build: "16",
20
- date: "2022-01-03T10:30:14+00:00",
21
- commit: "d2352a36a63834c46a5fc86dd75e6d703aaba74f",
22
- dependencies: {"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.0","@js-soft/ts-utils":"1.1.1","axios":"^0.24.0","deep-equal":"^2.0.5","fast-json-patch":"^3.1.0","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^2.2.0","qs":"^6.10.2","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^8.3.2"},
18
+ version: "1.1.8",
19
+ build: "20",
20
+ date: "2022-02-01T06:24:18+00:00",
21
+ commit: "800bbdcdec148918ad48e3c0d8851fd04876a2df",
22
+ dependencies: {"@js-soft/docdb-access-abstractions":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/simple-logger":"1.0.1","@js-soft/ts-utils":"1.1.1","axios":"^0.25.0","deep-equal":"^2.0.5","fast-json-patch":"^3.1.0","form-data":"^4.0.0","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^2.3.0","qs":"^6.10.3","reflect-metadata":"^0.1.13","ts-simple-nameof":"^1.3.1","uuid":"^8.3.2"},
23
23
  libraries: {
24
24
  crypto: crypto_1.buildInformation,
25
25
  serval: ts_serval_1.buildInformation
@@ -5257,7 +5257,8 @@ class FileController extends TransportController_1.TransportController {
5257
5257
  const result = await this.client.getFile(id);
5258
5258
  if (result.isError) {
5259
5259
  if (result.error.code === "error.transport.recordNotFound" ||
5260
- result.error.code === "error.transport.request.notFound") {
5260
+ result.error.code === "error.transport.request.notFound" ||
5261
+ result.error.code === "error.platform.recordNotFound") {
5261
5262
  this.log.warn(`Record id ${id} could not be found on backbone. It might be expired.`, result.error);
5262
5263
  continue;
5263
5264
  }
@@ -7164,7 +7165,8 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
7164
7165
  const result = await this.client.getRelationshipTemplate(id);
7165
7166
  if (result.isError) {
7166
7167
  if (result.error.code === "error.transport.recordNotFound" ||
7167
- result.error.code === "error.transport.request.notFound") {
7168
+ result.error.code === "error.transport.request.notFound" ||
7169
+ result.error.code === "error.platform.recordNotFound") {
7168
7170
  this.log.warn(`Record id ${id} could not be found on backbone. It might be expired.`, result.error);
7169
7171
  continue;
7170
7172
  }
@@ -11070,7 +11072,8 @@ class TokenController extends TransportController_1.TransportController {
11070
11072
  const result = await this.client.getToken(id);
11071
11073
  if (result.isError) {
11072
11074
  if (result.error.code === "error.transport.recordNotFound" ||
11073
- result.error.code === "error.transport.request.notFound") {
11075
+ result.error.code === "error.transport.request.notFound" ||
11076
+ result.error.code === "error.platform.recordNotFound") {
11074
11077
  this.log.warn(`Record id ${id} could not be found on backbone. It might be expired.`, result.error);
11075
11078
  continue;
11076
11079
  }
@@ -11087,7 +11090,8 @@ class TokenController extends TransportController_1.TransportController {
11087
11090
  promises.push(this.updateCacheOfExistingTokenInDb(resultItem.id, resultItem))
11088
11091
  }
11089
11092
  */
11090
- return await Promise.all(promises);
11093
+ const isToken = (item) => !!item;
11094
+ return (await Promise.all(promises)).filter(isToken);
11091
11095
  }
11092
11096
  async fetchCaches(ids) {
11093
11097
  if (ids.length === 0)
@@ -11103,7 +11107,8 @@ class TokenController extends TransportController_1.TransportController {
11103
11107
  async updateCacheOfExistingTokenInDb(id, response) {
11104
11108
  const tokenDoc = await this.tokens.read(id);
11105
11109
  if (!tokenDoc) {
11106
- throw core_1.TransportErrors.general.recordNotFound(Token_1.Token, id).logWith(this._log);
11110
+ core_1.TransportErrors.general.recordNotFound(Token_1.Token, id).logWith(this._log);
11111
+ return;
11107
11112
  }
11108
11113
  const token = await Token_1.Token.from(tokenDoc);
11109
11114
  await this.updateCacheOfToken(token, response);
@@ -11146,7 +11151,16 @@ class TokenController extends TransportController_1.TransportController {
11146
11151
  async loadPeerToken(id, secretKey, ephemeral) {
11147
11152
  const tokenDoc = await this.tokens.read(id.toString());
11148
11153
  if (tokenDoc) {
11149
- return await this.updateCacheOfExistingTokenInDb(id.toString());
11154
+ let token = await Token_1.Token.from(tokenDoc);
11155
+ if (token.cache) {
11156
+ return token;
11157
+ }
11158
+ token = await this.updateCacheOfExistingTokenInDb(id.toString());
11159
+ if (!token) {
11160
+ // This should not happen, we only update the cache if we found the tokenDoc
11161
+ throw new Error(`Tried to update a token (with ID: '${id.toString()}') that doesn't exist in the local database.`);
11162
+ }
11163
+ return token;
11150
11164
  }
11151
11165
  const token = await Token_1.Token.from({
11152
11166
  id: id,
@@ -12078,7 +12092,7 @@ class SimpleLogger {
12078
12092
  if (arg instanceof Error) {
12079
12093
  return (_a = arg.stack) !== null && _a !== void 0 ? _a : `${arg.name}: ${arg.message}`;
12080
12094
  }
12081
- return json_stringify_safe_1.default(arg);
12095
+ return (0, json_stringify_safe_1.default)(arg);
12082
12096
  })
12083
12097
  .join("\n");
12084
12098
  return { msg: message };
@@ -13138,14 +13152,18 @@ function Axios(instanceConfig) {
13138
13152
  *
13139
13153
  * @param {Object} config The config specific for this request (merged with this.defaults)
13140
13154
  */
13141
- Axios.prototype.request = function request(config) {
13155
+ Axios.prototype.request = function request(configOrUrl, config) {
13142
13156
  /*eslint no-param-reassign:0*/
13143
13157
  // Allow for axios('example/url'[, config]) a la fetch API
13144
- if (typeof config === 'string') {
13145
- config = arguments[1] || {};
13146
- config.url = arguments[0];
13147
- } else {
13158
+ if (typeof configOrUrl === 'string') {
13148
13159
  config = config || {};
13160
+ config.url = configOrUrl;
13161
+ } else {
13162
+ config = configOrUrl || {};
13163
+ }
13164
+
13165
+ if (!config.url) {
13166
+ throw new Error('Provided config url is not valid');
13149
13167
  }
13150
13168
 
13151
13169
  config = mergeConfig(this.defaults, config);
@@ -13230,6 +13248,9 @@ Axios.prototype.request = function request(config) {
13230
13248
  };
13231
13249
 
13232
13250
  Axios.prototype.getUri = function getUri(config) {
13251
+ if (!config.url) {
13252
+ throw new Error('Provided config url is not valid');
13253
+ }
13233
13254
  config = mergeConfig(this.defaults, config);
13234
13255
  return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
13235
13256
  };
@@ -13870,7 +13891,7 @@ module.exports = defaults;
13870
13891
  /***/ ((module) => {
13871
13892
 
13872
13893
  module.exports = {
13873
- "version": "0.24.0"
13894
+ "version": "0.25.0"
13874
13895
  };
13875
13896
 
13876
13897
  /***/ }),
@@ -14086,7 +14107,7 @@ module.exports = function isAbsoluteURL(url) {
14086
14107
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
14087
14108
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
14088
14109
  // by any combination of letters, digits, plus, period, or hyphen.
14089
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
14110
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
14090
14111
  };
14091
14112
 
14092
14113
 
@@ -14096,11 +14117,13 @@ module.exports = function isAbsoluteURL(url) {
14096
14117
  /*!********************************************************!*\
14097
14118
  !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***!
14098
14119
  \********************************************************/
14099
- /***/ ((module) => {
14120
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14100
14121
 
14101
14122
  "use strict";
14102
14123
 
14103
14124
 
14125
+ var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
14126
+
14104
14127
  /**
14105
14128
  * Determines whether the payload is an error thrown by Axios
14106
14129
  *
@@ -14108,7 +14131,7 @@ module.exports = function isAbsoluteURL(url) {
14108
14131
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
14109
14132
  */
14110
14133
  module.exports = function isAxiosError(payload) {
14111
- return (typeof payload === 'object') && (payload.isAxiosError === true);
14134
+ return utils.isObject(payload) && (payload.isAxiosError === true);
14112
14135
  };
14113
14136
 
14114
14137
 
@@ -14433,7 +14456,7 @@ var toString = Object.prototype.toString;
14433
14456
  * @returns {boolean} True if value is an Array, otherwise false
14434
14457
  */
14435
14458
  function isArray(val) {
14436
- return toString.call(val) === '[object Array]';
14459
+ return Array.isArray(val);
14437
14460
  }
14438
14461
 
14439
14462
  /**
@@ -14474,7 +14497,7 @@ function isArrayBuffer(val) {
14474
14497
  * @returns {boolean} True if value is an FormData, otherwise false
14475
14498
  */
14476
14499
  function isFormData(val) {
14477
- return (typeof FormData !== 'undefined') && (val instanceof FormData);
14500
+ return toString.call(val) === '[object FormData]';
14478
14501
  }
14479
14502
 
14480
14503
  /**
@@ -14488,7 +14511,7 @@ function isArrayBufferView(val) {
14488
14511
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
14489
14512
  result = ArrayBuffer.isView(val);
14490
14513
  } else {
14491
- result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
14514
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
14492
14515
  }
14493
14516
  return result;
14494
14517
  }
@@ -14595,7 +14618,7 @@ function isStream(val) {
14595
14618
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
14596
14619
  */
14597
14620
  function isURLSearchParams(val) {
14598
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
14621
+ return toString.call(val) === '[object URLSearchParams]';
14599
14622
  }
14600
14623
 
14601
14624
  /**
@@ -35008,17 +35031,16 @@ function padStart(input, n) {
35008
35031
  n = 2;
35009
35032
  }
35010
35033
 
35011
- var minus = input < 0 ? "-" : "";
35012
- var target = minus ? input * -1 : input;
35013
- var result;
35034
+ var isNeg = input < 0;
35035
+ var padded;
35014
35036
 
35015
- if (target.toString().length < n) {
35016
- result = ("0".repeat(n) + target).slice(-n);
35037
+ if (isNeg) {
35038
+ padded = "-" + ("" + -input).padStart(n, "0");
35017
35039
  } else {
35018
- result = target.toString();
35040
+ padded = ("" + input).padStart(n, "0");
35019
35041
  }
35020
35042
 
35021
- return "" + minus + result;
35043
+ return padded;
35022
35044
  }
35023
35045
  function parseInteger(string) {
35024
35046
  if (isUndefined(string) || string === null || string === "") {
@@ -36640,7 +36662,27 @@ var Settings = /*#__PURE__*/function () {
36640
36662
  return Settings;
36641
36663
  }();
36642
36664
 
36643
- var _excluded = ["base"];
36665
+ var _excluded = ["base"],
36666
+ _excluded2 = ["padTo", "floor"];
36667
+
36668
+ var intlLFCache = {};
36669
+
36670
+ function getCachedLF(locString, opts) {
36671
+ if (opts === void 0) {
36672
+ opts = {};
36673
+ }
36674
+
36675
+ var key = JSON.stringify([locString, opts]);
36676
+ var dtf = intlLFCache[key];
36677
+
36678
+ if (!dtf) {
36679
+ dtf = new Intl.ListFormat(locString, opts);
36680
+ intlLFCache[key] = dtf;
36681
+ }
36682
+
36683
+ return dtf;
36684
+ }
36685
+
36644
36686
  var intlDTCache = {};
36645
36687
 
36646
36688
  function getCachedDTF(locString, opts) {
@@ -36809,10 +36851,15 @@ var PolyNumberFormatter = /*#__PURE__*/function () {
36809
36851
  this.padTo = opts.padTo || 0;
36810
36852
  this.floor = opts.floor || false;
36811
36853
 
36812
- if (!forceSimple) {
36813
- var intlOpts = {
36854
+ opts.padTo;
36855
+ opts.floor;
36856
+ var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2);
36857
+
36858
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
36859
+ var intlOpts = _extends({
36814
36860
  useGrouping: false
36815
- };
36861
+ }, opts);
36862
+
36816
36863
  if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
36817
36864
  this.inf = getCachedINF(intl, intlOpts);
36818
36865
  }
@@ -37006,8 +37053,7 @@ var Locale = /*#__PURE__*/function () {
37006
37053
 
37007
37054
  var _proto4 = Locale.prototype;
37008
37055
 
37009
- _proto4.listingMode = function listingMode(defaultOK) {
37010
-
37056
+ _proto4.listingMode = function listingMode() {
37011
37057
  var isActuallyEn = this.isEnglish();
37012
37058
  var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
37013
37059
  return isActuallyEn && hasNoWeirdness ? "en" : "intl";
@@ -37187,6 +37233,14 @@ var Locale = /*#__PURE__*/function () {
37187
37233
  return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
37188
37234
  };
37189
37235
 
37236
+ _proto4.listFormatter = function listFormatter(opts) {
37237
+ if (opts === void 0) {
37238
+ opts = {};
37239
+ }
37240
+
37241
+ return getCachedLF(this.intl, opts);
37242
+ };
37243
+
37190
37244
  _proto4.isEnglish = function isEnglish() {
37191
37245
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
37192
37246
  };
@@ -37932,6 +37986,48 @@ var Duration = /*#__PURE__*/function () {
37932
37986
 
37933
37987
  return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
37934
37988
  }
37989
+ /**
37990
+ * Returns a string representation of a Duration with all units included
37991
+ * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. See {@link Intl.NumberFormat}.
37992
+ * @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`.
37993
+ * @example
37994
+ * ```js
37995
+ * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
37996
+ * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
37997
+ * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
37998
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
37999
+ * ```
38000
+ */
38001
+ ;
38002
+
38003
+ _proto.toHuman = function toHuman(opts) {
38004
+ var _this = this;
38005
+
38006
+ if (opts === void 0) {
38007
+ opts = {};
38008
+ }
38009
+
38010
+ var l = orderedUnits$1.map(function (unit) {
38011
+ var val = _this.values[unit];
38012
+
38013
+ if (isUndefined(val)) {
38014
+ return null;
38015
+ }
38016
+
38017
+ return _this.loc.numberFormatter(_extends({
38018
+ style: "unit",
38019
+ unitDisplay: "long"
38020
+ }, opts, {
38021
+ unit: unit.slice(0, -1)
38022
+ })).format(val);
38023
+ }).filter(function (n) {
38024
+ return n;
38025
+ });
38026
+ return this.loc.listFormatter(_extends({
38027
+ type: "conjunction",
38028
+ style: opts.listStyle || "narrow"
38029
+ }, opts)).format(l);
38030
+ }
37935
38031
  /**
37936
38032
  * Returns a JavaScript object with this Duration's values.
37937
38033
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
@@ -40469,51 +40565,67 @@ function toTechFormat(dt, format, allowZ) {
40469
40565
  allowZ: allowZ,
40470
40566
  forceSimple: true
40471
40567
  }).formatDateTimeFromString(dt, format) : null;
40472
- } // technical time formats (e.g. the time part of ISO 8601), take some options
40473
- // and this commonizes their handling
40568
+ }
40569
+
40570
+ function _toISODate(o, extended) {
40571
+ var longFormat = o.c.year > 9999 || o.c.year < 0;
40572
+ var c = "";
40573
+ if (longFormat && o.c.year >= 0) c += "+";
40574
+ c += padStart(o.c.year, longFormat ? 6 : 4);
40575
+
40576
+ if (extended) {
40577
+ c += "-";
40578
+ c += padStart(o.c.month);
40579
+ c += "-";
40580
+ c += padStart(o.c.day);
40581
+ } else {
40582
+ c += padStart(o.c.month);
40583
+ c += padStart(o.c.day);
40584
+ }
40474
40585
 
40586
+ return c;
40587
+ }
40475
40588
 
40476
- function toTechTimeFormat(dt, _ref) {
40477
- var _ref$suppressSeconds = _ref.suppressSeconds,
40478
- suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds,
40479
- _ref$suppressMillisec = _ref.suppressMilliseconds,
40480
- suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec,
40481
- includeOffset = _ref.includeOffset,
40482
- _ref$includePrefix = _ref.includePrefix,
40483
- includePrefix = _ref$includePrefix === void 0 ? false : _ref$includePrefix,
40484
- _ref$includeZone = _ref.includeZone,
40485
- includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone,
40486
- _ref$spaceZone = _ref.spaceZone,
40487
- spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone,
40488
- _ref$format = _ref.format,
40489
- format = _ref$format === void 0 ? "extended" : _ref$format;
40490
- var fmt = format === "basic" ? "HHmm" : "HH:mm";
40589
+ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
40590
+ var c = padStart(o.c.hour);
40491
40591
 
40492
- if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
40493
- fmt += format === "basic" ? "ss" : ":ss";
40592
+ if (extended) {
40593
+ c += ":";
40594
+ c += padStart(o.c.minute);
40494
40595
 
40495
- if (!suppressMilliseconds || dt.millisecond !== 0) {
40496
- fmt += ".SSS";
40596
+ if (o.c.second !== 0 || !suppressSeconds) {
40597
+ c += ":";
40497
40598
  }
40599
+ } else {
40600
+ c += padStart(o.c.minute);
40498
40601
  }
40499
40602
 
40500
- if ((includeZone || includeOffset) && spaceZone) {
40501
- fmt += " ";
40502
- }
40603
+ if (o.c.second !== 0 || !suppressSeconds) {
40604
+ c += padStart(o.c.second);
40503
40605
 
40504
- if (includeZone) {
40505
- fmt += "z";
40506
- } else if (includeOffset) {
40507
- fmt += format === "basic" ? "ZZZ" : "ZZ";
40606
+ if (o.c.millisecond !== 0 || !suppressMilliseconds) {
40607
+ c += ".";
40608
+ c += padStart(o.c.millisecond, 3);
40609
+ }
40508
40610
  }
40509
40611
 
40510
- var str = toTechFormat(dt, fmt);
40511
-
40512
- if (includePrefix) {
40513
- str = "T" + str;
40612
+ if (includeOffset) {
40613
+ if (o.isOffsetFixed && o.offset === 0) {
40614
+ c += "Z";
40615
+ } else if (o.o < 0) {
40616
+ c += "-";
40617
+ c += padStart(Math.trunc(-o.o / 60));
40618
+ c += ":";
40619
+ c += padStart(Math.trunc(-o.o % 60));
40620
+ } else {
40621
+ c += "+";
40622
+ c += padStart(Math.trunc(o.o / 60));
40623
+ c += ":";
40624
+ c += padStart(Math.trunc(o.o % 60));
40625
+ }
40514
40626
  }
40515
40627
 
40516
- return str;
40628
+ return c;
40517
40629
  } // defaults for unspecified units in the supported calendars
40518
40630
 
40519
40631
 
@@ -40708,9 +40820,9 @@ var DateTime = /*#__PURE__*/function () {
40708
40820
  var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
40709
40821
 
40710
40822
  if (unchanged) {
40711
- var _ref2 = [config.old.c, config.old.o];
40712
- c = _ref2[0];
40713
- o = _ref2[1];
40823
+ var _ref = [config.old.c, config.old.o];
40824
+ c = _ref[0];
40825
+ o = _ref[1];
40714
40826
  } else {
40715
40827
  var ot = zone.offset(this.ts);
40716
40828
  c = tsToObj(this.ts, ot);
@@ -41380,11 +41492,11 @@ var DateTime = /*#__PURE__*/function () {
41380
41492
  ;
41381
41493
 
41382
41494
  _proto.setZone = function setZone(zone, _temp) {
41383
- var _ref3 = _temp === void 0 ? {} : _temp,
41384
- _ref3$keepLocalTime = _ref3.keepLocalTime,
41385
- keepLocalTime = _ref3$keepLocalTime === void 0 ? false : _ref3$keepLocalTime,
41386
- _ref3$keepCalendarTim = _ref3.keepCalendarTime,
41387
- keepCalendarTime = _ref3$keepCalendarTim === void 0 ? false : _ref3$keepCalendarTim;
41495
+ var _ref2 = _temp === void 0 ? {} : _temp,
41496
+ _ref2$keepLocalTime = _ref2.keepLocalTime,
41497
+ keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime,
41498
+ _ref2$keepCalendarTim = _ref2.keepCalendarTime,
41499
+ keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim;
41388
41500
 
41389
41501
  zone = normalizeZone(zone, Settings.defaultZone);
41390
41502
 
@@ -41419,10 +41531,10 @@ var DateTime = /*#__PURE__*/function () {
41419
41531
  ;
41420
41532
 
41421
41533
  _proto.reconfigure = function reconfigure(_temp2) {
41422
- var _ref4 = _temp2 === void 0 ? {} : _temp2,
41423
- locale = _ref4.locale,
41424
- numberingSystem = _ref4.numberingSystem,
41425
- outputCalendar = _ref4.outputCalendar;
41534
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
41535
+ locale = _ref3.locale,
41536
+ numberingSystem = _ref3.numberingSystem,
41537
+ outputCalendar = _ref3.outputCalendar;
41426
41538
 
41427
41539
  var loc = this.loc.clone({
41428
41540
  locale: locale,
@@ -41525,7 +41637,7 @@ var DateTime = /*#__PURE__*/function () {
41525
41637
  * See {@link DateTime#plus}
41526
41638
  * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
41527
41639
  @return {DateTime}
41528
- */
41640
+ */
41529
41641
  ;
41530
41642
 
41531
41643
  _proto.minus = function minus(duration) {
@@ -41690,7 +41802,7 @@ var DateTime = /*#__PURE__*/function () {
41690
41802
  * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
41691
41803
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
41692
41804
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
41693
- * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
41805
+ * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
41694
41806
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
41695
41807
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
41696
41808
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
@@ -41698,16 +41810,28 @@ var DateTime = /*#__PURE__*/function () {
41698
41810
  */
41699
41811
  ;
41700
41812
 
41701
- _proto.toISO = function toISO(opts) {
41702
- if (opts === void 0) {
41703
- opts = {};
41704
- }
41813
+ _proto.toISO = function toISO(_temp3) {
41814
+ var _ref4 = _temp3 === void 0 ? {} : _temp3,
41815
+ _ref4$format = _ref4.format,
41816
+ format = _ref4$format === void 0 ? "extended" : _ref4$format,
41817
+ _ref4$suppressSeconds = _ref4.suppressSeconds,
41818
+ suppressSeconds = _ref4$suppressSeconds === void 0 ? false : _ref4$suppressSeconds,
41819
+ _ref4$suppressMillise = _ref4.suppressMilliseconds,
41820
+ suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
41821
+ _ref4$includeOffset = _ref4.includeOffset,
41822
+ includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset;
41705
41823
 
41706
41824
  if (!this.isValid) {
41707
41825
  return null;
41708
41826
  }
41709
41827
 
41710
- return this.toISODate(opts) + "T" + this.toISOTime(opts);
41828
+ var ext = format === "extended";
41829
+
41830
+ var c = _toISODate(this, ext);
41831
+
41832
+ c += "T";
41833
+ c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);
41834
+ return c;
41711
41835
  }
41712
41836
  /**
41713
41837
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
@@ -41719,18 +41843,16 @@ var DateTime = /*#__PURE__*/function () {
41719
41843
  */
41720
41844
  ;
41721
41845
 
41722
- _proto.toISODate = function toISODate(_temp3) {
41723
- var _ref5 = _temp3 === void 0 ? {} : _temp3,
41846
+ _proto.toISODate = function toISODate(_temp4) {
41847
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
41724
41848
  _ref5$format = _ref5.format,
41725
41849
  format = _ref5$format === void 0 ? "extended" : _ref5$format;
41726
41850
 
41727
- var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd";
41728
-
41729
- if (this.year > 9999) {
41730
- fmt = "+" + fmt;
41851
+ if (!this.isValid) {
41852
+ return null;
41731
41853
  }
41732
41854
 
41733
- return toTechFormat(this, fmt);
41855
+ return _toISODate(this, format === "extended");
41734
41856
  }
41735
41857
  /**
41736
41858
  * Returns an ISO 8601-compliant string representation of this DateTime's week date
@@ -41758,8 +41880,8 @@ var DateTime = /*#__PURE__*/function () {
41758
41880
  */
41759
41881
  ;
41760
41882
 
41761
- _proto.toISOTime = function toISOTime(_temp4) {
41762
- var _ref6 = _temp4 === void 0 ? {} : _temp4,
41883
+ _proto.toISOTime = function toISOTime(_temp5) {
41884
+ var _ref6 = _temp5 === void 0 ? {} : _temp5,
41763
41885
  _ref6$suppressMillise = _ref6.suppressMilliseconds,
41764
41886
  suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise,
41765
41887
  _ref6$suppressSeconds = _ref6.suppressSeconds,
@@ -41771,16 +41893,15 @@ var DateTime = /*#__PURE__*/function () {
41771
41893
  _ref6$format = _ref6.format,
41772
41894
  format = _ref6$format === void 0 ? "extended" : _ref6$format;
41773
41895
 
41774
- return toTechTimeFormat(this, {
41775
- suppressSeconds: suppressSeconds,
41776
- suppressMilliseconds: suppressMilliseconds,
41777
- includeOffset: includeOffset,
41778
- includePrefix: includePrefix,
41779
- format: format
41780
- });
41896
+ if (!this.isValid) {
41897
+ return null;
41898
+ }
41899
+
41900
+ var c = includePrefix ? "T" : "";
41901
+ return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
41781
41902
  }
41782
41903
  /**
41783
- * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC
41904
+ * Returns an RFC 2822-compatible string representation of this DateTime
41784
41905
  * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
41785
41906
  * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
41786
41907
  * @return {string}
@@ -41791,7 +41912,7 @@ var DateTime = /*#__PURE__*/function () {
41791
41912
  return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
41792
41913
  }
41793
41914
  /**
41794
- * Returns a string representation of this DateTime appropriate for use in HTTP headers.
41915
+ * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
41795
41916
  * Specifically, the string conforms to RFC 1123.
41796
41917
  * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
41797
41918
  * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
@@ -41811,7 +41932,11 @@ var DateTime = /*#__PURE__*/function () {
41811
41932
  ;
41812
41933
 
41813
41934
  _proto.toSQLDate = function toSQLDate() {
41814
- return toTechFormat(this, "yyyy-MM-dd");
41935
+ if (!this.isValid) {
41936
+ return null;
41937
+ }
41938
+
41939
+ return _toISODate(this, true);
41815
41940
  }
41816
41941
  /**
41817
41942
  * Returns a string representation of this DateTime appropriate for use in SQL Time
@@ -41826,18 +41951,26 @@ var DateTime = /*#__PURE__*/function () {
41826
41951
  */
41827
41952
  ;
41828
41953
 
41829
- _proto.toSQLTime = function toSQLTime(_temp5) {
41830
- var _ref7 = _temp5 === void 0 ? {} : _temp5,
41954
+ _proto.toSQLTime = function toSQLTime(_temp6) {
41955
+ var _ref7 = _temp6 === void 0 ? {} : _temp6,
41831
41956
  _ref7$includeOffset = _ref7.includeOffset,
41832
41957
  includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
41833
41958
  _ref7$includeZone = _ref7.includeZone,
41834
41959
  includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone;
41835
41960
 
41836
- return toTechTimeFormat(this, {
41837
- includeOffset: includeOffset,
41838
- includeZone: includeZone,
41839
- spaceZone: true
41840
- });
41961
+ var fmt = "HH:mm:ss.SSS";
41962
+
41963
+ if (includeZone || includeOffset) {
41964
+ fmt += " ";
41965
+
41966
+ if (includeZone) {
41967
+ fmt += "z";
41968
+ } else if (includeOffset) {
41969
+ fmt += "ZZ";
41970
+ }
41971
+ }
41972
+
41973
+ return toTechFormat(this, fmt, true);
41841
41974
  }
41842
41975
  /**
41843
41976
  * Returns a string representation of this DateTime appropriate for use in SQL DateTime
@@ -42041,10 +42174,10 @@ var DateTime = /*#__PURE__*/function () {
42041
42174
  _proto.hasSame = function hasSame(otherDateTime, unit) {
42042
42175
  if (!this.isValid) return false;
42043
42176
  var inputMs = otherDateTime.valueOf();
42044
- var otherZoneDateTime = this.setZone(otherDateTime.zone, {
42177
+ var adjustedToZone = this.setZone(otherDateTime.zone, {
42045
42178
  keepLocalTime: true
42046
42179
  });
42047
- return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit);
42180
+ return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
42048
42181
  }
42049
42182
  /**
42050
42183
  * Equality check
@@ -42843,7 +42976,7 @@ function friendlyDateTime(dateTimeish) {
42843
42976
  }
42844
42977
  }
42845
42978
 
42846
- var VERSION = "2.2.0";
42979
+ var VERSION = "2.3.0";
42847
42980
 
42848
42981
  exports.DateTime = DateTime;
42849
42982
  exports.Duration = Duration;
@@ -43540,7 +43673,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
43540
43673
  ) {
43541
43674
  obj = [];
43542
43675
  obj[index] = leaf;
43543
- } else {
43676
+ } else if (cleanRoot !== '__proto__') {
43544
43677
  obj[cleanRoot] = leaf;
43545
43678
  }
43546
43679
  }
@@ -43758,7 +43891,7 @@ var stringify = function stringify(
43758
43891
  var tmpSc = sideChannel;
43759
43892
  var step = 0;
43760
43893
  var findFlag = false;
43761
- while ((tmpSc = tmpSc.get(sentinel)) !== undefined && !findFlag) {
43894
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
43762
43895
  // Where object last appeared in the ref tree
43763
43896
  var pos = tmpSc.get(object);
43764
43897
  step += 1;
@@ -43820,7 +43953,7 @@ var stringify = function stringify(
43820
43953
  var objKeys;
43821
43954
  if (generateArrayPrefix === 'comma' && isArray(obj)) {
43822
43955
  // we need to join elements in
43823
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
43956
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
43824
43957
  } else if (isArray(filter)) {
43825
43958
  objKeys = filter;
43826
43959
  } else {
@@ -43830,7 +43963,7 @@ var stringify = function stringify(
43830
43963
 
43831
43964
  for (var j = 0; j < objKeys.length; ++j) {
43832
43965
  var key = objKeys[j];
43833
- var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
43966
+ var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
43834
43967
 
43835
43968
  if (skipNulls && value === null) {
43836
43969
  continue;
@@ -43870,7 +44003,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
43870
44003
  return defaults;
43871
44004
  }
43872
44005
 
43873
- if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
44006
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
43874
44007
  throw new TypeError('Encoder has to be a function.');
43875
44008
  }
43876
44009