@ductape/sdk 0.2.9 → 0.2.11

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 (39) hide show
  1. package/dist/api/services/processorApi.service.d.ts +4 -0
  2. package/dist/api/services/processorApi.service.js +13 -0
  3. package/dist/api/services/processorApi.service.js.map +1 -1
  4. package/dist/api/services/productsApi.service.d.ts +8 -0
  5. package/dist/api/services/productsApi.service.js.map +1 -1
  6. package/dist/features/feature-executor.js +3 -17
  7. package/dist/features/feature-executor.js.map +1 -1
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +28 -7
  10. package/dist/index.js.map +1 -1
  11. package/dist/logs/logs.service.d.ts +3 -0
  12. package/dist/logs/logs.service.js +21 -0
  13. package/dist/logs/logs.service.js.map +1 -1
  14. package/dist/processor/services/processor.service.d.ts +5 -0
  15. package/dist/processor/services/processor.service.js +58 -3
  16. package/dist/processor/services/processor.service.js.map +1 -1
  17. package/dist/products/services/products.service.js +2 -2
  18. package/dist/products/services/products.service.js.map +1 -1
  19. package/dist/resilience/fallback.service.d.ts +2 -4
  20. package/dist/resilience/fallback.service.js +56 -65
  21. package/dist/resilience/fallback.service.js.map +1 -1
  22. package/dist/resilience/health-status-cache.d.ts +11 -0
  23. package/dist/resilience/health-status-cache.js +46 -0
  24. package/dist/resilience/health-status-cache.js.map +1 -0
  25. package/dist/resilience/healthcheck.service.js +1 -1
  26. package/dist/resilience/healthcheck.service.js.map +1 -1
  27. package/dist/resilience/quota.service.d.ts +3 -5
  28. package/dist/resilience/quota.service.js +82 -62
  29. package/dist/resilience/quota.service.js.map +1 -1
  30. package/dist/resilience/resilience.service.js +6 -2
  31. package/dist/resilience/resilience.service.js.map +1 -1
  32. package/dist/resilience/types/index.d.ts +8 -0
  33. package/dist/runtime/resilient-write-queue.d.ts +18 -0
  34. package/dist/runtime/resilient-write-queue.js +74 -0
  35. package/dist/runtime/resilient-write-queue.js.map +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/dist/types/productsBuilder.types.d.ts +2 -0
  38. package/dist/types/productsBuilder.types.js.map +1 -1
  39. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -67,6 +67,7 @@ const healthcheck_cache_key_1 = require("./resilience/healthcheck-cache-key");
67
67
  const enums_1 = require("./types/enums");
68
68
  const productsApi_service_1 = require("./api/services/productsApi.service");
69
69
  const bootstrap_cache_1 = require("./products/bootstrap-cache");
70
+ const health_status_cache_1 = require("./resilience/health-status-cache");
70
71
  const imports_service_1 = __importDefault(require("./imports/imports.service"));
71
72
  const processor_service_1 = __importDefault(require("./processor/services/processor.service"));
72
73
  const processor_utils_1 = require("./processor/utils/processor.utils");
@@ -5810,6 +5811,11 @@ class Ductape {
5810
5811
  const previousManifest = this.runtimeManifest;
5811
5812
  const scope = `${this.workspace_id}:${response.snapshot.product_tag}:${response.snapshot.env_slug}`;
5812
5813
  (0, bootstrap_cache_1.primeRuntimeBootstrapCache)(this.workspace_id, scope, response.snapshot.entries);
5814
+ const healthchecks = response.snapshot.entries
5815
+ .filter((entry) => { var _a; return (entry === null || entry === void 0 ? void 0 : entry.domain) === 'resilience' && ((_a = entry === null || entry === void 0 ? void 0 : entry.parts) === null || _a === void 0 ? void 0 : _a[2]) === 'healthcheck'; })
5816
+ .map((entry) => { var _a; return (_a = entry === null || entry === void 0 ? void 0 : entry.data) === null || _a === void 0 ? void 0 : _a.component; })
5817
+ .filter(Boolean);
5818
+ (0, health_status_cache_1.primeRuntimeHealthSnapshot)(this.workspace_id, response.snapshot.product_tag, response.snapshot.env_slug, healthchecks);
5813
5819
  this.runtimeManifest = response.manifest;
5814
5820
  const derivedReferences = (0, secrets_1.findAllSecretReferences)(response.snapshot.entries.map((entry) => entry.data)).sort();
5815
5821
  this.runtimeCredentialBundle = response.snapshot.credentials
@@ -5938,10 +5944,23 @@ class Ductape {
5938
5944
  product_tag: this.defaultProduct,
5939
5945
  env_slug: this.defaultEnv,
5940
5946
  manifest_only: true,
5941
- etag: (_a = this.runtimeManifest) === null || _a === void 0 ? void 0 : _a.runtimeRevision,
5947
+ etag: this.runtimeManifest
5948
+ ? `${this.runtimeManifest.runtimeRevision}:${this.runtimeManifest.healthRevision}`
5949
+ : undefined,
5942
5950
  }, this.runtimeAuth());
5943
- if (manifestResponse && manifestResponse.manifest.runtimeRevision !== ((_b = this.runtimeManifest) === null || _b === void 0 ? void 0 : _b.runtimeRevision)) {
5944
- await this.refreshRuntimeSnapshot(true);
5951
+ const runtimeChanged = (manifestResponse === null || manifestResponse === void 0 ? void 0 : manifestResponse.manifest.runtimeRevision) !== ((_a = this.runtimeManifest) === null || _a === void 0 ? void 0 : _a.runtimeRevision);
5952
+ const healthChanged = (manifestResponse === null || manifestResponse === void 0 ? void 0 : manifestResponse.manifest.healthRevision) !== ((_b = this.runtimeManifest) === null || _b === void 0 ? void 0 : _b.healthRevision);
5953
+ if (manifestResponse && (runtimeChanged || healthChanged)) {
5954
+ const previous = this.runtimeManifest;
5955
+ const next = manifestResponse.manifest;
5956
+ const healthOnly = Boolean(previous) && !runtimeChanged && healthChanged;
5957
+ if (healthOnly && manifestResponse.health) {
5958
+ (0, health_status_cache_1.primeRuntimeHealthSnapshot)(this.workspace_id, manifestResponse.health.product_tag, manifestResponse.health.env_slug, manifestResponse.health.healthchecks);
5959
+ this.runtimeManifest = next;
5960
+ }
5961
+ else {
5962
+ await this.refreshRuntimeSnapshot(true);
5963
+ }
5945
5964
  }
5946
5965
  else if (this.defaultProduct && this.defaultEnv) {
5947
5966
  (0, bootstrap_cache_1.touchRuntimeBootstrapCache)(`${this.workspace_id}:${this.defaultProduct}:${this.defaultEnv}`);
@@ -5963,8 +5982,9 @@ class Ductape {
5963
5982
  if (this.runtimeRefreshInFlight)
5964
5983
  return await this.runtimeRefreshInFlight;
5965
5984
  this.runtimeRefreshInFlight = (async () => {
5966
- var _a;
5967
- const response = await this.productsApi.bootstrapRuntime(Object.assign({ product_tag: this.defaultProduct, env_slug: this.defaultEnv }, (force ? {} : { etag: (_a = this.runtimeManifest) === null || _a === void 0 ? void 0 : _a.runtimeRevision })), this.runtimeAuth());
5985
+ const response = await this.productsApi.bootstrapRuntime(Object.assign({ product_tag: this.defaultProduct, env_slug: this.defaultEnv }, (force || !this.runtimeManifest ? {} : {
5986
+ etag: `${this.runtimeManifest.runtimeRevision}:${this.runtimeManifest.healthRevision}`,
5987
+ })), this.runtimeAuth());
5968
5988
  if (response) {
5969
5989
  this.applyRuntimeSnapshot(response);
5970
5990
  const secrets = await this.createNewSecretsService();
@@ -6287,9 +6307,10 @@ class Ductape {
6287
6307
  }),
6288
6308
  getPrivateKey: () => this._privateKey,
6289
6309
  });
6290
- // Set the global instance for use by other services (e.g., database, storage)
6291
- (0, secrets_1.setSecretsService)(this._secretsService);
6292
6310
  }
6311
+ // Activate this Ductape instance's resolver on every use. Long-lived workers may cache
6312
+ // clients for several workspaces, while processors consume the current resolver globally.
6313
+ (0, secrets_1.setSecretsService)(this._secretsService);
6293
6314
  this.applyRuntimeCredentialBundle(this._secretsService);
6294
6315
  return this._secretsService;
6295
6316
  }