@punks/backend-entity-manager 0.0.310 → 0.0.312
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 +7 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/jobs/abstractions/runner.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/jobs/commands/job-dispatch/command.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/extensions/jobs/services/jobs-service/types.d.ts +1 -0
- package/dist/esm/index.js +7 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/jobs/abstractions/runner.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/jobs/commands/job-dispatch/command.d.ts +1 -0
- package/dist/esm/types/platforms/nest/extensions/jobs/services/jobs-service/types.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -33878,6 +33878,7 @@ exports.JobsService = class JobsService {
|
|
|
33878
33878
|
schedule,
|
|
33879
33879
|
runType: exports.JobRunType.OnDemand,
|
|
33880
33880
|
payload: input.payload,
|
|
33881
|
+
commandPlaceholders: input.commandPlaceholders,
|
|
33881
33882
|
}));
|
|
33882
33883
|
};
|
|
33883
33884
|
this.updateJob = async (input) => {
|
|
@@ -33978,7 +33979,7 @@ let JobDispatchHandler = JobDispatchHandler_1 = class JobDispatchHandler {
|
|
|
33978
33979
|
return result.result;
|
|
33979
33980
|
}
|
|
33980
33981
|
async dispatchJob(command) {
|
|
33981
|
-
const { input: { job, schedule, runType, payload }, } = command;
|
|
33982
|
+
const { input: { job, schedule, runType, payload, commandPlaceholders }, } = command;
|
|
33982
33983
|
const instanceId = backendCore.newUuid();
|
|
33983
33984
|
try {
|
|
33984
33985
|
this.logger.info(`JOB DISPATCH -> dispatching started job ${job.uid} -> ${instanceId}`);
|
|
@@ -33993,6 +33994,7 @@ let JobDispatchHandler = JobDispatchHandler_1 = class JobDispatchHandler {
|
|
|
33993
33994
|
schedule,
|
|
33994
33995
|
instanceId,
|
|
33995
33996
|
payload,
|
|
33997
|
+
commandPlaceholders,
|
|
33996
33998
|
});
|
|
33997
33999
|
await this.instances.updateInstance(instanceId, {
|
|
33998
34000
|
status: exports.JobStatus.Ready,
|
|
@@ -40246,18 +40248,20 @@ const mapJobStatus = (awsJobStatus) => {
|
|
|
40246
40248
|
return exports.JobProviderState.Completed;
|
|
40247
40249
|
}
|
|
40248
40250
|
};
|
|
40251
|
+
const replacePayload = (command, payload) => command.replaceAll("$(payload)", JSON.stringify(payload ?? {}));
|
|
40252
|
+
const replacePlaceholders = (command, placeholders) => Object.entries(placeholders ?? {}).reduce((acc, [key, value]) => acc.replaceAll(`$(${key})`, value), command);
|
|
40249
40253
|
let AwsJobsProvider = class AwsJobsProvider {
|
|
40250
40254
|
constructor(awsBatchService) {
|
|
40251
40255
|
this.awsBatchService = awsBatchService;
|
|
40252
40256
|
}
|
|
40253
40257
|
async dispatch(input) {
|
|
40254
|
-
const { definition, schedule, instanceId, payload } = input;
|
|
40258
|
+
const { definition, schedule, instanceId, payload, commandPlaceholders } = input;
|
|
40255
40259
|
const awsInvocationParams = schedule?.invocationOverrides;
|
|
40256
40260
|
await this.awsBatchService.submitJob({
|
|
40257
40261
|
instanceId,
|
|
40258
40262
|
jobUid: definition.uid,
|
|
40259
40263
|
overrides: {
|
|
40260
|
-
command: awsInvocationParams?.startCommand?.map((x) => x
|
|
40264
|
+
command: awsInvocationParams?.startCommand?.map((x) => replacePlaceholders(replacePayload(x, payload), commandPlaceholders)),
|
|
40261
40265
|
},
|
|
40262
40266
|
});
|
|
40263
40267
|
}
|