@nmshd/runtime 2.4.4 → 2.4.5

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.
package/README.md CHANGED
@@ -13,6 +13,8 @@ Both the Enmeshed Connector and the official Enmeshed Apps implement this runtim
13
13
 
14
14
  You can find the documentation for Enmeshed on [enmeshed.eu](https://enmeshed.eu).
15
15
 
16
+ To get started developing in this repository, see the [developer's guide](README_dev.md).
17
+
16
18
  ## Feedback
17
19
 
18
20
  Please file any bugs or feature requests by creating an [issue](https://github.com/nmshd/feedback/issues).
@@ -7,11 +7,11 @@ const content_1 = require("@nmshd/content");
7
7
  const crypto_1 = require("@nmshd/crypto");
8
8
  const transport_1 = require("@nmshd/transport");
9
9
  exports.buildInformation = {
10
- version: "2.4.4",
11
- build: "147",
12
- date: "2023-02-28T12:35:21+00:00",
13
- commit: "ada35df169bb8ee1993c790a761e760f955e61a2",
14
- dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.7","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.1.2","@nmshd/content":"2.3.1","@nmshd/crypto":"2.0.3","@nmshd/transport":"2.0.3","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.2.1","qrcode":"1.5.1","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
10
+ version: "2.4.5",
11
+ build: "149",
12
+ date: "2023-03-10T13:49:33+00:00",
13
+ commit: "5c431d115ed815a162291b04a746001832b8dcec",
14
+ dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.8","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.1.3","@nmshd/content":"2.3.2","@nmshd/crypto":"2.0.4","@nmshd/transport":"2.0.4","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.3.0","qrcode":"1.5.1","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
15
15
  libraries: {
16
16
  serval: ts_serval_1.buildInformation,
17
17
  consumption: consumption_1.buildInformation,
@@ -548,11 +548,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
548
548
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
549
549
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
550
550
  exports.buildInformation = {
551
- version: "2.4.4",
552
- build: "147",
553
- date: "2023-02-28T12:35:21+00:00",
554
- commit: "ada35df169bb8ee1993c790a761e760f955e61a2",
555
- dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.7","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.1.2","@nmshd/content":"2.3.1","@nmshd/crypto":"2.0.3","@nmshd/transport":"2.0.3","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.2.1","qrcode":"1.5.1","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
551
+ version: "2.4.5",
552
+ build: "149",
553
+ date: "2023-03-10T13:49:33+00:00",
554
+ commit: "5c431d115ed815a162291b04a746001832b8dcec",
555
+ dependencies: {"@js-soft/docdb-querytranslator":"1.1.0","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"2.0.8","@js-soft/ts-utils":"^2.3.1","@nmshd/consumption":"3.1.3","@nmshd/content":"2.3.2","@nmshd/crypto":"2.0.4","@nmshd/transport":"2.0.4","ajv":"^8.12.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","json-stringify-safe":"^5.0.1","lodash":"^4.17.21","luxon":"^3.3.0","qrcode":"1.5.1","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
556
556
  libraries: {
557
557
  serval: ts_serval_1.buildInformation,
558
558
  consumption: consumption_1.buildInformation,
@@ -66112,8 +66112,12 @@ class PolyNumberFormatter {
66112
66112
  class PolyDateFormatter {
66113
66113
  constructor(dt, intl, opts) {
66114
66114
  this.opts = opts;
66115
+ this.originalZone = undefined;
66115
66116
  let z = undefined;
66116
- if (dt.zone.isUniversal) {
66117
+ if (this.opts.timeZone) {
66118
+ // Don't apply any workarounds if a timeZone is explicitly provided in opts
66119
+ this.dt = dt;
66120
+ } else if (dt.zone.type === "fixed") {
66117
66121
  // UTC-8 or Etc/UTC-8 are not part of tzdata, only Etc/GMT+8 and the like.
66118
66122
  // That is why fixed-offset TZ is set to that unless it is:
66119
66123
  // 1. Representing offset 0 when UTC is used to maintain previous behavior and does not become GMT.
@@ -66126,25 +66130,27 @@ class PolyDateFormatter {
66126
66130
  z = offsetZ;
66127
66131
  this.dt = dt;
66128
66132
  } else {
66129
- // Not all fixed-offset zones like Etc/+4:30 are present in tzdata.
66130
- // So we have to make do. Two cases:
66131
- // 1. The format options tell us to show the zone. We can't do that, so the best
66132
- // we can do is format the date in UTC.
66133
- // 2. The format options don't tell us to show the zone. Then we can adjust them
66134
- // the time and tell the formatter to show it to us in UTC, so that the time is right
66135
- // and the bad zone doesn't show up.
66133
+ // Not all fixed-offset zones like Etc/+4:30 are present in tzdata so
66134
+ // we manually apply the offset and substitute the zone as needed.
66136
66135
  z = "UTC";
66137
- if (opts.timeZoneName) {
66138
- this.dt = dt;
66139
- } else {
66140
- this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000);
66141
- }
66136
+ this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
66137
+ minutes: dt.offset
66138
+ });
66139
+ this.originalZone = dt.zone;
66142
66140
  }
66143
66141
  } else if (dt.zone.type === "system") {
66144
66142
  this.dt = dt;
66145
- } else {
66143
+ } else if (dt.zone.type === "iana") {
66146
66144
  this.dt = dt;
66147
66145
  z = dt.zone.name;
66146
+ } else {
66147
+ // Custom zones can have any offset / offsetName so we just manually
66148
+ // apply the offset and substitute the zone as needed.
66149
+ z = "UTC";
66150
+ this.dt = dt.setZone("UTC").plus({
66151
+ minutes: dt.offset
66152
+ });
66153
+ this.originalZone = dt.zone;
66148
66154
  }
66149
66155
  const intlOpts = {
66150
66156
  ...this.opts
@@ -66153,10 +66159,34 @@ class PolyDateFormatter {
66153
66159
  this.dtf = getCachedDTF(intl, intlOpts);
66154
66160
  }
66155
66161
  format() {
66162
+ if (this.originalZone) {
66163
+ // If we have to substitute in the actual zone name, we have to use
66164
+ // formatToParts so that the timezone can be replaced.
66165
+ return this.formatToParts().map(({
66166
+ value
66167
+ }) => value).join("");
66168
+ }
66156
66169
  return this.dtf.format(this.dt.toJSDate());
66157
66170
  }
66158
66171
  formatToParts() {
66159
- return this.dtf.formatToParts(this.dt.toJSDate());
66172
+ const parts = this.dtf.formatToParts(this.dt.toJSDate());
66173
+ if (this.originalZone) {
66174
+ return parts.map(part => {
66175
+ if (part.type === "timeZoneName") {
66176
+ const offsetName = this.originalZone.offsetName(this.dt.ts, {
66177
+ locale: this.dt.locale,
66178
+ format: this.opts.timeZoneName
66179
+ });
66180
+ return {
66181
+ ...part,
66182
+ value: offsetName
66183
+ };
66184
+ } else {
66185
+ return part;
66186
+ }
66187
+ });
66188
+ }
66189
+ return parts;
66160
66190
  }
66161
66191
  resolvedOptions() {
66162
66192
  return this.dtf.resolvedOptions();
@@ -66815,7 +66845,10 @@ function objToLocalTS(obj) {
66815
66845
  // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that
66816
66846
  if (obj.year < 100 && obj.year >= 0) {
66817
66847
  d = new Date(d);
66818
- d.setUTCFullYear(d.getUTCFullYear() - 1900);
66848
+ // set the month and day again, this is necessary because year 2000 is a leap year, but year 100 is not
66849
+ // so if obj.year is in 99, but obj.day makes it roll over into year 100,
66850
+ // the calculations done by Date.UTC are using year 2000 - which is incorrect
66851
+ d.setUTCFullYear(obj.year, obj.month - 1, obj.day);
66819
66852
  }
66820
66853
  return +d;
66821
66854
  }
@@ -67047,6 +67080,9 @@ class Formatter {
67047
67080
  return new Formatter(locale, opts);
67048
67081
  }
67049
67082
  static parseFormat(fmt) {
67083
+ // white-space is always considered a literal in user-provided formats
67084
+ // the " " token has a special meaning (see unitForToken)
67085
+
67050
67086
  let current = null,
67051
67087
  currentFull = "",
67052
67088
  bracketed = false;
@@ -67056,7 +67092,7 @@ class Formatter {
67056
67092
  if (c === "'") {
67057
67093
  if (currentFull.length > 0) {
67058
67094
  splits.push({
67059
- literal: bracketed,
67095
+ literal: bracketed || /^\s+$/.test(currentFull),
67060
67096
  val: currentFull
67061
67097
  });
67062
67098
  }
@@ -67070,7 +67106,7 @@ class Formatter {
67070
67106
  } else {
67071
67107
  if (currentFull.length > 0) {
67072
67108
  splits.push({
67073
- literal: false,
67109
+ literal: /^\s+$/.test(currentFull),
67074
67110
  val: currentFull
67075
67111
  });
67076
67112
  }
@@ -67080,7 +67116,7 @@ class Formatter {
67080
67116
  }
67081
67117
  if (currentFull.length > 0) {
67082
67118
  splits.push({
67083
- literal: bracketed,
67119
+ literal: bracketed || /^\s+$/.test(currentFull),
67084
67120
  val: currentFull
67085
67121
  });
67086
67122
  }
@@ -68808,7 +68844,7 @@ class Interval {
68808
68844
  if (!this.isValid) return NaN;
68809
68845
  const start = this.start.startOf(unit),
68810
68846
  end = this.end.startOf(unit);
68811
- return Math.floor(end.diff(start, unit).get(unit)) + 1;
68847
+ return Math.floor(end.diff(start, unit).get(unit)) + (end.valueOf() !== this.end.valueOf());
68812
68848
  }
68813
68849
 
68814
68850
  /**
@@ -69674,6 +69710,10 @@ function unitForToken(token, loc) {
69674
69710
  // because we don't have any way to figure out what they are
69675
69711
  case "z":
69676
69712
  return simple(/[a-z_+-/]{1,256}?/i);
69713
+ // this special-case "token" represents a place where a macro-token expanded into a white-space literal
69714
+ // in this case we accept any non-newline white-space
69715
+ case " ":
69716
+ return simple(/[^\S\n\r]/);
69677
69717
  default:
69678
69718
  return literal(t);
69679
69719
  }
@@ -69728,9 +69768,10 @@ function tokenForPart(part, formatOpts) {
69728
69768
  value
69729
69769
  } = part;
69730
69770
  if (type === "literal") {
69771
+ const isSpace = /^\s+$/.test(value);
69731
69772
  return {
69732
- literal: true,
69733
- val: value
69773
+ literal: !isSpace,
69774
+ val: isSpace ? " " : value
69734
69775
  };
69735
69776
  }
69736
69777
  const style = formatOpts[type];
@@ -70205,7 +70246,7 @@ function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOff
70205
70246
  setZone,
70206
70247
  zone
70207
70248
  } = opts;
70208
- if (parsed && Object.keys(parsed).length !== 0) {
70249
+ if (parsed && Object.keys(parsed).length !== 0 || parsedZone) {
70209
70250
  const interpretationZone = parsedZone || zone,
70210
70251
  inst = DateTime.fromObject(parsed, {
70211
70252
  ...opts,
@@ -72252,7 +72293,7 @@ function friendlyDateTime(dateTimeish) {
72252
72293
  }
72253
72294
  }
72254
72295
 
72255
- const VERSION = "3.2.1";
72296
+ const VERSION = "3.3.0";
72256
72297
 
72257
72298
  exports.DateTime = DateTime;
72258
72299
  exports.Duration = Duration;