@xeno-js/core 0.1.9 → 0.1.10

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 CHANGED
@@ -1509,47 +1509,31 @@ var init_logger_utils = __esm({
1509
1509
  */
1510
1510
  async addLogger(container, opts) {
1511
1511
  const loggerDependencies = [];
1512
- const { Guards: Guards47, LOG_LEVEL: LOG_LEVEL7, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1513
- if (!Guards47.isDefined(opts) || opts.console) {
1512
+ const { Guards: Guards46, LOG_LEVEL: LOG_LEVEL7, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1513
+ if (!Guards46.isDefined(opts) || opts.console) {
1514
1514
  const { ConsoleLogger: ConsoleLogger2 } = await Promise.resolve().then(() => (init_console_logger(), console_logger_exports));
1515
- container.addSingleton(TOKENS4.CONSOLE_LOGGER, () => new ConsoleLogger2(opts?.level));
1516
- loggerDependencies.push(TOKENS4.CONSOLE_LOGGER);
1515
+ loggerDependencies.push(new ConsoleLogger2(opts?.level));
1517
1516
  }
1518
- const customLoggerFactories = [];
1519
- if (Guards47.isDefined(opts)) {
1520
- if (Guards47.isDefined(opts.sentry.config)) {
1517
+ if (Guards46.isDefined(opts)) {
1518
+ if (Guards46.isDefined(opts.sentry.config)) {
1521
1519
  const { SentryLoggerFactory: SentryLoggerFactory2 } = await Promise.resolve().then(() => (init_sentry_logger_factory(), sentry_logger_factory_exports));
1522
- container.addSingleton(TOKENS4.SENTRY_LOGGER, () => {
1523
- const factory = new SentryLoggerFactory2();
1524
- return factory.create(opts);
1525
- });
1526
- loggerDependencies.push(TOKENS4.SENTRY_LOGGER);
1520
+ loggerDependencies.push(new SentryLoggerFactory2().create(opts));
1527
1521
  }
1528
- if (Guards47.isDefined(opts.pino.config)) {
1522
+ if (Guards46.isDefined(opts.pino.config)) {
1529
1523
  const { PinoLoggerFactory: PinoLoggerFactory2 } = await Promise.resolve().then(() => (init_pino_logger_factory(), pino_logger_factory_exports));
1530
- container.addSingleton(TOKENS4.PINO_LOGGER, () => {
1531
- const factory = new PinoLoggerFactory2();
1532
- return factory.create(opts);
1533
- });
1534
- loggerDependencies.push(TOKENS4.PINO_LOGGER);
1524
+ loggerDependencies.push(new PinoLoggerFactory2().create(opts));
1535
1525
  }
1536
- if (!Guards47.isNullOrEmpty(opts.customLoggers)) {
1526
+ if (!Guards46.isNullOrEmpty(opts.customLoggers)) {
1537
1527
  const customLoggers = opts.customLoggers;
1538
- customLoggers.forEach((f) => {
1539
- if (Guards47.isDefined(f)) {
1540
- customLoggerFactories.push(f);
1541
- }
1528
+ customLoggers.forEach((fn) => {
1529
+ if (Guards46.isDefined(fn)) loggerDependencies.push(fn(container));
1542
1530
  });
1543
1531
  }
1544
1532
  }
1545
1533
  const { BaseLogger } = await import("@xeno-js/shared");
1546
1534
  container.addSingleton(TOKENS4.LOGGER, (c) => {
1547
1535
  const context = c.resolve(TOKENS4.CONTEXT_ACCESSOR);
1548
- const resolvedDependencies = [
1549
- ...loggerDependencies.map((token) => c.resolve(token)),
1550
- ...customLoggerFactories.map((factory) => factory(c))
1551
- ];
1552
- return new BaseLogger(context, opts?.level ?? LOG_LEVEL7.DEBUG, resolvedDependencies);
1536
+ return new BaseLogger(context, opts?.level ?? LOG_LEVEL7.DEBUG, loggerDependencies);
1553
1537
  });
1554
1538
  }
1555
1539
  });
@@ -1709,8 +1693,8 @@ var init_cache_utils = __esm({
1709
1693
  * @link https://github.com/xeno-js/xeno-js
1710
1694
  */
1711
1695
  async addCache(container, opts) {
1712
- const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1713
- if (!opts.inMemory && !Guards47.isDefined(opts.redis)) {
1696
+ const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1697
+ if (!opts.inMemory && !Guards46.isDefined(opts.redis)) {
1714
1698
  throw new Error(
1715
1699
  "No cache strategies are configured. Please provide at least one cache strategy."
1716
1700
  );
@@ -1720,12 +1704,12 @@ var init_cache_utils = __esm({
1720
1704
  TOKENS4.CACHE_KEY_BUILDER,
1721
1705
  (c) => new CacheKeyBuilder(c.resolve(TOKENS4.IDENTITY_ACCESSOR))
1722
1706
  );
1723
- if (opts.inMemory || !Guards47.isDefined(opts.redis)) {
1707
+ if (opts.inMemory || !Guards46.isDefined(opts.redis)) {
1724
1708
  const { InMemoryCacheExtended: InMemoryCacheExtended2 } = await Promise.resolve().then(() => (init_inmemory_cache(), inmemory_cache_exports));
1725
1709
  container.addSingleton(TOKENS4.CACHE, () => new InMemoryCacheExtended2());
1726
1710
  return;
1727
1711
  }
1728
- if (Guards47.isDefined(opts.redis)) {
1712
+ if (Guards46.isDefined(opts.redis)) {
1729
1713
  const { RedisCacheFactory: RedisCacheFactory2 } = await Promise.resolve().then(() => (init_redis_cache_factory(), redis_cache_factory_exports));
1730
1714
  container.addSingleton(TOKENS4.CACHE, () => {
1731
1715
  const config = opts.redis;
@@ -2634,7 +2618,9 @@ var init_supabase_factory = __esm({
2634
2618
  container
2635
2619
  }) {
2636
2620
  if (!import_shared55.Guards.isDefined(config.ssrOpts)) {
2637
- throw new Error("ISsrCookieHandler is required for @supabase/ssr initialization.");
2621
+ throw new Error(
2622
+ "ISsrCookieHandler is required for @supabase/ssr initialization., Please provide it in the config object."
2623
+ );
2638
2624
  }
2639
2625
  const cookieService = config.ssrOpts(container);
2640
2626
  const client = (0, import_ssr.createServerClient)(config.url, config.key, {
@@ -2697,10 +2683,6 @@ var init_user_context_factory = __esm({
2697
2683
  });
2698
2684
 
2699
2685
  // src/infrastructure/factories/zod-validator.factory.ts
2700
- var zod_validator_factory_exports = {};
2701
- __export(zod_validator_factory_exports, {
2702
- ZodValidatorFactory: () => ZodValidatorFactory
2703
- });
2704
2686
  var import_shared57, ZodValidatorFactory;
2705
2687
  var init_zod_validator_factory = __esm({
2706
2688
  "src/infrastructure/factories/zod-validator.factory.ts"() {
@@ -2777,97 +2759,57 @@ var init_auth_utils = __esm({
2777
2759
  */
2778
2760
  async addAuthZ(container, opts) {
2779
2761
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
2780
- const pipelines = [];
2781
2762
  const strategies = [];
2782
- const { Guards: Guards47 } = await import("@xeno-js/shared");
2783
- if (Guards47.isDefined(opts.policies)) {
2763
+ const { Guards: Guards46 } = await import("@xeno-js/shared");
2764
+ if (Guards46.isDefined(opts.policies)) {
2784
2765
  const { PolicyRegistry: PolicyRegistry2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2785
- container.addSingleton(TOKENS4.POLICY_REGISTRY, () => new PolicyRegistry2());
2786
2766
  const policyRegistry = opts.policies;
2787
- const registryInstance = container.resolve(TOKENS4.POLICY_REGISTRY);
2767
+ const registryInstance = new PolicyRegistry2();
2768
+ const ctxAccessor = container.resolve(TOKENS4.CONTEXT_ACCESSOR);
2788
2769
  const Policies = /* @__PURE__ */ new Set();
2789
2770
  for (const [intent, policy] of Object.entries(policyRegistry)) {
2790
2771
  const intentLower = intent.toLowerCase();
2791
2772
  registryInstance.addPolicy(intentLower, policy);
2792
- if (!Guards47.isNullOrEmpty(policy.roles)) {
2773
+ if (!Guards46.isNullOrEmpty(policy.roles)) {
2793
2774
  Policies.add("roles");
2794
2775
  }
2795
- if (!Guards47.isNullOrEmpty(policy.permissions)) {
2776
+ if (!Guards46.isNullOrEmpty(policy.permissions)) {
2796
2777
  Policies.add("permissions");
2797
2778
  }
2798
- if (!Guards47.isNullOrEmpty(policy.userId)) {
2779
+ if (!Guards46.isNullOrEmpty(policy.userId)) {
2799
2780
  Policies.add("userId");
2800
2781
  }
2801
- if (!Guards47.isNullOrEmpty(policy.tenantId)) {
2782
+ if (!Guards46.isNullOrEmpty(policy.tenantId)) {
2802
2783
  Policies.add("tenantId");
2803
2784
  }
2804
2785
  }
2805
2786
  if (Policies.has("roles")) {
2806
2787
  const { RoleAuthorizationStrategy: RoleAuthorizationStrategy2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2807
- container.addSingleton(
2808
- TOKENS4.ROLE_AUTHORIZATION_PIPELINE,
2809
- (c) => new RoleAuthorizationStrategy2(
2810
- c.resolve(TOKENS4.POLICY_REGISTRY),
2811
- c.resolve(TOKENS4.CONTEXT_ACCESSOR)
2812
- )
2813
- );
2814
- strategies.push(TOKENS4.ROLE_AUTHORIZATION_PIPELINE);
2788
+ strategies.push(new RoleAuthorizationStrategy2(registryInstance, ctxAccessor));
2815
2789
  }
2816
2790
  if (Policies.has("permissions")) {
2817
2791
  const { PermissionAuthorizationStrategy: PermissionAuthorizationStrategy2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2818
- container.addSingleton(
2819
- TOKENS4.PERMISSION_AUTHORIZATION_PIPELINE,
2820
- (c) => new PermissionAuthorizationStrategy2(
2821
- c.resolve(TOKENS4.POLICY_REGISTRY),
2822
- c.resolve(TOKENS4.CONTEXT_ACCESSOR)
2823
- )
2824
- );
2825
- strategies.push(TOKENS4.PERMISSION_AUTHORIZATION_PIPELINE);
2792
+ strategies.push(new PermissionAuthorizationStrategy2(registryInstance, ctxAccessor));
2826
2793
  }
2827
2794
  if (Policies.has("userId")) {
2828
2795
  const { UserAuthorizationStrategy: UserAuthorizationStrategy2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2829
- container.addSingleton(
2830
- TOKENS4.USER_AUTHORIZATION_PIPELINE,
2831
- (c) => new UserAuthorizationStrategy2(
2832
- c.resolve(TOKENS4.POLICY_REGISTRY),
2833
- c.resolve(TOKENS4.CONTEXT_ACCESSOR)
2834
- )
2835
- );
2836
- strategies.push(TOKENS4.USER_AUTHORIZATION_PIPELINE);
2796
+ strategies.push(new UserAuthorizationStrategy2(registryInstance, ctxAccessor));
2837
2797
  }
2838
2798
  if (Policies.has("tenantId")) {
2839
2799
  const { TenantAuthorizationStrategy: TenantAuthorizationStrategy2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2840
- container.addSingleton(
2841
- TOKENS4.TENANT_AUTHORIZATION_PIPELINE,
2842
- (c) => new TenantAuthorizationStrategy2(
2843
- c.resolve(TOKENS4.POLICY_REGISTRY),
2844
- c.resolve(TOKENS4.CONTEXT_ACCESSOR)
2845
- )
2846
- );
2847
- strategies.push(TOKENS4.TENANT_AUTHORIZATION_PIPELINE);
2800
+ strategies.push(new TenantAuthorizationStrategy2(registryInstance, ctxAccessor));
2848
2801
  }
2849
2802
  }
2850
- if (!Guards47.isNullOrEmpty(opts.customAuthorizationStrategy)) {
2803
+ if (!Guards46.isNullOrEmpty(opts.customAuthorizationStrategy)) {
2851
2804
  const customStrategies = opts.customAuthorizationStrategy;
2852
- customStrategies.forEach((strategyToken, index) => {
2853
- if (Guards47.isDefined(strategyToken)) {
2854
- const token = `CUSTOM_AUTHORIZATION_STRATEGY_${index}`;
2855
- container.addSingleton(token, (c) => {
2856
- return strategyToken(c);
2857
- });
2858
- strategies.push(token);
2805
+ customStrategies.forEach((strategyToken) => {
2806
+ if (Guards46.isDefined(strategyToken)) {
2807
+ strategies.push(strategyToken(container));
2859
2808
  }
2860
2809
  });
2861
2810
  }
2862
2811
  const { AuthorizationPipeline: AuthorizationPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2863
- container.addSingleton(TOKENS4.AUTHORIZATION_PIPELINE, (c) => {
2864
- const resolvedStrategies = strategies.map(
2865
- (strategy) => c.resolve(strategy)
2866
- );
2867
- return new AuthorizationPipeline2(resolvedStrategies);
2868
- });
2869
- pipelines.push(TOKENS4.AUTHORIZATION_PIPELINE);
2870
- return pipelines;
2812
+ return new AuthorizationPipeline2(strategies);
2871
2813
  },
2872
2814
  /**
2873
2815
  * @description Configures the authentication service and gatekeeper in the service container.
@@ -2884,22 +2826,13 @@ var init_auth_utils = __esm({
2884
2826
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
2885
2827
  const _t = opts;
2886
2828
  const { SupabaseServerAuthFactory: SupabaseServerAuthFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
2829
+ const factory = new SupabaseServerAuthFactory2();
2830
+ const supabase = factory.create({ config: opts, container });
2887
2831
  container.addScoped(TOKENS4.AUTH_SERVICE, () => {
2888
- const factory = new SupabaseServerAuthFactory2();
2889
- return factory.create({ config: opts, container });
2832
+ return supabase;
2890
2833
  });
2891
2834
  container.addSingleton(TOKENS4.BASE_AUTH_SERVICE, () => {
2892
- const factory = new SupabaseServerAuthFactory2();
2893
- return factory.create({ config: opts, container });
2894
- });
2895
- const { ClaimsIdentityMapper: ClaimsIdentityMapper2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2896
- container.addSingleton(TOKENS4.CLAIMS_IDENTITY_MAPPER, () => new ClaimsIdentityMapper2());
2897
- const { GateKeeper: GateKeeper2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2898
- container.addSingleton(TOKENS4.GATE_KEEPER, (c) => {
2899
- return new GateKeeper2(
2900
- c.resolve(TOKENS4.BASE_AUTH_SERVICE),
2901
- c.resolve(TOKENS4.CLAIMS_IDENTITY_MAPPER)
2902
- );
2835
+ return supabase;
2903
2836
  });
2904
2837
  }
2905
2838
  });
@@ -3053,24 +2986,20 @@ var init_db_module = __esm({
3053
2986
  "use strict";
3054
2987
  DbModule = class {
3055
2988
  async configure(container, opts) {
3056
- const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
2989
+ const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3057
2990
  const { DbUtils: DbUtils2 } = await Promise.resolve().then(() => (init_db_utils(), db_utils_exports));
3058
2991
  const db = opts.enableSqlLite ? await DbUtils2.addSqlLite(opts) : await DbUtils2.addDbClient(opts);
3059
2992
  const { TransactionState: TransactionState2 } = await Promise.resolve().then(() => (init_transaction_state(), transaction_state_exports));
3060
- container.addScoped(TOKENS4.TRANSACTION_STATE, () => {
3061
- return new TransactionState2();
3062
- });
2993
+ const ttx = new TransactionState2();
3063
2994
  const { UnitOfWork: UnitOfWork2 } = await Promise.resolve().then(() => (init_unit_of_work(), unit_of_work_exports));
3064
- container.addScoped(TOKENS4.UNIT_OF_WORK, (c) => {
3065
- const ttx = c.resolve(TOKENS4.TRANSACTION_STATE);
2995
+ container.addScoped(TOKENS4.UNIT_OF_WORK, () => {
3066
2996
  return new UnitOfWork2(db, ttx);
3067
2997
  });
3068
- container.addScoped(TOKENS4.DB_CONTEXT, (c) => {
3069
- const ttx = c.resolve(TOKENS4.TRANSACTION_STATE);
2998
+ container.addScoped(TOKENS4.DB_CONTEXT, () => {
3070
2999
  return new Proxy(db, {
3071
3000
  get(_target, prop, receiver) {
3072
3001
  const activeState = ttx.state;
3073
- if (Guards47.isDefined(activeState)) {
3002
+ if (Guards46.isDefined(activeState)) {
3074
3003
  if (prop === "transaction") {
3075
3004
  return activeState.transaction.bind(activeState);
3076
3005
  }
@@ -3107,14 +3036,14 @@ var init_http_utils = __esm({
3107
3036
  */
3108
3037
  async addAxios(container, opts) {
3109
3038
  const { NodeAxiosFactory: NodeAxiosFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
3110
- const { Guards: Guards47 } = await import("@xeno-js/shared");
3111
- if (!Guards47.isDefined(opts.token)) {
3039
+ const { Guards: Guards46 } = await import("@xeno-js/shared");
3040
+ if (!Guards46.isDefined(opts.token)) {
3112
3041
  throw new Error("HttpConfig.token is required and must be defined.");
3113
3042
  }
3114
3043
  container.addSingleton(opts.token, () => {
3115
3044
  const factory = new NodeAxiosFactory2();
3116
3045
  const instance = factory.create(opts.client);
3117
- if (!Guards47.hasMethod(instance, "get") || !Guards47.hasMethod(instance, "post") || !Guards47.hasMethod(instance, "put") || !Guards47.hasMethod(instance, "patch") || !Guards47.hasMethod(instance, "delete")) {
3046
+ if (!Guards46.hasMethod(instance, "get") || !Guards46.hasMethod(instance, "post") || !Guards46.hasMethod(instance, "put") || !Guards46.hasMethod(instance, "patch") || !Guards46.hasMethod(instance, "delete")) {
3118
3047
  throw new Error(
3119
3048
  "The created HTTP client instance does not implement the required methods of IHttpClient."
3120
3049
  );
@@ -3139,17 +3068,6 @@ var init_http_utils = __esm({
3139
3068
  const factory = new CockatielResilienceFactory2();
3140
3069
  return factory.create(opts);
3141
3070
  });
3142
- },
3143
- async addAllowOrigin(container, opts) {
3144
- const { Guards: Guards47 } = await import("@xeno-js/shared");
3145
- if (Guards47.isNullOrEmpty(opts)) throw new Error("At least an allow origin must be passed");
3146
- const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3147
- const { AllowOrigin: AllowOrigin2 } = await Promise.resolve().then(() => (init_services(), services_exports));
3148
- const allowOrigin = [];
3149
- opts.forEach((x) => {
3150
- allowOrigin.push(x.trim().toLowerCase());
3151
- });
3152
- container.addSingleton(TOKENS4.ALLOW_ORIGIN, () => new AllowOrigin2(allowOrigin));
3153
3071
  }
3154
3072
  });
3155
3073
  }
@@ -3158,10 +3076,9 @@ var init_http_utils = __esm({
3158
3076
  // src/infrastructure/modules/http-core.module.ts
3159
3077
  var http_core_module_exports = {};
3160
3078
  __export(http_core_module_exports, {
3161
- HttpCoreModule: () => HttpCoreModule,
3162
- HttpOriginModule: () => HttpOriginModule
3079
+ HttpCoreModule: () => HttpCoreModule
3163
3080
  });
3164
- var HttpCoreModule, HttpOriginModule;
3081
+ var HttpCoreModule;
3165
3082
  var init_http_core_module = __esm({
3166
3083
  "src/infrastructure/modules/http-core.module.ts"() {
3167
3084
  "use strict";
@@ -3172,12 +3089,6 @@ var init_http_core_module = __esm({
3172
3089
  await HttpUtils2.addResilience(container, opts.resilience);
3173
3090
  }
3174
3091
  };
3175
- HttpOriginModule = class {
3176
- async configure(container, opts) {
3177
- const { HttpUtils: HttpUtils2 } = await Promise.resolve().then(() => (init_http_utils(), http_utils_exports));
3178
- await HttpUtils2.addAllowOrigin(container, opts);
3179
- }
3180
- };
3181
3092
  }
3182
3093
  });
3183
3094
 
@@ -3202,53 +3113,32 @@ var init_validation_utils = __esm({
3202
3113
  * @link https://github.com/xeno-js/xeno-js
3203
3114
  */
3204
3115
  async addValidation(container, opts, logger) {
3205
- const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3206
- if (!Guards47.isDefined(opts.zod) && Guards47.isNullOrEmpty(opts.customValidationStrategy)) {
3207
- return [];
3116
+ const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3117
+ if (!Guards46.isDefined(opts.zod) && Guards46.isNullOrEmpty(opts.customValidationStrategy)) {
3118
+ return;
3208
3119
  }
3209
- const pipelines = [];
3210
3120
  const validationStrategies = [];
3211
- if (Guards47.isDefined(opts.zod)) {
3121
+ if (Guards46.isDefined(opts.zod)) {
3212
3122
  const config = opts.zod;
3213
- const { ZodValidatorFactory: ZodValidatorFactory2 } = await Promise.resolve().then(() => (init_zod_validator_factory(), zod_validator_factory_exports));
3214
- container.addSingleton(TOKENS4.ZOD_VALIDATOR, () => {
3215
- return new ZodValidatorFactory2().create({ ...config, logger });
3216
- });
3123
+ const { ZodValidatorFactory: ZodValidatorFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
3217
3124
  const { SchemaValidationStrategy: SchemaValidationStrategy2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3218
- container.addSingleton(
3219
- TOKENS4.SCHEMA_VALIDATION_STRATEGY,
3220
- (c) => new SchemaValidationStrategy2(c.resolve(TOKENS4.ZOD_VALIDATOR))
3221
- );
3222
- validationStrategies.push(TOKENS4.SCHEMA_VALIDATION_STRATEGY);
3125
+ const validatorService = new ZodValidatorFactory2().create({ ...config, logger });
3126
+ container.addSingleton(TOKENS4.VALIDATOR_SERVICE, () => validatorService);
3127
+ validationStrategies.push(new SchemaValidationStrategy2(validatorService));
3223
3128
  }
3224
- const customValidationFactory = [];
3225
- if (!Guards47.isNullOrEmpty(opts.customValidationStrategy)) {
3129
+ if (!Guards46.isNullOrEmpty(opts.customValidationStrategy)) {
3226
3130
  for (const strategyToken of opts.customValidationStrategy) {
3227
- if (Guards47.isDefined(strategyToken)) {
3228
- customValidationFactory.push(strategyToken);
3229
- }
3131
+ if (Guards46.isDefined(strategyToken)) validationStrategies.push(strategyToken(container));
3230
3132
  }
3231
3133
  }
3232
3134
  const { ValidationPipeline: ValidationPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3233
- container.addSingleton(TOKENS4.VALIDATION_PIPELINE, (c) => {
3234
- const resolvedStrategies = [
3235
- ...validationStrategies.map((token) => c.resolve(token)),
3236
- ...customValidationFactory.map((factory) => factory(c))
3237
- ];
3238
- return new ValidationPipeline2(resolvedStrategies);
3239
- });
3240
- pipelines.push(TOKENS4.VALIDATION_PIPELINE);
3241
- return pipelines;
3135
+ return new ValidationPipeline2(validationStrategies);
3242
3136
  }
3243
3137
  });
3244
3138
  }
3245
3139
  });
3246
3140
 
3247
3141
  // src/infrastructure/idempotency/idempotency-store.ts
3248
- var idempotency_store_exports = {};
3249
- __export(idempotency_store_exports, {
3250
- IdempotencyStore: () => IdempotencyStore
3251
- });
3252
3142
  var import_shared60, IdempotencyStore;
3253
3143
  var init_idempotency_store = __esm({
3254
3144
  "src/infrastructure/idempotency/idempotency-store.ts"() {
@@ -3305,6 +3195,18 @@ var init_idempotency_store = __esm({
3305
3195
  }
3306
3196
  });
3307
3197
 
3198
+ // src/infrastructure/idempotency/index.ts
3199
+ var idempotency_exports = {};
3200
+ __export(idempotency_exports, {
3201
+ IdempotencyStore: () => IdempotencyStore
3202
+ });
3203
+ var init_idempotency = __esm({
3204
+ "src/infrastructure/idempotency/index.ts"() {
3205
+ "use strict";
3206
+ init_idempotency_store();
3207
+ }
3208
+ });
3209
+
3308
3210
  // src/infrastructure/modules/utils/pipeline.utils.ts
3309
3211
  var pipeline_utils_exports = {};
3310
3212
  __export(pipeline_utils_exports, {
@@ -3326,35 +3228,30 @@ var init_pipeline_utils = __esm({
3326
3228
  * @link https://github.com/xeno-js/xeno-js
3327
3229
  */
3328
3230
  async addCommand(container, opts) {
3231
+ const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3329
3232
  const pipelines = [];
3330
- const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3331
- if (Guards47.isDefined(opts.idempotency)) {
3332
- const { IdempotencyStore: IdempotencyStore2 } = await Promise.resolve().then(() => (init_idempotency_store(), idempotency_store_exports));
3333
- container.addSingleton(
3334
- TOKENS4.IDEMPOTENCY_STORE,
3335
- (c) => new IdempotencyStore2(c.resolve(TOKENS4.CACHE), c.resolve(TOKENS4.CACHE_KEY_BUILDER))
3233
+ if (Guards46.isDefined(opts.idempotency)) {
3234
+ const { IdempotencyStore: IdempotencyStore2 } = await Promise.resolve().then(() => (init_idempotency(), idempotency_exports));
3235
+ const imdStore = new IdempotencyStore2(
3236
+ container.resolve(TOKENS4.CACHE),
3237
+ container.resolve(TOKENS4.CACHE_KEY_BUILDER)
3336
3238
  );
3337
3239
  const { IdempotencyPipeline: IdempotencyPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3338
- container.addSingleton(TOKENS4.IDEMPOTENCY_PIPELINE, (c) => {
3339
- const requestContext = c.resolve(TOKENS4.NETWORK_CONTEXT_ACCESSOR);
3340
- const idempotencyStore = c.resolve(TOKENS4.IDEMPOTENCY_STORE);
3341
- const config = opts.idempotency;
3342
- return new IdempotencyPipeline2(
3240
+ const requestContext = container.resolve(TOKENS4.NETWORK_CONTEXT_ACCESSOR);
3241
+ const config = opts.idempotency;
3242
+ pipelines.push(
3243
+ new IdempotencyPipeline2(
3343
3244
  requestContext,
3344
- idempotencyStore,
3245
+ imdStore,
3345
3246
  config?.lockTtlSeconds,
3346
3247
  config?.processedTtlSeconds
3347
- );
3348
- });
3349
- pipelines.push(TOKENS4.IDEMPOTENCY_PIPELINE);
3248
+ )
3249
+ );
3350
3250
  }
3351
- if (Guards47.isDefined(opts.concurrency)) {
3251
+ if (Guards46.isDefined(opts.concurrency)) {
3352
3252
  const { ConcurrencyRetryPipeline: ConcurrencyRetryPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3353
- container.addSingleton(TOKENS4.CONCURRENCY_RETRY_PIPELINE, () => {
3354
- const config = opts.concurrency;
3355
- return new ConcurrencyRetryPipeline2(config?.maxRetries, config?.delayConfig);
3356
- });
3357
- pipelines.push(TOKENS4.CONCURRENCY_RETRY_PIPELINE);
3253
+ const config = opts.concurrency;
3254
+ pipelines.push(new ConcurrencyRetryPipeline2(config?.maxRetries, config?.delayConfig));
3358
3255
  }
3359
3256
  return pipelines;
3360
3257
  },
@@ -3368,24 +3265,14 @@ var init_pipeline_utils = __esm({
3368
3265
  * @since 2025-09-30
3369
3266
  * @link https://github.com/xeno-js/xeno-js
3370
3267
  */
3371
- async addQuery(container, opts) {
3268
+ async addQuery(container) {
3372
3269
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3373
- const pipelines = [];
3374
- if (!opts.isCache) {
3375
- const { CacheUtils: CacheUtils2 } = await Promise.resolve().then(() => (init_cache_utils(), cache_utils_exports));
3376
- await CacheUtils2.addCache(container, { inMemory: true, redis: void 0 });
3377
- }
3378
3270
  const { QueryCachingPipeline: QueryCachingPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3379
- container.addSingleton(
3380
- TOKENS4.QUERY_CACHING_PIPELINE,
3381
- (c) => new QueryCachingPipeline2(
3382
- c.resolve(TOKENS4.CACHE),
3383
- c.resolve(TOKENS4.CACHE_KEY_BUILDER),
3384
- c.resolve(TOKENS4.LOGGER)
3385
- )
3271
+ return new QueryCachingPipeline2(
3272
+ container.resolve(TOKENS4.CACHE),
3273
+ container.resolve(TOKENS4.CACHE_KEY_BUILDER),
3274
+ container.resolve(TOKENS4.LOGGER)
3386
3275
  );
3387
- pipelines.push(TOKENS4.QUERY_CACHING_PIPELINE);
3388
- return pipelines;
3389
3276
  }
3390
3277
  });
3391
3278
  }
@@ -3403,79 +3290,54 @@ var init_cqrs_module = __esm({
3403
3290
  CqrsModule = class {
3404
3291
  async configure(container, opts) {
3405
3292
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3406
- let isCache = opts.isCache;
3293
+ const logger = container.resolve(TOKENS4.LOGGER);
3407
3294
  const { Mediator: Mediator2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3408
3295
  container.addSingleton(TOKENS4.MEDIATOR, (c) => {
3409
3296
  const serviceScopeAccessor = c.resolve(TOKENS4.SERVICE_SCOPE_ACCESSOR);
3410
3297
  return new Mediator2(serviceScopeAccessor);
3411
3298
  });
3412
3299
  const { ExceptionPipeline: ExceptionPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3413
- container.addSingleton(TOKENS4.EXCEPTION_PIPELINE, () => new ExceptionPipeline2());
3414
- if (!opts.isLogger) {
3415
- const { LoggerUtils: LoggerUtils2 } = await Promise.resolve().then(() => (init_logger_utils(), logger_utils_exports));
3416
- await LoggerUtils2.addLogger(container, void 0);
3417
- }
3418
3300
  const { LoggingPipeline: LoggingPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3419
- container.addSingleton(
3420
- TOKENS4.LOGGING_PIPELINE,
3421
- (c) => new LoggingPipeline2(c.resolve(TOKENS4.LOGGER))
3422
- );
3423
- const pipelines = [TOKENS4.EXCEPTION_PIPELINE, TOKENS4.LOGGING_PIPELINE];
3424
3301
  const { PerformancePipeline: PerformancePipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3425
- container.addSingleton(TOKENS4.PERFORMANCE_PIPELINE, (c) => {
3426
- const logger = c.resolve(TOKENS4.LOGGER);
3427
- const thresholdMs = opts.performance?.thresholdMs;
3428
- return new PerformancePipeline2(logger, thresholdMs);
3429
- });
3430
- pipelines.push(TOKENS4.PERFORMANCE_PIPELINE);
3431
- const { Guards: Guards47 } = await import("@xeno-js/shared");
3432
- if (Guards47.isDefined(opts.authorization.policies) || Guards47.isDefined(opts.authorization.customAuthorizationStrategy)) {
3302
+ const thresholdMs = opts.performance?.thresholdMs;
3303
+ const pipelines = [
3304
+ new ExceptionPipeline2(),
3305
+ new LoggingPipeline2(logger),
3306
+ new PerformancePipeline2(logger, thresholdMs)
3307
+ ];
3308
+ const { Guards: Guards46 } = await import("@xeno-js/shared");
3309
+ if (Guards46.isDefined(opts.authorization.policies) || Guards46.isDefined(opts.authorization.customAuthorizationStrategy)) {
3433
3310
  const { AuthUtils: AuthUtils2 } = await Promise.resolve().then(() => (init_auth_utils(), auth_utils_exports));
3434
3311
  const authPipelines = await AuthUtils2.addAuthZ(container, opts.authorization);
3435
- pipelines.push(...authPipelines);
3312
+ pipelines.push(authPipelines);
3436
3313
  }
3437
- if (Guards47.isDefined(opts.validation.zod) || Guards47.isDefined(opts.validation.customValidationStrategy)) {
3314
+ if (Guards46.isDefined(opts.validation.zod) || Guards46.isDefined(opts.validation.customValidationStrategy)) {
3438
3315
  const { ValidationUtils: ValidationUtils2 } = await Promise.resolve().then(() => (init_validation_utils(), validation_utils_exports));
3439
- const logger = container.resolve(TOKENS4.LOGGER);
3440
3316
  const validationPipelines = await ValidationUtils2.addValidation(
3441
3317
  container,
3442
3318
  opts.validation,
3443
3319
  logger
3444
3320
  );
3445
- pipelines.push(...validationPipelines);
3321
+ if (Guards46.isDefined(validationPipelines)) pipelines.push(validationPipelines);
3446
3322
  }
3447
3323
  const commandPipelines = pipelines;
3448
3324
  const queryPipelines = pipelines;
3449
- if ((Guards47.isDefined(opts.commandBus.idempotency) || opts.queryBus.isEnabled) && opts.isCache) {
3450
- const { CacheUtils: CacheUtils2 } = await Promise.resolve().then(() => (init_cache_utils(), cache_utils_exports));
3451
- await CacheUtils2.addCache(container, { inMemory: true, redis: void 0 });
3452
- }
3453
- if (Guards47.isDefined(opts.commandBus.idempotency) || Guards47.isDefined(opts.commandBus.concurrency)) {
3325
+ if (Guards46.isDefined(opts.commandBus.idempotency) || Guards46.isDefined(opts.commandBus.concurrency)) {
3454
3326
  const { PipelineUtils: PipelineUtils2 } = await Promise.resolve().then(() => (init_pipeline_utils(), pipeline_utils_exports));
3455
- const newCommandPipelines = await PipelineUtils2.addCommand(container, {
3456
- ...opts.commandBus,
3457
- isCache
3458
- });
3459
- isCache = true;
3327
+ const newCommandPipelines = await PipelineUtils2.addCommand(container, opts.commandBus);
3460
3328
  commandPipelines.push(...newCommandPipelines);
3461
3329
  }
3462
3330
  if (opts.queryBus.isEnabled) {
3463
3331
  const { PipelineUtils: PipelineUtils2 } = await Promise.resolve().then(() => (init_pipeline_utils(), pipeline_utils_exports));
3464
- const newQueryPipelines = await PipelineUtils2.addQuery(container, { isCache });
3465
- queryPipelines.push(...newQueryPipelines);
3332
+ const newQueryPipelines = await PipelineUtils2.addQuery(container);
3333
+ queryPipelines.push(newQueryPipelines);
3466
3334
  }
3467
3335
  const { CompositePipeline: CompositePipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3468
- container.addSingleton(TOKENS4.COMMAND_PIPELINES_BEHAVIOR, (c) => {
3469
- const resolvedCommandPipelines = commandPipelines.map((token) => {
3470
- return c.resolve(token);
3471
- });
3472
- return new CompositePipeline2(resolvedCommandPipelines);
3336
+ container.addSingleton(TOKENS4.COMMAND_PIPELINES_BEHAVIOR, () => {
3337
+ return new CompositePipeline2(commandPipelines);
3473
3338
  });
3474
- container.addSingleton(TOKENS4.QUERY_PIPELINES_BEHAVIOR, (c) => {
3475
- const resolvedQueryPipelines = queryPipelines.map(
3476
- (token) => c.resolve(token)
3477
- );
3478
- return new CompositePipeline2(resolvedQueryPipelines);
3339
+ container.addSingleton(TOKENS4.QUERY_PIPELINES_BEHAVIOR, () => {
3340
+ return new CompositePipeline2(queryPipelines);
3479
3341
  });
3480
3342
  }
3481
3343
  };
@@ -4259,150 +4121,111 @@ var middleware_module_exports = {};
4259
4121
  __export(middleware_module_exports, {
4260
4122
  MiddlewareModule: () => MiddlewareModule
4261
4123
  });
4262
- var import_shared73, MiddlewareModule;
4124
+ var MiddlewareModule;
4263
4125
  var init_middleware_module = __esm({
4264
4126
  "src/infrastructure/modules/middleware.module.ts"() {
4265
4127
  "use strict";
4266
- import_shared73 = require("@xeno-js/shared");
4267
4128
  MiddlewareModule = class {
4268
4129
  async configure(container, opts) {
4269
- const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
4270
- if (!opts.isAuth) {
4271
- const { NoAuthGateKeeper: NoAuthGateKeeper2 } = await Promise.resolve().then(() => (init_application(), application_exports));
4272
- container.addSingleton(TOKENS4.GATE_KEEPER, () => new NoAuthGateKeeper2());
4273
- }
4274
- if (opts.isSSR) {
4275
- const { SupabaseSsrTokenExtractor: SupabaseSsrTokenExtractor2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4276
- container.addSingleton(TOKENS4.BEARER_TOKEN_EXTRACTOR, () => new SupabaseSsrTokenExtractor2());
4277
- } else {
4278
- const { BearerTokenExtractor: BearerTokenExtractor2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4279
- container.addSingleton(TOKENS4.BEARER_TOKEN_EXTRACTOR, () => new BearerTokenExtractor2());
4280
- }
4130
+ const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
4281
4131
  const { HttpCookieExtractor: HttpCookieExtractor2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4282
- container.addSingleton("COOKIE_EXTRACTOR", () => new HttpCookieExtractor2());
4283
4132
  const { HttpHeaderExtractor: HttpHeaderExtractor2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4133
+ const tokenExtractor = await this._getTokenExtractor(opts.isSSR);
4284
4134
  container.addSingleton(
4285
4135
  TOKENS4.SERVICE_EXTRACTOR,
4286
- (c) => new HttpHeaderExtractor2(
4287
- c.resolve(TOKENS4.BEARER_TOKEN_EXTRACTOR),
4288
- c.resolve("COOKIE_EXTRACTOR"),
4136
+ () => new HttpHeaderExtractor2(
4137
+ tokenExtractor,
4138
+ new HttpCookieExtractor2(),
4289
4139
  opts.trustedIpHeader,
4290
4140
  opts.csrf?.cookieName ?? "__Host-xeno-csrf"
4291
4141
  )
4292
4142
  );
4293
- if (!opts.isLogger) {
4294
- const { LoggerUtils: LoggerUtils2 } = await Promise.resolve().then(() => (init_logger_utils(), logger_utils_exports));
4295
- await LoggerUtils2.addLogger(container, void 0);
4296
- }
4297
4143
  const { ClientIpResolver: ClientIpResolver2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4298
- container.addSingleton("IP_RESOLVER", () => new ClientIpResolver2(opts.trustedProxies));
4299
- const middlewares = [TOKENS4.REQUEST_CONTEXT_MIDDLEWARE];
4144
+ const middlewares = [];
4145
+ const requestContext = container.resolve(TOKENS4.REQUEST_CONTEXT);
4146
+ const logger = container.resolve(TOKENS4.LOGGER);
4300
4147
  const { RequestContextMiddleware: RequestContextMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4301
- container.addSingleton(
4302
- TOKENS4.REQUEST_CONTEXT_MIDDLEWARE,
4303
- (c) => new RequestContextMiddleware2(
4304
- c.resolve(TOKENS4.REQUEST_CONTEXT),
4305
- c.resolve(TOKENS4.SERVICE_EXTRACTOR),
4306
- c.resolve("IP_RESOLVER"),
4307
- c.resolve(TOKENS4.LOGGER)
4148
+ middlewares.push(
4149
+ new RequestContextMiddleware2(
4150
+ requestContext,
4151
+ container.resolve(TOKENS4.SERVICE_EXTRACTOR),
4152
+ new ClientIpResolver2(opts.trustedProxies),
4153
+ logger
4308
4154
  )
4309
4155
  );
4310
- if (!import_shared73.Guards.isNullOrEmpty(opts.allowOrigins)) {
4156
+ if (!Guards46.isNullOrEmpty(opts.allowOrigins)) {
4311
4157
  if (opts.withCredentials && opts.allowOrigins.includes("*"))
4312
4158
  throw new Error(
4313
4159
  "Wildcard CORS origin is not allowed when withCredentials is set to true in addHttpCore"
4314
4160
  );
4315
4161
  const { AllowOrigin: AllowOrigin2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4316
- container.addSingleton("ALLOW_ORIGIN", () => {
4317
- return new AllowOrigin2(opts.allowOrigins);
4318
- });
4319
4162
  const { AllowOriginMiddleware: AllowOriginMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4320
- container.addSingleton(TOKENS4.ALLOW_ORIGIN_MIDDLEWARE, (c) => {
4321
- return new AllowOriginMiddleware2(
4322
- c.resolve(TOKENS4.ALLOW_ORIGIN),
4323
- c.resolve(TOKENS4.CONTEXT_ACCESSOR),
4324
- c.resolve(TOKENS4.LOGGER)
4325
- );
4326
- });
4327
- middlewares.push(TOKENS4.ALLOW_ORIGIN_MIDDLEWARE);
4163
+ middlewares.push(
4164
+ new AllowOriginMiddleware2(new AllowOrigin2(opts.allowOrigins), requestContext, logger)
4165
+ );
4328
4166
  }
4329
4167
  const withCredentials = opts.withCredentials ? "true" : "false";
4168
+ const allowMethod = await this._getAllowMethod(
4169
+ opts.optionsMiddleware || opts.cors,
4170
+ opts.routeRegistry
4171
+ );
4330
4172
  if (opts.optionsMiddleware) {
4331
4173
  const { OptionsMiddleware: OptionsMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4332
- container.addSingleton(
4333
- TOKENS4.OPTIONS_MIDDLEWARE,
4334
- (c) => new OptionsMiddleware2(
4335
- c.resolve(TOKENS4.NETWORK_CONTEXT_ACCESSOR),
4336
- c.resolve(TOKENS4.ALLOW_METHOD),
4337
- opts.allowHeaders,
4338
- withCredentials
4339
- )
4174
+ middlewares.push(
4175
+ new OptionsMiddleware2(requestContext, allowMethod, opts.allowHeaders, withCredentials)
4340
4176
  );
4341
- middlewares.push(TOKENS4.OPTIONS_MIDDLEWARE);
4342
4177
  }
4343
4178
  if (opts.cors) {
4344
4179
  const { CORSMiddleware: CORSMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4345
- container.addSingleton(TOKENS4.CORS_MIDDLEWARE, (c) => {
4346
- return new CORSMiddleware2(c.resolve(TOKENS4.CONTEXT_ACCESSOR), withCredentials);
4347
- });
4348
- middlewares.push(TOKENS4.CORS_MIDDLEWARE);
4180
+ middlewares.push(new CORSMiddleware2(requestContext, withCredentials));
4349
4181
  }
4350
- if (import_shared73.Guards.isDefined(opts.routeRegistry)) {
4351
- const registry = opts.routeRegistry;
4352
- const { AllowMethodFactory: AllowMethodFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
4353
- container.addSingleton(TOKENS4.ALLOW_METHOD, () => new AllowMethodFactory2().create(registry));
4182
+ if (Guards46.isDefined(opts.routeRegistry)) {
4354
4183
  const { MethodCheckMiddleware: MethodCheckMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4355
- container.addSingleton(
4356
- TOKENS4.METHOD_CHECK_MIDDLEWARE,
4357
- (c) => new MethodCheckMiddleware2(
4358
- c.resolve(TOKENS4.REQUEST_CONTEXT),
4359
- c.resolve(TOKENS4.ALLOW_METHOD)
4360
- )
4361
- );
4362
- middlewares.push(TOKENS4.METHOD_CHECK_MIDDLEWARE);
4184
+ middlewares.push(new MethodCheckMiddleware2(requestContext, allowMethod));
4363
4185
  }
4364
4186
  const { AuthenticationMiddleware: AuthenticationMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4365
- container.addSingleton(TOKENS4.AUTH_MIDDLEWARE, (c) => {
4366
- return new AuthenticationMiddleware2(
4367
- c.resolve(TOKENS4.REQUEST_CONTEXT),
4368
- c.resolve(TOKENS4.BEARER_TOKEN_EXTRACTOR),
4369
- c.resolve(TOKENS4.GATE_KEEPER),
4370
- c.resolve(TOKENS4.LOGGER)
4187
+ if (!opts.isAuth) {
4188
+ const { NoAuthGateKeeper: NoAuthGateKeeper2 } = await Promise.resolve().then(() => (init_application(), application_exports));
4189
+ middlewares.push(
4190
+ new AuthenticationMiddleware2(
4191
+ requestContext,
4192
+ tokenExtractor,
4193
+ new NoAuthGateKeeper2(),
4194
+ logger
4195
+ )
4371
4196
  );
4372
- });
4373
- middlewares.push(TOKENS4.AUTH_MIDDLEWARE);
4374
- if (import_shared73.Guards.isDefined(opts.rateLimite.maxRequests) || import_shared73.Guards.isDefined(opts.rateLimite.windowSeconds)) {
4197
+ } else {
4198
+ const { ClaimsIdentityMapper: ClaimsIdentityMapper2 } = await Promise.resolve().then(() => (init_application(), application_exports));
4199
+ const { GateKeeper: GateKeeper2 } = await Promise.resolve().then(() => (init_application(), application_exports));
4200
+ middlewares.push(
4201
+ new AuthenticationMiddleware2(
4202
+ requestContext,
4203
+ tokenExtractor,
4204
+ new GateKeeper2(container.resolve(TOKENS4.BASE_AUTH_SERVICE), new ClaimsIdentityMapper2()),
4205
+ logger
4206
+ )
4207
+ );
4208
+ }
4209
+ if (Guards46.isDefined(opts.rateLimite.maxRequests) || Guards46.isDefined(opts.rateLimite.windowSeconds)) {
4375
4210
  const maxRequests = opts.rateLimite.maxRequests ?? 30;
4376
- import_shared73.Guards.throwIfNegative(maxRequests, "MaxRequests must be positive");
4377
- import_shared73.Guards.throwIfNotInteger(maxRequests, "MaxRequests must be an integer");
4211
+ Guards46.throwIfNegative(maxRequests, "MaxRequests must be positive");
4212
+ Guards46.throwIfNotInteger(maxRequests, "MaxRequests must be an integer");
4378
4213
  const windowSeconds = opts.rateLimite.windowSeconds ?? 30;
4379
- import_shared73.Guards.throwIfNegative(windowSeconds, "WindowSeconds must be positive");
4380
- import_shared73.Guards.throwIfNotInteger(windowSeconds, "WindowSeconds must be an integer");
4381
- if (!opts.isCache) {
4382
- const { CacheUtils: CacheUtils2 } = await Promise.resolve().then(() => (init_cache_utils(), cache_utils_exports));
4383
- await CacheUtils2.addCache(container, { inMemory: true, redis: void 0 });
4384
- }
4214
+ Guards46.throwIfNegative(windowSeconds, "WindowSeconds must be positive");
4215
+ Guards46.throwIfNotInteger(windowSeconds, "WindowSeconds must be an integer");
4385
4216
  const { RateLimitKeyBuilder: RateLimitKeyBuilder2 } = await Promise.resolve().then(() => (init_cache(), cache_exports));
4386
- container.addSingleton(
4387
- "RATE_LIMIT_KEY_BUILDER",
4388
- (c) => new RateLimitKeyBuilder2(c.resolve(TOKENS4.REQUEST_CONTEXT))
4389
- );
4390
4217
  const { RateLimitMiddleware: RateLimitMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4391
- container.addSingleton(TOKENS4.RATE_LIMITER_MIDDLEWARE, (c) => {
4392
- return new RateLimitMiddleware2(
4393
- c.resolve(TOKENS4.CONTEXT_ACCESSOR),
4394
- c.resolve(TOKENS4.CACHE),
4395
- c.resolve("RATE_LIMIT_KEY_BUILDER"),
4396
- c.resolve(TOKENS4.LOGGER),
4397
- {
4398
- maxRequests,
4399
- windowSeconds
4400
- }
4401
- );
4402
- });
4403
- middlewares.push(TOKENS4.RATE_LIMITER_MIDDLEWARE);
4218
+ middlewares.push(
4219
+ new RateLimitMiddleware2(
4220
+ requestContext,
4221
+ container.resolve(TOKENS4.CACHE),
4222
+ new RateLimitKeyBuilder2(requestContext),
4223
+ logger,
4224
+ { maxRequests, windowSeconds }
4225
+ )
4226
+ );
4404
4227
  }
4405
- if (import_shared73.Guards.isDefined(opts.csrf)) {
4228
+ if (Guards46.isDefined(opts.csrf)) {
4406
4229
  const csrf = opts.csrf;
4407
4230
  const { EdgeCryptoService: EdgeCryptoService2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4408
4231
  container.addSingleton("CRYPTO_SERVICE", () => new EdgeCryptoService2());
@@ -4411,31 +4234,36 @@ var init_middleware_module = __esm({
4411
4234
  return new CsrfTokenService2(csrf.secret, c.resolve("CRYPTO_SERVICE"));
4412
4235
  });
4413
4236
  const { CsrfCookieMiddleware: CsrfCookieMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4414
- container.addSingleton("CSRF_COOKIE_MIDDLEWARE", (c) => {
4415
- return new CsrfCookieMiddleware2(
4416
- c.resolve(TOKENS4.REQUEST_CONTEXT),
4417
- c.resolve("CSRF_TOKEN_SERVICE"),
4418
- csrf
4419
- );
4420
- });
4421
- middlewares.push("CSRF_COOKIE_MIDDLEWARE");
4237
+ middlewares.push(
4238
+ new CsrfCookieMiddleware2(
4239
+ requestContext,
4240
+ container.resolve("CSRF_TOKEN_SERVICE"),
4241
+ opts.csrf
4242
+ )
4243
+ );
4422
4244
  const { CsrfMiddleware: CsrfMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4423
- container.addSingleton(TOKENS4.CSRF_MIDDLEWARE, (c) => {
4424
- return new CsrfMiddleware2(
4425
- c.resolve(TOKENS4.REQUEST_CONTEXT),
4426
- c.resolve("CSRF_TOKEN_SERVICE")
4427
- );
4428
- });
4429
- middlewares.push(TOKENS4.CSRF_MIDDLEWARE);
4245
+ middlewares.push(new CsrfMiddleware2(requestContext, container.resolve("CSRF_TOKEN_SERVICE")));
4430
4246
  }
4431
4247
  const { CompositeMiddleware: CompositeMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4432
- container.addSingleton(TOKENS4.MIDDLEWARE, (c) => {
4433
- const resolvedMiddleware = middlewares.map(
4434
- (token) => c.resolve(token)
4435
- );
4436
- return new CompositeMiddleware2(resolvedMiddleware);
4248
+ container.addSingleton(TOKENS4.MIDDLEWARE, () => {
4249
+ return new CompositeMiddleware2(middlewares);
4437
4250
  });
4438
4251
  }
4252
+ async _getTokenExtractor(isSSR) {
4253
+ if (isSSR) {
4254
+ const { SupabaseSsrTokenExtractor: SupabaseSsrTokenExtractor2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4255
+ return new SupabaseSsrTokenExtractor2();
4256
+ } else {
4257
+ const { BearerTokenExtractor: BearerTokenExtractor2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4258
+ return new BearerTokenExtractor2();
4259
+ }
4260
+ }
4261
+ async _getAllowMethod(configure, opts) {
4262
+ const { Guards: Guards46 } = await import("@xeno-js/shared");
4263
+ if (!configure || !Guards46.isDefined(opts)) return void 0;
4264
+ const { AllowMethodFactory: AllowMethodFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
4265
+ return new AllowMethodFactory2().create(opts);
4266
+ }
4439
4267
  };
4440
4268
  }
4441
4269
  });
@@ -4453,26 +4281,17 @@ var init_context_module = __esm({
4453
4281
  async configure(container) {
4454
4282
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
4455
4283
  const { ServiceScopeFactory: ServiceScopeFactory2 } = await Promise.resolve().then(() => (init_service_scope_factory(), service_scope_factory_exports));
4456
- container.addSingleton(TOKENS4.SERVICE_SCOPE_FACTORY, () => {
4457
- const factory = new ServiceScopeFactory2(container);
4458
- return factory;
4459
- });
4460
4284
  const { NodeRequestContextFactory: NodeRequestContextFactory2 } = await Promise.resolve().then(() => (init_request_context_factory(), request_context_factory_exports));
4461
- container.addSingleton(TOKENS4.REQUEST_CONTEXT, (c) => {
4462
- return new NodeRequestContextFactory2(
4463
- c.resolve(TOKENS4.SERVICE_SCOPE_FACTORY)
4464
- ).create();
4465
- });
4466
- container.addSingleton(TOKENS4.CONTEXT_ACCESSOR, (c) => c.resolve(TOKENS4.REQUEST_CONTEXT));
4467
- container.addSingleton(TOKENS4.IDENTITY_ACCESSOR, (c) => c.resolve(TOKENS4.REQUEST_CONTEXT));
4468
- container.addSingleton(TOKENS4.SERVICE_SCOPE_ACCESSOR, (c) => c.resolve(TOKENS4.REQUEST_CONTEXT));
4469
- container.addSingleton(
4470
- TOKENS4.NETWORK_CONTEXT_ACCESSOR,
4471
- (c) => c.resolve(TOKENS4.REQUEST_CONTEXT)
4472
- );
4285
+ const requestContext = new NodeRequestContextFactory2(
4286
+ new ServiceScopeFactory2(container)
4287
+ ).create();
4288
+ container.addSingleton(TOKENS4.REQUEST_CONTEXT, () => requestContext);
4289
+ container.addSingleton(TOKENS4.CONTEXT_ACCESSOR, () => requestContext);
4290
+ container.addSingleton(TOKENS4.IDENTITY_ACCESSOR, () => requestContext);
4291
+ container.addSingleton(TOKENS4.SERVICE_SCOPE_ACCESSOR, () => requestContext);
4292
+ container.addSingleton(TOKENS4.NETWORK_CONTEXT_ACCESSOR, () => requestContext);
4473
4293
  const { UserContextFactory: UserContextFactory2 } = await Promise.resolve().then(() => (init_user_context_factory(), user_context_factory_exports));
4474
- container.addSingleton(TOKENS4.USER_CONTEXT_FACTORY, (c) => {
4475
- const requestContext = c.resolve(TOKENS4.REQUEST_CONTEXT);
4294
+ container.addSingleton("USER_CONTEXT_FACTORY", () => {
4476
4295
  return new UserContextFactory2(requestContext);
4477
4296
  });
4478
4297
  }
@@ -4488,7 +4307,7 @@ __export(index_exports, {
4488
4307
  BaseController: () => BaseController,
4489
4308
  BaseHandler: () => BaseHandler,
4490
4309
  BasePostgresSqlDataSource: () => BasePostgresSqlDataSource,
4491
- BaseQuery: () => import_shared80.Query,
4310
+ BaseQuery: () => import_shared79.Query,
4492
4311
  BaseSqliteSqlDataSource: () => BaseSqliteSqlDataSource,
4493
4312
  ContainerUtils: () => ContainerUtils,
4494
4313
  ReadDao: () => ReadDao,
@@ -4500,7 +4319,7 @@ module.exports = __toCommonJS(index_exports);
4500
4319
  init_application();
4501
4320
 
4502
4321
  // src/infrastructure/builder/app.builder.ts
4503
- var import_shared74 = require("@xeno-js/shared");
4322
+ var import_shared73 = require("@xeno-js/shared");
4504
4323
 
4505
4324
  // src/infrastructure/configuration/configuration.ts
4506
4325
  var import_shared32 = require("@xeno-js/shared");
@@ -4772,10 +4591,10 @@ var AppBuilder = class {
4772
4591
  constructor(container) {
4773
4592
  this._container = container ?? new ServiceContainer();
4774
4593
  this._container.addSingleton(
4775
- import_shared74.TOKENS.CONFIGURATION_SERVICE,
4594
+ import_shared73.TOKENS.CONFIGURATION_SERVICE,
4776
4595
  () => new EnvironmentConfigurationService()
4777
4596
  );
4778
- this._configuration = this._container.resolve(import_shared74.TOKENS.CONFIGURATION_SERVICE);
4597
+ this._configuration = this._container.resolve(import_shared73.TOKENS.CONFIGURATION_SERVICE);
4779
4598
  this._middlewareConfig.allowOrigins?.push(
4780
4599
  this._configuration.get("APP_URL") ?? `http://localhost:${this._configuration.getNumber("PORT", 3e3)}`
4781
4600
  );
@@ -4834,6 +4653,13 @@ var AppBuilder = class {
4834
4653
  },
4835
4654
  resilience: { retry: {}, circuitBreaker: {}, bulkhead: {} }
4836
4655
  };
4656
+ _loggerConfig = {
4657
+ level: import_shared73.LOG_LEVEL.DEBUG,
4658
+ console: true,
4659
+ sentry: { config: void 0 },
4660
+ pino: { config: void 0 },
4661
+ customLoggers: void 0
4662
+ };
4837
4663
  // --- Module Queuing Flags ---
4838
4664
  _isContextModuleQueued = false;
4839
4665
  _isMiddlewareModuleQueued = false;
@@ -4879,31 +4705,22 @@ var AppBuilder = class {
4879
4705
  * @description Configures the logger for the application. This method allows you to set up logging options such as log level, console logging, and integration with external logging services like Sentry or Pino.
4880
4706
  * @param setupAction A callback function that receives a LoggerConfig object to configure the logger settings.
4881
4707
  * @returns The current instance of AppBuilder for method chaining.
4882
-
4883
- *
4708
+ *
4884
4709
  * @author Xeno
4885
4710
  * @version 1.0.0
4886
4711
  * @since 2025-09-30
4887
- * @link https://github.com/xeno-js/xeno-js
4712
+ * @link https://github.com/xeno-js/xeno-js
4888
4713
  */
4889
4714
  addLogger(setupAction) {
4715
+ if (import_shared73.Guards.isDefined(setupAction)) setupAction(this._loggerConfig, this._configuration);
4890
4716
  if (this._isLoggerModuleQueued) return this;
4891
4717
  this._isLoggerModuleQueued = true;
4892
- const config = {
4893
- level: import_shared74.LOG_LEVEL.DEBUG,
4894
- console: true,
4895
- sentry: { config: void 0 },
4896
- pino: { config: void 0 },
4897
- customLoggers: void 0
4898
- };
4899
- if (import_shared74.Guards.isDefined(setupAction) && import_shared74.Guards.isDefined(config))
4900
- setupAction(config, this._configuration);
4901
4718
  this._modules.push({
4902
- priority: 3,
4719
+ priority: 1,
4903
4720
  name: "LoggerModule",
4904
4721
  action: async () => {
4905
4722
  const { LoggerUtils: LoggerUtils2 } = await Promise.resolve().then(() => (init_logger_utils(), logger_utils_exports));
4906
- await LoggerUtils2.addLogger(this._container, config);
4723
+ await LoggerUtils2.addLogger(this._container, this._loggerConfig);
4907
4724
  }
4908
4725
  });
4909
4726
  return this;
@@ -4920,11 +4737,11 @@ var AppBuilder = class {
4920
4737
  * @link https://github.com/xeno-js/xeno-js
4921
4738
  */
4922
4739
  addCache(setupAction) {
4740
+ if (import_shared73.Guards.isDefined(setupAction)) setupAction(this._config, this._configuration);
4923
4741
  if (this._isCacheModuleQueued) return this;
4924
4742
  this._isCacheModuleQueued = true;
4925
- if (import_shared74.Guards.isDefined(setupAction)) setupAction(this._config, this._configuration);
4926
4743
  this._modules.push({
4927
- priority: 3,
4744
+ priority: 2,
4928
4745
  name: "CacheModule",
4929
4746
  action: async () => {
4930
4747
  const { CacheUtils: CacheUtils2 } = await Promise.resolve().then(() => (init_cache_utils(), cache_utils_exports));
@@ -4957,7 +4774,7 @@ var AppBuilder = class {
4957
4774
  };
4958
4775
  setupAction(config, this._configuration);
4959
4776
  this._modules.push({
4960
- priority: 2,
4777
+ priority: 3,
4961
4778
  name: "AuthModule",
4962
4779
  action: async () => {
4963
4780
  const { AuthUtils: AuthUtils2 } = await Promise.resolve().then(() => (init_auth_utils(), auth_utils_exports));
@@ -5031,7 +4848,7 @@ var AppBuilder = class {
5031
4848
  * @link https://github.com/xeno-js/xeno-js
5032
4849
  */
5033
4850
  addPipeline(setupAction) {
5034
- if (import_shared74.Guards.isDefined(setupAction)) {
4851
+ if (import_shared73.Guards.isDefined(setupAction)) {
5035
4852
  setupAction(this._pipelineConfig, this._configuration);
5036
4853
  }
5037
4854
  this._queuePipelineModule();
@@ -5064,20 +4881,6 @@ var AppBuilder = class {
5064
4881
  });
5065
4882
  return this;
5066
4883
  }
5067
- addAllowOrigin(setupAction) {
5068
- const config = [];
5069
- setupAction(config, this._configuration);
5070
- this._modules.push({
5071
- priority: 30,
5072
- name: "HttpCoreModule",
5073
- action: async () => {
5074
- const { HttpOriginModule: HttpOriginModule2 } = await Promise.resolve().then(() => (init_http_core_module(), http_core_module_exports));
5075
- const httpOriginModule = new HttpOriginModule2();
5076
- await httpOriginModule.configure(this._container, config);
5077
- }
5078
- });
5079
- return this;
5080
- }
5081
4884
  // ─────────────────────────────────────────────────────────────────────────────
5082
4885
  // Dependency Injection Pass-through Methods
5083
4886
  // ─────────────────────────────────────────────────────────────────────────────
@@ -5165,7 +4968,7 @@ var AppBuilder = class {
5165
4968
  console.error(`\u{1F449} Module: **${queued.name}**`);
5166
4969
  console.error(`\u{1F4DD} Reason: ${errorMessage}
5167
4970
  `);
5168
- if (error instanceof Error && import_shared74.Guards.isDefined(error.stack)) {
4971
+ if (error instanceof Error && import_shared73.Guards.isDefined(error.stack)) {
5169
4972
  console.error(error.stack);
5170
4973
  }
5171
4974
  throw new Error(`Bootstrap failed at [${queued.name}]: ${errorMessage}`, { cause: error });
@@ -5190,17 +4993,15 @@ var AppBuilder = class {
5190
4993
  if (this._isPipelineModuleQueued) return;
5191
4994
  this._isPipelineModuleQueued = true;
5192
4995
  this._queueContextModule();
4996
+ if (!this._isLoggerModuleQueued) this.addLogger();
4997
+ if (!this._isCacheModuleQueued) this.addCache();
5193
4998
  this._modules.push({
5194
4999
  priority: 5,
5195
5000
  name: "CqrsModule",
5196
5001
  action: async () => {
5197
5002
  const { CqrsModule: CqrsModule2 } = await Promise.resolve().then(() => (init_cqrs_module(), cqrs_module_exports));
5198
5003
  const pipelineModule = new CqrsModule2();
5199
- await pipelineModule.configure(this._container, {
5200
- ...this._pipelineConfig,
5201
- isLogger: this._isLoggerModuleQueued || this._isMiddlewareModuleQueued,
5202
- isCache: !this._isCacheModuleQueued
5203
- });
5004
+ await pipelineModule.configure(this._container, this._pipelineConfig);
5204
5005
  }
5205
5006
  });
5206
5007
  }
@@ -5217,17 +5018,17 @@ var AppBuilder = class {
5217
5018
  if (this._isMiddlewareModuleQueued) return;
5218
5019
  this._isMiddlewareModuleQueued = true;
5219
5020
  this._queueContextModule();
5021
+ if (!this._isLoggerModuleQueued) this.addLogger();
5022
+ if (!this._isCacheModuleQueued) this.addCache();
5220
5023
  this._modules.push({
5221
- priority: 3,
5024
+ priority: 4,
5222
5025
  name: "MiddlewareModule",
5223
5026
  action: async () => {
5224
5027
  const { MiddlewareModule: MiddlewareModule2 } = await Promise.resolve().then(() => (init_middleware_module(), middleware_module_exports));
5225
5028
  const middlewareModule = new MiddlewareModule2();
5226
5029
  await middlewareModule.configure(this._container, {
5227
5030
  ...this._middlewareConfig,
5228
- isAuth: this._isAuthModuleQueued,
5229
- isLogger: this._isLoggerModuleQueued,
5230
- isCache: this._isCacheModuleQueued || this._isPipelineModuleQueued
5031
+ isAuth: this._isAuthModuleQueued
5231
5032
  });
5232
5033
  }
5233
5034
  });
@@ -5293,13 +5094,11 @@ var BaseSqliteSqlDataSource = class {
5293
5094
  };
5294
5095
 
5295
5096
  // src/infrastructure/datasources/remote.datasource.ts
5296
- var import_shared75 = require("@xeno-js/shared");
5097
+ var import_shared74 = require("@xeno-js/shared");
5297
5098
 
5298
5099
  // src/infrastructure/index.ts
5299
5100
  init_factories();
5300
-
5301
- // src/infrastructure/idempotency/index.ts
5302
- init_idempotency_store();
5101
+ init_idempotency();
5303
5102
 
5304
5103
  // src/infrastructure/loggers/index.ts
5305
5104
  init_console_logger();
@@ -5323,8 +5122,8 @@ init_pipeline_utils();
5323
5122
  init_validation_utils();
5324
5123
 
5325
5124
  // src/infrastructure/repositories/read-dao.ts
5125
+ var import_shared75 = require("@xeno-js/shared");
5326
5126
  var import_shared76 = require("@xeno-js/shared");
5327
- var import_shared77 = require("@xeno-js/shared");
5328
5127
  var ReadDao = class {
5329
5128
  /**
5330
5129
  * Constructs a new ReadDao instance.
@@ -5344,23 +5143,23 @@ var ReadDao = class {
5344
5143
  _dataSource;
5345
5144
  _mapper;
5346
5145
  async findById(id, ctx, signal) {
5347
- import_shared76.AppError.throwIfAborted(signal, "ReadDao.findById");
5146
+ import_shared75.AppError.throwIfAborted(signal, "ReadDao.findById");
5348
5147
  const result = await this._dataSource.findById(id, ctx, signal);
5349
- if (import_shared77.Guards.isNullOrEmpty(result)) return import_shared76.Result.ok();
5148
+ if (import_shared76.Guards.isNullOrEmpty(result)) return import_shared75.Result.ok();
5350
5149
  const entity = this._mapper.toEntity(result);
5351
- return import_shared76.Result.ok(entity);
5150
+ return import_shared75.Result.ok(entity);
5352
5151
  }
5353
5152
  async findAll(ctx, signal) {
5354
- import_shared76.AppError.throwIfAborted(signal, "ReadDao.findAll");
5153
+ import_shared75.AppError.throwIfAborted(signal, "ReadDao.findAll");
5355
5154
  const results = await this._dataSource.findAll(ctx, signal);
5356
5155
  const entities = results.map((result) => this._mapper.toEntity(result));
5357
- return import_shared76.Result.ok(entities);
5156
+ return import_shared75.Result.ok(entities);
5358
5157
  }
5359
5158
  };
5360
5159
 
5361
5160
  // src/infrastructure/repositories/repository.ts
5161
+ var import_shared77 = require("@xeno-js/shared");
5362
5162
  var import_shared78 = require("@xeno-js/shared");
5363
- var import_shared79 = require("@xeno-js/shared");
5364
5163
  var Repository = class {
5365
5164
  /**
5366
5165
  * Constructs a new Repository instance.
@@ -5380,35 +5179,35 @@ var Repository = class {
5380
5179
  _dataSource;
5381
5180
  _mapper;
5382
5181
  async findById(id, ctx, signal) {
5383
- import_shared78.AppError.throwIfAborted(signal, "Repository.findById");
5182
+ import_shared77.AppError.throwIfAborted(signal, "Repository.findById");
5384
5183
  const result = await this._dataSource.findById(id, ctx, signal);
5385
- if (import_shared79.Guards.isNullOrEmpty(result)) return import_shared78.Result.ok();
5184
+ if (import_shared78.Guards.isNullOrEmpty(result)) return import_shared77.Result.ok();
5386
5185
  const entity = this._mapper.toEntity(result);
5387
- return import_shared78.Result.ok(entity);
5186
+ return import_shared77.Result.ok(entity);
5388
5187
  }
5389
5188
  async findAll(ctx, signal) {
5390
- import_shared78.AppError.throwIfAborted(signal, "Repository.findAll");
5189
+ import_shared77.AppError.throwIfAborted(signal, "Repository.findAll");
5391
5190
  const results = await this._dataSource.findAll(ctx, signal);
5392
5191
  const entities = results.map((result) => this._mapper.toEntity(result));
5393
- return import_shared78.Result.ok(entities);
5192
+ return import_shared77.Result.ok(entities);
5394
5193
  }
5395
5194
  async save(entity, signal) {
5396
5195
  const dto = this._mapper.toDto(entity);
5397
- import_shared78.AppError.throwIfAborted(signal, "Repository.save");
5196
+ import_shared77.AppError.throwIfAborted(signal, "Repository.save");
5398
5197
  await this._dataSource.insert(dto, signal);
5399
- return import_shared78.Result.ok();
5198
+ return import_shared77.Result.ok();
5400
5199
  }
5401
5200
  async delete(entity, ctx, signal) {
5402
5201
  const dto = this._mapper.toDto(entity);
5403
- import_shared78.AppError.throwIfAborted(signal, "Repository.delete");
5202
+ import_shared77.AppError.throwIfAborted(signal, "Repository.delete");
5404
5203
  await this._dataSource.delete(dto, ctx, signal);
5405
- return import_shared78.Result.ok();
5204
+ return import_shared77.Result.ok();
5406
5205
  }
5407
5206
  async update(id, entity, ctx, signal) {
5408
5207
  const dto = this._mapper.toPartialDto(entity);
5409
- import_shared78.AppError.throwIfAborted(signal, "Repository.update");
5208
+ import_shared77.AppError.throwIfAborted(signal, "Repository.update");
5410
5209
  await this._dataSource.update(id, dto, ctx, signal);
5411
- return import_shared78.Result.ok();
5210
+ return import_shared77.Result.ok();
5412
5211
  }
5413
5212
  };
5414
5213
 
@@ -5426,7 +5225,7 @@ __reExport(drizzle_types_exports, require("drizzle-orm"));
5426
5225
  __reExport(index_exports, drizzle_types_exports, module.exports);
5427
5226
  init_presentation();
5428
5227
  __reExport(index_exports, require("@xeno-js/shared"), module.exports);
5429
- var import_shared80 = require("@xeno-js/shared");
5228
+ var import_shared79 = require("@xeno-js/shared");
5430
5229
  // Annotate the CommonJS export names for ESM import in node:
5431
5230
  0 && (module.exports = {
5432
5231
  AppBuilder,