@xeno-js/core 0.1.7 → 0.1.9

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
@@ -4,7 +4,9 @@ export { Query as BaseQuery } from '@xeno-js/shared';
4
4
  import { SupabaseClientOptions } from '@supabase/supabase-js';
5
5
  import * as _libsql_client_web from '@libsql/client/web';
6
6
  import * as drizzle_orm_libsql from 'drizzle-orm/libsql';
7
+ import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
8
  import * as drizzle_orm_node_postgres from 'drizzle-orm/node-postgres';
9
+ import { NodePgDatabase } from 'drizzle-orm/node-postgres';
8
10
  export * from 'drizzle-orm';
9
11
  export { Query } from 'drizzle-orm';
10
12
 
@@ -2017,6 +2019,42 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
2017
2019
  private _queueContextModule;
2018
2020
  }
2019
2021
 
2022
+ /**
2023
+ * @description BasePostgresSqlDataSource is an abstract class that serves as a foundation for creating data sources that interact with a PostgreSQL database. It provides a common interface for accessing the database connection and ensures that the database connection is properly initialized and managed. By extending this class, developers can easily create data sources that are tailored to their specific use cases.
2024
+ *
2025
+ * @author Xeno
2026
+ * @version 1.0.0
2027
+ * @since 2025-09-30
2028
+ * @link https://github.com/xeno-js/xeno-js
2029
+ */
2030
+ declare abstract class BasePostgresSqlDataSource<TSchema extends Dictionary = Dictionary> {
2031
+ private readonly _db;
2032
+ constructor(_db: DbContext<TSchema>);
2033
+ /**
2034
+ * @description Returns the database connection.
2035
+ * @returns {NodePgDatabase<TSchema>} The database connection.
2036
+ */
2037
+ protected get db(): NodePgDatabase<TSchema>;
2038
+ }
2039
+
2040
+ /**
2041
+ * @description BaseSqliteSqlDataSource is an abstract class that serves as a foundation for creating data sources that interact with a SQLite / libSQL database.
2042
+ *
2043
+ * @author Xeno
2044
+ * @version 1.0.0
2045
+ * @since 2025-09-30
2046
+ * @link https://github.com/xeno-js/xeno-js
2047
+ */
2048
+ declare abstract class BaseSqliteSqlDataSource<TSchema extends Dictionary = Dictionary> {
2049
+ private readonly _db;
2050
+ constructor(_db: DbContext<TSchema>);
2051
+ /**
2052
+ * @description Returns the SQLite database connection.
2053
+ * @returns {LibSQLDatabase<TSchema>} The database connection.
2054
+ */
2055
+ protected get db(): LibSQLDatabase<TSchema>;
2056
+ }
2057
+
2020
2058
  interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
2021
2059
  config: AuthSsrConfig<SupabaseClientOptions<'public'>>;
2022
2060
  container: IServiceContainer<TRegistry>;
@@ -2166,4 +2204,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2166
2204
  protected getContext(): Optional<RequestContext>;
2167
2205
  }
2168
2206
 
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 };
2207
+ 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 };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,9 @@ export { Query as BaseQuery } from '@xeno-js/shared';
4
4
  import { SupabaseClientOptions } from '@supabase/supabase-js';
5
5
  import * as _libsql_client_web from '@libsql/client/web';
6
6
  import * as drizzle_orm_libsql from 'drizzle-orm/libsql';
7
+ import { LibSQLDatabase } from 'drizzle-orm/libsql';
7
8
  import * as drizzle_orm_node_postgres from 'drizzle-orm/node-postgres';
9
+ import { NodePgDatabase } from 'drizzle-orm/node-postgres';
8
10
  export * from 'drizzle-orm';
9
11
  export { Query } from 'drizzle-orm';
10
12
 
@@ -2017,6 +2019,42 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
2017
2019
  private _queueContextModule;
2018
2020
  }
2019
2021
 
2022
+ /**
2023
+ * @description BasePostgresSqlDataSource is an abstract class that serves as a foundation for creating data sources that interact with a PostgreSQL database. It provides a common interface for accessing the database connection and ensures that the database connection is properly initialized and managed. By extending this class, developers can easily create data sources that are tailored to their specific use cases.
2024
+ *
2025
+ * @author Xeno
2026
+ * @version 1.0.0
2027
+ * @since 2025-09-30
2028
+ * @link https://github.com/xeno-js/xeno-js
2029
+ */
2030
+ declare abstract class BasePostgresSqlDataSource<TSchema extends Dictionary = Dictionary> {
2031
+ private readonly _db;
2032
+ constructor(_db: DbContext<TSchema>);
2033
+ /**
2034
+ * @description Returns the database connection.
2035
+ * @returns {NodePgDatabase<TSchema>} The database connection.
2036
+ */
2037
+ protected get db(): NodePgDatabase<TSchema>;
2038
+ }
2039
+
2040
+ /**
2041
+ * @description BaseSqliteSqlDataSource is an abstract class that serves as a foundation for creating data sources that interact with a SQLite / libSQL database.
2042
+ *
2043
+ * @author Xeno
2044
+ * @version 1.0.0
2045
+ * @since 2025-09-30
2046
+ * @link https://github.com/xeno-js/xeno-js
2047
+ */
2048
+ declare abstract class BaseSqliteSqlDataSource<TSchema extends Dictionary = Dictionary> {
2049
+ private readonly _db;
2050
+ constructor(_db: DbContext<TSchema>);
2051
+ /**
2052
+ * @description Returns the SQLite database connection.
2053
+ * @returns {LibSQLDatabase<TSchema>} The database connection.
2054
+ */
2055
+ protected get db(): LibSQLDatabase<TSchema>;
2056
+ }
2057
+
2020
2058
  interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
2021
2059
  config: AuthSsrConfig<SupabaseClientOptions<'public'>>;
2022
2060
  container: IServiceContainer<TRegistry>;
@@ -2166,4 +2204,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2166
2204
  protected getContext(): Optional<RequestContext>;
2167
2205
  }
2168
2206
 
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 };
2207
+ 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 };
package/dist/index.js CHANGED
@@ -4458,6 +4458,8 @@ var init_middleware_module = __esm({
4458
4458
  }
4459
4459
  if (Guards43.isDefined(opts.csrf)) {
4460
4460
  const csrf = opts.csrf;
4461
+ const { EdgeCryptoService: EdgeCryptoService2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4462
+ container.addSingleton("CRYPTO_SERVICE", () => new EdgeCryptoService2());
4461
4463
  const { CsrfTokenService: CsrfTokenService2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4462
4464
  container.addSingleton("CSRF_TOKEN_SERVICE", (c) => {
4463
4465
  return new CsrfTokenService2(csrf.secret, c.resolve("CRYPTO_SERVICE"));
@@ -4539,7 +4541,9 @@ __export(index_exports, {
4539
4541
  BaseAuthorizationStrategy: () => BaseAuthorizationStrategy,
4540
4542
  BaseController: () => BaseController,
4541
4543
  BaseHandler: () => BaseHandler,
4544
+ BasePostgresSqlDataSource: () => BasePostgresSqlDataSource,
4542
4545
  BaseQuery: () => Query,
4546
+ BaseSqliteSqlDataSource: () => BaseSqliteSqlDataSource,
4543
4547
  ContainerUtils: () => ContainerUtils,
4544
4548
  ReadDao: () => ReadDao,
4545
4549
  Repository: () => Repository,
@@ -5311,6 +5315,36 @@ init_cache();
5311
5315
  // src/infrastructure/context/index.ts
5312
5316
  init_request_context();
5313
5317
 
5318
+ // src/infrastructure/datasources/base-postgressql.datasource.ts
5319
+ var BasePostgresSqlDataSource = class {
5320
+ constructor(_db) {
5321
+ this._db = _db;
5322
+ }
5323
+ _db;
5324
+ /**
5325
+ * @description Returns the database connection.
5326
+ * @returns {NodePgDatabase<TSchema>} The database connection.
5327
+ */
5328
+ get db() {
5329
+ return this._db;
5330
+ }
5331
+ };
5332
+
5333
+ // src/infrastructure/datasources/base-sqllite.datasource.ts
5334
+ var BaseSqliteSqlDataSource = class {
5335
+ constructor(_db) {
5336
+ this._db = _db;
5337
+ }
5338
+ _db;
5339
+ /**
5340
+ * @description Returns the SQLite database connection.
5341
+ * @returns {LibSQLDatabase<TSchema>} The database connection.
5342
+ */
5343
+ get db() {
5344
+ return this._db;
5345
+ }
5346
+ };
5347
+
5314
5348
  // src/infrastructure/datasources/remote.datasource.ts
5315
5349
  import { AppError as AppError15, Result as Result16 } from "@xeno-js/shared";
5316
5350
 
@@ -5452,7 +5486,9 @@ export {
5452
5486
  BaseAuthorizationStrategy,
5453
5487
  BaseController,
5454
5488
  BaseHandler,
5489
+ BasePostgresSqlDataSource,
5455
5490
  Query as BaseQuery,
5491
+ BaseSqliteSqlDataSource,
5456
5492
  ContainerUtils,
5457
5493
  ReadDao,
5458
5494
  Repository,