@freshpointcz/fresh-core 0.0.19 → 0.0.20

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/index.js CHANGED
@@ -428,32 +428,73 @@ __export(index_exports, {
428
428
  AMOUNT_UNIT: () => AMOUNT_UNIT,
429
429
  ActionCommandCode: () => ActionCommandCode,
430
430
  ApiError: () => ApiError,
431
+ BadGatewayError: () => BadGatewayError,
432
+ BadRequestError: () => BadRequestError,
431
433
  BaseEntityChangeSubscriber: () => BaseEntityChangeSubscriber,
432
434
  BusinessWarning: () => BusinessWarning,
433
435
  Category: () => Category,
436
+ ConflictError: () => ConflictError,
434
437
  DEFAULT_PAGINATION_PARAMS: () => DEFAULT_PAGINATION_PARAMS,
435
438
  DataHelper: () => DataHelper,
436
439
  DateUtils: () => DateUtils,
437
440
  DepotPoolStatus: () => DepotPoolStatus,
438
441
  Device: () => Device,
442
+ ExpectationFailedError: () => ExpectationFailedError,
443
+ FailedDependencyError: () => FailedDependencyError,
444
+ ForbiddenError: () => ForbiddenError,
439
445
  FreshDao: () => FreshDao,
440
446
  FreshEntity: () => FreshEntity,
447
+ FreshError: () => FreshError,
441
448
  FreshHyperEntity: () => FreshHyperEntity,
442
449
  FreshJob: () => FreshJob,
443
450
  FreshTranslationBase: () => FreshTranslationBase,
451
+ GatewayTimeoutError: () => GatewayTimeoutError,
452
+ GoneError: () => GoneError,
444
453
  HttpStatus: () => HttpStatus,
454
+ HttpVersionNotSupportedError: () => HttpVersionNotSupportedError,
455
+ ImATeapotError: () => ImATeapotError,
456
+ InsufficientStorageError: () => InsufficientStorageError,
457
+ InternalServerError: () => InternalServerError,
445
458
  LanguageCode: () => LanguageCode,
459
+ LengthRequiredError: () => LengthRequiredError,
460
+ LockedError: () => LockedError,
461
+ LoopDetectedError: () => LoopDetectedError,
446
462
  Manufacturer: () => Manufacturer,
463
+ MethodNotAllowedError: () => MethodNotAllowedError,
464
+ MisdirectedRequestError: () => MisdirectedRequestError,
465
+ NetworkAuthenticationRequiredError: () => NetworkAuthenticationRequiredError,
466
+ NotAcceptableError: () => NotAcceptableError,
467
+ NotExtendedError: () => NotExtendedError,
468
+ NotFoundError: () => NotFoundError,
469
+ NotImplementedError: () => NotImplementedError,
470
+ PayloadTooLargeError: () => PayloadTooLargeError,
447
471
  PaymentMethod: () => PaymentMethod,
472
+ PaymentRequiredError: () => PaymentRequiredError,
448
473
  PgDataSourceOptions: () => datasource_default,
474
+ PreconditionFailedError: () => PreconditionFailedError,
475
+ PreconditionRequiredError: () => PreconditionRequiredError,
449
476
  Product: () => Product,
477
+ ProxyAuthenticationRequiredError: () => ProxyAuthenticationRequiredError,
478
+ RangeNotSatisfiableError: () => RangeNotSatisfiableError,
479
+ RequestHeaderFieldsTooLargeError: () => RequestHeaderFieldsTooLargeError,
480
+ RequestTimeoutError: () => RequestTimeoutError,
481
+ ServiceUnavailableError: () => ServiceUnavailableError,
450
482
  SinglePromiseWaiter: () => SinglePromiseWaiter,
451
483
  Singleton: () => Singleton,
452
484
  StatusDto: () => StatusDto,
453
485
  Subcategory: () => Subcategory,
454
486
  TO_BINARY_FLAG: () => TO_BINARY_FLAG,
455
487
  TimestampColumn: () => TimestampColumn,
488
+ TooEarlyError: () => TooEarlyError,
489
+ TooManyRequestsError: () => TooManyRequestsError,
456
490
  TransactionType: () => TransactionType,
491
+ UnauthorizedError: () => UnauthorizedError,
492
+ UnavailableForLegalReasonsError: () => UnavailableForLegalReasonsError,
493
+ UnprocessableEntityError: () => UnprocessableEntityError,
494
+ UnsupportedMediaTypeError: () => UnsupportedMediaTypeError,
495
+ UpgradeRequiredError: () => UpgradeRequiredError,
496
+ UriTooLongError: () => UriTooLongError,
497
+ VariantAlsoNegotiatesError: () => VariantAlsoNegotiatesError,
457
498
  buildPatch: () => buildPatch,
458
499
  constructTypeormPagination: () => constructTypeormPagination,
459
500
  createDeferred: () => createDeferred,
@@ -472,11 +513,44 @@ __export(index_exports, {
472
513
  isValidCron: () => isValidCron,
473
514
  listAll: () => listAll,
474
515
  parsePaginationFromURL: () => parsePaginationFromURL,
516
+ resolvePathParameterId: () => resolvePathParameterId,
475
517
  runWithConcurrency: () => runWithConcurrency,
476
518
  toDecimal: () => toDecimal
477
519
  });
478
520
  module.exports = __toCommonJS(index_exports);
479
521
 
522
+ // src/common/constants/amount-unit.ts
523
+ var AMOUNT_UNIT = {
524
+ 1: {
525
+ symbol: "g",
526
+ translations: {
527
+ en: "gram",
528
+ cs: "gram"
529
+ }
530
+ },
531
+ 2: {
532
+ symbol: "kg",
533
+ translations: {
534
+ en: "kilogram",
535
+ cs: "kilogram"
536
+ }
537
+ },
538
+ 3: {
539
+ symbol: "ml",
540
+ translations: {
541
+ en: "milliliter",
542
+ cs: "mililitr"
543
+ }
544
+ },
545
+ 4: {
546
+ symbol: "l",
547
+ translations: {
548
+ en: "liter",
549
+ cs: "litr"
550
+ }
551
+ }
552
+ };
553
+
480
554
  // src/common/date-utils.ts
481
555
  var import_dayjs = __toESM(require("dayjs"));
482
556
  var import_utc = __toESM(require("dayjs/plugin/utc"));
@@ -657,114 +731,6 @@ __publicField(_DateUtils, "HOLIDAYS", _DateUtils.HOLIDAYS_STR.map((h) => {
657
731
  }));
658
732
  var DateUtils = _DateUtils;
659
733
 
660
- // src/common/promise-magic/deferred.ts
661
- function createDeferred() {
662
- let resolve;
663
- let reject;
664
- const promise = new Promise((res, rej) => {
665
- resolve = res;
666
- reject = rej;
667
- });
668
- return {
669
- promise,
670
- resolve,
671
- reject
672
- };
673
- }
674
- __name(createDeferred, "createDeferred");
675
-
676
- // src/common/promise-magic/single-promise-waiter.ts
677
- var _SinglePromiseWaiter = class _SinglePromiseWaiter {
678
- constructor() {
679
- __publicField(this, "_promise", null);
680
- }
681
- static getInstance() {
682
- if (!_SinglePromiseWaiter._instance) {
683
- _SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
684
- }
685
- return _SinglePromiseWaiter._instance;
686
- }
687
- get promise() {
688
- return this._promise;
689
- }
690
- set promise(promise) {
691
- if (promise !== null) {
692
- this._promise = promise;
693
- this._promise.finally(() => {
694
- this._promise = null;
695
- });
696
- }
697
- }
698
- get hasPromise() {
699
- return this._promise !== null;
700
- }
701
- };
702
- __name(_SinglePromiseWaiter, "SinglePromiseWaiter");
703
- __publicField(_SinglePromiseWaiter, "_instance");
704
- var SinglePromiseWaiter = _SinglePromiseWaiter;
705
-
706
- // src/common/utils/is-cron-valid.ts
707
- function isValidCron(expr) {
708
- const parts = expr.trim().split(/\s+/);
709
- if (parts.length < 5 || parts.length > 6) {
710
- return false;
711
- }
712
- const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
713
- return parts.every((part) => cronPart.test(part));
714
- }
715
- __name(isValidCron, "isValidCron");
716
-
717
- // src/common/patterns/singleton.ts
718
- var _Singleton = class _Singleton {
719
- /**
720
- * Creates or returns the singleton instance for the subclass.
721
- *
722
- * If an instance already exists for the subclass, that instance is
723
- * returned instead of creating a new one.
724
- *
725
- * @param callOnInit - Whether to call {@link onInit} for a newly
726
- * created instance. Ignored if the instance already exists.
727
- */
728
- constructor(callOnInit = true) {
729
- const ctor = this.constructor;
730
- const existing = _Singleton.instances.get(ctor);
731
- if (existing) {
732
- return existing;
733
- }
734
- _Singleton.instances.set(ctor, this);
735
- if (callOnInit) {
736
- void this.onInit();
737
- }
738
- }
739
- /**
740
- * Retrieves the singleton instance for the calling subclass.
741
- *
742
- * If no instance exists, a new one is created using the provided
743
- * constructor arguments.
744
- *
745
- * Intended to be used by subclasses as a protected factory method.
746
- *
747
- * @typeParam T - The concrete subclass type.
748
- * @param args - Arguments forwarded to the subclass constructor.
749
- * @returns The singleton instance of the subclass.
750
- */
751
- static getInstance(...args) {
752
- let instance = _Singleton.instances.get(this);
753
- if (!instance) {
754
- instance = new this(...args);
755
- _Singleton.instances.set(this, instance);
756
- }
757
- return instance;
758
- }
759
- };
760
- __name(_Singleton, "Singleton");
761
- /**
762
- * Internal registry of singleton instances.
763
- * One instance per subclass constructor.
764
- */
765
- __publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
766
- var Singleton = _Singleton;
767
-
768
734
  // src/common/dto/status-dto.ts
769
735
  var _StatusDto = class _StatusDto {
770
736
  constructor(status, details, timestamp) {
@@ -854,37 +820,102 @@ async function listAll(fetchPage, batchSize = 1e3) {
854
820
  }
855
821
  __name(listAll, "listAll");
856
822
 
857
- // src/common/constants/amount-unit.ts
858
- var AMOUNT_UNIT = {
859
- 1: {
860
- symbol: "g",
861
- translations: {
862
- en: "gram",
863
- cs: "gram"
823
+ // src/common/patterns/singleton.ts
824
+ var _Singleton = class _Singleton {
825
+ /**
826
+ * Creates or returns the singleton instance for the subclass.
827
+ *
828
+ * If an instance already exists for the subclass, that instance is
829
+ * returned instead of creating a new one.
830
+ *
831
+ * @param callOnInit - Whether to call {@link onInit} for a newly
832
+ * created instance. Ignored if the instance already exists.
833
+ */
834
+ constructor(callOnInit = true) {
835
+ const ctor = this.constructor;
836
+ const existing = _Singleton.instances.get(ctor);
837
+ if (existing) {
838
+ return existing;
864
839
  }
865
- },
866
- 2: {
867
- symbol: "kg",
868
- translations: {
869
- en: "kilogram",
870
- cs: "kilogram"
840
+ _Singleton.instances.set(ctor, this);
841
+ if (callOnInit) {
842
+ void this.onInit();
871
843
  }
872
- },
873
- 3: {
874
- symbol: "ml",
875
- translations: {
876
- en: "milliliter",
877
- cs: "mililitr"
844
+ }
845
+ /**
846
+ * Retrieves the singleton instance for the calling subclass.
847
+ *
848
+ * If no instance exists, a new one is created using the provided
849
+ * constructor arguments.
850
+ *
851
+ * Intended to be used by subclasses as a protected factory method.
852
+ *
853
+ * @typeParam T - The concrete subclass type.
854
+ * @param args - Arguments forwarded to the subclass constructor.
855
+ * @returns The singleton instance of the subclass.
856
+ */
857
+ static getInstance(...args) {
858
+ let instance = _Singleton.instances.get(this);
859
+ if (!instance) {
860
+ instance = new this(...args);
861
+ _Singleton.instances.set(this, instance);
878
862
  }
879
- },
880
- 4: {
881
- symbol: "l",
882
- translations: {
883
- en: "liter",
884
- cs: "litr"
863
+ return instance;
864
+ }
865
+ };
866
+ __name(_Singleton, "Singleton");
867
+ /**
868
+ * Internal registry of singleton instances.
869
+ * One instance per subclass constructor.
870
+ */
871
+ __publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
872
+ var Singleton = _Singleton;
873
+
874
+ // src/common/promise-magic/deferred.ts
875
+ function createDeferred() {
876
+ let resolve;
877
+ let reject;
878
+ const promise = new Promise((res, rej) => {
879
+ resolve = res;
880
+ reject = rej;
881
+ });
882
+ return {
883
+ promise,
884
+ resolve,
885
+ reject
886
+ };
887
+ }
888
+ __name(createDeferred, "createDeferred");
889
+
890
+ // src/common/promise-magic/single-promise-waiter.ts
891
+ var _SinglePromiseWaiter = class _SinglePromiseWaiter {
892
+ constructor() {
893
+ __publicField(this, "_promise", null);
894
+ }
895
+ static getInstance() {
896
+ if (!_SinglePromiseWaiter._instance) {
897
+ _SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
898
+ }
899
+ return _SinglePromiseWaiter._instance;
900
+ }
901
+ get promise() {
902
+ return this._promise;
903
+ }
904
+ set promise(promise) {
905
+ if (promise !== null) {
906
+ this._promise = promise;
907
+ this._promise.finally(() => {
908
+ this._promise = null;
909
+ });
885
910
  }
886
911
  }
912
+ get hasPromise() {
913
+ return this._promise !== null;
914
+ }
887
915
  };
916
+ __name(_SinglePromiseWaiter, "SinglePromiseWaiter");
917
+ __publicField(_SinglePromiseWaiter, "_instance");
918
+ var SinglePromiseWaiter = _SinglePromiseWaiter;
888
919
 
889
920
  // src/common/schema/entities/category.entity.ts
890
921
  var import_typeorm5 = require("typeorm");
@@ -1523,6 +1554,23 @@ async function runWithConcurrency(items, concurrency, worker) {
1523
1554
  }
1524
1555
  __name(runWithConcurrency, "runWithConcurrency");
1525
1556
 
1557
+ // src/common/utils/id-path-param-resolver.utils.ts
1558
+ function resolvePathParameterId(id) {
1559
+ return /^\d+$/.test(id) ? parseInt(id, 10) : id;
1560
+ }
1561
+ __name(resolvePathParameterId, "resolvePathParameterId");
1562
+
1563
+ // src/common/utils/is-cron-valid.ts
1564
+ function isValidCron(expr) {
1565
+ const parts = expr.trim().split(/\s+/);
1566
+ if (parts.length < 5 || parts.length > 6) {
1567
+ return false;
1568
+ }
1569
+ const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
1570
+ return parts.every((part) => cronPart.test(part));
1571
+ }
1572
+ __name(isValidCron, "isValidCron");
1573
+
1526
1574
  // src/common/utils/patch.utils.ts
1527
1575
  function buildPatch(data, keys, transforms) {
1528
1576
  const patch = {};
@@ -1537,43 +1585,6 @@ function buildPatch(data, keys, transforms) {
1537
1585
  }
1538
1586
  __name(buildPatch, "buildPatch");
1539
1587
 
1540
- // src/core/data-helper.ts
1541
- var _DataHelper = class _DataHelper {
1542
- constructor(startDataRetrieve = true, deviceIds) {
1543
- __publicField(this, "_data");
1544
- __publicField(this, "_dataPromise", null);
1545
- __publicField(this, "deviceIds");
1546
- this.deviceIds = deviceIds;
1547
- if (startDataRetrieve) {
1548
- this._dataPromise = this.startDataRetrieval();
1549
- }
1550
- }
1551
- get data() {
1552
- return this._data;
1553
- }
1554
- set data(value) {
1555
- this._data = value;
1556
- }
1557
- get dataPromise() {
1558
- return this._dataPromise;
1559
- }
1560
- set dataPromise(value) {
1561
- this._dataPromise = value;
1562
- }
1563
- async getData() {
1564
- if (this._dataPromise) {
1565
- return await this._dataPromise;
1566
- }
1567
- if (this._data === void 0) {
1568
- this._dataPromise = this.startDataRetrieval();
1569
- return this._dataPromise;
1570
- }
1571
- return this._data;
1572
- }
1573
- };
1574
- __name(_DataHelper, "DataHelper");
1575
- var DataHelper = _DataHelper;
1576
-
1577
1588
  // src/core/class/fresh-job.ts
1578
1589
  var import_node_schedule = require("node-schedule");
1579
1590
  var _FreshJob = class _FreshJob extends Singleton {
@@ -1722,6 +1733,346 @@ var _BusinessWarning = class _BusinessWarning extends Error {
1722
1733
  __name(_BusinessWarning, "BusinessWarning");
1723
1734
  var BusinessWarning = _BusinessWarning;
1724
1735
 
1736
+ // src/core/errors/fresh-error.ts
1737
+ var _FreshError = class _FreshError extends Error {
1738
+ constructor(statusCode, status, detail, options) {
1739
+ super(detail != null ? detail : status);
1740
+ /** HTTP status code sent in the response. */
1741
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1742
+ __publicField(this, "statusCode");
1743
+ /** Structured response body describing the error. */
1744
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1745
+ __publicField(this, "statusDto");
1746
+ this.name = this.constructor.name;
1747
+ if ((options == null ? void 0 : options.cause) !== void 0) {
1748
+ this.cause = options.cause;
1749
+ }
1750
+ this.statusCode = statusCode;
1751
+ this.statusDto = new StatusDto(status, detail);
1752
+ }
1753
+ };
1754
+ __name(_FreshError, "FreshError");
1755
+ var FreshError = _FreshError;
1756
+
1757
+ // src/core/errors/errors.ts
1758
+ var _BadRequestError = class _BadRequestError extends FreshError {
1759
+ constructor(detail, options) {
1760
+ super(HttpStatus.BAD_REQUEST, "validation-error", detail, options);
1761
+ }
1762
+ };
1763
+ __name(_BadRequestError, "BadRequestError");
1764
+ var BadRequestError = _BadRequestError;
1765
+ var _UnauthorizedError = class _UnauthorizedError extends FreshError {
1766
+ constructor(detail, options) {
1767
+ super(HttpStatus.UNAUTHORIZED, "not-authenticated", detail, options);
1768
+ }
1769
+ };
1770
+ __name(_UnauthorizedError, "UnauthorizedError");
1771
+ var UnauthorizedError = _UnauthorizedError;
1772
+ var _PaymentRequiredError = class _PaymentRequiredError extends FreshError {
1773
+ constructor(detail, options) {
1774
+ super(HttpStatus.PAYMENT_REQUIRED, "error", detail, options);
1775
+ }
1776
+ };
1777
+ __name(_PaymentRequiredError, "PaymentRequiredError");
1778
+ var PaymentRequiredError = _PaymentRequiredError;
1779
+ var _ForbiddenError = class _ForbiddenError extends FreshError {
1780
+ constructor(detail, options) {
1781
+ super(HttpStatus.FORBIDDEN, "not-authorized", detail, options);
1782
+ }
1783
+ };
1784
+ __name(_ForbiddenError, "ForbiddenError");
1785
+ var ForbiddenError = _ForbiddenError;
1786
+ var _NotFoundError = class _NotFoundError extends FreshError {
1787
+ constructor(detail, options) {
1788
+ super(HttpStatus.NOT_FOUND, "error", detail, options);
1789
+ }
1790
+ };
1791
+ __name(_NotFoundError, "NotFoundError");
1792
+ var NotFoundError = _NotFoundError;
1793
+ var _MethodNotAllowedError = class _MethodNotAllowedError extends FreshError {
1794
+ constructor(detail, options) {
1795
+ super(HttpStatus.METHOD_NOT_ALLOWED, "error", detail, options);
1796
+ }
1797
+ };
1798
+ __name(_MethodNotAllowedError, "MethodNotAllowedError");
1799
+ var MethodNotAllowedError = _MethodNotAllowedError;
1800
+ var _NotAcceptableError = class _NotAcceptableError extends FreshError {
1801
+ constructor(detail, options) {
1802
+ super(HttpStatus.NOT_ACCEPTABLE, "error", detail, options);
1803
+ }
1804
+ };
1805
+ __name(_NotAcceptableError, "NotAcceptableError");
1806
+ var NotAcceptableError = _NotAcceptableError;
1807
+ var _ProxyAuthenticationRequiredError = class _ProxyAuthenticationRequiredError extends FreshError {
1808
+ constructor(detail, options) {
1809
+ super(HttpStatus.PROXY_AUTHENTICATION_REQUIRED, "not-authenticated", detail, options);
1810
+ }
1811
+ };
1812
+ __name(_ProxyAuthenticationRequiredError, "ProxyAuthenticationRequiredError");
1813
+ var ProxyAuthenticationRequiredError = _ProxyAuthenticationRequiredError;
1814
+ var _RequestTimeoutError = class _RequestTimeoutError extends FreshError {
1815
+ constructor(detail, options) {
1816
+ super(HttpStatus.REQUEST_TIMEOUT, "error", detail, options);
1817
+ }
1818
+ };
1819
+ __name(_RequestTimeoutError, "RequestTimeoutError");
1820
+ var RequestTimeoutError = _RequestTimeoutError;
1821
+ var _ConflictError = class _ConflictError extends FreshError {
1822
+ constructor(detail, options) {
1823
+ super(HttpStatus.CONFLICT, "error", detail, options);
1824
+ }
1825
+ };
1826
+ __name(_ConflictError, "ConflictError");
1827
+ var ConflictError = _ConflictError;
1828
+ var _GoneError = class _GoneError extends FreshError {
1829
+ constructor(detail, options) {
1830
+ super(HttpStatus.GONE, "error", detail, options);
1831
+ }
1832
+ };
1833
+ __name(_GoneError, "GoneError");
1834
+ var GoneError = _GoneError;
1835
+ var _LengthRequiredError = class _LengthRequiredError extends FreshError {
1836
+ constructor(detail, options) {
1837
+ super(HttpStatus.LENGTH_REQUIRED, "error", detail, options);
1838
+ }
1839
+ };
1840
+ __name(_LengthRequiredError, "LengthRequiredError");
1841
+ var LengthRequiredError = _LengthRequiredError;
1842
+ var _PreconditionFailedError = class _PreconditionFailedError extends FreshError {
1843
+ constructor(detail, options) {
1844
+ super(HttpStatus.PRECONDITION_FAILED, "error", detail, options);
1845
+ }
1846
+ };
1847
+ __name(_PreconditionFailedError, "PreconditionFailedError");
1848
+ var PreconditionFailedError = _PreconditionFailedError;
1849
+ var _PayloadTooLargeError = class _PayloadTooLargeError extends FreshError {
1850
+ constructor(detail, options) {
1851
+ super(HttpStatus.PAYLOAD_TOO_LARGE, "error", detail, options);
1852
+ }
1853
+ };
1854
+ __name(_PayloadTooLargeError, "PayloadTooLargeError");
1855
+ var PayloadTooLargeError = _PayloadTooLargeError;
1856
+ var _UriTooLongError = class _UriTooLongError extends FreshError {
1857
+ constructor(detail, options) {
1858
+ super(HttpStatus.URI_TOO_LONG, "error", detail, options);
1859
+ }
1860
+ };
1861
+ __name(_UriTooLongError, "UriTooLongError");
1862
+ var UriTooLongError = _UriTooLongError;
1863
+ var _UnsupportedMediaTypeError = class _UnsupportedMediaTypeError extends FreshError {
1864
+ constructor(detail, options) {
1865
+ super(HttpStatus.UNSUPPORTED_MEDIA_TYPE, "error", detail, options);
1866
+ }
1867
+ };
1868
+ __name(_UnsupportedMediaTypeError, "UnsupportedMediaTypeError");
1869
+ var UnsupportedMediaTypeError = _UnsupportedMediaTypeError;
1870
+ var _RangeNotSatisfiableError = class _RangeNotSatisfiableError extends FreshError {
1871
+ constructor(detail, options) {
1872
+ super(HttpStatus.RANGE_NOT_SATISFIABLE, "error", detail, options);
1873
+ }
1874
+ };
1875
+ __name(_RangeNotSatisfiableError, "RangeNotSatisfiableError");
1876
+ var RangeNotSatisfiableError = _RangeNotSatisfiableError;
1877
+ var _ExpectationFailedError = class _ExpectationFailedError extends FreshError {
1878
+ constructor(detail, options) {
1879
+ super(HttpStatus.EXPECTATION_FAILED, "error", detail, options);
1880
+ }
1881
+ };
1882
+ __name(_ExpectationFailedError, "ExpectationFailedError");
1883
+ var ExpectationFailedError = _ExpectationFailedError;
1884
+ var _ImATeapotError = class _ImATeapotError extends FreshError {
1885
+ constructor(detail, options) {
1886
+ super(HttpStatus.IM_A_TEAPOT, "error", detail, options);
1887
+ }
1888
+ };
1889
+ __name(_ImATeapotError, "ImATeapotError");
1890
+ var ImATeapotError = _ImATeapotError;
1891
+ var _MisdirectedRequestError = class _MisdirectedRequestError extends FreshError {
1892
+ constructor(detail, options) {
1893
+ super(HttpStatus.MISDIRECTED_REQUEST, "error", detail, options);
1894
+ }
1895
+ };
1896
+ __name(_MisdirectedRequestError, "MisdirectedRequestError");
1897
+ var MisdirectedRequestError = _MisdirectedRequestError;
1898
+ var _UnprocessableEntityError = class _UnprocessableEntityError extends FreshError {
1899
+ constructor(detail, options) {
1900
+ super(HttpStatus.UNPROCESSABLE_ENTITY, "validation-error", detail, options);
1901
+ }
1902
+ };
1903
+ __name(_UnprocessableEntityError, "UnprocessableEntityError");
1904
+ var UnprocessableEntityError = _UnprocessableEntityError;
1905
+ var _LockedError = class _LockedError extends FreshError {
1906
+ constructor(detail, options) {
1907
+ super(HttpStatus.LOCKED, "error", detail, options);
1908
+ }
1909
+ };
1910
+ __name(_LockedError, "LockedError");
1911
+ var LockedError = _LockedError;
1912
+ var _FailedDependencyError = class _FailedDependencyError extends FreshError {
1913
+ constructor(detail, options) {
1914
+ super(HttpStatus.FAILED_DEPENDENCY, "error", detail, options);
1915
+ }
1916
+ };
1917
+ __name(_FailedDependencyError, "FailedDependencyError");
1918
+ var FailedDependencyError = _FailedDependencyError;
1919
+ var _TooEarlyError = class _TooEarlyError extends FreshError {
1920
+ constructor(detail, options) {
1921
+ super(HttpStatus.TOO_EARLY, "error", detail, options);
1922
+ }
1923
+ };
1924
+ __name(_TooEarlyError, "TooEarlyError");
1925
+ var TooEarlyError = _TooEarlyError;
1926
+ var _UpgradeRequiredError = class _UpgradeRequiredError extends FreshError {
1927
+ constructor(detail, options) {
1928
+ super(HttpStatus.UPGRADE_REQUIRED, "error", detail, options);
1929
+ }
1930
+ };
1931
+ __name(_UpgradeRequiredError, "UpgradeRequiredError");
1932
+ var UpgradeRequiredError = _UpgradeRequiredError;
1933
+ var _PreconditionRequiredError = class _PreconditionRequiredError extends FreshError {
1934
+ constructor(detail, options) {
1935
+ super(HttpStatus.PRECONDITION_REQUIRED, "error", detail, options);
1936
+ }
1937
+ };
1938
+ __name(_PreconditionRequiredError, "PreconditionRequiredError");
1939
+ var PreconditionRequiredError = _PreconditionRequiredError;
1940
+ var _TooManyRequestsError = class _TooManyRequestsError extends FreshError {
1941
+ constructor(detail, options) {
1942
+ super(HttpStatus.TOO_MANY_REQUESTS, "error", detail, options);
1943
+ }
1944
+ };
1945
+ __name(_TooManyRequestsError, "TooManyRequestsError");
1946
+ var TooManyRequestsError = _TooManyRequestsError;
1947
+ var _RequestHeaderFieldsTooLargeError = class _RequestHeaderFieldsTooLargeError extends FreshError {
1948
+ constructor(detail, options) {
1949
+ super(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE, "error", detail, options);
1950
+ }
1951
+ };
1952
+ __name(_RequestHeaderFieldsTooLargeError, "RequestHeaderFieldsTooLargeError");
1953
+ var RequestHeaderFieldsTooLargeError = _RequestHeaderFieldsTooLargeError;
1954
+ var _UnavailableForLegalReasonsError = class _UnavailableForLegalReasonsError extends FreshError {
1955
+ constructor(detail, options) {
1956
+ super(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS, "error", detail, options);
1957
+ }
1958
+ };
1959
+ __name(_UnavailableForLegalReasonsError, "UnavailableForLegalReasonsError");
1960
+ var UnavailableForLegalReasonsError = _UnavailableForLegalReasonsError;
1961
+ var _InternalServerError = class _InternalServerError extends FreshError {
1962
+ constructor(detail, options) {
1963
+ super(HttpStatus.INTERNAL_SERVER_ERROR, "internal-server-error", detail, options);
1964
+ }
1965
+ };
1966
+ __name(_InternalServerError, "InternalServerError");
1967
+ var InternalServerError = _InternalServerError;
1968
+ var _NotImplementedError = class _NotImplementedError extends FreshError {
1969
+ constructor(detail, options) {
1970
+ super(HttpStatus.NOT_IMPLEMENTED, "internal-server-error", detail, options);
1971
+ }
1972
+ };
1973
+ __name(_NotImplementedError, "NotImplementedError");
1974
+ var NotImplementedError = _NotImplementedError;
1975
+ var _BadGatewayError = class _BadGatewayError extends FreshError {
1976
+ constructor(detail, options) {
1977
+ super(HttpStatus.BAD_GATEWAY, "internal-server-error", detail, options);
1978
+ }
1979
+ };
1980
+ __name(_BadGatewayError, "BadGatewayError");
1981
+ var BadGatewayError = _BadGatewayError;
1982
+ var _ServiceUnavailableError = class _ServiceUnavailableError extends FreshError {
1983
+ constructor(detail, options) {
1984
+ super(HttpStatus.SERVICE_UNAVAILABLE, "internal-server-error", detail, options);
1985
+ }
1986
+ };
1987
+ __name(_ServiceUnavailableError, "ServiceUnavailableError");
1988
+ var ServiceUnavailableError = _ServiceUnavailableError;
1989
+ var _GatewayTimeoutError = class _GatewayTimeoutError extends FreshError {
1990
+ constructor(detail, options) {
1991
+ super(HttpStatus.GATEWAY_TIMEOUT, "internal-server-error", detail, options);
1992
+ }
1993
+ };
1994
+ __name(_GatewayTimeoutError, "GatewayTimeoutError");
1995
+ var GatewayTimeoutError = _GatewayTimeoutError;
1996
+ var _HttpVersionNotSupportedError = class _HttpVersionNotSupportedError extends FreshError {
1997
+ constructor(detail, options) {
1998
+ super(HttpStatus.HTTP_VERSION_NOT_SUPPORTED, "internal-server-error", detail, options);
1999
+ }
2000
+ };
2001
+ __name(_HttpVersionNotSupportedError, "HttpVersionNotSupportedError");
2002
+ var HttpVersionNotSupportedError = _HttpVersionNotSupportedError;
2003
+ var _VariantAlsoNegotiatesError = class _VariantAlsoNegotiatesError extends FreshError {
2004
+ constructor(detail, options) {
2005
+ super(HttpStatus.VARIANT_ALSO_NEGOTIATES, "internal-server-error", detail, options);
2006
+ }
2007
+ };
2008
+ __name(_VariantAlsoNegotiatesError, "VariantAlsoNegotiatesError");
2009
+ var VariantAlsoNegotiatesError = _VariantAlsoNegotiatesError;
2010
+ var _InsufficientStorageError = class _InsufficientStorageError extends FreshError {
2011
+ constructor(detail, options) {
2012
+ super(HttpStatus.INSUFFICIENT_STORAGE, "internal-server-error", detail, options);
2013
+ }
2014
+ };
2015
+ __name(_InsufficientStorageError, "InsufficientStorageError");
2016
+ var InsufficientStorageError = _InsufficientStorageError;
2017
+ var _LoopDetectedError = class _LoopDetectedError extends FreshError {
2018
+ constructor(detail, options) {
2019
+ super(HttpStatus.LOOP_DETECTED, "internal-server-error", detail, options);
2020
+ }
2021
+ };
2022
+ __name(_LoopDetectedError, "LoopDetectedError");
2023
+ var LoopDetectedError = _LoopDetectedError;
2024
+ var _NotExtendedError = class _NotExtendedError extends FreshError {
2025
+ constructor(detail, options) {
2026
+ super(HttpStatus.NOT_EXTENDED, "internal-server-error", detail, options);
2027
+ }
2028
+ };
2029
+ __name(_NotExtendedError, "NotExtendedError");
2030
+ var NotExtendedError = _NotExtendedError;
2031
+ var _NetworkAuthenticationRequiredError = class _NetworkAuthenticationRequiredError extends FreshError {
2032
+ constructor(detail, options) {
2033
+ super(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED, "internal-server-error", detail, options);
2034
+ }
2035
+ };
2036
+ __name(_NetworkAuthenticationRequiredError, "NetworkAuthenticationRequiredError");
2037
+ var NetworkAuthenticationRequiredError = _NetworkAuthenticationRequiredError;
2038
+
2039
+ // src/core/data-helper.ts
2040
+ var _DataHelper = class _DataHelper {
2041
+ constructor(startDataRetrieve = true, deviceIds) {
2042
+ __publicField(this, "_data");
2043
+ __publicField(this, "_dataPromise", null);
2044
+ __publicField(this, "deviceIds");
2045
+ this.deviceIds = deviceIds;
2046
+ if (startDataRetrieve) {
2047
+ this._dataPromise = this.startDataRetrieval();
2048
+ }
2049
+ }
2050
+ get data() {
2051
+ return this._data;
2052
+ }
2053
+ set data(value) {
2054
+ this._data = value;
2055
+ }
2056
+ get dataPromise() {
2057
+ return this._dataPromise;
2058
+ }
2059
+ set dataPromise(value) {
2060
+ this._dataPromise = value;
2061
+ }
2062
+ async getData() {
2063
+ if (this._dataPromise) {
2064
+ return await this._dataPromise;
2065
+ }
2066
+ if (this._data === void 0) {
2067
+ this._dataPromise = this.startDataRetrieval();
2068
+ return this._dataPromise;
2069
+ }
2070
+ return this._data;
2071
+ }
2072
+ };
2073
+ __name(_DataHelper, "DataHelper");
2074
+ var DataHelper = _DataHelper;
2075
+
1725
2076
  // src/types/maybe-type.ts
1726
2077
  function isMaybe(v, inner) {
1727
2078
  return v === null || inner(v);
@@ -1915,32 +2266,73 @@ var datasource_default = PG_DATA_SOURCE_OPTIONS;
1915
2266
  AMOUNT_UNIT,
1916
2267
  ActionCommandCode,
1917
2268
  ApiError,
2269
+ BadGatewayError,
2270
+ BadRequestError,
1918
2271
  BaseEntityChangeSubscriber,
1919
2272
  BusinessWarning,
1920
2273
  Category,
2274
+ ConflictError,
1921
2275
  DEFAULT_PAGINATION_PARAMS,
1922
2276
  DataHelper,
1923
2277
  DateUtils,
1924
2278
  DepotPoolStatus,
1925
2279
  Device,
2280
+ ExpectationFailedError,
2281
+ FailedDependencyError,
2282
+ ForbiddenError,
1926
2283
  FreshDao,
1927
2284
  FreshEntity,
2285
+ FreshError,
1928
2286
  FreshHyperEntity,
1929
2287
  FreshJob,
1930
2288
  FreshTranslationBase,
2289
+ GatewayTimeoutError,
2290
+ GoneError,
1931
2291
  HttpStatus,
2292
+ HttpVersionNotSupportedError,
2293
+ ImATeapotError,
2294
+ InsufficientStorageError,
2295
+ InternalServerError,
1932
2296
  LanguageCode,
2297
+ LengthRequiredError,
2298
+ LockedError,
2299
+ LoopDetectedError,
1933
2300
  Manufacturer,
2301
+ MethodNotAllowedError,
2302
+ MisdirectedRequestError,
2303
+ NetworkAuthenticationRequiredError,
2304
+ NotAcceptableError,
2305
+ NotExtendedError,
2306
+ NotFoundError,
2307
+ NotImplementedError,
2308
+ PayloadTooLargeError,
1934
2309
  PaymentMethod,
2310
+ PaymentRequiredError,
1935
2311
  PgDataSourceOptions,
2312
+ PreconditionFailedError,
2313
+ PreconditionRequiredError,
1936
2314
  Product,
2315
+ ProxyAuthenticationRequiredError,
2316
+ RangeNotSatisfiableError,
2317
+ RequestHeaderFieldsTooLargeError,
2318
+ RequestTimeoutError,
2319
+ ServiceUnavailableError,
1937
2320
  SinglePromiseWaiter,
1938
2321
  Singleton,
1939
2322
  StatusDto,
1940
2323
  Subcategory,
1941
2324
  TO_BINARY_FLAG,
1942
2325
  TimestampColumn,
2326
+ TooEarlyError,
2327
+ TooManyRequestsError,
1943
2328
  TransactionType,
2329
+ UnauthorizedError,
2330
+ UnavailableForLegalReasonsError,
2331
+ UnprocessableEntityError,
2332
+ UnsupportedMediaTypeError,
2333
+ UpgradeRequiredError,
2334
+ UriTooLongError,
2335
+ VariantAlsoNegotiatesError,
1944
2336
  buildPatch,
1945
2337
  constructTypeormPagination,
1946
2338
  createDeferred,
@@ -1959,6 +2351,7 @@ var datasource_default = PG_DATA_SOURCE_OPTIONS;
1959
2351
  isValidCron,
1960
2352
  listAll,
1961
2353
  parsePaginationFromURL,
2354
+ resolvePathParameterId,
1962
2355
  runWithConcurrency,
1963
2356
  toDecimal
1964
2357
  });