@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 +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/jobs/abstractions/runner.d.ts +1 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/jobs/abstractions/runner.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -40231,18 +40231,20 @@ const mapJobStatus = (awsJobStatus) => {
|
|
|
40231
40231
|
return JobProviderState.Completed;
|
|
40232
40232
|
}
|
|
40233
40233
|
};
|
|
40234
|
+
const replacePayload = (command, payload) => command.replaceAll("$(payload)", JSON.stringify(payload ?? {}));
|
|
40235
|
+
const replacePlaceholders = (command, placeholders) => Object.entries(placeholders ?? {}).reduce((acc, [key, value]) => acc.replaceAll(`$(${key})`, value), command);
|
|
40234
40236
|
let AwsJobsProvider = class AwsJobsProvider {
|
|
40235
40237
|
constructor(awsBatchService) {
|
|
40236
40238
|
this.awsBatchService = awsBatchService;
|
|
40237
40239
|
}
|
|
40238
40240
|
async dispatch(input) {
|
|
40239
|
-
const { definition, schedule, instanceId, payload } = input;
|
|
40241
|
+
const { definition, schedule, instanceId, payload, commandPlaceholders } = input;
|
|
40240
40242
|
const awsInvocationParams = schedule?.invocationOverrides;
|
|
40241
40243
|
await this.awsBatchService.submitJob({
|
|
40242
40244
|
instanceId,
|
|
40243
40245
|
jobUid: definition.uid,
|
|
40244
40246
|
overrides: {
|
|
40245
|
-
command: awsInvocationParams?.startCommand?.map((x) => x
|
|
40247
|
+
command: awsInvocationParams?.startCommand?.map((x) => replacePlaceholders(replacePayload(x, payload), commandPlaceholders)),
|
|
40246
40248
|
},
|
|
40247
40249
|
});
|
|
40248
40250
|
}
|