@ductape/sdk 0.1.155 → 0.1.157

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.
@@ -384,9 +384,9 @@ export default class ProcessorService implements IProcessorService {
384
384
  runBrokerPublish(data: IStepEvent, additional_logs?: Partial<ILogData>): Promise<{
385
385
  published: boolean;
386
386
  }>;
387
- processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<{
387
+ processStorageRequest(data: IStepEvent, input: IStorageRequest, storageEnv: IProductStorageEnvs, additional_logs: Partial<ILogData>, decryptionKey?: string): Promise<IProcessingFailure | {
388
388
  url: string;
389
- } | IProcessingFailure>;
389
+ }>;
390
390
  writeResult(status: LogEventStatus, retryable?: boolean): Promise<void>;
391
391
  /**
392
392
  * Separate credentials into prefixed (e.g., 'headers:Authorization') and non-prefixed (e.g., 'api_key').
@@ -4910,29 +4910,23 @@ class ProcessorService {
4910
4910
  // Resolve flat input to structured format using action schema
4911
4911
  // This must happen AFTER bootstrap when we have the action schema
4912
4912
  if (bootstrapData.action && input && typeof input === 'object') {
4913
+ // Every action entry point (direct, Feature, Quota, Fallback, Healthcheck)
4914
+ // converges here, so connection credentials are resolved once for all of them.
4915
+ const allCredentials = {};
4916
+ const sharedCredentials = credential_manager_1.credentialManager.get({ product: product_tag, app, env });
4917
+ if (sharedCredentials)
4918
+ Object.assign(allCredentials, sharedCredentials);
4919
+ if (product_tag && oauth_manager_1.oauthManager.has(product_tag, app, env)) {
4920
+ const oauthCredentials = await oauth_manager_1.oauthManager.getCredentials(product_tag, app, env);
4921
+ if (oauthCredentials)
4922
+ Object.assign(allCredentials, oauthCredentials);
4923
+ }
4924
+ const { prefixed, nonPrefixed } = this.separateCredentials(allCredentials);
4925
+ const inputResolver = new utils_1.InputResolver();
4926
+ const locationMap = inputResolver.buildLocationMap(bootstrapData.action);
4913
4927
  if (!(0, utils_1.isStructuredInput)(input)) {
4914
4928
  // Flat input detected - resolve using action schema
4915
4929
  let flatInput = Object.assign({}, input);
4916
- // Gather all credentials (static + OAuth)
4917
- // Priority: user input > OAuth > static config
4918
- const allCredentials = {};
4919
- // Static credentials (lowest priority)
4920
- const sharedCredentials = credential_manager_1.credentialManager.get({ product: product_tag, app, env });
4921
- if (sharedCredentials) {
4922
- Object.assign(allCredentials, sharedCredentials);
4923
- }
4924
- // OAuth credentials (higher priority, overwrites static)
4925
- if (product_tag && oauth_manager_1.oauthManager.has(product_tag, app, env)) {
4926
- const oauthCredentials = await oauth_manager_1.oauthManager.getCredentials(product_tag, app, env);
4927
- if (oauthCredentials) {
4928
- Object.assign(allCredentials, oauthCredentials);
4929
- }
4930
- }
4931
- // Separate credentials into prefixed and non-prefixed
4932
- const { prefixed, nonPrefixed } = this.separateCredentials(allCredentials);
4933
- const inputResolver = new utils_1.InputResolver();
4934
- // Build location map to check which keys exist in the schema
4935
- const locationMap = inputResolver.buildLocationMap(bootstrapData.action);
4936
4930
  // Merge non-prefixed credentials into flatInput BEFORE resolution
4937
4931
  // Only include credentials that exist in the action schema
4938
4932
  // User input takes precedence over credentials
@@ -4964,6 +4958,13 @@ class ProcessorService {
4964
4958
  else {
4965
4959
  // Already structured - validate with existing schema
4966
4960
  await this.validateActionDataMappingInput(input, types_1.StepEventTypes.ACTION);
4961
+ const locatedCredentials = Object.assign({}, prefixed);
4962
+ for (const [key, value] of Object.entries(nonPrefixed)) {
4963
+ const locations = locationMap.keyToLocations.get(key);
4964
+ if ((locations === null || locations === void 0 ? void 0 : locations.length) === 1)
4965
+ locatedCredentials[`${locations[0]}:${key}`] = value;
4966
+ }
4967
+ resolvedInput = this.applyPrefixedCredentials(locatedCredentials, input, bootstrapData.action);
4967
4968
  }
4968
4969
  }
4969
4970
  else {