@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.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,61 @@ __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
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
__publicField(this, "_promise", null);
|
|
625
|
-
}
|
|
626
|
-
static getInstance() {
|
|
627
|
-
if (!_SinglePromiseWaiter._instance) {
|
|
628
|
-
_SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
|
|
629
|
-
}
|
|
630
|
-
return _SinglePromiseWaiter._instance;
|
|
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();
|
|
631
656
|
}
|
|
632
|
-
|
|
633
|
-
|
|
657
|
+
};
|
|
658
|
+
__name(_StatusDto, "StatusDto");
|
|
659
|
+
var StatusDto = _StatusDto;
|
|
660
|
+
|
|
661
|
+
// src/common/pagination/find-options/date-range.ts
|
|
662
|
+
import { Between, LessThanOrEqual, MoreThanOrEqual } from "typeorm";
|
|
663
|
+
function buildDateRange(from, to) {
|
|
664
|
+
const f = from ? new Date(from) : void 0;
|
|
665
|
+
const t = to ? new Date(to) : void 0;
|
|
666
|
+
if (f && t) {
|
|
667
|
+
return Between(f, t);
|
|
634
668
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
this._promise = promise;
|
|
638
|
-
this._promise.finally(() => {
|
|
639
|
-
this._promise = null;
|
|
640
|
-
});
|
|
641
|
-
}
|
|
669
|
+
if (f) {
|
|
670
|
+
return MoreThanOrEqual(f);
|
|
642
671
|
}
|
|
643
|
-
|
|
644
|
-
return
|
|
672
|
+
if (t) {
|
|
673
|
+
return LessThanOrEqual(t);
|
|
645
674
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
675
|
+
return void 0;
|
|
676
|
+
}
|
|
677
|
+
__name(buildDateRange, "buildDateRange");
|
|
650
678
|
|
|
651
|
-
// src/common/
|
|
652
|
-
function
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
return false;
|
|
679
|
+
// src/common/pagination/find-options/order.ts
|
|
680
|
+
function buildOrder(sortBy, sortOrder) {
|
|
681
|
+
if (!sortBy) {
|
|
682
|
+
return void 0;
|
|
656
683
|
}
|
|
657
|
-
|
|
658
|
-
|
|
684
|
+
return {
|
|
685
|
+
[sortBy]: sortOrder != null ? sortOrder : "ASC"
|
|
686
|
+
};
|
|
659
687
|
}
|
|
660
|
-
__name(
|
|
688
|
+
__name(buildOrder, "buildOrder");
|
|
689
|
+
|
|
690
|
+
// src/core/class/fresh-job.ts
|
|
691
|
+
import { scheduleJob } from "node-schedule";
|
|
661
692
|
|
|
662
693
|
// src/common/patterns/singleton.ts
|
|
663
694
|
var _Singleton = class _Singleton {
|
|
@@ -710,46 +741,650 @@ __name(_Singleton, "Singleton");
|
|
|
710
741
|
__publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
|
|
711
742
|
var Singleton = _Singleton;
|
|
712
743
|
|
|
713
|
-
// src/
|
|
714
|
-
var
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
744
|
+
// src/core/class/fresh-job.ts
|
|
745
|
+
var _FreshJob = class _FreshJob extends Singleton {
|
|
746
|
+
/**
|
|
747
|
+
* Creates and optionally schedules a singleton cron job.
|
|
748
|
+
*
|
|
749
|
+
* @param jobName - Logical name of the job (used in logs and errors).
|
|
750
|
+
* @param cronExpression - Cron expression consisting of numeric fields only.
|
|
751
|
+
* Example: `0 5 * * 4`
|
|
752
|
+
* The timezone `"Europe/Prague"` is applied automatically.
|
|
753
|
+
*
|
|
754
|
+
* @param jobEnabled - Whether the job should be scheduled immediately.
|
|
755
|
+
* If `false`, the instance exists but no cron trigger is registered.
|
|
756
|
+
*
|
|
757
|
+
* @throws Error If the cron expression is invalid.
|
|
758
|
+
* @throws Error If the job cannot be scheduled.
|
|
759
|
+
*/
|
|
760
|
+
constructor(jobName, cronExpression, jobEnabled) {
|
|
761
|
+
super(false);
|
|
762
|
+
/** Human-readable job identifier (used for logs and errors). */
|
|
763
|
+
__publicField(this, "_jobName");
|
|
725
764
|
/**
|
|
726
|
-
*
|
|
765
|
+
* Cron expression defining when the job runs.
|
|
766
|
+
*
|
|
767
|
+
* Must contain numeric cron fields only.
|
|
768
|
+
* Example: `0 5 * * 4`
|
|
769
|
+
*
|
|
770
|
+
* Timezone is always forced to `"Europe/Prague"`.
|
|
771
|
+
* If you need another timezone, this class is not your friend.
|
|
727
772
|
*/
|
|
728
|
-
__publicField(this, "
|
|
729
|
-
|
|
730
|
-
this
|
|
731
|
-
this.
|
|
773
|
+
__publicField(this, "_cronExpression");
|
|
774
|
+
/** Scheduled job instance, or `null` if the job is disabled. */
|
|
775
|
+
__publicField(this, "_job", null);
|
|
776
|
+
this._jobName = jobName;
|
|
777
|
+
if (!isValidCron(cronExpression)) {
|
|
778
|
+
throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
|
|
779
|
+
}
|
|
780
|
+
this._cronExpression = cronExpression;
|
|
781
|
+
if (jobEnabled) {
|
|
782
|
+
this._job = scheduleJob({
|
|
783
|
+
rule: this._cronExpression,
|
|
784
|
+
tz: "Europe/Prague"
|
|
785
|
+
}, async () => {
|
|
786
|
+
await this.invoke();
|
|
787
|
+
});
|
|
788
|
+
if (!this._job) {
|
|
789
|
+
throw new Error(`Job ${this._jobName} could not be scheduled`);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
this.onInit();
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Initialization hook.
|
|
796
|
+
*
|
|
797
|
+
* Called once during construction and used primarily for logging.
|
|
798
|
+
* Can also be reused by subclasses if manual rescheduling is implemented.
|
|
799
|
+
*
|
|
800
|
+
* @param rescheduled - Indicates whether the job was reconfigured
|
|
801
|
+
* after initial creation.
|
|
802
|
+
*/
|
|
803
|
+
onInit(rescheduled) {
|
|
804
|
+
console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
|
|
805
|
+
}
|
|
806
|
+
/** @returns The logical name of the job. */
|
|
807
|
+
get jobName() {
|
|
808
|
+
return this._jobName;
|
|
809
|
+
}
|
|
810
|
+
/** Allows subclasses to rename the job if absolutely necessary. */
|
|
811
|
+
set jobName(value) {
|
|
812
|
+
this._jobName = value;
|
|
813
|
+
}
|
|
814
|
+
/** @returns The cron expression used to schedule the job. */
|
|
815
|
+
get cronExpression() {
|
|
816
|
+
return this._cronExpression;
|
|
817
|
+
}
|
|
818
|
+
/**
|
|
819
|
+
* Allows subclasses to update the cron expression internally.
|
|
820
|
+
* Does reschedule of job if exists
|
|
821
|
+
*/
|
|
822
|
+
set cronExpression(value) {
|
|
823
|
+
if (!isValidCron(value)) {
|
|
824
|
+
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${value}"`);
|
|
825
|
+
}
|
|
826
|
+
this._cronExpression = value;
|
|
827
|
+
}
|
|
828
|
+
/** @returns The underlying scheduled job instance, or `null` if disabled. */
|
|
829
|
+
get job() {
|
|
830
|
+
return this._job;
|
|
831
|
+
}
|
|
832
|
+
/** Allows subclasses to manage the scheduled job instance. */
|
|
833
|
+
set job(value) {
|
|
834
|
+
this._job = value;
|
|
835
|
+
}
|
|
836
|
+
reschedule(newCronExpression) {
|
|
837
|
+
let result = false;
|
|
838
|
+
if (!isValidCron(newCronExpression)) {
|
|
839
|
+
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${newCronExpression}"`);
|
|
840
|
+
}
|
|
841
|
+
this._cronExpression = newCronExpression;
|
|
842
|
+
if (this._job) {
|
|
843
|
+
const rescheduleSuccess = this._job.reschedule({
|
|
844
|
+
rule: this._cronExpression,
|
|
845
|
+
tz: "Europe/Prague"
|
|
846
|
+
});
|
|
847
|
+
if (!rescheduleSuccess) {
|
|
848
|
+
throw new Error(`Job ${this._jobName} could not be re-scheduled`);
|
|
849
|
+
} else {
|
|
850
|
+
this.onInit(true);
|
|
851
|
+
}
|
|
852
|
+
result = rescheduleSuccess;
|
|
853
|
+
}
|
|
854
|
+
return result;
|
|
732
855
|
}
|
|
733
856
|
};
|
|
734
|
-
__name(
|
|
735
|
-
var
|
|
857
|
+
__name(_FreshJob, "FreshJob");
|
|
858
|
+
var FreshJob = _FreshJob;
|
|
736
859
|
|
|
737
|
-
// src/
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
860
|
+
// src/core/errors/api-error.ts
|
|
861
|
+
var _ApiError = class _ApiError extends Error {
|
|
862
|
+
constructor(statusCode, status, detail) {
|
|
863
|
+
super();
|
|
864
|
+
__publicField(this, "_statusCode");
|
|
865
|
+
__publicField(this, "_statusDto");
|
|
866
|
+
this._statusCode = statusCode;
|
|
867
|
+
this._statusDto = new StatusDto(status, detail);
|
|
868
|
+
}
|
|
869
|
+
get statusCode() {
|
|
870
|
+
return this._statusCode;
|
|
871
|
+
}
|
|
872
|
+
get statusDto() {
|
|
873
|
+
return this._statusDto;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
__name(_ApiError, "ApiError");
|
|
877
|
+
var ApiError = _ApiError;
|
|
878
|
+
|
|
879
|
+
// src/core/errors/business-warning.ts
|
|
880
|
+
var _BusinessWarning = class _BusinessWarning extends Error {
|
|
881
|
+
constructor(code, message) {
|
|
882
|
+
super(message);
|
|
883
|
+
__publicField(this, "code");
|
|
884
|
+
this.code = code;
|
|
885
|
+
this.name = "BusinessWarning";
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
__name(_BusinessWarning, "BusinessWarning");
|
|
889
|
+
var BusinessWarning = _BusinessWarning;
|
|
890
|
+
|
|
891
|
+
// src/core/errors/fresh-error.ts
|
|
892
|
+
var _FreshError = class _FreshError extends Error {
|
|
893
|
+
constructor(statusCode, status, detail, options) {
|
|
894
|
+
super(detail != null ? detail : status);
|
|
895
|
+
/** HTTP status code sent in the response. */
|
|
896
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
897
|
+
__publicField(this, "statusCode");
|
|
898
|
+
/** Structured response body describing the error. */
|
|
899
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
900
|
+
__publicField(this, "statusDto");
|
|
901
|
+
this.name = this.constructor.name;
|
|
902
|
+
if ((options == null ? void 0 : options.cause) !== void 0) {
|
|
903
|
+
this.cause = options.cause;
|
|
904
|
+
}
|
|
905
|
+
this.statusCode = statusCode;
|
|
906
|
+
this.statusDto = new StatusDto(status, detail);
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
__name(_FreshError, "FreshError");
|
|
910
|
+
var FreshError = _FreshError;
|
|
911
|
+
|
|
912
|
+
// src/enums/action-command-code.ts
|
|
913
|
+
var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
|
|
914
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
|
|
915
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
|
|
916
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
|
|
917
|
+
ActionCommandCode2[ActionCommandCode2["RESTART_REMOTE_CONTROL"] = 4] = "RESTART_REMOTE_CONTROL";
|
|
918
|
+
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE"] = 5] = "SYNCHRONIZE";
|
|
919
|
+
ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
|
|
920
|
+
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
|
|
921
|
+
return ActionCommandCode2;
|
|
922
|
+
})({});
|
|
923
|
+
|
|
924
|
+
// src/enums/depot-pool-status.ts
|
|
925
|
+
var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
|
|
926
|
+
DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
|
|
927
|
+
DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
|
|
928
|
+
DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
|
|
929
|
+
DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
|
|
930
|
+
DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
|
|
931
|
+
return DepotPoolStatus2;
|
|
932
|
+
})({});
|
|
933
|
+
|
|
934
|
+
// src/enums/http-status.ts
|
|
935
|
+
var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
|
|
936
|
+
HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
|
|
937
|
+
HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
938
|
+
HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
|
|
939
|
+
HttpStatus2[HttpStatus2["EARLY_HINTS"] = 103] = "EARLY_HINTS";
|
|
940
|
+
HttpStatus2[HttpStatus2["OK"] = 200] = "OK";
|
|
941
|
+
HttpStatus2[HttpStatus2["CREATED"] = 201] = "CREATED";
|
|
942
|
+
HttpStatus2[HttpStatus2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
943
|
+
HttpStatus2[HttpStatus2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
944
|
+
HttpStatus2[HttpStatus2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
945
|
+
HttpStatus2[HttpStatus2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
946
|
+
HttpStatus2[HttpStatus2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
947
|
+
HttpStatus2[HttpStatus2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
948
|
+
HttpStatus2[HttpStatus2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
949
|
+
HttpStatus2[HttpStatus2["IM_USED"] = 226] = "IM_USED";
|
|
950
|
+
HttpStatus2[HttpStatus2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
951
|
+
HttpStatus2[HttpStatus2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
952
|
+
HttpStatus2[HttpStatus2["FOUND"] = 302] = "FOUND";
|
|
953
|
+
HttpStatus2[HttpStatus2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
954
|
+
HttpStatus2[HttpStatus2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
955
|
+
HttpStatus2[HttpStatus2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
956
|
+
HttpStatus2[HttpStatus2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
957
|
+
HttpStatus2[HttpStatus2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
958
|
+
HttpStatus2[HttpStatus2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
959
|
+
HttpStatus2[HttpStatus2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
960
|
+
HttpStatus2[HttpStatus2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
961
|
+
HttpStatus2[HttpStatus2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
962
|
+
HttpStatus2[HttpStatus2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
963
|
+
HttpStatus2[HttpStatus2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
964
|
+
HttpStatus2[HttpStatus2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
965
|
+
HttpStatus2[HttpStatus2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
966
|
+
HttpStatus2[HttpStatus2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
967
|
+
HttpStatus2[HttpStatus2["CONFLICT"] = 409] = "CONFLICT";
|
|
968
|
+
HttpStatus2[HttpStatus2["GONE"] = 410] = "GONE";
|
|
969
|
+
HttpStatus2[HttpStatus2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
970
|
+
HttpStatus2[HttpStatus2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
971
|
+
HttpStatus2[HttpStatus2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
972
|
+
HttpStatus2[HttpStatus2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
973
|
+
HttpStatus2[HttpStatus2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
974
|
+
HttpStatus2[HttpStatus2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
|
|
975
|
+
HttpStatus2[HttpStatus2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
976
|
+
HttpStatus2[HttpStatus2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
|
|
977
|
+
HttpStatus2[HttpStatus2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
978
|
+
HttpStatus2[HttpStatus2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
979
|
+
HttpStatus2[HttpStatus2["LOCKED"] = 423] = "LOCKED";
|
|
980
|
+
HttpStatus2[HttpStatus2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
981
|
+
HttpStatus2[HttpStatus2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
982
|
+
HttpStatus2[HttpStatus2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
983
|
+
HttpStatus2[HttpStatus2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
984
|
+
HttpStatus2[HttpStatus2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
985
|
+
HttpStatus2[HttpStatus2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
986
|
+
HttpStatus2[HttpStatus2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
987
|
+
HttpStatus2[HttpStatus2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
988
|
+
HttpStatus2[HttpStatus2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
989
|
+
HttpStatus2[HttpStatus2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
990
|
+
HttpStatus2[HttpStatus2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
991
|
+
HttpStatus2[HttpStatus2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
992
|
+
HttpStatus2[HttpStatus2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
993
|
+
HttpStatus2[HttpStatus2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
994
|
+
HttpStatus2[HttpStatus2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
995
|
+
HttpStatus2[HttpStatus2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
996
|
+
HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
997
|
+
HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
998
|
+
return HttpStatus2;
|
|
999
|
+
})({});
|
|
1000
|
+
|
|
1001
|
+
// src/enums/language-code.ts
|
|
1002
|
+
var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
|
|
1003
|
+
LanguageCode2["CS"] = "cs";
|
|
1004
|
+
LanguageCode2["EN"] = "en";
|
|
1005
|
+
LanguageCode2["DE"] = "de";
|
|
1006
|
+
LanguageCode2["PL"] = "pl";
|
|
1007
|
+
LanguageCode2["SK"] = "sk";
|
|
1008
|
+
return LanguageCode2;
|
|
1009
|
+
})({});
|
|
1010
|
+
|
|
1011
|
+
// src/enums/payment-method.ts
|
|
1012
|
+
var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
|
|
1013
|
+
PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
|
|
1014
|
+
PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
|
|
1015
|
+
PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
|
|
1016
|
+
PaymentMethod2[PaymentMethod2["CREDIT"] = 3] = "CREDIT";
|
|
1017
|
+
return PaymentMethod2;
|
|
1018
|
+
})({});
|
|
1019
|
+
|
|
1020
|
+
// src/enums/transaction-type.ts
|
|
1021
|
+
var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
|
|
1022
|
+
TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
|
|
1023
|
+
TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
|
|
1024
|
+
TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
|
|
1025
|
+
TransactionType2[TransactionType2["ADD"] = 3] = "ADD";
|
|
1026
|
+
TransactionType2[TransactionType2["DELIVERY"] = 4] = "DELIVERY";
|
|
1027
|
+
TransactionType2[TransactionType2["DEPOT_WRITEOFF"] = 5] = "DEPOT_WRITEOFF";
|
|
1028
|
+
TransactionType2[TransactionType2["DEPOT_ADD"] = 6] = "DEPOT_ADD";
|
|
1029
|
+
TransactionType2[TransactionType2["RETURN"] = 7] = "RETURN";
|
|
1030
|
+
TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
|
|
1031
|
+
TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
|
|
1032
|
+
return TransactionType2;
|
|
1033
|
+
})({});
|
|
1034
|
+
|
|
1035
|
+
// src/core/errors/errors.ts
|
|
1036
|
+
var _BadRequestError = class _BadRequestError extends FreshError {
|
|
1037
|
+
constructor(detail, options) {
|
|
1038
|
+
super(HttpStatus.BAD_REQUEST, "validation-error", detail, options);
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
__name(_BadRequestError, "BadRequestError");
|
|
1042
|
+
var BadRequestError = _BadRequestError;
|
|
1043
|
+
var _UnauthorizedError = class _UnauthorizedError extends FreshError {
|
|
1044
|
+
constructor(detail, options) {
|
|
1045
|
+
super(HttpStatus.UNAUTHORIZED, "not-authenticated", detail, options);
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
__name(_UnauthorizedError, "UnauthorizedError");
|
|
1049
|
+
var UnauthorizedError = _UnauthorizedError;
|
|
1050
|
+
var _PaymentRequiredError = class _PaymentRequiredError extends FreshError {
|
|
1051
|
+
constructor(detail, options) {
|
|
1052
|
+
super(HttpStatus.PAYMENT_REQUIRED, "error", detail, options);
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
__name(_PaymentRequiredError, "PaymentRequiredError");
|
|
1056
|
+
var PaymentRequiredError = _PaymentRequiredError;
|
|
1057
|
+
var _ForbiddenError = class _ForbiddenError extends FreshError {
|
|
1058
|
+
constructor(detail, options) {
|
|
1059
|
+
super(HttpStatus.FORBIDDEN, "not-authorized", detail, options);
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
__name(_ForbiddenError, "ForbiddenError");
|
|
1063
|
+
var ForbiddenError = _ForbiddenError;
|
|
1064
|
+
var _NotFoundError = class _NotFoundError extends FreshError {
|
|
1065
|
+
constructor(detail, options) {
|
|
1066
|
+
super(HttpStatus.NOT_FOUND, "error", detail, options);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
__name(_NotFoundError, "NotFoundError");
|
|
1070
|
+
var NotFoundError = _NotFoundError;
|
|
1071
|
+
var _MethodNotAllowedError = class _MethodNotAllowedError extends FreshError {
|
|
1072
|
+
constructor(detail, options) {
|
|
1073
|
+
super(HttpStatus.METHOD_NOT_ALLOWED, "error", detail, options);
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
__name(_MethodNotAllowedError, "MethodNotAllowedError");
|
|
1077
|
+
var MethodNotAllowedError = _MethodNotAllowedError;
|
|
1078
|
+
var _NotAcceptableError = class _NotAcceptableError extends FreshError {
|
|
1079
|
+
constructor(detail, options) {
|
|
1080
|
+
super(HttpStatus.NOT_ACCEPTABLE, "error", detail, options);
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
__name(_NotAcceptableError, "NotAcceptableError");
|
|
1084
|
+
var NotAcceptableError = _NotAcceptableError;
|
|
1085
|
+
var _ProxyAuthenticationRequiredError = class _ProxyAuthenticationRequiredError extends FreshError {
|
|
1086
|
+
constructor(detail, options) {
|
|
1087
|
+
super(HttpStatus.PROXY_AUTHENTICATION_REQUIRED, "not-authenticated", detail, options);
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
__name(_ProxyAuthenticationRequiredError, "ProxyAuthenticationRequiredError");
|
|
1091
|
+
var ProxyAuthenticationRequiredError = _ProxyAuthenticationRequiredError;
|
|
1092
|
+
var _RequestTimeoutError = class _RequestTimeoutError extends FreshError {
|
|
1093
|
+
constructor(detail, options) {
|
|
1094
|
+
super(HttpStatus.REQUEST_TIMEOUT, "error", detail, options);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
__name(_RequestTimeoutError, "RequestTimeoutError");
|
|
1098
|
+
var RequestTimeoutError = _RequestTimeoutError;
|
|
1099
|
+
var _ConflictError = class _ConflictError extends FreshError {
|
|
1100
|
+
constructor(detail, options) {
|
|
1101
|
+
super(HttpStatus.CONFLICT, "error", detail, options);
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
__name(_ConflictError, "ConflictError");
|
|
1105
|
+
var ConflictError = _ConflictError;
|
|
1106
|
+
var _GoneError = class _GoneError extends FreshError {
|
|
1107
|
+
constructor(detail, options) {
|
|
1108
|
+
super(HttpStatus.GONE, "error", detail, options);
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
__name(_GoneError, "GoneError");
|
|
1112
|
+
var GoneError = _GoneError;
|
|
1113
|
+
var _LengthRequiredError = class _LengthRequiredError extends FreshError {
|
|
1114
|
+
constructor(detail, options) {
|
|
1115
|
+
super(HttpStatus.LENGTH_REQUIRED, "error", detail, options);
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
__name(_LengthRequiredError, "LengthRequiredError");
|
|
1119
|
+
var LengthRequiredError = _LengthRequiredError;
|
|
1120
|
+
var _PreconditionFailedError = class _PreconditionFailedError extends FreshError {
|
|
1121
|
+
constructor(detail, options) {
|
|
1122
|
+
super(HttpStatus.PRECONDITION_FAILED, "error", detail, options);
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
__name(_PreconditionFailedError, "PreconditionFailedError");
|
|
1126
|
+
var PreconditionFailedError = _PreconditionFailedError;
|
|
1127
|
+
var _PayloadTooLargeError = class _PayloadTooLargeError extends FreshError {
|
|
1128
|
+
constructor(detail, options) {
|
|
1129
|
+
super(HttpStatus.PAYLOAD_TOO_LARGE, "error", detail, options);
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
__name(_PayloadTooLargeError, "PayloadTooLargeError");
|
|
1133
|
+
var PayloadTooLargeError = _PayloadTooLargeError;
|
|
1134
|
+
var _UriTooLongError = class _UriTooLongError extends FreshError {
|
|
1135
|
+
constructor(detail, options) {
|
|
1136
|
+
super(HttpStatus.URI_TOO_LONG, "error", detail, options);
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
__name(_UriTooLongError, "UriTooLongError");
|
|
1140
|
+
var UriTooLongError = _UriTooLongError;
|
|
1141
|
+
var _UnsupportedMediaTypeError = class _UnsupportedMediaTypeError extends FreshError {
|
|
1142
|
+
constructor(detail, options) {
|
|
1143
|
+
super(HttpStatus.UNSUPPORTED_MEDIA_TYPE, "error", detail, options);
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
__name(_UnsupportedMediaTypeError, "UnsupportedMediaTypeError");
|
|
1147
|
+
var UnsupportedMediaTypeError = _UnsupportedMediaTypeError;
|
|
1148
|
+
var _RangeNotSatisfiableError = class _RangeNotSatisfiableError extends FreshError {
|
|
1149
|
+
constructor(detail, options) {
|
|
1150
|
+
super(HttpStatus.RANGE_NOT_SATISFIABLE, "error", detail, options);
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
__name(_RangeNotSatisfiableError, "RangeNotSatisfiableError");
|
|
1154
|
+
var RangeNotSatisfiableError = _RangeNotSatisfiableError;
|
|
1155
|
+
var _ExpectationFailedError = class _ExpectationFailedError extends FreshError {
|
|
1156
|
+
constructor(detail, options) {
|
|
1157
|
+
super(HttpStatus.EXPECTATION_FAILED, "error", detail, options);
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
__name(_ExpectationFailedError, "ExpectationFailedError");
|
|
1161
|
+
var ExpectationFailedError = _ExpectationFailedError;
|
|
1162
|
+
var _ImATeapotError = class _ImATeapotError extends FreshError {
|
|
1163
|
+
constructor(detail, options) {
|
|
1164
|
+
super(HttpStatus.IM_A_TEAPOT, "error", detail, options);
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
__name(_ImATeapotError, "ImATeapotError");
|
|
1168
|
+
var ImATeapotError = _ImATeapotError;
|
|
1169
|
+
var _MisdirectedRequestError = class _MisdirectedRequestError extends FreshError {
|
|
1170
|
+
constructor(detail, options) {
|
|
1171
|
+
super(HttpStatus.MISDIRECTED_REQUEST, "error", detail, options);
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
__name(_MisdirectedRequestError, "MisdirectedRequestError");
|
|
1175
|
+
var MisdirectedRequestError = _MisdirectedRequestError;
|
|
1176
|
+
var _UnprocessableEntityError = class _UnprocessableEntityError extends FreshError {
|
|
1177
|
+
constructor(detail, options) {
|
|
1178
|
+
super(HttpStatus.UNPROCESSABLE_ENTITY, "validation-error", detail, options);
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
__name(_UnprocessableEntityError, "UnprocessableEntityError");
|
|
1182
|
+
var UnprocessableEntityError = _UnprocessableEntityError;
|
|
1183
|
+
var _LockedError = class _LockedError extends FreshError {
|
|
1184
|
+
constructor(detail, options) {
|
|
1185
|
+
super(HttpStatus.LOCKED, "error", detail, options);
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
__name(_LockedError, "LockedError");
|
|
1189
|
+
var LockedError = _LockedError;
|
|
1190
|
+
var _FailedDependencyError = class _FailedDependencyError extends FreshError {
|
|
1191
|
+
constructor(detail, options) {
|
|
1192
|
+
super(HttpStatus.FAILED_DEPENDENCY, "error", detail, options);
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1195
|
+
__name(_FailedDependencyError, "FailedDependencyError");
|
|
1196
|
+
var FailedDependencyError = _FailedDependencyError;
|
|
1197
|
+
var _TooEarlyError = class _TooEarlyError extends FreshError {
|
|
1198
|
+
constructor(detail, options) {
|
|
1199
|
+
super(HttpStatus.TOO_EARLY, "error", detail, options);
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
__name(_TooEarlyError, "TooEarlyError");
|
|
1203
|
+
var TooEarlyError = _TooEarlyError;
|
|
1204
|
+
var _UpgradeRequiredError = class _UpgradeRequiredError extends FreshError {
|
|
1205
|
+
constructor(detail, options) {
|
|
1206
|
+
super(HttpStatus.UPGRADE_REQUIRED, "error", detail, options);
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
__name(_UpgradeRequiredError, "UpgradeRequiredError");
|
|
1210
|
+
var UpgradeRequiredError = _UpgradeRequiredError;
|
|
1211
|
+
var _PreconditionRequiredError = class _PreconditionRequiredError extends FreshError {
|
|
1212
|
+
constructor(detail, options) {
|
|
1213
|
+
super(HttpStatus.PRECONDITION_REQUIRED, "error", detail, options);
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
__name(_PreconditionRequiredError, "PreconditionRequiredError");
|
|
1217
|
+
var PreconditionRequiredError = _PreconditionRequiredError;
|
|
1218
|
+
var _TooManyRequestsError = class _TooManyRequestsError extends FreshError {
|
|
1219
|
+
constructor(detail, options) {
|
|
1220
|
+
super(HttpStatus.TOO_MANY_REQUESTS, "error", detail, options);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
__name(_TooManyRequestsError, "TooManyRequestsError");
|
|
1224
|
+
var TooManyRequestsError = _TooManyRequestsError;
|
|
1225
|
+
var _RequestHeaderFieldsTooLargeError = class _RequestHeaderFieldsTooLargeError extends FreshError {
|
|
1226
|
+
constructor(detail, options) {
|
|
1227
|
+
super(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE, "error", detail, options);
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
__name(_RequestHeaderFieldsTooLargeError, "RequestHeaderFieldsTooLargeError");
|
|
1231
|
+
var RequestHeaderFieldsTooLargeError = _RequestHeaderFieldsTooLargeError;
|
|
1232
|
+
var _UnavailableForLegalReasonsError = class _UnavailableForLegalReasonsError extends FreshError {
|
|
1233
|
+
constructor(detail, options) {
|
|
1234
|
+
super(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS, "error", detail, options);
|
|
1235
|
+
}
|
|
1236
|
+
};
|
|
1237
|
+
__name(_UnavailableForLegalReasonsError, "UnavailableForLegalReasonsError");
|
|
1238
|
+
var UnavailableForLegalReasonsError = _UnavailableForLegalReasonsError;
|
|
1239
|
+
var _InternalServerError = class _InternalServerError extends FreshError {
|
|
1240
|
+
constructor(detail, options) {
|
|
1241
|
+
super(HttpStatus.INTERNAL_SERVER_ERROR, "internal-server-error", detail, options);
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
__name(_InternalServerError, "InternalServerError");
|
|
1245
|
+
var InternalServerError = _InternalServerError;
|
|
1246
|
+
var _NotImplementedError = class _NotImplementedError extends FreshError {
|
|
1247
|
+
constructor(detail, options) {
|
|
1248
|
+
super(HttpStatus.NOT_IMPLEMENTED, "internal-server-error", detail, options);
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
__name(_NotImplementedError, "NotImplementedError");
|
|
1252
|
+
var NotImplementedError = _NotImplementedError;
|
|
1253
|
+
var _BadGatewayError = class _BadGatewayError extends FreshError {
|
|
1254
|
+
constructor(detail, options) {
|
|
1255
|
+
super(HttpStatus.BAD_GATEWAY, "internal-server-error", detail, options);
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
__name(_BadGatewayError, "BadGatewayError");
|
|
1259
|
+
var BadGatewayError = _BadGatewayError;
|
|
1260
|
+
var _ServiceUnavailableError = class _ServiceUnavailableError extends FreshError {
|
|
1261
|
+
constructor(detail, options) {
|
|
1262
|
+
super(HttpStatus.SERVICE_UNAVAILABLE, "internal-server-error", detail, options);
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
__name(_ServiceUnavailableError, "ServiceUnavailableError");
|
|
1266
|
+
var ServiceUnavailableError = _ServiceUnavailableError;
|
|
1267
|
+
var _GatewayTimeoutError = class _GatewayTimeoutError extends FreshError {
|
|
1268
|
+
constructor(detail, options) {
|
|
1269
|
+
super(HttpStatus.GATEWAY_TIMEOUT, "internal-server-error", detail, options);
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
__name(_GatewayTimeoutError, "GatewayTimeoutError");
|
|
1273
|
+
var GatewayTimeoutError = _GatewayTimeoutError;
|
|
1274
|
+
var _HttpVersionNotSupportedError = class _HttpVersionNotSupportedError extends FreshError {
|
|
1275
|
+
constructor(detail, options) {
|
|
1276
|
+
super(HttpStatus.HTTP_VERSION_NOT_SUPPORTED, "internal-server-error", detail, options);
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
__name(_HttpVersionNotSupportedError, "HttpVersionNotSupportedError");
|
|
1280
|
+
var HttpVersionNotSupportedError = _HttpVersionNotSupportedError;
|
|
1281
|
+
var _VariantAlsoNegotiatesError = class _VariantAlsoNegotiatesError extends FreshError {
|
|
1282
|
+
constructor(detail, options) {
|
|
1283
|
+
super(HttpStatus.VARIANT_ALSO_NEGOTIATES, "internal-server-error", detail, options);
|
|
1284
|
+
}
|
|
1285
|
+
};
|
|
1286
|
+
__name(_VariantAlsoNegotiatesError, "VariantAlsoNegotiatesError");
|
|
1287
|
+
var VariantAlsoNegotiatesError = _VariantAlsoNegotiatesError;
|
|
1288
|
+
var _InsufficientStorageError = class _InsufficientStorageError extends FreshError {
|
|
1289
|
+
constructor(detail, options) {
|
|
1290
|
+
super(HttpStatus.INSUFFICIENT_STORAGE, "internal-server-error", detail, options);
|
|
1291
|
+
}
|
|
1292
|
+
};
|
|
1293
|
+
__name(_InsufficientStorageError, "InsufficientStorageError");
|
|
1294
|
+
var InsufficientStorageError = _InsufficientStorageError;
|
|
1295
|
+
var _LoopDetectedError = class _LoopDetectedError extends FreshError {
|
|
1296
|
+
constructor(detail, options) {
|
|
1297
|
+
super(HttpStatus.LOOP_DETECTED, "internal-server-error", detail, options);
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
__name(_LoopDetectedError, "LoopDetectedError");
|
|
1301
|
+
var LoopDetectedError = _LoopDetectedError;
|
|
1302
|
+
var _NotExtendedError = class _NotExtendedError extends FreshError {
|
|
1303
|
+
constructor(detail, options) {
|
|
1304
|
+
super(HttpStatus.NOT_EXTENDED, "internal-server-error", detail, options);
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1307
|
+
__name(_NotExtendedError, "NotExtendedError");
|
|
1308
|
+
var NotExtendedError = _NotExtendedError;
|
|
1309
|
+
var _NetworkAuthenticationRequiredError = class _NetworkAuthenticationRequiredError extends FreshError {
|
|
1310
|
+
constructor(detail, options) {
|
|
1311
|
+
super(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED, "internal-server-error", detail, options);
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
__name(_NetworkAuthenticationRequiredError, "NetworkAuthenticationRequiredError");
|
|
1315
|
+
var NetworkAuthenticationRequiredError = _NetworkAuthenticationRequiredError;
|
|
1316
|
+
|
|
1317
|
+
// src/core/data-helper.ts
|
|
1318
|
+
var _DataHelper = class _DataHelper {
|
|
1319
|
+
constructor(startDataRetrieve = true, deviceIds) {
|
|
1320
|
+
__publicField(this, "_data");
|
|
1321
|
+
__publicField(this, "_dataPromise", null);
|
|
1322
|
+
__publicField(this, "deviceIds");
|
|
1323
|
+
this.deviceIds = deviceIds;
|
|
1324
|
+
if (startDataRetrieve) {
|
|
1325
|
+
this._dataPromise = this.startDataRetrieval();
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
get data() {
|
|
1329
|
+
return this._data;
|
|
1330
|
+
}
|
|
1331
|
+
set data(value) {
|
|
1332
|
+
this._data = value;
|
|
1333
|
+
}
|
|
1334
|
+
get dataPromise() {
|
|
1335
|
+
return this._dataPromise;
|
|
1336
|
+
}
|
|
1337
|
+
set dataPromise(value) {
|
|
1338
|
+
this._dataPromise = value;
|
|
1339
|
+
}
|
|
1340
|
+
async getData() {
|
|
1341
|
+
if (this._dataPromise) {
|
|
1342
|
+
return await this._dataPromise;
|
|
1343
|
+
}
|
|
1344
|
+
if (this._data === void 0) {
|
|
1345
|
+
this._dataPromise = this.startDataRetrieval();
|
|
1346
|
+
return this._dataPromise;
|
|
1347
|
+
}
|
|
1348
|
+
return this._data;
|
|
1349
|
+
}
|
|
1350
|
+
};
|
|
1351
|
+
__name(_DataHelper, "DataHelper");
|
|
1352
|
+
var DataHelper = _DataHelper;
|
|
1353
|
+
|
|
1354
|
+
// src/common/pagination/find-options/pagination.ts
|
|
1355
|
+
function buildPagination(page, limit) {
|
|
1356
|
+
if (page === void 0 && limit === void 0) {
|
|
1357
|
+
return void 0;
|
|
1358
|
+
}
|
|
1359
|
+
if (page !== void 0 && page < 1 || limit !== void 0 && limit < 0) {
|
|
1360
|
+
throw new ApiError(HttpStatus.BAD_REQUEST, "validation-error", "Pagination parameters cannot be negative");
|
|
1361
|
+
}
|
|
1362
|
+
const p = page != null ? page : 1;
|
|
1363
|
+
const l = limit != null ? limit : 1e3;
|
|
1364
|
+
return {
|
|
1365
|
+
page: p,
|
|
1366
|
+
limit: l,
|
|
1367
|
+
skip: (p - 1) * l
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
__name(buildPagination, "buildPagination");
|
|
1371
|
+
|
|
1372
|
+
// src/common/pagination/constructors.ts
|
|
1373
|
+
function constructTypeormPagination(params) {
|
|
1374
|
+
return {
|
|
1375
|
+
take: params.limit,
|
|
1376
|
+
skip: params.skip
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
__name(constructTypeormPagination, "constructTypeormPagination");
|
|
1380
|
+
function parsePaginationFromURL(searchParams) {
|
|
1381
|
+
var _a, _b;
|
|
1382
|
+
const page = Math.max(1, parseInt((_a = searchParams.get("page")) != null ? _a : "1", 10));
|
|
1383
|
+
const limit = Math.min(100, Math.max(1, parseInt((_b = searchParams.get("limit")) != null ? _b : "20", 10)));
|
|
1384
|
+
return {
|
|
1385
|
+
page,
|
|
1386
|
+
limit,
|
|
1387
|
+
skip: (page - 1) * limit
|
|
753
1388
|
};
|
|
754
1389
|
}
|
|
755
1390
|
__name(parsePaginationFromURL, "parsePaginationFromURL");
|
|
@@ -799,37 +1434,51 @@ async function listAll(fetchPage, batchSize = 1e3) {
|
|
|
799
1434
|
}
|
|
800
1435
|
__name(listAll, "listAll");
|
|
801
1436
|
|
|
802
|
-
// src/common/
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1437
|
+
// src/common/promise-magic/deferred.ts
|
|
1438
|
+
function createDeferred() {
|
|
1439
|
+
let resolve;
|
|
1440
|
+
let reject;
|
|
1441
|
+
const promise = new Promise((res, rej) => {
|
|
1442
|
+
resolve = res;
|
|
1443
|
+
reject = rej;
|
|
1444
|
+
});
|
|
1445
|
+
return {
|
|
1446
|
+
promise,
|
|
1447
|
+
resolve,
|
|
1448
|
+
reject
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
__name(createDeferred, "createDeferred");
|
|
1452
|
+
|
|
1453
|
+
// src/common/promise-magic/single-promise-waiter.ts
|
|
1454
|
+
var _SinglePromiseWaiter = class _SinglePromiseWaiter {
|
|
1455
|
+
constructor() {
|
|
1456
|
+
__publicField(this, "_promise", null);
|
|
1457
|
+
}
|
|
1458
|
+
static getInstance() {
|
|
1459
|
+
if (!_SinglePromiseWaiter._instance) {
|
|
1460
|
+
_SinglePromiseWaiter._instance = new _SinglePromiseWaiter();
|
|
823
1461
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1462
|
+
return _SinglePromiseWaiter._instance;
|
|
1463
|
+
}
|
|
1464
|
+
get promise() {
|
|
1465
|
+
return this._promise;
|
|
1466
|
+
}
|
|
1467
|
+
set promise(promise) {
|
|
1468
|
+
if (promise !== null) {
|
|
1469
|
+
this._promise = promise;
|
|
1470
|
+
this._promise.finally(() => {
|
|
1471
|
+
this._promise = null;
|
|
1472
|
+
});
|
|
830
1473
|
}
|
|
831
1474
|
}
|
|
1475
|
+
get hasPromise() {
|
|
1476
|
+
return this._promise !== null;
|
|
1477
|
+
}
|
|
832
1478
|
};
|
|
1479
|
+
__name(_SinglePromiseWaiter, "SinglePromiseWaiter");
|
|
1480
|
+
__publicField(_SinglePromiseWaiter, "_instance");
|
|
1481
|
+
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
833
1482
|
|
|
834
1483
|
// src/common/schema/entities/category.entity.ts
|
|
835
1484
|
import { Entity } from "typeorm";
|
|
@@ -968,178 +1617,53 @@ import { Column as Column2 } from "typeorm";
|
|
|
968
1617
|
function TimestampColumn(options = {}) {
|
|
969
1618
|
const defaultOptions = {
|
|
970
1619
|
type: "timestamptz",
|
|
971
|
-
nullable: false,
|
|
972
|
-
default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
|
|
973
|
-
...options
|
|
974
|
-
};
|
|
975
|
-
return Column2(defaultOptions);
|
|
976
|
-
}
|
|
977
|
-
__name(TimestampColumn, "TimestampColumn");
|
|
978
|
-
|
|
979
|
-
// src/database/entities/fresh-hyper-entity.ts
|
|
980
|
-
function _ts_decorate2(decorators, target, key, desc) {
|
|
981
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
982
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
983
|
-
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;
|
|
984
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
985
|
-
}
|
|
986
|
-
__name(_ts_decorate2, "_ts_decorate");
|
|
987
|
-
function _ts_metadata2(k, v) {
|
|
988
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
989
|
-
}
|
|
990
|
-
__name(_ts_metadata2, "_ts_metadata");
|
|
991
|
-
var _FreshHyperEntity = class _FreshHyperEntity extends BaseEntity2 {
|
|
992
|
-
/** After manual construction `id` is irrelevant */
|
|
993
|
-
constructor(timestamp) {
|
|
994
|
-
super();
|
|
995
|
-
// input timestamp as PK
|
|
996
|
-
__publicField(this, "timestamp");
|
|
997
|
-
// just info column about time of insert
|
|
998
|
-
__publicField(this, "created_at");
|
|
999
|
-
this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
|
|
1000
|
-
this.created_at = /* @__PURE__ */ new Date();
|
|
1001
|
-
}
|
|
1002
|
-
};
|
|
1003
|
-
__name(_FreshHyperEntity, "FreshHyperEntity");
|
|
1004
|
-
var FreshHyperEntity = _FreshHyperEntity;
|
|
1005
|
-
_ts_decorate2([
|
|
1006
|
-
PrimaryColumn({
|
|
1007
|
-
type: "timestamptz"
|
|
1008
|
-
}),
|
|
1009
|
-
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1010
|
-
], FreshHyperEntity.prototype, "timestamp", void 0);
|
|
1011
|
-
_ts_decorate2([
|
|
1012
|
-
TimestampColumn(),
|
|
1013
|
-
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1014
|
-
], FreshHyperEntity.prototype, "created_at", void 0);
|
|
1015
|
-
|
|
1016
|
-
// src/database/entities/fresh-translation-entity.ts
|
|
1017
|
-
import { PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column3, BaseEntity as BaseEntity3, Check } from "typeorm";
|
|
1018
|
-
|
|
1019
|
-
// src/enums/action-command-code.ts
|
|
1020
|
-
var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
|
|
1021
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
|
|
1022
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
|
|
1023
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
|
|
1024
|
-
ActionCommandCode2[ActionCommandCode2["RESTART_REMOTE_CONTROL"] = 4] = "RESTART_REMOTE_CONTROL";
|
|
1025
|
-
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE"] = 5] = "SYNCHRONIZE";
|
|
1026
|
-
ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
|
|
1027
|
-
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
|
|
1028
|
-
return ActionCommandCode2;
|
|
1029
|
-
})({});
|
|
1030
|
-
|
|
1031
|
-
// src/enums/depot-pool-status.ts
|
|
1032
|
-
var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
|
|
1033
|
-
DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
|
|
1034
|
-
DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
|
|
1035
|
-
DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
|
|
1036
|
-
DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
|
|
1037
|
-
DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
|
|
1038
|
-
return DepotPoolStatus2;
|
|
1039
|
-
})({});
|
|
1040
|
-
|
|
1041
|
-
// src/enums/http-status.ts
|
|
1042
|
-
var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
|
|
1043
|
-
HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
|
|
1044
|
-
HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
1045
|
-
HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
|
|
1046
|
-
HttpStatus2[HttpStatus2["EARLY_HINTS"] = 103] = "EARLY_HINTS";
|
|
1047
|
-
HttpStatus2[HttpStatus2["OK"] = 200] = "OK";
|
|
1048
|
-
HttpStatus2[HttpStatus2["CREATED"] = 201] = "CREATED";
|
|
1049
|
-
HttpStatus2[HttpStatus2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
1050
|
-
HttpStatus2[HttpStatus2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
1051
|
-
HttpStatus2[HttpStatus2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
1052
|
-
HttpStatus2[HttpStatus2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
1053
|
-
HttpStatus2[HttpStatus2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
1054
|
-
HttpStatus2[HttpStatus2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
1055
|
-
HttpStatus2[HttpStatus2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
1056
|
-
HttpStatus2[HttpStatus2["IM_USED"] = 226] = "IM_USED";
|
|
1057
|
-
HttpStatus2[HttpStatus2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
1058
|
-
HttpStatus2[HttpStatus2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
1059
|
-
HttpStatus2[HttpStatus2["FOUND"] = 302] = "FOUND";
|
|
1060
|
-
HttpStatus2[HttpStatus2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
1061
|
-
HttpStatus2[HttpStatus2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
1062
|
-
HttpStatus2[HttpStatus2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
1063
|
-
HttpStatus2[HttpStatus2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
1064
|
-
HttpStatus2[HttpStatus2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
1065
|
-
HttpStatus2[HttpStatus2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
1066
|
-
HttpStatus2[HttpStatus2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
1067
|
-
HttpStatus2[HttpStatus2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
1068
|
-
HttpStatus2[HttpStatus2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
1069
|
-
HttpStatus2[HttpStatus2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
1070
|
-
HttpStatus2[HttpStatus2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
1071
|
-
HttpStatus2[HttpStatus2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
1072
|
-
HttpStatus2[HttpStatus2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
1073
|
-
HttpStatus2[HttpStatus2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
1074
|
-
HttpStatus2[HttpStatus2["CONFLICT"] = 409] = "CONFLICT";
|
|
1075
|
-
HttpStatus2[HttpStatus2["GONE"] = 410] = "GONE";
|
|
1076
|
-
HttpStatus2[HttpStatus2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
1077
|
-
HttpStatus2[HttpStatus2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
1078
|
-
HttpStatus2[HttpStatus2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
1079
|
-
HttpStatus2[HttpStatus2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
1080
|
-
HttpStatus2[HttpStatus2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
1081
|
-
HttpStatus2[HttpStatus2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
|
|
1082
|
-
HttpStatus2[HttpStatus2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
1083
|
-
HttpStatus2[HttpStatus2["IM_A_TEAPOT"] = 418] = "IM_A_TEAPOT";
|
|
1084
|
-
HttpStatus2[HttpStatus2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
1085
|
-
HttpStatus2[HttpStatus2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
1086
|
-
HttpStatus2[HttpStatus2["LOCKED"] = 423] = "LOCKED";
|
|
1087
|
-
HttpStatus2[HttpStatus2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
1088
|
-
HttpStatus2[HttpStatus2["TOO_EARLY"] = 425] = "TOO_EARLY";
|
|
1089
|
-
HttpStatus2[HttpStatus2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
1090
|
-
HttpStatus2[HttpStatus2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
1091
|
-
HttpStatus2[HttpStatus2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
1092
|
-
HttpStatus2[HttpStatus2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
1093
|
-
HttpStatus2[HttpStatus2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
1094
|
-
HttpStatus2[HttpStatus2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
1095
|
-
HttpStatus2[HttpStatus2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
1096
|
-
HttpStatus2[HttpStatus2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
1097
|
-
HttpStatus2[HttpStatus2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
1098
|
-
HttpStatus2[HttpStatus2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
1099
|
-
HttpStatus2[HttpStatus2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
1100
|
-
HttpStatus2[HttpStatus2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
1101
|
-
HttpStatus2[HttpStatus2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
1102
|
-
HttpStatus2[HttpStatus2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
1103
|
-
HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
1104
|
-
HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
1105
|
-
return HttpStatus2;
|
|
1106
|
-
})({});
|
|
1107
|
-
|
|
1108
|
-
// src/enums/language-code.ts
|
|
1109
|
-
var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
|
|
1110
|
-
LanguageCode2["CS"] = "cs";
|
|
1111
|
-
LanguageCode2["EN"] = "en";
|
|
1112
|
-
LanguageCode2["DE"] = "de";
|
|
1113
|
-
LanguageCode2["PL"] = "pl";
|
|
1114
|
-
LanguageCode2["SK"] = "sk";
|
|
1115
|
-
return LanguageCode2;
|
|
1116
|
-
})({});
|
|
1117
|
-
|
|
1118
|
-
// src/enums/payment-method.ts
|
|
1119
|
-
var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
|
|
1120
|
-
PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
|
|
1121
|
-
PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
|
|
1122
|
-
PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
|
|
1123
|
-
PaymentMethod2[PaymentMethod2["CREDIT"] = 3] = "CREDIT";
|
|
1124
|
-
return PaymentMethod2;
|
|
1125
|
-
})({});
|
|
1620
|
+
nullable: false,
|
|
1621
|
+
default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
|
|
1622
|
+
...options
|
|
1623
|
+
};
|
|
1624
|
+
return Column2(defaultOptions);
|
|
1625
|
+
}
|
|
1626
|
+
__name(TimestampColumn, "TimestampColumn");
|
|
1126
1627
|
|
|
1127
|
-
// src/
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1628
|
+
// src/database/entities/fresh-hyper-entity.ts
|
|
1629
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
1630
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1631
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1632
|
+
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;
|
|
1633
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1634
|
+
}
|
|
1635
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
1636
|
+
function _ts_metadata2(k, v) {
|
|
1637
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1638
|
+
}
|
|
1639
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
1640
|
+
var _FreshHyperEntity = class _FreshHyperEntity extends BaseEntity2 {
|
|
1641
|
+
/** After manual construction `id` is irrelevant */
|
|
1642
|
+
constructor(timestamp) {
|
|
1643
|
+
super();
|
|
1644
|
+
// input timestamp as PK
|
|
1645
|
+
__publicField(this, "timestamp");
|
|
1646
|
+
// just info column about time of insert
|
|
1647
|
+
__publicField(this, "created_at");
|
|
1648
|
+
this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
|
|
1649
|
+
this.created_at = /* @__PURE__ */ new Date();
|
|
1650
|
+
}
|
|
1651
|
+
};
|
|
1652
|
+
__name(_FreshHyperEntity, "FreshHyperEntity");
|
|
1653
|
+
var FreshHyperEntity = _FreshHyperEntity;
|
|
1654
|
+
_ts_decorate2([
|
|
1655
|
+
PrimaryColumn({
|
|
1656
|
+
type: "timestamptz"
|
|
1657
|
+
}),
|
|
1658
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1659
|
+
], FreshHyperEntity.prototype, "timestamp", void 0);
|
|
1660
|
+
_ts_decorate2([
|
|
1661
|
+
TimestampColumn(),
|
|
1662
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1663
|
+
], FreshHyperEntity.prototype, "created_at", void 0);
|
|
1141
1664
|
|
|
1142
1665
|
// src/database/entities/fresh-translation-entity.ts
|
|
1666
|
+
import { PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column3, BaseEntity as BaseEntity3, Check } from "typeorm";
|
|
1143
1667
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
1144
1668
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1145
1669
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1468,6 +1992,23 @@ async function runWithConcurrency(items, concurrency, worker) {
|
|
|
1468
1992
|
}
|
|
1469
1993
|
__name(runWithConcurrency, "runWithConcurrency");
|
|
1470
1994
|
|
|
1995
|
+
// src/common/utils/id-path-param-resolver.utils.ts
|
|
1996
|
+
function resolvePathParameterId(id) {
|
|
1997
|
+
return /^\d+$/.test(id) ? parseInt(id, 10) : id;
|
|
1998
|
+
}
|
|
1999
|
+
__name(resolvePathParameterId, "resolvePathParameterId");
|
|
2000
|
+
|
|
2001
|
+
// src/common/utils/is-cron-valid.ts
|
|
2002
|
+
function isValidCron(expr) {
|
|
2003
|
+
const parts = expr.trim().split(/\s+/);
|
|
2004
|
+
if (parts.length < 5 || parts.length > 6) {
|
|
2005
|
+
return false;
|
|
2006
|
+
}
|
|
2007
|
+
const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
|
|
2008
|
+
return parts.every((part) => cronPart.test(part));
|
|
2009
|
+
}
|
|
2010
|
+
__name(isValidCron, "isValidCron");
|
|
2011
|
+
|
|
1471
2012
|
// src/common/utils/patch.utils.ts
|
|
1472
2013
|
function buildPatch(data, keys, transforms) {
|
|
1473
2014
|
const patch = {};
|
|
@@ -1482,191 +2023,6 @@ function buildPatch(data, keys, transforms) {
|
|
|
1482
2023
|
}
|
|
1483
2024
|
__name(buildPatch, "buildPatch");
|
|
1484
2025
|
|
|
1485
|
-
// src/core/data-helper.ts
|
|
1486
|
-
var _DataHelper = class _DataHelper {
|
|
1487
|
-
constructor(startDataRetrieve = true, deviceIds) {
|
|
1488
|
-
__publicField(this, "_data");
|
|
1489
|
-
__publicField(this, "_dataPromise", null);
|
|
1490
|
-
__publicField(this, "deviceIds");
|
|
1491
|
-
this.deviceIds = deviceIds;
|
|
1492
|
-
if (startDataRetrieve) {
|
|
1493
|
-
this._dataPromise = this.startDataRetrieval();
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
get data() {
|
|
1497
|
-
return this._data;
|
|
1498
|
-
}
|
|
1499
|
-
set data(value) {
|
|
1500
|
-
this._data = value;
|
|
1501
|
-
}
|
|
1502
|
-
get dataPromise() {
|
|
1503
|
-
return this._dataPromise;
|
|
1504
|
-
}
|
|
1505
|
-
set dataPromise(value) {
|
|
1506
|
-
this._dataPromise = value;
|
|
1507
|
-
}
|
|
1508
|
-
async getData() {
|
|
1509
|
-
if (this._dataPromise) {
|
|
1510
|
-
return await this._dataPromise;
|
|
1511
|
-
}
|
|
1512
|
-
if (this._data === void 0) {
|
|
1513
|
-
this._dataPromise = this.startDataRetrieval();
|
|
1514
|
-
return this._dataPromise;
|
|
1515
|
-
}
|
|
1516
|
-
return this._data;
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
__name(_DataHelper, "DataHelper");
|
|
1520
|
-
var DataHelper = _DataHelper;
|
|
1521
|
-
|
|
1522
|
-
// src/core/class/fresh-job.ts
|
|
1523
|
-
import { scheduleJob } from "node-schedule";
|
|
1524
|
-
var _FreshJob = class _FreshJob extends Singleton {
|
|
1525
|
-
/**
|
|
1526
|
-
* Creates and optionally schedules a singleton cron job.
|
|
1527
|
-
*
|
|
1528
|
-
* @param jobName - Logical name of the job (used in logs and errors).
|
|
1529
|
-
* @param cronExpression - Cron expression consisting of numeric fields only.
|
|
1530
|
-
* Example: `0 5 * * 4`
|
|
1531
|
-
* The timezone `"Europe/Prague"` is applied automatically.
|
|
1532
|
-
*
|
|
1533
|
-
* @param jobEnabled - Whether the job should be scheduled immediately.
|
|
1534
|
-
* If `false`, the instance exists but no cron trigger is registered.
|
|
1535
|
-
*
|
|
1536
|
-
* @throws Error If the cron expression is invalid.
|
|
1537
|
-
* @throws Error If the job cannot be scheduled.
|
|
1538
|
-
*/
|
|
1539
|
-
constructor(jobName, cronExpression, jobEnabled) {
|
|
1540
|
-
super(false);
|
|
1541
|
-
/** Human-readable job identifier (used for logs and errors). */
|
|
1542
|
-
__publicField(this, "_jobName");
|
|
1543
|
-
/**
|
|
1544
|
-
* Cron expression defining when the job runs.
|
|
1545
|
-
*
|
|
1546
|
-
* Must contain numeric cron fields only.
|
|
1547
|
-
* Example: `0 5 * * 4`
|
|
1548
|
-
*
|
|
1549
|
-
* Timezone is always forced to `"Europe/Prague"`.
|
|
1550
|
-
* If you need another timezone, this class is not your friend.
|
|
1551
|
-
*/
|
|
1552
|
-
__publicField(this, "_cronExpression");
|
|
1553
|
-
/** Scheduled job instance, or `null` if the job is disabled. */
|
|
1554
|
-
__publicField(this, "_job", null);
|
|
1555
|
-
this._jobName = jobName;
|
|
1556
|
-
if (!isValidCron(cronExpression)) {
|
|
1557
|
-
throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
|
|
1558
|
-
}
|
|
1559
|
-
this._cronExpression = cronExpression;
|
|
1560
|
-
if (jobEnabled) {
|
|
1561
|
-
this._job = scheduleJob({
|
|
1562
|
-
rule: this._cronExpression,
|
|
1563
|
-
tz: "Europe/Prague"
|
|
1564
|
-
}, async () => {
|
|
1565
|
-
await this.invoke();
|
|
1566
|
-
});
|
|
1567
|
-
if (!this._job) {
|
|
1568
|
-
throw new Error(`Job ${this._jobName} could not be scheduled`);
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
this.onInit();
|
|
1572
|
-
}
|
|
1573
|
-
/**
|
|
1574
|
-
* Initialization hook.
|
|
1575
|
-
*
|
|
1576
|
-
* Called once during construction and used primarily for logging.
|
|
1577
|
-
* Can also be reused by subclasses if manual rescheduling is implemented.
|
|
1578
|
-
*
|
|
1579
|
-
* @param rescheduled - Indicates whether the job was reconfigured
|
|
1580
|
-
* after initial creation.
|
|
1581
|
-
*/
|
|
1582
|
-
onInit(rescheduled) {
|
|
1583
|
-
console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
|
|
1584
|
-
}
|
|
1585
|
-
/** @returns The logical name of the job. */
|
|
1586
|
-
get jobName() {
|
|
1587
|
-
return this._jobName;
|
|
1588
|
-
}
|
|
1589
|
-
/** Allows subclasses to rename the job if absolutely necessary. */
|
|
1590
|
-
set jobName(value) {
|
|
1591
|
-
this._jobName = value;
|
|
1592
|
-
}
|
|
1593
|
-
/** @returns The cron expression used to schedule the job. */
|
|
1594
|
-
get cronExpression() {
|
|
1595
|
-
return this._cronExpression;
|
|
1596
|
-
}
|
|
1597
|
-
/**
|
|
1598
|
-
* Allows subclasses to update the cron expression internally.
|
|
1599
|
-
* Does reschedule of job if exists
|
|
1600
|
-
*/
|
|
1601
|
-
set cronExpression(value) {
|
|
1602
|
-
if (!isValidCron(value)) {
|
|
1603
|
-
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${value}"`);
|
|
1604
|
-
}
|
|
1605
|
-
this._cronExpression = value;
|
|
1606
|
-
}
|
|
1607
|
-
/** @returns The underlying scheduled job instance, or `null` if disabled. */
|
|
1608
|
-
get job() {
|
|
1609
|
-
return this._job;
|
|
1610
|
-
}
|
|
1611
|
-
/** Allows subclasses to manage the scheduled job instance. */
|
|
1612
|
-
set job(value) {
|
|
1613
|
-
this._job = value;
|
|
1614
|
-
}
|
|
1615
|
-
reschedule(newCronExpression) {
|
|
1616
|
-
let result = false;
|
|
1617
|
-
if (!isValidCron(newCronExpression)) {
|
|
1618
|
-
throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${newCronExpression}"`);
|
|
1619
|
-
}
|
|
1620
|
-
this._cronExpression = newCronExpression;
|
|
1621
|
-
if (this._job) {
|
|
1622
|
-
const rescheduleSuccess = this._job.reschedule({
|
|
1623
|
-
rule: this._cronExpression,
|
|
1624
|
-
tz: "Europe/Prague"
|
|
1625
|
-
});
|
|
1626
|
-
if (!rescheduleSuccess) {
|
|
1627
|
-
throw new Error(`Job ${this._jobName} could not be re-scheduled`);
|
|
1628
|
-
} else {
|
|
1629
|
-
this.onInit(true);
|
|
1630
|
-
}
|
|
1631
|
-
result = rescheduleSuccess;
|
|
1632
|
-
}
|
|
1633
|
-
return result;
|
|
1634
|
-
}
|
|
1635
|
-
};
|
|
1636
|
-
__name(_FreshJob, "FreshJob");
|
|
1637
|
-
var FreshJob = _FreshJob;
|
|
1638
|
-
|
|
1639
|
-
// src/core/errors/api-error.ts
|
|
1640
|
-
var _ApiError = class _ApiError extends Error {
|
|
1641
|
-
constructor(statusCode, status, detail) {
|
|
1642
|
-
super();
|
|
1643
|
-
__publicField(this, "_statusCode");
|
|
1644
|
-
__publicField(this, "_statusDto");
|
|
1645
|
-
this._statusCode = statusCode;
|
|
1646
|
-
this._statusDto = new StatusDto(status, detail);
|
|
1647
|
-
}
|
|
1648
|
-
get statusCode() {
|
|
1649
|
-
return this._statusCode;
|
|
1650
|
-
}
|
|
1651
|
-
get statusDto() {
|
|
1652
|
-
return this._statusDto;
|
|
1653
|
-
}
|
|
1654
|
-
};
|
|
1655
|
-
__name(_ApiError, "ApiError");
|
|
1656
|
-
var ApiError = _ApiError;
|
|
1657
|
-
|
|
1658
|
-
// src/core/errors/business-warning.ts
|
|
1659
|
-
var _BusinessWarning = class _BusinessWarning extends Error {
|
|
1660
|
-
constructor(code, message) {
|
|
1661
|
-
super(message);
|
|
1662
|
-
__publicField(this, "code");
|
|
1663
|
-
this.code = code;
|
|
1664
|
-
this.name = "BusinessWarning";
|
|
1665
|
-
}
|
|
1666
|
-
};
|
|
1667
|
-
__name(_BusinessWarning, "BusinessWarning");
|
|
1668
|
-
var BusinessWarning = _BusinessWarning;
|
|
1669
|
-
|
|
1670
2026
|
// src/types/maybe-type.ts
|
|
1671
2027
|
function isMaybe(v, inner) {
|
|
1672
2028
|
return v === null || inner(v);
|
|
@@ -1859,32 +2215,76 @@ export {
|
|
|
1859
2215
|
AMOUNT_UNIT,
|
|
1860
2216
|
ActionCommandCode,
|
|
1861
2217
|
ApiError,
|
|
2218
|
+
BadGatewayError,
|
|
2219
|
+
BadRequestError,
|
|
1862
2220
|
BaseEntityChangeSubscriber,
|
|
1863
2221
|
BusinessWarning,
|
|
1864
2222
|
Category,
|
|
2223
|
+
ConflictError,
|
|
1865
2224
|
DEFAULT_PAGINATION_PARAMS,
|
|
1866
2225
|
DataHelper,
|
|
1867
2226
|
DateUtils,
|
|
1868
2227
|
DepotPoolStatus,
|
|
1869
2228
|
Device,
|
|
2229
|
+
ExpectationFailedError,
|
|
2230
|
+
FailedDependencyError,
|
|
2231
|
+
ForbiddenError,
|
|
1870
2232
|
FreshDao,
|
|
1871
2233
|
FreshEntity,
|
|
2234
|
+
FreshError,
|
|
1872
2235
|
FreshHyperEntity,
|
|
1873
2236
|
FreshJob,
|
|
1874
2237
|
FreshTranslationBase,
|
|
2238
|
+
GatewayTimeoutError,
|
|
2239
|
+
GoneError,
|
|
1875
2240
|
HttpStatus,
|
|
2241
|
+
HttpVersionNotSupportedError,
|
|
2242
|
+
ImATeapotError,
|
|
2243
|
+
InsufficientStorageError,
|
|
2244
|
+
InternalServerError,
|
|
1876
2245
|
LanguageCode,
|
|
2246
|
+
LengthRequiredError,
|
|
2247
|
+
LockedError,
|
|
2248
|
+
LoopDetectedError,
|
|
1877
2249
|
Manufacturer,
|
|
2250
|
+
MethodNotAllowedError,
|
|
2251
|
+
MisdirectedRequestError,
|
|
2252
|
+
NetworkAuthenticationRequiredError,
|
|
2253
|
+
NotAcceptableError,
|
|
2254
|
+
NotExtendedError,
|
|
2255
|
+
NotFoundError,
|
|
2256
|
+
NotImplementedError,
|
|
2257
|
+
PayloadTooLargeError,
|
|
1878
2258
|
PaymentMethod,
|
|
2259
|
+
PaymentRequiredError,
|
|
1879
2260
|
datasource_default as PgDataSourceOptions,
|
|
2261
|
+
PreconditionFailedError,
|
|
2262
|
+
PreconditionRequiredError,
|
|
1880
2263
|
Product,
|
|
2264
|
+
ProxyAuthenticationRequiredError,
|
|
2265
|
+
RangeNotSatisfiableError,
|
|
2266
|
+
RequestHeaderFieldsTooLargeError,
|
|
2267
|
+
RequestTimeoutError,
|
|
2268
|
+
ServiceUnavailableError,
|
|
1881
2269
|
SinglePromiseWaiter,
|
|
1882
2270
|
Singleton,
|
|
1883
2271
|
StatusDto,
|
|
1884
2272
|
Subcategory,
|
|
1885
2273
|
TO_BINARY_FLAG,
|
|
1886
2274
|
TimestampColumn,
|
|
2275
|
+
TooEarlyError,
|
|
2276
|
+
TooManyRequestsError,
|
|
1887
2277
|
TransactionType,
|
|
2278
|
+
UnauthorizedError,
|
|
2279
|
+
UnavailableForLegalReasonsError,
|
|
2280
|
+
UnprocessableEntityError,
|
|
2281
|
+
UnsupportedMediaTypeError,
|
|
2282
|
+
UpgradeRequiredError,
|
|
2283
|
+
UriTooLongError,
|
|
2284
|
+
VariantAlsoNegotiatesError,
|
|
2285
|
+
buildDateRange,
|
|
2286
|
+
buildOrder,
|
|
2287
|
+
buildPagination,
|
|
1888
2288
|
buildPatch,
|
|
1889
2289
|
constructTypeormPagination,
|
|
1890
2290
|
createDeferred,
|
|
@@ -1903,6 +2303,7 @@ export {
|
|
|
1903
2303
|
isValidCron,
|
|
1904
2304
|
listAll,
|
|
1905
2305
|
parsePaginationFromURL,
|
|
2306
|
+
resolvePathParameterId,
|
|
1906
2307
|
runWithConcurrency,
|
|
1907
2308
|
toDecimal
|
|
1908
2309
|
};
|