@punks/backend-entity-manager 0.0.300 → 0.0.301
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 +42 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/manager/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/models/index.d.ts +1 -0
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/utils/logs.d.ts +2 -0
- package/dist/esm/index.js +42 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/manager/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/models/index.d.ts +1 -0
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/utils/logs.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/package.json +13 -11
package/dist/cjs/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
|
|
|
22
22
|
var clientSes = require('@aws-sdk/client-ses');
|
|
23
23
|
var mail = require('@sendgrid/mail');
|
|
24
24
|
var clientBatch = require('@aws-sdk/client-batch');
|
|
25
|
+
var clientCloudwatchLogs = require('@aws-sdk/client-cloudwatch-logs');
|
|
25
26
|
var require$$1$1 = require('http');
|
|
26
27
|
var require$$2 = require('https');
|
|
27
28
|
var require$$0$1 = require('url');
|
|
@@ -39988,6 +39989,28 @@ const awsBatchSettings = new AppInMemorySettings();
|
|
|
39988
39989
|
|
|
39989
39990
|
const JobProvider = (provider) => common.SetMetadata(JOB_PROVIDER, provider);
|
|
39990
39991
|
|
|
39992
|
+
const ensureJobLogGroup = async (logGroupName, awsSettings) => {
|
|
39993
|
+
const client = new clientCloudwatchLogs.CloudWatchLogsClient({
|
|
39994
|
+
...(awsSettings.awsSecretAccessKey && awsSettings.awsSecretAccessKey
|
|
39995
|
+
? {
|
|
39996
|
+
accessKeyId: awsSettings.awsSecretAccessKey,
|
|
39997
|
+
secretAccessKey: awsSettings.awsSecretAccessKey,
|
|
39998
|
+
}
|
|
39999
|
+
: {}),
|
|
40000
|
+
});
|
|
40001
|
+
const describeCommand = new clientCloudwatchLogs.DescribeLogGroupsCommand({
|
|
40002
|
+
logGroupNamePrefix: logGroupName,
|
|
40003
|
+
});
|
|
40004
|
+
const describeResponse = await client.send(describeCommand);
|
|
40005
|
+
const existingLogGroup = describeResponse.logGroups?.find((group) => group.logGroupName === logGroupName);
|
|
40006
|
+
if (!existingLogGroup) {
|
|
40007
|
+
const createCommand = new clientCloudwatchLogs.CreateLogGroupCommand({
|
|
40008
|
+
logGroupName,
|
|
40009
|
+
});
|
|
40010
|
+
await client.send(createCommand);
|
|
40011
|
+
}
|
|
40012
|
+
};
|
|
40013
|
+
|
|
39991
40014
|
var AwsBatchService_1;
|
|
39992
40015
|
const jobDefinitionName = (jobUid) => `job-${jobUid}`;
|
|
39993
40016
|
const jobInstanceName = (jobUid, instanceId) => `job-${jobUid}-${instanceId}`;
|
|
@@ -40081,7 +40104,16 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40081
40104
|
jobDefinition: jobDefinitionArn,
|
|
40082
40105
|
}));
|
|
40083
40106
|
}
|
|
40107
|
+
async ensureJobLogDriver(jobName, definition) { }
|
|
40084
40108
|
async registerJobDefinition(jobName, definition) {
|
|
40109
|
+
const logGroup = definition.infrastructureParams.logGroupName
|
|
40110
|
+
? {
|
|
40111
|
+
name: `/aws/batch/job-${definition.infrastructureParams.logGroupName}`,
|
|
40112
|
+
}
|
|
40113
|
+
: undefined;
|
|
40114
|
+
if (logGroup) {
|
|
40115
|
+
await ensureJobLogGroup(logGroup.name, this.awsSettings);
|
|
40116
|
+
}
|
|
40085
40117
|
await this.client().send(new clientBatch.RegisterJobDefinitionCommand({
|
|
40086
40118
|
jobDefinitionName: jobName,
|
|
40087
40119
|
type: clientBatch.JobDefinitionType.Container,
|
|
@@ -40115,6 +40147,16 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40115
40147
|
assignPublicIp: clientBatch.AssignPublicIp.ENABLED,
|
|
40116
40148
|
}
|
|
40117
40149
|
: undefined,
|
|
40150
|
+
logConfiguration: logGroup
|
|
40151
|
+
? {
|
|
40152
|
+
logDriver: "awslogs",
|
|
40153
|
+
options: {
|
|
40154
|
+
"awslogs-group": logGroup.name,
|
|
40155
|
+
"awslogs-region": await this.client().config.region(),
|
|
40156
|
+
"awslogs-stream-prefix": "ecs",
|
|
40157
|
+
},
|
|
40158
|
+
}
|
|
40159
|
+
: undefined,
|
|
40118
40160
|
},
|
|
40119
40161
|
}));
|
|
40120
40162
|
}
|