@equinor/fusion-framework-module-services 7.2.1 → 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 +24 -16
- 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/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,5 +1,29 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 8.0.0
|
|
4
|
+
|
|
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.
|
|
10
|
+
|
|
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
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [abffa53]
|
|
25
|
+
- @equinor/fusion-framework-module@6.0.0
|
|
26
|
+
|
|
3
27
|
## 7.2.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -16,7 +40,6 @@
|
|
|
16
40
|
- [#4095](https://github.com/equinor/fusion-framework/pull/4095) [`f09b26f`](https://github.com/equinor/fusion-framework/commit/f09b26f100a94bf3c841be9830525aa2c734b180) Thanks [@eikeland](https://github.com/eikeland)! - Add `suggest` and `resolve` methods to People API client for improved people picker functionality.
|
|
17
41
|
|
|
18
42
|
The People service now supports:
|
|
19
|
-
|
|
20
43
|
- **suggest**: Autocomplete/typeahead for people picker with optional system account filtering
|
|
21
44
|
- **resolve**: Batch resolution of person identifiers to full person objects
|
|
22
45
|
|
|
@@ -80,7 +103,6 @@
|
|
|
80
103
|
### Patch Changes
|
|
81
104
|
|
|
82
105
|
- [#3607](https://github.com/equinor/fusion-framework/pull/3607) [`6dfb29e`](https://github.com/equinor/fusion-framework/commit/6dfb29eef67548228c05668b44ad02a34c83b050) Thanks [@dependabot](https://github.com/apps/dependabot)! - chore: bump @faker-js/faker from 9.9.0 to 10.1.0
|
|
83
|
-
|
|
84
106
|
- Updated devDependency @faker-js/faker to v10.1.0
|
|
85
107
|
- ESM-only distribution aligns with project architecture
|
|
86
108
|
- All existing faker APIs remain stable and compatible
|
|
@@ -109,7 +131,6 @@
|
|
|
109
131
|
- [#3442](https://github.com/equinor/fusion-framework/pull/3442) [`3b614f8`](https://github.com/equinor/fusion-framework/commit/3b614f87138f5a52f8ccc50ca8c6598ef3db37d6) Thanks [@asbjornhaland](https://github.com/asbjornhaland)! - Update biome to latest version
|
|
110
132
|
|
|
111
133
|
- [#3428](https://github.com/equinor/fusion-framework/pull/3428) [`1700ca8`](https://github.com/equinor/fusion-framework/commit/1700ca8851fa108e55e9729fd24f595272766e63) Thanks [@dependabot](https://github.com/apps/dependabot)! - Update zod from 4.1.9 to 4.1.11
|
|
112
|
-
|
|
113
134
|
- **v4.1.10**: Fixed shape caching issue (#5263) improving validation performance for complex schemas
|
|
114
135
|
- **v4.1.11**: Maintenance release with general improvements
|
|
115
136
|
|
|
@@ -123,7 +144,6 @@
|
|
|
123
144
|
### Minor Changes
|
|
124
145
|
|
|
125
146
|
- [#3394](https://github.com/equinor/fusion-framework/pull/3394) [`c222c67`](https://github.com/equinor/fusion-framework/commit/c222c673bc7cdefff6eb0cd9436bfa3d1f185295) Thanks [@odinr](https://github.com/odinr)! - Updated Zod dependency from v3 to v4 with necessary schema adjustments.
|
|
126
|
-
|
|
127
147
|
- Updated `zod` dependency from `^3.25.76` to `^4.1.8`
|
|
128
148
|
- Fixed `z.record()` usage to explicitly specify key type as `z.string()`
|
|
129
149
|
- Simplified `schemaSelector` function type parameters to align with Zod v4 API
|
|
@@ -138,12 +158,10 @@
|
|
|
138
158
|
- [#3393](https://github.com/equinor/fusion-framework/pull/3393) [`3ce5a18`](https://github.com/equinor/fusion-framework/commit/3ce5a1887c8fb90f24c3367f8926db69cc9a1914) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updated odata-query dependency from 8.0.4 to 8.0.5
|
|
139
159
|
|
|
140
160
|
### Changes
|
|
141
|
-
|
|
142
161
|
- Updated odata-query to fix transform operations order issue
|
|
143
162
|
- This is a patch update with no breaking changes
|
|
144
163
|
|
|
145
164
|
### Links
|
|
146
|
-
|
|
147
165
|
- [GitHub releases](https://github.com/techniq/odata-query/releases/tag/v8.0.5)
|
|
148
166
|
- [Changelog](https://github.com/techniq/odata-query/blob/main/CHANGELOG.md#805)
|
|
149
167
|
|
|
@@ -154,7 +172,6 @@
|
|
|
154
172
|
- [#2910](https://github.com/equinor/fusion-framework/pull/2910) [`07cc985`](https://github.com/equinor/fusion-framework/commit/07cc9857e1427b574e011cc319518e701dba784d) Thanks [@dependabot](https://github.com/apps/dependabot)! - Updated vitest from 2.1.9 to 3.2.4 across all packages.
|
|
155
173
|
|
|
156
174
|
## Breaking Changes
|
|
157
|
-
|
|
158
175
|
- **Node.js Requirements**: Requires Node.js 18+ (already satisfied)
|
|
159
176
|
- **Vite Compatibility**: Updated to work with Vite 7.x (already using Vite 7.1.5)
|
|
160
177
|
- **Snapshot Format**: Snapshots now use backtick quotes (\`) instead of single quotes
|
|
@@ -162,18 +179,15 @@
|
|
|
162
179
|
- **TypeScript Support**: Enhanced TypeScript integration and type definitions
|
|
163
180
|
|
|
164
181
|
## Security Updates
|
|
165
|
-
|
|
166
182
|
- CVE-2025-24963: Browser mode serves arbitrary files (fixed in 2.1.9)
|
|
167
183
|
- CVE-2025-24964: Remote Code Execution vulnerability (fixed in 2.1.9)
|
|
168
184
|
|
|
169
185
|
## Migration Notes
|
|
170
|
-
|
|
171
186
|
- Test snapshots may need regeneration due to quote format changes
|
|
172
187
|
- Some test configurations might need updates for new TypeScript support
|
|
173
188
|
- Peer dependency warnings for @vitest/coverage-v8 are expected and safe to ignore
|
|
174
189
|
|
|
175
190
|
## Links
|
|
176
|
-
|
|
177
191
|
- [Vitest 3.0 Migration Guide](https://vitest.dev/guide/migration)
|
|
178
192
|
- [Vitest 3.2.4 Release Notes](https://github.com/vitest-dev/vitest/releases/tag/v3.2.4)
|
|
179
193
|
|
|
@@ -200,7 +214,6 @@
|
|
|
200
214
|
### Patch Changes
|
|
201
215
|
|
|
202
216
|
- [#3088](https://github.com/equinor/fusion-framework/pull/3088) [`7441b13`](https://github.com/equinor/fusion-framework/commit/7441b13aa50dd7362d1629086a27b6b4e571575d) Thanks [@eikeland](https://github.com/eikeland)! - chore: update package typesVersions
|
|
203
|
-
|
|
204
217
|
- Updated package.json typesVersions.
|
|
205
218
|
- Ensures backward compatibility with older node versions.
|
|
206
219
|
- Ensured consistency with workspace and repository configuration.
|
|
@@ -292,7 +305,6 @@
|
|
|
292
305
|
> This module is meant for internal use only, and should not be used directly by applications, so the breaking changes should not affect any applications. Ancestor modules should be updated to reflect the changes in this module.
|
|
293
306
|
|
|
294
307
|
**BREAKING CHANGES:**
|
|
295
|
-
|
|
296
308
|
- api client has been updated to reflect the new api endpoints and request/response types
|
|
297
309
|
- models have been replaced with infered `zod` schemas
|
|
298
310
|
- request and responses are now parsed and validated using `zod` schemas
|
|
@@ -334,7 +346,6 @@
|
|
|
334
346
|
- [#2320](https://github.com/equinor/fusion-framework/pull/2320) [`1dd85f3`](https://github.com/equinor/fusion-framework/commit/1dd85f3a408a73df556d1812a5f280945cc100ee) Thanks [@odinr](https://github.com/odinr)! - Removed the `removeComments` option from the `tsconfig.base.json` file.
|
|
335
347
|
|
|
336
348
|
Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
|
|
337
|
-
|
|
338
349
|
1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
|
|
339
350
|
2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
|
|
340
351
|
3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
|
|
@@ -386,7 +397,6 @@
|
|
|
386
397
|
Updated the `PeopleApiClient.photo` method to properly type the response as `PersonPhotoApiResponse<TVersion>` instead of `Blob`. This allows for more accurate type checking when using the method.
|
|
387
398
|
|
|
388
399
|
To update your code:
|
|
389
|
-
|
|
390
400
|
- If you are using the `PeopleApiClient.photo` method directly, no changes are needed. The method will now properly type the response.
|
|
391
401
|
- If you have custom type assertions or checks around the response from `PeopleApiClient.photo`, you may need to update them to handle `PersonPhotoApiResponse<TVersion>` instead of `Blob`.
|
|
392
402
|
|
|
@@ -473,7 +483,6 @@
|
|
|
473
483
|
- [#1243](https://github.com/equinor/fusion-framework/pull/1243) [`f277c7fc`](https://github.com/equinor/fusion-framework/commit/f277c7fc54ca2ebe75ba1dda94a0d72eb7c8e15b) Thanks [@odinr](https://github.com/odinr)! - Added person services
|
|
474
484
|
|
|
475
485
|
> **for internal usage only!**
|
|
476
|
-
|
|
477
486
|
- add function for fetching person details
|
|
478
487
|
- add function for querying persons
|
|
479
488
|
- add function for downloading person photo
|
|
@@ -1570,7 +1579,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
1570
1579
|
``
|
|
1571
1580
|
|
|
1572
1581
|
- [#1254](https://github.com/equinor/fusion-framework/pull/1254) [`a2d2dee9`](https://github.com/equinor/fusion-framework/commit/a2d2dee987673171ad91daec98cb530649da5849) Thanks [@odinr](https://github.com/odinr)! - Update people client to reflect Fusion API
|
|
1573
|
-
|
|
1574
1582
|
- added models for v2 and v4
|
|
1575
1583
|
- added expand logic for person detail `roles` `positions` `contracts` `manager` `companies`
|
|
1576
1584
|
- changed api client to now include args and init (previously args where extracted from call parameters) to correctly type response models
|
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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AQ,EAAE;aACV,OAAO,CAAC,EAAE,CAAC;aACX,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;YACf,IAAI,CAAC;gBACH,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,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"}
|