@xeno-js/core 0.1.13 → 1.1.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.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
@@ -715,8 +715,16 @@ interface ISsrCookieHandler {
715
715
  getAll(): ISsrCookie[];
716
716
  setAll(cookies: ISsrCookieToSet[]): void;
717
717
  }
718
+ interface CookieHandlerOptions extends CookieOptions {
719
+ httpOnly: boolean;
720
+ }
718
721
  interface AuthSsrConfig<TOption, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends AuthConfig<TOption> {
719
722
  ssrOpts: Optional<(container: IServiceContainer<TRegistry>) => ISsrCookieHandler>;
723
+ cookieOpts: CookieHandlerOptions;
724
+ customAuth: Optional<{
725
+ authHeaderExtractor: () => IServiceExtractor<Request['headers'], Optional<string>>;
726
+ authExtendedService: () => IExtendendAuthService;
727
+ }>;
720
728
  }
721
729
 
722
730
  /**
@@ -1165,6 +1173,10 @@ interface MiddlewareConfig {
1165
1173
  * @link https://github.com/xeno-js/xeno-js
1166
1174
  */
1167
1175
  withCredentials: boolean;
1176
+ /**
1177
+ * @description The cookie prefix
1178
+ */
1179
+ authCookieName: Optional<string>;
1168
1180
  }
1169
1181
  /**
1170
1182
  * @description
@@ -1414,10 +1426,7 @@ declare const ContainerUtils: Readonly<{
1414
1426
  * @throws Error If the service is not found in the container.
1415
1427
  * @throws Error If the service is not a scoped service.
1416
1428
  */
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>>;
1429
+ 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
1430
  }>;
1422
1431
 
1423
1432
  /**
@@ -1610,6 +1619,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1610
1619
  private _pipelineConfig;
1611
1620
  private _config;
1612
1621
  private _middlewareConfig;
1622
+ private readonly _authConfig;
1613
1623
  private readonly _httpConfig;
1614
1624
  private readonly _loggerConfig;
1615
1625
  private _isContextModuleQueued;
@@ -1845,6 +1855,7 @@ interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
1845
1855
  }
1846
1856
  declare class SupabaseServerAuthFactory<TRegistry extends XenoRegistry = XenoRegistry> implements IFactory<SupabaseServerAuthFactoryInput<TRegistry>, IExtendendAuthService> {
1847
1857
  create({ config, container, }: SupabaseServerAuthFactoryInput<TRegistry>): IExtendendAuthService;
1858
+ private _getCookieSsr;
1848
1859
  }
1849
1860
 
1850
1861
  /**
@@ -1934,7 +1945,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1934
1945
  * @link https://github.com/xeno-js/xeno-js
1935
1946
  */
1936
1947
  constructor(_requestContext: IContextAccessor<RequestContext>, _mediator: IMediator);
1937
- abstract handle(request: TRequest): Promise<ResponseDto<TResponse>>;
1948
+ abstract handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
1938
1949
  /**
1939
1950
  * Helper to return a successful 200/201 response.
1940
1951
  * @param data - The data to include in the response.
@@ -1966,6 +1977,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1966
1977
  /**
1967
1978
  * Helper to send a query through the mediator and return the result.
1968
1979
  * @param request - The IQuery instance to be sent.
1980
+ * @param signal - The AbortSignal
1969
1981
  * @returns A promise resolving to the result of the query.
1970
1982
  *
1971
1983
  * @author Xeno
@@ -1973,10 +1985,11 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1973
1985
  * @since 2025-09-30
1974
1986
  * @link https://github.com/xeno-js/xeno-js
1975
1987
  */
1976
- protected _query(request: IQuery<TResponse>): Promise<ResultType<TResponse>>;
1988
+ protected _query(request: IQuery<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1977
1989
  /**
1978
1990
  * Helper to send a command through the mediator and return the result.
1979
1991
  * @param request - The ICommand instance to be sent.
1992
+ * @param signal - The AbortSignal
1980
1993
  * @returns A promise resolving to the result of the command.
1981
1994
  *
1982
1995
  * @author Xeno
@@ -1984,8 +1997,8 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1984
1997
  * @since 2025-09-30
1985
1998
  * @link https://github.com/xeno-js/xeno-js
1986
1999
  */
1987
- protected _send(request: ICommand<TResponse>): Promise<ResultType<TResponse>>;
2000
+ protected _send(request: ICommand<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1988
2001
  protected getContext(): Optional<RequestContext>;
1989
2002
  }
1990
2003
 
1991
- export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, BasePostgresSqlDataSource, BaseSqliteSqlDataSource, ContainerUtils, type DbContext, type DbTransaction, type ExecutionContext, type HttpConfig, type HttpCoreConfig, type IAllowMethod, type IAllowOrigin, type IAtomicCache, type ICryptoService, type ICsrfTokenService, 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 };
2004
+ export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, BasePostgresSqlDataSource, BaseSqliteSqlDataSource, ContainerUtils, type CookieHandlerOptions, type DbContext, type DbTransaction, type ExecutionContext, type HttpConfig, type HttpCoreConfig, type IAllowMethod, type IAllowOrigin, type IAtomicCache, type ICryptoService, type ICsrfTokenService, 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 };
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
@@ -715,8 +715,16 @@ interface ISsrCookieHandler {
715
715
  getAll(): ISsrCookie[];
716
716
  setAll(cookies: ISsrCookieToSet[]): void;
717
717
  }
718
+ interface CookieHandlerOptions extends CookieOptions {
719
+ httpOnly: boolean;
720
+ }
718
721
  interface AuthSsrConfig<TOption, TRegistry extends ApplicationRegistry = ApplicationRegistry> extends AuthConfig<TOption> {
719
722
  ssrOpts: Optional<(container: IServiceContainer<TRegistry>) => ISsrCookieHandler>;
723
+ cookieOpts: CookieHandlerOptions;
724
+ customAuth: Optional<{
725
+ authHeaderExtractor: () => IServiceExtractor<Request['headers'], Optional<string>>;
726
+ authExtendedService: () => IExtendendAuthService;
727
+ }>;
720
728
  }
721
729
 
722
730
  /**
@@ -1165,6 +1173,10 @@ interface MiddlewareConfig {
1165
1173
  * @link https://github.com/xeno-js/xeno-js
1166
1174
  */
1167
1175
  withCredentials: boolean;
1176
+ /**
1177
+ * @description The cookie prefix
1178
+ */
1179
+ authCookieName: Optional<string>;
1168
1180
  }
1169
1181
  /**
1170
1182
  * @description
@@ -1414,10 +1426,7 @@ declare const ContainerUtils: Readonly<{
1414
1426
  * @throws Error If the service is not found in the container.
1415
1427
  * @throws Error If the service is not a scoped service.
1416
1428
  */
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>>;
1429
+ 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
1430
  }>;
1422
1431
 
1423
1432
  /**
@@ -1610,6 +1619,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
1610
1619
  private _pipelineConfig;
1611
1620
  private _config;
1612
1621
  private _middlewareConfig;
1622
+ private readonly _authConfig;
1613
1623
  private readonly _httpConfig;
1614
1624
  private readonly _loggerConfig;
1615
1625
  private _isContextModuleQueued;
@@ -1845,6 +1855,7 @@ interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
1845
1855
  }
1846
1856
  declare class SupabaseServerAuthFactory<TRegistry extends XenoRegistry = XenoRegistry> implements IFactory<SupabaseServerAuthFactoryInput<TRegistry>, IExtendendAuthService> {
1847
1857
  create({ config, container, }: SupabaseServerAuthFactoryInput<TRegistry>): IExtendendAuthService;
1858
+ private _getCookieSsr;
1848
1859
  }
1849
1860
 
1850
1861
  /**
@@ -1934,7 +1945,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1934
1945
  * @link https://github.com/xeno-js/xeno-js
1935
1946
  */
1936
1947
  constructor(_requestContext: IContextAccessor<RequestContext>, _mediator: IMediator);
1937
- abstract handle(request: TRequest): Promise<ResponseDto<TResponse>>;
1948
+ abstract handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
1938
1949
  /**
1939
1950
  * Helper to return a successful 200/201 response.
1940
1951
  * @param data - The data to include in the response.
@@ -1966,6 +1977,7 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1966
1977
  /**
1967
1978
  * Helper to send a query through the mediator and return the result.
1968
1979
  * @param request - The IQuery instance to be sent.
1980
+ * @param signal - The AbortSignal
1969
1981
  * @returns A promise resolving to the result of the query.
1970
1982
  *
1971
1983
  * @author Xeno
@@ -1973,10 +1985,11 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1973
1985
  * @since 2025-09-30
1974
1986
  * @link https://github.com/xeno-js/xeno-js
1975
1987
  */
1976
- protected _query(request: IQuery<TResponse>): Promise<ResultType<TResponse>>;
1988
+ protected _query(request: IQuery<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1977
1989
  /**
1978
1990
  * Helper to send a command through the mediator and return the result.
1979
1991
  * @param request - The ICommand instance to be sent.
1992
+ * @param signal - The AbortSignal
1980
1993
  * @returns A promise resolving to the result of the command.
1981
1994
  *
1982
1995
  * @author Xeno
@@ -1984,8 +1997,8 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
1984
1997
  * @since 2025-09-30
1985
1998
  * @link https://github.com/xeno-js/xeno-js
1986
1999
  */
1987
- protected _send(request: ICommand<TResponse>): Promise<ResultType<TResponse>>;
2000
+ protected _send(request: ICommand<TResponse>, signal: AbortSignal): Promise<ResultType<TResponse>>;
1988
2001
  protected getContext(): Optional<RequestContext>;
1989
2002
  }
1990
2003
 
1991
- export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, BasePostgresSqlDataSource, BaseSqliteSqlDataSource, ContainerUtils, type DbContext, type DbTransaction, type ExecutionContext, type HttpConfig, type HttpCoreConfig, type IAllowMethod, type IAllowOrigin, type IAtomicCache, type ICryptoService, type ICsrfTokenService, 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 };
2004
+ export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, BasePostgresSqlDataSource, BaseSqliteSqlDataSource, ContainerUtils, type CookieHandlerOptions, type DbContext, type DbTransaction, type ExecutionContext, type HttpConfig, type HttpCoreConfig, type IAllowMethod, type IAllowOrigin, type IAtomicCache, type ICryptoService, type ICsrfTokenService, 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 };