@o3r/apis-manager 11.0.0-prerelease.3 → 11.0.0-prerelease.30
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
|
@@ -39,6 +39,7 @@ The **ApiManager** requires the default API Client, which will be used across al
|
|
|
39
39
|
|
|
40
40
|
In the example that follows, we define the default base configuration that API classes will use, as well as a custom configuration for the 'ExampleApi'.
|
|
41
41
|
The plugins and fetch client come from the ``@ama-sdk/core`` module, but custom ones can be created if needed as long as they follow the ``ApiClient`` interface from ``@ama-sdk/core``. More details on ``@ama-sdk/core`` [here](https://www.npmjs.com/package/@ama-sdk/core).
|
|
42
|
+
|
|
42
43
|
```typescript
|
|
43
44
|
import { ApiFetchClient, ApiKeyRequest, JsonTokenReply, JsonTokenRequest, ReviverReply, ExceptionReply } from '@ama-sdk/core';
|
|
44
45
|
import { ApiManager, ApiManagerModule } from '@o3r/apis-manager';
|
|
@@ -113,15 +114,13 @@ The API instances can be retrieved via the injection of the ``ApiFactoryService`
|
|
|
113
114
|
import { ExampleApi } from '@shared/sdk';
|
|
114
115
|
import { ApiFactoryService } from '@o3r/apis-manager';
|
|
115
116
|
|
|
116
|
-
@
|
|
117
|
+
@Injectable()
|
|
117
118
|
class MyClass {
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
}
|
|
120
|
+
private exampleApi = inject(ApiFactoryService).getApi(ExampleApi); // <- retrieve example API instantiated with set configuration
|
|
121
121
|
|
|
122
122
|
doSomething() {
|
|
123
|
-
const
|
|
124
|
-
const call = exampleApi.doSomething({ ... });
|
|
123
|
+
const call = this.exampleApi.doSomething({ ... });
|
|
125
124
|
}
|
|
126
125
|
|
|
127
126
|
}
|
|
@@ -155,12 +154,10 @@ import { ApiFactoryService } from '@o3r/apis-manager';
|
|
|
155
154
|
@Injectable()
|
|
156
155
|
class MyClass {
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
}
|
|
157
|
+
private exampleApi = inject(ApiFactoryService).getApi(ExampleApi); // <- retrieve example API instantiated in @custom/sdk
|
|
160
158
|
|
|
161
159
|
doSomething() {
|
|
162
|
-
const
|
|
163
|
-
const call = exampleApi.doSomething({ ... });
|
|
160
|
+
const call = this.exampleApi.doSomething({ ... });
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
}
|
|
@@ -175,18 +172,18 @@ The configuration can be overridden after the instantiation of the API.
|
|
|
175
172
|
|
|
176
173
|
```typescript
|
|
177
174
|
import { ExampleApi } from '@shared/sdk';
|
|
178
|
-
import { ApiFactoryService
|
|
175
|
+
import { ApiFactoryService } from '@o3r/apis-manager';
|
|
179
176
|
import { ApiFetchClient } from '@ama-sdk/core';
|
|
180
177
|
|
|
181
178
|
@Injectable()
|
|
182
179
|
class MyClass {
|
|
183
180
|
|
|
184
|
-
constructor(
|
|
181
|
+
constructor(private apiManager: ApiManager, private apiFactoryService: ApiFactoryService) {
|
|
185
182
|
}
|
|
186
183
|
|
|
187
184
|
doSomething() {
|
|
188
185
|
this.apiManager.setConfiguration(new ApiFetchClient(), ExampleApi); // <- override configuration of Example API
|
|
189
|
-
const exampleApi = apiFactoryService.getApi(ExampleApi, true); // <- retrieve example API with the new configuration (and refresh the cache)
|
|
186
|
+
const exampleApi = this.apiFactoryService.getApi(ExampleApi, true); // <- retrieve example API with the new configuration (and refresh the cache)
|
|
190
187
|
}
|
|
191
188
|
|
|
192
189
|
}
|
|
@@ -78,10 +78,10 @@ export class ApiFactoryService {
|
|
|
78
78
|
getConfigFor(apiClass) {
|
|
79
79
|
return this.apiManager.getConfiguration(apiClass.apiName);
|
|
80
80
|
}
|
|
81
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
82
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
81
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiFactoryService, deps: [{ token: API_TOKEN }, { token: INITIAL_APIS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
82
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiFactoryService }); }
|
|
83
83
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiFactoryService, decorators: [{
|
|
85
85
|
type: Injectable
|
|
86
86
|
}], ctorParameters: () => [{ type: i1.ApiManager, decorators: [{
|
|
87
87
|
type: Inject,
|
|
@@ -17,13 +17,13 @@ export class ApiManagerModule {
|
|
|
17
17
|
]
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
21
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.
|
|
22
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.
|
|
20
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
21
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule }); }
|
|
22
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule, providers: [
|
|
23
23
|
ApiFactoryService
|
|
24
24
|
] }); }
|
|
25
25
|
}
|
|
26
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule, decorators: [{
|
|
27
27
|
type: NgModule,
|
|
28
28
|
args: [{
|
|
29
29
|
providers: [
|
|
@@ -125,10 +125,10 @@ class ApiFactoryService {
|
|
|
125
125
|
getConfigFor(apiClass) {
|
|
126
126
|
return this.apiManager.getConfiguration(apiClass.apiName);
|
|
127
127
|
}
|
|
128
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
129
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.
|
|
128
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiFactoryService, deps: [{ token: API_TOKEN }, { token: INITIAL_APIS_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
129
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiFactoryService }); }
|
|
130
130
|
}
|
|
131
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiFactoryService, decorators: [{
|
|
132
132
|
type: Injectable
|
|
133
133
|
}], ctorParameters: () => [{ type: ApiManager, decorators: [{
|
|
134
134
|
type: Inject,
|
|
@@ -155,13 +155,13 @@ class ApiManagerModule {
|
|
|
155
155
|
]
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.
|
|
159
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.
|
|
160
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.
|
|
158
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
159
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule }); }
|
|
160
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule, providers: [
|
|
161
161
|
ApiFactoryService
|
|
162
162
|
] }); }
|
|
163
163
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: ApiManagerModule, decorators: [{
|
|
165
165
|
type: NgModule,
|
|
166
166
|
args: [{
|
|
167
167
|
providers: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/apis-manager",
|
|
3
|
-
"version": "11.0.0-prerelease.
|
|
3
|
+
"version": "11.0.0-prerelease.30",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"otter-module"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@ama-sdk/core": "^11.0.0-prerelease.
|
|
14
|
+
"@ama-sdk/core": "^11.0.0-prerelease.30",
|
|
15
15
|
"@angular-devkit/schematics": "~17.3.0",
|
|
16
16
|
"@angular/common": "~17.3.0",
|
|
17
17
|
"@angular/core": "~17.3.0",
|
|
18
|
-
"@o3r/schematics": "^11.0.0-prerelease.
|
|
18
|
+
"@o3r/schematics": "^11.0.0-prerelease.30",
|
|
19
19
|
"@schematics/angular": "~17.3.0",
|
|
20
20
|
"rxjs": "^7.8.1",
|
|
21
21
|
"typescript": "~5.4.2"
|