@xeno-js/core 1.2.13 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,29 +1,8 @@
1
- import { ICache, Optional, IExtendendAuthService, IBaseAuthService, ICacheKeyBuilder, IPipelineBehavior, ICommand, IConcurrencyService, IConfigurationService, ILogger, IMediator, IMiddleware, IQuery, RequestContext, IServiceResilience, IServiceExtractor, Metadata, IUnitOfWork, IDisposable, IValidatorService, IIdentityAccessor, IContextAccessor, INetworkContextAccessor, IFactory, UserContext, ITransactionState, Factory, IBaseAccessor, Identity, ExtendedRequest, HttpMethod, AuthConfig, CookieOptions, SetupAction, HttpClientConfig, LogLevel, ILoggerClient, Dictionary, AuthPolicy, IStrategy, IRequest, ResponseDto, IHandler, ResultType, ISpecification, CacheConfig, DbConfig, IReadDao, IReadDataSource, IMapper, IRepository, IWriteDataSource, IController, AppError } from '@xeno-js/shared';
1
+ import { Optional, RequestContext, HttpMethod, AuthConfig, CookieOptions, IServiceExtractor, IExtendendAuthService, SetupAction, HttpClientConfig, LogLevel, ILoggerClient, Dictionary, AuthPolicy, IStrategy, IRequest, ResponseDto, IHandler, IFactory, UserContext, ResultType, IContextAccessor, Identity, ISpecification, IConfigurationService, CacheConfig, DbConfig, ExtendedRequest, IReadDao, IReadDataSource, IMapper, IRepository, IWriteDataSource, IController, IMediator, AppError, IQuery, ICommand } from '@xeno-js/shared';
2
2
  export * from '@xeno-js/shared';
3
- export { Query as BaseQuery } from '@xeno-js/shared';
4
- import { SupabaseClientOptions } from '@supabase/supabase-js';
5
- import * as _libsql_client_web from '@libsql/client/web';
6
- import * as drizzle_orm_libsql from 'drizzle-orm/libsql';
7
- import { LibSQLDatabase } from 'drizzle-orm/libsql';
8
- import * as drizzle_orm_node_postgres from 'drizzle-orm/node-postgres';
9
- import { NodePgDatabase } from 'drizzle-orm/node-postgres';
10
- export * from 'drizzle-orm';
11
- export { Query } from 'drizzle-orm';
12
-
13
- /**
14
- * @description IAtomicCache is an interface that extends the ICache interface and adds an increment method. The increment method takes a key and an optional ttlSeconds parameter and returns a Promise that resolves to an incremented value.
15
- *
16
- */
17
- interface IAtomicCache extends ICache {
18
- /**
19
- * @description The increment method increments the value associated with the given key in the cache. If the key does not exist, it is created with an initial value of 1. The method returns a Promise that resolves to the incremented value.
20
- *
21
- * @param key The key to increment the value for.
22
- * @param ttlSeconds The time-to-live (TTL) in seconds for the key-value pair. If not provided, the default TTL is used.
23
- * @returns A Promise that resolves to the incremented value.
24
- */
25
- increment(key: string, ttlSeconds: Optional<number | string>): Promise<number>;
26
- }
3
+ export { Query } from '@xeno-js/shared';
4
+ import { A as ApplicationRegistry, I as IServiceProvider, a as IServiceScope, b as IServiceContainer, c as IHttpAdapter, X as XenoWebTransport } from './itoken-service.contracts-3GrRvKeZ.js';
5
+ export { d as IAtomicCache, e as ICryptoService, f as ICsrfTokenService, g as IRequestContext, h as IServiceScopeAccessor } from './itoken-service.contracts-3GrRvKeZ.js';
27
6
 
28
7
  /**
29
8
  * @description An interface that defines the contract for a rate limit key builder in a Xeno Vue application. This interface requires the implementation of a single method, buildRateLimitKey, which takes a resource and a client IP address as parameters and returns a string representing the rate limit key.
@@ -44,380 +23,6 @@ interface IRateLimitKeyBuilder {
44
23
  buildRateLimitKey(resource: string): Optional<string>;
45
24
  }
46
25
 
47
- /**
48
- * @description This file defines the injection tokens used for dependency injection in the application.
49
- * Injection tokens are unique identifiers that are used to register and resolve dependencies in the container.
50
- * They can be symbols, strings, or classes, but using symbols is a common practice to avoid naming collisions.
51
- *
52
- * @author Xeno
53
- * @version 1.0.0
54
- * @since 2025-09-30
55
- * @link https://github.com/xeno-js/xeno-js
56
- */
57
- interface ApplicationRegistry<T = unknown, Ttx = unknown> {
58
- /** @description Token used to register and resolve the Extended AuthService instance in the dependency injection container.
59
- *
60
- * @author Xeno
61
- * @version 1.0.0
62
- * @since 2025-09-30
63
- * @link https://github.com/xeno-js/xeno-js
64
- */
65
- readonly AUTH_SERVICE: IExtendendAuthService;
66
- /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.
67
- *
68
- * @author Xeno
69
- * @version 1.0.0
70
- * @since 2025-09-30
71
- * @link https://github.com/xeno-js/xeno-js
72
- */
73
- readonly BASE_AUTH_SERVICE: IBaseAuthService;
74
- /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.
75
- *
76
- * @author Xeno
77
- * @version 1.0.0
78
- * @since 2025-09-30
79
- * @link https://github.com/xeno-js/xeno-js
80
- */
81
- readonly CACHE: IAtomicCache;
82
- /** @description Token used to register and resolve the CacheKeyBuilder instance in the dependency injection container.
83
- *
84
- * @author Xeno
85
- * @version 1.0.0
86
- * @since 2025-09-30
87
- * @link https://github.com/xeno-js/xeno-js
88
- */
89
- readonly CACHE_KEY_BUILDER: ICacheKeyBuilder;
90
- /** @description Token used to register and resolve the CommandPipeline behaviors in the dependency injection container.
91
- *
92
- * @author Xeno
93
- * @version 1.0.0
94
- * @since 2025-09-30
95
- * @link https://github.com/xeno-js/xeno-js
96
- */
97
- readonly COMMAND_PIPELINES_BEHAVIOR: IPipelineBehavior<ICommand, unknown>;
98
- /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.
99
- *
100
- * @author Xeno
101
- * @version 1.0.0
102
- * @since 2025-09-30
103
- * @link https://github.com/xeno-js/xeno-js
104
- */
105
- readonly CONCURRENCY_SERVICE: IConcurrencyService;
106
- /** @description Token used to register and resolve the ConfigurationService instance in the dependency injection container.
107
- *
108
- * @author Xeno
109
- * @version 1.0.0
110
- * @since 2025-09-30
111
- * @link https://github.com/xeno-js/xeno-js
112
- */
113
- readonly CONFIGURATION_SERVICE: IConfigurationService;
114
- /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.
115
- *
116
- * @author Xeno
117
- * @version 1.0.0
118
- * @since 2025-09-30
119
- * @link https://github.com/xeno-js/xeno-js
120
- */
121
- readonly CSRF_TOKEN_SERVICE: ICsrfTokenService;
122
- /** @description Token used to register and resolve the CryptoService instance in the dependency injection container.
123
- *
124
- * @author Xeno
125
- * @version 1.0.0
126
- * @since 2025-09-30
127
- * @link https://github.com/xeno-js/xeno-js
128
- */
129
- readonly CRYPTO_SERVICE: ICryptoService;
130
- /** @description Token used to register and resolve the DbContext instance in the dependency injection container.
131
- *
132
- * @author Xeno
133
- * @version 1.0.0
134
- * @since 2025-09-30
135
- * @link https://github.com/xeno-js/xeno-js
136
- */
137
- readonly DB_CONTEXT: T;
138
- /** @description Token used to register and resolve the HTTP Adapter instance in the dependency injection container.
139
- *
140
- * @author Xeno
141
- * @version 1.2.1
142
- * @since 2025-09-30
143
- * @link https://github.com/xeno-js/xeno-js
144
- */
145
- readonly HTTP_ADAPTER: IHttpAdapter<unknown, unknown>;
146
- /** @description Token used to register and resolve the Logger instance in the dependency injection container.
147
- *
148
- * @author Xeno
149
- * @version 1.0.0
150
- * @since 2025-09-30
151
- * @link https://github.com/xeno-js/xeno-js
152
- */
153
- readonly LOGGER: ILogger;
154
- /** @description Token used to register and resolve the Mediator instance in the dependency injection container.
155
- *
156
- * @author Xeno
157
- * @version 1.0.0
158
- * @since 2025-09-30
159
- * @link https://github.com/xeno-js/xeno-js
160
- */
161
- readonly MEDIATOR: IMediator;
162
- /** @description Token used to register and resolve the RequestContextMiddleware in the dependency injection container.
163
- *
164
- * @author Xeno
165
- * @version 1.0.0
166
- * @since 2025-09-30
167
- * @link https://github.com/xeno-js/xeno-js
168
- */
169
- readonly MIDDLEWARE: IMiddleware;
170
- /** @description Token used to register and resolve the QueryPipeline behaviors in the dependency injection container.
171
- *
172
- * @author Xeno
173
- * @version 1.0.0
174
- * @since 2025-09-30
175
- * @link https://github.com/xeno-js/xeno-js
176
- */
177
- readonly QUERY_PIPELINES_BEHAVIOR: IPipelineBehavior<IQuery, unknown>;
178
- /** @description Token used to register and resolve the RequestContext instance in the dependency injection container.
179
- *
180
- * @author Xeno
181
- * @version 1.0.0
182
- * @since 2025-09-30
183
- * @link https://github.com/xeno-js/xeno-js
184
- */
185
- readonly REQUEST_CONTEXT: IRequestContext<RequestContext, ApplicationRegistry<T>>;
186
- /** @description Token used to register and resolve the IServiceResilience instance in the dependency injection container.
187
- *
188
- * @author Xeno
189
- * @version 1.0.0
190
- * @since 2025-09-30
191
- * @link https://github.com/xeno-js/xeno-js
192
- */
193
- readonly RESILIENCE_CLIENT: IServiceResilience;
194
- /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.
195
- *
196
- * @author Xeno
197
- * @version 1.0.0
198
- * @since 2025-09-30
199
- * @link https://github.com/xeno-js/xeno-js
200
- */
201
- readonly SERVICE_CONTAINER: IServiceContainer;
202
- /** @description Token used to register and resolve the ServiceExtractor instance in the dependency injection container.
203
- *
204
- * @author Xeno
205
- * @version 1.0.0
206
- * @since 2025-09-30
207
- * @link https://github.com/xeno-js/xeno-js
208
- */
209
- readonly SERVICE_EXTRACTOR: IServiceExtractor<Request['headers'], Metadata>;
210
- /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
211
- *
212
- * @author Xeno
213
- * @version 1.0.0
214
- * @since 2025-09-30
215
- * @link https://github.com/xeno-js/xeno-js
216
- */
217
- readonly UNIT_OF_WORK: IUnitOfWork & IDisposable;
218
- /** @description Token used to register and resolve the ZodValidator instance in the dependency injection container.
219
- *
220
- * @author Xeno
221
- * @version 1.0.0
222
- * @since 2025-09-30
223
- * @link https://github.com/xeno-js/xeno-js
224
- */
225
- readonly VALIDATOR_SERVICE: IValidatorService;
226
- /** @description Token used to register and resolve the IIdentityAccessor in the dependency injection container, allowing access only to current user identity information.
227
- *
228
- * @author Xeno
229
- * @version 1.0.0
230
- * @since 2025-09-30
231
- * @link https://github.com/xeno-js/xeno-js
232
- */
233
- readonly IDENTITY_ACCESSOR: IIdentityAccessor;
234
- /** @description Token used to register and resolve the IServiceScopeAccessor in the dependency injection container, granting controlled access to the current request scope.
235
- *
236
- * @author Xeno
237
- * @version 1.0.0
238
- * @since 2025-09-30
239
- * @link https://github.com/xeno-js/xeno-js
240
- */
241
- readonly SERVICE_SCOPE_ACCESSOR: IServiceScopeAccessor<ApplicationRegistry<T>>;
242
- /** @description Token used to register and resolve the IContextAccessor instance in the dependency injection container to fetch execution context properties.
243
- *
244
- * @author Xeno
245
- * @version 1.0.0
246
- * @since 2025-09-30
247
- * @link https://github.com/xeno-js/xeno-js
248
- */
249
- readonly CONTEXT_ACCESSOR: IContextAccessor<RequestContext>;
250
- /** @description Token used to register and resolve the INetworkContextAccessor instance in the dependency injection container to fetch networking/observability context data.
251
- *
252
- * @author Xeno
253
- * @version 1.0.0
254
- * @since 2025-09-30
255
- * @link https://github.com/xeno-js/xeno-js
256
- */
257
- readonly NETWORK_CONTEXT_ACCESSOR: INetworkContextAccessor;
258
- /** @description Token used to register and resolve the UserContext factory in the dependency injection container.
259
- *
260
- * @author Xeno
261
- * @version 1.0.0
262
- * @since 2025-09-30
263
- * @link https://github.com/xeno-js/xeno-js
264
- */
265
- readonly USER_CONTEXT_FACTORY: IFactory<void, UserContext>;
266
- /** @description Token used to register and resolve the TransactionState instance in the dependency injection container.
267
- *
268
- * @author Xeno
269
- * @version 1.0.0
270
- * @since 2025-09-30
271
- * @link https://github.com/xeno-js/xeno-js
272
- */
273
- readonly TRANSACTION_STATE: ITransactionState<Ttx>;
274
- }
275
-
276
- /**
277
- * @fileoverview Defines the IServiceScope interface for scoped dependency injection.
278
- *
279
- * @author Xeno
280
- * @version 1.0.0
281
- * @since 2025-09-30
282
- * @link https://github.com/xeno-js/xeno-js
283
- */
284
- /**
285
- * @description Represents a logical scope for resolving scoped services,
286
- * mimicking the .NET `IServiceScope` pattern.
287
- *
288
- * A scope is created by {@link IServiceContainer.createScope} and provides
289
- * its own isolated instance cache for services registered with scoped lifetime.
290
- * Singleton and transient services are still resolved through the root container.
291
- *
292
- * Call {@link dispose} when the scope is no longer needed to release all
293
- * scoped instances and invalidate the scope.
294
- *
295
- * @author Xeno
296
- * @version 1.0.0
297
- * @since 2025-09-30
298
- * @link https://github.com/xeno-js/xeno-js
299
- */
300
- interface IServiceScope<Registry extends ApplicationRegistry<unknown> = ApplicationRegistry<unknown>> extends IDisposable {
301
- /**
302
- * Resolves and returns the service registered under the given token.
303
- * Scoped services can only be resolved through a scope;
304
- * resolving them directly from the root container throws an error.
305
- *
306
- * @param token - The injection token identifying the service to resolve.
307
- * @returns The resolved service instance of type `T`.
308
- * @throws An error if no registration is found for the given token.
309
- * @throws An error if the scope has already been disposed.
310
- *
311
- * @author Xeno
312
- * @version 1.0.0
313
- * @since 2025-09-30
314
- * @link https://github.com/xeno-js/xeno-js
315
- */
316
- resolve<K extends keyof Registry>(token: K): Registry[K];
317
- }
318
-
319
- /**
320
- * @fileoverview Defines the IServiceContainer interface for a dependency injection container.
321
- *
322
- * @author Xeno
323
- * @version 1.0.0
324
- * @since 2025-09-30
325
- * @link https://github.com/xeno-js/xeno-js
326
- */
327
- interface IServiceProvider<Registry extends ApplicationRegistry<unknown> = ApplicationRegistry<unknown>> {
328
- /**
329
- * Resolves and returns the service registered under the given token.
330
- * Scoped services can only be resolved through a scope;
331
- * resolving them directly from the root container throws an error.
332
- *
333
- * @param token - The injection token identifying the service to resolve.
334
- * @returns The resolved service instance of type `T`.
335
- * @throws An error if no registration is found for the given token.
336
- * @throws An error if the scope has already been disposed.
337
- *
338
- * @author Xeno
339
- * @version 1.0.0
340
- * @since 2025-09-30
341
- * @link https://github.com/xeno-js/xeno-js
342
- */
343
- resolve<K extends keyof Registry>(token: K): Registry[K];
344
- }
345
- /**
346
- * @description Agnostic contract for a dependency injection container that mimics
347
- * the .NET ServiceCollection builder pattern.
348
- *
349
- * Each registration method returns `this` to enable a fluent builder chain.
350
- * Dependencies are expressed as an ordered array of injection tokens
351
- * that the container will resolve and inject into the constructor.
352
- *
353
- * @author Xeno
354
- * @version 1.0.0
355
- * @since 2025-09-30
356
- * @link https://github.com/xeno-js/xeno-js
357
- */
358
- interface IServiceContainer<Registry extends ApplicationRegistry<unknown> = ApplicationRegistry<unknown>> extends IServiceProvider<Registry>, IDisposable {
359
- /**
360
- * Registers an implementation under the given token with **singleton** lifetime.
361
- * A single instance is created on first resolution and reused for every
362
- * subsequent call within the container's lifetime.
363
- *
364
- * @param token - The unique injection token that identifies this service binding.
365
- * @param factory - Factory function that creates the service instance, receiving the scope as an argument.
366
- * @returns The container instance to allow method chaining.
367
- *
368
- * @author Xeno
369
- * @version 1.0.0
370
- * @since 2025-09-30
371
- * @link https://github.com/xeno-js/xeno-js
372
- */
373
- addSingleton<K extends keyof Registry>(token: K, factory: Factory<Registry[K], [IServiceScope<Registry>]>): this;
374
- /**
375
- * Registers an implementation under the given token with **transient** lifetime.
376
- * A new instance is created on every call to {@link resolve}.
377
- *
378
- * @param token - The unique injection token that identifies this service binding.
379
- * @param factory - Factory function that creates the service instance, receiving the scope as an argument.
380
- * @returns The container instance to allow method chaining.
381
- *
382
- * @author Xeno
383
- * @version 1.0.0
384
- * @since 2025-09-30
385
- * @link https://github.com/xeno-js/xeno-js
386
- */
387
- addTransient<K extends keyof Registry>(token: K, factory: Factory<Registry[K], [IServiceScope<Registry>]>): this;
388
- /**
389
- * Registers an implementation under the given token with **scoped** lifetime.
390
- * One instance is created per logical scope (e.g. per HTTP request).
391
- * Scoped services must be resolved through an {@link IServiceScope} obtained
392
- * via {@link createScope}; resolving them directly from the root container throws.
393
- *
394
- * @param token - The unique injection token that identifies this service binding.
395
- * @param factory - Factory function that creates the service instance, receiving the scope as an argument.
396
- * @returns The container instance to allow method chaining.
397
- *
398
- * @author Xeno
399
- * @version 1.0.0
400
- * @since 2025-09-30
401
- * @link https://github.com/xeno-js/xeno-js
402
- */
403
- addScoped<K extends keyof Registry>(token: K, factory: Factory<Registry[K], [IServiceScope<Registry>]>): this;
404
- /**
405
- * Creates a new {@link IServiceScope}.
406
- *
407
- * The returned scope shares singleton instances with the root container
408
- * and maintains its own isolated cache for scoped services.
409
- * Call {@link IServiceScope.dispose} when the scope is no longer needed.
410
- *
411
- * @returns A new scope instance.
412
- *
413
- * @author Xeno
414
- * @version 1.0.0
415
- * @since 2025-09-30
416
- * @link https://github.com/xeno-js/xeno-js
417
- */
418
- createScope(): IServiceScope<Registry>;
419
- }
420
-
421
26
  /**
422
27
  * @fileoverview Defines the ServiceDescriptor type for service registrations.
423
28
 
@@ -520,122 +125,6 @@ interface ExecutionContext<TRegistry extends ApplicationRegistry = ApplicationRe
520
125
  scope: IServiceScope<TRegistry>;
521
126
  }
522
127
 
523
- /**
524
- * @fileoverview Defines the IRequestContext interface for managing user identity context within the application.
525
- *
526
- * @author Xeno
527
- * @version 1.0.0
528
- * @since 2025-09-30
529
- * @link https://github.com/xeno-js/xeno-js
530
- */
531
-
532
- /**
533
- * An interface for managing user identity context within the application. This interface provides methods for executing asynchronous functions with the current user's identity context and retrieving the current user's identity information. It allows for seamless integration of identity management into various parts of the application, ensuring that identity-related data is properly propagated and accessible when needed.
534
- *
535
- * @author Xeno
536
- * @version 1.0.0
537
- * @since 2025-09-30
538
- * @link https://github.com/xeno-js/xeno-js
539
- */
540
- interface IRequestContext<TCtx, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends IBaseAccessor<TCtx>, IServiceScopeAccessor<TRegistry> {
541
- /**
542
- * Executes the provided asynchronous function with the current user's identity context. This allows the function to access identity information such as user ID, roles, and correlation ID while performing its operations. The function will be executed within the scope of the current request's identity, ensuring that any identity-related data is properly propagated throughout the execution flow.
543
- * @param ctx The current user's identity context.
544
- * @param fn An asynchronous function that takes the current user's identity as an argument and returns a promise of type T. This function will be executed with the identity context of the current request.
545
- * @returns A promise that resolves to the result of the provided function, allowing the caller to handle the outcome of the operation performed within the identity context.
546
- *
547
- * @author Xeno
548
- * @version 1.0.0
549
- * @since 2025-09-30
550
- * @link https://github.com/xeno-js/xeno-js
551
- */
552
- runAsync<T = unknown>(ctx: TCtx, fn: () => Promise<T>): Promise<T>;
553
- updateIdentity(identity: Identity): void;
554
- }
555
- /**
556
- * @description The IIdentityAccessor interface is a contract that defines the structure and behavior of an identity accessor within the application. It provides a method for retrieving the current user's identity information, including user ID, roles, and correlation ID. This interface is essential for managing user identity and ensuring that identity-related data is accessible when needed.
557
- *
558
- *
559
- * @author Xeno
560
- * @version 1.0.0
561
- * @since 2025-09-30
562
- * @link https://github.com/xeno-js/xeno-js
563
- */
564
- interface IServiceScopeAccessor<TRegistry extends ApplicationRegistry<unknown> = ApplicationRegistry<unknown>> {
565
- /**
566
- * Retrieves the current service scope, which allows for managing dependencies during the execution of a request. This method enables access to the service scope, ensuring that services are properly scoped and disposed of after the request is processed.
567
- * @returns An object representing the current service scope, allowing for resolution of dependencies and management of services during the execution of a request.
568
- *
569
- * @author Xeno
570
- * @version 1.0.0
571
- * @since 2025-09-30
572
- * @link https://github.com/xeno-js/xeno-js
573
- */
574
- getScope(): Optional<IServiceScope<TRegistry>>;
575
- }
576
-
577
- /**
578
- * @description Interface for the crypto service
579
- */
580
- interface ICryptoService {
581
- /**
582
- * @description Generates a random byte array of the specified size.
583
- * @param size The size of the byte array to generate.
584
- * @returns A random byte array of the specified size.
585
- */
586
- randomBytes(size: number): Uint8Array;
587
- /**
588
- * @description Generates a HMAC SHA-256 hash of the specified data using the specified secret.
589
- * @param secret The secret to use for the HMAC SHA-256 hash.
590
- * @param data The data to hash.
591
- * @returns A promise that resolves to the HMAC SHA-256 hash of the specified data.
592
- */
593
- hmacSha256(secret: string, data: string): Promise<string>;
594
- /**
595
- * @description Compares two byte arrays in a way that is resistant to timing attacks.
596
- * @param a The first byte array to compare.
597
- * @param b The second byte array to compare.
598
- * @returns True if the two byte arrays are equal, false otherwise.
599
- */
600
- timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean;
601
- }
602
-
603
- /**
604
- * @description Interface for a WebTransport.
605
- * @author Xeno
606
- * @version 1.2.1
607
- * @since 2025-09-30
608
- * @link https://github.com/xeno-js/xeno-js
609
- */
610
- interface XenoWebTransport {
611
- /**
612
- * @description The Extendend native request.
613
- * @type ExtendedRequest
614
- */
615
- request: ExtendedRequest;
616
- /**
617
- * @description The native response.
618
- * @type Response
619
- */
620
- response: Response;
621
- }
622
- /**
623
- * @description Interface for an HTTP adapter.
624
- * @author Xeno
625
- * @version 1.2.1
626
- * @since 2025-09-30
627
- * @link https://github.com/xeno-js/xeno-js
628
- */
629
- interface IHttpAdapter<TReq = Request, TRes = Response> {
630
- /**
631
- * @description Adapts an HTTP request and response to an ExtendedRequest and Response.
632
- * @param req - The HTTP request.
633
- * @param res - The HTTP response.
634
- * @returns An object containing the adapted ExtendedRequest and Response.
635
- */
636
- adapt(req: TReq, res: TRes): XenoWebTransport;
637
- }
638
-
639
128
  /**
640
129
  * @description Represents a module that can be registered with the service container.
641
130
  *
@@ -729,25 +218,6 @@ interface IAllowOrigin {
729
218
  isAllowed(origin: Optional<string>): boolean;
730
219
  }
731
220
 
732
- /**
733
- * @description Interface for the CSRF token service
734
- */
735
- interface ICsrfTokenService {
736
- /**
737
- * @description Generate a new CSRF token
738
- * @param subject The subject of the token
739
- * @returns A promise that resolves to the token
740
- */
741
- generate(subject: string): Promise<string>;
742
- /**
743
- * @description Validate a CSRF token
744
- * @param token The token to validate
745
- * @param subject The subject of the token
746
- * @returns A priomise that resolves to true if the token is valid, false otherwise
747
- */
748
- validate(token: string, subject: string): Promise<boolean>;
749
- }
750
-
751
221
  interface ISsrCookie {
752
222
  name: string;
753
223
  value: string;
@@ -762,7 +232,7 @@ interface ISsrCookieHandler {
762
232
  interface CookieHandlerOptions extends CookieOptions {
763
233
  httpOnly: boolean;
764
234
  }
765
- interface AuthSsrConfig<TOption, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends AuthConfig<TOption> {
235
+ interface AuthSsrConfig<TOption = unknown, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends AuthConfig<TOption> {
766
236
  ssrOpts: Optional<(container: IServiceContainer<TRegistry>) => ISsrCookieHandler>;
767
237
  cookieOpts: CookieHandlerOptions;
768
238
  customAuth: Optional<{
@@ -1663,38 +1133,6 @@ declare abstract class Specification<T> implements ISpecification<T> {
1663
1133
  not(): ISpecification<T>;
1664
1134
  }
1665
1135
 
1666
- /**
1667
- * @description Type definition for the database context used in the application.
1668
- * Polymorphically handles both PostgreSQL and libSQL (SQLite/Turso) engines.
1669
- *
1670
- * @author Xeno
1671
- * @version 1.0.0
1672
- * @since 2025-09-30
1673
- * @link https://github.com/xeno-js/xeno-js
1674
- */
1675
- type DbContext<TSchema extends Dictionary = Dictionary> = drizzle_orm_node_postgres.NodePgDatabase<TSchema> | (drizzle_orm_libsql.LibSQLDatabase<TSchema> & {
1676
- $client: _libsql_client_web.Client;
1677
- });
1678
- /**
1679
- * @description Type definition for the transaction object used in the database context.
1680
- * Polymorphically handles both PostgreSQL and libSQL (SQLite/Turso) engines.
1681
- *
1682
- * @author Xeno
1683
- * @version 1.0.0
1684
- * @since 2025-09-30
1685
- * @link https://github.com/xeno-js/xeno-js
1686
- */
1687
- type DbTransaction = Parameters<Parameters<DbContext['transaction']>[0]>[0];
1688
-
1689
- /**
1690
- * @description The XenoRegistry type is an alias for the ApplicationRegistry specialized with DbContext. It represents the registry of application services and dependencies, specifically tailored for applications that utilize a database context. This type is used throughout the application to ensure consistent typing and to facilitate dependency injection and service resolution.
1691
- * @author Xeno
1692
- * @version 1.0.0
1693
- * @since 2025-09-30
1694
- * @link https://github.com/xeno-js/xeno-js
1695
- */
1696
- type XenoRegistry<TSchema extends Dictionary = Dictionary, TExtensions = object> = ApplicationRegistry<DbContext<TSchema>, DbTransaction> & Readonly<Omit<TExtensions, keyof ApplicationRegistry<DbContext<TSchema>, DbTransaction>>>;
1697
-
1698
1136
  /**
1699
1137
  * @description The AppBuilder class provides a fluent, .NET-style API for configuring and bootstrapping the application.
1700
1138
  * It orchestrates the registration of various modules (CQRS, HTTP, Database, Logging, Auth) into the ServiceContainer.
@@ -1705,7 +1143,7 @@ type XenoRegistry<TSchema extends Dictionary = Dictionary, TExtensions = object>
1705
1143
  * @since 2025-09-30
1706
1144
  * @link https://github.com/xeno-js/xeno-js
1707
1145
  */
1708
- declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1146
+ declare class AppBuilder<TRegistry extends ApplicationRegistry = ApplicationRegistry> {
1709
1147
  private readonly _container;
1710
1148
  private readonly _configuration;
1711
1149
  private _isBuilded;
@@ -1784,7 +1222,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1784
1222
  * @since 2025-09-30
1785
1223
  * @link https://github.com/xeno-js/xeno-js
1786
1224
  */
1787
- addAuth(setupAction: SetupAction<AuthSsrConfig<SupabaseClientOptions<'public'>>, IConfigurationService>): this;
1225
+ addAuth(setupAction: SetupAction<AuthSsrConfig, IConfigurationService>): this;
1788
1226
  /**
1789
1227
  * @description Configures the database settings for the application. This method allows you to set up database options such as enabling/disabling the database, connection string, and table definitions.
1790
1228
  * @param setupAction A callback function that receives a DbConfig object to configure the database settings.
@@ -1907,51 +1345,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1907
1345
  private _queueContextModule;
1908
1346
  }
1909
1347
 
1910
- /**
1911
- * @description BasePostgresSqlDataSource is an abstract class that serves as a foundation for creating data sources that interact with a PostgreSQL database. It provides a common interface for accessing the database connection and ensures that the database connection is properly initialized and managed. By extending this class, developers can easily create data sources that are tailored to their specific use cases.
1912
- *
1913
- * @author Xeno
1914
- * @version 1.0.0
1915
- * @since 2025-09-30
1916
- * @link https://github.com/xeno-js/xeno-js
1917
- */
1918
- declare abstract class BasePostgresSqlDataSource<TSchema extends Dictionary = Dictionary> {
1919
- private readonly _db;
1920
- constructor(_db: DbContext<TSchema>);
1921
- /**
1922
- * @description Returns the database connection.
1923
- * @returns {NodePgDatabase<TSchema>} The database connection.
1924
- */
1925
- protected get db(): NodePgDatabase<TSchema>;
1926
- }
1927
-
1928
- /**
1929
- * @description BaseSqliteSqlDataSource is an abstract class that serves as a foundation for creating data sources that interact with a SQLite / libSQL database.
1930
- *
1931
- * @author Xeno
1932
- * @version 1.0.0
1933
- * @since 2025-09-30
1934
- * @link https://github.com/xeno-js/xeno-js
1935
- */
1936
- declare abstract class BaseSqliteSqlDataSource<TSchema extends Dictionary = Dictionary> {
1937
- private readonly _db;
1938
- constructor(_db: DbContext<TSchema>);
1939
- /**
1940
- * @description Returns the SQLite database connection.
1941
- * @returns {LibSQLDatabase<TSchema>} The database connection.
1942
- */
1943
- protected get db(): LibSQLDatabase<TSchema>;
1944
- }
1945
-
1946
- interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
1947
- config: AuthSsrConfig<SupabaseClientOptions<'public'>>;
1948
- container: IServiceContainer<TRegistry>;
1949
- }
1950
- declare class SupabaseServerAuthFactory<TRegistry extends XenoRegistry = XenoRegistry> implements IFactory<SupabaseServerAuthFactoryInput<TRegistry>, IExtendendAuthService> {
1951
- create({ config, container, }: SupabaseServerAuthFactoryInput<TRegistry>): IExtendendAuthService;
1952
- private _getCookieSsr;
1953
- }
1954
-
1955
1348
  /**
1956
1349
  * @description Base HTTP adapter.
1957
1350
  * @author Xeno
@@ -2066,6 +1459,15 @@ declare abstract class Repository<T, TDto> implements IRepository<T> {
2066
1459
  update(id: string | number, entity: Partial<T>, ctx: UserContext, signal: Optional<AbortSignal>): Promise<ResultType<void>>;
2067
1460
  }
2068
1461
 
1462
+ /**
1463
+ * @description The XenoRegistry type is an alias for the ApplicationRegistry specialized with DbContext. It represents the registry of application services and dependencies, specifically tailored for applications that utilize a database context. This type is used throughout the application to ensure consistent typing and to facilitate dependency injection and service resolution.
1464
+ * @author Xeno
1465
+ * @version 1.0.0
1466
+ * @since 2025-09-30
1467
+ * @link https://github.com/xeno-js/xeno-js
1468
+ */
1469
+ type XenoRegistry<TExtensions = object> = ApplicationRegistry & Readonly<Omit<TExtensions, keyof ApplicationRegistry>>;
1470
+
2069
1471
  /**
2070
1472
  * BaseController is an abstract class that implements the IController interface. It provides a foundation for creating specific controllers that handle incoming requests and return responses. The class requires a mediator to facilitate communication between different parts of the application.
2071
1473
  * @template TRequest - The type of the request object that the controller will handle.
@@ -2146,4 +1548,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2146
1548
  protected getContext(): Optional<RequestContext>;
2147
1549
  }
2148
1550
 
2149
- export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, BaseHttpAdapter, BasePostgresSqlDataSource, BaseSqliteSqlDataSource, ContainerUtils, type CookieHandlerOptions, type DbContext, type DbTransaction, type ExecutionContext, type HttpAdapterConfig, type HttpConfig, type HttpCoreConfig, type IAllowMethod, type IAllowOrigin, type IAtomicCache, type ICryptoService, type ICsrfTokenService, type IHttpAdapter, type IIPResolver, type IModule, type IRateLimitKeyBuilder, type IRequestContext, type IServiceContainer, type IServiceProvider, type IServiceScope, type IServiceScopeAccessor, type ISsrCookie, type ISsrCookieHandler, type ISsrCookieToSet, type Lifetime, type LoggerConfig, type MiddlewareConfig, type PinoLoggerConfig, type PipelineConfig, ReadDao, Repository, type ResilienceConfig, type SchemaConfig, type SentryLoggerConfig, type ServiceDescriptor, Specification, SupabaseServerAuthFactory, type XenoRegistry, type XenoWebTransport };
1551
+ export { AppBuilder, ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, BaseHttpAdapter, ContainerUtils, type CookieHandlerOptions, type ExecutionContext, type HttpAdapterConfig, type HttpConfig, type HttpCoreConfig, type IAllowMethod, type IAllowOrigin, IHttpAdapter, type IIPResolver, type IModule, type IRateLimitKeyBuilder, IServiceContainer, IServiceProvider, IServiceScope, type ISsrCookie, type ISsrCookieHandler, type ISsrCookieToSet, type Lifetime, type LoggerConfig, type MiddlewareConfig, type PinoLoggerConfig, type PipelineConfig, ReadDao, Repository, type ResilienceConfig, type SchemaConfig, type SentryLoggerConfig, type ServiceDescriptor, Specification, type XenoRegistry, XenoWebTransport };