@o3r/apis-manager 11.3.0-prerelease.4 → 11.3.0-prerelease.41
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 +3 -1
- package/esm2022/apis-manager/api-factory.service.mjs +3 -3
- package/esm2022/apis-manager/api-manager.module.mjs +4 -4
- package/fesm2022/o3r-apis-manager.mjs +7 -7
- package/package.json +7 -3
- package/schematics/helpers/update-api-deps/index.d.ts +2 -4
- package/schematics/helpers/update-api-deps/index.d.ts.map +1 -1
- package/schematics/helpers/update-api-deps/index.js +5 -4
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +3 -0
- package/schematics/ng-add/schema.d.ts +5 -0
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/schematics/ng-add/schema.json +5 -0
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ The plugins and fetch client come from the ``@ama-sdk/core`` module, but custom
|
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
44
|
import { ApiFetchClient, ApiKeyRequest, JsonTokenReply, JsonTokenRequest, ReviverReply, ExceptionReply } from '@ama-sdk/core';
|
|
45
|
+
import { ApiFetchClient } from '@ama-sdk/client-fetch';
|
|
45
46
|
import { ApiManager, ApiManagerModule } from '@o3r/apis-manager';
|
|
46
47
|
|
|
47
48
|
const PROXY_SERVER = "https://your-enpoint-base-path";
|
|
@@ -72,6 +73,7 @@ The **ApiManager** instance can be customized via a *factory* function provided
|
|
|
72
73
|
|
|
73
74
|
```typescript
|
|
74
75
|
import { ApiClient, ApiFetchClient, ApiKeyRequest, Mark, PerformanceMetricPlugin } from '@ama-sdk/core';
|
|
76
|
+
import { ApiFetchClient } from '@ama-sdk/client-fetch';
|
|
75
77
|
import { ApiManager, ApiManagerModule, API_TOKEN } from '@o3r/apis-manager';
|
|
76
78
|
import { EventTrackService } from '@o3r/analytics';
|
|
77
79
|
|
|
@@ -173,7 +175,7 @@ The configuration can be overridden after the instantiation of the API.
|
|
|
173
175
|
```typescript
|
|
174
176
|
import { ExampleApi } from '@shared/sdk';
|
|
175
177
|
import { ApiFactoryService } from '@o3r/apis-manager';
|
|
176
|
-
import { ApiFetchClient } from '@ama-sdk/
|
|
178
|
+
import { ApiFetchClient } from '@ama-sdk/client-fetch';
|
|
177
179
|
|
|
178
180
|
@Injectable()
|
|
179
181
|
class MyClass {
|
|
@@ -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: "18.2.
|
|
82
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
81
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.3", 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: "18.2.3", ngImport: i0, type: ApiFactoryService }); }
|
|
83
83
|
}
|
|
84
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.3", 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: "18.2.
|
|
21
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.
|
|
22
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.
|
|
20
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.3", ngImport: i0, type: ApiManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
21
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.3", ngImport: i0, type: ApiManagerModule }); }
|
|
22
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.3", ngImport: i0, type: ApiManagerModule, providers: [
|
|
23
23
|
ApiFactoryService
|
|
24
24
|
] }); }
|
|
25
25
|
}
|
|
26
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
26
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.3", 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: "18.2.
|
|
129
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
128
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.3", 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: "18.2.3", ngImport: i0, type: ApiFactoryService }); }
|
|
130
130
|
}
|
|
131
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.3", 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: "18.2.
|
|
159
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.
|
|
160
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.
|
|
158
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.3", ngImport: i0, type: ApiManagerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
159
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.3", ngImport: i0, type: ApiManagerModule }); }
|
|
160
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.3", ngImport: i0, type: ApiManagerModule, providers: [
|
|
161
161
|
ApiFactoryService
|
|
162
162
|
] }); }
|
|
163
163
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.3", 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.3.0-prerelease.
|
|
3
|
+
"version": "11.3.0-prerelease.41",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
"otter-module"
|
|
12
12
|
],
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@ama-sdk/
|
|
14
|
+
"@ama-sdk/client-fetch": "^11.3.0-prerelease.41",
|
|
15
|
+
"@ama-sdk/core": "^11.3.0-prerelease.41",
|
|
15
16
|
"@angular-devkit/schematics": "~18.2.0",
|
|
16
17
|
"@angular/common": "~18.2.0",
|
|
17
18
|
"@angular/core": "~18.2.0",
|
|
18
|
-
"@o3r/schematics": "^11.3.0-prerelease.
|
|
19
|
+
"@o3r/schematics": "^11.3.0-prerelease.41",
|
|
19
20
|
"@schematics/angular": "~18.2.0",
|
|
20
21
|
"rxjs": "^7.8.1",
|
|
21
22
|
"typescript": "~5.5.4"
|
|
22
23
|
},
|
|
23
24
|
"peerDependenciesMeta": {
|
|
25
|
+
"@ama-sdk/client-fetch": {
|
|
26
|
+
"optional": true
|
|
27
|
+
},
|
|
24
28
|
"@angular-devkit/schematics": {
|
|
25
29
|
"optional": true
|
|
26
30
|
},
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import type { NgAddSchematicsSchema } from '../../ng-add/schema';
|
|
2
3
|
/**
|
|
3
4
|
* Update app.module file with api manager, if needed
|
|
4
5
|
* @param options
|
|
5
|
-
* @param options.projectName
|
|
6
6
|
*/
|
|
7
|
-
export declare function updateApiDependencies(options:
|
|
8
|
-
projectName?: string | undefined;
|
|
9
|
-
}): Rule;
|
|
7
|
+
export declare function updateApiDependencies(options: NgAddSchematicsSchema): Rule;
|
|
10
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/helpers/update-api-deps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/helpers/update-api-deps/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAWjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CA4G1E"}
|
|
@@ -9,7 +9,6 @@ const ts = require("typescript");
|
|
|
9
9
|
/**
|
|
10
10
|
* Update app.module file with api manager, if needed
|
|
11
11
|
* @param options
|
|
12
|
-
* @param options.projectName
|
|
13
12
|
*/
|
|
14
13
|
function updateApiDependencies(options) {
|
|
15
14
|
const updateAppModule = (tree, context) => {
|
|
@@ -33,7 +32,8 @@ function updateApiDependencies(options) {
|
|
|
33
32
|
insertBeforeModule('const PROXY_SERVER = \'https://YOUR_API_ENDPOINT\';');
|
|
34
33
|
insertBeforeModule('appendPreconnect(PROXY_SERVER);');
|
|
35
34
|
addImportToModuleFile('ApiManagerModule', '@o3r/apis-manager');
|
|
36
|
-
|
|
35
|
+
if (!options.skipCodeSample) {
|
|
36
|
+
insertBeforeModule(`
|
|
37
37
|
export function apiManagerFactory(): ApiManager {
|
|
38
38
|
const apiClient = new ApiFetchClient({
|
|
39
39
|
basePath: PROXY_SERVER,
|
|
@@ -42,9 +42,10 @@ export function apiManagerFactory(): ApiManager {
|
|
|
42
42
|
|
|
43
43
|
return new ApiManager(apiClient);
|
|
44
44
|
}`);
|
|
45
|
-
|
|
45
|
+
addProviderToModuleFile('API_TOKEN', '@o3r/apis-manager', 'useFactory: apiManagerFactory');
|
|
46
|
+
insertImportToModuleFile('ApiFetchClient', '@ama-sdk/client-fetch', false);
|
|
47
|
+
}
|
|
46
48
|
insertImportToModuleFile('ApiManager', '@o3r/apis-manager', false);
|
|
47
|
-
insertImportToModuleFile('ApiFetchClient', '@ama-sdk/core', false);
|
|
48
49
|
insertImportToModuleFile('ApiKeyRequest', '@ama-sdk/core', false);
|
|
49
50
|
tree.commitUpdate(recorder);
|
|
50
51
|
context.logger.info('Please update by hand the placeholders for YOUR_API_ENDPOINT and YOUR_API_KEY!');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAqDtD;;;GAGG;AACH,eAAO,MAAM,KAAK,YAAa,qBAAqB,KAAG,IAGtD,CAAC"}
|
|
@@ -25,6 +25,9 @@ function ngAddFn(options) {
|
|
|
25
25
|
if (projectType === 'application') {
|
|
26
26
|
rulesToExecute.push(updateApiDependencies(options));
|
|
27
27
|
}
|
|
28
|
+
if (!options.skipCodeSample) {
|
|
29
|
+
depsInfo.o3rPeerDeps.push('@ama-sdk/client-fetch');
|
|
30
|
+
}
|
|
28
31
|
const dependencies = depsInfo.o3rPeerDeps.reduce((acc, dep) => {
|
|
29
32
|
acc[dep] = {
|
|
30
33
|
inManifest: [{
|
|
@@ -8,5 +8,10 @@ export interface NgAddSchematicsSchema extends SchematicOptionObject {
|
|
|
8
8
|
skipInstall: boolean;
|
|
9
9
|
/** Use a pinned version for otter packages */
|
|
10
10
|
exactO3rVersion?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Skip the code sample generated in application to register the ApiManager
|
|
13
|
+
* If `false`, a dependency to @ama-sdk/client-fetch will be added
|
|
14
|
+
*/
|
|
15
|
+
skipCodeSample?: boolean;
|
|
11
16
|
}
|
|
12
17
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,+BAA+B;IAC/B,WAAW,EAAE,OAAO,CAAC;IAErB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,8BAA8B;IAC9B,UAAU,EAAE,OAAO,CAAC;IAEpB,+BAA+B;IAC/B,WAAW,EAAE,OAAO,CAAC;IAErB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"type": "boolean",
|
|
26
26
|
"description": "Use a pinned version for otter packages",
|
|
27
27
|
"default": false
|
|
28
|
+
},
|
|
29
|
+
"skipCodeSample": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"description": "Skip the code sample generated in application to register the ApiManager (which is relying on FetchApiClient)",
|
|
32
|
+
"default": false
|
|
28
33
|
}
|
|
29
34
|
},
|
|
30
35
|
"required": [
|