@xeno-js/core 0.1.9 → 0.1.10

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.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ICache, Optional, IPipelineBehavior, IRequest, IExtendendService, IBaseAuthService, IServiceExtractor, HttpHeaders, ICacheKeyBuilder, IBaseMapper, AuthClaims, Identity, ICommand, IQuery, IConcurrencyService, IConfigurationService, ILoggerClient, IGateKeeper, IIdempotencyStore, ILogger, IMediator, IMiddleware, IStrategy, IPolicyRegistry, HttpMethod, RequestContext, IServiceResilience, Metadata, IFactory, ITransactionState, IUnitOfWork, IDisposable, IValidatorService, IIdentityAccessor, IContextAccessor, INetworkContextAccessor, UserContext, Factory, IBaseAccessor, AuthConfig, CookieOptions, SetupAction, HttpClientConfig, LogLevel, Dictionary, AuthPolicy, ResponseDto, IHandler, ResultType, ISpecification, CacheConfig, DbConfig, IReadDao, IReadDataSource, IMapper, IRepository, IWriteDataSource, IController, AppError } from '@xeno-js/shared';
1
+ import { ICache, Optional, IExtendendAuthService, IBaseAuthService, ICacheKeyBuilder, IPipelineBehavior, ICommand, IConcurrencyService, IConfigurationService, ILogger, IMediator, IMiddleware, HttpHeaders, IQuery, RequestContext, IServiceResilience, IServiceExtractor, Metadata, IUnitOfWork, IDisposable, IValidatorService, IIdentityAccessor, IContextAccessor, INetworkContextAccessor, IFactory, UserContext, Factory, IBaseAccessor, Identity, 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';
2
2
  export * from '@xeno-js/shared';
3
3
  export { Query as BaseQuery } from '@xeno-js/shared';
4
4
  import { SupabaseClientOptions } from '@supabase/supabase-js';
@@ -54,34 +54,23 @@ interface IRateLimitKeyBuilder {
54
54
  * @since 2025-09-30
55
55
  * @link https://github.com/xeno-js/xeno-js
56
56
  */
57
- interface ApplicationRegistry<T = unknown, Ttx = unknown> {
58
- readonly ALLOW_ORIGIN: IAllowOrigin;
59
- readonly ALLOW_METHOD: IAllowMethod;
60
- /** @description Token used to register and resolve the AuthorizationPipeline instance in the dependency injection container.
57
+ interface ApplicationRegistry<T = unknown> {
58
+ /** @description Token used to register and resolve the Extended AuthService instance in the dependency injection container.
61
59
  *
62
60
  * @author Xeno
63
61
  * @version 1.0.0
64
62
  * @since 2025-09-30
65
63
  * @link https://github.com/xeno-js/xeno-js
66
64
  */
67
- readonly AUTHORIZATION_PIPELINE: IPipelineBehavior<IRequest, unknown>;
68
- /** @description Token used to register and resolve the AuthService instance in the dependency injection container.
65
+ readonly AUTH_SERVICE: IExtendendAuthService;
66
+ /** @description Token used to register and resolve the BaseAuthService instance in the dependency injection container.
69
67
  *
70
68
  * @author Xeno
71
69
  * @version 1.0.0
72
70
  * @since 2025-09-30
73
71
  * @link https://github.com/xeno-js/xeno-js
74
72
  */
75
- readonly AUTH_SERVICE: IExtendendService;
76
73
  readonly BASE_AUTH_SERVICE: IBaseAuthService;
77
- /** @description Token used to register and resolve the BearerTokenExtractor instance in the dependency injection container.
78
- *
79
- * @author Xeno
80
- * @version 1.0.0
81
- * @since 2025-09-30
82
- * @link https://github.com/xeno-js/xeno-js
83
- */
84
- readonly BEARER_TOKEN_EXTRACTOR: IServiceExtractor<HttpHeaders, Optional<string>>;
85
74
  /** @description Token used to register and resolve the InMemoryCache instance in the dependency injection container.
86
75
  *
87
76
  * @author Xeno
@@ -98,14 +87,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
98
87
  * @link https://github.com/xeno-js/xeno-js
99
88
  */
100
89
  readonly CACHE_KEY_BUILDER: ICacheKeyBuilder;
101
- /** @description Token used to register and resolve the ClaimsIdentityMapper instance in the dependency injection container.
102
- *
103
- * @author Xeno
104
- * @version 1.0.0
105
- * @since 2025-09-30
106
- * @link https://github.com/xeno-js/xeno-js
107
- */
108
- readonly CLAIMS_IDENTITY_MAPPER: IBaseMapper<AuthClaims, Identity>;
109
90
  /** @description Token used to register and resolve the CommandPipeline behaviors in the dependency injection container.
110
91
  *
111
92
  * @author Xeno
@@ -114,22 +95,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
114
95
  * @link https://github.com/xeno-js/xeno-js
115
96
  */
116
97
  readonly COMMAND_PIPELINES_BEHAVIOR: IPipelineBehavior<ICommand, unknown>;
117
- /** @description Token used to register and resolve the CompositePipeline instance in the dependency injection container.
118
- *
119
- * @author Xeno
120
- * @version 1.0.0
121
- * @since 2025-09-30
122
- * @link https://github.com/xeno-js/xeno-js
123
- */
124
- readonly COMPOSITE_PIPELINE: IPipelineBehavior<IQuery, unknown>;
125
- /** @description Token used to register and resolve the ConcurrencyRetryPipeline instance in the dependency injection container.
126
- *
127
- * @author Xeno
128
- * @version 1.0.0
129
- * @since 2025-09-30
130
- * @link https://github.com/xeno-js/xeno-js
131
- */
132
- readonly CONCURRENCY_RETRY_PIPELINE: IPipelineBehavior<ICommand, unknown>;
133
98
  /** @description Token used to register and resolve the ConcurrencyService instance in the dependency injection container.
134
99
  *
135
100
  * @author Xeno
@@ -146,25 +111,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
146
111
  * @link https://github.com/xeno-js/xeno-js
147
112
  */
148
113
  readonly CONFIGURATION_SERVICE: IConfigurationService;
149
- /** @description Token used to register and resolve the ConsoleLogger instance in the dependency injection container.
150
- *
151
- * @author Xeno
152
- * @version 1.0.0
153
- * @since 2025-09-30
154
- * @link https://github.com/xeno-js/xeno-js
155
- */
156
- readonly CONSOLE_LOGGER: ILoggerClient;
157
- /** @description Token used to register and resolve the CookieExtractor instance in the dependency injection container.
158
- *
159
- * @author Xeno
160
- * @version 1.0.0
161
- * @since 2025-09-30
162
- * @link https://github.com/xeno-js/xeno-js
163
- */
164
- readonly COOKIE_EXTRACTOR: IServiceExtractor<{
165
- header: Optional<string>;
166
- name: string;
167
- }, Optional<string>>;
168
114
  /** @description Token used to register and resolve the CsrfTokenService instance in the dependency injection container.
169
115
  *
170
116
  * @author Xeno
@@ -189,38 +135,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
189
135
  * @link https://github.com/xeno-js/xeno-js
190
136
  */
191
137
  readonly DB_CONTEXT: T;
192
- /** @description Token used to register and resolve the ExceptionPipeline instance in the dependency injection container.
193
- *
194
- * @author Xeno
195
- * @version 1.0.0
196
- * @since 2025-09-30
197
- * @link https://github.com/xeno-js/xeno-js
198
- */
199
- readonly EXCEPTION_PIPELINE: IPipelineBehavior<IRequest, unknown>;
200
- /** @description Token used to register and resolve the GateKeeper instance in the dependency injection container.
201
- *
202
- * @author Xeno
203
- * @version 1.0.0
204
- * @since 2025-09-30
205
- * @link https://github.com/xeno-js/xeno-js
206
- */
207
- readonly GATE_KEEPER: IGateKeeper;
208
- /** @description Token used to register and resolve the IdempotencyPipeline instance in the dependency injection container.
209
- *
210
- * @author Xeno
211
- * @version 1.0.0
212
- * @since 2025-09-30
213
- * @link https://github.com/xeno-js/xeno-js
214
- */
215
- readonly IDEMPOTENCY_PIPELINE: IPipelineBehavior<ICommand, unknown>;
216
- /** @description Token used to register and resolve the IdempotencyStore instance in the dependency injection container.
217
- *
218
- * @author Xeno
219
- * @version 1.0.0
220
- * @since 2025-09-30
221
- * @link https://github.com/xeno-js/xeno-js
222
- */
223
- readonly IDEMPOTENCY_STORE: IIdempotencyStore;
224
138
  /** @description Token used to register and resolve the Logger instance in the dependency injection container.
225
139
  *
226
140
  * @author Xeno
@@ -229,14 +143,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
229
143
  * @link https://github.com/xeno-js/xeno-js
230
144
  */
231
145
  readonly LOGGER: ILogger;
232
- /** @description Token used to register and resolve the LoggingPipeline instance in the dependency injection container.
233
- *
234
- * @author Xeno
235
- * @version 1.0.0
236
- * @since 2025-09-30
237
- * @link https://github.com/xeno-js/xeno-js
238
- */
239
- readonly LOGGING_PIPELINE: IPipelineBehavior<IRequest, unknown>;
240
146
  /** @description Token used to register and resolve the Mediator instance in the dependency injection container.
241
147
  *
242
148
  * @author Xeno
@@ -253,56 +159,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
253
159
  * @link https://github.com/xeno-js/xeno-js
254
160
  */
255
161
  readonly MIDDLEWARE: IMiddleware<HttpHeaders>;
256
- readonly AUTH_MIDDLEWARE: IMiddleware<HttpHeaders>;
257
- readonly CSRF_MIDDLEWARE: IMiddleware<HttpHeaders>;
258
- readonly CSRF_COOKIE_MIDDLEWARE: IMiddleware<HttpHeaders>;
259
- readonly ALLOW_ORIGIN_MIDDLEWARE: IMiddleware<HttpHeaders>;
260
- readonly CORS_MIDDLEWARE: IMiddleware<HttpHeaders>;
261
- readonly METHOD_CHECK_MIDDLEWARE: IMiddleware<HttpHeaders>;
262
- readonly OPTIONS_MIDDLEWARE: IMiddleware<HttpHeaders>;
263
- readonly REQUEST_CONTEXT_MIDDLEWARE: IMiddleware<HttpHeaders>;
264
- readonly RATE_LIMITER_MIDDLEWARE: IMiddleware<HttpHeaders>;
265
- readonly RATE_LIMIT_KEY_BUILDER: IRateLimitKeyBuilder;
266
- /** @description Token used to register and resolve the PerformancePipeline 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 PERFORMANCE_PIPELINE: IPipelineBehavior<IRequest, unknown>;
274
- /** @description Token used to register and resolve the PermissionAuthorizationPipeline instance in the dependency injection container.
275
- *
276
- * @author Xeno
277
- * @version 1.0.0
278
- * @since 2025-09-30
279
- * @link https://github.com/xeno-js/xeno-js
280
- */
281
- readonly PERMISSION_AUTHORIZATION_PIPELINE: IStrategy<IRequest>;
282
- /** @description Token used to register and resolve the PinoLogger instance in the dependency injection container.
283
- *
284
- * @author Xeno
285
- * @version 1.0.0
286
- * @since 2025-09-30
287
- * @link https://github.com/xeno-js/xeno-js
288
- */
289
- readonly PINO_LOGGER: ILoggerClient;
290
- /** @description Token used to register and resolve the PolicyRegistry instance in the dependency injection container.
291
- *
292
- * @author Xeno
293
- * @version 1.0.0
294
- * @since 2025-09-30
295
- * @link https://github.com/xeno-js/xeno-js
296
- */
297
- readonly POLICY_REGISTRY: IPolicyRegistry;
298
- /** @description Token used to register and resolve the QueryCachingPipeline instance in the dependency injection container.
299
- *
300
- * @author Xeno
301
- * @version 1.0.0
302
- * @since 2025-09-30
303
- * @link https://github.com/xeno-js/xeno-js
304
- */
305
- readonly QUERY_CACHING_PIPELINE: IPipelineBehavior<IQuery, unknown>;
306
162
  /** @description Token used to register and resolve the QueryPipeline behaviors in the dependency injection container.
307
163
  *
308
164
  * @author Xeno
@@ -311,14 +167,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
311
167
  * @link https://github.com/xeno-js/xeno-js
312
168
  */
313
169
  readonly QUERY_PIPELINES_BEHAVIOR: IPipelineBehavior<IQuery, unknown>;
314
- /** @description Token used to register and resolve the RoutesRegistry instance in the dependency injection container.
315
- *
316
- * @author Xeno
317
- * @version 1.0.0
318
- * @since 2025-09-30
319
- * @link https://github.com/xeno-js/xeno-js
320
- */
321
- readonly REGISTRY_ROUTES: Record<`/${string}`, Record<HttpMethod, 'isPublic'>>;
322
170
  /** @description Token used to register and resolve the RequestContext instance in the dependency injection container.
323
171
  *
324
172
  * @author Xeno
@@ -335,38 +183,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
335
183
  * @link https://github.com/xeno-js/xeno-js
336
184
  */
337
185
  readonly RESILIENCE_CLIENT: IServiceResilience;
338
- /** @description Token used to register and resolve the IIPResolver instance in the dependency injection container.
339
- *
340
- * @author Xeno
341
- * @version 1.0.0
342
- * @since 2025-09-30
343
- * @link https://github.com/xeno-js/xeno-js
344
- */
345
- readonly IP_RESOLVER: IIPResolver;
346
- /** @description Token used to register and resolve the RoleAuthorizationPipeline instance in the dependency injection container.
347
- *
348
- * @author Xeno
349
- * @version 1.0.0
350
- * @since 2025-09-30
351
- * @link https://github.com/xeno-js/xeno-js
352
- */
353
- readonly ROLE_AUTHORIZATION_PIPELINE: IStrategy<IRequest>;
354
- /** @description Token used to register and resolve the SchemaValidationStrategy instance in the dependency injection container.
355
- *
356
- * @author Xeno
357
- * @version 1.0.0
358
- * @since 2025-09-30
359
- * @link https://github.com/xeno-js/xeno-js
360
- */
361
- readonly SCHEMA_VALIDATION_STRATEGY: IStrategy<IRequest, boolean>;
362
- /** @description Token used to register and resolve the SentryLogger instance in the dependency injection container.
363
- *
364
- * @author Xeno
365
- * @version 1.0.0
366
- * @since 2025-09-30
367
- * @link https://github.com/xeno-js/xeno-js
368
- */
369
- readonly SENTRY_LOGGER: ILoggerClient;
370
186
  /** @description Token used to register and resolve the ServiceContainer instance in the dependency injection container.
371
187
  *
372
188
  * @author Xeno
@@ -383,30 +199,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
383
199
  * @link https://github.com/xeno-js/xeno-js
384
200
  */
385
201
  readonly SERVICE_EXTRACTOR: IServiceExtractor<HttpHeaders, Metadata>;
386
- /** @description Token used to register and resolve the ServiceScopeFactory instance in the dependency injection container.
387
- *
388
- * @author Xeno
389
- * @version 1.0.0
390
- * @since 2025-09-30
391
- * @link https://github.com/xeno-js/xeno-js
392
- */
393
- readonly SERVICE_SCOPE_FACTORY: IFactory<void, IServiceScope>;
394
- /** @description Token used to register and resolve the TenantAuthorizationPipeline instance in the dependency injection container.
395
- *
396
- * @author Xeno
397
- * @version 1.0.0
398
- * @since 2025-09-30
399
- * @link https://github.com/xeno-js/xeno-js
400
- */
401
- readonly TENANT_AUTHORIZATION_PIPELINE: IStrategy<IRequest>;
402
- /** @description Token used to register and resolve the TransactionState instance in the dependency injection container.
403
- *
404
- * @author Xeno
405
- * @version 1.0.0
406
- * @since 2025-09-30
407
- * @link https://github.com/xeno-js/xeno-js
408
- */
409
- readonly TRANSACTION_STATE: ITransactionState<Ttx>;
410
202
  /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
411
203
  *
412
204
  * @author Xeno
@@ -415,22 +207,6 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
415
207
  * @link https://github.com/xeno-js/xeno-js
416
208
  */
417
209
  readonly UNIT_OF_WORK: IUnitOfWork & IDisposable;
418
- /** @description Token used to register and resolve the UserAuthorizationPipeline instance in the dependency injection container.
419
- *
420
- * @author Xeno
421
- * @version 1.0.0
422
- * @since 2025-09-30
423
- * @link https://github.com/xeno-js/xeno-js
424
- */
425
- readonly USER_AUTHORIZATION_PIPELINE: IStrategy<IRequest>;
426
- /** @description Token used to register and resolve the ValidationPipeline instance in the dependency injection container.
427
- *
428
- * @author Xeno
429
- * @version 1.0.0
430
- * @since 2025-09-30
431
- * @link https://github.com/xeno-js/xeno-js
432
- */
433
- readonly VALIDATION_PIPELINE: IPipelineBehavior<IRequest, unknown>;
434
210
  /** @description Token used to register and resolve the ZodValidator instance in the dependency injection container.
435
211
  *
436
212
  * @author Xeno
@@ -438,7 +214,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
438
214
  * @since 2025-09-30
439
215
  * @link https://github.com/xeno-js/xeno-js
440
216
  */
441
- readonly ZOD_VALIDATOR: IValidatorService;
217
+ readonly VALIDATOR_SERVICE: IValidatorService;
442
218
  /** @description Token used to register and resolve the IIdentityAccessor in the dependency injection container, allowing access only to current user identity information.
443
219
  *
444
220
  * @author Xeno
@@ -1805,7 +1581,7 @@ type DbTransaction = Parameters<Parameters<DbContext['transaction']>[0]>[0];
1805
1581
  * @since 2025-09-30
1806
1582
  * @link https://github.com/xeno-js/xeno-js
1807
1583
  */
1808
- type XenoRegistry<TSchema extends Dictionary = Dictionary, TExtensions = object> = ApplicationRegistry<DbContext<TSchema>, DbTransaction> & Readonly<Omit<TExtensions, keyof ApplicationRegistry<DbContext, DbTransaction>>>;
1584
+ type XenoRegistry<TSchema extends Dictionary = Dictionary, TExtensions = object> = ApplicationRegistry<DbContext<TSchema>> & Readonly<Omit<TExtensions, keyof ApplicationRegistry<DbContext<TSchema>>>>;
1809
1585
 
1810
1586
  /**
1811
1587
  * @description The AppBuilder class provides a fluent, .NET-style API for configuring and bootstrapping the application.
@@ -1826,6 +1602,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1826
1602
  private _config;
1827
1603
  private _middlewareConfig;
1828
1604
  private readonly _httpConfig;
1605
+ private readonly _loggerConfig;
1829
1606
  private _isContextModuleQueued;
1830
1607
  private _isMiddlewareModuleQueued;
1831
1608
  private _isPipelineModuleQueued;
@@ -1860,7 +1637,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1860
1637
  * @description Configures the logger for the application. This method allows you to set up logging options such as log level, console logging, and integration with external logging services like Sentry or Pino.
1861
1638
  * @param setupAction A callback function that receives a LoggerConfig object to configure the logger settings.
1862
1639
  * @returns The current instance of AppBuilder for method chaining.
1863
-
1864
1640
  *
1865
1641
  * @author Xeno
1866
1642
  * @version 1.0.0
@@ -1939,7 +1715,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1939
1715
  * @link https://github.com/xeno-js/xeno-js
1940
1716
  */
1941
1717
  addHttpCore(setupAction: SetupAction<HttpCoreConfig<TRegistry>, IConfigurationService>): this;
1942
- addAllowOrigin(setupAction: SetupAction<string[], IConfigurationService>): this;
1943
1718
  /**
1944
1719
  * @description Registers services in the application. This method allows you to add custom services to the dependency injection container, enabling modular and organized configuration of services.
1945
1720
  * @param setupAction A callback function that receives the IServiceContainer to register services.
@@ -2059,8 +1834,8 @@ interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
2059
1834
  config: AuthSsrConfig<SupabaseClientOptions<'public'>>;
2060
1835
  container: IServiceContainer<TRegistry>;
2061
1836
  }
2062
- declare class SupabaseServerAuthFactory<TRegistry extends XenoRegistry = XenoRegistry> implements IFactory<SupabaseServerAuthFactoryInput<TRegistry>, IExtendendService> {
2063
- create({ config, container, }: SupabaseServerAuthFactoryInput<TRegistry>): IExtendendService;
1837
+ declare class SupabaseServerAuthFactory<TRegistry extends XenoRegistry = XenoRegistry> implements IFactory<SupabaseServerAuthFactoryInput<TRegistry>, IExtendendAuthService> {
1838
+ create({ config, container, }: SupabaseServerAuthFactoryInput<TRegistry>): IExtendendAuthService;
2064
1839
  }
2065
1840
 
2066
1841
  /**