@equinor/fusion-framework-module-services 7.1.2 → 7.1.3

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,4 +1,5 @@
1
1
  import type { IHttpClient } from '@equinor/fusion-framework-module-http';
2
+ import { BaseModuleProvider } from '@equinor/fusion-framework-module/provider';
2
3
  import type { ClientMethod } from './types';
3
4
  import type { ApiClientFactory } from './types';
4
5
  import { ContextApiClient } from './context';
@@ -23,10 +24,6 @@ export interface IApiProvider<TClient extends IHttpClient = IHttpClient> {
23
24
  */
24
25
  createPeopleClient(): Promise<PeopleApiClient<TClient>>;
25
26
  }
26
- type ApiProviderCtorArgs<TClient extends IHttpClient = IHttpClient> = {
27
- /** method for creating IHttpClients for api clients */
28
- createClient: ApiClientFactory<TClient>;
29
- };
30
27
  type ApiProviderErrorResponse = {
31
28
  type: ResponseType;
32
29
  status: number;
@@ -39,9 +36,12 @@ export declare class ApiProviderError extends Error {
39
36
  readonly response: ApiProviderErrorResponse;
40
37
  constructor(msg: string, response: ApiProviderErrorResponse, options?: ErrorOptions);
41
38
  }
42
- export declare class ApiProvider<TClient extends IHttpClient = IHttpClient> implements IApiProvider<TClient> {
39
+ type ApiProviderConfig<TClient extends IHttpClient = IHttpClient> = {
40
+ createClient: ApiClientFactory<TClient>;
41
+ };
42
+ export declare class ApiProvider<TClient extends IHttpClient = IHttpClient> extends BaseModuleProvider<ApiProviderConfig<TClient>> implements IApiProvider<TClient> {
43
43
  protected _createClientFn: ApiClientFactory<TClient>;
44
- constructor({ createClient }: ApiProviderCtorArgs<TClient>);
44
+ constructor(config: ApiProviderConfig<TClient>);
45
45
  createNotificationClient<TMethod extends keyof ClientMethod>(method: TMethod): Promise<NotificationApiClient<TMethod, TClient>>;
46
46
  createBookmarksClient<TMethod extends keyof ClientMethod>(method: TMethod): Promise<BookmarksApiClient<TMethod, TClient>>;
47
47
  createContextClient<TMethod extends keyof ClientMethod>(method: TMethod): Promise<ContextApiClient<TMethod, TClient>>;
@@ -1 +1 @@
1
- export declare const version = "7.1.2";
1
+ export declare const version = "7.1.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-module-services",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "main": "dist/esm/index.js",
@@ -126,17 +126,17 @@
126
126
  "zod": "^4.1.8"
127
127
  },
128
128
  "devDependencies": {
129
- "@faker-js/faker": "^9.5.1",
129
+ "@faker-js/faker": "^10.1.0",
130
130
  "msw": "^2.7.3",
131
131
  "typescript": "^5.8.2",
132
132
  "vitest": "^3.2.4",
133
- "@equinor/fusion-framework-module": "^5.0.2",
134
- "@equinor/fusion-framework-module-http": "^7.0.1",
135
- "@equinor/fusion-framework-module-service-discovery": "^9.0.1"
133
+ "@equinor/fusion-framework-module": "^5.0.4",
134
+ "@equinor/fusion-framework-module-http": "^7.0.3",
135
+ "@equinor/fusion-framework-module-service-discovery": "^9.0.3"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "odata-query": "^8.0.4",
139
- "@equinor/fusion-framework-module": "^5.0.2"
139
+ "@equinor/fusion-framework-module": "^5.0.4"
140
140
  },
141
141
  "scripts": {
142
142
  "build": "tsc -b",
package/src/module.ts CHANGED
@@ -61,7 +61,7 @@ export const module: ServicesModule = {
61
61
  if (!config.createClient) {
62
62
  throw Error('missing configuration for creating API client');
63
63
  }
64
- return new ApiProvider(config as Required<IApiConfigurator>);
64
+ return new ApiProvider({ createClient: config.createClient });
65
65
  },
66
66
  };
67
67
 
package/src/provider.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import type { IHttpClient } from '@equinor/fusion-framework-module-http';
2
+ import { BaseModuleProvider } from '@equinor/fusion-framework-module/provider';
2
3
  import type { ClientMethod } from './types';
4
+ import type { IApiConfigurator } from './configurator';
3
5
 
4
6
  import type { ApiClientFactory } from './types';
7
+ import { version } from './version.js';
5
8
  import { ContextApiClient } from './context';
6
9
  import BookmarksApiClient from './bookmarks/client';
7
10
  import { NotificationApiClient } from './notification';
@@ -76,12 +79,18 @@ const validateResponse = async (response: Response) => {
76
79
  }
77
80
  };
78
81
 
82
+ type ApiProviderConfig<TClient extends IHttpClient = IHttpClient> = {
83
+ createClient: ApiClientFactory<TClient>;
84
+ };
85
+
79
86
  export class ApiProvider<TClient extends IHttpClient = IHttpClient>
87
+ extends BaseModuleProvider<ApiProviderConfig<TClient>>
80
88
  implements IApiProvider<TClient>
81
89
  {
82
90
  protected _createClientFn: ApiClientFactory<TClient>;
83
- constructor({ createClient }: ApiProviderCtorArgs<TClient>) {
84
- this._createClientFn = createClient;
91
+ constructor(config: ApiProviderConfig<TClient>) {
92
+ super({ version, config });
93
+ this._createClientFn = config.createClient;
85
94
  }
86
95
 
87
96
  public async createNotificationClient<TMethod extends keyof ClientMethod>(
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '7.1.2';
2
+ export const version = '7.1.3';