runtime-config-loader 5.0.2 → 6.0.1

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/README.md CHANGED
@@ -8,51 +8,50 @@ This library provides an easy way to load one or more JSON files with configurat
8
8
 
9
9
  ## How to Implement
10
10
 
11
- In your `app.module.ts` file, add the following to the `@NgModule` decorator:
11
+ In your `app.config.ts` file, add the following to the `providers` array:
12
12
 
13
13
  ```ts
14
- imports: [..., RuntimeConfigLoaderModule, ...],
14
+ import { provideRuntimeConfig } from 'runtime-config-loader';
15
+
16
+ export const appConfig: ApplicationConfig = {
17
+ providers: [
18
+ ...,
19
+ provideRuntimeConfig({ configUrl: './assets/config.json' }),
20
+ ...
21
+ ]
22
+ };
15
23
  ```
16
24
 
17
- That's it; it's that simple. In the `RuntimeConfigLoaderModule`, the `APP_INITIALIZER` token is used to run a function which loads the configuration from a file or an API endpoint that can be used throughout the application.
25
+ That's it; it's that simple. The `provideRuntimeConfig` function sets up the `APP_INITIALIZER` token to load the configuration from a file or an API endpoint before the application starts.
18
26
 
19
- If you implement the library exactly as it is above, the configuration file needs to be in the `./assets/config.json` location as mentioned above. If you'd like to load the file from a different location, provide that location in the `.forRoot()` method when importing the `RuntimeConfigLoaderModule`:
27
+ ### Configuration
20
28
 
21
- ```ts
22
- imports: [
23
- ...,
24
- RuntimeConfigLoaderModule.forRoot(
25
- { configUrl: './path/to/config/config.json' }
26
- ),
27
- ...]
28
- ```
29
+ The `provideRuntimeConfig` function accepts a configuration object with a `configUrl` property. This can be a single string or an array of strings.
29
30
 
30
- If you want to load multiple files, the value of `configUrl` should be an array of strings:
31
+ #### Single Config File
32
+
33
+ The default location is `./assets/config.json`. If you'd like to load the file from a different location:
31
34
 
32
35
  ```ts
33
- imports: [
34
- ...,
35
- RuntimeConfigLoaderModule.forRoot(
36
- { configUrl: ['./path/to/config/config-1.json', './path/to/config/config-2.json'] }
37
- ),
38
- ...]
36
+ provideRuntimeConfig({ configUrl: './path/to/config/config.json' });
39
37
  ```
40
38
 
41
- > Make sure that the path(s) you provide here is accessible by the Angular application, meaning that the file is somewhere the app can load it. In my opinion, the `assets` folder is the easiest place to work from.
42
-
43
- ## Multiple Config Paths
39
+ #### Multiple Config Files
44
40
 
45
- One reason you may want to load multiple configuration objects is so that you can set the configuration on your machine without affecting anyone else. For example, you could have a `local.config.json` file that is not included in source control. Some of the values in that file would overwrite the values in a config file that everyone can use. Another use case is that some config values don't change between environments, and some do. The ones that don't change could go in one file, the ones that do change could go in a second file. Each developer/environment can provide the second file with values they want or need.
46
-
47
- It's important to know that if an attribute is repeated in two configuration files, the latest value is kept. So, let's say you have `apiUrl` in both files, `config-1.json` and `config-2.json`. Let's assume the files are passed in to the `forRoot` method like this:
41
+ You can load multiple files (or API endpoints) and they will be merged into a single configuration object.
48
42
 
49
43
  ```ts
50
- imports: [
51
- ...,
52
- RuntimeConfigLoaderModule.forRoot(
53
- { configUrl: ['./path/to/config/config-1.json', './path/to/config/config-2.json'] }
54
- ),
55
- ...]
44
+ provideRuntimeConfig({
45
+ configUrl: [
46
+ './path/to/config/config-1.json',
47
+ './path/to/config/config-2.json',
48
+ ],
49
+ });
56
50
  ```
57
51
 
58
- In this case, the `apiUrl` value from `config-2.json` will override the value from `config-1.json`.
52
+ If an attribute is repeated in multiple configuration files, the latest value is kept. For example, if `apiUrl` exists in both files above, the value from `config-2.json` will override the value from `config-1.json`.
53
+
54
+ > [!TIP]
55
+ > This is useful for maintaining local overrides (e.g., `local.config.json` ignored by git) or separating environment-specific values from global ones.
56
+
57
+ Make sure that the path(s) you provide are accessible by the Angular application. The `assets` folder is generally the easiest place to serve these files.
@@ -0,0 +1,92 @@
1
+ import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable, provideAppInitializer, makeEnvironmentProviders } from '@angular/core';
4
+ import { Subject, forkJoin, of } from 'rxjs';
5
+ import { tap, catchError, take } from 'rxjs/operators';
6
+
7
+ class RuntimeConfig {
8
+ constructor(obj = {}) {
9
+ this.configUrl = obj.configUrl || './assets/config.json';
10
+ }
11
+ }
12
+
13
+ class RuntimeConfigLoaderService {
14
+ constructor() {
15
+ this.configUrl = './assets/config.json';
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
+ this.configObject = null;
18
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
+ this.configSubject = new Subject();
20
+ this._http = inject(HttpClient);
21
+ this._config = inject(RuntimeConfig, { optional: true });
22
+ if (this._config) {
23
+ this.configUrl = this._config.configUrl;
24
+ }
25
+ }
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ loadConfig() {
28
+ const urls = Array.isArray(this.configUrl)
29
+ ? this.configUrl
30
+ : [this.configUrl];
31
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
+ const observables = urls.map((url) => this.makeHttpCall(url));
33
+ return forkJoin(observables).pipe(
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ tap((configDataArray) => {
36
+ this.configObject = configDataArray.reduce(
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ (acc, configData) => {
39
+ return { ...acc, ...configData };
40
+ }, {});
41
+ this.configSubject.next(this.configObject);
42
+ }),
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ catchError((err) => {
45
+ console.error('Error loading config: ', err);
46
+ this.configObject = null;
47
+ this.configSubject.next(this.configObject);
48
+ return of(null);
49
+ }));
50
+ }
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ makeHttpCall(url) {
53
+ return this._http.get(url).pipe(take(1));
54
+ }
55
+ getConfig() {
56
+ return this.configObject;
57
+ }
58
+ getConfigObjectKey(key) {
59
+ return this.configObject ? this.configObject[key] : null;
60
+ }
61
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: RuntimeConfigLoaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
62
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: RuntimeConfigLoaderService }); }
63
+ }
64
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: RuntimeConfigLoaderService, decorators: [{
65
+ type: Injectable
66
+ }], ctorParameters: () => [] });
67
+
68
+ function initConfig(configSvc) {
69
+ return () => configSvc.loadConfig();
70
+ }
71
+ function provideRuntimeConfig(config) {
72
+ const providers = [
73
+ {
74
+ provide: RuntimeConfig,
75
+ useValue: config,
76
+ },
77
+ RuntimeConfigLoaderService,
78
+ provideAppInitializer(() => {
79
+ const initializerFn = initConfig(inject(RuntimeConfigLoaderService));
80
+ return initializerFn();
81
+ }),
82
+ provideHttpClient(withInterceptorsFromDi()),
83
+ ];
84
+ return makeEnvironmentProviders(providers);
85
+ }
86
+
87
+ /**
88
+ * Generated bundle index. Do not edit.
89
+ */
90
+
91
+ export { RuntimeConfig, RuntimeConfigLoaderService, initConfig, provideRuntimeConfig };
92
+ //# sourceMappingURL=runtime-config-loader.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-config-loader.mjs","sources":["../../../../libs/runtime-config-loader/src/lib/runtime-config.ts","../../../../libs/runtime-config-loader/src/lib/runtime-config-loader/runtime-config-loader.service.ts","../../../../libs/runtime-config-loader/src/lib/runtime-config-loader.provider.ts","../../../../libs/runtime-config-loader/src/runtime-config-loader.ts"],"sourcesContent":["export class RuntimeConfig {\n\tconfigUrl: string | string[];\n\n\tconstructor(obj: { configUrl?: string | string[] } = {}) {\n\t\tthis.configUrl = obj.configUrl || './assets/config.json';\n\t}\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { RuntimeConfig } from '../runtime-config';\nimport { forkJoin, Observable, of, Subject } from 'rxjs';\nimport { catchError, take, tap } from 'rxjs/operators';\n\n@Injectable()\nexport class RuntimeConfigLoaderService {\n\tprivate configUrl: string | string[] = './assets/config.json';\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate configObject: any = null;\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic configSubject: Subject<any> = new Subject<any>();\n\n\tprivate _http = inject(HttpClient);\n\tprivate _config = inject(RuntimeConfig, { optional: true });\n\n\tconstructor() {\n\t\tif (this._config) {\n\t\t\tthis.configUrl = this._config.configUrl;\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tloadConfig(): Observable<any> {\n\t\tconst urls: string[] = Array.isArray(this.configUrl)\n\t\t\t? this.configUrl\n\t\t\t: [this.configUrl];\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tconst observables: Observable<any>[] = urls.map((url) =>\n\t\t\tthis.makeHttpCall(url)\n\t\t);\n\n\t\treturn forkJoin(observables).pipe(\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\ttap((configDataArray: any[]) => {\n\t\t\t\tthis.configObject = configDataArray.reduce(\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t(acc, configData) => {\n\t\t\t\t\t\treturn { ...acc, ...configData };\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\tthis.configSubject.next(this.configObject);\n\t\t\t}),\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\tcatchError((err: any) => {\n\t\t\t\tconsole.error('Error loading config: ', err);\n\t\t\t\tthis.configObject = null;\n\t\t\t\tthis.configSubject.next(this.configObject);\n\t\t\t\treturn of(null);\n\t\t\t})\n\t\t);\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate makeHttpCall(url: string): Observable<any> {\n\t\treturn this._http.get(url).pipe(take(1));\n\t}\n\n\tgetConfig() {\n\t\treturn this.configObject;\n\t}\n\n\tgetConfigObjectKey(key: string) {\n\t\treturn this.configObject ? this.configObject[key] : null;\n\t}\n}\n","import {\n\tEnvironmentProviders,\n\tProvider,\n\tinject,\n\tmakeEnvironmentProviders,\n\tprovideAppInitializer,\n} from '@angular/core';\nimport {\n\tprovideHttpClient,\n\twithInterceptorsFromDi,\n} from '@angular/common/http';\nimport { RuntimeConfig } from './runtime-config';\nimport { RuntimeConfigLoaderService } from './runtime-config-loader/runtime-config-loader.service';\n\nexport function initConfig(configSvc: RuntimeConfigLoaderService) {\n\treturn () => configSvc.loadConfig();\n}\n\nexport function provideRuntimeConfig(\n\tconfig: RuntimeConfig\n): EnvironmentProviders {\n\tconst providers: (Provider | EnvironmentProviders)[] = [\n\t\t{\n\t\t\tprovide: RuntimeConfig,\n\t\t\tuseValue: config,\n\t\t},\n\t\tRuntimeConfigLoaderService,\n\t\tprovideAppInitializer(() => {\n\t\t\tconst initializerFn = initConfig(\n\t\t\t\tinject(RuntimeConfigLoaderService)\n\t\t\t);\n\t\t\treturn initializerFn();\n\t\t}),\n\t\tprovideHttpClient(withInterceptorsFromDi()),\n\t];\n\n\treturn makeEnvironmentProviders(providers);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAAa,aAAa,CAAA;AAGzB,IAAA,WAAA,CAAY,MAAyC,EAAE,EAAA;QACtD,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,sBAAsB;IACzD;AACA;;MCCY,0BAA0B,CAAA;AAUtC,IAAA,WAAA,GAAA;QATQ,IAAA,CAAA,SAAS,GAAsB,sBAAsB;;QAErD,IAAA,CAAA,YAAY,GAAQ,IAAI;;AAEzB,QAAA,IAAA,CAAA,aAAa,GAAiB,IAAI,OAAO,EAAO;AAE/C,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;QAC1B,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IA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AA;QACR,OAAO,IAAI,CAAC,YAAY;IACzB;AAEA,IAAA,kBAAkB,CAAC,GAAW,EAAA;AAC7B,QAAA,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI;IACzD;8GA7DY,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA1B,0BAA0B,EAAA,CAAA,CAAA;;2FAA1B,0BAA0B,EAAA,UAAA,EAAA,CAAA;kBADtC;;;ACQK,SAAU,UAAU,CAAC,SAAqC,EAAA;AAC/D,IAAA,OAAO,MAAM,SAAS,CAAC,UAAU,EAAE;AACpC;AAEM,SAAU,oBAAoB,CACnC,MAAqB,EAAA;AAErB,IAAA,MAAM,SAAS,GAAwC;AACtD,QAAA;AACC,YAAA,OAAO,EAAE,aAAa;AACtB,YAAA,QAAQ,EAAE,MAAM;AAChB,SAAA;QACD,0BAA0B;QAC1B,qBAAqB,CAAC,MAAK;YAC1B,MAAM,aAAa,GAAG,UAAU,CAC/B,MAAM,CAAC,0BAA0B,CAAC,CAClC;YACD,OAAO,aAAa,EAAE;AACvB,QAAA,CAAC,CAAC;QACF,iBAAiB,CAAC,sBAAsB,EAAE,CAAC;KAC3C;AAED,IAAA,OAAO,wBAAwB,CAAC,SAAS,CAAC;AAC3C;;ACrCA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runtime-config-loader",
3
- "version": "5.0.2",
3
+ "version": "6.0.1",
4
4
  "author": {
5
5
  "email": "preston.j.lamb@gmail.com",
6
6
  "name": "Preston Lamb",
@@ -23,31 +23,23 @@
23
23
  "config"
24
24
  ],
25
25
  "peerDependencies": {
26
- "@angular/common": ">=13.0.0",
27
- "@angular/core": ">=13.0.0",
28
- "@angular/platform-browser-dynamic": ">=13.0.0",
26
+ "@angular/common": ">=19.0.0",
27
+ "@angular/core": ">=19.0.0",
28
+ "@angular/platform-browser-dynamic": ">=19.0.0",
29
29
  "rxjs": ">=6.6.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "tslib": "^2.3.0"
33
33
  },
34
- "module": "fesm2015/runtime-config-loader.mjs",
35
- "es2020": "fesm2020/runtime-config-loader.mjs",
36
- "esm2020": "esm2020/runtime-config-loader.mjs",
37
- "fesm2020": "fesm2020/runtime-config-loader.mjs",
38
- "fesm2015": "fesm2015/runtime-config-loader.mjs",
39
- "typings": "index.d.ts",
34
+ "module": "fesm2022/runtime-config-loader.mjs",
35
+ "typings": "types/runtime-config-loader.d.ts",
40
36
  "exports": {
41
37
  "./package.json": {
42
38
  "default": "./package.json"
43
39
  },
44
40
  ".": {
45
- "types": "./index.d.ts",
46
- "esm2020": "./esm2020/runtime-config-loader.mjs",
47
- "es2020": "./fesm2020/runtime-config-loader.mjs",
48
- "es2015": "./fesm2015/runtime-config-loader.mjs",
49
- "node": "./fesm2015/runtime-config-loader.mjs",
50
- "default": "./fesm2020/runtime-config-loader.mjs"
41
+ "types": "./types/runtime-config-loader.d.ts",
42
+ "default": "./fesm2022/runtime-config-loader.mjs"
51
43
  }
52
44
  },
53
45
  "sideEffects": false
Binary file
@@ -0,0 +1,31 @@
1
+ import * as rxjs from 'rxjs';
2
+ import { Subject, Observable } from 'rxjs';
3
+ import * as i0 from '@angular/core';
4
+ import { EnvironmentProviders } from '@angular/core';
5
+
6
+ declare class RuntimeConfig {
7
+ configUrl: string | string[];
8
+ constructor(obj?: {
9
+ configUrl?: string | string[];
10
+ });
11
+ }
12
+
13
+ declare class RuntimeConfigLoaderService {
14
+ private configUrl;
15
+ private configObject;
16
+ configSubject: Subject<any>;
17
+ private _http;
18
+ private _config;
19
+ constructor();
20
+ loadConfig(): Observable<any>;
21
+ private makeHttpCall;
22
+ getConfig(): any;
23
+ getConfigObjectKey(key: string): any;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeConfigLoaderService, never>;
25
+ static ɵprov: i0.ɵɵInjectableDeclaration<RuntimeConfigLoaderService>;
26
+ }
27
+
28
+ declare function initConfig(configSvc: RuntimeConfigLoaderService): () => rxjs.Observable<any>;
29
+ declare function provideRuntimeConfig(config: RuntimeConfig): EnvironmentProviders;
30
+
31
+ export { RuntimeConfig, RuntimeConfigLoaderService, initConfig, provideRuntimeConfig };
package/esm2020/index.mjs DELETED
@@ -1,4 +0,0 @@
1
- export * from './lib/runtime-config-loader.module';
2
- export * from './lib/runtime-config';
3
- export * from './lib/runtime-config-loader/runtime-config-loader.service';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL3J1bnRpbWUtY29uZmlnLWxvYWRlci9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxvQ0FBb0MsQ0FBQztBQUNuRCxjQUFjLHNCQUFzQixDQUFDO0FBQ3JDLGNBQWMsMkRBQTJELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9ydW50aW1lLWNvbmZpZy1sb2FkZXIubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3J1bnRpbWUtY29uZmlnJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3J1bnRpbWUtY29uZmlnLWxvYWRlci9ydW50aW1lLWNvbmZpZy1sb2FkZXIuc2VydmljZSc7XG4iXX0=
@@ -1,53 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { Injectable, Optional } from '@angular/core';
3
- import { RuntimeConfig } from '../runtime-config';
4
- import { forkJoin, of, Subject } from 'rxjs';
5
- import { catchError, take, tap } from 'rxjs/operators';
6
- import * as i0 from "@angular/core";
7
- import * as i1 from "@angular/common/http";
8
- import * as i2 from "../runtime-config";
9
- export class RuntimeConfigLoaderService {
10
- constructor(_http, config) {
11
- this._http = _http;
12
- this.configUrl = './assets/config.json';
13
- this.configObject = null;
14
- this.configSubject = new Subject();
15
- if (config) {
16
- this.configUrl = config.configUrl;
17
- }
18
- }
19
- loadConfig() {
20
- const urls = Array.isArray(this.configUrl)
21
- ? this.configUrl
22
- : [this.configUrl];
23
- const observables = urls.map((url) => this.makeHttpCall(url));
24
- return forkJoin(observables).pipe(tap((configDataArray) => {
25
- this.configObject = configDataArray.reduce((acc, configData) => {
26
- return { ...acc, ...configData };
27
- }, {});
28
- this.configSubject.next(this.configObject);
29
- }), catchError((err) => {
30
- console.error('Error loading config: ', err);
31
- this.configObject = null;
32
- this.configSubject.next(this.configObject);
33
- return of(null);
34
- }));
35
- }
36
- makeHttpCall(url) {
37
- return this._http.get(url).pipe(take(1));
38
- }
39
- getConfig() {
40
- return this.configObject;
41
- }
42
- getConfigObjectKey(key) {
43
- return this.configObject ? this.configObject[key] : null;
44
- }
45
- }
46
- RuntimeConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService, deps: [{ token: i1.HttpClient }, { token: i2.RuntimeConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
47
- RuntimeConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService });
48
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService, decorators: [{
49
- type: Injectable
50
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.RuntimeConfig, decorators: [{
51
- type: Optional
52
- }] }]; } });
53
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVudGltZS1jb25maWctbG9hZGVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8u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b25maWdPYmplY3QgPSBudWxsO1xuXHRcdFx0XHR0aGlzLmNvbmZpZ1N1YmplY3QubmV4dCh0aGlzLmNvbmZpZ09iamVjdCk7XG5cdFx0XHRcdHJldHVybiBvZihudWxsKTtcblx0XHRcdH0pXG5cdFx0KTtcblx0fVxuXG5cdHByaXZhdGUgbWFrZUh0dHBDYWxsKHVybDogc3RyaW5nKTogT2JzZXJ2YWJsZTxhbnk+IHtcblx0XHRyZXR1cm4gdGhpcy5faHR0cC5nZXQodXJsKS5waXBlKHRha2UoMSkpO1xuXHR9XG5cblx0Z2V0Q29uZmlnKCkge1xuXHRcdHJldHVybiB0aGlzLmNvbmZpZ09iamVjdDtcblx0fVxuXG5cdGdldENvbmZpZ09iamVjdEtleShrZXk6IHN0cmluZykge1xuXHRcdHJldHVybiB0aGlzLmNvbmZpZ09iamVjdCA/IHRoaXMuY29uZmlnT2JqZWN0W2tleV0gOiBudWxsO1xuXHR9XG59XG4iXX0=
@@ -1,49 +0,0 @@
1
- import { HttpClientModule } from '@angular/common/http';
2
- import { APP_INITIALIZER, NgModule } from '@angular/core';
3
- import { RuntimeConfig } from './runtime-config';
4
- import { RuntimeConfigLoaderService } from './runtime-config-loader/runtime-config-loader.service';
5
- import * as i0 from "@angular/core";
6
- export function initConfig(configSvc) {
7
- return () => configSvc.loadConfig();
8
- }
9
- export class RuntimeConfigLoaderModule {
10
- static forRoot(config) {
11
- return {
12
- ngModule: RuntimeConfigLoaderModule,
13
- providers: [
14
- {
15
- provide: RuntimeConfig,
16
- useValue: config,
17
- },
18
- RuntimeConfigLoaderService,
19
- ],
20
- };
21
- }
22
- }
23
- RuntimeConfigLoaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
24
- RuntimeConfigLoaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, imports: [HttpClientModule] });
25
- RuntimeConfigLoaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, providers: [
26
- RuntimeConfigLoaderService,
27
- {
28
- provide: APP_INITIALIZER,
29
- useFactory: initConfig,
30
- deps: [RuntimeConfigLoaderService],
31
- multi: true,
32
- },
33
- ], imports: [HttpClientModule] });
34
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, decorators: [{
35
- type: NgModule,
36
- args: [{
37
- imports: [HttpClientModule],
38
- providers: [
39
- RuntimeConfigLoaderService,
40
- {
41
- provide: APP_INITIALIZER,
42
- useFactory: initConfig,
43
- deps: [RuntimeConfigLoaderService],
44
- multi: true,
45
- },
46
- ],
47
- }]
48
- }] });
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVudGltZS1jb25maWctbG9hZGVyLm1vZHVsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvcnVudGltZS1jb25maWctbG9hZGVyL3NyYy9saWIvcnVudGltZS1jb25maWctbG9hZGVyLm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN4RCxPQUFPLEVBQUUsZUFBZSxFQUF1QixRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDL0UsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLGtCQUFrQixDQUFDO0FBQ2pELE9BQU8sRUFBRSwwQkFBMEIsRUFBRSxNQUFNLHVEQUF1RCxDQUFDOztBQUVuRyxNQUFNLFVBQVUsVUFBVSxDQUFDLFNBQXFDO0lBQy9ELE9BQU8sR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xuXHRcdFx0XHRcdHVzZVZhbHVlOiBjb25maWcsXG5cdFx0XHRcdH0sXG5cdFx0XHRcdFJ1bnRpbWVDb25maWdMb2FkZXJTZXJ2aWNlLFxuXHRcdFx0XSxcblx0XHR9O1xuXHR9XG59XG4iXX0=
@@ -1,6 +0,0 @@
1
- export class RuntimeConfig {
2
- constructor(obj = {}) {
3
- this.configUrl = obj.configUrl || './assets/config.json';
4
- }
5
- }
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVudGltZS1jb25maWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL3J1bnRpbWUtY29uZmlnLWxvYWRlci9zcmMvbGliL3J1bnRpbWUtY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sT0FBTyxhQUFhO0lBR3pCLFlBQVksTUFBVyxFQUFFO1FBQ3hCLElBQUksQ0FBQyxTQUFTLEdBQUcsR0FBRyxDQUFDLFNBQVMsSUFBSSxzQkFBc0IsQ0FBQztJQUMxRCxDQUFDO0NBQ0QiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY2xhc3MgUnVudGltZUNvbmZpZyB7XG5cdGNvbmZpZ1VybDogc3RyaW5nIHwgc3RyaW5nW107XG5cblx0Y29uc3RydWN0b3Iob2JqOiBhbnkgPSB7fSkge1xuXHRcdHRoaXMuY29uZmlnVXJsID0gb2JqLmNvbmZpZ1VybCB8fCAnLi9hc3NldHMvY29uZmlnLmpzb24nO1xuXHR9XG59XG4iXX0=
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnVudGltZS1jb25maWctbG9hZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vbGlicy9ydW50aW1lLWNvbmZpZy1sb2FkZXIvc3JjL3J1bnRpbWUtY29uZmlnLWxvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
@@ -1,110 +0,0 @@
1
- import * as i1 from '@angular/common/http';
2
- import { HttpClientModule } from '@angular/common/http';
3
- import * as i0 from '@angular/core';
4
- import { Injectable, Optional, APP_INITIALIZER, NgModule } from '@angular/core';
5
- import { Subject, forkJoin, of } from 'rxjs';
6
- import { tap, catchError, take } from 'rxjs/operators';
7
-
8
- class RuntimeConfig {
9
- constructor(obj = {}) {
10
- this.configUrl = obj.configUrl || './assets/config.json';
11
- }
12
- }
13
-
14
- class RuntimeConfigLoaderService {
15
- constructor(_http, config) {
16
- this._http = _http;
17
- this.configUrl = './assets/config.json';
18
- this.configObject = null;
19
- this.configSubject = new Subject();
20
- if (config) {
21
- this.configUrl = config.configUrl;
22
- }
23
- }
24
- loadConfig() {
25
- const urls = Array.isArray(this.configUrl)
26
- ? this.configUrl
27
- : [this.configUrl];
28
- const observables = urls.map((url) => this.makeHttpCall(url));
29
- return forkJoin(observables).pipe(tap((configDataArray) => {
30
- this.configObject = configDataArray.reduce((acc, configData) => {
31
- return Object.assign(Object.assign({}, acc), configData);
32
- }, {});
33
- this.configSubject.next(this.configObject);
34
- }), catchError((err) => {
35
- console.error('Error loading config: ', err);
36
- this.configObject = null;
37
- this.configSubject.next(this.configObject);
38
- return of(null);
39
- }));
40
- }
41
- makeHttpCall(url) {
42
- return this._http.get(url).pipe(take(1));
43
- }
44
- getConfig() {
45
- return this.configObject;
46
- }
47
- getConfigObjectKey(key) {
48
- return this.configObject ? this.configObject[key] : null;
49
- }
50
- }
51
- RuntimeConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService, deps: [{ token: i1.HttpClient }, { token: RuntimeConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
52
- RuntimeConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService });
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService, decorators: [{
54
- type: Injectable
55
- }], ctorParameters: function () {
56
- return [{ type: i1.HttpClient }, { type: RuntimeConfig, decorators: [{
57
- type: Optional
58
- }] }];
59
- } });
60
-
61
- function initConfig(configSvc) {
62
- return () => configSvc.loadConfig();
63
- }
64
- class RuntimeConfigLoaderModule {
65
- static forRoot(config) {
66
- return {
67
- ngModule: RuntimeConfigLoaderModule,
68
- providers: [
69
- {
70
- provide: RuntimeConfig,
71
- useValue: config,
72
- },
73
- RuntimeConfigLoaderService,
74
- ],
75
- };
76
- }
77
- }
78
- RuntimeConfigLoaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
79
- RuntimeConfigLoaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, imports: [HttpClientModule] });
80
- RuntimeConfigLoaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, providers: [
81
- RuntimeConfigLoaderService,
82
- {
83
- provide: APP_INITIALIZER,
84
- useFactory: initConfig,
85
- deps: [RuntimeConfigLoaderService],
86
- multi: true,
87
- },
88
- ], imports: [HttpClientModule] });
89
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, decorators: [{
90
- type: NgModule,
91
- args: [{
92
- imports: [HttpClientModule],
93
- providers: [
94
- RuntimeConfigLoaderService,
95
- {
96
- provide: APP_INITIALIZER,
97
- useFactory: initConfig,
98
- deps: [RuntimeConfigLoaderService],
99
- multi: true,
100
- },
101
- ],
102
- }]
103
- }] });
104
-
105
- /**
106
- * Generated bundle index. Do not edit.
107
- */
108
-
109
- export { RuntimeConfig, RuntimeConfigLoaderModule, RuntimeConfigLoaderService, initConfig };
110
- //# sourceMappingURL=runtime-config-loader.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-config-loader.mjs","sources":["../../../../libs/runtime-config-loader/src/lib/runtime-config.ts","../../../../libs/runtime-config-loader/src/lib/runtime-config-loader/runtime-config-loader.service.ts","../../../../libs/runtime-config-loader/src/lib/runtime-config-loader.module.ts","../../../../libs/runtime-config-loader/src/runtime-config-loader.ts"],"sourcesContent":["export class RuntimeConfig {\n\tconfigUrl: string | string[];\n\n\tconstructor(obj: any = {}) {\n\t\tthis.configUrl = obj.configUrl || './assets/config.json';\n\t}\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable, Optional } from '@angular/core';\nimport { RuntimeConfig } from '../runtime-config';\nimport { forkJoin, Observable, of, Subject, zip } from 'rxjs';\nimport { catchError, take, tap } from 'rxjs/operators';\n\n@Injectable()\nexport class RuntimeConfigLoaderService {\n\tprivate configUrl: string | string[] = './assets/config.json';\n\tprivate configObject: any = null;\n\tpublic configSubject: Subject<any> = new Subject<any>();\n\n\tconstructor(private _http: HttpClient, @Optional() config: RuntimeConfig) {\n\t\tif (config) {\n\t\t\tthis.configUrl = config.configUrl;\n\t\t}\n\t}\n\n\tloadConfig(): Observable<any> {\n\t\tconst urls: string[] = Array.isArray(this.configUrl)\n\t\t\t? this.configUrl\n\t\t\t: [this.configUrl];\n\n\t\tconst observables: Observable<any>[] = urls.map((url) =>\n\t\t\tthis.makeHttpCall(url)\n\t\t);\n\n\t\treturn forkJoin(observables).pipe(\n\t\t\ttap((configDataArray: any[]) => {\n\t\t\t\tthis.configObject = configDataArray.reduce(\n\t\t\t\t\t(acc, configData) => {\n\t\t\t\t\t\treturn { ...acc, ...configData };\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\tthis.configSubject.next(this.configObject);\n\t\t\t}),\n\t\t\tcatchError((err: any) => {\n\t\t\t\tconsole.error('Error loading config: ', err);\n\t\t\t\tthis.configObject = null;\n\t\t\t\tthis.configSubject.next(this.configObject);\n\t\t\t\treturn of(null);\n\t\t\t})\n\t\t);\n\t}\n\n\tprivate makeHttpCall(url: string): Observable<any> {\n\t\treturn this._http.get(url).pipe(take(1));\n\t}\n\n\tgetConfig() {\n\t\treturn this.configObject;\n\t}\n\n\tgetConfigObjectKey(key: string) {\n\t\treturn this.configObject ? this.configObject[key] : null;\n\t}\n}\n","import { HttpClientModule } from '@angular/common/http';\nimport { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';\nimport { RuntimeConfig } from './runtime-config';\nimport { RuntimeConfigLoaderService } from './runtime-config-loader/runtime-config-loader.service';\n\nexport function initConfig(configSvc: RuntimeConfigLoaderService) {\n\treturn () => configSvc.loadConfig();\n}\n\n@NgModule({\n\timports: [HttpClientModule],\n\tproviders: [\n\t\tRuntimeConfigLoaderService,\n\t\t{\n\t\t\tprovide: APP_INITIALIZER,\n\t\t\tuseFactory: initConfig,\n\t\t\tdeps: [RuntimeConfigLoaderService],\n\t\t\tmulti: true,\n\t\t},\n\t],\n})\nexport class RuntimeConfigLoaderModule {\n\tstatic forRoot(\n\t\tconfig: RuntimeConfig\n\t): ModuleWithProviders<RuntimeConfigLoaderModule> {\n\t\treturn {\n\t\t\tngModule: RuntimeConfigLoaderModule,\n\t\t\tproviders: [\n\t\t\t\t{\n\t\t\t\t\tprovide: RuntimeConfig,\n\t\t\t\t\tuseValue: config,\n\t\t\t\t},\n\t\t\t\tRuntimeConfigLoaderService,\n\t\t\t],\n\t\t};\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.RuntimeConfig"],"mappings":";;;;;;;MAAa,aAAa,CAAA;IAGzB,WAAY,CAAA,MAAW,EAAE,EAAA;QACxB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,sBAAsB,CAAC;KACzD;AACD;;MCCY,0BAA0B,CAAA;IAKtC,WAAoB,CAAA,KAAiB,EAAc,MAAqB,EAAA;AAApD,QAAA,IAAK,CAAA,KAAA,GAAL,KAAK,CAAY;AAJ7B,QAAA,IAAS,CAAA,SAAA,GAAsB,sBAAsB,CAAC;AACtD,QAAA,IAAY,CAAA,YAAA,GAAQ,IAAI,CAAC;AAC1B,QAAA,IAAA,CAAA,aAAa,GAAiB,IAAI,OAAO,EAAO,CAAC;AAGvD,QAAA,IAAI,MAAM,EAAE;AACX,YAAA,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAClC,SAAA;KACD;IAED,UAAU,GAAA;QACT,MAAM,IAAI,GAAa,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;cACjD,IAAI,CAAC,SAAS;AAChB,cAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAEpB,QAAA,MAAM,WAAW,GAAsB,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KACnD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CACtB,CAAC;AAEF,QAAA,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC,IAAI,CAChC,GAAG,CAAC,CAAC,eAAsB,KAAI;AAC9B,YAAA,IAAI,CAAC,YAAY,GAAG,eAAe,CAAC,MAAM,CACzC,CAAC,GAAG,EAAE,UAAU,KAAI;gBACnB,OAAY,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,E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;4BACtB,IAAI,EAAE,CAAC,0BAA0B,CAAC;AAClC,4BAAA,KAAK,EAAE,IAAI;AACX,yBAAA;AACD,qBAAA;iBACD,CAAA;;;ACpBD;;AAEG;;;;"}
@@ -1,108 +0,0 @@
1
- import * as i1 from '@angular/common/http';
2
- import { HttpClientModule } from '@angular/common/http';
3
- import * as i0 from '@angular/core';
4
- import { Injectable, Optional, APP_INITIALIZER, NgModule } from '@angular/core';
5
- import { Subject, forkJoin, of } from 'rxjs';
6
- import { tap, catchError, take } from 'rxjs/operators';
7
-
8
- class RuntimeConfig {
9
- constructor(obj = {}) {
10
- this.configUrl = obj.configUrl || './assets/config.json';
11
- }
12
- }
13
-
14
- class RuntimeConfigLoaderService {
15
- constructor(_http, config) {
16
- this._http = _http;
17
- this.configUrl = './assets/config.json';
18
- this.configObject = null;
19
- this.configSubject = new Subject();
20
- if (config) {
21
- this.configUrl = config.configUrl;
22
- }
23
- }
24
- loadConfig() {
25
- const urls = Array.isArray(this.configUrl)
26
- ? this.configUrl
27
- : [this.configUrl];
28
- const observables = urls.map((url) => this.makeHttpCall(url));
29
- return forkJoin(observables).pipe(tap((configDataArray) => {
30
- this.configObject = configDataArray.reduce((acc, configData) => {
31
- return { ...acc, ...configData };
32
- }, {});
33
- this.configSubject.next(this.configObject);
34
- }), catchError((err) => {
35
- console.error('Error loading config: ', err);
36
- this.configObject = null;
37
- this.configSubject.next(this.configObject);
38
- return of(null);
39
- }));
40
- }
41
- makeHttpCall(url) {
42
- return this._http.get(url).pipe(take(1));
43
- }
44
- getConfig() {
45
- return this.configObject;
46
- }
47
- getConfigObjectKey(key) {
48
- return this.configObject ? this.configObject[key] : null;
49
- }
50
- }
51
- RuntimeConfigLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService, deps: [{ token: i1.HttpClient }, { token: RuntimeConfig, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
52
- RuntimeConfigLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService });
53
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderService, decorators: [{
54
- type: Injectable
55
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: RuntimeConfig, decorators: [{
56
- type: Optional
57
- }] }]; } });
58
-
59
- function initConfig(configSvc) {
60
- return () => configSvc.loadConfig();
61
- }
62
- class RuntimeConfigLoaderModule {
63
- static forRoot(config) {
64
- return {
65
- ngModule: RuntimeConfigLoaderModule,
66
- providers: [
67
- {
68
- provide: RuntimeConfig,
69
- useValue: config,
70
- },
71
- RuntimeConfigLoaderService,
72
- ],
73
- };
74
- }
75
- }
76
- RuntimeConfigLoaderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
77
- RuntimeConfigLoaderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, imports: [HttpClientModule] });
78
- RuntimeConfigLoaderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, providers: [
79
- RuntimeConfigLoaderService,
80
- {
81
- provide: APP_INITIALIZER,
82
- useFactory: initConfig,
83
- deps: [RuntimeConfigLoaderService],
84
- multi: true,
85
- },
86
- ], imports: [HttpClientModule] });
87
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RuntimeConfigLoaderModule, decorators: [{
88
- type: NgModule,
89
- args: [{
90
- imports: [HttpClientModule],
91
- providers: [
92
- RuntimeConfigLoaderService,
93
- {
94
- provide: APP_INITIALIZER,
95
- useFactory: initConfig,
96
- deps: [RuntimeConfigLoaderService],
97
- multi: true,
98
- },
99
- ],
100
- }]
101
- }] });
102
-
103
- /**
104
- * Generated bundle index. Do not edit.
105
- */
106
-
107
- export { RuntimeConfig, RuntimeConfigLoaderModule, RuntimeConfigLoaderService, initConfig };
108
- //# sourceMappingURL=runtime-config-loader.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-config-loader.mjs","sources":["../../../../libs/runtime-config-loader/src/lib/runtime-config.ts","../../../../libs/runtime-config-loader/src/lib/runtime-config-loader/runtime-config-loader.service.ts","../../../../libs/runtime-config-loader/src/lib/runtime-config-loader.module.ts","../../../../libs/runtime-config-loader/src/runtime-config-loader.ts"],"sourcesContent":["export class RuntimeConfig {\n\tconfigUrl: string | string[];\n\n\tconstructor(obj: any = {}) {\n\t\tthis.configUrl = obj.configUrl || './assets/config.json';\n\t}\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable, Optional } from '@angular/core';\nimport { RuntimeConfig } from '../runtime-config';\nimport { forkJoin, Observable, of, Subject, zip } from 'rxjs';\nimport { catchError, take, tap } from 'rxjs/operators';\n\n@Injectable()\nexport class RuntimeConfigLoaderService {\n\tprivate configUrl: string | string[] = './assets/config.json';\n\tprivate configObject: any = null;\n\tpublic configSubject: Subject<any> = new Subject<any>();\n\n\tconstructor(private _http: HttpClient, @Optional() config: RuntimeConfig) {\n\t\tif (config) {\n\t\t\tthis.configUrl = config.configUrl;\n\t\t}\n\t}\n\n\tloadConfig(): Observable<any> {\n\t\tconst urls: string[] = Array.isArray(this.configUrl)\n\t\t\t? this.configUrl\n\t\t\t: [this.configUrl];\n\n\t\tconst observables: Observable<any>[] = urls.map((url) =>\n\t\t\tthis.makeHttpCall(url)\n\t\t);\n\n\t\treturn forkJoin(observables).pipe(\n\t\t\ttap((configDataArray: any[]) => {\n\t\t\t\tthis.configObject = configDataArray.reduce(\n\t\t\t\t\t(acc, configData) => {\n\t\t\t\t\t\treturn { ...acc, ...configData };\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\tthis.configSubject.next(this.configObject);\n\t\t\t}),\n\t\t\tcatchError((err: any) => {\n\t\t\t\tconsole.error('Error loading config: ', err);\n\t\t\t\tthis.configObject = null;\n\t\t\t\tthis.configSubject.next(this.configObject);\n\t\t\t\treturn of(null);\n\t\t\t})\n\t\t);\n\t}\n\n\tprivate makeHttpCall(url: string): Observable<any> {\n\t\treturn this._http.get(url).pipe(take(1));\n\t}\n\n\tgetConfig() {\n\t\treturn this.configObject;\n\t}\n\n\tgetConfigObjectKey(key: string) {\n\t\treturn this.configObject ? this.configObject[key] : null;\n\t}\n}\n","import { HttpClientModule } from '@angular/common/http';\nimport { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';\nimport { RuntimeConfig } from './runtime-config';\nimport { RuntimeConfigLoaderService } from './runtime-config-loader/runtime-config-loader.service';\n\nexport function initConfig(configSvc: RuntimeConfigLoaderService) {\n\treturn () => configSvc.loadConfig();\n}\n\n@NgModule({\n\timports: [HttpClientModule],\n\tproviders: [\n\t\tRuntimeConfigLoaderService,\n\t\t{\n\t\t\tprovide: APP_INITIALIZER,\n\t\t\tuseFactory: initConfig,\n\t\t\tdeps: [RuntimeConfigLoaderService],\n\t\t\tmulti: true,\n\t\t},\n\t],\n})\nexport class RuntimeConfigLoaderModule {\n\tstatic forRoot(\n\t\tconfig: RuntimeConfig\n\t): ModuleWithProviders<RuntimeConfigLoaderModule> {\n\t\treturn {\n\t\t\tngModule: RuntimeConfigLoaderModule,\n\t\t\tproviders: [\n\t\t\t\t{\n\t\t\t\t\tprovide: RuntimeConfig,\n\t\t\t\t\tuseValue: config,\n\t\t\t\t},\n\t\t\t\tRuntimeConfigLoaderService,\n\t\t\t],\n\t\t};\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2.RuntimeConfig"],"mappings":";;;;;;;MAAa,aAAa,CAAA;AAGzB,IAAA,WAAA,CAAY,MAA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AC;KACF;;sHAdW,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAzB,yBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,YAX3B,gBAAgB,CAAA,EAAA,CAAA,CAAA;AAWd,yBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,yBAAyB,EAV1B,SAAA,EAAA;QACV,0BAA0B;AAC1B,QAAA;AACC,YAAA,OAAO,EAAE,eAAe;AACxB,YAAA,UAAU,EAAE,UAAU;YACtB,IAAI,EAAE,CAAC,0BAA0B,CAAC;AAClC,YAAA,KAAK,EAAE,IAAI;AACX,SAAA;AACD,KAAA,EAAA,OAAA,EAAA,CATS,gBAAgB,CAAA,EAAA,CAAA,CAAA;2FAWd,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBAZrC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACT,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC3B,oBAAA,SAAS,EAAE;wBACV,0BAA0B;AAC1B,wBAAA;AACC,4BAAA,OAAO,EAAE,eAAe;AACxB,4BAAA,UAAU,EAAE,UAAU;4BACtB,IAAI,EAAE,CAAC,0BAA0B,CAAC;AAClC,4BAAA,KAAK,EAAE,IAAI;AACX,yBAAA;AACD,qBAAA;AACD,iBAAA,CAAA;;;ACpBD;;AAEG;;;;"}
package/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './lib/runtime-config-loader.module';
2
- export * from './lib/runtime-config';
3
- export * from './lib/runtime-config-loader/runtime-config-loader.service';
@@ -1,17 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { RuntimeConfig } from '../runtime-config';
3
- import { Observable, Subject } from 'rxjs';
4
- import * as i0 from "@angular/core";
5
- export declare class RuntimeConfigLoaderService {
6
- private _http;
7
- private configUrl;
8
- private configObject;
9
- configSubject: Subject<any>;
10
- constructor(_http: HttpClient, config: RuntimeConfig);
11
- loadConfig(): Observable<any>;
12
- private makeHttpCall;
13
- getConfig(): any;
14
- getConfigObjectKey(key: string): any;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeConfigLoaderService, [null, { optional: true; }]>;
16
- static ɵprov: i0.ɵɵInjectableDeclaration<RuntimeConfigLoaderService>;
17
- }
@@ -1,12 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { RuntimeConfig } from './runtime-config';
3
- import { RuntimeConfigLoaderService } from './runtime-config-loader/runtime-config-loader.service';
4
- import * as i0 from "@angular/core";
5
- import * as i1 from "@angular/common/http";
6
- export declare function initConfig(configSvc: RuntimeConfigLoaderService): () => import("rxjs").Observable<any>;
7
- export declare class RuntimeConfigLoaderModule {
8
- static forRoot(config: RuntimeConfig): ModuleWithProviders<RuntimeConfigLoaderModule>;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeConfigLoaderModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<RuntimeConfigLoaderModule, never, [typeof i1.HttpClientModule], never>;
11
- static ɵinj: i0.ɵɵInjectorDeclaration<RuntimeConfigLoaderModule>;
12
- }
@@ -1,4 +0,0 @@
1
- export declare class RuntimeConfig {
2
- configUrl: string | string[];
3
- constructor(obj?: any);
4
- }
Binary file