@xeno-js/core 0.1.6 → 0.1.8

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
 
@@ -1370,6 +1372,15 @@ interface MiddlewareConfig {
1370
1372
  * @link https://github.com/xeno-js/xeno-js
1371
1373
  */
1372
1374
  cors: boolean;
1375
+ /**
1376
+ * @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.
1377
+ *
1378
+ * @author Xeno
1379
+ * @version 1.0.0
1380
+ * @since 2025-09-30
1381
+ * @link https://github.com/xeno-js/xeno-js
1382
+ */
1383
+ withCredentials: boolean;
1373
1384
  }
1374
1385
  /**
1375
1386
  * @description
@@ -2008,6 +2019,42 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
2008
2019
  private _queueContextModule;
2009
2020
  }
2010
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
+
2011
2058
  interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
2012
2059
  config: AuthSsrConfig<SupabaseClientOptions<'public'>>;
2013
2060
  container: IServiceContainer<TRegistry>;
@@ -2157,4 +2204,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2157
2204
  protected getContext(): Optional<RequestContext>;
2158
2205
  }
2159
2206
 
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 };
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
 
@@ -1370,6 +1372,15 @@ interface MiddlewareConfig {
1370
1372
  * @link https://github.com/xeno-js/xeno-js
1371
1373
  */
1372
1374
  cors: boolean;
1375
+ /**
1376
+ * @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.
1377
+ *
1378
+ * @author Xeno
1379
+ * @version 1.0.0
1380
+ * @since 2025-09-30
1381
+ * @link https://github.com/xeno-js/xeno-js
1382
+ */
1383
+ withCredentials: boolean;
1373
1384
  }
1374
1385
  /**
1375
1386
  * @description
@@ -2008,6 +2019,42 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
2008
2019
  private _queueContextModule;
2009
2020
  }
2010
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
+
2011
2058
  interface SupabaseServerAuthFactoryInput<TRegistry extends XenoRegistry> {
2012
2059
  config: AuthSsrConfig<SupabaseClientOptions<'public'>>;
2013
2060
  container: IServiceContainer<TRegistry>;
@@ -2157,4 +2204,4 @@ declare abstract class BaseController<TRequest, TResponse> implements IControlle
2157
2204
  protected getContext(): Optional<RequestContext>;
2158
2205
  }
2159
2206
 
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 };
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
@@ -4313,9 +4313,7 @@ var middleware_module_exports = {};
4313
4313
  __export(middleware_module_exports, {
4314
4314
  MiddlewareModule: () => MiddlewareModule
4315
4315
  });
4316
- import {
4317
- Guards as Guards43
4318
- } from "@xeno-js/shared";
4316
+ import { Guards as Guards43 } from "@xeno-js/shared";
4319
4317
  var MiddlewareModule;
4320
4318
  var init_middleware_module = __esm({
4321
4319
  "src/infrastructure/modules/middleware.module.ts"() {
@@ -4364,8 +4362,7 @@ var init_middleware_module = __esm({
4364
4362
  )
4365
4363
  );
4366
4364
  if (!Guards43.isNullOrEmpty(opts.allowOrigins)) {
4367
- const withCredentials2 = opts.httpConfig.withCredentials ?? false;
4368
- if (withCredentials2 && opts.allowOrigins.includes("*"))
4365
+ if (opts.withCredentials && opts.allowOrigins.includes("*"))
4369
4366
  throw new Error(
4370
4367
  "Wildcard CORS origin is not allowed when withCredentials is set to true in addHttpCore"
4371
4368
  );
@@ -4383,7 +4380,7 @@ var init_middleware_module = __esm({
4383
4380
  });
4384
4381
  middlewares.push(TOKENS4.ALLOW_ORIGIN_MIDDLEWARE);
4385
4382
  }
4386
- const withCredentials = Guards43.isDefined(opts.httpConfig.withCredentials) && opts.httpConfig.withCredentials ? "true" : "false";
4383
+ const withCredentials = opts.withCredentials ? "true" : "false";
4387
4384
  if (opts.optionsMiddleware) {
4388
4385
  const { OptionsMiddleware: OptionsMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4389
4386
  container.addSingleton(
@@ -4542,7 +4539,9 @@ __export(index_exports, {
4542
4539
  BaseAuthorizationStrategy: () => BaseAuthorizationStrategy,
4543
4540
  BaseController: () => BaseController,
4544
4541
  BaseHandler: () => BaseHandler,
4542
+ BasePostgresSqlDataSource: () => BasePostgresSqlDataSource,
4545
4543
  BaseQuery: () => Query,
4544
+ BaseSqliteSqlDataSource: () => BaseSqliteSqlDataSource,
4546
4545
  ContainerUtils: () => ContainerUtils,
4547
4546
  ReadDao: () => ReadDao,
4548
4547
  Repository: () => Repository,
@@ -4865,7 +4864,8 @@ var AppBuilder = class {
4865
4864
  trustedProxies: [],
4866
4865
  allowOrigins: [],
4867
4866
  allowHeaders: [],
4868
- cors: true
4867
+ cors: true,
4868
+ withCredentials: true
4869
4869
  };
4870
4870
  _httpConfig = {
4871
4871
  dataSourceToken: void 0,
@@ -5278,8 +5278,7 @@ var AppBuilder = class {
5278
5278
  ...this._middlewareConfig,
5279
5279
  isAuth: this._isAuthModuleQueued,
5280
5280
  isLogger: this._isLoggerModuleQueued,
5281
- isCache: this._isCacheModuleQueued || this._isPipelineModuleQueued,
5282
- httpConfig: this._httpConfig.http.client
5281
+ isCache: this._isCacheModuleQueued || this._isPipelineModuleQueued
5283
5282
  });
5284
5283
  }
5285
5284
  });
@@ -5314,6 +5313,36 @@ init_cache();
5314
5313
  // src/infrastructure/context/index.ts
5315
5314
  init_request_context();
5316
5315
 
5316
+ // src/infrastructure/datasources/base-postgressql.datasource.ts
5317
+ var BasePostgresSqlDataSource = class {
5318
+ constructor(_db) {
5319
+ this._db = _db;
5320
+ }
5321
+ _db;
5322
+ /**
5323
+ * @description Returns the database connection.
5324
+ * @returns {NodePgDatabase<TSchema>} The database connection.
5325
+ */
5326
+ get db() {
5327
+ return this._db;
5328
+ }
5329
+ };
5330
+
5331
+ // src/infrastructure/datasources/base-sqllite.datasource.ts
5332
+ var BaseSqliteSqlDataSource = class {
5333
+ constructor(_db) {
5334
+ this._db = _db;
5335
+ }
5336
+ _db;
5337
+ /**
5338
+ * @description Returns the SQLite database connection.
5339
+ * @returns {LibSQLDatabase<TSchema>} The database connection.
5340
+ */
5341
+ get db() {
5342
+ return this._db;
5343
+ }
5344
+ };
5345
+
5317
5346
  // src/infrastructure/datasources/remote.datasource.ts
5318
5347
  import { AppError as AppError15, Result as Result16 } from "@xeno-js/shared";
5319
5348
 
@@ -5455,7 +5484,9 @@ export {
5455
5484
  BaseAuthorizationStrategy,
5456
5485
  BaseController,
5457
5486
  BaseHandler,
5487
+ BasePostgresSqlDataSource,
5458
5488
  Query as BaseQuery,
5489
+ BaseSqliteSqlDataSource,
5459
5490
  ContainerUtils,
5460
5491
  ReadDao,
5461
5492
  Repository,