@punks/backend-entity-manager 0.0.310 → 0.0.311

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/cjs/index.js CHANGED
@@ -40246,18 +40246,20 @@ const mapJobStatus = (awsJobStatus) => {
40246
40246
  return exports.JobProviderState.Completed;
40247
40247
  }
40248
40248
  };
40249
+ const replacePayload = (command, payload) => command.replaceAll("$(payload)", JSON.stringify(payload ?? {}));
40250
+ const replacePlaceholders = (command, placeholders) => Object.entries(placeholders ?? {}).reduce((acc, [key, value]) => acc.replaceAll(`$(${key})`, value), command);
40249
40251
  let AwsJobsProvider = class AwsJobsProvider {
40250
40252
  constructor(awsBatchService) {
40251
40253
  this.awsBatchService = awsBatchService;
40252
40254
  }
40253
40255
  async dispatch(input) {
40254
- const { definition, schedule, instanceId, payload } = input;
40256
+ const { definition, schedule, instanceId, payload, commandPlaceholders } = input;
40255
40257
  const awsInvocationParams = schedule?.invocationOverrides;
40256
40258
  await this.awsBatchService.submitJob({
40257
40259
  instanceId,
40258
40260
  jobUid: definition.uid,
40259
40261
  overrides: {
40260
- command: awsInvocationParams?.startCommand?.map((x) => x.replace("{payload}", JSON.stringify(payload ?? {}))),
40262
+ command: awsInvocationParams?.startCommand?.map((x) => replacePlaceholders(replacePayload(x, payload), commandPlaceholders)),
40261
40263
  },
40262
40264
  });
40263
40265
  }