@ti-engine/core 1.8.1 → 1.9.0

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/components/auditing.js +2 -4
  3. package/components/definitions.types.js +19 -4
  4. package/components/exchange/default/default-message-exchange.js +2 -0
  5. package/components/exchange/default/default-message-receiver.js +2 -0
  6. package/components/exchange/default/default-message-sender.js +2 -0
  7. package/components/exchange/message-dispatcher.js +4 -0
  8. package/components/exchange/message-exchange.js +4 -0
  9. package/components/exchange/message-handler.js +7 -5
  10. package/components/exchange/message-memory-cache.js +3 -0
  11. package/components/exchange/message-observer.js +2 -0
  12. package/components/exchange/message-receiver.js +2 -1
  13. package/components/exchange/message-sender.js +2 -2
  14. package/components/exchange/message-tracer.js +2 -3
  15. package/components/service-caller.js +2 -5
  16. package/components/service-consumer.js +2 -0
  17. package/components/service-executor.js +3 -5
  18. package/components/service-instance.js +2 -4
  19. package/components/service-provider.js +3 -0
  20. package/integrations/redis-integration.js +1 -5
  21. package/package.json +152 -36
  22. package/types/bin/start-instance.d.ts +1 -0
  23. package/types/components/auditing.d.ts +30 -0
  24. package/types/components/connection-observer.d.ts +49 -0
  25. package/types/components/definitions.types.d.ts +443 -0
  26. package/types/components/exchange/default/default-message-exchange.d.ts +61 -0
  27. package/types/components/exchange/default/default-message-receiver.d.ts +49 -0
  28. package/types/components/exchange/default/default-message-sender.d.ts +50 -0
  29. package/types/components/exchange/message-dispatcher.d.ts +77 -0
  30. package/types/components/exchange/message-exchange.d.ts +306 -0
  31. package/types/components/exchange/message-handler.d.ts +132 -0
  32. package/types/components/exchange/message-memory-cache.d.ts +84 -0
  33. package/types/components/exchange/message-observer.d.ts +87 -0
  34. package/types/components/exchange/message-receiver.d.ts +91 -0
  35. package/types/components/exchange/message-sender.d.ts +68 -0
  36. package/types/components/exchange/message-tracer.d.ts +84 -0
  37. package/types/components/service-caller.d.ts +68 -0
  38. package/types/components/service-consumer.d.ts +81 -0
  39. package/types/components/service-executor.d.ts +101 -0
  40. package/types/components/service-instance.d.ts +111 -0
  41. package/types/components/service-provider.d.ts +120 -0
  42. package/types/integrations/redis-integration.d.ts +223 -0
  43. package/types/utils/cache.d.ts +320 -0
  44. package/types/utils/config.d.ts +40 -0
  45. package/types/utils/exceptions.d.ts +224 -0
  46. package/types/utils/localization.d.ts +194 -0
  47. package/types/utils/logger.d.ts +24 -0
  48. package/types/utils/tools.d.ts +70 -0
  49. package/utils/cache.js +0 -1
  50. package/utils/exceptions.js +2 -0
  51. package/utils/localization.js +2 -0
  52. package/utils/logger.js +2 -0
  53. package/utils/tools.js +10 -8
@@ -0,0 +1,224 @@
1
+ export { exceptionCodeEnum as exceptionCode };
2
+ export { httpCodeEnum as httpCode };
3
+ export { TiException };
4
+ export declare var raise: (source: any, data: any, exceptionID?: undefined, httpCode?: undefined) => TiException;
5
+ export declare var isException: (object: any) => boolean;
6
+ export type TiExceptionCode = number;
7
+ /**
8
+ * Enum for listing all system-recognized exceptions.
9
+ *
10
+ * @readonly
11
+ * @enum {number}
12
+ * @typedef {number} TiExceptionCode
13
+ */
14
+ declare const exceptionCodeEnum: import("../components/definitions.types").TiEnumOf<{
15
+ E_UNKNOWN_ERROR: (string | number)[];
16
+ /** General exceptions - codes under 1xxx */
17
+ E_GEN_JS_INTERNAL_ERROR: (string | number)[];
18
+ E_GEN_ABSTRACT_CLASS_INIT: (string | number)[];
19
+ E_GEN_ABSTRACT_METHOD_CALL: (string | number)[];
20
+ E_GEN_INVALID_SERVICE_DOMAIN_NAME: (string | number)[];
21
+ E_GEN_SYSTEM_CACHE_UNAVAILABLE: (string | number)[];
22
+ E_GEN_BAD_SERVICE_HANDLER: (string | number)[];
23
+ E_GEN_FEATURE_UNSUPPORTED: (string | number)[];
24
+ E_GEN_INVALID_ARGUMENT_TYPE: (string | number)[];
25
+ E_GEN_NOT_INITIALIZED: (string | number)[];
26
+ E_GEN_UNALLOWED_OVERRIDE: (string | number)[];
27
+ E_GEN_NOT_IMPLEMENTED: (string | number)[];
28
+ /** Security & Administration exceptions - codes under 2xxx */
29
+ E_SEC_INVALID_AUTH_TOKEN: (string | number)[];
30
+ E_SEC_INVALID_EXPIRED_SESSION: (string | number)[];
31
+ E_SEC_UNAUTHORIZED_ACCESS: (string | number)[];
32
+ E_SEC_MESSAGE_TAMPERING_DETECTED: (string | number)[];
33
+ E_SEC_UNRECOGNIZED_AUTH_METHOD: (string | number)[];
34
+ /** Cross-Application Communication exceptions - codes under 3xxx */
35
+ E_COM_GENERAL_ERROR: (string | number)[];
36
+ E_COM_MESSAGE_SENDER_UNAVAILABLE: (string | number)[];
37
+ E_COM_SERVICE_EXEC_TIMEOUT: (string | number)[];
38
+ E_COM_SERVICE_NOT_REGISTERED: (string | number)[];
39
+ E_COM_SERVICE_NOT_FOUND: (string | number)[];
40
+ E_COM_SERVICE_HANDLER_NOT_FOUND: (string | number)[];
41
+ E_COM_MESSAGE_RECEIVER_UNAVAILABLE: (string | number)[];
42
+ E_COM_MESSAGE_EXCHANGE_BROKEN: (string | number)[];
43
+ E_COM_SERVICE_EXEC_FAILED: (string | number)[];
44
+ E_COM_RETRY_ATTEMPTS_EXCEEDED: (string | number)[];
45
+ /** Web server exceptions - codes under 4xxx */
46
+ E_WEB_INVALID_REQUEST_METHOD: (string | number)[];
47
+ E_WEB_INVALID_REQUEST_URI: (string | number)[];
48
+ E_WEB_INVALID_REQUEST_BODY: (string | number)[];
49
+ E_WEB_INVALID_REQUEST_QUERY: (string | number)[];
50
+ E_WEB_INVALID_REQUEST_HEADERS: (string | number)[];
51
+ E_WEB_INVALID_REQUEST_PARAMETERS: (string | number)[];
52
+ E_WEB_INVALID_REQUEST_FORMAT: (string | number)[];
53
+ E_WEB_INVALID_REQUEST_CONTENT_TYPE: (string | number)[];
54
+ E_WEB_INVALID_REQUEST_CONTENT_LENGTH: (string | number)[];
55
+ E_WEB_INVALID_REQUEST_CONTENT_ENCODING: (string | number)[];
56
+ /** Application exceptions - codes under 5xxx */
57
+ E_APP_RESOURCE_NOT_FOUND: (string | number)[];
58
+ E_APP_SERVICE_ERROR: (string | number)[];
59
+ E_APP_RESOURCE_ALREADY_EXISTS: (string | number)[];
60
+ }>;
61
+ export type TiHttpCode = number;
62
+ /**
63
+ * Enum for listing all HTTP codes.
64
+ *
65
+ * @readonly
66
+ * @enum {number}
67
+ * @typedef {number} TiHttpCode
68
+ */
69
+ declare const httpCodeEnum: import("../components/definitions.types").TiEnumOf<{
70
+ /** 1xx informational response */
71
+ C_100: (string | number)[];
72
+ C_101: (string | number)[];
73
+ C_102: (string | number)[];
74
+ C_103: (string | number)[];
75
+ /** 2xx success */
76
+ C_200: (string | number)[];
77
+ C_201: (string | number)[];
78
+ C_202: (string | number)[];
79
+ C_203: (string | number)[];
80
+ C_204: (string | number)[];
81
+ C_205: (string | number)[];
82
+ C_206: (string | number)[];
83
+ C_207: (string | number)[];
84
+ C_208: (string | number)[];
85
+ C_226: (string | number)[];
86
+ /** 3xx redirection */
87
+ C_300: (string | number)[];
88
+ C_301: (string | number)[];
89
+ C_302: (string | number)[];
90
+ C_303: (string | number)[];
91
+ C_304: (string | number)[];
92
+ C_307: (string | number)[];
93
+ C_308: (string | number)[];
94
+ /** 4xx client errors */
95
+ C_400: (string | number)[];
96
+ C_401: (string | number)[];
97
+ C_403: (string | number)[];
98
+ C_404: (string | number)[];
99
+ C_405: (string | number)[];
100
+ C_406: (string | number)[];
101
+ C_407: (string | number)[];
102
+ C_408: (string | number)[];
103
+ C_409: (string | number)[];
104
+ C_410: (string | number)[];
105
+ C_411: (string | number)[];
106
+ C_412: (string | number)[];
107
+ C_413: (string | number)[];
108
+ C_414: (string | number)[];
109
+ C_415: (string | number)[];
110
+ C_416: (string | number)[];
111
+ C_417: (string | number)[];
112
+ C_421: (string | number)[];
113
+ C_422: (string | number)[];
114
+ C_423: (string | number)[];
115
+ C_424: (string | number)[];
116
+ C_425: (string | number)[];
117
+ C_426: (string | number)[];
118
+ C_428: (string | number)[];
119
+ C_429: (string | number)[];
120
+ C_431: (string | number)[];
121
+ C_451: (string | number)[];
122
+ /** 5xx server errors */
123
+ C_500: (string | number)[];
124
+ C_501: (string | number)[];
125
+ C_502: (string | number)[];
126
+ C_503: (string | number)[];
127
+ C_504: (string | number)[];
128
+ C_505: (string | number)[];
129
+ C_506: (string | number)[];
130
+ C_507: (string | number)[];
131
+ C_508: (string | number)[];
132
+ C_510: (string | number)[];
133
+ C_511: (string | number)[];
134
+ }>;
135
+ /**
136
+ * Represents an any-purpose exception.
137
+ *
138
+ * @class TiException
139
+ * @public
140
+ */
141
+ declare class TiException {
142
+ #private;
143
+ /**
144
+ * @constructor
145
+ * @param {string} id The unique ID to be assigned to this exception.
146
+ * @param {TiExceptionCode} exceptionCode An unique exception identifier. If this is not recognized, the default error code will be used instead.
147
+ * @param {Object} [data={}] Any additional data to insert into the exception.
148
+ * @param {string} [description=undefined] Description of the exception.
149
+ */
150
+ constructor(id: string, exceptionCode: TiExceptionCode, data?: Object, description?: string);
151
+ /**
152
+ * Unique identifier of the exception instance. Can be used for tracing problems with customer support cases.
153
+ *
154
+ * @property
155
+ * @returns {string}
156
+ * @public
157
+ */
158
+ get id(): string;
159
+ /**
160
+ * Identifier code of the exception type.
161
+ *
162
+ * @property
163
+ * @returns {TiExceptionCode}
164
+ * @public
165
+ */
166
+ get code(): TiExceptionCode;
167
+ /**
168
+ * HTTP error code if relevant.
169
+ *
170
+ * @property
171
+ * @returns {TiHttpCode}
172
+ * @public
173
+ */
174
+ get httpCode(): TiHttpCode;
175
+ /**
176
+ * HTTP error code if relevant.
177
+ *
178
+ * @property
179
+ * @param {TiHttpCode} httpCode
180
+ * @public
181
+ */
182
+ set httpCode(httpCode: TiHttpCode);
183
+ /**
184
+ * Localized label identifier.
185
+ *
186
+ * @property
187
+ * @returns {string}
188
+ * @public
189
+ */
190
+ get label(): string;
191
+ /**
192
+ * Description or additional technical information that is NOT localized.
193
+ *
194
+ * @property
195
+ * @returns {string}
196
+ * @public
197
+ */
198
+ get description(): string;
199
+ /**
200
+ * JSON containing any additional data that has relevance for the exception. Can be converted JavaScript {@link Error} object as well.
201
+ *
202
+ * @property
203
+ * @returns {Object}
204
+ * @public
205
+ */
206
+ get data(): Object;
207
+ /**
208
+ * JSON containing any additional data that has relevance for the exception. Can be converted JavaScript {@link Error} object as well.
209
+ *
210
+ * @property
211
+ * @param {Object} data
212
+ * @public
213
+ */
214
+ set data(data: Object);
215
+ /**
216
+ * Extracts the essential information about the {@link TiException} and returns it as JSON.
217
+ *
218
+ * @method
219
+ * @param {boolean} [includeData=true] Whether to include the data property in the output.
220
+ * @returns {Object}
221
+ * @public
222
+ */
223
+ asJSON(includeData?: boolean): Object;
224
+ }
@@ -0,0 +1,194 @@
1
+ export { localizationLanguageEnum as localizationLanguage };
2
+ export declare var getLabel: (label: string, language?: TiLocalizationLanguage) => string;
3
+ export declare var getAllLabels: (language?: TiLocalizationLanguage) => TiLabelsTree;
4
+ export type TiLocalizationLanguage = string;
5
+ /**
6
+ * Enum for defining a localization language based on the ISO 639-1 language code.
7
+ *
8
+ * @readonly
9
+ * @enum {string}
10
+ * @typedef {string} TiLocalizationLanguage
11
+ */
12
+ declare const localizationLanguageEnum: import("#definitions").TiEnumOf<{
13
+ ABKHAZIAN: string[];
14
+ AFAR: string[];
15
+ AFRIKAANS: string[];
16
+ AKAN: string[];
17
+ ALBANIAN: string[];
18
+ AMHARIC: string[];
19
+ ARABIC: string[];
20
+ ARAGONESE: string[];
21
+ ARMENIAN: string[];
22
+ ASSAMESE: string[];
23
+ AVARIC: string[];
24
+ AVESTAN: string[];
25
+ AYMARA: string[];
26
+ AZERBAIJANI: string[];
27
+ BAMBARA: string[];
28
+ BASHKIR: string[];
29
+ BASQUE: string[];
30
+ BELARUSIAN: string[];
31
+ BENGALI: string[];
32
+ BIHARI_LANGUAGES: string[];
33
+ BISLAMA: string[];
34
+ BOSNIAN: string[];
35
+ BRETON: string[];
36
+ BULGARIAN: string[];
37
+ BURMESE: string[];
38
+ CATALAN: string[];
39
+ CENTRAL_KHMER: string[];
40
+ CHAMORRO: string[];
41
+ CHECHEN: string[];
42
+ CHICHEWA: string[];
43
+ CHINESE: string[];
44
+ CHURCH_SLAVIC: string[];
45
+ CHUVASH: string[];
46
+ CORNISH: string[];
47
+ CORSICAN: string[];
48
+ CREE: string[];
49
+ CROATIAN: string[];
50
+ CZECH: string[];
51
+ DANISH: string[];
52
+ DIVEHI: string[];
53
+ DUTCH: string[];
54
+ DZONGKHA: string[];
55
+ ENGLISH: string[];
56
+ ESPERANTO: string[];
57
+ ESTONIAN: string[];
58
+ EWE: string[];
59
+ FAROESE: string[];
60
+ FIJIAN: string[];
61
+ FINNISH: string[];
62
+ FRENCH: string[];
63
+ FULAH: string[];
64
+ FRISIAN_WESTERN: string[];
65
+ GAELIC_SCOTTISH: string[];
66
+ GALICIAN: string[];
67
+ GANDA: string[];
68
+ GEORGIAN: string[];
69
+ GERMAN: string[];
70
+ GREEK_MODERN: string[];
71
+ GUARANI: string[];
72
+ GUJARATI: string[];
73
+ HAITIAN: string[];
74
+ HAUSA: string[];
75
+ HEBREW: string[];
76
+ HERERO: string[];
77
+ HINDI: string[];
78
+ HIRI_MOTU: string[];
79
+ HUNGARIAN: string[];
80
+ ICELANDIC: string[];
81
+ IDO: string[];
82
+ IGBO: string[];
83
+ INTERLINGUA: string[];
84
+ INTERLINGUE: string[];
85
+ INDONESIAN: string[];
86
+ INUKTITUT: string[];
87
+ INUPIAQ: string[];
88
+ IRISH: string[];
89
+ ITALIAN: string[];
90
+ JAPANESE: string[];
91
+ JAVANESE: string[];
92
+ KALAALLISUT: string[];
93
+ KANNADA: string[];
94
+ KASHMIRI: string[];
95
+ KAZAKH: string[];
96
+ KIKUYU: string[];
97
+ KINYARWANDA: string[];
98
+ KIRGHIZ: string[];
99
+ KOMI: string[];
100
+ KONGO: string[];
101
+ KOREAN: string[];
102
+ KUANYAMA: string[];
103
+ KURDISH: string[];
104
+ LAO: string[];
105
+ LATIN: string[];
106
+ LATVIAN: string[];
107
+ LIMBURGAN: string[];
108
+ LINGALA: string[];
109
+ LITHUANIAN: string[];
110
+ LUBA_KATANGA: string[];
111
+ LUXEMBOURGISH: string[];
112
+ MACEDONIAN: string[];
113
+ MALAGASY: string[];
114
+ MALAY: string[];
115
+ MALAYALAM: string[];
116
+ MALTESE: string[];
117
+ MANX: string[];
118
+ MAORI: string[];
119
+ MARATHI: string[];
120
+ MARSHALLESE: string[];
121
+ MONGOLIAN: string[];
122
+ NAURU: string[];
123
+ NAVAJO: string[];
124
+ NDEBELE_NORTH: string[];
125
+ NDEBELE_SOUTH: string[];
126
+ NDONGA: string[];
127
+ NEPALI: string[];
128
+ NORTHERN_SAMI: string[];
129
+ NORWEGIAN: string[];
130
+ NORWEGIAN_BOKMAL: string[];
131
+ NORWEGIAN_NYNORSK: string[];
132
+ OCCITAN: string[];
133
+ OJIBWA: string[];
134
+ ORIYA: string[];
135
+ OROMO: string[];
136
+ OSSETIAN: string[];
137
+ PANJABI: string[];
138
+ PALI: string[];
139
+ PASHTO: string[];
140
+ POLISH: string[];
141
+ PORTUGUESE: string[];
142
+ QUECHUA: string[];
143
+ ROMANIAN: string[];
144
+ ROMANSH: string[];
145
+ RUNDI: string[];
146
+ RUSSIAN: string[];
147
+ SANGO: string[];
148
+ SANSKRIT: string[];
149
+ SARDINIAN: string[];
150
+ SERBIAN: string[];
151
+ SHONA: string[];
152
+ SINDHI: string[];
153
+ SINHALA: string[];
154
+ SLOVAK: string[];
155
+ SLOVENIAN: string[];
156
+ SOMALI: string[];
157
+ SOTHO_SOUTHERN: string[];
158
+ SPANISH: string[];
159
+ SUNDANESE: string[];
160
+ SWAHILI: string[];
161
+ SWATI: string[];
162
+ SWEDISH: string[];
163
+ TAGALOG: string[];
164
+ TAHITIAN: string[];
165
+ TAJIK: string[];
166
+ TAMIL: string[];
167
+ TATAR: string[];
168
+ TELUGU: string[];
169
+ THAI: string[];
170
+ TIBETAN: string[];
171
+ TIGRINYA: string[];
172
+ TONGA: string[];
173
+ TSONGA: string[];
174
+ TSWANA: string[];
175
+ TURKISH: string[];
176
+ TURKMEN: string[];
177
+ TWI: string[];
178
+ UIGHUR: string[];
179
+ UKRAINIAN: string[];
180
+ URDU: string[];
181
+ UZBEK: string[];
182
+ VENDA: string[];
183
+ VIETNAMESE: string[];
184
+ VOLAPUK: string[];
185
+ WALLON: string[];
186
+ WELSH: string[];
187
+ WOLOF: string[];
188
+ XHOSA: string[];
189
+ YIDDISH: string[];
190
+ YORUBA: string[];
191
+ ZHUANG: string[];
192
+ ZULU: string[];
193
+ }>;
194
+ import type { TiLabelsTree } from "#definitions";
@@ -0,0 +1,24 @@
1
+ export { logSeverityEnum as logSeverity };
2
+ export declare var getSeverityName: (severity: TiLogSeverity) => string;
3
+ export declare var log: (message: string, level?: TiLogSeverity, data?: Object | Error | TiException, thread?: string) => void;
4
+ import type { TiException } from "#exceptions";
5
+ export type TiLogSeverity = number;
6
+ /** @import { TiException } from "#exceptions" */
7
+ /**
8
+ * Enum for specifying the log entry severity. This is based on the Google Stackdriver severity levels.
9
+ *
10
+ * @readonly
11
+ * @enum {number}
12
+ * @typedef {number} TiLogSeverity
13
+ */
14
+ declare const logSeverityEnum: import("../components/definitions.types").TiEnumOf<{
15
+ DEFAULT: (string | number)[];
16
+ DEBUG: (string | number)[];
17
+ INFO: (string | number)[];
18
+ NOTICE: (string | number)[];
19
+ WARNING: (string | number)[];
20
+ ERROR: (string | number)[];
21
+ CRITICAL: (string | number)[];
22
+ ALERT: (string | number)[];
23
+ EMERGENCY: (string | number)[];
24
+ }>;
@@ -0,0 +1,70 @@
1
+ export declare var getUUID: () => string;
2
+ export declare var deepFreeze: (object: Object, seen?: WeakSet<any>) => Object;
3
+ export { createEnum as enum };
4
+ export declare var getEnumName: (enumList: TiEnum, enumValue: number | string, placeholder?: string) => string | undefined;
5
+ export declare var errorToJSON: (value: Error) => Object;
6
+ export declare var toBool: (value: any) => boolean;
7
+ export declare var arrayUniques: (array: any[]) => any[];
8
+ export declare var getUTCDateString: (date: Date) => string;
9
+ export declare var getUTCTimeString: (date: Date, useMilliseconds?: boolean) => string;
10
+ export declare var decycle: (object: Object, replacer?: (value: Object) => Object) => Object;
11
+ export declare var retrocycle: ($: Object) => Object;
12
+ export declare var stringifyJSON: (value: Object) => string | any;
13
+ export declare var isJsonString: (string: string) => boolean;
14
+ export declare var parseJSON: (value: string) => Object | string;
15
+ export declare var decomposeJSON: (input: Object) => string | null;
16
+ export declare var constantTimeEquals: (a: any, b: any) => boolean;
17
+ export { RetryPolicy };
18
+ import type { TiEnum, TiEnumOf } from "#definitions";
19
+ /**
20
+ * Used to create a custom Enum list.
21
+ *
22
+ * @method
23
+ * @template {Record<string,*>} T
24
+ * @param {T} seed
25
+ * @returns {TiEnumOf<T>}
26
+ * @public
27
+ */
28
+ declare const createEnum: <T extends Record<string, any>>(seed: T) => TiEnumOf<T>;
29
+ /**
30
+ * Used to create retry policy for the execution of an operation.
31
+ *
32
+ * @class RetryPolicy
33
+ * @public
34
+ */
35
+ declare class RetryPolicy {
36
+ #private;
37
+ /**
38
+ * @constructor
39
+ * @param {number} maxAttempts The maximum number of attempts to execute the operation.
40
+ * @throws {TypeError} maxAttempts must be a positive integer.
41
+ */
42
+ constructor(maxAttempts: number);
43
+ /**
44
+ * Used to start execution of the provided operation.
45
+ *
46
+ * @method
47
+ * @param {Object} context The context in which the operation will be executed (i.e., this reference).
48
+ * @param {(...args: *[]) => Promise<*>} operation Operation to be executed; must return a Promise.
49
+ * @param {Array<*>} [params=[]] The arguments to be provided to the operation upon execution.
50
+ * @returns {Promise}
51
+ * @public
52
+ */
53
+ execute(context: Object, operation: (...args: any[]) => Promise<any>, params?: Array<any>): Promise<any>;
54
+ /**
55
+ * Used to register a method that will be automatically called on a failed execution attempt.
56
+ *
57
+ * @method
58
+ * @param {(error: Error) => void} action The execution error will be provided as an argument.
59
+ * @public
60
+ */
61
+ onFailedAttempt(action: (error: Error) => void): void;
62
+ /**
63
+ * Used to register a method that will be automatically called on each execution retry (after the initial one).
64
+ *
65
+ * @method
66
+ * @param {(attempt: number, lastError: Error|undefined) => void} action The current attempt and last error are provided.
67
+ * @public
68
+ */
69
+ onRetry(action: (attempt: number, lastError: Error | undefined) => void): void;
70
+ }
package/utils/cache.js CHANGED
@@ -758,7 +758,6 @@ class CommonMemoryCache extends ConnectionObserver {
758
758
  * @method
759
759
  * @param {string|string[]} path
760
760
  * @returns {string}
761
- * @private
762
761
  */
763
762
  #normalizeJSONPath( path ) {
764
763
  if ( Array.isArray( path ) ) {
@@ -307,6 +307,8 @@ class TiException {
307
307
  * @returns {TiException}
308
308
  * @public
309
309
  */
310
+ module.exports.TiException = TiException;
311
+
310
312
  module.exports.raise = ( source, data, exceptionID = undefined, httpCode = undefined ) => {
311
313
  /** @type TiException */
312
314
  let exception;
@@ -233,6 +233,8 @@ module.exports.localizationLanguage = localizationLanguageEnum;
233
233
  /** @type {TiLabelsTree} */
234
234
  const labels = require( "#labels" );
235
235
 
236
+ /** @import { TiLabelsTree } from "#definitions" */
237
+
236
238
  // Load any custom labels defined in the configuration:
237
239
  const labelsPaths = config.getSetting( config.setting.LOCALIZATION_LABELS_PATH );
238
240
  if ( labelsPaths && _.isArray( labelsPaths ) && labelsPaths.length > 0 ) {
package/utils/logger.js CHANGED
@@ -11,6 +11,8 @@ const tools = require( "#tools" );
11
11
  const exceptions = require( "#exceptions" );
12
12
  const localization = require( "#localization" );
13
13
 
14
+ /** @import { TiException } from "#exceptions" */
15
+
14
16
  /**
15
17
  * Enum for specifying the log entry severity. This is based on the Google Stackdriver severity levels.
16
18
  *
package/utils/tools.js CHANGED
@@ -9,6 +9,8 @@
9
9
  const _ = require( "lodash" );
10
10
  const crypto = require( "node:crypto" );
11
11
 
12
+ /** @import { TiEnum, TiEnumOf } from "#definitions" */
13
+
12
14
  /**
13
15
  * Used to generate and return new UUID.
14
16
  *
@@ -45,8 +47,9 @@ module.exports.deepFreeze = ( object, seen = new WeakSet() ) => {
45
47
  * Used to create a custom Enum list.
46
48
  *
47
49
  * @method
48
- * @param {Object} seed
49
- * @returns {Object} This is a {@link TiEnum} object. Setting the proper reference here would unfortunately break IDE support.
50
+ * @template {Record<string,*>} T
51
+ * @param {T} seed
52
+ * @returns {TiEnumOf<T>}
50
53
  * @public
51
54
  */
52
55
  // Declared as a named constant and exported below rather than assigned straight onto `module.exports`:
@@ -285,7 +288,7 @@ module.exports.getUTCTimeString = ( date, useMilliseconds = false ) => {
285
288
  *
286
289
  * @method
287
290
  * @param {Object} object
288
- * @param {function( Object ): Object} [replacer]
291
+ * @param {(value: Object) => Object} [replacer]
289
292
  * @returns {Object}
290
293
  * @public
291
294
  */
@@ -555,7 +558,7 @@ class RetryPolicy {
555
558
  *
556
559
  * @method
557
560
  * @param {Object} context The context in which the operation will be executed (i.e., this reference).
558
- * @param {function( ...* ): Promise<*>} operation Operation to be executed; must return a Promise.
561
+ * @param {(...args: *[]) => Promise<*>} operation Operation to be executed; must return a Promise.
559
562
  * @param {Array<*>} [params=[]] The arguments to be provided to the operation upon execution.
560
563
  * @returns {Promise}
561
564
  * @public
@@ -568,7 +571,7 @@ class RetryPolicy {
568
571
  * Used to register a method that will be automatically called on a failed execution attempt.
569
572
  *
570
573
  * @method
571
- * @param {function( Error )} action The execution error will be provided as an argument.
574
+ * @param {(error: Error) => void} action The execution error will be provided as an argument.
572
575
  * @public
573
576
  */
574
577
  onFailedAttempt( action ) {
@@ -581,7 +584,7 @@ class RetryPolicy {
581
584
  * Used to register a method that will be automatically called on each execution retry (after the initial one).
582
585
  *
583
586
  * @method
584
- * @param {function( number, (Error|undefined) )} action The current attempt and last error are provided.
587
+ * @param {(attempt: number, lastError: Error|undefined) => void} action The current attempt and last error are provided.
585
588
  * @public
586
589
  */
587
590
  onRetry( action ) {
@@ -597,12 +600,11 @@ class RetryPolicy {
597
600
  *
598
601
  * @method
599
602
  * @param {Object} context
600
- * @param {function( ...* ): Promise<*>} operation Operation to be executed; must return a Promise.
603
+ * @param {(...args: *[]) => Promise<*>} operation Operation to be executed; must return a Promise.
601
604
  * @param {Array<*>} params The arguments to be provided to the operation upon execution.
602
605
  * @param {number} attempt
603
606
  * @param {Error} error
604
607
  * @returns {Promise}
605
- * @private
606
608
  */
607
609
  #retry( context, operation, params, attempt, error ) {
608
610
  if ( attempt > this.#maxAttempts ) {