@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
|
@@ -6,6 +6,7 @@ export declare class AwsBatchService {
|
|
|
6
6
|
submitJob(input: SubmitBatchJobInput): Promise<void>;
|
|
7
7
|
ensureJobDefinition(definition: AwsJobDefinition): Promise<import("@aws-sdk/client-batch").JobDefinition>;
|
|
8
8
|
private unregisterJobDefinition;
|
|
9
|
+
private ensureJobLogDriver;
|
|
9
10
|
private registerJobDefinition;
|
|
10
11
|
private getLatestJobDefinition;
|
|
11
12
|
private getActiveJobDefinitions;
|
package/dist/esm/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
|
18
18
|
import { SendEmailCommand, SESClient } from '@aws-sdk/client-ses';
|
|
19
19
|
import { MailService } from '@sendgrid/mail';
|
|
20
20
|
import { BatchClient, CancelJobCommand, ListJobsCommand, SubmitJobCommand, DeregisterJobDefinitionCommand, RegisterJobDefinitionCommand, JobDefinitionType, PlatformCapability, ResourceType, AssignPublicIp, DescribeJobDefinitionsCommand, CreateJobQueueCommand, DescribeJobQueuesCommand, JobStatus as JobStatus$1 } from '@aws-sdk/client-batch';
|
|
21
|
+
import { CloudWatchLogsClient, DescribeLogGroupsCommand, CreateLogGroupCommand } from '@aws-sdk/client-cloudwatch-logs';
|
|
21
22
|
import require$$1$1 from 'http';
|
|
22
23
|
import require$$2 from 'https';
|
|
23
24
|
import require$$0$1 from 'url';
|
|
@@ -39973,6 +39974,28 @@ const awsBatchSettings = new AppInMemorySettings();
|
|
|
39973
39974
|
|
|
39974
39975
|
const JobProvider = (provider) => SetMetadata(JOB_PROVIDER, provider);
|
|
39975
39976
|
|
|
39977
|
+
const ensureJobLogGroup = async (logGroupName, awsSettings) => {
|
|
39978
|
+
const client = new CloudWatchLogsClient({
|
|
39979
|
+
...(awsSettings.awsSecretAccessKey && awsSettings.awsSecretAccessKey
|
|
39980
|
+
? {
|
|
39981
|
+
accessKeyId: awsSettings.awsSecretAccessKey,
|
|
39982
|
+
secretAccessKey: awsSettings.awsSecretAccessKey,
|
|
39983
|
+
}
|
|
39984
|
+
: {}),
|
|
39985
|
+
});
|
|
39986
|
+
const describeCommand = new DescribeLogGroupsCommand({
|
|
39987
|
+
logGroupNamePrefix: logGroupName,
|
|
39988
|
+
});
|
|
39989
|
+
const describeResponse = await client.send(describeCommand);
|
|
39990
|
+
const existingLogGroup = describeResponse.logGroups?.find((group) => group.logGroupName === logGroupName);
|
|
39991
|
+
if (!existingLogGroup) {
|
|
39992
|
+
const createCommand = new CreateLogGroupCommand({
|
|
39993
|
+
logGroupName,
|
|
39994
|
+
});
|
|
39995
|
+
await client.send(createCommand);
|
|
39996
|
+
}
|
|
39997
|
+
};
|
|
39998
|
+
|
|
39976
39999
|
var AwsBatchService_1;
|
|
39977
40000
|
const jobDefinitionName = (jobUid) => `job-${jobUid}`;
|
|
39978
40001
|
const jobInstanceName = (jobUid, instanceId) => `job-${jobUid}-${instanceId}`;
|
|
@@ -40066,7 +40089,16 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40066
40089
|
jobDefinition: jobDefinitionArn,
|
|
40067
40090
|
}));
|
|
40068
40091
|
}
|
|
40092
|
+
async ensureJobLogDriver(jobName, definition) { }
|
|
40069
40093
|
async registerJobDefinition(jobName, definition) {
|
|
40094
|
+
const logGroup = definition.infrastructureParams.logGroupName
|
|
40095
|
+
? {
|
|
40096
|
+
name: `/aws/batch/job-${definition.infrastructureParams.logGroupName}`,
|
|
40097
|
+
}
|
|
40098
|
+
: undefined;
|
|
40099
|
+
if (logGroup) {
|
|
40100
|
+
await ensureJobLogGroup(logGroup.name, this.awsSettings);
|
|
40101
|
+
}
|
|
40070
40102
|
await this.client().send(new RegisterJobDefinitionCommand({
|
|
40071
40103
|
jobDefinitionName: jobName,
|
|
40072
40104
|
type: JobDefinitionType.Container,
|
|
@@ -40100,6 +40132,16 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40100
40132
|
assignPublicIp: AssignPublicIp.ENABLED,
|
|
40101
40133
|
}
|
|
40102
40134
|
: undefined,
|
|
40135
|
+
logConfiguration: logGroup
|
|
40136
|
+
? {
|
|
40137
|
+
logDriver: "awslogs",
|
|
40138
|
+
options: {
|
|
40139
|
+
"awslogs-group": logGroup.name,
|
|
40140
|
+
"awslogs-region": await this.client().config.region(),
|
|
40141
|
+
"awslogs-stream-prefix": "ecs",
|
|
40142
|
+
},
|
|
40143
|
+
}
|
|
40144
|
+
: undefined,
|
|
40103
40145
|
},
|
|
40104
40146
|
}));
|
|
40105
40147
|
}
|