supaapps-config-fetcher 1.0.5 → 1.1.0

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.
@@ -5,6 +5,5 @@ export declare class ConfigManager<T> {
5
5
  private configHost;
6
6
  private constructor();
7
7
  static getInstance<T>(appName: string, configHost?: string): ConfigManager<T>;
8
- loadConfig(): Promise<T | null>;
9
- getConfig(): T | null;
8
+ loadConfig(): Promise<T>;
10
9
  }
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ConfigManager = void 0;
13
13
  const axios_1 = require("axios");
14
14
  class ConfigManager {
15
- constructor(appName, configHost = 'https://config.sacl.io') {
15
+ constructor(appName, configHost = 'https://config.envdomain.com') {
16
16
  this.config = null;
17
17
  this.appName = appName;
18
18
  this.configHost = configHost;
@@ -36,13 +36,10 @@ class ConfigManager {
36
36
  }
37
37
  catch (error) {
38
38
  console.error("Failed to load config:", error);
39
- return null;
39
+ throw new Error('Received invalid config data');
40
40
  }
41
41
  });
42
42
  }
43
- getConfig() {
44
- return this.config;
45
- }
46
43
  }
47
44
  exports.ConfigManager = ConfigManager;
48
45
  ConfigManager.instances = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supaapps-config-fetcher",
3
- "version": "1.0.5",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -6,7 +6,7 @@ export class ConfigManager<T> {
6
6
  private appName: string;
7
7
  private configHost: string;
8
8
 
9
- private constructor(appName: string, configHost: string = 'https://config.sacl.io') {
9
+ private constructor(appName: string, configHost: string = 'https://config.envdomain.com') {
10
10
  this.appName = appName;
11
11
  this.configHost = configHost;
12
12
  }
@@ -19,7 +19,7 @@ export class ConfigManager<T> {
19
19
  return ConfigManager.instances[key] as ConfigManager<T>;
20
20
  }
21
21
 
22
- public async loadConfig(): Promise<T | null> {
22
+ public async loadConfig(): Promise<T> {
23
23
  if (this.config) return this.config;
24
24
  try {
25
25
  const host = typeof window !== 'undefined' ? window.location.hostname : 'localhost';
@@ -28,11 +28,7 @@ export class ConfigManager<T> {
28
28
  return this.config;
29
29
  } catch (error) {
30
30
  console.error("Failed to load config:", error);
31
- return null;
31
+ throw new Error('Received invalid config data');
32
32
  }
33
33
  }
34
-
35
- public getConfig(): T | null {
36
- return this.config;
37
- }
38
34
  }