@ductape/sdk 0.1.19 → 0.1.21

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.
Files changed (116) hide show
  1. package/dist/agents/agents.service.d.ts +2 -0
  2. package/dist/agents/agents.service.js +26 -3
  3. package/dist/agents/agents.service.js.map +1 -1
  4. package/dist/api/services/appApi.service.d.ts +6 -0
  5. package/dist/api/services/appApi.service.js +25 -0
  6. package/dist/api/services/appApi.service.js.map +1 -1
  7. package/dist/api/services/cloudApi.service.js +8 -4
  8. package/dist/api/services/cloudApi.service.js.map +1 -1
  9. package/dist/api/services/logsApi.service.js +5 -1
  10. package/dist/api/services/logsApi.service.js.map +1 -1
  11. package/dist/api/services/productsApi.service.d.ts +113 -0
  12. package/dist/api/services/productsApi.service.js +104 -0
  13. package/dist/api/services/productsApi.service.js.map +1 -1
  14. package/dist/api/urls.d.ts +7 -0
  15. package/dist/api/urls.js +14 -7
  16. package/dist/api/urls.js.map +1 -1
  17. package/dist/api/utils/cache.utils.d.ts +1 -0
  18. package/dist/api/utils/cache.utils.js +5 -1
  19. package/dist/api/utils/cache.utils.js.map +1 -1
  20. package/dist/apps/services/app.service.js +27 -8
  21. package/dist/apps/services/app.service.js.map +1 -1
  22. package/dist/brokers/brokers.service.js +20 -12
  23. package/dist/brokers/brokers.service.js.map +1 -1
  24. package/dist/cloud/cloud-broker-link.util.d.ts +2 -6
  25. package/dist/cloud/cloud-broker-link.util.js +21 -35
  26. package/dist/cloud/cloud-broker-link.util.js.map +1 -1
  27. package/dist/cloud/cloud-database-link.util.d.ts +2 -6
  28. package/dist/cloud/cloud-database-link.util.js +17 -12
  29. package/dist/cloud/cloud-database-link.util.js.map +1 -1
  30. package/dist/cloud/cloud-graph-link.util.d.ts +2 -6
  31. package/dist/cloud/cloud-graph-link.util.js +18 -21
  32. package/dist/cloud/cloud-graph-link.util.js.map +1 -1
  33. package/dist/cloud/cloud-materialize.util.d.ts +22 -0
  34. package/dist/cloud/cloud-materialize.util.js +82 -0
  35. package/dist/cloud/cloud-materialize.util.js.map +1 -0
  36. package/dist/cloud/cloud-resource-body.util.d.ts +6 -0
  37. package/dist/cloud/cloud-resource-body.util.js +58 -0
  38. package/dist/cloud/cloud-resource-body.util.js.map +1 -0
  39. package/dist/cloud/cloud-runtime.util.js +1 -1
  40. package/dist/cloud/cloud-runtime.util.js.map +1 -1
  41. package/dist/cloud/cloud-vector-link.util.d.ts +2 -6
  42. package/dist/cloud/cloud-vector-link.util.js +22 -20
  43. package/dist/cloud/cloud-vector-link.util.js.map +1 -1
  44. package/dist/cloud/cloud.service.js +4 -4
  45. package/dist/cloud/cloud.service.js.map +1 -1
  46. package/dist/cloud/types/cloud.types.d.ts +13 -13
  47. package/dist/database/adapters/mysql.adapter.js +8 -3
  48. package/dist/database/adapters/mysql.adapter.js.map +1 -1
  49. package/dist/database/adapters/postgresql.adapter.js +6 -2
  50. package/dist/database/adapters/postgresql.adapter.js.map +1 -1
  51. package/dist/database/databases.service.d.ts +10 -1
  52. package/dist/database/databases.service.js +84 -27
  53. package/dist/database/databases.service.js.map +1 -1
  54. package/dist/graph/graphs.service.d.ts +7 -3
  55. package/dist/graph/graphs.service.js +67 -31
  56. package/dist/graph/graphs.service.js.map +1 -1
  57. package/dist/index.d.ts +27 -6
  58. package/dist/index.js +94 -102
  59. package/dist/index.js.map +1 -1
  60. package/dist/logs/logs.service.d.ts +3 -1
  61. package/dist/logs/logs.service.js +12 -2
  62. package/dist/logs/logs.service.js.map +1 -1
  63. package/dist/logs/logs.types.d.ts +4 -0
  64. package/dist/logs/logs.types.js.map +1 -1
  65. package/dist/notifications/notifications.service.d.ts +6 -0
  66. package/dist/notifications/notifications.service.js +54 -17
  67. package/dist/notifications/notifications.service.js.map +1 -1
  68. package/dist/processor/services/processor.service.d.ts +0 -14
  69. package/dist/processor/services/processor.service.js +6 -72
  70. package/dist/processor/services/processor.service.js.map +1 -1
  71. package/dist/products/bootstrap-cache.d.ts +22 -0
  72. package/dist/products/bootstrap-cache.js +78 -0
  73. package/dist/products/bootstrap-cache.js.map +1 -0
  74. package/dist/products/services/products.service.d.ts +48 -5
  75. package/dist/products/services/products.service.js +314 -171
  76. package/dist/products/services/products.service.js.map +1 -1
  77. package/dist/products/validators/joi-validators/create.productFallback.validator.js +1 -1
  78. package/dist/products/validators/joi-validators/create.productGraph.validator.js +7 -0
  79. package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -1
  80. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +1 -1
  81. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
  82. package/dist/products/validators/joi-validators/create.productQuota.validator.js +1 -1
  83. package/dist/products/validators/joi-validators/create.productVector.validator.js +6 -0
  84. package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -1
  85. package/dist/products/validators/joi-validators/update.productFallback.validator.js +1 -1
  86. package/dist/products/validators/joi-validators/update.productGraph.validator.js +9 -0
  87. package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -1
  88. package/dist/products/validators/joi-validators/update.productQuota.validator.js +1 -1
  89. package/dist/resilience/fallback.service.d.ts +3 -0
  90. package/dist/resilience/fallback.service.js +49 -14
  91. package/dist/resilience/fallback.service.js.map +1 -1
  92. package/dist/resilience/healthcheck.service.d.ts +3 -0
  93. package/dist/resilience/healthcheck.service.js +57 -7
  94. package/dist/resilience/healthcheck.service.js.map +1 -1
  95. package/dist/resilience/quota.service.d.ts +3 -0
  96. package/dist/resilience/quota.service.js +49 -14
  97. package/dist/resilience/quota.service.js.map +1 -1
  98. package/dist/resilience/resilience-execution.utils.d.ts +22 -0
  99. package/dist/resilience/resilience-execution.utils.js +81 -0
  100. package/dist/resilience/resilience-execution.utils.js.map +1 -0
  101. package/dist/sessions/sessions.service.d.ts +9 -1
  102. package/dist/sessions/sessions.service.js +125 -49
  103. package/dist/sessions/sessions.service.js.map +1 -1
  104. package/dist/storage/storage-cloud-link.util.d.ts +2 -6
  105. package/dist/storage/storage-cloud-link.util.js +23 -21
  106. package/dist/storage/storage-cloud-link.util.js.map +1 -1
  107. package/dist/types/appBuilder.types.d.ts +2 -0
  108. package/dist/types/index.types.d.ts +8 -0
  109. package/dist/types/index.types.js.map +1 -1
  110. package/dist/types/processor.types.d.ts +3 -0
  111. package/dist/types/processor.types.js.map +1 -1
  112. package/dist/types/requests.types.d.ts +4 -0
  113. package/dist/vector/vector-database.service.d.ts +6 -0
  114. package/dist/vector/vector-database.service.js +66 -8
  115. package/dist/vector/vector-database.service.js.map +1 -1
  116. package/package.json +3 -1
package/dist/index.js CHANGED
@@ -464,7 +464,7 @@ class Ductape {
464
464
  this.redisClient = undefined;
465
465
  }
466
466
  }
467
- constructor({ accessKey, redis_url, product, env, local }) {
467
+ constructor({ accessKey, redis_url, product, env, local, ip_address, language }) {
468
468
  this.productBuilders = new Map();
469
469
  this.appBuilders = new Map();
470
470
  // Cached service instances (lazily initialized after auth)
@@ -479,6 +479,7 @@ class Ductape {
479
479
  this._jobsService = null;
480
480
  this._secretsService = null;
481
481
  this._cloudService = null;
482
+ this._sessionsService = null;
482
483
  this._privateKey = null;
483
484
  this._quotaService = null;
484
485
  this._fallbackService = null;
@@ -491,7 +492,7 @@ class Ductape {
491
492
  /**
492
493
  * Creates a new product.
493
494
  * @param {IProduct} data - The product data.
494
- * @returns {Promise<void>} Resolves when the product is created. Throws on error.
495
+ * @returns {Promise<IProduct>} The created (or existing) product document.
495
496
  */
496
497
  create: async (data) => {
497
498
  const builder = await this.initProductBuilder();
@@ -531,6 +532,22 @@ class Ductape {
531
532
  throw e;
532
533
  }
533
534
  },
535
+ /**
536
+ * Deletes a product by tag.
537
+ * @param {string} tag - The product tag.
538
+ * @returns {Promise<void>} Resolves when the product is deleted. Throws on error.
539
+ */
540
+ delete: async (tag) => {
541
+ const builder = await this.getProductBuilder(tag);
542
+ await this.productsApi.deleteProduct(builder.fetchProductId(), {
543
+ token: this.token,
544
+ public_key: this.public_key,
545
+ user_id: this.user_id,
546
+ workspace_id: this.workspace_id,
547
+ access_key: this.accessKey,
548
+ });
549
+ this.productBuilders.delete(tag);
550
+ },
534
551
  /**
535
552
  * Updates data validation for a product.
536
553
  * @param {string} product - The product tag.
@@ -591,9 +608,9 @@ class Ductape {
591
608
  * @param {string} appTag - The app tag.
592
609
  * @returns {Promise<IAppAccess>} The result of the connection.
593
610
  */
594
- connect: async (product, appTag) => {
611
+ connect: async (product, appTag, options) => {
595
612
  const builder = await this.getProductBuilder(product);
596
- return builder.createAppAccessTag(appTag);
613
+ return builder.createAppAccessTag(appTag, options === null || options === void 0 ? void 0 : options.appId);
597
614
  },
598
615
  /**
599
616
  * Adds an app to a product.
@@ -4546,6 +4563,40 @@ class Ductape {
4546
4563
  console.log(`App initialized with tag: ${appTag}`);
4547
4564
  await this.getAppBuilder(appTag);
4548
4565
  },
4566
+ /**
4567
+ * Deletes an app by tag.
4568
+ * @param {string} tag - The app tag.
4569
+ * @returns {Promise<void>} Resolves when the app is deleted. Throws on error.
4570
+ */
4571
+ delete: async (tag) => {
4572
+ var _a, _b, _c;
4573
+ if (!this.token)
4574
+ await this.initUserAuth();
4575
+ const app = await this.appApi.fetchAppByTag(tag, {
4576
+ token: this.token,
4577
+ workspace_id: this.workspace_id,
4578
+ user_id: this.user_id,
4579
+ public_key: this.public_key,
4580
+ access_key: this.accessKey,
4581
+ });
4582
+ const appId = String((_b = (_a = app._id) !== null && _a !== void 0 ? _a : app.id) !== null && _b !== void 0 ? _b : '');
4583
+ if (!appId) {
4584
+ throw new Error(`App id missing for tag ${tag}`);
4585
+ }
4586
+ await this.appApi.deleteApp(appId, {
4587
+ token: this.token,
4588
+ workspace_id: this.workspace_id,
4589
+ user_id: this.user_id,
4590
+ public_key: this.public_key,
4591
+ access_key: this.accessKey,
4592
+ });
4593
+ const appName = String((_c = app.app_name) !== null && _c !== void 0 ? _c : '').trim();
4594
+ if (appName) {
4595
+ await this.appApi.invalidateAppNameLookupCache(appName, this.workspace_id);
4596
+ }
4597
+ await this.appApi.invalidateAppTagLookupCache(tag, this.workspace_id);
4598
+ this.appBuilders.delete(tag);
4599
+ },
4549
4600
  /**
4550
4601
  * Updates data validation for an app.
4551
4602
  * @param {string} appTag - The app tag.
@@ -4704,27 +4755,30 @@ class Ductape {
4704
4755
  * @param {boolean} [params.updateIfExists] - Whether to update if actions exist (optional).
4705
4756
  * @returns {Promise<void>} Resolves when the import is complete. Throws on error.
4706
4757
  */
4707
- import: async ({ file, type, version, appTag, updateIfExists, isAdminImport, }) => {
4708
- var _a;
4758
+ import: async ({ file, type, version, appTag, appId, updateIfExists, isAdminImport, }) => {
4759
+ var _a, _b;
4709
4760
  if (!this.token)
4710
4761
  await this.initUserAuth();
4711
4762
  this.importService = await this.createNewImporter();
4712
- let app_id = null;
4713
- if (appTag) {
4763
+ let resolvedAppId = appId !== null && appId !== void 0 ? appId : null;
4764
+ if (!resolvedAppId && appTag) {
4714
4765
  const builder = await this.getAppBuilder(appTag);
4715
4766
  const app = builder.fetchApp();
4716
- const latest = app.versions.find((v) => v.latest === true);
4717
4767
  if (!app) {
4718
4768
  throw new Error(`App ${appTag} not found`);
4719
4769
  }
4720
- if (latest && ((_a = latest === null || latest === void 0 ? void 0 : latest.actions) === null || _a === void 0 ? void 0 : _a.length) && !updateIfExists) {
4770
+ const latest = (_a = app.versions) === null || _a === void 0 ? void 0 : _a.find((v) => v.latest === true);
4771
+ if (((_b = latest === null || latest === void 0 ? void 0 : latest.actions) === null || _b === void 0 ? void 0 : _b.length) && !updateIfExists) {
4721
4772
  console.log(`App ${appTag} version ${version} already has actions, please set updateIfExists to true to overwrite existing action`);
4722
4773
  return;
4723
4774
  }
4724
- app_id = app._id;
4775
+ resolvedAppId = app._id;
4776
+ }
4777
+ if (!resolvedAppId) {
4778
+ throw new Error('appId or appTag is required for import');
4725
4779
  }
4726
4780
  console.log(`Importing actions from file, type: ${type}, version: ${version}`);
4727
- return this.importService.importApp(file, type, version, updateIfExists, app_id, isAdminImport);
4781
+ return this.importService.importApp(file, type, version, updateIfExists, resolvedAppId, isAdminImport);
4728
4782
  },
4729
4783
  /**
4730
4784
  * Updates an action by tag.
@@ -5160,6 +5214,8 @@ class Ductape {
5160
5214
  const productTag = product === null || product === void 0 ? void 0 : product.trim();
5161
5215
  const envSlug = env === null || env === void 0 ? void 0 : env.trim();
5162
5216
  this.accessKey = accessKey;
5217
+ this.clientIpAddress = (ip_address === null || ip_address === void 0 ? void 0 : ip_address.trim()) || undefined;
5218
+ this.clientLanguage = (language === null || language === void 0 ? void 0 : language.trim()) || undefined;
5163
5219
  this.environment =
5164
5220
  local === true
5165
5221
  ? index_types_1.EnvType.LOCAL
@@ -5478,29 +5534,18 @@ class Ductape {
5478
5534
  }
5479
5535
  }
5480
5536
  createNewLogger(product_id, app_id) {
5537
+ return new logs_service_1.default(Object.assign(Object.assign({}, this.builderInit()), { product_id,
5538
+ app_id }));
5539
+ }
5540
+ /** Shared auth + client context fields for service constructors. */
5541
+ builderInit(extra = {}) {
5481
5542
  var _a;
5482
- return new logs_service_1.default({
5483
- workspace_id: this.workspace_id,
5484
- public_key: this.public_key,
5485
- user_id: this.user_id,
5486
- token: this.token,
5487
- product_id,
5488
- env_type: this.environment,
5489
- app_id,
5490
- workspace_private_key: (_a = this._privateKey) !== null && _a !== void 0 ? _a : undefined,
5491
- });
5543
+ return Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, access_key: this.accessKey, workspace_private_key: (_a = this._privateKey) !== null && _a !== void 0 ? _a : undefined, ip_address: this.clientIpAddress, language: this.clientLanguage }, extra);
5492
5544
  }
5493
5545
  async createNewProductBuilder() {
5494
5546
  const subCheck = false;
5495
5547
  await this.initUserAuth(subCheck);
5496
- return new products_service_1.default({
5497
- workspace_id: this.workspace_id,
5498
- public_key: this.public_key,
5499
- user_id: this.user_id,
5500
- token: this.token,
5501
- env_type: this.environment,
5502
- access_key: this.accessKey,
5503
- });
5548
+ return new products_service_1.default(this.builderInit());
5504
5549
  }
5505
5550
  async createNewProcessor() {
5506
5551
  const subCheck = false;
@@ -5509,41 +5554,17 @@ class Ductape {
5509
5554
  if (this.redis_url && !this.jobsQueue) {
5510
5555
  await this.monitor();
5511
5556
  }
5512
- return new processor_service_1.default({
5513
- workspace_id: this.workspace_id,
5514
- public_key: this.public_key,
5515
- user_id: this.user_id,
5516
- token: this.token,
5517
- env_type: this.environment,
5518
- redis_client: this.redisClient,
5519
- queues: { health: this.healthCheckQueue, jobs: this.jobsQueue },
5520
- access_key: this.accessKey,
5521
- private_key: this._privateKey,
5522
- });
5557
+ return new processor_service_1.default(Object.assign(Object.assign({}, this.builderInit()), { redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey }));
5523
5558
  }
5524
5559
  async createNewImporter() {
5525
5560
  const subCheck = false;
5526
5561
  await this.initUserAuth(subCheck);
5527
- return new imports_service_1.default({
5528
- workspace_id: this.workspace_id,
5529
- public_key: this.public_key,
5530
- user_id: this.user_id,
5531
- token: this.token,
5532
- env_type: this.environment,
5533
- access_key: this.accessKey,
5534
- });
5562
+ return new imports_service_1.default(this.builderInit());
5535
5563
  }
5536
5564
  async createNewAppBuilder() {
5537
5565
  const subCheck = false;
5538
5566
  await this.initUserAuth(subCheck);
5539
- return new app_service_1.default({
5540
- workspace_id: this.workspace_id,
5541
- public_key: this.public_key,
5542
- user_id: this.user_id,
5543
- token: this.token,
5544
- env_type: this.environment,
5545
- access_key: this.accessKey,
5546
- });
5567
+ return new app_service_1.default(this.builderInit());
5547
5568
  }
5548
5569
  /**
5549
5570
  * Create a new DatabaseService instance with authenticated config
@@ -5560,7 +5581,7 @@ class Ductape {
5560
5581
  await this.connectCacheRedis();
5561
5582
  // Return cached instance if available, otherwise create new
5562
5583
  if (!this._databaseService) {
5563
- this._databaseService = new database_1.DatabaseService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, private_key: this._privateKey, access_key: this.accessKey, redis_client: this.redisClient }, this.runtimeDefaultsForServices()));
5584
+ this._databaseService = new database_1.DatabaseService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { private_key: this._privateKey, redis_client: this.redisClient }), this.runtimeDefaultsForServices()));
5564
5585
  }
5565
5586
  return this._databaseService;
5566
5587
  }
@@ -5576,7 +5597,7 @@ class Ductape {
5576
5597
  // Connect to Redis for caching (if configured)
5577
5598
  await this.connectCacheRedis();
5578
5599
  if (!this._graphService) {
5579
- this._graphService = new graph_1.GraphService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, private_key: this._privateKey, access_key: this.accessKey, redis_client: this.redisClient }, this.runtimeDefaultsForServices()));
5600
+ this._graphService = new graph_1.GraphService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { private_key: this._privateKey, redis_client: this.redisClient }), this.runtimeDefaultsForServices()));
5580
5601
  }
5581
5602
  return this._graphService;
5582
5603
  }
@@ -5590,15 +5611,7 @@ class Ductape {
5590
5611
  // Ensure secrets service is initialized so workflow steps can resolve $Secret{...} / $secret{...} in configs (broker, storage, etc.)
5591
5612
  await this.createNewSecretsService();
5592
5613
  if (!this._workflowService) {
5593
- this._workflowService = new workflows_1.WorkflowService({
5594
- workspace_id: this.workspace_id,
5595
- public_key: this.public_key,
5596
- user_id: this.user_id,
5597
- token: this.token,
5598
- env_type: this.environment,
5599
- private_key: this._privateKey,
5600
- access_key: this.accessKey,
5601
- });
5614
+ this._workflowService = new workflows_1.WorkflowService(Object.assign(Object.assign({}, this.builderInit()), { private_key: this._privateKey }));
5602
5615
  }
5603
5616
  return this._workflowService;
5604
5617
  }
@@ -5612,16 +5625,7 @@ class Ductape {
5612
5625
  // Ensure secrets service is initialized for secret storage/resolution
5613
5626
  await this.createNewSecretsService();
5614
5627
  if (!this._agentsService) {
5615
- this._agentsService = new agents_1.AgentsService({
5616
- workspace_id: this.workspace_id,
5617
- public_key: this.public_key,
5618
- user_id: this.user_id,
5619
- token: this.token,
5620
- env_type: this.environment,
5621
- redis_client: this.redisClient,
5622
- private_key: this._privateKey,
5623
- access_key: this.accessKey,
5624
- });
5628
+ this._agentsService = new agents_1.AgentsService(Object.assign(Object.assign({}, this.builderInit()), { redis_client: this.redisClient, private_key: this._privateKey }));
5625
5629
  }
5626
5630
  return this._agentsService;
5627
5631
  }
@@ -5633,11 +5637,7 @@ class Ductape {
5633
5637
  const subCheck = false;
5634
5638
  await this.initUserAuth(subCheck);
5635
5639
  if (!this._modelService) {
5636
- this._modelService = new models_1.ModelService({
5637
- workspace_id: this.workspace_id,
5638
- user_id: this.user_id,
5639
- env_type: this.environment,
5640
- }, this.getProductBuilder.bind(this));
5640
+ this._modelService = new models_1.ModelService(Object.assign({}, this.builderInit()), this.getProductBuilder.bind(this));
5641
5641
  }
5642
5642
  return this._modelService;
5643
5643
  }
@@ -5653,7 +5653,7 @@ class Ductape {
5653
5653
  // Connect to Redis for caching (if configured)
5654
5654
  await this.connectCacheRedis();
5655
5655
  if (!this._vectorService) {
5656
- this._vectorService = new vector_1.VectorDatabaseService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, private_key: this._privateKey, access_key: this.accessKey, redis_client: this.redisClient }, this.runtimeDefaultsForServices()));
5656
+ this._vectorService = new vector_1.VectorDatabaseService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { private_key: this._privateKey, redis_client: this.redisClient }), this.runtimeDefaultsForServices()));
5657
5657
  }
5658
5658
  return this._vectorService;
5659
5659
  }
@@ -5684,11 +5684,10 @@ class Ductape {
5684
5684
  * @returns CacheService instance
5685
5685
  */
5686
5686
  async createNewCacheService() {
5687
- var _a;
5688
5687
  const subCheck = false;
5689
5688
  await this.initUserAuth(subCheck);
5690
5689
  if (!this._cacheService) {
5691
- this._cacheService = new cache_1.CacheService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, access_key: this.accessKey, workspace_private_key: (_a = this._privateKey) !== null && _a !== void 0 ? _a : undefined }, this.runtimeDefaultsForServices()));
5690
+ this._cacheService = new cache_1.CacheService(Object.assign(Object.assign({}, this.builderInit()), this.runtimeDefaultsForServices()));
5692
5691
  }
5693
5692
  return this._cacheService;
5694
5693
  }
@@ -5778,10 +5777,12 @@ class Ductape {
5778
5777
  * @returns SessionsService instance
5779
5778
  */
5780
5779
  async createNewSessionsService() {
5781
- var _a;
5782
5780
  const subCheck = false;
5783
5781
  await this.initUserAuth(subCheck);
5784
- return new sessions_1.SessionsService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, access_key: this.accessKey, redis_client: this.redisClient, workspace_private_key: (_a = this._privateKey) !== null && _a !== void 0 ? _a : undefined }, this.runtimeDefaultsForServices()));
5782
+ if (!this._sessionsService) {
5783
+ this._sessionsService = new sessions_1.SessionsService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { redis_client: this.redisClient }), this.runtimeDefaultsForServices()));
5784
+ }
5785
+ return this._sessionsService;
5785
5786
  }
5786
5787
  /**
5787
5788
  * Create a new StorageService instance with authenticated config
@@ -5794,14 +5795,13 @@ class Ductape {
5794
5795
  await this.createNewSecretsService();
5795
5796
  // Connect to Redis for caching (if configured)
5796
5797
  await this.connectCacheRedis();
5797
- return new storage_1.StorageService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, private_key: this._privateKey, redis_client: this.redisClient }, this.runtimeDefaultsForServices()));
5798
+ return new storage_1.StorageService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { private_key: this._privateKey, redis_client: this.redisClient }), this.runtimeDefaultsForServices()));
5798
5799
  }
5799
5800
  /**
5800
5801
  * Get or create a BrokersService instance with authenticated config (cached)
5801
5802
  * @returns BrokersService instance
5802
5803
  */
5803
5804
  async createNewBrokersService() {
5804
- var _a;
5805
5805
  // Return cached instance if available
5806
5806
  if (this._brokersService) {
5807
5807
  return this._brokersService;
@@ -5810,15 +5810,7 @@ class Ductape {
5810
5810
  await this.initUserAuth(subCheck);
5811
5811
  // Ensure secrets service is initialized for secret storage/resolution
5812
5812
  await this.createNewSecretsService();
5813
- this._brokersService = new brokers_1.BrokersService({
5814
- workspace_id: this.workspace_id,
5815
- public_key: this.public_key,
5816
- user_id: this.user_id,
5817
- token: this.token,
5818
- env_type: this.environment,
5819
- access_key: this.accessKey,
5820
- workspace_private_key: (_a = this._privateKey) !== null && _a !== void 0 ? _a : undefined,
5821
- });
5813
+ this._brokersService = new brokers_1.BrokersService(this.builderInit());
5822
5814
  return this._brokersService;
5823
5815
  }
5824
5816
  /**
@@ -5829,7 +5821,7 @@ class Ductape {
5829
5821
  const subCheck = false;
5830
5822
  await this.initUserAuth(subCheck);
5831
5823
  if (!this._quotaService) {
5832
- this._quotaService = new resilience_1.QuotaService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey, access_key: this.accessKey }, this.runtimeDefaultsForServices()));
5824
+ this._quotaService = new resilience_1.QuotaService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey }), this.runtimeDefaultsForServices()));
5833
5825
  }
5834
5826
  return this._quotaService;
5835
5827
  }
@@ -5841,7 +5833,7 @@ class Ductape {
5841
5833
  const subCheck = false;
5842
5834
  await this.initUserAuth(subCheck);
5843
5835
  if (!this._fallbackService) {
5844
- this._fallbackService = new resilience_1.FallbackService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey, access_key: this.accessKey }, this.runtimeDefaultsForServices()));
5836
+ this._fallbackService = new resilience_1.FallbackService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey }), this.runtimeDefaultsForServices()));
5845
5837
  }
5846
5838
  return this._fallbackService;
5847
5839
  }
@@ -5856,7 +5848,7 @@ class Ductape {
5856
5848
  // (DatabaseService, StorageService, WorkflowService, etc.) can resolve $secret{...}
5857
5849
  await this.createNewSecretsService();
5858
5850
  if (!this._healthcheckService) {
5859
- this._healthcheckService = new resilience_1.HealthcheckService(Object.assign({ workspace_id: this.workspace_id, public_key: this.public_key, user_id: this.user_id, token: this.token, env_type: this.environment, redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey, access_key: this.accessKey }, this.runtimeDefaultsForServices()));
5851
+ this._healthcheckService = new resilience_1.HealthcheckService(Object.assign(Object.assign(Object.assign({}, this.builderInit()), { redis_client: this.redisClient, queues: { health: this.healthCheckQueue, jobs: this.jobsQueue }, private_key: this._privateKey }), this.runtimeDefaultsForServices()));
5860
5852
  }
5861
5853
  return this._healthcheckService;
5862
5854
  }