@xeno-js/shared 2.0.1 → 3.0.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.
- package/README.md +675 -678
- package/dist/axios.cjs +2230 -0
- package/dist/axios.cjs.map +1 -0
- package/dist/axios.d.cts +19 -0
- package/dist/axios.d.ts +19 -0
- package/dist/axios.js +2203 -0
- package/dist/axios.js.map +1 -0
- package/dist/common.types-DT8JtZ0E.d.cts +214 -0
- package/dist/common.types-DT8JtZ0E.d.ts +214 -0
- package/dist/iauth-service.contracts-DotziBbm.d.ts +230 -0
- package/dist/iauth-service.contracts-DyFYvLdb.d.cts +230 -0
- package/dist/ihttp-client.contracts-DX2hDTW6.d.ts +299 -0
- package/dist/ihttp-client.contracts-KMkYuIHH.d.cts +299 -0
- package/dist/index.cjs +2 -348
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +973 -2295
- package/dist/index.d.ts +973 -2295
- package/dist/index.js +1 -341
- package/dist/index.js.map +1 -1
- package/dist/ivalidator-service.contracts-DGMounqU.d.cts +102 -0
- package/dist/ivalidator-service.contracts-ulue7FGh.d.ts +102 -0
- package/dist/result.types-BNTzjCgR.d.cts +381 -0
- package/dist/result.types-DRyxvpQs.d.ts +381 -0
- package/dist/supabase.cjs +2431 -0
- package/dist/supabase.cjs.map +1 -0
- package/dist/supabase.d.cts +53 -0
- package/dist/supabase.d.ts +53 -0
- package/dist/supabase.js +2402 -0
- package/dist/supabase.js.map +1 -0
- package/dist/zod.cjs +2372 -0
- package/dist/zod.cjs.map +1 -0
- package/dist/zod.d.cts +63 -0
- package/dist/zod.d.ts +63 -0
- package/dist/zod.js +2344 -0
- package/dist/zod.js.map +1 -0
- package/package.json +17 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
1
|
+
import { D as Dictionary, O as Optional, G as Guid, M as Maybe, F as Factory } from './common.types-DT8JtZ0E.js';
|
|
2
|
+
export { A as AbstractConstructor, a as AsyncFactory, b as AsyncResolver, C as Constructor, K as KeysOfType, N as Nullable, c as Override, R as RequireKeys, d as Resolver, S as SetupAction } from './common.types-DT8JtZ0E.js';
|
|
3
|
+
import { c as HttpHeaders, C as CookieOptions, E as ExtendedRequest, d as HttpBaseRequest } from './ihttp-client.contracts-DX2hDTW6.js';
|
|
4
|
+
export { e as HttpMethod, a as HttpOptions, f as HttpQueryValue, H as HttpRequest, b as HttpResponse, g as HttpResponseType, I as IHttpClient } from './ihttp-client.contracts-DX2hDTW6.js';
|
|
5
|
+
import { I as ILogger } from './ivalidator-service.contracts-ulue7FGh.js';
|
|
6
|
+
export { a as IValidatorService } from './ivalidator-service.contracts-ulue7FGh.js';
|
|
7
|
+
import { R as ResultType } from './result.types-DRyxvpQs.js';
|
|
8
|
+
export { A as AppError, a as Result } from './result.types-DRyxvpQs.js';
|
|
9
|
+
import { U as UserContext } from './iauth-service.contracts-DotziBbm.js';
|
|
10
|
+
export { A as AuthClaims, I as IAuthService, a as IBaseAuthService, b as IBaseMapper, c as IExtendendAuthService, P as Provider, S as Session } from './iauth-service.contracts-DotziBbm.js';
|
|
4
11
|
|
|
5
12
|
/**
|
|
6
13
|
* @description DomainEvent is an interface that represents a domain event in the application. It defines the structure and properties of a domain event, which is a message that is published when a significant change
|
|
@@ -1071,251 +1078,12 @@ declare const TOKENS: Readonly<{
|
|
|
1071
1078
|
}>;
|
|
1072
1079
|
|
|
1073
1080
|
/**
|
|
1074
|
-
* @description
|
|
1075
|
-
* Prefer this over `T | null` in all public APIs so intent is self-documenting.
|
|
1076
|
-
|
|
1077
|
-
*
|
|
1078
|
-
* @author Xeno
|
|
1079
|
-
* @version 1.0.0
|
|
1080
|
-
* @since 2025-09-30
|
|
1081
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1082
|
-
*/
|
|
1083
|
-
type Nullable<T> = T | null;
|
|
1084
|
-
/**
|
|
1085
|
-
* @description Represents a value that may be `undefined`.
|
|
1086
|
-
* Prefer this over `T | undefined` in all public APIs.
|
|
1087
|
-
|
|
1088
|
-
*
|
|
1089
|
-
* @author Xeno
|
|
1090
|
-
* @version 1.0.0
|
|
1091
|
-
* @since 2025-09-30
|
|
1092
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1093
|
-
*/
|
|
1094
|
-
type Optional<T> = T | undefined;
|
|
1095
|
-
/**
|
|
1096
|
-
* @description Represents a value that may be either `null` or `undefined`.
|
|
1097
|
-
* Use when a value is absent regardless of the reason.
|
|
1098
|
-
|
|
1099
|
-
*
|
|
1100
|
-
* @author Xeno
|
|
1101
|
-
* @version 1.0.0
|
|
1102
|
-
* @since 2025-09-30
|
|
1103
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1104
|
-
*/
|
|
1105
|
-
type Maybe<T> = T | null | undefined;
|
|
1106
|
-
/**
|
|
1107
|
-
* @description Represents a concrete (instantiable) class.
|
|
1108
|
-
* Used by IoC containers and auto-wiring utilities to bind concrete implementations.
|
|
1109
|
-
*
|
|
1110
|
-
* @template T The instance type produced by `new`.
|
|
1111
|
-
* @template TArgs Constructor parameter tuple; defaults to `any[]`.
|
|
1112
|
-
|
|
1113
|
-
*
|
|
1114
|
-
* @author Xeno
|
|
1115
|
-
* @version 1.0.0
|
|
1116
|
-
* @since 2025-09-30
|
|
1117
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1118
|
-
*/
|
|
1119
|
-
type Constructor<T, TArgs extends Dictionary[] = Dictionary[]> = new (...args: TArgs) => T;
|
|
1120
|
-
/**
|
|
1121
|
-
* @description Represents an abstract class that cannot be instantiated directly.
|
|
1122
|
-
* Used for binding abstract base classes in the IoC container without requiring
|
|
1123
|
-
* a concrete constructor signature.
|
|
1124
|
-
*
|
|
1125
|
-
* @template T The instance type produced by subclasses.
|
|
1126
|
-
|
|
1127
|
-
*
|
|
1128
|
-
* @author Xeno
|
|
1129
|
-
* @version 1.0.0
|
|
1130
|
-
* @since 2025-09-30
|
|
1131
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1132
|
-
*/
|
|
1133
|
-
type AbstractConstructor<T> = abstract new (...args: Dictionary[]) => T;
|
|
1134
|
-
/**
|
|
1135
|
-
* @description A plain-object dictionary with string keys and uniform value type.
|
|
1136
|
-
* Prefer over `{ [key: string]: V }` for self-documenting intent.
|
|
1137
|
-
|
|
1138
|
-
*
|
|
1139
|
-
* @author Xeno
|
|
1140
|
-
* @version 1.0.0
|
|
1141
|
-
* @since 2025-09-30
|
|
1142
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1143
|
-
*/
|
|
1144
|
-
type Dictionary<V = unknown> = Record<string, V>;
|
|
1145
|
-
/**
|
|
1146
|
-
* @description Produces a new type with only the keys `K` made required;
|
|
1147
|
-
* all other keys retain their original optionality.
|
|
1148
|
-
|
|
1149
|
-
*
|
|
1150
|
-
* @author Xeno
|
|
1151
|
-
* @version 1.0.0
|
|
1152
|
-
* @since 2025-09-30
|
|
1153
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1154
|
-
*/
|
|
1155
|
-
type RequireKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
1156
|
-
/**
|
|
1157
|
-
* @description Produces a new type where property `K` is overridden with type `V`.
|
|
1158
|
-
* Useful for narrowing a property inside a generic base type.
|
|
1159
|
-
|
|
1160
|
-
*
|
|
1161
|
-
* @author Xeno
|
|
1162
|
-
* @version 1.0.0
|
|
1163
|
-
* @since 2025-09-30
|
|
1164
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1165
|
-
*/
|
|
1166
|
-
type Override<T, K extends keyof T, V> = Omit<T, K> & Record<K, V>;
|
|
1167
|
-
/**
|
|
1168
|
-
* @description Extracts only the keys of `T` whose values are assignable to `V`.
|
|
1169
|
-
*
|
|
1170
|
-
* @example
|
|
1171
|
-
* type StringKeys = KeysOfType<{ a: string; b: number; c: string }, string>;
|
|
1172
|
-
* // => 'a' | 'c'
|
|
1173
|
-
|
|
1174
|
-
*
|
|
1175
|
-
* @author Xeno
|
|
1176
|
-
* @version 1.0.0
|
|
1177
|
-
* @since 2025-09-30
|
|
1178
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1179
|
-
*/
|
|
1180
|
-
type KeysOfType<T, V> = {
|
|
1181
|
-
[K in keyof T]: T[K] extends V ? K : never;
|
|
1182
|
-
}[keyof T];
|
|
1183
|
-
/**
|
|
1184
|
-
* @description Generic factory function that produces a value of type `T`.
|
|
1185
|
-
*
|
|
1186
|
-
* `TArgs` defaults to an empty tuple for zero-argument factories, enabling
|
|
1187
|
-
* usage both as a plain provider (`Factory<T>`) and as a parameterised
|
|
1188
|
-
* creator (`Factory<T, [config: MyConfig]>`).
|
|
1189
|
-
*
|
|
1190
|
-
* @template T The type of the value produced.
|
|
1191
|
-
* @template TArgs Tuple of constructor/factory argument types.
|
|
1192
|
-
*
|
|
1193
|
-
* @example
|
|
1194
|
-
* // Zero-argument factory
|
|
1195
|
-
* const makeLogger: Factory<ILoggerService> = () => new ConsoleLogger();
|
|
1196
|
-
*
|
|
1197
|
-
* // Parameterised factory
|
|
1198
|
-
* const makeRepo: Factory<IRepository<Entity>, [tx: Transaction]> =
|
|
1199
|
-
* (tx) => new DrizzleRepository(tx);
|
|
1200
|
-
|
|
1201
|
-
*
|
|
1202
|
-
* @author Xeno
|
|
1203
|
-
* @version 1.0.0
|
|
1204
|
-
* @since 2025-09-30
|
|
1205
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1206
|
-
*/
|
|
1207
|
-
type Factory<T, TArgs extends unknown[] = []> = (...args: TArgs) => T;
|
|
1208
|
-
/**
|
|
1209
|
-
* @description Async variant of `Factory<T, TArgs>`.
|
|
1210
|
-
* Use when the construction process involves I/O (e.g. DB pool acquisition).
|
|
1211
|
-
*
|
|
1212
|
-
* @template T The type of the resolved value.
|
|
1213
|
-
* @template TArgs Tuple of factory argument types.
|
|
1214
|
-
|
|
1215
|
-
*
|
|
1216
|
-
* @author Xeno
|
|
1217
|
-
* @version 1.0.0
|
|
1218
|
-
* @since 2025-09-30
|
|
1219
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1220
|
-
*/
|
|
1221
|
-
type AsyncFactory<T, TArgs extends unknown[] = []> = (...args: TArgs) => Promise<T>;
|
|
1222
|
-
/**
|
|
1223
|
-
* @description Delegate used by application-layer services to perform lazy,
|
|
1224
|
-
* symbol-keyed dependency resolution without coupling to the concrete container.
|
|
1225
|
-
*
|
|
1226
|
-
* This is the **only** sanctioned way to resolve dependencies at runtime outside
|
|
1227
|
-
* of constructor injection. Never inject the raw IoC container into services.
|
|
1228
|
-
*
|
|
1229
|
-
* @template T Narrows the return type at each call site.
|
|
1230
|
-
*
|
|
1231
|
-
* @example
|
|
1232
|
-
* class NexusMediator {
|
|
1233
|
-
* constructor(private readonly resolve: Resolver) {}
|
|
1081
|
+
* @description Standardised paginated response envelope returned by query handlers.
|
|
1234
1082
|
*
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
* command.resolverToken,
|
|
1238
|
-
* );
|
|
1239
|
-
* return handler.execute(command);
|
|
1240
|
-
* }
|
|
1241
|
-
* }
|
|
1242
|
-
|
|
1243
|
-
*
|
|
1244
|
-
* @author Xeno
|
|
1245
|
-
* @version 1.0.0
|
|
1246
|
-
* @since 2025-09-30
|
|
1247
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1248
|
-
*/
|
|
1249
|
-
type Resolver<T = unknown> = (token: symbol) => T;
|
|
1250
|
-
/**
|
|
1251
|
-
* @description Async variant of `Resolver` for containers that resolve
|
|
1252
|
-
* dependencies asynchronously (e.g. lazy module loading, remote config).
|
|
1083
|
+
* Wraps the items array with cursor metadata so callers can navigate pages
|
|
1084
|
+
* without re-computing totals on every request.
|
|
1253
1085
|
*
|
|
1254
|
-
* @template T
|
|
1255
|
-
|
|
1256
|
-
*
|
|
1257
|
-
* @author Xeno
|
|
1258
|
-
* @version 1.0.0
|
|
1259
|
-
* @since 2025-09-30
|
|
1260
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1261
|
-
*/
|
|
1262
|
-
type AsyncResolver = <T>(token: symbol) => Promise<T>;
|
|
1263
|
-
/**
|
|
1264
|
-
* @description Represents a globally unique identifier (GUID/UUID) as a string.
|
|
1265
|
-
* The format is typically 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.
|
|
1266
|
-
|
|
1267
|
-
*
|
|
1268
|
-
* @author Xeno
|
|
1269
|
-
* @version 1.0.0
|
|
1270
|
-
* @since 2025-09-30
|
|
1271
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1272
|
-
*/
|
|
1273
|
-
type Guid = `${string}-${string}-${string}-${string}-${string}`;
|
|
1274
|
-
/**
|
|
1275
|
-
* @description Represents a function that performs setup or configuration
|
|
1276
|
-
* based on the provided options of type `T`.
|
|
1277
|
-
|
|
1278
|
-
*
|
|
1279
|
-
* @author Xeno
|
|
1280
|
-
* @version 1.0.0
|
|
1281
|
-
* @since 2025-09-30
|
|
1282
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1283
|
-
*/
|
|
1284
|
-
type SetupAction<T, E = undefined> = (options: T, config: E) => void;
|
|
1285
|
-
|
|
1286
|
-
/**
|
|
1287
|
-
* @description Supported HTTP methods.
|
|
1288
|
-
|
|
1289
|
-
*
|
|
1290
|
-
* @author Xeno
|
|
1291
|
-
* @version 1.0.0
|
|
1292
|
-
* @since 2025-09-30
|
|
1293
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1294
|
-
*/
|
|
1295
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
1296
|
-
/**
|
|
1297
|
-
* @description Header map used by agnostic HTTP clients.
|
|
1298
|
-
|
|
1299
|
-
*
|
|
1300
|
-
* @author Xeno
|
|
1301
|
-
* @version 1.0.0
|
|
1302
|
-
* @since 2025-09-30
|
|
1303
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1304
|
-
*/
|
|
1305
|
-
type HttpHeaders = Dictionary<Optional<string | string[]>>;
|
|
1306
|
-
/**
|
|
1307
|
-
* @description Query string value accepted by the HTTP contract.
|
|
1308
|
-
|
|
1309
|
-
*
|
|
1310
|
-
* @author Xeno
|
|
1311
|
-
* @version 1.0.0
|
|
1312
|
-
* @since 2025-09-30
|
|
1313
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1314
|
-
*/
|
|
1315
|
-
type HttpQueryValue = Maybe<string | number | boolean>;
|
|
1316
|
-
/**
|
|
1317
|
-
* @description Agnostic contract used to execute HTTP calls independently
|
|
1318
|
-
* from concrete transport libraries (fetch, axios, undici, etc.).
|
|
1086
|
+
* @template T The type of each item in the page.
|
|
1319
1087
|
|
|
1320
1088
|
*
|
|
1321
1089
|
* @author Xeno
|
|
@@ -1323,69 +1091,92 @@ type HttpQueryValue = Maybe<string | number | boolean>;
|
|
|
1323
1091
|
* @since 2025-09-30
|
|
1324
1092
|
* @link https://github.com/xeno-js/xeno-js
|
|
1325
1093
|
*/
|
|
1326
|
-
|
|
1327
|
-
/**
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1094
|
+
interface IPaginatedResult<T> {
|
|
1095
|
+
/**
|
|
1096
|
+
* @description Immutable slice of items for the requested page.
|
|
1097
|
+
|
|
1098
|
+
*
|
|
1099
|
+
* @author Xeno
|
|
1100
|
+
* @version 1.0.0
|
|
1101
|
+
* @since 2025-09-30
|
|
1102
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1103
|
+
*/
|
|
1104
|
+
readonly items: readonly T[];
|
|
1105
|
+
/**
|
|
1106
|
+
* @description Total number of items matching the query across all pages.
|
|
1107
|
+
|
|
1108
|
+
*
|
|
1109
|
+
* @author Xeno
|
|
1110
|
+
* @version 1.0.0
|
|
1111
|
+
* @since 2025-09-30
|
|
1112
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1113
|
+
*/
|
|
1114
|
+
readonly total: number;
|
|
1115
|
+
/**
|
|
1116
|
+
* @description Current 1-based page index.
|
|
1117
|
+
|
|
1337
1118
|
*
|
|
1338
1119
|
* @author Xeno
|
|
1339
1120
|
* @version 1.0.0
|
|
1340
1121
|
* @since 2025-09-30
|
|
1341
1122
|
* @link https://github.com/xeno-js/xeno-js
|
|
1342
1123
|
*/
|
|
1343
|
-
readonly
|
|
1344
|
-
/**
|
|
1124
|
+
readonly page: number;
|
|
1125
|
+
/**
|
|
1126
|
+
* @description Number of items per page used for this result.
|
|
1127
|
+
|
|
1345
1128
|
*
|
|
1346
1129
|
* @author Xeno
|
|
1347
1130
|
* @version 1.0.0
|
|
1348
1131
|
* @since 2025-09-30
|
|
1349
1132
|
* @link https://github.com/xeno-js/xeno-js
|
|
1350
1133
|
*/
|
|
1351
|
-
readonly
|
|
1352
|
-
/**
|
|
1134
|
+
readonly pageSize: number;
|
|
1135
|
+
/**
|
|
1136
|
+
* @description Total number of pages given `total` and `pageSize`.
|
|
1137
|
+
* Computed as `Math.ceil(total / pageSize)`.
|
|
1138
|
+
|
|
1353
1139
|
*
|
|
1354
1140
|
* @author Xeno
|
|
1355
1141
|
* @version 1.0.0
|
|
1356
1142
|
* @since 2025-09-30
|
|
1357
1143
|
* @link https://github.com/xeno-js/xeno-js
|
|
1358
1144
|
*/
|
|
1359
|
-
readonly
|
|
1360
|
-
/**
|
|
1145
|
+
readonly totalPages: number;
|
|
1146
|
+
/**
|
|
1147
|
+
* @description `true` when a next page exists (i.e. `page < totalPages`).
|
|
1148
|
+
|
|
1361
1149
|
*
|
|
1362
1150
|
* @author Xeno
|
|
1363
1151
|
* @version 1.0.0
|
|
1364
1152
|
* @since 2025-09-30
|
|
1365
1153
|
* @link https://github.com/xeno-js/xeno-js
|
|
1366
1154
|
*/
|
|
1367
|
-
readonly
|
|
1155
|
+
readonly hasNextPage: boolean;
|
|
1368
1156
|
/**
|
|
1369
|
-
* @description
|
|
1157
|
+
* @description `true` when a previous page exists (i.e. `page > 1`).
|
|
1158
|
+
|
|
1370
1159
|
*
|
|
1371
1160
|
* @author Xeno
|
|
1372
1161
|
* @version 1.0.0
|
|
1373
1162
|
* @since 2025-09-30
|
|
1374
1163
|
* @link https://github.com/xeno-js/xeno-js
|
|
1375
1164
|
*/
|
|
1376
|
-
readonly
|
|
1165
|
+
readonly hasPreviousPage: boolean;
|
|
1377
1166
|
}
|
|
1167
|
+
|
|
1378
1168
|
/**
|
|
1379
|
-
* @
|
|
1380
|
-
*
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1169
|
+
* @file api-response.types.ts
|
|
1170
|
+
* @description Defines types related to API responses, including the structure of successful and error responses returned by the server.
|
|
1171
|
+
|
|
1172
|
+
*
|
|
1173
|
+
* @author Xeno
|
|
1174
|
+
* @version 1.0.0
|
|
1175
|
+
* @since 2025-09-30
|
|
1176
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1177
|
+
*/
|
|
1387
1178
|
/**
|
|
1388
|
-
* @description
|
|
1179
|
+
* @description Defines the structure of the API response returned by the server. It includes a status indicating whether the request was successful or resulted in an error, a boolean flag 'ok' for quick checks, headers containing any relevant HTTP headers, and a data field that can either be a successful response with the expected data or an error response with details about the failure.
|
|
1389
1180
|
|
|
1390
1181
|
*
|
|
1391
1182
|
* @author Xeno
|
|
@@ -1393,34 +1184,42 @@ type HttpResponseType = 'json' | 'blob' | 'text' | 'arraybuffer';
|
|
|
1393
1184
|
* @since 2025-09-30
|
|
1394
1185
|
* @link https://github.com/xeno-js/xeno-js
|
|
1395
1186
|
*/
|
|
1396
|
-
interface
|
|
1397
|
-
/** @description
|
|
1187
|
+
interface ResponseDto<T = unknown> {
|
|
1188
|
+
/** @description Indicates the overall status of the API response, which can be either 'success' or 'error'.
|
|
1189
|
+
*
|
|
1190
|
+
* @author Xeno
|
|
1191
|
+
* @version 1.0.0
|
|
1192
|
+
* @since 2025-09-30
|
|
1193
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1194
|
+
*/
|
|
1195
|
+
status: number;
|
|
1196
|
+
/** @description A boolean flag that is true if the response status is 'success' and false if it is 'error'. This provides a convenient way to check the success of the API call without having to compare the status string.
|
|
1398
1197
|
*
|
|
1399
1198
|
* @author Xeno
|
|
1400
1199
|
* @version 1.0.0
|
|
1401
1200
|
* @since 2025-09-30
|
|
1402
1201
|
* @link https://github.com/xeno-js/xeno-js
|
|
1403
1202
|
*/
|
|
1404
|
-
|
|
1405
|
-
/** @description
|
|
1203
|
+
ok: boolean;
|
|
1204
|
+
/** @description A dictionary of HTTP headers included in the API response. This can contain any relevant headers returned by the server, such as content type, caching directives, or custom headers.
|
|
1406
1205
|
*
|
|
1407
1206
|
* @author Xeno
|
|
1408
1207
|
* @version 1.0.0
|
|
1409
1208
|
* @since 2025-09-30
|
|
1410
1209
|
* @link https://github.com/xeno-js/xeno-js
|
|
1411
1210
|
*/
|
|
1412
|
-
|
|
1413
|
-
/** @description
|
|
1211
|
+
headers: HttpHeaders;
|
|
1212
|
+
/** @description The payload of the API response, which can either be a successful response containing the expected data or an error response containing details about the failure. The structure of this field depends on whether the API call was successful or resulted in an error.
|
|
1414
1213
|
*
|
|
1415
1214
|
* @author Xeno
|
|
1416
1215
|
* @version 1.0.0
|
|
1417
1216
|
* @since 2025-09-30
|
|
1418
1217
|
* @link https://github.com/xeno-js/xeno-js
|
|
1419
1218
|
*/
|
|
1420
|
-
|
|
1219
|
+
data: ApiResponseDto<T>;
|
|
1421
1220
|
}
|
|
1422
1221
|
/**
|
|
1423
|
-
* @description
|
|
1222
|
+
* @description Defines the structure of a successful API response, which includes a data field containing the expected response payload. This interface is used when the API call is successful and the server returns the requested data.
|
|
1424
1223
|
|
|
1425
1224
|
*
|
|
1426
1225
|
* @author Xeno
|
|
@@ -1428,245 +1227,24 @@ interface HttpRequest<TBody = unknown> extends HttpBaseRequest {
|
|
|
1428
1227
|
* @since 2025-09-30
|
|
1429
1228
|
* @link https://github.com/xeno-js/xeno-js
|
|
1430
1229
|
*/
|
|
1431
|
-
interface
|
|
1432
|
-
/** @description
|
|
1230
|
+
interface SuccessResponseDto<T = unknown> {
|
|
1231
|
+
/** @description A boolean flag that is always true for successful responses. This provides a consistent way to check for success in the API response.
|
|
1433
1232
|
*
|
|
1434
1233
|
* @author Xeno
|
|
1435
1234
|
* @version 1.0.0
|
|
1436
1235
|
* @since 2025-09-30
|
|
1437
1236
|
* @link https://github.com/xeno-js/xeno-js
|
|
1438
1237
|
*/
|
|
1439
|
-
readonly
|
|
1440
|
-
/** @description
|
|
1238
|
+
readonly success: true;
|
|
1239
|
+
/** @description The actual data payload returned by the API call. The structure of this field can vary depending on the specific endpoint and the type of data being returned. It is defined as a generic type T, allowing for flexibility in the shape of the response data.
|
|
1441
1240
|
*
|
|
1442
1241
|
* @author Xeno
|
|
1443
1242
|
* @version 1.0.0
|
|
1444
1243
|
* @since 2025-09-30
|
|
1445
1244
|
* @link https://github.com/xeno-js/xeno-js
|
|
1446
1245
|
*/
|
|
1447
|
-
readonly
|
|
1448
|
-
/** @description
|
|
1449
|
-
*
|
|
1450
|
-
* @author Xeno
|
|
1451
|
-
* @version 1.0.0
|
|
1452
|
-
* @since 2025-09-30
|
|
1453
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1454
|
-
*/
|
|
1455
|
-
readonly headers: HttpHeaders;
|
|
1456
|
-
/** @description Parsed response payload.
|
|
1457
|
-
*
|
|
1458
|
-
* @author Xeno
|
|
1459
|
-
* @version 1.0.0
|
|
1460
|
-
* @since 2025-09-30
|
|
1461
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1462
|
-
*/
|
|
1463
|
-
readonly data: TData;
|
|
1464
|
-
}
|
|
1465
|
-
/**
|
|
1466
|
-
* @description Represents the CookieOptions interface.
|
|
1467
|
-
*
|
|
1468
|
-
* @author Xeno
|
|
1469
|
-
* @version 1.0.0
|
|
1470
|
-
* @since 2025-09-30
|
|
1471
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1472
|
-
*/
|
|
1473
|
-
interface CookieOptions {
|
|
1474
|
-
/** @description The path for which the cookie is valid. Defaults to '/'. */
|
|
1475
|
-
path?: Optional<string>;
|
|
1476
|
-
/** @description The value of the maximum age in seconds. If not specified, the cookie will expire when the browser session ends. */
|
|
1477
|
-
maxAge?: Optional<number>;
|
|
1478
|
-
/** @description The domain for which the cookie is valid. Defaults to the domain of the current document host. */
|
|
1479
|
-
domain?: Optional<string>;
|
|
1480
|
-
/** @description Whether the cookie is only transmitted over secure (HTTPS) connections. Defaults to true in production. */
|
|
1481
|
-
secure?: Optional<boolean>;
|
|
1482
|
-
/** @description Controls whether the cookie is withheld on cross-site requests, providing some protection against cross-site request forgery attacks. */
|
|
1483
|
-
sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
|
|
1484
|
-
}
|
|
1485
|
-
/**
|
|
1486
|
-
* @description Represents an extended Request object that includes additional properties
|
|
1487
|
-
* required by the Xeno-js framework, such as custom path handling.
|
|
1488
|
-
*
|
|
1489
|
-
* @author Xeno
|
|
1490
|
-
* @version 1.0.0
|
|
1491
|
-
* @since 2025-09-30
|
|
1492
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1493
|
-
*/
|
|
1494
|
-
interface ExtendedRequest extends Request {
|
|
1495
|
-
/**
|
|
1496
|
-
* @description The path of the request, which may be modified by middleware.
|
|
1497
|
-
* Example: '/api/v1/user'
|
|
1498
|
-
*/
|
|
1499
|
-
path: string;
|
|
1500
|
-
}
|
|
1501
|
-
|
|
1502
|
-
/**
|
|
1503
|
-
* @description Standardised paginated response envelope returned by query handlers.
|
|
1504
|
-
*
|
|
1505
|
-
* Wraps the items array with cursor metadata so callers can navigate pages
|
|
1506
|
-
* without re-computing totals on every request.
|
|
1507
|
-
*
|
|
1508
|
-
* @template T The type of each item in the page.
|
|
1509
|
-
|
|
1510
|
-
*
|
|
1511
|
-
* @author Xeno
|
|
1512
|
-
* @version 1.0.0
|
|
1513
|
-
* @since 2025-09-30
|
|
1514
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1515
|
-
*/
|
|
1516
|
-
interface IPaginatedResult<T> {
|
|
1517
|
-
/**
|
|
1518
|
-
* @description Immutable slice of items for the requested page.
|
|
1519
|
-
|
|
1520
|
-
*
|
|
1521
|
-
* @author Xeno
|
|
1522
|
-
* @version 1.0.0
|
|
1523
|
-
* @since 2025-09-30
|
|
1524
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1525
|
-
*/
|
|
1526
|
-
readonly items: readonly T[];
|
|
1527
|
-
/**
|
|
1528
|
-
* @description Total number of items matching the query across all pages.
|
|
1529
|
-
|
|
1530
|
-
*
|
|
1531
|
-
* @author Xeno
|
|
1532
|
-
* @version 1.0.0
|
|
1533
|
-
* @since 2025-09-30
|
|
1534
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1535
|
-
*/
|
|
1536
|
-
readonly total: number;
|
|
1537
|
-
/**
|
|
1538
|
-
* @description Current 1-based page index.
|
|
1539
|
-
|
|
1540
|
-
*
|
|
1541
|
-
* @author Xeno
|
|
1542
|
-
* @version 1.0.0
|
|
1543
|
-
* @since 2025-09-30
|
|
1544
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1545
|
-
*/
|
|
1546
|
-
readonly page: number;
|
|
1547
|
-
/**
|
|
1548
|
-
* @description Number of items per page used for this result.
|
|
1549
|
-
|
|
1550
|
-
*
|
|
1551
|
-
* @author Xeno
|
|
1552
|
-
* @version 1.0.0
|
|
1553
|
-
* @since 2025-09-30
|
|
1554
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1555
|
-
*/
|
|
1556
|
-
readonly pageSize: number;
|
|
1557
|
-
/**
|
|
1558
|
-
* @description Total number of pages given `total` and `pageSize`.
|
|
1559
|
-
* Computed as `Math.ceil(total / pageSize)`.
|
|
1560
|
-
|
|
1561
|
-
*
|
|
1562
|
-
* @author Xeno
|
|
1563
|
-
* @version 1.0.0
|
|
1564
|
-
* @since 2025-09-30
|
|
1565
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1566
|
-
*/
|
|
1567
|
-
readonly totalPages: number;
|
|
1568
|
-
/**
|
|
1569
|
-
* @description `true` when a next page exists (i.e. `page < totalPages`).
|
|
1570
|
-
|
|
1571
|
-
*
|
|
1572
|
-
* @author Xeno
|
|
1573
|
-
* @version 1.0.0
|
|
1574
|
-
* @since 2025-09-30
|
|
1575
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1576
|
-
*/
|
|
1577
|
-
readonly hasNextPage: boolean;
|
|
1578
|
-
/**
|
|
1579
|
-
* @description `true` when a previous page exists (i.e. `page > 1`).
|
|
1580
|
-
|
|
1581
|
-
*
|
|
1582
|
-
* @author Xeno
|
|
1583
|
-
* @version 1.0.0
|
|
1584
|
-
* @since 2025-09-30
|
|
1585
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1586
|
-
*/
|
|
1587
|
-
readonly hasPreviousPage: boolean;
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
/**
|
|
1591
|
-
* @file api-response.types.ts
|
|
1592
|
-
* @description Defines types related to API responses, including the structure of successful and error responses returned by the server.
|
|
1593
|
-
|
|
1594
|
-
*
|
|
1595
|
-
* @author Xeno
|
|
1596
|
-
* @version 1.0.0
|
|
1597
|
-
* @since 2025-09-30
|
|
1598
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1599
|
-
*/
|
|
1600
|
-
/**
|
|
1601
|
-
* @description Defines the structure of the API response returned by the server. It includes a status indicating whether the request was successful or resulted in an error, a boolean flag 'ok' for quick checks, headers containing any relevant HTTP headers, and a data field that can either be a successful response with the expected data or an error response with details about the failure.
|
|
1602
|
-
|
|
1603
|
-
*
|
|
1604
|
-
* @author Xeno
|
|
1605
|
-
* @version 1.0.0
|
|
1606
|
-
* @since 2025-09-30
|
|
1607
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1608
|
-
*/
|
|
1609
|
-
interface ResponseDto<T = unknown> {
|
|
1610
|
-
/** @description Indicates the overall status of the API response, which can be either 'success' or 'error'.
|
|
1611
|
-
*
|
|
1612
|
-
* @author Xeno
|
|
1613
|
-
* @version 1.0.0
|
|
1614
|
-
* @since 2025-09-30
|
|
1615
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1616
|
-
*/
|
|
1617
|
-
status: number;
|
|
1618
|
-
/** @description A boolean flag that is true if the response status is 'success' and false if it is 'error'. This provides a convenient way to check the success of the API call without having to compare the status string.
|
|
1619
|
-
*
|
|
1620
|
-
* @author Xeno
|
|
1621
|
-
* @version 1.0.0
|
|
1622
|
-
* @since 2025-09-30
|
|
1623
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1624
|
-
*/
|
|
1625
|
-
ok: boolean;
|
|
1626
|
-
/** @description A dictionary of HTTP headers included in the API response. This can contain any relevant headers returned by the server, such as content type, caching directives, or custom headers.
|
|
1627
|
-
*
|
|
1628
|
-
* @author Xeno
|
|
1629
|
-
* @version 1.0.0
|
|
1630
|
-
* @since 2025-09-30
|
|
1631
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1632
|
-
*/
|
|
1633
|
-
headers: HttpHeaders;
|
|
1634
|
-
/** @description The payload of the API response, which can either be a successful response containing the expected data or an error response containing details about the failure. The structure of this field depends on whether the API call was successful or resulted in an error.
|
|
1635
|
-
*
|
|
1636
|
-
* @author Xeno
|
|
1637
|
-
* @version 1.0.0
|
|
1638
|
-
* @since 2025-09-30
|
|
1639
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1640
|
-
*/
|
|
1641
|
-
data: ApiResponseDto<T>;
|
|
1642
|
-
}
|
|
1643
|
-
/**
|
|
1644
|
-
* @description Defines the structure of a successful API response, which includes a data field containing the expected response payload. This interface is used when the API call is successful and the server returns the requested data.
|
|
1645
|
-
|
|
1646
|
-
*
|
|
1647
|
-
* @author Xeno
|
|
1648
|
-
* @version 1.0.0
|
|
1649
|
-
* @since 2025-09-30
|
|
1650
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1651
|
-
*/
|
|
1652
|
-
interface SuccessResponseDto<T = unknown> {
|
|
1653
|
-
/** @description A boolean flag that is always true for successful responses. This provides a consistent way to check for success in the API response.
|
|
1654
|
-
*
|
|
1655
|
-
* @author Xeno
|
|
1656
|
-
* @version 1.0.0
|
|
1657
|
-
* @since 2025-09-30
|
|
1658
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1659
|
-
*/
|
|
1660
|
-
readonly success: true;
|
|
1661
|
-
/** @description The actual data payload returned by the API call. The structure of this field can vary depending on the specific endpoint and the type of data being returned. It is defined as a generic type T, allowing for flexibility in the shape of the response data.
|
|
1662
|
-
*
|
|
1663
|
-
* @author Xeno
|
|
1664
|
-
* @version 1.0.0
|
|
1665
|
-
* @since 2025-09-30
|
|
1666
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1667
|
-
*/
|
|
1668
|
-
readonly data: T | IPaginatedResult<T>;
|
|
1669
|
-
/** @description Metadata associated with the successful API response. This can include pagination information, rate limit details, or other relevant metadata.
|
|
1246
|
+
readonly data: T | IPaginatedResult<T>;
|
|
1247
|
+
/** @description Metadata associated with the successful API response. This can include pagination information, rate limit details, or other relevant metadata.
|
|
1670
1248
|
*
|
|
1671
1249
|
* @author Xeno
|
|
1672
1250
|
* @version 1.0.0
|
|
@@ -1770,8 +1348,7 @@ interface ErrorResponseDto {
|
|
|
1770
1348
|
type ApiResponseDto<T = unknown> = SuccessResponseDto<T> | ErrorResponseDto;
|
|
1771
1349
|
|
|
1772
1350
|
/**
|
|
1773
|
-
* @
|
|
1774
|
-
* @description Defines types related to authentication and authorization.
|
|
1351
|
+
* @description The AuthPolicy interface defines the structure of an authorization policy, which includes a list of roles and permissions. This interface is used to represent the access control policies associated with different intents or actions within the application. Implementations of this interface can be used to enforce role-based and permission-based access control by specifying which roles and permissions are required for specific operations.
|
|
1775
1352
|
|
|
1776
1353
|
*
|
|
1777
1354
|
* @author Xeno
|
|
@@ -1779,8 +1356,47 @@ type ApiResponseDto<T = unknown> = SuccessResponseDto<T> | ErrorResponseDto;
|
|
|
1779
1356
|
* @since 2025-09-30
|
|
1780
1357
|
* @link https://github.com/xeno-js/xeno-js
|
|
1781
1358
|
*/
|
|
1359
|
+
interface AuthPolicy {
|
|
1360
|
+
/**
|
|
1361
|
+
* An optional boolean flag indicating whether the authorization policy requires a user ID for authentication. If set to true, the policy enforces that a valid user ID must be present in the request context for authorization to succeed. This flag can be used to differentiate between policies that require user-level authentication and those that do not.
|
|
1362
|
+
* @author Xeno
|
|
1363
|
+
* @version 1.0.0
|
|
1364
|
+
* @since 2025-09-30
|
|
1365
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1366
|
+
*/
|
|
1367
|
+
readonly userId?: boolean;
|
|
1368
|
+
/**
|
|
1369
|
+
* An optional boolean flag indicating whether the authorization policy requires a tenant ID for authentication. If set to true, the policy enforces that a valid tenant ID must be present in the request context for authorization to succeed. This flag can be used to differentiate between policies that require tenant-level authentication and those that do not.
|
|
1370
|
+
* @author Xeno
|
|
1371
|
+
* @version 1.0.0
|
|
1372
|
+
* @since 2025-09-30
|
|
1373
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1374
|
+
*/
|
|
1375
|
+
readonly tenantId?: boolean;
|
|
1376
|
+
/**
|
|
1377
|
+
* An array of roles that are associated with the authorization policy. These roles define the access level and permissions granted to users who possess them. The roles can be used to determine whether a user is authorized to perform certain actions or access specific resources within the application.
|
|
1378
|
+
|
|
1379
|
+
*
|
|
1380
|
+
* @author Xeno
|
|
1381
|
+
* @version 1.0.0
|
|
1382
|
+
* @since 2025-09-30
|
|
1383
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1384
|
+
*/
|
|
1385
|
+
readonly roles?: string[];
|
|
1386
|
+
/**
|
|
1387
|
+
* An array of permissions that are associated with the authorization policy. These permissions define the specific actions or operations that a user is allowed to perform within the application. The permissions can be used to enforce fine-grained access control by specifying which operations require certain permissions.
|
|
1388
|
+
|
|
1389
|
+
*
|
|
1390
|
+
* @author Xeno
|
|
1391
|
+
* @version 1.0.0
|
|
1392
|
+
* @since 2025-09-30
|
|
1393
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1394
|
+
*/
|
|
1395
|
+
readonly permissions?: string[];
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1782
1398
|
/**
|
|
1783
|
-
* @description An interface representing
|
|
1399
|
+
* @description An interface representing cacheable options, which includes properties for cache key, TTL, and bypass flags. This allows query handlers to determine how to cache the results of the query based on the provided options.
|
|
1784
1400
|
|
|
1785
1401
|
*
|
|
1786
1402
|
* @author Xeno
|
|
@@ -1788,9 +1404,9 @@ type ApiResponseDto<T = unknown> = SuccessResponseDto<T> | ErrorResponseDto;
|
|
|
1788
1404
|
* @since 2025-09-30
|
|
1789
1405
|
* @link https://github.com/xeno-js/xeno-js
|
|
1790
1406
|
*/
|
|
1791
|
-
interface
|
|
1407
|
+
interface ICacheableOptions {
|
|
1792
1408
|
/**
|
|
1793
|
-
*
|
|
1409
|
+
* @description A unique key under which to save the result. Must include parameters (e.g., `travel-intents:tenant-123:page-1`).
|
|
1794
1410
|
|
|
1795
1411
|
*
|
|
1796
1412
|
* @author Xeno
|
|
@@ -1798,19 +1414,20 @@ interface AuthClaims {
|
|
|
1798
1414
|
* @since 2025-09-30
|
|
1799
1415
|
* @link https://github.com/xeno-js/xeno-js
|
|
1800
1416
|
*/
|
|
1801
|
-
readonly
|
|
1417
|
+
readonly cacheKey: string;
|
|
1802
1418
|
/**
|
|
1803
|
-
*
|
|
1419
|
+
* @description Time to live for the cache entry in seconds. Optional; if omitted, a default TTL defined in the caching layer will be used. Must be a positive integer if provided.
|
|
1420
|
+
|
|
1804
1421
|
*
|
|
1805
1422
|
* @author Xeno
|
|
1806
1423
|
* @version 1.0.0
|
|
1807
1424
|
* @since 2025-09-30
|
|
1808
1425
|
* @link https://github.com/xeno-js/xeno-js
|
|
1809
1426
|
*/
|
|
1810
|
-
readonly
|
|
1811
|
-
readonly name: Optional<string>;
|
|
1427
|
+
readonly ttl: Optional<number>;
|
|
1812
1428
|
/**
|
|
1813
|
-
*
|
|
1429
|
+
* @description If true, indicates that the cache should be bypassed for this request. Similar to consistentRead but less semantically explicit.
|
|
1430
|
+
* If both bypassCache and consistentRead are provided, consistentRead takes precedence.
|
|
1814
1431
|
|
|
1815
1432
|
*
|
|
1816
1433
|
* @author Xeno
|
|
@@ -1818,9 +1435,9 @@ interface AuthClaims {
|
|
|
1818
1435
|
* @since 2025-09-30
|
|
1819
1436
|
* @link https://github.com/xeno-js/xeno-js
|
|
1820
1437
|
*/
|
|
1821
|
-
readonly
|
|
1438
|
+
readonly bypassCache: Optional<boolean>;
|
|
1822
1439
|
/**
|
|
1823
|
-
*
|
|
1440
|
+
* @description (Optional) If true, indicates that a consistent read is required, bypassing the cache. Similar to bypassCache but more semantically explicit.
|
|
1824
1441
|
|
|
1825
1442
|
*
|
|
1826
1443
|
* @author Xeno
|
|
@@ -1828,9 +1445,9 @@ interface AuthClaims {
|
|
|
1828
1445
|
* @since 2025-09-30
|
|
1829
1446
|
* @link https://github.com/xeno-js/xeno-js
|
|
1830
1447
|
*/
|
|
1831
|
-
readonly
|
|
1448
|
+
readonly consistentRead: Optional<boolean>;
|
|
1832
1449
|
/**
|
|
1833
|
-
*
|
|
1450
|
+
* @description (Optional) If true, indicates that the cache entry is scoped to the current user. This is useful for multi-tenant applications where cached data should be isolated per user or tenant.
|
|
1834
1451
|
|
|
1835
1452
|
*
|
|
1836
1453
|
* @author Xeno
|
|
@@ -1838,154 +1455,10 @@ interface AuthClaims {
|
|
|
1838
1455
|
* @since 2025-09-30
|
|
1839
1456
|
* @link https://github.com/xeno-js/xeno-js
|
|
1840
1457
|
*/
|
|
1841
|
-
readonly
|
|
1458
|
+
readonly isUserScoped: boolean;
|
|
1842
1459
|
}
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
*
|
|
1846
|
-
* @author Xeno
|
|
1847
|
-
* @version 1.0.0
|
|
1848
|
-
* @since 2025-09-30
|
|
1849
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1850
|
-
*/
|
|
1851
|
-
interface UserContext {
|
|
1852
|
-
/**
|
|
1853
|
-
* The unique identifier for the user (subject).
|
|
1854
|
-
* @author Xeno
|
|
1855
|
-
* @version 1.0.0
|
|
1856
|
-
* @since 2025-09-30
|
|
1857
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1858
|
-
*/
|
|
1859
|
-
readonly userId: Optional<Guid>;
|
|
1860
|
-
/**
|
|
1861
|
-
* The tenant ID associated with the user, if applicable. This is useful in multi-tenant applications to identify which tenant the user belongs to.
|
|
1862
|
-
* @author Xeno
|
|
1863
|
-
* @version 1.0.0
|
|
1864
|
-
* @since 2025-09-30
|
|
1865
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1866
|
-
*/
|
|
1867
|
-
readonly tenantId: Optional<Guid>;
|
|
1868
|
-
}
|
|
1869
|
-
interface Session {
|
|
1870
|
-
readonly accessToken: string;
|
|
1871
|
-
readonly refreshToken: string;
|
|
1872
|
-
readonly expiresAt: Optional<number>;
|
|
1873
|
-
readonly user: AuthClaims;
|
|
1874
|
-
}
|
|
1875
|
-
type Provider = 'apple' | 'discord' | 'facebook' | 'github' | 'gitlab' | 'google' | 'linkedin' | 'linkedin_oidc' | 'spotify';
|
|
1876
|
-
|
|
1877
|
-
/**
|
|
1878
|
-
* @description The AuthPolicy interface defines the structure of an authorization policy, which includes a list of roles and permissions. This interface is used to represent the access control policies associated with different intents or actions within the application. Implementations of this interface can be used to enforce role-based and permission-based access control by specifying which roles and permissions are required for specific operations.
|
|
1879
|
-
|
|
1880
|
-
*
|
|
1881
|
-
* @author Xeno
|
|
1882
|
-
* @version 1.0.0
|
|
1883
|
-
* @since 2025-09-30
|
|
1884
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1885
|
-
*/
|
|
1886
|
-
interface AuthPolicy {
|
|
1887
|
-
/**
|
|
1888
|
-
* An optional boolean flag indicating whether the authorization policy requires a user ID for authentication. If set to true, the policy enforces that a valid user ID must be present in the request context for authorization to succeed. This flag can be used to differentiate between policies that require user-level authentication and those that do not.
|
|
1889
|
-
* @author Xeno
|
|
1890
|
-
* @version 1.0.0
|
|
1891
|
-
* @since 2025-09-30
|
|
1892
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1893
|
-
*/
|
|
1894
|
-
readonly userId?: boolean;
|
|
1895
|
-
/**
|
|
1896
|
-
* An optional boolean flag indicating whether the authorization policy requires a tenant ID for authentication. If set to true, the policy enforces that a valid tenant ID must be present in the request context for authorization to succeed. This flag can be used to differentiate between policies that require tenant-level authentication and those that do not.
|
|
1897
|
-
* @author Xeno
|
|
1898
|
-
* @version 1.0.0
|
|
1899
|
-
* @since 2025-09-30
|
|
1900
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1901
|
-
*/
|
|
1902
|
-
readonly tenantId?: boolean;
|
|
1903
|
-
/**
|
|
1904
|
-
* An array of roles that are associated with the authorization policy. These roles define the access level and permissions granted to users who possess them. The roles can be used to determine whether a user is authorized to perform certain actions or access specific resources within the application.
|
|
1905
|
-
|
|
1906
|
-
*
|
|
1907
|
-
* @author Xeno
|
|
1908
|
-
* @version 1.0.0
|
|
1909
|
-
* @since 2025-09-30
|
|
1910
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1911
|
-
*/
|
|
1912
|
-
readonly roles?: string[];
|
|
1913
|
-
/**
|
|
1914
|
-
* An array of permissions that are associated with the authorization policy. These permissions define the specific actions or operations that a user is allowed to perform within the application. The permissions can be used to enforce fine-grained access control by specifying which operations require certain permissions.
|
|
1915
|
-
|
|
1916
|
-
*
|
|
1917
|
-
* @author Xeno
|
|
1918
|
-
* @version 1.0.0
|
|
1919
|
-
* @since 2025-09-30
|
|
1920
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1921
|
-
*/
|
|
1922
|
-
readonly permissions?: string[];
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
/**
|
|
1926
|
-
* @description An interface representing cacheable options, which includes properties for cache key, TTL, and bypass flags. This allows query handlers to determine how to cache the results of the query based on the provided options.
|
|
1927
|
-
|
|
1928
|
-
*
|
|
1929
|
-
* @author Xeno
|
|
1930
|
-
* @version 1.0.0
|
|
1931
|
-
* @since 2025-09-30
|
|
1932
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1933
|
-
*/
|
|
1934
|
-
interface ICacheableOptions {
|
|
1935
|
-
/**
|
|
1936
|
-
* @description A unique key under which to save the result. Must include parameters (e.g., `travel-intents:tenant-123:page-1`).
|
|
1937
|
-
|
|
1938
|
-
*
|
|
1939
|
-
* @author Xeno
|
|
1940
|
-
* @version 1.0.0
|
|
1941
|
-
* @since 2025-09-30
|
|
1942
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1943
|
-
*/
|
|
1944
|
-
readonly cacheKey: string;
|
|
1945
|
-
/**
|
|
1946
|
-
* @description Time to live for the cache entry in seconds. Optional; if omitted, a default TTL defined in the caching layer will be used. Must be a positive integer if provided.
|
|
1947
|
-
|
|
1948
|
-
*
|
|
1949
|
-
* @author Xeno
|
|
1950
|
-
* @version 1.0.0
|
|
1951
|
-
* @since 2025-09-30
|
|
1952
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1953
|
-
*/
|
|
1954
|
-
readonly ttl: Optional<number>;
|
|
1955
|
-
/**
|
|
1956
|
-
* @description If true, indicates that the cache should be bypassed for this request. Similar to consistentRead but less semantically explicit.
|
|
1957
|
-
* If both bypassCache and consistentRead are provided, consistentRead takes precedence.
|
|
1958
|
-
|
|
1959
|
-
*
|
|
1960
|
-
* @author Xeno
|
|
1961
|
-
* @version 1.0.0
|
|
1962
|
-
* @since 2025-09-30
|
|
1963
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1964
|
-
*/
|
|
1965
|
-
readonly bypassCache: Optional<boolean>;
|
|
1966
|
-
/**
|
|
1967
|
-
* @description (Optional) If true, indicates that a consistent read is required, bypassing the cache. Similar to bypassCache but more semantically explicit.
|
|
1968
|
-
|
|
1969
|
-
*
|
|
1970
|
-
* @author Xeno
|
|
1971
|
-
* @version 1.0.0
|
|
1972
|
-
* @since 2025-09-30
|
|
1973
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1974
|
-
*/
|
|
1975
|
-
readonly consistentRead: Optional<boolean>;
|
|
1976
|
-
/**
|
|
1977
|
-
* @description (Optional) If true, indicates that the cache entry is scoped to the current user. This is useful for multi-tenant applications where cached data should be isolated per user or tenant.
|
|
1978
|
-
|
|
1979
|
-
*
|
|
1980
|
-
* @author Xeno
|
|
1981
|
-
* @version 1.0.0
|
|
1982
|
-
* @since 2025-09-30
|
|
1983
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
1984
|
-
*/
|
|
1985
|
-
readonly isUserScoped: boolean;
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
declare const _phantom: unique symbol;
|
|
1460
|
+
|
|
1461
|
+
declare const _phantom: unique symbol;
|
|
1989
1462
|
/**
|
|
1990
1463
|
* @description A typed injection token that binds a runtime `symbol` to a
|
|
1991
1464
|
* compile-time type `T` via a phantom property.
|
|
@@ -2495,644 +1968,15 @@ declare const Guards: Readonly<{
|
|
|
2495
1968
|
|
|
2496
1969
|
*
|
|
2497
1970
|
* @author Xeno
|
|
2498
|
-
* @version 1.0.0
|
|
2499
|
-
* @since 2025-09-30
|
|
2500
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2501
|
-
*/
|
|
2502
|
-
readonly isFunction: (value: unknown) => value is (...args: readonly unknown[]) => unknown;
|
|
2503
|
-
/**
|
|
2504
|
-
* @description Checks value is an array.
|
|
2505
|
-
* @param value Candidate value.
|
|
2506
|
-
* @returns True when value is array.
|
|
2507
|
-
|
|
2508
|
-
*
|
|
2509
|
-
* @author Xeno
|
|
2510
|
-
* @version 1.0.0
|
|
2511
|
-
* @since 2025-09-30
|
|
2512
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2513
|
-
*/
|
|
2514
|
-
readonly isArray: <TValue>(value: unknown) => value is TValue[];
|
|
2515
|
-
/**
|
|
2516
|
-
* @description Checks value is a Date instance with valid timestamp.
|
|
2517
|
-
* @param value Candidate value.
|
|
2518
|
-
* @returns True when value is valid Date.
|
|
2519
|
-
|
|
2520
|
-
*
|
|
2521
|
-
* @author Xeno
|
|
2522
|
-
* @version 1.0.0
|
|
2523
|
-
* @since 2025-09-30
|
|
2524
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2525
|
-
*/
|
|
2526
|
-
readonly isDate: (value: unknown) => value is Date;
|
|
2527
|
-
/**
|
|
2528
|
-
* @description Checks value is an Error instance.
|
|
2529
|
-
* @param value Candidate value.
|
|
2530
|
-
* @returns True when value is Error.
|
|
2531
|
-
|
|
2532
|
-
*
|
|
2533
|
-
* @author Xeno
|
|
2534
|
-
* @version 1.0.0
|
|
2535
|
-
* @since 2025-09-30
|
|
2536
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2537
|
-
*/
|
|
2538
|
-
readonly isError: (value: unknown) => value is Error;
|
|
2539
|
-
/**
|
|
2540
|
-
* @description Checks value is a plain object record.
|
|
2541
|
-
* @param value Candidate value.
|
|
2542
|
-
* @returns True when value is object record.
|
|
2543
|
-
|
|
2544
|
-
*
|
|
2545
|
-
* @author Xeno
|
|
2546
|
-
* @version 1.0.0
|
|
2547
|
-
* @since 2025-09-30
|
|
2548
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2549
|
-
*/
|
|
2550
|
-
readonly isObjectRecord: (value: unknown) => value is Readonly<Dictionary<unknown>>;
|
|
2551
|
-
/**
|
|
2552
|
-
* @description Checks value is an object (not null).
|
|
2553
|
-
* @param value Candidate value.
|
|
2554
|
-
* @returns True when value is object.
|
|
2555
|
-
|
|
2556
|
-
*
|
|
2557
|
-
* @author Xeno
|
|
2558
|
-
* @version 1.0.0
|
|
2559
|
-
* @since 2025-09-30
|
|
2560
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2561
|
-
*/
|
|
2562
|
-
readonly isObject: (value: unknown) => value is object;
|
|
2563
|
-
/**
|
|
2564
|
-
* @description Checks value is PromiseLike.
|
|
2565
|
-
* @param value Candidate value.
|
|
2566
|
-
* @returns True when value has then function.
|
|
2567
|
-
|
|
2568
|
-
*
|
|
2569
|
-
* @author Xeno
|
|
2570
|
-
* @version 1.0.0
|
|
2571
|
-
* @since 2025-09-30
|
|
2572
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2573
|
-
*/
|
|
2574
|
-
readonly isPromiseLike: <TValue>(value: unknown) => value is PromiseLike<TValue>;
|
|
2575
|
-
}>;
|
|
2576
|
-
|
|
2577
|
-
/**
|
|
2578
|
-
* @fileoverview Utility functions for generating and validating GUIDs (UUID v4).
|
|
2579
|
-
* This module provides a simple interface for working with GUIDs, including generation and validation.
|
|
2580
|
-
|
|
2581
|
-
*
|
|
2582
|
-
* @author Xeno
|
|
2583
|
-
* @version 1.0.0
|
|
2584
|
-
* @since 2025-09-30
|
|
2585
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2586
|
-
*/
|
|
2587
|
-
declare const GuidHelper: Readonly<{
|
|
2588
|
-
/**
|
|
2589
|
-
* @description Generates a cryptographically-random UUID v4.
|
|
2590
|
-
* @returns Lowercase UUID v4 string.
|
|
2591
|
-
|
|
2592
|
-
*
|
|
2593
|
-
* @author Xeno
|
|
2594
|
-
* @version 1.0.0
|
|
2595
|
-
* @since 2025-09-30
|
|
2596
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2597
|
-
*/
|
|
2598
|
-
readonly generate: () => Guid;
|
|
2599
|
-
/**
|
|
2600
|
-
* @description Validates if a value is a valid GUID (UUID v4) and not empty.
|
|
2601
|
-
* @param value The value to validate.
|
|
2602
|
-
* @returns True if the value is a valid and non-empty GUID, false otherwise.
|
|
2603
|
-
|
|
2604
|
-
*
|
|
2605
|
-
* @author Xeno
|
|
2606
|
-
* @version 1.0.0
|
|
2607
|
-
* @since 2025-09-30
|
|
2608
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2609
|
-
*/
|
|
2610
|
-
readonly isValidGuid: (value: Guid) => boolean;
|
|
2611
|
-
/**
|
|
2612
|
-
* @description Validates if a string is a valid UUID v4.
|
|
2613
|
-
* @param value Candidate string to validate.
|
|
2614
|
-
* @returns True if the string is a valid UUID v4, false otherwise.
|
|
2615
|
-
|
|
2616
|
-
*
|
|
2617
|
-
* @author Xeno
|
|
2618
|
-
* @version 1.0.0
|
|
2619
|
-
* @since 2025-09-30
|
|
2620
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2621
|
-
*/
|
|
2622
|
-
readonly isValid: (value: string) => value is Guid;
|
|
2623
|
-
/**
|
|
2624
|
-
* @description Converts a string to a GUID if it's valid.
|
|
2625
|
-
* @param value The string to convert.
|
|
2626
|
-
* @returns The GUID if the string is valid, otherwise undefined.
|
|
2627
|
-
|
|
2628
|
-
*
|
|
2629
|
-
* @author Xeno
|
|
2630
|
-
* @version 1.0.0
|
|
2631
|
-
* @since 2025-09-30
|
|
2632
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2633
|
-
*/
|
|
2634
|
-
readonly parse: (value: Optional<string>) => Optional<Guid>;
|
|
2635
|
-
/**
|
|
2636
|
-
* @description Checks if a GUID is the empty GUID (all zeros).
|
|
2637
|
-
* @param value The GUID to check.
|
|
2638
|
-
* @returns True if the GUID is the empty GUID, false otherwise.
|
|
2639
|
-
|
|
2640
|
-
*
|
|
2641
|
-
* @author Xeno
|
|
2642
|
-
* @version 1.0.0
|
|
2643
|
-
* @since 2025-09-30
|
|
2644
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2645
|
-
*/
|
|
2646
|
-
readonly isEmpty: (value: string) => boolean;
|
|
2647
|
-
}>;
|
|
2648
|
-
|
|
2649
|
-
/**
|
|
2650
|
-
* @description This module provides utility functions for handling HTTP-related tasks, such as normalizing HTTP headers. It includes a single function, `normalizeHeaders`, which takes an input of unknown type and returns an object with normalized header values. The function ensures that all header values are converted to strings, and if a header value is an array, it joins the elements into a single string separated by commas. This utility is useful for ensuring consistent header formats when working with various HTTP client libraries.
|
|
2651
|
-
|
|
2652
|
-
*
|
|
2653
|
-
* @author Xeno
|
|
2654
|
-
* @version 1.0.0
|
|
2655
|
-
* @since 2025-09-30
|
|
2656
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2657
|
-
*/
|
|
2658
|
-
/**
|
|
2659
|
-
* @description A helper object that provides utility functions for HTTP-related tasks. Currently, it includes a method for normalizing HTTP headers, which ensures that all header values are strings and handles cases where header values may be arrays. This helper can be extended in the future to include additional HTTP-related utilities as needed.
|
|
2660
|
-
|
|
2661
|
-
*
|
|
2662
|
-
* @author Xeno
|
|
2663
|
-
* @version 1.0.0
|
|
2664
|
-
* @since 2025-09-30
|
|
2665
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2666
|
-
*/
|
|
2667
|
-
declare const HttpHelper: Readonly<{
|
|
2668
|
-
/**
|
|
2669
|
-
* @description A function that masks the IP address in the given headers object.
|
|
2670
|
-
* @param ip The IP address to mask.
|
|
2671
|
-
* @returns The masked IP address.
|
|
2672
|
-
*/
|
|
2673
|
-
readonly maskIp: (ip: Optional<string>) => Optional<string>;
|
|
2674
|
-
/**
|
|
2675
|
-
* @description Normalizes HTTP headers by converting all header values to strings. If a header value is an array, it joins the array elements into a single string separated by commas. This method ensures that the headers are in a consistent format, which can be particularly useful when working with different HTTP client libraries that may represent headers in various ways. If the input headers are not defined or not an object, it returns an empty object.
|
|
2676
|
-
* @param headers The input headers to be normalized, which can be of any type. The method checks if the headers are defined and are an object before processing them.
|
|
2677
|
-
* @returns An object containing the normalized headers, where each header value is a string. If the input headers were not valid, it returns an empty object.
|
|
2678
|
-
|
|
2679
|
-
*
|
|
2680
|
-
* @author Xeno
|
|
2681
|
-
* @version 1.0.0
|
|
2682
|
-
* @since 2025-09-30
|
|
2683
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2684
|
-
*/
|
|
2685
|
-
readonly normalizeHeaders: (headers: unknown) => HttpHeaders;
|
|
2686
|
-
/**
|
|
2687
|
-
* @description Sanitizes the origin URL by parsing it and extracting the origin part. If the URL is not valid or cannot be parsed or does not contain an origin, it returns undefined.
|
|
2688
|
-
* @param url The URL to be sanitized.
|
|
2689
|
-
* @returns The sanitized origin URL or undefined if the URL is not valid or cannot be parsed or does not contain an origin.
|
|
2690
|
-
*
|
|
2691
|
-
*
|
|
2692
|
-
* @author Xeno
|
|
2693
|
-
* @version 1.0.0
|
|
2694
|
-
* @since 2025-09-30
|
|
2695
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2696
|
-
*/
|
|
2697
|
-
readonly sanitizeOriginUrl: (url: Optional<string>) => Optional<string>;
|
|
2698
|
-
/**
|
|
2699
|
-
* @description Generates a standardized successful HTTP response with the provided data, status code, metadata, and custom headers. The response includes a success flag set to true, the data payload, and any additional metadata. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.
|
|
2700
|
-
* @param data The actual data payload to be included in the successful response. This can be of any type and will be wrapped in a SuccessResponseDto structure.
|
|
2701
|
-
* @param status The HTTP status code for the response, defaulting to 200 (OK) if not provided. This allows for flexibility in indicating different types of successful responses (e.g., 201 for created, 204 for no content).
|
|
2702
|
-
* @param meta Optional metadata to be included in the response. This can contain additional information relevant to the response, such as pagination details, rate limit information, or any other contextual data that may be useful for clients consuming the API.
|
|
2703
|
-
* @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific responses, such as caching directives, custom authentication headers, or other relevant information.
|
|
2704
|
-
* @returns A ResponseDto object representing the successful HTTP response, containing the status code, success flag, headers, and data payload structured as a SuccessResponseDto.
|
|
2705
|
-
|
|
2706
|
-
*
|
|
2707
|
-
* @author Xeno
|
|
2708
|
-
* @version 1.0.0
|
|
2709
|
-
* @since 2025-09-30
|
|
2710
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2711
|
-
*/
|
|
2712
|
-
readonly success: <T>(data: T | IPaginatedResult<T>, status?: number, meta?: Dictionary, customHeaders?: HttpHeaders) => ResponseDto<T>;
|
|
2713
|
-
/**
|
|
2714
|
-
* @description Generates a standardized error HTTP response with the provided error details, status code, correlation ID, request ID, timestamp, and custom headers. The response includes a success flag set to false, an error object containing the error code, message, and optional details, as well as metadata such as correlation ID and request ID for tracking purposes. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.
|
|
2715
|
-
* @param dto An object containing the error details, including the error code, message, optional details, and optional path. This information is structured as an ErrorResponseDto and provides context about the error that occurred.
|
|
2716
|
-
* @param status The HTTP status code for the response, defaulting to 500 (Internal Server Error) if not provided. This allows for flexibility in indicating different types of error responses (e.g., 400 for bad request, 404 for not found).
|
|
2717
|
-
* @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific error responses, such as caching directives, custom authentication headers, or other relevant information.
|
|
2718
|
-
* @returns A ResponseDto object representing the error HTTP response, containing the status code, success flag, headers, and data payload structured as an ErrorResponseDto.
|
|
2719
|
-
|
|
2720
|
-
*
|
|
2721
|
-
* @author Xeno
|
|
2722
|
-
* @version 1.0.0
|
|
2723
|
-
* @since 2025-09-30
|
|
2724
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2725
|
-
*/
|
|
2726
|
-
readonly error: <T>(dto: ErrorResponseDto, status?: Optional<number>, customHeaders?: Optional<HttpHeaders>) => ResponseDto<T>;
|
|
2727
|
-
}>;
|
|
2728
|
-
|
|
2729
|
-
/**
|
|
2730
|
-
* @description Namespace for safe mathematical operations.
|
|
2731
|
-
|
|
2732
|
-
*
|
|
2733
|
-
* @author Xeno
|
|
2734
|
-
* @version 1.0.0
|
|
2735
|
-
* @since 2025-09-30
|
|
2736
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2737
|
-
*/
|
|
2738
|
-
declare const MathHelper: Readonly<{
|
|
2739
|
-
/**
|
|
2740
|
-
* @description Constrains a value within an inclusive min-max range.
|
|
2741
|
-
* @param value Input value.
|
|
2742
|
-
* @param min Minimum bound.
|
|
2743
|
-
* @param max Maximum bound.
|
|
2744
|
-
* @returns Clamped value.
|
|
2745
|
-
|
|
2746
|
-
*
|
|
2747
|
-
* @author Xeno
|
|
2748
|
-
* @version 1.0.0
|
|
2749
|
-
* @since 2025-09-30
|
|
2750
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2751
|
-
*/
|
|
2752
|
-
readonly clamp: (value: number, min: number, max: number) => number;
|
|
2753
|
-
/**
|
|
2754
|
-
* @description Rounds a number to the specified decimal precision.
|
|
2755
|
-
* @param value Input value.
|
|
2756
|
-
* @param decimals Number of decimal places.
|
|
2757
|
-
* @returns Rounded value.
|
|
2758
|
-
|
|
2759
|
-
*
|
|
2760
|
-
* @author Xeno
|
|
2761
|
-
* @version 1.0.0
|
|
2762
|
-
* @since 2025-09-30
|
|
2763
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2764
|
-
*/
|
|
2765
|
-
readonly roundTo: (value: number, decimals: number) => number;
|
|
2766
|
-
/**
|
|
2767
|
-
* @description Divides two numbers, returning a safe fallback on zero denominator.
|
|
2768
|
-
* @param numerator Numerator.
|
|
2769
|
-
* @param denominator Denominator.
|
|
2770
|
-
* @param fallback Return value when denominator is zero.
|
|
2771
|
-
* @returns Division result or fallback.
|
|
2772
|
-
|
|
2773
|
-
*
|
|
2774
|
-
* @author Xeno
|
|
2775
|
-
* @version 1.0.0
|
|
2776
|
-
* @since 2025-09-30
|
|
2777
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2778
|
-
*/
|
|
2779
|
-
readonly safeDivide: (numerator: number, denominator: number, fallback?: number) => number;
|
|
2780
|
-
/**
|
|
2781
|
-
* @description Returns the percentage of part over total (0–100 scale).
|
|
2782
|
-
* @param part Part value.
|
|
2783
|
-
* @param total Total value.
|
|
2784
|
-
* @returns Percentage or 0 when total is zero.
|
|
2785
|
-
|
|
2786
|
-
*
|
|
2787
|
-
* @author Xeno
|
|
2788
|
-
* @version 1.0.0
|
|
2789
|
-
* @since 2025-09-30
|
|
2790
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2791
|
-
*/
|
|
2792
|
-
readonly toPercentage: (part: number, total: number) => number;
|
|
2793
|
-
/**
|
|
2794
|
-
* @description Converts a value to a number, returning a fallback for non-numeric inputs.
|
|
2795
|
-
* @param value Input value.
|
|
2796
|
-
* @param fallback Fallback value for non-numeric inputs.
|
|
2797
|
-
* @returns Numeric value or fallback.
|
|
2798
|
-
*
|
|
2799
|
-
* @author Xeno
|
|
2800
|
-
* @version 1.0.0
|
|
2801
|
-
* @since 2025-09-30
|
|
2802
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2803
|
-
*/
|
|
2804
|
-
readonly toNumber: (value: Optional<unknown>, fallback?: number) => number;
|
|
2805
|
-
}>;
|
|
2806
|
-
|
|
2807
|
-
/**
|
|
2808
|
-
* @description Fornisce utilità per la gestione avanzata di Promise, ritardi asincroni e concorrenza.
|
|
2809
|
-
* Astrae le logiche di timing per renderle facilmente testabili e riutilizzabili.
|
|
2810
|
-
|
|
2811
|
-
*
|
|
2812
|
-
* @author Xeno
|
|
2813
|
-
* @version 1.0.0
|
|
2814
|
-
* @since 2025-09-30
|
|
2815
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2816
|
-
*/
|
|
2817
|
-
declare const PromiseHelper: Readonly<{
|
|
2818
|
-
/**
|
|
2819
|
-
* @description Sospende l'esecuzione asincrona per un numero esatto di millisecondi.
|
|
2820
|
-
* @param ms I millisecondi di attesa.
|
|
2821
|
-
* @returns Una Promise che si risolve al termine del tempo.
|
|
2822
|
-
|
|
2823
|
-
*
|
|
2824
|
-
* @author Xeno
|
|
2825
|
-
* @version 1.0.0
|
|
2826
|
-
* @since 2025-09-30
|
|
2827
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2828
|
-
*/
|
|
2829
|
-
readonly delay: (ms: number) => Promise<void>;
|
|
2830
|
-
/**
|
|
2831
|
-
* @description Introduce un ritardo asincrono composto da un tempo base più una variazione casuale.
|
|
2832
|
-
* Fondamentale per mitigare il "Thundering Herd problem" (effetto gregge) distribuendo
|
|
2833
|
-
* nel tempo i retry simultanei di più client.
|
|
2834
|
-
* * @param baseDelayMs Il ritardo minimo garantito.
|
|
2835
|
-
* @param maxJitterMs La variazione massima casuale aggiuntiva.
|
|
2836
|
-
* @returns Una Promise che si risolve al termine del calcolo.
|
|
2837
|
-
|
|
2838
|
-
*
|
|
2839
|
-
* @author Xeno
|
|
2840
|
-
* @version 1.0.0
|
|
2841
|
-
* @since 2025-09-30
|
|
2842
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2843
|
-
*/
|
|
2844
|
-
readonly delayWithJitter: (baseDelayMs: number, maxJitterMs: number) => Promise<void>;
|
|
2845
|
-
}>;
|
|
2846
|
-
|
|
2847
|
-
/**
|
|
2848
|
-
* @description Centralized security utility for data and context sanitization.
|
|
2849
|
-
* Enforces OWASP guidelines preventing Log Injection (CWE-117), CRLF injection,
|
|
2850
|
-
* and URI protocol manipulation across all application layers.
|
|
2851
|
-
*
|
|
2852
|
-
* @author Xeno
|
|
2853
|
-
* @version 1.0.0
|
|
2854
|
-
* @since 2025-09-30
|
|
2855
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2856
|
-
*/
|
|
2857
|
-
declare const SanitizeHelper: Readonly<{
|
|
2858
|
-
/**
|
|
2859
|
-
* @description Removes carriage returns, line feeds, null bytes, and non-printable control characters.
|
|
2860
|
-
* Mitigates Log Forging and Log Injection attacks (CWE-117).
|
|
2861
|
-
* @param value The candidate string to sanitize.
|
|
2862
|
-
* @param maxLength Maximum allowable length after sanitization. Defaults to 256.
|
|
2863
|
-
* @returns Sanitized string or undefined if empty/non-string.
|
|
2864
|
-
*/
|
|
2865
|
-
readonly stripControlChars: (value: Optional<string>, maxLength?: number) => Optional<string>;
|
|
2866
|
-
/**
|
|
2867
|
-
* @description Sanitizes navigation paths and URLs, removing control characters
|
|
2868
|
-
* and preventing execution of dangerous pseudo-protocols (e.g. javascript:, data:).
|
|
2869
|
-
* @param path The path string to sanitize.
|
|
2870
|
-
* @param maxLength Maximum length of the path. Defaults to 512.
|
|
2871
|
-
* @returns Sanitized path or '/' fallback for unsafe inputs.
|
|
2872
|
-
*/
|
|
2873
|
-
readonly sanitizePath: (path: Optional<string>, maxLength?: number) => Optional<string>;
|
|
2874
|
-
/**
|
|
2875
|
-
* @description Sanitizes an array of strings (e.g. roles, permissions, scopes).
|
|
2876
|
-
* Strips control characters, filters out empty entries, and limits collection size.
|
|
2877
|
-
* @param items Array of strings to sanitize.
|
|
2878
|
-
* @param maxItemLength Maximum allowable character length per item. Defaults to 64.
|
|
2879
|
-
* @param maxItems Maximum total number of elements kept. Defaults to 50.
|
|
2880
|
-
* @returns Immutable array of sanitized strings.
|
|
2881
|
-
*/
|
|
2882
|
-
readonly sanitizeStringArray: (items: Optional<string[]>, maxItemLength?: number, maxItems?: number) => Optional<string[]>;
|
|
2883
|
-
}>;
|
|
2884
|
-
|
|
2885
|
-
/**
|
|
2886
|
-
* @description Namespace for string manipulation utilities.
|
|
2887
|
-
|
|
2888
|
-
*
|
|
2889
|
-
* @author Xeno
|
|
2890
|
-
* @version 1.0.0
|
|
2891
|
-
* @since 2025-09-30
|
|
2892
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2893
|
-
*/
|
|
2894
|
-
declare const StringHelper: Readonly<{
|
|
2895
|
-
/**
|
|
2896
|
-
* @description Safely converts a value to a JSON string, falling back to String() on failure.
|
|
2897
|
-
* @param value The value to stringify.
|
|
2898
|
-
* @returns A JSON string representation of the value, or a fallback string if serialization fails.
|
|
2899
|
-
|
|
2900
|
-
*
|
|
2901
|
-
* @author Xeno
|
|
2902
|
-
* @version 1.0.0
|
|
2903
|
-
* @since 2025-09-30
|
|
2904
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2905
|
-
*/
|
|
2906
|
-
readonly safeStringify: <T>(value: T) => string;
|
|
2907
|
-
/**
|
|
2908
|
-
* @description Safely parses a JSON string, returning a fallback value on failure.
|
|
2909
|
-
* @param input The JSON string to parse.
|
|
2910
|
-
* @param fallback Optional fallback value to return if parsing fails.
|
|
2911
|
-
* @returns The parsed value, or the fallback value if parsing fails.
|
|
2912
|
-
|
|
2913
|
-
*
|
|
2914
|
-
* @author Xeno
|
|
2915
|
-
* @version 1.0.0
|
|
2916
|
-
* @since 2025-09-30
|
|
2917
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2918
|
-
*/
|
|
2919
|
-
readonly safeParse: <T = unknown>(input: string, fallback?: Optional<T>) => T | Optional<string>;
|
|
2920
|
-
/**
|
|
2921
|
-
* @description Converts a string to camelCase.
|
|
2922
|
-
* @param input Input string (supports snake_case, kebab-case, or space-separated).
|
|
2923
|
-
* @returns camelCase string.
|
|
2924
|
-
|
|
2925
|
-
*
|
|
2926
|
-
* @author Xeno
|
|
2927
|
-
* @version 1.0.0
|
|
2928
|
-
* @since 2025-09-30
|
|
2929
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2930
|
-
*/
|
|
2931
|
-
readonly camelCase: (input: string) => string;
|
|
2932
|
-
/**
|
|
2933
|
-
* @description Interpolates {{key}} placeholders in a template string.
|
|
2934
|
-
* @param template Template string with {{key}} tokens.
|
|
2935
|
-
* @param vars Key-value substitution map.
|
|
2936
|
-
* @returns Interpolated string with resolved placeholders.
|
|
2937
|
-
|
|
2938
|
-
*
|
|
2939
|
-
* @author Xeno
|
|
2940
|
-
* @version 1.0.0
|
|
2941
|
-
* @since 2025-09-30
|
|
2942
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2943
|
-
*/
|
|
2944
|
-
readonly interpolate: (template: string, vars: Readonly<Dictionary<string | number>>) => string;
|
|
2945
|
-
/**
|
|
2946
|
-
* @description Truncates a string to maxLength, appending a suffix when truncated.
|
|
2947
|
-
* @param input Input string.
|
|
2948
|
-
* @param maxLength Maximum character length including the suffix.
|
|
2949
|
-
* @param suffix Appended suffix on truncation.
|
|
2950
|
-
* @returns Truncated string.
|
|
2951
|
-
|
|
2952
|
-
*
|
|
2953
|
-
* @author Xeno
|
|
2954
|
-
* @version 1.0.0
|
|
2955
|
-
* @since 2025-09-30
|
|
2956
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2957
|
-
*/
|
|
2958
|
-
readonly truncate: (input: string, maxLength: number, suffix?: string) => string;
|
|
2959
|
-
/**
|
|
2960
|
-
* @description Generates a reference code with a prefix, random alphanumeric part, and year.
|
|
2961
|
-
* @param prefix Custom prefix for the reference code (e.g., "TRV" for travel).
|
|
2962
|
-
* @returns Formatted reference code string.
|
|
2963
|
-
|
|
2964
|
-
*
|
|
2965
|
-
* @author Xeno
|
|
2966
|
-
* @version 1.0.0
|
|
2967
|
-
* @since 2025-09-30
|
|
2968
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2969
|
-
*/
|
|
2970
|
-
readonly generateReferenceCode: (prefix: string) => string;
|
|
2971
|
-
/**
|
|
2972
|
-
* @description Extracts a single string value from a header that may be a string or an array of strings.
|
|
2973
|
-
* @param value The header value, which can be a string or an array of strings.
|
|
2974
|
-
* @returns The first string value if it's an array, the string itself if it's a string, or undefined if it's empty or not defined.
|
|
2975
|
-
|
|
2976
|
-
*
|
|
2977
|
-
* @author Xeno
|
|
2978
|
-
* @version 1.0.0
|
|
2979
|
-
* @since 2025-09-30
|
|
2980
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2981
|
-
*/
|
|
2982
|
-
readonly getSingleValue: (value: Optional<string | string[]>, separator?: Optional<string>) => Optional<string>;
|
|
2983
|
-
readonly getSingleValueWithSplit: (value: string, separator: string) => string;
|
|
2984
|
-
}>;
|
|
2985
|
-
|
|
2986
|
-
/**
|
|
2987
|
-
* The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.
|
|
2988
|
-
|
|
2989
|
-
*
|
|
2990
|
-
* @author Xeno
|
|
2991
|
-
* @version 1.0.0
|
|
2992
|
-
* @since 2025-09-30
|
|
2993
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2994
|
-
*/
|
|
2995
|
-
declare abstract class ValueObject<T extends object> implements IValueObject<T> {
|
|
2996
|
-
/** @description The properties of the value object, which are immutable and define the value represented by the value object.
|
|
2997
|
-
*
|
|
2998
|
-
* @author Xeno
|
|
2999
|
-
* @version 1.0.0
|
|
3000
|
-
* @since 2025-09-30
|
|
3001
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3002
|
-
*/
|
|
3003
|
-
protected readonly _props: T;
|
|
3004
|
-
protected constructor(props: T);
|
|
3005
|
-
equals(vo?: Optional<IValueObject<T>>): boolean;
|
|
3006
|
-
getValue(): T;
|
|
3007
|
-
toString(): string;
|
|
3008
|
-
}
|
|
3009
|
-
|
|
3010
|
-
/**
|
|
3011
|
-
* @description AggregateRoot is an abstract class that represents the base class for all aggregate roots in the application. An aggregate root is the root entity of an aggregate, which is a group of related entities and value objects that are treated as a single unit. The AggregateRoot class provides common functionality for managing the state and behavior of aggregate roots, including methods for adding and retrieving uncommitted events, and methods for applying events to the aggregate.
|
|
3012
|
-
*
|
|
3013
|
-
* @author Xeno
|
|
3014
|
-
* @version 1.0.0
|
|
3015
|
-
*/
|
|
3016
|
-
declare abstract class AggregateRoot<TEvent = unknown, TValueObject extends object = object> {
|
|
3017
|
-
readonly id: IValueObject<TValueObject>;
|
|
3018
|
-
private _version;
|
|
3019
|
-
private readonly _uncommittedEvents;
|
|
3020
|
-
/**
|
|
3021
|
-
* @description Constructs a new instance of the AggregateRoot class with the specified ID.
|
|
3022
|
-
* @param {IValueObject<TValueObject>} id - The ID of the aggregate.
|
|
3023
|
-
*/
|
|
3024
|
-
constructor(id: IValueObject<TValueObject>);
|
|
3025
|
-
/**
|
|
3026
|
-
* @description Gets the current version of the aggregate.
|
|
3027
|
-
* @returns {number} The current version of the aggregate.
|
|
3028
|
-
*/
|
|
3029
|
-
get version(): number;
|
|
3030
|
-
/**
|
|
3031
|
-
* @description Gets the uncommitted events of the aggregate.
|
|
3032
|
-
* @returns {readonly IDomainEvent[]} The uncommitted events of the aggregate.
|
|
3033
|
-
*/
|
|
3034
|
-
getUncommittedEvents(): readonly IDomainEvent<TEvent, IValueObject<TValueObject>>[];
|
|
3035
|
-
/**
|
|
3036
|
-
* @description Clears the uncommitted events of the aggregate.
|
|
3037
|
-
*/
|
|
3038
|
-
clearUncommittedEvents(): void;
|
|
3039
|
-
/**
|
|
3040
|
-
* @description Loads the aggregate from a history of domain events.
|
|
3041
|
-
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>[]} history - The history of domain events to load.
|
|
3042
|
-
*/
|
|
3043
|
-
loadFromHistory(history: IDomainEvent<TEvent, IValueObject<TValueObject>>[]): void;
|
|
3044
|
-
/**
|
|
3045
|
-
* @description Raises a domain event and adds it to the uncommitted events list.
|
|
3046
|
-
* @param {Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>} eventData - The data of the domain event to raise.
|
|
3047
|
-
*/
|
|
3048
|
-
protected raise(eventData: Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>): void;
|
|
3049
|
-
/**
|
|
3050
|
-
* @description Applies a domain event to the aggregate root.
|
|
3051
|
-
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>} event - The domain event to apply.
|
|
3052
|
-
* @param {boolean} isNew - Indicates whether the event is new or already committed.
|
|
3053
|
-
*/
|
|
3054
|
-
protected abstract apply(event: IDomainEvent<TEvent, IValueObject<TValueObject>>, isNew: boolean): void;
|
|
3055
|
-
}
|
|
3056
|
-
|
|
3057
|
-
/**
|
|
3058
|
-
* @description Configuration options for the authentication service.
|
|
3059
|
-
* @author Xeno
|
|
3060
|
-
* @version 1.0.0
|
|
3061
|
-
* @since 2025-09-30
|
|
3062
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3063
|
-
*/
|
|
3064
|
-
interface AuthConfig<TOptions = unknown> {
|
|
3065
|
-
/**
|
|
3066
|
-
* @description The URL of the authentication service.
|
|
3067
|
-
* @type {string}
|
|
3068
|
-
*/
|
|
3069
|
-
url: string;
|
|
3070
|
-
/**
|
|
3071
|
-
* @description The key of the authentication service.
|
|
3072
|
-
* @type {string}
|
|
3073
|
-
*/
|
|
3074
|
-
key: string;
|
|
3075
|
-
/**
|
|
3076
|
-
* @description The options of the authentication service.
|
|
3077
|
-
* @type {TOptions}
|
|
3078
|
-
*/
|
|
3079
|
-
opts: Optional<TOptions>;
|
|
3080
|
-
/**
|
|
3081
|
-
* @description The storage options of the authentication service.
|
|
3082
|
-
* @type {StorageOptions}
|
|
3083
|
-
* @default { type: 'local', cookieOpts: {}, storage: null }
|
|
3084
|
-
*/
|
|
3085
|
-
storageOpts: Optional<StorageOptions>;
|
|
3086
|
-
/**
|
|
3087
|
-
* @description The redirect URL of the authentication service.
|
|
3088
|
-
* @type {string}
|
|
3089
|
-
* @default '/'
|
|
3090
|
-
*/
|
|
3091
|
-
redirectTo: Optional<string>;
|
|
3092
|
-
}
|
|
3093
|
-
interface StorageOptions {
|
|
3094
|
-
type: Optional<'local' | 'session' | 'memory' | 'cookie'>;
|
|
3095
|
-
cookieOpts: Optional<CookieOptions>;
|
|
3096
|
-
storage: Optional<IStorage>;
|
|
3097
|
-
}
|
|
3098
|
-
|
|
3099
|
-
/** @description Configuration for Redis integration, including details such as host, port, and credentials. If enabled, the query bus and command bus (in case of idempotency) pipelines will use Redis as the cache system to store and retrieve data efficiently. The configuration includes specific details for Redis integration, such as host, port, and credentials, providing flexibility in how the cache is implemented and used within the application.
|
|
3100
|
-
*
|
|
3101
|
-
* @author Xeno
|
|
3102
|
-
* @version 1.0.0
|
|
3103
|
-
* @since 2025-09-30
|
|
3104
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3105
|
-
*/
|
|
3106
|
-
interface CacheConfig {
|
|
3107
|
-
/** @description Optional configuration for in-memory cache integration. If enabled, the query bus and command bus (in case of idempotency) pipelines will use an in-memory cache system to store and retrieve data efficiently. The configuration includes specific details for in-memory cache integration, providing flexibility in how the cache is implemented and used within the application.
|
|
3108
|
-
*
|
|
3109
|
-
* @author Xeno
|
|
3110
|
-
* @version 1.0.0
|
|
3111
|
-
* @since 2025-09-30
|
|
3112
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3113
|
-
*/
|
|
3114
|
-
inMemory: boolean;
|
|
3115
|
-
/** @description Optional configuration for Redis integration, including details such as host, port, and credentials. If provided and enabled, the application will use Redis as the cache system to store and retrieve data efficiently. The configuration includes specific details for Redis integration, such as host, port, and credentials, providing flexibility in how the cache is implemented and used within the application.
|
|
3116
|
-
*
|
|
3117
|
-
* @author Xeno
|
|
3118
|
-
* @version 1.0.0
|
|
3119
|
-
* @since 2025-09-30
|
|
3120
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3121
|
-
*/
|
|
3122
|
-
redis: Optional<CacheClientConfig>;
|
|
3123
|
-
}
|
|
3124
|
-
/**
|
|
3125
|
-
* @description An interface representing a cache client, which provides methods for getting and setting values in a cache storage. This interface abstracts the underlying cache implementation, allowing for flexibility in choosing different caching solutions (e.g., in-memory, Redis) without affecting the rest of the application.
|
|
3126
|
-
|
|
3127
|
-
*
|
|
3128
|
-
* @author Xeno
|
|
3129
|
-
* @version 1.0.0
|
|
3130
|
-
* @since 2025-09-30
|
|
3131
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3132
|
-
*/
|
|
3133
|
-
interface CacheClientConfig {
|
|
1971
|
+
* @version 1.0.0
|
|
1972
|
+
* @since 2025-09-30
|
|
1973
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1974
|
+
*/
|
|
1975
|
+
readonly isFunction: (value: unknown) => value is (...args: readonly unknown[]) => unknown;
|
|
3134
1976
|
/**
|
|
3135
|
-
* @description
|
|
1977
|
+
* @description Checks value is an array.
|
|
1978
|
+
* @param value Candidate value.
|
|
1979
|
+
* @returns True when value is array.
|
|
3136
1980
|
|
|
3137
1981
|
*
|
|
3138
1982
|
* @author Xeno
|
|
@@ -3140,18 +1984,23 @@ interface CacheClientConfig {
|
|
|
3140
1984
|
* @since 2025-09-30
|
|
3141
1985
|
* @link https://github.com/xeno-js/xeno-js
|
|
3142
1986
|
*/
|
|
3143
|
-
|
|
1987
|
+
readonly isArray: <TValue>(value: unknown) => value is TValue[];
|
|
3144
1988
|
/**
|
|
3145
|
-
* @description
|
|
1989
|
+
* @description Checks value is a Date instance with valid timestamp.
|
|
1990
|
+
* @param value Candidate value.
|
|
1991
|
+
* @returns True when value is valid Date.
|
|
1992
|
+
|
|
3146
1993
|
*
|
|
3147
1994
|
* @author Xeno
|
|
3148
1995
|
* @version 1.0.0
|
|
3149
1996
|
* @since 2025-09-30
|
|
3150
1997
|
* @link https://github.com/xeno-js/xeno-js
|
|
3151
1998
|
*/
|
|
3152
|
-
|
|
1999
|
+
readonly isDate: (value: unknown) => value is Date;
|
|
3153
2000
|
/**
|
|
3154
|
-
* @description
|
|
2001
|
+
* @description Checks value is an Error instance.
|
|
2002
|
+
* @param value Candidate value.
|
|
2003
|
+
* @returns True when value is Error.
|
|
3155
2004
|
|
|
3156
2005
|
*
|
|
3157
2006
|
* @author Xeno
|
|
@@ -3159,8 +2008,11 @@ interface CacheClientConfig {
|
|
|
3159
2008
|
* @since 2025-09-30
|
|
3160
2009
|
* @link https://github.com/xeno-js/xeno-js
|
|
3161
2010
|
*/
|
|
3162
|
-
|
|
3163
|
-
/**
|
|
2011
|
+
readonly isError: (value: unknown) => value is Error;
|
|
2012
|
+
/**
|
|
2013
|
+
* @description Checks value is a plain object record.
|
|
2014
|
+
* @param value Candidate value.
|
|
2015
|
+
* @returns True when value is object record.
|
|
3164
2016
|
|
|
3165
2017
|
*
|
|
3166
2018
|
* @author Xeno
|
|
@@ -3168,28 +2020,36 @@ interface CacheClientConfig {
|
|
|
3168
2020
|
* @since 2025-09-30
|
|
3169
2021
|
* @link https://github.com/xeno-js/xeno-js
|
|
3170
2022
|
*/
|
|
3171
|
-
|
|
3172
|
-
/**
|
|
2023
|
+
readonly isObjectRecord: (value: unknown) => value is Readonly<Dictionary<unknown>>;
|
|
2024
|
+
/**
|
|
2025
|
+
* @description Checks value is an object (not null).
|
|
2026
|
+
* @param value Candidate value.
|
|
2027
|
+
* @returns True when value is object.
|
|
2028
|
+
|
|
3173
2029
|
*
|
|
3174
2030
|
* @author Xeno
|
|
3175
2031
|
* @version 1.0.0
|
|
3176
2032
|
* @since 2025-09-30
|
|
3177
2033
|
* @link https://github.com/xeno-js/xeno-js
|
|
3178
2034
|
*/
|
|
3179
|
-
|
|
3180
|
-
/**
|
|
2035
|
+
readonly isObject: (value: unknown) => value is object;
|
|
2036
|
+
/**
|
|
2037
|
+
* @description Checks value is PromiseLike.
|
|
2038
|
+
* @param value Candidate value.
|
|
2039
|
+
* @returns True when value has then function.
|
|
2040
|
+
|
|
3181
2041
|
*
|
|
3182
2042
|
* @author Xeno
|
|
3183
2043
|
* @version 1.0.0
|
|
3184
2044
|
* @since 2025-09-30
|
|
3185
2045
|
* @link https://github.com/xeno-js/xeno-js
|
|
3186
2046
|
*/
|
|
3187
|
-
|
|
3188
|
-
}
|
|
2047
|
+
readonly isPromiseLike: <TValue>(value: unknown) => value is PromiseLike<TValue>;
|
|
2048
|
+
}>;
|
|
3189
2049
|
|
|
3190
2050
|
/**
|
|
3191
|
-
* @
|
|
3192
|
-
*
|
|
2051
|
+
* @fileoverview Utility functions for generating and validating GUIDs (UUID v4).
|
|
2052
|
+
* This module provides a simple interface for working with GUIDs, including generation and validation.
|
|
3193
2053
|
|
|
3194
2054
|
*
|
|
3195
2055
|
* @author Xeno
|
|
@@ -3197,182 +2057,306 @@ interface CacheClientConfig {
|
|
|
3197
2057
|
* @since 2025-09-30
|
|
3198
2058
|
* @link https://github.com/xeno-js/xeno-js
|
|
3199
2059
|
*/
|
|
3200
|
-
|
|
3201
|
-
/**
|
|
2060
|
+
declare const GuidHelper: Readonly<{
|
|
2061
|
+
/**
|
|
2062
|
+
* @description Generates a cryptographically-random UUID v4.
|
|
2063
|
+
* @returns Lowercase UUID v4 string.
|
|
2064
|
+
|
|
3202
2065
|
*
|
|
3203
2066
|
* @author Xeno
|
|
3204
2067
|
* @version 1.0.0
|
|
3205
2068
|
* @since 2025-09-30
|
|
3206
2069
|
* @link https://github.com/xeno-js/xeno-js
|
|
3207
2070
|
*/
|
|
3208
|
-
|
|
3209
|
-
/**
|
|
2071
|
+
readonly generate: () => Guid;
|
|
2072
|
+
/**
|
|
2073
|
+
* @description Validates if a value is a valid GUID (UUID v4) and not empty.
|
|
2074
|
+
* @param value The value to validate.
|
|
2075
|
+
* @returns True if the value is a valid and non-empty GUID, false otherwise.
|
|
2076
|
+
|
|
3210
2077
|
*
|
|
3211
2078
|
* @author Xeno
|
|
3212
2079
|
* @version 1.0.0
|
|
3213
2080
|
* @since 2025-09-30
|
|
3214
2081
|
* @link https://github.com/xeno-js/xeno-js
|
|
3215
2082
|
*/
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
*
|
|
3223
|
-
* @author Xeno
|
|
3224
|
-
* @version 1.0.0
|
|
3225
|
-
* @since 2025-09-30
|
|
3226
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3227
|
-
*/
|
|
3228
|
-
interface HttpClientConfig {
|
|
3229
|
-
/** @description Optional default headers to include in every request made by the HTTP client.
|
|
2083
|
+
readonly isValidGuid: (value: Guid) => boolean;
|
|
2084
|
+
/**
|
|
2085
|
+
* @description Validates if a string is a valid UUID v4.
|
|
2086
|
+
* @param value Candidate string to validate.
|
|
2087
|
+
* @returns True if the string is a valid UUID v4, false otherwise.
|
|
2088
|
+
|
|
3230
2089
|
*
|
|
3231
2090
|
* @author Xeno
|
|
3232
2091
|
* @version 1.0.0
|
|
3233
2092
|
* @since 2025-09-30
|
|
3234
2093
|
* @link https://github.com/xeno-js/xeno-js
|
|
3235
2094
|
*/
|
|
3236
|
-
|
|
3237
|
-
/**
|
|
2095
|
+
readonly isValid: (value: string) => value is Guid;
|
|
2096
|
+
/**
|
|
2097
|
+
* @description Converts a string to a GUID if it's valid.
|
|
2098
|
+
* @param value The string to convert.
|
|
2099
|
+
* @returns The GUID if the string is valid, otherwise undefined.
|
|
2100
|
+
|
|
3238
2101
|
*
|
|
3239
2102
|
* @author Xeno
|
|
3240
2103
|
* @version 1.0.0
|
|
3241
2104
|
* @since 2025-09-30
|
|
3242
2105
|
* @link https://github.com/xeno-js/xeno-js
|
|
3243
2106
|
*/
|
|
3244
|
-
|
|
3245
|
-
/**
|
|
2107
|
+
readonly parse: (value: Optional<string>) => Optional<Guid>;
|
|
2108
|
+
/**
|
|
2109
|
+
* @description Checks if a GUID is the empty GUID (all zeros).
|
|
2110
|
+
* @param value The GUID to check.
|
|
2111
|
+
* @returns True if the GUID is the empty GUID, false otherwise.
|
|
2112
|
+
|
|
3246
2113
|
*
|
|
3247
2114
|
* @author Xeno
|
|
3248
2115
|
* @version 1.0.0
|
|
3249
2116
|
* @since 2025-09-30
|
|
3250
2117
|
* @link https://github.com/xeno-js/xeno-js
|
|
3251
2118
|
*/
|
|
3252
|
-
|
|
3253
|
-
|
|
2119
|
+
readonly isEmpty: (value: string) => boolean;
|
|
2120
|
+
}>;
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* @description This module provides utility functions for handling HTTP-related tasks, such as normalizing HTTP headers. It includes a single function, `normalizeHeaders`, which takes an input of unknown type and returns an object with normalized header values. The function ensures that all header values are converted to strings, and if a header value is an array, it joins the elements into a single string separated by commas. This utility is useful for ensuring consistent header formats when working with various HTTP client libraries.
|
|
2124
|
+
|
|
2125
|
+
*
|
|
2126
|
+
* @author Xeno
|
|
2127
|
+
* @version 1.0.0
|
|
2128
|
+
* @since 2025-09-30
|
|
2129
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2130
|
+
*/
|
|
2131
|
+
/**
|
|
2132
|
+
* @description A helper object that provides utility functions for HTTP-related tasks. Currently, it includes a method for normalizing HTTP headers, which ensures that all header values are strings and handles cases where header values may be arrays. This helper can be extended in the future to include additional HTTP-related utilities as needed.
|
|
2133
|
+
|
|
2134
|
+
*
|
|
2135
|
+
* @author Xeno
|
|
2136
|
+
* @version 1.0.0
|
|
2137
|
+
* @since 2025-09-30
|
|
2138
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2139
|
+
*/
|
|
2140
|
+
declare const HttpHelper: Readonly<{
|
|
2141
|
+
/**
|
|
2142
|
+
* @description A function that masks the IP address in the given headers object.
|
|
2143
|
+
* @param ip The IP address to mask.
|
|
2144
|
+
* @returns The masked IP address.
|
|
2145
|
+
*/
|
|
2146
|
+
readonly maskIp: (ip: Optional<string>) => Optional<string>;
|
|
2147
|
+
/**
|
|
2148
|
+
* @description Normalizes HTTP headers by converting all header values to strings. If a header value is an array, it joins the array elements into a single string separated by commas. This method ensures that the headers are in a consistent format, which can be particularly useful when working with different HTTP client libraries that may represent headers in various ways. If the input headers are not defined or not an object, it returns an empty object.
|
|
2149
|
+
* @param headers The input headers to be normalized, which can be of any type. The method checks if the headers are defined and are an object before processing them.
|
|
2150
|
+
* @returns An object containing the normalized headers, where each header value is a string. If the input headers were not valid, it returns an empty object.
|
|
2151
|
+
|
|
3254
2152
|
*
|
|
3255
2153
|
* @author Xeno
|
|
3256
2154
|
* @version 1.0.0
|
|
3257
2155
|
* @since 2025-09-30
|
|
3258
2156
|
* @link https://github.com/xeno-js/xeno-js
|
|
3259
2157
|
*/
|
|
3260
|
-
|
|
3261
|
-
/**
|
|
2158
|
+
readonly normalizeHeaders: (headers: unknown) => HttpHeaders;
|
|
2159
|
+
/**
|
|
2160
|
+
* @description Sanitizes the origin URL by parsing it and extracting the origin part. If the URL is not valid or cannot be parsed or does not contain an origin, it returns undefined.
|
|
2161
|
+
* @param url The URL to be sanitized.
|
|
2162
|
+
* @returns The sanitized origin URL or undefined if the URL is not valid or cannot be parsed or does not contain an origin.
|
|
2163
|
+
*
|
|
3262
2164
|
*
|
|
3263
2165
|
* @author Xeno
|
|
3264
2166
|
* @version 1.0.0
|
|
3265
2167
|
* @since 2025-09-30
|
|
3266
2168
|
* @link https://github.com/xeno-js/xeno-js
|
|
3267
2169
|
*/
|
|
3268
|
-
|
|
2170
|
+
readonly sanitizeOriginUrl: (url: Optional<string>) => Optional<string>;
|
|
3269
2171
|
/**
|
|
3270
|
-
* @description
|
|
2172
|
+
* @description Generates a standardized successful HTTP response with the provided data, status code, metadata, and custom headers. The response includes a success flag set to true, the data payload, and any additional metadata. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.
|
|
2173
|
+
* @param data The actual data payload to be included in the successful response. This can be of any type and will be wrapped in a SuccessResponseDto structure.
|
|
2174
|
+
* @param status The HTTP status code for the response, defaulting to 200 (OK) if not provided. This allows for flexibility in indicating different types of successful responses (e.g., 201 for created, 204 for no content).
|
|
2175
|
+
* @param meta Optional metadata to be included in the response. This can contain additional information relevant to the response, such as pagination details, rate limit information, or any other contextual data that may be useful for clients consuming the API.
|
|
2176
|
+
* @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific responses, such as caching directives, custom authentication headers, or other relevant information.
|
|
2177
|
+
* @returns A ResponseDto object representing the successful HTTP response, containing the status code, success flag, headers, and data payload structured as a SuccessResponseDto.
|
|
2178
|
+
|
|
3271
2179
|
*
|
|
3272
2180
|
* @author Xeno
|
|
3273
2181
|
* @version 1.0.0
|
|
3274
2182
|
* @since 2025-09-30
|
|
3275
2183
|
* @link https://github.com/xeno-js/xeno-js
|
|
3276
2184
|
*/
|
|
3277
|
-
|
|
2185
|
+
readonly success: <T>(data: T | IPaginatedResult<T>, status?: number, meta?: Dictionary, customHeaders?: HttpHeaders) => ResponseDto<T>;
|
|
3278
2186
|
/**
|
|
3279
|
-
* @description
|
|
2187
|
+
* @description Generates a standardized error HTTP response with the provided error details, status code, correlation ID, request ID, timestamp, and custom headers. The response includes a success flag set to false, an error object containing the error code, message, and optional details, as well as metadata such as correlation ID and request ID for tracking purposes. The headers include a default 'Content-Type' of 'application/json' along with any custom headers provided.
|
|
2188
|
+
* @param dto An object containing the error details, including the error code, message, optional details, and optional path. This information is structured as an ErrorResponseDto and provides context about the error that occurred.
|
|
2189
|
+
* @param status The HTTP status code for the response, defaulting to 500 (Internal Server Error) if not provided. This allows for flexibility in indicating different types of error responses (e.g., 400 for bad request, 404 for not found).
|
|
2190
|
+
* @param customHeaders Optional custom HTTP headers to be included in the response. This allows for adding any additional headers that may be necessary for specific error responses, such as caching directives, custom authentication headers, or other relevant information.
|
|
2191
|
+
* @returns A ResponseDto object representing the error HTTP response, containing the status code, success flag, headers, and data payload structured as an ErrorResponseDto.
|
|
2192
|
+
|
|
3280
2193
|
*
|
|
3281
2194
|
* @author Xeno
|
|
3282
2195
|
* @version 1.0.0
|
|
3283
2196
|
* @since 2025-09-30
|
|
3284
2197
|
* @link https://github.com/xeno-js/xeno-js
|
|
3285
2198
|
*/
|
|
3286
|
-
|
|
2199
|
+
readonly error: <T>(dto: ErrorResponseDto, status?: Optional<number>, customHeaders?: Optional<HttpHeaders>) => ResponseDto<T>;
|
|
2200
|
+
}>;
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* @description Namespace for safe mathematical operations.
|
|
2204
|
+
|
|
2205
|
+
*
|
|
2206
|
+
* @author Xeno
|
|
2207
|
+
* @version 1.0.0
|
|
2208
|
+
* @since 2025-09-30
|
|
2209
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2210
|
+
*/
|
|
2211
|
+
declare const MathHelper: Readonly<{
|
|
3287
2212
|
/**
|
|
3288
|
-
* @description
|
|
2213
|
+
* @description Constrains a value within an inclusive min-max range.
|
|
2214
|
+
* @param value Input value.
|
|
2215
|
+
* @param min Minimum bound.
|
|
2216
|
+
* @param max Maximum bound.
|
|
2217
|
+
* @returns Clamped value.
|
|
2218
|
+
|
|
2219
|
+
*
|
|
2220
|
+
* @author Xeno
|
|
2221
|
+
* @version 1.0.0
|
|
2222
|
+
* @since 2025-09-30
|
|
2223
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3289
2224
|
*/
|
|
3290
|
-
|
|
2225
|
+
readonly clamp: (value: number, min: number, max: number) => number;
|
|
3291
2226
|
/**
|
|
3292
|
-
* @description
|
|
2227
|
+
* @description Rounds a number to the specified decimal precision.
|
|
2228
|
+
* @param value Input value.
|
|
2229
|
+
* @param decimals Number of decimal places.
|
|
2230
|
+
* @returns Rounded value.
|
|
2231
|
+
|
|
3293
2232
|
*
|
|
3294
2233
|
* @author Xeno
|
|
3295
2234
|
* @version 1.0.0
|
|
3296
2235
|
* @since 2025-09-30
|
|
3297
2236
|
* @link https://github.com/xeno-js/xeno-js
|
|
3298
2237
|
*/
|
|
3299
|
-
|
|
3300
|
-
}
|
|
3301
|
-
/**
|
|
3302
|
-
* @description Configuration interface for HTTP client settings, defining parameters such as timeouts, headers, and proxy configurations.
|
|
3303
|
-
*
|
|
3304
|
-
* @author Xeno
|
|
3305
|
-
* @version 1.0.0
|
|
3306
|
-
* @since 2025-09-30
|
|
3307
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3308
|
-
*/
|
|
3309
|
-
interface ProxyConfig {
|
|
2238
|
+
readonly roundTo: (value: number, decimals: number) => number;
|
|
3310
2239
|
/**
|
|
3311
|
-
* @description
|
|
2240
|
+
* @description Divides two numbers, returning a safe fallback on zero denominator.
|
|
2241
|
+
* @param numerator Numerator.
|
|
2242
|
+
* @param denominator Denominator.
|
|
2243
|
+
* @param fallback Return value when denominator is zero.
|
|
2244
|
+
* @returns Division result or fallback.
|
|
2245
|
+
|
|
3312
2246
|
*
|
|
3313
2247
|
* @author Xeno
|
|
3314
2248
|
* @version 1.0.0
|
|
3315
2249
|
* @since 2025-09-30
|
|
3316
2250
|
* @link https://github.com/xeno-js/xeno-js
|
|
3317
2251
|
*/
|
|
3318
|
-
|
|
2252
|
+
readonly safeDivide: (numerator: number, denominator: number, fallback?: number) => number;
|
|
3319
2253
|
/**
|
|
3320
|
-
* @description
|
|
2254
|
+
* @description Returns the percentage of part over total (0–100 scale).
|
|
2255
|
+
* @param part Part value.
|
|
2256
|
+
* @param total Total value.
|
|
2257
|
+
* @returns Percentage or 0 when total is zero.
|
|
2258
|
+
|
|
3321
2259
|
*
|
|
3322
2260
|
* @author Xeno
|
|
3323
2261
|
* @version 1.0.0
|
|
3324
2262
|
* @since 2025-09-30
|
|
3325
2263
|
* @link https://github.com/xeno-js/xeno-js
|
|
3326
2264
|
*/
|
|
3327
|
-
|
|
2265
|
+
readonly toPercentage: (part: number, total: number) => number;
|
|
3328
2266
|
/**
|
|
3329
|
-
* @description
|
|
2267
|
+
* @description Converts a value to a number, returning a fallback for non-numeric inputs.
|
|
2268
|
+
* @param value Input value.
|
|
2269
|
+
* @param fallback Fallback value for non-numeric inputs.
|
|
2270
|
+
* @returns Numeric value or fallback.
|
|
2271
|
+
*
|
|
2272
|
+
* @author Xeno
|
|
2273
|
+
* @version 1.0.0
|
|
2274
|
+
* @since 2025-09-30
|
|
2275
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2276
|
+
*/
|
|
2277
|
+
readonly toNumber: (value: Optional<unknown>, fallback?: number) => number;
|
|
2278
|
+
}>;
|
|
2279
|
+
|
|
2280
|
+
/**
|
|
2281
|
+
* @description Fornisce utilità per la gestione avanzata di Promise, ritardi asincroni e concorrenza.
|
|
2282
|
+
* Astrae le logiche di timing per renderle facilmente testabili e riutilizzabili.
|
|
2283
|
+
|
|
2284
|
+
*
|
|
2285
|
+
* @author Xeno
|
|
2286
|
+
* @version 1.0.0
|
|
2287
|
+
* @since 2025-09-30
|
|
2288
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2289
|
+
*/
|
|
2290
|
+
declare const PromiseHelper: Readonly<{
|
|
2291
|
+
/**
|
|
2292
|
+
* @description Sospende l'esecuzione asincrona per un numero esatto di millisecondi.
|
|
2293
|
+
* @param ms I millisecondi di attesa.
|
|
2294
|
+
* @returns Una Promise che si risolve al termine del tempo.
|
|
2295
|
+
|
|
3330
2296
|
*
|
|
3331
2297
|
* @author Xeno
|
|
3332
2298
|
* @version 1.0.0
|
|
3333
2299
|
* @since 2025-09-30
|
|
3334
2300
|
* @link https://github.com/xeno-js/xeno-js
|
|
3335
2301
|
*/
|
|
3336
|
-
|
|
3337
|
-
/**
|
|
3338
|
-
* @description The username for the proxy server.
|
|
3339
|
-
*
|
|
3340
|
-
* @author Xeno
|
|
3341
|
-
* @version 1.0.0
|
|
3342
|
-
* @since 2025-09-30
|
|
3343
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3344
|
-
*/
|
|
3345
|
-
username: string;
|
|
3346
|
-
/**
|
|
3347
|
-
* @description The password for the proxy server.
|
|
3348
|
-
*
|
|
3349
|
-
* @author Xeno
|
|
3350
|
-
* @version 1.0.0
|
|
3351
|
-
* @since 2025-09-30
|
|
3352
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3353
|
-
*/
|
|
3354
|
-
password: string;
|
|
3355
|
-
};
|
|
2302
|
+
readonly delay: (ms: number) => Promise<void>;
|
|
3356
2303
|
/**
|
|
3357
|
-
* @description
|
|
2304
|
+
* @description Introduce un ritardo asincrono composto da un tempo base più una variazione casuale.
|
|
2305
|
+
* Fondamentale per mitigare il "Thundering Herd problem" (effetto gregge) distribuendo
|
|
2306
|
+
* nel tempo i retry simultanei di più client.
|
|
2307
|
+
* * @param baseDelayMs Il ritardo minimo garantito.
|
|
2308
|
+
* @param maxJitterMs La variazione massima casuale aggiuntiva.
|
|
2309
|
+
* @returns Una Promise che si risolve al termine del calcolo.
|
|
2310
|
+
|
|
3358
2311
|
*
|
|
3359
2312
|
* @author Xeno
|
|
3360
2313
|
* @version 1.0.0
|
|
3361
2314
|
* @since 2025-09-30
|
|
2315
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3362
2316
|
*/
|
|
3363
|
-
|
|
3364
|
-
}
|
|
2317
|
+
readonly delayWithJitter: (baseDelayMs: number, maxJitterMs: number) => Promise<void>;
|
|
2318
|
+
}>;
|
|
3365
2319
|
|
|
3366
2320
|
/**
|
|
3367
|
-
* @
|
|
2321
|
+
* @description Centralized security utility for data and context sanitization.
|
|
2322
|
+
* Enforces OWASP guidelines preventing Log Injection (CWE-117), CRLF injection,
|
|
2323
|
+
* and URI protocol manipulation across all application layers.
|
|
3368
2324
|
*
|
|
3369
2325
|
* @author Xeno
|
|
3370
2326
|
* @version 1.0.0
|
|
3371
2327
|
* @since 2025-09-30
|
|
3372
2328
|
* @link https://github.com/xeno-js/xeno-js
|
|
3373
2329
|
*/
|
|
2330
|
+
declare const SanitizeHelper: Readonly<{
|
|
2331
|
+
/**
|
|
2332
|
+
* @description Removes carriage returns, line feeds, null bytes, and non-printable control characters.
|
|
2333
|
+
* Mitigates Log Forging and Log Injection attacks (CWE-117).
|
|
2334
|
+
* @param value The candidate string to sanitize.
|
|
2335
|
+
* @param maxLength Maximum allowable length after sanitization. Defaults to 256.
|
|
2336
|
+
* @returns Sanitized string or undefined if empty/non-string.
|
|
2337
|
+
*/
|
|
2338
|
+
readonly stripControlChars: (value: Optional<string>, maxLength?: number) => Optional<string>;
|
|
2339
|
+
/**
|
|
2340
|
+
* @description Sanitizes navigation paths and URLs, removing control characters
|
|
2341
|
+
* and preventing execution of dangerous pseudo-protocols (e.g. javascript:, data:).
|
|
2342
|
+
* @param path The path string to sanitize.
|
|
2343
|
+
* @param maxLength Maximum length of the path. Defaults to 512.
|
|
2344
|
+
* @returns Sanitized path or '/' fallback for unsafe inputs.
|
|
2345
|
+
*/
|
|
2346
|
+
readonly sanitizePath: (path: Optional<string>, maxLength?: number) => Optional<string>;
|
|
2347
|
+
/**
|
|
2348
|
+
* @description Sanitizes an array of strings (e.g. roles, permissions, scopes).
|
|
2349
|
+
* Strips control characters, filters out empty entries, and limits collection size.
|
|
2350
|
+
* @param items Array of strings to sanitize.
|
|
2351
|
+
* @param maxItemLength Maximum allowable character length per item. Defaults to 64.
|
|
2352
|
+
* @param maxItems Maximum total number of elements kept. Defaults to 50.
|
|
2353
|
+
* @returns Immutable array of sanitized strings.
|
|
2354
|
+
*/
|
|
2355
|
+
readonly sanitizeStringArray: (items: Optional<string[]>, maxItemLength?: number, maxItems?: number) => Optional<string[]>;
|
|
2356
|
+
}>;
|
|
2357
|
+
|
|
3374
2358
|
/**
|
|
3375
|
-
*
|
|
2359
|
+
* @description Namespace for string manipulation utilities.
|
|
3376
2360
|
|
|
3377
2361
|
*
|
|
3378
2362
|
* @author Xeno
|
|
@@ -3380,11 +2364,11 @@ interface ProxyConfig {
|
|
|
3380
2364
|
* @since 2025-09-30
|
|
3381
2365
|
* @link https://github.com/xeno-js/xeno-js
|
|
3382
2366
|
*/
|
|
3383
|
-
|
|
2367
|
+
declare const StringHelper: Readonly<{
|
|
3384
2368
|
/**
|
|
3385
|
-
*
|
|
3386
|
-
* @param
|
|
3387
|
-
* @returns
|
|
2369
|
+
* @description Safely converts a value to a JSON string, falling back to String() on failure.
|
|
2370
|
+
* @param value The value to stringify.
|
|
2371
|
+
* @returns A JSON string representation of the value, or a fallback string if serialization fails.
|
|
3388
2372
|
|
|
3389
2373
|
*
|
|
3390
2374
|
* @author Xeno
|
|
@@ -3392,12 +2376,12 @@ interface ICache {
|
|
|
3392
2376
|
* @since 2025-09-30
|
|
3393
2377
|
* @link https://github.com/xeno-js/xeno-js
|
|
3394
2378
|
*/
|
|
3395
|
-
|
|
2379
|
+
readonly safeStringify: <T>(value: T) => string;
|
|
3396
2380
|
/**
|
|
3397
|
-
*
|
|
3398
|
-
* @param
|
|
3399
|
-
* @param
|
|
3400
|
-
* @
|
|
2381
|
+
* @description Safely parses a JSON string, returning a fallback value on failure.
|
|
2382
|
+
* @param input The JSON string to parse.
|
|
2383
|
+
* @param fallback Optional fallback value to return if parsing fails.
|
|
2384
|
+
* @returns The parsed value, or the fallback value if parsing fails.
|
|
3401
2385
|
|
|
3402
2386
|
*
|
|
3403
2387
|
* @author Xeno
|
|
@@ -3405,13 +2389,11 @@ interface ICache {
|
|
|
3405
2389
|
* @since 2025-09-30
|
|
3406
2390
|
* @link https://github.com/xeno-js/xeno-js
|
|
3407
2391
|
*/
|
|
3408
|
-
|
|
2392
|
+
readonly safeParse: <T = unknown>(input: string, fallback?: Optional<T>) => T | Optional<string>;
|
|
3409
2393
|
/**
|
|
3410
|
-
*
|
|
3411
|
-
* @param
|
|
3412
|
-
* @
|
|
3413
|
-
* @param ttl Optional time-to-live (TTL) in milliseconds, indicating how long the value should remain in the cache before it expires. If not provided, the value will be stored indefinitely.
|
|
3414
|
-
* @returns True if the value was successfully stored in the cache because the key did not already exist; otherwise, returns false if the key already exists in the cache and the value was not set.
|
|
2394
|
+
* @description Converts a string to camelCase.
|
|
2395
|
+
* @param input Input string (supports snake_case, kebab-case, or space-separated).
|
|
2396
|
+
* @returns camelCase string.
|
|
3415
2397
|
|
|
3416
2398
|
*
|
|
3417
2399
|
* @author Xeno
|
|
@@ -3419,10 +2401,12 @@ interface ICache {
|
|
|
3419
2401
|
* @since 2025-09-30
|
|
3420
2402
|
* @link https://github.com/xeno-js/xeno-js
|
|
3421
2403
|
*/
|
|
3422
|
-
|
|
2404
|
+
readonly camelCase: (input: string) => string;
|
|
3423
2405
|
/**
|
|
3424
|
-
*
|
|
3425
|
-
* @param
|
|
2406
|
+
* @description Interpolates {{key}} placeholders in a template string.
|
|
2407
|
+
* @param template Template string with {{key}} tokens.
|
|
2408
|
+
* @param vars Key-value substitution map.
|
|
2409
|
+
* @returns Interpolated string with resolved placeholders.
|
|
3426
2410
|
|
|
3427
2411
|
*
|
|
3428
2412
|
* @author Xeno
|
|
@@ -3430,11 +2414,13 @@ interface ICache {
|
|
|
3430
2414
|
* @since 2025-09-30
|
|
3431
2415
|
* @link https://github.com/xeno-js/xeno-js
|
|
3432
2416
|
*/
|
|
3433
|
-
|
|
2417
|
+
readonly interpolate: (template: string, vars: Readonly<Dictionary<string | number>>) => string;
|
|
3434
2418
|
/**
|
|
3435
|
-
*
|
|
3436
|
-
* @param
|
|
3437
|
-
* @
|
|
2419
|
+
* @description Truncates a string to maxLength, appending a suffix when truncated.
|
|
2420
|
+
* @param input Input string.
|
|
2421
|
+
* @param maxLength Maximum character length including the suffix.
|
|
2422
|
+
* @param suffix Appended suffix on truncation.
|
|
2423
|
+
* @returns Truncated string.
|
|
3438
2424
|
|
|
3439
2425
|
*
|
|
3440
2426
|
* @author Xeno
|
|
@@ -3442,9 +2428,11 @@ interface ICache {
|
|
|
3442
2428
|
* @since 2025-09-30
|
|
3443
2429
|
* @link https://github.com/xeno-js/xeno-js
|
|
3444
2430
|
*/
|
|
3445
|
-
|
|
2431
|
+
readonly truncate: (input: string, maxLength: number, suffix?: string) => string;
|
|
3446
2432
|
/**
|
|
3447
|
-
*
|
|
2433
|
+
* @description Generates a reference code with a prefix, random alphanumeric part, and year.
|
|
2434
|
+
* @param prefix Custom prefix for the reference code (e.g., "TRV" for travel).
|
|
2435
|
+
* @returns Formatted reference code string.
|
|
3448
2436
|
|
|
3449
2437
|
*
|
|
3450
2438
|
* @author Xeno
|
|
@@ -3452,114 +2440,162 @@ interface ICache {
|
|
|
3452
2440
|
* @since 2025-09-30
|
|
3453
2441
|
* @link https://github.com/xeno-js/xeno-js
|
|
3454
2442
|
*/
|
|
3455
|
-
|
|
3456
|
-
}
|
|
3457
|
-
|
|
3458
|
-
/**
|
|
3459
|
-
* @interface ICacheKeyBuilder
|
|
3460
|
-
* @description Interface for building cache keys with contextual information.
|
|
3461
|
-
*
|
|
3462
|
-
* @author Xeno
|
|
3463
|
-
* @version 1.0.0
|
|
3464
|
-
* @since 2025-09-30
|
|
3465
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3466
|
-
*/
|
|
3467
|
-
interface ICacheKeyBuilder {
|
|
2443
|
+
readonly generateReferenceCode: (prefix: string) => string;
|
|
3468
2444
|
/**
|
|
3469
|
-
* @description
|
|
3470
|
-
* @param
|
|
3471
|
-
* @returns The
|
|
2445
|
+
* @description Extracts a single string value from a header that may be a string or an array of strings.
|
|
2446
|
+
* @param value The header value, which can be a string or an array of strings.
|
|
2447
|
+
* @returns The first string value if it's an array, the string itself if it's a string, or undefined if it's empty or not defined.
|
|
2448
|
+
|
|
3472
2449
|
*
|
|
3473
2450
|
* @author Xeno
|
|
3474
2451
|
* @version 1.0.0
|
|
3475
2452
|
* @since 2025-09-30
|
|
3476
2453
|
* @link https://github.com/xeno-js/xeno-js
|
|
3477
2454
|
*/
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
2455
|
+
readonly getSingleValue: (value: Optional<string | string[]>, separator?: Optional<string>) => Optional<string>;
|
|
2456
|
+
readonly getSingleValueWithSplit: (value: string, separator: string) => string;
|
|
2457
|
+
}>;
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* The ValueObject class is an abstract implementation of the IValueObject interface, providing a base class for creating value objects in the domain. A value object is an immutable type that represents a concept or measurement in the domain, and its equality is based on its properties rather than its identity. The ValueObject class includes a constructor that initializes the properties of the value object and an equals method that compares two value objects for equality based on their properties.
|
|
2461
|
+
|
|
2462
|
+
*
|
|
2463
|
+
* @author Xeno
|
|
2464
|
+
* @version 1.0.0
|
|
2465
|
+
* @since 2025-09-30
|
|
2466
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2467
|
+
*/
|
|
2468
|
+
declare abstract class ValueObject<T extends object> implements IValueObject<T> {
|
|
2469
|
+
/** @description The properties of the value object, which are immutable and define the value represented by the value object.
|
|
3483
2470
|
*
|
|
3484
2471
|
* @author Xeno
|
|
3485
2472
|
* @version 1.0.0
|
|
3486
2473
|
* @since 2025-09-30
|
|
3487
2474
|
* @link https://github.com/xeno-js/xeno-js
|
|
3488
2475
|
*/
|
|
3489
|
-
|
|
2476
|
+
protected readonly _props: T;
|
|
2477
|
+
protected constructor(props: T);
|
|
2478
|
+
equals(vo?: Optional<IValueObject<T>>): boolean;
|
|
2479
|
+
getValue(): T;
|
|
2480
|
+
toString(): string;
|
|
3490
2481
|
}
|
|
3491
2482
|
|
|
3492
2483
|
/**
|
|
3493
|
-
* @description
|
|
3494
|
-
* This interface defines the contract for a configuration service that provides methods to retrieve configuration values.
|
|
2484
|
+
* @description AggregateRoot is an abstract class that represents the base class for all aggregate roots in the application. An aggregate root is the root entity of an aggregate, which is a group of related entities and value objects that are treated as a single unit. The AggregateRoot class provides common functionality for managing the state and behavior of aggregate roots, including methods for adding and retrieving uncommitted events, and methods for applying events to the aggregate.
|
|
3495
2485
|
*
|
|
3496
2486
|
* @author Xeno
|
|
3497
2487
|
* @version 1.0.0
|
|
2488
|
+
*/
|
|
2489
|
+
declare abstract class AggregateRoot<TEvent = unknown, TValueObject extends object = object> {
|
|
2490
|
+
readonly id: IValueObject<TValueObject>;
|
|
2491
|
+
private _version;
|
|
2492
|
+
private readonly _uncommittedEvents;
|
|
2493
|
+
/**
|
|
2494
|
+
* @description Constructs a new instance of the AggregateRoot class with the specified ID.
|
|
2495
|
+
* @param {IValueObject<TValueObject>} id - The ID of the aggregate.
|
|
2496
|
+
*/
|
|
2497
|
+
constructor(id: IValueObject<TValueObject>);
|
|
2498
|
+
/**
|
|
2499
|
+
* @description Gets the current version of the aggregate.
|
|
2500
|
+
* @returns {number} The current version of the aggregate.
|
|
2501
|
+
*/
|
|
2502
|
+
get version(): number;
|
|
2503
|
+
/**
|
|
2504
|
+
* @description Gets the uncommitted events of the aggregate.
|
|
2505
|
+
* @returns {readonly IDomainEvent[]} The uncommitted events of the aggregate.
|
|
2506
|
+
*/
|
|
2507
|
+
getUncommittedEvents(): readonly IDomainEvent<TEvent, IValueObject<TValueObject>>[];
|
|
2508
|
+
/**
|
|
2509
|
+
* @description Clears the uncommitted events of the aggregate.
|
|
2510
|
+
*/
|
|
2511
|
+
clearUncommittedEvents(): void;
|
|
2512
|
+
/**
|
|
2513
|
+
* @description Loads the aggregate from a history of domain events.
|
|
2514
|
+
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>[]} history - The history of domain events to load.
|
|
2515
|
+
*/
|
|
2516
|
+
loadFromHistory(history: IDomainEvent<TEvent, IValueObject<TValueObject>>[]): void;
|
|
2517
|
+
/**
|
|
2518
|
+
* @description Raises a domain event and adds it to the uncommitted events list.
|
|
2519
|
+
* @param {Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>} eventData - The data of the domain event to raise.
|
|
2520
|
+
*/
|
|
2521
|
+
protected raise(eventData: Omit<IDomainEvent<TEvent, IValueObject<TValueObject>>, 'aggregateId' | 'version' | 'occurredAt'>): void;
|
|
2522
|
+
/**
|
|
2523
|
+
* @description Applies a domain event to the aggregate root.
|
|
2524
|
+
* @param {IDomainEvent<TEvent, IValueObject<TValueObject>>} event - The domain event to apply.
|
|
2525
|
+
* @param {boolean} isNew - Indicates whether the event is new or already committed.
|
|
2526
|
+
*/
|
|
2527
|
+
protected abstract apply(event: IDomainEvent<TEvent, IValueObject<TValueObject>>, isNew: boolean): void;
|
|
2528
|
+
}
|
|
2529
|
+
|
|
2530
|
+
/**
|
|
2531
|
+
* @description Configuration options for the authentication service.
|
|
2532
|
+
* @author Xeno
|
|
2533
|
+
* @version 1.0.0
|
|
3498
2534
|
* @since 2025-09-30
|
|
3499
2535
|
* @link https://github.com/xeno-js/xeno-js
|
|
3500
2536
|
*/
|
|
3501
|
-
interface
|
|
2537
|
+
interface AuthConfig<TOptions = unknown> {
|
|
3502
2538
|
/**
|
|
3503
|
-
*
|
|
3504
|
-
* @
|
|
3505
|
-
* @param defaultValue - The default value to return if the key is not present.
|
|
3506
|
-
* @returns The configuration value as a string, or the default value if the key is not present.
|
|
3507
|
-
*
|
|
3508
|
-
* @author Xeno
|
|
3509
|
-
* @version 1.0.0
|
|
3510
|
-
* @since 2025-09-30
|
|
3511
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
2539
|
+
* @description The URL of the authentication service.
|
|
2540
|
+
* @type {string}
|
|
3512
2541
|
*/
|
|
3513
|
-
|
|
2542
|
+
url: string;
|
|
3514
2543
|
/**
|
|
3515
|
-
*
|
|
3516
|
-
* @
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
* @
|
|
3521
|
-
* @
|
|
3522
|
-
|
|
3523
|
-
|
|
2544
|
+
* @description The key of the authentication service.
|
|
2545
|
+
* @type {string}
|
|
2546
|
+
*/
|
|
2547
|
+
key: string;
|
|
2548
|
+
/**
|
|
2549
|
+
* @description The options of the authentication service.
|
|
2550
|
+
* @type {TOptions}
|
|
2551
|
+
*/
|
|
2552
|
+
opts: Optional<TOptions>;
|
|
2553
|
+
/**
|
|
2554
|
+
* @description The storage options of the authentication service.
|
|
2555
|
+
* @type {StorageOptions}
|
|
2556
|
+
* @default { type: 'local', cookieOpts: {}, storage: null }
|
|
3524
2557
|
*/
|
|
3525
|
-
|
|
2558
|
+
storageOpts: Optional<StorageOptions>;
|
|
3526
2559
|
/**
|
|
3527
|
-
*
|
|
3528
|
-
* @
|
|
3529
|
-
* @
|
|
3530
|
-
|
|
2560
|
+
* @description The redirect URL of the authentication service.
|
|
2561
|
+
* @type {string}
|
|
2562
|
+
* @default '/'
|
|
2563
|
+
*/
|
|
2564
|
+
redirectTo: Optional<string>;
|
|
2565
|
+
}
|
|
2566
|
+
interface StorageOptions {
|
|
2567
|
+
type: Optional<'local' | 'session' | 'memory' | 'cookie'>;
|
|
2568
|
+
cookieOpts: Optional<CookieOptions>;
|
|
2569
|
+
storage: Optional<IStorage>;
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
/** @description Configuration for Redis integration, including details such as host, port, and credentials. If enabled, the query bus and command bus (in case of idempotency) pipelines will use Redis as the cache system to store and retrieve data efficiently. The configuration includes specific details for Redis integration, such as host, port, and credentials, providing flexibility in how the cache is implemented and used within the application.
|
|
2573
|
+
*
|
|
2574
|
+
* @author Xeno
|
|
2575
|
+
* @version 1.0.0
|
|
2576
|
+
* @since 2025-09-30
|
|
2577
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2578
|
+
*/
|
|
2579
|
+
interface CacheConfig {
|
|
2580
|
+
/** @description Optional configuration for in-memory cache integration. If enabled, the query bus and command bus (in case of idempotency) pipelines will use an in-memory cache system to store and retrieve data efficiently. The configuration includes specific details for in-memory cache integration, providing flexibility in how the cache is implemented and used within the application.
|
|
3531
2581
|
*
|
|
3532
2582
|
* @author Xeno
|
|
3533
2583
|
* @version 1.0.0
|
|
3534
2584
|
* @since 2025-09-30
|
|
3535
2585
|
* @link https://github.com/xeno-js/xeno-js
|
|
3536
2586
|
*/
|
|
3537
|
-
|
|
3538
|
-
/**
|
|
3539
|
-
* Retrieves a configuration value as a string. Throws an error if the key is not present.
|
|
3540
|
-
* @param key - The configuration key to retrieve.
|
|
3541
|
-
* @returns The configuration value as a string.
|
|
3542
|
-
* @throws An error if the key is not present in the configuration.
|
|
2587
|
+
inMemory: boolean;
|
|
2588
|
+
/** @description Optional configuration for Redis integration, including details such as host, port, and credentials. If provided and enabled, the application will use Redis as the cache system to store and retrieve data efficiently. The configuration includes specific details for Redis integration, such as host, port, and credentials, providing flexibility in how the cache is implemented and used within the application.
|
|
3543
2589
|
*
|
|
3544
2590
|
* @author Xeno
|
|
3545
2591
|
* @version 1.0.0
|
|
3546
2592
|
* @since 2025-09-30
|
|
3547
2593
|
* @link https://github.com/xeno-js/xeno-js
|
|
3548
2594
|
*/
|
|
3549
|
-
|
|
2595
|
+
redis: Optional<CacheClientConfig>;
|
|
3550
2596
|
}
|
|
3551
|
-
|
|
3552
|
-
/**
|
|
3553
|
-
* @fileoverview Defines the Identity interface representing the authenticated user's identity in the system.
|
|
3554
|
-
|
|
3555
|
-
*
|
|
3556
|
-
* @author Xeno
|
|
3557
|
-
* @version 1.0.0
|
|
3558
|
-
* @since 2025-09-30
|
|
3559
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3560
|
-
*/
|
|
3561
2597
|
/**
|
|
3562
|
-
* An interface representing
|
|
2598
|
+
* @description An interface representing a cache client, which provides methods for getting and setting values in a cache storage. This interface abstracts the underlying cache implementation, allowing for flexibility in choosing different caching solutions (e.g., in-memory, Redis) without affecting the rest of the application.
|
|
3563
2599
|
|
|
3564
2600
|
*
|
|
3565
2601
|
* @author Xeno
|
|
@@ -3567,211 +2603,249 @@ interface IConfigurationService {
|
|
|
3567
2603
|
* @since 2025-09-30
|
|
3568
2604
|
* @link https://github.com/xeno-js/xeno-js
|
|
3569
2605
|
*/
|
|
3570
|
-
interface
|
|
3571
|
-
/**
|
|
2606
|
+
interface CacheClientConfig {
|
|
2607
|
+
/**
|
|
2608
|
+
* @description The host address of the cache server (e.g., Redis). Optional for in-memory cache implementations.
|
|
2609
|
+
|
|
3572
2610
|
*
|
|
3573
2611
|
* @author Xeno
|
|
3574
2612
|
* @version 1.0.0
|
|
3575
2613
|
* @since 2025-09-30
|
|
3576
2614
|
* @link https://github.com/xeno-js/xeno-js
|
|
3577
2615
|
*/
|
|
3578
|
-
|
|
3579
|
-
/**
|
|
2616
|
+
host: Optional<string>;
|
|
2617
|
+
/**
|
|
2618
|
+
* @description The port number of the cache server (e.g., Redis). Optional for in-memory cache implementations.
|
|
3580
2619
|
*
|
|
3581
2620
|
* @author Xeno
|
|
3582
2621
|
* @version 1.0.0
|
|
3583
2622
|
* @since 2025-09-30
|
|
3584
2623
|
* @link https://github.com/xeno-js/xeno-js
|
|
3585
2624
|
*/
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
2625
|
+
port: Optional<number>;
|
|
2626
|
+
/**
|
|
2627
|
+
* @description The password for authenticating with the cache server (e.g., Redis). Optional for in-memory cache implementations.
|
|
2628
|
+
|
|
3589
2629
|
*
|
|
3590
2630
|
* @author Xeno
|
|
3591
2631
|
* @version 1.0.0
|
|
3592
2632
|
* @since 2025-09-30
|
|
3593
2633
|
* @link https://github.com/xeno-js/xeno-js
|
|
3594
2634
|
*/
|
|
3595
|
-
|
|
3596
|
-
/** @description The
|
|
2635
|
+
password: Optional<string>;
|
|
2636
|
+
/** @description The username for authenticating with the cache server (e.g., Redis). Optional for in-memory cache implementations.
|
|
2637
|
+
|
|
3597
2638
|
*
|
|
3598
2639
|
* @author Xeno
|
|
3599
2640
|
* @version 1.0.0
|
|
3600
2641
|
* @since 2025-09-30
|
|
3601
2642
|
* @link https://github.com/xeno-js/xeno-js
|
|
3602
2643
|
*/
|
|
3603
|
-
|
|
3604
|
-
/** @description
|
|
2644
|
+
username: Optional<string>;
|
|
2645
|
+
/** @description A boolean flag indicating whether to use TLS/SSL for the connection to the cache server (e.g., Redis). Optional for in-memory cache implementations.
|
|
3605
2646
|
*
|
|
3606
2647
|
* @author Xeno
|
|
3607
2648
|
* @version 1.0.0
|
|
3608
2649
|
* @since 2025-09-30
|
|
3609
2650
|
* @link https://github.com/xeno-js/xeno-js
|
|
3610
2651
|
*/
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
/**
|
|
3615
|
-
* @description MessagingContext defines the structure for messaging-related information used in message handling and processing. It includes properties such as return address, expiration time, and message sequence information, which can be used for managing message delivery, expiration, and sequencing in distributed systems.
|
|
3616
|
-
*
|
|
3617
|
-
* @author Xeno
|
|
3618
|
-
* @version 1.0.0
|
|
3619
|
-
* @since 2025-09-30
|
|
3620
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3621
|
-
*/
|
|
3622
|
-
interface MessageSequence {
|
|
3623
|
-
/** @description The unique identifier for the message sequence, which can be used to track and manage the order of messages in a sequence.
|
|
2652
|
+
tls: boolean;
|
|
2653
|
+
/** @description The maximum number of reconnection attempts before declaring failure. Optional for in-memory cache implementations.
|
|
3624
2654
|
*
|
|
3625
2655
|
* @author Xeno
|
|
3626
2656
|
* @version 1.0.0
|
|
3627
2657
|
* @since 2025-09-30
|
|
3628
2658
|
* @link https://github.com/xeno-js/xeno-js
|
|
3629
2659
|
*/
|
|
3630
|
-
|
|
3631
|
-
|
|
2660
|
+
maxRetriesPerRequest: Optional<number>;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
/**
|
|
2664
|
+
* @description Configuration options for the Database Module.
|
|
2665
|
+
* Contains the connection string for PostgreSQL and a dictionary mapping schema names to Drizzle PgTable definitions.
|
|
2666
|
+
|
|
2667
|
+
*
|
|
2668
|
+
* @author Xeno
|
|
2669
|
+
* @version 1.0.0
|
|
2670
|
+
* @since 2025-09-30
|
|
2671
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2672
|
+
*/
|
|
2673
|
+
interface DbConfig {
|
|
2674
|
+
/** @description The connection string used to connect to the PostgreSQL database. This should include the necessary credentials and connection details (e.g., host, port, database name, username, password) required for establishing a connection to the database.
|
|
3632
2675
|
*
|
|
3633
2676
|
* @author Xeno
|
|
3634
2677
|
* @version 1.0.0
|
|
3635
2678
|
* @since 2025-09-30
|
|
3636
2679
|
* @link https://github.com/xeno-js/xeno-js
|
|
3637
2680
|
*/
|
|
3638
|
-
|
|
3639
|
-
/** @description
|
|
2681
|
+
connectionString: string;
|
|
2682
|
+
/** @description A boolean flag indicating whether to enable SQLite support in the database configuration. If set to true, the application will be configured to use SQLite as the underlying database engine, allowing for lightweight and file-based database operations. This option is useful for scenarios where a full-fledged PostgreSQL server is not required or when running in environments with limited resources.
|
|
3640
2683
|
*
|
|
3641
2684
|
* @author Xeno
|
|
3642
2685
|
* @version 1.0.0
|
|
3643
2686
|
* @since 2025-09-30
|
|
3644
2687
|
* @link https://github.com/xeno-js/xeno-js
|
|
3645
2688
|
*/
|
|
3646
|
-
|
|
2689
|
+
enableSqlLite: boolean;
|
|
3647
2690
|
}
|
|
2691
|
+
|
|
3648
2692
|
/**
|
|
3649
|
-
* @description
|
|
2693
|
+
* @description Agnostic contract used to execute HTTP calls independently
|
|
2694
|
+
* from concrete transport libraries (fetch, axios, undici, etc.),
|
|
3650
2695
|
*
|
|
3651
2696
|
* @author Xeno
|
|
3652
2697
|
* @version 1.0.0
|
|
3653
2698
|
* @since 2025-09-30
|
|
3654
2699
|
* @link https://github.com/xeno-js/xeno-js
|
|
3655
2700
|
*/
|
|
3656
|
-
interface
|
|
3657
|
-
/** @description
|
|
2701
|
+
interface HttpClientConfig {
|
|
2702
|
+
/** @description Optional default headers to include in every request made by the HTTP client.
|
|
3658
2703
|
*
|
|
3659
2704
|
* @author Xeno
|
|
3660
2705
|
* @version 1.0.0
|
|
3661
2706
|
* @since 2025-09-30
|
|
3662
2707
|
* @link https://github.com/xeno-js/xeno-js
|
|
3663
2708
|
*/
|
|
3664
|
-
|
|
3665
|
-
/** @description
|
|
2709
|
+
defaultHeaders: Optional<HttpHeaders>;
|
|
2710
|
+
/** @description Optional base URL to prepend to all request URLs made by the HTTP client.
|
|
3666
2711
|
*
|
|
3667
2712
|
* @author Xeno
|
|
3668
2713
|
* @version 1.0.0
|
|
3669
2714
|
* @since 2025-09-30
|
|
3670
2715
|
* @link https://github.com/xeno-js/xeno-js
|
|
3671
2716
|
*/
|
|
3672
|
-
|
|
3673
|
-
/** @description
|
|
2717
|
+
baseURL: Optional<string>;
|
|
2718
|
+
/** @description Optional timeout in milliseconds for all requests made by the HTTP client.
|
|
3674
2719
|
*
|
|
3675
2720
|
* @author Xeno
|
|
3676
2721
|
* @version 1.0.0
|
|
3677
2722
|
* @since 2025-09-30
|
|
3678
2723
|
* @link https://github.com/xeno-js/xeno-js
|
|
3679
2724
|
*/
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
/**
|
|
3684
|
-
* @description NetworkContext defines the structure for network-related information used in logging and monitoring. It includes a request ID for ensuring idempotency and a client IP address for audit logging purposes.
|
|
3685
|
-
*
|
|
3686
|
-
* @author Xeno
|
|
3687
|
-
* @version 1.0.0
|
|
3688
|
-
* @since 2025-09-30
|
|
3689
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3690
|
-
*/
|
|
3691
|
-
interface NetworkContext {
|
|
3692
|
-
/** A unique identifier for the request, which can be used for ensuring idempotency and tracing purposes.
|
|
2725
|
+
timeoutMs: Optional<number>;
|
|
2726
|
+
/** @description Optional keep-alive configuration for the HTTP client.
|
|
3693
2727
|
*
|
|
3694
2728
|
* @author Xeno
|
|
3695
2729
|
* @version 1.0.0
|
|
3696
2730
|
* @since 2025-09-30
|
|
3697
2731
|
* @link https://github.com/xeno-js/xeno-js
|
|
3698
2732
|
*/
|
|
3699
|
-
|
|
3700
|
-
/**
|
|
2733
|
+
keepAlive: Optional<boolean>;
|
|
2734
|
+
/** @description Optional maximum number of sockets to be used by the HTTP client.
|
|
3701
2735
|
*
|
|
3702
2736
|
* @author Xeno
|
|
3703
2737
|
* @version 1.0.0
|
|
3704
2738
|
* @since 2025-09-30
|
|
3705
2739
|
* @link https://github.com/xeno-js/xeno-js
|
|
3706
2740
|
*/
|
|
3707
|
-
|
|
3708
|
-
/**
|
|
2741
|
+
maxSockets: Optional<number>;
|
|
2742
|
+
/**
|
|
2743
|
+
* @description Optional maximum number of redirects to follow for the HTTP client.
|
|
3709
2744
|
*
|
|
3710
2745
|
* @author Xeno
|
|
3711
2746
|
* @version 1.0.0
|
|
3712
2747
|
* @since 2025-09-30
|
|
3713
2748
|
* @link https://github.com/xeno-js/xeno-js
|
|
3714
2749
|
*/
|
|
3715
|
-
|
|
3716
|
-
/**
|
|
2750
|
+
maxRedirects: Optional<number>;
|
|
2751
|
+
/**
|
|
2752
|
+
* @description Optional flag to enable or disable automatic decompression of response bodies.
|
|
3717
2753
|
*
|
|
3718
2754
|
* @author Xeno
|
|
3719
2755
|
* @version 1.0.0
|
|
3720
2756
|
* @since 2025-09-30
|
|
3721
2757
|
* @link https://github.com/xeno-js/xeno-js
|
|
3722
2758
|
*/
|
|
3723
|
-
|
|
3724
|
-
/**
|
|
2759
|
+
decompress: Optional<boolean>;
|
|
2760
|
+
/**
|
|
2761
|
+
* @description Optional flag to enable or disable sending credentials (cookies, authorization headers, or TLS client certificates) with cross-origin requests.
|
|
2762
|
+
*/
|
|
2763
|
+
withCredentials: Optional<boolean>;
|
|
2764
|
+
/**
|
|
2765
|
+
* @description Optional proxy configuration for the HTTP client.
|
|
3725
2766
|
*
|
|
3726
2767
|
* @author Xeno
|
|
3727
2768
|
* @version 1.0.0
|
|
3728
2769
|
* @since 2025-09-30
|
|
3729
2770
|
* @link https://github.com/xeno-js/xeno-js
|
|
3730
2771
|
*/
|
|
3731
|
-
|
|
2772
|
+
proxy: ProxyConfig | false;
|
|
2773
|
+
}
|
|
2774
|
+
/**
|
|
2775
|
+
* @description Configuration interface for HTTP client settings, defining parameters such as timeouts, headers, and proxy configurations.
|
|
2776
|
+
*
|
|
2777
|
+
* @author Xeno
|
|
2778
|
+
* @version 1.0.0
|
|
2779
|
+
* @since 2025-09-30
|
|
2780
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2781
|
+
*/
|
|
2782
|
+
interface ProxyConfig {
|
|
3732
2783
|
/**
|
|
3733
|
-
* @description The
|
|
2784
|
+
* @description The hostname or IP address of the proxy server.
|
|
3734
2785
|
*
|
|
3735
2786
|
* @author Xeno
|
|
3736
2787
|
* @version 1.0.0
|
|
3737
2788
|
* @since 2025-09-30
|
|
3738
2789
|
* @link https://github.com/xeno-js/xeno-js
|
|
3739
2790
|
*/
|
|
3740
|
-
|
|
2791
|
+
host: string;
|
|
3741
2792
|
/**
|
|
3742
|
-
* @description The
|
|
2793
|
+
* @description The port number of the proxy server.
|
|
3743
2794
|
*
|
|
3744
2795
|
* @author Xeno
|
|
3745
2796
|
* @version 1.0.0
|
|
3746
2797
|
* @since 2025-09-30
|
|
3747
2798
|
* @link https://github.com/xeno-js/xeno-js
|
|
3748
2799
|
*/
|
|
3749
|
-
|
|
2800
|
+
port: number;
|
|
3750
2801
|
/**
|
|
3751
|
-
* @description
|
|
2802
|
+
* @description Optional authentication credentials for the proxy server.
|
|
3752
2803
|
*
|
|
3753
2804
|
* @author Xeno
|
|
3754
2805
|
* @version 1.0.0
|
|
3755
2806
|
* @since 2025-09-30
|
|
3756
2807
|
* @link https://github.com/xeno-js/xeno-js
|
|
3757
2808
|
*/
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
2809
|
+
auth?: {
|
|
2810
|
+
/**
|
|
2811
|
+
* @description The username for the proxy server.
|
|
2812
|
+
*
|
|
2813
|
+
* @author Xeno
|
|
2814
|
+
* @version 1.0.0
|
|
2815
|
+
* @since 2025-09-30
|
|
2816
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2817
|
+
*/
|
|
2818
|
+
username: string;
|
|
2819
|
+
/**
|
|
2820
|
+
* @description The password for the proxy server.
|
|
2821
|
+
*
|
|
2822
|
+
* @author Xeno
|
|
2823
|
+
* @version 1.0.0
|
|
2824
|
+
* @since 2025-09-30
|
|
2825
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2826
|
+
*/
|
|
2827
|
+
password: string;
|
|
2828
|
+
};
|
|
3762
2829
|
/**
|
|
3763
|
-
* @description The
|
|
2830
|
+
* @description The protocol to use for the proxy server (e.g., 'http', 'https').
|
|
3764
2831
|
*
|
|
3765
2832
|
* @author Xeno
|
|
3766
2833
|
* @version 1.0.0
|
|
3767
2834
|
* @since 2025-09-30
|
|
3768
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3769
2835
|
*/
|
|
3770
|
-
|
|
2836
|
+
protocol?: string;
|
|
3771
2837
|
}
|
|
3772
2838
|
|
|
3773
2839
|
/**
|
|
3774
|
-
* @
|
|
2840
|
+
* @fileoverview Defines the ICache interface for caching mechanisms within the application.
|
|
2841
|
+
*
|
|
2842
|
+
* @author Xeno
|
|
2843
|
+
* @version 1.0.0
|
|
2844
|
+
* @since 2025-09-30
|
|
2845
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
2846
|
+
*/
|
|
2847
|
+
/**
|
|
2848
|
+
* An interface representing a caching mechanism within the application. This interface provides methods for retrieving and storing values in the cache, as well as clearing the cache when necessary. The get method allows for retrieving values from the cache based on a specified key, while the set method enables storing values in the cache with an optional time-to-live (TTL) parameter to specify how long the value should remain in the cache before it expires. The clear method provides a way to remove all entries from the cache when needed.
|
|
3775
2849
|
|
|
3776
2850
|
*
|
|
3777
2851
|
* @author Xeno
|
|
@@ -3779,213 +2853,177 @@ interface NetworkContext {
|
|
|
3779
2853
|
* @since 2025-09-30
|
|
3780
2854
|
* @link https://github.com/xeno-js/xeno-js
|
|
3781
2855
|
*/
|
|
3782
|
-
interface
|
|
3783
|
-
/**
|
|
3784
|
-
*
|
|
3785
|
-
* @
|
|
3786
|
-
* @
|
|
3787
|
-
|
|
3788
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3789
|
-
*/
|
|
3790
|
-
readonly correlationId: Guid;
|
|
3791
|
-
/** The timestamp indicating when the operation started, used for measuring duration and performance.
|
|
3792
|
-
*
|
|
3793
|
-
* @author Xeno
|
|
3794
|
-
* @version 1.0.0
|
|
3795
|
-
* @since 2025-09-30
|
|
3796
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3797
|
-
*/
|
|
3798
|
-
readonly startTime: number;
|
|
3799
|
-
/** An optional identifier for distributed tracing, which can be used to track the flow of requests across multiple services in a microservices architecture.
|
|
3800
|
-
*
|
|
3801
|
-
* @author Xeno
|
|
3802
|
-
* @version 1.0.0
|
|
3803
|
-
* @since 2025-09-30
|
|
3804
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3805
|
-
*/
|
|
3806
|
-
readonly spanId: Optional<string>;
|
|
3807
|
-
/** An optional identifier for the parent span in distributed tracing, which can be used to establish a hierarchy of spans and track the flow of requests across multiple services in a microservices architecture.
|
|
2856
|
+
interface ICache {
|
|
2857
|
+
/**
|
|
2858
|
+
* Retrieves a value from the cache based on the specified key. If the key exists in the cache and has not expired, the corresponding value will be returned. If the key does not exist or has expired, this method will return undefined, indicating that there is no valid cached value available for the given key.
|
|
2859
|
+
* @param key The unique identifier for the cached value. This key is used to store and retrieve values from the cache.
|
|
2860
|
+
* @returns The value associated with the specified key if it exists and has not expired; otherwise, returns undefined.
|
|
2861
|
+
|
|
3808
2862
|
*
|
|
3809
2863
|
* @author Xeno
|
|
3810
2864
|
* @version 1.0.0
|
|
3811
2865
|
* @since 2025-09-30
|
|
3812
2866
|
* @link https://github.com/xeno-js/xeno-js
|
|
3813
2867
|
*/
|
|
3814
|
-
|
|
2868
|
+
get<T>(key: string): Promise<Optional<T>>;
|
|
3815
2869
|
/**
|
|
3816
|
-
*
|
|
2870
|
+
* Stores a value in the cache with the specified key and an optional time-to-live (TTL) parameter. The TTL parameter specifies how long the value should remain in the cache before it expires. If the TTL is not provided, the value will be stored indefinitely until it is explicitly removed or cleared from the cache. This method allows for efficient caching of values that may have a limited lifespan, ensuring that stale data is not returned when retrieving values from the cache.
|
|
2871
|
+
* @param key The unique identifier for the cached value. This key is used to store and retrieve values from the cache.
|
|
2872
|
+
* @param value The value to be stored in the cache associated with the specified key.
|
|
2873
|
+
* @param ttl Optional time-to-live (TTL) in milliseconds, indicating how long the value should remain in the cache before it expires. If not provided, the value will be stored indefinitely.
|
|
2874
|
+
|
|
3817
2875
|
*
|
|
3818
2876
|
* @author Xeno
|
|
3819
2877
|
* @version 1.0.0
|
|
3820
2878
|
* @since 2025-09-30
|
|
3821
2879
|
* @link https://github.com/xeno-js/xeno-js
|
|
3822
2880
|
*/
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
* @since 2025-09-30
|
|
3832
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3833
|
-
*/
|
|
3834
|
-
interface RequestContext {
|
|
3835
|
-
/** The identity of the user or system executing the request, which can be used for authentication and authorization purposes.
|
|
2881
|
+
set<T>(key: string, value: T, ttl: Optional<number>): Promise<void>;
|
|
2882
|
+
/**
|
|
2883
|
+
* Stores a value in the cache only if the specified key does not already exist. This method is useful for ensuring that a value is only set in the cache if it has not been previously stored, preventing overwriting of existing values. The TTL parameter specifies how long the value should remain in the cache before it expires, similar to the set method. If the key already exists in the cache, this method will return false, indicating that the value was not set; otherwise, it will store the value and return true.
|
|
2884
|
+
* @param key The unique identifier for the cached value. This key is used to store and retrieve values from the cache.
|
|
2885
|
+
* @param value The value to be stored in the cache associated with the specified key.
|
|
2886
|
+
* @param ttl Optional time-to-live (TTL) in milliseconds, indicating how long the value should remain in the cache before it expires. If not provided, the value will be stored indefinitely.
|
|
2887
|
+
* @returns True if the value was successfully stored in the cache because the key did not already exist; otherwise, returns false if the key already exists in the cache and the value was not set.
|
|
2888
|
+
|
|
3836
2889
|
*
|
|
3837
2890
|
* @author Xeno
|
|
3838
2891
|
* @version 1.0.0
|
|
3839
2892
|
* @since 2025-09-30
|
|
3840
2893
|
* @link https://github.com/xeno-js/xeno-js
|
|
3841
2894
|
*/
|
|
3842
|
-
|
|
3843
|
-
/**
|
|
2895
|
+
setIfAbsent<T>(key: string, value: T, ttl: Optional<number>): Promise<boolean>;
|
|
2896
|
+
/**
|
|
2897
|
+
* Removes a specific entry from the cache based on the provided key. This method allows for targeted invalidation of cached values when they are no longer valid or needed. After calling this method with a specific key, subsequent calls to the get method with that key will return undefined until a new value is stored in the cache using the set method.
|
|
2898
|
+
* @param key The unique identifier for the cached value to be removed. This key is used to identify which entry in the cache should be invalidated.
|
|
2899
|
+
|
|
3844
2900
|
*
|
|
3845
2901
|
* @author Xeno
|
|
3846
2902
|
* @version 1.0.0
|
|
3847
2903
|
* @since 2025-09-30
|
|
3848
2904
|
* @link https://github.com/xeno-js/xeno-js
|
|
3849
2905
|
*/
|
|
3850
|
-
|
|
3851
|
-
/**
|
|
2906
|
+
remove(key: string): Promise<void>;
|
|
2907
|
+
/**
|
|
2908
|
+
* Checks if a specific key exists in the cache and has not expired. This method returns true if the key is present in the cache and its associated value is still valid; otherwise, it returns false. This can be useful for determining whether a cached value can be retrieved without actually fetching it, allowing for more efficient cache management and decision-making based on the presence of valid cached data.
|
|
2909
|
+
* @param key The unique identifier for the cached value to check for existence. This key is used to determine if a valid entry exists in the cache.
|
|
2910
|
+
* @returns True if the key exists in the cache and has not expired; otherwise, returns false.
|
|
2911
|
+
|
|
3852
2912
|
*
|
|
3853
2913
|
* @author Xeno
|
|
3854
2914
|
* @version 1.0.0
|
|
3855
2915
|
* @since 2025-09-30
|
|
3856
2916
|
* @link https://github.com/xeno-js/xeno-js
|
|
3857
2917
|
*/
|
|
3858
|
-
|
|
3859
|
-
/**
|
|
2918
|
+
has(key: string): Promise<boolean>;
|
|
2919
|
+
/**
|
|
2920
|
+
* Clears all entries from the cache, effectively removing all stored values. This method can be used when there is a need to invalidate the entire cache, such as when significant changes occur in the underlying data or when the cache needs to be reset for any reason. After calling this method, subsequent calls to the get method will return undefined until new values are stored in the cache using the set method.
|
|
2921
|
+
|
|
3860
2922
|
*
|
|
3861
2923
|
* @author Xeno
|
|
3862
2924
|
* @version 1.0.0
|
|
3863
2925
|
* @since 2025-09-30
|
|
3864
2926
|
* @link https://github.com/xeno-js/xeno-js
|
|
3865
2927
|
*/
|
|
3866
|
-
|
|
2928
|
+
clear(): Promise<void>;
|
|
3867
2929
|
}
|
|
3868
2930
|
|
|
3869
|
-
interface IBaseAccessor<TCtx> extends IContextAccessor<TCtx>, IIdentityAccessor, INetworkContextAccessor {
|
|
3870
|
-
}
|
|
3871
2931
|
/**
|
|
3872
|
-
* @
|
|
3873
|
-
*
|
|
2932
|
+
* @interface ICacheKeyBuilder
|
|
2933
|
+
* @description Interface for building cache keys with contextual information.
|
|
3874
2934
|
*
|
|
3875
2935
|
* @author Xeno
|
|
3876
2936
|
* @version 1.0.0
|
|
3877
2937
|
* @since 2025-09-30
|
|
3878
2938
|
* @link https://github.com/xeno-js/xeno-js
|
|
3879
2939
|
*/
|
|
3880
|
-
interface
|
|
2940
|
+
interface ICacheKeyBuilder {
|
|
3881
2941
|
/**
|
|
3882
|
-
*
|
|
3883
|
-
* @
|
|
2942
|
+
* @description Builds a contextual cache key based on the provided key and the current user's identity. If a tenant ID is present in the identity, the cache key is prefixed with the tenant ID; otherwise, it defaults to a public cache key. This method ensures that cached data is appropriately scoped to the user's context, preventing data leakage between tenants.
|
|
2943
|
+
* @param key The base key to be used for building the contextual cache key.
|
|
2944
|
+
* @returns The contextual cache key.
|
|
3884
2945
|
*
|
|
3885
2946
|
* @author Xeno
|
|
3886
2947
|
* @version 1.0.0
|
|
3887
2948
|
* @since 2025-09-30
|
|
3888
2949
|
* @link https://github.com/xeno-js/xeno-js
|
|
3889
2950
|
*/
|
|
3890
|
-
|
|
3891
|
-
}
|
|
3892
|
-
/**
|
|
3893
|
-
* @description The IServiceScopeAccessor interface is a contract that defines the structure and behavior of a service scope accessor within the application. It provides a method for retrieving the current service scope, which allows for managing dependencies during the execution of a request. This interface is essential for ensuring that services are properly scoped and disposed of after the request is processed.
|
|
3894
|
-
*
|
|
3895
|
-
*
|
|
3896
|
-
* @author Xeno
|
|
3897
|
-
* @version 1.0.0
|
|
3898
|
-
* @since 2025-09-30
|
|
3899
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3900
|
-
*/
|
|
3901
|
-
interface IContextAccessor<TCtx> {
|
|
2951
|
+
buildContextualKey(key: string): string;
|
|
3902
2952
|
/**
|
|
3903
|
-
*
|
|
3904
|
-
* @
|
|
2953
|
+
* @description Builds a user-scoped cache key based on the provided key and the current user's identity. If a user ID is present in the identity, the cache key is prefixed with the user ID; otherwise, it defaults to a public cache key. This method ensures that cached data is appropriately scoped to the user's context, preventing data leakage between users.
|
|
2954
|
+
* @param key The base key to be used for building the user-scoped cache key.
|
|
2955
|
+
* @returns The user-scoped cache key.
|
|
3905
2956
|
*
|
|
3906
2957
|
* @author Xeno
|
|
3907
2958
|
* @version 1.0.0
|
|
3908
2959
|
* @since 2025-09-30
|
|
3909
2960
|
* @link https://github.com/xeno-js/xeno-js
|
|
3910
2961
|
*/
|
|
3911
|
-
|
|
2962
|
+
buildUserScopedKey(key: string): string;
|
|
3912
2963
|
}
|
|
2964
|
+
|
|
3913
2965
|
/**
|
|
3914
|
-
* @description
|
|
3915
|
-
*
|
|
2966
|
+
* @description
|
|
2967
|
+
* This interface defines the contract for a configuration service that provides methods to retrieve configuration values.
|
|
3916
2968
|
*
|
|
3917
2969
|
* @author Xeno
|
|
3918
2970
|
* @version 1.0.0
|
|
3919
2971
|
* @since 2025-09-30
|
|
3920
2972
|
* @link https://github.com/xeno-js/xeno-js
|
|
3921
2973
|
*/
|
|
3922
|
-
interface
|
|
2974
|
+
interface IConfigurationService {
|
|
3923
2975
|
/**
|
|
3924
|
-
* Retrieves
|
|
3925
|
-
* @
|
|
2976
|
+
* Retrieves a configuration value as a string. Returns the default value if the key is not present.
|
|
2977
|
+
* @param key - The configuration key to retrieve.
|
|
2978
|
+
* @param defaultValue - The default value to return if the key is not present.
|
|
2979
|
+
* @returns The configuration value as a string, or the default value if the key is not present.
|
|
3926
2980
|
*
|
|
3927
2981
|
* @author Xeno
|
|
3928
2982
|
* @version 1.0.0
|
|
3929
2983
|
* @since 2025-09-30
|
|
3930
2984
|
* @link https://github.com/xeno-js/xeno-js
|
|
3931
2985
|
*/
|
|
3932
|
-
|
|
3933
|
-
}
|
|
3934
|
-
|
|
3935
|
-
/**
|
|
3936
|
-
* @fileoverview IController defines the interface for controllers in the application. A controller is responsible for handling incoming requests, processing them, and returning appropriate responses. The IController interface ensures that all controllers adhere to a consistent structure, making it easier to manage and maintain the application's request handling logic. Each controller must implement the handle method, which takes an incoming request and returns a response, typically as a promise to accommodate asynchronous operations.
|
|
3937
|
-
*
|
|
3938
|
-
* @author Xeno
|
|
3939
|
-
* @version 1.0.0
|
|
3940
|
-
* @since 2025-09-30
|
|
3941
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3942
|
-
*/
|
|
3943
|
-
interface IController<TRequest = unknown, TResponse = unknown> {
|
|
2986
|
+
get(key: string, defaultValue?: string): Optional<string>;
|
|
3944
2987
|
/**
|
|
3945
|
-
*
|
|
3946
|
-
* @param
|
|
3947
|
-
* @param
|
|
3948
|
-
* @returns
|
|
2988
|
+
* Retrieves a configuration value as a number. Returns the default value if the key is not present.
|
|
2989
|
+
* @param key - The configuration key to retrieve.
|
|
2990
|
+
* @param defaultValue - The default value to return if the key is not present.
|
|
2991
|
+
* @returns The configuration value as a number, or the default value if the key is not present.
|
|
3949
2992
|
*
|
|
3950
2993
|
* @author Xeno
|
|
3951
2994
|
* @version 1.0.0
|
|
3952
2995
|
* @since 2025-09-30
|
|
3953
|
-
* @link https://github.com/xeno-js/xeno-
|
|
2996
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3954
2997
|
*/
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
*
|
|
3962
|
-
* @author Xeno
|
|
3963
|
-
* @version 1.0.0
|
|
3964
|
-
* @since 2025-09-30
|
|
3965
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
3966
|
-
*/
|
|
3967
|
-
interface IRequest<TResponse = unknown> {
|
|
3968
|
-
readonly $type?: TResponse;
|
|
3969
|
-
/** @description The intent of the request, which can be used to describe the purpose or action associated with the request.
|
|
2998
|
+
getNumber(key: string, defaultValue?: number): Optional<number>;
|
|
2999
|
+
/**
|
|
3000
|
+
* Retrieves a configuration value as a boolean. Returns the default value if the key is not present.
|
|
3001
|
+
* @param key - The configuration key to retrieve.
|
|
3002
|
+
* @param defaultValue - The default value to return if the key is not present.
|
|
3003
|
+
* @returns The configuration value as a boolean, or the default value if the key is not present.
|
|
3970
3004
|
*
|
|
3971
3005
|
* @author Xeno
|
|
3972
3006
|
* @version 1.0.0
|
|
3973
3007
|
* @since 2025-09-30
|
|
3974
3008
|
* @link https://github.com/xeno-js/xeno-js
|
|
3975
3009
|
*/
|
|
3976
|
-
|
|
3977
|
-
/**
|
|
3010
|
+
getBoolean(key: string, defaultValue?: boolean): Optional<boolean>;
|
|
3011
|
+
/**
|
|
3012
|
+
* Retrieves a configuration value as a string. Throws an error if the key is not present.
|
|
3013
|
+
* @param key - The configuration key to retrieve.
|
|
3014
|
+
* @returns The configuration value as a string.
|
|
3015
|
+
* @throws An error if the key is not present in the configuration.
|
|
3978
3016
|
*
|
|
3979
3017
|
* @author Xeno
|
|
3980
3018
|
* @version 1.0.0
|
|
3981
3019
|
* @since 2025-09-30
|
|
3982
3020
|
* @link https://github.com/xeno-js/xeno-js
|
|
3983
3021
|
*/
|
|
3984
|
-
|
|
3022
|
+
getOrThrow(key: string): string;
|
|
3985
3023
|
}
|
|
3986
3024
|
|
|
3987
3025
|
/**
|
|
3988
|
-
* @fileoverview Defines the
|
|
3026
|
+
* @fileoverview Defines the Identity interface representing the authenticated user's identity in the system.
|
|
3989
3027
|
|
|
3990
3028
|
*
|
|
3991
3029
|
* @author Xeno
|
|
@@ -3994,7 +3032,7 @@ interface IRequest<TResponse = unknown> {
|
|
|
3994
3032
|
* @link https://github.com/xeno-js/xeno-js
|
|
3995
3033
|
*/
|
|
3996
3034
|
/**
|
|
3997
|
-
*
|
|
3035
|
+
* An interface representing the authenticated user's identity in the system. This interface includes properties such as the user's unique identifier, email address, and assigned roles, which can be used for authentication and authorization purposes throughout the application.
|
|
3998
3036
|
|
|
3999
3037
|
*
|
|
4000
3038
|
* @author Xeno
|
|
@@ -4002,416 +3040,463 @@ interface IRequest<TResponse = unknown> {
|
|
|
4002
3040
|
* @since 2025-09-30
|
|
4003
3041
|
* @link https://github.com/xeno-js/xeno-js
|
|
4004
3042
|
*/
|
|
4005
|
-
interface
|
|
4006
|
-
/** @description
|
|
3043
|
+
interface Identity {
|
|
3044
|
+
/** @description The unique identifier of the user.
|
|
4007
3045
|
*
|
|
4008
3046
|
* @author Xeno
|
|
4009
3047
|
* @version 1.0.0
|
|
4010
3048
|
* @since 2025-09-30
|
|
4011
3049
|
* @link https://github.com/xeno-js/xeno-js
|
|
4012
3050
|
*/
|
|
4013
|
-
readonly
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
/**
|
|
4017
|
-
* @fileoverview Defines the IQuery interface for query requests in a CQRS architecture.
|
|
4018
|
-
|
|
4019
|
-
*
|
|
4020
|
-
* @author Xeno
|
|
4021
|
-
* @version 1.0.0
|
|
4022
|
-
* @since 2025-09-30
|
|
4023
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4024
|
-
*/
|
|
4025
|
-
/**
|
|
4026
|
-
* @description An interface representing a paginated query request, which extends the IQuery interface and includes pagination parameters.
|
|
4027
|
-
|
|
4028
|
-
*
|
|
4029
|
-
* @author Xeno
|
|
4030
|
-
* @version 1.0.0
|
|
4031
|
-
* @since 2025-09-30
|
|
4032
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4033
|
-
*/
|
|
4034
|
-
interface IQuery<TResponse = unknown> extends IRequest<TResponse> {
|
|
4035
|
-
/**
|
|
4036
|
-
* @description Cache options for the query, including cache key, TTL, and bypass flags.
|
|
3051
|
+
readonly userId: Optional<Guid>;
|
|
3052
|
+
/** @description The email address of the user.
|
|
4037
3053
|
*
|
|
4038
3054
|
* @author Xeno
|
|
4039
3055
|
* @version 1.0.0
|
|
4040
3056
|
* @since 2025-09-30
|
|
4041
3057
|
* @link https://github.com/xeno-js/xeno-js
|
|
4042
3058
|
*/
|
|
4043
|
-
readonly
|
|
3059
|
+
readonly email: Optional<string>;
|
|
3060
|
+
readonly name: Optional<string>;
|
|
3061
|
+
/** @description The tenant ID associated with the user.
|
|
3062
|
+
*
|
|
3063
|
+
* @author Xeno
|
|
3064
|
+
* @version 1.0.0
|
|
3065
|
+
* @since 2025-09-30
|
|
3066
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3067
|
+
*/
|
|
3068
|
+
readonly tenantId: Optional<Guid>;
|
|
3069
|
+
/** @description The roles assigned to the user, which can be used for authorization purposes.
|
|
3070
|
+
*
|
|
3071
|
+
* @author Xeno
|
|
3072
|
+
* @version 1.0.0
|
|
3073
|
+
* @since 2025-09-30
|
|
3074
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3075
|
+
*/
|
|
3076
|
+
readonly roles: Optional<string[]>;
|
|
3077
|
+
/** @description The permissions assigned to the user, which can be used for fine-grained authorization checks.
|
|
3078
|
+
*
|
|
3079
|
+
* @author Xeno
|
|
3080
|
+
* @version 1.0.0
|
|
3081
|
+
* @since 2025-09-30
|
|
3082
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3083
|
+
*/
|
|
3084
|
+
readonly permissions: Optional<string[]>;
|
|
4044
3085
|
}
|
|
4045
3086
|
|
|
4046
3087
|
/**
|
|
4047
|
-
*
|
|
4048
|
-
*
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
3088
|
+
* @description MessagingContext defines the structure for messaging-related information used in message handling and processing. It includes properties such as return address, expiration time, and message sequence information, which can be used for managing message delivery, expiration, and sequencing in distributed systems.
|
|
3089
|
+
*
|
|
3090
|
+
* @author Xeno
|
|
3091
|
+
* @version 1.0.0
|
|
3092
|
+
* @since 2025-09-30
|
|
3093
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3094
|
+
*/
|
|
3095
|
+
interface MessageSequence {
|
|
3096
|
+
/** @description The unique identifier for the message sequence, which can be used to track and manage the order of messages in a sequence.
|
|
3097
|
+
*
|
|
3098
|
+
* @author Xeno
|
|
3099
|
+
* @version 1.0.0
|
|
3100
|
+
* @since 2025-09-30
|
|
3101
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3102
|
+
*/
|
|
3103
|
+
readonly sequenceId: Optional<string>;
|
|
3104
|
+
/** @description The position of the message within the sequence, which can be used to determine the order of messages in a sequence.
|
|
4058
3105
|
*
|
|
4059
3106
|
* @author Xeno
|
|
4060
3107
|
* @version 1.0.0
|
|
4061
3108
|
* @since 2025-09-30
|
|
4062
3109
|
* @link https://github.com/xeno-js/xeno-js
|
|
4063
3110
|
*/
|
|
4064
|
-
|
|
4065
|
-
/** The
|
|
3111
|
+
readonly position: Optional<number>;
|
|
3112
|
+
/** @description The total number of messages in the sequence, which can be used to determine the size of the sequence.
|
|
4066
3113
|
*
|
|
4067
3114
|
* @author Xeno
|
|
4068
3115
|
* @version 1.0.0
|
|
4069
3116
|
* @since 2025-09-30
|
|
4070
3117
|
* @link https://github.com/xeno-js/xeno-js
|
|
4071
3118
|
*/
|
|
4072
|
-
|
|
4073
|
-
|
|
3119
|
+
readonly size: Optional<number>;
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* @description MessagingContext defines the structure for messaging-related information used in message handling and processing. It includes properties such as return address, expiration time, and message sequence information, which can be used for managing message delivery, expiration, and sequencing in distributed systems.
|
|
3123
|
+
*
|
|
3124
|
+
* @author Xeno
|
|
3125
|
+
* @version 1.0.0
|
|
3126
|
+
* @since 2025-09-30
|
|
3127
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3128
|
+
*/
|
|
3129
|
+
interface MessagingContext {
|
|
3130
|
+
/** @description The return address for asynchronous responses, which can be used to specify where to send responses for asynchronous message processing.
|
|
4074
3131
|
*
|
|
4075
3132
|
* @author Xeno
|
|
4076
3133
|
* @version 1.0.0
|
|
4077
3134
|
* @since 2025-09-30
|
|
4078
3135
|
* @link https://github.com/xeno-js/xeno-js
|
|
4079
3136
|
*/
|
|
4080
|
-
|
|
4081
|
-
/** The
|
|
3137
|
+
readonly returnAddress: Optional<string>;
|
|
3138
|
+
/** @description The expiration time for the message, which can be used to determine when the message should be considered expired and no longer processed.
|
|
4082
3139
|
*
|
|
4083
3140
|
* @author Xeno
|
|
4084
3141
|
* @version 1.0.0
|
|
4085
3142
|
* @since 2025-09-30
|
|
4086
3143
|
* @link https://github.com/xeno-js/xeno-js
|
|
4087
3144
|
*/
|
|
4088
|
-
|
|
4089
|
-
/**
|
|
3145
|
+
readonly expiration: Optional<number>;
|
|
3146
|
+
/** @description The sequence information for the message, which can be used to manage the order and grouping of messages in a sequence.
|
|
4090
3147
|
*
|
|
4091
3148
|
* @author Xeno
|
|
4092
3149
|
* @version 1.0.0
|
|
4093
3150
|
* @since 2025-09-30
|
|
4094
3151
|
* @link https://github.com/xeno-js/xeno-js
|
|
4095
3152
|
*/
|
|
4096
|
-
|
|
4097
|
-
|
|
3153
|
+
readonly sequence: Optional<MessageSequence>;
|
|
3154
|
+
}
|
|
3155
|
+
|
|
3156
|
+
/**
|
|
3157
|
+
* @description NetworkContext defines the structure for network-related information used in logging and monitoring. It includes a request ID for ensuring idempotency and a client IP address for audit logging purposes.
|
|
3158
|
+
*
|
|
3159
|
+
* @author Xeno
|
|
3160
|
+
* @version 1.0.0
|
|
3161
|
+
* @since 2025-09-30
|
|
3162
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3163
|
+
*/
|
|
3164
|
+
interface NetworkContext {
|
|
3165
|
+
/** A unique identifier for the request, which can be used for ensuring idempotency and tracing purposes.
|
|
4098
3166
|
*
|
|
4099
3167
|
* @author Xeno
|
|
4100
3168
|
* @version 1.0.0
|
|
4101
3169
|
* @since 2025-09-30
|
|
4102
3170
|
* @link https://github.com/xeno-js/xeno-js
|
|
4103
3171
|
*/
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
/**
|
|
4107
|
-
* A class representing an application error, which extends the built-in Error class.
|
|
4108
|
-
* It includes additional properties such as an error code and an HTTP status code.
|
|
4109
|
-
|
|
4110
|
-
*
|
|
4111
|
-
* @author Xeno
|
|
4112
|
-
* @version 1.0.0
|
|
4113
|
-
* @since 2025-09-30
|
|
4114
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4115
|
-
*/
|
|
4116
|
-
declare class AppError extends Error {
|
|
4117
|
-
/**
|
|
4118
|
-
* The error code representing the type of error.
|
|
4119
|
-
|
|
3172
|
+
readonly requestId: Guid;
|
|
3173
|
+
/** The IP address of the client making the request, which can be used for audit logging and security purposes.
|
|
4120
3174
|
*
|
|
4121
3175
|
* @author Xeno
|
|
4122
3176
|
* @version 1.0.0
|
|
4123
3177
|
* @since 2025-09-30
|
|
4124
3178
|
* @link https://github.com/xeno-js/xeno-js
|
|
4125
3179
|
*/
|
|
4126
|
-
readonly
|
|
4127
|
-
/**
|
|
4128
|
-
* The HTTP status code associated with the error.
|
|
4129
|
-
|
|
3180
|
+
readonly clientIp: Optional<string>;
|
|
3181
|
+
/** The user agent string of the client making the request, which can be used for audit logging and security purposes.
|
|
4130
3182
|
*
|
|
4131
3183
|
* @author Xeno
|
|
4132
3184
|
* @version 1.0.0
|
|
4133
3185
|
* @since 2025-09-30
|
|
4134
3186
|
* @link https://github.com/xeno-js/xeno-js
|
|
4135
3187
|
*/
|
|
4136
|
-
readonly
|
|
4137
|
-
/**
|
|
4138
|
-
* A Dictionary to hold any additional context or information related to the error.
|
|
3188
|
+
readonly userAgent: Optional<string>;
|
|
3189
|
+
/** The format indicator for the request, which can be used for content negotiation and logging purposes.
|
|
4139
3190
|
*
|
|
4140
3191
|
* @author Xeno
|
|
4141
3192
|
* @version 1.0.0
|
|
4142
3193
|
* @since 2025-09-30
|
|
4143
3194
|
* @link https://github.com/xeno-js/xeno-js
|
|
4144
3195
|
*/
|
|
4145
|
-
readonly
|
|
4146
|
-
/**
|
|
4147
|
-
* Private constructor to prevent direct instantiation. Use the static methods `create` and `throw` to create instances.
|
|
4148
|
-
*
|
|
4149
|
-
* @param payload - The payload containing error details.
|
|
4150
|
-
|
|
3196
|
+
readonly formatIndicator: Optional<string>;
|
|
3197
|
+
/** The path of the request, which can be used for routing, logging, or applying specific middleware logic.
|
|
4151
3198
|
*
|
|
4152
3199
|
* @author Xeno
|
|
4153
3200
|
* @version 1.0.0
|
|
4154
3201
|
* @since 2025-09-30
|
|
4155
3202
|
* @link https://github.com/xeno-js/xeno-js
|
|
4156
3203
|
*/
|
|
4157
|
-
|
|
3204
|
+
readonly path: Optional<string>;
|
|
4158
3205
|
/**
|
|
4159
|
-
*
|
|
4160
|
-
*
|
|
4161
|
-
* @param payload - The payload containing error details.
|
|
4162
|
-
* @returns An AppError instance representing the error.
|
|
4163
|
-
|
|
3206
|
+
* @description The CSRF token for the request, which can be used for preventing cross-site request forgery attacks.
|
|
4164
3207
|
*
|
|
4165
3208
|
* @author Xeno
|
|
4166
3209
|
* @version 1.0.0
|
|
4167
3210
|
* @since 2025-09-30
|
|
4168
3211
|
* @link https://github.com/xeno-js/xeno-js
|
|
4169
3212
|
*/
|
|
4170
|
-
|
|
3213
|
+
readonly csrf: Optional<string>;
|
|
4171
3214
|
/**
|
|
4172
|
-
*
|
|
4173
|
-
* @param payload - The payload containing error details.
|
|
4174
|
-
* @throws An AppError instance representing the error.
|
|
4175
|
-
|
|
3215
|
+
* @description The CSRF cookie for the request, which can be used for preventing cross-site request forgery attacks.
|
|
4176
3216
|
*
|
|
4177
3217
|
* @author Xeno
|
|
4178
3218
|
* @version 1.0.0
|
|
4179
3219
|
* @since 2025-09-30
|
|
4180
3220
|
* @link https://github.com/xeno-js/xeno-js
|
|
4181
3221
|
*/
|
|
4182
|
-
|
|
3222
|
+
readonly csrfCookie: Optional<string>;
|
|
4183
3223
|
/**
|
|
4184
|
-
*
|
|
4185
|
-
* @param name - The name of the error, typically the class name or context where the error occurred.
|
|
4186
|
-
* @returns An AppError instance representing the aborted request error.
|
|
4187
|
-
|
|
3224
|
+
* @description The transport used for the request, which can be used for logging, monitoring, or applying specific middleware logic.
|
|
4188
3225
|
*
|
|
4189
3226
|
* @author Xeno
|
|
4190
3227
|
* @version 1.0.0
|
|
4191
3228
|
* @since 2025-09-30
|
|
4192
3229
|
* @link https://github.com/xeno-js/xeno-js
|
|
4193
3230
|
*/
|
|
4194
|
-
|
|
3231
|
+
readonly transport: Optional<{
|
|
3232
|
+
req: ExtendedRequest;
|
|
3233
|
+
res: Response;
|
|
3234
|
+
}>;
|
|
4195
3235
|
/**
|
|
4196
|
-
*
|
|
4197
|
-
* @param signal - The AbortSignal to check for abortion.
|
|
4198
|
-
* @param name - The name of the error, typically the class name or context where the error occurred.
|
|
4199
|
-
|
|
3236
|
+
* @description The origin of the request, which can be used for logging, monitoring, or applying specific middleware logic.
|
|
4200
3237
|
*
|
|
4201
3238
|
* @author Xeno
|
|
4202
3239
|
* @version 1.0.0
|
|
4203
3240
|
* @since 2025-09-30
|
|
4204
3241
|
* @link https://github.com/xeno-js/xeno-js
|
|
4205
3242
|
*/
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
3243
|
+
readonly origin: Optional<string>;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3246
|
+
/**
|
|
3247
|
+
* @description TracingContext defines the structure for tracing information used in logging and monitoring. It includes a correlation ID for tracking related operations, a start time for measuring duration, and an optional span ID for distributed tracing.
|
|
3248
|
+
|
|
3249
|
+
*
|
|
3250
|
+
* @author Xeno
|
|
3251
|
+
* @version 1.0.0
|
|
3252
|
+
* @since 2025-09-30
|
|
3253
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3254
|
+
*/
|
|
3255
|
+
interface TracingContext {
|
|
3256
|
+
/** A unique identifier for correlating related operations across different services or components.
|
|
4211
3257
|
*
|
|
4212
3258
|
* @author Xeno
|
|
4213
3259
|
* @version 1.0.0
|
|
4214
3260
|
* @since 2025-09-30
|
|
4215
3261
|
* @link https://github.com/xeno-js/xeno-js
|
|
4216
3262
|
*/
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
/** @description Creates an AppError instance representing a forbidden access error. This method is used to generate a standardized error response when a user attempts to access a resource or perform an action that they are not authorized to access, even if they are authenticated.
|
|
4220
|
-
* @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.
|
|
4221
|
-
* @param message A custom message describing the reason for the forbidden access. This message is included in the AppError's cause for detailed error reporting.
|
|
4222
|
-
* @returns An AppError instance representing the forbidden access error.
|
|
3263
|
+
readonly correlationId: Guid;
|
|
3264
|
+
/** The timestamp indicating when the operation started, used for measuring duration and performance.
|
|
4223
3265
|
*
|
|
4224
3266
|
* @author Xeno
|
|
4225
3267
|
* @version 1.0.0
|
|
4226
3268
|
* @since 2025-09-30
|
|
4227
3269
|
* @link https://github.com/xeno-js/xeno-js
|
|
4228
3270
|
*/
|
|
4229
|
-
|
|
4230
|
-
/**
|
|
4231
|
-
* @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.
|
|
4232
|
-
* @param message A custom message describing the reason for the bad request. This message is included in the AppError's cause for detailed error reporting.
|
|
4233
|
-
* @returns An AppError instance representing the bad request error.
|
|
3271
|
+
readonly startTime: number;
|
|
3272
|
+
/** An optional identifier for distributed tracing, which can be used to track the flow of requests across multiple services in a microservices architecture.
|
|
4234
3273
|
*
|
|
4235
3274
|
* @author Xeno
|
|
4236
3275
|
* @version 1.0.0
|
|
4237
3276
|
* @since 2025-09-30
|
|
4238
3277
|
* @link https://github.com/xeno-js/xeno-js
|
|
4239
3278
|
*/
|
|
4240
|
-
|
|
4241
|
-
/**
|
|
4242
|
-
* @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.
|
|
4243
|
-
* @param message A custom message describing the reason for the validation failure. This message is included in the AppError's cause for detailed error reporting.
|
|
4244
|
-
* @returns An AppError instance representing the validation error.
|
|
3279
|
+
readonly spanId: Optional<string>;
|
|
3280
|
+
/** An optional identifier for the parent span in distributed tracing, which can be used to establish a hierarchy of spans and track the flow of requests across multiple services in a microservices architecture.
|
|
4245
3281
|
*
|
|
4246
3282
|
* @author Xeno
|
|
4247
3283
|
* @version 1.0.0
|
|
4248
3284
|
* @since 2025-09-30
|
|
4249
3285
|
* @link https://github.com/xeno-js/xeno-js
|
|
4250
3286
|
*/
|
|
4251
|
-
|
|
4252
|
-
/**
|
|
4253
|
-
* @
|
|
4254
|
-
* @param message A custom message describing the reason for the conflict. This message is included in the AppError's cause for detailed error reporting.
|
|
4255
|
-
* @returns An AppError instance representing the conflict error.
|
|
3287
|
+
readonly parentSpanId: Optional<string>;
|
|
3288
|
+
/**
|
|
3289
|
+
* @description The referer header of the request.
|
|
4256
3290
|
*
|
|
4257
3291
|
* @author Xeno
|
|
4258
3292
|
* @version 1.0.0
|
|
4259
3293
|
* @since 2025-09-30
|
|
4260
3294
|
* @link https://github.com/xeno-js/xeno-js
|
|
4261
3295
|
*/
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
3296
|
+
readonly referer?: Optional<string>;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
/**
|
|
3300
|
+
* @description RequestContext defines the structure for the context of a request execution, which includes the identity of the user or system executing the request, the network context for tracing and logging purposes, and the tracing context for distributed tracing across services. This context is essential for ensuring proper authentication, authorization, and observability in a distributed system.
|
|
3301
|
+
*
|
|
3302
|
+
* @author Xeno
|
|
3303
|
+
* @version 1.0.0
|
|
3304
|
+
* @since 2025-09-30
|
|
3305
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3306
|
+
*/
|
|
3307
|
+
interface RequestContext {
|
|
3308
|
+
/** The identity of the user or system executing the request, which can be used for authentication and authorization purposes.
|
|
4267
3309
|
*
|
|
4268
3310
|
* @author Xeno
|
|
4269
3311
|
* @version 1.0.0
|
|
4270
3312
|
* @since 2025-09-30
|
|
4271
3313
|
* @link https://github.com/xeno-js/xeno-js
|
|
4272
3314
|
*/
|
|
4273
|
-
|
|
4274
|
-
/**
|
|
4275
|
-
* @param name The name of the error, typically the class name or context where the error occurred. This helps in identifying the source of the error in logs and error reports.
|
|
4276
|
-
* @param message A custom message describing the reason for the Authentication failed. This message is included in the AppError's cause for detailed error reporting.
|
|
4277
|
-
* @returns An AppError instance representing the Authentication failed.
|
|
3315
|
+
readonly identity: Identity;
|
|
3316
|
+
/** The network context of the request, which includes information such as the client's IP address and request ID for tracing purposes.
|
|
4278
3317
|
*
|
|
4279
3318
|
* @author Xeno
|
|
4280
3319
|
* @version 1.0.0
|
|
4281
3320
|
* @since 2025-09-30
|
|
4282
3321
|
* @link https://github.com/xeno-js/xeno-js
|
|
4283
3322
|
*/
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
/**
|
|
4288
|
-
* A class representing the result of an operation, which can either be a success or a failure.
|
|
4289
|
-
* It encapsulates the value of a successful operation or the error of a failed operation.
|
|
4290
|
-
*
|
|
4291
|
-
* @template TValue - The type of the value in case of a successful operation.
|
|
4292
|
-
* @template TError - The type of the error in case of a failed operation (default is never).
|
|
4293
|
-
|
|
4294
|
-
*
|
|
4295
|
-
* @author Xeno
|
|
4296
|
-
* @version 1.0.0
|
|
4297
|
-
* @since 2025-09-30
|
|
4298
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4299
|
-
*/
|
|
4300
|
-
declare class Result<TValue, TError = never> {
|
|
4301
|
-
/**
|
|
4302
|
-
* Indicates whether the operation was successful or not.
|
|
4303
|
-
|
|
3323
|
+
readonly network: NetworkContext;
|
|
3324
|
+
/** The tracing context of the request, which includes information for distributed tracing and correlation across services.
|
|
4304
3325
|
*
|
|
4305
3326
|
* @author Xeno
|
|
4306
3327
|
* @version 1.0.0
|
|
4307
3328
|
* @since 2025-09-30
|
|
4308
3329
|
* @link https://github.com/xeno-js/xeno-js
|
|
4309
3330
|
*/
|
|
4310
|
-
|
|
4311
|
-
/**
|
|
4312
|
-
* The error of the operation in case it failed.
|
|
4313
|
-
|
|
3331
|
+
readonly tracing: TracingContext;
|
|
3332
|
+
/** The messaging context of the request, which includes information related to messaging systems, such as return addresses and message expiration times. This context is useful for handling asynchronous communication and message-based workflows.
|
|
4314
3333
|
*
|
|
4315
3334
|
* @author Xeno
|
|
4316
3335
|
* @version 1.0.0
|
|
4317
3336
|
* @since 2025-09-30
|
|
4318
3337
|
* @link https://github.com/xeno-js/xeno-js
|
|
4319
3338
|
*/
|
|
4320
|
-
|
|
3339
|
+
readonly messaging?: Maybe<MessagingContext>;
|
|
3340
|
+
}
|
|
3341
|
+
|
|
3342
|
+
interface IBaseAccessor<TCtx> extends IContextAccessor<TCtx>, IIdentityAccessor, INetworkContextAccessor {
|
|
3343
|
+
}
|
|
3344
|
+
/**
|
|
3345
|
+
* @description The IRequestContext interface is a contract that defines the structure and behavior of a request context within the application. It provides methods for executing asynchronous functions with the current user's identity context and retrieving the current user's identity information. This interface is essential for managing user identity and ensuring that identity-related data is properly propagated throughout the application.
|
|
3346
|
+
*
|
|
3347
|
+
*
|
|
3348
|
+
* @author Xeno
|
|
3349
|
+
* @version 1.0.0
|
|
3350
|
+
* @since 2025-09-30
|
|
3351
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3352
|
+
*/
|
|
3353
|
+
interface IIdentityAccessor {
|
|
4321
3354
|
/**
|
|
4322
|
-
*
|
|
4323
|
-
|
|
3355
|
+
* Retrieves the current user's identity information, including user ID, roles, and correlation ID. This method can be used to access identity data outside of the context of an asynchronous function, allowing for synchronous access to identity information when needed.
|
|
3356
|
+
* @returns An object representing the current user's identity, containing properties such as user ID, roles, and correlation ID. This information can be used for authentication and authorization purposes throughout the application.
|
|
4324
3357
|
*
|
|
4325
3358
|
* @author Xeno
|
|
4326
3359
|
* @version 1.0.0
|
|
4327
3360
|
* @since 2025-09-30
|
|
4328
3361
|
* @link https://github.com/xeno-js/xeno-js
|
|
4329
3362
|
*/
|
|
4330
|
-
|
|
3363
|
+
getIdentity(): Optional<Identity>;
|
|
3364
|
+
}
|
|
3365
|
+
/**
|
|
3366
|
+
* @description The IServiceScopeAccessor interface is a contract that defines the structure and behavior of a service scope accessor within the application. It provides a method for retrieving the current service scope, which allows for managing dependencies during the execution of a request. This interface is essential for ensuring that services are properly scoped and disposed of after the request is processed.
|
|
3367
|
+
*
|
|
3368
|
+
*
|
|
3369
|
+
* @author Xeno
|
|
3370
|
+
* @version 1.0.0
|
|
3371
|
+
* @since 2025-09-30
|
|
3372
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3373
|
+
*/
|
|
3374
|
+
interface IContextAccessor<TCtx> {
|
|
4331
3375
|
/**
|
|
4332
|
-
*
|
|
4333
|
-
*
|
|
4334
|
-
* @param isSuccess - A boolean indicating whether the operation was successful.
|
|
4335
|
-
* @param error - The error of the operation in case it failed (optional).
|
|
4336
|
-
* @param value - The value of the operation in case it succeeded (optional).
|
|
4337
|
-
|
|
3376
|
+
* Retrieves the current context, which can include information about the identity of the user or system executing the request, as well as network and tracing contexts for observability. This method allows for synchronous access to context-related data when needed.
|
|
3377
|
+
* @returns An object representing the current context, containing properties such as identity, network, and tracing contexts. This information can be used for managing execution context and ensuring that context-related data is accessible when needed.
|
|
4338
3378
|
*
|
|
4339
3379
|
* @author Xeno
|
|
4340
3380
|
* @version 1.0.0
|
|
4341
3381
|
* @since 2025-09-30
|
|
4342
3382
|
* @link https://github.com/xeno-js/xeno-js
|
|
4343
3383
|
*/
|
|
4344
|
-
|
|
3384
|
+
getContext(): Optional<TCtx>;
|
|
3385
|
+
}
|
|
3386
|
+
/**
|
|
3387
|
+
* @description The IContextAccessor interface is a contract that defines the structure and behavior of a context accessor within the application. It provides a method for retrieving the current context, which can include information about the identity of the user or system executing the request, as well as network and tracing contexts for observability. This interface is essential for managing execution context and ensuring that context-related data is accessible when needed.
|
|
3388
|
+
*
|
|
3389
|
+
*
|
|
3390
|
+
* @author Xeno
|
|
3391
|
+
* @version 1.0.0
|
|
3392
|
+
* @since 2025-09-30
|
|
3393
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3394
|
+
*/
|
|
3395
|
+
interface INetworkContextAccessor {
|
|
4345
3396
|
/**
|
|
4346
|
-
*
|
|
4347
|
-
*
|
|
4348
|
-
* @param value - The value of the successful operation.
|
|
4349
|
-
* @returns A Result instance representing a successful operation.
|
|
4350
|
-
|
|
3397
|
+
* Retrieves the current network context, which can include information about the request ID, correlation ID, and other network-related data. This method allows for synchronous access to network context-related data when needed.
|
|
3398
|
+
* @returns An object representing the current network context, containing properties such as request ID, correlation ID, and other network-related data. This information can be used for managing execution context and ensuring that network context-related data is accessible when needed.
|
|
4351
3399
|
*
|
|
4352
3400
|
* @author Xeno
|
|
4353
3401
|
* @version 1.0.0
|
|
4354
3402
|
* @since 2025-09-30
|
|
4355
3403
|
* @link https://github.com/xeno-js/xeno-js
|
|
4356
3404
|
*/
|
|
4357
|
-
|
|
3405
|
+
getNetworkContext(): Optional<NetworkContext>;
|
|
3406
|
+
}
|
|
3407
|
+
|
|
3408
|
+
/**
|
|
3409
|
+
* @fileoverview IController defines the interface for controllers in the application. A controller is responsible for handling incoming requests, processing them, and returning appropriate responses. The IController interface ensures that all controllers adhere to a consistent structure, making it easier to manage and maintain the application's request handling logic. Each controller must implement the handle method, which takes an incoming request and returns a response, typically as a promise to accommodate asynchronous operations.
|
|
3410
|
+
*
|
|
3411
|
+
* @author Xeno
|
|
3412
|
+
* @version 1.0.0
|
|
3413
|
+
* @since 2025-09-30
|
|
3414
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3415
|
+
*/
|
|
3416
|
+
interface IController<TRequest = unknown, TResponse = unknown> {
|
|
4358
3417
|
/**
|
|
4359
|
-
*
|
|
4360
|
-
*
|
|
4361
|
-
* @param
|
|
4362
|
-
* @returns A
|
|
4363
|
-
|
|
3418
|
+
* Handles an incoming request and returns a response.
|
|
3419
|
+
* @param request - The incoming request object.
|
|
3420
|
+
* @param signal - The AbortSignal
|
|
3421
|
+
* @returns A promise that resolves to a ResponseDto containing the response object.
|
|
4364
3422
|
*
|
|
4365
3423
|
* @author Xeno
|
|
4366
3424
|
* @version 1.0.0
|
|
4367
3425
|
* @since 2025-09-30
|
|
4368
|
-
* @link https://github.com/xeno-js/xeno-
|
|
3426
|
+
* @link https://github.com/xeno-js/xeno-shared
|
|
4369
3427
|
*/
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
3428
|
+
handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* @fileoverview Defines the IRequest interface for requests in a CQRS architecture.
|
|
3433
|
+
|
|
3434
|
+
*
|
|
3435
|
+
* @author Xeno
|
|
3436
|
+
* @version 1.0.0
|
|
3437
|
+
* @since 2025-09-30
|
|
3438
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3439
|
+
*/
|
|
3440
|
+
interface IRequest<TResponse = unknown> {
|
|
3441
|
+
readonly $type?: TResponse;
|
|
3442
|
+
/** @description The intent of the request, which can be used to describe the purpose or action associated with the request.
|
|
4376
3443
|
*
|
|
4377
3444
|
* @author Xeno
|
|
4378
3445
|
* @version 1.0.0
|
|
4379
3446
|
* @since 2025-09-30
|
|
4380
3447
|
* @link https://github.com/xeno-js/xeno-js
|
|
4381
3448
|
*/
|
|
4382
|
-
|
|
4383
|
-
/**
|
|
4384
|
-
* Gets the value of the result or throws an error if the result is a failure.
|
|
4385
|
-
*
|
|
4386
|
-
* @returns The value of the result.
|
|
4387
|
-
* @throws An error if the result is a failure.
|
|
4388
|
-
|
|
3449
|
+
readonly intent: string;
|
|
3450
|
+
/** @description The type of the request, which can be used to distinguish between different kinds of requests (e.g., command, query).
|
|
4389
3451
|
*
|
|
4390
3452
|
* @author Xeno
|
|
4391
3453
|
* @version 1.0.0
|
|
4392
3454
|
* @since 2025-09-30
|
|
4393
3455
|
* @link https://github.com/xeno-js/xeno-js
|
|
4394
3456
|
*/
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
3457
|
+
readonly type: RequestType;
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
/**
|
|
3461
|
+
* @fileoverview Defines the ICommand interface for base requests in a CQRS architecture.
|
|
3462
|
+
|
|
3463
|
+
*
|
|
3464
|
+
* @author Xeno
|
|
3465
|
+
* @version 1.0.0
|
|
3466
|
+
* @since 2025-09-30
|
|
3467
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3468
|
+
*/
|
|
3469
|
+
/**
|
|
3470
|
+
* @description An interface representing a base request in a CQRS architecture. This interface can be implemented by both command and query requests, as it includes common properties such as the request type, timestamp, and a unique token for identification.
|
|
3471
|
+
|
|
3472
|
+
*
|
|
3473
|
+
* @author Xeno
|
|
3474
|
+
* @version 1.0.0
|
|
3475
|
+
* @since 2025-09-30
|
|
3476
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3477
|
+
*/
|
|
3478
|
+
interface ICommand<TResponse = unknown> extends IRequest<TResponse> {
|
|
3479
|
+
/** @description An optional property to specify the expected response type of the command, which can be used for type inference and validation in command handlers.
|
|
4402
3480
|
*
|
|
4403
3481
|
* @author Xeno
|
|
4404
3482
|
* @version 1.0.0
|
|
4405
3483
|
* @since 2025-09-30
|
|
4406
3484
|
* @link https://github.com/xeno-js/xeno-js
|
|
4407
3485
|
*/
|
|
4408
|
-
|
|
3486
|
+
readonly $type?: TResponse;
|
|
4409
3487
|
}
|
|
4410
3488
|
|
|
4411
3489
|
/**
|
|
4412
|
-
*
|
|
4413
|
-
|
|
4414
|
-
|
|
3490
|
+
* @fileoverview Defines the IQuery interface for query requests in a CQRS architecture.
|
|
3491
|
+
|
|
3492
|
+
*
|
|
3493
|
+
* @author Xeno
|
|
3494
|
+
* @version 1.0.0
|
|
3495
|
+
* @since 2025-09-30
|
|
3496
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3497
|
+
*/
|
|
3498
|
+
/**
|
|
3499
|
+
* @description An interface representing a paginated query request, which extends the IQuery interface and includes pagination parameters.
|
|
4415
3500
|
|
|
4416
3501
|
*
|
|
4417
3502
|
* @author Xeno
|
|
@@ -4419,7 +3504,17 @@ declare class Result<TValue, TError = never> {
|
|
|
4419
3504
|
* @since 2025-09-30
|
|
4420
3505
|
* @link https://github.com/xeno-js/xeno-js
|
|
4421
3506
|
*/
|
|
4422
|
-
|
|
3507
|
+
interface IQuery<TResponse = unknown> extends IRequest<TResponse> {
|
|
3508
|
+
/**
|
|
3509
|
+
* @description Cache options for the query, including cache key, TTL, and bypass flags.
|
|
3510
|
+
*
|
|
3511
|
+
* @author Xeno
|
|
3512
|
+
* @version 1.0.0
|
|
3513
|
+
* @since 2025-09-30
|
|
3514
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3515
|
+
*/
|
|
3516
|
+
readonly cacheOptions: ICacheableOptions;
|
|
3517
|
+
}
|
|
4423
3518
|
|
|
4424
3519
|
/**
|
|
4425
3520
|
* An interface representing a handler for processing requests in a CQRS (Command Query Responsibility Segregation) pattern.
|
|
@@ -4792,86 +3887,6 @@ interface IGateKeeper {
|
|
|
4792
3887
|
authenticate(token: Optional<string>): Promise<ResultType<Identity>>;
|
|
4793
3888
|
}
|
|
4794
3889
|
|
|
4795
|
-
/**
|
|
4796
|
-
* @description Agnostic contract used to execute HTTP calls independently from concrete transport libraries (fetch, axios, undici, etc.).
|
|
4797
|
-
|
|
4798
|
-
*
|
|
4799
|
-
* @author Xeno
|
|
4800
|
-
* @version 1.0.0
|
|
4801
|
-
* @since 2025-09-30
|
|
4802
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4803
|
-
*/
|
|
4804
|
-
interface IHttpClient {
|
|
4805
|
-
/**
|
|
4806
|
-
* @description Executes an HTTP GET request to the specified URL with optional request options.
|
|
4807
|
-
* @param url The URL to which the GET request is sent. This can be an absolute or relative URL depending on the configuration of the HTTP client.
|
|
4808
|
-
* @param options Optional request options that can include headers, query parameters, abort signal, and timeout settings. These options allow for customization of the HTTP request, such as adding specific headers, including query parameters in the URL, setting a timeout for the request, or providing an abort signal to cancel the request if needed.
|
|
4809
|
-
* @returns A promise that resolves to an HttpResponse object containing the status code, response headers, and response data from the server. The HttpResponse object provides information about the outcome of the HTTP request, including whether it was successful (status code 2xx) or if there was an error (status code 4xx or 5xx).
|
|
4810
|
-
|
|
4811
|
-
*
|
|
4812
|
-
* @author Xeno
|
|
4813
|
-
* @version 1.0.0
|
|
4814
|
-
* @since 2025-09-30
|
|
4815
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4816
|
-
*/
|
|
4817
|
-
get<TResponse = unknown>(url: string, options: Optional<Omit<HttpRequest<never>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
4818
|
-
/**
|
|
4819
|
-
* @description Executes an HTTP POST request to the specified URL with the provided request body and optional request options.
|
|
4820
|
-
* @param url The URL to which the POST request is sent. This can be an absolute or relative URL depending on the configuration of the HTTP client.
|
|
4821
|
-
* @param body The request body to be sent with the POST request. This can be of any type, such as an object, string, or FormData, depending on the requirements of the server endpoint.
|
|
4822
|
-
* @param options Optional request options that can include headers, query parameters, abort signal, and timeout settings. These options allow for customization of the HTTP request, such as adding specific headers, including query parameters in the URL, setting a timeout for the request, or providing an abort signal to cancel the request if needed.
|
|
4823
|
-
* @returns A promise that resolves to an HttpResponse object containing the status code, response headers, and response data from the server. The HttpResponse object provides information about the outcome of the HTTP request, including whether it was successful (status code 2xx) or if there was an error (status code 4xx or 5xx).
|
|
4824
|
-
|
|
4825
|
-
*
|
|
4826
|
-
* @author Xeno
|
|
4827
|
-
* @version 1.0.0
|
|
4828
|
-
* @since 2025-09-30
|
|
4829
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4830
|
-
*/
|
|
4831
|
-
post<TResponse = unknown, TBody = unknown>(url: string, body: Optional<TBody>, options: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
4832
|
-
/**
|
|
4833
|
-
* @description Executes an HTTP PUT request to the specified URL with the provided request body and optional request options.
|
|
4834
|
-
* @param url The URL to which the PUT request is sent. This can be an absolute or relative URL depending on the configuration of the HTTP client.
|
|
4835
|
-
* @param body The request body to be sent with the PUT request. This can be of any type, such as an object, string, or FormData, depending on the requirements of the server endpoint.
|
|
4836
|
-
* @param options Optional request options that can include headers, query parameters, abort signal, and timeout settings. These options allow for customization of the HTTP request, such as adding specific headers, including query parameters in the URL, setting a timeout for the request, or providing an abort signal to cancel the request if needed.
|
|
4837
|
-
* @returns A promise that resolves to an HttpResponse object containing the status code, response headers, and response data from the server. The HttpResponse object provides information about the outcome of the HTTP request, including whether it was successful (status code 2xx) or if there was an error (status code 4xx or 5xx).
|
|
4838
|
-
|
|
4839
|
-
*
|
|
4840
|
-
* @author Xeno
|
|
4841
|
-
* @version 1.0.0
|
|
4842
|
-
* @since 2025-09-30
|
|
4843
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4844
|
-
*/
|
|
4845
|
-
put<TResponse = unknown, TBody = unknown>(url: string, body: Optional<TBody>, options: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
4846
|
-
/**
|
|
4847
|
-
* @description Executes an HTTP PATCH request to the specified URL with the provided request body and optional request options.
|
|
4848
|
-
* @param url The URL to which the PATCH request is sent. This can be an absolute or relative URL depending on the configuration of the HTTP client.
|
|
4849
|
-
* @param body The request body to be sent with the PATCH request. This can be of any type, such as an object, string, or FormData, depending on the requirements of the server endpoint.
|
|
4850
|
-
* @param options Optional request options that can include headers, query parameters, abort signal, and timeout settings. These options allow for customization of the HTTP request, such as adding specific headers, including query parameters in the URL, setting a timeout for the request, or providing an abort signal to cancel the request if needed.
|
|
4851
|
-
* @returns A promise that resolves to an HttpResponse object containing the status code, response headers, and response data from the server. The HttpResponse object provides information about the outcome of the HTTP request, including whether it was successful (status code 2xx) or if there was an error (status code 4xx or 5xx).
|
|
4852
|
-
|
|
4853
|
-
*
|
|
4854
|
-
* @author Xeno
|
|
4855
|
-
* @version 1.0.0
|
|
4856
|
-
* @since 2025-09-30
|
|
4857
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4858
|
-
*/
|
|
4859
|
-
patch<TResponse = unknown, TBody = unknown>(url: string, body: Optional<TBody>, options: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
4860
|
-
/**
|
|
4861
|
-
* @description Executes an HTTP DELETE request to the specified URL with optional request options.
|
|
4862
|
-
* @param url The URL to which the DELETE request is sent. This can be an absolute or relative URL depending on the configuration of the HTTP client.
|
|
4863
|
-
* @param options Optional request options that can include headers, query parameters, abort signal, and timeout settings. These options allow for customization of the HTTP request, such as adding specific headers, including query parameters in the URL, setting a timeout for the request, or providing an abort signal to cancel the request if needed.
|
|
4864
|
-
* @returns A promise that resolves to an HttpResponse object containing the status code, response headers, and response data from the server. The HttpResponse object provides information about the outcome of the HTTP request, including whether it was successful (status code 2xx) or if there was an error (status code 4xx or 5xx).
|
|
4865
|
-
|
|
4866
|
-
*
|
|
4867
|
-
* @author Xeno
|
|
4868
|
-
* @version 1.0.0
|
|
4869
|
-
* @since 2025-09-30
|
|
4870
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4871
|
-
*/
|
|
4872
|
-
delete<TResponse = unknown>(url: string, options: Optional<Omit<HttpRequest<never>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
4873
|
-
}
|
|
4874
|
-
|
|
4875
3890
|
/**
|
|
4876
3891
|
* @description Interface for an idempotency store that provides methods for acquiring locks, checking if a command has been processed, marking commands as processed with associated payloads, retrieving stored payloads, and releasing locks. This interface is designed to support idempotent command processing in a distributed system, ensuring that duplicate commands are not processed multiple times and that the results of previously processed commands can be retrieved when necessary.
|
|
4877
3892
|
|
|
@@ -4942,67 +3957,6 @@ interface IIdempotencyStore {
|
|
|
4942
3957
|
releaseLock(commandId: string): Promise<void>;
|
|
4943
3958
|
}
|
|
4944
3959
|
|
|
4945
|
-
/**
|
|
4946
|
-
* @description Interface for a logger that provides methods for logging messages at different levels (info, warn, error, debug) and tracking exceptions. Each logging method accepts a message and an optional context, while the error method also accepts an optional Error object.
|
|
4947
|
-
|
|
4948
|
-
*
|
|
4949
|
-
* @author Xeno
|
|
4950
|
-
* @version 1.0.0
|
|
4951
|
-
* @since 2025-09-30
|
|
4952
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4953
|
-
*/
|
|
4954
|
-
interface ILogger {
|
|
4955
|
-
/**
|
|
4956
|
-
* Log a message at the info level with an optional context.
|
|
4957
|
-
* @param message The message to log.
|
|
4958
|
-
* @param context An optional dictionary containing additional context for the log message.
|
|
4959
|
-
|
|
4960
|
-
*
|
|
4961
|
-
* @author Xeno
|
|
4962
|
-
* @version 1.0.0
|
|
4963
|
-
* @since 2025-09-30
|
|
4964
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4965
|
-
*/
|
|
4966
|
-
info(message: string): void;
|
|
4967
|
-
/**
|
|
4968
|
-
* Log a message at the warning level with an optional context.
|
|
4969
|
-
* @param message The message to log.
|
|
4970
|
-
* @param context An optional dictionary containing additional context for the log message.
|
|
4971
|
-
|
|
4972
|
-
*
|
|
4973
|
-
* @author Xeno
|
|
4974
|
-
* @version 1.0.0
|
|
4975
|
-
* @since 2025-09-30
|
|
4976
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4977
|
-
*/
|
|
4978
|
-
warn(message: string): void;
|
|
4979
|
-
/**
|
|
4980
|
-
* Log a message at the error level with an optional error object and context.
|
|
4981
|
-
* @param message The message to log.
|
|
4982
|
-
* @param error An optional unknown object associated with the log message.
|
|
4983
|
-
* @param context An optional dictionary containing additional context for the log message.
|
|
4984
|
-
|
|
4985
|
-
*
|
|
4986
|
-
* @author Xeno
|
|
4987
|
-
* @version 1.0.0
|
|
4988
|
-
* @since 2025-09-30
|
|
4989
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
4990
|
-
*/
|
|
4991
|
-
error(message: string, error: Optional<unknown>): void;
|
|
4992
|
-
/**
|
|
4993
|
-
* Log a message at the debug level with an optional context.
|
|
4994
|
-
* @param message The message to log.
|
|
4995
|
-
* @param context An optional dictionary containing additional context for the log message.
|
|
4996
|
-
|
|
4997
|
-
*
|
|
4998
|
-
* @author Xeno
|
|
4999
|
-
* @version 1.0.0
|
|
5000
|
-
* @since 2025-09-30
|
|
5001
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5002
|
-
*/
|
|
5003
|
-
debug(message: string): void;
|
|
5004
|
-
}
|
|
5005
|
-
|
|
5006
3960
|
/**
|
|
5007
3961
|
* @description Interface for a logger client that provides a method for tracking log messages with a specified log level, message, optional context, and optional error.
|
|
5008
3962
|
|
|
@@ -5052,39 +4006,6 @@ interface LoggerContext {
|
|
|
5052
4006
|
messaging?: Maybe<MessagingContext>;
|
|
5053
4007
|
}
|
|
5054
4008
|
|
|
5055
|
-
/**
|
|
5056
|
-
* @description Generic mapper interface defining a contract for mapping objects of type TSource to type TDestination. Mappers are used to convert data between different layers of the application, such as transforming DTOs to domain entities or vice versa. This interface defines a contract that all mappers must implement, ensuring consistency and maintainability of the code.
|
|
5057
|
-
* @template TSource The type of the source object to be mapped.
|
|
5058
|
-
* @template TDestination The type of the destination object resulting from the mapping.
|
|
5059
|
-
* @example
|
|
5060
|
-
* // Example of a UserMapper that maps a UserDTO to a UserEntity
|
|
5061
|
-
* class UserMapper implements IBaseMapper<UserDTO, UserEntity> {
|
|
5062
|
-
* map(source: UserDTO): UserEntity {
|
|
5063
|
-
* // Mapping logic here
|
|
5064
|
-
* }
|
|
5065
|
-
* }
|
|
5066
|
-
|
|
5067
|
-
*
|
|
5068
|
-
* @author Xeno
|
|
5069
|
-
* @version 1.0.0
|
|
5070
|
-
* @since 2025-09-30
|
|
5071
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5072
|
-
*/
|
|
5073
|
-
interface IBaseMapper<TSource, TDestination> {
|
|
5074
|
-
/**
|
|
5075
|
-
* @description Maps an object of type TSource to an object of type TDestination. The implementation of this method should contain the logic for transforming the source object into the desired destination format, which may involve copying properties, converting data types, or applying any necessary transformations to ensure that the resulting object is correctly structured for its intended use.
|
|
5076
|
-
* @param source The source object of type TSource that needs to be mapped to type TDestination. This object contains the data that will be transformed and returned as a new object of the destination type.
|
|
5077
|
-
* @returns An object of type TDestination that is the result of mapping the source object. The returned object should be a new instance that represents the transformed data according to the mapping logic defined in the implementation of this method.
|
|
5078
|
-
|
|
5079
|
-
*
|
|
5080
|
-
* @author Xeno
|
|
5081
|
-
* @version 1.0.0
|
|
5082
|
-
* @since 2025-09-30
|
|
5083
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5084
|
-
*/
|
|
5085
|
-
map(source: TSource): TDestination;
|
|
5086
|
-
}
|
|
5087
|
-
|
|
5088
4009
|
/**
|
|
5089
4010
|
* @description Contratto per i Mapper, che definisce i metodi per convertire tra entità e Data Transfer Object (DTO).
|
|
5090
4011
|
*
|
|
@@ -5332,94 +4253,6 @@ interface IRepository<T> {
|
|
|
5332
4253
|
delete(entity: T, ctx: UserContext, signal: Optional<AbortSignal>): Promise<ResultType<void>>;
|
|
5333
4254
|
}
|
|
5334
4255
|
|
|
5335
|
-
/**
|
|
5336
|
-
* @description IAuthService defines the contract for authentication services.
|
|
5337
|
-
* It provides methods to check if a user is authenticated and to retrieve the user's claims.
|
|
5338
|
-
*
|
|
5339
|
-
* @author Xeno
|
|
5340
|
-
* @version 1.0.0
|
|
5341
|
-
* @since 2025-09-30
|
|
5342
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5343
|
-
*/
|
|
5344
|
-
interface IBaseAuthService {
|
|
5345
|
-
/**
|
|
5346
|
-
* Checks if the user is authenticated.
|
|
5347
|
-
* @returns A promise that resolves to true if the user is authenticated, false otherwise.
|
|
5348
|
-
*
|
|
5349
|
-
* @author Xeno
|
|
5350
|
-
* @version 1.0.0
|
|
5351
|
-
* @since 2025-09-30
|
|
5352
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5353
|
-
*/
|
|
5354
|
-
isAuthenticated(): Promise<boolean>;
|
|
5355
|
-
/**
|
|
5356
|
-
* Retrieves the user's claims.
|
|
5357
|
-
* @returns A promise that resolves to the user's claims, or null if not authenticated.
|
|
5358
|
-
*
|
|
5359
|
-
* @author Xeno
|
|
5360
|
-
* @version 1.0.0
|
|
5361
|
-
* @since 2025-09-30
|
|
5362
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5363
|
-
*/
|
|
5364
|
-
getUser(): Promise<ResultType<Maybe<AuthClaims>>>;
|
|
5365
|
-
/**
|
|
5366
|
-
* Authenticates a user based on a token.
|
|
5367
|
-
* @param token The token to authenticate the user.
|
|
5368
|
-
* @returns A promise that resolves to the user's claims, or null if not authenticated.
|
|
5369
|
-
*
|
|
5370
|
-
* @author Xeno
|
|
5371
|
-
* @version 1.0.0
|
|
5372
|
-
* @since 2025-09-30
|
|
5373
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5374
|
-
*/
|
|
5375
|
-
authenticate(token: string): Promise<ResultType<AuthClaims>>;
|
|
5376
|
-
}
|
|
5377
|
-
/**
|
|
5378
|
-
* @description IAuthService defines the contract for authentication services.
|
|
5379
|
-
* It provides methods to check if a user is authenticated and to retrieve the user's claims.
|
|
5380
|
-
|
|
5381
|
-
*
|
|
5382
|
-
* @author Xeno
|
|
5383
|
-
* @version 1.0.0
|
|
5384
|
-
* @since 2025-09-30
|
|
5385
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5386
|
-
*/
|
|
5387
|
-
interface IAuthService {
|
|
5388
|
-
/**
|
|
5389
|
-
* Signs in a user by the specified provider.
|
|
5390
|
-
* @param provider The provider to use for signing in the user.
|
|
5391
|
-
* @returns A promise that resolves to the URL for the specified provider.
|
|
5392
|
-
*/
|
|
5393
|
-
signInWithProvider(provider: Provider): Promise<ResultType<{
|
|
5394
|
-
url: string;
|
|
5395
|
-
}>>;
|
|
5396
|
-
/**
|
|
5397
|
-
* @description Gets the current session of the user.
|
|
5398
|
-
* @returns A promise that resolves to the current session of the user.
|
|
5399
|
-
*/
|
|
5400
|
-
getSession(): Promise<ResultType<Maybe<Session>>>;
|
|
5401
|
-
/**
|
|
5402
|
-
* @description Signs out the user.
|
|
5403
|
-
* @returns A promise that resolves when the user is signed out.
|
|
5404
|
-
*/
|
|
5405
|
-
signOut(): Promise<ResultType<void>>;
|
|
5406
|
-
/**
|
|
5407
|
-
* @description Exchanges the code for a session.
|
|
5408
|
-
* @param code the code to exchange for a session
|
|
5409
|
-
* @returns A promise that resolves to the session wit
|
|
5410
|
-
*/
|
|
5411
|
-
exchangeCodeForSession(code: string): Promise<ResultType<Optional<Session>>>;
|
|
5412
|
-
}
|
|
5413
|
-
/**
|
|
5414
|
-
* @description An extended version of the IAuthService interface that includes additional methods for managing user sessions.
|
|
5415
|
-
* @author Xeno
|
|
5416
|
-
* @version 1.0.0
|
|
5417
|
-
* @since 2025-09-30
|
|
5418
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5419
|
-
*/
|
|
5420
|
-
interface IExtendendAuthService extends IBaseAuthService, IAuthService {
|
|
5421
|
-
}
|
|
5422
|
-
|
|
5423
4256
|
/**
|
|
5424
4257
|
* @description The IConcurrencyService interface provides a contract for executing multiple asynchronous tasks in parallel while strictly controlling the maximum number of concurrent executions. This is crucial for protecting system resources (CPU, RAM) and avoiding event loop blocking during massive batch operations (e.g., processing large CSV files, bulk database inserts).
|
|
5425
4258
|
|
|
@@ -5494,43 +4327,6 @@ interface IServiceResilience {
|
|
|
5494
4327
|
execute<T>(action: () => Promise<T>, signal: Optional<AbortSignal>): Promise<T>;
|
|
5495
4328
|
}
|
|
5496
4329
|
|
|
5497
|
-
/**
|
|
5498
|
-
* @description Interface for a validation service that provides methods to check for the existence of validation schemas and to validate data against those schemas. The IValidatorService interface defines two methods: hasSchema, which checks if a validation schema exists for a given key, and validate, which validates data against a specified schema key and returns a ResultType indicating the success or failure of the validation process. This interface can be implemented by various validation services that utilize different schema validation libraries or custom validation logic to ensure that incoming data meets the required criteria before being processed further in the application.
|
|
5499
|
-
|
|
5500
|
-
*
|
|
5501
|
-
* @author Xeno
|
|
5502
|
-
* @version 1.0.0
|
|
5503
|
-
* @since 2025-09-30
|
|
5504
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5505
|
-
*/
|
|
5506
|
-
interface IValidatorService {
|
|
5507
|
-
/**
|
|
5508
|
-
* @description Validates the provided data against the validation schema associated with the specified key. This method performs the actual validation logic, checking if the data conforms to the rules defined in the corresponding schema. It returns a ResultType indicating whether the validation was successful or if it failed, along with any relevant error information if the validation did not pass.
|
|
5509
|
-
* @param key The key representing the type of data or request for which the validation is being performed. This key is used to identify the appropriate validation schema to apply to the data.
|
|
5510
|
-
* @param data The data to be validated against the schema. This can be any type of data that needs to be checked for conformity with the validation rules defined in the schema.
|
|
5511
|
-
* @returns A ResultType indicating the outcome of the validation. If the validation is successful, it returns a ResultType with a value of true; if the validation fails, it returns a ResultType with a value of false and includes error information.
|
|
5512
|
-
|
|
5513
|
-
*
|
|
5514
|
-
* @author Xeno
|
|
5515
|
-
* @version 1.0.0
|
|
5516
|
-
* @since 2025-09-30
|
|
5517
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5518
|
-
*/
|
|
5519
|
-
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
5520
|
-
/**
|
|
5521
|
-
* @description Adds a new validation schema to the service's registry, associating it with the specified key. This method allows for dynamically registering validation schemas that can be used later for validating incoming data. The schema must conform to the expected structure defined by the validation library being used (e.g., Zod schemas). By adding schemas to the service, it enables the application to perform validation checks against those schemas when processing requests or data that require validation.
|
|
5522
|
-
* @param key The key representing the type of data or request for which the validation schema is being added. This key is used to identify the schema when performing validation checks.
|
|
5523
|
-
* @param schema The validation schema to be added, which defines the rules and structure that incoming data must conform to in order to pass validation. The specific type of the schema will depend on the validation library being used (e.g., ZodType for Zod schemas).
|
|
5524
|
-
|
|
5525
|
-
*
|
|
5526
|
-
* @author Xeno
|
|
5527
|
-
* @version 1.0.0
|
|
5528
|
-
* @since 2025-09-30
|
|
5529
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5530
|
-
*/
|
|
5531
|
-
addSchema(key: string, schema: unknown): void;
|
|
5532
|
-
}
|
|
5533
|
-
|
|
5534
4330
|
/**
|
|
5535
4331
|
* Interfaccia che definisce il contratto per una specifica di dominio.
|
|
5536
4332
|
* Una specifica permette di verificare se un oggetto (candidato)
|
|
@@ -5929,34 +4725,6 @@ declare const StorageHelper: Readonly<{
|
|
|
5929
4725
|
}) => Optional<IStorage>;
|
|
5930
4726
|
}>;
|
|
5931
4727
|
|
|
5932
|
-
/**
|
|
5933
|
-
* @description The SupabaseAuthService class is responsible for handling authentication-related operations using a SupabaseClient instance. It implements the IAuthService interface, providing methods to check if a user is authenticated and to retrieve authentication claims from a given token. The authenticate method interacts with the Supabase authentication API to fetch user information based on the provided token, while the isAuthenticated method checks if there is an active session. The class also includes error handling to create standardized authentication errors when necessary.
|
|
5934
|
-
*
|
|
5935
|
-
* @author Xeno
|
|
5936
|
-
* @version 1.0.0
|
|
5937
|
-
* @since 2025-09-30
|
|
5938
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5939
|
-
*/
|
|
5940
|
-
declare class SupabaseAuthService implements IBaseAuthService, IAuthService {
|
|
5941
|
-
private readonly _supabase;
|
|
5942
|
-
private readonly _mapper;
|
|
5943
|
-
private readonly _sessionMapper;
|
|
5944
|
-
private readonly _opts;
|
|
5945
|
-
constructor(_supabase: SupabaseClient, _mapper: IBaseMapper<User, AuthClaims>, _sessionMapper: IBaseMapper<Session$1, Session>, _opts: {
|
|
5946
|
-
redirectTo: Optional<string>;
|
|
5947
|
-
});
|
|
5948
|
-
authenticate(token: string): Promise<ResultType<AuthClaims>>;
|
|
5949
|
-
isAuthenticated(): Promise<boolean>;
|
|
5950
|
-
exchangeCodeForSession(code: string): Promise<ResultType<Optional<Session>>>;
|
|
5951
|
-
signInWithProvider(provider: Provider$1): Promise<ResultType<{
|
|
5952
|
-
url: string;
|
|
5953
|
-
}>>;
|
|
5954
|
-
getSession(): Promise<ResultType<Maybe<Session>>>;
|
|
5955
|
-
getUser(): Promise<ResultType<Maybe<AuthClaims>>>;
|
|
5956
|
-
signOut(): Promise<ResultType<void>>;
|
|
5957
|
-
getSessionToken(): Promise<ResultType<Optional<string>>>;
|
|
5958
|
-
}
|
|
5959
|
-
|
|
5960
4728
|
/**
|
|
5961
4729
|
* @description The InMemoryCache class provides an implementation of the ICache interface using an in-memory Map to store cached values. This class allows for storing, retrieving, and managing cached values in memory, supporting features such as time-to-live (TTL) for cache entries and atomic operations for setting values only if they do not already exist. The InMemoryCache class is a simple and efficient caching solution for scenarios where a lightweight, in-memory cache is sufficient, such as during development or for caching non-critical data that does not require persistence across application restarts.
|
|
5962
4730
|
|
|
@@ -6014,94 +4782,4 @@ declare class CacheKeyBuilder implements ICacheKeyBuilder {
|
|
|
6014
4782
|
buildUserScopedKey(key: string): string;
|
|
6015
4783
|
}
|
|
6016
4784
|
|
|
6017
|
-
|
|
6018
|
-
private readonly _client;
|
|
6019
|
-
constructor(_client: AxiosInstance);
|
|
6020
|
-
private executInAsync;
|
|
6021
|
-
get<TResponse = unknown>(url: string, options?: Optional<Omit<HttpRequest<never>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
6022
|
-
post<TResponse = unknown, TBody = unknown>(url: string, body?: Optional<TBody>, options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
6023
|
-
put<TResponse = unknown, TBody = unknown>(url: string, body?: Optional<TBody>, options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
6024
|
-
patch<TResponse = unknown, TBody = unknown>(url: string, body?: Optional<TBody>, options?: Optional<Omit<HttpRequest<TBody>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
6025
|
-
delete<TResponse = unknown>(url: string, options?: Optional<Omit<HttpRequest<never>, HttpOptions>>): Promise<HttpResponse<TResponse>>;
|
|
6026
|
-
private buildConfig;
|
|
6027
|
-
private handleResponse;
|
|
6028
|
-
private handleError;
|
|
6029
|
-
}
|
|
6030
|
-
|
|
6031
|
-
/**
|
|
6032
|
-
* @description SupabaseClaimsMapper is responsible for mapping authentication claims (AuthClaims) to an Identity object. This mapper takes the claims extracted from a token (such as a JWT) and transforms them into a structured Identity that can be used throughout the application for authentication and authorization purposes. The mapping includes parsing the user ID and tenant ID from the claims, as well as extracting roles and permissions.
|
|
6033
|
-
|
|
6034
|
-
*
|
|
6035
|
-
* @author Xeno
|
|
6036
|
-
* @version 1.0.0
|
|
6037
|
-
* @since 2025-09-30
|
|
6038
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
6039
|
-
*/
|
|
6040
|
-
declare class SupabaseClaimsMapper implements IBaseMapper<User, AuthClaims> {
|
|
6041
|
-
map(user: User): AuthClaims;
|
|
6042
|
-
}
|
|
6043
|
-
|
|
6044
|
-
declare class SupabaseSessionMapper implements IBaseMapper<Session$1, Session> {
|
|
6045
|
-
private readonly _claimsMapper;
|
|
6046
|
-
constructor(_claimsMapper: IBaseMapper<User, AuthClaims>);
|
|
6047
|
-
map(source: Session$1): Session;
|
|
6048
|
-
}
|
|
6049
|
-
|
|
6050
|
-
/**
|
|
6051
|
-
* @description Utility functions for creating Zod schemas for commands and queries.
|
|
6052
|
-
* @author Xeno
|
|
6053
|
-
* @version 1.0.0
|
|
6054
|
-
* @since 2025-09-30
|
|
6055
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
6056
|
-
*/
|
|
6057
|
-
declare const ZodUtils: Readonly<{
|
|
6058
|
-
/**
|
|
6059
|
-
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
6060
|
-
* @param intent - The intent of the command.
|
|
6061
|
-
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
6062
|
-
* @returns A Zod schema for the command.
|
|
6063
|
-
*/
|
|
6064
|
-
createCommandSchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6065
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6066
|
-
}, z.core.$strict>;
|
|
6067
|
-
/**
|
|
6068
|
-
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
6069
|
-
* @param intent - The intent of the query.
|
|
6070
|
-
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
6071
|
-
* @returns A Zod schema for the query.
|
|
6072
|
-
*/
|
|
6073
|
-
createQuerySchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6074
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6075
|
-
}, z.core.$strict>;
|
|
6076
|
-
}>;
|
|
6077
|
-
|
|
6078
|
-
/**
|
|
6079
|
-
* @description Implementation of the IValidatorService interface using Zod schemas for validation. This service maintains a registry of Zod schemas identified by unique keys and provides methods to check for the existence of a schema and to validate data against a specified schema. The validate method returns a ResultType indicating success or failure, with detailed error information in case of validation failure, including formatted error messages from Zod.
|
|
6080
|
-
|
|
6081
|
-
*
|
|
6082
|
-
* @author Xeno
|
|
6083
|
-
* @version 1.0.0
|
|
6084
|
-
* @since 2025-09-30
|
|
6085
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
6086
|
-
*/
|
|
6087
|
-
declare class ZodValidatorService implements IValidatorService {
|
|
6088
|
-
private readonly _cache;
|
|
6089
|
-
private readonly _logger;
|
|
6090
|
-
/**
|
|
6091
|
-
* @description Constructs a new instance of the ZodValidatorService class, which takes an ICache instance as a parameter. This cache is used to store and manage the validation schemas that will be applied to incoming data. The constructor initializes the service with the provided cache, allowing it to perform validation checks based on the cached schemas when the validate method is called.
|
|
6092
|
-
*
|
|
6093
|
-
* @param _cache An instance of ICache used to store and retrieve Zod schemas. This cache is essential for the operation of the validator service, as it allows it to look up and apply the correct schema for validating incoming data.
|
|
6094
|
-
* @param _logger An instance of ILogger used to log warning when schema was not found.
|
|
6095
|
-
*
|
|
6096
|
-
* @author Xeno
|
|
6097
|
-
* @version 1.0.0
|
|
6098
|
-
* @since 2025-09-30
|
|
6099
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
6100
|
-
*/
|
|
6101
|
-
constructor(_cache: Map<string, ZodType> | undefined, _logger: ILogger);
|
|
6102
|
-
private static formatIssue;
|
|
6103
|
-
addSchema(key: string, schema: ZodType): void;
|
|
6104
|
-
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
6105
|
-
}
|
|
6106
|
-
|
|
6107
|
-
export { AbortSignalHelper, type AbstractConstructor, AggregateRoot, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy, AxiosHttpClient, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, type Constructor, type CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, type Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, type ExtendedRequest, type Factory, GUEST, Guards, type Guid, GuidHelper, type HttpBaseRequest, type HttpClientConfig, type HttpHeaders, HttpHelper, type HttpMethod, type HttpOptions, type HttpQueryValue, type HttpRequest, type HttpResponse, type HttpResponseType, type IAuthService, type IBaseAccessor, type IBaseAuthService, type IBaseMapper, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IDomainEvent, type IEntity, type IExtendendAuthService, type IFactory, type IGateKeeper, type IHandler, type IHttpClient, type IIdempotencyStore, type IIdentityAccessor, type ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValidatorService, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, type KeysOfType, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, type Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, type Nullable, type Optional, type Override, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type Provider, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type RequireKeys, type Resolver, type ResponseDto, Result, type ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type Session, type SetupAction, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, SupabaseAuthService, SupabaseClaimsMapper, SupabaseSessionMapper, TOKENS, type TracingContext, UniqueId, type UserContext, ValueObject, ZodUtils, ZodValidatorService };
|
|
4785
|
+
export { AbortSignalHelper, AggregateRoot, type ApiResponseDto, type AuthConfig, type AuthPolicy, BaseLogger, type CacheClientConfig, type CacheConfig, CacheKeyBuilder, Command, CookieOptions, DEFAULT_CONCURRENCY, DateHelper, type DbConfig, type Delegate, Dictionary, ERROR_CODES, ERROR_CODE_MESSAGES, Entity, Enumerable, type ErrorCode, type ErrorResponseDto, ExtendedRequest, Factory, GUEST, Guards, Guid, GuidHelper, HttpBaseRequest, type HttpClientConfig, HttpHeaders, HttpHelper, type IBaseAccessor, type ICache, type ICacheKeyBuilder, type ICacheableOptions, type ICommand, type IConcurrencyService, type IConfigurationService, type IContextAccessor, type IController, IDEMPOTENCY_CONSTANTS, type IDisposable, type IDomainEvent, type IEntity, type IFactory, type IGateKeeper, type IHandler, type IIdempotencyStore, type IIdentityAccessor, ILogger, type ILoggerClient, type IMapper, type IMediator, type IMiddleware, type INetworkContextAccessor, type IPaginatedResult, type IPipelineBehavior, type IPolicyRegistry, type IQuery, type IReadDao, type IReadDataSource, type IRemoteDataSource, type IRepository, type IRequest, type IServiceExtractor, type IServiceResilience, type ISpecification, type IStorage, type IStrategy, type ITransactionState, type IUnitOfWork, type IValueObject, type IWriteDataSource, type Identity, InMemoryCache, type InjectionToken, LOG_LEVEL, LOG_LEVEL_NAMES, type LogLevel, type LoggerContext, LoggerUtils, MathHelper, Maybe, type MessageSequence, type MessagingContext, type Metadata, type NetworkContext, Optional, PAGINATION_DEFAULTS, PERMISSIONS, type Permission, PromiseHelper, type ProxyConfig, Query, REQUEST_TYPE, RESILIENCE_DEFAULTS, ROLES, type RequestContext, type RequestType, type ResponseDto, ResultType, type Role, SORT_DIRECTION, STATUS_CODES, SanitizeHelper, type SortDirection, type StatusCode, StorageHelper, StringHelper, type SuccessResponseDto, TOKENS, type TracingContext, UniqueId, UserContext, ValueObject };
|