@equinor/fusion-framework-module-services 7.2.2-next.0 → 8.0.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/CHANGELOG.md +20 -5
- package/README.md +125 -0
- package/dist/esm/bookmarks/api-version.js +3 -0
- package/dist/esm/bookmarks/api-version.js.map +1 -1
- package/dist/esm/bookmarks/index.js +13 -0
- package/dist/esm/bookmarks/index.js.map +1 -1
- package/dist/esm/bookmarks/schemas.js +10 -0
- package/dist/esm/bookmarks/schemas.js.map +1 -1
- package/dist/esm/bookmarks/types.js +5 -0
- package/dist/esm/bookmarks/types.js.map +1 -1
- package/dist/esm/configurator.js +7 -0
- package/dist/esm/configurator.js.map +1 -1
- package/dist/esm/context/client.js +32 -6
- package/dist/esm/context/client.js.map +1 -1
- package/dist/esm/context/get/client.js +9 -4
- package/dist/esm/context/get/client.js.map +1 -1
- package/dist/esm/context/index.js +13 -0
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/query/client.js +9 -1
- package/dist/esm/context/query/client.js.map +1 -1
- package/dist/esm/context/related/client.js +9 -1
- package/dist/esm/context/related/client.js.map +1 -1
- package/dist/esm/context/static.js +3 -2
- package/dist/esm/context/static.js.map +1 -1
- package/dist/esm/errors.js +14 -0
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/module.js +39 -7
- package/dist/esm/module.js.map +1 -1
- package/dist/esm/notification/client.js +56 -14
- package/dist/esm/notification/client.js.map +1 -1
- package/dist/esm/notification/index.js +14 -0
- package/dist/esm/notification/index.js.map +1 -1
- package/dist/esm/notification/static.js +3 -2
- package/dist/esm/notification/static.js.map +1 -1
- package/dist/esm/people/client.js +58 -5
- package/dist/esm/people/client.js.map +1 -1
- package/dist/esm/people/index.js +13 -0
- package/dist/esm/people/index.js.map +1 -1
- package/dist/esm/people/person-details/client.js +10 -4
- package/dist/esm/people/person-details/client.js.map +1 -1
- package/dist/esm/people/person-photo/client.js +10 -4
- package/dist/esm/people/person-photo/client.js.map +1 -1
- package/dist/esm/people/query/client.js +10 -4
- package/dist/esm/people/query/client.js.map +1 -1
- package/dist/esm/people/static.js +3 -0
- package/dist/esm/people/static.js.map +1 -1
- package/dist/esm/people/utils.js +19 -0
- package/dist/esm/people/utils.js.map +1 -1
- package/dist/esm/provider.js +37 -2
- package/dist/esm/provider.js.map +1 -1
- package/dist/esm/utils.js +2 -11
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bookmarks/api-version.d.ts +3 -0
- package/dist/types/bookmarks/index.d.ts +13 -0
- package/dist/types/bookmarks/schemas.d.ts +10 -0
- package/dist/types/bookmarks/types.d.ts +17 -0
- package/dist/types/configurator.d.ts +15 -1
- package/dist/types/context/api-models.d.ts +16 -0
- package/dist/types/context/client.d.ts +32 -6
- package/dist/types/context/get/client.d.ts +9 -4
- package/dist/types/context/get/types.d.ts +27 -0
- package/dist/types/context/index.d.ts +13 -0
- package/dist/types/context/query/client.d.ts +9 -1
- package/dist/types/context/query/types.d.ts +35 -0
- package/dist/types/context/related/client.d.ts +9 -1
- package/dist/types/context/related/types.d.ts +36 -0
- package/dist/types/context/static.d.ts +3 -2
- package/dist/types/errors.d.ts +14 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/module.d.ts +41 -6
- package/dist/types/notification/api-models.d.ts +20 -1
- package/dist/types/notification/client.d.ts +56 -14
- package/dist/types/notification/index.d.ts +14 -0
- package/dist/types/notification/static.d.ts +3 -2
- package/dist/types/people/api-models.d.ts +26 -0
- package/dist/types/people/api-models.v2.d.ts +1 -0
- package/dist/types/people/api-models.v4.d.ts +24 -0
- package/dist/types/people/client.d.ts +58 -5
- package/dist/types/people/index.d.ts +13 -0
- package/dist/types/people/person-details/client.d.ts +10 -4
- package/dist/types/people/person-details/types.d.ts +21 -0
- package/dist/types/people/person-photo/client.d.ts +10 -4
- package/dist/types/people/person-photo/types.d.ts +17 -0
- package/dist/types/people/query/client.d.ts +10 -4
- package/dist/types/people/query/types.d.ts +19 -0
- package/dist/types/people/resolve/types.d.ts +7 -0
- package/dist/types/people/static.d.ts +3 -0
- package/dist/types/people/suggest/types.d.ts +7 -0
- package/dist/types/people/utils.d.ts +19 -0
- package/dist/types/provider.d.ts +69 -4
- package/dist/types/types.d.ts +40 -15
- package/dist/types/utils.d.ts +2 -11
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -9
- package/src/bookmarks/api-version.ts +3 -0
- package/src/bookmarks/index.ts +14 -0
- package/src/bookmarks/schemas.ts +10 -0
- package/src/bookmarks/types.ts +18 -0
- package/src/configurator.ts +15 -1
- package/src/context/api-models.ts +16 -0
- package/src/context/client.ts +32 -6
- package/src/context/get/client.ts +9 -4
- package/src/context/get/types.ts +27 -0
- package/src/context/index.ts +14 -0
- package/src/context/query/client.ts +9 -1
- package/src/context/query/types.ts +35 -0
- package/src/context/related/client.ts +9 -1
- package/src/context/related/types.ts +36 -0
- package/src/context/static.ts +3 -2
- package/src/errors.ts +14 -0
- package/src/index.ts +15 -0
- package/src/module.ts +47 -7
- package/src/notification/api-models.ts +20 -1
- package/src/notification/client.ts +56 -14
- package/src/notification/index.ts +15 -0
- package/src/notification/static.ts +3 -2
- package/src/people/api-models.ts +26 -1
- package/src/people/api-models.v2.ts +1 -0
- package/src/people/api-models.v4.ts +24 -0
- package/src/people/client.ts +58 -5
- package/src/people/index.ts +14 -0
- package/src/people/person-details/client.ts +10 -4
- package/src/people/person-details/types.ts +21 -0
- package/src/people/person-photo/client.ts +10 -4
- package/src/people/person-photo/types.ts +17 -0
- package/src/people/query/client.ts +10 -4
- package/src/people/query/types.ts +19 -0
- package/src/people/resolve/types.ts +7 -0
- package/src/people/static.ts +3 -0
- package/src/people/suggest/types.ts +7 -0
- package/src/people/utils.ts +19 -0
- package/src/provider.ts +79 -8
- package/src/types.ts +40 -15
- package/src/utils.ts +2 -11
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 8.0.0
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- abffa53: Major version bump for Fusion Framework React 19 release.
|
|
8
|
+
|
|
9
|
+
All packages are bumped to the next major version as part of the React 19 upgrade. This release drops support for React versions below 18 and includes breaking changes across the framework.
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
**Breaking changes:**
|
|
12
|
+
- Peer dependencies now require React 18 or 19 (`^18.0.0 || ^19.0.0`)
|
|
13
|
+
- React Router upgraded from v6 to v7
|
|
14
|
+
- Navigation module refactored with new history API
|
|
15
|
+
- `renderComponent` and `renderApp` now use `createRoot` API
|
|
16
|
+
|
|
17
|
+
**Migration:**
|
|
18
|
+
- Update your React version to 18.0.0 or higher before upgrading
|
|
19
|
+
- Replace `NavigationProvider.createRouter()` with `@equinor/fusion-framework-react-router`
|
|
20
|
+
- See individual package changelogs for package-specific migration steps
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
8
23
|
|
|
9
|
-
- Updated dependencies [
|
|
10
|
-
- @equinor/fusion-framework-module@
|
|
24
|
+
- Updated dependencies [abffa53]
|
|
25
|
+
- @equinor/fusion-framework-module@6.0.0
|
|
11
26
|
|
|
12
27
|
## 7.2.1
|
|
13
28
|
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @equinor/fusion-framework-module-services
|
|
2
|
+
|
|
3
|
+
Typed API service clients for the Fusion Framework. Provides factory-based access to platform backend services (bookmarks, context, notification, people) with versioned endpoints, automatic HTTP client resolution, and response validation.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Domain-specific API clients** — `BookmarksApiClient`, `ContextApiClient`, `NotificationApiClient`, `PeopleApiClient`
|
|
8
|
+
- **Versioned endpoints** — each service exposes version-aware methods (e.g. `v1`, `v2`, `v4`) with type-safe request/response shapes
|
|
9
|
+
- **Dual consumption patterns** — every endpoint supports both `Promise` (`json`) and observable (`json$`) return types
|
|
10
|
+
- **Automatic HTTP client resolution** — resolves named clients through the HTTP module, falling back to service-discovery
|
|
11
|
+
- **Response validation** — built-in response handler validates HTTP status codes and throws structured `ApiProviderError` on failure
|
|
12
|
+
- **Zod schema selectors** — `schemaSelector` utility for runtime response parsing with Zod schemas
|
|
13
|
+
- **Bookmark Zod schemas** — pre-built Zod schemas (`ApiBookmarkSchema`, `ApiBookmarkPayload`) for bookmark entities
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pnpm add @equinor/fusion-framework-module-services
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Enable the module
|
|
24
|
+
|
|
25
|
+
Register the services module during app configuration:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { enableServices } from '@equinor/fusion-framework-module-services';
|
|
29
|
+
|
|
30
|
+
export const configure = (configurator) => {
|
|
31
|
+
enableServices(configurator);
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Custom client factory
|
|
36
|
+
|
|
37
|
+
Override HTTP client resolution with `configureServices`:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { configureServices } from '@equinor/fusion-framework-module-services';
|
|
41
|
+
|
|
42
|
+
export const configure = (configurator) => {
|
|
43
|
+
configurator.addConfig(
|
|
44
|
+
configureServices((cfg) => {
|
|
45
|
+
cfg.createClient = async (name) => myHttpClientFactory(name);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Create and use API clients
|
|
52
|
+
|
|
53
|
+
Access the services provider at runtime to create domain clients:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
// Bookmarks
|
|
57
|
+
const bookmarks = await provider.services.createBookmarksClient('json');
|
|
58
|
+
const allBookmarks = await bookmarks.query('v1');
|
|
59
|
+
const single = await bookmarks.get('v1', { bookmarkId: 'abc-123' });
|
|
60
|
+
|
|
61
|
+
// Context
|
|
62
|
+
const context = await provider.services.createContextClient('json');
|
|
63
|
+
const ctx = await context.get('v1', { id: 'context-id' });
|
|
64
|
+
const results = await context.query('v1', { query: 'my search' });
|
|
65
|
+
|
|
66
|
+
// Notifications
|
|
67
|
+
const notifications = await provider.services.createNotificationClient('json');
|
|
68
|
+
const all = await notifications.getAll('v1');
|
|
69
|
+
await notifications.setSeenByUser('v1', { notificationId: 'notif-id' });
|
|
70
|
+
|
|
71
|
+
// People
|
|
72
|
+
const people = await provider.services.createPeopleClient();
|
|
73
|
+
const person = await people.get('v4', 'json', { azureId: 'azure-unique-id' });
|
|
74
|
+
const photo = await people.photo('v2', 'blob', { azureId: 'azure-unique-id' });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## API Reference
|
|
78
|
+
|
|
79
|
+
### Module setup
|
|
80
|
+
|
|
81
|
+
| Export | Description |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `enableServices` | Register the services module with the framework configurator |
|
|
84
|
+
| `configureServices` | Create a module config object with a custom configuration callback |
|
|
85
|
+
| `module` | The raw module definition |
|
|
86
|
+
|
|
87
|
+
### Provider
|
|
88
|
+
|
|
89
|
+
| Export | Description |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `ApiProvider` / `IApiProvider` | Services provider with factory methods for creating domain clients |
|
|
92
|
+
| `ApiConfigurator` / `IApiConfigurator` | Configuration interface (set `createClient` to override HTTP client resolution) |
|
|
93
|
+
| `ApiProviderError` | Structured error thrown on non-OK HTTP responses |
|
|
94
|
+
|
|
95
|
+
### Domain clients
|
|
96
|
+
|
|
97
|
+
| Client | Import path | Services |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `BookmarksApiClient` | `@equinor/fusion-framework-module-services/bookmarks` | CRUD bookmarks, favourites |
|
|
100
|
+
| `ContextApiClient` | `@equinor/fusion-framework-module-services/context` | Get, query, related contexts |
|
|
101
|
+
| `NotificationApiClient` | `@equinor/fusion-framework-module-services/notification` | CRUD notifications, settings |
|
|
102
|
+
| `PeopleApiClient` | `@equinor/fusion-framework-module-services/people` | Get, query, photo, suggest, resolve |
|
|
103
|
+
|
|
104
|
+
### Types and utilities
|
|
105
|
+
|
|
106
|
+
| Export | Description |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `ClientMethod` | Maps `json` / `json$` to `Promise` / `StreamResponse` |
|
|
109
|
+
| `ClientDataMethod` | Maps `blob` / `blob$` for binary responses |
|
|
110
|
+
| `ApiClientFactory` | Factory function type for creating named HTTP clients |
|
|
111
|
+
| `FilterAllowedApiVersions` | Utility type for constraining API version unions |
|
|
112
|
+
| `ExtractApiVersion` | Utility type for resolving a version key to its string value |
|
|
113
|
+
| `UnsupportedApiVersion` | Error class for invalid API version strings |
|
|
114
|
+
| `extractVersion` | Resolves a version key or value from an API-version enum |
|
|
115
|
+
| `schemaSelector` | Creates a response selector that validates with a Zod schema |
|
|
116
|
+
| `isApiPerson` | Type-guard factory for validating person entities by API version |
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
The services module depends on:
|
|
121
|
+
|
|
122
|
+
- **`@equinor/fusion-framework-module-http`** — provides named HTTP clients
|
|
123
|
+
- **`@equinor/fusion-framework-module-service-discovery`** (optional) — automatic client resolution via service discovery
|
|
124
|
+
|
|
125
|
+
When neither a registered HTTP client nor service-discovery is available for a service name, the module throws an error during client creation.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/** Supported API versions for the bookmarks service. */
|
|
1
2
|
export var ApiVersion;
|
|
2
3
|
(function (ApiVersion) {
|
|
4
|
+
/** Bookmarks API version 1.0. */
|
|
3
5
|
ApiVersion["v1"] = "1.0";
|
|
6
|
+
/** Bookmarks API version 2.0. */
|
|
4
7
|
ApiVersion["v2"] = "2.0";
|
|
5
8
|
})(ApiVersion || (ApiVersion = {}));
|
|
6
9
|
//# sourceMappingURL=api-version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-version.js","sourceRoot":"","sources":["../../../src/bookmarks/api-version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"api-version.js","sourceRoot":"","sources":["../../../src/bookmarks/api-version.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,iCAAiC;IACjC,wBAAU,CAAA;IACV,iCAAiC;IACjC,wBAAU,CAAA;AACZ,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Bookmarks API client and types.
|
|
5
|
+
*
|
|
6
|
+
* Provides {@link BookmarksApiClient} for CRUD operations on bookmarks
|
|
7
|
+
* and favourite management, with versioned endpoints (`v1`, `v2`).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { BookmarksApiClient } from '@equinor/fusion-framework-module-services/bookmarks';
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
export { BookmarksApiClient, default } from './client';
|
|
2
15
|
export { ApiVersion } from './api-version';
|
|
3
16
|
export * from './schemas';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bookmarks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bookmarks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,cAAc,WAAW,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ApiVersion } from './api-version';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
/** Zod schema that parses an ISO-8601 datetime string into a `Date` object. */
|
|
3
4
|
export const ApiDateSchema = z
|
|
4
5
|
.string()
|
|
5
6
|
.datetime({ offset: true })
|
|
6
7
|
.transform((x) => new Date(x));
|
|
8
|
+
/** Zod schema for a person reference in a bookmark response. */
|
|
7
9
|
export const ApiPersonSchema = {
|
|
8
10
|
[ApiVersion.v1]: z.object({
|
|
9
11
|
azureUniqueId: z.string(),
|
|
@@ -15,6 +17,7 @@ export const ApiPersonSchema = {
|
|
|
15
17
|
accountClassification: z.enum(['Unclassified', 'Internal', 'External']).nullish(),
|
|
16
18
|
}),
|
|
17
19
|
};
|
|
20
|
+
/** Zod schema for the source system of a bookmark. */
|
|
18
21
|
export const ApiSourceSystem = {
|
|
19
22
|
[ApiVersion.v1]: z.object({
|
|
20
23
|
identifier: z.string(),
|
|
@@ -22,6 +25,7 @@ export const ApiSourceSystem = {
|
|
|
22
25
|
subSystem: z.string().nullish(),
|
|
23
26
|
}),
|
|
24
27
|
};
|
|
28
|
+
/** Zod schema for a Fusion context reference attached to a bookmark. */
|
|
25
29
|
export const ApiFusionContext = {
|
|
26
30
|
[ApiVersion.v1]: z.object({
|
|
27
31
|
id: z.string(),
|
|
@@ -54,6 +58,12 @@ export const ApiBookmarkSchema = {
|
|
|
54
58
|
return this[ApiVersion.v1];
|
|
55
59
|
},
|
|
56
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Zod schema for the bookmark payload.
|
|
63
|
+
*
|
|
64
|
+
* Accepts a record of key-value pairs, a JSON string, or `undefined`.
|
|
65
|
+
* JSON strings are automatically parsed into objects.
|
|
66
|
+
*/
|
|
57
67
|
export const ApiBookmarkPayload = {
|
|
58
68
|
get [ApiVersion.v1]() {
|
|
59
69
|
return z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/bookmarks/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;KAC1B,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;QACxB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;QAC9B,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE;QAC9F,qBAAqB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE;KAClF,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,G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,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,CAAC,CAAC;YACX,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/bookmarks/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/bookmarks/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/esm/configurator.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default configurator for the services module.
|
|
3
|
+
*
|
|
4
|
+
* Implements {@link IApiConfigurator} with an initially empty configuration.
|
|
5
|
+
* The module initialization step populates `createClient` if it was not
|
|
6
|
+
* provided during configuration.
|
|
7
|
+
*/
|
|
1
8
|
export class ApiConfigurator {
|
|
2
9
|
}
|
|
3
10
|
//# sourceMappingURL=configurator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configurator.js","sourceRoot":"","sources":["../../src/configurator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configurator.js","sourceRoot":"","sources":["../../src/configurator.ts"],"names":[],"mappings":"AAcA;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;CAA+B"}
|
|
@@ -2,35 +2,61 @@ import { ApiVersion } from './static';
|
|
|
2
2
|
import { getContext, } from './get';
|
|
3
3
|
import { queryContext, } from './query';
|
|
4
4
|
import { relatedContexts, } from './related';
|
|
5
|
+
/**
|
|
6
|
+
* Typed API client for the Fusion context service.
|
|
7
|
+
*
|
|
8
|
+
* Delegates to versioned endpoint implementations for fetching a single context,
|
|
9
|
+
* querying contexts by search criteria, and listing related contexts.
|
|
10
|
+
*
|
|
11
|
+
* @template TMethod - The client execution method (`'json'` or `'json$'`).
|
|
12
|
+
* @template TClient - The underlying HTTP client type.
|
|
13
|
+
*/
|
|
5
14
|
export class ContextApiClient {
|
|
6
15
|
_client;
|
|
7
16
|
_method;
|
|
17
|
+
/** Returns the {@link ApiVersion} enum for version-constant access. */
|
|
8
18
|
get Version() {
|
|
9
19
|
return ApiVersion;
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* @param _client - The HTTP client used to execute requests.
|
|
23
|
+
* @param _method - The execution method (`'json'` or `'json$'`).
|
|
24
|
+
*/
|
|
11
25
|
constructor(_client, _method) {
|
|
12
26
|
this._client = _client;
|
|
13
27
|
this._method = _method;
|
|
14
28
|
}
|
|
15
29
|
/**
|
|
16
|
-
* Fetch context by
|
|
17
|
-
*
|
|
30
|
+
* Fetch a single context entity by its identifier.
|
|
31
|
+
*
|
|
32
|
+
* @template TVersion - The API version key (e.g. `'v1'`).
|
|
33
|
+
* @template TResult - The expected response type.
|
|
34
|
+
* @param version - API version to use.
|
|
35
|
+
* @returns The context entity matching the provided arguments.
|
|
18
36
|
*/
|
|
19
37
|
get(version, ...args) {
|
|
20
38
|
const fn = getContext(this._client, version, this._method);
|
|
21
39
|
return fn(...args);
|
|
22
40
|
}
|
|
23
41
|
/**
|
|
24
|
-
* Query context service
|
|
25
|
-
*
|
|
42
|
+
* Query the context service with search criteria.
|
|
43
|
+
*
|
|
44
|
+
* @template TVersion - The API version key (e.g. `'v1'`).
|
|
45
|
+
* @template TResult - The expected response type.
|
|
46
|
+
* @param version - API version to use.
|
|
47
|
+
* @returns An array of context entities matching the query.
|
|
26
48
|
*/
|
|
27
49
|
query(version, ...args) {
|
|
28
50
|
const fn = queryContext(this._client, version, this._method);
|
|
29
51
|
return fn(...args);
|
|
30
52
|
}
|
|
31
53
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
54
|
+
* List contexts related to a specific context entity.
|
|
55
|
+
*
|
|
56
|
+
* @template TVersion - The API version key (e.g. `'v1'`).
|
|
57
|
+
* @template TResult - The expected response type.
|
|
58
|
+
* @param version - API version to use.
|
|
59
|
+
* @returns An array of related context entities.
|
|
34
60
|
*/
|
|
35
61
|
related(version, ...args) {
|
|
36
62
|
const fn = relatedContexts(this._client, version, this._method);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/context/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EACL,UAAU,GAIX,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,YAAY,GAIb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIL,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB,MAAM,OAAO,gBAAgB;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/context/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EACL,UAAU,GAIX,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,YAAY,GAIb,MAAM,SAAS,CAAC;AAEjB,OAAO,EAIL,eAAe,GAChB,MAAM,WAAW,CAAC;AAEnB;;;;;;;;GAQG;AACH,MAAM,OAAO,gBAAgB;IAcf;IACA;IAXZ,uEAAuE;IACvE,IAAI,OAAO;QACT,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,YACY,OAAgB,EAChB,OAAgB;QADhB,YAAO,GAAP,OAAO,CAAS;QAChB,YAAO,GAAP,OAAO,CAAS;IACzB,CAAC;IAEJ;;;;;;;OAOG;IACI,GAAG,CAIR,OAAiB,EACjB,GAAG,IAAmE;QAEtE,MAAM,EAAE,GAAG,UAAU,CAA6B,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACvF,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAIV,OAAiB,EACjB,GAAG,IAAqE;QAExE,MAAM,EAAE,GAAG,YAAY,CAA6B,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACzF,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED;;;;;;;OAOG;IACI,OAAO,CAIZ,OAAiB,EACjB,GAAG,IAAuE;QAE1E,MAAM,EAAE,GAAG,eAAe,CAA6B,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5F,OAAO,EAAE,CAAU,GAAG,IAAI,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { generateParameters } from './generate-parameters';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
6
|
-
* @
|
|
3
|
+
* Creates a curried function that fetches a single context entity by ID.
|
|
4
|
+
*
|
|
5
|
+
* @template TVersion - The API version key (e.g. `'v1'`).
|
|
6
|
+
* @template TMethod - The client execution method (`'json'` or `'json$'`).
|
|
7
|
+
* @template TClient - The underlying HTTP client type.
|
|
8
|
+
* @param client - HTTP client used to execute the request.
|
|
9
|
+
* @param version - API version to call.
|
|
10
|
+
* @param method - Client method to use (defaults to `'json'`).
|
|
11
|
+
* @returns A function that accepts context args and returns the result.
|
|
7
12
|
*/
|
|
8
13
|
export const getContext = (client, version, method = 'json') => (args, init) => client[method](...generateParameters(version, args, init));
|
|
9
14
|
export default getContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/context/get/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/context/get/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAI3D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GACrB,CAKE,MAAe,EACf,OAAiB,EACjB,SAAkB,MAAiB,EACnC,EAAE,CACJ,CACE,IAA8B,EAC9B,IAAoC,EACI,EAAE,CAC1C,MAAM,CAAC,MAAM,CAAC,CACZ,GAAG,kBAAkB,CAAuB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CACvB,CAAC;AAEhD,eAAe,UAAU,CAAC"}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Context API client and types.
|
|
5
|
+
*
|
|
6
|
+
* Provides {@link ContextApiClient} for fetching, querying, and listing
|
|
7
|
+
* related contexts, with versioned endpoints (`v1`, `v2`).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { ContextApiClient } from '@equinor/fusion-framework-module-services/context';
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
1
14
|
export { ContextApiClient, default } from './client';
|
|
2
15
|
export { ApiVersion } from './static';
|
|
3
16
|
export * from './api-models';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/context/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAItC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { generateParameters } from './generate-parameters';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a curried function that queries the context service.
|
|
4
|
+
*
|
|
5
|
+
* @template TVersion - The API version key.
|
|
6
|
+
* @template TMethod - The client execution method.
|
|
7
|
+
* @template TClient - The underlying HTTP client type.
|
|
8
|
+
* @param client - HTTP client used to execute the request.
|
|
9
|
+
* @param version - API version to call.
|
|
10
|
+
* @param method - Client method to use (defaults to `'json'`).
|
|
11
|
+
* @returns A function that accepts query args and returns context results.
|
|
4
12
|
*/
|
|
5
13
|
export const queryContext = (client, version, method = 'json') => (args, init) => client[method](...generateParameters(version, args, init));
|
|
6
14
|
export default queryContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/context/query/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAS3D
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/context/query/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAS3D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GACvB,CAKE,MAAe,EACf,OAAiB,EACjB,SAAkB,MAAiB,EACnC,EAAE,CACJ,CACE,IAAgC,EAChC,IAAoC,EACM,EAAE,CAC5C,MAAM,CAAC,MAAM,CAAC,CACZ,GAAG,kBAAkB,CAAuB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CACrB,CAAC;AAElD,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { generateParameters } from './generate-parameters';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Creates a curried function that fetches contexts related to a given context.
|
|
4
|
+
*
|
|
5
|
+
* @template TVersion - The API version key.
|
|
6
|
+
* @template TMethod - The client execution method.
|
|
7
|
+
* @template TClient - The underlying HTTP client type.
|
|
8
|
+
* @param client - HTTP client used to execute the request.
|
|
9
|
+
* @param version - API version to call.
|
|
10
|
+
* @param method - Client method to use (defaults to `'json'`).
|
|
11
|
+
* @returns A function that accepts relation args and returns related contexts.
|
|
4
12
|
*/
|
|
5
13
|
export const relatedContexts = (client, version, method = 'json') => (args, init) => client[method](...generateParameters(version, args, init));
|
|
6
14
|
export default relatedContexts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/context/related/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAS3D
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/context/related/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAS3D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAC1B,CAKE,MAAe,EACf,OAAiB,EACjB,SAAkB,MAAiB,EACnC,EAAE,CACJ,CACE,IAAkC,EAClC,IAAoC,EACQ,EAAE,CAC9C,MAAM,CAAC,MAAM,CAAC,CACZ,GAAG,kBAAkB,CAAuB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CACnB,CAAC;AAEpD,eAAe,eAAe,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Supported API versions for the context service. */
|
|
2
2
|
export var ApiVersion;
|
|
3
3
|
(function (ApiVersion) {
|
|
4
|
+
/** Context API version 1.0. */
|
|
4
5
|
ApiVersion["v1"] = "1.0";
|
|
5
|
-
/** not in use
|
|
6
|
+
/** Context API version 2.0 (not currently in use). */
|
|
6
7
|
ApiVersion["v2"] = "2.0";
|
|
7
8
|
})(ApiVersion || (ApiVersion = {}));
|
|
8
9
|
//# sourceMappingURL=static.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../../src/context/static.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"static.js","sourceRoot":"","sources":["../../../src/context/static.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,+BAA+B;IAC/B,wBAAU,CAAA;IACV,sDAAsD;IACtD,wBAAU,CAAA;AACZ,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB"}
|
package/dist/esm/errors.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown when an API endpoint is called with a version string
|
|
3
|
+
* that does not match any supported API version.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* throw new UnsupportedApiVersion('3.0');
|
|
8
|
+
* // Error: unsupported version 3.0
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
1
11
|
export class UnsupportedApiVersion extends Error {
|
|
2
12
|
version;
|
|
13
|
+
/**
|
|
14
|
+
* @param version - The unsupported version value that was requested.
|
|
15
|
+
* @param cause - Optional underlying error or context.
|
|
16
|
+
*/
|
|
3
17
|
constructor(version, cause) {
|
|
4
18
|
super(`unsupported version ${version}`, { cause });
|
|
5
19
|
this.version = version;
|
package/dist/esm/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAM5B;IALlB;;;OAGG;IACH,YACkB,OAAwB,EACxC,KAAe;QAEf,KAAK,CAAC,uBAAuB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAHnC,YAAO,GAAP,OAAO,CAAiB;IAI1C,CAAC;CACF"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Typed API service clients for the Fusion Framework.\
|
|
5
|
+
* Provides factory-based access to bookmarks, context, notification, and
|
|
6
|
+
* people APIs with versioned endpoints, response validation, and support
|
|
7
|
+
* for both promise (`json`) and observable (`json$`) consumption patterns.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { enableServices } from '@equinor/fusion-framework-module-services';
|
|
12
|
+
* configurator.addConfig(enableServices);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
export * from './types';
|
|
2
16
|
export { ApiConfigurator } from './configurator';
|
|
3
17
|
export { ApiProvider } from './provider';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAoB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAoB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAgB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/esm/module.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ApiConfigurator } from './configurator';
|
|
2
2
|
import { ApiProvider } from './provider';
|
|
3
|
+
/** Module registration key used to identify the services module. */
|
|
3
4
|
export const moduleKey = 'services';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Creates the default {@link ApiClientFactory} by attempting named HTTP clients
|
|
7
|
+
* first, then falling back to service-discovery.
|
|
8
|
+
*
|
|
9
|
+
* @param http - The HTTP client provider from the `http` module.
|
|
10
|
+
* @param serviceDiscovery - Optional service-discovery provider for automatic client resolution.
|
|
11
|
+
* @returns A factory function that creates named HTTP clients.
|
|
6
12
|
*/
|
|
7
13
|
const createDefaultClient = (http, serviceDiscovery) => async (name) => {
|
|
8
14
|
if (http.hasClient(name)) {
|
|
@@ -14,7 +20,11 @@ const createDefaultClient = (http, serviceDiscovery) => async (name) => {
|
|
|
14
20
|
throw Error(`failed to create http client for service ${name}`);
|
|
15
21
|
};
|
|
16
22
|
/**
|
|
17
|
-
*
|
|
23
|
+
* Services module definition.
|
|
24
|
+
*
|
|
25
|
+
* Registers the `'services'` module, wires up the {@link ApiConfigurator},
|
|
26
|
+
* and initializes the {@link ApiProvider} with an HTTP client factory
|
|
27
|
+
* resolved from the `http` and optional `serviceDiscovery` modules.
|
|
18
28
|
*/
|
|
19
29
|
export const module = {
|
|
20
30
|
name: moduleKey,
|
|
@@ -37,8 +47,18 @@ export const module = {
|
|
|
37
47
|
},
|
|
38
48
|
};
|
|
39
49
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
50
|
+
* Registers the services module with the framework configurator.
|
|
51
|
+
*
|
|
52
|
+
* Call this during app configuration to make the services module
|
|
53
|
+
* available at runtime.
|
|
54
|
+
*
|
|
55
|
+
* @param config - The framework modules configurator.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* import { enableServices } from '@equinor/fusion-framework-module-services';
|
|
60
|
+
* configurator.addConfig(enableServices);
|
|
61
|
+
* ```
|
|
42
62
|
*/
|
|
43
63
|
export const enableServices = (
|
|
44
64
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -46,12 +66,24 @@ config) => {
|
|
|
46
66
|
config.addConfig({ module });
|
|
47
67
|
};
|
|
48
68
|
/**
|
|
69
|
+
* Creates a module configuration object for the services module
|
|
70
|
+
* with a custom configuration callback.
|
|
71
|
+
*
|
|
72
|
+
* Use this when you need to customise the services module (for example,
|
|
73
|
+
* supplying a custom `createClient` factory).
|
|
74
|
+
*
|
|
75
|
+
* @param configure - Callback that receives the {@link IApiConfigurator} for customisation.
|
|
76
|
+
* @returns A module configurator object that can be passed to `addConfig`.
|
|
77
|
+
*
|
|
49
78
|
* @example
|
|
50
79
|
* ```ts
|
|
51
|
-
*
|
|
80
|
+
* import { configureServices } from '@equinor/fusion-framework-module-services';
|
|
81
|
+
* configurator.addConfig(
|
|
82
|
+
* configureServices((cfg) => {
|
|
83
|
+
* cfg.createClient = myCustomClientFactory;
|
|
84
|
+
* }),
|
|
85
|
+
* );
|
|
52
86
|
* ```
|
|
53
|
-
* @param configure - Callback for configuring the module
|
|
54
|
-
* @returns Configuration object
|
|
55
87
|
*/
|
|
56
88
|
export const configureServices = (configure) => {
|
|
57
89
|
return {
|
package/dist/esm/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAWA,OAAO,EAAyB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAqB,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAWA,OAAO,EAAyB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAqB,WAAW,EAAE,MAAM,YAA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