@eggslib/configuration 19.0.1 → 20.0.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.
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Injectable } from '@angular/core';
|
|
3
|
-
import {
|
|
2
|
+
import { inject, EventEmitter, Injectable } from '@angular/core';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import { firstValueFrom, forkJoin } from 'rxjs';
|
|
4
5
|
import { map } from 'rxjs/operators';
|
|
5
|
-
import * as i1 from '@angular/common/http';
|
|
6
6
|
|
|
7
7
|
class ConfigurationService {
|
|
8
|
-
http;
|
|
8
|
+
http = inject(HttpClient);
|
|
9
9
|
otherconfig;
|
|
10
10
|
pathconfig;
|
|
11
11
|
keycloakconfig;
|
|
12
12
|
configChanged = new EventEmitter();
|
|
13
|
-
constructor(http) {
|
|
14
|
-
this.http = http;
|
|
15
|
-
}
|
|
16
13
|
init(pathconfig, otherconfig, keycloakconfig) {
|
|
17
14
|
const calls = [];
|
|
18
15
|
calls.push(this.http.get(pathconfig));
|
|
@@ -22,7 +19,7 @@ class ConfigurationService {
|
|
|
22
19
|
if (keycloakconfig) {
|
|
23
20
|
calls.push(this.http.get(keycloakconfig));
|
|
24
21
|
}
|
|
25
|
-
return forkJoin(calls)
|
|
22
|
+
return firstValueFrom(forkJoin(calls)
|
|
26
23
|
.pipe(map(res => {
|
|
27
24
|
this.pathconfig = res[0];
|
|
28
25
|
if (otherconfig) {
|
|
@@ -32,8 +29,7 @@ class ConfigurationService {
|
|
|
32
29
|
this.keycloakconfig = res[2];
|
|
33
30
|
}
|
|
34
31
|
this.configChanged.emit();
|
|
35
|
-
}))
|
|
36
|
-
.toPromise();
|
|
32
|
+
})));
|
|
37
33
|
}
|
|
38
34
|
get(key) {
|
|
39
35
|
let res = this.pathconfig ? this.pathconfig[key] : null;
|
|
@@ -45,15 +41,15 @@ class ConfigurationService {
|
|
|
45
41
|
}
|
|
46
42
|
return res;
|
|
47
43
|
}
|
|
48
|
-
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
49
|
-
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
44
|
+
/** @nocollapse */ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.26", ngImport: i0, type: ConfigurationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
45
|
+
/** @nocollapse */ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.26", ngImport: i0, type: ConfigurationService, providedIn: 'root' });
|
|
50
46
|
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.26", ngImport: i0, type: ConfigurationService, decorators: [{
|
|
52
48
|
type: Injectable,
|
|
53
49
|
args: [{
|
|
54
50
|
providedIn: 'root'
|
|
55
51
|
}]
|
|
56
|
-
}]
|
|
52
|
+
}] });
|
|
57
53
|
|
|
58
54
|
/**
|
|
59
55
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eggslib-configuration.mjs","sources":["../../../projects/configuration/src/lib/configuration.service.ts","../../../projects/configuration/src/eggslib-configuration.ts"],"sourcesContent":["import {EventEmitter, Injectable} from '@angular/core';\nimport {HttpClient} from '@angular/common/http';\nimport {forkJoin, Observable} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigurationService {\n\n private otherconfig
|
|
1
|
+
{"version":3,"file":"eggslib-configuration.mjs","sources":["../../../projects/configuration/src/lib/configuration.service.ts","../../../projects/configuration/src/eggslib-configuration.ts"],"sourcesContent":["import { EventEmitter, Injectable, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport {firstValueFrom, forkJoin, Observable} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nexport type ConfigurationValues = Record<string, unknown>;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class ConfigurationService {\n private http = inject(HttpClient);\n\n private otherconfig?: ConfigurationValues;\n private pathconfig?: ConfigurationValues;\n private keycloakconfig?: ConfigurationValues;\n\n public configChanged: EventEmitter<void> = new EventEmitter<void>();\n\n public init(pathconfig: string, otherconfig?: string, keycloakconfig?: string): Promise<void> {\n const calls: Observable<ConfigurationValues>[] = [];\n calls.push(this.http.get<ConfigurationValues>(pathconfig));\n if (otherconfig) {\n calls.push(this.http.get<ConfigurationValues>(otherconfig));\n }\n if (keycloakconfig) {\n calls.push(this.http.get<ConfigurationValues>(keycloakconfig));\n }\n return firstValueFrom(forkJoin(calls)\n .pipe(\n map(res => {\n this.pathconfig = res[0];\n if (otherconfig) {\n this.otherconfig = res[1];\n }\n if (keycloakconfig) {\n this.keycloakconfig = res[2];\n }\n this.configChanged.emit();\n })\n ));\n }\n\n public get(key: string): unknown {\n let res: unknown = this.pathconfig ? this.pathconfig[key] : null;\n if (!res) {\n res = this.otherconfig ? this.otherconfig[key] : null;\n }\n if (!res) {\n res = this.keycloakconfig ? this.keycloakconfig[key] : null;\n }\n return res;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAUa,oBAAoB,CAAA;AACrB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;AAEzB,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,cAAc;AAEf,IAAA,aAAa,GAAuB,IAAI,YAAY,EAAQ;AAE5D,IAAA,IAAI,CAAC,UAAkB,EAAE,WAAoB,EAAE,cAAuB,EAAA;QACzE,MAAM,KAAK,GAAsC,EAAE;AACnD,QAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,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AA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cAFjB,MAAM,EAAA,CAAA;;4FAET,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACTD;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
declare class ConfigurationService {
|
|
5
|
+
private http;
|
|
6
|
+
private otherconfig?;
|
|
7
|
+
private pathconfig?;
|
|
8
|
+
private keycloakconfig?;
|
|
9
|
+
configChanged: EventEmitter<void>;
|
|
10
|
+
init(pathconfig: string, otherconfig?: string, keycloakconfig?: string): Promise<void>;
|
|
11
|
+
get(key: string): unknown;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurationService, never>;
|
|
13
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ConfigurationService>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { ConfigurationService };
|
package/package.json
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggslib/configuration",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Configuration",
|
|
3
|
+
"version": "20.0.0",
|
|
4
|
+
"description": "Configuration Library",
|
|
5
5
|
"author": "Alessandro Prandini",
|
|
6
|
-
"peerDependencies": {
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@angular/common": "^20.0.0",
|
|
8
|
+
"@angular/core": "^20.0.0"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"tslib": "^2.3.0"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org/",
|
|
16
|
+
"provenance": false
|
|
17
|
+
},
|
|
7
18
|
"module": "fesm2022/eggslib-configuration.mjs",
|
|
8
19
|
"typings": "index.d.ts",
|
|
9
20
|
"exports": {
|
|
@@ -15,8 +26,5 @@
|
|
|
15
26
|
"default": "./fesm2022/eggslib-configuration.mjs"
|
|
16
27
|
}
|
|
17
28
|
},
|
|
18
|
-
"sideEffects": false
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"tslib": "^2.3.0"
|
|
21
|
-
}
|
|
29
|
+
"sideEffects": false
|
|
22
30
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class ConfigurationService {
|
|
5
|
-
private http;
|
|
6
|
-
private otherconfig;
|
|
7
|
-
private pathconfig;
|
|
8
|
-
private keycloakconfig;
|
|
9
|
-
configChanged: EventEmitter<void>;
|
|
10
|
-
constructor(http: HttpClient);
|
|
11
|
-
init(pathconfig: string, otherconfig?: string, keycloakconfig?: string): Promise<void>;
|
|
12
|
-
get(key: string): any;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurationService, never>;
|
|
14
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ConfigurationService>;
|
|
15
|
-
}
|
package/public-api.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ConfigurationService } from './lib/configuration.service';
|