@freshpointcz/fresh-core 0.0.18 → 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.d.mts +696 -113
- package/dist/index.d.ts +696 -113
- package/dist/index.js +662 -137
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +611 -136
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,62 +634,94 @@ __publicField(_DateUtils, "HOLIDAYS", _DateUtils.HOLIDAYS_STR.map((h) => {
|
|
|
602
634
|
}));
|
|
603
635
|
var DateUtils = _DateUtils;
|
|
604
636
|
|
|
605
|
-
// src/common/
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
637
|
+
// src/common/dto/status-dto.ts
|
|
638
|
+
var _StatusDto = class _StatusDto {
|
|
639
|
+
constructor(status, details, timestamp) {
|
|
640
|
+
/**
|
|
641
|
+
* Call result status
|
|
642
|
+
*/
|
|
643
|
+
__publicField(this, "status");
|
|
644
|
+
/**
|
|
645
|
+
* UTC Timestamp
|
|
646
|
+
* @example "2021-12-01T13:23:39.305Z"
|
|
647
|
+
*/
|
|
648
|
+
__publicField(this, "timestamp");
|
|
649
|
+
/**
|
|
650
|
+
* Details (optional)
|
|
651
|
+
*/
|
|
652
|
+
__publicField(this, "details");
|
|
653
|
+
this.status = status;
|
|
654
|
+
this.details = details;
|
|
655
|
+
this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
__name(_StatusDto, "StatusDto");
|
|
659
|
+
var StatusDto = _StatusDto;
|
|
660
|
+
|
|
661
|
+
// src/common/pagination/constructors.ts
|
|
662
|
+
function constructTypeormPagination(params) {
|
|
613
663
|
return {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
reject
|
|
664
|
+
take: params.limit,
|
|
665
|
+
skip: params.skip
|
|
617
666
|
};
|
|
618
667
|
}
|
|
619
|
-
__name(
|
|
668
|
+
__name(constructTypeormPagination, "constructTypeormPagination");
|
|
669
|
+
function parsePaginationFromURL(searchParams) {
|
|
670
|
+
var _a, _b;
|
|
671
|
+
const page = Math.max(1, parseInt((_a = searchParams.get("page")) != null ? _a : "1", 10));
|
|
672
|
+
const limit = Math.min(100, Math.max(1, parseInt((_b = searchParams.get("limit")) != null ? _b : "20", 10)));
|
|
673
|
+
return {
|
|
674
|
+
page,
|
|
675
|
+
limit,
|
|
676
|
+
skip: (page - 1) * limit
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
__name(parsePaginationFromURL, "parsePaginationFromURL");
|
|
620
680
|
|
|
621
|
-
// src/common/
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
return this._promise !== null;
|
|
645
|
-
}
|
|
681
|
+
// src/common/pagination/pagination-meta.ts
|
|
682
|
+
function getPaginationMeta(total, page, limit) {
|
|
683
|
+
return {
|
|
684
|
+
total,
|
|
685
|
+
page,
|
|
686
|
+
limit,
|
|
687
|
+
totalPages: Math.ceil(total / limit)
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
__name(getPaginationMeta, "getPaginationMeta");
|
|
691
|
+
|
|
692
|
+
// src/common/pagination/pagination-params.ts
|
|
693
|
+
function getPaginationParams(params) {
|
|
694
|
+
return {
|
|
695
|
+
...DEFAULT_PAGINATION_PARAMS,
|
|
696
|
+
...params
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
__name(getPaginationParams, "getPaginationParams");
|
|
700
|
+
var DEFAULT_PAGINATION_PARAMS = {
|
|
701
|
+
page: 1,
|
|
702
|
+
limit: 1e3,
|
|
703
|
+
skip: 0
|
|
646
704
|
};
|
|
647
|
-
__name(_SinglePromiseWaiter, "SinglePromiseWaiter");
|
|
648
|
-
__publicField(_SinglePromiseWaiter, "_instance");
|
|
649
|
-
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
650
705
|
|
|
651
|
-
// src/common/
|
|
652
|
-
function
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
706
|
+
// src/common/pagination/scrapper.ts
|
|
707
|
+
async function listAll(fetchPage, batchSize = 1e3) {
|
|
708
|
+
const results = [];
|
|
709
|
+
let page = 1;
|
|
710
|
+
while (true) {
|
|
711
|
+
const { data, meta } = await fetchPage({
|
|
712
|
+
page,
|
|
713
|
+
limit: batchSize,
|
|
714
|
+
skip: (page - 1) * batchSize
|
|
715
|
+
});
|
|
716
|
+
results.push(...data);
|
|
717
|
+
if (page >= meta.totalPages) {
|
|
718
|
+
break;
|
|
719
|
+
}
|
|
720
|
+
page++;
|
|
656
721
|
}
|
|
657
|
-
|
|
658
|
-
return parts.every((part) => cronPart.test(part));
|
|
722
|
+
return results;
|
|
659
723
|
}
|
|
660
|
-
__name(
|
|
724
|
+
__name(listAll, "listAll");
|
|
661
725
|
|
|
662
726
|
// src/common/patterns/singleton.ts
|
|
663
727
|
var _Singleton = class _Singleton {
|
|
@@ -710,61 +774,51 @@ __name(_Singleton, "Singleton");
|
|
|
710
774
|
__publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
|
|
711
775
|
var Singleton = _Singleton;
|
|
712
776
|
|
|
713
|
-
// src/common/
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
__publicField(this, "details");
|
|
729
|
-
this.status = status;
|
|
730
|
-
this.details = details;
|
|
731
|
-
this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
|
|
732
|
-
}
|
|
733
|
-
};
|
|
734
|
-
__name(_StatusDto, "StatusDto");
|
|
735
|
-
var StatusDto = _StatusDto;
|
|
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");
|
|
736
792
|
|
|
737
|
-
// src/common/
|
|
738
|
-
var
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
},
|
|
746
|
-
2: {
|
|
747
|
-
symbol: "kg",
|
|
748
|
-
translations: {
|
|
749
|
-
en: "kilogram",
|
|
750
|
-
cs: "kilogram"
|
|
751
|
-
}
|
|
752
|
-
},
|
|
753
|
-
3: {
|
|
754
|
-
symbol: "ml",
|
|
755
|
-
translations: {
|
|
756
|
-
en: "milliliter",
|
|
757
|
-
cs: "mililitr"
|
|
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();
|
|
758
801
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
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
|
+
});
|
|
765
813
|
}
|
|
766
814
|
}
|
|
815
|
+
get hasPromise() {
|
|
816
|
+
return this._promise !== null;
|
|
817
|
+
}
|
|
767
818
|
};
|
|
819
|
+
__name(_SinglePromiseWaiter, "SinglePromiseWaiter");
|
|
820
|
+
__publicField(_SinglePromiseWaiter, "_instance");
|
|
821
|
+
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
768
822
|
|
|
769
823
|
// src/common/schema/entities/category.entity.ts
|
|
770
824
|
import { Entity } from "typeorm";
|
|
@@ -1282,6 +1336,57 @@ Subcategory = _ts_decorate8([
|
|
|
1282
1336
|
Entity5()
|
|
1283
1337
|
], Subcategory);
|
|
1284
1338
|
|
|
1339
|
+
// src/common/typeguards/decimal.ts
|
|
1340
|
+
function toDecimal(num, precision = 9, scale = 2) {
|
|
1341
|
+
const limit = Math.pow(10, precision - scale);
|
|
1342
|
+
if (Math.abs(num) >= limit) {
|
|
1343
|
+
throw new Error(`Value ${num} exceeds the allowed precision of ${precision} and scale of ${scale}.`);
|
|
1344
|
+
}
|
|
1345
|
+
return num.toFixed(scale);
|
|
1346
|
+
}
|
|
1347
|
+
__name(toDecimal, "toDecimal");
|
|
1348
|
+
function isDecimal(v, options) {
|
|
1349
|
+
var _a, _b, _c;
|
|
1350
|
+
const type = typeof v;
|
|
1351
|
+
if ((options == null ? void 0 : options.allowedType) !== void 0 && type !== options.allowedType) {
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
if (type !== "number" && type !== "string") {
|
|
1355
|
+
return false;
|
|
1356
|
+
}
|
|
1357
|
+
const sep = (_a = options == null ? void 0 : options.decimalPoint) != null ? _a : ".";
|
|
1358
|
+
let intPart;
|
|
1359
|
+
let fracPart;
|
|
1360
|
+
if (type === "number") {
|
|
1361
|
+
const n = v;
|
|
1362
|
+
if (!Number.isFinite(n)) {
|
|
1363
|
+
return false;
|
|
1364
|
+
}
|
|
1365
|
+
const str = n.toString();
|
|
1366
|
+
if (str.includes("e") || str.includes("E")) {
|
|
1367
|
+
return false;
|
|
1368
|
+
}
|
|
1369
|
+
const parts = str.replace("-", "").split(".");
|
|
1370
|
+
intPart = parts[0];
|
|
1371
|
+
fracPart = (_b = parts[1]) != null ? _b : "";
|
|
1372
|
+
} else {
|
|
1373
|
+
const s = v;
|
|
1374
|
+
const escapedSep = sep === "." ? "\\." : ",";
|
|
1375
|
+
const pattern = new RegExp(`^-?\\d+(?:${escapedSep}\\d+)?$`);
|
|
1376
|
+
if (!pattern.test(s)) {
|
|
1377
|
+
return false;
|
|
1378
|
+
}
|
|
1379
|
+
const parts = s.replace("-", "").split(sep);
|
|
1380
|
+
intPart = parts[0];
|
|
1381
|
+
fracPart = (_c = parts[1]) != null ? _c : "";
|
|
1382
|
+
}
|
|
1383
|
+
if ((options == null ? void 0 : options.scale) !== void 0 && fracPart.length > options.scale) {
|
|
1384
|
+
return false;
|
|
1385
|
+
}
|
|
1386
|
+
return (options == null ? void 0 : options.precision) === void 0 || intPart.length + fracPart.length <= options.precision;
|
|
1387
|
+
}
|
|
1388
|
+
__name(isDecimal, "isDecimal");
|
|
1389
|
+
|
|
1285
1390
|
// src/common/typeguards/enums.ts
|
|
1286
1391
|
function isEnumValue(enumObj, v) {
|
|
1287
1392
|
if (!enumObj) {
|
|
@@ -1352,6 +1457,23 @@ async function runWithConcurrency(items, concurrency, worker) {
|
|
|
1352
1457
|
}
|
|
1353
1458
|
__name(runWithConcurrency, "runWithConcurrency");
|
|
1354
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
|
+
|
|
1355
1477
|
// src/common/utils/patch.utils.ts
|
|
1356
1478
|
function buildPatch(data, keys, transforms) {
|
|
1357
1479
|
const patch = {};
|
|
@@ -1366,43 +1488,6 @@ function buildPatch(data, keys, transforms) {
|
|
|
1366
1488
|
}
|
|
1367
1489
|
__name(buildPatch, "buildPatch");
|
|
1368
1490
|
|
|
1369
|
-
// src/core/data-helper.ts
|
|
1370
|
-
var _DataHelper = class _DataHelper {
|
|
1371
|
-
constructor(startDataRetrieve = true, deviceIds) {
|
|
1372
|
-
__publicField(this, "_data");
|
|
1373
|
-
__publicField(this, "_dataPromise", null);
|
|
1374
|
-
__publicField(this, "deviceIds");
|
|
1375
|
-
this.deviceIds = deviceIds;
|
|
1376
|
-
if (startDataRetrieve) {
|
|
1377
|
-
this._dataPromise = this.startDataRetrieval();
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
get data() {
|
|
1381
|
-
return this._data;
|
|
1382
|
-
}
|
|
1383
|
-
set data(value) {
|
|
1384
|
-
this._data = value;
|
|
1385
|
-
}
|
|
1386
|
-
get dataPromise() {
|
|
1387
|
-
return this._dataPromise;
|
|
1388
|
-
}
|
|
1389
|
-
set dataPromise(value) {
|
|
1390
|
-
this._dataPromise = value;
|
|
1391
|
-
}
|
|
1392
|
-
async getData() {
|
|
1393
|
-
if (this._dataPromise) {
|
|
1394
|
-
return await this._dataPromise;
|
|
1395
|
-
}
|
|
1396
|
-
if (this._data === void 0) {
|
|
1397
|
-
this._dataPromise = this.startDataRetrieval();
|
|
1398
|
-
return this._dataPromise;
|
|
1399
|
-
}
|
|
1400
|
-
return this._data;
|
|
1401
|
-
}
|
|
1402
|
-
};
|
|
1403
|
-
__name(_DataHelper, "DataHelper");
|
|
1404
|
-
var DataHelper = _DataHelper;
|
|
1405
|
-
|
|
1406
1491
|
// src/core/class/fresh-job.ts
|
|
1407
1492
|
import { scheduleJob } from "node-schedule";
|
|
1408
1493
|
var _FreshJob = class _FreshJob extends Singleton {
|
|
@@ -1551,6 +1636,346 @@ var _BusinessWarning = class _BusinessWarning extends Error {
|
|
|
1551
1636
|
__name(_BusinessWarning, "BusinessWarning");
|
|
1552
1637
|
var BusinessWarning = _BusinessWarning;
|
|
1553
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
|
+
|
|
1554
1979
|
// src/types/maybe-type.ts
|
|
1555
1980
|
function isMaybe(v, inner) {
|
|
1556
1981
|
return v === null || inner(v);
|
|
@@ -1743,35 +2168,81 @@ export {
|
|
|
1743
2168
|
AMOUNT_UNIT,
|
|
1744
2169
|
ActionCommandCode,
|
|
1745
2170
|
ApiError,
|
|
2171
|
+
BadGatewayError,
|
|
2172
|
+
BadRequestError,
|
|
1746
2173
|
BaseEntityChangeSubscriber,
|
|
1747
2174
|
BusinessWarning,
|
|
1748
2175
|
Category,
|
|
2176
|
+
ConflictError,
|
|
2177
|
+
DEFAULT_PAGINATION_PARAMS,
|
|
1749
2178
|
DataHelper,
|
|
1750
2179
|
DateUtils,
|
|
1751
2180
|
DepotPoolStatus,
|
|
1752
2181
|
Device,
|
|
2182
|
+
ExpectationFailedError,
|
|
2183
|
+
FailedDependencyError,
|
|
2184
|
+
ForbiddenError,
|
|
1753
2185
|
FreshDao,
|
|
1754
2186
|
FreshEntity,
|
|
2187
|
+
FreshError,
|
|
1755
2188
|
FreshHyperEntity,
|
|
1756
2189
|
FreshJob,
|
|
1757
2190
|
FreshTranslationBase,
|
|
2191
|
+
GatewayTimeoutError,
|
|
2192
|
+
GoneError,
|
|
1758
2193
|
HttpStatus,
|
|
2194
|
+
HttpVersionNotSupportedError,
|
|
2195
|
+
ImATeapotError,
|
|
2196
|
+
InsufficientStorageError,
|
|
2197
|
+
InternalServerError,
|
|
1759
2198
|
LanguageCode,
|
|
2199
|
+
LengthRequiredError,
|
|
2200
|
+
LockedError,
|
|
2201
|
+
LoopDetectedError,
|
|
1760
2202
|
Manufacturer,
|
|
2203
|
+
MethodNotAllowedError,
|
|
2204
|
+
MisdirectedRequestError,
|
|
2205
|
+
NetworkAuthenticationRequiredError,
|
|
2206
|
+
NotAcceptableError,
|
|
2207
|
+
NotExtendedError,
|
|
2208
|
+
NotFoundError,
|
|
2209
|
+
NotImplementedError,
|
|
2210
|
+
PayloadTooLargeError,
|
|
1761
2211
|
PaymentMethod,
|
|
2212
|
+
PaymentRequiredError,
|
|
1762
2213
|
datasource_default as PgDataSourceOptions,
|
|
2214
|
+
PreconditionFailedError,
|
|
2215
|
+
PreconditionRequiredError,
|
|
1763
2216
|
Product,
|
|
2217
|
+
ProxyAuthenticationRequiredError,
|
|
2218
|
+
RangeNotSatisfiableError,
|
|
2219
|
+
RequestHeaderFieldsTooLargeError,
|
|
2220
|
+
RequestTimeoutError,
|
|
2221
|
+
ServiceUnavailableError,
|
|
1764
2222
|
SinglePromiseWaiter,
|
|
1765
2223
|
Singleton,
|
|
1766
2224
|
StatusDto,
|
|
1767
2225
|
Subcategory,
|
|
1768
2226
|
TO_BINARY_FLAG,
|
|
1769
2227
|
TimestampColumn,
|
|
2228
|
+
TooEarlyError,
|
|
2229
|
+
TooManyRequestsError,
|
|
1770
2230
|
TransactionType,
|
|
2231
|
+
UnauthorizedError,
|
|
2232
|
+
UnavailableForLegalReasonsError,
|
|
2233
|
+
UnprocessableEntityError,
|
|
2234
|
+
UnsupportedMediaTypeError,
|
|
2235
|
+
UpgradeRequiredError,
|
|
2236
|
+
UriTooLongError,
|
|
2237
|
+
VariantAlsoNegotiatesError,
|
|
1771
2238
|
buildPatch,
|
|
2239
|
+
constructTypeormPagination,
|
|
1772
2240
|
createDeferred,
|
|
1773
2241
|
eslint_config_default as freshEslintConfig,
|
|
2242
|
+
getPaginationMeta,
|
|
2243
|
+
getPaginationParams,
|
|
1774
2244
|
hasOwn,
|
|
2245
|
+
isDecimal,
|
|
1775
2246
|
isEnumValue,
|
|
1776
2247
|
isFlag01,
|
|
1777
2248
|
isMaybe,
|
|
@@ -1780,6 +2251,10 @@ export {
|
|
|
1780
2251
|
isObject,
|
|
1781
2252
|
isString,
|
|
1782
2253
|
isValidCron,
|
|
1783
|
-
|
|
2254
|
+
listAll,
|
|
2255
|
+
parsePaginationFromURL,
|
|
2256
|
+
resolvePathParameterId,
|
|
2257
|
+
runWithConcurrency,
|
|
2258
|
+
toDecimal
|
|
1784
2259
|
};
|
|
1785
2260
|
//# sourceMappingURL=index.mjs.map
|