@ductape/sdk 0.2.10 → 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.
@@ -388,9 +388,9 @@ export default class ProcessorService implements IProcessorService {
388
388
  runBrokerPublish(data: IStepEvent, additional_logs?: Partial<ILogData>): Promise<{
389
389
  published: boolean;
390
390
  }>;
391
- processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<IProcessingFailure | {
391
+ processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<{
392
392
  url: string;
393
- }>;
393
+ } | IProcessingFailure>;
394
394
  writeResult(status: LogEventStatus, retryable?: boolean): Promise<void>;
395
395
  /**
396
396
  * Separate credentials into prefixed (e.g., 'headers:Authorization') and non-prefixed (e.g., 'api_key').
@@ -4803,7 +4803,7 @@ class ProcessorService {
4803
4803
  }
4804
4804
  }
4805
4805
  async processAction(action) {
4806
- var _a, _b, _c;
4806
+ var _a, _b, _c, _d, _e, _f;
4807
4807
  await create_productFeature_validator_1.ActionProcessorInputSchema.validateAsync(action, { abortEarly: true }).catch((err) => {
4808
4808
  var _a, _b, _c, _d;
4809
4809
  throw new Error((_d = (_c = (_b = (_a = err.details) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : err.message) !== null && _d !== void 0 ? _d : 'Invalid action input');
@@ -4900,7 +4900,7 @@ class ProcessorService {
4900
4900
  try {
4901
4901
  this.productBuilderService.fetchPrivateKey();
4902
4902
  }
4903
- catch (_d) {
4903
+ catch (_g) {
4904
4904
  await this.productBuilderService.initializeProductByTag(product_tag);
4905
4905
  }
4906
4906
  }
@@ -4930,6 +4930,38 @@ class ProcessorService {
4930
4930
  // Every action entry point (direct, Feature, Quota, Fallback, Healthcheck)
4931
4931
  // converges here, so connection credentials are resolved once for all of them.
4932
4932
  const allCredentials = {};
4933
+ const connectionMapping = bootstrapData.product_env_mapping;
4934
+ for (const variable of (_d = connectionMapping === null || connectionMapping === void 0 ? void 0 : connectionMapping.variables) !== null && _d !== void 0 ? _d : []) {
4935
+ if ((variable === null || variable === void 0 ? void 0 : variable.key) && variable.value !== undefined) {
4936
+ allCredentials[String(variable.key)] = variable.value;
4937
+ }
4938
+ }
4939
+ if ((connectionMapping === null || connectionMapping === void 0 ? void 0 : connectionMapping.credentials) && typeof connectionMapping.credentials === 'object') {
4940
+ Object.assign(allCredentials, connectionMapping.credentials);
4941
+ }
4942
+ // Token-access auth is already the reusable request credential. Resolve it lazily just
4943
+ // like Workbench shared configuration; credential-access login secrets stay isolated.
4944
+ if (((_e = bootstrapData.app_auth) === null || _e === void 0 ? void 0 : _e.setup_type) === 'token_access' && ((_f = connectionMapping === null || connectionMapping === void 0 ? void 0 : connectionMapping.auth) === null || _f === void 0 ? void 0 : _f.data)) {
4945
+ let authData = connectionMapping.auth.data;
4946
+ if (typeof authData === 'string') {
4947
+ try {
4948
+ authData = JSON.parse((0, processor_utils_1.decrypt)(authData, String(bootstrapData.private_key)));
4949
+ }
4950
+ catch (_h) {
4951
+ authData = undefined;
4952
+ }
4953
+ }
4954
+ if (authData && typeof authData === 'object') {
4955
+ for (const location of ['headers', 'query', 'params', 'body']) {
4956
+ const values = authData[location];
4957
+ if (!values || typeof values !== 'object' || Array.isArray(values))
4958
+ continue;
4959
+ for (const [key, value] of Object.entries(values)) {
4960
+ allCredentials[`${location}:${key}`] = value;
4961
+ }
4962
+ }
4963
+ }
4964
+ }
4933
4965
  const sharedCredentials = credential_manager_1.credentialManager.get({ product: product_tag, app, env });
4934
4966
  if (sharedCredentials)
4935
4967
  Object.assign(allCredentials, sharedCredentials);