@o3r/apis-manager 13.0.0-next.6 → 13.0.0-prerelease.2

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,59 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Inject, Optional, Injectable, NgModule, makeEnvironmentProviders } from '@angular/core';
3
-
4
- /**
5
- * Api manager is responsible to provide an api configuration to a service factory, so that it could instantiate an API
6
- * with the right parameters. It contains a default configuration and a map of specific configurations for API / set of
7
- * API. Configurations are only exposed through the method getConfiguration, which will merge the default configuration
8
- * and the requested one.
9
- */
10
- class ApiManager {
11
- /**
12
- * Map of registered Api Client associated to specific API
13
- * Warning: This should not be used to get the ApiClient for an API, the function getConfiguration() should be used instead
14
- */
15
- get registeredApiConfigurations() {
16
- return { ...this.apiConfigurations };
17
- }
18
- /**
19
- * Create an API manager using a custom ApiClient
20
- * @param defaultConfiguration
21
- */
22
- constructor(defaultConfiguration, apiConfigurations = {}) {
23
- this.defaultConfiguration = defaultConfiguration;
24
- this.apiConfigurations = apiConfigurations;
25
- }
26
- /**
27
- * Retrieve a configuration for a specific API
28
- * @param api API to get the configuration for
29
- * @note When passing a string the configuration is expecting to exist else an error is thrown
30
- * @note when passing an Api instance that does not match a registered configuration, the default one will be returned
31
- */
32
- getConfiguration(api) {
33
- if (typeof api === 'string') {
34
- if (this.apiConfigurations[api]) {
35
- return this.apiConfigurations[api];
36
- }
37
- else {
38
- throw new Error(`Unknown API configuration: ${api}\nKnown API configurations: ${Object.keys(this.apiConfigurations).join(', ')}`);
39
- }
40
- }
41
- return (api && this.apiConfigurations[api.apiName]) || this.defaultConfiguration;
42
- }
43
- /**
44
- * Set or override API configuration
45
- * @param apiClient API configuration to override to the given api
46
- * @param api API name to override, the default configuration will be used if not specified
47
- */
48
- setConfiguration(apiClient, api) {
49
- if (api) {
50
- this.apiConfigurations[typeof api === 'string' ? api : api.apiName] = apiClient;
51
- }
52
- else {
53
- this.defaultConfiguration = apiClient;
54
- }
55
- }
56
- }
2
+ import { InjectionToken, inject, Injectable, NgModule, makeEnvironmentProviders } from '@angular/core';
57
3
 
58
4
  /**
59
5
  * Token used by the core library to provide an Api manager to services. It can be provided in the app.
@@ -65,10 +11,11 @@ const API_TOKEN = new InjectionToken('Custom API manager token');
65
11
  */
66
12
  const INITIAL_APIS_TOKEN = new InjectionToken('Initial APIs token');
67
13
  class ApiFactoryService {
68
- constructor(apiManager, apis) {
69
- this.apiManager = apiManager;
14
+ constructor() {
15
+ this.apiManager = inject(API_TOKEN);
70
16
  /** Map of loaded APIs */
71
17
  this.loadedApis = {};
18
+ const apis = inject(INITIAL_APIS_TOKEN, { optional: true });
72
19
  if (apis) {
73
20
  this.updateApiMapping(apis);
74
21
  }
@@ -139,20 +86,66 @@ class ApiFactoryService {
139
86
  getConfigFor(api) {
140
87
  return this.apiManager.getConfiguration(api);
141
88
  }
142
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: ApiFactoryService, deps: [{ token: API_TOKEN }, { token: INITIAL_APIS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
143
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: ApiFactoryService }); }
89
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: ApiFactoryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
90
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: ApiFactoryService }); }
144
91
  }
145
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: ApiFactoryService, decorators: [{
92
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: ApiFactoryService, decorators: [{
146
93
  type: Injectable
147
- }], ctorParameters: () => [{ type: ApiManager, decorators: [{
148
- type: Inject,
149
- args: [API_TOKEN]
150
- }] }, { type: undefined, decorators: [{
151
- type: Optional
152
- }, {
153
- type: Inject,
154
- args: [INITIAL_APIS_TOKEN]
155
- }] }] });
94
+ }], ctorParameters: () => [] });
95
+
96
+ /**
97
+ * Api manager is responsible to provide an api configuration to a service factory, so that it could instantiate an API
98
+ * with the right parameters. It contains a default configuration and a map of specific configurations for API / set of
99
+ * API. Configurations are only exposed through the method getConfiguration, which will merge the default configuration
100
+ * and the requested one.
101
+ */
102
+ class ApiManager {
103
+ /**
104
+ * Map of registered Api Client associated to specific API
105
+ * Warning: This should not be used to get the ApiClient for an API, the function getConfiguration() should be used instead
106
+ */
107
+ get registeredApiConfigurations() {
108
+ return { ...this.apiConfigurations };
109
+ }
110
+ /**
111
+ * Create an API manager using a custom ApiClient
112
+ * @param defaultConfiguration
113
+ */
114
+ constructor(defaultConfiguration, apiConfigurations = {}) {
115
+ this.defaultConfiguration = defaultConfiguration;
116
+ this.apiConfigurations = apiConfigurations;
117
+ }
118
+ /**
119
+ * Retrieve a configuration for a specific API
120
+ * @param api API to get the configuration for
121
+ * @note When passing a string the configuration is expecting to exist else an error is thrown
122
+ * @note when passing an Api instance that does not match a registered configuration, the default one will be returned
123
+ */
124
+ getConfiguration(api) {
125
+ if (typeof api === 'string') {
126
+ if (this.apiConfigurations[api]) {
127
+ return this.apiConfigurations[api];
128
+ }
129
+ else {
130
+ throw new Error(`Unknown API configuration: ${api}\nKnown API configurations: ${Object.keys(this.apiConfigurations).join(', ')}`);
131
+ }
132
+ }
133
+ return (api && this.apiConfigurations[api.apiName]) || this.defaultConfiguration;
134
+ }
135
+ /**
136
+ * Set or override API configuration
137
+ * @param apiClient API configuration to override to the given api
138
+ * @param api API name to override, the default configuration will be used if not specified
139
+ */
140
+ setConfiguration(apiClient, api) {
141
+ if (api) {
142
+ this.apiConfigurations[typeof api === 'string' ? api : api.apiName] = apiClient;
143
+ }
144
+ else {
145
+ this.defaultConfiguration = apiClient;
146
+ }
147
+ }
148
+ }
156
149
 
157
150
  /**
158
151
  * Add a preconnect `<link>` element to the DOM
@@ -187,13 +180,13 @@ class ApiManagerModule {
187
180
  ]
188
181
  };
189
182
  }
190
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: ApiManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
191
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.13", ngImport: i0, type: ApiManagerModule }); }
192
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: ApiManagerModule, providers: [
183
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: ApiManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
184
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.7", ngImport: i0, type: ApiManagerModule }); }
185
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: ApiManagerModule, providers: [
193
186
  ApiFactoryService
194
187
  ] }); }
195
188
  }
196
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.13", ngImport: i0, type: ApiManagerModule, decorators: [{
189
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.7", ngImport: i0, type: ApiManagerModule, decorators: [{
197
190
  type: NgModule,
198
191
  args: [{
199
192
  providers: [
@@ -1 +1 @@
1
- {"version":3,"file":"o3r-apis-manager.mjs","sources":["../../src/apis-manager/api-manager.ts","../../src/apis-manager/api-manager.token.ts","../../src/apis-manager/api-factory.service.ts","../../src/apis-manager/api-manager.helpers.ts","../../src/apis-manager/api-manager.module.ts","../../src/o3r-apis-manager.ts"],"sourcesContent":["import type {\n ApiClient,\n ApiName,\n} from '@ama-sdk/core';\n\n/**\n * Api manager is responsible to provide an api configuration to a service factory, so that it could instantiate an API\n * with the right parameters. It contains a default configuration and a map of specific configurations for API / set of\n * API. Configurations are only exposed through the method getConfiguration, which will merge the default configuration\n * and the requested one.\n */\nexport class ApiManager {\n private defaultConfiguration: ApiClient;\n private apiConfigurations: { [key: string]: ApiClient };\n\n /**\n * Map of registered Api Client associated to specific API\n * Warning: This should not be used to get the ApiClient for an API, the function getConfiguration() should be used instead\n */\n public get registeredApiConfigurations() {\n return { ...this.apiConfigurations } as const;\n }\n\n /**\n * Create an API manager using a custom ApiClient\n * @param defaultConfiguration\n */\n constructor(defaultConfiguration: ApiClient, apiConfigurations: { [key: string]: ApiClient } = {}) {\n this.defaultConfiguration = defaultConfiguration;\n this.apiConfigurations = apiConfigurations;\n }\n\n /**\n * Retrieve a configuration for a specific API\n * @param api API to get the configuration for\n * @note When passing a string the configuration is expecting to exist else an error is thrown\n * @note when passing an Api instance that does not match a registered configuration, the default one will be returned\n */\n public getConfiguration(api?: string | ApiName): ApiClient {\n if (typeof api === 'string') {\n if (this.apiConfigurations[api]) {\n return this.apiConfigurations[api];\n } else {\n throw new Error(`Unknown API configuration: ${api}\\nKnown API configurations: ${Object.keys(this.apiConfigurations).join(', ')}`);\n }\n }\n return (api && this.apiConfigurations[api.apiName]) || this.defaultConfiguration;\n }\n\n /**\n * Set or override API configuration\n * @param apiClient API configuration to override to the given api\n * @param api API name to override, the default configuration will be used if not specified\n */\n public setConfiguration(apiClient: ApiClient, api?: string | ApiName): void {\n if (api) {\n this.apiConfigurations[typeof api === 'string' ? api : api.apiName] = apiClient;\n } else {\n this.defaultConfiguration = apiClient;\n }\n }\n}\n","import {\n InjectionToken,\n} from '@angular/core';\nimport type {\n ApiManager,\n} from './api-manager';\n\n/**\n * Token used by the core library to provide an Api manager to services. It can be provided in the app.\n */\nexport const API_TOKEN = new InjectionToken<ApiManager>('Custom API manager token');\n","import type {\n Api,\n ApiClient,\n ApiName,\n} from '@ama-sdk/core';\nimport {\n Inject,\n Injectable,\n InjectionToken,\n Optional,\n} from '@angular/core';\nimport {\n ApiManager,\n} from './api-manager';\nimport {\n API_TOKEN,\n} from './api-manager.token';\n\n/** Type of the Class of an SDK Api */\nexport type ApiClassType<T extends Api = Api> = (new (client: ApiClient) => T) & ApiName;\n\n/**\n * Initial APIs instantiations\n */\nexport const INITIAL_APIS_TOKEN = new InjectionToken<(Api | ApiClassType)[]>('Initial APIs token');\n\n@Injectable()\nexport class ApiFactoryService {\n /** Map of loaded APIs */\n private loadedApis: Record<string, Api> = {};\n\n constructor(@Inject(API_TOKEN) private readonly apiManager: ApiManager, @Optional() @Inject(INITIAL_APIS_TOKEN) apis?: (Api | ApiClassType)[]) {\n if (apis) {\n this.updateApiMapping(apis);\n }\n }\n\n /**\n * Determine if the given parameter is a API class\n * @param apiClass object to check\n */\n private isApiClass<T extends Api = Api>(apiClass: any): apiClass is ApiClassType<T> {\n return !!apiClass.apiName && typeof apiClass === 'function';\n }\n\n /**\n * Retrieve a specific API with loaded configuration\n * @param apiClass class of the API to retrieve\n * @param refreshCache Ignore cached API instance and refresh it\n * @param customApiName override the `apiName` set in the `apiClass`\n * @note When passing `customApiName` the configuration is expecting to exist else an error is thrown\n * @note When passing an Api instance that does not match a registered configuration without `customApiName`, the default one will be returned\n */\n public getApi<T extends Api>(apiClass: (new (client: ApiClient) => T) & ApiName, refreshCache = false, customApiName?: string): T {\n const apiName = customApiName ?? apiClass.apiName;\n const cache = this.loadedApis[apiName];\n if (!refreshCache && cache) {\n return cache as T;\n }\n\n const instance = new apiClass(this.getConfigFor(customApiName ?? apiClass));\n this.loadedApis[apiName] = instance;\n return instance;\n }\n\n /**\n * Update the Map of loaded APIs.\n * Note: Can be used to override the a specific API\n * @param map Map of loaded APIs to update\n */\n public updateApiMapping(map: (Api | ApiClassType)[] | Record<string, (Api | ApiClassType)>) {\n const newItems: Record<string, (Api | ApiClassType)> = Array.isArray(map)\n ? map\n .reduce<Record<string, Api | ApiClassType<Api>>>((acc, curr) => {\n acc[curr.apiName] = curr;\n return acc;\n }, {})\n : map;\n\n this.loadedApis = {\n ...this.loadedApis,\n ...Object.entries(newItems)\n .reduce<Record<string, Api>>((acc, [apiName, api]) => {\n acc[apiName] = this.isApiClass(api) ? new api(this.getConfigFor(api)) : api;\n return acc;\n }, {})\n };\n }\n\n /**\n * Clear the cache of loaded APIs\n * @param apis Whitelist of APIs to clear from the cache, if specified only these apis will be removed from the cache\n */\n public clearCache(apis?: (ApiName | string)[]) {\n if (apis) {\n apis.forEach((api) => delete this.loadedApis[typeof api === 'string' ? api : api.apiName]);\n } else {\n this.loadedApis = {};\n }\n }\n\n /**\n * Retrieve the configuration for a specific API\n * @param api API for which retrieving the configuration\n */\n public getConfigFor(api: string | ApiName): ApiClient {\n return this.apiManager.getConfiguration(api);\n }\n}\n","/**\n * Add a preconnect `<link>` element to the DOM\n * @param baseUrl the origin href\n * @param supportCrossOrigin add crossorigin attribute to the link element\n */\nexport function appendPreconnect(baseUrl: string, supportCrossOrigin = true): void {\n const preConnectLink = document.createElement('link');\n preConnectLink.setAttribute('rel', 'preconnect');\n preConnectLink.setAttribute('href', baseUrl);\n if (supportCrossOrigin) {\n preConnectLink.setAttribute('crossorigin', '');\n }\n document.head.append(preConnectLink);\n}\n","import {\n makeEnvironmentProviders,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport {\n ApiFactoryService,\n} from './api-factory.service';\nimport {\n ApiManager,\n} from './api-manager';\nimport {\n API_TOKEN,\n} from './api-manager.token';\n\n/**\n * Module that needs to be imported by the application to instantiate an SDK configuration.\n */\n@NgModule({\n providers: [\n ApiFactoryService\n ]\n})\nexport class ApiManagerModule {\n /**\n * Provide a custom {@link ApiManager}\n * A factory can be provided via injection to the token {@link API_TOKEN}\n * @param apiManager\n * @deprecated Please use {@link provideApiManager} instead, will be removed in v14.\n */\n public static forRoot(apiManager: ApiManager): ModuleWithProviders<ApiManagerModule> {\n return {\n ngModule: ApiManagerModule,\n providers: [\n { provide: API_TOKEN, useValue: apiManager }\n ]\n };\n }\n}\n\n/**\n * Provide a custom {@link ApiManager}\n * A factory can be provided via injection to the token {@link API_TOKEN}\n * @param apiManager\n */\nexport function provideApiManager(apiManager: ApiManager) {\n return makeEnvironmentProviders([\n ApiFactoryService,\n { provide: API_TOKEN, useValue: apiManager }\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAKA;;;;;AAKG;MACU,UAAU,CAAA;AAIrB;;;AAGG;AACH,IAAA,IAAW,2BAA2B,GAAA;AACpC,QAAA,OAAO,EAAE,GAAG,IAAI,CAAC,iBAAiB,EAAW;;AAG/C;;;AAGG;IACH,WAAY,CAAA,oBAA+B,EAAE,iBAAA,GAAkD,EAAE,EAAA;AAC/F,QAAA,IAAI,CAAC,oBAAoB,GAAG,oBAAoB;AAChD,QAAA,IAAI,CAAC,iBAAiB,GAAG,iBAAiB;;AAG5C;;;;;AAKG;AACI,IAAA,gBAAgB,CAAC,GAAsB,EAAA;AAC5C,QAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,YAAA,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE;AAC/B,gBAAA,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC;;iBAC7B;gBACL,MAAM,IAAI,KAAK,CAAC,CAAA,2BAAA,EAA8B,GAAG,CAA+B,4BAAA,EAAA,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,CAAA,CAAC;;;AAGrI,QAAA,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,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A;YACT;AACD,SAAA,EAAA,CAAA,CAAA;;4FAEU,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;wBACT;AACD;AACF,iBAAA;;AAkBD;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,UAAsB,EAAA;AACtD,IAAA,OAAO,wBAAwB,CAAC;QAC9B,iBAAiB;AACjB,QAAA,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU;AAC3C,KAAA,CAAC;AACJ;;AClDA;;AAEG;;;;"}
1
+ {"version":3,"file":"o3r-apis-manager.mjs","sources":["../../src/apis-manager/api-manager.token.ts","../../src/apis-manager/api-factory.service.ts","../../src/apis-manager/api-manager.ts","../../src/apis-manager/api-manager.helpers.ts","../../src/apis-manager/api-manager.module.ts","../../src/o3r-apis-manager.ts"],"sourcesContent":["import {\n InjectionToken,\n} from '@angular/core';\nimport type {\n ApiManager,\n} from './api-manager';\n\n/**\n * Token used by the core library to provide an Api manager to services. It can be provided in the app.\n */\nexport const API_TOKEN = new InjectionToken<ApiManager>('Custom API manager token');\n","import type {\n Api,\n ApiClient,\n ApiName,\n} from '@ama-sdk/core';\nimport {\n inject,\n Injectable,\n InjectionToken,\n} from '@angular/core';\nimport {\n ApiManager,\n} from './api-manager';\nimport {\n API_TOKEN,\n} from './api-manager.token';\n\n/** Type of the Class of an SDK Api */\nexport type ApiClassType<T extends Api = Api> = (new (client: ApiClient) => T) & ApiName;\n\n/**\n * Initial APIs instantiations\n */\nexport const INITIAL_APIS_TOKEN = new InjectionToken<(Api | ApiClassType)[]>('Initial APIs token');\n\n@Injectable()\nexport class ApiFactoryService {\n private readonly apiManager = inject<ApiManager>(API_TOKEN);\n\n /** Map of loaded APIs */\n private loadedApis: Record<string, Api> = {};\n\n constructor() {\n const apis = inject(INITIAL_APIS_TOKEN, { optional: true });\n\n if (apis) {\n this.updateApiMapping(apis);\n }\n }\n\n /**\n * Determine if the given parameter is a API class\n * @param apiClass object to check\n */\n private isApiClass<T extends Api = Api>(apiClass: any): apiClass is ApiClassType<T> {\n return !!apiClass.apiName && typeof apiClass === 'function';\n }\n\n /**\n * Retrieve a specific API with loaded configuration\n * @param apiClass class of the API to retrieve\n * @param refreshCache Ignore cached API instance and refresh it\n * @param customApiName override the `apiName` set in the `apiClass`\n * @note When passing `customApiName` the configuration is expecting to exist else an error is thrown\n * @note When passing an Api instance that does not match a registered configuration without `customApiName`, the default one will be returned\n */\n public getApi<T extends Api>(apiClass: (new (client: ApiClient) => T) & ApiName, refreshCache = false, customApiName?: string): T {\n const apiName = customApiName ?? apiClass.apiName;\n const cache = this.loadedApis[apiName];\n if (!refreshCache && cache) {\n return cache as T;\n }\n\n const instance = new apiClass(this.getConfigFor(customApiName ?? apiClass));\n this.loadedApis[apiName] = instance;\n return instance;\n }\n\n /**\n * Update the Map of loaded APIs.\n * Note: Can be used to override the a specific API\n * @param map Map of loaded APIs to update\n */\n public updateApiMapping(map: (Api | ApiClassType)[] | Record<string, (Api | ApiClassType)>) {\n const newItems: Record<string, (Api | ApiClassType)> = Array.isArray(map)\n ? map\n .reduce<Record<string, Api | ApiClassType<Api>>>((acc, curr) => {\n acc[curr.apiName] = curr;\n return acc;\n }, {})\n : map;\n\n this.loadedApis = {\n ...this.loadedApis,\n ...Object.entries(newItems)\n .reduce<Record<string, Api>>((acc, [apiName, api]) => {\n acc[apiName] = this.isApiClass(api) ? new api(this.getConfigFor(api)) : api;\n return acc;\n }, {})\n };\n }\n\n /**\n * Clear the cache of loaded APIs\n * @param apis Whitelist of APIs to clear from the cache, if specified only these apis will be removed from the cache\n */\n public clearCache(apis?: (ApiName | string)[]) {\n if (apis) {\n apis.forEach((api) => delete this.loadedApis[typeof api === 'string' ? api : api.apiName]);\n } else {\n this.loadedApis = {};\n }\n }\n\n /**\n * Retrieve the configuration for a specific API\n * @param api API for which retrieving the configuration\n */\n public getConfigFor(api: string | ApiName): ApiClient {\n return this.apiManager.getConfiguration(api);\n }\n}\n","import type {\n ApiClient,\n ApiName,\n} from '@ama-sdk/core';\n\n/**\n * Api manager is responsible to provide an api configuration to a service factory, so that it could instantiate an API\n * with the right parameters. It contains a default configuration and a map of specific configurations for API / set of\n * API. Configurations are only exposed through the method getConfiguration, which will merge the default configuration\n * and the requested one.\n */\nexport class ApiManager {\n private defaultConfiguration: ApiClient;\n private apiConfigurations: { [key: string]: ApiClient };\n\n /**\n * Map of registered Api Client associated to specific API\n * Warning: This should not be used to get the ApiClient for an API, the function getConfiguration() should be used instead\n */\n public get registeredApiConfigurations() {\n return { ...this.apiConfigurations } as const;\n }\n\n /**\n * Create an API manager using a custom ApiClient\n * @param defaultConfiguration\n */\n constructor(defaultConfiguration: ApiClient, apiConfigurations: { [key: string]: ApiClient } = {}) {\n this.defaultConfiguration = defaultConfiguration;\n this.apiConfigurations = apiConfigurations;\n }\n\n /**\n * Retrieve a configuration for a specific API\n * @param api API to get the configuration for\n * @note When passing a string the configuration is expecting to exist else an error is thrown\n * @note when passing an Api instance that does not match a registered configuration, the default one will be returned\n */\n public getConfiguration(api?: string | ApiName): ApiClient {\n if (typeof api === 'string') {\n if (this.apiConfigurations[api]) {\n return this.apiConfigurations[api];\n } else {\n throw new Error(`Unknown API configuration: ${api}\\nKnown API configurations: ${Object.keys(this.apiConfigurations).join(', ')}`);\n }\n }\n return (api && this.apiConfigurations[api.apiName]) || this.defaultConfiguration;\n }\n\n /**\n * Set or override API configuration\n * @param apiClient API configuration to override to the given api\n * @param api API name to override, the default configuration will be used if not specified\n */\n public setConfiguration(apiClient: ApiClient, api?: string | ApiName): void {\n if (api) {\n this.apiConfigurations[typeof api === 'string' ? api : api.apiName] = apiClient;\n } else {\n this.defaultConfiguration = apiClient;\n }\n }\n}\n","/**\n * Add a preconnect `<link>` element to the DOM\n * @param baseUrl the origin href\n * @param supportCrossOrigin add crossorigin attribute to the link element\n */\nexport function appendPreconnect(baseUrl: string, supportCrossOrigin = true): void {\n const preConnectLink = document.createElement('link');\n preConnectLink.setAttribute('rel', 'preconnect');\n preConnectLink.setAttribute('href', baseUrl);\n if (supportCrossOrigin) {\n preConnectLink.setAttribute('crossorigin', '');\n }\n document.head.append(preConnectLink);\n}\n","import {\n makeEnvironmentProviders,\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport {\n ApiFactoryService,\n} from './api-factory.service';\nimport {\n ApiManager,\n} from './api-manager';\nimport {\n API_TOKEN,\n} from './api-manager.token';\n\n/**\n * Module that needs to be imported by the application to instantiate an SDK configuration.\n */\n@NgModule({\n providers: [\n ApiFactoryService\n ]\n})\nexport class ApiManagerModule {\n /**\n * Provide a custom {@link ApiManager}\n * A factory can be provided via injection to the token {@link API_TOKEN}\n * @param apiManager\n * @deprecated Please use {@link provideApiManager} instead, will be removed in v14.\n */\n public static forRoot(apiManager: ApiManager): ModuleWithProviders<ApiManagerModule> {\n return {\n ngModule: ApiManagerModule,\n providers: [\n { provide: API_TOKEN, useValue: apiManager }\n ]\n };\n }\n}\n\n/**\n * Provide a custom {@link ApiManager}\n * A factory can be provided via injection to the token {@link API_TOKEN}\n * @param apiManager\n */\nexport function provideApiManager(apiManager: ApiManager) {\n return makeEnvironmentProviders([\n ApiFactoryService,\n { provide: API_TOKEN, useValue: apiManager }\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;AAOA;;AAEG;MACU,SAAS,GAAG,IAAI,cAAc,CAAa,0BAA0B;;ACUlF;;AAEG;MACU,kBAAkB,GAAG,IAAI,cAAc,CAAyB,oBAAoB;MAGpF,iBAAiB,CAAA;AAM5B,IAAA,WAAA,GAAA;AALiB,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAa,SAAS,CAAC;;QAGnD,IAAA,CAAA,UAAU,GAAwB,EAAE;AAG1C,QAAA,MAAM,IAAI,GAAG,MAAM,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,C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,QAAQ,EAAE,gBAAgB;AAC1B,YAAA,SAAS,EAAE;AACT,gBAAA,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU;AAC3C;SACF;IACH;iIAdW,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;kIAAhB,gBAAgB,EAAA,CAAA,CAAA;AAAhB,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,EAAA,SAAA,EAJhB;YACT;AACD,SAAA,EAAA,CAAA,CAAA;;2FAEU,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;wBACT;AACD;AACF,iBAAA;;AAkBD;;;;AAIG;AACG,SAAU,iBAAiB,CAAC,UAAsB,EAAA;AACtD,IAAA,OAAO,wBAAwB,CAAC;QAC9B,iBAAiB;AACjB,QAAA,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU;AAC3C,KAAA,CAAC;AACJ;;AClDA;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,6 +1,124 @@
1
+ import { Api, ApiClient, ApiName } from '@ama-sdk/core';
2
+ import * as i0 from '@angular/core';
3
+ import { InjectionToken, ModuleWithProviders } from '@angular/core';
4
+
5
+ /** Type of the Class of an SDK Api */
6
+ type ApiClassType<T extends Api = Api> = (new (client: ApiClient) => T) & ApiName;
1
7
  /**
2
- * Generated bundle index. Do not edit.
8
+ * Initial APIs instantiations
3
9
  */
4
- /// <amd-module name="@o3r/apis-manager" />
5
- export * from './public_api';
6
- //# sourceMappingURL=o3r-apis-manager.d.ts.map
10
+ declare const INITIAL_APIS_TOKEN: InjectionToken<(Api | ApiClassType<Api>)[]>;
11
+ declare class ApiFactoryService {
12
+ private readonly apiManager;
13
+ /** Map of loaded APIs */
14
+ private loadedApis;
15
+ constructor();
16
+ /**
17
+ * Determine if the given parameter is a API class
18
+ * @param apiClass object to check
19
+ */
20
+ private isApiClass;
21
+ /**
22
+ * Retrieve a specific API with loaded configuration
23
+ * @param apiClass class of the API to retrieve
24
+ * @param refreshCache Ignore cached API instance and refresh it
25
+ * @param customApiName override the `apiName` set in the `apiClass`
26
+ * @note When passing `customApiName` the configuration is expecting to exist else an error is thrown
27
+ * @note When passing an Api instance that does not match a registered configuration without `customApiName`, the default one will be returned
28
+ */
29
+ getApi<T extends Api>(apiClass: (new (client: ApiClient) => T) & ApiName, refreshCache?: boolean, customApiName?: string): T;
30
+ /**
31
+ * Update the Map of loaded APIs.
32
+ * Note: Can be used to override the a specific API
33
+ * @param map Map of loaded APIs to update
34
+ */
35
+ updateApiMapping(map: (Api | ApiClassType)[] | Record<string, (Api | ApiClassType)>): void;
36
+ /**
37
+ * Clear the cache of loaded APIs
38
+ * @param apis Whitelist of APIs to clear from the cache, if specified only these apis will be removed from the cache
39
+ */
40
+ clearCache(apis?: (ApiName | string)[]): void;
41
+ /**
42
+ * Retrieve the configuration for a specific API
43
+ * @param api API for which retrieving the configuration
44
+ */
45
+ getConfigFor(api: string | ApiName): ApiClient;
46
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiFactoryService, never>;
47
+ static ɵprov: i0.ɵɵInjectableDeclaration<ApiFactoryService>;
48
+ }
49
+
50
+ /**
51
+ * Api manager is responsible to provide an api configuration to a service factory, so that it could instantiate an API
52
+ * with the right parameters. It contains a default configuration and a map of specific configurations for API / set of
53
+ * API. Configurations are only exposed through the method getConfiguration, which will merge the default configuration
54
+ * and the requested one.
55
+ */
56
+ declare class ApiManager {
57
+ private defaultConfiguration;
58
+ private apiConfigurations;
59
+ /**
60
+ * Map of registered Api Client associated to specific API
61
+ * Warning: This should not be used to get the ApiClient for an API, the function getConfiguration() should be used instead
62
+ */
63
+ get registeredApiConfigurations(): {
64
+ readonly [key: string]: ApiClient;
65
+ };
66
+ /**
67
+ * Create an API manager using a custom ApiClient
68
+ * @param defaultConfiguration
69
+ */
70
+ constructor(defaultConfiguration: ApiClient, apiConfigurations?: {
71
+ [key: string]: ApiClient;
72
+ });
73
+ /**
74
+ * Retrieve a configuration for a specific API
75
+ * @param api API to get the configuration for
76
+ * @note When passing a string the configuration is expecting to exist else an error is thrown
77
+ * @note when passing an Api instance that does not match a registered configuration, the default one will be returned
78
+ */
79
+ getConfiguration(api?: string | ApiName): ApiClient;
80
+ /**
81
+ * Set or override API configuration
82
+ * @param apiClient API configuration to override to the given api
83
+ * @param api API name to override, the default configuration will be used if not specified
84
+ */
85
+ setConfiguration(apiClient: ApiClient, api?: string | ApiName): void;
86
+ }
87
+
88
+ /**
89
+ * Add a preconnect `<link>` element to the DOM
90
+ * @param baseUrl the origin href
91
+ * @param supportCrossOrigin add crossorigin attribute to the link element
92
+ */
93
+ declare function appendPreconnect(baseUrl: string, supportCrossOrigin?: boolean): void;
94
+
95
+ /**
96
+ * Module that needs to be imported by the application to instantiate an SDK configuration.
97
+ */
98
+ declare class ApiManagerModule {
99
+ /**
100
+ * Provide a custom {@link ApiManager}
101
+ * A factory can be provided via injection to the token {@link API_TOKEN}
102
+ * @param apiManager
103
+ * @deprecated Please use {@link provideApiManager} instead, will be removed in v14.
104
+ */
105
+ static forRoot(apiManager: ApiManager): ModuleWithProviders<ApiManagerModule>;
106
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiManagerModule, never>;
107
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ApiManagerModule, never, never, never>;
108
+ static ɵinj: i0.ɵɵInjectorDeclaration<ApiManagerModule>;
109
+ }
110
+ /**
111
+ * Provide a custom {@link ApiManager}
112
+ * A factory can be provided via injection to the token {@link API_TOKEN}
113
+ * @param apiManager
114
+ */
115
+ declare function provideApiManager(apiManager: ApiManager): i0.EnvironmentProviders;
116
+
117
+ /**
118
+ * Token used by the core library to provide an Api manager to services. It can be provided in the app.
119
+ */
120
+ declare const API_TOKEN: InjectionToken<ApiManager>;
121
+
122
+ export { API_TOKEN, ApiFactoryService, ApiManager, ApiManagerModule, INITIAL_APIS_TOKEN, appendPreconnect, provideApiManager };
123
+ export type { ApiClassType };
124
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../src/apis-manager/api-factory.service.ts","../src/apis-manager/api-manager.ts","../src/apis-manager/api-manager.helpers.ts","../src/apis-manager/api-manager.module.ts","../src/apis-manager/api-manager.token.ts"],"sourcesContent":[null,null,null,null,null],"names":[],"mappings":";;;;AAiBA;;AAGA;;AAEG;AACH;AAEA;AAEE;;;;AAaA;;;AAGG;AACH;AAIA;;;;;;;AAOG;;AAaH;;;;AAIG;AACI;AAmBP;;;AAGG;;AASH;;;AAGG;AACI;;;AAGR;;AC1GD;;;;;AAKG;AACH;;;AAIE;;;AAGG;AACH;;AAEC;AAED;;;AAGG;AACS;AAAsD;AAA+B;AAKjG;;;;;AAKG;;AAYH;;;;AAIG;AACI;AAOR;;AC7DD;;;;AAIG;AACH;;ACUA;;AAEG;AACH;AAME;;;;;AAKG;;;;;AASJ;AAED;;;;AAIG;AACH;;ACtCA;;AAEG;AACH;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/apis-manager",
3
- "version": "13.0.0-next.6",
3
+ "version": "13.0.0-prerelease.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -11,17 +11,17 @@
11
11
  "otter-module"
12
12
  ],
13
13
  "peerDependencies": {
14
- "@ama-sdk/client-fetch": "^13.0.0-next.6",
15
- "@ama-sdk/core": "^13.0.0-next.6",
16
- "@angular-devkit/schematics": "^19.0.0",
17
- "@angular/common": "^19.0.0",
18
- "@angular/core": "^19.0.0",
19
- "@o3r/schematics": "^13.0.0-next.6",
20
- "@schematics/angular": "^19.0.0",
14
+ "@ama-sdk/client-fetch": "^13.0.0-prerelease.2",
15
+ "@ama-sdk/core": "^13.0.0-prerelease.2",
16
+ "@angular-devkit/schematics": "^20.0.0",
17
+ "@angular/common": "^20.0.0",
18
+ "@angular/core": "^20.0.0",
19
+ "@o3r/schematics": "^13.0.0-prerelease.2",
20
+ "@schematics/angular": "^20.0.0",
21
21
  "rxjs": "^7.8.1",
22
22
  "ts-node": "~10.9.2",
23
23
  "type-fest": "^4.30.1",
24
- "typescript": "^5.5.4"
24
+ "typescript": "^5.8.0"
25
25
  },
26
26
  "peerDependenciesMeta": {
27
27
  "@ama-sdk/client-fetch": {
@@ -41,12 +41,12 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@o3r/schematics": "^13.0.0-next.6",
44
+ "@o3r/schematics": "^13.0.0-prerelease.2",
45
45
  "tslib": "^2.6.2"
46
46
  },
47
47
  "schematics": "./collection.json",
48
48
  "engines": {
49
- "node": "^20.11.1 || >=22.0.0"
49
+ "node": "^20.19.0 || ^22.17.0 || ^24.0.0"
50
50
  },
51
51
  "module": "fesm2022/o3r-apis-manager.mjs",
52
52
  "typings": "index.d.ts",
@@ -9,7 +9,8 @@
9
9
  "description": "Project name",
10
10
  "$default": {
11
11
  "$source": "projectName"
12
- }
12
+ },
13
+ "alias": "project"
13
14
  },
14
15
  "skipLinter": {
15
16
  "type": "boolean",
@@ -1,49 +0,0 @@
1
- import type { Api, ApiClient, ApiName } from '@ama-sdk/core';
2
- import { InjectionToken } from '@angular/core';
3
- import { ApiManager } from './api-manager';
4
- import * as i0 from "@angular/core";
5
- /** Type of the Class of an SDK Api */
6
- export type ApiClassType<T extends Api = Api> = (new (client: ApiClient) => T) & ApiName;
7
- /**
8
- * Initial APIs instantiations
9
- */
10
- export declare const INITIAL_APIS_TOKEN: InjectionToken<(Api | ApiClassType<Api>)[]>;
11
- export declare class ApiFactoryService {
12
- private readonly apiManager;
13
- /** Map of loaded APIs */
14
- private loadedApis;
15
- constructor(apiManager: ApiManager, apis?: (Api | ApiClassType)[]);
16
- /**
17
- * Determine if the given parameter is a API class
18
- * @param apiClass object to check
19
- */
20
- private isApiClass;
21
- /**
22
- * Retrieve a specific API with loaded configuration
23
- * @param apiClass class of the API to retrieve
24
- * @param refreshCache Ignore cached API instance and refresh it
25
- * @param customApiName override the `apiName` set in the `apiClass`
26
- * @note When passing `customApiName` the configuration is expecting to exist else an error is thrown
27
- * @note When passing an Api instance that does not match a registered configuration without `customApiName`, the default one will be returned
28
- */
29
- getApi<T extends Api>(apiClass: (new (client: ApiClient) => T) & ApiName, refreshCache?: boolean, customApiName?: string): T;
30
- /**
31
- * Update the Map of loaded APIs.
32
- * Note: Can be used to override the a specific API
33
- * @param map Map of loaded APIs to update
34
- */
35
- updateApiMapping(map: (Api | ApiClassType)[] | Record<string, (Api | ApiClassType)>): void;
36
- /**
37
- * Clear the cache of loaded APIs
38
- * @param apis Whitelist of APIs to clear from the cache, if specified only these apis will be removed from the cache
39
- */
40
- clearCache(apis?: (ApiName | string)[]): void;
41
- /**
42
- * Retrieve the configuration for a specific API
43
- * @param api API for which retrieving the configuration
44
- */
45
- getConfigFor(api: string | ApiName): ApiClient;
46
- static ɵfac: i0.ɵɵFactoryDeclaration<ApiFactoryService, [null, { optional: true; }]>;
47
- static ɵprov: i0.ɵɵInjectableDeclaration<ApiFactoryService>;
48
- }
49
- //# sourceMappingURL=api-factory.service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-factory.service.d.ts","sourceRoot":"","sources":["../../src/apis-manager/api-factory.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EACH,SAAS,EACT,OAAO,EACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,cAAc,EAEf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACX,MAAM,eAAe,CAAC;;AAKvB,sCAAsC;AACtC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,MAAM,EAAE,SAAS,KAAK,CAAC,CAAC,GAAG,OAAO,CAAC;AAEzF;;GAEG;AACH,eAAO,MAAM,kBAAkB,6CAAmE,CAAC;AAEnG,qBACa,iBAAiB;IAIG,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH1D,yBAAyB;IACzB,OAAO,CAAC,UAAU,CAA2B;gBAEG,UAAU,EAAE,UAAU,EAA0C,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,YAAY,CAAC,EAAE;IAM7I;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB;;;;;;;OAOG;IACI,MAAM,CAAC,CAAC,SAAS,GAAG,EAAE,QAAQ,EAAE,CAAC,KAAK,MAAM,EAAE,SAAS,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,YAAY,UAAQ,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,CAAC;IAYjI;;;;OAIG;IACI,gBAAgB,CAAC,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,YAAY,CAAC,CAAC;IAmB1F;;;OAGG;IACI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,GAAG,MAAM,CAAC,EAAE;IAQ7C;;;OAGG;IACI,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;yCA9E1C,iBAAiB;6CAAjB,iBAAiB;CAiF7B"}
@@ -1,39 +0,0 @@
1
- import type { ApiClient, ApiName } from '@ama-sdk/core';
2
- /**
3
- * Api manager is responsible to provide an api configuration to a service factory, so that it could instantiate an API
4
- * with the right parameters. It contains a default configuration and a map of specific configurations for API / set of
5
- * API. Configurations are only exposed through the method getConfiguration, which will merge the default configuration
6
- * and the requested one.
7
- */
8
- export declare class ApiManager {
9
- private defaultConfiguration;
10
- private apiConfigurations;
11
- /**
12
- * Map of registered Api Client associated to specific API
13
- * Warning: This should not be used to get the ApiClient for an API, the function getConfiguration() should be used instead
14
- */
15
- get registeredApiConfigurations(): {
16
- readonly [key: string]: ApiClient;
17
- };
18
- /**
19
- * Create an API manager using a custom ApiClient
20
- * @param defaultConfiguration
21
- */
22
- constructor(defaultConfiguration: ApiClient, apiConfigurations?: {
23
- [key: string]: ApiClient;
24
- });
25
- /**
26
- * Retrieve a configuration for a specific API
27
- * @param api API to get the configuration for
28
- * @note When passing a string the configuration is expecting to exist else an error is thrown
29
- * @note when passing an Api instance that does not match a registered configuration, the default one will be returned
30
- */
31
- getConfiguration(api?: string | ApiName): ApiClient;
32
- /**
33
- * Set or override API configuration
34
- * @param apiClient API configuration to override to the given api
35
- * @param api API name to override, the default configuration will be used if not specified
36
- */
37
- setConfiguration(apiClient: ApiClient, api?: string | ApiName): void;
38
- }
39
- //# sourceMappingURL=api-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-manager.d.ts","sourceRoot":"","sources":["../../src/apis-manager/api-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACR,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,oBAAoB,CAAY;IACxC,OAAO,CAAC,iBAAiB,CAA+B;IAExD;;;OAGG;IACH,IAAW,2BAA2B;;MAErC;IAED;;;OAGG;gBACS,oBAAoB,EAAE,SAAS,EAAE,iBAAiB,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;KAAO;IAKjG;;;;;OAKG;IACI,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAW1D;;;;OAIG;IACI,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI;CAO5E"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Add a preconnect `<link>` element to the DOM
3
- * @param baseUrl the origin href
4
- * @param supportCrossOrigin add crossorigin attribute to the link element
5
- */
6
- export declare function appendPreconnect(baseUrl: string, supportCrossOrigin?: boolean): void;
7
- //# sourceMappingURL=api-manager.helpers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-manager.helpers.d.ts","sourceRoot":"","sources":["../../src/apis-manager/api-manager.helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,UAAO,GAAG,IAAI,CAQjF"}
@@ -1,25 +0,0 @@
1
- import { ModuleWithProviders } from '@angular/core';
2
- import { ApiManager } from './api-manager';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Module that needs to be imported by the application to instantiate an SDK configuration.
6
- */
7
- export declare class ApiManagerModule {
8
- /**
9
- * Provide a custom {@link ApiManager}
10
- * A factory can be provided via injection to the token {@link API_TOKEN}
11
- * @param apiManager
12
- * @deprecated Please use {@link provideApiManager} instead, will be removed in v14.
13
- */
14
- static forRoot(apiManager: ApiManager): ModuleWithProviders<ApiManagerModule>;
15
- static ɵfac: i0.ɵɵFactoryDeclaration<ApiManagerModule, never>;
16
- static ɵmod: i0.ɵɵNgModuleDeclaration<ApiManagerModule, never, never, never>;
17
- static ɵinj: i0.ɵɵInjectorDeclaration<ApiManagerModule>;
18
- }
19
- /**
20
- * Provide a custom {@link ApiManager}
21
- * A factory can be provided via injection to the token {@link API_TOKEN}
22
- * @param apiManager
23
- */
24
- export declare function provideApiManager(apiManager: ApiManager): import("@angular/core").EnvironmentProviders;
25
- //# sourceMappingURL=api-manager.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-manager.module.d.ts","sourceRoot":"","sources":["../../src/apis-manager/api-manager.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAEpB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,UAAU,EACX,MAAM,eAAe,CAAC;;AAKvB;;GAEG;AACH,qBAKa,gBAAgB;IAC3B;;;;;OAKG;WACW,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,mBAAmB,CAAC,gBAAgB,CAAC;yCAPzE,gBAAgB;0CAAhB,gBAAgB;0CAAhB,gBAAgB;CAe5B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,gDAKvD"}
@@ -1,7 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import type { ApiManager } from './api-manager';
3
- /**
4
- * Token used by the core library to provide an Api manager to services. It can be provided in the app.
5
- */
6
- export declare const API_TOKEN: InjectionToken<ApiManager>;
7
- //# sourceMappingURL=api-manager.token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-manager.token.d.ts","sourceRoot":"","sources":["../../src/apis-manager/api-manager.token.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,eAAO,MAAM,SAAS,4BAA6D,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from './api-factory.service';
2
- export * from './api-manager';
3
- export * from './api-manager.helpers';
4
- export * from './api-manager.module';
5
- export * from './api-manager.token';
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/apis-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"o3r-apis-manager.d.ts","sourceRoot":"","sources":["../src/o3r-apis-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}
package/public_api.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './apis-manager/index';
2
- //# sourceMappingURL=public_api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../src/public_api.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../schematics/helpers/update-api-deps/index.ts"],"names":[],"mappings":";;AA6BA,sDAwGC;AArID,2DAKoC;AACpC,gDAMyB;AACzB,yDAGqC;AACrC,qEAE+C;AAC/C,iCAAiC;AAKjC;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,OAA8B;IAClE,MAAM,eAAe,GAAS,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QACtE,MAAM,eAAe,GAAW,EAAE,CAAC;QACnC,MAAM,cAAc,GAAG,IAAA,iCAAoB,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAChF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAExD,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,cAAc,EACd,iBAAiB,EACjB,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;QAEF,IAAI,IAAA,sBAAU,EAAC,UAAU,EAAE,kBAAkB,EAAE,eAAe,CAAC,IAAI,IAAA,sBAAU,EAAC,UAAU,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,EAAE,CAAC;YACnI,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAClD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,2BAAc,EAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAEtE,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE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