@punks/backend-entity-manager 0.0.322 → 0.0.324

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
@@ -22332,19 +22332,21 @@ AuthenticationServicesResolver = __decorate([
22332
22332
  ], AuthenticationServicesResolver);
22333
22333
 
22334
22334
  class AppInMemorySettings {
22335
- constructor() { }
22335
+ constructor(name) {
22336
+ this.name = name;
22337
+ }
22336
22338
  initialize(value) {
22337
22339
  this._instance = value;
22338
22340
  }
22339
22341
  get value() {
22340
22342
  if (!this._instance) {
22341
- throw new Error("AppSettings not initialized");
22343
+ throw new Error(`AppSettings ${this.name} not initialized`);
22342
22344
  }
22343
22345
  return this._instance;
22344
22346
  }
22345
22347
  }
22346
22348
 
22347
- const authSettings = new AppInMemorySettings();
22349
+ const authSettings = new AppInMemorySettings("authSettings");
22348
22350
 
22349
22351
  let JwtProvider = class JwtProvider {
22350
22352
  constructor(jwtService) {
@@ -33810,7 +33812,7 @@ JobsMonitorTask = JobsMonitorTask_1 = __decorate([
33810
33812
  __metadata("design:paramtypes", [Object, Object, cqrs.CommandBus])
33811
33813
  ], JobsMonitorTask);
33812
33814
 
33813
- const jobsSettings = new AppInMemorySettings();
33815
+ const jobsSettings = new AppInMemorySettings("jobsSettings");
33814
33816
 
33815
33817
  var JobsScheduler_1;
33816
33818
  let JobsScheduler = JobsScheduler_1 = class JobsScheduler {
@@ -34439,7 +34441,7 @@ class AwsS3BucketError extends Error {
34439
34441
  }
34440
34442
  }
34441
34443
 
34442
- const awsBucketSettings = new AppInMemorySettings();
34444
+ const awsBucketSettings = new AppInMemorySettings("awsBucketSettings");
34443
34445
 
34444
34446
  const streamToBuffer = (stream) => new Promise((resolve, reject) => {
34445
34447
  const chunks = [];
@@ -34791,7 +34793,7 @@ const WpAwsSesEmailTemplate = (templateId, sendgridTemplateData) => common.apply
34791
34793
  templateId,
34792
34794
  }), common.SetMetadata(AwsSesModuleSymbols.EmailTemplate, sendgridTemplateData));
34793
34795
 
34794
- const awsSesSettings = new AppInMemorySettings();
34796
+ const awsSesSettings = new AppInMemorySettings("awsSesSettings");
34795
34797
 
34796
34798
  const getLocalizedText = (item, languageId, defaultLanguageId) => {
34797
34799
  return typeof item === "string"
@@ -39837,7 +39839,7 @@ const WpSendgridEmailTemplate = (templateId, sendgridTemplateData) => common.app
39837
39839
  templateId,
39838
39840
  }), common.SetMetadata(SendgridModuleSymbols.EmailTemplate, sendgridTemplateData));
39839
39841
 
39840
- const sendgridSettings = new AppInMemorySettings();
39842
+ const sendgridSettings = new AppInMemorySettings("sendgridSettings");
39841
39843
 
39842
39844
  const sanitizeValue = (value) => value?.trim() ? value?.trim() : undefined;
39843
39845
  const sanitizeArray = (value) => (value?.length ?? 0) > 0 ? value : undefined;
@@ -40013,7 +40015,7 @@ exports.InMemoryEmailProvider = __decorate([
40013
40015
  WpEmailProvider("in-memory")
40014
40016
  ], exports.InMemoryEmailProvider);
40015
40017
 
40016
- const awsBatchSettings = new AppInMemorySettings();
40018
+ const awsBatchSettings = new AppInMemorySettings("awsBatchSettings");
40017
40019
 
40018
40020
  const JobProvider = (provider) => common.SetMetadata(JOB_PROVIDER, provider);
40019
40021
 
@@ -40355,7 +40357,7 @@ class AwsS3MediaError extends Error {
40355
40357
  }
40356
40358
  }
40357
40359
 
40358
- const awsMediaSettings = new AppInMemorySettings();
40360
+ const awsMediaSettings = new AppInMemorySettings("awsMediaSettings");
40359
40361
 
40360
40362
  const createClient$1 = (settings) => new clientS3.S3Client({
40361
40363
  region: settings.region,
@@ -43324,7 +43326,7 @@ axios$2.exports.default = axios$1;
43324
43326
 
43325
43327
  var axios = axios$2.exports;
43326
43328
 
43327
- const sanityMediaSettings = new AppInMemorySettings();
43329
+ const sanityMediaSettings = new AppInMemorySettings("sanityMediaSettings");
43328
43330
 
43329
43331
  const buildRef = ({ dataset, projectId, id, }) => {
43330
43332
  return `sanity://${projectId}/${dataset}/${id}`;
@@ -43471,7 +43473,7 @@ exports.InMemoryMediaProvider = __decorate([
43471
43473
  WpMediaProvider("inMemory")
43472
43474
  ], exports.InMemoryMediaProvider);
43473
43475
 
43474
- const awsSecretsSettings = new AppInMemorySettings();
43476
+ const awsSecretsSettings = new AppInMemorySettings("awsSecretsSettings");
43475
43477
 
43476
43478
  const WpSecretsProvider = (providerId) => common.applyDecorators(common.Injectable(), common.SetMetadata(EntityManagerSymbols.SecretsProvider, {
43477
43479
  providerId,
@@ -43667,6 +43669,53 @@ exports.AwsSecretsModule = AwsSecretsModule_1 = __decorate([
43667
43669
  })
43668
43670
  ], exports.AwsSecretsModule);
43669
43671
 
43672
+ exports.InMemorySecretsProvider = class InMemorySecretsProvider {
43673
+ constructor() {
43674
+ this.secrets = new Map();
43675
+ }
43676
+ async getSecrets(pageName) {
43677
+ return Object.values(this.secrets.get(pageName).secrets).map((secret) => secret.value);
43678
+ }
43679
+ async setSecret(pageName, secret) {
43680
+ this.secrets.get(pageName).secrets[secret.key] = {
43681
+ definition: {
43682
+ key: secret.key,
43683
+ type: secret.type,
43684
+ hidden: secret.hidden,
43685
+ defaultValue: secret.value,
43686
+ },
43687
+ value: secret,
43688
+ };
43689
+ }
43690
+ async defineSecret(pageName, definition) {
43691
+ this.secrets.get(pageName).secrets[definition.key] = {
43692
+ definition,
43693
+ value: {
43694
+ key: definition.key,
43695
+ value: definition.defaultValue,
43696
+ type: definition.type,
43697
+ hidden: definition.hidden,
43698
+ timestamp: Date.now(),
43699
+ },
43700
+ };
43701
+ }
43702
+ async pageInitialize(pageName, metadata) {
43703
+ this.secrets.set(pageName, { metadata, secrets: {} });
43704
+ }
43705
+ async pageEnsure(pageName, metadata) {
43706
+ if (this.secrets.has(pageName)) {
43707
+ return;
43708
+ }
43709
+ this.secrets.set(pageName, { metadata, secrets: {} });
43710
+ }
43711
+ async pageExists(pageName) {
43712
+ return this.secrets.has(pageName);
43713
+ }
43714
+ };
43715
+ exports.InMemorySecretsProvider = __decorate([
43716
+ WpSecretsProvider("inMemorySecretsManager")
43717
+ ], exports.InMemorySecretsProvider);
43718
+
43670
43719
  exports.AUTHENTICATION_EVENTS_NAMESPACE = AUTHENTICATION_EVENTS_NAMESPACE;
43671
43720
  exports.ApiKeyAccess = ApiKeyAccess;
43672
43721
  exports.AppExceptionsFilterBase = AppExceptionsFilterBase;