@punks/backend-entity-manager 0.0.321 → 0.0.322

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/dist/cjs/index.js CHANGED
@@ -2769,6 +2769,11 @@ class PipelineInstance {
2769
2769
  }
2770
2770
  buildInitialStepState() {
2771
2771
  return {
2772
+ reference: {
2773
+ index: 0,
2774
+ key: this.definition.steps[0].operations[0].key,
2775
+ name: this.definition.steps[0].operations[0].name,
2776
+ },
2772
2777
  stepInput: this.input,
2773
2778
  context: this.context,
2774
2779
  pipelineInput: this.input,
@@ -2776,10 +2781,22 @@ class PipelineInstance {
2776
2781
  }
2777
2782
  buildNextStepState(state, stepResult) {
2778
2783
  return {
2784
+ reference: {
2785
+ index: state.reference.index + 1,
2786
+ name: this.definition.steps[state.reference.index + 1]?.operations[0]
2787
+ .name,
2788
+ key: this.definition.steps[state.reference.index + 1]?.operations[0]
2789
+ .key,
2790
+ },
2779
2791
  stepInput: getStepOutput(stepResult),
2780
2792
  context: this.context,
2781
2793
  pipelineInput: this.input,
2782
2794
  previousStep: {
2795
+ reference: {
2796
+ index: state.reference.index,
2797
+ key: state.reference.key,
2798
+ name: state.reference.name,
2799
+ },
2783
2800
  stepInput: state.stepInput,
2784
2801
  stepOutput: getStepOutput(stepResult),
2785
2802
  context: this.context,
@@ -21727,24 +21744,17 @@ exports.MediaLibraryService = __decorate([
21727
21744
  __metadata("design:paramtypes", [exports.EntityManagerRegistry])
21728
21745
  ], exports.MediaLibraryService);
21729
21746
 
21730
- function _typeof(obj) {
21731
- "@babel/helpers - typeof";
21732
-
21733
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
21734
- return typeof obj;
21735
- } : function (obj) {
21736
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
21737
- }, _typeof(obj);
21738
- }
21739
-
21740
21747
  function toInteger(dirtyNumber) {
21741
21748
  if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
21742
21749
  return NaN;
21743
21750
  }
21751
+
21744
21752
  var number = Number(dirtyNumber);
21753
+
21745
21754
  if (isNaN(number)) {
21746
21755
  return number;
21747
21756
  }
21757
+
21748
21758
  return number < 0 ? Math.ceil(number) : Math.floor(number);
21749
21759
  }
21750
21760
 
@@ -21784,12 +21794,12 @@ function requiredArgs(required, args) {
21784
21794
  * const result = toDate(1392098430000)
21785
21795
  * //=> Tue Feb 11 2014 11:30:30
21786
21796
  */
21797
+
21787
21798
  function toDate(argument) {
21788
21799
  requiredArgs(1, arguments);
21789
- var argStr = Object.prototype.toString.call(argument);
21800
+ var argStr = Object.prototype.toString.call(argument); // Clone the date
21790
21801
 
21791
- // Clone the date
21792
- if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
21802
+ if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
21793
21803
  // Prevent the date to lose the milliseconds when passed to new Date() in IE10
21794
21804
  return new Date(argument.getTime());
21795
21805
  } else if (typeof argument === 'number' || argStr === '[object Number]') {
@@ -21797,10 +21807,11 @@ function toDate(argument) {
21797
21807
  } else {
21798
21808
  if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
21799
21809
  // eslint-disable-next-line no-console
21800
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
21801
- // eslint-disable-next-line no-console
21810
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"); // eslint-disable-next-line no-console
21811
+
21802
21812
  console.warn(new Error().stack);
21803
21813
  }
21814
+
21804
21815
  return new Date(NaN);
21805
21816
  }
21806
21817
  }
@@ -21813,50 +21824,39 @@ function toDate(argument) {
21813
21824
  * @description
21814
21825
  * Add the specified number of days to the given date.
21815
21826
  *
21827
+ * ### v2.0.0 breaking changes:
21828
+ *
21829
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
21830
+ *
21816
21831
  * @param {Date|Number} date - the date to be changed
21817
21832
  * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
21818
- * @returns {Date} - the new date with the days added
21819
- * @throws {TypeError} - 2 arguments required
21833
+ * @returns {Date} the new date with the days added
21834
+ * @throws {TypeError} 2 arguments required
21820
21835
  *
21821
21836
  * @example
21822
21837
  * // Add 10 days to 1 September 2014:
21823
- * const result = addDays(new Date(2014, 8, 1), 10)
21838
+ * var result = addDays(new Date(2014, 8, 1), 10)
21824
21839
  * //=> Thu Sep 11 2014 00:00:00
21825
21840
  */
21841
+
21826
21842
  function addDays(dirtyDate, dirtyAmount) {
21827
21843
  requiredArgs(2, arguments);
21828
21844
  var date = toDate(dirtyDate);
21829
21845
  var amount = toInteger(dirtyAmount);
21846
+
21830
21847
  if (isNaN(amount)) {
21831
21848
  return new Date(NaN);
21832
21849
  }
21850
+
21833
21851
  if (!amount) {
21834
21852
  // If 0 days, no-op to avoid changing times in the hour before end of DST
21835
21853
  return date;
21836
21854
  }
21855
+
21837
21856
  date.setDate(date.getDate() + amount);
21838
21857
  return date;
21839
21858
  }
21840
21859
 
21841
- /**
21842
- * Days in 1 week.
21843
- *
21844
- * @name daysInWeek
21845
- * @constant
21846
- * @type {number}
21847
- * @default
21848
- */
21849
-
21850
- /**
21851
- * Milliseconds in 1 minute
21852
- *
21853
- * @name millisecondsInMinute
21854
- * @constant
21855
- * @type {number}
21856
- * @default
21857
- */
21858
- var millisecondsInMinute = 60000;
21859
-
21860
21860
  /**
21861
21861
  * @name differenceInMilliseconds
21862
21862
  * @category Millisecond Helpers
@@ -21865,6 +21865,10 @@ var millisecondsInMinute = 60000;
21865
21865
  * @description
21866
21866
  * Get the number of milliseconds between the given dates.
21867
21867
  *
21868
+ * ### v2.0.0 breaking changes:
21869
+ *
21870
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
21871
+ *
21868
21872
  * @param {Date|Number} dateLeft - the later date
21869
21873
  * @param {Date|Number} dateRight - the earlier date
21870
21874
  * @returns {Number} the number of milliseconds
@@ -21873,31 +21877,21 @@ var millisecondsInMinute = 60000;
21873
21877
  * @example
21874
21878
  * // How many milliseconds are between
21875
21879
  * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
21876
- * const result = differenceInMilliseconds(
21880
+ * var result = differenceInMilliseconds(
21877
21881
  * new Date(2014, 6, 2, 12, 30, 21, 700),
21878
21882
  * new Date(2014, 6, 2, 12, 30, 20, 600)
21879
21883
  * )
21880
21884
  * //=> 1100
21881
21885
  */
21882
- function differenceInMilliseconds(dateLeft, dateRight) {
21883
- requiredArgs(2, arguments);
21884
- return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
21885
- }
21886
21886
 
21887
- var roundingMap = {
21888
- ceil: Math.ceil,
21889
- round: Math.round,
21890
- floor: Math.floor,
21891
- trunc: function trunc(value) {
21892
- return value < 0 ? Math.ceil(value) : Math.floor(value);
21893
- } // Math.trunc is not supported by IE
21894
- };
21895
-
21896
- var defaultRoundingMethod = 'trunc';
21897
- function getRoundingMethod(method) {
21898
- return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
21887
+ function differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) {
21888
+ requiredArgs(2, arguments);
21889
+ var dateLeft = toDate(dirtyDateLeft);
21890
+ var dateRight = toDate(dirtyDateRight);
21891
+ return dateLeft.getTime() - dateRight.getTime();
21899
21892
  }
21900
21893
 
21894
+ var MILLISECONDS_IN_MINUTE = 60000;
21901
21895
  /**
21902
21896
  * @name differenceInMinutes
21903
21897
  * @category Minute Helpers
@@ -21906,33 +21900,36 @@ function getRoundingMethod(method) {
21906
21900
  * @description
21907
21901
  * Get the signed number of full (rounded towards 0) minutes between the given dates.
21908
21902
  *
21903
+ * ### v2.0.0 breaking changes:
21904
+ *
21905
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
21906
+ *
21909
21907
  * @param {Date|Number} dateLeft - the later date
21910
21908
  * @param {Date|Number} dateRight - the earlier date
21911
- * @param {Object} [options] - an object with options.
21912
- * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
21913
21909
  * @returns {Number} the number of minutes
21914
21910
  * @throws {TypeError} 2 arguments required
21915
21911
  *
21916
21912
  * @example
21917
21913
  * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
21918
- * const result = differenceInMinutes(
21914
+ * var result = differenceInMinutes(
21919
21915
  * new Date(2014, 6, 2, 12, 20, 0),
21920
21916
  * new Date(2014, 6, 2, 12, 7, 59)
21921
21917
  * )
21922
21918
  * //=> 12
21923
21919
  *
21924
21920
  * @example
21925
- * // How many minutes are between 10:01:59 and 10:00:00
21926
- * const result = differenceInMinutes(
21921
+ * // How many minutes are from 10:01:59 to 10:00:00
21922
+ * var result = differenceInMinutes(
21927
21923
  * new Date(2000, 0, 1, 10, 0, 0),
21928
21924
  * new Date(2000, 0, 1, 10, 1, 59)
21929
21925
  * )
21930
21926
  * //=> -1
21931
21927
  */
21932
- function differenceInMinutes(dateLeft, dateRight, options) {
21928
+
21929
+ function differenceInMinutes(dirtyDateLeft, dirtyDateRight) {
21933
21930
  requiredArgs(2, arguments);
21934
- var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
21935
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
21931
+ var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_MINUTE;
21932
+ return diff > 0 ? Math.floor(diff) : Math.ceil(diff);
21936
21933
  }
21937
21934
 
21938
21935
  /**
@@ -21943,6 +21940,10 @@ function differenceInMinutes(dateLeft, dateRight, options) {
21943
21940
  * @description
21944
21941
  * Subtract the specified number of days from the given date.
21945
21942
  *
21943
+ * ### v2.0.0 breaking changes:
21944
+ *
21945
+ * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
21946
+ *
21946
21947
  * @param {Date|Number} date - the date to be changed
21947
21948
  * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
21948
21949
  * @returns {Date} the new date with the days subtracted
@@ -21950,9 +21951,10 @@ function differenceInMinutes(dateLeft, dateRight, options) {
21950
21951
  *
21951
21952
  * @example
21952
21953
  * // Subtract 10 days from 1 September 2014:
21953
- * const result = subDays(new Date(2014, 8, 1), 10)
21954
+ * var result = subDays(new Date(2014, 8, 1), 10)
21954
21955
  * //=> Fri Aug 22 2014 00:00:00
21955
21956
  */
21957
+
21956
21958
  function subDays(dirtyDate, dirtyAmount) {
21957
21959
  requiredArgs(2, arguments);
21958
21960
  var amount = toInteger(dirtyAmount);
@@ -34317,6 +34319,20 @@ const buildCompletedStepsSequence = (step) => {
34317
34319
  };
34318
34320
  class PipelineUtils {
34319
34321
  constructor() {
34322
+ this.getStepByKey = (step, key) => {
34323
+ const sequence = buildCompletedStepsSequence(step);
34324
+ const matchingStep = sequence.find((x) => x.reference.key === key);
34325
+ if (!matchingStep) {
34326
+ throw new Error(`Step key ${key} not found`);
34327
+ }
34328
+ return matchingStep;
34329
+ };
34330
+ this.getStepInputByKey = (step, key) => {
34331
+ return this.getStepByKey(step, key).stepInput;
34332
+ };
34333
+ this.getStepOutputByKey = (step, key) => {
34334
+ return this.getStepByKey(step, key).stepOutput;
34335
+ };
34320
34336
  this.getStep = (step, index) => {
34321
34337
  const sequence = buildCompletedStepsSequence(step);
34322
34338
  if (index >= sequence.length) {