@equinor/fusion-framework-module-http 7.0.8 → 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.
Files changed (41) hide show
  1. package/CHANGELOG.md +34 -27
  2. package/README.md +141 -925
  3. package/dist/esm/configurator.js +5 -5
  4. package/dist/esm/configurator.js.map +1 -1
  5. package/dist/esm/lib/client/client-msal.js +3 -2
  6. package/dist/esm/lib/client/client-msal.js.map +1 -1
  7. package/dist/esm/lib/client/client.js +8 -7
  8. package/dist/esm/lib/client/client.js.map +1 -1
  9. package/dist/esm/lib/operators/index.js +1 -0
  10. package/dist/esm/lib/operators/index.js.map +1 -1
  11. package/dist/esm/lib/selectors/index.js +1 -0
  12. package/dist/esm/lib/selectors/index.js.map +1 -1
  13. package/dist/esm/module.js +18 -9
  14. package/dist/esm/module.js.map +1 -1
  15. package/dist/esm/provider.js +38 -27
  16. package/dist/esm/provider.js.map +1 -1
  17. package/dist/esm/version.js +1 -1
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/dist/types/configurator.d.ts +49 -26
  20. package/dist/types/lib/client/client.d.ts +7 -7
  21. package/dist/types/lib/operators/index.d.ts +1 -0
  22. package/dist/types/lib/selectors/index.d.ts +2 -0
  23. package/dist/types/module.d.ts +18 -9
  24. package/dist/types/provider.d.ts +24 -19
  25. package/dist/types/version.d.ts +1 -1
  26. package/docs/client-configuration.md +175 -0
  27. package/docs/observable-patterns.md +103 -0
  28. package/docs/selectors-and-handlers.md +112 -0
  29. package/docs/server-sent-events.md +125 -0
  30. package/package.json +6 -6
  31. package/src/configurator.ts +54 -26
  32. package/src/lib/client/client-msal.ts +3 -2
  33. package/src/lib/client/client.ts +8 -9
  34. package/src/lib/operators/index.ts +1 -0
  35. package/src/lib/selectors/index.ts +7 -0
  36. package/src/module.ts +18 -9
  37. package/src/provider.ts +56 -34
  38. package/src/version.ts +1 -1
  39. package/tests/HttpClient.test.ts +90 -11
  40. package/tests/operators.test.ts +24 -0
  41. package/tests/sse.selector.test.ts +6 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
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
+ - abffa53: Fix HTTP client configuration so `responseHandler` options are applied when creating clients, preserve request `path` values in the request pipeline, only treat absolute `http:` and `https:` strings as ad-hoc client URLs, avoid mutating caller-provided MSAL request init objects, and re-export the SSE helpers from the operators and selectors entry points.
25
+ - Updated dependencies [abffa53]
26
+ - Updated dependencies [abffa53]
27
+ - @equinor/fusion-framework-module@6.0.0
28
+ - @equinor/fusion-framework-module-msal@8.0.0
29
+
3
30
  ## 7.0.8
4
31
 
5
32
  ### Patch Changes
@@ -77,7 +104,6 @@
77
104
  ### Patch Changes
78
105
 
79
106
  - [#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
80
-
81
107
  - **v4.1.10**: Fixed shape caching issue (#5263) improving validation performance for complex schemas
82
108
  - **v4.1.11**: Maintenance release with general improvements
83
109
 
@@ -96,7 +122,6 @@
96
122
  Updated source code to migrate from zod v3 to v4. Updated zod dependency from v3.25.76 to v4.1.8 and modified error handling in the HTTP module to use ZodError `.issues` property instead of `.errors` and replaced `z.custom()` with `z.string().refine()` for better v4 compatibility.
97
123
 
98
124
  Key changes in source code:
99
-
100
125
  - Updated ZodError `.errors` to `.issues` property in capitalize-request-method operator
101
126
  - Replaced `z.custom()` with `z.string().refine()` for better v4 compatibility in request method casing validation
102
127
  - Simplified error message configuration in request method verb validation
@@ -105,7 +130,6 @@
105
130
  Breaking changes: Error handling structure has changed to use new zod v4 error format.
106
131
 
107
132
  Links:
108
-
109
133
  - [Zod v4 Migration Guide](https://github.com/colinhacks/zod/releases/tag/v4.0.0)
110
134
  - [Zod v4.1.8 Release Notes](https://github.com/colinhacks/zod/releases/tag/v4.1.8)
111
135
 
@@ -121,7 +145,6 @@
121
145
  - [#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.
122
146
 
123
147
  ## Breaking Changes
124
-
125
148
  - **Node.js Requirements**: Requires Node.js 18+ (already satisfied)
126
149
  - **Vite Compatibility**: Updated to work with Vite 7.x (already using Vite 7.1.5)
127
150
  - **Snapshot Format**: Snapshots now use backtick quotes (\`) instead of single quotes
@@ -129,18 +152,15 @@
129
152
  - **TypeScript Support**: Enhanced TypeScript integration and type definitions
130
153
 
131
154
  ## Security Updates
132
-
133
155
  - CVE-2025-24963: Browser mode serves arbitrary files (fixed in 2.1.9)
134
156
  - CVE-2025-24964: Remote Code Execution vulnerability (fixed in 2.1.9)
135
157
 
136
158
  ## Migration Notes
137
-
138
159
  - Test snapshots may need regeneration due to quote format changes
139
160
  - Some test configurations might need updates for new TypeScript support
140
161
  - Peer dependency warnings for @vitest/coverage-v8 are expected and safe to ignore
141
162
 
142
163
  ## Links
143
-
144
164
  - [Vitest 3.0 Migration Guide](https://vitest.dev/guide/migration)
145
165
  - [Vitest 3.2.4 Release Notes](https://github.com/vitest-dev/vitest/releases/tag/v3.2.4)
146
166
 
@@ -152,7 +172,6 @@
152
172
  ### Patch Changes
153
173
 
154
174
  - [#3075](https://github.com/equinor/fusion-framework/pull/3075) [`8fffbfb`](https://github.com/equinor/fusion-framework/commit/8fffbfb12daa9748bf5290e5084cd4d409aed253) Thanks [@odinr](https://github.com/odinr)! - fix(http): use acquireAccessToken instead of acquireToken
155
-
156
175
  - The HTTP module now uses the correct method `acquireAccessToken` from the auth provider to retrieve the access token for requests with scopes.
157
176
  - This fixes compatibility with the new MSAL node module interface, which no longer exposes `acquireToken` but instead provides `acquireAccessToken` for token retrieval.
158
177
  - Ensures the Authorization header is set correctly for authenticated HTTP requests.
@@ -170,7 +189,6 @@
170
189
  ### Patch Changes
171
190
 
172
191
  - [#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
173
-
174
192
  - Updated package.json typesVersions.
175
193
  - Ensures backward compatibility with older node versions.
176
194
  - Ensured consistency with workspace and repository configuration.
@@ -201,7 +219,6 @@
201
219
  ### Minor Changes
202
220
 
203
221
  - [#3038](https://github.com/equinor/fusion-framework/pull/3038) [`7a0a510`](https://github.com/equinor/fusion-framework/commit/7a0a510e0af1f0769c596e1b9aaa391250efd95d) Thanks [@odinr](https://github.com/odinr)! - ### Added
204
-
205
222
  - Introduced support for Server-Sent Events (SSE) in the HTTP module.
206
223
  - Added `sse# Change Log method to `HttpClient` for subscribing to SSE streams.
207
224
  - Added `sseMap` operator for handling SSE in RxJS pipelines.
@@ -209,7 +226,6 @@
209
226
  - Enhanced error handling with `ServerSentEventResponseError`.
210
227
 
211
228
  ### Documentation
212
-
213
229
  - Updated README with examples and usage details for SSE support.
214
230
 
215
231
  ### Patch Changes
@@ -272,7 +288,6 @@
272
288
  ### Minor Changes
273
289
 
274
290
  - [#2491](https://github.com/equinor/fusion-framework/pull/2491) [`73af73e`](https://github.com/equinor/fusion-framework/commit/73af73e5582ca27b132210af8ba308b80e036d51) Thanks [@odinr](https://github.com/odinr)! - Added a new operator `capitalizeRequestMethodOperator` to ensure that the HTTP method of a given request is in uppercase.
275
-
276
291
  - Introduced `capitalizeRequestMethodOperator` which processes an HTTP request object and converts its method to uppercase.
277
292
  - Logs a warning if the HTTP method was converted, providing information about the change and a reference to RFC 7231 Section 4.1.
278
293
 
@@ -293,7 +308,7 @@
293
308
  const httpClient = new HttpClient();
294
309
  httpClient.requestHandler.add(
295
310
  "capatalize-method",
296
- capitalizeRequestMethodOperator()
311
+ capitalizeRequestMethodOperator(),
297
312
  );
298
313
 
299
314
  // transforms `method` to uppercase and logs a warning.
@@ -411,7 +426,7 @@
411
426
  // Add the request validation operator to the HttpClient.
412
427
  httpClient.requestHandler.add(
413
428
  "validate-init",
414
- requestValidationOperator({ parse: true })
429
+ requestValidationOperator({ parse: true }),
415
430
  );
416
431
 
417
432
  // will throw an error because of invalid method.
@@ -469,7 +484,6 @@
469
484
  ### Patch Changes
470
485
 
471
486
  - [#2324](https://github.com/equinor/fusion-framework/pull/2324) [`788d0b9`](https://github.com/equinor/fusion-framework/commit/788d0b93edc25e5b682d88c58614560c204c1af9) Thanks [@odinr](https://github.com/odinr)! - Updated documentation in `README.md` for http module.
472
-
473
487
  - added introduction to http module
474
488
  - added concepts section which highlights the key concepts of http module
475
489
  - added sequence diagram for http request execution
@@ -483,14 +497,12 @@
483
497
  - [#2324](https://github.com/equinor/fusion-framework/pull/2324) [`788d0b9`](https://github.com/equinor/fusion-framework/commit/788d0b93edc25e5b682d88c58614560c204c1af9) Thanks [@odinr](https://github.com/odinr)! - Updated TsDoc for http module
484
498
 
485
499
  - [#2324](https://github.com/equinor/fusion-framework/pull/2324) [`788d0b9`](https://github.com/equinor/fusion-framework/commit/788d0b93edc25e5b682d88c58614560c204c1af9) Thanks [@odinr](https://github.com/odinr)! - - Added a new type `ResponseSelector<TResult, TResponse>`: a function that takes a `Response` object and returns an observable stream of type `TResult`. The `ResponseSelector` type has two template parameters: `TResult` and `TResponse`.
486
-
487
500
  - Updated the `FetchRequestInit` type to include a new property `selector` of type `ResponseSelector<TReturn, TResponse>`, which allows specifying a response selector function.
488
501
  - Updated the blob-selector and json-selector functions to use the new `ResponseSelector` type.
489
502
 
490
503
  - [#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.
491
504
 
492
505
  Removing the `removeComments` option allows TypeScript to preserve comments in the compiled JavaScript output. This can be beneficial for several reasons:
493
-
494
506
  1. Improved debugging: Preserved comments can help developers understand the code better during debugging sessions.
495
507
  2. Documentation: JSDoc comments and other important code documentation will be retained in the compiled output.
496
508
  3. Source map accuracy: Keeping comments can lead to more accurate source maps, which is crucial for debugging and error tracking.
@@ -539,7 +551,6 @@
539
551
  ### Major Changes
540
552
 
541
553
  - [#2181](https://github.com/equinor/fusion-framework/pull/2181) [`ba2379b`](https://github.com/equinor/fusion-framework/commit/ba2379b177f23ccc023894e36e50d7fc56c929c8) Thanks [@odinr](https://github.com/odinr)! - The `blob` and `blob# Change Log methods in the `HttpClient` class have been updated to provide a more robust and flexible API for fetching blob resources.
542
-
543
554
  1. The `blob` and `blob# Change Log methods now accept an optional `args`parameter of type`FetchRequestInit<T, TRequest, TResponse>`, where `T` is the type of the expected blob result. This allows consumers to customize the fetch request and response handling.
544
555
  2. The `blob` and `blob# Change Log methods now return a `Promise<T>`and`StreamResponse<T>`respectively, where`T` is the type of the expected blob result. This allows consumers to handle the blob data in a more type-safe manner.
545
556
  3. The `blobSelector` function has been updated to extract the filename (if available) from the `content-disposition` header and return it along with the blob data in a `BlobResult` object.
@@ -562,7 +573,7 @@
562
573
 
563
574
  ```typescript
564
575
  const customBlobSelector = async (
565
- response: Response
576
+ response: Response,
566
577
  ): Promise<{ filename: string; blob: Blob }> => {
567
578
  // Extract filename and blob from the response
568
579
  const { filename, blob } = await blobSelector(response);
@@ -606,12 +617,12 @@
606
617
  if (data) {
607
618
  console.error(
608
619
  "the request was not `ok`, see provided error data",
609
- data
620
+ data,
610
621
  );
611
622
  } else {
612
623
  console.error(
613
624
  "failed to parse data from response, see provided cause",
614
- cause
625
+ cause,
615
626
  );
616
627
  }
617
628
  }
@@ -663,7 +674,7 @@
663
674
 
664
675
  // generate a RequestInit object
665
676
  const fooRequest = await lastValueFrom(
666
- fooClient.requestHandler.process({ path: "/api", uri: fooClient.uri })
677
+ fooClient.requestHandler.process({ path: "/api", uri: fooClient.uri }),
667
678
  );
668
679
 
669
680
  expect((fooRequest.headers as Headers)?.get("x-foo")).toBe("bar");
@@ -673,7 +684,7 @@
673
684
 
674
685
  // generate a RequestInit object
675
686
  const barRequest = await lastValueFrom(
676
- barClient.requestHandler.process({ path: "/api", uri: barClient.uri })
687
+ barClient.requestHandler.process({ path: "/api", uri: barClient.uri }),
677
688
  );
678
689
 
679
690
  // expect the request header to not been modified
@@ -739,7 +750,6 @@
739
750
  - [#1621](https://github.com/equinor/fusion-framework/pull/1621) [`0af3540`](https://github.com/equinor/fusion-framework/commit/0af3540340bac85a19ca3a8ec4e0ccd42b3090ee) Thanks [@odinr](https://github.com/odinr)! - **Improves error handling when processing json http response**
740
751
 
741
752
  In packages/modules/http/src/errors.ts:
742
-
743
753
  - The class HttpResponseError now has a generic parameter TResponse.
744
754
  - Added a static property Name to the class.
745
755
  - Added a new class HttpJsonResponseError which extends HttpResponseError and also has generic parameters TType and TResponse.
@@ -748,7 +758,6 @@
748
758
  - Modified the constructor to accept an optional data parameter.
749
759
 
750
760
  In packages/modules/http/src/lib/selectors/json-selector.ts:
751
-
752
761
  - Added an import statement for HttpJsonResponseError.
753
762
  - Modified the jsonSelector function to handle errors when parsing the response.
754
763
  - Added a try-catch block.
@@ -781,7 +790,6 @@
781
790
  ### Minor Changes
782
791
 
783
792
  - [#1242](https://github.com/equinor/fusion-framework/pull/1242) [`8e9e34a0`](https://github.com/equinor/fusion-framework/commit/8e9e34a06a6905d092ad8ca3f9330a3699da20fa) Thanks [@odinr](https://github.com/odinr)! - add method for executing blob requests
784
-
785
793
  - added selector for extracting blob from response
786
794
  - added function for fetching blob as stream or promise on the http client
787
795
 
@@ -834,7 +842,6 @@
834
842
  ### Patch Changes
835
843
 
836
844
  - [#905](https://github.com/equinor/fusion-framework/pull/905) [`a7858a1c`](https://github.com/equinor/fusion-framework/commit/a7858a1c01542e2dc94370709f122b4b99c3219c) Thanks [@odinr](https://github.com/odinr)! - **🚧 Chore: dedupe packages**
837
-
838
845
  - align all versions of typescript
839
846
  - update types to build
840
847
  - a couple of typecasts did not [satisfies](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#satisfies-support-in-jsdoc) and was recasted as `unknwon`, marked with `TODO`, should be fixed in future