@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.cjs
CHANGED
|
@@ -4388,17 +4388,16 @@ var init_middleware_module = __esm({
|
|
|
4388
4388
|
logger
|
|
4389
4389
|
)
|
|
4390
4390
|
);
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
const { AllowOriginMiddleware: AllowOriginMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
|
|
4398
|
-
middlewares.push(
|
|
4399
|
-
new AllowOriginMiddleware2(new AllowOrigin2(opts.allowOrigins), requestContext, logger)
|
|
4391
|
+
const configuration = container.resolve(TOKENS5.CONFIGURATION_SERVICE);
|
|
4392
|
+
const defaultOrigin = configuration.get("APP_URL") ?? `http://localhost:${configuration.getNumber("PORT", 3e3)}`;
|
|
4393
|
+
const origins = !Guards51.isNullOrEmpty(opts.allowOrigins) ? opts.allowOrigins : [defaultOrigin];
|
|
4394
|
+
if (opts.withCredentials && origins.includes("*"))
|
|
4395
|
+
throw new Error(
|
|
4396
|
+
"Wildcard CORS origin is not allowed when withCredentials is set to true in addHttpCore"
|
|
4400
4397
|
);
|
|
4401
|
-
}
|
|
4398
|
+
const { AllowOrigin: AllowOrigin2 } = await Promise.resolve().then(() => (init_services(), services_exports));
|
|
4399
|
+
const { AllowOriginMiddleware: AllowOriginMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
|
|
4400
|
+
middlewares.push(new AllowOriginMiddleware2(new AllowOrigin2(origins), requestContext, logger));
|
|
4402
4401
|
const withCredentials = opts.withCredentials ? "true" : "false";
|
|
4403
4402
|
const allowMethod = await this._getAllowMethod(
|
|
4404
4403
|
opts.optionsMiddleware || opts.cors,
|
|
@@ -4999,16 +4998,10 @@ var AppBuilder = class {
|
|
|
4999
4998
|
_container = new ServiceContainer();
|
|
5000
4999
|
_configuration;
|
|
5001
5000
|
_isBuilded = false;
|
|
5002
|
-
constructor(container) {
|
|
5001
|
+
constructor(container, configurationService) {
|
|
5003
5002
|
this._container = container ?? new ServiceContainer();
|
|
5004
|
-
this.
|
|
5005
|
-
|
|
5006
|
-
() => new EnvironmentConfigurationService()
|
|
5007
|
-
);
|
|
5008
|
-
this._configuration = this._container.resolve(import_shared78.TOKENS.CONFIGURATION_SERVICE);
|
|
5009
|
-
this._middlewareConfig.allowOrigins?.push(
|
|
5010
|
-
this._configuration.get("APP_URL") ?? `http://localhost:${this._configuration.getNumber("PORT", 3e3)}`
|
|
5011
|
-
);
|
|
5003
|
+
this._configuration = configurationService ?? new EnvironmentConfigurationService();
|
|
5004
|
+
this._container.addSingleton(import_shared78.TOKENS.CONFIGURATION_SERVICE, () => this._configuration);
|
|
5012
5005
|
this.addContext();
|
|
5013
5006
|
}
|
|
5014
5007
|
// --- Module Configurations ---
|
|
@@ -5372,12 +5365,11 @@ var AppBuilder = class {
|
|
|
5372
5365
|
* @description Resolves a service from the dependency injection container.
|
|
5373
5366
|
* @param token The injection token used to identify the service.
|
|
5374
5367
|
* @returns The resolved service instance.
|
|
5375
|
-
|
|
5376
|
-
*
|
|
5368
|
+
*
|
|
5377
5369
|
* @author Xeno
|
|
5378
5370
|
* @version 1.0.0
|
|
5379
5371
|
* @since 2025-09-30
|
|
5380
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5372
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5381
5373
|
*/
|
|
5382
5374
|
resolve(token) {
|
|
5383
5375
|
return this._container.resolve(token);
|
|
@@ -5388,12 +5380,11 @@ var AppBuilder = class {
|
|
|
5388
5380
|
/**
|
|
5389
5381
|
* @description Finalizes the configuration and initializes all registered modules in the container.
|
|
5390
5382
|
* @returns The fully configured ServiceContainer.
|
|
5391
|
-
|
|
5392
|
-
*
|
|
5383
|
+
*
|
|
5393
5384
|
* @author Xeno
|
|
5394
5385
|
* @version 1.0.0
|
|
5395
5386
|
* @since 2025-09-30
|
|
5396
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5387
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5397
5388
|
*/
|
|
5398
5389
|
async build() {
|
|
5399
5390
|
if (this._isBuilded) return this._container;
|
|
@@ -5425,12 +5416,11 @@ var AppBuilder = class {
|
|
|
5425
5416
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
5426
5417
|
/**
|
|
5427
5418
|
* @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.
|
|
5428
|
-
|
|
5429
|
-
*
|
|
5419
|
+
*
|
|
5430
5420
|
* @author Xeno
|
|
5431
5421
|
* @version 1.0.0
|
|
5432
5422
|
* @since 2025-09-30
|
|
5433
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5423
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5434
5424
|
*/
|
|
5435
5425
|
_queuePipelineModule() {
|
|
5436
5426
|
if (this._isPipelineModuleQueued) return;
|
|
@@ -5450,12 +5440,11 @@ var AppBuilder = class {
|
|
|
5450
5440
|
}
|
|
5451
5441
|
/**
|
|
5452
5442
|
* @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.
|
|
5453
|
-
|
|
5454
|
-
*
|
|
5443
|
+
*
|
|
5455
5444
|
* @author Xeno
|
|
5456
5445
|
* @version 1.0.0
|
|
5457
5446
|
* @since 2025-09-30
|
|
5458
|
-
* @link https://github.com/xeno-js/xeno-js
|
|
5447
|
+
* @link https://github.com/xeno-js/xeno-js
|
|
5459
5448
|
*/
|
|
5460
5449
|
_queueMiddlewareModule() {
|
|
5461
5450
|
if (this._isMiddlewareModuleQueued) return;
|