@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.mjs CHANGED
@@ -422,6 +422,38 @@ var require_main = __commonJS({
422
422
  }
423
423
  });
424
424
 
425
+ // src/common/constants/amount-unit.ts
426
+ var AMOUNT_UNIT = {
427
+ 1: {
428
+ symbol: "g",
429
+ translations: {
430
+ en: "gram",
431
+ cs: "gram"
432
+ }
433
+ },
434
+ 2: {
435
+ symbol: "kg",
436
+ translations: {
437
+ en: "kilogram",
438
+ cs: "kilogram"
439
+ }
440
+ },
441
+ 3: {
442
+ symbol: "ml",
443
+ translations: {
444
+ en: "milliliter",
445
+ cs: "mililitr"
446
+ }
447
+ },
448
+ 4: {
449
+ symbol: "l",
450
+ translations: {
451
+ en: "liter",
452
+ cs: "litr"
453
+ }
454
+ }
455
+ };
456
+
425
457
  // src/common/date-utils.ts
426
458
  import dayjs from "dayjs";
427
459
  import utc from "dayjs/plugin/utc";
@@ -602,114 +634,6 @@ __publicField(_DateUtils, "HOLIDAYS", _DateUtils.HOLIDAYS_STR.map((h) => {
602
634
  }));
603
635
  var DateUtils = _DateUtils;
604
636
 
605
- // src/common/promise-magic/deferred.ts
606
- function createDeferred() {
607
- let resolve;
608
- let reject;
609
- const promise = new Promise((res, rej) => {
610
- resolve = res;
611
- reject = rej;
612
- });
613
- return {
614
- promise,
615
- resolve,
616
- reject
617
- };
618
- }
619
- __name(createDeferred, "createDeferred");
620
-
621
- // src/common/promise-magic/single-promise-waiter.ts
622
- var _SinglePromiseWaiter = class _SinglePromiseWaiter {
623
- constructor() {
624
- __publicField(this, "_promise", null);
625
- }
626
- static getInstance() {
627
- if (!_SinglePromiseWaiter._instance) {
628
- _SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
629
- }
630
- return _SinglePromiseWaiter._instance;
631
- }
632
- get promise() {
633
- return this._promise;
634
- }
635
- set promise(promise) {
636
- if (promise !== null) {
637
- this._promise = promise;
638
- this._promise.finally(() => {
639
- this._promise = null;
640
- });
641
- }
642
- }
643
- get hasPromise() {
644
- return this._promise !== null;
645
- }
646
- };
647
- __name(_SinglePromiseWaiter, "SinglePromiseWaiter");
648
- __publicField(_SinglePromiseWaiter, "_instance");
649
- var SinglePromiseWaiter = _SinglePromiseWaiter;
650
-
651
- // src/common/utils/is-cron-valid.ts
652
- function isValidCron(expr) {
653
- const parts = expr.trim().split(/\s+/);
654
- if (parts.length < 5 || parts.length > 6) {
655
- return false;
656
- }
657
- const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
658
- return parts.every((part) => cronPart.test(part));
659
- }
660
- __name(isValidCron, "isValidCron");
661
-
662
- // src/common/patterns/singleton.ts
663
- var _Singleton = class _Singleton {
664
- /**
665
- * Creates or returns the singleton instance for the subclass.
666
- *
667
- * If an instance already exists for the subclass, that instance is
668
- * returned instead of creating a new one.
669
- *
670
- * @param callOnInit - Whether to call {@link onInit} for a newly
671
- * created instance. Ignored if the instance already exists.
672
- */
673
- constructor(callOnInit = true) {
674
- const ctor = this.constructor;
675
- const existing = _Singleton.instances.get(ctor);
676
- if (existing) {
677
- return existing;
678
- }
679
- _Singleton.instances.set(ctor, this);
680
- if (callOnInit) {
681
- void this.onInit();
682
- }
683
- }
684
- /**
685
- * Retrieves the singleton instance for the calling subclass.
686
- *
687
- * If no instance exists, a new one is created using the provided
688
- * constructor arguments.
689
- *
690
- * Intended to be used by subclasses as a protected factory method.
691
- *
692
- * @typeParam T - The concrete subclass type.
693
- * @param args - Arguments forwarded to the subclass constructor.
694
- * @returns The singleton instance of the subclass.
695
- */
696
- static getInstance(...args) {
697
- let instance = _Singleton.instances.get(this);
698
- if (!instance) {
699
- instance = new this(...args);
700
- _Singleton.instances.set(this, instance);
701
- }
702
- return instance;
703
- }
704
- };
705
- __name(_Singleton, "Singleton");
706
- /**
707
- * Internal registry of singleton instances.
708
- * One instance per subclass constructor.
709
- */
710
- __publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
711
- var Singleton = _Singleton;
712
-
713
637
  // src/common/dto/status-dto.ts
714
638
  var _StatusDto = class _StatusDto {
715
639
  constructor(status, details, timestamp) {
@@ -799,37 +723,102 @@ async function listAll(fetchPage, batchSize = 1e3) {
799
723
  }
800
724
  __name(listAll, "listAll");
801
725
 
802
- // src/common/constants/amount-unit.ts
803
- var AMOUNT_UNIT = {
804
- 1: {
805
- symbol: "g",
806
- translations: {
807
- en: "gram",
808
- cs: "gram"
726
+ // src/common/patterns/singleton.ts
727
+ var _Singleton = class _Singleton {
728
+ /**
729
+ * Creates or returns the singleton instance for the subclass.
730
+ *
731
+ * If an instance already exists for the subclass, that instance is
732
+ * returned instead of creating a new one.
733
+ *
734
+ * @param callOnInit - Whether to call {@link onInit} for a newly
735
+ * created instance. Ignored if the instance already exists.
736
+ */
737
+ constructor(callOnInit = true) {
738
+ const ctor = this.constructor;
739
+ const existing = _Singleton.instances.get(ctor);
740
+ if (existing) {
741
+ return existing;
809
742
  }
810
- },
811
- 2: {
812
- symbol: "kg",
813
- translations: {
814
- en: "kilogram",
815
- cs: "kilogram"
743
+ _Singleton.instances.set(ctor, this);
744
+ if (callOnInit) {
745
+ void this.onInit();
816
746
  }
817
- },
818
- 3: {
819
- symbol: "ml",
820
- translations: {
821
- en: "milliliter",
822
- cs: "mililitr"
747
+ }
748
+ /**
749
+ * Retrieves the singleton instance for the calling subclass.
750
+ *
751
+ * If no instance exists, a new one is created using the provided
752
+ * constructor arguments.
753
+ *
754
+ * Intended to be used by subclasses as a protected factory method.
755
+ *
756
+ * @typeParam T - The concrete subclass type.
757
+ * @param args - Arguments forwarded to the subclass constructor.
758
+ * @returns The singleton instance of the subclass.
759
+ */
760
+ static getInstance(...args) {
761
+ let instance = _Singleton.instances.get(this);
762
+ if (!instance) {
763
+ instance = new this(...args);
764
+ _Singleton.instances.set(this, instance);
823
765
  }
824
- },
825
- 4: {
826
- symbol: "l",
827
- translations: {
828
- en: "liter",
829
- cs: "litr"
766
+ return instance;
767
+ }
768
+ };
769
+ __name(_Singleton, "Singleton");
770
+ /**
771
+ * Internal registry of singleton instances.
772
+ * One instance per subclass constructor.
773
+ */
774
+ __publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
775
+ var Singleton = _Singleton;
776
+
777
+ // src/common/promise-magic/deferred.ts
778
+ function createDeferred() {
779
+ let resolve;
780
+ let reject;
781
+ const promise = new Promise((res, rej) => {
782
+ resolve = res;
783
+ reject = rej;
784
+ });
785
+ return {
786
+ promise,
787
+ resolve,
788
+ reject
789
+ };
790
+ }
791
+ __name(createDeferred, "createDeferred");
792
+
793
+ // src/common/promise-magic/single-promise-waiter.ts
794
+ var _SinglePromiseWaiter = class _SinglePromiseWaiter {
795
+ constructor() {
796
+ __publicField(this, "_promise", null);
797
+ }
798
+ static getInstance() {
799
+ if (!_SinglePromiseWaiter._instance) {
800
+ _SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
801
+ }
802
+ return _SinglePromiseWaiter._instance;
803
+ }
804
+ get promise() {
805
+ return this._promise;
806
+ }
807
+ set promise(promise) {
808
+ if (promise !== null) {
809
+ this._promise = promise;
810
+ this._promise.finally(() => {
811
+ this._promise = null;
812
+ });
830
813
  }
831
814
  }
815
+ get hasPromise() {
816
+ return this._promise !== null;
817
+ }
832
818
  };
819
+ __name(_SinglePromiseWaiter, "SinglePromiseWaiter");
820
+ __publicField(_SinglePromiseWaiter, "_instance");
821
+ var SinglePromiseWaiter = _SinglePromiseWaiter;
833
822
 
834
823
  // src/common/schema/entities/category.entity.ts
835
824
  import { Entity } from "typeorm";
@@ -1468,6 +1457,23 @@ async function runWithConcurrency(items, concurrency, worker) {
1468
1457
  }
1469
1458
  __name(runWithConcurrency, "runWithConcurrency");
1470
1459
 
1460
+ // src/common/utils/id-path-param-resolver.utils.ts
1461
+ function resolvePathParameterId(id) {
1462
+ return /^\d+$/.test(id) ? parseInt(id, 10) : id;
1463
+ }
1464
+ __name(resolvePathParameterId, "resolvePathParameterId");
1465
+
1466
+ // src/common/utils/is-cron-valid.ts
1467
+ function isValidCron(expr) {
1468
+ const parts = expr.trim().split(/\s+/);
1469
+ if (parts.length < 5 || parts.length > 6) {
1470
+ return false;
1471
+ }
1472
+ const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
1473
+ return parts.every((part) => cronPart.test(part));
1474
+ }
1475
+ __name(isValidCron, "isValidCron");
1476
+
1471
1477
  // src/common/utils/patch.utils.ts
1472
1478
  function buildPatch(data, keys, transforms) {
1473
1479
  const patch = {};
@@ -1482,43 +1488,6 @@ function buildPatch(data, keys, transforms) {
1482
1488
  }
1483
1489
  __name(buildPatch, "buildPatch");
1484
1490
 
1485
- // src/core/data-helper.ts
1486
- var _DataHelper = class _DataHelper {
1487
- constructor(startDataRetrieve = true, deviceIds) {
1488
- __publicField(this, "_data");
1489
- __publicField(this, "_dataPromise", null);
1490
- __publicField(this, "deviceIds");
1491
- this.deviceIds = deviceIds;
1492
- if (startDataRetrieve) {
1493
- this._dataPromise = this.startDataRetrieval();
1494
- }
1495
- }
1496
- get data() {
1497
- return this._data;
1498
- }
1499
- set data(value) {
1500
- this._data = value;
1501
- }
1502
- get dataPromise() {
1503
- return this._dataPromise;
1504
- }
1505
- set dataPromise(value) {
1506
- this._dataPromise = value;
1507
- }
1508
- async getData() {
1509
- if (this._dataPromise) {
1510
- return await this._dataPromise;
1511
- }
1512
- if (this._data === void 0) {
1513
- this._dataPromise = this.startDataRetrieval();
1514
- return this._dataPromise;
1515
- }
1516
- return this._data;
1517
- }
1518
- };
1519
- __name(_DataHelper, "DataHelper");
1520
- var DataHelper = _DataHelper;
1521
-
1522
1491
  // src/core/class/fresh-job.ts
1523
1492
  import { scheduleJob } from "node-schedule";
1524
1493
  var _FreshJob = class _FreshJob extends Singleton {
@@ -1667,6 +1636,346 @@ var _BusinessWarning = class _BusinessWarning extends Error {
1667
1636
  __name(_BusinessWarning, "BusinessWarning");
1668
1637
  var BusinessWarning = _BusinessWarning;
1669
1638
 
1639
+ // src/core/errors/fresh-error.ts
1640
+ var _FreshError = class _FreshError extends Error {
1641
+ constructor(statusCode, status, detail, options) {
1642
+ super(detail != null ? detail : status);
1643
+ /** HTTP status code sent in the response. */
1644
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1645
+ __publicField(this, "statusCode");
1646
+ /** Structured response body describing the error. */
1647
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1648
+ __publicField(this, "statusDto");
1649
+ this.name = this.constructor.name;
1650
+ if ((options == null ? void 0 : options.cause) !== void 0) {
1651
+ this.cause = options.cause;
1652
+ }
1653
+ this.statusCode = statusCode;
1654
+ this.statusDto = new StatusDto(status, detail);
1655
+ }
1656
+ };
1657
+ __name(_FreshError, "FreshError");
1658
+ var FreshError = _FreshError;
1659
+
1660
+ // src/core/errors/errors.ts
1661
+ var _BadRequestError = class _BadRequestError extends FreshError {
1662
+ constructor(detail, options) {
1663
+ super(HttpStatus.BAD_REQUEST, "validation-error", detail, options);
1664
+ }
1665
+ };
1666
+ __name(_BadRequestError, "BadRequestError");
1667
+ var BadRequestError = _BadRequestError;
1668
+ var _UnauthorizedError = class _UnauthorizedError extends FreshError {
1669
+ constructor(detail, options) {
1670
+ super(HttpStatus.UNAUTHORIZED, "not-authenticated", detail, options);
1671
+ }
1672
+ };
1673
+ __name(_UnauthorizedError, "UnauthorizedError");
1674
+ var UnauthorizedError = _UnauthorizedError;
1675
+ var _PaymentRequiredError = class _PaymentRequiredError extends FreshError {
1676
+ constructor(detail, options) {
1677
+ super(HttpStatus.PAYMENT_REQUIRED, "error", detail, options);
1678
+ }
1679
+ };
1680
+ __name(_PaymentRequiredError, "PaymentRequiredError");
1681
+ var PaymentRequiredError = _PaymentRequiredError;
1682
+ var _ForbiddenError = class _ForbiddenError extends FreshError {
1683
+ constructor(detail, options) {
1684
+ super(HttpStatus.FORBIDDEN, "not-authorized", detail, options);
1685
+ }
1686
+ };
1687
+ __name(_ForbiddenError, "ForbiddenError");
1688
+ var ForbiddenError = _ForbiddenError;
1689
+ var _NotFoundError = class _NotFoundError extends FreshError {
1690
+ constructor(detail, options) {
1691
+ super(HttpStatus.NOT_FOUND, "error", detail, options);
1692
+ }
1693
+ };
1694
+ __name(_NotFoundError, "NotFoundError");
1695
+ var NotFoundError = _NotFoundError;
1696
+ var _MethodNotAllowedError = class _MethodNotAllowedError extends FreshError {
1697
+ constructor(detail, options) {
1698
+ super(HttpStatus.METHOD_NOT_ALLOWED, "error", detail, options);
1699
+ }
1700
+ };
1701
+ __name(_MethodNotAllowedError, "MethodNotAllowedError");
1702
+ var MethodNotAllowedError = _MethodNotAllowedError;
1703
+ var _NotAcceptableError = class _NotAcceptableError extends FreshError {
1704
+ constructor(detail, options) {
1705
+ super(HttpStatus.NOT_ACCEPTABLE, "error", detail, options);
1706
+ }
1707
+ };
1708
+ __name(_NotAcceptableError, "NotAcceptableError");
1709
+ var NotAcceptableError = _NotAcceptableError;
1710
+ var _ProxyAuthenticationRequiredError = class _ProxyAuthenticationRequiredError extends FreshError {
1711
+ constructor(detail, options) {
1712
+ super(HttpStatus.PROXY_AUTHENTICATION_REQUIRED, "not-authenticated", detail, options);
1713
+ }
1714
+ };
1715
+ __name(_ProxyAuthenticationRequiredError, "ProxyAuthenticationRequiredError");
1716
+ var ProxyAuthenticationRequiredError = _ProxyAuthenticationRequiredError;
1717
+ var _RequestTimeoutError = class _RequestTimeoutError extends FreshError {
1718
+ constructor(detail, options) {
1719
+ super(HttpStatus.REQUEST_TIMEOUT, "error", detail, options);
1720
+ }
1721
+ };
1722
+ __name(_RequestTimeoutError, "RequestTimeoutError");
1723
+ var RequestTimeoutError = _RequestTimeoutError;
1724
+ var _ConflictError = class _ConflictError extends FreshError {
1725
+ constructor(detail, options) {
1726
+ super(HttpStatus.CONFLICT, "error", detail, options);
1727
+ }
1728
+ };
1729
+ __name(_ConflictError, "ConflictError");
1730
+ var ConflictError = _ConflictError;
1731
+ var _GoneError = class _GoneError extends FreshError {
1732
+ constructor(detail, options) {
1733
+ super(HttpStatus.GONE, "error", detail, options);
1734
+ }
1735
+ };
1736
+ __name(_GoneError, "GoneError");
1737
+ var GoneError = _GoneError;
1738
+ var _LengthRequiredError = class _LengthRequiredError extends FreshError {
1739
+ constructor(detail, options) {
1740
+ super(HttpStatus.LENGTH_REQUIRED, "error", detail, options);
1741
+ }
1742
+ };
1743
+ __name(_LengthRequiredError, "LengthRequiredError");
1744
+ var LengthRequiredError = _LengthRequiredError;
1745
+ var _PreconditionFailedError = class _PreconditionFailedError extends FreshError {
1746
+ constructor(detail, options) {
1747
+ super(HttpStatus.PRECONDITION_FAILED, "error", detail, options);
1748
+ }
1749
+ };
1750
+ __name(_PreconditionFailedError, "PreconditionFailedError");
1751
+ var PreconditionFailedError = _PreconditionFailedError;
1752
+ var _PayloadTooLargeError = class _PayloadTooLargeError extends FreshError {
1753
+ constructor(detail, options) {
1754
+ super(HttpStatus.PAYLOAD_TOO_LARGE, "error", detail, options);
1755
+ }
1756
+ };
1757
+ __name(_PayloadTooLargeError, "PayloadTooLargeError");
1758
+ var PayloadTooLargeError = _PayloadTooLargeError;
1759
+ var _UriTooLongError = class _UriTooLongError extends FreshError {
1760
+ constructor(detail, options) {
1761
+ super(HttpStatus.URI_TOO_LONG, "error", detail, options);
1762
+ }
1763
+ };
1764
+ __name(_UriTooLongError, "UriTooLongError");
1765
+ var UriTooLongError = _UriTooLongError;
1766
+ var _UnsupportedMediaTypeError = class _UnsupportedMediaTypeError extends FreshError {
1767
+ constructor(detail, options) {
1768
+ super(HttpStatus.UNSUPPORTED_MEDIA_TYPE, "error", detail, options);
1769
+ }
1770
+ };
1771
+ __name(_UnsupportedMediaTypeError, "UnsupportedMediaTypeError");
1772
+ var UnsupportedMediaTypeError = _UnsupportedMediaTypeError;
1773
+ var _RangeNotSatisfiableError = class _RangeNotSatisfiableError extends FreshError {
1774
+ constructor(detail, options) {
1775
+ super(HttpStatus.RANGE_NOT_SATISFIABLE, "error", detail, options);
1776
+ }
1777
+ };
1778
+ __name(_RangeNotSatisfiableError, "RangeNotSatisfiableError");
1779
+ var RangeNotSatisfiableError = _RangeNotSatisfiableError;
1780
+ var _ExpectationFailedError = class _ExpectationFailedError extends FreshError {
1781
+ constructor(detail, options) {
1782
+ super(HttpStatus.EXPECTATION_FAILED, "error", detail, options);
1783
+ }
1784
+ };
1785
+ __name(_ExpectationFailedError, "ExpectationFailedError");
1786
+ var ExpectationFailedError = _ExpectationFailedError;
1787
+ var _ImATeapotError = class _ImATeapotError extends FreshError {
1788
+ constructor(detail, options) {
1789
+ super(HttpStatus.IM_A_TEAPOT, "error", detail, options);
1790
+ }
1791
+ };
1792
+ __name(_ImATeapotError, "ImATeapotError");
1793
+ var ImATeapotError = _ImATeapotError;
1794
+ var _MisdirectedRequestError = class _MisdirectedRequestError extends FreshError {
1795
+ constructor(detail, options) {
1796
+ super(HttpStatus.MISDIRECTED_REQUEST, "error", detail, options);
1797
+ }
1798
+ };
1799
+ __name(_MisdirectedRequestError, "MisdirectedRequestError");
1800
+ var MisdirectedRequestError = _MisdirectedRequestError;
1801
+ var _UnprocessableEntityError = class _UnprocessableEntityError extends FreshError {
1802
+ constructor(detail, options) {
1803
+ super(HttpStatus.UNPROCESSABLE_ENTITY, "validation-error", detail, options);
1804
+ }
1805
+ };
1806
+ __name(_UnprocessableEntityError, "UnprocessableEntityError");
1807
+ var UnprocessableEntityError = _UnprocessableEntityError;
1808
+ var _LockedError = class _LockedError extends FreshError {
1809
+ constructor(detail, options) {
1810
+ super(HttpStatus.LOCKED, "error", detail, options);
1811
+ }
1812
+ };
1813
+ __name(_LockedError, "LockedError");
1814
+ var LockedError = _LockedError;
1815
+ var _FailedDependencyError = class _FailedDependencyError extends FreshError {
1816
+ constructor(detail, options) {
1817
+ super(HttpStatus.FAILED_DEPENDENCY, "error", detail, options);
1818
+ }
1819
+ };
1820
+ __name(_FailedDependencyError, "FailedDependencyError");
1821
+ var FailedDependencyError = _FailedDependencyError;
1822
+ var _TooEarlyError = class _TooEarlyError extends FreshError {
1823
+ constructor(detail, options) {
1824
+ super(HttpStatus.TOO_EARLY, "error", detail, options);
1825
+ }
1826
+ };
1827
+ __name(_TooEarlyError, "TooEarlyError");
1828
+ var TooEarlyError = _TooEarlyError;
1829
+ var _UpgradeRequiredError = class _UpgradeRequiredError extends FreshError {
1830
+ constructor(detail, options) {
1831
+ super(HttpStatus.UPGRADE_REQUIRED, "error", detail, options);
1832
+ }
1833
+ };
1834
+ __name(_UpgradeRequiredError, "UpgradeRequiredError");
1835
+ var UpgradeRequiredError = _UpgradeRequiredError;
1836
+ var _PreconditionRequiredError = class _PreconditionRequiredError extends FreshError {
1837
+ constructor(detail, options) {
1838
+ super(HttpStatus.PRECONDITION_REQUIRED, "error", detail, options);
1839
+ }
1840
+ };
1841
+ __name(_PreconditionRequiredError, "PreconditionRequiredError");
1842
+ var PreconditionRequiredError = _PreconditionRequiredError;
1843
+ var _TooManyRequestsError = class _TooManyRequestsError extends FreshError {
1844
+ constructor(detail, options) {
1845
+ super(HttpStatus.TOO_MANY_REQUESTS, "error", detail, options);
1846
+ }
1847
+ };
1848
+ __name(_TooManyRequestsError, "TooManyRequestsError");
1849
+ var TooManyRequestsError = _TooManyRequestsError;
1850
+ var _RequestHeaderFieldsTooLargeError = class _RequestHeaderFieldsTooLargeError extends FreshError {
1851
+ constructor(detail, options) {
1852
+ super(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE, "error", detail, options);
1853
+ }
1854
+ };
1855
+ __name(_RequestHeaderFieldsTooLargeError, "RequestHeaderFieldsTooLargeError");
1856
+ var RequestHeaderFieldsTooLargeError = _RequestHeaderFieldsTooLargeError;
1857
+ var _UnavailableForLegalReasonsError = class _UnavailableForLegalReasonsError extends FreshError {
1858
+ constructor(detail, options) {
1859
+ super(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS, "error", detail, options);
1860
+ }
1861
+ };
1862
+ __name(_UnavailableForLegalReasonsError, "UnavailableForLegalReasonsError");
1863
+ var UnavailableForLegalReasonsError = _UnavailableForLegalReasonsError;
1864
+ var _InternalServerError = class _InternalServerError extends FreshError {
1865
+ constructor(detail, options) {
1866
+ super(HttpStatus.INTERNAL_SERVER_ERROR, "internal-server-error", detail, options);
1867
+ }
1868
+ };
1869
+ __name(_InternalServerError, "InternalServerError");
1870
+ var InternalServerError = _InternalServerError;
1871
+ var _NotImplementedError = class _NotImplementedError extends FreshError {
1872
+ constructor(detail, options) {
1873
+ super(HttpStatus.NOT_IMPLEMENTED, "internal-server-error", detail, options);
1874
+ }
1875
+ };
1876
+ __name(_NotImplementedError, "NotImplementedError");
1877
+ var NotImplementedError = _NotImplementedError;
1878
+ var _BadGatewayError = class _BadGatewayError extends FreshError {
1879
+ constructor(detail, options) {
1880
+ super(HttpStatus.BAD_GATEWAY, "internal-server-error", detail, options);
1881
+ }
1882
+ };
1883
+ __name(_BadGatewayError, "BadGatewayError");
1884
+ var BadGatewayError = _BadGatewayError;
1885
+ var _ServiceUnavailableError = class _ServiceUnavailableError extends FreshError {
1886
+ constructor(detail, options) {
1887
+ super(HttpStatus.SERVICE_UNAVAILABLE, "internal-server-error", detail, options);
1888
+ }
1889
+ };
1890
+ __name(_ServiceUnavailableError, "ServiceUnavailableError");
1891
+ var ServiceUnavailableError = _ServiceUnavailableError;
1892
+ var _GatewayTimeoutError = class _GatewayTimeoutError extends FreshError {
1893
+ constructor(detail, options) {
1894
+ super(HttpStatus.GATEWAY_TIMEOUT, "internal-server-error", detail, options);
1895
+ }
1896
+ };
1897
+ __name(_GatewayTimeoutError, "GatewayTimeoutError");
1898
+ var GatewayTimeoutError = _GatewayTimeoutError;
1899
+ var _HttpVersionNotSupportedError = class _HttpVersionNotSupportedError extends FreshError {
1900
+ constructor(detail, options) {
1901
+ super(HttpStatus.HTTP_VERSION_NOT_SUPPORTED, "internal-server-error", detail, options);
1902
+ }
1903
+ };
1904
+ __name(_HttpVersionNotSupportedError, "HttpVersionNotSupportedError");
1905
+ var HttpVersionNotSupportedError = _HttpVersionNotSupportedError;
1906
+ var _VariantAlsoNegotiatesError = class _VariantAlsoNegotiatesError extends FreshError {
1907
+ constructor(detail, options) {
1908
+ super(HttpStatus.VARIANT_ALSO_NEGOTIATES, "internal-server-error", detail, options);
1909
+ }
1910
+ };
1911
+ __name(_VariantAlsoNegotiatesError, "VariantAlsoNegotiatesError");
1912
+ var VariantAlsoNegotiatesError = _VariantAlsoNegotiatesError;
1913
+ var _InsufficientStorageError = class _InsufficientStorageError extends FreshError {
1914
+ constructor(detail, options) {
1915
+ super(HttpStatus.INSUFFICIENT_STORAGE, "internal-server-error", detail, options);
1916
+ }
1917
+ };
1918
+ __name(_InsufficientStorageError, "InsufficientStorageError");
1919
+ var InsufficientStorageError = _InsufficientStorageError;
1920
+ var _LoopDetectedError = class _LoopDetectedError extends FreshError {
1921
+ constructor(detail, options) {
1922
+ super(HttpStatus.LOOP_DETECTED, "internal-server-error", detail, options);
1923
+ }
1924
+ };
1925
+ __name(_LoopDetectedError, "LoopDetectedError");
1926
+ var LoopDetectedError = _LoopDetectedError;
1927
+ var _NotExtendedError = class _NotExtendedError extends FreshError {
1928
+ constructor(detail, options) {
1929
+ super(HttpStatus.NOT_EXTENDED, "internal-server-error", detail, options);
1930
+ }
1931
+ };
1932
+ __name(_NotExtendedError, "NotExtendedError");
1933
+ var NotExtendedError = _NotExtendedError;
1934
+ var _NetworkAuthenticationRequiredError = class _NetworkAuthenticationRequiredError extends FreshError {
1935
+ constructor(detail, options) {
1936
+ super(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED, "internal-server-error", detail, options);
1937
+ }
1938
+ };
1939
+ __name(_NetworkAuthenticationRequiredError, "NetworkAuthenticationRequiredError");
1940
+ var NetworkAuthenticationRequiredError = _NetworkAuthenticationRequiredError;
1941
+
1942
+ // src/core/data-helper.ts
1943
+ var _DataHelper = class _DataHelper {
1944
+ constructor(startDataRetrieve = true, deviceIds) {
1945
+ __publicField(this, "_data");
1946
+ __publicField(this, "_dataPromise", null);
1947
+ __publicField(this, "deviceIds");
1948
+ this.deviceIds = deviceIds;
1949
+ if (startDataRetrieve) {
1950
+ this._dataPromise = this.startDataRetrieval();
1951
+ }
1952
+ }
1953
+ get data() {
1954
+ return this._data;
1955
+ }
1956
+ set data(value) {
1957
+ this._data = value;
1958
+ }
1959
+ get dataPromise() {
1960
+ return this._dataPromise;
1961
+ }
1962
+ set dataPromise(value) {
1963
+ this._dataPromise = value;
1964
+ }
1965
+ async getData() {
1966
+ if (this._dataPromise) {
1967
+ return await this._dataPromise;
1968
+ }
1969
+ if (this._data === void 0) {
1970
+ this._dataPromise = this.startDataRetrieval();
1971
+ return this._dataPromise;
1972
+ }
1973
+ return this._data;
1974
+ }
1975
+ };
1976
+ __name(_DataHelper, "DataHelper");
1977
+ var DataHelper = _DataHelper;
1978
+
1670
1979
  // src/types/maybe-type.ts
1671
1980
  function isMaybe(v, inner) {
1672
1981
  return v === null || inner(v);
@@ -1859,32 +2168,73 @@ export {
1859
2168
  AMOUNT_UNIT,
1860
2169
  ActionCommandCode,
1861
2170
  ApiError,
2171
+ BadGatewayError,
2172
+ BadRequestError,
1862
2173
  BaseEntityChangeSubscriber,
1863
2174
  BusinessWarning,
1864
2175
  Category,
2176
+ ConflictError,
1865
2177
  DEFAULT_PAGINATION_PARAMS,
1866
2178
  DataHelper,
1867
2179
  DateUtils,
1868
2180
  DepotPoolStatus,
1869
2181
  Device,
2182
+ ExpectationFailedError,
2183
+ FailedDependencyError,
2184
+ ForbiddenError,
1870
2185
  FreshDao,
1871
2186
  FreshEntity,
2187
+ FreshError,
1872
2188
  FreshHyperEntity,
1873
2189
  FreshJob,
1874
2190
  FreshTranslationBase,
2191
+ GatewayTimeoutError,
2192
+ GoneError,
1875
2193
  HttpStatus,
2194
+ HttpVersionNotSupportedError,
2195
+ ImATeapotError,
2196
+ InsufficientStorageError,
2197
+ InternalServerError,
1876
2198
  LanguageCode,
2199
+ LengthRequiredError,
2200
+ LockedError,
2201
+ LoopDetectedError,
1877
2202
  Manufacturer,
2203
+ MethodNotAllowedError,
2204
+ MisdirectedRequestError,
2205
+ NetworkAuthenticationRequiredError,
2206
+ NotAcceptableError,
2207
+ NotExtendedError,
2208
+ NotFoundError,
2209
+ NotImplementedError,
2210
+ PayloadTooLargeError,
1878
2211
  PaymentMethod,
2212
+ PaymentRequiredError,
1879
2213
  datasource_default as PgDataSourceOptions,
2214
+ PreconditionFailedError,
2215
+ PreconditionRequiredError,
1880
2216
  Product,
2217
+ ProxyAuthenticationRequiredError,
2218
+ RangeNotSatisfiableError,
2219
+ RequestHeaderFieldsTooLargeError,
2220
+ RequestTimeoutError,
2221
+ ServiceUnavailableError,
1881
2222
  SinglePromiseWaiter,
1882
2223
  Singleton,
1883
2224
  StatusDto,
1884
2225
  Subcategory,
1885
2226
  TO_BINARY_FLAG,
1886
2227
  TimestampColumn,
2228
+ TooEarlyError,
2229
+ TooManyRequestsError,
1887
2230
  TransactionType,
2231
+ UnauthorizedError,
2232
+ UnavailableForLegalReasonsError,
2233
+ UnprocessableEntityError,
2234
+ UnsupportedMediaTypeError,
2235
+ UpgradeRequiredError,
2236
+ UriTooLongError,
2237
+ VariantAlsoNegotiatesError,
1888
2238
  buildPatch,
1889
2239
  constructTypeormPagination,
1890
2240
  createDeferred,
@@ -1903,6 +2253,7 @@ export {
1903
2253
  isValidCron,
1904
2254
  listAll,
1905
2255
  parsePaginationFromURL,
2256
+ resolvePathParameterId,
1906
2257
  runWithConcurrency,
1907
2258
  toDecimal
1908
2259
  };