@digitaldefiance/express-suite-starter 4.23.1 → 4.23.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/express-suite-starter",
3
- "version": "4.23.1",
3
+ "version": "4.23.2",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "create-express-suite": "./dist/src/cli.js"
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  BaseRouter,
8
8
  DummyEmailService,
9
- emailServiceRegistry,
9
+ ServiceKeys,
10
10
  IApplication,
11
11
  } from '@digitaldefiance/node-express-suite';
12
12
  import { Environment } from './environment';
@@ -81,6 +81,6 @@ export class App<
81
81
  // Register the DummyEmailService - users should replace this with their own email service
82
82
  const emailService = new DummyEmailService<TID>(this);
83
83
  // const emailService = new EmailService(this);
84
- emailServiceRegistry.setService(emailService);
84
+ this.services.register(ServiceKeys.EMAIL, () => emailService);
85
85
  }
86
86
  }
@@ -1,18 +1,16 @@
1
1
  import { SecureString } from '@digitaldefiance/ecies-lib';
2
2
  import { BrightDbEnvironment } from '@brightchain/node-express-suite';
3
- import { emailServiceRegistry } from '@digitaldefiance/node-express-suite';
4
3
  import { IEnvironment } from './interfaces/environment';
5
4
  import { IEnvironmentAws } from './interfaces/environment-aws';
6
5
  import { Constants } from './constants';
7
6
  import { getSuiteCoreTranslation, SuiteCoreStringKey } from '@digitaldefiance/suite-core-lib';
8
- import { EmailService } from './services/email';
9
7
  import { PlatformID } from '@digitaldefiance/node-ecies-lib';
10
8
  import { DefaultBackendIdType } from './shared-types';
11
9
 
12
10
  export class Environment<TID extends PlatformID = DefaultBackendIdType> extends BrightDbEnvironment<TID> implements IEnvironment<TID> {
13
11
  private _aws: IEnvironmentAws;
14
12
 
15
- constructor(path?: string, initialization = false, override = true) {
13
+ constructor(path?: string, initialization = false, override = true, requireAwsCredentials = false) {
16
14
  super(path, initialization, override, Constants);
17
15
  const envObj = this.getObject();
18
16
 
@@ -24,7 +22,7 @@ export class Environment<TID extends PlatformID = DefaultBackendIdType> extends
24
22
 
25
23
  if (process.env['NODE_ENV'] !== 'test' &&
26
24
  process.env['NODE_ENV'] !== 'development' &&
27
- emailServiceRegistry.isServiceType(EmailService) && // only enforce if real EmailService is used
25
+ requireAwsCredentials &&
28
26
  this._aws.accessKeyId.length === 0) {
29
27
  throw new Error(
30
28
  getSuiteCoreTranslation(SuiteCoreStringKey.Admin_EnvNotSetTemplate, {
@@ -34,7 +32,7 @@ export class Environment<TID extends PlatformID = DefaultBackendIdType> extends
34
32
  }
35
33
  if (process.env['NODE_ENV'] !== 'test' &&
36
34
  process.env['NODE_ENV'] !== 'development' &&
37
- emailServiceRegistry.isServiceType(EmailService) && // only enforce if real EmailService is used
35
+ requireAwsCredentials &&
38
36
  this._aws.secretAccessKey.length === 0) {
39
37
  throw new Error(
40
38
  getSuiteCoreTranslation(SuiteCoreStringKey.Admin_EnvNotSetTemplate, {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Application,
3
3
  DummyEmailService,
4
- emailServiceRegistry,
4
+ ServiceKeys,
5
5
  BaseRouter,
6
6
  IApplication,
7
7
  } from '@digitaldefiance/node-express-suite';
@@ -113,6 +113,6 @@ export class App<
113
113
  // Register the DummyEmailService - users should replace this with their own email service
114
114
  const emailService = new DummyEmailService<Types.ObjectId>(this);
115
115
  // const emailService = new EmailService(this);
116
- emailServiceRegistry.setService(emailService);
116
+ this.services.register(ServiceKeys.EMAIL, () => emailService);
117
117
  }
118
118
  }
@@ -1,16 +1,15 @@
1
1
  import { SecureString } from '@digitaldefiance/ecies-lib';
2
- import { Environment as BaseEnvironment, emailServiceRegistry } from '@digitaldefiance/node-express-suite';
2
+ import { Environment as BaseEnvironment } from '@digitaldefiance/node-express-suite';
3
3
  import { IEnvironment } from './interfaces/environment';
4
4
  import { IEnvironmentAws } from './interfaces/environment-aws';
5
5
  import { Constants } from './constants';
6
6
  import { getSuiteCoreTranslation, SuiteCoreStringKey } from '@digitaldefiance/suite-core-lib';
7
- import { EmailService } from './services/email';
8
7
  import { PlatformID } from '@digitaldefiance/node-ecies-lib';
9
8
 
10
9
  export class Environment<TID extends PlatformID> extends BaseEnvironment<TID> implements IEnvironment<TID> {
11
10
  private _aws: IEnvironmentAws;
12
11
 
13
- constructor(path?: string, initialization = false, override = true) {
12
+ constructor(path?: string, initialization = false, override = true, requireAwsCredentials = false) {
14
13
  super(path, initialization, override, Constants);
15
14
  const envObj = this.getObject();
16
15
 
@@ -22,7 +21,7 @@ export class Environment<TID extends PlatformID> extends BaseEnvironment<TID> im
22
21
 
23
22
  if (process.env['NODE_ENV'] !== 'test' &&
24
23
  process.env['NODE_ENV'] !== 'development' &&
25
- emailServiceRegistry.isServiceType(EmailService) && // only enforce if real EmailService is used
24
+ requireAwsCredentials &&
26
25
  this._aws.accessKeyId.length === 0) {
27
26
  throw new Error(
28
27
  getSuiteCoreTranslation(SuiteCoreStringKey.Admin_EnvNotSetTemplate, {
@@ -32,7 +31,7 @@ export class Environment<TID extends PlatformID> extends BaseEnvironment<TID> im
32
31
  }
33
32
  if (process.env['NODE_ENV'] !== 'test' &&
34
33
  process.env['NODE_ENV'] !== 'development' &&
35
- emailServiceRegistry.isServiceType(EmailService) && // only enforce if real EmailService is used
34
+ requireAwsCredentials &&
36
35
  this._aws.secretAccessKey.length === 0) {
37
36
  throw new Error(
38
37
  getSuiteCoreTranslation(SuiteCoreStringKey.Admin_EnvNotSetTemplate, {