@punks/backend-entity-manager 0.0.286 → 0.0.287

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 CHANGED
@@ -39970,14 +39970,15 @@ exports.InMemoryEmailProvider = __decorate([
39970
39970
  WpEmailProvider("in-memory")
39971
39971
  ], exports.InMemoryEmailProvider);
39972
39972
 
39973
+ const awsBatchSettings = new AppInMemorySettings();
39974
+
39973
39975
  const JobProvider = (provider) => common.SetMetadata(JOB_PROVIDER, provider);
39974
39976
 
39975
39977
  var AwsBatchService_1;
39976
39978
  const jobDefinitionName = (jobUid) => `job-${jobUid}`;
39977
39979
  const jobInstanceName = (jobUid, instanceId) => `job-${jobUid}-${instanceId}`;
39978
39980
  let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
39979
- constructor(awsSettings) {
39980
- this.awsSettings = awsSettings;
39981
+ constructor() {
39981
39982
  this.logger = backendCore.Log.getLogger(AwsBatchService_1.name);
39982
39983
  this.client = () => new clientBatch.BatchClient({
39983
39984
  ...(this.awsSettings.awsSecretAccessKey &&
@@ -40090,6 +40091,9 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
40090
40091
  return result.jobDefinitions ?? [];
40091
40092
  }
40092
40093
  async ensureQueue(queueName) {
40094
+ if (!queueName) {
40095
+ throw new Error(`Queue name not provided`);
40096
+ }
40093
40097
  this.logger.debug(`AWS JOB -> ensuring queue ${queueName}`);
40094
40098
  const queue = await this.getQueue(queueName);
40095
40099
  if (queue) {
@@ -40106,6 +40110,9 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
40106
40110
  return currentQueue;
40107
40111
  }
40108
40112
  async createQueue(queueName) {
40113
+ if (!this.awsSettings.batchComputeEnvironment) {
40114
+ throw new Error(`No compute environment defined`);
40115
+ }
40109
40116
  await this.client().send(new clientBatch.CreateJobQueueCommand({
40110
40117
  jobQueueName: queueName,
40111
40118
  priority: 0,
@@ -40123,11 +40130,12 @@ let AwsBatchService = AwsBatchService_1 = class AwsBatchService {
40123
40130
  }));
40124
40131
  return result.jobQueues?.[0];
40125
40132
  }
40133
+ get awsSettings() {
40134
+ return awsBatchSettings.value;
40135
+ }
40126
40136
  };
40127
40137
  AwsBatchService = AwsBatchService_1 = __decorate([
40128
- common.Injectable(),
40129
- __param(0, common.Inject("WP.AWS_BATCH_SETTINGS")),
40130
- __metadata("design:paramtypes", [Object])
40138
+ common.Injectable()
40131
40139
  ], AwsBatchService);
40132
40140
 
40133
40141
  const mapJobStatus = (awsJobStatus) => {
@@ -40202,17 +40210,10 @@ const ModuleData$3 = {
40202
40210
  };
40203
40211
  exports.AwsJobsModule = AwsJobsModule_1 = class AwsJobsModule {
40204
40212
  static forRoot(input) {
40213
+ awsBatchSettings.initialize(input);
40205
40214
  return {
40206
40215
  module: AwsJobsModule_1,
40207
40216
  ...ModuleData$3,
40208
- providers: [
40209
- ...ModuleData$3.providers,
40210
- {
40211
- provide: "WP.AWS_BATCH_SETTINGS",
40212
- useValue: input,
40213
- },
40214
- ],
40215
- exports: [...ModuleData$3.exports],
40216
40217
  };
40217
40218
  }
40218
40219
  };
@@ -43631,6 +43632,7 @@ exports.WpRolesService = WpRolesService;
43631
43632
  exports.WpSendgridEmailTemplate = WpSendgridEmailTemplate;
43632
43633
  exports.WpUserRolesService = WpUserRolesService;
43633
43634
  exports.WpUserService = WpUserService;
43635
+ exports.awsBatchSettings = awsBatchSettings;
43634
43636
  exports.buildPermissionsGuard = buildPermissionsGuard;
43635
43637
  exports.buildProviderToken = buildProviderToken;
43636
43638
  exports.buildRolesGuard = buildRolesGuard;