@xeno-js/core 1.2.11 → 1.2.13
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 +20 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -9
- package/dist/index.d.ts +5 -9
- package/dist/index.js +20 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1709,7 +1709,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1709
1709
|
private readonly _container;
|
|
1710
1710
|
private readonly _configuration;
|
|
1711
1711
|
private _isBuilded;
|
|
1712
|
-
constructor(container?: IServiceContainer<TRegistry
|
|
1712
|
+
constructor(container?: IServiceContainer<TRegistry>, configurationService?: IConfigurationService);
|
|
1713
1713
|
private readonly _modules;
|
|
1714
1714
|
private _adapterConfig;
|
|
1715
1715
|
private _pipelineConfig;
|
|
@@ -1860,7 +1860,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1860
1860
|
* @description Resolves a service from the dependency injection container.
|
|
1861
1861
|
* @param token The injection token used to identify the service.
|
|
1862
1862
|
* @returns The resolved service instance.
|
|
1863
|
-
|
|
1864
1863
|
*
|
|
1865
1864
|
* @author Xeno
|
|
1866
1865
|
* @version 1.0.0
|
|
@@ -1871,7 +1870,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1871
1870
|
/**
|
|
1872
1871
|
* @description Finalizes the configuration and initializes all registered modules in the container.
|
|
1873
1872
|
* @returns The fully configured ServiceContainer.
|
|
1874
|
-
|
|
1875
1873
|
*
|
|
1876
1874
|
* @author Xeno
|
|
1877
1875
|
* @version 1.0.0
|
|
@@ -1881,7 +1879,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1881
1879
|
build(): Promise<IServiceContainer<TRegistry>>;
|
|
1882
1880
|
/**
|
|
1883
1881
|
* @description Queues the configuration of the CQRS pipeline module if it has not already been queued. This method ensures that the pipeline module is only added once, even if multiple pipeline-related configurations are made.
|
|
1884
|
-
|
|
1885
1882
|
*
|
|
1886
1883
|
* @author Xeno
|
|
1887
1884
|
* @version 1.0.0
|
|
@@ -1891,7 +1888,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1891
1888
|
private _queuePipelineModule;
|
|
1892
1889
|
/**
|
|
1893
1890
|
* @description Queues the configuration of the middleware module if it has not already been queued. This method ensures that the middleware module is only added once, even if multiple middleware-related configurations are made.
|
|
1894
|
-
|
|
1895
1891
|
*
|
|
1896
1892
|
* @author Xeno
|
|
1897
1893
|
* @version 1.0.0
|
|
@@ -2019,8 +2015,8 @@ declare abstract class BaseHttpAdapter<TReq = ExtendedRequest, TRes = Response>
|
|
|
2019
2015
|
* @link https://github.com/xeno-js/xeno-js
|
|
2020
2016
|
*/
|
|
2021
2017
|
declare abstract class ReadDao<T, TDto> implements IReadDao<T> {
|
|
2022
|
-
|
|
2023
|
-
|
|
2018
|
+
protected readonly _dataSource: IReadDataSource<TDto>;
|
|
2019
|
+
protected readonly _mapper: IMapper<T, TDto>;
|
|
2024
2020
|
/**
|
|
2025
2021
|
* Constructs a new ReadDao instance.
|
|
2026
2022
|
* @param _dataSource An instance of IReadDataSource used to execute SQL queries and commands for data access.
|
|
@@ -2049,8 +2045,8 @@ declare abstract class ReadDao<T, TDto> implements IReadDao<T> {
|
|
|
2049
2045
|
* @link https://github.com/xeno-js/xeno-js
|
|
2050
2046
|
*/
|
|
2051
2047
|
declare abstract class Repository<T, TDto> implements IRepository<T> {
|
|
2052
|
-
|
|
2053
|
-
|
|
2048
|
+
protected readonly _dataSource: IWriteDataSource<TDto>;
|
|
2049
|
+
protected readonly _mapper: IMapper<T, TDto>;
|
|
2054
2050
|
/**
|
|
2055
2051
|
* Constructs a new Repository instance.
|
|
2056
2052
|
* @param _dataSource An instance of IWriteDataSource used to execute SQL queries and commands for data access.
|
package/dist/index.d.ts
CHANGED
|
@@ -1709,7 +1709,7 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1709
1709
|
private readonly _container;
|
|
1710
1710
|
private readonly _configuration;
|
|
1711
1711
|
private _isBuilded;
|
|
1712
|
-
constructor(container?: IServiceContainer<TRegistry
|
|
1712
|
+
constructor(container?: IServiceContainer<TRegistry>, configurationService?: IConfigurationService);
|
|
1713
1713
|
private readonly _modules;
|
|
1714
1714
|
private _adapterConfig;
|
|
1715
1715
|
private _pipelineConfig;
|
|
@@ -1860,7 +1860,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1860
1860
|
* @description Resolves a service from the dependency injection container.
|
|
1861
1861
|
* @param token The injection token used to identify the service.
|
|
1862
1862
|
* @returns The resolved service instance.
|
|
1863
|
-
|
|
1864
1863
|
*
|
|
1865
1864
|
* @author Xeno
|
|
1866
1865
|
* @version 1.0.0
|
|
@@ -1871,7 +1870,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1871
1870
|
/**
|
|
1872
1871
|
* @description Finalizes the configuration and initializes all registered modules in the container.
|
|
1873
1872
|
* @returns The fully configured ServiceContainer.
|
|
1874
|
-
|
|
1875
1873
|
*
|
|
1876
1874
|
* @author Xeno
|
|
1877
1875
|
* @version 1.0.0
|
|
@@ -1881,7 +1879,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1881
1879
|
build(): Promise<IServiceContainer<TRegistry>>;
|
|
1882
1880
|
/**
|
|
1883
1881
|
* @description Queues the configuration of the CQRS pipeline module if it has not already been queued. This method ensures that the pipeline module is only added once, even if multiple pipeline-related configurations are made.
|
|
1884
|
-
|
|
1885
1882
|
*
|
|
1886
1883
|
* @author Xeno
|
|
1887
1884
|
* @version 1.0.0
|
|
@@ -1891,7 +1888,6 @@ declare class AppBuilder<TRegistry extends XenoRegistry = XenoRegistry> {
|
|
|
1891
1888
|
private _queuePipelineModule;
|
|
1892
1889
|
/**
|
|
1893
1890
|
* @description Queues the configuration of the middleware module if it has not already been queued. This method ensures that the middleware module is only added once, even if multiple middleware-related configurations are made.
|
|
1894
|
-
|
|
1895
1891
|
*
|
|
1896
1892
|
* @author Xeno
|
|
1897
1893
|
* @version 1.0.0
|
|
@@ -2019,8 +2015,8 @@ declare abstract class BaseHttpAdapter<TReq = ExtendedRequest, TRes = Response>
|
|
|
2019
2015
|
* @link https://github.com/xeno-js/xeno-js
|
|
2020
2016
|
*/
|
|
2021
2017
|
declare abstract class ReadDao<T, TDto> implements IReadDao<T> {
|
|
2022
|
-
|
|
2023
|
-
|
|
2018
|
+
protected readonly _dataSource: IReadDataSource<TDto>;
|
|
2019
|
+
protected readonly _mapper: IMapper<T, TDto>;
|
|
2024
2020
|
/**
|
|
2025
2021
|
* Constructs a new ReadDao instance.
|
|
2026
2022
|
* @param _dataSource An instance of IReadDataSource used to execute SQL queries and commands for data access.
|
|
@@ -2049,8 +2045,8 @@ declare abstract class ReadDao<T, TDto> implements IReadDao<T> {
|
|
|
2049
2045
|
* @link https://github.com/xeno-js/xeno-js
|
|
2050
2046
|
*/
|
|
2051
2047
|
declare abstract class Repository<T, TDto> implements IRepository<T> {
|
|
2052
|
-
|
|
2053
|
-
|
|
2048
|
+
protected readonly _dataSource: IWriteDataSource<TDto>;
|
|
2049
|
+
protected readonly _mapper: IMapper<T, TDto>;
|
|
2054
2050
|
/**
|
|
2055
2051
|
* Constructs a new Repository instance.
|
|
2056
2052
|
* @param _dataSource An instance of IWriteDataSource used to execute SQL queries and commands for data access.
|
package/dist/index.js
CHANGED
|
@@ -4431,17 +4431,16 @@ var init_middleware_module = __esm({
|
|
|
4431
4431
|
logger
|
|
4432
4432
|
)
|
|
4433
4433
|
);
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
const { AllowOriginMiddleware: AllowOriginMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
|
|
4441
|
-
middlewares.push(
|
|
4442
|
-
new AllowOriginMiddleware2(new AllowOrigin2(opts.allowOrigins), requestContext, logger)
|
|
4434
|
+
const configuration = container.resolve(TOKENS5.CONFIGURATION_SERVICE);
|
|
4435
|
+
const defaultOrigin = configuration.get("APP_URL") ?? `http://localhost:${configuration.getNumber("PORT", 3e3)}`;
|
|
4436
|
+
const origins = !Guards51.isNullOrEmpty(opts.allowOrigins) ? opts.allowOrigins : [defaultOrigin];
|
|
4437
|
+
if (opts.withCredentials && origins.includes("*"))
|
|
4438
|
+
throw new Error(
|
|
4439
|
+
"Wildcard CORS origin is not allowed when withCredentials is set to true in addHttpCore"
|
|
4443
4440
|
);
|
|
4444
|
-
}
|
|
4441
|
+
const { AllowOrigin: AllowOrigin2 } = await Promise.resolve().then(() => (init_services(), services_exports));
|
|
4442
|
+
const { AllowOriginMiddleware: AllowOriginMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
|
|
4443
|
+
middlewares.push(new AllowOriginMiddleware2(new AllowOrigin2(origins), requestContext, logger));
|
|
4445
4444
|
const withCredentials = opts.withCredentials ? "true" : "false";
|
|
4446
4445
|
const allowMethod = await this._getAllowMethod(
|
|
4447
4446
|
opts.optionsMiddleware || opts.cors,
|
|
@@ -5041,16 +5040,10 @@ var AppBuilder = class {
|
|
|
5041
5040
|
_container = new ServiceContainer();
|
|
5042
5041
|
_configuration;
|
|
5043
5042
|
_isBuilded = false;
|
|
5044
|
-
constructor(container) {
|
|
5043
|
+
constructor(container, configurationService) {
|
|
5045
5044
|
this._container = container ?? new ServiceContainer();
|
|
5046
|
-
this.
|
|
5047
|
-
|
|
5048
|
-
() => new EnvironmentConfigurationService()
|
|
5049
|
-
);
|
|
5050
|
-
this._configuration = this._container.resolve(TOKENS4.CONFIGURATION_SERVICE);
|
|
5051
|
-
this._middlewareConfig.allowOrigins?.push(
|
|
5052
|
-
this._configuration.get("APP_URL") ?? `http://localhost:${this._configuration.getNumber("PORT", 3e3)}`
|
|
5053
|
-
);
|
|
5045
|
+
this._configuration = configurationService ?? new EnvironmentConfigurationService();
|
|
5046
|
+
this._container.addSingleton(TOKENS4.CONFIGURATION_SERVICE, () => this._configuration);
|
|
5054
5047
|
this.addContext();
|
|
5055
5048
|
}
|
|
5056
5049
|
// --- Module Configurations ---
|
|
@@ -5414,12 +5407,11 @@ var AppBuilder = class {
|
|
|
5414
5407
|
* @description Resolves a service from the dependency injection container.
|
|
5415
5408
|
* @param token The injection token used to identify the service.
|
|
5416
5409
|
* @returns The resolved service instance.
|
|
5417
|
-
|
|
5418
|
-
*
|
|
5410
|
+
*
|
|
5419
5411
|
* @author Xeno
|
|
5420
5412
|
* @version 1.0.0
|
|
5421
5413
|
* @since 2025-09-30
|
|
5422
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5414
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5423
5415
|
*/
|
|
5424
5416
|
resolve(token) {
|
|
5425
5417
|
return this._container.resolve(token);
|
|
@@ -5430,12 +5422,11 @@ var AppBuilder = class {
|
|
|
5430
5422
|
/**
|
|
5431
5423
|
* @description Finalizes the configuration and initializes all registered modules in the container.
|
|
5432
5424
|
* @returns The fully configured ServiceContainer.
|
|
5433
|
-
|
|
5434
|
-
*
|
|
5425
|
+
*
|
|
5435
5426
|
* @author Xeno
|
|
5436
5427
|
* @version 1.0.0
|
|
5437
5428
|
* @since 2025-09-30
|
|
5438
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5429
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5439
5430
|
*/
|
|
5440
5431
|
async build() {
|
|
5441
5432
|
if (this._isBuilded) return this._container;
|
|
@@ -5467,12 +5458,11 @@ var AppBuilder = class {
|
|
|
5467
5458
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
5468
5459
|
/**
|
|
5469
5460
|
* @description Queues the configuration of the CQRS pipeline module if it has not already been queued. This method ensures that the pipeline module is only added once, even if multiple pipeline-related configurations are made.
|
|
5470
|
-
|
|
5471
|
-
*
|
|
5461
|
+
*
|
|
5472
5462
|
* @author Xeno
|
|
5473
5463
|
* @version 1.0.0
|
|
5474
5464
|
* @since 2025-09-30
|
|
5475
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5465
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5476
5466
|
*/
|
|
5477
5467
|
_queuePipelineModule() {
|
|
5478
5468
|
if (this._isPipelineModuleQueued) return;
|
|
@@ -5492,12 +5482,11 @@ var AppBuilder = class {
|
|
|
5492
5482
|
}
|
|
5493
5483
|
/**
|
|
5494
5484
|
* @description Queues the configuration of the middleware module if it has not already been queued. This method ensures that the middleware module is only added once, even if multiple middleware-related configurations are made.
|
|
5495
|
-
|
|
5496
|
-
*
|
|
5485
|
+
*
|
|
5497
5486
|
* @author Xeno
|
|
5498
5487
|
* @version 1.0.0
|
|
5499
5488
|
* @since 2025-09-30
|
|
5500
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5489
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5501
5490
|
*/
|
|
5502
5491
|
_queueMiddlewareModule() {
|
|
5503
5492
|
if (this._isMiddlewareModuleQueued) return;
|