@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.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 __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,
@@ -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.HOLIDAYS_STR = [
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.HOLIDAYS = _DateUtils.HOLIDAYS_STR.map((h) => {
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 { promise, resolve, reject };
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 SinglePromiseWaiter = class _SinglePromiseWaiter {
657
+ var _SinglePromiseWaiter = class _SinglePromiseWaiter {
627
658
  constructor() {
628
- this._promise = null;
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
- import_winston.default.format.timestamp({ format: () => (/* @__PURE__ */ new Date()).toISOString() }),
667
- import_winston.default.format.errors({ stack: true }),
668
- import_winston.default.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
- })
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,36 +742,113 @@ 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 {
714
- constructor() {
749
+ /**
750
+ * Creates or returns the singleton instance for the subclass.
751
+ *
752
+ * If an instance already exists for the subclass, that instance is
753
+ * returned instead of creating a new one.
754
+ *
755
+ * @param callOnInit - Whether to call {@link onInit} for a newly
756
+ * created instance. Ignored if the instance already exists.
757
+ */
758
+ constructor(callOnInit = true) {
715
759
  const ctor = this.constructor;
716
760
  const existing = _Singleton.instances.get(ctor);
717
761
  if (existing) {
718
762
  return existing;
719
763
  }
720
764
  _Singleton.instances.set(ctor, this);
765
+ if (callOnInit) {
766
+ void this.onInit();
767
+ }
768
+ }
769
+ /**
770
+ * Retrieves the singleton instance for the calling subclass.
771
+ *
772
+ * If no instance exists, a new one is created using the provided
773
+ * constructor arguments.
774
+ *
775
+ * Intended to be used by subclasses as a protected factory method.
776
+ *
777
+ * @typeParam T - The concrete subclass type.
778
+ * @param args - Arguments forwarded to the subclass constructor.
779
+ * @returns The singleton instance of the subclass.
780
+ */
781
+ static getInstance(...args) {
782
+ let instance = _Singleton.instances.get(this);
783
+ if (!instance) {
784
+ instance = new this(...args);
785
+ _Singleton.instances.set(this, instance);
786
+ }
787
+ return instance;
721
788
  }
722
789
  };
723
- _Singleton.instances = /* @__PURE__ */ new Map();
790
+ __name(_Singleton, "Singleton");
791
+ /**
792
+ * Internal registry of singleton instances.
793
+ * One instance per subclass constructor.
794
+ */
795
+ __publicField(_Singleton, "instances", /* @__PURE__ */ new Map());
724
796
  var Singleton = _Singleton;
725
797
 
726
798
  // src/common/dto/status-dto.ts
727
- var StatusDto = class {
799
+ var _StatusDto = class _StatusDto {
728
800
  constructor(status, details, timestamp) {
801
+ /**
802
+ * Call result status
803
+ */
804
+ __publicField(this, "status");
805
+ /**
806
+ * UTC Timestamp
807
+ * @example "2021-12-01T13:23:39.305Z"
808
+ */
809
+ __publicField(this, "timestamp");
810
+ /**
811
+ * Details (optional)
812
+ */
813
+ __publicField(this, "details");
729
814
  this.status = status;
730
815
  this.details = details;
731
816
  this.timestamp = timestamp != null ? timestamp : DateUtils.getNowCzech().toISOString();
732
817
  }
733
818
  };
819
+ __name(_StatusDto, "StatusDto");
820
+ var StatusDto = _StatusDto;
734
821
 
735
822
  // src/common/constants/amount-unit.ts
736
823
  var AMOUNT_UNIT = {
737
- 1: { symbol: "g", translations: { en: "gram", cs: "gram" } },
738
- 2: { symbol: "kg", translations: { en: "kilogram", cs: "kilogram" } },
739
- 3: { symbol: "ml", translations: { en: "milliliter", cs: "mililitr" } },
740
- 4: { symbol: "l", translations: { en: "liter", cs: "litr" } }
824
+ 1: {
825
+ symbol: "g",
826
+ translations: {
827
+ en: "gram",
828
+ cs: "gram"
829
+ }
830
+ },
831
+ 2: {
832
+ symbol: "kg",
833
+ translations: {
834
+ en: "kilogram",
835
+ cs: "kilogram"
836
+ }
837
+ },
838
+ 3: {
839
+ symbol: "ml",
840
+ translations: {
841
+ en: "milliliter",
842
+ cs: "mililitr"
843
+ }
844
+ },
845
+ 4: {
846
+ symbol: "l",
847
+ translations: {
848
+ en: "liter",
849
+ cs: "litr"
850
+ }
851
+ }
741
852
  };
742
853
 
743
854
  // src/common/schema/entities/category.entity.ts
@@ -754,6 +865,7 @@ for (let i = 0; i < 256; ++i) {
754
865
  function unsafeStringify(arr, offset = 0) {
755
866
  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
867
  }
868
+ __name(unsafeStringify, "unsafeStringify");
757
869
 
758
870
  // ../../node_modules/uuid/dist/esm/rng.js
759
871
  var import_crypto = require("crypto");
@@ -766,10 +878,13 @@ function rng() {
766
878
  }
767
879
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
768
880
  }
881
+ __name(rng, "rng");
769
882
 
770
883
  // ../../node_modules/uuid/dist/esm/native.js
771
884
  var import_crypto2 = require("crypto");
772
- var native_default = { randomUUID: import_crypto2.randomUUID };
885
+ var native_default = {
886
+ randomUUID: import_crypto2.randomUUID
887
+ };
773
888
 
774
889
  // ../../node_modules/uuid/dist/esm/v4.js
775
890
  function v4(options, buf, offset) {
@@ -796,13 +911,31 @@ function v4(options, buf, offset) {
796
911
  }
797
912
  return unsafeStringify(rnds);
798
913
  }
914
+ __name(v4, "v4");
799
915
  var v4_default = v4;
800
916
 
801
917
  // src/database/entities/fresh-entity.ts
802
- var FreshEntity = class extends import_typeorm.BaseEntity {
918
+ function _ts_decorate(decorators, target, key, desc) {
919
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
920
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
921
+ 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;
922
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
923
+ }
924
+ __name(_ts_decorate, "_ts_decorate");
925
+ function _ts_metadata(k, v) {
926
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
927
+ }
928
+ __name(_ts_metadata, "_ts_metadata");
929
+ var _FreshEntity = class _FreshEntity extends import_typeorm.BaseEntity {
803
930
  /** After manual construction `id` is irrelevant. Refer to `uuid` only, because that will be inserted into DB */
804
931
  constructor() {
805
932
  super();
933
+ __publicField(this, "id");
934
+ __publicField(this, "uuid");
935
+ __publicField(this, "created_at");
936
+ __publicField(this, "updated_at");
937
+ // for soft delete methods by typeorm
938
+ __publicField(this, "deleted_at");
806
939
  this.id = 0;
807
940
  this.uuid = v4_default();
808
941
  const newDate = /* @__PURE__ */ new Date();
@@ -811,22 +944,41 @@ var FreshEntity = class extends import_typeorm.BaseEntity {
811
944
  this.deleted_at = null;
812
945
  }
813
946
  };
814
- __decorateClass([
815
- (0, import_typeorm.PrimaryGeneratedColumn)("increment")
816
- ], FreshEntity.prototype, "id", 2);
817
- __decorateClass([
818
- (0, import_typeorm.Index)({ unique: true }),
819
- (0, import_typeorm.Column)({ type: "uuid", default: () => "timescale.uuid_generate_v4()" })
820
- ], FreshEntity.prototype, "uuid", 2);
821
- __decorateClass([
822
- (0, import_typeorm.CreateDateColumn)({ type: "timestamptz" })
823
- ], FreshEntity.prototype, "created_at", 2);
824
- __decorateClass([
825
- (0, import_typeorm.UpdateDateColumn)({ type: "timestamptz" })
826
- ], FreshEntity.prototype, "updated_at", 2);
827
- __decorateClass([
828
- (0, import_typeorm.DeleteDateColumn)({ type: "timestamptz", nullable: true })
829
- ], FreshEntity.prototype, "deleted_at", 2);
947
+ __name(_FreshEntity, "FreshEntity");
948
+ var FreshEntity = _FreshEntity;
949
+ _ts_decorate([
950
+ (0, import_typeorm.PrimaryGeneratedColumn)("increment"),
951
+ _ts_metadata("design:type", Number)
952
+ ], FreshEntity.prototype, "id", void 0);
953
+ _ts_decorate([
954
+ (0, import_typeorm.Index)({
955
+ unique: true
956
+ }),
957
+ (0, import_typeorm.Column)({
958
+ type: "uuid",
959
+ default: /* @__PURE__ */ __name(() => "timescale.uuid_generate_v4()", "default")
960
+ }),
961
+ _ts_metadata("design:type", String)
962
+ ], FreshEntity.prototype, "uuid", void 0);
963
+ _ts_decorate([
964
+ (0, import_typeorm.CreateDateColumn)({
965
+ type: "timestamptz"
966
+ }),
967
+ _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
968
+ ], FreshEntity.prototype, "created_at", void 0);
969
+ _ts_decorate([
970
+ (0, import_typeorm.UpdateDateColumn)({
971
+ type: "timestamptz"
972
+ }),
973
+ _ts_metadata("design:type", typeof Date === "undefined" ? Object : Date)
974
+ ], FreshEntity.prototype, "updated_at", void 0);
975
+ _ts_decorate([
976
+ (0, import_typeorm.DeleteDateColumn)({
977
+ type: "timestamptz",
978
+ nullable: true
979
+ }),
980
+ _ts_metadata("design:type", Object)
981
+ ], FreshEntity.prototype, "deleted_at", void 0);
830
982
 
831
983
  // src/database/entities/fresh-hyper-entity.ts
832
984
  var import_typeorm3 = require("typeorm");
@@ -837,33 +989,55 @@ function TimestampColumn(options = {}) {
837
989
  const defaultOptions = {
838
990
  type: "timestamptz",
839
991
  nullable: false,
840
- default: () => "CURRENT_TIMESTAMP",
992
+ default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default"),
841
993
  ...options
842
994
  };
843
995
  return (0, import_typeorm2.Column)(defaultOptions);
844
996
  }
997
+ __name(TimestampColumn, "TimestampColumn");
845
998
 
846
999
  // src/database/entities/fresh-hyper-entity.ts
847
- var FreshHyperEntity = class extends import_typeorm3.BaseEntity {
1000
+ function _ts_decorate2(decorators, target, key, desc) {
1001
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1002
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1003
+ 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;
1004
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1005
+ }
1006
+ __name(_ts_decorate2, "_ts_decorate");
1007
+ function _ts_metadata2(k, v) {
1008
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1009
+ }
1010
+ __name(_ts_metadata2, "_ts_metadata");
1011
+ var _FreshHyperEntity = class _FreshHyperEntity extends import_typeorm3.BaseEntity {
848
1012
  /** After manual construction `id` is irrelevant */
849
1013
  constructor(timestamp) {
850
1014
  super();
1015
+ // input timestamp as PK
1016
+ __publicField(this, "timestamp");
1017
+ // just info column about time of insert
1018
+ __publicField(this, "created_at");
851
1019
  this.timestamp = timestamp != null ? timestamp : /* @__PURE__ */ new Date();
852
1020
  this.created_at = /* @__PURE__ */ new Date();
853
1021
  }
854
1022
  };
855
- __decorateClass([
856
- (0, import_typeorm3.PrimaryColumn)({ type: "timestamptz" })
857
- ], FreshHyperEntity.prototype, "timestamp", 2);
858
- __decorateClass([
859
- TimestampColumn()
860
- ], FreshHyperEntity.prototype, "created_at", 2);
1023
+ __name(_FreshHyperEntity, "FreshHyperEntity");
1024
+ var FreshHyperEntity = _FreshHyperEntity;
1025
+ _ts_decorate2([
1026
+ (0, import_typeorm3.PrimaryColumn)({
1027
+ type: "timestamptz"
1028
+ }),
1029
+ _ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
1030
+ ], FreshHyperEntity.prototype, "timestamp", void 0);
1031
+ _ts_decorate2([
1032
+ TimestampColumn(),
1033
+ _ts_metadata2("design:type", typeof Date === "undefined" ? Object : Date)
1034
+ ], FreshHyperEntity.prototype, "created_at", void 0);
861
1035
 
862
1036
  // src/database/entities/fresh-translation-entity.ts
863
1037
  var import_typeorm4 = require("typeorm");
864
1038
 
865
1039
  // src/enums/action-command-code.ts
866
- var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2) => {
1040
+ var ActionCommandCode = /* @__PURE__ */ (function(ActionCommandCode2) {
867
1041
  ActionCommandCode2[ActionCommandCode2["RESTART_PC"] = 1] = "RESTART_PC";
868
1042
  ActionCommandCode2[ActionCommandCode2["RESTART_APPLICATION"] = 2] = "RESTART_APPLICATION";
869
1043
  ActionCommandCode2[ActionCommandCode2["RESTART_ROUTER"] = 3] = "RESTART_ROUTER";
@@ -872,20 +1046,20 @@ var ActionCommandCode = /* @__PURE__ */ ((ActionCommandCode2) => {
872
1046
  ActionCommandCode2[ActionCommandCode2["DIAGNOSE_LOCKS"] = 6] = "DIAGNOSE_LOCKS";
873
1047
  ActionCommandCode2[ActionCommandCode2["SYNCHRONIZE_CONFIG"] = 7] = "SYNCHRONIZE_CONFIG";
874
1048
  return ActionCommandCode2;
875
- })(ActionCommandCode || {});
1049
+ })({});
876
1050
 
877
1051
  // src/enums/depot-pool-status.ts
878
- var DepotPoolStatus = /* @__PURE__ */ ((DepotPoolStatus2) => {
1052
+ var DepotPoolStatus = /* @__PURE__ */ (function(DepotPoolStatus2) {
879
1053
  DepotPoolStatus2[DepotPoolStatus2["NEW"] = 0] = "NEW";
880
1054
  DepotPoolStatus2[DepotPoolStatus2["PICKED"] = 1] = "PICKED";
881
1055
  DepotPoolStatus2[DepotPoolStatus2["WRITTEN_OFF"] = 2] = "WRITTEN_OFF";
882
1056
  DepotPoolStatus2[DepotPoolStatus2["ACTIVE"] = 3] = "ACTIVE";
883
1057
  DepotPoolStatus2[DepotPoolStatus2["TERMINATED"] = 4] = "TERMINATED";
884
1058
  return DepotPoolStatus2;
885
- })(DepotPoolStatus || {});
1059
+ })({});
886
1060
 
887
1061
  // src/enums/http-status.ts
888
- var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
1062
+ var HttpStatus = /* @__PURE__ */ (function(HttpStatus2) {
889
1063
  HttpStatus2[HttpStatus2["CONTINUE"] = 100] = "CONTINUE";
890
1064
  HttpStatus2[HttpStatus2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
891
1065
  HttpStatus2[HttpStatus2["PROCESSING"] = 102] = "PROCESSING";
@@ -949,28 +1123,28 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus2) => {
949
1123
  HttpStatus2[HttpStatus2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
950
1124
  HttpStatus2[HttpStatus2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
951
1125
  return HttpStatus2;
952
- })(HttpStatus || {});
1126
+ })({});
953
1127
 
954
1128
  // src/enums/language-code.ts
955
- var LanguageCode = /* @__PURE__ */ ((LanguageCode2) => {
1129
+ var LanguageCode = /* @__PURE__ */ (function(LanguageCode2) {
956
1130
  LanguageCode2["CS"] = "cs";
957
1131
  LanguageCode2["EN"] = "en";
958
1132
  LanguageCode2["DE"] = "de";
959
1133
  LanguageCode2["PL"] = "pl";
960
1134
  LanguageCode2["SK"] = "sk";
961
1135
  return LanguageCode2;
962
- })(LanguageCode || {});
1136
+ })({});
963
1137
 
964
1138
  // src/enums/payment-method.ts
965
- var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
1139
+ var PaymentMethod = /* @__PURE__ */ (function(PaymentMethod2) {
966
1140
  PaymentMethod2[PaymentMethod2["CODE"] = 0] = "CODE";
967
1141
  PaymentMethod2[PaymentMethod2["CARD"] = 1] = "CARD";
968
1142
  PaymentMethod2[PaymentMethod2["NONE"] = 2] = "NONE";
969
1143
  return PaymentMethod2;
970
- })(PaymentMethod || {});
1144
+ })({});
971
1145
 
972
1146
  // src/enums/transaction-type.ts
973
- var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
1147
+ var TransactionType = /* @__PURE__ */ (function(TransactionType2) {
974
1148
  TransactionType2[TransactionType2["WRITEOFF"] = 0] = "WRITEOFF";
975
1149
  TransactionType2[TransactionType2["SALE"] = 1] = "SALE";
976
1150
  TransactionType2[TransactionType2["LOST"] = 2] = "LOST";
@@ -982,81 +1156,142 @@ var TransactionType = /* @__PURE__ */ ((TransactionType2) => {
982
1156
  TransactionType2[TransactionType2["INVENTORY_SURPLUS"] = 8] = "INVENTORY_SURPLUS";
983
1157
  TransactionType2[TransactionType2["INVENTORY_MISSING"] = 9] = "INVENTORY_MISSING";
984
1158
  return TransactionType2;
985
- })(TransactionType || {});
1159
+ })({});
986
1160
 
987
1161
  // src/database/entities/fresh-translation-entity.ts
1162
+ function _ts_decorate3(decorators, target, key, desc) {
1163
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1164
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1165
+ 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;
1166
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1167
+ }
1168
+ __name(_ts_decorate3, "_ts_decorate");
1169
+ function _ts_metadata3(k, v) {
1170
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
1171
+ }
1172
+ __name(_ts_metadata3, "_ts_metadata");
988
1173
  var languageValues = Object.values(LanguageCode).map((v) => `'${v}'`).join(",");
989
- var FreshTranslationBase = class extends import_typeorm4.BaseEntity {
1174
+ var _FreshTranslationBase = class _FreshTranslationBase extends import_typeorm4.BaseEntity {
990
1175
  constructor() {
991
1176
  super();
1177
+ __publicField(this, "id");
1178
+ __publicField(this, "languageCode");
992
1179
  this.id = 0;
993
- this.languageCode = "cs" /* CS */;
1180
+ this.languageCode = LanguageCode.CS;
994
1181
  }
995
1182
  };
996
- __decorateClass([
997
- (0, import_typeorm4.PrimaryGeneratedColumn)()
998
- ], FreshTranslationBase.prototype, "id", 2);
999
- __decorateClass([
1183
+ __name(_FreshTranslationBase, "FreshTranslationBase");
1184
+ var FreshTranslationBase = _FreshTranslationBase;
1185
+ _ts_decorate3([
1186
+ (0, import_typeorm4.PrimaryGeneratedColumn)(),
1187
+ _ts_metadata3("design:type", Number)
1188
+ ], FreshTranslationBase.prototype, "id", void 0);
1189
+ _ts_decorate3([
1000
1190
  (0, import_typeorm4.Column)({
1001
1191
  type: "varchar",
1002
1192
  length: 3,
1003
1193
  nullable: false
1004
1194
  }),
1005
- (0, import_typeorm4.Check)(`"languageCode" IN (${languageValues})`)
1006
- ], FreshTranslationBase.prototype, "languageCode", 2);
1195
+ (0, import_typeorm4.Check)(`"languageCode" IN (${languageValues})`),
1196
+ _ts_metadata3("design:type", typeof LanguageCode === "undefined" ? Object : LanguageCode)
1197
+ ], FreshTranslationBase.prototype, "languageCode", void 0);
1007
1198
 
1008
1199
  // src/database/dao/fresh-dao.ts
1009
- var FreshDao = class {
1200
+ var _FreshDao = class _FreshDao {
1010
1201
  };
1202
+ __name(_FreshDao, "FreshDao");
1203
+ var FreshDao = _FreshDao;
1011
1204
 
1012
1205
  // src/common/schema/entities/category.entity.ts
1013
- var Category = class extends FreshEntity {
1014
- // ...
1206
+ function _ts_decorate4(decorators, target, key, desc) {
1207
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1208
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1209
+ 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;
1210
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1211
+ }
1212
+ __name(_ts_decorate4, "_ts_decorate");
1213
+ var _Category = class _Category extends FreshEntity {
1015
1214
  };
1016
- Category = __decorateClass([
1215
+ __name(_Category, "Category");
1216
+ var Category = _Category;
1217
+ Category = _ts_decorate4([
1017
1218
  (0, import_typeorm5.Entity)()
1018
1219
  ], Category);
1019
1220
 
1020
1221
  // src/common/schema/entities/device.entity.ts
1021
1222
  var import_typeorm6 = require("typeorm");
1022
- var Device = class extends FreshEntity {
1023
- // ...
1223
+ function _ts_decorate5(decorators, target, key, desc) {
1224
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1225
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1226
+ 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;
1227
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1228
+ }
1229
+ __name(_ts_decorate5, "_ts_decorate");
1230
+ var _Device = class _Device extends FreshEntity {
1024
1231
  };
1025
- Device = __decorateClass([
1232
+ __name(_Device, "Device");
1233
+ var Device = _Device;
1234
+ Device = _ts_decorate5([
1026
1235
  (0, import_typeorm6.Entity)()
1027
1236
  ], Device);
1028
1237
 
1029
1238
  // src/common/schema/entities/manufacturer.entity.ts
1030
1239
  var import_typeorm7 = require("typeorm");
1031
- var Manufacturer = class extends FreshEntity {
1032
- // ...
1240
+ function _ts_decorate6(decorators, target, key, desc) {
1241
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1242
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1243
+ 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;
1244
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1245
+ }
1246
+ __name(_ts_decorate6, "_ts_decorate");
1247
+ var _Manufacturer = class _Manufacturer extends FreshEntity {
1033
1248
  };
1034
- Manufacturer = __decorateClass([
1249
+ __name(_Manufacturer, "Manufacturer");
1250
+ var Manufacturer = _Manufacturer;
1251
+ Manufacturer = _ts_decorate6([
1035
1252
  (0, import_typeorm7.Entity)()
1036
1253
  ], Manufacturer);
1037
1254
 
1038
1255
  // src/common/schema/entities/product.entity.ts
1039
1256
  var import_typeorm8 = require("typeorm");
1040
- var Product = class extends FreshEntity {
1041
- // ...
1257
+ function _ts_decorate7(decorators, target, key, desc) {
1258
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1259
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1260
+ 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;
1261
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1262
+ }
1263
+ __name(_ts_decorate7, "_ts_decorate");
1264
+ var _Product = class _Product extends FreshEntity {
1042
1265
  };
1043
- Product = __decorateClass([
1266
+ __name(_Product, "Product");
1267
+ var Product = _Product;
1268
+ Product = _ts_decorate7([
1044
1269
  (0, import_typeorm8.Entity)()
1045
1270
  ], Product);
1046
1271
 
1047
1272
  // src/common/schema/entities/subcategory.entity.ts
1048
1273
  var import_typeorm9 = require("typeorm");
1049
- var Subcategory = class extends FreshEntity {
1050
- // ...
1274
+ function _ts_decorate8(decorators, target, key, desc) {
1275
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1276
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1277
+ 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;
1278
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1279
+ }
1280
+ __name(_ts_decorate8, "_ts_decorate");
1281
+ var _Subcategory = class _Subcategory extends FreshEntity {
1051
1282
  };
1052
- Subcategory = __decorateClass([
1283
+ __name(_Subcategory, "Subcategory");
1284
+ var Subcategory = _Subcategory;
1285
+ Subcategory = _ts_decorate8([
1053
1286
  (0, import_typeorm9.Entity)()
1054
1287
  ], Subcategory);
1055
1288
 
1056
1289
  // src/core/data-helper.ts
1057
- var DataHelper = class {
1290
+ var _DataHelper = class _DataHelper {
1058
1291
  constructor(startDataRetrieve = true, deviceIds) {
1059
- this._dataPromise = null;
1292
+ __publicField(this, "_data");
1293
+ __publicField(this, "_dataPromise", null);
1294
+ __publicField(this, "deviceIds");
1060
1295
  this.deviceIds = deviceIds;
1061
1296
  if (startDataRetrieve) {
1062
1297
  this._dataPromise = this.startDataRetrieval();
@@ -1085,77 +1320,144 @@ var DataHelper = class {
1085
1320
  return this._data;
1086
1321
  }
1087
1322
  };
1323
+ __name(_DataHelper, "DataHelper");
1324
+ var DataHelper = _DataHelper;
1088
1325
 
1089
1326
  // src/core/class/fresh-job.ts
1090
1327
  var import_node_schedule = require("node-schedule");
1091
- var FreshJob = class extends Singleton {
1328
+ var _FreshJob = class _FreshJob extends Singleton {
1092
1329
  /**
1093
- * @param cronExpression must be cron of just numbers ex.: `0 5 * * 4`
1094
- * By default timezone is added " Europe/Prague"
1330
+ * Creates and optionally schedules a singleton cron job.
1331
+ *
1332
+ * @param jobName - Logical name of the job (used in logs and errors).
1333
+ * @param cronExpression - Cron expression consisting of numeric fields only.
1334
+ * Example: `0 5 * * 4`
1335
+ * The timezone `"Europe/Prague"` is applied automatically.
1336
+ *
1337
+ * @param jobEnabled - Whether the job should be scheduled immediately.
1338
+ * If `false`, the instance exists but no cron trigger is registered.
1339
+ *
1340
+ * @throws Error If the cron expression is invalid.
1341
+ * @throws Error If the job cannot be scheduled.
1095
1342
  */
1096
1343
  constructor(jobName, cronExpression, jobEnabled) {
1097
- super();
1098
- this._job = null;
1344
+ super(false);
1345
+ /** Human-readable job identifier (used for logs and errors). */
1346
+ __publicField(this, "_jobName");
1347
+ /**
1348
+ * Cron expression defining when the job runs.
1349
+ *
1350
+ * Must contain numeric cron fields only.
1351
+ * Example: `0 5 * * 4`
1352
+ *
1353
+ * Timezone is always forced to `"Europe/Prague"`.
1354
+ * If you need another timezone, this class is not your friend.
1355
+ */
1356
+ __publicField(this, "_cronExpression");
1357
+ /** Scheduled job instance, or `null` if the job is disabled. */
1358
+ __publicField(this, "_job", null);
1099
1359
  this._jobName = jobName;
1100
1360
  if (!isValidCron(cronExpression)) {
1101
- throw new Error(
1102
- `Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`
1103
- );
1361
+ throw new Error(`Job ${this.jobName} cannot be constructed with invalid cron: "${cronExpression}"`);
1104
1362
  }
1105
1363
  this._cronExpression = cronExpression;
1106
1364
  if (jobEnabled) {
1107
- this._job = (0, import_node_schedule.scheduleJob)(
1108
- { rule: this._cronExpression, tz: "Europe/Prague" },
1109
- async () => {
1110
- await this.invoke();
1111
- }
1112
- );
1365
+ this._job = (0, import_node_schedule.scheduleJob)({
1366
+ rule: this._cronExpression,
1367
+ tz: "Europe/Prague"
1368
+ }, async () => {
1369
+ await this.invoke();
1370
+ });
1113
1371
  if (!this._job) {
1114
1372
  throw new Error(`Job ${this._jobName} could not be scheduled`);
1115
1373
  }
1116
1374
  }
1117
1375
  this.onInit();
1118
1376
  }
1119
- /** Just logging */
1377
+ /**
1378
+ * Initialization hook.
1379
+ *
1380
+ * Called once during construction and used primarily for logging.
1381
+ * Can also be reused by subclasses if manual rescheduling is implemented.
1382
+ *
1383
+ * @param rescheduled - Indicates whether the job was reconfigured
1384
+ * after initial creation.
1385
+ */
1120
1386
  onInit(rescheduled) {
1121
- console.log(
1122
- `Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`
1123
- );
1387
+ console.log(`Job ${this.jobName} ${rescheduled ? "rescheduled" : "initialized"} with cron rule: "${this.cronExpression}"`);
1124
1388
  }
1389
+ /** @returns The logical name of the job. */
1125
1390
  get jobName() {
1126
1391
  return this._jobName;
1127
1392
  }
1393
+ /** Allows subclasses to rename the job if absolutely necessary. */
1128
1394
  set jobName(value) {
1129
1395
  this._jobName = value;
1130
1396
  }
1397
+ /** @returns The cron expression used to schedule the job. */
1131
1398
  get cronExpression() {
1132
1399
  return this._cronExpression;
1133
1400
  }
1401
+ /**
1402
+ * Allows subclasses to update the cron expression internally.
1403
+ * Does reschedule of job if exists
1404
+ */
1134
1405
  set cronExpression(value) {
1406
+ if (!isValidCron(value)) {
1407
+ throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${value}"`);
1408
+ }
1135
1409
  this._cronExpression = value;
1136
1410
  }
1411
+ /** @returns The underlying scheduled job instance, or `null` if disabled. */
1137
1412
  get job() {
1138
1413
  return this._job;
1139
1414
  }
1415
+ /** Allows subclasses to manage the scheduled job instance. */
1140
1416
  set job(value) {
1141
1417
  this._job = value;
1142
1418
  }
1419
+ reschedule(newCronExpression) {
1420
+ let result = false;
1421
+ if (!isValidCron(newCronExpression)) {
1422
+ throw new Error(`Job ${this._jobName} cannot be re-scheduled with invalid cron: "${newCronExpression}"`);
1423
+ }
1424
+ this._cronExpression = newCronExpression;
1425
+ if (this._job) {
1426
+ const rescheduleSuccess = this._job.reschedule({
1427
+ rule: this._cronExpression,
1428
+ tz: "Europe/Prague"
1429
+ });
1430
+ if (!rescheduleSuccess) {
1431
+ throw new Error(`Job ${this._jobName} could not be re-scheduled`);
1432
+ } else {
1433
+ this.onInit(true);
1434
+ }
1435
+ result = rescheduleSuccess;
1436
+ }
1437
+ return result;
1438
+ }
1143
1439
  };
1440
+ __name(_FreshJob, "FreshJob");
1441
+ var FreshJob = _FreshJob;
1144
1442
 
1145
1443
  // src/core/errors/api-error.ts
1146
- var ApiError = class extends Error {
1444
+ var _ApiError = class _ApiError extends Error {
1445
+ constructor(statusCode, status, detail) {
1446
+ super();
1447
+ __publicField(this, "_statusCode");
1448
+ __publicField(this, "_statusDto");
1449
+ this._statusCode = statusCode;
1450
+ this._statusDto = new StatusDto(status, detail);
1451
+ }
1147
1452
  get statusCode() {
1148
1453
  return this._statusCode;
1149
1454
  }
1150
1455
  get statusDto() {
1151
1456
  return this._statusDto;
1152
1457
  }
1153
- constructor(statusCode, status, detail) {
1154
- super();
1155
- this._statusCode = statusCode;
1156
- this._statusDto = new StatusDto(status, detail);
1157
- }
1158
1458
  };
1459
+ __name(_ApiError, "ApiError");
1460
+ var ApiError = _ApiError;
1159
1461
 
1160
1462
  // src/config/eslint-config.ts
1161
1463
  var import_typescript_eslint = __toESM(require("typescript-eslint"));
@@ -1166,7 +1468,10 @@ var FRESH_ESLINT_CONFIG = [
1166
1468
  // Prettier integration
1167
1469
  ...import_eslint_config_prettier.default,
1168
1470
  // Affected files
1169
- files: ["**/*.ts", "**/*.tsx"],
1471
+ files: [
1472
+ "**/*.ts",
1473
+ "**/*.tsx"
1474
+ ],
1170
1475
  ignores: [
1171
1476
  "dist/**",
1172
1477
  "node_modules/**",
@@ -1191,26 +1496,49 @@ var FRESH_ESLINT_CONFIG = [
1191
1496
  // no lets or vars
1192
1497
  "prefer-const": "error",
1193
1498
  // blocks ("red" === color) these ifs
1194
- yoda: ["error", "never"],
1195
- "no-multiple-empty-lines": ["error", { max: 1 }],
1499
+ yoda: [
1500
+ "error",
1501
+ "never"
1502
+ ],
1503
+ "no-multiple-empty-lines": [
1504
+ "error",
1505
+ {
1506
+ max: 1
1507
+ }
1508
+ ],
1196
1509
  // semi-colons
1197
- semi: ["error", "always"],
1510
+ semi: [
1511
+ "error",
1512
+ "always"
1513
+ ],
1198
1514
  // forces block for all control statements (forbid one-line returns)
1199
- curly: ["error", "all"],
1515
+ curly: [
1516
+ "error",
1517
+ "all"
1518
+ ],
1200
1519
  // makes spaces between brackets
1201
- "object-curly-spacing": ["error", "always"],
1520
+ "object-curly-spacing": [
1521
+ "error",
1522
+ "always"
1523
+ ],
1202
1524
  // checks same if/else conditions
1203
1525
  "no-dupe-else-if": "error",
1204
1526
  // keeps imports from one package in same declaration
1205
1527
  "no-duplicate-imports": "error",
1206
1528
  // blocks simple '=' in condition blocks
1207
- "no-cond-assign": ["error", "always"],
1529
+ "no-cond-assign": [
1530
+ "error",
1531
+ "always"
1532
+ ],
1208
1533
  // forbids promise inside promise
1209
1534
  "no-async-promise-executor": "error",
1210
1535
  // watches possible falltrough in switch cases
1211
1536
  "no-fallthrough": "error",
1212
1537
  // use === instead of ==
1213
- eqeqeq: ["error", "always"],
1538
+ eqeqeq: [
1539
+ "error",
1540
+ "always"
1541
+ ],
1214
1542
  // Prettier formatting rules
1215
1543
  "prettier/prettier": [
1216
1544
  "error",
@@ -1236,23 +1564,40 @@ var FRESH_ESLINT_CONFIG = [
1236
1564
  "@typescript-eslint/naming-convention": [
1237
1565
  "error",
1238
1566
  {
1239
- selector: ["variable", "function"],
1240
- format: ["camelCase"],
1567
+ selector: [
1568
+ "variable",
1569
+ "function"
1570
+ ],
1571
+ format: [
1572
+ "camelCase"
1573
+ ],
1241
1574
  leadingUnderscore: "allow"
1242
1575
  },
1243
1576
  {
1244
1577
  selector: "class",
1245
- format: ["PascalCase"]
1578
+ format: [
1579
+ "PascalCase"
1580
+ ]
1246
1581
  },
1247
1582
  {
1248
1583
  selector: "variable",
1249
- modifiers: ["const", "exported"],
1250
- format: ["UPPER_CASE"]
1584
+ modifiers: [
1585
+ "const",
1586
+ "exported"
1587
+ ],
1588
+ format: [
1589
+ "UPPER_CASE",
1590
+ "PascalCase"
1591
+ ]
1251
1592
  },
1252
1593
  {
1253
1594
  selector: "property",
1254
- modifiers: ["readonly"],
1255
- format: ["UPPER_CASE"]
1595
+ modifiers: [
1596
+ "readonly"
1597
+ ],
1598
+ format: [
1599
+ "UPPER_CASE"
1600
+ ]
1256
1601
  }
1257
1602
  ]
1258
1603
  }
@@ -1277,8 +1622,12 @@ var PG_DATA_SOURCE_OPTIONS = {
1277
1622
  password: process.env.POSTGRE_SQL_PASSWORD || "<password>",
1278
1623
  database: process.env.POSTGRE_SQL_DATABASE || "<database>",
1279
1624
  schema: process.env.POSTGRE_SQL_SCHEMA || "<scheme>",
1280
- entities: [import_path.default.join(basePath, isTs ? "src/entity/*.{ts,js}" : "build/entity/*.js")],
1281
- migrations: [import_path.default.join(basePath, isTs ? "src/migration/*.{ts,js}" : "build/migration/*.js")],
1625
+ entities: [
1626
+ import_path.default.join(basePath, isTs ? "src/entity/*.{ts,js}" : "build/entity/*.js")
1627
+ ],
1628
+ migrations: [
1629
+ import_path.default.join(basePath, isTs ? "src/migration/*.{ts,js}" : "build/migration/*.js")
1630
+ ],
1282
1631
  migrationsRun: process.env.RUN_MIGRATIONS === "true",
1283
1632
  migrationsTableName: "migrations",
1284
1633
  migrationsTransactionMode: "each",
@@ -1290,7 +1639,6 @@ var PG_DATA_SOURCE_OPTIONS = {
1290
1639
  useUTC: true,
1291
1640
  cache: true,
1292
1641
  namingStrategy: new import_typeorm_naming_strategies.SnakeNamingStrategy()
1293
- // replication: undefined,
1294
1642
  };
1295
1643
  var datasource_default = PG_DATA_SOURCE_OPTIONS;
1296
1644
  // Annotate the CommonJS export names for ESM import in node: