@xeno-js/core 0.1.4 → 0.1.6

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
@@ -2,9 +2,9 @@ import { ICache, Optional, IPipelineBehavior, IRequest, IExtendendService, IBase
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';
5
- import { Client } from '@libsql/client/web';
6
- import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
- import { NodePgDatabase } from 'drizzle-orm/node-postgres';
5
+ import * as _libsql_client_web from '@libsql/client/web';
6
+ import * as drizzle_orm_libsql from 'drizzle-orm/libsql';
7
+ import * as drizzle_orm_node_postgres from 'drizzle-orm/node-postgres';
8
8
  export * from 'drizzle-orm';
9
9
  export { Query } from 'drizzle-orm';
10
10
 
@@ -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.
@@ -1733,8 +1773,8 @@ declare abstract class Specification<T> implements ISpecification<T> {
1733
1773
  * @since 2025-09-30
1734
1774
  * @link https://github.com/xeno-js/xeno-js
1735
1775
  */
1736
- type DbContext<TSchema extends Dictionary = Dictionary> = NodePgDatabase<TSchema> | (LibSQLDatabase<TSchema> & {
1737
- $client: Client;
1776
+ type DbContext<TSchema extends Dictionary = Dictionary> = drizzle_orm_node_postgres.NodePgDatabase<TSchema> | (drizzle_orm_libsql.LibSQLDatabase<TSchema> & {
1777
+ $client: _libsql_client_web.Client;
1738
1778
  });
1739
1779
  /**
1740
1780
  * @description Type definition for the transaction object used in the database context.
@@ -2117,4 +2157,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2117
2157
  protected getContext(): Optional<RequestContext>;
2118
2158
  }
2119
2159
 
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 };
2160
+ 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
@@ -2,9 +2,9 @@ import { ICache, Optional, IPipelineBehavior, IRequest, IExtendendService, IBase
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';
5
- import { Client } from '@libsql/client/web';
6
- import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
- import { NodePgDatabase } from 'drizzle-orm/node-postgres';
5
+ import * as _libsql_client_web from '@libsql/client/web';
6
+ import * as drizzle_orm_libsql from 'drizzle-orm/libsql';
7
+ import * as drizzle_orm_node_postgres from 'drizzle-orm/node-postgres';
8
8
  export * from 'drizzle-orm';
9
9
  export { Query } from 'drizzle-orm';
10
10
 
@@ -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.
@@ -1733,8 +1773,8 @@ declare abstract class Specification<T> implements ISpecification<T> {
1733
1773
  * @since 2025-09-30
1734
1774
  * @link https://github.com/xeno-js/xeno-js
1735
1775
  */
1736
- type DbContext<TSchema extends Dictionary = Dictionary> = NodePgDatabase<TSchema> | (LibSQLDatabase<TSchema> & {
1737
- $client: Client;
1776
+ type DbContext<TSchema extends Dictionary = Dictionary> = drizzle_orm_node_postgres.NodePgDatabase<TSchema> | (drizzle_orm_libsql.LibSQLDatabase<TSchema> & {
1777
+ $client: _libsql_client_web.Client;
1738
1778
  });
1739
1779
  /**
1740
1780
  * @description Type definition for the transaction object used in the database context.
@@ -2117,4 +2157,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2117
2157
  protected getContext(): Optional<RequestContext>;
2118
2158
  }
2119
2159
 
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 };
2160
+ 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 };