@nmshd/transport 1.1.2 → 1.1.6

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.2",
19
- build: "14",
20
- date: "2021-12-27T14:35:00+00:00",
21
- commit: "08e6e7a9d318eed605afe46dbea5043a964968e3",
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.6",
19
+ build: "18",
20
+ date: "2022-01-18T13:52:13+00:00",
21
+ commit: "c09b6d27bdbb5c6a8e4ef80024e5f10a36379b92",
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.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
@@ -3118,6 +3118,7 @@ const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-s
3118
3118
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
3119
3119
  const CoreSerializableAsync_1 = __webpack_require__(/*! ../../../core/CoreSerializableAsync */ "./dist/core/CoreSerializableAsync.js");
3120
3120
  const CoreAddress_1 = __webpack_require__(/*! ../../../core/types/CoreAddress */ "./dist/core/types/CoreAddress.js");
3121
+ const CoreDate_1 = __webpack_require__(/*! ../../../core/types/CoreDate */ "./dist/core/types/CoreDate.js");
3121
3122
  var Realm;
3122
3123
  (function (Realm) {
3123
3124
  Realm["Dev"] = "dev";
@@ -3126,7 +3127,13 @@ var Realm;
3126
3127
  })(Realm = exports.Realm || (exports.Realm = {}));
3127
3128
  let Identity = Identity_1 = class Identity extends CoreSerializableAsync_1.CoreSerializableAsync {
3128
3129
  static async from(value) {
3129
- return await super.fromT(value, Identity_1);
3130
+ const identity = await super.fromT(value, Identity_1);
3131
+ // TODO: Remove these default values once we're sure that nobody is accessing the deprecated properties anymore
3132
+ identity.name = "";
3133
+ identity.description = "";
3134
+ identity.type = "unknown";
3135
+ identity.createdAt = CoreDate_1.CoreDate.from("2020-01-01T00:00:00Z");
3136
+ return identity;
3130
3137
  }
3131
3138
  };
3132
3139
  __decorate([
@@ -3144,6 +3151,30 @@ __decorate([
3144
3151
  (0, ts_serval_1.serialize)(),
3145
3152
  __metadata("design:type", String)
3146
3153
  ], Identity.prototype, "realm", void 0);
3154
+ __decorate([
3155
+ (0, ts_serval_1.validate)({ nullable: true }),
3156
+ (0, ts_serval_1.serialize)(),
3157
+ __metadata("design:type", String)
3158
+ ], Identity.prototype, "name", void 0);
3159
+ __decorate([
3160
+ (0, ts_serval_1.validate)({ nullable: true }),
3161
+ (0, ts_serval_1.serialize)(),
3162
+ __metadata("design:type", String)
3163
+ ], Identity.prototype, "description", void 0);
3164
+ __decorate([
3165
+ (0, ts_serval_1.validate)({ nullable: true }),
3166
+ (0, ts_serval_1.serialize)(),
3167
+ __metadata("design:type", CoreDate_1.CoreDate
3168
+ /**
3169
+ * @deprecated
3170
+ */
3171
+ )
3172
+ ], Identity.prototype, "createdAt", void 0);
3173
+ __decorate([
3174
+ (0, ts_serval_1.validate)({ nullable: true }),
3175
+ (0, ts_serval_1.serialize)(),
3176
+ __metadata("design:type", String)
3177
+ ], Identity.prototype, "type", void 0);
3147
3178
  Identity = Identity_1 = __decorate([
3148
3179
  (0, ts_serval_1.type)("Identity")
3149
3180
  ], Identity);
@@ -5218,11 +5249,32 @@ class FileController extends TransportController_1.TransportController {
5218
5249
  return await Promise.all(decryptionPromises);
5219
5250
  }
5220
5251
  async updateCache(ids) {
5221
- const resultItems = (await this.client.getFiles({ ids })).value;
5252
+ if (ids.length < 1) {
5253
+ return [];
5254
+ }
5222
5255
  const promises = [];
5223
- 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;
5224
5268
  promises.push(this.updateCacheOfExistingFileInDb(resultItem.id, resultItem));
5225
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
+ */
5226
5278
  return await Promise.all(promises);
5227
5279
  }
5228
5280
  async updateCacheOfExistingFileInDb(id, response) {
@@ -6135,6 +6187,9 @@ class MessageController extends TransportController_1.TransportController {
6135
6187
  return messageDoc ? await Message_1.Message.from(messageDoc) : undefined;
6136
6188
  }
6137
6189
  async updateCache(ids) {
6190
+ if (ids.length < 1) {
6191
+ return [];
6192
+ }
6138
6193
  const paginator = (await this.client.getMessages({ ids })).value;
6139
6194
  const promises = [];
6140
6195
  for await (const resultItem of paginator) {
@@ -7102,11 +7157,32 @@ class RelationshipTemplateController extends TransportController_1.TransportCont
7102
7157
  return await this.parseArray(templateDocs, RelationshipTemplate_1.RelationshipTemplate);
7103
7158
  }
7104
7159
  async updateCache(ids) {
7105
- const resultItems = (await this.client.getRelationshipTemplates({ ids })).value;
7160
+ if (ids.length < 1) {
7161
+ return [];
7162
+ }
7106
7163
  const promises = [];
7107
- 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;
7108
7176
  promises.push(this.updateCacheOfExistingTemplateInDb(resultItem.id, resultItem));
7109
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
+ */
7110
7186
  return await Promise.all(promises);
7111
7187
  }
7112
7188
  async fetchCaches(ids) {
@@ -7889,6 +7965,9 @@ class RelationshipsController extends core_1.TransportController {
7889
7965
  return await this.parseArray(relationshipDocs, Relationship_1.Relationship);
7890
7966
  }
7891
7967
  async updateCache(ids) {
7968
+ if (ids.length < 1) {
7969
+ return [];
7970
+ }
7892
7971
  const resultItems = (await this.client.getRelationships({ ids })).value;
7893
7972
  const promises = [];
7894
7973
  for await (const resultItem of resultItems) {
@@ -10985,11 +11064,32 @@ class TokenController extends TransportController_1.TransportController {
10985
11064
  return tokenDoc ? await Token_1.Token.from(tokenDoc) : undefined;
10986
11065
  }
10987
11066
  async updateCache(ids) {
10988
- const resultItems = (await this.client.getTokens({ ids })).value;
11067
+ if (ids.length < 1) {
11068
+ return [];
11069
+ }
10989
11070
  const promises = [];
10990
- 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;
10991
11083
  promises.push(this.updateCacheOfExistingTokenInDb(resultItem.id, resultItem));
10992
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
+ */
10993
11093
  return await Promise.all(promises);
10994
11094
  }
10995
11095
  async fetchCaches(ids) {
@@ -13041,14 +13141,18 @@ function Axios(instanceConfig) {
13041
13141
  *
13042
13142
  * @param {Object} config The config specific for this request (merged with this.defaults)
13043
13143
  */
13044
- Axios.prototype.request = function request(config) {
13144
+ Axios.prototype.request = function request(configOrUrl, config) {
13045
13145
  /*eslint no-param-reassign:0*/
13046
13146
  // Allow for axios('example/url'[, config]) a la fetch API
13047
- if (typeof config === 'string') {
13048
- config = arguments[1] || {};
13049
- config.url = arguments[0];
13050
- } else {
13147
+ if (typeof configOrUrl === 'string') {
13051
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');
13052
13156
  }
13053
13157
 
13054
13158
  config = mergeConfig(this.defaults, config);
@@ -13133,6 +13237,9 @@ Axios.prototype.request = function request(config) {
13133
13237
  };
13134
13238
 
13135
13239
  Axios.prototype.getUri = function getUri(config) {
13240
+ if (!config.url) {
13241
+ throw new Error('Provided config url is not valid');
13242
+ }
13136
13243
  config = mergeConfig(this.defaults, config);
13137
13244
  return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
13138
13245
  };
@@ -13773,7 +13880,7 @@ module.exports = defaults;
13773
13880
  /***/ ((module) => {
13774
13881
 
13775
13882
  module.exports = {
13776
- "version": "0.24.0"
13883
+ "version": "0.25.0"
13777
13884
  };
13778
13885
 
13779
13886
  /***/ }),
@@ -13989,7 +14096,7 @@ module.exports = function isAbsoluteURL(url) {
13989
14096
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
13990
14097
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
13991
14098
  // by any combination of letters, digits, plus, period, or hyphen.
13992
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
14099
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
13993
14100
  };
13994
14101
 
13995
14102
 
@@ -13999,11 +14106,13 @@ module.exports = function isAbsoluteURL(url) {
13999
14106
  /*!********************************************************!*\
14000
14107
  !*** ./node_modules/axios/lib/helpers/isAxiosError.js ***!
14001
14108
  \********************************************************/
14002
- /***/ ((module) => {
14109
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
14003
14110
 
14004
14111
  "use strict";
14005
14112
 
14006
14113
 
14114
+ var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
14115
+
14007
14116
  /**
14008
14117
  * Determines whether the payload is an error thrown by Axios
14009
14118
  *
@@ -14011,7 +14120,7 @@ module.exports = function isAbsoluteURL(url) {
14011
14120
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
14012
14121
  */
14013
14122
  module.exports = function isAxiosError(payload) {
14014
- return (typeof payload === 'object') && (payload.isAxiosError === true);
14123
+ return utils.isObject(payload) && (payload.isAxiosError === true);
14015
14124
  };
14016
14125
 
14017
14126
 
@@ -14336,7 +14445,7 @@ var toString = Object.prototype.toString;
14336
14445
  * @returns {boolean} True if value is an Array, otherwise false
14337
14446
  */
14338
14447
  function isArray(val) {
14339
- return toString.call(val) === '[object Array]';
14448
+ return Array.isArray(val);
14340
14449
  }
14341
14450
 
14342
14451
  /**
@@ -14377,7 +14486,7 @@ function isArrayBuffer(val) {
14377
14486
  * @returns {boolean} True if value is an FormData, otherwise false
14378
14487
  */
14379
14488
  function isFormData(val) {
14380
- return (typeof FormData !== 'undefined') && (val instanceof FormData);
14489
+ return toString.call(val) === '[object FormData]';
14381
14490
  }
14382
14491
 
14383
14492
  /**
@@ -14391,7 +14500,7 @@ function isArrayBufferView(val) {
14391
14500
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
14392
14501
  result = ArrayBuffer.isView(val);
14393
14502
  } else {
14394
- result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
14503
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
14395
14504
  }
14396
14505
  return result;
14397
14506
  }
@@ -14498,7 +14607,7 @@ function isStream(val) {
14498
14607
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
14499
14608
  */
14500
14609
  function isURLSearchParams(val) {
14501
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
14610
+ return toString.call(val) === '[object URLSearchParams]';
14502
14611
  }
14503
14612
 
14504
14613
  /**
@@ -34911,17 +35020,16 @@ function padStart(input, n) {
34911
35020
  n = 2;
34912
35021
  }
34913
35022
 
34914
- var minus = input < 0 ? "-" : "";
34915
- var target = minus ? input * -1 : input;
34916
- var result;
35023
+ var isNeg = input < 0;
35024
+ var padded;
34917
35025
 
34918
- if (target.toString().length < n) {
34919
- result = ("0".repeat(n) + target).slice(-n);
35026
+ if (isNeg) {
35027
+ padded = "-" + ("" + -input).padStart(n, "0");
34920
35028
  } else {
34921
- result = target.toString();
35029
+ padded = ("" + input).padStart(n, "0");
34922
35030
  }
34923
35031
 
34924
- return "" + minus + result;
35032
+ return padded;
34925
35033
  }
34926
35034
  function parseInteger(string) {
34927
35035
  if (isUndefined(string) || string === null || string === "") {
@@ -36543,7 +36651,27 @@ var Settings = /*#__PURE__*/function () {
36543
36651
  return Settings;
36544
36652
  }();
36545
36653
 
36546
- 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
+
36547
36675
  var intlDTCache = {};
36548
36676
 
36549
36677
  function getCachedDTF(locString, opts) {
@@ -36712,10 +36840,15 @@ var PolyNumberFormatter = /*#__PURE__*/function () {
36712
36840
  this.padTo = opts.padTo || 0;
36713
36841
  this.floor = opts.floor || false;
36714
36842
 
36715
- if (!forceSimple) {
36716
- 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({
36717
36849
  useGrouping: false
36718
- };
36850
+ }, opts);
36851
+
36719
36852
  if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo;
36720
36853
  this.inf = getCachedINF(intl, intlOpts);
36721
36854
  }
@@ -36909,8 +37042,7 @@ var Locale = /*#__PURE__*/function () {
36909
37042
 
36910
37043
  var _proto4 = Locale.prototype;
36911
37044
 
36912
- _proto4.listingMode = function listingMode(defaultOK) {
36913
-
37045
+ _proto4.listingMode = function listingMode() {
36914
37046
  var isActuallyEn = this.isEnglish();
36915
37047
  var hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
36916
37048
  return isActuallyEn && hasNoWeirdness ? "en" : "intl";
@@ -37090,6 +37222,14 @@ var Locale = /*#__PURE__*/function () {
37090
37222
  return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
37091
37223
  };
37092
37224
 
37225
+ _proto4.listFormatter = function listFormatter(opts) {
37226
+ if (opts === void 0) {
37227
+ opts = {};
37228
+ }
37229
+
37230
+ return getCachedLF(this.intl, opts);
37231
+ };
37232
+
37093
37233
  _proto4.isEnglish = function isEnglish() {
37094
37234
  return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
37095
37235
  };
@@ -37835,6 +37975,48 @@ var Duration = /*#__PURE__*/function () {
37835
37975
 
37836
37976
  return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
37837
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
+ }
37838
38020
  /**
37839
38021
  * Returns a JavaScript object with this Duration's values.
37840
38022
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 }
@@ -40372,51 +40554,67 @@ function toTechFormat(dt, format, allowZ) {
40372
40554
  allowZ: allowZ,
40373
40555
  forceSimple: true
40374
40556
  }).formatDateTimeFromString(dt, format) : null;
40375
- } // technical time formats (e.g. the time part of ISO 8601), take some options
40376
- // and this commonizes their handling
40557
+ }
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);
40564
+
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
+ }
40377
40574
 
40575
+ return c;
40576
+ }
40378
40577
 
40379
- function toTechTimeFormat(dt, _ref) {
40380
- var _ref$suppressSeconds = _ref.suppressSeconds,
40381
- suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds,
40382
- _ref$suppressMillisec = _ref.suppressMilliseconds,
40383
- suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec,
40384
- includeOffset = _ref.includeOffset,
40385
- _ref$includePrefix = _ref.includePrefix,
40386
- includePrefix = _ref$includePrefix === void 0 ? false : _ref$includePrefix,
40387
- _ref$includeZone = _ref.includeZone,
40388
- includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone,
40389
- _ref$spaceZone = _ref.spaceZone,
40390
- spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone,
40391
- _ref$format = _ref.format,
40392
- format = _ref$format === void 0 ? "extended" : _ref$format;
40393
- var fmt = format === "basic" ? "HHmm" : "HH:mm";
40578
+ function _toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset) {
40579
+ var c = padStart(o.c.hour);
40394
40580
 
40395
- if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) {
40396
- fmt += format === "basic" ? "ss" : ":ss";
40581
+ if (extended) {
40582
+ c += ":";
40583
+ c += padStart(o.c.minute);
40397
40584
 
40398
- if (!suppressMilliseconds || dt.millisecond !== 0) {
40399
- fmt += ".SSS";
40585
+ if (o.c.second !== 0 || !suppressSeconds) {
40586
+ c += ":";
40400
40587
  }
40588
+ } else {
40589
+ c += padStart(o.c.minute);
40401
40590
  }
40402
40591
 
40403
- if ((includeZone || includeOffset) && spaceZone) {
40404
- fmt += " ";
40405
- }
40592
+ if (o.c.second !== 0 || !suppressSeconds) {
40593
+ c += padStart(o.c.second);
40406
40594
 
40407
- if (includeZone) {
40408
- fmt += "z";
40409
- } else if (includeOffset) {
40410
- fmt += format === "basic" ? "ZZZ" : "ZZ";
40595
+ if (o.c.millisecond !== 0 || !suppressMilliseconds) {
40596
+ c += ".";
40597
+ c += padStart(o.c.millisecond, 3);
40598
+ }
40411
40599
  }
40412
40600
 
40413
- var str = toTechFormat(dt, fmt);
40414
-
40415
- if (includePrefix) {
40416
- 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
+ }
40417
40615
  }
40418
40616
 
40419
- return str;
40617
+ return c;
40420
40618
  } // defaults for unspecified units in the supported calendars
40421
40619
 
40422
40620
 
@@ -40611,9 +40809,9 @@ var DateTime = /*#__PURE__*/function () {
40611
40809
  var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
40612
40810
 
40613
40811
  if (unchanged) {
40614
- var _ref2 = [config.old.c, config.old.o];
40615
- c = _ref2[0];
40616
- o = _ref2[1];
40812
+ var _ref = [config.old.c, config.old.o];
40813
+ c = _ref[0];
40814
+ o = _ref[1];
40617
40815
  } else {
40618
40816
  var ot = zone.offset(this.ts);
40619
40817
  c = tsToObj(this.ts, ot);
@@ -41283,11 +41481,11 @@ var DateTime = /*#__PURE__*/function () {
41283
41481
  ;
41284
41482
 
41285
41483
  _proto.setZone = function setZone(zone, _temp) {
41286
- var _ref3 = _temp === void 0 ? {} : _temp,
41287
- _ref3$keepLocalTime = _ref3.keepLocalTime,
41288
- keepLocalTime = _ref3$keepLocalTime === void 0 ? false : _ref3$keepLocalTime,
41289
- _ref3$keepCalendarTim = _ref3.keepCalendarTime,
41290
- 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;
41291
41489
 
41292
41490
  zone = normalizeZone(zone, Settings.defaultZone);
41293
41491
 
@@ -41322,10 +41520,10 @@ var DateTime = /*#__PURE__*/function () {
41322
41520
  ;
41323
41521
 
41324
41522
  _proto.reconfigure = function reconfigure(_temp2) {
41325
- var _ref4 = _temp2 === void 0 ? {} : _temp2,
41326
- locale = _ref4.locale,
41327
- numberingSystem = _ref4.numberingSystem,
41328
- outputCalendar = _ref4.outputCalendar;
41523
+ var _ref3 = _temp2 === void 0 ? {} : _temp2,
41524
+ locale = _ref3.locale,
41525
+ numberingSystem = _ref3.numberingSystem,
41526
+ outputCalendar = _ref3.outputCalendar;
41329
41527
 
41330
41528
  var loc = this.loc.clone({
41331
41529
  locale: locale,
@@ -41428,7 +41626,7 @@ var DateTime = /*#__PURE__*/function () {
41428
41626
  * See {@link DateTime#plus}
41429
41627
  * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject()
41430
41628
  @return {DateTime}
41431
- */
41629
+ */
41432
41630
  ;
41433
41631
 
41434
41632
  _proto.minus = function minus(duration) {
@@ -41593,7 +41791,7 @@ var DateTime = /*#__PURE__*/function () {
41593
41791
  * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
41594
41792
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
41595
41793
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
41596
- * @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'
41597
41795
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
41598
41796
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
41599
41797
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
@@ -41601,16 +41799,28 @@ var DateTime = /*#__PURE__*/function () {
41601
41799
  */
41602
41800
  ;
41603
41801
 
41604
- _proto.toISO = function toISO(opts) {
41605
- if (opts === void 0) {
41606
- opts = {};
41607
- }
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;
41608
41812
 
41609
41813
  if (!this.isValid) {
41610
41814
  return null;
41611
41815
  }
41612
41816
 
41613
- 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;
41614
41824
  }
41615
41825
  /**
41616
41826
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
@@ -41622,18 +41832,16 @@ var DateTime = /*#__PURE__*/function () {
41622
41832
  */
41623
41833
  ;
41624
41834
 
41625
- _proto.toISODate = function toISODate(_temp3) {
41626
- var _ref5 = _temp3 === void 0 ? {} : _temp3,
41835
+ _proto.toISODate = function toISODate(_temp4) {
41836
+ var _ref5 = _temp4 === void 0 ? {} : _temp4,
41627
41837
  _ref5$format = _ref5.format,
41628
41838
  format = _ref5$format === void 0 ? "extended" : _ref5$format;
41629
41839
 
41630
- var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd";
41631
-
41632
- if (this.year > 9999) {
41633
- fmt = "+" + fmt;
41840
+ if (!this.isValid) {
41841
+ return null;
41634
41842
  }
41635
41843
 
41636
- return toTechFormat(this, fmt);
41844
+ return _toISODate(this, format === "extended");
41637
41845
  }
41638
41846
  /**
41639
41847
  * Returns an ISO 8601-compliant string representation of this DateTime's week date
@@ -41661,8 +41869,8 @@ var DateTime = /*#__PURE__*/function () {
41661
41869
  */
41662
41870
  ;
41663
41871
 
41664
- _proto.toISOTime = function toISOTime(_temp4) {
41665
- var _ref6 = _temp4 === void 0 ? {} : _temp4,
41872
+ _proto.toISOTime = function toISOTime(_temp5) {
41873
+ var _ref6 = _temp5 === void 0 ? {} : _temp5,
41666
41874
  _ref6$suppressMillise = _ref6.suppressMilliseconds,
41667
41875
  suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise,
41668
41876
  _ref6$suppressSeconds = _ref6.suppressSeconds,
@@ -41674,16 +41882,15 @@ var DateTime = /*#__PURE__*/function () {
41674
41882
  _ref6$format = _ref6.format,
41675
41883
  format = _ref6$format === void 0 ? "extended" : _ref6$format;
41676
41884
 
41677
- return toTechTimeFormat(this, {
41678
- suppressSeconds: suppressSeconds,
41679
- suppressMilliseconds: suppressMilliseconds,
41680
- includeOffset: includeOffset,
41681
- includePrefix: includePrefix,
41682
- format: format
41683
- });
41885
+ if (!this.isValid) {
41886
+ return null;
41887
+ }
41888
+
41889
+ var c = includePrefix ? "T" : "";
41890
+ return c + _toISOTime(this, format === "extended", suppressSeconds, suppressMilliseconds, includeOffset);
41684
41891
  }
41685
41892
  /**
41686
- * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC
41893
+ * Returns an RFC 2822-compatible string representation of this DateTime
41687
41894
  * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000'
41688
41895
  * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400'
41689
41896
  * @return {string}
@@ -41694,7 +41901,7 @@ var DateTime = /*#__PURE__*/function () {
41694
41901
  return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
41695
41902
  }
41696
41903
  /**
41697
- * 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.
41698
41905
  * Specifically, the string conforms to RFC 1123.
41699
41906
  * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1
41700
41907
  * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT'
@@ -41714,7 +41921,11 @@ var DateTime = /*#__PURE__*/function () {
41714
41921
  ;
41715
41922
 
41716
41923
  _proto.toSQLDate = function toSQLDate() {
41717
- return toTechFormat(this, "yyyy-MM-dd");
41924
+ if (!this.isValid) {
41925
+ return null;
41926
+ }
41927
+
41928
+ return _toISODate(this, true);
41718
41929
  }
41719
41930
  /**
41720
41931
  * Returns a string representation of this DateTime appropriate for use in SQL Time
@@ -41729,18 +41940,26 @@ var DateTime = /*#__PURE__*/function () {
41729
41940
  */
41730
41941
  ;
41731
41942
 
41732
- _proto.toSQLTime = function toSQLTime(_temp5) {
41733
- var _ref7 = _temp5 === void 0 ? {} : _temp5,
41943
+ _proto.toSQLTime = function toSQLTime(_temp6) {
41944
+ var _ref7 = _temp6 === void 0 ? {} : _temp6,
41734
41945
  _ref7$includeOffset = _ref7.includeOffset,
41735
41946
  includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset,
41736
41947
  _ref7$includeZone = _ref7.includeZone,
41737
41948
  includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone;
41738
41949
 
41739
- return toTechTimeFormat(this, {
41740
- includeOffset: includeOffset,
41741
- includeZone: includeZone,
41742
- spaceZone: true
41743
- });
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);
41744
41963
  }
41745
41964
  /**
41746
41965
  * Returns a string representation of this DateTime appropriate for use in SQL DateTime
@@ -41944,10 +42163,10 @@ var DateTime = /*#__PURE__*/function () {
41944
42163
  _proto.hasSame = function hasSame(otherDateTime, unit) {
41945
42164
  if (!this.isValid) return false;
41946
42165
  var inputMs = otherDateTime.valueOf();
41947
- var otherZoneDateTime = this.setZone(otherDateTime.zone, {
42166
+ var adjustedToZone = this.setZone(otherDateTime.zone, {
41948
42167
  keepLocalTime: true
41949
42168
  });
41950
- return otherZoneDateTime.startOf(unit) <= inputMs && inputMs <= otherZoneDateTime.endOf(unit);
42169
+ return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
41951
42170
  }
41952
42171
  /**
41953
42172
  * Equality check
@@ -42746,7 +42965,7 @@ function friendlyDateTime(dateTimeish) {
42746
42965
  }
42747
42966
  }
42748
42967
 
42749
- var VERSION = "2.2.0";
42968
+ var VERSION = "2.3.0";
42750
42969
 
42751
42970
  exports.DateTime = DateTime;
42752
42971
  exports.Duration = Duration;
@@ -43443,7 +43662,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
43443
43662
  ) {
43444
43663
  obj = [];
43445
43664
  obj[index] = leaf;
43446
- } else {
43665
+ } else if (cleanRoot !== '__proto__') {
43447
43666
  obj[cleanRoot] = leaf;
43448
43667
  }
43449
43668
  }
@@ -43661,7 +43880,7 @@ var stringify = function stringify(
43661
43880
  var tmpSc = sideChannel;
43662
43881
  var step = 0;
43663
43882
  var findFlag = false;
43664
- while ((tmpSc = tmpSc.get(sentinel)) !== undefined && !findFlag) {
43883
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
43665
43884
  // Where object last appeared in the ref tree
43666
43885
  var pos = tmpSc.get(object);
43667
43886
  step += 1;
@@ -43723,7 +43942,7 @@ var stringify = function stringify(
43723
43942
  var objKeys;
43724
43943
  if (generateArrayPrefix === 'comma' && isArray(obj)) {
43725
43944
  // we need to join elements in
43726
- objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
43945
+ objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
43727
43946
  } else if (isArray(filter)) {
43728
43947
  objKeys = filter;
43729
43948
  } else {
@@ -43733,7 +43952,7 @@ var stringify = function stringify(
43733
43952
 
43734
43953
  for (var j = 0; j < objKeys.length; ++j) {
43735
43954
  var key = objKeys[j];
43736
- 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];
43737
43956
 
43738
43957
  if (skipNulls && value === null) {
43739
43958
  continue;
@@ -43773,7 +43992,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
43773
43992
  return defaults;
43774
43993
  }
43775
43994
 
43776
- if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
43995
+ if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
43777
43996
  throw new TypeError('Encoder has to be a function.');
43778
43997
  }
43779
43998