@freshpointcz/fresh-core 0.0.12 → 0.0.14

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.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 __decorateClass = (decorators, target, key, kind) => {
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 { ciphertext, key };
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 { parsed };
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 = [dotenvPath];
276
+ let optionPaths = [
277
+ dotenvPath
278
+ ];
267
279
  if (options && options.path) {
268
280
  if (!Array.isArray(options.path)) {
269
- optionPaths = [_resolveHome(options.path)];
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, { encoding }));
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 { parsed: parsedAll, error: lastError };
328
+ return {
329
+ parsed: parsedAll,
330
+ error: lastError
331
+ };
313
332
  } else {
314
- return { parsed: parsedAll };
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.HOLIDAYS_STR = [
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.HOLIDAYS = _DateUtils.HOLIDAYS_STR.map((h) => {
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 { promise, resolve, reject };
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 SinglePromiseWaiter = class _SinglePromiseWaiter {
622
+ var _SinglePromiseWaiter = class _SinglePromiseWaiter {
592
623
  constructor() {
593
- this._promise = null;
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
- winston.format.timestamp({ format: () => (/* @__PURE__ */ new Date()).toISOString() }),
632
- winston.format.errors({ stack: true }),
633
- winston.format.printf((info) => {
634
- const payload = {
635
- ts: info.timestamp,
636
- level: info.level,
637
- severity: levelToSeverity[info.level] || info.level,
638
- message: info.message,
639
- service: SERVICE,
640
- env: ENV,
641
- process_name: process.title || process.argv[1] || "node",
642
- pid: process.pid,
643
- device: process.env.DEVICE_ID || void 0,
644
- traceId: info.traceId,
645
- spanId: info.spanId,
646
- extra: info.extra || info.meta || void 0,
647
- stack: info.stack
648
- };
649
- return JSON.stringify(payload);
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,51 +707,120 @@ 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 {
679
- constructor() {
714
+ /**
715
+ * Creates or returns the singleton instance for the subclass.
716
+ *
717
+ * If an instance already exists for the subclass, that instance is
718
+ * returned instead of creating a new one.
719
+ *
720
+ * @param callOnInit - Whether to call {@link onInit} for a newly
721
+ * created instance. Ignored if the instance already exists.
722
+ */
723
+ constructor(callOnInit = true) {
680
724
  const ctor = this.constructor;
681
725
  const existing = _Singleton.instances.get(ctor);
682
726
  if (existing) {
683
727
  return existing;
684
728
  }
685
729
  _Singleton.instances.set(ctor, this);
730
+ if (callOnInit) {
731
+ void this.onInit();
732
+ }
733
+ }
734
+ /**
735
+ * Retrieves the singleton instance for the calling subclass.
736
+ *
737
+ * If no instance exists, a new one is created using the provided
738
+ * constructor arguments.
739
+ *
740
+ * Intended to be used by subclasses as a protected factory method.
741
+ *
742
+ * @typeParam T - The concrete subclass type.
743
+ * @param args - Arguments forwarded to the subclass constructor.
744
+ * @returns The singleton instance of the subclass.
745
+ */
746
+ static getInstance(...args) {
747
+ let instance = _Singleton.instances.get(this);
748
+ if (!instance) {
749
+ instance = new this(...args);
750
+ _Singleton.instances.set(this, instance);
751
+ }
752
+ return instance;
686
753
  }
687
754
  };
688
- _Singleton.instances = /* @__PURE__ */ new Map();
755
+ __name(_Singleton, "Singleton");
756
+ /**
757
+ * Internal registry of singleton instances.
758
+ * One instance per subclass constructor.
759
+ */
760
+ __publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
689
761
  var Singleton = _Singleton;
690
762
 
691
763
  // src/common/dto/status-dto.ts
692
- var StatusDto = class {
764
+ var _StatusDto = class _StatusDto {
693
765
  constructor(status, details, timestamp) {
766
+ /**
767
+ * Call result status
768
+ */
769
+ __publicField(this, "status");
770
+ /**
771
+ * UTC Timestamp
772
+ * @example "2021-12-01T13:23:39.305Z"
773
+ */
774
+ __publicField(this, "timestamp");
775
+ /**
776
+ * Details (optional)
777
+ */
778
+ __publicField(this, "details");
694
779
  this.status = status;
695
780
  this.details = details;
696
781
  this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
697
782
  }
698
783
  };
784
+ __name(_StatusDto, "StatusDto");
785
+ var StatusDto = _StatusDto;
699
786
 
700
787
  // src/common/constants/amount-unit.ts
701
788
  var AMOUNT_UNIT = {
702
- 1: { symbol: "g", translations: { en: "gram", cs: "gram" } },
703
- 2: { symbol: "kg", translations: { en: "kilogram", cs: "kilogram" } },
704
- 3: { symbol: "ml", translations: { en: "milliliter", cs: "mililitr" } },
705
- 4: { symbol: "l", translations: { en: "liter", cs: "litr" } }
789
+ 1: {
790
+ symbol: "g",
791
+ translations: {
792
+ en: "gram",
793
+ cs: "gram"
794
+ }
795
+ },
796
+ 2: {
797
+ symbol: "kg",
798
+ translations: {
799
+ en: "kilogram",
800
+ cs: "kilogram"
801
+ }
802
+ },
803
+ 3: {
804
+ symbol: "ml",
805
+ translations: {
806
+ en: "milliliter",
807
+ cs: "mililitr"
808
+ }
809
+ },
810
+ 4: {
811
+ symbol: "l",
812
+ translations: {
813
+ en: "liter",
814
+ cs: "litr"
815
+ }
816
+ }
706
817
  };
707
818
 
708
819
  // src/common/schema/entities/category.entity.ts
709
820
  import { Entity } from "typeorm";
710
821
 
711
822
  // 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";
823
+ import { BaseEntity, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, Index, Column } from "typeorm";
721
824
 
722
825
  // ../../node_modules/uuid/dist/esm/stringify.js
723
826
  var byteToHex = [];
@@ -727,6 +830,7 @@ for (let i = 0; i < 256; ++i) {
727
830
  function unsafeStringify(arr, offset = 0) {
728
831
  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
832
  }
833
+ __name(unsafeStringify, "unsafeStringify");
730
834
 
731
835
  // ../../node_modules/uuid/dist/esm/rng.js
732
836
  import { randomFillSync } from "crypto";
@@ -739,10 +843,13 @@ function rng() {
739
843
  }
740
844
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
741
845
  }
846
+ __name(rng, "rng");
742
847
 
743
848
  // ../../node_modules/uuid/dist/esm/native.js
744
849
  import { randomUUID } from "crypto";
745
- var native_default = { randomUUID };
850
+ var native_default = {
851
+ randomUUID
852
+ };
746
853
 
747
854
  // ../../node_modules/uuid/dist/esm/v4.js
748
855
  function v4(options, buf, offset) {
@@ -769,13 +876,31 @@ function v4(options, buf, offset) {
769
876
  }
770
877
  return unsafeStringify(rnds);
771
878
  }
879
+ __name(v4, "v4");
772
880
  var v4_default = v4;
773
881
 
774
882
  // src/database/entities/fresh-entity.ts
775
- var FreshEntity = class extends BaseEntity {
883
+ function _ts_decorate(decorators, target, key, desc) {
884
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
885
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
886
+ 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;
887
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
888
+ }
889
+ __name(_ts_decorate, "_ts_decorate");
890
+ function _ts_metadata(k, v) {
891
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
892
+ }
893
+ __name(_ts_metadata, "_ts_metadata");
894
+ var _FreshEntity = class _FreshEntity extends BaseEntity {
776
895
  /** After manual construction `id` is irrelevant. Refer to `uuid` only, because that will be inserted into DB */
777
896
  constructor() {
778
897
  super();
898
+ __publicField(this, "id");
899
+ __publicField(this, "uuid");
900
+ __publicField(this, "created_at");
901
+ __publicField(this, "updated_at");
902
+ // for soft delete methods by typeorm
903
+ __publicField(this, "deleted_at");
779
904
  this.id = 0;
780
905
  this.uuid = v4_default();
781
906
  const newDate = /* @__PURE__ */ new Date();
@@ -784,22 +909,41 @@ var FreshEntity = class extends BaseEntity {
784
909
  this.deleted_at = null;
785
910
  }
786
911
  };
787
- __decorateClass([
788
- PrimaryGeneratedColumn("increment")
789
- ], FreshEntity.prototype, "id", 2);
790
- __decorateClass([
791
- Index({ unique: true }),
792
- Column({ type: "uuid", default: () => "timescale.uuid_generate_v4()" })
793
- ], FreshEntity.prototype, "uuid", 2);
794
- __decorateClass([
795
- CreateDateColumn({ type: "timestamptz" })
796
- ], FreshEntity.prototype, "created_at", 2);
797
- __decorateClass([
798
- UpdateDateColumn({ type: "timestamptz" })
799
- ], FreshEntity.prototype, "updated_at", 2);
800
- __decorateClass([
801
- DeleteDateColumn({ type: "timestamptz", nullable: true })
802
- ], FreshEntity.prototype, "deleted_at", 2);
912
+ __name(_FreshEntity, "FreshEntity");
913
+ var FreshEntity = _FreshEntity;
914
+ _ts_decorate([
915
+ PrimaryGeneratedColumn("increment"),
916
+ _ts_metadata("design:type", Number)
917
+ ], FreshEntity.prototype, "id", void 0);
918
+ _ts_decorate([
919
+ Index({
920
+ unique: true
921
+ }),
922
+ Column({
923
+ type: "uuid",
924
+ default: /* @__PURE__ */ __name(() => "timescale.uuid_generate_v4()", "default")
925
+ }),
926
+ _ts_metadata("design:type", String)
927
+ ], FreshEntity.prototype, "uuid", void 0);
928
+ _ts_decorate([
929
+ CreateDateColumn({
930
+ type: "timestamptz"
931
+ }),
932
+ _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
933
+ ], FreshEntity.prototype, "created_at", void 0);
934
+ _ts_decorate([
935
+ UpdateDateColumn({
936
+ type: "timestamptz"
937
+ }),
938
+ _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
939
+ ], FreshEntity.prototype, "updated_at", void 0);
940
+ _ts_decorate([
941
+ DeleteDateColumn({
942
+ type: "timestamptz",
943
+ nullable: true
944
+ }),
945
+ _ts_metadata("design:type", Object)
946
+ ], FreshEntity.prototype, "deleted_at", void 0);
803
947
 
804
948
  // src/database/entities/fresh-hyper-entity.ts
805
949
  import { BaseEntity as BaseEntity2, PrimaryColumn } from "typeorm";
@@ -810,33 +954,55 @@ function TimestampColumn(options = {}) {
810
954
  const defaultOptions = {
811
955
  type: "timestamptz",
812
956
  nullable: false,
813
- default: () => "CURRENT_TIMESTAMP",
957
+ default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
814
958
  ...options
815
959
  };
816
960
  return Column2(defaultOptions);
817
961
  }
962
+ __name(TimestampColumn, "TimestampColumn");
818
963
 
819
964
  // src/database/entities/fresh-hyper-entity.ts
820
- var FreshHyperEntity = class extends BaseEntity2 {
965
+ function _ts_decorate2(decorators, target, key, desc) {
966
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
967
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
968
+ 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;
969
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
970
+ }
971
+ __name(_ts_decorate2, "_ts_decorate");
972
+ function _ts_metadata2(k, v) {
973
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
974
+ }
975
+ __name(_ts_metadata2, "_ts_metadata");
976
+ var _FreshHyperEntity = class _FreshHyperEntity extends BaseEntity2 {
821
977
  /** After manual construction `id` is irrelevant */
822
978
  constructor(timestamp) {
823
979
  super();
980
+ // input timestamp as PK
981
+ __publicField(this, "timestamp");
982
+ // just info column about time of insert
983
+ __publicField(this, "created_at");
824
984
  this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
825
985
  this.created_at = /* @__PURE__ */ new Date();
826
986
  }
827
987
  };
828
- __decorateClass([
829
- PrimaryColumn({ type: "timestamptz" })
830
- ], FreshHyperEntity.prototype, "timestamp", 2);
831
- __decorateClass([
832
- TimestampColumn()
833
- ], FreshHyperEntity.prototype, "created_at", 2);
988
+ __name(_FreshHyperEntity, "FreshHyperEntity");
989
+ var FreshHyperEntity = _FreshHyperEntity;
990
+ _ts_decorate2([
991
+ PrimaryColumn({
992
+ type: "timestamptz"
993
+ }),
994
+ _ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
995
+ ], FreshHyperEntity.prototype, "timestamp", void 0);
996
+ _ts_decorate2([
997
+ TimestampColumn(),
998
+ _ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
999
+ ], FreshHyperEntity.prototype, "created_at", void 0);
834
1000
 
835
1001
  // src/database/entities/fresh-translation-entity.ts
836
1002
  import { PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column3, BaseEntity as BaseEntity3, Check } from "typeorm";
837
1003
 
838
1004
  // src/enums/action-command-code.ts
839
- var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2) => {
1005
+ var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
840
1006
  ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
841
1007
  ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
842
1008
  ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
@@ -845,20 +1011,20 @@ var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2) => {
845
1011
  ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
846
1012
  ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
847
1013
  return ActionCommandCode2;
848
- })(ActionCommandCode || {});
1014
+ })({});
849
1015
 
850
1016
  // src/enums/depot-pool-status.ts
851
- var DepotPoolStatus = /* @__PURE__ */ ((DepotPoolStatus2) => {
1017
+ var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
852
1018
  DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
853
1019
  DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
854
1020
  DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
855
1021
  DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
856
1022
  DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
857
1023
  return DepotPoolStatus2;
858
- })(DepotPoolStatus || {});
1024
+ })({});
859
1025
 
860
1026
  // src/enums/http-status.ts
861
- var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
1027
+ var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
862
1028
  HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
863
1029
  HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
864
1030
  HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
@@ -922,28 +1088,28 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
922
1088
  HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
923
1089
  HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
924
1090
  return HttpStatus2;
925
- })(HttpStatus || {});
1091
+ })({});
926
1092
 
927
1093
  // src/enums/language-code.ts
928
- var LanguageCode = /* @__PURE__ */ ((LanguageCode2) => {
1094
+ var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
929
1095
  LanguageCode2["CS"] = "cs";
930
1096
  LanguageCode2["EN"] = "en";
931
1097
  LanguageCode2["DE"] = "de";
932
1098
  LanguageCode2["PL"] = "pl";
933
1099
  LanguageCode2["SK"] = "sk";
934
1100
  return LanguageCode2;
935
- })(LanguageCode || {});
1101
+ })({});
936
1102
 
937
1103
  // src/enums/payment-method.ts
938
- var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
1104
+ var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
939
1105
  PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
940
1106
  PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
941
1107
  PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
942
1108
  return PaymentMethod2;
943
- })(PaymentMethod || {});
1109
+ })({});
944
1110
 
945
1111
  // src/enums/transaction-type.ts
946
- var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
1112
+ var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
947
1113
  TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
948
1114
  TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
949
1115
  TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
@@ -955,81 +1121,142 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
955
1121
  TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
956
1122
  TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
957
1123
  return TransactionType2;
958
- })(TransactionType || {});
1124
+ })({});
959
1125
 
960
1126
  // src/database/entities/fresh-translation-entity.ts
1127
+ function _ts_decorate3(decorators, target, key, desc) {
1128
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1129
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1130
+ 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;
1131
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1132
+ }
1133
+ __name(_ts_decorate3, "_ts_decorate");
1134
+ function _ts_metadata3(k, v) {
1135
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1136
+ }
1137
+ __name(_ts_metadata3, "_ts_metadata");
961
1138
  var languageValues = Object.values(LanguageCode).map((v) => `'${v}'`).join(",");
962
- var FreshTranslationBase = class extends BaseEntity3 {
1139
+ var _FreshTranslationBase = class _FreshTranslationBase extends BaseEntity3 {
963
1140
  constructor() {
964
1141
  super();
1142
+ __publicField(this, "id");
1143
+ __publicField(this, "languageCode");
965
1144
  this.id = 0;
966
- this.languageCode = "cs" /* CS */;
1145
+ this.languageCode = LanguageCode.CS;
967
1146
  }
968
1147
  };
969
- __decorateClass([
970
- PrimaryGeneratedColumn2()
971
- ], FreshTranslationBase.prototype, "id", 2);
972
- __decorateClass([
1148
+ __name(_FreshTranslationBase, "FreshTranslationBase");
1149
+ var FreshTranslationBase = _FreshTranslationBase;
1150
+ _ts_decorate3([
1151
+ PrimaryGeneratedColumn2(),
1152
+ _ts_metadata3("design:type", Number)
1153
+ ], FreshTranslationBase.prototype, "id", void 0);
1154
+ _ts_decorate3([
973
1155
  Column3({
974
1156
  type: "varchar",
975
1157
  length: 3,
976
1158
  nullable: false
977
1159
  }),
978
- Check(`"languageCode" IN (${languageValues})`)
979
- ], FreshTranslationBase.prototype, "languageCode", 2);
1160
+ Check(`"languageCode" IN (${languageValues})`),
1161
+ _ts_metadata3("design:type", typeof LanguageCode === "undefined" ? Object : LanguageCode)
1162
+ ], FreshTranslationBase.prototype, "languageCode", void 0);
980
1163
 
981
1164
  // src/database/dao/fresh-dao.ts
982
- var FreshDao = class {
1165
+ var _FreshDao = class _FreshDao {
983
1166
  };
1167
+ __name(_FreshDao, "FreshDao");
1168
+ var FreshDao = _FreshDao;
984
1169
 
985
1170
  // src/common/schema/entities/category.entity.ts
986
- var Category = class extends FreshEntity {
987
- // ...
1171
+ function _ts_decorate4(decorators, target, key, desc) {
1172
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1173
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1174
+ 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;
1175
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1176
+ }
1177
+ __name(_ts_decorate4, "_ts_decorate");
1178
+ var _Category = class _Category extends FreshEntity {
988
1179
  };
989
- Category = __decorateClass([
1180
+ __name(_Category, "Category");
1181
+ var Category = _Category;
1182
+ Category = _ts_decorate4([
990
1183
  Entity()
991
1184
  ], Category);
992
1185
 
993
1186
  // src/common/schema/entities/device.entity.ts
994
1187
  import { Entity as Entity2 } from "typeorm";
995
- var Device = class extends FreshEntity {
996
- // ...
1188
+ function _ts_decorate5(decorators, target, key, desc) {
1189
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1190
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1191
+ 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;
1192
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1193
+ }
1194
+ __name(_ts_decorate5, "_ts_decorate");
1195
+ var _Device = class _Device extends FreshEntity {
997
1196
  };
998
- Device = __decorateClass([
1197
+ __name(_Device, "Device");
1198
+ var Device = _Device;
1199
+ Device = _ts_decorate5([
999
1200
  Entity2()
1000
1201
  ], Device);
1001
1202
 
1002
1203
  // src/common/schema/entities/manufacturer.entity.ts
1003
1204
  import { Entity as Entity3 } from "typeorm";
1004
- var Manufacturer = class extends FreshEntity {
1005
- // ...
1205
+ function _ts_decorate6(decorators, target, key, desc) {
1206
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1207
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1208
+ 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;
1209
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1210
+ }
1211
+ __name(_ts_decorate6, "_ts_decorate");
1212
+ var _Manufacturer = class _Manufacturer extends FreshEntity {
1006
1213
  };
1007
- Manufacturer = __decorateClass([
1214
+ __name(_Manufacturer, "Manufacturer");
1215
+ var Manufacturer = _Manufacturer;
1216
+ Manufacturer = _ts_decorate6([
1008
1217
  Entity3()
1009
1218
  ], Manufacturer);
1010
1219
 
1011
1220
  // src/common/schema/entities/product.entity.ts
1012
1221
  import { Entity as Entity4 } from "typeorm";
1013
- var Product = class extends FreshEntity {
1014
- // ...
1222
+ function _ts_decorate7(decorators, target, key, desc) {
1223
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1224
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1225
+ 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;
1226
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1227
+ }
1228
+ __name(_ts_decorate7, "_ts_decorate");
1229
+ var _Product = class _Product extends FreshEntity {
1015
1230
  };
1016
- Product = __decorateClass([
1231
+ __name(_Product, "Product");
1232
+ var Product = _Product;
1233
+ Product = _ts_decorate7([
1017
1234
  Entity4()
1018
1235
  ], Product);
1019
1236
 
1020
1237
  // src/common/schema/entities/subcategory.entity.ts
1021
1238
  import { Entity as Entity5 } from "typeorm";
1022
- var Subcategory = class extends FreshEntity {
1023
- // ...
1239
+ function _ts_decorate8(decorators, target, key, desc) {
1240
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1241
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1242
+ 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;
1243
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1244
+ }
1245
+ __name(_ts_decorate8, "_ts_decorate");
1246
+ var _Subcategory = class _Subcategory extends FreshEntity {
1024
1247
  };
1025
- Subcategory = __decorateClass([
1248
+ __name(_Subcategory, "Subcategory");
1249
+ var Subcategory = _Subcategory;
1250
+ Subcategory = _ts_decorate8([
1026
1251
  Entity5()
1027
1252
  ], Subcategory);
1028
1253
 
1029
1254
  // src/core/data-helper.ts
1030
- var DataHelper = class {
1255
+ var _DataHelper = class _DataHelper {
1031
1256
  constructor(startDataRetrieve = true, deviceIds) {
1032
- this._dataPromise = null;
1257
+ __publicField(this, "_data");
1258
+ __publicField(this, "_dataPromise", null);
1259
+ __publicField(this, "deviceIds");
1033
1260
  this.deviceIds = deviceIds;
1034
1261
  if (startDataRetrieve) {
1035
1262
  this._dataPromise = this.startDataRetrieval();
@@ -1058,77 +1285,144 @@ var DataHelper = class {
1058
1285
  return this._data;
1059
1286
  }
1060
1287
  };
1288
+ __name(_DataHelper, "DataHelper");
1289
+ var DataHelper = _DataHelper;
1061
1290
 
1062
1291
  // src/core/class/fresh-job.ts
1063
1292
  import { scheduleJob } from "node-schedule";
1064
- var FreshJob = class extends Singleton {
1293
+ var _FreshJob = class _FreshJob extends Singleton {
1065
1294
  /**
1066
- * @param cronExpression must be cron of just numbers ex.: `0 5 * * 4`
1067
- * By default timezone is added " Europe/Prague"
1295
+ * Creates and optionally schedules a singleton cron job.
1296
+ *
1297
+ * @param jobName - Logical name of the job (used in logs and errors).
1298
+ * @param cronExpression - Cron expression consisting of numeric fields only.
1299
+ * Example: `0 5 * * 4`
1300
+ * The timezone `"Europe/Prague"` is applied automatically.
1301
+ *
1302
+ * @param jobEnabled - Whether the job should be scheduled immediately.
1303
+ * If `false`, the instance exists but no cron trigger is registered.
1304
+ *
1305
+ * @throws Error If the cron expression is invalid.
1306
+ * @throws Error If the job cannot be scheduled.
1068
1307
  */
1069
1308
  constructor(jobName, cronExpression, jobEnabled) {
1070
- super();
1071
- this._job = null;
1309
+ super(false);
1310
+ /** Human-readable job identifier (used for logs and errors). */
1311
+ __publicField(this, "_jobName");
1312
+ /**
1313
+ * Cron expression defining when the job runs.
1314
+ *
1315
+ * Must contain numeric cron fields only.
1316
+ * Example: `0 5 * * 4`
1317
+ *
1318
+ * Timezone is always forced to `"Europe/Prague"`.
1319
+ * If you need another timezone, this class is not your friend.
1320
+ */
1321
+ __publicField(this, "_cronExpression");
1322
+ /** Scheduled job instance, or `null` if the job is disabled. */
1323
+ __publicField(this, "_job", null);
1072
1324
  this._jobName = jobName;
1073
1325
  if (!isValidCron(cronExpression)) {
1074
- throw new Error(
1075
- `Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`
1076
- );
1326
+ throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
1077
1327
  }
1078
1328
  this._cronExpression = cronExpression;
1079
1329
  if (jobEnabled) {
1080
- this._job = scheduleJob(
1081
- { rule: this._cronExpression, tz: "Europe/Prague" },
1082
- async () => {
1083
- await this.invoke();
1084
- }
1085
- );
1330
+ this._job = scheduleJob({
1331
+ rule: this._cronExpression,
1332
+ tz: "Europe/Prague"
1333
+ }, async () => {
1334
+ await this.invoke();
1335
+ });
1086
1336
  if (!this._job) {
1087
1337
  throw new Error(`Job ${this._jobName} could not be scheduled`);
1088
1338
  }
1089
1339
  }
1090
1340
  this.onInit();
1091
1341
  }
1092
- /** Just logging */
1342
+ /**
1343
+ * Initialization hook.
1344
+ *
1345
+ * Called once during construction and used primarily for logging.
1346
+ * Can also be reused by subclasses if manual rescheduling is implemented.
1347
+ *
1348
+ * @param rescheduled - Indicates whether the job was reconfigured
1349
+ * after initial creation.
1350
+ */
1093
1351
  onInit(rescheduled) {
1094
- console.log(
1095
- `Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`
1096
- );
1352
+ console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
1097
1353
  }
1354
+ /** @returns The logical name of the job. */
1098
1355
  get jobName() {
1099
1356
  return this._jobName;
1100
1357
  }
1358
+ /** Allows subclasses to rename the job if absolutely necessary. */
1101
1359
  set jobName(value) {
1102
1360
  this._jobName = value;
1103
1361
  }
1362
+ /** @returns The cron expression used to schedule the job. */
1104
1363
  get cronExpression() {
1105
1364
  return this._cronExpression;
1106
1365
  }
1366
+ /**
1367
+ * Allows subclasses to update the cron expression internally.
1368
+ * Does reschedule of job if exists
1369
+ */
1107
1370
  set cronExpression(value) {
1371
+ if (!isValidCron(value)) {
1372
+ throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${value}"`);
1373
+ }
1108
1374
  this._cronExpression = value;
1109
1375
  }
1376
+ /** @returns The underlying scheduled job instance, or `null` if disabled. */
1110
1377
  get job() {
1111
1378
  return this._job;
1112
1379
  }
1380
+ /** Allows subclasses to manage the scheduled job instance. */
1113
1381
  set job(value) {
1114
1382
  this._job = value;
1115
1383
  }
1384
+ reschedule(newCronExpression) {
1385
+ let result = false;
1386
+ if (!isValidCron(newCronExpression)) {
1387
+ throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${newCronExpression}"`);
1388
+ }
1389
+ this._cronExpression = newCronExpression;
1390
+ if (this._job) {
1391
+ const rescheduleSuccess = this._job.reschedule({
1392
+ rule: this._cronExpression,
1393
+ tz: "Europe/Prague"
1394
+ });
1395
+ if (!rescheduleSuccess) {
1396
+ throw new Error(`Job ${this._jobName} could not be re-scheduled`);
1397
+ } else {
1398
+ this.onInit(true);
1399
+ }
1400
+ result = rescheduleSuccess;
1401
+ }
1402
+ return result;
1403
+ }
1116
1404
  };
1405
+ __name(_FreshJob, "FreshJob");
1406
+ var FreshJob = _FreshJob;
1117
1407
 
1118
1408
  // src/core/errors/api-error.ts
1119
- var ApiError = class extends Error {
1409
+ var _ApiError = class _ApiError extends Error {
1410
+ constructor(statusCode, status, detail) {
1411
+ super();
1412
+ __publicField(this, "_statusCode");
1413
+ __publicField(this, "_statusDto");
1414
+ this._statusCode = statusCode;
1415
+ this._statusDto = new StatusDto(status, detail);
1416
+ }
1120
1417
  get statusCode() {
1121
1418
  return this._statusCode;
1122
1419
  }
1123
1420
  get statusDto() {
1124
1421
  return this._statusDto;
1125
1422
  }
1126
- constructor(statusCode, status, detail) {
1127
- super();
1128
- this._statusCode = statusCode;
1129
- this._statusDto = new StatusDto(status, detail);
1130
- }
1131
1423
  };
1424
+ __name(_ApiError, "ApiError");
1425
+ var ApiError = _ApiError;
1132
1426
 
1133
1427
  // src/config/eslint-config.ts
1134
1428
  import tseslint from "typescript-eslint";
@@ -1139,7 +1433,10 @@ var FRESH_ESLINT_CONFIG = [
1139
1433
  // Prettier integration
1140
1434
  ...eslintConfigPrettier,
1141
1435
  // Affected files
1142
- files: ["**/*.ts", "**/*.tsx"],
1436
+ files: [
1437
+ "**/*.ts",
1438
+ "**/*.tsx"
1439
+ ],
1143
1440
  ignores: [
1144
1441
  "dist/**",
1145
1442
  "node_modules/**",
@@ -1164,26 +1461,49 @@ var FRESH_ESLINT_CONFIG = [
1164
1461
  // no lets or vars
1165
1462
  "prefer-const": "error",
1166
1463
  // blocks ("red" === color) these ifs
1167
- yoda: ["error", "never"],
1168
- "no-multiple-empty-lines": ["error", { max: 1 }],
1464
+ yoda: [
1465
+ "error",
1466
+ "never"
1467
+ ],
1468
+ "no-multiple-empty-lines": [
1469
+ "error",
1470
+ {
1471
+ max: 1
1472
+ }
1473
+ ],
1169
1474
  // semi-colons
1170
- semi: ["error", "always"],
1475
+ semi: [
1476
+ "error",
1477
+ "always"
1478
+ ],
1171
1479
  // forces block for all control statements (forbid one-line returns)
1172
- curly: ["error", "all"],
1480
+ curly: [
1481
+ "error",
1482
+ "all"
1483
+ ],
1173
1484
  // makes spaces between brackets
1174
- "object-curly-spacing": ["error", "always"],
1485
+ "object-curly-spacing": [
1486
+ "error",
1487
+ "always"
1488
+ ],
1175
1489
  // checks same if/else conditions
1176
1490
  "no-dupe-else-if": "error",
1177
1491
  // keeps imports from one package in same declaration
1178
1492
  "no-duplicate-imports": "error",
1179
1493
  // blocks simple '=' in condition blocks
1180
- "no-cond-assign": ["error", "always"],
1494
+ "no-cond-assign": [
1495
+ "error",
1496
+ "always"
1497
+ ],
1181
1498
  // forbids promise inside promise
1182
1499
  "no-async-promise-executor": "error",
1183
1500
  // watches possible falltrough in switch cases
1184
1501
  "no-fallthrough": "error",
1185
1502
  // use === instead of ==
1186
- eqeqeq: ["error", "always"],
1503
+ eqeqeq: [
1504
+ "error",
1505
+ "always"
1506
+ ],
1187
1507
  // Prettier formatting rules
1188
1508
  "prettier/prettier": [
1189
1509
  "error",
@@ -1209,23 +1529,40 @@ var FRESH_ESLINT_CONFIG = [
1209
1529
  "@typescript-eslint/naming-convention": [
1210
1530
  "error",
1211
1531
  {
1212
- selector: ["variable", "function"],
1213
- format: ["camelCase"],
1532
+ selector: [
1533
+ "variable",
1534
+ "function"
1535
+ ],
1536
+ format: [
1537
+ "camelCase"
1538
+ ],
1214
1539
  leadingUnderscore: "allow"
1215
1540
  },
1216
1541
  {
1217
1542
  selector: "class",
1218
- format: ["PascalCase"]
1543
+ format: [
1544
+ "PascalCase"
1545
+ ]
1219
1546
  },
1220
1547
  {
1221
1548
  selector: "variable",
1222
- modifiers: ["const", "exported"],
1223
- format: ["UPPER_CASE"]
1549
+ modifiers: [
1550
+ "const",
1551
+ "exported"
1552
+ ],
1553
+ format: [
1554
+ "UPPER_CASE",
1555
+ "PascalCase"
1556
+ ]
1224
1557
  },
1225
1558
  {
1226
1559
  selector: "property",
1227
- modifiers: ["readonly"],
1228
- format: ["UPPER_CASE"]
1560
+ modifiers: [
1561
+ "readonly"
1562
+ ],
1563
+ format: [
1564
+ "UPPER_CASE"
1565
+ ]
1229
1566
  }
1230
1567
  ]
1231
1568
  }
@@ -1250,8 +1587,12 @@ var PG_DATA_SOURCE_OPTIONS = {
1250
1587
  password: process.env.POSTGRE_SQL_PASSWORD || "<password>",
1251
1588
  database: process.env.POSTGRE_SQL_DATABASE || "<database>",
1252
1589
  schema: process.env.POSTGRE_SQL_SCHEMA || "<scheme>",
1253
- entities: [path.join(basePath, isTs ? "src/entity/*.{ts,js}" : "build/entity/*.js")],
1254
- migrations: [path.join(basePath, isTs ? "src/migration/*.{ts,js}" : "build/migration/*.js")],
1590
+ entities: [
1591
+ path.join(basePath, isTs ? "src/entity/*.{ts,js}" : "build/entity/*.js")
1592
+ ],
1593
+ migrations: [
1594
+ path.join(basePath, isTs ? "src/migration/*.{ts,js}" : "build/migration/*.js")
1595
+ ],
1255
1596
  migrationsRun: process.env.RUN_MIGRATIONS === "true",
1256
1597
  migrationsTableName: "migrations",
1257
1598
  migrationsTransactionMode: "each",
@@ -1263,7 +1604,6 @@ var PG_DATA_SOURCE_OPTIONS = {
1263
1604
  useUTC: true,
1264
1605
  cache: true,
1265
1606
  namingStrategy: new SnakeNamingStrategy()
1266
- // replication: undefined,
1267
1607
  };
1268
1608
  var datasource_default = PG_DATA_SOURCE_OPTIONS;
1269
1609
  export {