@nmshd/transport 1.1.3 → 1.1.7

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.3",
19
- build: "15",
20
- date: "2021-12-28T16:36:51+00:00",
21
- commit: "d926ace865b9799f0fdc997dfeefe087f158fa26",
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.7",
19
+ build: "19",
20
+ date: "2022-01-25T08:22:08+00:00",
21
+ commit: "08b1af84a2f84252f464e3361e7b6b5a0cdfb427",
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
@@ -5249,11 +5249,32 @@ class FileController extends TransportController_1.TransportController {
5249
5249
  return await Promise.all(decryptionPromises);
5250
5250
  }
5251
5251
  async updateCache(ids) {
5252
- const resultItems = (await this.client.getFiles({ ids })).value;
5252
+ if (ids.length < 1) {
5253
+ return [];
5254
+ }
5253
5255
  const promises = [];
5254
- for await (const resultItem of resultItems) {
5256
+ for (const id of ids) {
5257
+ const result = await this.client.getFile(id);
5258
+ if (result.isError) {
5259
+ if (result.error.code === "error.transport.recordNotFound" ||
5260
+ result.error.code === "error.transport.request.notFound" ||
5261
+ result.error.code === "error.platform.recordNotFound") {
5262
+ this.log.warn(`Record id ${id} could not be found on backbone. It might be expired.`, result.error);
5263
+ continue;
5264
+ }
5265
+ throw result.error;
5266
+ }
5267
+ const resultItem = result.value;
5255
5268
  promises.push(this.updateCacheOfExistingFileInDb(resultItem.id, resultItem));
5256
5269
  }
5270
+ /*
5271
+ // TODO: Optimize once backbone handling is clarified
5272
+ const resultItems = (await this.client.getFiles({ ids })).value
5273
+ const promises = []
5274
+ for await (const resultItem of resultItems) {
5275
+ promises.push(this.updateCacheOfExistingFileInDb(resultItem.id, resultItem))
5276
+ }
5277
+ */
5257
5278
  return await Promise.all(promises);
5258
5279
  }
5259
5280
  async updateCacheOfExistingFileInDb(id, response) {
@@ -6166,6 +6187,9 @@ class MessageController extends TransportController_1.TransportController {
6166
6187
  return messageDoc ? await Message_1.Message.from(messageDoc) : undefined;
6167
6188
  }
6168
6189
  async updateCache(ids) {
6190
+ if (ids.length < 1) {
6191
+ return [];
6192
+ }
6169
6193
  const paginator = (await this.client.getMessages({ ids })).value;
6170
6194
  const promises = [];
6171
6195
  for await (const resultItem of paginator) {
@@ -7133,11 +7157,32 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
7133
7157
  return await this.parseArray(templateDocs, RelationshipTemplate_1.RelationshipTemplate);
7134
7158
  }
7135
7159
  async updateCache(ids) {
7136
- const resultItems = (await this.client.getRelationshipTemplates({ ids })).value;
7160
+ if (ids.length < 1) {
7161
+ return [];
7162
+ }
7137
7163
  const promises = [];
7138
- for await (const resultItem of resultItems) {
7164
+ for (const id of ids) {
7165
+ const result = await this.client.getRelationshipTemplate(id);
7166
+ if (result.isError) {
7167
+ if (result.error.code === "error.transport.recordNotFound" ||
7168
+ result.error.code === "error.transport.request.notFound" ||
7169
+ result.error.code === "error.platform.recordNotFound") {
7170
+ this.log.warn(`Record id ${id} could not be found on backbone. It might be expired.`, result.error);
7171
+ continue;
7172
+ }
7173
+ throw result.error;
7174
+ }
7175
+ const resultItem = result.value;
7139
7176
  promises.push(this.updateCacheOfExistingTemplateInDb(resultItem.id, resultItem));
7140
7177
  }
7178
+ /*
7179
+ // TODO: Optimize once backbone handling is clarified
7180
+ const resultItems = (await this.client.getRelationshipTemplates({ ids })).value
7181
+ const promises = []
7182
+ for await (const resultItem of resultItems) {
7183
+ promises.push(this.updateCacheOfExistingTemplateInDb(resultItem.id, resultItem))
7184
+ }
7185
+ */
7141
7186
  return await Promise.all(promises);
7142
7187
  }
7143
7188
  async fetchCaches(ids) {
@@ -7920,6 +7965,9 @@ class RelationshipsController extends core_1.TransportController {
7920
7965
  return await this.parseArray(relationshipDocs, Relationship_1.Relationship);
7921
7966
  }
7922
7967
  async updateCache(ids) {
7968
+ if (ids.length < 1) {
7969
+ return [];
7970
+ }
7923
7971
  const resultItems = (await this.client.getRelationships({ ids })).value;
7924
7972
  const promises = [];
7925
7973
  for await (const resultItem of resultItems) {
@@ -11016,11 +11064,32 @@ class TokenController extends TransportController_1.TransportController {
11016
11064
  return tokenDoc ? await Token_1.Token.from(tokenDoc) : undefined;
11017
11065
  }
11018
11066
  async updateCache(ids) {
11019
- const resultItems = (await this.client.getTokens({ ids })).value;
11067
+ if (ids.length < 1) {
11068
+ return [];
11069
+ }
11020
11070
  const promises = [];
11021
- for await (const resultItem of resultItems) {
11071
+ for (const id of ids) {
11072
+ const result = await this.client.getToken(id);
11073
+ if (result.isError) {
11074
+ if (result.error.code === "error.transport.recordNotFound" ||
11075
+ result.error.code === "error.transport.request.notFound" ||
11076
+ result.error.code === "error.platform.recordNotFound") {
11077
+ this.log.warn(`Record id ${id} could not be found on backbone. It might be expired.`, result.error);
11078
+ continue;
11079
+ }
11080
+ throw result.error;
11081
+ }
11082
+ const resultItem = result.value;
11022
11083
  promises.push(this.updateCacheOfExistingTokenInDb(resultItem.id, resultItem));
11023
11084
  }
11085
+ /*
11086
+ // TODO: Optimize once backbone handling is clarified
11087
+ const resultItems = (await this.client.getTokens({ ids })).value
11088
+ const promises = []
11089
+ for await (const resultItem of resultItems) {
11090
+ promises.push(this.updateCacheOfExistingTokenInDb(resultItem.id, resultItem))
11091
+ }
11092
+ */
11024
11093
  return await Promise.all(promises);
11025
11094
  }
11026
11095
  async fetchCaches(ids) {
@@ -12012,7 +12081,7 @@ class SimpleLogger {
12012
12081
  if (arg instanceof Error) {
12013
12082
  return (_a = arg.stack) !== null && _a !== void 0 ? _a : `${arg.name}: ${arg.message}`;
12014
12083
  }
12015
- return json_stringify_safe_1.default(arg);
12084
+ return (0, json_stringify_safe_1.default)(arg);
12016
12085
  })
12017
12086
  .join("\n");
12018
12087
  return { msg: message };
@@ -13072,14 +13141,18 @@ function Axios(instanceConfig) {
13072
13141
  *
13073
13142
  * @param {Object} config The config specific for this request (merged with this.defaults)
13074
13143
  */
13075
- Axios.prototype.request = function request(config) {
13144
+ Axios.prototype.request = function request(configOrUrl, config) {
13076
13145
  /*eslint no-param-reassign:0*/
13077
13146
  // Allow for axios('example/url'[, config]) a la fetch API
13078
- if (typeof config === 'string') {
13079
- config = arguments[1] || {};
13080
- config.url = arguments[0];
13081
- } else {
13147
+ if (typeof configOrUrl === 'string') {
13082
13148
  config = config || {};
13149
+ config.url = configOrUrl;
13150
+ } else {
13151
+ config = configOrUrl || {};
13152
+ }
13153
+
13154
+ if (!config.url) {
13155
+ throw new Error('Provided config url is not valid');
13083
13156
  }
13084
13157
 
13085
13158
  config = mergeConfig(this.defaults, config);
@@ -13164,6 +13237,9 @@ Axios.prototype.request = function request(config) {
13164
13237
  };
13165
13238
 
13166
13239
  Axios.prototype.getUri = function getUri(config) {
13240
+ if (!config.url) {
13241
+ throw new Error('Provided config url is not valid');
13242
+ }
13167
13243
  config = mergeConfig(this.defaults, config);
13168
13244
  return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
13169
13245
  };
@@ -13804,7 +13880,7 @@ module.exports = defaults;
13804
13880
  /***/ ((module) => {
13805
13881
 
13806
13882
  module.exports = {
13807
- "version": "0.24.0"
13883
+ "version": "0.25.0"
13808
13884
  };
13809
13885
 
13810
13886
  /***/ }),
@@ -14020,7 +14096,7 @@ module.exports = function isAbsoluteURL(url) {
14020
14096
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
14021
14097
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
14022
14098
  // by any combination of letters, digits, plus, period, or hyphen.
14023
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
14099
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
14024
14100
  };
14025
14101
 
14026
14102
 
@@ -14030,11 +14106,13 @@ module.exports = function isAbsoluteURL(url) {
14030
14106
  /*!********************************************************!*\
14031
14107
  !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***!
14032
14108
  \********************************************************/
14033
- /***/ ((module) => {
14109
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14034
14110
 
14035
14111
  "use strict";
14036
14112
 
14037
14113
 
14114
+ var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
14115
+
14038
14116
  /**
14039
14117
  * Determines whether the payload is an error thrown by Axios
14040
14118
  *
@@ -14042,7 +14120,7 @@ module.exports = function isAbsoluteURL(url) {
14042
14120
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
14043
14121
  */
14044
14122
  module.exports = function isAxiosError(payload) {
14045
- return (typeof payload === 'object') && (payload.isAxiosError === true);
14123
+ return utils.isObject(payload) && (payload.isAxiosError === true);
14046
14124
  };
14047
14125
 
14048
14126
 
@@ -14367,7 +14445,7 @@ var toString = Object.prototype.toString;
14367
14445
  * @returns {boolean} True if value is an Array, otherwise false
14368
14446
  */
14369
14447
  function isArray(val) {
14370
- return toString.call(val) === '[object Array]';
14448
+ return Array.isArray(val);
14371
14449
  }
14372
14450
 
14373
14451
  /**
@@ -14408,7 +14486,7 @@ function isArrayBuffer(val) {
14408
14486
  * @returns {boolean} True if value is an FormData, otherwise false
14409
14487
  */
14410
14488
  function isFormData(val) {
14411
- return (typeof FormData !== 'undefined') && (val instanceof FormData);
14489
+ return toString.call(val) === '[object FormData]';
14412
14490
  }
14413
14491
 
14414
14492
  /**
@@ -14422,7 +14500,7 @@ function isArrayBufferView(val) {
14422
14500
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
14423
14501
  result = ArrayBuffer.isView(val);
14424
14502
  } else {
14425
- result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
14503
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
14426
14504
  }
14427
14505
  return result;
14428
14506
  }
@@ -14529,7 +14607,7 @@ function isStream(val) {
14529
14607
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
14530
14608
  */
14531
14609
  function isURLSearchParams(val) {
14532
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
14610
+ return toString.call(val) === '[object URLSearchParams]';
14533
14611
  }
14534
14612
 
14535
14613
  /**
@@ -34942,17 +35020,16 @@ function padStart(input, n) {
34942
35020
  n = 2;
34943
35021
  }
34944
35022
 
34945
- var minus = input < 0 ? "-" : "";
34946
- var target = minus ? input * -1 : input;
34947
- var result;
35023
+ var isNeg = input < 0;
35024
+ var padded;
34948
35025
 
34949
- if (target.toString().length < n) {
34950
- result = ("0".repeat(n) + target).slice(-n);
35026
+ if (isNeg) {
35027
+ padded = "-" + ("" + -input).padStart(n, "0");
34951
35028
  } else {
34952
- result = target.toString();
35029
+ padded = ("" + input).padStart(n, "0");
34953
35030
  }
34954
35031
 
34955
- return "" + minus + result;
35032
+ return padded;
34956
35033
  }
34957
35034
  function parseInteger(string) {
34958
35035
  if (isUndefined(string) || string === null || string === "") {
@@ -36574,7 +36651,27 @@ var Settings = /*#__PURE__*/function () {
36574
36651
  return Settings;
36575
36652
  }();
36576
36653
 
36577
- var _excluded = ["base"];
36654
+ var _excluded = ["base"],
36655
+ _excluded2 = ["padTo", "floor"];
36656
+
36657
+ var intlLFCache = {};
36658
+
36659
+ function getCachedLF(locString, opts) {
36660
+ if (opts === void 0) {
36661
+ opts = {};
36662
+ }
36663
+
36664
+ var key = JSON.stringify([locString, opts]);
36665
+ var dtf = intlLFCache[key];
36666
+
36667
+ if (!dtf) {
36668
+ dtf = new Intl.ListFormat(locString, opts);
36669
+ intlLFCache[key] = dtf;
36670
+ }
36671
+
36672
+ return dtf;
36673
+ }
36674
+
36578
36675
  var intlDTCache = {};
36579
36676
 
36580
36677
  function getCachedDTF(locString, opts) {
@@ -36743,10 +36840,15 @@ var PolyNumberFormatter = /*#__PURE__*/function () {
36743
36840
  this.padTo = opts.padTo || 0;
36744
36841
  this.floor = opts.floor || false;
36745
36842
 
36746
- if (!forceSimple) {
36747
- var intlOpts = {
36843
+ opts.padTo;
36844
+ opts.floor;
36845
+ var otherOpts = _objectWithoutPropertiesLoose(opts, _excluded2);
36846
+
36847
+ if (!forceSimple || Object.keys(otherOpts).length > 0) {
36848
+ var intlOpts = _extends({
36748
36849
  useGrouping: false
36749
- };
36850
+ }, opts);
36851
+
36750
36852
  if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
36751
36853
  this.inf = getCachedINF(intl, intlOpts);
36752
36854
  }
@@ -36940,8 +37042,7 @@ var Locale = /*#__PURE__*/function () {
36940
37042
 
36941
37043
  var _proto4 = Locale.prototype;
36942
37044
 
36943
- _proto4.listingMode = function listingMode(defaultOK) {
36944
-
37045
+ _proto4.listingMode = function listingMode() {
36945
37046
  var isActuallyEn = this.isEnglish();
36946
37047
  var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
36947
37048
  return isActuallyEn && hasNoWeirdness ? "en" : "intl";
@@ -37121,6 +37222,14 @@ var Locale = /*#__PURE__*/function () {
37121
37222
  return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
37122
37223
  };
37123
37224
 
37225
+ _proto4.listFormatter = function listFormatter(opts) {
37226
+ if (opts === void 0) {
37227
+ opts = {};
37228
+ }
37229
+
37230
+ return getCachedLF(this.intl, opts);
37231
+ };
37232
+
37124
37233
  _proto4.isEnglish = function isEnglish() {
37125
37234
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
37126
37235
  };
@@ -37866,6 +37975,48 @@ var Duration = /*#__PURE__*/function () {
37866
37975
 
37867
37976
  return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
37868
37977
  }
37978
+ /**
37979
+ * Returns a string representation of a Duration with all units included
37980
+ * To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant. See {@link Intl.NumberFormat}.
37981
+ * @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`.
37982
+ * @example
37983
+ * ```js
37984
+ * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
37985
+ * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
37986
+ * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
37987
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
37988
+ * ```
37989
+ */
37990
+ ;
37991
+
37992
+ _proto.toHuman = function toHuman(opts) {
37993
+ var _this = this;
37994
+
37995
+ if (opts === void 0) {
37996
+ opts = {};
37997
+ }
37998
+
37999
+ var l = orderedUnits$1.map(function (unit) {
38000
+ var val = _this.values[unit];
38001
+
38002
+ if (isUndefined(val)) {
38003
+ return null;
38004
+ }
38005
+
38006
+ return _this.loc.numberFormatter(_extends({
38007
+ style: "unit",
38008
+ unitDisplay: "long"
38009
+ }, opts, {
38010
+ unit: unit.slice(0, -1)
38011
+ })).format(val);
38012
+ }).filter(function (n) {
38013
+ return n;
38014
+ });
38015
+ return this.loc.listFormatter(_extends({
38016
+ type: "conjunction",
38017
+ style: opts.listStyle || "narrow"
38018
+ }, opts)).format(l);
38019
+ }
37869
38020
  /**
37870
38021
  * Returns a JavaScript object with this Duration's values.
37871
38022
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
@@ -40403,51 +40554,67 @@ function toTechFormat(dt, format, allowZ) {
40403
40554
  allowZ: allowZ,
40404
40555
  forceSimple: true
40405
40556
  }).formatDateTimeFromString(dt, format) : null;
40406
- } // technical time formats (e.g. the time part of ISO 8601), take some options
40407
- // and this commonizes their handling
40557
+ }
40408
40558
 
40559
+ function _toISODate(o, extended) {
40560
+ var longFormat = o.c.year > 9999 || o.c.year < 0;
40561
+ var c = "";
40562
+ if (longFormat && o.c.year >= 0) c += "+";
40563
+ c += padStart(o.c.year, longFormat ? 6 : 4);
40409
40564
 
40410
- function toTechTimeFormat(dt, _ref) {
40411
- var _ref$suppressSeconds = _ref.suppressSeconds,
40412
- suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds,
40413
- _ref$suppressMillisec = _ref.suppressMilliseconds,
40414
- suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec,
40415
- includeOffset = _ref.includeOffset,
40416
- _ref$includePrefix = _ref.includePrefix,
40417
- includePrefix = _ref$includePrefix === void 0 ? false : _ref$includePrefix,
40418
- _ref$includeZone = _ref.includeZone,
40419
- includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone,
40420
- _ref$spaceZone = _ref.spaceZone,
40421
- spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone,
40422
- _ref$format = _ref.format,
40423
- format = _ref$format === void 0 ? "extended" : _ref$format;
40424
- var fmt = format === "basic" ? "HHmm" : "HH:mm";
40565
+ if (extended) {
40566
+ c += "-";
40567
+ c += padStart(o.c.month);
40568
+ c += "-";
40569
+ c += padStart(o.c.day);
40570
+ } else {
40571
+ c += padStart(o.c.month);
40572
+ c += padStart(o.c.day);
40573
+ }
40425
40574
 
40426
- if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
40427
- fmt += format === "basic" ? "ss" : ":ss";
40575
+ return c;
40576
+ }
40577
+
40578
+ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
40579
+ var c = padStart(o.c.hour);
40428
40580
 
40429
- if (!suppressMilliseconds || dt.millisecond !== 0) {
40430
- fmt += ".SSS";
40581
+ if (extended) {
40582
+ c += ":";
40583
+ c += padStart(o.c.minute);
40584
+
40585
+ if (o.c.second !== 0 || !suppressSeconds) {
40586
+ c += ":";
40431
40587
  }
40588
+ } else {
40589
+ c += padStart(o.c.minute);
40432
40590
  }
40433
40591
 
40434
- if ((includeZone || includeOffset) && spaceZone) {
40435
- fmt += " ";
40436
- }
40592
+ if (o.c.second !== 0 || !suppressSeconds) {
40593
+ c += padStart(o.c.second);
40437
40594
 
40438
- if (includeZone) {
40439
- fmt += "z";
40440
- } else if (includeOffset) {
40441
- fmt += format === "basic" ? "ZZZ" : "ZZ";
40595
+ if (o.c.millisecond !== 0 || !suppressMilliseconds) {
40596
+ c += ".";
40597
+ c += padStart(o.c.millisecond, 3);
40598
+ }
40442
40599
  }
40443
40600
 
40444
- var str = toTechFormat(dt, fmt);
40445
-
40446
- if (includePrefix) {
40447
- str = "T" + str;
40601
+ if (includeOffset) {
40602
+ if (o.isOffsetFixed && o.offset === 0) {
40603
+ c += "Z";
40604
+ } else if (o.o < 0) {
40605
+ c += "-";
40606
+ c += padStart(Math.trunc(-o.o / 60));
40607
+ c += ":";
40608
+ c += padStart(Math.trunc(-o.o % 60));
40609
+ } else {
40610
+ c += "+";
40611
+ c += padStart(Math.trunc(o.o / 60));
40612
+ c += ":";
40613
+ c += padStart(Math.trunc(o.o % 60));
40614
+ }
40448
40615
  }
40449
40616
 
40450
- return str;
40617
+ return c;
40451
40618
  } // defaults for unspecified units in the supported calendars
40452
40619
 
40453
40620
 
@@ -40642,9 +40809,9 @@ var DateTime = /*#__PURE__*/function () {
40642
40809
  var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
40643
40810
 
40644
40811
  if (unchanged) {
40645
- var _ref2 = [config.old.c, config.old.o];
40646
- c = _ref2[0];
40647
- o = _ref2[1];
40812
+ var _ref = [config.old.c, config.old.o];
40813
+ c = _ref[0];
40814
+ o = _ref[1];
40648
40815
  } else {
40649
40816
  var ot = zone.offset(this.ts);
40650
40817
  c = tsToObj(this.ts, ot);
@@ -41314,11 +41481,11 @@ var DateTime = /*#__PURE__*/function () {
41314
41481
  ;
41315
41482
 
41316
41483
  _proto.setZone = function setZone(zone, _temp) {
41317
- var _ref3 = _temp === void 0 ? {} : _temp,
41318
- _ref3$keepLocalTime = _ref3.keepLocalTime,
41319
- keepLocalTime = _ref3$keepLocalTime === void 0 ? false : _ref3$keepLocalTime,
41320
- _ref3$keepCalendarTim = _ref3.keepCalendarTime,
41321
- keepCalendarTime = _ref3$keepCalendarTim === void 0 ? false : _ref3$keepCalendarTim;
41484
+ var _ref2 = _temp === void 0 ? {} : _temp,
41485
+ _ref2$keepLocalTime = _ref2.keepLocalTime,
41486
+ keepLocalTime = _ref2$keepLocalTime === void 0 ? false : _ref2$keepLocalTime,
41487
+ _ref2$keepCalendarTim = _ref2.keepCalendarTime,
41488
+ keepCalendarTime = _ref2$keepCalendarTim === void 0 ? false : _ref2$keepCalendarTim;
41322
41489
 
41323
41490
  zone = normalizeZone(zone, Settings.defaultZone);
41324
41491
 
@@ -41353,10 +41520,10 @@ var DateTime = /*#__PURE__*/function () {
41353
41520
  ;
41354
41521
 
41355
41522
  _proto.reconfigure = function reconfigure(_temp2) {
41356
- var _ref4 = _temp2 === void 0 ? {} : _temp2,
41357
- locale = _ref4.locale,
41358
- numberingSystem = _ref4.numberingSystem,
41359
- outputCalendar = _ref4.outputCalendar;
41523
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
41524
+ locale = _ref3.locale,
41525
+ numberingSystem = _ref3.numberingSystem,
41526
+ outputCalendar = _ref3.outputCalendar;
41360
41527
 
41361
41528
  var loc = this.loc.clone({
41362
41529
  locale: locale,
@@ -41459,7 +41626,7 @@ var DateTime = /*#__PURE__*/function () {
41459
41626
  * See {@link DateTime#plus}
41460
41627
  * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
41461
41628
  @return {DateTime}
41462
- */
41629
+ */
41463
41630
  ;
41464
41631
 
41465
41632
  _proto.minus = function minus(duration) {
@@ -41624,7 +41791,7 @@ var DateTime = /*#__PURE__*/function () {
41624
41791
  * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
41625
41792
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
41626
41793
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
41627
- * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
41794
+ * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
41628
41795
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
41629
41796
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
41630
41797
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
@@ -41632,16 +41799,28 @@ var DateTime = /*#__PURE__*/function () {
41632
41799
  */
41633
41800
  ;
41634
41801
 
41635
- _proto.toISO = function toISO(opts) {
41636
- if (opts === void 0) {
41637
- opts = {};
41638
- }
41802
+ _proto.toISO = function toISO(_temp3) {
41803
+ var _ref4 = _temp3 === void 0 ? {} : _temp3,
41804
+ _ref4$format = _ref4.format,
41805
+ format = _ref4$format === void 0 ? "extended" : _ref4$format,
41806
+ _ref4$suppressSeconds = _ref4.suppressSeconds,
41807
+ suppressSeconds = _ref4$suppressSeconds === void 0 ? false : _ref4$suppressSeconds,
41808
+ _ref4$suppressMillise = _ref4.suppressMilliseconds,
41809
+ suppressMilliseconds = _ref4$suppressMillise === void 0 ? false : _ref4$suppressMillise,
41810
+ _ref4$includeOffset = _ref4.includeOffset,
41811
+ includeOffset = _ref4$includeOffset === void 0 ? true : _ref4$includeOffset;
41639
41812
 
41640
41813
  if (!this.isValid) {
41641
41814
  return null;
41642
41815
  }
41643
41816
 
41644
- return this.toISODate(opts) + "T" + this.toISOTime(opts);
41817
+ var ext = format === "extended";
41818
+
41819
+ var c = _toISODate(this, ext);
41820
+
41821
+ c += "T";
41822
+ c += _toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset);
41823
+ return c;
41645
41824
  }
41646
41825
  /**
41647
41826
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
@@ -41653,18 +41832,16 @@ var DateTime = /*#__PURE__*/function () {
41653
41832
  */
41654
41833
  ;
41655
41834
 
41656
- _proto.toISODate = function toISODate(_temp3) {
41657
- var _ref5 = _temp3 === void 0 ? {} : _temp3,
41835
+ _proto.toISODate = function toISODate(_temp4) {
41836
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
41658
41837
  _ref5$format = _ref5.format,
41659
41838
  format = _ref5$format === void 0 ? "extended" : _ref5$format;
41660
41839
 
41661
- var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd";
41662
-
41663
- if (this.year > 9999) {
41664
- fmt = "+" + fmt;
41840
+ if (!this.isValid) {
41841
+ return null;
41665
41842
  }
41666
41843
 
41667
- return toTechFormat(this, fmt);
41844
+ return _toISODate(this, format === "extended");
41668
41845
  }
41669
41846
  /**
41670
41847
  * Returns an ISO 8601-compliant string representation of this DateTime's week date
@@ -41692,8 +41869,8 @@ var DateTime = /*#__PURE__*/function () {
41692
41869
  */
41693
41870
  ;
41694
41871
 
41695
- _proto.toISOTime = function toISOTime(_temp4) {
41696
- var _ref6 = _temp4 === void 0 ? {} : _temp4,
41872
+ _proto.toISOTime = function toISOTime(_temp5) {
41873
+ var _ref6 = _temp5 === void 0 ? {} : _temp5,
41697
41874
  _ref6$suppressMillise = _ref6.suppressMilliseconds,
41698
41875
  suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise,
41699
41876
  _ref6$suppressSeconds = _ref6.suppressSeconds,
@@ -41705,16 +41882,15 @@ var DateTime = /*#__PURE__*/function () {
41705
41882
  _ref6$format = _ref6.format,
41706
41883
  format = _ref6$format === void 0 ? "extended" : _ref6$format;
41707
41884
 
41708
- return toTechTimeFormat(this, {
41709
- suppressSeconds: suppressSeconds,
41710
- suppressMilliseconds: suppressMilliseconds,
41711
- includeOffset: includeOffset,
41712
- includePrefix: includePrefix,
41713
- format: format
41714
- });
41885
+ if (!this.isValid) {
41886
+ return null;
41887
+ }
41888
+
41889
+ var c = includePrefix ? "T" : "";
41890
+ return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
41715
41891
  }
41716
41892
  /**
41717
- * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC
41893
+ * Returns an RFC 2822-compatible string representation of this DateTime
41718
41894
  * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
41719
41895
  * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
41720
41896
  * @return {string}
@@ -41725,7 +41901,7 @@ var DateTime = /*#__PURE__*/function () {
41725
41901
  return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
41726
41902
  }
41727
41903
  /**
41728
- * Returns a string representation of this DateTime appropriate for use in HTTP headers.
41904
+ * Returns a string representation of this DateTime appropriate for use in HTTP headers. The output is always expressed in GMT.
41729
41905
  * Specifically, the string conforms to RFC 1123.
41730
41906
  * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
41731
41907
  * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
@@ -41745,7 +41921,11 @@ var DateTime = /*#__PURE__*/function () {
41745
41921
  ;
41746
41922
 
41747
41923
  _proto.toSQLDate = function toSQLDate() {
41748
- return toTechFormat(this, "yyyy-MM-dd");
41924
+ if (!this.isValid) {
41925
+ return null;
41926
+ }
41927
+
41928
+ return _toISODate(this, true);
41749
41929
  }
41750
41930
  /**
41751
41931
  * Returns a string representation of this DateTime appropriate for use in SQL Time
@@ -41760,18 +41940,26 @@ var DateTime = /*#__PURE__*/function () {
41760
41940
  */
41761
41941
  ;
41762
41942
 
41763
- _proto.toSQLTime = function toSQLTime(_temp5) {
41764
- var _ref7 = _temp5 === void 0 ? {} : _temp5,
41943
+ _proto.toSQLTime = function toSQLTime(_temp6) {
41944
+ var _ref7 = _temp6 === void 0 ? {} : _temp6,
41765
41945
  _ref7$includeOffset = _ref7.includeOffset,
41766
41946
  includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
41767
41947
  _ref7$includeZone = _ref7.includeZone,
41768
41948
  includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone;
41769
41949
 
41770
- return toTechTimeFormat(this, {
41771
- includeOffset: includeOffset,
41772
- includeZone: includeZone,
41773
- spaceZone: true
41774
- });
41950
+ var fmt = "HH:mm:ss.SSS";
41951
+
41952
+ if (includeZone || includeOffset) {
41953
+ fmt += " ";
41954
+
41955
+ if (includeZone) {
41956
+ fmt += "z";
41957
+ } else if (includeOffset) {
41958
+ fmt += "ZZ";
41959
+ }
41960
+ }
41961
+
41962
+ return toTechFormat(this, fmt, true);
41775
41963
  }
41776
41964
  /**
41777
41965
  * Returns a string representation of this DateTime appropriate for use in SQL DateTime
@@ -41975,10 +42163,10 @@ var DateTime = /*#__PURE__*/function () {
41975
42163
  _proto.hasSame = function hasSame(otherDateTime, unit) {
41976
42164
  if (!this.isValid) return false;
41977
42165
  var inputMs = otherDateTime.valueOf();
41978
- var otherZoneDateTime = this.setZone(otherDateTime.zone, {
42166
+ var adjustedToZone = this.setZone(otherDateTime.zone, {
41979
42167
  keepLocalTime: true
41980
42168
  });
41981
- return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit);
42169
+ return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
41982
42170
  }
41983
42171
  /**
41984
42172
  * Equality check
@@ -42777,7 +42965,7 @@ function friendlyDateTime(dateTimeish) {
42777
42965
  }
42778
42966
  }
42779
42967
 
42780
- var VERSION = "2.2.0";
42968
+ var VERSION = "2.3.0";
42781
42969
 
42782
42970
  exports.DateTime = DateTime;
42783
42971
  exports.Duration = Duration;
@@ -43474,7 +43662,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
43474
43662
  ) {
43475
43663
  obj = [];
43476
43664
  obj[index] = leaf;
43477
- } else {
43665
+ } else if (cleanRoot !== '__proto__') {
43478
43666
  obj[cleanRoot] = leaf;
43479
43667
  }
43480
43668
  }
@@ -43692,7 +43880,7 @@ var stringify = function stringify(
43692
43880
  var tmpSc = sideChannel;
43693
43881
  var step = 0;
43694
43882
  var findFlag = false;
43695
- while ((tmpSc = tmpSc.get(sentinel)) !== undefined && !findFlag) {
43883
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
43696
43884
  // Where object last appeared in the ref tree
43697
43885
  var pos = tmpSc.get(object);
43698
43886
  step += 1;
@@ -43754,7 +43942,7 @@ var stringify = function stringify(
43754
43942
  var objKeys;
43755
43943
  if (generateArrayPrefix === 'comma' && isArray(obj)) {
43756
43944
  // we need to join elements in
43757
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
43945
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
43758
43946
  } else if (isArray(filter)) {
43759
43947
  objKeys = filter;
43760
43948
  } else {
@@ -43764,7 +43952,7 @@ var stringify = function stringify(
43764
43952
 
43765
43953
  for (var j = 0; j < objKeys.length; ++j) {
43766
43954
  var key = objKeys[j];
43767
- var value = typeof key === 'object' && key.value !== undefined ? key.value : obj[key];
43955
+ var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
43768
43956
 
43769
43957
  if (skipNulls && value === null) {
43770
43958
  continue;
@@ -43804,7 +43992,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
43804
43992
  return defaults;
43805
43993
  }
43806
43994
 
43807
- if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
43995
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
43808
43996
  throw new TypeError('Encoder has to be a function.');
43809
43997
  }
43810
43998