@equinor/fusion-framework 8.1.0-next.1 → 8.1.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 CHANGED
@@ -1,201 +1,119 @@
1
1
  # Change Log
2
2
 
3
- ## 8.1.0-next.1
4
-
5
- ### Patch Changes
6
-
7
- - @equinor/fusion-framework-module-telemetry@8.0.0-next.1
8
-
9
- ## 8.1.0-next.0
3
+ ## 8.1.0
10
4
 
11
5
  ### Minor Changes
12
6
 
13
- - 2836e0b: Restructure documentation so each README is an entry point rather than a manual.
14
-
7
+ - f663b46: Restructure documentation so each README is an entry point rather than a manual.
8
+
15
9
  Long-form content moved into per-package `docs/` folders, matching the convention already used by `@equinor/fusion-framework-module` and `@equinor/fusion-framework-module-http`. Each README now keeps the elevator pitch, the shortest working example and a documentation table linking to the rest.
16
-
10
+
17
11
  - **msal** — `docs/api-reference.md`, `docs/auth-code-flow.md`, `docs/testing.md`, `docs/version-management.md`, `docs/migration-v2-to-v4.md`, `docs/troubleshooting.md`. The README also gained the top-level heading it was missing.
18
12
  - **service-discovery** — `docs/configuration.md`, `docs/testing.md`, `docs/session-overrides.md`, `docs/api-reference.md`.
19
13
  - **framework** — `docs/testing-choosing-a-layer.md`, `docs/testing.md`, `docs/testing-design.md`, `docs/testing-extending.md`, `docs/testing-api.md`.
20
-
14
+
21
15
  Both module READMEs now document their `/mock` entry point, which was previously undocumented, and state that spying on an individual call is the test runner's job rather than something these packages provide.
22
-
23
- - 2836e0b: `FrameworkMockConfigurator.context` is now backed by `ContextMockConfigurator` from `@equinor/fusion-framework-module-context/mock` instead of the real `ContextModuleConfigurator` — context resolution in tests no longer performs real I/O:
24
-
16
+ - f663b46: Add a `./mock` entry point for initializing the framework in a test.
17
+
25
18
  ```typescript
26
- const configurator = new FrameworkMockConfigurator();
27
- configurator.context.setCurrentContext({
28
- id: "my-ctx",
29
- type: { id: "ProjectMaster" },
30
- value: {},
19
+ import { mockFramework } from '@equinor/fusion-framework/mock';
20
+
21
+ const fusion = await mockFramework((configurator) => {
22
+ configurator.msal.setAccount({ name: 'Ada Lovelace' });
23
+ configurator.serviceDiscovery.setBaseUri('http://localhost:6669');
24
+ configurator.serviceDiscovery.addService({ key: 'my-api' });
31
25
  });
32
-
33
- const fusion = await init(configurator);
34
26
  ```
35
-
36
- This changes the type returned by `.context` from `ContextModuleConfigurator` to `ContextMockConfigurator` (which extends it) code relying on `.context` being exactly `ContextModuleConfigurator` should switch to seeding data through the new mock methods (`setCurrentContext`, `setContexts`, `addContext`, `setRelatedContexts`, `setResolver`) instead of configuring a real client.
37
-
38
- `docs/testing.md`, `docs/testing-extending.md` and `docs/testing-api.md` are updated to describe both mocking strategies now available for context: the in-memory `ContextMockConfigurator` above, and mocking the context API's HTTP responses directly for tests that need to exercise the real configurator/services/HTTP pipeline.
39
-
40
- - 2836e0b: Add `_pin` and `_getConfig` to `FrameworkMockConfigurator`, so a module supplied through `TModules` can get the same kind of named accessor `.msal` and `.serviceDiscovery` already have.
41
-
42
- Previously that pinning was hand-written twice, once per built-in mock, with no way for anything else to do the same. A subclass now reuses it directly:
43
-
27
+
28
+ `mockFramework` runs the real configure initialize pipeline with the real built-in modules and
29
+ substitutes only the boundaries that leave the process. It takes a single callback receiving a
30
+ `FrameworkMockConfigurator`, which **is** a `FrameworkConfigurator`, so every `enableX` helper an
31
+ application already uses — including its own — accepts it unchanged.
32
+
33
+ `FrameworkMockConfigurator` exposes an accessor per module whose test boundary is mocked, all
34
+ reachable synchronously via a new `_pin`/`_getConfig` primitive any module (built-in or
35
+ application-defined) can reuse:
36
+
44
37
  ```typescript
45
38
  class AppMockConfigurator extends FrameworkMockConfigurator<[InvoiceModule]> {
46
39
  constructor() {
47
40
  super();
48
41
  this._pin(invoiceMockModule);
49
42
  }
50
-
51
43
  get invoices(): InvoiceMockConfigurator {
52
- return this._getConfig("invoices");
44
+ return this._getConfig('invoices');
53
45
  }
54
46
  }
55
47
  ```
56
-
57
- `_pin(module)` replaces the module's own `configure` factory with one that always returns the same instance, and registers it — pinning it before initialization runs is what lets a test reach the accessor synchronously and have it be the configurator the module is actually built from. `_getConfig(name)` looks that instance up by the module's name, throwing if nothing was pinned for it.
58
-
59
- `.msal` and `.serviceDiscovery` are unchanged for consumers; they are now built from `_pin`/`_getConfig` themselves rather than from two private fields.
60
-
61
- - 2836e0b: Add `.services`, `.context` and `.telemetry` accessors to `FrameworkMockConfigurator`, alongside the existing `.msal`, `.serviceDiscovery` and `.http`.
62
-
63
- These three modules have no test double yet, so anything read through `.services`, `.context` or `.telemetry` still performs real I/O — but their configurators are now reachable synchronously the same way `.msal` and `.serviceDiscovery` already are, since none of their `configure` factories depend on `ref`:
64
-
65
- ```typescript
66
- const configurator = new FrameworkMockConfigurator();
67
- configurator.services.configureClient("my-api", {
68
- baseUri: "http://localhost:6669",
69
- });
70
-
71
- const fusion = await init(configurator);
72
- ```
73
-
74
- `event` is intentionally left out: its `configure` factory reads `ref` to wire event bubbling to a parent event provider when `FrameworkMockConfigurator` is hoisted inside a host framework, and pinning it would call `configure()` with `ref` always `undefined` — silently disabling that bubbling.
75
-
76
- - 2836e0b: Add a `./mock` entry point for initializing the framework in a test.
77
-
78
- ```typescript
79
- import { mockFramework } from "@equinor/fusion-framework/mock";
80
-
81
- const fusion = await mockFramework();
82
- ```
83
-
84
- `mockFramework` runs the real configure → initialize pipeline with the real built-in modules and substitutes only the boundaries that leave the process — the MSAL client and the service discovery client. Module wiring, configuration validation and lifecycle hooks behave as they do in production, so a test still catches wiring mistakes that a hand-built replacement for the module graph would hide.
85
-
86
- It takes a single callback receiving a `FrameworkMockConfigurator`, which **is** a `FrameworkConfigurator`. Modules whose boundary is mocked expose their own configurator as a property, so a test configures them without registering a callback:
87
-
88
- ```typescript
89
- const fusion = await mockFramework((configurator) => {
90
- configurator.msal.setAccount({ name: "Ada Lovelace" });
91
- configurator.serviceDiscovery.setBaseUri("http://localhost:6669");
92
- configurator.serviceDiscovery.addService({ key: "my-api" });
93
- });
94
- ```
95
-
96
- Because it is a real configurator, every `enableX` helper an application already uses accepts it unchanged — including the ones a team writes for their own modules. Those modules can be passed as a type argument so they are typed on the configurator _and_ on the resulting `fusion.modules` without a cast:
97
-
98
- ```typescript
99
- const fusion = await mockFramework<[InvoiceModule]>((configurator) => {
100
- enableInvoicesMock(configurator, { total: 42 });
101
- });
102
-
103
- await fusion.modules.invoices.getInvoice("inv-1"); // typed
104
- ```
105
-
106
- `FrameworkMockConfigurator` is also exported for tests that need to hold on to the configurator and call `init` themselves.
107
-
108
- The entry point owns no mock logic. Each module exports its own test double from its own `./mock` entry point, and this one composes the built-in set; an application module follows the same pattern and plugs in without any support from this package. It has no test-runner dependency and provides no mocking API, because replacing an individual call belongs to your test runner.
109
-
110
- - 2836e0b: `FrameworkMockConfigurator.telemetry` is now backed by `TelemetryMockConfigurator` from `@equinor/fusion-framework-module-telemetry/mock` instead of the real `TelemetryConfigurator` — telemetry tracked through a mocked framework instance no longer reaches Application Insights or any real endpoint:
111
-
112
- ```typescript
113
- import { filter } from "rxjs";
114
-
115
- const fusion = await mockFramework();
116
-
117
- fusion.modules.telemetry.items
118
- .pipe(filter((item) => item.name === "button-click"))
119
- .subscribe((item) => {
120
- // ...
121
- });
122
-
123
- fusion.modules.telemetry.trackEvent({ name: "button-click" });
124
- ```
125
-
126
- A test can register its own adapter alongside the mock's default one, the same way `enableTelemetry` already does:
127
-
128
- ```typescript
129
- const myAdapter: ITelemetryAdapter = {
130
- processItem: (item) => forwardSomewhere(item),
131
- };
132
- const fusion = await mockFramework((configurator) => {
133
- configurator.telemetry.setAdapter("my-adapter", myAdapter);
134
- });
135
- ```
136
-
137
- This changes the type returned by `.telemetry` from `ITelemetryConfigurator` to `TelemetryMockConfigurator` (which extends the real `TelemetryConfigurator`) — code relying on `.telemetry` being exactly the real configurator should read tracked items back through `.telemetry.adapter` (`getItems`/`waitForItem`) instead of asserting against a real telemetry backend.
138
-
139
- - 2836e0b: Add a `.http` accessor to `FrameworkMockConfigurator`, backed by the real `IHttpClientConfigurator` — fake a response by registering a short-circuiting middleware through `.http.addMiddleware(...)` instead of swapping the module out:
140
-
141
- ```ts
142
- const configurator = new FrameworkMockConfigurator();
143
- configurator.http.addMiddleware(async (uri, init, next) =>
144
- uri === "https://api.example.com/items"
145
- ? Response.json([{ id: 1 }])
146
- : next(uri, init),
147
- );
148
- ```
149
-
150
- See `@equinor/fusion-framework-module-http`'s `addMiddleware` changeset for the full API.
151
-
152
- ### Patch Changes
153
-
154
- - e8aae1f: Internal: publish every package on the `next` pre-release tag so the whole framework can be installed as a coherent set.
155
-
156
- Packages without their own changes are bumped only to receive a `-next.N` version and the `next` dist-tag on npm. Install with:
157
-
158
- ```bash
159
- pnpm add @equinor/fusion-framework-react-app@next
160
- ```
161
-
162
- - 2836e0b: `init` no longer throws when no DOM is present.
163
-
48
+
49
+ - `.msal` / `.serviceDiscovery` unchanged in behavior, now built on `_pin`/`_getConfig` themselves.
50
+ - `.http` — backed by the real `IHttpClientConfigurator`; fake a response with
51
+ `configurator.http.addMiddleware(...)` instead of swapping the module out. See
52
+ `@equinor/fusion-framework-module-http`'s `addMiddleware` changeset for the full API.
53
+ - `.context` backed by `ContextMockConfigurator` (`@equinor/fusion-framework-module-context/mock`);
54
+ context resolution in tests no longer performs real I/O. **Type change:** `.context` now returns
55
+ `ContextMockConfigurator` (extends `ContextModuleConfigurator`) seed data with
56
+ `setCurrentContext`/`setContexts`/`addContext`/`setRelatedContexts`/`setResolver` instead of
57
+ configuring a real client.
58
+ - `.telemetry` backed by `TelemetryMockConfigurator`
59
+ (`@equinor/fusion-framework-module-telemetry/mock`); tracked telemetry no longer reaches
60
+ Application Insights or any real endpoint. **Type change:** `.telemetry` now returns
61
+ `TelemetryMockConfigurator` (extends the real `TelemetryConfigurator`) — read tracked items back
62
+ through `.telemetry.adapter` (`getItems`/`waitForItem`) instead of asserting against a real backend.
63
+ - `.services` reachable the same way, though it still performs real I/O (no test double yet).
64
+
65
+ `event` is intentionally left out: its `configure` factory reads `ref` to wire event bubbling to a
66
+ parent event provider when `FrameworkMockConfigurator` is hoisted inside a host framework, and
67
+ pinning it would silently disable that bubbling.
68
+
69
+ `docs/testing.md`, `docs/testing-extending.md` and `docs/testing-api.md` describe both mocking
70
+ strategies now available for context and telemetry: the in-memory mock configurators above, and
71
+ mocking the real API/adapter boundary directly for tests that need the full pipeline.
72
+
73
+ The entry point owns no mock logic of its own — each module exports its own test double from its
74
+ own `./mock` entry point, and this one composes the built-in set.
75
+
76
+ ### Patch Changes
77
+
78
+ - f663b46: `init` no longer throws when no DOM is present.
79
+
164
80
  The running instance is published as `window.Fusion` for portal shells and widgets. That assignment was unguarded, so initializing the framework anywhere without a `window` — a test runner using the `node` environment, or a server-side render — failed with `ReferenceError: window is not defined`.
165
-
81
+
166
82
  The assignment is now skipped when `window` is undefined. Browser behaviour is unchanged.
167
-
168
- - Updated dependencies [e8aae1f]
169
- - Updated dependencies [2836e0b]
170
- - Updated dependencies [2836e0b]
171
- - Updated dependencies [2836e0b]
172
- - Updated dependencies [2836e0b]
173
- - Updated dependencies [2836e0b]
174
- - Updated dependencies [2836e0b]
175
- - Updated dependencies [2836e0b]
176
- - Updated dependencies [2836e0b]
177
- - Updated dependencies [2836e0b]
178
- - Updated dependencies [2836e0b]
179
- - Updated dependencies [2836e0b]
180
- - Updated dependencies [2836e0b]
181
- - Updated dependencies [2836e0b]
182
- - Updated dependencies [2836e0b]
183
- - Updated dependencies [2836e0b]
184
- - Updated dependencies [2836e0b]
185
- - Updated dependencies [2836e0b]
186
- - Updated dependencies [2836e0b]
187
- - Updated dependencies [2836e0b]
188
- - Updated dependencies [2836e0b]
189
- - Updated dependencies [2836e0b]
190
- - Updated dependencies [2836e0b]
191
- - @equinor/fusion-framework-module@6.1.3-next.0
192
- - @equinor/fusion-framework-module-context@9.0.0-next.0
193
- - @equinor/fusion-framework-module-event@6.1.0-next.0
194
- - @equinor/fusion-framework-module-http@8.1.0-next.0
195
- - @equinor/fusion-framework-module-msal@11.0.0-next.0
196
- - @equinor/fusion-framework-module-service-discovery@10.1.0-next.0
197
- - @equinor/fusion-framework-module-services@8.1.1-next.0
198
- - @equinor/fusion-framework-module-telemetry@8.0.0-next.0
83
+ - Updated dependencies [f663b46]
84
+ - Updated dependencies [f663b46]
85
+ - Updated dependencies [f663b46]
86
+ - Updated dependencies [f663b46]
87
+ - Updated dependencies [f663b46]
88
+ - Updated dependencies [f663b46]
89
+ - Updated dependencies [f663b46]
90
+ - Updated dependencies [f663b46]
91
+ - Updated dependencies [f663b46]
92
+ - Updated dependencies [f663b46]
93
+ - Updated dependencies [f663b46]
94
+ - Updated dependencies [f663b46]
95
+ - Updated dependencies [f663b46]
96
+ - Updated dependencies [f663b46]
97
+ - Updated dependencies [f663b46]
98
+ - Updated dependencies [f663b46]
99
+ - Updated dependencies [f663b46]
100
+ - Updated dependencies [f663b46]
101
+ - Updated dependencies [f663b46]
102
+ - Updated dependencies [f663b46]
103
+ - @equinor/fusion-framework-module-service-discovery@10.1.0
104
+ - @equinor/fusion-framework-module-msal@11.0.0
105
+ - @equinor/fusion-framework-module-context@9.0.0
106
+ - @equinor/fusion-framework-module-event@6.1.0
107
+ - @equinor/fusion-framework-module-http@8.1.0
108
+ - @equinor/fusion-framework-module-telemetry@7.1.0
109
+ - @equinor/fusion-framework-module@6.1.3
110
+ - @equinor/fusion-framework-module-services@8.1.1
111
+
112
+ ## 8.0.16
113
+
114
+ ### Patch Changes
115
+
116
+ - @equinor/fusion-framework-module-telemetry@7.0.3
199
117
 
200
118
  ## 8.0.15
201
119
 
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '8.1.0-next.1';
2
+ export const version = '8.1.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}