@xeno-js/core 0.1.5 → 0.1.7

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,15 +1509,15 @@ var init_logger_utils = __esm({
1509
1509
  */
1510
1510
  async addLogger(container, opts) {
1511
1511
  const loggerDependencies = [];
1512
- const { Guards: Guards46, LOG_LEVEL: LOG_LEVEL7, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1513
- if (!Guards46.isDefined(opts) || opts.console) {
1512
+ const { Guards: Guards47, LOG_LEVEL: LOG_LEVEL7, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1513
+ if (!Guards47.isDefined(opts) || opts.console) {
1514
1514
  const { ConsoleLogger: ConsoleLogger2 } = await Promise.resolve().then(() => (init_console_logger(), console_logger_exports));
1515
1515
  container.addSingleton(TOKENS4.CONSOLE_LOGGER, () => new ConsoleLogger2(opts?.level));
1516
1516
  loggerDependencies.push(TOKENS4.CONSOLE_LOGGER);
1517
1517
  }
1518
1518
  const customLoggerFactories = [];
1519
- if (Guards46.isDefined(opts)) {
1520
- if (Guards46.isDefined(opts.sentry.config)) {
1519
+ if (Guards47.isDefined(opts)) {
1520
+ if (Guards47.isDefined(opts.sentry.config)) {
1521
1521
  const { SentryLoggerFactory: SentryLoggerFactory2 } = await Promise.resolve().then(() => (init_sentry_logger_factory(), sentry_logger_factory_exports));
1522
1522
  container.addSingleton(TOKENS4.SENTRY_LOGGER, () => {
1523
1523
  const factory = new SentryLoggerFactory2();
@@ -1525,7 +1525,7 @@ var init_logger_utils = __esm({
1525
1525
  });
1526
1526
  loggerDependencies.push(TOKENS4.SENTRY_LOGGER);
1527
1527
  }
1528
- if (Guards46.isDefined(opts.pino.config)) {
1528
+ if (Guards47.isDefined(opts.pino.config)) {
1529
1529
  const { PinoLoggerFactory: PinoLoggerFactory2 } = await Promise.resolve().then(() => (init_pino_logger_factory(), pino_logger_factory_exports));
1530
1530
  container.addSingleton(TOKENS4.PINO_LOGGER, () => {
1531
1531
  const factory = new PinoLoggerFactory2();
@@ -1533,10 +1533,10 @@ var init_logger_utils = __esm({
1533
1533
  });
1534
1534
  loggerDependencies.push(TOKENS4.PINO_LOGGER);
1535
1535
  }
1536
- if (!Guards46.isNullOrEmpty(opts.customLoggers)) {
1536
+ if (!Guards47.isNullOrEmpty(opts.customLoggers)) {
1537
1537
  const customLoggers = opts.customLoggers;
1538
1538
  customLoggers.forEach((f) => {
1539
- if (Guards46.isDefined(f)) {
1539
+ if (Guards47.isDefined(f)) {
1540
1540
  customLoggerFactories.push(f);
1541
1541
  }
1542
1542
  });
@@ -1709,8 +1709,8 @@ var init_cache_utils = __esm({
1709
1709
  * @link https://github.com/xeno-js/xeno-js
1710
1710
  */
1711
1711
  async addCache(container, opts) {
1712
- const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1713
- if (!opts.inMemory && !Guards46.isDefined(opts.redis)) {
1712
+ const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
1713
+ if (!opts.inMemory && !Guards47.isDefined(opts.redis)) {
1714
1714
  throw new Error(
1715
1715
  "No cache strategies are configured. Please provide at least one cache strategy."
1716
1716
  );
@@ -1720,12 +1720,12 @@ var init_cache_utils = __esm({
1720
1720
  TOKENS4.CACHE_KEY_BUILDER,
1721
1721
  (c) => new CacheKeyBuilder(c.resolve(TOKENS4.IDENTITY_ACCESSOR))
1722
1722
  );
1723
- if (opts.inMemory || !Guards46.isDefined(opts.redis)) {
1723
+ if (opts.inMemory || !Guards47.isDefined(opts.redis)) {
1724
1724
  const { InMemoryCacheExtended: InMemoryCacheExtended2 } = await Promise.resolve().then(() => (init_inmemory_cache(), inmemory_cache_exports));
1725
1725
  container.addSingleton(TOKENS4.CACHE, () => new InMemoryCacheExtended2());
1726
1726
  return;
1727
1727
  }
1728
- if (Guards46.isDefined(opts.redis)) {
1728
+ if (Guards47.isDefined(opts.redis)) {
1729
1729
  const { RedisCacheFactory: RedisCacheFactory2 } = await Promise.resolve().then(() => (init_redis_cache_factory(), redis_cache_factory_exports));
1730
1730
  container.addSingleton(TOKENS4.CACHE, () => {
1731
1731
  const config = opts.redis;
@@ -1764,6 +1764,17 @@ var init_allow_method_service = __esm({
1764
1764
  }
1765
1765
  return false;
1766
1766
  }
1767
+ getMethods(path) {
1768
+ const cleanPath = this.normalizePath(path.split("?")[0].split("#")[0]);
1769
+ const methods = this.findMethods(cleanPath);
1770
+ return import_shared42.Guards.isDefined(methods) ? methods.join(", ").toUpperCase() : "";
1771
+ }
1772
+ findMethods(cleanPath) {
1773
+ const staticMethods = this._staticRoutes.get(cleanPath);
1774
+ if (import_shared42.Guards.isDefined(staticMethods)) return staticMethods;
1775
+ for (const route of this._dynamicRoutes) if (route.pattern.test(cleanPath)) return route.methods;
1776
+ return void 0;
1777
+ }
1767
1778
  isDynamicPath(path) {
1768
1779
  return path.includes(":") || path.includes("{") && path.includes("}");
1769
1780
  }
@@ -2768,8 +2779,8 @@ var init_auth_utils = __esm({
2768
2779
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
2769
2780
  const pipelines = [];
2770
2781
  const strategies = [];
2771
- const { Guards: Guards46 } = await import("@xeno-js/shared");
2772
- if (Guards46.isDefined(opts.policies)) {
2782
+ const { Guards: Guards47 } = await import("@xeno-js/shared");
2783
+ if (Guards47.isDefined(opts.policies)) {
2773
2784
  const { PolicyRegistry: PolicyRegistry2 } = await Promise.resolve().then(() => (init_application(), application_exports));
2774
2785
  container.addSingleton(TOKENS4.POLICY_REGISTRY, () => new PolicyRegistry2());
2775
2786
  const policyRegistry = opts.policies;
@@ -2778,16 +2789,16 @@ var init_auth_utils = __esm({
2778
2789
  for (const [intent, policy] of Object.entries(policyRegistry)) {
2779
2790
  const intentLower = intent.toLowerCase();
2780
2791
  registryInstance.addPolicy(intentLower, policy);
2781
- if (!Guards46.isNullOrEmpty(policy.roles)) {
2792
+ if (!Guards47.isNullOrEmpty(policy.roles)) {
2782
2793
  Policies.add("roles");
2783
2794
  }
2784
- if (!Guards46.isNullOrEmpty(policy.permissions)) {
2795
+ if (!Guards47.isNullOrEmpty(policy.permissions)) {
2785
2796
  Policies.add("permissions");
2786
2797
  }
2787
- if (!Guards46.isNullOrEmpty(policy.userId)) {
2798
+ if (!Guards47.isNullOrEmpty(policy.userId)) {
2788
2799
  Policies.add("userId");
2789
2800
  }
2790
- if (!Guards46.isNullOrEmpty(policy.tenantId)) {
2801
+ if (!Guards47.isNullOrEmpty(policy.tenantId)) {
2791
2802
  Policies.add("tenantId");
2792
2803
  }
2793
2804
  }
@@ -2836,10 +2847,10 @@ var init_auth_utils = __esm({
2836
2847
  strategies.push(TOKENS4.TENANT_AUTHORIZATION_PIPELINE);
2837
2848
  }
2838
2849
  }
2839
- if (!Guards46.isNullOrEmpty(opts.customAuthorizationStrategy)) {
2850
+ if (!Guards47.isNullOrEmpty(opts.customAuthorizationStrategy)) {
2840
2851
  const customStrategies = opts.customAuthorizationStrategy;
2841
2852
  customStrategies.forEach((strategyToken, index) => {
2842
- if (Guards46.isDefined(strategyToken)) {
2853
+ if (Guards47.isDefined(strategyToken)) {
2843
2854
  const token = `CUSTOM_AUTHORIZATION_STRATEGY_${index}`;
2844
2855
  container.addSingleton(token, (c) => {
2845
2856
  return strategyToken(c);
@@ -3042,7 +3053,7 @@ var init_db_module = __esm({
3042
3053
  "use strict";
3043
3054
  DbModule = class {
3044
3055
  async configure(container, opts) {
3045
- const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3056
+ const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3046
3057
  const { DbUtils: DbUtils2 } = await Promise.resolve().then(() => (init_db_utils(), db_utils_exports));
3047
3058
  const db = opts.enableSqlLite ? await DbUtils2.addSqlLite(opts) : await DbUtils2.addDbClient(opts);
3048
3059
  const { TransactionState: TransactionState2 } = await Promise.resolve().then(() => (init_transaction_state(), transaction_state_exports));
@@ -3059,7 +3070,7 @@ var init_db_module = __esm({
3059
3070
  return new Proxy(db, {
3060
3071
  get(_target, prop, receiver) {
3061
3072
  const activeState = ttx.state;
3062
- if (Guards46.isDefined(activeState)) {
3073
+ if (Guards47.isDefined(activeState)) {
3063
3074
  if (prop === "transaction") {
3064
3075
  return activeState.transaction.bind(activeState);
3065
3076
  }
@@ -3096,14 +3107,14 @@ var init_http_utils = __esm({
3096
3107
  */
3097
3108
  async addAxios(container, opts) {
3098
3109
  const { NodeAxiosFactory: NodeAxiosFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
3099
- const { Guards: Guards46 } = await import("@xeno-js/shared");
3100
- if (!Guards46.isDefined(opts.token)) {
3110
+ const { Guards: Guards47 } = await import("@xeno-js/shared");
3111
+ if (!Guards47.isDefined(opts.token)) {
3101
3112
  throw new Error("HttpConfig.token is required and must be defined.");
3102
3113
  }
3103
3114
  container.addSingleton(opts.token, () => {
3104
3115
  const factory = new NodeAxiosFactory2();
3105
3116
  const instance = factory.create(opts.client);
3106
- if (!Guards46.hasMethod(instance, "get") || !Guards46.hasMethod(instance, "post") || !Guards46.hasMethod(instance, "put") || !Guards46.hasMethod(instance, "patch") || !Guards46.hasMethod(instance, "delete")) {
3117
+ if (!Guards47.hasMethod(instance, "get") || !Guards47.hasMethod(instance, "post") || !Guards47.hasMethod(instance, "put") || !Guards47.hasMethod(instance, "patch") || !Guards47.hasMethod(instance, "delete")) {
3107
3118
  throw new Error(
3108
3119
  "The created HTTP client instance does not implement the required methods of IHttpClient."
3109
3120
  );
@@ -3130,8 +3141,8 @@ var init_http_utils = __esm({
3130
3141
  });
3131
3142
  },
3132
3143
  async addAllowOrigin(container, opts) {
3133
- const { Guards: Guards46 } = await import("@xeno-js/shared");
3134
- if (Guards46.isNullOrEmpty(opts)) throw new Error("At least an allow origin must be passed");
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");
3135
3146
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3136
3147
  const { AllowOrigin: AllowOrigin2 } = await Promise.resolve().then(() => (init_services(), services_exports));
3137
3148
  const allowOrigin = [];
@@ -3191,13 +3202,13 @@ var init_validation_utils = __esm({
3191
3202
  * @link https://github.com/xeno-js/xeno-js
3192
3203
  */
3193
3204
  async addValidation(container, opts, logger) {
3194
- const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3195
- if (!Guards46.isDefined(opts.zod) && Guards46.isNullOrEmpty(opts.customValidationStrategy)) {
3205
+ const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3206
+ if (!Guards47.isDefined(opts.zod) && Guards47.isNullOrEmpty(opts.customValidationStrategy)) {
3196
3207
  return [];
3197
3208
  }
3198
3209
  const pipelines = [];
3199
3210
  const validationStrategies = [];
3200
- if (Guards46.isDefined(opts.zod)) {
3211
+ if (Guards47.isDefined(opts.zod)) {
3201
3212
  const config = opts.zod;
3202
3213
  const { ZodValidatorFactory: ZodValidatorFactory2 } = await Promise.resolve().then(() => (init_zod_validator_factory(), zod_validator_factory_exports));
3203
3214
  container.addSingleton(TOKENS4.ZOD_VALIDATOR, () => {
@@ -3211,9 +3222,9 @@ var init_validation_utils = __esm({
3211
3222
  validationStrategies.push(TOKENS4.SCHEMA_VALIDATION_STRATEGY);
3212
3223
  }
3213
3224
  const customValidationFactory = [];
3214
- if (!Guards46.isNullOrEmpty(opts.customValidationStrategy)) {
3225
+ if (!Guards47.isNullOrEmpty(opts.customValidationStrategy)) {
3215
3226
  for (const strategyToken of opts.customValidationStrategy) {
3216
- if (Guards46.isDefined(strategyToken)) {
3227
+ if (Guards47.isDefined(strategyToken)) {
3217
3228
  customValidationFactory.push(strategyToken);
3218
3229
  }
3219
3230
  }
@@ -3316,8 +3327,8 @@ var init_pipeline_utils = __esm({
3316
3327
  */
3317
3328
  async addCommand(container, opts) {
3318
3329
  const pipelines = [];
3319
- const { Guards: Guards46, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3320
- if (Guards46.isDefined(opts.idempotency)) {
3330
+ const { Guards: Guards47, TOKENS: TOKENS4 } = await import("@xeno-js/shared");
3331
+ if (Guards47.isDefined(opts.idempotency)) {
3321
3332
  const { IdempotencyStore: IdempotencyStore2 } = await Promise.resolve().then(() => (init_idempotency_store(), idempotency_store_exports));
3322
3333
  container.addSingleton(
3323
3334
  TOKENS4.IDEMPOTENCY_STORE,
@@ -3337,7 +3348,7 @@ var init_pipeline_utils = __esm({
3337
3348
  });
3338
3349
  pipelines.push(TOKENS4.IDEMPOTENCY_PIPELINE);
3339
3350
  }
3340
- if (Guards46.isDefined(opts.concurrency)) {
3351
+ if (Guards47.isDefined(opts.concurrency)) {
3341
3352
  const { ConcurrencyRetryPipeline: ConcurrencyRetryPipeline2 } = await Promise.resolve().then(() => (init_application(), application_exports));
3342
3353
  container.addSingleton(TOKENS4.CONCURRENCY_RETRY_PIPELINE, () => {
3343
3354
  const config = opts.concurrency;
@@ -3417,13 +3428,13 @@ var init_cqrs_module = __esm({
3417
3428
  return new PerformancePipeline2(logger, thresholdMs);
3418
3429
  });
3419
3430
  pipelines.push(TOKENS4.PERFORMANCE_PIPELINE);
3420
- const { Guards: Guards46 } = await import("@xeno-js/shared");
3421
- if (Guards46.isDefined(opts.authorization.policies) || Guards46.isDefined(opts.authorization.customAuthorizationStrategy)) {
3431
+ const { Guards: Guards47 } = await import("@xeno-js/shared");
3432
+ if (Guards47.isDefined(opts.authorization.policies) || Guards47.isDefined(opts.authorization.customAuthorizationStrategy)) {
3422
3433
  const { AuthUtils: AuthUtils2 } = await Promise.resolve().then(() => (init_auth_utils(), auth_utils_exports));
3423
3434
  const authPipelines = await AuthUtils2.addAuthZ(container, opts.authorization);
3424
3435
  pipelines.push(...authPipelines);
3425
3436
  }
3426
- if (Guards46.isDefined(opts.validation.zod) || Guards46.isDefined(opts.validation.customValidationStrategy)) {
3437
+ if (Guards47.isDefined(opts.validation.zod) || Guards47.isDefined(opts.validation.customValidationStrategy)) {
3427
3438
  const { ValidationUtils: ValidationUtils2 } = await Promise.resolve().then(() => (init_validation_utils(), validation_utils_exports));
3428
3439
  const logger = container.resolve(TOKENS4.LOGGER);
3429
3440
  const validationPipelines = await ValidationUtils2.addValidation(
@@ -3435,11 +3446,11 @@ var init_cqrs_module = __esm({
3435
3446
  }
3436
3447
  const commandPipelines = pipelines;
3437
3448
  const queryPipelines = pipelines;
3438
- if ((Guards46.isDefined(opts.commandBus.idempotency) || opts.queryBus.isEnabled) && opts.isCache) {
3449
+ if ((Guards47.isDefined(opts.commandBus.idempotency) || opts.queryBus.isEnabled) && opts.isCache) {
3439
3450
  const { CacheUtils: CacheUtils2 } = await Promise.resolve().then(() => (init_cache_utils(), cache_utils_exports));
3440
3451
  await CacheUtils2.addCache(container, { inMemory: true, redis: void 0 });
3441
3452
  }
3442
- if (Guards46.isDefined(opts.commandBus.idempotency) || Guards46.isDefined(opts.commandBus.concurrency)) {
3453
+ if (Guards47.isDefined(opts.commandBus.idempotency) || Guards47.isDefined(opts.commandBus.concurrency)) {
3443
3454
  const { PipelineUtils: PipelineUtils2 } = await Promise.resolve().then(() => (init_pipeline_utils(), pipeline_utils_exports));
3444
3455
  const newCommandPipelines = await PipelineUtils2.addCommand(container, {
3445
3456
  ...opts.commandBus,
@@ -3622,7 +3633,10 @@ var init_allow_method_middleware = __esm({
3622
3633
  spanId: tracing?.spanId ?? import_shared62.GuidHelper.generate(),
3623
3634
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
3624
3635
  },
3625
- import_shared62.STATUS_CODES.NOT_ALLOWED
3636
+ import_shared62.STATUS_CODES.NOT_ALLOWED,
3637
+ {
3638
+ Allow: this._allowMethod.getMethods(req.path)
3639
+ }
3626
3640
  );
3627
3641
  }
3628
3642
  return await next();
@@ -3755,11 +3769,13 @@ var init_cors_middleware = __esm({
3755
3769
  "use strict";
3756
3770
  import_shared65 = require("@xeno-js/shared");
3757
3771
  CORSMiddleware = class {
3758
- constructor(_requestContext) {
3772
+ constructor(_requestContext, _withCredentials = "false") {
3759
3773
  this._requestContext = _requestContext;
3774
+ this._withCredentials = _withCredentials;
3760
3775
  }
3761
3776
  _requestContext;
3762
- async execute(req, _headers, next) {
3777
+ _withCredentials;
3778
+ async execute(_req, _headers, next) {
3763
3779
  const { network } = this._requestContext.getContext() ?? {};
3764
3780
  const origin = network?.origin;
3765
3781
  const response = await next();
@@ -3767,7 +3783,7 @@ var init_cors_middleware = __esm({
3767
3783
  response.headers = {
3768
3784
  ...response.headers ?? {},
3769
3785
  "Access-Control-Allow-Origin": origin,
3770
- "Access-Control-Allow-Credentials": "true",
3786
+ "Access-Control-Allow-Credentials": this._withCredentials,
3771
3787
  "Vary": "Origin"
3772
3788
  };
3773
3789
  return response;
@@ -3911,10 +3927,16 @@ var init_options_middleware = __esm({
3911
3927
  "use strict";
3912
3928
  import_shared68 = require("@xeno-js/shared");
3913
3929
  OptionsMiddleware = class {
3914
- constructor(_requestContext) {
3930
+ constructor(_requestContext, _alloewMethod, _allowHeaders = [], _withCredentials = "false") {
3915
3931
  this._requestContext = _requestContext;
3932
+ this._alloewMethod = _alloewMethod;
3933
+ this._allowHeaders = _allowHeaders;
3934
+ this._withCredentials = _withCredentials;
3916
3935
  }
3917
3936
  _requestContext;
3937
+ _alloewMethod;
3938
+ _allowHeaders;
3939
+ _withCredentials;
3918
3940
  async execute(req, _headers, next) {
3919
3941
  if (req.method.toUpperCase() === "OPTIONS") {
3920
3942
  const network = this._requestContext.getNetworkContext();
@@ -3922,11 +3944,11 @@ var init_options_middleware = __esm({
3922
3944
  const headers = {};
3923
3945
  if (import_shared68.Guards.isDefined(origin)) {
3924
3946
  headers["Access-Control-Allow-Origin"] = origin;
3925
- headers["Access-Control-Allow-Credentials"] = "true";
3947
+ headers["Access-Control-Allow-Credentials"] = this._withCredentials;
3926
3948
  headers["Vary"] = "Origin";
3927
3949
  }
3928
- headers["Access-Control-Allow-Methods"] = "POST,GET,PUT,PATCH,DELETE,OPTIONS";
3929
- headers["Access-Control-Allow-Headers"] = "X-CSRF-Token, Accept, Accept-Version, Content-Type, Authorization, X-Correlation-Id";
3950
+ headers["Access-Control-Allow-Methods"] = this._alloewMethod.getMethods(req.path);
3951
+ headers["Access-Control-Allow-Headers"] = this._allowHeaders.join(", ");
3930
3952
  return import_shared68.HttpHelper.success(null, import_shared68.STATUS_CODES.NO_CONTENT, {}, headers);
3931
3953
  }
3932
3954
  return await next();
@@ -3942,26 +3964,29 @@ var init_rate_limiter_middleware = __esm({
3942
3964
  "use strict";
3943
3965
  import_shared69 = require("@xeno-js/shared");
3944
3966
  RateLimitMiddleware = class {
3945
- constructor(_ctxAccessor, _cache, _logger, _opts) {
3967
+ constructor(_ctxAccessor, _cache, _keyBuilder, _logger, _opts) {
3946
3968
  this._ctxAccessor = _ctxAccessor;
3947
3969
  this._cache = _cache;
3970
+ this._keyBuilder = _keyBuilder;
3948
3971
  this._logger = _logger;
3949
3972
  this._opts = _opts;
3950
3973
  }
3951
3974
  _ctxAccessor;
3952
3975
  _cache;
3976
+ _keyBuilder;
3953
3977
  _logger;
3954
3978
  _opts;
3955
3979
  async execute(req, _headers, next) {
3980
+ const cacheKey = this._keyBuilder.buildRateLimitKey(req.path);
3956
3981
  const { network, tracing } = this._ctxAccessor.getContext() ?? {};
3957
- if (!import_shared69.Guards.isDefined(network?.clientIp))
3982
+ if (!import_shared69.Guards.isDefined(cacheKey))
3958
3983
  return import_shared69.HttpHelper.error(
3959
3984
  {
3960
3985
  success: false,
3961
3986
  error: {
3962
3987
  code: import_shared69.ERROR_CODES.SYSTEM_ERROR,
3963
- message: "IP undefined. Please contact the administrator.",
3964
- details: `IP undefined. Please contact the administrator.`,
3988
+ message: import_shared69.ERROR_CODE_MESSAGES[import_shared69.ERROR_CODES.SYSTEM_ERROR],
3989
+ details: `Bad Request: Unable to identify client context for rate limiting.`,
3965
3990
  path: req.path
3966
3991
  },
3967
3992
  correlationId: tracing?.correlationId ?? import_shared69.GuidHelper.generate(),
@@ -3975,18 +4000,16 @@ var init_rate_limiter_middleware = __esm({
3975
4000
  "Retry-After": [String(this._opts.windowSeconds)]
3976
4001
  }
3977
4002
  );
3978
- const clientIp = network?.clientIp;
3979
- const cacheKey = `rate_limit:${clientIp}`;
3980
4003
  const currentHits = await this._cache.increment(cacheKey, this._opts.windowSeconds);
3981
4004
  if (currentHits > this._opts.maxRequests) {
3982
- this._logger.warn(`[RateLimit] IP ${clientIp} blocked on ${req.path}`);
4005
+ this._logger.warn(`[RateLimit] key ${cacheKey} has been blocked on ${req.path}`);
3983
4006
  return import_shared69.HttpHelper.error(
3984
4007
  {
3985
4008
  success: false,
3986
4009
  error: {
3987
4010
  code: import_shared69.ERROR_CODES.TOO_MANY_REQUESTS,
3988
- message: "Rate limit exceeded.",
3989
- details: `IP ${clientIp} throttled.`,
4011
+ message: import_shared69.ERROR_CODE_MESSAGES[import_shared69.ERROR_CODES.TOO_MANY_REQUESTS],
4012
+ details: `Rate limit exceeded. Key ${cacheKey} throttled.`,
3990
4013
  path: req.path
3991
4014
  },
3992
4015
  correlationId: tracing?.correlationId ?? import_shared69.GuidHelper.generate(),
@@ -4187,16 +4210,60 @@ var init_presentation = __esm({
4187
4210
  }
4188
4211
  });
4189
4212
 
4213
+ // src/infrastructure/cache/rate-limit-key-builder.cache.ts
4214
+ var import_shared72, RateLimitKeyBuilder;
4215
+ var init_rate_limit_key_builder_cache = __esm({
4216
+ "src/infrastructure/cache/rate-limit-key-builder.cache.ts"() {
4217
+ "use strict";
4218
+ import_shared72 = require("@xeno-js/shared");
4219
+ RateLimitKeyBuilder = class {
4220
+ constructor(_contextAccessor) {
4221
+ this._contextAccessor = _contextAccessor;
4222
+ }
4223
+ _contextAccessor;
4224
+ buildRateLimitKey(resource) {
4225
+ const ctx = this._contextAccessor.getContext();
4226
+ const tenantId = ctx?.identity?.tenantId;
4227
+ const userId = ctx?.identity?.userId;
4228
+ const clientIp = ctx?.network?.clientIp;
4229
+ if (!import_shared72.Guards.isNullOrEmpty(tenantId) && !import_shared72.Guards.isNullOrEmpty(userId))
4230
+ return `ratelimit:tenant:${tenantId}:user:${userId}:${resource}`;
4231
+ if (!import_shared72.Guards.isNullOrEmpty(tenantId) && !import_shared72.Guards.isNullOrEmpty(clientIp))
4232
+ return `ratelimit:tenant:${tenantId}:ip:${clientIp}:${resource}`;
4233
+ if (!import_shared72.Guards.isNullOrEmpty(userId)) return `ratelimit:user:${userId}:${resource}`;
4234
+ if (!import_shared72.Guards.isNullOrEmpty(clientIp)) return `ratelimit:ip:${clientIp}:${resource}`;
4235
+ return void 0;
4236
+ }
4237
+ };
4238
+ }
4239
+ });
4240
+
4241
+ // src/infrastructure/cache/index.ts
4242
+ var cache_exports = {};
4243
+ __export(cache_exports, {
4244
+ InMemoryCacheExtended: () => InMemoryCacheExtended,
4245
+ RateLimitKeyBuilder: () => RateLimitKeyBuilder,
4246
+ RedisCache: () => RedisCache
4247
+ });
4248
+ var init_cache = __esm({
4249
+ "src/infrastructure/cache/index.ts"() {
4250
+ "use strict";
4251
+ init_inmemory_cache();
4252
+ init_rate_limit_key_builder_cache();
4253
+ init_redis_cache();
4254
+ }
4255
+ });
4256
+
4190
4257
  // src/infrastructure/modules/middleware.module.ts
4191
4258
  var middleware_module_exports = {};
4192
4259
  __export(middleware_module_exports, {
4193
4260
  MiddlewareModule: () => MiddlewareModule
4194
4261
  });
4195
- var import_shared72, MiddlewareModule;
4262
+ var import_shared73, MiddlewareModule;
4196
4263
  var init_middleware_module = __esm({
4197
4264
  "src/infrastructure/modules/middleware.module.ts"() {
4198
4265
  "use strict";
4199
- import_shared72 = require("@xeno-js/shared");
4266
+ import_shared73 = require("@xeno-js/shared");
4200
4267
  MiddlewareModule = class {
4201
4268
  async configure(container, opts) {
4202
4269
  const { TOKENS: TOKENS4 } = await import("@xeno-js/shared");
@@ -4240,10 +4307,11 @@ var init_middleware_module = __esm({
4240
4307
  c.resolve(TOKENS4.LOGGER)
4241
4308
  )
4242
4309
  );
4243
- if (!import_shared72.Guards.isNullOrEmpty(opts.allowOrigins)) {
4244
- const withCredentials = import_shared72.Guards.isDefined(opts.httpConfig.withCredentials) ? opts.httpConfig.withCredentials : false;
4245
- if (withCredentials && opts.allowOrigins.includes("*"))
4246
- throw new Error("Wildcard CORS origin is not allowed when withCredentials is set to true");
4310
+ if (!import_shared73.Guards.isNullOrEmpty(opts.allowOrigins)) {
4311
+ if (opts.withCredentials && opts.allowOrigins.includes("*"))
4312
+ throw new Error(
4313
+ "Wildcard CORS origin is not allowed when withCredentials is set to true in addHttpCore"
4314
+ );
4247
4315
  const { AllowOrigin: AllowOrigin2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4248
4316
  container.addSingleton("ALLOW_ORIGIN", () => {
4249
4317
  return new AllowOrigin2(opts.allowOrigins);
@@ -4258,22 +4326,28 @@ var init_middleware_module = __esm({
4258
4326
  });
4259
4327
  middlewares.push(TOKENS4.ALLOW_ORIGIN_MIDDLEWARE);
4260
4328
  }
4329
+ const withCredentials = opts.withCredentials ? "true" : "false";
4261
4330
  if (opts.optionsMiddleware) {
4262
4331
  const { OptionsMiddleware: OptionsMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4263
4332
  container.addSingleton(
4264
4333
  TOKENS4.OPTIONS_MIDDLEWARE,
4265
- (c) => new OptionsMiddleware2(c.resolve(TOKENS4.NETWORK_CONTEXT_ACCESSOR))
4334
+ (c) => new OptionsMiddleware2(
4335
+ c.resolve(TOKENS4.NETWORK_CONTEXT_ACCESSOR),
4336
+ c.resolve(TOKENS4.ALLOW_METHOD),
4337
+ opts.allowHeaders,
4338
+ withCredentials
4339
+ )
4266
4340
  );
4267
4341
  middlewares.push(TOKENS4.OPTIONS_MIDDLEWARE);
4268
4342
  }
4269
4343
  if (opts.cors) {
4270
4344
  const { CORSMiddleware: CORSMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4271
4345
  container.addSingleton(TOKENS4.CORS_MIDDLEWARE, (c) => {
4272
- return new CORSMiddleware2(c.resolve(TOKENS4.CONTEXT_ACCESSOR));
4346
+ return new CORSMiddleware2(c.resolve(TOKENS4.CONTEXT_ACCESSOR), withCredentials);
4273
4347
  });
4274
4348
  middlewares.push(TOKENS4.CORS_MIDDLEWARE);
4275
4349
  }
4276
- if (import_shared72.Guards.isDefined(opts.routeRegistry)) {
4350
+ if (import_shared73.Guards.isDefined(opts.routeRegistry)) {
4277
4351
  const registry = opts.routeRegistry;
4278
4352
  const { AllowMethodFactory: AllowMethodFactory2 } = await Promise.resolve().then(() => (init_factories(), factories_exports));
4279
4353
  container.addSingleton(TOKENS4.ALLOW_METHOD, () => new AllowMethodFactory2().create(registry));
@@ -4297,7 +4371,38 @@ var init_middleware_module = __esm({
4297
4371
  );
4298
4372
  });
4299
4373
  middlewares.push(TOKENS4.AUTH_MIDDLEWARE);
4300
- if (import_shared72.Guards.isDefined(opts.csrf)) {
4374
+ if (import_shared73.Guards.isDefined(opts.rateLimite.maxRequests) || import_shared73.Guards.isDefined(opts.rateLimite.windowSeconds)) {
4375
+ 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");
4378
+ 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
+ }
4385
+ 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
+ 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);
4404
+ }
4405
+ if (import_shared73.Guards.isDefined(opts.csrf)) {
4301
4406
  const csrf = opts.csrf;
4302
4407
  const { CsrfTokenService: CsrfTokenService2 } = await Promise.resolve().then(() => (init_services(), services_exports));
4303
4408
  container.addSingleton("CSRF_TOKEN_SERVICE", (c) => {
@@ -4321,31 +4426,6 @@ var init_middleware_module = __esm({
4321
4426
  });
4322
4427
  middlewares.push(TOKENS4.CSRF_MIDDLEWARE);
4323
4428
  }
4324
- if (import_shared72.Guards.isDefined(opts.rateLimite.maxRequests) || import_shared72.Guards.isDefined(opts.rateLimite.windowSeconds)) {
4325
- const maxRequests = opts.rateLimite.maxRequests ?? 30;
4326
- import_shared72.Guards.throwIfNegative(maxRequests, "MaxRequests must be positive");
4327
- import_shared72.Guards.throwIfNotInteger(maxRequests, "MaxRequests must be an integer");
4328
- const windowSeconds = opts.rateLimite.windowSeconds ?? 30;
4329
- import_shared72.Guards.throwIfNegative(windowSeconds, "WindowSeconds must be positive");
4330
- import_shared72.Guards.throwIfNotInteger(windowSeconds, "WindowSeconds must be an integer");
4331
- if (!opts.isCache) {
4332
- const { CacheUtils: CacheUtils2 } = await Promise.resolve().then(() => (init_cache_utils(), cache_utils_exports));
4333
- await CacheUtils2.addCache(container, { inMemory: true, redis: void 0 });
4334
- }
4335
- const { RateLimitMiddleware: RateLimitMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4336
- container.addSingleton(TOKENS4.RATE_LIMITER_MIDDLEWARE, (c) => {
4337
- return new RateLimitMiddleware2(
4338
- c.resolve(TOKENS4.CONTEXT_ACCESSOR),
4339
- c.resolve(TOKENS4.CACHE),
4340
- c.resolve(TOKENS4.LOGGER),
4341
- {
4342
- maxRequests,
4343
- windowSeconds
4344
- }
4345
- );
4346
- });
4347
- middlewares.push(TOKENS4.RATE_LIMITER_MIDDLEWARE);
4348
- }
4349
4429
  const { CompositeMiddleware: CompositeMiddleware2 } = await Promise.resolve().then(() => (init_presentation(), presentation_exports));
4350
4430
  container.addSingleton(TOKENS4.MIDDLEWARE, (c) => {
4351
4431
  const resolvedMiddleware = middlewares.map(
@@ -4405,7 +4485,7 @@ __export(index_exports, {
4405
4485
  BaseAuthorizationStrategy: () => BaseAuthorizationStrategy,
4406
4486
  BaseController: () => BaseController,
4407
4487
  BaseHandler: () => BaseHandler,
4408
- BaseQuery: () => import_shared79.Query,
4488
+ BaseQuery: () => import_shared80.Query,
4409
4489
  ContainerUtils: () => ContainerUtils,
4410
4490
  ReadDao: () => ReadDao,
4411
4491
  Repository: () => Repository,
@@ -4416,7 +4496,7 @@ module.exports = __toCommonJS(index_exports);
4416
4496
  init_application();
4417
4497
 
4418
4498
  // src/infrastructure/builder/app.builder.ts
4419
- var import_shared73 = require("@xeno-js/shared");
4499
+ var import_shared74 = require("@xeno-js/shared");
4420
4500
 
4421
4501
  // src/infrastructure/configuration/configuration.ts
4422
4502
  var import_shared32 = require("@xeno-js/shared");
@@ -4688,10 +4768,10 @@ var AppBuilder = class {
4688
4768
  constructor(container) {
4689
4769
  this._container = container ?? new ServiceContainer();
4690
4770
  this._container.addSingleton(
4691
- import_shared73.TOKENS.CONFIGURATION_SERVICE,
4771
+ import_shared74.TOKENS.CONFIGURATION_SERVICE,
4692
4772
  () => new EnvironmentConfigurationService()
4693
4773
  );
4694
- this._configuration = this._container.resolve(import_shared73.TOKENS.CONFIGURATION_SERVICE);
4774
+ this._configuration = this._container.resolve(import_shared74.TOKENS.CONFIGURATION_SERVICE);
4695
4775
  this._middlewareConfig.allowOrigins?.push(
4696
4776
  this._configuration.get("APP_URL") ?? `http://localhost:${this._configuration.getNumber("PORT", 3e3)}`
4697
4777
  );
@@ -4728,7 +4808,9 @@ var AppBuilder = class {
4728
4808
  trustedIpHeader: void 0,
4729
4809
  trustedProxies: [],
4730
4810
  allowOrigins: [],
4731
- cors: true
4811
+ allowHeaders: [],
4812
+ cors: true,
4813
+ withCredentials: true
4732
4814
  };
4733
4815
  _httpConfig = {
4734
4816
  dataSourceToken: void 0,
@@ -4804,13 +4886,13 @@ var AppBuilder = class {
4804
4886
  if (this._isLoggerModuleQueued) return this;
4805
4887
  this._isLoggerModuleQueued = true;
4806
4888
  const config = {
4807
- level: import_shared73.LOG_LEVEL.DEBUG,
4889
+ level: import_shared74.LOG_LEVEL.DEBUG,
4808
4890
  console: true,
4809
4891
  sentry: { config: void 0 },
4810
4892
  pino: { config: void 0 },
4811
4893
  customLoggers: void 0
4812
4894
  };
4813
- if (import_shared73.Guards.isDefined(setupAction) && import_shared73.Guards.isDefined(config))
4895
+ if (import_shared74.Guards.isDefined(setupAction) && import_shared74.Guards.isDefined(config))
4814
4896
  setupAction(config, this._configuration);
4815
4897
  this._modules.push({
4816
4898
  priority: 3,
@@ -4836,7 +4918,7 @@ var AppBuilder = class {
4836
4918
  addCache(setupAction) {
4837
4919
  if (this._isCacheModuleQueued) return this;
4838
4920
  this._isCacheModuleQueued = true;
4839
- if (import_shared73.Guards.isDefined(setupAction)) setupAction(this._config, this._configuration);
4921
+ if (import_shared74.Guards.isDefined(setupAction)) setupAction(this._config, this._configuration);
4840
4922
  this._modules.push({
4841
4923
  priority: 3,
4842
4924
  name: "CacheModule",
@@ -4945,7 +5027,7 @@ var AppBuilder = class {
4945
5027
  * @link https://github.com/xeno-js/xeno-js
4946
5028
  */
4947
5029
  addPipeline(setupAction) {
4948
- if (import_shared73.Guards.isDefined(setupAction)) {
5030
+ if (import_shared74.Guards.isDefined(setupAction)) {
4949
5031
  setupAction(this._pipelineConfig, this._configuration);
4950
5032
  }
4951
5033
  this._queuePipelineModule();
@@ -5079,7 +5161,7 @@ var AppBuilder = class {
5079
5161
  console.error(`\u{1F449} Module: **${queued.name}**`);
5080
5162
  console.error(`\u{1F4DD} Reason: ${errorMessage}
5081
5163
  `);
5082
- if (error instanceof Error && import_shared73.Guards.isDefined(error.stack)) {
5164
+ if (error instanceof Error && import_shared74.Guards.isDefined(error.stack)) {
5083
5165
  console.error(error.stack);
5084
5166
  }
5085
5167
  throw new Error(`Bootstrap failed at [${queued.name}]: ${errorMessage}`, { cause: error });
@@ -5141,8 +5223,7 @@ var AppBuilder = class {
5141
5223
  ...this._middlewareConfig,
5142
5224
  isAuth: this._isAuthModuleQueued,
5143
5225
  isLogger: this._isLoggerModuleQueued,
5144
- isCache: this._isCacheModuleQueued || this._isPipelineModuleQueued,
5145
- httpConfig: this._httpConfig.http.client
5226
+ isCache: this._isCacheModuleQueued || this._isPipelineModuleQueued
5146
5227
  });
5147
5228
  }
5148
5229
  });
@@ -5171,14 +5252,14 @@ var AppBuilder = class {
5171
5252
  }
5172
5253
  };
5173
5254
 
5174
- // src/infrastructure/cache/index.ts
5175
- init_redis_cache();
5255
+ // src/infrastructure/index.ts
5256
+ init_cache();
5176
5257
 
5177
5258
  // src/infrastructure/context/index.ts
5178
5259
  init_request_context();
5179
5260
 
5180
5261
  // src/infrastructure/datasources/remote.datasource.ts
5181
- var import_shared74 = require("@xeno-js/shared");
5262
+ var import_shared75 = require("@xeno-js/shared");
5182
5263
 
5183
5264
  // src/infrastructure/index.ts
5184
5265
  init_factories();
@@ -5208,8 +5289,8 @@ init_pipeline_utils();
5208
5289
  init_validation_utils();
5209
5290
 
5210
5291
  // src/infrastructure/repositories/read-dao.ts
5211
- var import_shared75 = require("@xeno-js/shared");
5212
5292
  var import_shared76 = require("@xeno-js/shared");
5293
+ var import_shared77 = require("@xeno-js/shared");
5213
5294
  var ReadDao = class {
5214
5295
  /**
5215
5296
  * Constructs a new ReadDao instance.
@@ -5229,23 +5310,23 @@ var ReadDao = class {
5229
5310
  _dataSource;
5230
5311
  _mapper;
5231
5312
  async findById(id, ctx, signal) {
5232
- import_shared75.AppError.throwIfAborted(signal, "ReadDao.findById");
5313
+ import_shared76.AppError.throwIfAborted(signal, "ReadDao.findById");
5233
5314
  const result = await this._dataSource.findById(id, ctx, signal);
5234
- if (import_shared76.Guards.isNullOrEmpty(result)) return import_shared75.Result.ok();
5315
+ if (import_shared77.Guards.isNullOrEmpty(result)) return import_shared76.Result.ok();
5235
5316
  const entity = this._mapper.toEntity(result);
5236
- return import_shared75.Result.ok(entity);
5317
+ return import_shared76.Result.ok(entity);
5237
5318
  }
5238
5319
  async findAll(ctx, signal) {
5239
- import_shared75.AppError.throwIfAborted(signal, "ReadDao.findAll");
5320
+ import_shared76.AppError.throwIfAborted(signal, "ReadDao.findAll");
5240
5321
  const results = await this._dataSource.findAll(ctx, signal);
5241
5322
  const entities = results.map((result) => this._mapper.toEntity(result));
5242
- return import_shared75.Result.ok(entities);
5323
+ return import_shared76.Result.ok(entities);
5243
5324
  }
5244
5325
  };
5245
5326
 
5246
5327
  // src/infrastructure/repositories/repository.ts
5247
- var import_shared77 = require("@xeno-js/shared");
5248
5328
  var import_shared78 = require("@xeno-js/shared");
5329
+ var import_shared79 = require("@xeno-js/shared");
5249
5330
  var Repository = class {
5250
5331
  /**
5251
5332
  * Constructs a new Repository instance.
@@ -5265,35 +5346,35 @@ var Repository = class {
5265
5346
  _dataSource;
5266
5347
  _mapper;
5267
5348
  async findById(id, ctx, signal) {
5268
- import_shared77.AppError.throwIfAborted(signal, "Repository.findById");
5349
+ import_shared78.AppError.throwIfAborted(signal, "Repository.findById");
5269
5350
  const result = await this._dataSource.findById(id, ctx, signal);
5270
- if (import_shared78.Guards.isNullOrEmpty(result)) return import_shared77.Result.ok();
5351
+ if (import_shared79.Guards.isNullOrEmpty(result)) return import_shared78.Result.ok();
5271
5352
  const entity = this._mapper.toEntity(result);
5272
- return import_shared77.Result.ok(entity);
5353
+ return import_shared78.Result.ok(entity);
5273
5354
  }
5274
5355
  async findAll(ctx, signal) {
5275
- import_shared77.AppError.throwIfAborted(signal, "Repository.findAll");
5356
+ import_shared78.AppError.throwIfAborted(signal, "Repository.findAll");
5276
5357
  const results = await this._dataSource.findAll(ctx, signal);
5277
5358
  const entities = results.map((result) => this._mapper.toEntity(result));
5278
- return import_shared77.Result.ok(entities);
5359
+ return import_shared78.Result.ok(entities);
5279
5360
  }
5280
5361
  async save(entity, signal) {
5281
5362
  const dto = this._mapper.toDto(entity);
5282
- import_shared77.AppError.throwIfAborted(signal, "Repository.save");
5363
+ import_shared78.AppError.throwIfAborted(signal, "Repository.save");
5283
5364
  await this._dataSource.insert(dto, signal);
5284
- return import_shared77.Result.ok();
5365
+ return import_shared78.Result.ok();
5285
5366
  }
5286
5367
  async delete(entity, ctx, signal) {
5287
5368
  const dto = this._mapper.toDto(entity);
5288
- import_shared77.AppError.throwIfAborted(signal, "Repository.delete");
5369
+ import_shared78.AppError.throwIfAborted(signal, "Repository.delete");
5289
5370
  await this._dataSource.delete(dto, ctx, signal);
5290
- return import_shared77.Result.ok();
5371
+ return import_shared78.Result.ok();
5291
5372
  }
5292
5373
  async update(id, entity, ctx, signal) {
5293
5374
  const dto = this._mapper.toPartialDto(entity);
5294
- import_shared77.AppError.throwIfAborted(signal, "Repository.update");
5375
+ import_shared78.AppError.throwIfAborted(signal, "Repository.update");
5295
5376
  await this._dataSource.update(id, dto, ctx, signal);
5296
- return import_shared77.Result.ok();
5377
+ return import_shared78.Result.ok();
5297
5378
  }
5298
5379
  };
5299
5380
 
@@ -5311,7 +5392,7 @@ __reExport(drizzle_types_exports, require("drizzle-orm"));
5311
5392
  __reExport(index_exports, drizzle_types_exports, module.exports);
5312
5393
  init_presentation();
5313
5394
  __reExport(index_exports, require("@xeno-js/shared"), module.exports);
5314
- var import_shared79 = require("@xeno-js/shared");
5395
+ var import_shared80 = require("@xeno-js/shared");
5315
5396
  // Annotate the CommonJS export names for ESM import in node:
5316
5397
  0 && (module.exports = {
5317
5398
  AppBuilder,
@@ -5335,4 +5416,14 @@ var import_shared79 = require("@xeno-js/shared");
5335
5416
  * @link https://github.com/xeno-js/xeno-js
5336
5417
  * @license MIT
5337
5418
  */
5419
+ /**
5420
+ * @description The RateLimitKeyBuilder class implements the IRateLimitKeyBuilder interface, providing a method to build rate limit keys based on the user's identity. This class utilizes an instance of IIdentityAccessor to retrieve the current user's identity, allowing for the creation of tenant-specific rate limit keys in multi-tenant applications. If a tenant ID is present in the identity, the rate limit key is prefixed with the tenant ID; otherwise, it defaults to a public rate limit key. This approach ensures that rate limit data is appropriately scoped to the user's context, preventing data leakage between tenants.
5421
+ *
5422
+ * @author Xeno
5423
+ * @version 1.0.0
5424
+ * @since 2025-09-30
5425
+ * @link https://github.com/xeno-js/xeno-vue
5426
+ * @copyright Xeno
5427
+ * @license MIT
5428
+ */
5338
5429
  //# sourceMappingURL=index.cjs.map