@punks/backend-entity-manager 0.0.472 → 0.0.473
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 +34 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/extensions/jobs/abstractions/runner.d.ts +2 -0
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/manager/converters.d.ts +4 -0
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/manager/types.d.ts +2 -0
- package/dist/esm/index.js +34 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/extensions/jobs/abstractions/runner.d.ts +2 -0
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/manager/converters.d.ts +4 -0
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/manager/types.d.ts +2 -0
- package/dist/index.d.ts +25 -22
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -41521,6 +41521,27 @@ const ensureJobLogGroup = async (logGroupName, awsSettings) => {
|
|
|
41521
41521
|
}
|
|
41522
41522
|
};
|
|
41523
41523
|
|
|
41524
|
+
const replaceVariablesInValue = (value, variables) => {
|
|
41525
|
+
// Example matches:
|
|
41526
|
+
// Input: "Hello ${name} and $(user)!" with variables {name: "World", user: "John"}
|
|
41527
|
+
// Output: "Hello World and John!"
|
|
41528
|
+
//
|
|
41529
|
+
// Input: "The ${animal} jumps over $(object)" with variables {animal: "fox", object: "fence"}
|
|
41530
|
+
// Output: "The fox jumps over fence"
|
|
41531
|
+
return value.replace(/[\$][\{\(]([^\}\)]+)[\}\)]/g, (match, p1) => variables[p1]);
|
|
41532
|
+
};
|
|
41533
|
+
const replaceVariable = (environmentValue, variables) => {
|
|
41534
|
+
return {
|
|
41535
|
+
name: environmentValue.name,
|
|
41536
|
+
value: environmentValue.value
|
|
41537
|
+
? replaceVariablesInValue(environmentValue.value, variables)
|
|
41538
|
+
: environmentValue.value,
|
|
41539
|
+
};
|
|
41540
|
+
};
|
|
41541
|
+
const replaceVariables = (environment, variables) => {
|
|
41542
|
+
return environment.map((e) => replaceVariable(e, variables));
|
|
41543
|
+
};
|
|
41544
|
+
|
|
41524
41545
|
var AwsBatchService_1;
|
|
41525
41546
|
const jobDefinitionName = (jobUid) => `${awsBatchSettings.value.batchResourcesPrefix}-job-${jobUid}`;
|
|
41526
41547
|
const jobInstanceName = (jobUid, instanceId) => `${awsBatchSettings.value.batchResourcesPrefix}-job-${jobUid}-${instanceId}`;
|
|
@@ -41587,14 +41608,18 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
41587
41608
|
jobQueue: queue.jobQueueArn,
|
|
41588
41609
|
jobDefinition: jobDefinition.jobDefinitionArn,
|
|
41589
41610
|
jobName,
|
|
41590
|
-
|
|
41591
|
-
|
|
41592
|
-
|
|
41611
|
+
containerOverrides: {
|
|
41612
|
+
...(input.overrides?.command ||
|
|
41613
|
+
jobDefinition.containerProperties?.command
|
|
41614
|
+
? {
|
|
41593
41615
|
command: input.overrides?.command ??
|
|
41594
41616
|
jobDefinition.containerProperties.command,
|
|
41595
|
-
}
|
|
41596
|
-
|
|
41597
|
-
:
|
|
41617
|
+
}
|
|
41618
|
+
: {}),
|
|
41619
|
+
environment: jobDefinition.containerProperties?.environment && input.variables
|
|
41620
|
+
? replaceVariables(jobDefinition.containerProperties.environment, input.variables)
|
|
41621
|
+
: jobDefinition.containerProperties?.environment ?? [],
|
|
41622
|
+
},
|
|
41598
41623
|
};
|
|
41599
41624
|
this.logger.info(`AWS JOB -> invoking job ${jobName} ${queue.jobQueueArn}`, {
|
|
41600
41625
|
request: submitJobRequest,
|
|
@@ -41726,6 +41751,8 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
41726
41751
|
});
|
|
41727
41752
|
await this.updateQueue(queueName, options);
|
|
41728
41753
|
this.logger.debug(`AWS JOB -> queue updated ${queueName}`);
|
|
41754
|
+
// Wait for the queue to be active
|
|
41755
|
+
await backendCore.sleep(10000);
|
|
41729
41756
|
const updatedQueue = await this.getQueue(queueName);
|
|
41730
41757
|
if (!updatedQueue) {
|
|
41731
41758
|
throw new Error(`Queue not updated -> ${queueName}`);
|
|
@@ -41824,6 +41851,7 @@ let AwsJobsProvider = class AwsJobsProvider {
|
|
|
41824
41851
|
command: awsInvocationParams.startCommand?.map((x) => replacePlaceholders(replacePayload(x, payload), commandPlaceholders)),
|
|
41825
41852
|
batchComputeEnvironment: awsInfrastructureParams.batchComputeEnvironment,
|
|
41826
41853
|
},
|
|
41854
|
+
variables: input.variables,
|
|
41827
41855
|
});
|
|
41828
41856
|
}
|
|
41829
41857
|
async upsertJobDefinition(input) {
|