@xeno-js/core 0.1.12 → 1.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
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, ITransactionState, 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';
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, HttpMethod, AuthConfig, CookieOptions, SetupAction, HttpClientConfig, LogLevel, ILoggerClient, Dictionary, AuthPolicy, IStrategy, IRequest, ExtendedRequest, 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';
@@ -158,7 +158,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
158
158
  * @since 2025-09-30
159
159
  * @link https://github.com/xeno-js/xeno-js
160
160
  */
161
- readonly MIDDLEWARE: IMiddleware<HttpHeaders>;
161
+ readonly MIDDLEWARE: IMiddleware;
162
162
  /** @description Token used to register and resolve the QueryPipeline behaviors in the dependency injection container.
163
163
  *
164
164
  * @author Xeno
@@ -198,7 +198,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
198
198
  * @since 2025-09-30
199
199
  * @link https://github.com/xeno-js/xeno-js
200
200
  */
201
- readonly SERVICE_EXTRACTOR: IServiceExtractor<HttpHeaders, Metadata>;
201
+ readonly SERVICE_EXTRACTOR: IServiceExtractor<Request['headers'], Metadata>;
202
202
  /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
203
203
  *
204
204
  * @author Xeno
@@ -717,6 +717,10 @@ interface ISsrCookieHandler {
717
717
  }
718
718
  interface AuthSsrConfig<TOption, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends AuthConfig<TOption> {
719
719
  ssrOpts: Optional<(container: IServiceContainer<TRegistry>) => ISsrCookieHandler>;
720
+ customAuth: Optional<{
721
+ authHeaderExtractor: () => IServiceExtractor<Request['headers'], Optional<string>>;
722
+ authExtendedService: () => IExtendendAuthService;
723
+ }>;
720
724
  }
721
725
 
722
726
  /**
@@ -1165,6 +1169,10 @@ interface MiddlewareConfig {
1165
1169
  * @link https://github.com/xeno-js/xeno-js
1166
1170
  */
1167
1171
  withCredentials: boolean;
1172
+ /**
1173
+ * @description The cookie prefix
1174
+ */
1175
+ authCookieName: Optional<string>;
1168
1176
  }
1169
1177
  /**
1170
1178
  * @description
@@ -1414,10 +1422,7 @@ declare const ContainerUtils: Readonly<{
1414
1422
  * @throws Error If the service is not found in the container.
1415
1423
  * @throws Error If the service is not a scoped service.
1416
1424
  */
1417
- runExecute<TResponse, T extends ApplicationRegistry, TRes, TReq>(endpoint: string, method: Optional<string>, headers: HttpHeaders, transport: {
1418
- res: TRes;
1419
- req: TReq;
1420
- }, container: IServiceContainer<T>, action: () => Promise<ResponseDto<TResponse>>): Promise<ResponseDto<TResponse>>;
1425
+ runExecute<TResponse, T extends ApplicationRegistry, TRes extends Response, TReq extends ExtendedRequest>(res: TRes, req: TReq, container: IServiceContainer<T>, action: () => Promise<ResponseDto<TResponse>>): Promise<ResponseDto<TResponse>>;
1421
1426
  }>;
1422
1427
 
1423
1428
  /**
@@ -1610,6 +1615,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1610
1615
  private _pipelineConfig;
1611
1616
  private _config;
1612
1617
  private _middlewareConfig;
1618
+ private readonly _authConfig;
1613
1619
  private readonly _httpConfig;
1614
1620
  private readonly _loggerConfig;
1615
1621
  private _isContextModuleQueued;
@@ -1934,7 +1940,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1934
1940
  * @link https://github.com/xeno-js/xeno-js
1935
1941
  */
1936
1942
  constructor(_requestContext: IContextAccessor<RequestContext>, _mediator: IMediator);
1937
- abstract handle(request: TRequest): Promise<ResponseDto<TResponse>>;
1943
+ abstract handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
1938
1944
  /**
1939
1945
  * Helper to return a successful 200/201 response.
1940
1946
  * @param data - The data to include in the response.
@@ -1966,6 +1972,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1966
1972
  /**
1967
1973
  * Helper to send a query through the mediator and return the result.
1968
1974
  * @param request - The IQuery instance to be sent.
1975
+ * @param signal - The AbortSignal
1969
1976
  * @returns A promise resolving to the result of the query.
1970
1977
  *
1971
1978
  * @author Xeno
@@ -1973,10 +1980,11 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1973
1980
  * @since 2025-09-30
1974
1981
  * @link https://github.com/xeno-js/xeno-js
1975
1982
  */
1976
- protected _query(request: IQuery<TResponse>): Promise<ResultType<TResponse>>;
1983
+ protected _query(request: IQuery<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1977
1984
  /**
1978
1985
  * Helper to send a command through the mediator and return the result.
1979
1986
  * @param request - The ICommand instance to be sent.
1987
+ * @param signal - The AbortSignal
1980
1988
  * @returns A promise resolving to the result of the command.
1981
1989
  *
1982
1990
  * @author Xeno
@@ -1984,7 +1992,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1984
1992
  * @since 2025-09-30
1985
1993
  * @link https://github.com/xeno-js/xeno-js
1986
1994
  */
1987
- protected _send(request: ICommand<TResponse>): Promise<ResultType<TResponse>>;
1995
+ protected _send(request: ICommand<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1988
1996
  protected getContext(): Optional<RequestContext>;
1989
1997
  }
1990
1998
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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, ITransactionState, 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';
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, HttpMethod, AuthConfig, CookieOptions, SetupAction, HttpClientConfig, LogLevel, ILoggerClient, Dictionary, AuthPolicy, IStrategy, IRequest, ExtendedRequest, 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';
@@ -158,7 +158,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
158
158
  * @since 2025-09-30
159
159
  * @link https://github.com/xeno-js/xeno-js
160
160
  */
161
- readonly MIDDLEWARE: IMiddleware<HttpHeaders>;
161
+ readonly MIDDLEWARE: IMiddleware;
162
162
  /** @description Token used to register and resolve the QueryPipeline behaviors in the dependency injection container.
163
163
  *
164
164
  * @author Xeno
@@ -198,7 +198,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
198
198
  * @since 2025-09-30
199
199
  * @link https://github.com/xeno-js/xeno-js
200
200
  */
201
- readonly SERVICE_EXTRACTOR: IServiceExtractor<HttpHeaders, Metadata>;
201
+ readonly SERVICE_EXTRACTOR: IServiceExtractor<Request['headers'], Metadata>;
202
202
  /** @description Token used to register and resolve the UnitOfWork instance in the dependency injection container.
203
203
  *
204
204
  * @author Xeno
@@ -717,6 +717,10 @@ interface ISsrCookieHandler {
717
717
  }
718
718
  interface AuthSsrConfig<TOption, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends AuthConfig<TOption> {
719
719
  ssrOpts: Optional<(container: IServiceContainer<TRegistry>) => ISsrCookieHandler>;
720
+ customAuth: Optional<{
721
+ authHeaderExtractor: () => IServiceExtractor<Request['headers'], Optional<string>>;
722
+ authExtendedService: () => IExtendendAuthService;
723
+ }>;
720
724
  }
721
725
 
722
726
  /**
@@ -1165,6 +1169,10 @@ interface MiddlewareConfig {
1165
1169
  * @link https://github.com/xeno-js/xeno-js
1166
1170
  */
1167
1171
  withCredentials: boolean;
1172
+ /**
1173
+ * @description The cookie prefix
1174
+ */
1175
+ authCookieName: Optional<string>;
1168
1176
  }
1169
1177
  /**
1170
1178
  * @description
@@ -1414,10 +1422,7 @@ declare const ContainerUtils: Readonly<{
1414
1422
  * @throws Error If the service is not found in the container.
1415
1423
  * @throws Error If the service is not a scoped service.
1416
1424
  */
1417
- runExecute<TResponse, T extends ApplicationRegistry, TRes, TReq>(endpoint: string, method: Optional<string>, headers: HttpHeaders, transport: {
1418
- res: TRes;
1419
- req: TReq;
1420
- }, container: IServiceContainer<T>, action: () => Promise<ResponseDto<TResponse>>): Promise<ResponseDto<TResponse>>;
1425
+ runExecute<TResponse, T extends ApplicationRegistry, TRes extends Response, TReq extends ExtendedRequest>(res: TRes, req: TReq, container: IServiceContainer<T>, action: () => Promise<ResponseDto<TResponse>>): Promise<ResponseDto<TResponse>>;
1421
1426
  }>;
1422
1427
 
1423
1428
  /**
@@ -1610,6 +1615,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1610
1615
  private _pipelineConfig;
1611
1616
  private _config;
1612
1617
  private _middlewareConfig;
1618
+ private readonly _authConfig;
1613
1619
  private readonly _httpConfig;
1614
1620
  private readonly _loggerConfig;
1615
1621
  private _isContextModuleQueued;
@@ -1934,7 +1940,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1934
1940
  * @link https://github.com/xeno-js/xeno-js
1935
1941
  */
1936
1942
  constructor(_requestContext: IContextAccessor<RequestContext>, _mediator: IMediator);
1937
- abstract handle(request: TRequest): Promise<ResponseDto<TResponse>>;
1943
+ abstract handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
1938
1944
  /**
1939
1945
  * Helper to return a successful 200/201 response.
1940
1946
  * @param data - The data to include in the response.
@@ -1966,6 +1972,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1966
1972
  /**
1967
1973
  * Helper to send a query through the mediator and return the result.
1968
1974
  * @param request - The IQuery instance to be sent.
1975
+ * @param signal - The AbortSignal
1969
1976
  * @returns A promise resolving to the result of the query.
1970
1977
  *
1971
1978
  * @author Xeno
@@ -1973,10 +1980,11 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1973
1980
  * @since 2025-09-30
1974
1981
  * @link https://github.com/xeno-js/xeno-js
1975
1982
  */
1976
- protected _query(request: IQuery<TResponse>): Promise<ResultType<TResponse>>;
1983
+ protected _query(request: IQuery<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1977
1984
  /**
1978
1985
  * Helper to send a command through the mediator and return the result.
1979
1986
  * @param request - The ICommand instance to be sent.
1987
+ * @param signal - The AbortSignal
1980
1988
  * @returns A promise resolving to the result of the command.
1981
1989
  *
1982
1990
  * @author Xeno
@@ -1984,7 +1992,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1984
1992
  * @since 2025-09-30
1985
1993
  * @link https://github.com/xeno-js/xeno-js
1986
1994
  */
1987
- protected _send(request: ICommand<TResponse>): Promise<ResultType<TResponse>>;
1995
+ protected _send(request: ICommand<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1988
1996
  protected getContext(): Optional<RequestContext>;
1989
1997
  }
1990
1998