@freshpointcz/fresh-core 0.0.19 → 0.0.21
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 +431 -164
- package/dist/index.d.ts +431 -164
- package/dist/index.js +936 -490
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +866 -465
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -428,32 +428,76 @@ __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,
|
|
498
|
+
buildDateRange: () => buildDateRange,
|
|
499
|
+
buildOrder: () => buildOrder,
|
|
500
|
+
buildPagination: () => buildPagination,
|
|
457
501
|
buildPatch: () => buildPatch,
|
|
458
502
|
constructTypeormPagination: () => constructTypeormPagination,
|
|
459
503
|
createDeferred: () => createDeferred,
|
|
@@ -472,11 +516,44 @@ __export(index_exports, {
|
|
|
472
516
|
isValidCron: () => isValidCron,
|
|
473
517
|
listAll: () => listAll,
|
|
474
518
|
parsePaginationFromURL: () => parsePaginationFromURL,
|
|
519
|
+
resolvePathParameterId: () => resolvePathParameterId,
|
|
475
520
|
runWithConcurrency: () => runWithConcurrency,
|
|
476
521
|
toDecimal: () => toDecimal
|
|
477
522
|
});
|
|
478
523
|
module.exports = __toCommonJS(index_exports);
|
|
479
524
|
|
|
525
|
+
// src/common/constants/amount-unit.ts
|
|
526
|
+
var AMOUNT_UNIT = {
|
|
527
|
+
1: {
|
|
528
|
+
symbol: "g",
|
|
529
|
+
translations: {
|
|
530
|
+
en: "gram",
|
|
531
|
+
cs: "gram"
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
2: {
|
|
535
|
+
symbol: "kg",
|
|
536
|
+
translations: {
|
|
537
|
+
en: "kilogram",
|
|
538
|
+
cs: "kilogram"
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
3: {
|
|
542
|
+
symbol: "ml",
|
|
543
|
+
translations: {
|
|
544
|
+
en: "milliliter",
|
|
545
|
+
cs: "mililitr"
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
4: {
|
|
549
|
+
symbol: "l",
|
|
550
|
+
translations: {
|
|
551
|
+
en: "liter",
|
|
552
|
+
cs: "litr"
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
|
|
480
557
|
// src/common/date-utils.ts
|
|
481
558
|
var import_dayjs = __toESM(require("dayjs"));
|
|
482
559
|
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
@@ -657,62 +734,61 @@ __publicField(_DateUtils, "HOLIDAYS", _DateUtils.HOLIDAYS_STR.map((h) => {
|
|
|
657
734
|
}));
|
|
658
735
|
var DateUtils = _DateUtils;
|
|
659
736
|
|
|
660
|
-
// src/common/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
__publicField(this, "_promise", null);
|
|
680
|
-
}
|
|
681
|
-
static getInstance() {
|
|
682
|
-
if (!_SinglePromiseWaiter._instance) {
|
|
683
|
-
_SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
|
|
684
|
-
}
|
|
685
|
-
return _SinglePromiseWaiter._instance;
|
|
737
|
+
// src/common/dto/status-dto.ts
|
|
738
|
+
var _StatusDto = class _StatusDto {
|
|
739
|
+
constructor(status, details, timestamp) {
|
|
740
|
+
/**
|
|
741
|
+
* Call result status
|
|
742
|
+
*/
|
|
743
|
+
__publicField(this, "status");
|
|
744
|
+
/**
|
|
745
|
+
* UTC Timestamp
|
|
746
|
+
* @example "2021-12-01T13:23:39.305Z"
|
|
747
|
+
*/
|
|
748
|
+
__publicField(this, "timestamp");
|
|
749
|
+
/**
|
|
750
|
+
* Details (optional)
|
|
751
|
+
*/
|
|
752
|
+
__publicField(this, "details");
|
|
753
|
+
this.status = status;
|
|
754
|
+
this.details = details;
|
|
755
|
+
this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
|
|
686
756
|
}
|
|
687
|
-
|
|
688
|
-
|
|
757
|
+
};
|
|
758
|
+
__name(_StatusDto, "StatusDto");
|
|
759
|
+
var StatusDto = _StatusDto;
|
|
760
|
+
|
|
761
|
+
// src/common/pagination/find-options/date-range.ts
|
|
762
|
+
var import_typeorm = require("typeorm");
|
|
763
|
+
function buildDateRange(from, to) {
|
|
764
|
+
const f = from ? new Date(from) : void 0;
|
|
765
|
+
const t = to ? new Date(to) : void 0;
|
|
766
|
+
if (f && t) {
|
|
767
|
+
return (0, import_typeorm.Between)(f, t);
|
|
689
768
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
this._promise = promise;
|
|
693
|
-
this._promise.finally(() => {
|
|
694
|
-
this._promise = null;
|
|
695
|
-
});
|
|
696
|
-
}
|
|
769
|
+
if (f) {
|
|
770
|
+
return (0, import_typeorm.MoreThanOrEqual)(f);
|
|
697
771
|
}
|
|
698
|
-
|
|
699
|
-
return
|
|
772
|
+
if (t) {
|
|
773
|
+
return (0, import_typeorm.LessThanOrEqual)(t);
|
|
700
774
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
775
|
+
return void 0;
|
|
776
|
+
}
|
|
777
|
+
__name(buildDateRange, "buildDateRange");
|
|
705
778
|
|
|
706
|
-
// src/common/
|
|
707
|
-
function
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
return false;
|
|
779
|
+
// src/common/pagination/find-options/order.ts
|
|
780
|
+
function buildOrder(sortBy, sortOrder) {
|
|
781
|
+
if (!sortBy) {
|
|
782
|
+
return void 0;
|
|
711
783
|
}
|
|
712
|
-
|
|
713
|
-
|
|
784
|
+
return {
|
|
785
|
+
[sortBy]: sortOrder != null ? sortOrder : "ASC"
|
|
786
|
+
};
|
|
714
787
|
}
|
|
715
|
-
__name(
|
|
788
|
+
__name(buildOrder, "buildOrder");
|
|
789
|
+
|
|
790
|
+
// src/core/class/fresh-job.ts
|
|
791
|
+
var import_node_schedule = require("node-schedule");
|
|
716
792
|
|
|
717
793
|
// src/common/patterns/singleton.ts
|
|
718
794
|
var _Singleton = class _Singleton {
|
|
@@ -765,45 +841,649 @@ __name(_Singleton, "Singleton");
|
|
|
765
841
|
__publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
|
|
766
842
|
var Singleton = _Singleton;
|
|
767
843
|
|
|
768
|
-
// src/
|
|
769
|
-
var
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
844
|
+
// src/core/class/fresh-job.ts
|
|
845
|
+
var _FreshJob = class _FreshJob extends Singleton {
|
|
846
|
+
/**
|
|
847
|
+
* Creates and optionally schedules a singleton cron job.
|
|
848
|
+
*
|
|
849
|
+
* @param jobName - Logical name of the job (used in logs and errors).
|
|
850
|
+
* @param cronExpression - Cron expression consisting of numeric fields only.
|
|
851
|
+
* Example: `0 5 * * 4`
|
|
852
|
+
* The timezone `"Europe/Prague"` is applied automatically.
|
|
853
|
+
*
|
|
854
|
+
* @param jobEnabled - Whether the job should be scheduled immediately.
|
|
855
|
+
* If `false`, the instance exists but no cron trigger is registered.
|
|
856
|
+
*
|
|
857
|
+
* @throws Error If the cron expression is invalid.
|
|
858
|
+
* @throws Error If the job cannot be scheduled.
|
|
859
|
+
*/
|
|
860
|
+
constructor(jobName, cronExpression, jobEnabled) {
|
|
861
|
+
super(false);
|
|
862
|
+
/** Human-readable job identifier (used for logs and errors). */
|
|
863
|
+
__publicField(this, "_jobName");
|
|
780
864
|
/**
|
|
781
|
-
*
|
|
865
|
+
* Cron expression defining when the job runs.
|
|
866
|
+
*
|
|
867
|
+
* Must contain numeric cron fields only.
|
|
868
|
+
* Example: `0 5 * * 4`
|
|
869
|
+
*
|
|
870
|
+
* Timezone is always forced to `"Europe/Prague"`.
|
|
871
|
+
* If you need another timezone, this class is not your friend.
|
|
782
872
|
*/
|
|
783
|
-
__publicField(this, "
|
|
784
|
-
|
|
785
|
-
this
|
|
786
|
-
this.
|
|
873
|
+
__publicField(this, "_cronExpression");
|
|
874
|
+
/** Scheduled job instance, or `null` if the job is disabled. */
|
|
875
|
+
__publicField(this, "_job", null);
|
|
876
|
+
this._jobName = jobName;
|
|
877
|
+
if (!isValidCron(cronExpression)) {
|
|
878
|
+
throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
|
|
879
|
+
}
|
|
880
|
+
this._cronExpression = cronExpression;
|
|
881
|
+
if (jobEnabled) {
|
|
882
|
+
this._job = (0, import_node_schedule.scheduleJob)({
|
|
883
|
+
rule: this._cronExpression,
|
|
884
|
+
tz: "Europe/Prague"
|
|
885
|
+
}, async () => {
|
|
886
|
+
await this.invoke();
|
|
887
|
+
});
|
|
888
|
+
if (!this._job) {
|
|
889
|
+
throw new Error(`Job ${this._jobName} could not be scheduled`);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
this.onInit();
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Initialization hook.
|
|
896
|
+
*
|
|
897
|
+
* Called once during construction and used primarily for logging.
|
|
898
|
+
* Can also be reused by subclasses if manual rescheduling is implemented.
|
|
899
|
+
*
|
|
900
|
+
* @param rescheduled - Indicates whether the job was reconfigured
|
|
901
|
+
* after initial creation.
|
|
902
|
+
*/
|
|
903
|
+
onInit(rescheduled) {
|
|
904
|
+
console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
|
|
905
|
+
}
|
|
906
|
+
/** @returns The logical name of the job. */
|
|
907
|
+
get jobName() {
|
|
908
|
+
return this._jobName;
|
|
909
|
+
}
|
|
910
|
+
/** Allows subclasses to rename the job if absolutely necessary. */
|
|
911
|
+
set jobName(value) {
|
|
912
|
+
this._jobName = value;
|
|
913
|
+
}
|
|
914
|
+
/** @returns The cron expression used to schedule the job. */
|
|
915
|
+
get cronExpression() {
|
|
916
|
+
return this._cronExpression;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Allows subclasses to update the cron expression internally.
|
|
920
|
+
* Does reschedule of job if exists
|
|
921
|
+
*/
|
|
922
|
+
set cronExpression(value) {
|
|
923
|
+
if (!isValidCron(value)) {
|
|
924
|
+
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${value}"`);
|
|
925
|
+
}
|
|
926
|
+
this._cronExpression = value;
|
|
927
|
+
}
|
|
928
|
+
/** @returns The underlying scheduled job instance, or `null` if disabled. */
|
|
929
|
+
get job() {
|
|
930
|
+
return this._job;
|
|
931
|
+
}
|
|
932
|
+
/** Allows subclasses to manage the scheduled job instance. */
|
|
933
|
+
set job(value) {
|
|
934
|
+
this._job = value;
|
|
935
|
+
}
|
|
936
|
+
reschedule(newCronExpression) {
|
|
937
|
+
let result = false;
|
|
938
|
+
if (!isValidCron(newCronExpression)) {
|
|
939
|
+
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${newCronExpression}"`);
|
|
940
|
+
}
|
|
941
|
+
this._cronExpression = newCronExpression;
|
|
942
|
+
if (this._job) {
|
|
943
|
+
const rescheduleSuccess = this._job.reschedule({
|
|
944
|
+
rule: this._cronExpression,
|
|
945
|
+
tz: "Europe/Prague"
|
|
946
|
+
});
|
|
947
|
+
if (!rescheduleSuccess) {
|
|
948
|
+
throw new Error(`Job ${this._jobName} could not be re-scheduled`);
|
|
949
|
+
} else {
|
|
950
|
+
this.onInit(true);
|
|
951
|
+
}
|
|
952
|
+
result = rescheduleSuccess;
|
|
953
|
+
}
|
|
954
|
+
return result;
|
|
787
955
|
}
|
|
788
956
|
};
|
|
789
|
-
__name(
|
|
790
|
-
var
|
|
957
|
+
__name(_FreshJob, "FreshJob");
|
|
958
|
+
var FreshJob = _FreshJob;
|
|
791
959
|
|
|
792
|
-
// src/
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
960
|
+
// src/core/errors/api-error.ts
|
|
961
|
+
var _ApiError = class _ApiError extends Error {
|
|
962
|
+
constructor(statusCode, status, detail) {
|
|
963
|
+
super();
|
|
964
|
+
__publicField(this, "_statusCode");
|
|
965
|
+
__publicField(this, "_statusDto");
|
|
966
|
+
this._statusCode = statusCode;
|
|
967
|
+
this._statusDto = new StatusDto(status, detail);
|
|
968
|
+
}
|
|
969
|
+
get statusCode() {
|
|
970
|
+
return this._statusCode;
|
|
971
|
+
}
|
|
972
|
+
get statusDto() {
|
|
973
|
+
return this._statusDto;
|
|
974
|
+
}
|
|
975
|
+
};
|
|
976
|
+
__name(_ApiError, "ApiError");
|
|
977
|
+
var ApiError = _ApiError;
|
|
978
|
+
|
|
979
|
+
// src/core/errors/business-warning.ts
|
|
980
|
+
var _BusinessWarning = class _BusinessWarning extends Error {
|
|
981
|
+
constructor(code, message) {
|
|
982
|
+
super(message);
|
|
983
|
+
__publicField(this, "code");
|
|
984
|
+
this.code = code;
|
|
985
|
+
this.name = "BusinessWarning";
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
__name(_BusinessWarning, "BusinessWarning");
|
|
989
|
+
var BusinessWarning = _BusinessWarning;
|
|
990
|
+
|
|
991
|
+
// src/core/errors/fresh-error.ts
|
|
992
|
+
var _FreshError = class _FreshError extends Error {
|
|
993
|
+
constructor(statusCode, status, detail, options) {
|
|
994
|
+
super(detail != null ? detail : status);
|
|
995
|
+
/** HTTP status code sent in the response. */
|
|
996
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
997
|
+
__publicField(this, "statusCode");
|
|
998
|
+
/** Structured response body describing the error. */
|
|
999
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1000
|
+
__publicField(this, "statusDto");
|
|
1001
|
+
this.name = this.constructor.name;
|
|
1002
|
+
if ((options == null ? void 0 : options.cause) !== void 0) {
|
|
1003
|
+
this.cause = options.cause;
|
|
1004
|
+
}
|
|
1005
|
+
this.statusCode = statusCode;
|
|
1006
|
+
this.statusDto = new StatusDto(status, detail);
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
__name(_FreshError, "FreshError");
|
|
1010
|
+
var FreshError = _FreshError;
|
|
1011
|
+
|
|
1012
|
+
// src/enums/action-command-code.ts
|
|
1013
|
+
var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
|
|
1014
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
|
|
1015
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
|
|
1016
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
|
|
1017
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_REMOTE_CONTROL"] = 4] = "RESTART_REMOTE_CONTROL";
|
|
1018
|
+
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE"] = 5] = "SYNCHRONIZE";
|
|
1019
|
+
ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
|
|
1020
|
+
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
|
|
1021
|
+
return ActionCommandCode2;
|
|
1022
|
+
})({});
|
|
1023
|
+
|
|
1024
|
+
// src/enums/depot-pool-status.ts
|
|
1025
|
+
var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
|
|
1026
|
+
DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
|
|
1027
|
+
DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
|
|
1028
|
+
DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
|
|
1029
|
+
DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
|
|
1030
|
+
DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
|
|
1031
|
+
return DepotPoolStatus2;
|
|
1032
|
+
})({});
|
|
1033
|
+
|
|
1034
|
+
// src/enums/http-status.ts
|
|
1035
|
+
var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
|
|
1036
|
+
HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
|
|
1037
|
+
HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
1038
|
+
HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
|
|
1039
|
+
HttpStatus2[HttpStatus2["EARLY_HINTS"] = 103] = "EARLY_HINTS";
|
|
1040
|
+
HttpStatus2[HttpStatus2["OK"] = 200] = "OK";
|
|
1041
|
+
HttpStatus2[HttpStatus2["CREATED"] = 201] = "CREATED";
|
|
1042
|
+
HttpStatus2[HttpStatus2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
1043
|
+
HttpStatus2[HttpStatus2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
1044
|
+
HttpStatus2[HttpStatus2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
1045
|
+
HttpStatus2[HttpStatus2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
1046
|
+
HttpStatus2[HttpStatus2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
1047
|
+
HttpStatus2[HttpStatus2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
1048
|
+
HttpStatus2[HttpStatus2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
1049
|
+
HttpStatus2[HttpStatus2["IM_USED"] = 226] = "IM_USED";
|
|
1050
|
+
HttpStatus2[HttpStatus2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
1051
|
+
HttpStatus2[HttpStatus2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
1052
|
+
HttpStatus2[HttpStatus2["FOUND"] = 302] = "FOUND";
|
|
1053
|
+
HttpStatus2[HttpStatus2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
1054
|
+
HttpStatus2[HttpStatus2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
1055
|
+
HttpStatus2[HttpStatus2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
1056
|
+
HttpStatus2[HttpStatus2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
1057
|
+
HttpStatus2[HttpStatus2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
1058
|
+
HttpStatus2[HttpStatus2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
1059
|
+
HttpStatus2[HttpStatus2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
1060
|
+
HttpStatus2[HttpStatus2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
1061
|
+
HttpStatus2[HttpStatus2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
1062
|
+
HttpStatus2[HttpStatus2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
1063
|
+
HttpStatus2[HttpStatus2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
1064
|
+
HttpStatus2[HttpStatus2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
1065
|
+
HttpStatus2[HttpStatus2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
1066
|
+
HttpStatus2[HttpStatus2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
1067
|
+
HttpStatus2[HttpStatus2["CONFLICT"] = 409] = "CONFLICT";
|
|
1068
|
+
HttpStatus2[HttpStatus2["GONE"] = 410] = "GONE";
|
|
1069
|
+
HttpStatus2[HttpStatus2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
1070
|
+
HttpStatus2[HttpStatus2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
1071
|
+
HttpStatus2[HttpStatus2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
1072
|
+
HttpStatus2[HttpStatus2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
1073
|
+
HttpStatus2[HttpStatus2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
1074
|
+
HttpStatus2[HttpStatus2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
|
|
1075
|
+
HttpStatus2[HttpStatus2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
1076
|
+
HttpStatus2[HttpStatus2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
|
|
1077
|
+
HttpStatus2[HttpStatus2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
1078
|
+
HttpStatus2[HttpStatus2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
1079
|
+
HttpStatus2[HttpStatus2["LOCKED"] = 423] = "LOCKED";
|
|
1080
|
+
HttpStatus2[HttpStatus2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
1081
|
+
HttpStatus2[HttpStatus2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
1082
|
+
HttpStatus2[HttpStatus2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
1083
|
+
HttpStatus2[HttpStatus2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
1084
|
+
HttpStatus2[HttpStatus2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
1085
|
+
HttpStatus2[HttpStatus2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
1086
|
+
HttpStatus2[HttpStatus2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
1087
|
+
HttpStatus2[HttpStatus2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
1088
|
+
HttpStatus2[HttpStatus2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
1089
|
+
HttpStatus2[HttpStatus2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
1090
|
+
HttpStatus2[HttpStatus2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
1091
|
+
HttpStatus2[HttpStatus2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
1092
|
+
HttpStatus2[HttpStatus2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
1093
|
+
HttpStatus2[HttpStatus2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
1094
|
+
HttpStatus2[HttpStatus2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
1095
|
+
HttpStatus2[HttpStatus2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
1096
|
+
HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
1097
|
+
HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
1098
|
+
return HttpStatus2;
|
|
1099
|
+
})({});
|
|
1100
|
+
|
|
1101
|
+
// src/enums/language-code.ts
|
|
1102
|
+
var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
|
|
1103
|
+
LanguageCode2["CS"] = "cs";
|
|
1104
|
+
LanguageCode2["EN"] = "en";
|
|
1105
|
+
LanguageCode2["DE"] = "de";
|
|
1106
|
+
LanguageCode2["PL"] = "pl";
|
|
1107
|
+
LanguageCode2["SK"] = "sk";
|
|
1108
|
+
return LanguageCode2;
|
|
1109
|
+
})({});
|
|
1110
|
+
|
|
1111
|
+
// src/enums/payment-method.ts
|
|
1112
|
+
var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
|
|
1113
|
+
PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
|
|
1114
|
+
PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
|
|
1115
|
+
PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
|
|
1116
|
+
PaymentMethod2[PaymentMethod2["CREDIT"] = 3] = "CREDIT";
|
|
1117
|
+
return PaymentMethod2;
|
|
1118
|
+
})({});
|
|
1119
|
+
|
|
1120
|
+
// src/enums/transaction-type.ts
|
|
1121
|
+
var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
|
|
1122
|
+
TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
|
|
1123
|
+
TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
|
|
1124
|
+
TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
|
|
1125
|
+
TransactionType2[TransactionType2["ADD"] = 3] = "ADD";
|
|
1126
|
+
TransactionType2[TransactionType2["DELIVERY"] = 4] = "DELIVERY";
|
|
1127
|
+
TransactionType2[TransactionType2["DEPOT_WRITEOFF"] = 5] = "DEPOT_WRITEOFF";
|
|
1128
|
+
TransactionType2[TransactionType2["DEPOT_ADD"] = 6] = "DEPOT_ADD";
|
|
1129
|
+
TransactionType2[TransactionType2["RETURN"] = 7] = "RETURN";
|
|
1130
|
+
TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
|
|
1131
|
+
TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
|
|
1132
|
+
return TransactionType2;
|
|
1133
|
+
})({});
|
|
1134
|
+
|
|
1135
|
+
// src/core/errors/errors.ts
|
|
1136
|
+
var _BadRequestError = class _BadRequestError extends FreshError {
|
|
1137
|
+
constructor(detail, options) {
|
|
1138
|
+
super(HttpStatus.BAD_REQUEST, "validation-error", detail, options);
|
|
1139
|
+
}
|
|
1140
|
+
};
|
|
1141
|
+
__name(_BadRequestError, "BadRequestError");
|
|
1142
|
+
var BadRequestError = _BadRequestError;
|
|
1143
|
+
var _UnauthorizedError = class _UnauthorizedError extends FreshError {
|
|
1144
|
+
constructor(detail, options) {
|
|
1145
|
+
super(HttpStatus.UNAUTHORIZED, "not-authenticated", detail, options);
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
__name(_UnauthorizedError, "UnauthorizedError");
|
|
1149
|
+
var UnauthorizedError = _UnauthorizedError;
|
|
1150
|
+
var _PaymentRequiredError = class _PaymentRequiredError extends FreshError {
|
|
1151
|
+
constructor(detail, options) {
|
|
1152
|
+
super(HttpStatus.PAYMENT_REQUIRED, "error", detail, options);
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
__name(_PaymentRequiredError, "PaymentRequiredError");
|
|
1156
|
+
var PaymentRequiredError = _PaymentRequiredError;
|
|
1157
|
+
var _ForbiddenError = class _ForbiddenError extends FreshError {
|
|
1158
|
+
constructor(detail, options) {
|
|
1159
|
+
super(HttpStatus.FORBIDDEN, "not-authorized", detail, options);
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
__name(_ForbiddenError, "ForbiddenError");
|
|
1163
|
+
var ForbiddenError = _ForbiddenError;
|
|
1164
|
+
var _NotFoundError = class _NotFoundError extends FreshError {
|
|
1165
|
+
constructor(detail, options) {
|
|
1166
|
+
super(HttpStatus.NOT_FOUND, "error", detail, options);
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
__name(_NotFoundError, "NotFoundError");
|
|
1170
|
+
var NotFoundError = _NotFoundError;
|
|
1171
|
+
var _MethodNotAllowedError = class _MethodNotAllowedError extends FreshError {
|
|
1172
|
+
constructor(detail, options) {
|
|
1173
|
+
super(HttpStatus.METHOD_NOT_ALLOWED, "error", detail, options);
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
__name(_MethodNotAllowedError, "MethodNotAllowedError");
|
|
1177
|
+
var MethodNotAllowedError = _MethodNotAllowedError;
|
|
1178
|
+
var _NotAcceptableError = class _NotAcceptableError extends FreshError {
|
|
1179
|
+
constructor(detail, options) {
|
|
1180
|
+
super(HttpStatus.NOT_ACCEPTABLE, "error", detail, options);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
__name(_NotAcceptableError, "NotAcceptableError");
|
|
1184
|
+
var NotAcceptableError = _NotAcceptableError;
|
|
1185
|
+
var _ProxyAuthenticationRequiredError = class _ProxyAuthenticationRequiredError extends FreshError {
|
|
1186
|
+
constructor(detail, options) {
|
|
1187
|
+
super(HttpStatus.PROXY_AUTHENTICATION_REQUIRED, "not-authenticated", detail, options);
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
__name(_ProxyAuthenticationRequiredError, "ProxyAuthenticationRequiredError");
|
|
1191
|
+
var ProxyAuthenticationRequiredError = _ProxyAuthenticationRequiredError;
|
|
1192
|
+
var _RequestTimeoutError = class _RequestTimeoutError extends FreshError {
|
|
1193
|
+
constructor(detail, options) {
|
|
1194
|
+
super(HttpStatus.REQUEST_TIMEOUT, "error", detail, options);
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
__name(_RequestTimeoutError, "RequestTimeoutError");
|
|
1198
|
+
var RequestTimeoutError = _RequestTimeoutError;
|
|
1199
|
+
var _ConflictError = class _ConflictError extends FreshError {
|
|
1200
|
+
constructor(detail, options) {
|
|
1201
|
+
super(HttpStatus.CONFLICT, "error", detail, options);
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
__name(_ConflictError, "ConflictError");
|
|
1205
|
+
var ConflictError = _ConflictError;
|
|
1206
|
+
var _GoneError = class _GoneError extends FreshError {
|
|
1207
|
+
constructor(detail, options) {
|
|
1208
|
+
super(HttpStatus.GONE, "error", detail, options);
|
|
1209
|
+
}
|
|
1210
|
+
};
|
|
1211
|
+
__name(_GoneError, "GoneError");
|
|
1212
|
+
var GoneError = _GoneError;
|
|
1213
|
+
var _LengthRequiredError = class _LengthRequiredError extends FreshError {
|
|
1214
|
+
constructor(detail, options) {
|
|
1215
|
+
super(HttpStatus.LENGTH_REQUIRED, "error", detail, options);
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
__name(_LengthRequiredError, "LengthRequiredError");
|
|
1219
|
+
var LengthRequiredError = _LengthRequiredError;
|
|
1220
|
+
var _PreconditionFailedError = class _PreconditionFailedError extends FreshError {
|
|
1221
|
+
constructor(detail, options) {
|
|
1222
|
+
super(HttpStatus.PRECONDITION_FAILED, "error", detail, options);
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
__name(_PreconditionFailedError, "PreconditionFailedError");
|
|
1226
|
+
var PreconditionFailedError = _PreconditionFailedError;
|
|
1227
|
+
var _PayloadTooLargeError = class _PayloadTooLargeError extends FreshError {
|
|
1228
|
+
constructor(detail, options) {
|
|
1229
|
+
super(HttpStatus.PAYLOAD_TOO_LARGE, "error", detail, options);
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
__name(_PayloadTooLargeError, "PayloadTooLargeError");
|
|
1233
|
+
var PayloadTooLargeError = _PayloadTooLargeError;
|
|
1234
|
+
var _UriTooLongError = class _UriTooLongError extends FreshError {
|
|
1235
|
+
constructor(detail, options) {
|
|
1236
|
+
super(HttpStatus.URI_TOO_LONG, "error", detail, options);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
__name(_UriTooLongError, "UriTooLongError");
|
|
1240
|
+
var UriTooLongError = _UriTooLongError;
|
|
1241
|
+
var _UnsupportedMediaTypeError = class _UnsupportedMediaTypeError extends FreshError {
|
|
1242
|
+
constructor(detail, options) {
|
|
1243
|
+
super(HttpStatus.UNSUPPORTED_MEDIA_TYPE, "error", detail, options);
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
__name(_UnsupportedMediaTypeError, "UnsupportedMediaTypeError");
|
|
1247
|
+
var UnsupportedMediaTypeError = _UnsupportedMediaTypeError;
|
|
1248
|
+
var _RangeNotSatisfiableError = class _RangeNotSatisfiableError extends FreshError {
|
|
1249
|
+
constructor(detail, options) {
|
|
1250
|
+
super(HttpStatus.RANGE_NOT_SATISFIABLE, "error", detail, options);
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
__name(_RangeNotSatisfiableError, "RangeNotSatisfiableError");
|
|
1254
|
+
var RangeNotSatisfiableError = _RangeNotSatisfiableError;
|
|
1255
|
+
var _ExpectationFailedError = class _ExpectationFailedError extends FreshError {
|
|
1256
|
+
constructor(detail, options) {
|
|
1257
|
+
super(HttpStatus.EXPECTATION_FAILED, "error", detail, options);
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
__name(_ExpectationFailedError, "ExpectationFailedError");
|
|
1261
|
+
var ExpectationFailedError = _ExpectationFailedError;
|
|
1262
|
+
var _ImATeapotError = class _ImATeapotError extends FreshError {
|
|
1263
|
+
constructor(detail, options) {
|
|
1264
|
+
super(HttpStatus.IM_A_TEAPOT, "error", detail, options);
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
__name(_ImATeapotError, "ImATeapotError");
|
|
1268
|
+
var ImATeapotError = _ImATeapotError;
|
|
1269
|
+
var _MisdirectedRequestError = class _MisdirectedRequestError extends FreshError {
|
|
1270
|
+
constructor(detail, options) {
|
|
1271
|
+
super(HttpStatus.MISDIRECTED_REQUEST, "error", detail, options);
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
__name(_MisdirectedRequestError, "MisdirectedRequestError");
|
|
1275
|
+
var MisdirectedRequestError = _MisdirectedRequestError;
|
|
1276
|
+
var _UnprocessableEntityError = class _UnprocessableEntityError extends FreshError {
|
|
1277
|
+
constructor(detail, options) {
|
|
1278
|
+
super(HttpStatus.UNPROCESSABLE_ENTITY, "validation-error", detail, options);
|
|
1279
|
+
}
|
|
1280
|
+
};
|
|
1281
|
+
__name(_UnprocessableEntityError, "UnprocessableEntityError");
|
|
1282
|
+
var UnprocessableEntityError = _UnprocessableEntityError;
|
|
1283
|
+
var _LockedError = class _LockedError extends FreshError {
|
|
1284
|
+
constructor(detail, options) {
|
|
1285
|
+
super(HttpStatus.LOCKED, "error", detail, options);
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
__name(_LockedError, "LockedError");
|
|
1289
|
+
var LockedError = _LockedError;
|
|
1290
|
+
var _FailedDependencyError = class _FailedDependencyError extends FreshError {
|
|
1291
|
+
constructor(detail, options) {
|
|
1292
|
+
super(HttpStatus.FAILED_DEPENDENCY, "error", detail, options);
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
__name(_FailedDependencyError, "FailedDependencyError");
|
|
1296
|
+
var FailedDependencyError = _FailedDependencyError;
|
|
1297
|
+
var _TooEarlyError = class _TooEarlyError extends FreshError {
|
|
1298
|
+
constructor(detail, options) {
|
|
1299
|
+
super(HttpStatus.TOO_EARLY, "error", detail, options);
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
__name(_TooEarlyError, "TooEarlyError");
|
|
1303
|
+
var TooEarlyError = _TooEarlyError;
|
|
1304
|
+
var _UpgradeRequiredError = class _UpgradeRequiredError extends FreshError {
|
|
1305
|
+
constructor(detail, options) {
|
|
1306
|
+
super(HttpStatus.UPGRADE_REQUIRED, "error", detail, options);
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
__name(_UpgradeRequiredError, "UpgradeRequiredError");
|
|
1310
|
+
var UpgradeRequiredError = _UpgradeRequiredError;
|
|
1311
|
+
var _PreconditionRequiredError = class _PreconditionRequiredError extends FreshError {
|
|
1312
|
+
constructor(detail, options) {
|
|
1313
|
+
super(HttpStatus.PRECONDITION_REQUIRED, "error", detail, options);
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1316
|
+
__name(_PreconditionRequiredError, "PreconditionRequiredError");
|
|
1317
|
+
var PreconditionRequiredError = _PreconditionRequiredError;
|
|
1318
|
+
var _TooManyRequestsError = class _TooManyRequestsError extends FreshError {
|
|
1319
|
+
constructor(detail, options) {
|
|
1320
|
+
super(HttpStatus.TOO_MANY_REQUESTS, "error", detail, options);
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
__name(_TooManyRequestsError, "TooManyRequestsError");
|
|
1324
|
+
var TooManyRequestsError = _TooManyRequestsError;
|
|
1325
|
+
var _RequestHeaderFieldsTooLargeError = class _RequestHeaderFieldsTooLargeError extends FreshError {
|
|
1326
|
+
constructor(detail, options) {
|
|
1327
|
+
super(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE, "error", detail, options);
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
__name(_RequestHeaderFieldsTooLargeError, "RequestHeaderFieldsTooLargeError");
|
|
1331
|
+
var RequestHeaderFieldsTooLargeError = _RequestHeaderFieldsTooLargeError;
|
|
1332
|
+
var _UnavailableForLegalReasonsError = class _UnavailableForLegalReasonsError extends FreshError {
|
|
1333
|
+
constructor(detail, options) {
|
|
1334
|
+
super(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS, "error", detail, options);
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
__name(_UnavailableForLegalReasonsError, "UnavailableForLegalReasonsError");
|
|
1338
|
+
var UnavailableForLegalReasonsError = _UnavailableForLegalReasonsError;
|
|
1339
|
+
var _InternalServerError = class _InternalServerError extends FreshError {
|
|
1340
|
+
constructor(detail, options) {
|
|
1341
|
+
super(HttpStatus.INTERNAL_SERVER_ERROR, "internal-server-error", detail, options);
|
|
1342
|
+
}
|
|
1343
|
+
};
|
|
1344
|
+
__name(_InternalServerError, "InternalServerError");
|
|
1345
|
+
var InternalServerError = _InternalServerError;
|
|
1346
|
+
var _NotImplementedError = class _NotImplementedError extends FreshError {
|
|
1347
|
+
constructor(detail, options) {
|
|
1348
|
+
super(HttpStatus.NOT_IMPLEMENTED, "internal-server-error", detail, options);
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
__name(_NotImplementedError, "NotImplementedError");
|
|
1352
|
+
var NotImplementedError = _NotImplementedError;
|
|
1353
|
+
var _BadGatewayError = class _BadGatewayError extends FreshError {
|
|
1354
|
+
constructor(detail, options) {
|
|
1355
|
+
super(HttpStatus.BAD_GATEWAY, "internal-server-error", detail, options);
|
|
1356
|
+
}
|
|
1357
|
+
};
|
|
1358
|
+
__name(_BadGatewayError, "BadGatewayError");
|
|
1359
|
+
var BadGatewayError = _BadGatewayError;
|
|
1360
|
+
var _ServiceUnavailableError = class _ServiceUnavailableError extends FreshError {
|
|
1361
|
+
constructor(detail, options) {
|
|
1362
|
+
super(HttpStatus.SERVICE_UNAVAILABLE, "internal-server-error", detail, options);
|
|
1363
|
+
}
|
|
1364
|
+
};
|
|
1365
|
+
__name(_ServiceUnavailableError, "ServiceUnavailableError");
|
|
1366
|
+
var ServiceUnavailableError = _ServiceUnavailableError;
|
|
1367
|
+
var _GatewayTimeoutError = class _GatewayTimeoutError extends FreshError {
|
|
1368
|
+
constructor(detail, options) {
|
|
1369
|
+
super(HttpStatus.GATEWAY_TIMEOUT, "internal-server-error", detail, options);
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
__name(_GatewayTimeoutError, "GatewayTimeoutError");
|
|
1373
|
+
var GatewayTimeoutError = _GatewayTimeoutError;
|
|
1374
|
+
var _HttpVersionNotSupportedError = class _HttpVersionNotSupportedError extends FreshError {
|
|
1375
|
+
constructor(detail, options) {
|
|
1376
|
+
super(HttpStatus.HTTP_VERSION_NOT_SUPPORTED, "internal-server-error", detail, options);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
__name(_HttpVersionNotSupportedError, "HttpVersionNotSupportedError");
|
|
1380
|
+
var HttpVersionNotSupportedError = _HttpVersionNotSupportedError;
|
|
1381
|
+
var _VariantAlsoNegotiatesError = class _VariantAlsoNegotiatesError extends FreshError {
|
|
1382
|
+
constructor(detail, options) {
|
|
1383
|
+
super(HttpStatus.VARIANT_ALSO_NEGOTIATES, "internal-server-error", detail, options);
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
1386
|
+
__name(_VariantAlsoNegotiatesError, "VariantAlsoNegotiatesError");
|
|
1387
|
+
var VariantAlsoNegotiatesError = _VariantAlsoNegotiatesError;
|
|
1388
|
+
var _InsufficientStorageError = class _InsufficientStorageError extends FreshError {
|
|
1389
|
+
constructor(detail, options) {
|
|
1390
|
+
super(HttpStatus.INSUFFICIENT_STORAGE, "internal-server-error", detail, options);
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
__name(_InsufficientStorageError, "InsufficientStorageError");
|
|
1394
|
+
var InsufficientStorageError = _InsufficientStorageError;
|
|
1395
|
+
var _LoopDetectedError = class _LoopDetectedError extends FreshError {
|
|
1396
|
+
constructor(detail, options) {
|
|
1397
|
+
super(HttpStatus.LOOP_DETECTED, "internal-server-error", detail, options);
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
__name(_LoopDetectedError, "LoopDetectedError");
|
|
1401
|
+
var LoopDetectedError = _LoopDetectedError;
|
|
1402
|
+
var _NotExtendedError = class _NotExtendedError extends FreshError {
|
|
1403
|
+
constructor(detail, options) {
|
|
1404
|
+
super(HttpStatus.NOT_EXTENDED, "internal-server-error", detail, options);
|
|
1405
|
+
}
|
|
1406
|
+
};
|
|
1407
|
+
__name(_NotExtendedError, "NotExtendedError");
|
|
1408
|
+
var NotExtendedError = _NotExtendedError;
|
|
1409
|
+
var _NetworkAuthenticationRequiredError = class _NetworkAuthenticationRequiredError extends FreshError {
|
|
1410
|
+
constructor(detail, options) {
|
|
1411
|
+
super(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED, "internal-server-error", detail, options);
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
__name(_NetworkAuthenticationRequiredError, "NetworkAuthenticationRequiredError");
|
|
1415
|
+
var NetworkAuthenticationRequiredError = _NetworkAuthenticationRequiredError;
|
|
1416
|
+
|
|
1417
|
+
// src/core/data-helper.ts
|
|
1418
|
+
var _DataHelper = class _DataHelper {
|
|
1419
|
+
constructor(startDataRetrieve = true, deviceIds) {
|
|
1420
|
+
__publicField(this, "_data");
|
|
1421
|
+
__publicField(this, "_dataPromise", null);
|
|
1422
|
+
__publicField(this, "deviceIds");
|
|
1423
|
+
this.deviceIds = deviceIds;
|
|
1424
|
+
if (startDataRetrieve) {
|
|
1425
|
+
this._dataPromise = this.startDataRetrieval();
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
get data() {
|
|
1429
|
+
return this._data;
|
|
1430
|
+
}
|
|
1431
|
+
set data(value) {
|
|
1432
|
+
this._data = value;
|
|
1433
|
+
}
|
|
1434
|
+
get dataPromise() {
|
|
1435
|
+
return this._dataPromise;
|
|
1436
|
+
}
|
|
1437
|
+
set dataPromise(value) {
|
|
1438
|
+
this._dataPromise = value;
|
|
1439
|
+
}
|
|
1440
|
+
async getData() {
|
|
1441
|
+
if (this._dataPromise) {
|
|
1442
|
+
return await this._dataPromise;
|
|
1443
|
+
}
|
|
1444
|
+
if (this._data === void 0) {
|
|
1445
|
+
this._dataPromise = this.startDataRetrieval();
|
|
1446
|
+
return this._dataPromise;
|
|
1447
|
+
}
|
|
1448
|
+
return this._data;
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
__name(_DataHelper, "DataHelper");
|
|
1452
|
+
var DataHelper = _DataHelper;
|
|
1453
|
+
|
|
1454
|
+
// src/common/pagination/find-options/pagination.ts
|
|
1455
|
+
function buildPagination(page, limit) {
|
|
1456
|
+
if (page === void 0 && limit === void 0) {
|
|
1457
|
+
return void 0;
|
|
1458
|
+
}
|
|
1459
|
+
if (page !== void 0 && page < 1 || limit !== void 0 && limit < 0) {
|
|
1460
|
+
throw new ApiError(HttpStatus.BAD_REQUEST, "validation-error", "Pagination parameters cannot be negative");
|
|
1461
|
+
}
|
|
1462
|
+
const p = page != null ? page : 1;
|
|
1463
|
+
const l = limit != null ? limit : 1e3;
|
|
1464
|
+
return {
|
|
1465
|
+
page: p,
|
|
1466
|
+
limit: l,
|
|
1467
|
+
skip: (p - 1) * l
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
__name(buildPagination, "buildPagination");
|
|
1471
|
+
|
|
1472
|
+
// src/common/pagination/constructors.ts
|
|
1473
|
+
function constructTypeormPagination(params) {
|
|
1474
|
+
return {
|
|
1475
|
+
take: params.limit,
|
|
1476
|
+
skip: params.skip
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1479
|
+
__name(constructTypeormPagination, "constructTypeormPagination");
|
|
1480
|
+
function parsePaginationFromURL(searchParams) {
|
|
1481
|
+
var _a, _b;
|
|
1482
|
+
const page = Math.max(1, parseInt((_a = searchParams.get("page")) != null ? _a : "1", 10));
|
|
1483
|
+
const limit = Math.min(100, Math.max(1, parseInt((_b = searchParams.get("limit")) != null ? _b : "20", 10)));
|
|
1484
|
+
return {
|
|
1485
|
+
page,
|
|
1486
|
+
limit,
|
|
807
1487
|
skip: (page - 1) * limit
|
|
808
1488
|
};
|
|
809
1489
|
}
|
|
@@ -854,43 +1534,57 @@ async function listAll(fetchPage, batchSize = 1e3) {
|
|
|
854
1534
|
}
|
|
855
1535
|
__name(listAll, "listAll");
|
|
856
1536
|
|
|
857
|
-
// src/common/
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1537
|
+
// src/common/promise-magic/deferred.ts
|
|
1538
|
+
function createDeferred() {
|
|
1539
|
+
let resolve;
|
|
1540
|
+
let reject;
|
|
1541
|
+
const promise = new Promise((res, rej) => {
|
|
1542
|
+
resolve = res;
|
|
1543
|
+
reject = rej;
|
|
1544
|
+
});
|
|
1545
|
+
return {
|
|
1546
|
+
promise,
|
|
1547
|
+
resolve,
|
|
1548
|
+
reject
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
__name(createDeferred, "createDeferred");
|
|
1552
|
+
|
|
1553
|
+
// src/common/promise-magic/single-promise-waiter.ts
|
|
1554
|
+
var _SinglePromiseWaiter = class _SinglePromiseWaiter {
|
|
1555
|
+
constructor() {
|
|
1556
|
+
__publicField(this, "_promise", null);
|
|
1557
|
+
}
|
|
1558
|
+
static getInstance() {
|
|
1559
|
+
if (!_SinglePromiseWaiter._instance) {
|
|
1560
|
+
_SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
|
|
878
1561
|
}
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1562
|
+
return _SinglePromiseWaiter._instance;
|
|
1563
|
+
}
|
|
1564
|
+
get promise() {
|
|
1565
|
+
return this._promise;
|
|
1566
|
+
}
|
|
1567
|
+
set promise(promise) {
|
|
1568
|
+
if (promise !== null) {
|
|
1569
|
+
this._promise = promise;
|
|
1570
|
+
this._promise.finally(() => {
|
|
1571
|
+
this._promise = null;
|
|
1572
|
+
});
|
|
885
1573
|
}
|
|
886
1574
|
}
|
|
1575
|
+
get hasPromise() {
|
|
1576
|
+
return this._promise !== null;
|
|
1577
|
+
}
|
|
887
1578
|
};
|
|
1579
|
+
__name(_SinglePromiseWaiter, "SinglePromiseWaiter");
|
|
1580
|
+
__publicField(_SinglePromiseWaiter, "_instance");
|
|
1581
|
+
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
888
1582
|
|
|
889
1583
|
// src/common/schema/entities/category.entity.ts
|
|
890
|
-
var
|
|
1584
|
+
var import_typeorm6 = require("typeorm");
|
|
891
1585
|
|
|
892
1586
|
// src/database/entities/fresh-entity.ts
|
|
893
|
-
var
|
|
1587
|
+
var import_typeorm2 = require("typeorm");
|
|
894
1588
|
|
|
895
1589
|
// ../../node_modules/uuid/dist/esm/stringify.js
|
|
896
1590
|
var byteToHex = [];
|
|
@@ -961,7 +1655,7 @@ function _ts_metadata(k, v) {
|
|
|
961
1655
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
962
1656
|
}
|
|
963
1657
|
__name(_ts_metadata, "_ts_metadata");
|
|
964
|
-
var _FreshEntity = class _FreshEntity extends
|
|
1658
|
+
var _FreshEntity = class _FreshEntity extends import_typeorm2.BaseEntity {
|
|
965
1659
|
/** After manual construction `id` is irrelevant. Refer to `uuid` only, because that will be inserted into DB */
|
|
966
1660
|
constructor() {
|
|
967
1661
|
super();
|
|
@@ -982,33 +1676,33 @@ var _FreshEntity = class _FreshEntity extends import_typeorm.BaseEntity {
|
|
|
982
1676
|
__name(_FreshEntity, "FreshEntity");
|
|
983
1677
|
var FreshEntity = _FreshEntity;
|
|
984
1678
|
_ts_decorate([
|
|
985
|
-
(0,
|
|
1679
|
+
(0, import_typeorm2.PrimaryGeneratedColumn)("increment"),
|
|
986
1680
|
_ts_metadata("design:type", Number)
|
|
987
1681
|
], FreshEntity.prototype, "id", void 0);
|
|
988
1682
|
_ts_decorate([
|
|
989
|
-
(0,
|
|
1683
|
+
(0, import_typeorm2.Index)({
|
|
990
1684
|
unique: true
|
|
991
1685
|
}),
|
|
992
|
-
(0,
|
|
1686
|
+
(0, import_typeorm2.Column)({
|
|
993
1687
|
type: "uuid",
|
|
994
1688
|
default: /* @__PURE__ */ __name(() => "gen_random_uuid()", "default")
|
|
995
1689
|
}),
|
|
996
1690
|
_ts_metadata("design:type", String)
|
|
997
1691
|
], FreshEntity.prototype, "uuid", void 0);
|
|
998
1692
|
_ts_decorate([
|
|
999
|
-
(0,
|
|
1693
|
+
(0, import_typeorm2.CreateDateColumn)({
|
|
1000
1694
|
type: "timestamptz"
|
|
1001
1695
|
}),
|
|
1002
1696
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1003
1697
|
], FreshEntity.prototype, "created_at", void 0);
|
|
1004
1698
|
_ts_decorate([
|
|
1005
|
-
(0,
|
|
1699
|
+
(0, import_typeorm2.UpdateDateColumn)({
|
|
1006
1700
|
type: "timestamptz"
|
|
1007
1701
|
}),
|
|
1008
1702
|
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1009
1703
|
], FreshEntity.prototype, "updated_at", void 0);
|
|
1010
1704
|
_ts_decorate([
|
|
1011
|
-
(0,
|
|
1705
|
+
(0, import_typeorm2.DeleteDateColumn)({
|
|
1012
1706
|
type: "timestamptz",
|
|
1013
1707
|
nullable: true
|
|
1014
1708
|
}),
|
|
@@ -1016,185 +1710,60 @@ _ts_decorate([
|
|
|
1016
1710
|
], FreshEntity.prototype, "deleted_at", void 0);
|
|
1017
1711
|
|
|
1018
1712
|
// src/database/entities/fresh-hyper-entity.ts
|
|
1019
|
-
var
|
|
1713
|
+
var import_typeorm4 = require("typeorm");
|
|
1020
1714
|
|
|
1021
1715
|
// src/database/decorators/timestamp-column.ts
|
|
1022
|
-
var
|
|
1716
|
+
var import_typeorm3 = require("typeorm");
|
|
1023
1717
|
function TimestampColumn(options = {}) {
|
|
1024
1718
|
const defaultOptions = {
|
|
1025
|
-
type: "timestamptz",
|
|
1026
|
-
nullable: false,
|
|
1027
|
-
default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
|
|
1028
|
-
...options
|
|
1029
|
-
};
|
|
1030
|
-
return (0,
|
|
1031
|
-
}
|
|
1032
|
-
__name(TimestampColumn, "TimestampColumn");
|
|
1033
|
-
|
|
1034
|
-
// src/database/entities/fresh-hyper-entity.ts
|
|
1035
|
-
function _ts_decorate2(decorators, target, key, desc) {
|
|
1036
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1037
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1038
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1039
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1040
|
-
}
|
|
1041
|
-
__name(_ts_decorate2, "_ts_decorate");
|
|
1042
|
-
function _ts_metadata2(k, v) {
|
|
1043
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1044
|
-
}
|
|
1045
|
-
__name(_ts_metadata2, "_ts_metadata");
|
|
1046
|
-
var _FreshHyperEntity = class _FreshHyperEntity extends
|
|
1047
|
-
/** After manual construction `id` is irrelevant */
|
|
1048
|
-
constructor(timestamp) {
|
|
1049
|
-
super();
|
|
1050
|
-
// input timestamp as PK
|
|
1051
|
-
__publicField(this, "timestamp");
|
|
1052
|
-
// just info column about time of insert
|
|
1053
|
-
__publicField(this, "created_at");
|
|
1054
|
-
this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
|
|
1055
|
-
this.created_at = /* @__PURE__ */ new Date();
|
|
1056
|
-
}
|
|
1057
|
-
};
|
|
1058
|
-
__name(_FreshHyperEntity, "FreshHyperEntity");
|
|
1059
|
-
var FreshHyperEntity = _FreshHyperEntity;
|
|
1060
|
-
_ts_decorate2([
|
|
1061
|
-
(0,
|
|
1062
|
-
type: "timestamptz"
|
|
1063
|
-
}),
|
|
1064
|
-
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1065
|
-
], FreshHyperEntity.prototype, "timestamp", void 0);
|
|
1066
|
-
_ts_decorate2([
|
|
1067
|
-
TimestampColumn(),
|
|
1068
|
-
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1069
|
-
], FreshHyperEntity.prototype, "created_at", void 0);
|
|
1070
|
-
|
|
1071
|
-
// src/database/entities/fresh-translation-entity.ts
|
|
1072
|
-
var import_typeorm4 = require("typeorm");
|
|
1073
|
-
|
|
1074
|
-
// src/enums/action-command-code.ts
|
|
1075
|
-
var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
|
|
1076
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
|
|
1077
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
|
|
1078
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
|
|
1079
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_REMOTE_CONTROL"] = 4] = "RESTART_REMOTE_CONTROL";
|
|
1080
|
-
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE"] = 5] = "SYNCHRONIZE";
|
|
1081
|
-
ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
|
|
1082
|
-
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
|
|
1083
|
-
return ActionCommandCode2;
|
|
1084
|
-
})({});
|
|
1085
|
-
|
|
1086
|
-
// src/enums/depot-pool-status.ts
|
|
1087
|
-
var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
|
|
1088
|
-
DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
|
|
1089
|
-
DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
|
|
1090
|
-
DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
|
|
1091
|
-
DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
|
|
1092
|
-
DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
|
|
1093
|
-
return DepotPoolStatus2;
|
|
1094
|
-
})({});
|
|
1095
|
-
|
|
1096
|
-
// src/enums/http-status.ts
|
|
1097
|
-
var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
|
|
1098
|
-
HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
|
|
1099
|
-
HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
1100
|
-
HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
|
|
1101
|
-
HttpStatus2[HttpStatus2["EARLY_HINTS"] = 103] = "EARLY_HINTS";
|
|
1102
|
-
HttpStatus2[HttpStatus2["OK"] = 200] = "OK";
|
|
1103
|
-
HttpStatus2[HttpStatus2["CREATED"] = 201] = "CREATED";
|
|
1104
|
-
HttpStatus2[HttpStatus2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
1105
|
-
HttpStatus2[HttpStatus2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
1106
|
-
HttpStatus2[HttpStatus2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
1107
|
-
HttpStatus2[HttpStatus2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
1108
|
-
HttpStatus2[HttpStatus2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
1109
|
-
HttpStatus2[HttpStatus2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
1110
|
-
HttpStatus2[HttpStatus2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
1111
|
-
HttpStatus2[HttpStatus2["IM_USED"] = 226] = "IM_USED";
|
|
1112
|
-
HttpStatus2[HttpStatus2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
1113
|
-
HttpStatus2[HttpStatus2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
1114
|
-
HttpStatus2[HttpStatus2["FOUND"] = 302] = "FOUND";
|
|
1115
|
-
HttpStatus2[HttpStatus2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
1116
|
-
HttpStatus2[HttpStatus2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
1117
|
-
HttpStatus2[HttpStatus2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
1118
|
-
HttpStatus2[HttpStatus2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
1119
|
-
HttpStatus2[HttpStatus2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
1120
|
-
HttpStatus2[HttpStatus2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
1121
|
-
HttpStatus2[HttpStatus2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
1122
|
-
HttpStatus2[HttpStatus2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
1123
|
-
HttpStatus2[HttpStatus2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
1124
|
-
HttpStatus2[HttpStatus2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
1125
|
-
HttpStatus2[HttpStatus2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
1126
|
-
HttpStatus2[HttpStatus2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
1127
|
-
HttpStatus2[HttpStatus2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
1128
|
-
HttpStatus2[HttpStatus2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
1129
|
-
HttpStatus2[HttpStatus2["CONFLICT"] = 409] = "CONFLICT";
|
|
1130
|
-
HttpStatus2[HttpStatus2["GONE"] = 410] = "GONE";
|
|
1131
|
-
HttpStatus2[HttpStatus2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
1132
|
-
HttpStatus2[HttpStatus2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
1133
|
-
HttpStatus2[HttpStatus2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
1134
|
-
HttpStatus2[HttpStatus2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
1135
|
-
HttpStatus2[HttpStatus2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
1136
|
-
HttpStatus2[HttpStatus2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
|
|
1137
|
-
HttpStatus2[HttpStatus2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
1138
|
-
HttpStatus2[HttpStatus2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
|
|
1139
|
-
HttpStatus2[HttpStatus2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
1140
|
-
HttpStatus2[HttpStatus2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
1141
|
-
HttpStatus2[HttpStatus2["LOCKED"] = 423] = "LOCKED";
|
|
1142
|
-
HttpStatus2[HttpStatus2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
1143
|
-
HttpStatus2[HttpStatus2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
1144
|
-
HttpStatus2[HttpStatus2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
1145
|
-
HttpStatus2[HttpStatus2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
1146
|
-
HttpStatus2[HttpStatus2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
1147
|
-
HttpStatus2[HttpStatus2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
1148
|
-
HttpStatus2[HttpStatus2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
1149
|
-
HttpStatus2[HttpStatus2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
1150
|
-
HttpStatus2[HttpStatus2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
1151
|
-
HttpStatus2[HttpStatus2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
1152
|
-
HttpStatus2[HttpStatus2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
1153
|
-
HttpStatus2[HttpStatus2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
1154
|
-
HttpStatus2[HttpStatus2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
1155
|
-
HttpStatus2[HttpStatus2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
1156
|
-
HttpStatus2[HttpStatus2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
1157
|
-
HttpStatus2[HttpStatus2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
1158
|
-
HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
1159
|
-
HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
1160
|
-
return HttpStatus2;
|
|
1161
|
-
})({});
|
|
1162
|
-
|
|
1163
|
-
// src/enums/language-code.ts
|
|
1164
|
-
var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
|
|
1165
|
-
LanguageCode2["CS"] = "cs";
|
|
1166
|
-
LanguageCode2["EN"] = "en";
|
|
1167
|
-
LanguageCode2["DE"] = "de";
|
|
1168
|
-
LanguageCode2["PL"] = "pl";
|
|
1169
|
-
LanguageCode2["SK"] = "sk";
|
|
1170
|
-
return LanguageCode2;
|
|
1171
|
-
})({});
|
|
1172
|
-
|
|
1173
|
-
// src/enums/payment-method.ts
|
|
1174
|
-
var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
|
|
1175
|
-
PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
|
|
1176
|
-
PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
|
|
1177
|
-
PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
|
|
1178
|
-
PaymentMethod2[PaymentMethod2["CREDIT"] = 3] = "CREDIT";
|
|
1179
|
-
return PaymentMethod2;
|
|
1180
|
-
})({});
|
|
1181
|
-
|
|
1182
|
-
// src/enums/transaction-type.ts
|
|
1183
|
-
var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
|
|
1184
|
-
TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
|
|
1185
|
-
TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
|
|
1186
|
-
TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
|
|
1187
|
-
TransactionType2[TransactionType2["ADD"] = 3] = "ADD";
|
|
1188
|
-
TransactionType2[TransactionType2["DELIVERY"] = 4] = "DELIVERY";
|
|
1189
|
-
TransactionType2[TransactionType2["DEPOT_WRITEOFF"] = 5] = "DEPOT_WRITEOFF";
|
|
1190
|
-
TransactionType2[TransactionType2["DEPOT_ADD"] = 6] = "DEPOT_ADD";
|
|
1191
|
-
TransactionType2[TransactionType2["RETURN"] = 7] = "RETURN";
|
|
1192
|
-
TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
|
|
1193
|
-
TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
|
|
1194
|
-
return TransactionType2;
|
|
1195
|
-
})({});
|
|
1719
|
+
type: "timestamptz",
|
|
1720
|
+
nullable: false,
|
|
1721
|
+
default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
|
|
1722
|
+
...options
|
|
1723
|
+
};
|
|
1724
|
+
return (0, import_typeorm3.Column)(defaultOptions);
|
|
1725
|
+
}
|
|
1726
|
+
__name(TimestampColumn, "TimestampColumn");
|
|
1727
|
+
|
|
1728
|
+
// src/database/entities/fresh-hyper-entity.ts
|
|
1729
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1730
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1731
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1732
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1733
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1734
|
+
}
|
|
1735
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
1736
|
+
function _ts_metadata2(k, v) {
|
|
1737
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1738
|
+
}
|
|
1739
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
1740
|
+
var _FreshHyperEntity = class _FreshHyperEntity extends import_typeorm4.BaseEntity {
|
|
1741
|
+
/** After manual construction `id` is irrelevant */
|
|
1742
|
+
constructor(timestamp) {
|
|
1743
|
+
super();
|
|
1744
|
+
// input timestamp as PK
|
|
1745
|
+
__publicField(this, "timestamp");
|
|
1746
|
+
// just info column about time of insert
|
|
1747
|
+
__publicField(this, "created_at");
|
|
1748
|
+
this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
|
|
1749
|
+
this.created_at = /* @__PURE__ */ new Date();
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
__name(_FreshHyperEntity, "FreshHyperEntity");
|
|
1753
|
+
var FreshHyperEntity = _FreshHyperEntity;
|
|
1754
|
+
_ts_decorate2([
|
|
1755
|
+
(0, import_typeorm4.PrimaryColumn)({
|
|
1756
|
+
type: "timestamptz"
|
|
1757
|
+
}),
|
|
1758
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1759
|
+
], FreshHyperEntity.prototype, "timestamp", void 0);
|
|
1760
|
+
_ts_decorate2([
|
|
1761
|
+
TimestampColumn(),
|
|
1762
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1763
|
+
], FreshHyperEntity.prototype, "created_at", void 0);
|
|
1196
1764
|
|
|
1197
1765
|
// src/database/entities/fresh-translation-entity.ts
|
|
1766
|
+
var import_typeorm5 = require("typeorm");
|
|
1198
1767
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
1199
1768
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1200
1769
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1207,7 +1776,7 @@ function _ts_metadata3(k, v) {
|
|
|
1207
1776
|
}
|
|
1208
1777
|
__name(_ts_metadata3, "_ts_metadata");
|
|
1209
1778
|
var languageValues = Object.values(LanguageCode).map((v) => `'${v}'`).join(",");
|
|
1210
|
-
var _FreshTranslationBase = class _FreshTranslationBase extends
|
|
1779
|
+
var _FreshTranslationBase = class _FreshTranslationBase extends import_typeorm5.BaseEntity {
|
|
1211
1780
|
constructor() {
|
|
1212
1781
|
super();
|
|
1213
1782
|
__publicField(this, "id");
|
|
@@ -1219,16 +1788,16 @@ var _FreshTranslationBase = class _FreshTranslationBase extends import_typeorm4.
|
|
|
1219
1788
|
__name(_FreshTranslationBase, "FreshTranslationBase");
|
|
1220
1789
|
var FreshTranslationBase = _FreshTranslationBase;
|
|
1221
1790
|
_ts_decorate3([
|
|
1222
|
-
(0,
|
|
1791
|
+
(0, import_typeorm5.PrimaryGeneratedColumn)(),
|
|
1223
1792
|
_ts_metadata3("design:type", Number)
|
|
1224
1793
|
], FreshTranslationBase.prototype, "id", void 0);
|
|
1225
1794
|
_ts_decorate3([
|
|
1226
|
-
(0,
|
|
1795
|
+
(0, import_typeorm5.Column)({
|
|
1227
1796
|
type: "varchar",
|
|
1228
1797
|
length: 3,
|
|
1229
1798
|
nullable: false
|
|
1230
1799
|
}),
|
|
1231
|
-
(0,
|
|
1800
|
+
(0, import_typeorm5.Check)(`"languageCode" IN (${languageValues})`),
|
|
1232
1801
|
_ts_metadata3("design:type", typeof LanguageCode === "undefined" ? Object : LanguageCode)
|
|
1233
1802
|
], FreshTranslationBase.prototype, "languageCode", void 0);
|
|
1234
1803
|
|
|
@@ -1331,11 +1900,11 @@ var _Category = class _Category extends FreshEntity {
|
|
|
1331
1900
|
__name(_Category, "Category");
|
|
1332
1901
|
var Category = _Category;
|
|
1333
1902
|
Category = _ts_decorate4([
|
|
1334
|
-
(0,
|
|
1903
|
+
(0, import_typeorm6.Entity)()
|
|
1335
1904
|
], Category);
|
|
1336
1905
|
|
|
1337
1906
|
// src/common/schema/entities/device.entity.ts
|
|
1338
|
-
var
|
|
1907
|
+
var import_typeorm7 = require("typeorm");
|
|
1339
1908
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
1340
1909
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1341
1910
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1348,11 +1917,11 @@ var _Device = class _Device extends FreshEntity {
|
|
|
1348
1917
|
__name(_Device, "Device");
|
|
1349
1918
|
var Device = _Device;
|
|
1350
1919
|
Device = _ts_decorate5([
|
|
1351
|
-
(0,
|
|
1920
|
+
(0, import_typeorm7.Entity)()
|
|
1352
1921
|
], Device);
|
|
1353
1922
|
|
|
1354
1923
|
// src/common/schema/entities/manufacturer.entity.ts
|
|
1355
|
-
var
|
|
1924
|
+
var import_typeorm8 = require("typeorm");
|
|
1356
1925
|
function _ts_decorate6(decorators, target, key, desc) {
|
|
1357
1926
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1358
1927
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1365,11 +1934,11 @@ var _Manufacturer = class _Manufacturer extends FreshEntity {
|
|
|
1365
1934
|
__name(_Manufacturer, "Manufacturer");
|
|
1366
1935
|
var Manufacturer = _Manufacturer;
|
|
1367
1936
|
Manufacturer = _ts_decorate6([
|
|
1368
|
-
(0,
|
|
1937
|
+
(0, import_typeorm8.Entity)()
|
|
1369
1938
|
], Manufacturer);
|
|
1370
1939
|
|
|
1371
1940
|
// src/common/schema/entities/product.entity.ts
|
|
1372
|
-
var
|
|
1941
|
+
var import_typeorm9 = require("typeorm");
|
|
1373
1942
|
function _ts_decorate7(decorators, target, key, desc) {
|
|
1374
1943
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1375
1944
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1382,11 +1951,11 @@ var _Product = class _Product extends FreshEntity {
|
|
|
1382
1951
|
__name(_Product, "Product");
|
|
1383
1952
|
var Product = _Product;
|
|
1384
1953
|
Product = _ts_decorate7([
|
|
1385
|
-
(0,
|
|
1954
|
+
(0, import_typeorm9.Entity)()
|
|
1386
1955
|
], Product);
|
|
1387
1956
|
|
|
1388
1957
|
// src/common/schema/entities/subcategory.entity.ts
|
|
1389
|
-
var
|
|
1958
|
+
var import_typeorm10 = require("typeorm");
|
|
1390
1959
|
function _ts_decorate8(decorators, target, key, desc) {
|
|
1391
1960
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1392
1961
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1399,7 +1968,7 @@ var _Subcategory = class _Subcategory extends FreshEntity {
|
|
|
1399
1968
|
__name(_Subcategory, "Subcategory");
|
|
1400
1969
|
var Subcategory = _Subcategory;
|
|
1401
1970
|
Subcategory = _ts_decorate8([
|
|
1402
|
-
(0,
|
|
1971
|
+
(0, import_typeorm10.Entity)()
|
|
1403
1972
|
], Subcategory);
|
|
1404
1973
|
|
|
1405
1974
|
// src/common/typeguards/decimal.ts
|
|
@@ -1523,6 +2092,23 @@ async function runWithConcurrency(items, concurrency, worker) {
|
|
|
1523
2092
|
}
|
|
1524
2093
|
__name(runWithConcurrency, "runWithConcurrency");
|
|
1525
2094
|
|
|
2095
|
+
// src/common/utils/id-path-param-resolver.utils.ts
|
|
2096
|
+
function resolvePathParameterId(id) {
|
|
2097
|
+
return /^\d+$/.test(id) ? parseInt(id, 10) : id;
|
|
2098
|
+
}
|
|
2099
|
+
__name(resolvePathParameterId, "resolvePathParameterId");
|
|
2100
|
+
|
|
2101
|
+
// src/common/utils/is-cron-valid.ts
|
|
2102
|
+
function isValidCron(expr) {
|
|
2103
|
+
const parts = expr.trim().split(/\s+/);
|
|
2104
|
+
if (parts.length < 5 || parts.length > 6) {
|
|
2105
|
+
return false;
|
|
2106
|
+
}
|
|
2107
|
+
const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
|
|
2108
|
+
return parts.every((part) => cronPart.test(part));
|
|
2109
|
+
}
|
|
2110
|
+
__name(isValidCron, "isValidCron");
|
|
2111
|
+
|
|
1526
2112
|
// src/common/utils/patch.utils.ts
|
|
1527
2113
|
function buildPatch(data, keys, transforms) {
|
|
1528
2114
|
const patch = {};
|
|
@@ -1537,191 +2123,6 @@ function buildPatch(data, keys, transforms) {
|
|
|
1537
2123
|
}
|
|
1538
2124
|
__name(buildPatch, "buildPatch");
|
|
1539
2125
|
|
|
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
|
-
// src/core/class/fresh-job.ts
|
|
1578
|
-
var import_node_schedule = require("node-schedule");
|
|
1579
|
-
var _FreshJob = class _FreshJob extends Singleton {
|
|
1580
|
-
/**
|
|
1581
|
-
* Creates and optionally schedules a singleton cron job.
|
|
1582
|
-
*
|
|
1583
|
-
* @param jobName - Logical name of the job (used in logs and errors).
|
|
1584
|
-
* @param cronExpression - Cron expression consisting of numeric fields only.
|
|
1585
|
-
* Example: `0 5 * * 4`
|
|
1586
|
-
* The timezone `"Europe/Prague"` is applied automatically.
|
|
1587
|
-
*
|
|
1588
|
-
* @param jobEnabled - Whether the job should be scheduled immediately.
|
|
1589
|
-
* If `false`, the instance exists but no cron trigger is registered.
|
|
1590
|
-
*
|
|
1591
|
-
* @throws Error If the cron expression is invalid.
|
|
1592
|
-
* @throws Error If the job cannot be scheduled.
|
|
1593
|
-
*/
|
|
1594
|
-
constructor(jobName, cronExpression, jobEnabled) {
|
|
1595
|
-
super(false);
|
|
1596
|
-
/** Human-readable job identifier (used for logs and errors). */
|
|
1597
|
-
__publicField(this, "_jobName");
|
|
1598
|
-
/**
|
|
1599
|
-
* Cron expression defining when the job runs.
|
|
1600
|
-
*
|
|
1601
|
-
* Must contain numeric cron fields only.
|
|
1602
|
-
* Example: `0 5 * * 4`
|
|
1603
|
-
*
|
|
1604
|
-
* Timezone is always forced to `"Europe/Prague"`.
|
|
1605
|
-
* If you need another timezone, this class is not your friend.
|
|
1606
|
-
*/
|
|
1607
|
-
__publicField(this, "_cronExpression");
|
|
1608
|
-
/** Scheduled job instance, or `null` if the job is disabled. */
|
|
1609
|
-
__publicField(this, "_job", null);
|
|
1610
|
-
this._jobName = jobName;
|
|
1611
|
-
if (!isValidCron(cronExpression)) {
|
|
1612
|
-
throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
|
|
1613
|
-
}
|
|
1614
|
-
this._cronExpression = cronExpression;
|
|
1615
|
-
if (jobEnabled) {
|
|
1616
|
-
this._job = (0, import_node_schedule.scheduleJob)({
|
|
1617
|
-
rule: this._cronExpression,
|
|
1618
|
-
tz: "Europe/Prague"
|
|
1619
|
-
}, async () => {
|
|
1620
|
-
await this.invoke();
|
|
1621
|
-
});
|
|
1622
|
-
if (!this._job) {
|
|
1623
|
-
throw new Error(`Job ${this._jobName} could not be scheduled`);
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
this.onInit();
|
|
1627
|
-
}
|
|
1628
|
-
/**
|
|
1629
|
-
* Initialization hook.
|
|
1630
|
-
*
|
|
1631
|
-
* Called once during construction and used primarily for logging.
|
|
1632
|
-
* Can also be reused by subclasses if manual rescheduling is implemented.
|
|
1633
|
-
*
|
|
1634
|
-
* @param rescheduled - Indicates whether the job was reconfigured
|
|
1635
|
-
* after initial creation.
|
|
1636
|
-
*/
|
|
1637
|
-
onInit(rescheduled) {
|
|
1638
|
-
console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
|
|
1639
|
-
}
|
|
1640
|
-
/** @returns The logical name of the job. */
|
|
1641
|
-
get jobName() {
|
|
1642
|
-
return this._jobName;
|
|
1643
|
-
}
|
|
1644
|
-
/** Allows subclasses to rename the job if absolutely necessary. */
|
|
1645
|
-
set jobName(value) {
|
|
1646
|
-
this._jobName = value;
|
|
1647
|
-
}
|
|
1648
|
-
/** @returns The cron expression used to schedule the job. */
|
|
1649
|
-
get cronExpression() {
|
|
1650
|
-
return this._cronExpression;
|
|
1651
|
-
}
|
|
1652
|
-
/**
|
|
1653
|
-
* Allows subclasses to update the cron expression internally.
|
|
1654
|
-
* Does reschedule of job if exists
|
|
1655
|
-
*/
|
|
1656
|
-
set cronExpression(value) {
|
|
1657
|
-
if (!isValidCron(value)) {
|
|
1658
|
-
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${value}"`);
|
|
1659
|
-
}
|
|
1660
|
-
this._cronExpression = value;
|
|
1661
|
-
}
|
|
1662
|
-
/** @returns The underlying scheduled job instance, or `null` if disabled. */
|
|
1663
|
-
get job() {
|
|
1664
|
-
return this._job;
|
|
1665
|
-
}
|
|
1666
|
-
/** Allows subclasses to manage the scheduled job instance. */
|
|
1667
|
-
set job(value) {
|
|
1668
|
-
this._job = value;
|
|
1669
|
-
}
|
|
1670
|
-
reschedule(newCronExpression) {
|
|
1671
|
-
let result = false;
|
|
1672
|
-
if (!isValidCron(newCronExpression)) {
|
|
1673
|
-
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${newCronExpression}"`);
|
|
1674
|
-
}
|
|
1675
|
-
this._cronExpression = newCronExpression;
|
|
1676
|
-
if (this._job) {
|
|
1677
|
-
const rescheduleSuccess = this._job.reschedule({
|
|
1678
|
-
rule: this._cronExpression,
|
|
1679
|
-
tz: "Europe/Prague"
|
|
1680
|
-
});
|
|
1681
|
-
if (!rescheduleSuccess) {
|
|
1682
|
-
throw new Error(`Job ${this._jobName} could not be re-scheduled`);
|
|
1683
|
-
} else {
|
|
1684
|
-
this.onInit(true);
|
|
1685
|
-
}
|
|
1686
|
-
result = rescheduleSuccess;
|
|
1687
|
-
}
|
|
1688
|
-
return result;
|
|
1689
|
-
}
|
|
1690
|
-
};
|
|
1691
|
-
__name(_FreshJob, "FreshJob");
|
|
1692
|
-
var FreshJob = _FreshJob;
|
|
1693
|
-
|
|
1694
|
-
// src/core/errors/api-error.ts
|
|
1695
|
-
var _ApiError = class _ApiError extends Error {
|
|
1696
|
-
constructor(statusCode, status, detail) {
|
|
1697
|
-
super();
|
|
1698
|
-
__publicField(this, "_statusCode");
|
|
1699
|
-
__publicField(this, "_statusDto");
|
|
1700
|
-
this._statusCode = statusCode;
|
|
1701
|
-
this._statusDto = new StatusDto(status, detail);
|
|
1702
|
-
}
|
|
1703
|
-
get statusCode() {
|
|
1704
|
-
return this._statusCode;
|
|
1705
|
-
}
|
|
1706
|
-
get statusDto() {
|
|
1707
|
-
return this._statusDto;
|
|
1708
|
-
}
|
|
1709
|
-
};
|
|
1710
|
-
__name(_ApiError, "ApiError");
|
|
1711
|
-
var ApiError = _ApiError;
|
|
1712
|
-
|
|
1713
|
-
// src/core/errors/business-warning.ts
|
|
1714
|
-
var _BusinessWarning = class _BusinessWarning extends Error {
|
|
1715
|
-
constructor(code, message) {
|
|
1716
|
-
super(message);
|
|
1717
|
-
__publicField(this, "code");
|
|
1718
|
-
this.code = code;
|
|
1719
|
-
this.name = "BusinessWarning";
|
|
1720
|
-
}
|
|
1721
|
-
};
|
|
1722
|
-
__name(_BusinessWarning, "BusinessWarning");
|
|
1723
|
-
var BusinessWarning = _BusinessWarning;
|
|
1724
|
-
|
|
1725
2126
|
// src/types/maybe-type.ts
|
|
1726
2127
|
function isMaybe(v, inner) {
|
|
1727
2128
|
return v === null || inner(v);
|
|
@@ -1915,32 +2316,76 @@ var datasource_default = PG_DATA_SOURCE_OPTIONS;
|
|
|
1915
2316
|
AMOUNT_UNIT,
|
|
1916
2317
|
ActionCommandCode,
|
|
1917
2318
|
ApiError,
|
|
2319
|
+
BadGatewayError,
|
|
2320
|
+
BadRequestError,
|
|
1918
2321
|
BaseEntityChangeSubscriber,
|
|
1919
2322
|
BusinessWarning,
|
|
1920
2323
|
Category,
|
|
2324
|
+
ConflictError,
|
|
1921
2325
|
DEFAULT_PAGINATION_PARAMS,
|
|
1922
2326
|
DataHelper,
|
|
1923
2327
|
DateUtils,
|
|
1924
2328
|
DepotPoolStatus,
|
|
1925
2329
|
Device,
|
|
2330
|
+
ExpectationFailedError,
|
|
2331
|
+
FailedDependencyError,
|
|
2332
|
+
ForbiddenError,
|
|
1926
2333
|
FreshDao,
|
|
1927
2334
|
FreshEntity,
|
|
2335
|
+
FreshError,
|
|
1928
2336
|
FreshHyperEntity,
|
|
1929
2337
|
FreshJob,
|
|
1930
2338
|
FreshTranslationBase,
|
|
2339
|
+
GatewayTimeoutError,
|
|
2340
|
+
GoneError,
|
|
1931
2341
|
HttpStatus,
|
|
2342
|
+
HttpVersionNotSupportedError,
|
|
2343
|
+
ImATeapotError,
|
|
2344
|
+
InsufficientStorageError,
|
|
2345
|
+
InternalServerError,
|
|
1932
2346
|
LanguageCode,
|
|
2347
|
+
LengthRequiredError,
|
|
2348
|
+
LockedError,
|
|
2349
|
+
LoopDetectedError,
|
|
1933
2350
|
Manufacturer,
|
|
2351
|
+
MethodNotAllowedError,
|
|
2352
|
+
MisdirectedRequestError,
|
|
2353
|
+
NetworkAuthenticationRequiredError,
|
|
2354
|
+
NotAcceptableError,
|
|
2355
|
+
NotExtendedError,
|
|
2356
|
+
NotFoundError,
|
|
2357
|
+
NotImplementedError,
|
|
2358
|
+
PayloadTooLargeError,
|
|
1934
2359
|
PaymentMethod,
|
|
2360
|
+
PaymentRequiredError,
|
|
1935
2361
|
PgDataSourceOptions,
|
|
2362
|
+
PreconditionFailedError,
|
|
2363
|
+
PreconditionRequiredError,
|
|
1936
2364
|
Product,
|
|
2365
|
+
ProxyAuthenticationRequiredError,
|
|
2366
|
+
RangeNotSatisfiableError,
|
|
2367
|
+
RequestHeaderFieldsTooLargeError,
|
|
2368
|
+
RequestTimeoutError,
|
|
2369
|
+
ServiceUnavailableError,
|
|
1937
2370
|
SinglePromiseWaiter,
|
|
1938
2371
|
Singleton,
|
|
1939
2372
|
StatusDto,
|
|
1940
2373
|
Subcategory,
|
|
1941
2374
|
TO_BINARY_FLAG,
|
|
1942
2375
|
TimestampColumn,
|
|
2376
|
+
TooEarlyError,
|
|
2377
|
+
TooManyRequestsError,
|
|
1943
2378
|
TransactionType,
|
|
2379
|
+
UnauthorizedError,
|
|
2380
|
+
UnavailableForLegalReasonsError,
|
|
2381
|
+
UnprocessableEntityError,
|
|
2382
|
+
UnsupportedMediaTypeError,
|
|
2383
|
+
UpgradeRequiredError,
|
|
2384
|
+
UriTooLongError,
|
|
2385
|
+
VariantAlsoNegotiatesError,
|
|
2386
|
+
buildDateRange,
|
|
2387
|
+
buildOrder,
|
|
2388
|
+
buildPagination,
|
|
1944
2389
|
buildPatch,
|
|
1945
2390
|
constructTypeormPagination,
|
|
1946
2391
|
createDeferred,
|
|
@@ -1959,6 +2404,7 @@ var datasource_default = PG_DATA_SOURCE_OPTIONS;
|
|
|
1959
2404
|
isValidCron,
|
|
1960
2405
|
listAll,
|
|
1961
2406
|
parsePaginationFromURL,
|
|
2407
|
+
resolvePathParameterId,
|
|
1962
2408
|
runWithConcurrency,
|
|
1963
2409
|
toDecimal
|
|
1964
2410
|
});
|