@punks/backend-entity-manager 0.0.286 → 0.0.288
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 +30 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/manager/index.d.ts +1 -3
- package/dist/cjs/types/platforms/nest/plugins/jobs/aws-batch/settings/index.d.ts +2 -0
- package/dist/esm/index.js +30 -16
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/manager/index.d.ts +1 -3
- package/dist/esm/types/platforms/nest/plugins/jobs/aws-batch/settings/index.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { BathJobDefinition, GetBatchJobStatusInput, SubmitBatchJobInput } from "./types";
|
|
2
|
-
import { AwsBatchSettings } from "../settings";
|
|
3
2
|
export declare class AwsBatchService {
|
|
4
|
-
private readonly awsSettings;
|
|
5
3
|
private readonly logger;
|
|
6
|
-
constructor(awsSettings: AwsBatchSettings);
|
|
7
4
|
cancelJobInput(): Promise<void>;
|
|
8
5
|
getJobInstance(input: GetBatchJobStatusInput): Promise<import("@aws-sdk/client-batch").JobSummary | undefined>;
|
|
9
6
|
submitJob(input: SubmitBatchJobInput): Promise<void>;
|
|
@@ -16,4 +13,5 @@ export declare class AwsBatchService {
|
|
|
16
13
|
private createQueue;
|
|
17
14
|
private getQueue;
|
|
18
15
|
private client;
|
|
16
|
+
private get awsSettings();
|
|
19
17
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AppInMemorySettings } from "../../../../../../settings";
|
|
1
2
|
export type AwsBatchSettings = {
|
|
2
3
|
awsAccessKeyId?: string;
|
|
3
4
|
awsSecretAccessKey?: string;
|
|
@@ -6,3 +7,4 @@ export type AwsBatchSettings = {
|
|
|
6
7
|
batchComputeEnvironment: string;
|
|
7
8
|
batchExecutionRole: string;
|
|
8
9
|
};
|
|
10
|
+
export declare const awsBatchSettings: AppInMemorySettings<AwsBatchSettings>;
|
package/dist/esm/index.js
CHANGED
|
@@ -33852,7 +33852,7 @@ let JobsService = class JobsService {
|
|
|
33852
33852
|
}));
|
|
33853
33853
|
};
|
|
33854
33854
|
this.updateJob = async (input) => {
|
|
33855
|
-
this.commandBus.execute(new JobDefinitionUpdateCommand({
|
|
33855
|
+
await this.commandBus.execute(new JobDefinitionUpdateCommand({
|
|
33856
33856
|
job: input,
|
|
33857
33857
|
}));
|
|
33858
33858
|
};
|
|
@@ -39955,14 +39955,15 @@ InMemoryEmailProvider = __decorate([
|
|
|
39955
39955
|
WpEmailProvider("in-memory")
|
|
39956
39956
|
], InMemoryEmailProvider);
|
|
39957
39957
|
|
|
39958
|
+
const awsBatchSettings = new AppInMemorySettings();
|
|
39959
|
+
|
|
39958
39960
|
const JobProvider = (provider) => SetMetadata(JOB_PROVIDER, provider);
|
|
39959
39961
|
|
|
39960
39962
|
var AwsBatchService_1;
|
|
39961
39963
|
const jobDefinitionName = (jobUid) => `job-${jobUid}`;
|
|
39962
39964
|
const jobInstanceName = (jobUid, instanceId) => `job-${jobUid}-${instanceId}`;
|
|
39963
39965
|
let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
39964
|
-
constructor(
|
|
39965
|
-
this.awsSettings = awsSettings;
|
|
39966
|
+
constructor() {
|
|
39966
39967
|
this.logger = Log.getLogger(AwsBatchService_1.name);
|
|
39967
39968
|
this.client = () => new BatchClient({
|
|
39968
39969
|
...(this.awsSettings.awsSecretAccessKey &&
|
|
@@ -40022,12 +40023,25 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40022
40023
|
}
|
|
40023
40024
|
async ensureJobDefinition(definition) {
|
|
40024
40025
|
const jobName = jobDefinitionName(definition.jobUid);
|
|
40026
|
+
this.logger.debug(`AWS JOB -> ensuring job definition ${jobName}`, {
|
|
40027
|
+
definition,
|
|
40028
|
+
});
|
|
40025
40029
|
const jobs = await this.getActiveJobDefinitions(jobName);
|
|
40026
40030
|
for (const job of jobs) {
|
|
40031
|
+
this.logger.debug(`AWS JOB -> unregistering job definition`, {
|
|
40032
|
+
job,
|
|
40033
|
+
});
|
|
40027
40034
|
await this.unregisterJobDefinition(job.jobDefinitionArn);
|
|
40028
40035
|
}
|
|
40036
|
+
this.logger.debug(`AWS JOB -> registering job definition`, {
|
|
40037
|
+
definition,
|
|
40038
|
+
});
|
|
40029
40039
|
await this.registerJobDefinition(jobName, definition);
|
|
40030
|
-
|
|
40040
|
+
const updatedDefinition = await this.getLatestJobDefinition(jobName);
|
|
40041
|
+
this.logger.debug(`AWS JOB -> job definition updated`, {
|
|
40042
|
+
updatedDefinition,
|
|
40043
|
+
});
|
|
40044
|
+
return updatedDefinition;
|
|
40031
40045
|
}
|
|
40032
40046
|
async unregisterJobDefinition(jobDefinitionArn) {
|
|
40033
40047
|
await this.client().send(new DeregisterJobDefinitionCommand({
|
|
@@ -40075,6 +40089,9 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40075
40089
|
return result.jobDefinitions ?? [];
|
|
40076
40090
|
}
|
|
40077
40091
|
async ensureQueue(queueName) {
|
|
40092
|
+
if (!queueName) {
|
|
40093
|
+
throw new Error(`Queue name not provided`);
|
|
40094
|
+
}
|
|
40078
40095
|
this.logger.debug(`AWS JOB -> ensuring queue ${queueName}`);
|
|
40079
40096
|
const queue = await this.getQueue(queueName);
|
|
40080
40097
|
if (queue) {
|
|
@@ -40091,6 +40108,9 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40091
40108
|
return currentQueue;
|
|
40092
40109
|
}
|
|
40093
40110
|
async createQueue(queueName) {
|
|
40111
|
+
if (!this.awsSettings.batchComputeEnvironment) {
|
|
40112
|
+
throw new Error(`No compute environment defined`);
|
|
40113
|
+
}
|
|
40094
40114
|
await this.client().send(new CreateJobQueueCommand({
|
|
40095
40115
|
jobQueueName: queueName,
|
|
40096
40116
|
priority: 0,
|
|
@@ -40108,11 +40128,12 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
|
|
|
40108
40128
|
}));
|
|
40109
40129
|
return result.jobQueues?.[0];
|
|
40110
40130
|
}
|
|
40131
|
+
get awsSettings() {
|
|
40132
|
+
return awsBatchSettings.value;
|
|
40133
|
+
}
|
|
40111
40134
|
};
|
|
40112
40135
|
AwsBatchService = AwsBatchService_1 = __decorate([
|
|
40113
|
-
Injectable()
|
|
40114
|
-
__param(0, Inject("WP.AWS_BATCH_SETTINGS")),
|
|
40115
|
-
__metadata("design:paramtypes", [Object])
|
|
40136
|
+
Injectable()
|
|
40116
40137
|
], AwsBatchService);
|
|
40117
40138
|
|
|
40118
40139
|
const mapJobStatus = (awsJobStatus) => {
|
|
@@ -40187,17 +40208,10 @@ const ModuleData$3 = {
|
|
|
40187
40208
|
};
|
|
40188
40209
|
let AwsJobsModule = AwsJobsModule_1 = class AwsJobsModule {
|
|
40189
40210
|
static forRoot(input) {
|
|
40211
|
+
awsBatchSettings.initialize(input);
|
|
40190
40212
|
return {
|
|
40191
40213
|
module: AwsJobsModule_1,
|
|
40192
40214
|
...ModuleData$3,
|
|
40193
|
-
providers: [
|
|
40194
|
-
...ModuleData$3.providers,
|
|
40195
|
-
{
|
|
40196
|
-
provide: "WP.AWS_BATCH_SETTINGS",
|
|
40197
|
-
useValue: input,
|
|
40198
|
-
},
|
|
40199
|
-
],
|
|
40200
|
-
exports: [...ModuleData$3.exports],
|
|
40201
40215
|
};
|
|
40202
40216
|
}
|
|
40203
40217
|
};
|
|
@@ -43528,5 +43542,5 @@ AwsSecretsModule = AwsSecretsModule_1 = __decorate([
|
|
|
43528
43542
|
})
|
|
43529
43543
|
], AwsSecretsModule);
|
|
43530
43544
|
|
|
43531
|
-
export { AUTHENTICATION_EVENTS_NAMESPACE, ApiKeyAccess, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsEmailModule, AwsJobsModule, AwsS3BucketError, AwsS3BucketProvider, AwsS3MediaError, AwsS3MediaModule, AwsS3MediaProvider, AwsSecretsModule, AwsSecretsProvider, AwsSesEmailTemplate, BucketItemType, CacheService, ConnectorMode, CurrentUser, CustomDiscoveryModule, CustomDiscoveryService, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EntitySerializationFormat, EntitySerializer, EntitySnapshotService, EntityVersionOperation, EventsService, FilesManager, IEntityVersionsCursor, InMemoryBucketProvider, InMemoryEmailProvider, InMemoryMediaProvider, InvalidCredentialsError, JobConcurrency, JobInstance, JobProviderState, JobRunType, JobSchedule, JobStatus, JobsModule, JobsService, LockNotFoundError, MediaLibraryService, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestEntitySerializer, NestEntitySnapshotService, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, OperationLockService, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, Permissions, PipelineController, PipelineErrorType, PipelineInvocationError, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, QueryBuilderOperation, ReplicationMode, Roles, SanityMediaError, SanityMediaModule, SanityMediaProvider, SecretsService, SendgridEmailModule, SendgridEmailTemplate, SortDirection, TrackingService, TypeOrmQueryBuilder, TypeOrmRepository, TypeormCacheInstance, TypeormOperationLockRepository, UserCreationError, UserRegistrationError, WpApiKeysService, WpAppInitializer, WpAwsSesEmailTemplate, WpBucketProvider, WpCacheInstance, WpEmailLogger, WpEmailProvider, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConnectorMapper, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEntitySerializer, WpEntitySnapshotService, WpEntityVersioningProvider, WpEventsTracker, WpFileProvider, WpFileReferenceRepository, WpGlobalAuthenticationMiddleware, WpMediaFolderRepository, WpMediaProvider, WpMediaReferenceRepository, WpPermissionsService, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, buildPermissionsGuard, buildProviderToken, buildRolesGuard, createContainer, createExpressFileResponse, getEntityManagerProviderToken, getLocalizedText, newUuid, renderHandlebarsTemplate, toEntitiesImportInput };
|
|
43545
|
+
export { AUTHENTICATION_EVENTS_NAMESPACE, ApiKeyAccess, AppExceptionsFilterBase, AppHashingService, AppInMemorySettings, AppSessionMiddleware, AppSessionService, AuthGuard, Authenticated, AuthenticationEmailTemplates, AuthenticationError, AuthenticationEvents, AuthenticationExtensionSymbols, AuthenticationModule, AuthenticationService, AwsBucketModule, AwsEmailModule, AwsJobsModule, AwsS3BucketError, AwsS3BucketProvider, AwsS3MediaError, AwsS3MediaModule, AwsS3MediaProvider, AwsSecretsModule, AwsSecretsProvider, AwsSesEmailTemplate, BucketItemType, CacheService, ConnectorMode, CurrentUser, CustomDiscoveryModule, CustomDiscoveryService, EmailService, EntityManagerConfigurationError, EntityManagerException, EntityManagerInitializer, EntityManagerModule, EntityManagerRegistry, EntityManagerService, EntityManagerSymbols, EntityManagerUnauthorizedException, EntityNotFoundException, EntityOperationType, EntityOperationUnauthorizedException, EntitySeeder, EntitySerializationFormat, EntitySerializer, EntitySnapshotService, EntityVersionOperation, EventsService, FilesManager, IEntityVersionsCursor, InMemoryBucketProvider, InMemoryEmailProvider, InMemoryMediaProvider, InvalidCredentialsError, JobConcurrency, JobInstance, JobProviderState, JobRunType, JobSchedule, JobStatus, JobsModule, JobsService, LockNotFoundError, MediaLibraryService, MemberOf, MissingEntityIdError, ModulesContainerProvider, MultiTenancyModule, MultipleEntitiesFoundException, NestEntityActions, NestEntityAuthorizationMiddleware, NestEntityManager, NestEntitySerializer, NestEntitySnapshotService, NestPipelineTemplate, NestTypeOrmEntitySeeder, NestTypeOrmQueryBuilder, NestTypeOrmRepository, OperationLockService, OperationTokenMismatchError, PLATFORM_EVENT_NAMESPACE, Permissions, PipelineController, PipelineErrorType, PipelineInvocationError, PipelineStatus, PipelineStepErrorType, PipelinesBuilder, PipelinesRunner, PlatformEvents, Public, QueryBuilderBase, QueryBuilderOperation, ReplicationMode, Roles, SanityMediaError, SanityMediaModule, SanityMediaProvider, SecretsService, SendgridEmailModule, SendgridEmailTemplate, SortDirection, TrackingService, TypeOrmQueryBuilder, TypeOrmRepository, TypeormCacheInstance, TypeormOperationLockRepository, UserCreationError, UserRegistrationError, WpApiKeysService, WpAppInitializer, WpAwsSesEmailTemplate, WpBucketProvider, WpCacheInstance, WpEmailLogger, WpEmailProvider, WpEmailTemplate, WpEntity, WpEntityActions, WpEntityAdapter, WpEntityAuthMiddleware, WpEntityConnector, WpEntityConnectorMapper, WpEntityConverter, WpEntityManager, WpEntityQueryBuilder, WpEntityRepository, WpEntitySeeder, WpEntitySerializer, WpEntitySnapshotService, WpEntityVersioningProvider, WpEventsTracker, WpFileProvider, WpFileReferenceRepository, WpGlobalAuthenticationMiddleware, WpMediaFolderRepository, WpMediaProvider, WpMediaReferenceRepository, WpPermissionsService, WpPipeline, WpRolesService, WpSendgridEmailTemplate, WpUserRolesService, WpUserService, awsBatchSettings, buildPermissionsGuard, buildProviderToken, buildRolesGuard, createContainer, createExpressFileResponse, getEntityManagerProviderToken, getLocalizedText, newUuid, renderHandlebarsTemplate, toEntitiesImportInput };
|
|
43532
43546
|
//# sourceMappingURL=index.js.map
|