@xeno-js/shared 0.2.1 → 2.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 +678 -652
- package/dist/index.cjs +47 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -46
- package/dist/index.d.ts +42 -46
- package/dist/index.js +47 -41
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.d.cts
CHANGED
|
@@ -1482,6 +1482,22 @@ interface CookieOptions {
|
|
|
1482
1482
|
/** @description Controls whether the cookie is withheld on cross-site requests, providing some protection against cross-site request forgery attacks. */
|
|
1483
1483
|
sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
|
|
1484
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
|
+
}
|
|
1485
1501
|
|
|
1486
1502
|
/**
|
|
1487
1503
|
* @description Standardised paginated response envelope returned by query handlers.
|
|
@@ -3740,8 +3756,8 @@ interface NetworkContext {
|
|
|
3740
3756
|
* @link https://github.com/xeno-js/xeno-js
|
|
3741
3757
|
*/
|
|
3742
3758
|
readonly transport: Optional<{
|
|
3743
|
-
req:
|
|
3744
|
-
res:
|
|
3759
|
+
req: ExtendedRequest;
|
|
3760
|
+
res: Response;
|
|
3745
3761
|
}>;
|
|
3746
3762
|
/**
|
|
3747
3763
|
* @description The origin of the request, which can be used for logging, monitoring, or applying specific middleware logic.
|
|
@@ -3918,26 +3934,25 @@ interface INetworkContextAccessor {
|
|
|
3918
3934
|
|
|
3919
3935
|
/**
|
|
3920
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.
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
*/
|
|
3937
|
+
*
|
|
3938
|
+
* @author Xeno
|
|
3939
|
+
* @version 1.0.0
|
|
3940
|
+
* @since 2025-09-30
|
|
3941
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3942
|
+
*/
|
|
3928
3943
|
interface IController<TRequest = unknown, TResponse = unknown> {
|
|
3929
3944
|
/**
|
|
3930
3945
|
* Handles an incoming request and returns a response.
|
|
3931
3946
|
* @param request - The incoming request object.
|
|
3947
|
+
* @param signal - The AbortSignal
|
|
3932
3948
|
* @returns A promise that resolves to a ResponseDto containing the response object.
|
|
3933
|
-
|
|
3934
3949
|
*
|
|
3935
3950
|
* @author Xeno
|
|
3936
3951
|
* @version 1.0.0
|
|
3937
3952
|
* @since 2025-09-30
|
|
3938
|
-
* @link https://github.com/xeno-js/xeno-
|
|
3953
|
+
* @link https://github.com/xeno-js/xeno-shared
|
|
3939
3954
|
*/
|
|
3940
|
-
handle(request: TRequest): Promise<ResponseDto<TResponse>>;
|
|
3955
|
+
handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
|
|
3941
3956
|
}
|
|
3942
3957
|
|
|
3943
3958
|
/**
|
|
@@ -5125,18 +5140,17 @@ interface IMapper<TE, TDto> {
|
|
|
5125
5140
|
|
|
5126
5141
|
/**
|
|
5127
5142
|
* @description The IMiddleware interface defines the contract for middleware components that process incoming HTTP requests. Implementing classes must provide an execute method that takes an HttpRequest as input and returns a Promise of a ResponseDto, which can either be a successful response or an error response. This design allows for flexible middleware implementations that can perform various tasks such as authentication, logging, request transformation, or response generation.
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
interface IMiddleware<THeaders = unknown> {
|
|
5143
|
+
*
|
|
5144
|
+
* @author Xeno
|
|
5145
|
+
* @version 1.0.0
|
|
5146
|
+
* @since 2025-09-30
|
|
5147
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5148
|
+
*/
|
|
5149
|
+
interface IMiddleware {
|
|
5136
5150
|
/**
|
|
5137
5151
|
* @description The execute method processes an incoming HTTP request and returns a ResponseDto that can either be a successful response or an error response. This allows for flexible middleware implementations that can either modify the request, perform side effects, or generate a response directly.
|
|
5138
|
-
* @param
|
|
5139
|
-
* @param
|
|
5152
|
+
* @param req The request object that the middleware will process. This object typically contains information such as the request method, URL, headers, body, and other relevant data needed for processing.
|
|
5153
|
+
* @param res The response object that the middleware will use to send the response back to the client. This object provides methods for setting headers, status codes, and the response body.
|
|
5140
5154
|
* @param next A callback function that, when invoked, will pass control to the next middleware in the chain or to the final request handler. This allows for a composable middleware architecture where multiple middleware components can be chained together to process a request.
|
|
5141
5155
|
* @returns A Promise that resolves to a ResponseDto containing either a successful response or an error response. The ResponseDto allows for handling both success and error cases in a consistent manner.
|
|
5142
5156
|
*
|
|
@@ -5146,14 +5160,7 @@ interface IMiddleware<THeaders = unknown> {
|
|
|
5146
5160
|
* @since 2025-09-30
|
|
5147
5161
|
* @link https://github.com/xeno-js/xeno-js
|
|
5148
5162
|
*/
|
|
5149
|
-
execute<
|
|
5150
|
-
method: HttpMethod;
|
|
5151
|
-
path: string;
|
|
5152
|
-
transport: {
|
|
5153
|
-
req: unknown;
|
|
5154
|
-
res: unknown;
|
|
5155
|
-
};
|
|
5156
|
-
}, headers: THeaders, next: () => Promise<ResponseDto<T>>): Promise<ResponseDto<T>>;
|
|
5163
|
+
execute<TResp, TReq extends ExtendedRequest, TRes extends Response>(req: TReq, res: TRes, next: () => Promise<ResponseDto<TResp>>): Promise<ResponseDto<TResp>>;
|
|
5157
5164
|
}
|
|
5158
5165
|
|
|
5159
5166
|
/**
|
|
@@ -6007,19 +6014,6 @@ declare class CacheKeyBuilder implements ICacheKeyBuilder {
|
|
|
6007
6014
|
buildUserScopedKey(key: string): string;
|
|
6008
6015
|
}
|
|
6009
6016
|
|
|
6010
|
-
/**
|
|
6011
|
-
* @description Factory class responsible for creating instances of AxiosHttpClient based on the provided configuration. It implements the IFactory interface, allowing for easy integration with dependency injection systems. The factory encapsulates the creation logic for the AxiosHttpClient, including the initialization of the underlying Axios instance with the specified configuration options such as base URL, default headers, and timeout settings. This design promotes separation of concerns and allows for flexibility in managing AxiosHttpClient instances across the application.
|
|
6012
|
-
|
|
6013
|
-
*
|
|
6014
|
-
* @author Xeno
|
|
6015
|
-
* @version 1.0.0
|
|
6016
|
-
* @since 2025-09-30
|
|
6017
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
6018
|
-
*/
|
|
6019
|
-
declare class AxiosFactory implements IFactory<HttpClientConfig, IHttpClient> {
|
|
6020
|
-
create(config: HttpClientConfig): IHttpClient;
|
|
6021
|
-
}
|
|
6022
|
-
|
|
6023
6017
|
declare class AxiosHttpClient implements IHttpClient {
|
|
6024
6018
|
private readonly _client;
|
|
6025
6019
|
constructor(_client: AxiosInstance);
|
|
@@ -6063,18 +6057,20 @@ declare class SupabaseSessionMapper implements IBaseMapper<Session$1, Session> {
|
|
|
6063
6057
|
declare const ZodUtils: Readonly<{
|
|
6064
6058
|
/**
|
|
6065
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.
|
|
6066
6061
|
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
6067
6062
|
* @returns A Zod schema for the command.
|
|
6068
6063
|
*/
|
|
6069
|
-
createCommandSchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6064
|
+
createCommandSchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6070
6065
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6071
6066
|
}, z.core.$strict>;
|
|
6072
6067
|
/**
|
|
6073
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.
|
|
6074
6070
|
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
6075
6071
|
* @returns A Zod schema for the query.
|
|
6076
6072
|
*/
|
|
6077
|
-
createQuerySchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6073
|
+
createQuerySchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6078
6074
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6079
6075
|
}, z.core.$strict>;
|
|
6080
6076
|
}>;
|
|
@@ -6108,4 +6104,4 @@ declare class ZodValidatorService implements IValidatorService {
|
|
|
6108
6104
|
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
6109
6105
|
}
|
|
6110
6106
|
|
|
6111
|
-
export { AbortSignalHelper, type AbstractConstructor, AggregateRoot, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy,
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1482,6 +1482,22 @@ interface CookieOptions {
|
|
|
1482
1482
|
/** @description Controls whether the cookie is withheld on cross-site requests, providing some protection against cross-site request forgery attacks. */
|
|
1483
1483
|
sameSite?: Optional<'lax' | 'strict' | 'none' | boolean>;
|
|
1484
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
|
+
}
|
|
1485
1501
|
|
|
1486
1502
|
/**
|
|
1487
1503
|
* @description Standardised paginated response envelope returned by query handlers.
|
|
@@ -3740,8 +3756,8 @@ interface NetworkContext {
|
|
|
3740
3756
|
* @link https://github.com/xeno-js/xeno-js
|
|
3741
3757
|
*/
|
|
3742
3758
|
readonly transport: Optional<{
|
|
3743
|
-
req:
|
|
3744
|
-
res:
|
|
3759
|
+
req: ExtendedRequest;
|
|
3760
|
+
res: Response;
|
|
3745
3761
|
}>;
|
|
3746
3762
|
/**
|
|
3747
3763
|
* @description The origin of the request, which can be used for logging, monitoring, or applying specific middleware logic.
|
|
@@ -3918,26 +3934,25 @@ interface INetworkContextAccessor {
|
|
|
3918
3934
|
|
|
3919
3935
|
/**
|
|
3920
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.
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
*/
|
|
3937
|
+
*
|
|
3938
|
+
* @author Xeno
|
|
3939
|
+
* @version 1.0.0
|
|
3940
|
+
* @since 2025-09-30
|
|
3941
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
3942
|
+
*/
|
|
3928
3943
|
interface IController<TRequest = unknown, TResponse = unknown> {
|
|
3929
3944
|
/**
|
|
3930
3945
|
* Handles an incoming request and returns a response.
|
|
3931
3946
|
* @param request - The incoming request object.
|
|
3947
|
+
* @param signal - The AbortSignal
|
|
3932
3948
|
* @returns A promise that resolves to a ResponseDto containing the response object.
|
|
3933
|
-
|
|
3934
3949
|
*
|
|
3935
3950
|
* @author Xeno
|
|
3936
3951
|
* @version 1.0.0
|
|
3937
3952
|
* @since 2025-09-30
|
|
3938
|
-
* @link https://github.com/xeno-js/xeno-
|
|
3953
|
+
* @link https://github.com/xeno-js/xeno-shared
|
|
3939
3954
|
*/
|
|
3940
|
-
handle(request: TRequest): Promise<ResponseDto<TResponse>>;
|
|
3955
|
+
handle(request: TRequest, signal: AbortSignal): Promise<ResponseDto<TResponse>>;
|
|
3941
3956
|
}
|
|
3942
3957
|
|
|
3943
3958
|
/**
|
|
@@ -5125,18 +5140,17 @@ interface IMapper<TE, TDto> {
|
|
|
5125
5140
|
|
|
5126
5141
|
/**
|
|
5127
5142
|
* @description The IMiddleware interface defines the contract for middleware components that process incoming HTTP requests. Implementing classes must provide an execute method that takes an HttpRequest as input and returns a Promise of a ResponseDto, which can either be a successful response or an error response. This design allows for flexible middleware implementations that can perform various tasks such as authentication, logging, request transformation, or response generation.
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
interface IMiddleware<THeaders = unknown> {
|
|
5143
|
+
*
|
|
5144
|
+
* @author Xeno
|
|
5145
|
+
* @version 1.0.0
|
|
5146
|
+
* @since 2025-09-30
|
|
5147
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5148
|
+
*/
|
|
5149
|
+
interface IMiddleware {
|
|
5136
5150
|
/**
|
|
5137
5151
|
* @description The execute method processes an incoming HTTP request and returns a ResponseDto that can either be a successful response or an error response. This allows for flexible middleware implementations that can either modify the request, perform side effects, or generate a response directly.
|
|
5138
|
-
* @param
|
|
5139
|
-
* @param
|
|
5152
|
+
* @param req The request object that the middleware will process. This object typically contains information such as the request method, URL, headers, body, and other relevant data needed for processing.
|
|
5153
|
+
* @param res The response object that the middleware will use to send the response back to the client. This object provides methods for setting headers, status codes, and the response body.
|
|
5140
5154
|
* @param next A callback function that, when invoked, will pass control to the next middleware in the chain or to the final request handler. This allows for a composable middleware architecture where multiple middleware components can be chained together to process a request.
|
|
5141
5155
|
* @returns A Promise that resolves to a ResponseDto containing either a successful response or an error response. The ResponseDto allows for handling both success and error cases in a consistent manner.
|
|
5142
5156
|
*
|
|
@@ -5146,14 +5160,7 @@ interface IMiddleware<THeaders = unknown> {
|
|
|
5146
5160
|
* @since 2025-09-30
|
|
5147
5161
|
* @link https://github.com/xeno-js/xeno-js
|
|
5148
5162
|
*/
|
|
5149
|
-
execute<
|
|
5150
|
-
method: HttpMethod;
|
|
5151
|
-
path: string;
|
|
5152
|
-
transport: {
|
|
5153
|
-
req: unknown;
|
|
5154
|
-
res: unknown;
|
|
5155
|
-
};
|
|
5156
|
-
}, headers: THeaders, next: () => Promise<ResponseDto<T>>): Promise<ResponseDto<T>>;
|
|
5163
|
+
execute<TResp, TReq extends ExtendedRequest, TRes extends Response>(req: TReq, res: TRes, next: () => Promise<ResponseDto<TResp>>): Promise<ResponseDto<TResp>>;
|
|
5157
5164
|
}
|
|
5158
5165
|
|
|
5159
5166
|
/**
|
|
@@ -6007,19 +6014,6 @@ declare class CacheKeyBuilder implements ICacheKeyBuilder {
|
|
|
6007
6014
|
buildUserScopedKey(key: string): string;
|
|
6008
6015
|
}
|
|
6009
6016
|
|
|
6010
|
-
/**
|
|
6011
|
-
* @description Factory class responsible for creating instances of AxiosHttpClient based on the provided configuration. It implements the IFactory interface, allowing for easy integration with dependency injection systems. The factory encapsulates the creation logic for the AxiosHttpClient, including the initialization of the underlying Axios instance with the specified configuration options such as base URL, default headers, and timeout settings. This design promotes separation of concerns and allows for flexibility in managing AxiosHttpClient instances across the application.
|
|
6012
|
-
|
|
6013
|
-
*
|
|
6014
|
-
* @author Xeno
|
|
6015
|
-
* @version 1.0.0
|
|
6016
|
-
* @since 2025-09-30
|
|
6017
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
6018
|
-
*/
|
|
6019
|
-
declare class AxiosFactory implements IFactory<HttpClientConfig, IHttpClient> {
|
|
6020
|
-
create(config: HttpClientConfig): IHttpClient;
|
|
6021
|
-
}
|
|
6022
|
-
|
|
6023
6017
|
declare class AxiosHttpClient implements IHttpClient {
|
|
6024
6018
|
private readonly _client;
|
|
6025
6019
|
constructor(_client: AxiosInstance);
|
|
@@ -6063,18 +6057,20 @@ declare class SupabaseSessionMapper implements IBaseMapper<Session$1, Session> {
|
|
|
6063
6057
|
declare const ZodUtils: Readonly<{
|
|
6064
6058
|
/**
|
|
6065
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.
|
|
6066
6061
|
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
6067
6062
|
* @returns A Zod schema for the command.
|
|
6068
6063
|
*/
|
|
6069
|
-
createCommandSchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6064
|
+
createCommandSchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6070
6065
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6071
6066
|
}, z.core.$strict>;
|
|
6072
6067
|
/**
|
|
6073
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.
|
|
6074
6070
|
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
6075
6071
|
* @returns A Zod schema for the query.
|
|
6076
6072
|
*/
|
|
6077
|
-
createQuerySchema: (additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6073
|
+
createQuerySchema: (intent: string, additionalSchema: z.ZodRawShape) => z.ZodObject<{
|
|
6078
6074
|
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
6079
6075
|
}, z.core.$strict>;
|
|
6080
6076
|
}>;
|
|
@@ -6108,4 +6104,4 @@ declare class ZodValidatorService implements IValidatorService {
|
|
|
6108
6104
|
validate<T>(key: string, data: T): Promise<ResultType<boolean>>;
|
|
6109
6105
|
}
|
|
6110
6106
|
|
|
6111
|
-
export { AbortSignalHelper, type AbstractConstructor, AggregateRoot, type ApiResponseDto, AppError, type AsyncFactory, type AsyncResolver, type AuthClaims, type AuthConfig, type AuthPolicy,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -2705,9 +2705,6 @@ var CacheKeyBuilder = class {
|
|
|
2705
2705
|
}
|
|
2706
2706
|
};
|
|
2707
2707
|
|
|
2708
|
-
// src/infrastructure/factories/axios.factory.ts
|
|
2709
|
-
import axios from "axios";
|
|
2710
|
-
|
|
2711
2708
|
// src/infrastructure/http/axios.http.ts
|
|
2712
2709
|
import { AxiosError } from "axios";
|
|
2713
2710
|
var AxiosHttpClient = class {
|
|
@@ -2813,22 +2810,6 @@ var AxiosHttpClient = class {
|
|
|
2813
2810
|
}
|
|
2814
2811
|
};
|
|
2815
2812
|
|
|
2816
|
-
// src/infrastructure/factories/axios.factory.ts
|
|
2817
|
-
var AxiosFactory = class {
|
|
2818
|
-
create(config) {
|
|
2819
|
-
const axiosInstance = axios.create({
|
|
2820
|
-
baseURL: config.baseURL,
|
|
2821
|
-
headers: config.defaultHeaders,
|
|
2822
|
-
timeout: config.timeoutMs,
|
|
2823
|
-
maxRedirects: config.maxRedirects ?? 5,
|
|
2824
|
-
decompress: config.decompress ?? true,
|
|
2825
|
-
proxy: config.proxy,
|
|
2826
|
-
withCredentials: config.withCredentials
|
|
2827
|
-
});
|
|
2828
|
-
return new AxiosHttpClient(axiosInstance);
|
|
2829
|
-
}
|
|
2830
|
-
};
|
|
2831
|
-
|
|
2832
2813
|
// src/infrastructure/mappers/supabase-claims.mapper.ts
|
|
2833
2814
|
var SupabaseClaimsMapper = class {
|
|
2834
2815
|
map(user) {
|
|
@@ -2863,41 +2844,67 @@ var SupabaseSessionMapper = class {
|
|
|
2863
2844
|
|
|
2864
2845
|
// src/infrastructure/validators/base-schema.constant.ts
|
|
2865
2846
|
import { z } from "zod";
|
|
2866
|
-
var
|
|
2867
|
-
intent
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
}
|
|
2874
|
-
var cacheableOptionsZodSchema =
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
}
|
|
2847
|
+
var baseZodSchema = {
|
|
2848
|
+
get(intent, type) {
|
|
2849
|
+
return z.object({
|
|
2850
|
+
intent: z.literal(intent),
|
|
2851
|
+
type: z.literal(type)
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
var cacheableOptionsZodSchema = {
|
|
2856
|
+
get() {
|
|
2857
|
+
return z.object({
|
|
2858
|
+
cacheKey: z.string().min(1, "Cache key is required"),
|
|
2859
|
+
ttl: z.number().int().positive().optional(),
|
|
2860
|
+
bypassCache: z.boolean().optional(),
|
|
2861
|
+
consistentRead: z.boolean().optional()
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
};
|
|
2865
|
+
var baseCommandZodSchema = {
|
|
2866
|
+
/**
|
|
2867
|
+
* @description Gets the base schema for a command with the given intent.
|
|
2868
|
+
* @param intent The intent of the command.
|
|
2869
|
+
* @returns The base schema for the command.
|
|
2870
|
+
*/
|
|
2871
|
+
get(intent) {
|
|
2872
|
+
return baseZodSchema.get(intent, REQUEST_TYPE.COMMAND);
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
var baseQueryZodSchema = {
|
|
2876
|
+
/**
|
|
2877
|
+
* @description Gets the base schema for a query with the given intent and chache key.
|
|
2878
|
+
* @param intent The intent of the query.
|
|
2879
|
+
* @returns The base schema for the query.
|
|
2880
|
+
*/
|
|
2881
|
+
get(intent) {
|
|
2882
|
+
const baseSchema = baseZodSchema.get(intent, REQUEST_TYPE.QUERY);
|
|
2883
|
+
return baseSchema.extend({
|
|
2884
|
+
cacheOptions: cacheableOptionsZodSchema.get()
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2883
2888
|
|
|
2884
2889
|
// src/infrastructure/validators/schema-zod.utils.ts
|
|
2885
2890
|
var ZodUtils = Object.freeze({
|
|
2886
2891
|
/**
|
|
2887
2892
|
* @description Creates a Zod schema for a command by extending the base command schema with additional properties.
|
|
2893
|
+
* @param intent - The intent of the command.
|
|
2888
2894
|
* @param additionalSchema - An object representing additional properties to be added to the command schema.
|
|
2889
2895
|
* @returns A Zod schema for the command.
|
|
2890
2896
|
*/
|
|
2891
|
-
createCommandSchema: (additionalSchema) => {
|
|
2892
|
-
return baseCommandZodSchema.extend(additionalSchema).strict();
|
|
2897
|
+
createCommandSchema: (intent, additionalSchema) => {
|
|
2898
|
+
return baseCommandZodSchema.get(intent).extend(additionalSchema).strict();
|
|
2893
2899
|
},
|
|
2894
2900
|
/**
|
|
2895
2901
|
* @description Creates a Zod schema for a query by extending the base query schema with additional properties.
|
|
2902
|
+
* @param intent - The intent of the query.
|
|
2896
2903
|
* @param additionalSchema - An object representing additional properties to be added to the query schema.
|
|
2897
2904
|
* @returns A Zod schema for the query.
|
|
2898
2905
|
*/
|
|
2899
|
-
createQuerySchema: (additionalSchema) => {
|
|
2900
|
-
return baseQueryZodSchema.extend(additionalSchema).strict();
|
|
2906
|
+
createQuerySchema: (intent, additionalSchema) => {
|
|
2907
|
+
return baseQueryZodSchema.get(intent).extend(additionalSchema).strict();
|
|
2901
2908
|
}
|
|
2902
2909
|
});
|
|
2903
2910
|
|
|
@@ -2949,7 +2956,6 @@ var ZodValidatorService = class _ZodValidatorService {
|
|
|
2949
2956
|
export {
|
|
2950
2957
|
AbortSignalHelper,
|
|
2951
2958
|
AppError,
|
|
2952
|
-
AxiosFactory,
|
|
2953
2959
|
AxiosHttpClient,
|
|
2954
2960
|
BaseLogger,
|
|
2955
2961
|
CacheKeyBuilder,
|