@freshpointcz/fresh-core 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,117 +1,39 @@
1
- import dayjs, { Dayjs } from 'dayjs';
2
1
  import { BaseEntity, ColumnOptions, Repository, EntityTarget, EntityManager, ObjectLiteral, EntitySubscriberInterface, InsertEvent, UpdateEvent, SoftRemoveEvent, TransactionCommitEvent, DataSourceOptions } from 'typeorm';
2
+ import dayjs, { Dayjs } from 'dayjs';
3
3
  import { Job } from 'node-schedule';
4
4
  import * as _eslint_core from '@eslint/core';
5
5
  import * as typescript_eslint_dist_compatibility_types from 'typescript-eslint/dist/compatibility-types';
6
6
 
7
- /**
8
- * Static DateUtils class
9
- */
10
- declare class DateUtils {
11
- /** Holidays 2025-2030 as YYYY-MM-DD strings */
12
- static HOLIDAYS_STR: readonly string[];
13
- /** Holidays 2025-2030 as UTC timestamps */
14
- static HOLIDAYS: readonly number[];
15
- static fromISOtoSQLtimestamp(ts?: string): string;
16
- static toSQLtimestamp(ts: Dayjs): string;
17
- static fromSQLtimestamp(mysqlDate: string): Dayjs;
18
- static getSqlTimestampFromNowCzech(): string;
19
- static fromISO(isoDate: string): Dayjs;
20
- static getDate(ts: string): dayjs.Dayjs;
21
- static getNow(): Dayjs;
22
- static getNowCzech(): Dayjs;
23
- static clone(ts: Dayjs): Dayjs;
24
- static getLastSunday(weeksOffset?: number): Dayjs;
25
- static dayInWeek(ts?: Dayjs): 1 | 2 | 3 | 4 | 5 | 6 | 7;
26
- static isWorkdayDay(ts: Dayjs): boolean;
27
- static getDiffInMinutesWithNow(inputTime: Dayjs): number;
28
- static isInLastDays(numOfDays: number, timestampInput: string | Dayjs): boolean;
29
- }
30
-
31
- type Deferred<T> = {
32
- promise: Promise<T>;
33
- resolve: (value: T) => void;
34
- reject: (err: any) => void;
7
+ declare const AMOUNT_UNIT: {
8
+ readonly 1: {
9
+ readonly symbol: "g";
10
+ readonly translations: {
11
+ readonly en: "gram";
12
+ readonly cs: "gram";
13
+ };
14
+ };
15
+ readonly 2: {
16
+ readonly symbol: "kg";
17
+ readonly translations: {
18
+ readonly en: "kilogram";
19
+ readonly cs: "kilogram";
20
+ };
21
+ };
22
+ readonly 3: {
23
+ readonly symbol: "ml";
24
+ readonly translations: {
25
+ readonly en: "milliliter";
26
+ readonly cs: "mililitr";
27
+ };
28
+ };
29
+ readonly 4: {
30
+ readonly symbol: "l";
31
+ readonly translations: {
32
+ readonly en: "liter";
33
+ readonly cs: "litr";
34
+ };
35
+ };
35
36
  };
36
- /**
37
- * Deferred promise is like "fake" which is used to manually resolve/reject later on with different promise
38
- * With resolve and reject outside for easier change of promise
39
- * is used as placeholder untill real promise is assigned
40
- */
41
- declare function createDeferred<T>(): Deferred<T>;
42
-
43
- /**
44
- * Experimental class to maintain just one promise for some process flow.
45
- * Currently is in singleton design, so can be used only in one proces. (currently: all-product-availability-per-day)
46
- */
47
- declare class SinglePromiseWaiter<T = any> {
48
- private static _instance;
49
- static getInstance<T = any>(): SinglePromiseWaiter<any>;
50
- private _promise;
51
- get promise(): Promise<T> | null;
52
- set promise(promise: Promise<T> | null);
53
- get hasPromise(): boolean;
54
- }
55
-
56
- declare function isValidCron(expr: string): boolean;
57
-
58
- /**
59
- * Abstract base class implementing a per-subclass Singleton pattern.
60
- *
61
- * Each subclass of `Singleton` can have exactly one instance.
62
- * Instantiation is guarded at runtime: calling `new` multiple times
63
- * will always return the first created instance for that subclass.
64
- *
65
- * Instances are stored internally in a static map keyed by constructor
66
- * function, allowing independent singleton instances per subclass.
67
- *
68
- * ⚠️ Important:
69
- * - Subclasses MUST NOT override the constructor unless they fully
70
- * understand the consequences.
71
- * - Initialization logic must be placed in {@link onInit}, not the constructor.
72
- * - The constructor may return an existing instance, which is legal in JS
73
- * but mildly unsettling.
74
- */
75
- declare abstract class Singleton {
76
- /**
77
- * Internal registry of singleton instances.
78
- * One instance per subclass constructor.
79
- */
80
- private static instances;
81
- /**
82
- * Creates or returns the singleton instance for the subclass.
83
- *
84
- * If an instance already exists for the subclass, that instance is
85
- * returned instead of creating a new one.
86
- *
87
- * @param callOnInit - Whether to call {@link onInit} for a newly
88
- * created instance. Ignored if the instance already exists.
89
- */
90
- constructor(callOnInit?: boolean);
91
- /**
92
- * Retrieves the singleton instance for the calling subclass.
93
- *
94
- * If no instance exists, a new one is created using the provided
95
- * constructor arguments.
96
- *
97
- * Intended to be used by subclasses as a protected factory method.
98
- *
99
- * @typeParam T - The concrete subclass type.
100
- * @param args - Arguments forwarded to the subclass constructor.
101
- * @returns The singleton instance of the subclass.
102
- */
103
- protected static getInstance<T>(this: new (...args: any[]) => T, ...args: ConstructorParameters<any>): T;
104
- /**
105
- * Lifecycle hook called once when the singleton instance is first created.
106
- *
107
- * Subclasses must implement this method instead of relying on the
108
- * constructor for initialization logic.
109
- *
110
- * This method is guaranteed to be called at most once per subclass
111
- * instance.
112
- */
113
- protected abstract onInit(): void | Promise<void>;
114
- }
115
37
 
116
38
  type Status = "ok" | "error" | "not-authorized" | "not-authenticated" | "internal-server-error" | "validation-error";
117
39
 
@@ -362,36 +284,88 @@ interface PaginatedList<T> {
362
284
  */
363
285
  declare function listAll<T>(fetchPage: (pagination: PaginationParams) => Promise<PaginatedList<T>>, batchSize?: number): Promise<T[]>;
364
286
 
365
- declare const AMOUNT_UNIT: {
366
- readonly 1: {
367
- readonly symbol: "g";
368
- readonly translations: {
369
- readonly en: "gram";
370
- readonly cs: "gram";
371
- };
372
- };
373
- readonly 2: {
374
- readonly symbol: "kg";
375
- readonly translations: {
376
- readonly en: "kilogram";
377
- readonly cs: "kilogram";
378
- };
379
- };
380
- readonly 3: {
381
- readonly symbol: "ml";
382
- readonly translations: {
383
- readonly en: "milliliter";
384
- readonly cs: "mililitr";
385
- };
386
- };
387
- readonly 4: {
388
- readonly symbol: "l";
389
- readonly translations: {
390
- readonly en: "liter";
391
- readonly cs: "litr";
392
- };
393
- };
287
+ /**
288
+ * Abstract base class implementing a per-subclass Singleton pattern.
289
+ *
290
+ * Each subclass of `Singleton` can have exactly one instance.
291
+ * Instantiation is guarded at runtime: calling `new` multiple times
292
+ * will always return the first created instance for that subclass.
293
+ *
294
+ * Instances are stored internally in a static map keyed by constructor
295
+ * function, allowing independent singleton instances per subclass.
296
+ *
297
+ * ⚠️ Important:
298
+ * - Subclasses MUST NOT override the constructor unless they fully
299
+ * understand the consequences.
300
+ * - Initialization logic must be placed in {@link onInit}, not the constructor.
301
+ * - The constructor may return an existing instance, which is legal in JS
302
+ * but mildly unsettling.
303
+ */
304
+ declare abstract class Singleton {
305
+ /**
306
+ * Internal registry of singleton instances.
307
+ * One instance per subclass constructor.
308
+ */
309
+ private static instances;
310
+ /**
311
+ * Creates or returns the singleton instance for the subclass.
312
+ *
313
+ * If an instance already exists for the subclass, that instance is
314
+ * returned instead of creating a new one.
315
+ *
316
+ * @param callOnInit - Whether to call {@link onInit} for a newly
317
+ * created instance. Ignored if the instance already exists.
318
+ */
319
+ constructor(callOnInit?: boolean);
320
+ /**
321
+ * Retrieves the singleton instance for the calling subclass.
322
+ *
323
+ * If no instance exists, a new one is created using the provided
324
+ * constructor arguments.
325
+ *
326
+ * Intended to be used by subclasses as a protected factory method.
327
+ *
328
+ * @typeParam T - The concrete subclass type.
329
+ * @param args - Arguments forwarded to the subclass constructor.
330
+ * @returns The singleton instance of the subclass.
331
+ */
332
+ protected static getInstance<T>(this: new (...args: any[]) => T, ...args: ConstructorParameters<any>): T;
333
+ /**
334
+ * Lifecycle hook called once when the singleton instance is first created.
335
+ *
336
+ * Subclasses must implement this method instead of relying on the
337
+ * constructor for initialization logic.
338
+ *
339
+ * This method is guaranteed to be called at most once per subclass
340
+ * instance.
341
+ */
342
+ protected abstract onInit(): void | Promise<void>;
343
+ }
344
+
345
+ type Deferred<T> = {
346
+ promise: Promise<T>;
347
+ resolve: (value: T) => void;
348
+ reject: (err: any) => void;
394
349
  };
350
+ /**
351
+ * Deferred promise is like "fake" which is used to manually resolve/reject later on with different promise
352
+ * With resolve and reject outside for easier change of promise
353
+ * is used as placeholder untill real promise is assigned
354
+ */
355
+ declare function createDeferred<T>(): Deferred<T>;
356
+
357
+ /**
358
+ * Experimental class to maintain just one promise for some process flow.
359
+ * Currently is in singleton design, so can be used only in one proces. (currently: all-product-availability-per-day)
360
+ */
361
+ declare class SinglePromiseWaiter<T = any> {
362
+ private static _instance;
363
+ static getInstance<T = any>(): SinglePromiseWaiter<any>;
364
+ private _promise;
365
+ get promise(): Promise<T> | null;
366
+ set promise(promise: Promise<T> | null);
367
+ get hasPromise(): boolean;
368
+ }
395
369
 
396
370
  /**
397
371
  * Default Entity with needed columns for every basic entity `id`, `uuid`, `created_at`, `updated_at` and `deleted_at`;
@@ -864,6 +838,29 @@ declare const TO_BINARY_FLAG: (v: number | boolean | null | undefined) => Binary
864
838
  */
865
839
  declare function runWithConcurrency<T>(items: T[], concurrency: number, worker: (item: T) => Promise<void>): Promise<void>;
866
840
 
841
+ /**
842
+ * Resolves a path parameter ID string to either a numeric ID or a UUID (any version).
843
+ *
844
+ * tsoa always provides path parameters as strings, so this utility determines
845
+ * the intended type by checking whether the value is purely numeric.
846
+ *
847
+ * @param id - Raw path parameter string
848
+ * @returns Parsed `number` if the value is numeric, otherwise the original `string`.
849
+ *
850
+ * @example
851
+ * resolvePathParameterId("42") // → 42
852
+ * resolvePathParameterId("550e8400-e29b-41d4-a716-446655440000") // → "550e8400-..."
853
+ *
854
+ * // Typical tsoa usage:
855
+ * \@Get("{id}")
856
+ * public async getUserById(\@Request() req: ExRequest, \@Path() id: string) {
857
+ * const userId = resolvePathParameterId(id); // number | string
858
+ * }
859
+ */
860
+ declare function resolvePathParameterId(id: string): string | number;
861
+
862
+ declare function isValidCron(expr: string): boolean;
863
+
867
864
  type TransformMap<TIn, TOut, K extends keyof TIn & keyof TOut> = Partial<{
868
865
  [P in K]: (val: TIn[P]) => TOut[P];
869
866
  }>;
@@ -876,34 +873,28 @@ type TransformMap<TIn, TOut, K extends keyof TIn & keyof TOut> = Partial<{
876
873
  */
877
874
  declare function buildPatch<TOut extends Record<string, any>, TIn extends Record<string, any>, K extends keyof TIn & keyof TOut = keyof TIn & keyof TOut>(data: Partial<TIn>, keys: readonly K[], transforms?: TransformMap<TIn, TOut, K>): Partial<Pick<TOut, K>>;
878
875
 
879
- type Maybe<T> = T | null;
880
876
  /**
881
- * Validates a value that may be `null` or given type
882
- *
883
- * WARNING:
884
- * `undefined` is NOT accepted by this function.
885
- * If you need `undefined` support, it must be handled
886
- * before calling this guard or explicitly allowed elsewhere.
887
- *
888
- * @typeParam T - The underlying non-nullable type
889
- * @param v - Value to validate
890
- * @param inner - Typeguard function for the underlying type `T`
891
- *
892
- * @returns `true` if the value is `null` or satisfies the inner typeguard
877
+ * Static DateUtils class
893
878
  */
894
- declare function isMaybe<T>(v: unknown, inner: (x: unknown) => x is T): v is Maybe<T>;
895
-
896
- declare abstract class DataHelper<T> {
897
- private _data?;
898
- private _dataPromise;
899
- protected deviceIds: Promise<number[]>;
900
- constructor(startDataRetrieve: boolean | undefined, deviceIds: Promise<number[]>);
901
- protected get data(): Maybe<T> | undefined;
902
- protected set data(value: Maybe<T>);
903
- protected get dataPromise(): Maybe<Promise<Maybe<T>>>;
904
- protected set dataPromise(value: Maybe<Promise<Maybe<T>>>);
905
- getData(): Promise<Maybe<T>>;
906
- abstract startDataRetrieval(): Promise<Maybe<T>>;
879
+ declare class DateUtils {
880
+ /** Holidays 2025-2030 as YYYY-MM-DD strings */
881
+ static HOLIDAYS_STR: readonly string[];
882
+ /** Holidays 2025-2030 as UTC timestamps */
883
+ static HOLIDAYS: readonly number[];
884
+ static fromISOtoSQLtimestamp(ts?: string): string;
885
+ static toSQLtimestamp(ts: Dayjs): string;
886
+ static fromSQLtimestamp(mysqlDate: string): Dayjs;
887
+ static getSqlTimestampFromNowCzech(): string;
888
+ static fromISO(isoDate: string): Dayjs;
889
+ static getDate(ts: string): dayjs.Dayjs;
890
+ static getNow(): Dayjs;
891
+ static getNowCzech(): Dayjs;
892
+ static clone(ts: Dayjs): Dayjs;
893
+ static getLastSunday(weeksOffset?: number): Dayjs;
894
+ static dayInWeek(ts?: Dayjs): 1 | 2 | 3 | 4 | 5 | 6 | 7;
895
+ static isWorkdayDay(ts: Dayjs): boolean;
896
+ static getDiffInMinutesWithNow(inputTime: Dayjs): number;
897
+ static isInLastDays(numOfDays: number, timestampInput: string | Dayjs): boolean;
907
898
  }
908
899
 
909
900
  /**
@@ -996,8 +987,26 @@ declare abstract class FreshJob<T = void> extends Singleton {
996
987
  abstract invoke(): T | Promise<T>;
997
988
  }
998
989
 
990
+ type Maybe<T> = T | null;
991
+ /**
992
+ * Validates a value that may be `null` or given type
993
+ *
994
+ * WARNING:
995
+ * `undefined` is NOT accepted by this function.
996
+ * If you need `undefined` support, it must be handled
997
+ * before calling this guard or explicitly allowed elsewhere.
998
+ *
999
+ * @typeParam T - The underlying non-nullable type
1000
+ * @param v - Value to validate
1001
+ * @param inner - Typeguard function for the underlying type `T`
1002
+ *
1003
+ * @returns `true` if the value is `null` or satisfies the inner typeguard
1004
+ */
1005
+ declare function isMaybe<T>(v: unknown, inner: (x: unknown) => x is T): v is Maybe<T>;
1006
+
999
1007
  type CardNumber = `${number}${number}${number}${number}`;
1000
1008
 
1009
+ /** @deprecated use {@link FreshError} instead */
1001
1010
  declare class ApiError extends Error {
1002
1011
  private _statusCode;
1003
1012
  get statusCode(): number;
@@ -1018,6 +1027,219 @@ declare class BusinessWarning extends Error {
1018
1027
  constructor(code: string, message: string);
1019
1028
  }
1020
1029
 
1030
+ /**
1031
+ * Options for {@link FreshError} and its subclasses.
1032
+ */
1033
+ interface FreshErrorOptions {
1034
+ /**
1035
+ * The original error that caused this one.
1036
+ * Preserved for error chaining and accessible via `error.cause`.
1037
+ */
1038
+ cause?: unknown;
1039
+ }
1040
+ /**
1041
+ * Base class for all application HTTP errors.
1042
+ *
1043
+ * Extend this class to create typed, status-specific errors with a hardcoded
1044
+ * HTTP status code and status string. Direct instantiation is allowed but
1045
+ * subclasses are preferred for consistent error identity.
1046
+ *
1047
+ * `error.name` is automatically set to the subclass name, so stack traces
1048
+ * and logs show `UnauthorizedError` instead of the generic `Error`.
1049
+ *
1050
+ * @example
1051
+ * // Without cause
1052
+ * throw new FreshError(HttpStatus.NOT_FOUND, "error", "User not found");
1053
+ *
1054
+ * // With cause — preserves the original error for logging/debugging
1055
+ * try {
1056
+ * await db.findUser(id);
1057
+ * } catch (err) {
1058
+ * throw new FreshError(HttpStatus.INTERNAL_SERVER_ERROR, "internal-server-error", "DB query failed", { cause: err });
1059
+ * }
1060
+ */
1061
+ declare class FreshError extends Error {
1062
+ /** HTTP status code sent in the response. */
1063
+ readonly statusCode: number;
1064
+ /** Structured response body describing the error. */
1065
+ readonly statusDto: StatusDto;
1066
+ constructor(statusCode: HttpStatus, status: Status, detail?: string, options?: FreshErrorOptions);
1067
+ }
1068
+
1069
+ /** 400 — The request is malformed or contains invalid parameters. */
1070
+ declare class BadRequestError extends FreshError {
1071
+ constructor(detail?: string, options?: FreshErrorOptions);
1072
+ }
1073
+ /** 401 — Authentication is required or the provided credentials are invalid. */
1074
+ declare class UnauthorizedError extends FreshError {
1075
+ constructor(detail?: string, options?: FreshErrorOptions);
1076
+ }
1077
+ /** 402 — Payment is required to access the requested resource. */
1078
+ declare class PaymentRequiredError extends FreshError {
1079
+ constructor(detail?: string, options?: FreshErrorOptions);
1080
+ }
1081
+ /** 403 — The caller is authenticated but lacks permission to access the resource. */
1082
+ declare class ForbiddenError extends FreshError {
1083
+ constructor(detail?: string, options?: FreshErrorOptions);
1084
+ }
1085
+ /** 404 — The requested resource does not exist. */
1086
+ declare class NotFoundError extends FreshError {
1087
+ constructor(detail?: string, options?: FreshErrorOptions);
1088
+ }
1089
+ /** 405 — The HTTP method is not supported for this endpoint. */
1090
+ declare class MethodNotAllowedError extends FreshError {
1091
+ constructor(detail?: string, options?: FreshErrorOptions);
1092
+ }
1093
+ /** 406 — The server cannot produce a response matching the client's `Accept` headers. */
1094
+ declare class NotAcceptableError extends FreshError {
1095
+ constructor(detail?: string, options?: FreshErrorOptions);
1096
+ }
1097
+ /** 407 — Authentication with the proxy is required before the request can proceed. */
1098
+ declare class ProxyAuthenticationRequiredError extends FreshError {
1099
+ constructor(detail?: string, options?: FreshErrorOptions);
1100
+ }
1101
+ /** 408 — The server timed out waiting for the client to complete the request. */
1102
+ declare class RequestTimeoutError extends FreshError {
1103
+ constructor(detail?: string, options?: FreshErrorOptions);
1104
+ }
1105
+ /** 409 — The request conflicts with the current state of the resource. */
1106
+ declare class ConflictError extends FreshError {
1107
+ constructor(detail?: string, options?: FreshErrorOptions);
1108
+ }
1109
+ /** 410 — The resource has been permanently removed and will not return. */
1110
+ declare class GoneError extends FreshError {
1111
+ constructor(detail?: string, options?: FreshErrorOptions);
1112
+ }
1113
+ /** 411 — The request must include a `Content-Length` header. */
1114
+ declare class LengthRequiredError extends FreshError {
1115
+ constructor(detail?: string, options?: FreshErrorOptions);
1116
+ }
1117
+ /** 412 — A precondition in the request headers was not met. */
1118
+ declare class PreconditionFailedError extends FreshError {
1119
+ constructor(detail?: string, options?: FreshErrorOptions);
1120
+ }
1121
+ /** 413 — The request body exceeds the server's size limit. */
1122
+ declare class PayloadTooLargeError extends FreshError {
1123
+ constructor(detail?: string, options?: FreshErrorOptions);
1124
+ }
1125
+ /** 414 — The request URI is longer than the server is willing to process. */
1126
+ declare class UriTooLongError extends FreshError {
1127
+ constructor(detail?: string, options?: FreshErrorOptions);
1128
+ }
1129
+ /** 415 — The request's `Content-Type` is not supported by the server. */
1130
+ declare class UnsupportedMediaTypeError extends FreshError {
1131
+ constructor(detail?: string, options?: FreshErrorOptions);
1132
+ }
1133
+ /** 416 — The `Range` header in the request cannot be satisfied by the resource. */
1134
+ declare class RangeNotSatisfiableError extends FreshError {
1135
+ constructor(detail?: string, options?: FreshErrorOptions);
1136
+ }
1137
+ /** 417 — The expectation in the `Expect` request header could not be met. */
1138
+ declare class ExpectationFailedError extends FreshError {
1139
+ constructor(detail?: string, options?: FreshErrorOptions);
1140
+ }
1141
+ /** 418 — The server refuses to brew coffee because it is, permanently, a teapot. */
1142
+ declare class ImATeapotError extends FreshError {
1143
+ constructor(detail?: string, options?: FreshErrorOptions);
1144
+ }
1145
+ /** 421 — The request was directed at a server that cannot produce a response. */
1146
+ declare class MisdirectedRequestError extends FreshError {
1147
+ constructor(detail?: string, options?: FreshErrorOptions);
1148
+ }
1149
+ /** 422 — The request is well-formed but contains semantic errors. */
1150
+ declare class UnprocessableEntityError extends FreshError {
1151
+ constructor(detail?: string, options?: FreshErrorOptions);
1152
+ }
1153
+ /** 423 — The resource is locked and cannot be accessed. */
1154
+ declare class LockedError extends FreshError {
1155
+ constructor(detail?: string, options?: FreshErrorOptions);
1156
+ }
1157
+ /** 424 — The request failed because a dependency it relies on also failed. */
1158
+ declare class FailedDependencyError extends FreshError {
1159
+ constructor(detail?: string, options?: FreshErrorOptions);
1160
+ }
1161
+ /** 425 — The server is unwilling to process a request that may be replayed. */
1162
+ declare class TooEarlyError extends FreshError {
1163
+ constructor(detail?: string, options?: FreshErrorOptions);
1164
+ }
1165
+ /** 426 — The client must switch to a different protocol to proceed. */
1166
+ declare class UpgradeRequiredError extends FreshError {
1167
+ constructor(detail?: string, options?: FreshErrorOptions);
1168
+ }
1169
+ /** 428 — The request must be conditional (e.g. missing `If-Match` header). */
1170
+ declare class PreconditionRequiredError extends FreshError {
1171
+ constructor(detail?: string, options?: FreshErrorOptions);
1172
+ }
1173
+ /** 429 — The client has sent too many requests in a given time window. */
1174
+ declare class TooManyRequestsError extends FreshError {
1175
+ constructor(detail?: string, options?: FreshErrorOptions);
1176
+ }
1177
+ /** 431 — The request headers are too large for the server to process. */
1178
+ declare class RequestHeaderFieldsTooLargeError extends FreshError {
1179
+ constructor(detail?: string, options?: FreshErrorOptions);
1180
+ }
1181
+ /** 451 — The resource is unavailable due to legal restrictions. */
1182
+ declare class UnavailableForLegalReasonsError extends FreshError {
1183
+ constructor(detail?: string, options?: FreshErrorOptions);
1184
+ }
1185
+ /** 500 — The server encountered an unexpected condition. */
1186
+ declare class InternalServerError extends FreshError {
1187
+ constructor(detail?: string, options?: FreshErrorOptions);
1188
+ }
1189
+ /** 501 — The server does not support the functionality required to fulfil the request. */
1190
+ declare class NotImplementedError extends FreshError {
1191
+ constructor(detail?: string, options?: FreshErrorOptions);
1192
+ }
1193
+ /** 502 — The upstream server returned an invalid response. */
1194
+ declare class BadGatewayError extends FreshError {
1195
+ constructor(detail?: string, options?: FreshErrorOptions);
1196
+ }
1197
+ /** 503 — The server is temporarily unavailable, usually due to maintenance or overload. */
1198
+ declare class ServiceUnavailableError extends FreshError {
1199
+ constructor(detail?: string, options?: FreshErrorOptions);
1200
+ }
1201
+ /** 504 — The upstream server did not respond in time. */
1202
+ declare class GatewayTimeoutError extends FreshError {
1203
+ constructor(detail?: string, options?: FreshErrorOptions);
1204
+ }
1205
+ /** 505 — The HTTP version used in the request is not supported by the server. */
1206
+ declare class HttpVersionNotSupportedError extends FreshError {
1207
+ constructor(detail?: string, options?: FreshErrorOptions);
1208
+ }
1209
+ /** 506 — The server has a configuration error resulting in circular content negotiation. */
1210
+ declare class VariantAlsoNegotiatesError extends FreshError {
1211
+ constructor(detail?: string, options?: FreshErrorOptions);
1212
+ }
1213
+ /** 507 — The server cannot store the representation needed to complete the request. */
1214
+ declare class InsufficientStorageError extends FreshError {
1215
+ constructor(detail?: string, options?: FreshErrorOptions);
1216
+ }
1217
+ /** 508 — The server detected an infinite loop while processing the request. */
1218
+ declare class LoopDetectedError extends FreshError {
1219
+ constructor(detail?: string, options?: FreshErrorOptions);
1220
+ }
1221
+ /** 510 — Further extensions to the request are required for the server to fulfil it. */
1222
+ declare class NotExtendedError extends FreshError {
1223
+ constructor(detail?: string, options?: FreshErrorOptions);
1224
+ }
1225
+ /** 511 — The client must authenticate to gain network access (e.g. captive portal). */
1226
+ declare class NetworkAuthenticationRequiredError extends FreshError {
1227
+ constructor(detail?: string, options?: FreshErrorOptions);
1228
+ }
1229
+
1230
+ declare abstract class DataHelper<T> {
1231
+ private _data?;
1232
+ private _dataPromise;
1233
+ protected deviceIds: Promise<number[]>;
1234
+ constructor(startDataRetrieve: boolean | undefined, deviceIds: Promise<number[]>);
1235
+ protected get data(): Maybe<T> | undefined;
1236
+ protected set data(value: Maybe<T>);
1237
+ protected get dataPromise(): Maybe<Promise<Maybe<T>>>;
1238
+ protected set dataPromise(value: Maybe<Promise<Maybe<T>>>);
1239
+ getData(): Promise<Maybe<T>>;
1240
+ abstract startDataRetrieval(): Promise<Maybe<T>>;
1241
+ }
1242
+
1021
1243
  declare const FRESH_ESLINT_CONFIG: {
1022
1244
  files: string[];
1023
1245
  ignores: string[];
@@ -1095,4 +1317,4 @@ interface HealthCheckResult {
1095
1317
  };
1096
1318
  }
1097
1319
 
1098
- export { AMOUNT_UNIT, ActionCommandCode, ApiError, BaseEntityChangeSubscriber, type BinaryFlag, BusinessWarning, type CardNumber, Category, DEFAULT_PAGINATION_PARAMS, DataHelper, DateUtils, type Deferred, DepotPoolStatus, Device, type EntityChangeEvent, FreshDao, FreshEntity, FreshHyperEntity, FreshJob, FreshTranslationBase, type HealthCheckResult, HttpStatus, type IsDecimalOptions, LanguageCode, Manufacturer, type Maybe, type PaginatedList, type PaginationMeta, type PaginationParams, PaymentMethod, PG_DATA_SOURCE_OPTIONS as PgDataSourceOptions, Product, SinglePromiseWaiter, Singleton, type Status, StatusDto, Subcategory, TO_BINARY_FLAG, TimestampColumn, TransactionType, buildPatch, constructTypeormPagination, createDeferred, FRESH_ESLINT_CONFIG as freshEslintConfig, getPaginationMeta, getPaginationParams, hasOwn, isDecimal, isEnumValue, isFlag01, isMaybe, isNumber, isNumberInRange, isObject, isString, isValidCron, listAll, parsePaginationFromURL, runWithConcurrency, toDecimal };
1320
+ export { AMOUNT_UNIT, ActionCommandCode, ApiError, BadGatewayError, BadRequestError, BaseEntityChangeSubscriber, type BinaryFlag, BusinessWarning, type CardNumber, Category, ConflictError, DEFAULT_PAGINATION_PARAMS, DataHelper, DateUtils, type Deferred, DepotPoolStatus, Device, type EntityChangeEvent, ExpectationFailedError, FailedDependencyError, ForbiddenError, FreshDao, FreshEntity, FreshError, type FreshErrorOptions, FreshHyperEntity, FreshJob, FreshTranslationBase, GatewayTimeoutError, GoneError, type HealthCheckResult, HttpStatus, HttpVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, type IsDecimalOptions, LanguageCode, LengthRequiredError, LockedError, LoopDetectedError, Manufacturer, type Maybe, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, type PaginatedList, type PaginationMeta, type PaginationParams, PayloadTooLargeError, PaymentMethod, PaymentRequiredError, PG_DATA_SOURCE_OPTIONS as PgDataSourceOptions, PreconditionFailedError, PreconditionRequiredError, Product, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, SinglePromiseWaiter, Singleton, type Status, StatusDto, Subcategory, TO_BINARY_FLAG, TimestampColumn, TooEarlyError, TooManyRequestsError, TransactionType, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, UriTooLongError, VariantAlsoNegotiatesError, buildPatch, constructTypeormPagination, createDeferred, FRESH_ESLINT_CONFIG as freshEslintConfig, getPaginationMeta, getPaginationParams, hasOwn, isDecimal, isEnumValue, isFlag01, isMaybe, isNumber, isNumberInRange, isObject, isString, isValidCron, listAll, parsePaginationFromURL, resolvePathParameterId, runWithConcurrency, toDecimal };