@freshpointcz/fresh-core 0.0.12 → 0.0.13
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +412 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +413 -162
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,6 +5,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
10
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
12
|
};
|
|
@@ -29,14 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
31
|
mod
|
|
30
32
|
));
|
|
31
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
var
|
|
33
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
34
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
35
|
-
if (decorator = decorators[i])
|
|
36
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
37
|
-
if (kind && result) __defProp(target, key, result);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
34
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
35
|
|
|
41
36
|
// ../../node_modules/dotenv/package.json
|
|
42
37
|
var require_package = __commonJS({
|
|
@@ -136,6 +131,7 @@ var require_main = __commonJS({
|
|
|
136
131
|
}
|
|
137
132
|
return obj;
|
|
138
133
|
}
|
|
134
|
+
__name(parse, "parse");
|
|
139
135
|
function _parseVault(options) {
|
|
140
136
|
options = options || {};
|
|
141
137
|
const vaultPath = _vaultPath(options);
|
|
@@ -163,15 +159,19 @@ var require_main = __commonJS({
|
|
|
163
159
|
}
|
|
164
160
|
return DotenvModule.parse(decrypted);
|
|
165
161
|
}
|
|
162
|
+
__name(_parseVault, "_parseVault");
|
|
166
163
|
function _warn(message) {
|
|
167
164
|
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
168
165
|
}
|
|
166
|
+
__name(_warn, "_warn");
|
|
169
167
|
function _debug(message) {
|
|
170
168
|
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
171
169
|
}
|
|
170
|
+
__name(_debug, "_debug");
|
|
172
171
|
function _log(message) {
|
|
173
172
|
console.log(`[dotenv@${version}] ${message}`);
|
|
174
173
|
}
|
|
174
|
+
__name(_log, "_log");
|
|
175
175
|
function _dotenvKey(options) {
|
|
176
176
|
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
177
177
|
return options.DOTENV_KEY;
|
|
@@ -181,6 +181,7 @@ var require_main = __commonJS({
|
|
|
181
181
|
}
|
|
182
182
|
return "";
|
|
183
183
|
}
|
|
184
|
+
__name(_dotenvKey, "_dotenvKey");
|
|
184
185
|
function _instructions(result, dotenvKey) {
|
|
185
186
|
let uri;
|
|
186
187
|
try {
|
|
@@ -212,8 +213,12 @@ var require_main = __commonJS({
|
|
|
212
213
|
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
213
214
|
throw err;
|
|
214
215
|
}
|
|
215
|
-
return {
|
|
216
|
+
return {
|
|
217
|
+
ciphertext,
|
|
218
|
+
key
|
|
219
|
+
};
|
|
216
220
|
}
|
|
221
|
+
__name(_instructions, "_instructions");
|
|
217
222
|
function _vaultPath(options) {
|
|
218
223
|
let possibleVaultPath = null;
|
|
219
224
|
if (options && options.path && options.path.length > 0) {
|
|
@@ -234,9 +239,11 @@ var require_main = __commonJS({
|
|
|
234
239
|
}
|
|
235
240
|
return null;
|
|
236
241
|
}
|
|
242
|
+
__name(_vaultPath, "_vaultPath");
|
|
237
243
|
function _resolveHome(envPath) {
|
|
238
244
|
return envPath[0] === "~" ? path2.join(os.homedir(), envPath.slice(1)) : envPath;
|
|
239
245
|
}
|
|
246
|
+
__name(_resolveHome, "_resolveHome");
|
|
240
247
|
function _configVault(options) {
|
|
241
248
|
const debug = Boolean(options && options.debug);
|
|
242
249
|
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
@@ -249,8 +256,11 @@ var require_main = __commonJS({
|
|
|
249
256
|
processEnv = options.processEnv;
|
|
250
257
|
}
|
|
251
258
|
DotenvModule.populate(processEnv, parsed, options);
|
|
252
|
-
return {
|
|
259
|
+
return {
|
|
260
|
+
parsed
|
|
261
|
+
};
|
|
253
262
|
}
|
|
263
|
+
__name(_configVault, "_configVault");
|
|
254
264
|
function configDotenv(options) {
|
|
255
265
|
const dotenvPath = path2.resolve(process.cwd(), ".env");
|
|
256
266
|
let encoding = "utf8";
|
|
@@ -263,10 +273,14 @@ var require_main = __commonJS({
|
|
|
263
273
|
_debug("No encoding is specified. UTF-8 is used by default");
|
|
264
274
|
}
|
|
265
275
|
}
|
|
266
|
-
let optionPaths = [
|
|
276
|
+
let optionPaths = [
|
|
277
|
+
dotenvPath
|
|
278
|
+
];
|
|
267
279
|
if (options && options.path) {
|
|
268
280
|
if (!Array.isArray(options.path)) {
|
|
269
|
-
optionPaths = [
|
|
281
|
+
optionPaths = [
|
|
282
|
+
_resolveHome(options.path)
|
|
283
|
+
];
|
|
270
284
|
} else {
|
|
271
285
|
optionPaths = [];
|
|
272
286
|
for (const filepath of options.path) {
|
|
@@ -278,7 +292,9 @@ var require_main = __commonJS({
|
|
|
278
292
|
const parsedAll = {};
|
|
279
293
|
for (const path3 of optionPaths) {
|
|
280
294
|
try {
|
|
281
|
-
const parsed = DotenvModule.parse(fs.readFileSync(path3, {
|
|
295
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path3, {
|
|
296
|
+
encoding
|
|
297
|
+
}));
|
|
282
298
|
DotenvModule.populate(parsedAll, parsed, options);
|
|
283
299
|
} catch (e) {
|
|
284
300
|
if (debug) {
|
|
@@ -309,11 +325,17 @@ var require_main = __commonJS({
|
|
|
309
325
|
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
|
|
310
326
|
}
|
|
311
327
|
if (lastError) {
|
|
312
|
-
return {
|
|
328
|
+
return {
|
|
329
|
+
parsed: parsedAll,
|
|
330
|
+
error: lastError
|
|
331
|
+
};
|
|
313
332
|
} else {
|
|
314
|
-
return {
|
|
333
|
+
return {
|
|
334
|
+
parsed: parsedAll
|
|
335
|
+
};
|
|
315
336
|
}
|
|
316
337
|
}
|
|
338
|
+
__name(configDotenv, "configDotenv");
|
|
317
339
|
function config2(options) {
|
|
318
340
|
if (_dotenvKey(options).length === 0) {
|
|
319
341
|
return DotenvModule.configDotenv(options);
|
|
@@ -325,6 +347,7 @@ var require_main = __commonJS({
|
|
|
325
347
|
}
|
|
326
348
|
return DotenvModule._configVault(options);
|
|
327
349
|
}
|
|
350
|
+
__name(config2, "config");
|
|
328
351
|
function decrypt(encrypted, keyStr) {
|
|
329
352
|
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
330
353
|
let ciphertext = Buffer.from(encrypted, "base64");
|
|
@@ -352,6 +375,7 @@ var require_main = __commonJS({
|
|
|
352
375
|
}
|
|
353
376
|
}
|
|
354
377
|
}
|
|
378
|
+
__name(decrypt, "decrypt");
|
|
355
379
|
function populate(processEnv, parsed, options = {}) {
|
|
356
380
|
const debug = Boolean(options && options.debug);
|
|
357
381
|
const override = Boolean(options && options.override);
|
|
@@ -377,6 +401,7 @@ var require_main = __commonJS({
|
|
|
377
401
|
}
|
|
378
402
|
}
|
|
379
403
|
}
|
|
404
|
+
__name(populate, "populate");
|
|
380
405
|
var DotenvModule = {
|
|
381
406
|
configDotenv,
|
|
382
407
|
_configVault,
|
|
@@ -515,9 +540,10 @@ var _DateUtils = class _DateUtils {
|
|
|
515
540
|
return timestamp.isAfter(dateLimit);
|
|
516
541
|
}
|
|
517
542
|
};
|
|
543
|
+
__name(_DateUtils, "DateUtils");
|
|
518
544
|
//#region Holidays
|
|
519
545
|
/** Holidays 2025-2030 as YYYY-MM-DD strings */
|
|
520
|
-
_DateUtils
|
|
546
|
+
__publicField(_DateUtils, "HOLIDAYS_STR", [
|
|
521
547
|
/* 2025 */
|
|
522
548
|
"2025-01-01",
|
|
523
549
|
"2025-04-18",
|
|
@@ -602,13 +628,13 @@ _DateUtils.HOLIDAYS_STR = [
|
|
|
602
628
|
"2030-12-24",
|
|
603
629
|
"2030-12-25",
|
|
604
630
|
"2030-12-26"
|
|
605
|
-
];
|
|
631
|
+
]);
|
|
606
632
|
/** Holidays 2025-2030 as UTC timestamps */
|
|
607
|
-
_DateUtils
|
|
633
|
+
__publicField(_DateUtils, "HOLIDAYS", _DateUtils.HOLIDAYS_STR.map((h) => {
|
|
608
634
|
const date = new Date(h);
|
|
609
635
|
date.setUTCHours(0, 0, 0, 0);
|
|
610
636
|
return date.getTime();
|
|
611
|
-
});
|
|
637
|
+
}));
|
|
612
638
|
var DateUtils = _DateUtils;
|
|
613
639
|
|
|
614
640
|
// src/common/promise-magic/deferred.ts
|
|
@@ -619,13 +645,18 @@ function createDeferred() {
|
|
|
619
645
|
resolve = res;
|
|
620
646
|
reject = rej;
|
|
621
647
|
});
|
|
622
|
-
return {
|
|
648
|
+
return {
|
|
649
|
+
promise,
|
|
650
|
+
resolve,
|
|
651
|
+
reject
|
|
652
|
+
};
|
|
623
653
|
}
|
|
654
|
+
__name(createDeferred, "createDeferred");
|
|
624
655
|
|
|
625
656
|
// src/common/promise-magic/single-promise-waiter.ts
|
|
626
|
-
var
|
|
657
|
+
var _SinglePromiseWaiter = class _SinglePromiseWaiter {
|
|
627
658
|
constructor() {
|
|
628
|
-
this
|
|
659
|
+
__publicField(this, "_promise", null);
|
|
629
660
|
}
|
|
630
661
|
static getInstance() {
|
|
631
662
|
if (!_SinglePromiseWaiter._instance) {
|
|
@@ -648,6 +679,9 @@ var SinglePromiseWaiter = class _SinglePromiseWaiter {
|
|
|
648
679
|
return this._promise !== null;
|
|
649
680
|
}
|
|
650
681
|
};
|
|
682
|
+
__name(_SinglePromiseWaiter, "SinglePromiseWaiter");
|
|
683
|
+
__publicField(_SinglePromiseWaiter, "_instance");
|
|
684
|
+
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
651
685
|
|
|
652
686
|
// src/common/winston.ts
|
|
653
687
|
var import_winston = __toESM(require("winston"));
|
|
@@ -662,28 +696,28 @@ var levelToSeverity = {
|
|
|
662
696
|
warn: "warn",
|
|
663
697
|
error: "error"
|
|
664
698
|
};
|
|
665
|
-
var baseFormat = import_winston.default.format.combine(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
);
|
|
699
|
+
var baseFormat = import_winston.default.format.combine(import_winston.default.format.timestamp({
|
|
700
|
+
format: /* @__PURE__ */ __name(() => (/* @__PURE__ */ new Date()).toISOString(), "format")
|
|
701
|
+
}), import_winston.default.format.errors({
|
|
702
|
+
stack: true
|
|
703
|
+
}), import_winston.default.format.printf((info) => {
|
|
704
|
+
const payload = {
|
|
705
|
+
ts: info.timestamp,
|
|
706
|
+
level: info.level,
|
|
707
|
+
severity: levelToSeverity[info.level] || info.level,
|
|
708
|
+
message: info.message,
|
|
709
|
+
service: SERVICE,
|
|
710
|
+
env: ENV,
|
|
711
|
+
process_name: process.title || process.argv[1] || "node",
|
|
712
|
+
pid: process.pid,
|
|
713
|
+
device: process.env.DEVICE_ID || void 0,
|
|
714
|
+
traceId: info.traceId,
|
|
715
|
+
spanId: info.spanId,
|
|
716
|
+
extra: info.extra || info.meta || void 0,
|
|
717
|
+
stack: info.stack
|
|
718
|
+
};
|
|
719
|
+
return JSON.stringify(payload);
|
|
720
|
+
}));
|
|
687
721
|
var transports = [
|
|
688
722
|
new import_winston.default.transports.Console({
|
|
689
723
|
level: process.env.LOG_LEVEL || "info"
|
|
@@ -696,7 +730,7 @@ var logger = import_winston.default.createLogger({
|
|
|
696
730
|
exitOnError: false
|
|
697
731
|
});
|
|
698
732
|
logger.stream = {
|
|
699
|
-
write: (message) => logger.info(message.trim())
|
|
733
|
+
write: /* @__PURE__ */ __name((message) => logger.info(message.trim()), "write")
|
|
700
734
|
};
|
|
701
735
|
|
|
702
736
|
// src/common/utils/is-cron-valid.ts
|
|
@@ -708,6 +742,7 @@ function isValidCron(expr) {
|
|
|
708
742
|
const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
|
|
709
743
|
return parts.every((part) => cronPart.test(part));
|
|
710
744
|
}
|
|
745
|
+
__name(isValidCron, "isValidCron");
|
|
711
746
|
|
|
712
747
|
// src/common/patterns/singleton.ts
|
|
713
748
|
var _Singleton = class _Singleton {
|
|
@@ -719,25 +754,73 @@ var _Singleton = class _Singleton {
|
|
|
719
754
|
}
|
|
720
755
|
_Singleton.instances.set(ctor, this);
|
|
721
756
|
}
|
|
757
|
+
static getInstance(...args) {
|
|
758
|
+
let instance = _Singleton.instances.get(this);
|
|
759
|
+
if (!instance) {
|
|
760
|
+
instance = new this(...args);
|
|
761
|
+
_Singleton.instances.set(this, instance);
|
|
762
|
+
}
|
|
763
|
+
return instance;
|
|
764
|
+
}
|
|
722
765
|
};
|
|
723
|
-
_Singleton
|
|
766
|
+
__name(_Singleton, "Singleton");
|
|
767
|
+
__publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
|
|
724
768
|
var Singleton = _Singleton;
|
|
725
769
|
|
|
726
770
|
// src/common/dto/status-dto.ts
|
|
727
|
-
var
|
|
771
|
+
var _StatusDto = class _StatusDto {
|
|
728
772
|
constructor(status, details, timestamp) {
|
|
773
|
+
/**
|
|
774
|
+
* Call result status
|
|
775
|
+
*/
|
|
776
|
+
__publicField(this, "status");
|
|
777
|
+
/**
|
|
778
|
+
* UTC Timestamp
|
|
779
|
+
* @example "2021-12-01T13:23:39.305Z"
|
|
780
|
+
*/
|
|
781
|
+
__publicField(this, "timestamp");
|
|
782
|
+
/**
|
|
783
|
+
* Details (optional)
|
|
784
|
+
*/
|
|
785
|
+
__publicField(this, "details");
|
|
729
786
|
this.status = status;
|
|
730
787
|
this.details = details;
|
|
731
788
|
this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
|
|
732
789
|
}
|
|
733
790
|
};
|
|
791
|
+
__name(_StatusDto, "StatusDto");
|
|
792
|
+
var StatusDto = _StatusDto;
|
|
734
793
|
|
|
735
794
|
// src/common/constants/amount-unit.ts
|
|
736
795
|
var AMOUNT_UNIT = {
|
|
737
|
-
1: {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
796
|
+
1: {
|
|
797
|
+
symbol: "g",
|
|
798
|
+
translations: {
|
|
799
|
+
en: "gram",
|
|
800
|
+
cs: "gram"
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
2: {
|
|
804
|
+
symbol: "kg",
|
|
805
|
+
translations: {
|
|
806
|
+
en: "kilogram",
|
|
807
|
+
cs: "kilogram"
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
3: {
|
|
811
|
+
symbol: "ml",
|
|
812
|
+
translations: {
|
|
813
|
+
en: "milliliter",
|
|
814
|
+
cs: "mililitr"
|
|
815
|
+
}
|
|
816
|
+
},
|
|
817
|
+
4: {
|
|
818
|
+
symbol: "l",
|
|
819
|
+
translations: {
|
|
820
|
+
en: "liter",
|
|
821
|
+
cs: "litr"
|
|
822
|
+
}
|
|
823
|
+
}
|
|
741
824
|
};
|
|
742
825
|
|
|
743
826
|
// src/common/schema/entities/category.entity.ts
|
|
@@ -754,6 +837,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
754
837
|
function unsafeStringify(arr, offset = 0) {
|
|
755
838
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
756
839
|
}
|
|
840
|
+
__name(unsafeStringify, "unsafeStringify");
|
|
757
841
|
|
|
758
842
|
// ../../node_modules/uuid/dist/esm/rng.js
|
|
759
843
|
var import_crypto = require("crypto");
|
|
@@ -766,10 +850,13 @@ function rng() {
|
|
|
766
850
|
}
|
|
767
851
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
768
852
|
}
|
|
853
|
+
__name(rng, "rng");
|
|
769
854
|
|
|
770
855
|
// ../../node_modules/uuid/dist/esm/native.js
|
|
771
856
|
var import_crypto2 = require("crypto");
|
|
772
|
-
var native_default = {
|
|
857
|
+
var native_default = {
|
|
858
|
+
randomUUID: import_crypto2.randomUUID
|
|
859
|
+
};
|
|
773
860
|
|
|
774
861
|
// ../../node_modules/uuid/dist/esm/v4.js
|
|
775
862
|
function v4(options, buf, offset) {
|
|
@@ -796,13 +883,31 @@ function v4(options, buf, offset) {
|
|
|
796
883
|
}
|
|
797
884
|
return unsafeStringify(rnds);
|
|
798
885
|
}
|
|
886
|
+
__name(v4, "v4");
|
|
799
887
|
var v4_default = v4;
|
|
800
888
|
|
|
801
889
|
// src/database/entities/fresh-entity.ts
|
|
802
|
-
|
|
890
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
891
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
892
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
893
|
+
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;
|
|
894
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
895
|
+
}
|
|
896
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
897
|
+
function _ts_metadata(k, v) {
|
|
898
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
899
|
+
}
|
|
900
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
901
|
+
var _FreshEntity = class _FreshEntity extends import_typeorm.BaseEntity {
|
|
803
902
|
/** After manual construction `id` is irrelevant. Refer to `uuid` only, because that will be inserted into DB */
|
|
804
903
|
constructor() {
|
|
805
904
|
super();
|
|
905
|
+
__publicField(this, "id");
|
|
906
|
+
__publicField(this, "uuid");
|
|
907
|
+
__publicField(this, "created_at");
|
|
908
|
+
__publicField(this, "updated_at");
|
|
909
|
+
// for soft delete methods by typeorm
|
|
910
|
+
__publicField(this, "deleted_at");
|
|
806
911
|
this.id = 0;
|
|
807
912
|
this.uuid = v4_default();
|
|
808
913
|
const newDate = /* @__PURE__ */ new Date();
|
|
@@ -811,22 +916,41 @@ var FreshEntity = class extends import_typeorm.BaseEntity {
|
|
|
811
916
|
this.deleted_at = null;
|
|
812
917
|
}
|
|
813
918
|
};
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
(
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
(
|
|
829
|
-
], FreshEntity.prototype, "
|
|
919
|
+
__name(_FreshEntity, "FreshEntity");
|
|
920
|
+
var FreshEntity = _FreshEntity;
|
|
921
|
+
_ts_decorate([
|
|
922
|
+
(0, import_typeorm.PrimaryGeneratedColumn)("increment"),
|
|
923
|
+
_ts_metadata("design:type", Number)
|
|
924
|
+
], FreshEntity.prototype, "id", void 0);
|
|
925
|
+
_ts_decorate([
|
|
926
|
+
(0, import_typeorm.Index)({
|
|
927
|
+
unique: true
|
|
928
|
+
}),
|
|
929
|
+
(0, import_typeorm.Column)({
|
|
930
|
+
type: "uuid",
|
|
931
|
+
default: /* @__PURE__ */ __name(() => "timescale.uuid_generate_v4()", "default")
|
|
932
|
+
}),
|
|
933
|
+
_ts_metadata("design:type", String)
|
|
934
|
+
], FreshEntity.prototype, "uuid", void 0);
|
|
935
|
+
_ts_decorate([
|
|
936
|
+
(0, import_typeorm.CreateDateColumn)({
|
|
937
|
+
type: "timestamptz"
|
|
938
|
+
}),
|
|
939
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
940
|
+
], FreshEntity.prototype, "created_at", void 0);
|
|
941
|
+
_ts_decorate([
|
|
942
|
+
(0, import_typeorm.UpdateDateColumn)({
|
|
943
|
+
type: "timestamptz"
|
|
944
|
+
}),
|
|
945
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
946
|
+
], FreshEntity.prototype, "updated_at", void 0);
|
|
947
|
+
_ts_decorate([
|
|
948
|
+
(0, import_typeorm.DeleteDateColumn)({
|
|
949
|
+
type: "timestamptz",
|
|
950
|
+
nullable: true
|
|
951
|
+
}),
|
|
952
|
+
_ts_metadata("design:type", Object)
|
|
953
|
+
], FreshEntity.prototype, "deleted_at", void 0);
|
|
830
954
|
|
|
831
955
|
// src/database/entities/fresh-hyper-entity.ts
|
|
832
956
|
var import_typeorm3 = require("typeorm");
|
|
@@ -837,33 +961,55 @@ function TimestampColumn(options = {}) {
|
|
|
837
961
|
const defaultOptions = {
|
|
838
962
|
type: "timestamptz",
|
|
839
963
|
nullable: false,
|
|
840
|
-
default: () => "CURRENT_TIMESTAMP",
|
|
964
|
+
default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
|
|
841
965
|
...options
|
|
842
966
|
};
|
|
843
967
|
return (0, import_typeorm2.Column)(defaultOptions);
|
|
844
968
|
}
|
|
969
|
+
__name(TimestampColumn, "TimestampColumn");
|
|
845
970
|
|
|
846
971
|
// src/database/entities/fresh-hyper-entity.ts
|
|
847
|
-
|
|
972
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
973
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
974
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
975
|
+
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;
|
|
976
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
977
|
+
}
|
|
978
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
979
|
+
function _ts_metadata2(k, v) {
|
|
980
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
981
|
+
}
|
|
982
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
983
|
+
var _FreshHyperEntity = class _FreshHyperEntity extends import_typeorm3.BaseEntity {
|
|
848
984
|
/** After manual construction `id` is irrelevant */
|
|
849
985
|
constructor(timestamp) {
|
|
850
986
|
super();
|
|
987
|
+
// input timestamp as PK
|
|
988
|
+
__publicField(this, "timestamp");
|
|
989
|
+
// just info column about time of insert
|
|
990
|
+
__publicField(this, "created_at");
|
|
851
991
|
this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
|
|
852
992
|
this.created_at = /* @__PURE__ */ new Date();
|
|
853
993
|
}
|
|
854
994
|
};
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
995
|
+
__name(_FreshHyperEntity, "FreshHyperEntity");
|
|
996
|
+
var FreshHyperEntity = _FreshHyperEntity;
|
|
997
|
+
_ts_decorate2([
|
|
998
|
+
(0, import_typeorm3.PrimaryColumn)({
|
|
999
|
+
type: "timestamptz"
|
|
1000
|
+
}),
|
|
1001
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1002
|
+
], FreshHyperEntity.prototype, "timestamp", void 0);
|
|
1003
|
+
_ts_decorate2([
|
|
1004
|
+
TimestampColumn(),
|
|
1005
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
1006
|
+
], FreshHyperEntity.prototype, "created_at", void 0);
|
|
861
1007
|
|
|
862
1008
|
// src/database/entities/fresh-translation-entity.ts
|
|
863
1009
|
var import_typeorm4 = require("typeorm");
|
|
864
1010
|
|
|
865
1011
|
// src/enums/action-command-code.ts
|
|
866
|
-
var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2)
|
|
1012
|
+
var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
|
|
867
1013
|
ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
|
|
868
1014
|
ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
|
|
869
1015
|
ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
|
|
@@ -872,20 +1018,20 @@ var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2) => {
|
|
|
872
1018
|
ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
|
|
873
1019
|
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
|
|
874
1020
|
return ActionCommandCode2;
|
|
875
|
-
})(
|
|
1021
|
+
})({});
|
|
876
1022
|
|
|
877
1023
|
// src/enums/depot-pool-status.ts
|
|
878
|
-
var DepotPoolStatus = /* @__PURE__ */ ((DepotPoolStatus2)
|
|
1024
|
+
var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
|
|
879
1025
|
DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
|
|
880
1026
|
DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
|
|
881
1027
|
DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
|
|
882
1028
|
DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
|
|
883
1029
|
DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
|
|
884
1030
|
return DepotPoolStatus2;
|
|
885
|
-
})(
|
|
1031
|
+
})({});
|
|
886
1032
|
|
|
887
1033
|
// src/enums/http-status.ts
|
|
888
|
-
var HttpStatus = /* @__PURE__ */ ((HttpStatus2)
|
|
1034
|
+
var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
|
|
889
1035
|
HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
|
|
890
1036
|
HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
891
1037
|
HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
|
|
@@ -949,28 +1095,28 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
|
|
|
949
1095
|
HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
950
1096
|
HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
951
1097
|
return HttpStatus2;
|
|
952
|
-
})(
|
|
1098
|
+
})({});
|
|
953
1099
|
|
|
954
1100
|
// src/enums/language-code.ts
|
|
955
|
-
var LanguageCode = /* @__PURE__ */ ((LanguageCode2)
|
|
1101
|
+
var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
|
|
956
1102
|
LanguageCode2["CS"] = "cs";
|
|
957
1103
|
LanguageCode2["EN"] = "en";
|
|
958
1104
|
LanguageCode2["DE"] = "de";
|
|
959
1105
|
LanguageCode2["PL"] = "pl";
|
|
960
1106
|
LanguageCode2["SK"] = "sk";
|
|
961
1107
|
return LanguageCode2;
|
|
962
|
-
})(
|
|
1108
|
+
})({});
|
|
963
1109
|
|
|
964
1110
|
// src/enums/payment-method.ts
|
|
965
|
-
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2)
|
|
1111
|
+
var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
|
|
966
1112
|
PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
|
|
967
1113
|
PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
|
|
968
1114
|
PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
|
|
969
1115
|
return PaymentMethod2;
|
|
970
|
-
})(
|
|
1116
|
+
})({});
|
|
971
1117
|
|
|
972
1118
|
// src/enums/transaction-type.ts
|
|
973
|
-
var TransactionType = /* @__PURE__ */ ((TransactionType2)
|
|
1119
|
+
var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
|
|
974
1120
|
TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
|
|
975
1121
|
TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
|
|
976
1122
|
TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
|
|
@@ -982,81 +1128,142 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
|
982
1128
|
TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
|
|
983
1129
|
TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
|
|
984
1130
|
return TransactionType2;
|
|
985
|
-
})(
|
|
1131
|
+
})({});
|
|
986
1132
|
|
|
987
1133
|
// src/database/entities/fresh-translation-entity.ts
|
|
1134
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
1135
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1136
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1137
|
+
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;
|
|
1138
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1139
|
+
}
|
|
1140
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
1141
|
+
function _ts_metadata3(k, v) {
|
|
1142
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1143
|
+
}
|
|
1144
|
+
__name(_ts_metadata3, "_ts_metadata");
|
|
988
1145
|
var languageValues = Object.values(LanguageCode).map((v) => `'${v}'`).join(",");
|
|
989
|
-
var
|
|
1146
|
+
var _FreshTranslationBase = class _FreshTranslationBase extends import_typeorm4.BaseEntity {
|
|
990
1147
|
constructor() {
|
|
991
1148
|
super();
|
|
1149
|
+
__publicField(this, "id");
|
|
1150
|
+
__publicField(this, "languageCode");
|
|
992
1151
|
this.id = 0;
|
|
993
|
-
this.languageCode =
|
|
1152
|
+
this.languageCode = LanguageCode.CS;
|
|
994
1153
|
}
|
|
995
1154
|
};
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1155
|
+
__name(_FreshTranslationBase, "FreshTranslationBase");
|
|
1156
|
+
var FreshTranslationBase = _FreshTranslationBase;
|
|
1157
|
+
_ts_decorate3([
|
|
1158
|
+
(0, import_typeorm4.PrimaryGeneratedColumn)(),
|
|
1159
|
+
_ts_metadata3("design:type", Number)
|
|
1160
|
+
], FreshTranslationBase.prototype, "id", void 0);
|
|
1161
|
+
_ts_decorate3([
|
|
1000
1162
|
(0, import_typeorm4.Column)({
|
|
1001
1163
|
type: "varchar",
|
|
1002
1164
|
length: 3,
|
|
1003
1165
|
nullable: false
|
|
1004
1166
|
}),
|
|
1005
|
-
(0, import_typeorm4.Check)(`"languageCode" IN (${languageValues})`)
|
|
1006
|
-
|
|
1167
|
+
(0, import_typeorm4.Check)(`"languageCode" IN (${languageValues})`),
|
|
1168
|
+
_ts_metadata3("design:type", typeof LanguageCode === "undefined" ? Object : LanguageCode)
|
|
1169
|
+
], FreshTranslationBase.prototype, "languageCode", void 0);
|
|
1007
1170
|
|
|
1008
1171
|
// src/database/dao/fresh-dao.ts
|
|
1009
|
-
var
|
|
1172
|
+
var _FreshDao = class _FreshDao {
|
|
1010
1173
|
};
|
|
1174
|
+
__name(_FreshDao, "FreshDao");
|
|
1175
|
+
var FreshDao = _FreshDao;
|
|
1011
1176
|
|
|
1012
1177
|
// src/common/schema/entities/category.entity.ts
|
|
1013
|
-
|
|
1014
|
-
|
|
1178
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
1179
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1180
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1181
|
+
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;
|
|
1182
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1183
|
+
}
|
|
1184
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
1185
|
+
var _Category = class _Category extends FreshEntity {
|
|
1015
1186
|
};
|
|
1016
|
-
Category
|
|
1187
|
+
__name(_Category, "Category");
|
|
1188
|
+
var Category = _Category;
|
|
1189
|
+
Category = _ts_decorate4([
|
|
1017
1190
|
(0, import_typeorm5.Entity)()
|
|
1018
1191
|
], Category);
|
|
1019
1192
|
|
|
1020
1193
|
// src/common/schema/entities/device.entity.ts
|
|
1021
1194
|
var import_typeorm6 = require("typeorm");
|
|
1022
|
-
|
|
1023
|
-
|
|
1195
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
1196
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1197
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1198
|
+
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;
|
|
1199
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1200
|
+
}
|
|
1201
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
1202
|
+
var _Device = class _Device extends FreshEntity {
|
|
1024
1203
|
};
|
|
1025
|
-
Device
|
|
1204
|
+
__name(_Device, "Device");
|
|
1205
|
+
var Device = _Device;
|
|
1206
|
+
Device = _ts_decorate5([
|
|
1026
1207
|
(0, import_typeorm6.Entity)()
|
|
1027
1208
|
], Device);
|
|
1028
1209
|
|
|
1029
1210
|
// src/common/schema/entities/manufacturer.entity.ts
|
|
1030
1211
|
var import_typeorm7 = require("typeorm");
|
|
1031
|
-
|
|
1032
|
-
|
|
1212
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1213
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1214
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1215
|
+
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;
|
|
1216
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1217
|
+
}
|
|
1218
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
1219
|
+
var _Manufacturer = class _Manufacturer extends FreshEntity {
|
|
1033
1220
|
};
|
|
1034
|
-
Manufacturer
|
|
1221
|
+
__name(_Manufacturer, "Manufacturer");
|
|
1222
|
+
var Manufacturer = _Manufacturer;
|
|
1223
|
+
Manufacturer = _ts_decorate6([
|
|
1035
1224
|
(0, import_typeorm7.Entity)()
|
|
1036
1225
|
], Manufacturer);
|
|
1037
1226
|
|
|
1038
1227
|
// src/common/schema/entities/product.entity.ts
|
|
1039
1228
|
var import_typeorm8 = require("typeorm");
|
|
1040
|
-
|
|
1041
|
-
|
|
1229
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
1230
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1231
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1232
|
+
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;
|
|
1233
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1234
|
+
}
|
|
1235
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
1236
|
+
var _Product = class _Product extends FreshEntity {
|
|
1042
1237
|
};
|
|
1043
|
-
Product
|
|
1238
|
+
__name(_Product, "Product");
|
|
1239
|
+
var Product = _Product;
|
|
1240
|
+
Product = _ts_decorate7([
|
|
1044
1241
|
(0, import_typeorm8.Entity)()
|
|
1045
1242
|
], Product);
|
|
1046
1243
|
|
|
1047
1244
|
// src/common/schema/entities/subcategory.entity.ts
|
|
1048
1245
|
var import_typeorm9 = require("typeorm");
|
|
1049
|
-
|
|
1050
|
-
|
|
1246
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
1247
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1248
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1249
|
+
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;
|
|
1250
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1251
|
+
}
|
|
1252
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
1253
|
+
var _Subcategory = class _Subcategory extends FreshEntity {
|
|
1051
1254
|
};
|
|
1052
|
-
Subcategory
|
|
1255
|
+
__name(_Subcategory, "Subcategory");
|
|
1256
|
+
var Subcategory = _Subcategory;
|
|
1257
|
+
Subcategory = _ts_decorate8([
|
|
1053
1258
|
(0, import_typeorm9.Entity)()
|
|
1054
1259
|
], Subcategory);
|
|
1055
1260
|
|
|
1056
1261
|
// src/core/data-helper.ts
|
|
1057
|
-
var
|
|
1262
|
+
var _DataHelper = class _DataHelper {
|
|
1058
1263
|
constructor(startDataRetrieve = true, deviceIds) {
|
|
1059
|
-
this
|
|
1264
|
+
__publicField(this, "_data");
|
|
1265
|
+
__publicField(this, "_dataPromise", null);
|
|
1266
|
+
__publicField(this, "deviceIds");
|
|
1060
1267
|
this.deviceIds = deviceIds;
|
|
1061
1268
|
if (startDataRetrieve) {
|
|
1062
1269
|
this._dataPromise = this.startDataRetrieval();
|
|
@@ -1085,31 +1292,33 @@ var DataHelper = class {
|
|
|
1085
1292
|
return this._data;
|
|
1086
1293
|
}
|
|
1087
1294
|
};
|
|
1295
|
+
__name(_DataHelper, "DataHelper");
|
|
1296
|
+
var DataHelper = _DataHelper;
|
|
1088
1297
|
|
|
1089
1298
|
// src/core/class/fresh-job.ts
|
|
1090
1299
|
var import_node_schedule = require("node-schedule");
|
|
1091
|
-
var
|
|
1300
|
+
var _FreshJob = class _FreshJob extends Singleton {
|
|
1092
1301
|
/**
|
|
1093
1302
|
* @param cronExpression must be cron of just numbers ex.: `0 5 * * 4`
|
|
1094
1303
|
* By default timezone is added " Europe/Prague"
|
|
1095
1304
|
*/
|
|
1096
1305
|
constructor(jobName, cronExpression, jobEnabled) {
|
|
1097
1306
|
super();
|
|
1098
|
-
this
|
|
1307
|
+
__publicField(this, "_jobName");
|
|
1308
|
+
__publicField(this, "_cronExpression");
|
|
1309
|
+
__publicField(this, "_job", null);
|
|
1099
1310
|
this._jobName = jobName;
|
|
1100
1311
|
if (!isValidCron(cronExpression)) {
|
|
1101
|
-
throw new Error(
|
|
1102
|
-
`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`
|
|
1103
|
-
);
|
|
1312
|
+
throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
|
|
1104
1313
|
}
|
|
1105
1314
|
this._cronExpression = cronExpression;
|
|
1106
1315
|
if (jobEnabled) {
|
|
1107
|
-
this._job = (0, import_node_schedule.scheduleJob)(
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
);
|
|
1316
|
+
this._job = (0, import_node_schedule.scheduleJob)({
|
|
1317
|
+
rule: this._cronExpression,
|
|
1318
|
+
tz: "Europe/Prague"
|
|
1319
|
+
}, async () => {
|
|
1320
|
+
await this.invoke();
|
|
1321
|
+
});
|
|
1113
1322
|
if (!this._job) {
|
|
1114
1323
|
throw new Error(`Job ${this._jobName} could not be scheduled`);
|
|
1115
1324
|
}
|
|
@@ -1118,9 +1327,7 @@ var FreshJob = class extends Singleton {
|
|
|
1118
1327
|
}
|
|
1119
1328
|
/** Just logging */
|
|
1120
1329
|
onInit(rescheduled) {
|
|
1121
|
-
console.log(
|
|
1122
|
-
`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`
|
|
1123
|
-
);
|
|
1330
|
+
console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
|
|
1124
1331
|
}
|
|
1125
1332
|
get jobName() {
|
|
1126
1333
|
return this._jobName;
|
|
@@ -1141,21 +1348,27 @@ var FreshJob = class extends Singleton {
|
|
|
1141
1348
|
this._job = value;
|
|
1142
1349
|
}
|
|
1143
1350
|
};
|
|
1351
|
+
__name(_FreshJob, "FreshJob");
|
|
1352
|
+
var FreshJob = _FreshJob;
|
|
1144
1353
|
|
|
1145
1354
|
// src/core/errors/api-error.ts
|
|
1146
|
-
var
|
|
1355
|
+
var _ApiError = class _ApiError extends Error {
|
|
1356
|
+
constructor(statusCode, status, detail) {
|
|
1357
|
+
super();
|
|
1358
|
+
__publicField(this, "_statusCode");
|
|
1359
|
+
__publicField(this, "_statusDto");
|
|
1360
|
+
this._statusCode = statusCode;
|
|
1361
|
+
this._statusDto = new StatusDto(status, detail);
|
|
1362
|
+
}
|
|
1147
1363
|
get statusCode() {
|
|
1148
1364
|
return this._statusCode;
|
|
1149
1365
|
}
|
|
1150
1366
|
get statusDto() {
|
|
1151
1367
|
return this._statusDto;
|
|
1152
1368
|
}
|
|
1153
|
-
constructor(statusCode, status, detail) {
|
|
1154
|
-
super();
|
|
1155
|
-
this._statusCode = statusCode;
|
|
1156
|
-
this._statusDto = new StatusDto(status, detail);
|
|
1157
|
-
}
|
|
1158
1369
|
};
|
|
1370
|
+
__name(_ApiError, "ApiError");
|
|
1371
|
+
var ApiError = _ApiError;
|
|
1159
1372
|
|
|
1160
1373
|
// src/config/eslint-config.ts
|
|
1161
1374
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
@@ -1166,7 +1379,10 @@ var FRESH_ESLINT_CONFIG = [
|
|
|
1166
1379
|
// Prettier integration
|
|
1167
1380
|
...import_eslint_config_prettier.default,
|
|
1168
1381
|
// Affected files
|
|
1169
|
-
files: [
|
|
1382
|
+
files: [
|
|
1383
|
+
"**/*.ts",
|
|
1384
|
+
"**/*.tsx"
|
|
1385
|
+
],
|
|
1170
1386
|
ignores: [
|
|
1171
1387
|
"dist/**",
|
|
1172
1388
|
"node_modules/**",
|
|
@@ -1191,26 +1407,49 @@ var FRESH_ESLINT_CONFIG = [
|
|
|
1191
1407
|
// no lets or vars
|
|
1192
1408
|
"prefer-const": "error",
|
|
1193
1409
|
// blocks ("red" === color) these ifs
|
|
1194
|
-
yoda: [
|
|
1195
|
-
|
|
1410
|
+
yoda: [
|
|
1411
|
+
"error",
|
|
1412
|
+
"never"
|
|
1413
|
+
],
|
|
1414
|
+
"no-multiple-empty-lines": [
|
|
1415
|
+
"error",
|
|
1416
|
+
{
|
|
1417
|
+
max: 1
|
|
1418
|
+
}
|
|
1419
|
+
],
|
|
1196
1420
|
// semi-colons
|
|
1197
|
-
semi: [
|
|
1421
|
+
semi: [
|
|
1422
|
+
"error",
|
|
1423
|
+
"always"
|
|
1424
|
+
],
|
|
1198
1425
|
// forces block for all control statements (forbid one-line returns)
|
|
1199
|
-
curly: [
|
|
1426
|
+
curly: [
|
|
1427
|
+
"error",
|
|
1428
|
+
"all"
|
|
1429
|
+
],
|
|
1200
1430
|
// makes spaces between brackets
|
|
1201
|
-
"object-curly-spacing": [
|
|
1431
|
+
"object-curly-spacing": [
|
|
1432
|
+
"error",
|
|
1433
|
+
"always"
|
|
1434
|
+
],
|
|
1202
1435
|
// checks same if/else conditions
|
|
1203
1436
|
"no-dupe-else-if": "error",
|
|
1204
1437
|
// keeps imports from one package in same declaration
|
|
1205
1438
|
"no-duplicate-imports": "error",
|
|
1206
1439
|
// blocks simple '=' in condition blocks
|
|
1207
|
-
"no-cond-assign": [
|
|
1440
|
+
"no-cond-assign": [
|
|
1441
|
+
"error",
|
|
1442
|
+
"always"
|
|
1443
|
+
],
|
|
1208
1444
|
// forbids promise inside promise
|
|
1209
1445
|
"no-async-promise-executor": "error",
|
|
1210
1446
|
// watches possible falltrough in switch cases
|
|
1211
1447
|
"no-fallthrough": "error",
|
|
1212
1448
|
// use === instead of ==
|
|
1213
|
-
eqeqeq: [
|
|
1449
|
+
eqeqeq: [
|
|
1450
|
+
"error",
|
|
1451
|
+
"always"
|
|
1452
|
+
],
|
|
1214
1453
|
// Prettier formatting rules
|
|
1215
1454
|
"prettier/prettier": [
|
|
1216
1455
|
"error",
|
|
@@ -1236,23 +1475,40 @@ var FRESH_ESLINT_CONFIG = [
|
|
|
1236
1475
|
"@typescript-eslint/naming-convention": [
|
|
1237
1476
|
"error",
|
|
1238
1477
|
{
|
|
1239
|
-
selector: [
|
|
1240
|
-
|
|
1478
|
+
selector: [
|
|
1479
|
+
"variable",
|
|
1480
|
+
"function"
|
|
1481
|
+
],
|
|
1482
|
+
format: [
|
|
1483
|
+
"camelCase"
|
|
1484
|
+
],
|
|
1241
1485
|
leadingUnderscore: "allow"
|
|
1242
1486
|
},
|
|
1243
1487
|
{
|
|
1244
1488
|
selector: "class",
|
|
1245
|
-
format: [
|
|
1489
|
+
format: [
|
|
1490
|
+
"PascalCase"
|
|
1491
|
+
]
|
|
1246
1492
|
},
|
|
1247
1493
|
{
|
|
1248
1494
|
selector: "variable",
|
|
1249
|
-
modifiers: [
|
|
1250
|
-
|
|
1495
|
+
modifiers: [
|
|
1496
|
+
"const",
|
|
1497
|
+
"exported"
|
|
1498
|
+
],
|
|
1499
|
+
format: [
|
|
1500
|
+
"UPPER_CASE",
|
|
1501
|
+
"PascalCase"
|
|
1502
|
+
]
|
|
1251
1503
|
},
|
|
1252
1504
|
{
|
|
1253
1505
|
selector: "property",
|
|
1254
|
-
modifiers: [
|
|
1255
|
-
|
|
1506
|
+
modifiers: [
|
|
1507
|
+
"readonly"
|
|
1508
|
+
],
|
|
1509
|
+
format: [
|
|
1510
|
+
"UPPER_CASE"
|
|
1511
|
+
]
|
|
1256
1512
|
}
|
|
1257
1513
|
]
|
|
1258
1514
|
}
|
|
@@ -1277,8 +1533,12 @@ var PG_DATA_SOURCE_OPTIONS = {
|
|
|
1277
1533
|
password: process.env.POSTGRE_SQL_PASSWORD || "<password>",
|
|
1278
1534
|
database: process.env.POSTGRE_SQL_DATABASE || "<database>",
|
|
1279
1535
|
schema: process.env.POSTGRE_SQL_SCHEMA || "<scheme>",
|
|
1280
|
-
entities: [
|
|
1281
|
-
|
|
1536
|
+
entities: [
|
|
1537
|
+
import_path.default.join(basePath, isTs ? "src/entity/*.{ts,js}" : "build/entity/*.js")
|
|
1538
|
+
],
|
|
1539
|
+
migrations: [
|
|
1540
|
+
import_path.default.join(basePath, isTs ? "src/migration/*.{ts,js}" : "build/migration/*.js")
|
|
1541
|
+
],
|
|
1282
1542
|
migrationsRun: process.env.RUN_MIGRATIONS === "true",
|
|
1283
1543
|
migrationsTableName: "migrations",
|
|
1284
1544
|
migrationsTransactionMode: "each",
|
|
@@ -1290,7 +1550,6 @@ var PG_DATA_SOURCE_OPTIONS = {
|
|
|
1290
1550
|
useUTC: true,
|
|
1291
1551
|
cache: true,
|
|
1292
1552
|
namingStrategy: new import_typeorm_naming_strategies.SnakeNamingStrategy()
|
|
1293
|
-
// replication: undefined,
|
|
1294
1553
|
};
|
|
1295
1554
|
var datasource_default = PG_DATA_SOURCE_OPTIONS;
|
|
1296
1555
|
// Annotate the CommonJS export names for ESM import in node:
|