@dhedge/backend-flatcoin-core 0.2.87 → 0.2.89

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.
@@ -6,6 +6,5 @@ export declare class ConfigService {
6
6
  private readonly logger;
7
7
  private baseConfig;
8
8
  constructor(configRepository: MultichainConfigRepository, logger: Logger);
9
- baseConfigs(): MultichainConfig;
10
- refreshConfigs(): Promise<void>;
9
+ baseConfigs(): Promise<MultichainConfig>;
11
10
  }
@@ -16,31 +16,24 @@ let ConfigService = class ConfigService {
16
16
  constructor(configRepository, logger) {
17
17
  this.configRepository = configRepository;
18
18
  this.logger = logger;
19
- this.refreshConfigs().catch();
20
19
  }
21
- baseConfigs() {
20
+ async baseConfigs() {
22
21
  if (this.baseConfig) {
23
22
  return this.baseConfig;
24
23
  }
25
24
  else {
26
- throw Error('multichain configs not loaded');
27
- }
28
- }
29
- async refreshConfigs() {
30
- this.configRepository
31
- .getById(1)
32
- .then((result) => {
25
+ const result = await this.configRepository.getById(1);
33
26
  if (!result) {
34
27
  throw new Error('failed to load multichain config from db');
35
28
  }
36
29
  else {
37
- this.baseConfig = result;
38
- this.logger.log(`multichain config loaded ${result}`);
30
+ if (!this.baseConfig) {
31
+ this.baseConfig = result;
32
+ this.logger.log(`multichain config loaded ${result}`);
33
+ }
34
+ return this.baseConfig;
39
35
  }
40
- })
41
- .catch((er) => {
42
- throw new Error(`failed to load multichain config ${er}`);
43
- });
36
+ }
44
37
  }
45
38
  };
46
39
  exports.ConfigService = ConfigService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/backend-flatcoin-core",
3
- "version": "0.2.87",
3
+ "version": "0.2.89",
4
4
  "description": "Backend Flatcoin Core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",