ngssm-smusdi 22.1.0 → 22.2.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.
- package/fesm2022/ngssm-smusdi.mjs +15 -27
- package/fesm2022/ngssm-smusdi.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngssm-smusdi.d.ts +21 -28
|
@@ -1,33 +1,21 @@
|
|
|
1
|
-
import { inject, makeEnvironmentProviders, provideAppInitializer } from
|
|
2
|
-
import { HttpClient } from
|
|
3
|
-
import { Store } from
|
|
4
|
-
import { NgssmLoadDataSourceValueAction, provideNgssmDataSource } from
|
|
5
|
-
|
|
6
|
-
const serviceInfoKey = 'service-info';
|
|
1
|
+
import { inject, makeEnvironmentProviders, provideAppInitializer } from "@angular/core";
|
|
2
|
+
import { HttpClient } from "@angular/common/http";
|
|
3
|
+
import { Store } from "ngssm-store";
|
|
4
|
+
import { NgssmLoadDataSourceValueAction, provideNgssmDataSource } from "ngssm-data";
|
|
5
|
+
const serviceInfoKey = "service-info";
|
|
7
6
|
const serviceInfoLoader = (_, dataSourceKey, parameter) => {
|
|
8
|
-
|
|
9
|
-
return httpClient.get(parameter ?? '');
|
|
7
|
+
return inject(HttpClient).get(parameter ?? "");
|
|
10
8
|
};
|
|
11
|
-
|
|
12
9
|
const loadServiceInfoAtStartup = async () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return true;
|
|
10
|
+
inject(Store).dispatchAction(new NgssmLoadDataSourceValueAction(serviceInfoKey, { forceReload: true }));
|
|
11
|
+
return true;
|
|
16
12
|
};
|
|
17
|
-
const provideNgssmSmusdi = (infoUrl =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
const provideNgssmSmusdi = (infoUrl = "../info") => {
|
|
14
|
+
return makeEnvironmentProviders([provideNgssmDataSource(serviceInfoKey, serviceInfoLoader, {
|
|
15
|
+
dataLifetimeInSeconds: 600,
|
|
16
|
+
initialParameter: infoUrl
|
|
17
|
+
}), provideAppInitializer(loadServiceInfoAtStartup)]);
|
|
22
18
|
};
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
* Public API Surface of ngssm-smusdi
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Generated bundle index. Do not edit.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
19
|
export { provideNgssmSmusdi, serviceInfoKey, serviceInfoLoader };
|
|
33
|
-
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=ngssm-smusdi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngssm-smusdi.mjs","sources":["../../../projects/ngssm-smusdi/src/lib/service-info.ts","../../../projects/ngssm-smusdi/src/lib/provide-ngssm-smusdi.ts"
|
|
1
|
+
{"version":3,"file":"ngssm-smusdi.mjs","names":[],"sources":["../../../projects/ngssm-smusdi/src/lib/service-info.ts","../../../projects/ngssm-smusdi/src/lib/provide-ngssm-smusdi.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\n\nimport { State } from 'ngssm-store';\nimport { NgssmDataLoading } from 'ngssm-data';\n\nimport { OauthInfo } from './oauth-info';\n\nexport const serviceInfoKey = 'service-info';\n\nexport interface ProvidedCustomElements {\n script: string;\n customElements: string[];\n}\n\nexport interface ServiceInfo {\n serviceName: string;\n serviceVersion: string;\n environment: string;\n oauth?: OauthInfo;\n customElements?: ProvidedCustomElements;\n serviceUrl?: string;\n}\n\nexport const serviceInfoLoader: NgssmDataLoading<ServiceInfo, string> = (_: State, dataSourceKey, parameter?: string) => {\n const httpClient = inject(HttpClient);\n return httpClient.get<ServiceInfo>(parameter ?? '');\n};\n","import { EnvironmentProviders, inject, makeEnvironmentProviders, provideAppInitializer } from '@angular/core';\n\nimport { Store } from 'ngssm-store';\nimport { NgssmLoadDataSourceValueAction, provideNgssmDataSource } from 'ngssm-data';\n\nimport { serviceInfoKey, serviceInfoLoader } from './service-info';\n\nconst loadServiceInfoAtStartup = async () => {\n const store = inject(Store);\n store.dispatchAction(new NgssmLoadDataSourceValueAction(serviceInfoKey, { forceReload: true }));\n return true;\n};\n\nexport const provideNgssmSmusdi = (infoUrl = '../info'): EnvironmentProviders => {\n return makeEnvironmentProviders([\n provideNgssmDataSource(serviceInfoKey, serviceInfoLoader, { dataLifetimeInSeconds: 600, initialParameter: infoUrl }),\n provideAppInitializer(loadServiceInfoAtStartup)\n ]);\n};\n"],"mappings":";;;;AAQA,MAAa,iBAAiB;AAgB9B,MAAa,qBAA4D,GAAU,eAAe,cAAsB;CAEtH,OADmB,OAAO,UACnB,CAAA,CAAW,IAAiB,aAAa,EAAE;AACpD;ACpBA,MAAM,2BAA2B,YAAW;CAE1C,AADc,OAAO,KACrB,CAAA,CAAM,eAAe,IAAI,+BAA+B,gBAAgB,EAAE,aAAa,KAAI,CAAE,CAAC;CAC9F,OAAO;AACT;AAEA,MAAa,sBAAsB,UAAU,cAAmC;CAC9E,OAAO,yBAAyB,CAC9B,uBAAuB,gBAAgB,mBAAmB;EAAE,uBAAuB;EAAK,kBAAkB;CAAO,CAAE,GACnH,sBAAsB,wBAAwB,CAC/C,CAAA;AACH"}
|
package/package.json
CHANGED
package/types/ngssm-smusdi.d.ts
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import { NgssmDataLoading } from
|
|
2
|
-
import { EnvironmentProviders } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
authority: string;
|
|
1
|
+
import { NgssmDataLoading } from "ngssm-data";
|
|
2
|
+
import { EnvironmentProviders } from "@angular/core";
|
|
3
|
+
export interface OauthInfo {
|
|
4
|
+
authority: string;
|
|
6
5
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
results: TData[];
|
|
6
|
+
export interface SearchQueryResult<TData> {
|
|
7
|
+
maxResults: number;
|
|
8
|
+
totalResults: number;
|
|
9
|
+
results: TData[];
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
customElements: string[];
|
|
11
|
+
export declare const serviceInfoKey = "service-info";
|
|
12
|
+
export interface ProvidedCustomElements {
|
|
13
|
+
script: string;
|
|
14
|
+
customElements: string[];
|
|
18
15
|
}
|
|
19
|
-
interface ServiceInfo {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
export interface ServiceInfo {
|
|
17
|
+
serviceName: string;
|
|
18
|
+
serviceVersion: string;
|
|
19
|
+
environment: string;
|
|
20
|
+
oauth?: OauthInfo;
|
|
21
|
+
customElements?: ProvidedCustomElements;
|
|
22
|
+
serviceUrl?: string;
|
|
26
23
|
}
|
|
27
|
-
declare const serviceInfoLoader: NgssmDataLoading<ServiceInfo, string>;
|
|
28
|
-
|
|
29
|
-
declare const provideNgssmSmusdi: (infoUrl?: string) => EnvironmentProviders;
|
|
30
|
-
|
|
31
|
-
export { provideNgssmSmusdi, serviceInfoKey, serviceInfoLoader };
|
|
32
|
-
export type { OauthInfo, ProvidedCustomElements, SearchQueryResult, ServiceInfo };
|
|
24
|
+
export declare const serviceInfoLoader: NgssmDataLoading<ServiceInfo, string>;
|
|
25
|
+
export declare const provideNgssmSmusdi: (infoUrl?: string) => EnvironmentProviders;
|