@nmshd/consumption 2.0.0-beta.14 → 2.0.0-beta.15

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.
@@ -6,10 +6,10 @@ const content_1 = require("@nmshd/content");
6
6
  const crypto_1 = require("@nmshd/crypto");
7
7
  const transport_1 = require("@nmshd/transport");
8
8
  exports.buildInformation = {
9
- version: "2.0.0-beta.14",
10
- build: "65",
11
- date: "2022-09-08T16:46:17+00:00",
12
- commit: "5e08a83edb35bff3255290783a568dc0123b7394",
9
+ version: "2.0.0-beta.15",
10
+ build: "66",
11
+ date: "2022-09-09T06:59:05+00:00",
12
+ commit: "36168f3d7a06186c388a1563731cfa88541125b5",
13
13
  dependencies: {"@js-soft/docdb-querytranslator":"^1.1.0","ts-simple-nameof":"^1.3.1"},
14
14
  libraries: {
15
15
  transport: transport_1.buildInformation,
@@ -9,5 +9,5 @@ export declare class ConsumptionBaseController {
9
9
  get parent(): ConsumptionController;
10
10
  constructor(controllerName: ConsumptionControllerName, _parent: ConsumptionController);
11
11
  init(): Promise<this>;
12
- protected parseArray<T extends CoreSerializable | CoreSerializable>(values: Object[], type: new () => T): T[];
12
+ protected parseArray<T extends CoreSerializable>(values: Object[], type: new () => T): T[];
13
13
  }
@@ -17,7 +17,7 @@ class ConsumptionBaseController {
17
17
  return Promise.resolve(this);
18
18
  }
19
19
  parseArray(values, type) {
20
- return values.map((v) => type.from(v));
20
+ return values.map((v) => type.fromAny(v));
21
21
  }
22
22
  }
23
23
  exports.ConsumptionBaseController = ConsumptionBaseController;
@@ -1 +1 @@
1
- {"version":3,"file":"ConsumptionBaseController.js","sourceRoot":"","sources":["../../src/consumption/ConsumptionBaseController.ts"],"names":[],"mappings":";;;AACA,gDAA2E;AAI3E,MAAa,yBAAyB;IAUlC,YAAmB,cAAyC,EAAY,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;QAClG,IAAI,CAAC,IAAI,GAAG,kCAAsB,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAChE,CAAC;IAVD,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;IAMM,IAAI;QACP,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAES,UAAU,CAAgD,MAAgB,EAAE,IAAiB;QACnG,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,IAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;CACJ;AArBD,8DAqBC"}
1
+ {"version":3,"file":"ConsumptionBaseController.js","sourceRoot":"","sources":["../../src/consumption/ConsumptionBaseController.ts"],"names":[],"mappings":";;;AACA,gDAA2E;AAI3E,MAAa,yBAAyB;IAUlC,YAAmB,cAAyC,EAAY,OAA8B;QAA9B,YAAO,GAAP,OAAO,CAAuB;QAClG,IAAI,CAAC,IAAI,GAAG,kCAAsB,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;IAChE,CAAC;IAVD,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;IAMM,IAAI;QACP,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAES,UAAU,CAA6B,MAAgB,EAAE,IAAiB;QAChF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,IAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;IACtD,CAAC;CACJ;AArBD,8DAqBC"}
@@ -17,10 +17,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
17
17
  const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
18
18
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
19
19
  exports.buildInformation = {
20
- version: "2.0.0-beta.14",
21
- build: "65",
22
- date: "2022-09-08T16:46:17+00:00",
23
- commit: "5e08a83edb35bff3255290783a568dc0123b7394",
20
+ version: "2.0.0-beta.15",
21
+ build: "66",
22
+ date: "2022-09-09T06:59:05+00:00",
23
+ commit: "36168f3d7a06186c388a1563731cfa88541125b5",
24
24
  dependencies: {"@js-soft/docdb-querytranslator":"^1.1.0","ts-simple-nameof":"^1.3.1"},
25
25
  libraries: {
26
26
  transport: transport_1.buildInformation,
@@ -59,7 +59,7 @@ class ConsumptionBaseController {
59
59
  return Promise.resolve(this);
60
60
  }
61
61
  parseArray(values, type) {
62
- return values.map((v) => type.from(v));
62
+ return values.map((v) => type.fromAny(v));
63
63
  }
64
64
  }
65
65
  exports.ConsumptionBaseController = ConsumptionBaseController;
@@ -9111,7 +9111,8 @@ function clone$1(dur, alts, clear = false) {
9111
9111
  ...(alts.values || {})
9112
9112
  },
9113
9113
  loc: dur.loc.clone(alts.loc),
9114
- conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy
9114
+ conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
9115
+ matrix: alts.matrix || dur.matrix
9115
9116
  };
9116
9117
  return new Duration(conf);
9117
9118
  }
@@ -9150,7 +9151,7 @@ function normalizeValues(matrix, vals) {
9150
9151
  *
9151
9152
  * Here is a brief overview of commonly used methods and getters in Duration:
9152
9153
  *
9153
- * * **Creation** To create a Duration, use {@link Duration#fromMillis}, {@link Duration#fromObject}, or {@link Duration#fromISO}.
9154
+ * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.
9154
9155
  * * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.
9155
9156
  * * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.
9156
9157
  * * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.
@@ -9166,10 +9167,16 @@ class Duration {
9166
9167
  */
9167
9168
  constructor(config) {
9168
9169
  const accurate = config.conversionAccuracy === "longterm" || false;
9170
+ let matrix = accurate ? accurateMatrix : casualMatrix;
9171
+
9172
+ if (config.matrix) {
9173
+ matrix = config.matrix;
9174
+ }
9169
9175
  /**
9170
9176
  * @access private
9171
9177
  */
9172
9178
 
9179
+
9173
9180
  this.values = config.values;
9174
9181
  /**
9175
9182
  * @access private
@@ -9190,7 +9197,7 @@ class Duration {
9190
9197
  * @access private
9191
9198
  */
9192
9199
 
9193
- this.matrix = accurate ? accurateMatrix : casualMatrix;
9200
+ this.matrix = matrix;
9194
9201
  /**
9195
9202
  * @access private
9196
9203
  */
@@ -9229,7 +9236,8 @@ class Duration {
9229
9236
  * @param {Object} [opts=[]] - options for creating this Duration
9230
9237
  * @param {string} [opts.locale='en-US'] - the locale to use
9231
9238
  * @param {string} opts.numberingSystem - the numbering system to use
9232
- * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
9239
+ * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
9240
+ * @param {string} [opts.matrix=Object] - the custom conversion system to use
9233
9241
  * @return {Duration}
9234
9242
  */
9235
9243
 
@@ -9242,7 +9250,8 @@ class Duration {
9242
9250
  return new Duration({
9243
9251
  values: normalizeObject(obj, Duration.normalizeUnit),
9244
9252
  loc: Locale.fromObject(opts),
9245
- conversionAccuracy: opts.conversionAccuracy
9253
+ conversionAccuracy: opts.conversionAccuracy,
9254
+ matrix: opts.matrix
9246
9255
  });
9247
9256
  }
9248
9257
  /**
@@ -9274,7 +9283,8 @@ class Duration {
9274
9283
  * @param {Object} opts - options for parsing
9275
9284
  * @param {string} [opts.locale='en-US'] - the locale to use
9276
9285
  * @param {string} opts.numberingSystem - the numbering system to use
9277
- * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
9286
+ * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
9287
+ * @param {string} [opts.matrix=Object] - the preset conversion system to use
9278
9288
  * @see https://en.wikipedia.org/wiki/ISO_8601#Durations
9279
9289
  * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }
9280
9290
  * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }
@@ -9298,7 +9308,8 @@ class Duration {
9298
9308
  * @param {Object} opts - options for parsing
9299
9309
  * @param {string} [opts.locale='en-US'] - the locale to use
9300
9310
  * @param {string} opts.numberingSystem - the numbering system to use
9301
- * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
9311
+ * @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
9312
+ * @param {string} [opts.matrix=Object] - the conversion system to use
9302
9313
  * @see https://en.wikipedia.org/wiki/ISO_8601#Times
9303
9314
  * @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }
9304
9315
  * @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
@@ -9629,7 +9640,7 @@ class Duration {
9629
9640
  * Scale this Duration by the specified amount. Return a newly-constructed Duration.
9630
9641
  * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.
9631
9642
  * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }
9632
- * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 }
9643
+ * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 }
9633
9644
  * @return {Duration}
9634
9645
  */
9635
9646
 
@@ -9687,20 +9698,18 @@ class Duration {
9687
9698
  reconfigure({
9688
9699
  locale,
9689
9700
  numberingSystem,
9690
- conversionAccuracy
9701
+ conversionAccuracy,
9702
+ matrix
9691
9703
  } = {}) {
9692
9704
  const loc = this.loc.clone({
9693
9705
  locale,
9694
9706
  numberingSystem
9695
- }),
9696
- opts = {
9697
- loc
9707
+ });
9708
+ const opts = {
9709
+ loc,
9710
+ matrix,
9711
+ conversionAccuracy
9698
9712
  };
9699
-
9700
- if (conversionAccuracy) {
9701
- opts.conversionAccuracy = conversionAccuracy;
9702
- }
9703
-
9704
9713
  return clone$1(this, opts);
9705
9714
  }
9706
9715
  /**
@@ -9974,10 +9983,10 @@ function validateStartEnd(start, end) {
9974
9983
  *
9975
9984
  * Here is a brief overview of the most commonly used methods and getters in Interval:
9976
9985
  *
9977
- * * **Creation** To create an Interval, use {@link Interval#fromDateTimes}, {@link Interval#after}, {@link Interval#before}, or {@link Interval#fromISO}.
9986
+ * * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.
9978
9987
  * * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.
9979
9988
  * * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.
9980
- * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval#merge}, {@link Interval#xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.
9989
+ * * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.
9981
9990
  * * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}
9982
9991
  * * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.
9983
9992
  */
@@ -11418,7 +11427,6 @@ function expandMacroTokens(tokens, locale) {
11418
11427
  * @private
11419
11428
  */
11420
11429
 
11421
-
11422
11430
  function explainFromTokens(locale, input, format) {
11423
11431
  const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),
11424
11432
  units = tokens.map(t => unitForToken(t, locale)),
@@ -12014,7 +12022,7 @@ function lastOpts(argList) {
12014
12022
  *
12015
12023
  * Here is a brief overview of the most commonly used functionality it provides:
12016
12024
  *
12017
- * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime#local}, {@link DateTime#utc}, and (most flexibly) {@link DateTime#fromObject}. To create one from a standard string format, use {@link DateTime#fromISO}, {@link DateTime#fromHTTP}, and {@link DateTime#fromRFC2822}. To create one from a custom string format, use {@link DateTime#fromFormat}. To create one from a native JS date, use {@link DateTime#fromJSDate}.
12025
+ * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.
12018
12026
  * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},
12019
12027
  * {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.
12020
12028
  * * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.
@@ -12553,6 +12561,19 @@ class DateTime {
12553
12561
  static parseFormatForOpts(formatOpts, localeOpts = {}) {
12554
12562
  const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
12555
12563
  return !tokenList ? null : tokenList.map(t => t ? t.val : null).join("");
12564
+ }
12565
+ /**
12566
+ * Produce the the fully expanded format token for the locale
12567
+ * Does NOT quote characters, so quoted tokens will not round trip correctly
12568
+ * @param fmt
12569
+ * @param localeOpts
12570
+ * @returns {string}
12571
+ */
12572
+
12573
+
12574
+ static expandFormat(fmt, localeOpts = {}) {
12575
+ const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
12576
+ return expanded.map(t => t.val).join("");
12556
12577
  } // INFO
12557
12578
 
12558
12579
  /**
@@ -13245,8 +13266,8 @@ class DateTime {
13245
13266
  * @param {Object} opts - opts to override the configuration options on this DateTime
13246
13267
  * @example DateTime.now().toLocaleString(); //=> 4/20/2017
13247
13268
  * @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
13248
- * @example DateTime.now().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'
13249
13269
  * @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
13270
+ * @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'
13250
13271
  * @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
13251
13272
  * @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
13252
13273
  * @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'
@@ -13283,7 +13304,7 @@ class DateTime {
13283
13304
  * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
13284
13305
  * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
13285
13306
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
13286
- * @param {boolean} [opts.extendedZone=true] - add the time zone format extension
13307
+ * @param {boolean} [opts.extendedZone=false] - add the time zone format extension
13287
13308
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
13288
13309
  * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
13289
13310
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
@@ -13988,7 +14009,7 @@ function friendlyDateTime(dateTimeish) {
13988
14009
  }
13989
14010
  }
13990
14011
 
13991
- const VERSION = "3.0.1";
14012
+ const VERSION = "3.0.3";
13992
14013
 
13993
14014
  exports.DateTime = DateTime;
13994
14015
  exports.Duration = Duration;