@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.mjs
CHANGED
|
@@ -4,6 +4,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
9
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
10
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
11
|
}) : x)(function(x) {
|
|
@@ -29,14 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
31
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
32
|
mod
|
|
31
33
|
));
|
|
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,
|
|
@@ -480,9 +505,10 @@ var _DateUtils = class _DateUtils {
|
|
|
480
505
|
return timestamp.isAfter(dateLimit);
|
|
481
506
|
}
|
|
482
507
|
};
|
|
508
|
+
__name(_DateUtils, "DateUtils");
|
|
483
509
|
//#region Holidays
|
|
484
510
|
/** Holidays 2025-2030 as YYYY-MM-DD strings */
|
|
485
|
-
_DateUtils
|
|
511
|
+
__publicField(_DateUtils, "HOLIDAYS_STR", [
|
|
486
512
|
/* 2025 */
|
|
487
513
|
"2025-01-01",
|
|
488
514
|
"2025-04-18",
|
|
@@ -567,13 +593,13 @@ _DateUtils.HOLIDAYS_STR = [
|
|
|
567
593
|
"2030-12-24",
|
|
568
594
|
"2030-12-25",
|
|
569
595
|
"2030-12-26"
|
|
570
|
-
];
|
|
596
|
+
]);
|
|
571
597
|
/** Holidays 2025-2030 as UTC timestamps */
|
|
572
|
-
_DateUtils
|
|
598
|
+
__publicField(_DateUtils, "HOLIDAYS", _DateUtils.HOLIDAYS_STR.map((h) => {
|
|
573
599
|
const date = new Date(h);
|
|
574
600
|
date.setUTCHours(0, 0, 0, 0);
|
|
575
601
|
return date.getTime();
|
|
576
|
-
});
|
|
602
|
+
}));
|
|
577
603
|
var DateUtils = _DateUtils;
|
|
578
604
|
|
|
579
605
|
// src/common/promise-magic/deferred.ts
|
|
@@ -584,13 +610,18 @@ function createDeferred() {
|
|
|
584
610
|
resolve = res;
|
|
585
611
|
reject = rej;
|
|
586
612
|
});
|
|
587
|
-
return {
|
|
613
|
+
return {
|
|
614
|
+
promise,
|
|
615
|
+
resolve,
|
|
616
|
+
reject
|
|
617
|
+
};
|
|
588
618
|
}
|
|
619
|
+
__name(createDeferred, "createDeferred");
|
|
589
620
|
|
|
590
621
|
// src/common/promise-magic/single-promise-waiter.ts
|
|
591
|
-
var
|
|
622
|
+
var _SinglePromiseWaiter = class _SinglePromiseWaiter {
|
|
592
623
|
constructor() {
|
|
593
|
-
this
|
|
624
|
+
__publicField(this, "_promise", null);
|
|
594
625
|
}
|
|
595
626
|
static getInstance() {
|
|
596
627
|
if (!_SinglePromiseWaiter._instance) {
|
|
@@ -613,6 +644,9 @@ var SinglePromiseWaiter = class _SinglePromiseWaiter {
|
|
|
613
644
|
return this._promise !== null;
|
|
614
645
|
}
|
|
615
646
|
};
|
|
647
|
+
__name(_SinglePromiseWaiter, "SinglePromiseWaiter");
|
|
648
|
+
__publicField(_SinglePromiseWaiter, "_instance");
|
|
649
|
+
var SinglePromiseWaiter = _SinglePromiseWaiter;
|
|
616
650
|
|
|
617
651
|
// src/common/winston.ts
|
|
618
652
|
import winston from "winston";
|
|
@@ -627,28 +661,28 @@ var levelToSeverity = {
|
|
|
627
661
|
warn: "warn",
|
|
628
662
|
error: "error"
|
|
629
663
|
};
|
|
630
|
-
var baseFormat = winston.format.combine(
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
);
|
|
664
|
+
var baseFormat = winston.format.combine(winston.format.timestamp({
|
|
665
|
+
format: /* @__PURE__ */ __name(() => (/* @__PURE__ */ new Date()).toISOString(), "format")
|
|
666
|
+
}), winston.format.errors({
|
|
667
|
+
stack: true
|
|
668
|
+
}), winston.format.printf((info) => {
|
|
669
|
+
const payload = {
|
|
670
|
+
ts: info.timestamp,
|
|
671
|
+
level: info.level,
|
|
672
|
+
severity: levelToSeverity[info.level] || info.level,
|
|
673
|
+
message: info.message,
|
|
674
|
+
service: SERVICE,
|
|
675
|
+
env: ENV,
|
|
676
|
+
process_name: process.title || process.argv[1] || "node",
|
|
677
|
+
pid: process.pid,
|
|
678
|
+
device: process.env.DEVICE_ID || void 0,
|
|
679
|
+
traceId: info.traceId,
|
|
680
|
+
spanId: info.spanId,
|
|
681
|
+
extra: info.extra || info.meta || void 0,
|
|
682
|
+
stack: info.stack
|
|
683
|
+
};
|
|
684
|
+
return JSON.stringify(payload);
|
|
685
|
+
}));
|
|
652
686
|
var transports = [
|
|
653
687
|
new winston.transports.Console({
|
|
654
688
|
level: process.env.LOG_LEVEL || "info"
|
|
@@ -661,7 +695,7 @@ var logger = winston.createLogger({
|
|
|
661
695
|
exitOnError: false
|
|
662
696
|
});
|
|
663
697
|
logger.stream = {
|
|
664
|
-
write: (message) => logger.info(message.trim())
|
|
698
|
+
write: /* @__PURE__ */ __name((message) => logger.info(message.trim()), "write")
|
|
665
699
|
};
|
|
666
700
|
|
|
667
701
|
// src/common/utils/is-cron-valid.ts
|
|
@@ -673,6 +707,7 @@ function isValidCron(expr) {
|
|
|
673
707
|
const cronPart = /^(\*|\d+|\d+\-\d+|\d+\/\d+|\*\/\d+)(,\d+)*$/;
|
|
674
708
|
return parts.every((part) => cronPart.test(part));
|
|
675
709
|
}
|
|
710
|
+
__name(isValidCron, "isValidCron");
|
|
676
711
|
|
|
677
712
|
// src/common/patterns/singleton.ts
|
|
678
713
|
var _Singleton = class _Singleton {
|
|
@@ -684,40 +719,80 @@ var _Singleton = class _Singleton {
|
|
|
684
719
|
}
|
|
685
720
|
_Singleton.instances.set(ctor, this);
|
|
686
721
|
}
|
|
722
|
+
static getInstance(...args) {
|
|
723
|
+
let instance = _Singleton.instances.get(this);
|
|
724
|
+
if (!instance) {
|
|
725
|
+
instance = new this(...args);
|
|
726
|
+
_Singleton.instances.set(this, instance);
|
|
727
|
+
}
|
|
728
|
+
return instance;
|
|
729
|
+
}
|
|
687
730
|
};
|
|
688
|
-
_Singleton
|
|
731
|
+
__name(_Singleton, "Singleton");
|
|
732
|
+
__publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
|
|
689
733
|
var Singleton = _Singleton;
|
|
690
734
|
|
|
691
735
|
// src/common/dto/status-dto.ts
|
|
692
|
-
var
|
|
736
|
+
var _StatusDto = class _StatusDto {
|
|
693
737
|
constructor(status, details, timestamp) {
|
|
738
|
+
/**
|
|
739
|
+
* Call result status
|
|
740
|
+
*/
|
|
741
|
+
__publicField(this, "status");
|
|
742
|
+
/**
|
|
743
|
+
* UTC Timestamp
|
|
744
|
+
* @example "2021-12-01T13:23:39.305Z"
|
|
745
|
+
*/
|
|
746
|
+
__publicField(this, "timestamp");
|
|
747
|
+
/**
|
|
748
|
+
* Details (optional)
|
|
749
|
+
*/
|
|
750
|
+
__publicField(this, "details");
|
|
694
751
|
this.status = status;
|
|
695
752
|
this.details = details;
|
|
696
753
|
this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
|
|
697
754
|
}
|
|
698
755
|
};
|
|
756
|
+
__name(_StatusDto, "StatusDto");
|
|
757
|
+
var StatusDto = _StatusDto;
|
|
699
758
|
|
|
700
759
|
// src/common/constants/amount-unit.ts
|
|
701
760
|
var AMOUNT_UNIT = {
|
|
702
|
-
1: {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
761
|
+
1: {
|
|
762
|
+
symbol: "g",
|
|
763
|
+
translations: {
|
|
764
|
+
en: "gram",
|
|
765
|
+
cs: "gram"
|
|
766
|
+
}
|
|
767
|
+
},
|
|
768
|
+
2: {
|
|
769
|
+
symbol: "kg",
|
|
770
|
+
translations: {
|
|
771
|
+
en: "kilogram",
|
|
772
|
+
cs: "kilogram"
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
3: {
|
|
776
|
+
symbol: "ml",
|
|
777
|
+
translations: {
|
|
778
|
+
en: "milliliter",
|
|
779
|
+
cs: "mililitr"
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
4: {
|
|
783
|
+
symbol: "l",
|
|
784
|
+
translations: {
|
|
785
|
+
en: "liter",
|
|
786
|
+
cs: "litr"
|
|
787
|
+
}
|
|
788
|
+
}
|
|
706
789
|
};
|
|
707
790
|
|
|
708
791
|
// src/common/schema/entities/category.entity.ts
|
|
709
792
|
import { Entity } from "typeorm";
|
|
710
793
|
|
|
711
794
|
// src/database/entities/fresh-entity.ts
|
|
712
|
-
import {
|
|
713
|
-
BaseEntity,
|
|
714
|
-
PrimaryGeneratedColumn,
|
|
715
|
-
CreateDateColumn,
|
|
716
|
-
UpdateDateColumn,
|
|
717
|
-
DeleteDateColumn,
|
|
718
|
-
Index,
|
|
719
|
-
Column
|
|
720
|
-
} from "typeorm";
|
|
795
|
+
import { BaseEntity, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, Column } from "typeorm";
|
|
721
796
|
|
|
722
797
|
// ../../node_modules/uuid/dist/esm/stringify.js
|
|
723
798
|
var byteToHex = [];
|
|
@@ -727,6 +802,7 @@ for (let i = 0; i < 256; ++i) {
|
|
|
727
802
|
function unsafeStringify(arr, offset = 0) {
|
|
728
803
|
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();
|
|
729
804
|
}
|
|
805
|
+
__name(unsafeStringify, "unsafeStringify");
|
|
730
806
|
|
|
731
807
|
// ../../node_modules/uuid/dist/esm/rng.js
|
|
732
808
|
import { randomFillSync } from "crypto";
|
|
@@ -739,10 +815,13 @@ function rng() {
|
|
|
739
815
|
}
|
|
740
816
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
741
817
|
}
|
|
818
|
+
__name(rng, "rng");
|
|
742
819
|
|
|
743
820
|
// ../../node_modules/uuid/dist/esm/native.js
|
|
744
821
|
import { randomUUID } from "crypto";
|
|
745
|
-
var native_default = {
|
|
822
|
+
var native_default = {
|
|
823
|
+
randomUUID
|
|
824
|
+
};
|
|
746
825
|
|
|
747
826
|
// ../../node_modules/uuid/dist/esm/v4.js
|
|
748
827
|
function v4(options, buf, offset) {
|
|
@@ -769,13 +848,31 @@ function v4(options, buf, offset) {
|
|
|
769
848
|
}
|
|
770
849
|
return unsafeStringify(rnds);
|
|
771
850
|
}
|
|
851
|
+
__name(v4, "v4");
|
|
772
852
|
var v4_default = v4;
|
|
773
853
|
|
|
774
854
|
// src/database/entities/fresh-entity.ts
|
|
775
|
-
|
|
855
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
856
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
857
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
858
|
+
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;
|
|
859
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
860
|
+
}
|
|
861
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
862
|
+
function _ts_metadata(k, v) {
|
|
863
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
864
|
+
}
|
|
865
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
866
|
+
var _FreshEntity = class _FreshEntity extends BaseEntity {
|
|
776
867
|
/** After manual construction `id` is irrelevant. Refer to `uuid` only, because that will be inserted into DB */
|
|
777
868
|
constructor() {
|
|
778
869
|
super();
|
|
870
|
+
__publicField(this, "id");
|
|
871
|
+
__publicField(this, "uuid");
|
|
872
|
+
__publicField(this, "created_at");
|
|
873
|
+
__publicField(this, "updated_at");
|
|
874
|
+
// for soft delete methods by typeorm
|
|
875
|
+
__publicField(this, "deleted_at");
|
|
779
876
|
this.id = 0;
|
|
780
877
|
this.uuid = v4_default();
|
|
781
878
|
const newDate = /* @__PURE__ */ new Date();
|
|
@@ -784,22 +881,41 @@ var FreshEntity = class extends BaseEntity {
|
|
|
784
881
|
this.deleted_at = null;
|
|
785
882
|
}
|
|
786
883
|
};
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
], FreshEntity.prototype, "
|
|
884
|
+
__name(_FreshEntity, "FreshEntity");
|
|
885
|
+
var FreshEntity = _FreshEntity;
|
|
886
|
+
_ts_decorate([
|
|
887
|
+
PrimaryGeneratedColumn("increment"),
|
|
888
|
+
_ts_metadata("design:type", Number)
|
|
889
|
+
], FreshEntity.prototype, "id", void 0);
|
|
890
|
+
_ts_decorate([
|
|
891
|
+
Index({
|
|
892
|
+
unique: true
|
|
893
|
+
}),
|
|
894
|
+
Column({
|
|
895
|
+
type: "uuid",
|
|
896
|
+
default: /* @__PURE__ */ __name(() => "timescale.uuid_generate_v4()", "default")
|
|
897
|
+
}),
|
|
898
|
+
_ts_metadata("design:type", String)
|
|
899
|
+
], FreshEntity.prototype, "uuid", void 0);
|
|
900
|
+
_ts_decorate([
|
|
901
|
+
CreateDateColumn({
|
|
902
|
+
type: "timestamptz"
|
|
903
|
+
}),
|
|
904
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
905
|
+
], FreshEntity.prototype, "created_at", void 0);
|
|
906
|
+
_ts_decorate([
|
|
907
|
+
UpdateDateColumn({
|
|
908
|
+
type: "timestamptz"
|
|
909
|
+
}),
|
|
910
|
+
_ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
|
|
911
|
+
], FreshEntity.prototype, "updated_at", void 0);
|
|
912
|
+
_ts_decorate([
|
|
913
|
+
DeleteDateColumn({
|
|
914
|
+
type: "timestamptz",
|
|
915
|
+
nullable: true
|
|
916
|
+
}),
|
|
917
|
+
_ts_metadata("design:type", Object)
|
|
918
|
+
], FreshEntity.prototype, "deleted_at", void 0);
|
|
803
919
|
|
|
804
920
|
// src/database/entities/fresh-hyper-entity.ts
|
|
805
921
|
import { BaseEntity as BaseEntity2, PrimaryColumn } from "typeorm";
|
|
@@ -810,33 +926,55 @@ function TimestampColumn(options = {}) {
|
|
|
810
926
|
const defaultOptions = {
|
|
811
927
|
type: "timestamptz",
|
|
812
928
|
nullable: false,
|
|
813
|
-
default: () => "CURRENT_TIMESTAMP",
|
|
929
|
+
default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
|
|
814
930
|
...options
|
|
815
931
|
};
|
|
816
932
|
return Column2(defaultOptions);
|
|
817
933
|
}
|
|
934
|
+
__name(TimestampColumn, "TimestampColumn");
|
|
818
935
|
|
|
819
936
|
// src/database/entities/fresh-hyper-entity.ts
|
|
820
|
-
|
|
937
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
938
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
939
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
940
|
+
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;
|
|
941
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
942
|
+
}
|
|
943
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
944
|
+
function _ts_metadata2(k, v) {
|
|
945
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
946
|
+
}
|
|
947
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
948
|
+
var _FreshHyperEntity = class _FreshHyperEntity extends BaseEntity2 {
|
|
821
949
|
/** After manual construction `id` is irrelevant */
|
|
822
950
|
constructor(timestamp) {
|
|
823
951
|
super();
|
|
952
|
+
// input timestamp as PK
|
|
953
|
+
__publicField(this, "timestamp");
|
|
954
|
+
// just info column about time of insert
|
|
955
|
+
__publicField(this, "created_at");
|
|
824
956
|
this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
|
|
825
957
|
this.created_at = /* @__PURE__ */ new Date();
|
|
826
958
|
}
|
|
827
959
|
};
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
960
|
+
__name(_FreshHyperEntity, "FreshHyperEntity");
|
|
961
|
+
var FreshHyperEntity = _FreshHyperEntity;
|
|
962
|
+
_ts_decorate2([
|
|
963
|
+
PrimaryColumn({
|
|
964
|
+
type: "timestamptz"
|
|
965
|
+
}),
|
|
966
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
967
|
+
], FreshHyperEntity.prototype, "timestamp", void 0);
|
|
968
|
+
_ts_decorate2([
|
|
969
|
+
TimestampColumn(),
|
|
970
|
+
_ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
|
|
971
|
+
], FreshHyperEntity.prototype, "created_at", void 0);
|
|
834
972
|
|
|
835
973
|
// src/database/entities/fresh-translation-entity.ts
|
|
836
974
|
import { PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column3, BaseEntity as BaseEntity3, Check } from "typeorm";
|
|
837
975
|
|
|
838
976
|
// src/enums/action-command-code.ts
|
|
839
|
-
var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2)
|
|
977
|
+
var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
|
|
840
978
|
ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
|
|
841
979
|
ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
|
|
842
980
|
ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
|
|
@@ -845,20 +983,20 @@ var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2) => {
|
|
|
845
983
|
ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
|
|
846
984
|
ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
|
|
847
985
|
return ActionCommandCode2;
|
|
848
|
-
})(
|
|
986
|
+
})({});
|
|
849
987
|
|
|
850
988
|
// src/enums/depot-pool-status.ts
|
|
851
|
-
var DepotPoolStatus = /* @__PURE__ */ ((DepotPoolStatus2)
|
|
989
|
+
var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
|
|
852
990
|
DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
|
|
853
991
|
DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
|
|
854
992
|
DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
|
|
855
993
|
DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
|
|
856
994
|
DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
|
|
857
995
|
return DepotPoolStatus2;
|
|
858
|
-
})(
|
|
996
|
+
})({});
|
|
859
997
|
|
|
860
998
|
// src/enums/http-status.ts
|
|
861
|
-
var HttpStatus = /* @__PURE__ */ ((HttpStatus2)
|
|
999
|
+
var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
|
|
862
1000
|
HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
|
|
863
1001
|
HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
864
1002
|
HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
|
|
@@ -922,28 +1060,28 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
|
|
|
922
1060
|
HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
923
1061
|
HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
924
1062
|
return HttpStatus2;
|
|
925
|
-
})(
|
|
1063
|
+
})({});
|
|
926
1064
|
|
|
927
1065
|
// src/enums/language-code.ts
|
|
928
|
-
var LanguageCode = /* @__PURE__ */ ((LanguageCode2)
|
|
1066
|
+
var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
|
|
929
1067
|
LanguageCode2["CS"] = "cs";
|
|
930
1068
|
LanguageCode2["EN"] = "en";
|
|
931
1069
|
LanguageCode2["DE"] = "de";
|
|
932
1070
|
LanguageCode2["PL"] = "pl";
|
|
933
1071
|
LanguageCode2["SK"] = "sk";
|
|
934
1072
|
return LanguageCode2;
|
|
935
|
-
})(
|
|
1073
|
+
})({});
|
|
936
1074
|
|
|
937
1075
|
// src/enums/payment-method.ts
|
|
938
|
-
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2)
|
|
1076
|
+
var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
|
|
939
1077
|
PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
|
|
940
1078
|
PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
|
|
941
1079
|
PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
|
|
942
1080
|
return PaymentMethod2;
|
|
943
|
-
})(
|
|
1081
|
+
})({});
|
|
944
1082
|
|
|
945
1083
|
// src/enums/transaction-type.ts
|
|
946
|
-
var TransactionType = /* @__PURE__ */ ((TransactionType2)
|
|
1084
|
+
var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
|
|
947
1085
|
TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
|
|
948
1086
|
TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
|
|
949
1087
|
TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
|
|
@@ -955,81 +1093,142 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
|
|
|
955
1093
|
TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
|
|
956
1094
|
TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
|
|
957
1095
|
return TransactionType2;
|
|
958
|
-
})(
|
|
1096
|
+
})({});
|
|
959
1097
|
|
|
960
1098
|
// src/database/entities/fresh-translation-entity.ts
|
|
1099
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
1100
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1101
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1102
|
+
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;
|
|
1103
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1104
|
+
}
|
|
1105
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
1106
|
+
function _ts_metadata3(k, v) {
|
|
1107
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1108
|
+
}
|
|
1109
|
+
__name(_ts_metadata3, "_ts_metadata");
|
|
961
1110
|
var languageValues = Object.values(LanguageCode).map((v) => `'${v}'`).join(",");
|
|
962
|
-
var
|
|
1111
|
+
var _FreshTranslationBase = class _FreshTranslationBase extends BaseEntity3 {
|
|
963
1112
|
constructor() {
|
|
964
1113
|
super();
|
|
1114
|
+
__publicField(this, "id");
|
|
1115
|
+
__publicField(this, "languageCode");
|
|
965
1116
|
this.id = 0;
|
|
966
|
-
this.languageCode =
|
|
1117
|
+
this.languageCode = LanguageCode.CS;
|
|
967
1118
|
}
|
|
968
1119
|
};
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1120
|
+
__name(_FreshTranslationBase, "FreshTranslationBase");
|
|
1121
|
+
var FreshTranslationBase = _FreshTranslationBase;
|
|
1122
|
+
_ts_decorate3([
|
|
1123
|
+
PrimaryGeneratedColumn2(),
|
|
1124
|
+
_ts_metadata3("design:type", Number)
|
|
1125
|
+
], FreshTranslationBase.prototype, "id", void 0);
|
|
1126
|
+
_ts_decorate3([
|
|
973
1127
|
Column3({
|
|
974
1128
|
type: "varchar",
|
|
975
1129
|
length: 3,
|
|
976
1130
|
nullable: false
|
|
977
1131
|
}),
|
|
978
|
-
Check(`"languageCode" IN (${languageValues})`)
|
|
979
|
-
|
|
1132
|
+
Check(`"languageCode" IN (${languageValues})`),
|
|
1133
|
+
_ts_metadata3("design:type", typeof LanguageCode === "undefined" ? Object : LanguageCode)
|
|
1134
|
+
], FreshTranslationBase.prototype, "languageCode", void 0);
|
|
980
1135
|
|
|
981
1136
|
// src/database/dao/fresh-dao.ts
|
|
982
|
-
var
|
|
1137
|
+
var _FreshDao = class _FreshDao {
|
|
983
1138
|
};
|
|
1139
|
+
__name(_FreshDao, "FreshDao");
|
|
1140
|
+
var FreshDao = _FreshDao;
|
|
984
1141
|
|
|
985
1142
|
// src/common/schema/entities/category.entity.ts
|
|
986
|
-
|
|
987
|
-
|
|
1143
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
1144
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1145
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1146
|
+
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;
|
|
1147
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1148
|
+
}
|
|
1149
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
1150
|
+
var _Category = class _Category extends FreshEntity {
|
|
988
1151
|
};
|
|
989
|
-
Category
|
|
1152
|
+
__name(_Category, "Category");
|
|
1153
|
+
var Category = _Category;
|
|
1154
|
+
Category = _ts_decorate4([
|
|
990
1155
|
Entity()
|
|
991
1156
|
], Category);
|
|
992
1157
|
|
|
993
1158
|
// src/common/schema/entities/device.entity.ts
|
|
994
1159
|
import { Entity as Entity2 } from "typeorm";
|
|
995
|
-
|
|
996
|
-
|
|
1160
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
1161
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1162
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1163
|
+
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;
|
|
1164
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1165
|
+
}
|
|
1166
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
1167
|
+
var _Device = class _Device extends FreshEntity {
|
|
997
1168
|
};
|
|
998
|
-
Device
|
|
1169
|
+
__name(_Device, "Device");
|
|
1170
|
+
var Device = _Device;
|
|
1171
|
+
Device = _ts_decorate5([
|
|
999
1172
|
Entity2()
|
|
1000
1173
|
], Device);
|
|
1001
1174
|
|
|
1002
1175
|
// src/common/schema/entities/manufacturer.entity.ts
|
|
1003
1176
|
import { Entity as Entity3 } from "typeorm";
|
|
1004
|
-
|
|
1005
|
-
|
|
1177
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1178
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1179
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1180
|
+
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;
|
|
1181
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1182
|
+
}
|
|
1183
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
1184
|
+
var _Manufacturer = class _Manufacturer extends FreshEntity {
|
|
1006
1185
|
};
|
|
1007
|
-
Manufacturer
|
|
1186
|
+
__name(_Manufacturer, "Manufacturer");
|
|
1187
|
+
var Manufacturer = _Manufacturer;
|
|
1188
|
+
Manufacturer = _ts_decorate6([
|
|
1008
1189
|
Entity3()
|
|
1009
1190
|
], Manufacturer);
|
|
1010
1191
|
|
|
1011
1192
|
// src/common/schema/entities/product.entity.ts
|
|
1012
1193
|
import { Entity as Entity4 } from "typeorm";
|
|
1013
|
-
|
|
1014
|
-
|
|
1194
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
1195
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1196
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1197
|
+
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;
|
|
1198
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1199
|
+
}
|
|
1200
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
1201
|
+
var _Product = class _Product extends FreshEntity {
|
|
1015
1202
|
};
|
|
1016
|
-
Product
|
|
1203
|
+
__name(_Product, "Product");
|
|
1204
|
+
var Product = _Product;
|
|
1205
|
+
Product = _ts_decorate7([
|
|
1017
1206
|
Entity4()
|
|
1018
1207
|
], Product);
|
|
1019
1208
|
|
|
1020
1209
|
// src/common/schema/entities/subcategory.entity.ts
|
|
1021
1210
|
import { Entity as Entity5 } from "typeorm";
|
|
1022
|
-
|
|
1023
|
-
|
|
1211
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
1212
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1213
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1214
|
+
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;
|
|
1215
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1216
|
+
}
|
|
1217
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
1218
|
+
var _Subcategory = class _Subcategory extends FreshEntity {
|
|
1024
1219
|
};
|
|
1025
|
-
Subcategory
|
|
1220
|
+
__name(_Subcategory, "Subcategory");
|
|
1221
|
+
var Subcategory = _Subcategory;
|
|
1222
|
+
Subcategory = _ts_decorate8([
|
|
1026
1223
|
Entity5()
|
|
1027
1224
|
], Subcategory);
|
|
1028
1225
|
|
|
1029
1226
|
// src/core/data-helper.ts
|
|
1030
|
-
var
|
|
1227
|
+
var _DataHelper = class _DataHelper {
|
|
1031
1228
|
constructor(startDataRetrieve = true, deviceIds) {
|
|
1032
|
-
this
|
|
1229
|
+
__publicField(this, "_data");
|
|
1230
|
+
__publicField(this, "_dataPromise", null);
|
|
1231
|
+
__publicField(this, "deviceIds");
|
|
1033
1232
|
this.deviceIds = deviceIds;
|
|
1034
1233
|
if (startDataRetrieve) {
|
|
1035
1234
|
this._dataPromise = this.startDataRetrieval();
|
|
@@ -1058,31 +1257,33 @@ var DataHelper = class {
|
|
|
1058
1257
|
return this._data;
|
|
1059
1258
|
}
|
|
1060
1259
|
};
|
|
1260
|
+
__name(_DataHelper, "DataHelper");
|
|
1261
|
+
var DataHelper = _DataHelper;
|
|
1061
1262
|
|
|
1062
1263
|
// src/core/class/fresh-job.ts
|
|
1063
1264
|
import { scheduleJob } from "node-schedule";
|
|
1064
|
-
var
|
|
1265
|
+
var _FreshJob = class _FreshJob extends Singleton {
|
|
1065
1266
|
/**
|
|
1066
1267
|
* @param cronExpression must be cron of just numbers ex.: `0 5 * * 4`
|
|
1067
1268
|
* By default timezone is added " Europe/Prague"
|
|
1068
1269
|
*/
|
|
1069
1270
|
constructor(jobName, cronExpression, jobEnabled) {
|
|
1070
1271
|
super();
|
|
1071
|
-
this
|
|
1272
|
+
__publicField(this, "_jobName");
|
|
1273
|
+
__publicField(this, "_cronExpression");
|
|
1274
|
+
__publicField(this, "_job", null);
|
|
1072
1275
|
this._jobName = jobName;
|
|
1073
1276
|
if (!isValidCron(cronExpression)) {
|
|
1074
|
-
throw new Error(
|
|
1075
|
-
`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`
|
|
1076
|
-
);
|
|
1277
|
+
throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
|
|
1077
1278
|
}
|
|
1078
1279
|
this._cronExpression = cronExpression;
|
|
1079
1280
|
if (jobEnabled) {
|
|
1080
|
-
this._job = scheduleJob(
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
);
|
|
1281
|
+
this._job = scheduleJob({
|
|
1282
|
+
rule: this._cronExpression,
|
|
1283
|
+
tz: "Europe/Prague"
|
|
1284
|
+
}, async () => {
|
|
1285
|
+
await this.invoke();
|
|
1286
|
+
});
|
|
1086
1287
|
if (!this._job) {
|
|
1087
1288
|
throw new Error(`Job ${this._jobName} could not be scheduled`);
|
|
1088
1289
|
}
|
|
@@ -1091,9 +1292,7 @@ var FreshJob = class extends Singleton {
|
|
|
1091
1292
|
}
|
|
1092
1293
|
/** Just logging */
|
|
1093
1294
|
onInit(rescheduled) {
|
|
1094
|
-
console.log(
|
|
1095
|
-
`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`
|
|
1096
|
-
);
|
|
1295
|
+
console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
|
|
1097
1296
|
}
|
|
1098
1297
|
get jobName() {
|
|
1099
1298
|
return this._jobName;
|
|
@@ -1114,21 +1313,27 @@ var FreshJob = class extends Singleton {
|
|
|
1114
1313
|
this._job = value;
|
|
1115
1314
|
}
|
|
1116
1315
|
};
|
|
1316
|
+
__name(_FreshJob, "FreshJob");
|
|
1317
|
+
var FreshJob = _FreshJob;
|
|
1117
1318
|
|
|
1118
1319
|
// src/core/errors/api-error.ts
|
|
1119
|
-
var
|
|
1320
|
+
var _ApiError = class _ApiError extends Error {
|
|
1321
|
+
constructor(statusCode, status, detail) {
|
|
1322
|
+
super();
|
|
1323
|
+
__publicField(this, "_statusCode");
|
|
1324
|
+
__publicField(this, "_statusDto");
|
|
1325
|
+
this._statusCode = statusCode;
|
|
1326
|
+
this._statusDto = new StatusDto(status, detail);
|
|
1327
|
+
}
|
|
1120
1328
|
get statusCode() {
|
|
1121
1329
|
return this._statusCode;
|
|
1122
1330
|
}
|
|
1123
1331
|
get statusDto() {
|
|
1124
1332
|
return this._statusDto;
|
|
1125
1333
|
}
|
|
1126
|
-
constructor(statusCode, status, detail) {
|
|
1127
|
-
super();
|
|
1128
|
-
this._statusCode = statusCode;
|
|
1129
|
-
this._statusDto = new StatusDto(status, detail);
|
|
1130
|
-
}
|
|
1131
1334
|
};
|
|
1335
|
+
__name(_ApiError, "ApiError");
|
|
1336
|
+
var ApiError = _ApiError;
|
|
1132
1337
|
|
|
1133
1338
|
// src/config/eslint-config.ts
|
|
1134
1339
|
import tseslint from "typescript-eslint";
|
|
@@ -1139,7 +1344,10 @@ var FRESH_ESLINT_CONFIG = [
|
|
|
1139
1344
|
// Prettier integration
|
|
1140
1345
|
...eslintConfigPrettier,
|
|
1141
1346
|
// Affected files
|
|
1142
|
-
files: [
|
|
1347
|
+
files: [
|
|
1348
|
+
"**/*.ts",
|
|
1349
|
+
"**/*.tsx"
|
|
1350
|
+
],
|
|
1143
1351
|
ignores: [
|
|
1144
1352
|
"dist/**",
|
|
1145
1353
|
"node_modules/**",
|
|
@@ -1164,26 +1372,49 @@ var FRESH_ESLINT_CONFIG = [
|
|
|
1164
1372
|
// no lets or vars
|
|
1165
1373
|
"prefer-const": "error",
|
|
1166
1374
|
// blocks ("red" === color) these ifs
|
|
1167
|
-
yoda: [
|
|
1168
|
-
|
|
1375
|
+
yoda: [
|
|
1376
|
+
"error",
|
|
1377
|
+
"never"
|
|
1378
|
+
],
|
|
1379
|
+
"no-multiple-empty-lines": [
|
|
1380
|
+
"error",
|
|
1381
|
+
{
|
|
1382
|
+
max: 1
|
|
1383
|
+
}
|
|
1384
|
+
],
|
|
1169
1385
|
// semi-colons
|
|
1170
|
-
semi: [
|
|
1386
|
+
semi: [
|
|
1387
|
+
"error",
|
|
1388
|
+
"always"
|
|
1389
|
+
],
|
|
1171
1390
|
// forces block for all control statements (forbid one-line returns)
|
|
1172
|
-
curly: [
|
|
1391
|
+
curly: [
|
|
1392
|
+
"error",
|
|
1393
|
+
"all"
|
|
1394
|
+
],
|
|
1173
1395
|
// makes spaces between brackets
|
|
1174
|
-
"object-curly-spacing": [
|
|
1396
|
+
"object-curly-spacing": [
|
|
1397
|
+
"error",
|
|
1398
|
+
"always"
|
|
1399
|
+
],
|
|
1175
1400
|
// checks same if/else conditions
|
|
1176
1401
|
"no-dupe-else-if": "error",
|
|
1177
1402
|
// keeps imports from one package in same declaration
|
|
1178
1403
|
"no-duplicate-imports": "error",
|
|
1179
1404
|
// blocks simple '=' in condition blocks
|
|
1180
|
-
"no-cond-assign": [
|
|
1405
|
+
"no-cond-assign": [
|
|
1406
|
+
"error",
|
|
1407
|
+
"always"
|
|
1408
|
+
],
|
|
1181
1409
|
// forbids promise inside promise
|
|
1182
1410
|
"no-async-promise-executor": "error",
|
|
1183
1411
|
// watches possible falltrough in switch cases
|
|
1184
1412
|
"no-fallthrough": "error",
|
|
1185
1413
|
// use === instead of ==
|
|
1186
|
-
eqeqeq: [
|
|
1414
|
+
eqeqeq: [
|
|
1415
|
+
"error",
|
|
1416
|
+
"always"
|
|
1417
|
+
],
|
|
1187
1418
|
// Prettier formatting rules
|
|
1188
1419
|
"prettier/prettier": [
|
|
1189
1420
|
"error",
|
|
@@ -1209,23 +1440,40 @@ var FRESH_ESLINT_CONFIG = [
|
|
|
1209
1440
|
"@typescript-eslint/naming-convention": [
|
|
1210
1441
|
"error",
|
|
1211
1442
|
{
|
|
1212
|
-
selector: [
|
|
1213
|
-
|
|
1443
|
+
selector: [
|
|
1444
|
+
"variable",
|
|
1445
|
+
"function"
|
|
1446
|
+
],
|
|
1447
|
+
format: [
|
|
1448
|
+
"camelCase"
|
|
1449
|
+
],
|
|
1214
1450
|
leadingUnderscore: "allow"
|
|
1215
1451
|
},
|
|
1216
1452
|
{
|
|
1217
1453
|
selector: "class",
|
|
1218
|
-
format: [
|
|
1454
|
+
format: [
|
|
1455
|
+
"PascalCase"
|
|
1456
|
+
]
|
|
1219
1457
|
},
|
|
1220
1458
|
{
|
|
1221
1459
|
selector: "variable",
|
|
1222
|
-
modifiers: [
|
|
1223
|
-
|
|
1460
|
+
modifiers: [
|
|
1461
|
+
"const",
|
|
1462
|
+
"exported"
|
|
1463
|
+
],
|
|
1464
|
+
format: [
|
|
1465
|
+
"UPPER_CASE",
|
|
1466
|
+
"PascalCase"
|
|
1467
|
+
]
|
|
1224
1468
|
},
|
|
1225
1469
|
{
|
|
1226
1470
|
selector: "property",
|
|
1227
|
-
modifiers: [
|
|
1228
|
-
|
|
1471
|
+
modifiers: [
|
|
1472
|
+
"readonly"
|
|
1473
|
+
],
|
|
1474
|
+
format: [
|
|
1475
|
+
"UPPER_CASE"
|
|
1476
|
+
]
|
|
1229
1477
|
}
|
|
1230
1478
|
]
|
|
1231
1479
|
}
|
|
@@ -1250,8 +1498,12 @@ var PG_DATA_SOURCE_OPTIONS = {
|
|
|
1250
1498
|
password: process.env.POSTGRE_SQL_PASSWORD || "<password>",
|
|
1251
1499
|
database: process.env.POSTGRE_SQL_DATABASE || "<database>",
|
|
1252
1500
|
schema: process.env.POSTGRE_SQL_SCHEMA || "<scheme>",
|
|
1253
|
-
entities: [
|
|
1254
|
-
|
|
1501
|
+
entities: [
|
|
1502
|
+
path.join(basePath, isTs ? "src/entity/*.{ts,js}" : "build/entity/*.js")
|
|
1503
|
+
],
|
|
1504
|
+
migrations: [
|
|
1505
|
+
path.join(basePath, isTs ? "src/migration/*.{ts,js}" : "build/migration/*.js")
|
|
1506
|
+
],
|
|
1255
1507
|
migrationsRun: process.env.RUN_MIGRATIONS === "true",
|
|
1256
1508
|
migrationsTableName: "migrations",
|
|
1257
1509
|
migrationsTransactionMode: "each",
|
|
@@ -1263,7 +1515,6 @@ var PG_DATA_SOURCE_OPTIONS = {
|
|
|
1263
1515
|
useUTC: true,
|
|
1264
1516
|
cache: true,
|
|
1265
1517
|
namingStrategy: new SnakeNamingStrategy()
|
|
1266
|
-
// replication: undefined,
|
|
1267
1518
|
};
|
|
1268
1519
|
var datasource_default = PG_DATA_SOURCE_OPTIONS;
|
|
1269
1520
|
export {
|