@xeno-js/core 0.1.5 → 0.1.7
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.cjs +216 -125
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +205 -109
- package/dist/index.js.map +1 -1
- package/package.json +160 -160
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,25 @@ interface IAtomicCache extends ICache {
|
|
|
23
23
|
increment(key: string, ttlSeconds: Optional<number | string>): Promise<number>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @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.
|
|
28
|
+
*
|
|
29
|
+
* @author Xeno
|
|
30
|
+
* @version 1.0.0
|
|
31
|
+
* @since 2025-09-30
|
|
32
|
+
* @link https://github.com/xeno-js/xeno-vue
|
|
33
|
+
* @copyright Xeno
|
|
34
|
+
* @license MIT
|
|
35
|
+
*/
|
|
36
|
+
interface IRateLimitKeyBuilder {
|
|
37
|
+
/**
|
|
38
|
+
* Builds a rate limit key based on the provided resource and client IP address
|
|
39
|
+
* @param resource the resource to limit
|
|
40
|
+
* @param clientIp the client IP address
|
|
41
|
+
*/
|
|
42
|
+
buildRateLimitKey(resource: string): Optional<string>;
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
/**
|
|
27
46
|
* @description This file defines the injection tokens used for dependency injection in the application.
|
|
28
47
|
* Injection tokens are unique identifiers that are used to register and resolve dependencies in the container.
|
|
@@ -241,6 +260,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
|
|
|
241
260
|
readonly OPTIONS_MIDDLEWARE: IMiddleware<HttpHeaders>;
|
|
242
261
|
readonly REQUEST_CONTEXT_MIDDLEWARE: IMiddleware<HttpHeaders>;
|
|
243
262
|
readonly RATE_LIMITER_MIDDLEWARE: IMiddleware<HttpHeaders>;
|
|
263
|
+
readonly RATE_LIMIT_KEY_BUILDER: IRateLimitKeyBuilder;
|
|
244
264
|
/** @description Token used to register and resolve the PerformancePipeline instance in the dependency injection container.
|
|
245
265
|
*
|
|
246
266
|
* @author Xeno
|
|
@@ -846,6 +866,16 @@ interface IAllowMethod {
|
|
|
846
866
|
* @link https://github.com/xeno-js/xeno-js
|
|
847
867
|
*/
|
|
848
868
|
check(path: string, method: HttpMethod): boolean;
|
|
869
|
+
/**
|
|
870
|
+
* @description Get the allowed methods for the given path.
|
|
871
|
+
* @param path the path to get the allowed methods for.
|
|
872
|
+
* @returns the allowed methods for the given path.
|
|
873
|
+
* @author Xeno
|
|
874
|
+
* @version 1.0.0
|
|
875
|
+
* @since 2025-09-30
|
|
876
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
877
|
+
*/
|
|
878
|
+
getMethods(path: string): string;
|
|
849
879
|
}
|
|
850
880
|
|
|
851
881
|
/**
|
|
@@ -1320,6 +1350,16 @@ interface MiddlewareConfig {
|
|
|
1320
1350
|
* @link https://github.com/xeno-js/xeno-js
|
|
1321
1351
|
*/
|
|
1322
1352
|
allowOrigins: Optional<string[]>;
|
|
1353
|
+
/**
|
|
1354
|
+
* @description
|
|
1355
|
+
* The allowMethods property is an optional property that can be used to configure the allowed methods for the application. It is an array of strings that specifies the methods that are allowed to be used in requests to the application. This property is used to implement CORS and restrict access to the application based on the method of the request.
|
|
1356
|
+
*
|
|
1357
|
+
* @author Xeno
|
|
1358
|
+
* @version 1.0.0
|
|
1359
|
+
* @since 2025-09-30
|
|
1360
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1361
|
+
*/
|
|
1362
|
+
allowHeaders: Optional<string[]>;
|
|
1323
1363
|
/**
|
|
1324
1364
|
* @description
|
|
1325
1365
|
* The cors property is a boolean property that is used to enable or disable Cross-Origin Resource Sharing (CORS) for the application. CORS is a mechanism that allows resources on a web page to be requested from another domain outside the domain from which the first resource was served. This property is used to configure the CORS middleware that is responsible for handling CORS requests and responses.
|
|
@@ -1330,6 +1370,15 @@ interface MiddlewareConfig {
|
|
|
1330
1370
|
* @link https://github.com/xeno-js/xeno-js
|
|
1331
1371
|
*/
|
|
1332
1372
|
cors: boolean;
|
|
1373
|
+
/**
|
|
1374
|
+
* @description The exposeHeaders property is an array of strings that specifies the headers that should be exposed to the client. This property is used to configure the CORS middleware that is responsible for handling CORS requests and responses.
|
|
1375
|
+
*
|
|
1376
|
+
* @author Xeno
|
|
1377
|
+
* @version 1.0.0
|
|
1378
|
+
* @since 2025-09-30
|
|
1379
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1380
|
+
*/
|
|
1381
|
+
withCredentials: boolean;
|
|
1333
1382
|
}
|
|
1334
1383
|
/**
|
|
1335
1384
|
* @description
|
|
@@ -2117,4 +2166,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
|
|
|
2117
2166
|
protected getContext(): Optional<RequestContext>;
|
|
2118
2167
|
}
|
|
2119
2168
|
|
|
2120
|
-
export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, 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 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 };
|
|
2169
|
+
export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,25 @@ interface IAtomicCache extends ICache {
|
|
|
23
23
|
increment(key: string, ttlSeconds: Optional<number | string>): Promise<number>;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* @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.
|
|
28
|
+
*
|
|
29
|
+
* @author Xeno
|
|
30
|
+
* @version 1.0.0
|
|
31
|
+
* @since 2025-09-30
|
|
32
|
+
* @link https://github.com/xeno-js/xeno-vue
|
|
33
|
+
* @copyright Xeno
|
|
34
|
+
* @license MIT
|
|
35
|
+
*/
|
|
36
|
+
interface IRateLimitKeyBuilder {
|
|
37
|
+
/**
|
|
38
|
+
* Builds a rate limit key based on the provided resource and client IP address
|
|
39
|
+
* @param resource the resource to limit
|
|
40
|
+
* @param clientIp the client IP address
|
|
41
|
+
*/
|
|
42
|
+
buildRateLimitKey(resource: string): Optional<string>;
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
/**
|
|
27
46
|
* @description This file defines the injection tokens used for dependency injection in the application.
|
|
28
47
|
* Injection tokens are unique identifiers that are used to register and resolve dependencies in the container.
|
|
@@ -241,6 +260,7 @@ interface ApplicationRegistry<T = unknown, Ttx = unknown> {
|
|
|
241
260
|
readonly OPTIONS_MIDDLEWARE: IMiddleware<HttpHeaders>;
|
|
242
261
|
readonly REQUEST_CONTEXT_MIDDLEWARE: IMiddleware<HttpHeaders>;
|
|
243
262
|
readonly RATE_LIMITER_MIDDLEWARE: IMiddleware<HttpHeaders>;
|
|
263
|
+
readonly RATE_LIMIT_KEY_BUILDER: IRateLimitKeyBuilder;
|
|
244
264
|
/** @description Token used to register and resolve the PerformancePipeline instance in the dependency injection container.
|
|
245
265
|
*
|
|
246
266
|
* @author Xeno
|
|
@@ -846,6 +866,16 @@ interface IAllowMethod {
|
|
|
846
866
|
* @link https://github.com/xeno-js/xeno-js
|
|
847
867
|
*/
|
|
848
868
|
check(path: string, method: HttpMethod): boolean;
|
|
869
|
+
/**
|
|
870
|
+
* @description Get the allowed methods for the given path.
|
|
871
|
+
* @param path the path to get the allowed methods for.
|
|
872
|
+
* @returns the allowed methods for the given path.
|
|
873
|
+
* @author Xeno
|
|
874
|
+
* @version 1.0.0
|
|
875
|
+
* @since 2025-09-30
|
|
876
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
877
|
+
*/
|
|
878
|
+
getMethods(path: string): string;
|
|
849
879
|
}
|
|
850
880
|
|
|
851
881
|
/**
|
|
@@ -1320,6 +1350,16 @@ interface MiddlewareConfig {
|
|
|
1320
1350
|
* @link https://github.com/xeno-js/xeno-js
|
|
1321
1351
|
*/
|
|
1322
1352
|
allowOrigins: Optional<string[]>;
|
|
1353
|
+
/**
|
|
1354
|
+
* @description
|
|
1355
|
+
* The allowMethods property is an optional property that can be used to configure the allowed methods for the application. It is an array of strings that specifies the methods that are allowed to be used in requests to the application. This property is used to implement CORS and restrict access to the application based on the method of the request.
|
|
1356
|
+
*
|
|
1357
|
+
* @author Xeno
|
|
1358
|
+
* @version 1.0.0
|
|
1359
|
+
* @since 2025-09-30
|
|
1360
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1361
|
+
*/
|
|
1362
|
+
allowHeaders: Optional<string[]>;
|
|
1323
1363
|
/**
|
|
1324
1364
|
* @description
|
|
1325
1365
|
* The cors property is a boolean property that is used to enable or disable Cross-Origin Resource Sharing (CORS) for the application. CORS is a mechanism that allows resources on a web page to be requested from another domain outside the domain from which the first resource was served. This property is used to configure the CORS middleware that is responsible for handling CORS requests and responses.
|
|
@@ -1330,6 +1370,15 @@ interface MiddlewareConfig {
|
|
|
1330
1370
|
* @link https://github.com/xeno-js/xeno-js
|
|
1331
1371
|
*/
|
|
1332
1372
|
cors: boolean;
|
|
1373
|
+
/**
|
|
1374
|
+
* @description The exposeHeaders property is an array of strings that specifies the headers that should be exposed to the client. This property is used to configure the CORS middleware that is responsible for handling CORS requests and responses.
|
|
1375
|
+
*
|
|
1376
|
+
* @author Xeno
|
|
1377
|
+
* @version 1.0.0
|
|
1378
|
+
* @since 2025-09-30
|
|
1379
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
1380
|
+
*/
|
|
1381
|
+
withCredentials: boolean;
|
|
1333
1382
|
}
|
|
1334
1383
|
/**
|
|
1335
1384
|
* @description
|
|
@@ -2117,4 +2166,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
|
|
|
2117
2166
|
protected getContext(): Optional<RequestContext>;
|
|
2118
2167
|
}
|
|
2119
2168
|
|
|
2120
|
-
export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, 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 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 };
|
|
2169
|
+
export { AppBuilder, type ApplicationRegistry, type AuthSsrConfig, BaseAuthorizationStrategy, BaseController, BaseHandler, 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 };
|