@equinor/fusion-framework-module-signalr 10.0.2-next.0 → 11.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 (36) hide show
  1. package/CHANGELOG.md +24 -18
  2. package/README.md +133 -0
  3. package/dist/esm/SignalRModule.js +16 -0
  4. package/dist/esm/SignalRModule.js.map +1 -1
  5. package/dist/esm/SignalRModuleConfigurator.js +35 -7
  6. package/dist/esm/SignalRModuleConfigurator.js.map +1 -1
  7. package/dist/esm/SignalRModuleProvider.js +33 -1
  8. package/dist/esm/SignalRModuleProvider.js.map +1 -1
  9. package/dist/esm/index.js +13 -0
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/lib/Topic.js +40 -0
  12. package/dist/esm/lib/Topic.js.map +1 -1
  13. package/dist/esm/lib/utils/configure-from-framework.js +12 -0
  14. package/dist/esm/lib/utils/configure-from-framework.js.map +1 -1
  15. package/dist/esm/lib/utils/enable-signalr.js +29 -24
  16. package/dist/esm/lib/utils/enable-signalr.js.map +1 -1
  17. package/dist/esm/version.js +1 -1
  18. package/dist/esm/version.js.map +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/dist/types/SignalRModule.d.ts +25 -0
  21. package/dist/types/SignalRModuleConfigurator.d.ts +91 -15
  22. package/dist/types/SignalRModuleProvider.d.ts +56 -3
  23. package/dist/types/index.d.ts +13 -0
  24. package/dist/types/lib/Topic.d.ts +40 -0
  25. package/dist/types/lib/utils/configure-from-framework.d.ts +1 -8
  26. package/dist/types/lib/utils/enable-signalr.d.ts +46 -24
  27. package/dist/types/version.d.ts +1 -1
  28. package/package.json +8 -8
  29. package/src/SignalRModule.ts +25 -0
  30. package/src/SignalRModuleConfigurator.ts +92 -15
  31. package/src/SignalRModuleProvider.ts +58 -4
  32. package/src/index.ts +14 -0
  33. package/src/lib/Topic.ts +40 -0
  34. package/src/lib/utils/configure-from-framework.ts +12 -0
  35. package/src/lib/utils/enable-signalr.ts +47 -24
  36. package/src/version.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,15 +1,32 @@
1
1
  # Change Log
2
2
 
3
- ## 10.0.2-next.0
3
+ ## 11.0.0
4
4
 
5
- ### Patch Changes
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
- - [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`f647825`](https://github.com/equinor/fusion-framework/commit/f647825cb5712763b09dafda21fd996211c78b78) Thanks [@odinr](https://github.com/odinr)! - relase next
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 [[`f647825`](https://github.com/equinor/fusion-framework/commit/f647825cb5712763b09dafda21fd996211c78b78)]:
10
- - @equinor/fusion-framework-module@5.0.7-next.0
11
- - @equinor/fusion-framework-module-msal@7.3.2-next.0
12
- - @equinor/fusion-framework-module-service-discovery@9.1.2-next.0
24
+ - Updated dependencies [abffa53]
25
+ - Updated dependencies [abffa53]
26
+ - Updated dependencies [8f30948]
27
+ - @equinor/fusion-framework-module@6.0.0
28
+ - @equinor/fusion-framework-module-msal@8.0.0
29
+ - @equinor/fusion-framework-module-service-discovery@10.0.0
13
30
 
14
31
  ## 10.0.1
15
32
 
@@ -29,17 +46,6 @@
29
46
  - Updated dependencies [[`cb37cae`](https://github.com/equinor/fusion-framework/commit/cb37cae45e06778e8d1ea20faed31b582e49fcae)]:
30
47
  - @equinor/fusion-framework-module-msal@7.0.0
31
48
 
32
- ## 10.0.0-next.0
33
-
34
- ### Patch Changes
35
-
36
- - [#3820](https://github.com/equinor/fusion-framework/pull/3820) [`265bb76`](https://github.com/equinor/fusion-framework/commit/265bb767249989eeb1971e83f3fba94879e0813b) Thanks [@odinr](https://github.com/odinr)! - relase next
37
-
38
- - Updated dependencies [[`265bb76`](https://github.com/equinor/fusion-framework/commit/265bb767249989eeb1971e83f3fba94879e0813b)]:
39
- - @equinor/fusion-framework-module@5.0.6-next.0
40
- - @equinor/fusion-framework-module-msal@7.0.0-next.0
41
- - @equinor/fusion-framework-module-service-discovery@9.0.5-next.0
42
-
43
49
  ## 9.0.0
44
50
 
45
51
  ### Patch Changes
package/README.md ADDED
@@ -0,0 +1,133 @@
1
+ # @equinor/fusion-framework-module-signalr
2
+
3
+ Fusion Framework module for real-time communication via [SignalR](https://learn.microsoft.com/aspnet/core/signalr/introduction).
4
+
5
+ Provides an RxJS-based API for connecting to SignalR hubs, subscribing to server-side methods, and sending messages back to the server. Hub connections are reference-counted and automatically stopped when all subscribers unsubscribe.
6
+
7
+ ## When to use
8
+
9
+ Use this module when your Fusion application needs to:
10
+
11
+ - Receive real-time push notifications from a backend service
12
+ - Subscribe to server-sent events through a SignalR hub
13
+ - Send messages to a SignalR hub method
14
+
15
+ ## Installation
16
+
17
+ ```sh
18
+ pnpm add @equinor/fusion-framework-module-signalr
19
+ ```
20
+
21
+ ### Peer dependencies
22
+
23
+ | Package | Required |
24
+ | --- | --- |
25
+ | `@equinor/fusion-framework-module` | Yes |
26
+ | `@equinor/fusion-framework-module-msal` | No (needed for automatic token acquisition) |
27
+ | `@equinor/fusion-framework-module-service-discovery` | No (needed for service-discovery shorthand) |
28
+
29
+ ## Quick start
30
+
31
+ ### Service-discovery shorthand
32
+
33
+ The simplest path uses `enableSignalR` with service-discovery and MSAL. The hub URL and access token are resolved automatically:
34
+
35
+ ```ts
36
+ import { enableSignalR } from '@equinor/fusion-framework-module-signalr';
37
+
38
+ export const configure = (configurator) => {
39
+ enableSignalR(configurator, 'portal', {
40
+ service: 'portal',
41
+ path: '/signalr/hubs/service-message',
42
+ });
43
+ };
44
+ ```
45
+
46
+ ### Custom configuration callback
47
+
48
+ For full control, pass a builder callback:
49
+
50
+ ```ts
51
+ import { enableSignalR } from '@equinor/fusion-framework-module-signalr';
52
+
53
+ export const configure = (configurator) => {
54
+ enableSignalR(configurator, 'custom', (builder) => {
55
+ builder.addHub('custom', {
56
+ url: 'https://my-service.example.com/hub',
57
+ options: {
58
+ accessTokenFactory: () => getAccessToken(),
59
+ },
60
+ automaticReconnect: true,
61
+ });
62
+ });
63
+ };
64
+ ```
65
+
66
+ ## Subscribing to hub messages
67
+
68
+ Once the module is initialized, use `ISignalRProvider.connect()` to obtain a `Topic` — an RxJS `Observable` bound to a specific hub method:
69
+
70
+ ```ts
71
+ const signalR = modules.signalR;
72
+ const topic = signalR.connect<MyMessage>('portal', 'OnServiceMessage');
73
+
74
+ const subscription = topic.subscribe((message) => {
75
+ console.log('Received:', message);
76
+ });
77
+
78
+ // Unsubscribe when done — the hub connection is stopped automatically
79
+ // when the last subscriber unsubscribes.
80
+ subscription.unsubscribe();
81
+ ```
82
+
83
+ ## Sending messages
84
+
85
+ A `Topic` also exposes `send()` (fire-and-forget) and `invoke()` (request-response) for communicating with the server:
86
+
87
+ ```ts
88
+ // Fire-and-forget
89
+ topic.send('Hello from client');
90
+
91
+ // Request-response
92
+ const result = await topic.invoke<ServerResponse>('some argument');
93
+ ```
94
+
95
+ ## Key concepts
96
+
97
+ ### Hub configuration (`SignalRHubConfig`)
98
+
99
+ Each hub connection is described by a `SignalRHubConfig`:
100
+
101
+ | Property | Type | Description |
102
+ | --- | --- | --- |
103
+ | `url` | `string` | Absolute URL of the SignalR hub endpoint |
104
+ | `options` | `IHttpConnectionOptions` | Transport and auth options (minus `httpClient`) |
105
+ | `automaticReconnect` | `boolean` | Enable automatic reconnection on disconnect |
106
+ | `logLevel` | `LogLevel` | SignalR logging level (defaults to `Critical`) |
107
+
108
+ ### Connection lifecycle
109
+
110
+ - **Lazy creation** — hub connections are created on first subscription.
111
+ - **Shared connections** — multiple `Topic` instances for the same hub share one underlying `HubConnection` via `shareReplay`.
112
+ - **Automatic teardown** — when the last subscriber unsubscribes, the connection is stopped and removed from the internal cache.
113
+
114
+ ### `Topic<T>`
115
+
116
+ `Topic` extends RxJS `Observable<T>` and wraps a `HubConnection` method listener. It handles registering and unregistering the callback on the connection automatically.
117
+
118
+ ## Exports
119
+
120
+ | Export | Kind | Description |
121
+ | --- | --- | --- |
122
+ | `enableSignalR` | function | Register the module and configure hubs in one call |
123
+ | `module` / `default` | `SignalRModule` | Module instance for manual registration |
124
+ | `moduleKey` | `'signalR'` | Module registration key |
125
+ | `SignalRModuleProvider` | class | Default `ISignalRProvider` implementation |
126
+ | `SignalRConfigurator` | class | Default `ISignalRConfigurator` implementation |
127
+ | `SignalRModuleConfigBuilder` | class | Builder for dynamic hub configuration |
128
+ | `Topic` | class | RxJS Observable wrapper for a hub method |
129
+ | `ISignalRProvider` | interface | Provider interface |
130
+ | `ISignalRConfigurator` | interface | Configurator interface |
131
+ | `SignalRConfig` | type | Resolved configuration |
132
+ | `SignalRHubConfig` | type | Single hub configuration |
133
+ | `SignalRModuleConfigBuilderCallback` | type | Builder callback signature |
@@ -1,6 +1,22 @@
1
1
  import { SignalRConfigurator } from './SignalRModuleConfigurator';
2
2
  import { SignalRModuleProvider } from './SignalRModuleProvider';
3
+ /** Module registration key for the SignalR module (`'signalR'`). */
3
4
  export const moduleKey = 'signalR';
5
+ /**
6
+ * SignalR module instance that can be registered with a Fusion Framework configurator.
7
+ *
8
+ * During the `configure` phase, a {@link SignalRConfigurator} is created.
9
+ * During the `initialize` phase, the configurator builds its {@link SignalRConfig}
10
+ * and produces a {@link SignalRModuleProvider}.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { ModuleConfigurator } from '@equinor/fusion-framework-module';
15
+ * import signalR from '@equinor/fusion-framework-module-signalr';
16
+ *
17
+ * configurator.addConfig({ module: signalR });
18
+ * ```
19
+ */
4
20
  export const module = {
5
21
  name: moduleKey,
6
22
  configure: () => new SignalRConfigurator(),
@@ -1 +1 @@
1
- {"version":3,"file":"SignalRModule.js","sourceRoot":"","sources":["../../src/SignalRModule.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EAAyB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIvF,MAAM,CAAC,MAAM,SAAS,GAAqB,SAAS,CAAC;AAIrD,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,mBAAmB,EAAE;IAC1C,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,MAAO,IAAI,CAAC,MAA8B,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"SignalRModule.js","sourceRoot":"","sources":["../../src/SignalRModule.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAE7F,OAAO,EAAyB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAKvF,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAAqB,SAAS,CAAC;AAWrD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,mBAAmB,EAAE;IAC1C,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,MAAM,GAAG,MAAO,IAAI,CAAC,MAA8B,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC7E,OAAO,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,32 +1,60 @@
1
1
  import { ModuleConfigBuilder, } from '@equinor/fusion-framework-module';
2
2
  /**
3
- * builder utility class for generating configuration
3
+ * Builder utility for registering SignalR hub configurations during
4
+ * module initialization.
5
+ *
6
+ * Extends {@link ModuleConfigBuilder} to provide access to resolved
7
+ * module dependencies (e.g., service-discovery, authentication) so that
8
+ * hub URLs and access-token factories can be built dynamically.
9
+ *
10
+ * @template TDeps - Tuple of module dependencies available through the builder
4
11
  */
5
12
  export class SignalRModuleConfigBuilder extends ModuleConfigBuilder {
13
+ /**
14
+ * Register a named hub connection through the underlying configurator.
15
+ *
16
+ * @param name - Unique hub identifier
17
+ * @param config - Hub connection configuration
18
+ */
6
19
  async addHub(name, config) {
7
20
  this._config.addHub(name, config);
8
21
  }
9
22
  }
23
+ /**
24
+ * Default {@link ISignalRConfigurator} implementation.
25
+ *
26
+ * Collects hub registrations and builder callbacks, then produces a
27
+ * {@link SignalRConfig} during the module initialization phase.
28
+ */
10
29
  export class SignalRConfigurator {
11
30
  #builderCallbacks = [];
12
31
  #hubs = {};
13
32
  /**
14
- * register SignalR hub configuration.
33
+ * Register a named SignalR hub connection.
34
+ *
35
+ * @param name - Unique identifier for the hub
36
+ * @param config - Hub connection configuration
15
37
  */
16
38
  addHub(name, config) {
17
39
  this.#hubs[name] = config;
18
40
  }
19
41
  /**
20
- * add callback for building config on when configurator is creating config.
21
- * {@link SignalRConfigurator.createConfig}
42
+ * Register a configuration builder callback that will run during
43
+ * {@link SignalRConfigurator.createConfig}.
44
+ *
45
+ * @param cb - Callback receiving a {@link SignalRModuleConfigBuilder}
22
46
  */
23
47
  onCreateConfig(cb) {
24
48
  this.#builderCallbacks.push(cb);
25
49
  }
26
50
  /**
27
- * normally executed in `init` phase of module, which creates configuration to the module provider.
28
- * cycles threw all registered configuration builders.
29
- * await all registered hub configurations.
51
+ * Build the final {@link SignalRConfig} by executing all registered
52
+ * builder callbacks and collecting hub configurations.
53
+ *
54
+ * Normally called during the module `initialize` phase.
55
+ *
56
+ * @param init - Module initializer arguments providing access to resolved dependencies
57
+ * @returns Resolved configuration containing all registered hubs
30
58
  */
31
59
  async createConfig(init) {
32
60
  /** trigger all builder callbacks */
@@ -1 +1 @@
1
- {"version":3,"file":"SignalRModuleConfigurator.js","sourceRoot":"","sources":["../../src/SignalRModuleConfigurator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,GAEpB,MAAM,kCAAkC,CAAC;AAwC1C;;GAEG;AACH,MAAM,OAAO,0BAGX,SAAQ,mBAAgD;IACxD,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,MAAwB;QACjD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,mBAAmB;IAC9B,iBAAiB,GAA8C,EAAE,CAAC;IAElE,KAAK,GAAqC,EAAE,CAAC;IAE7C;;OAEG;IACI,MAAM,CAAC,IAAY,EAAE,MAAwB;QAClD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAI,EAAyC;QAChE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,YAAY,CACvB,IAA2E;QAE3E,oCAAoC;QACpC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACxC,8DAA8D;YAC9D,MAAM,OAAO,GAAG,IAAI,0BAA0B,CAA2B,IAAI,EAAE,IAAI,CAAC,CAAC;YACrF,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF"}
1
+ {"version":3,"file":"SignalRModuleConfigurator.js","sourceRoot":"","sources":["../../src/SignalRModuleConfigurator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,GAEpB,MAAM,kCAAkC,CAAC;AAyF1C;;;;;;;;;GASG;AACH,MAAM,OAAO,0BAGX,SAAQ,mBAAgD;IACxD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,MAAwB;QACjD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IAC9B,iBAAiB,GAA8C,EAAE,CAAC;IAElE,KAAK,GAAqC,EAAE,CAAC;IAE7C;;;;;OAKG;IACI,MAAM,CAAC,IAAY,EAAE,MAAwB;QAClD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAI,EAAyC;QAChE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,YAAY,CACvB,IAA2E;QAE3E,oCAAoC;QACpC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACxC,8DAA8D;YAC9D,MAAM,OAAO,GAAG,IAAI,0BAA0B,CAA2B,IAAI,EAAE,IAAI,CAAC,CAAC;YACrF,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF"}
@@ -1,15 +1,46 @@
1
1
  import { HubConnectionBuilder, AbortError } from '@microsoft/signalr';
2
2
  import { Observable, shareReplay } from 'rxjs';
3
3
  import { Topic } from './lib/Topic';
4
+ /**
5
+ * Default {@link ISignalRProvider} implementation.
6
+ *
7
+ * Creates and manages `@microsoft/signalr` `HubConnection` instances based on
8
+ * the resolved {@link SignalRConfig}. Hub connections are lazily created on
9
+ * first subscription and shared across all callers via `shareReplay`.
10
+ */
4
11
  export class SignalRModuleProvider {
5
12
  #config;
6
13
  #hubConnections = {};
14
+ /**
15
+ * @param config - Resolved SignalR configuration containing all registered hubs
16
+ */
7
17
  constructor(config) {
8
18
  this.#config = config;
9
19
  }
20
+ /**
21
+ * Connect to a named hub method and return an observable {@link Topic}.
22
+ *
23
+ * @template T - Type of messages received from the hub method
24
+ * @param hubId - Name of the hub as registered in the configurator
25
+ * @param methodName - Server-side method name to listen on
26
+ * @returns A {@link Topic} observable emitting hub messages
27
+ * @throws {Error} When no hub configuration exists for `hubId`
28
+ */
10
29
  connect(hubId, methodName) {
11
30
  return new Topic(methodName, this._createHubConnection(hubId));
12
31
  }
32
+ /**
33
+ * Create or retrieve a shared `HubConnection` observable for the given hub.
34
+ *
35
+ * The connection is lazily built using `HubConnectionBuilder` and shared
36
+ * with `shareReplay({ bufferSize: 1, refCount: true })` so that:
37
+ * - New subscribers immediately receive the current connection.
38
+ * - The connection is stopped when the last subscriber unsubscribes.
39
+ *
40
+ * @param hubId - Name of the hub as registered in the configurator
41
+ * @returns Observable that emits the active `HubConnection`
42
+ * @throws {Error} When no hub configuration exists for `hubId`
43
+ */
13
44
  _createHubConnection(hubId) {
14
45
  const LOG_LEVEL_CRITICAL = 5;
15
46
  if (hubId in this.#hubConnections) {
@@ -33,12 +64,13 @@ export class SignalRModuleProvider {
33
64
  })
34
65
  .catch((error) => {
35
66
  if (error instanceof AbortError) {
36
- // Omit AbortError
67
+ // AbortError is expected during teardown — safe to ignore
37
68
  }
38
69
  else {
39
70
  throw error;
40
71
  }
41
72
  });
73
+ // Stop the connection and clean up the cache entry on unsubscribe
42
74
  const teardown = () => {
43
75
  connection.stop();
44
76
  observer.complete();
@@ -1 +1 @@
1
- {"version":3,"file":"SignalRModuleProvider.js","sourceRoot":"","sources":["../../src/SignalRModuleProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAsB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAI/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAUpC,MAAM,OAAO,qBAAqB;IAChC,OAAO,CAAgB;IACvB,eAAe,GAA8C,EAAE,CAAC;IAEhE,YAAY,MAAqB;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAEM,OAAO,CAAI,KAAa,EAAE,UAAkB;QACjD,OAAO,IAAI,KAAK,CAAI,UAAU,EAAE,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpE,CAAC;IAES,oBAAoB,CAAC,KAAa;QAC1C,MAAM,kBAAkB,GAAG,CAAC,CAAC;QAE7B,IAAI,KAAK,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,KAAK,CAAC,6CAA6C,KAAK,GAAG,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,IAAI,UAAU,CAAgB,CAAC,QAAQ,EAAE,EAAE;YACvE,MAAM,OAAO,GAAG,IAAI,oBAAoB,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE;gBAC7D,GAAG,MAAM,CAAC,OAAO;aAClB,CAAC,CAAC;YAEH,MAAM,CAAC,kBAAkB,IAAI,OA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AAC,CAAC;YAC5B,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBACxB,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;oBAChC,0DAA0D;gBAC5D,CAAC;qBAAM,CAAC;oBACN,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC,CAAC,CAAC;YAEL,kEAAkE;YAClE,MAAM,QAAQ,GAAG,GAAG,EAAE;gBACpB,UAAU,CAAC,IAAI,EAAE,CAAC;gBAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAC,CAAC,IAAI,CACL,WAAW,CAAC;YACV,6DAA6D;YAC7D,UAAU,EAAE,CAAC;YACb,+CAA+C;YAC/C,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AAED,eAAe,qBAAqB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,3 +1,16 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * Fusion Framework module for real-time communication via
5
+ * [SignalR](https://learn.microsoft.com/aspnet/core/signalr/introduction).
6
+ *
7
+ * Provides an RxJS-based API for connecting to SignalR hubs, subscribing to
8
+ * server-side methods, and sending messages. Hub connections are reference-counted
9
+ * and automatically stopped when no subscribers remain.
10
+ *
11
+ * @see {@link enableSignalR} for the quickest way to register the module.
12
+ * @see {@link ISignalRProvider.connect} for subscribing to hub methods at runtime.
13
+ */
1
14
  export { SignalRConfigurator, SignalRModuleConfigBuilder, } from './SignalRModuleConfigurator';
2
15
  export { SignalRModuleProvider } from './SignalRModuleProvider';
3
16
  export { Topic } from './lib/Topic';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EAGnB,0BAA0B,GAE3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAoB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAmC,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEL,mBAAmB,EAGnB,0BAA0B,GAE3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAoB,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAmC,MAAM,iBAAiB,CAAC"}
@@ -1,8 +1,34 @@
1
1
  import { Observable } from 'rxjs';
2
+ /**
3
+ * RxJS Observable wrapper around a SignalR hub method.
4
+ *
5
+ * A `Topic` subscribes to a named method on a `HubConnection` and emits
6
+ * incoming messages as observable values. It also exposes {@link Topic.send}
7
+ * and {@link Topic.invoke} for sending messages back to the server.
8
+ *
9
+ * Created by {@link SignalRModuleProvider.connect} — consumers typically
10
+ * do not instantiate `Topic` directly.
11
+ *
12
+ * @template T - Type of messages received from the hub method
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const topic = provider.connect<ChatMessage>('chat', 'ReceiveMessage');
17
+ * topic.subscribe((msg) => console.log(msg.text));
18
+ *
19
+ * // Send a message to the server on the same method
20
+ * topic.send('Hello, world!');
21
+ * ```
22
+ */
2
23
  export class Topic extends Observable {
3
24
  topic;
4
25
  hubConnection;
26
+ /** The active hub connection, set once the connection observable emits. */
5
27
  connection;
28
+ /**
29
+ * @param topic - Server-side method name to listen on and send to
30
+ * @param hubConnection - Observable that emits the active `HubConnection`
31
+ */
6
32
  constructor(topic, hubConnection) {
7
33
  super((subscriber) => {
8
34
  const hubConnectionSubscription = hubConnection.subscribe((connection) => {
@@ -18,6 +44,12 @@ export class Topic extends Observable {
18
44
  this.topic = topic;
19
45
  this.hubConnection = hubConnection;
20
46
  }
47
+ /**
48
+ * Send a fire-and-forget message to the server on this topic.
49
+ *
50
+ * @param args - Arguments forwarded to `HubConnection.send()`
51
+ * @throws {Error} When the hub connection has not been established yet
52
+ */
21
53
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
54
  send(...args) {
23
55
  if (!this.connection) {
@@ -25,6 +57,14 @@ export class Topic extends Observable {
25
57
  }
26
58
  this.connection.send(this.topic, args);
27
59
  }
60
+ /**
61
+ * Invoke a server method on this topic and wait for a response.
62
+ *
63
+ * @template T - Expected return type from the server method
64
+ * @param args - Arguments forwarded to `HubConnection.invoke()`
65
+ * @returns Promise resolving with the server's response
66
+ * @throws {Error} When the hub connection has not been established yet
67
+ */
28
68
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
69
  invoke(...args) {
30
70
  if (!this.connection) {
@@ -1 +1 @@
1
- {"version":3,"file":"Topic.js","sourceRoot":"","sources":["../../../src/lib/Topic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,MAAM,OAAO,KAAS,SAAQ,UAAa;IAIhC;IACA;IAJT,UAAU,CAA4B;IAEtC,YACS,KAAa,EACb,aAAwC;QAE/C,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE;YACnB,MAAM,yBAAyB,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE;gBACvE,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC5C,UAAU,CAAC,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overy
3
+ * and MSAL authentication.
4
+ *
5
+ * Resolves the hub endpoint URL from the service registry and creates an
6
+ * `accessTokenFactory` that acquires tokens via the MSAL auth provider.
7
+ *
8
+ * @param args - Hub name, service identifier, and path to append to the resolved service URI
9
+ * @param builder - Module config builder with access to MSAL and service-discovery instances
10
+ *
11
+ * @internal
12
+ */
1
13
  export const configureFromFramework = async (args, builder) => {
2
14
  const authProvider = await builder.requireInstance('auth');
3
15
  const serviceDiscovery = await builder.requireInstance('serviceDiscovery');
@@ -1 +1 @@
1
- {"version":3,"file":"configure-from-framework.js","sourceRoot":"","sources":["../../../../src/lib/utils/configure-from-framework.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,IAAqD,EACrD,OAAyE,EACzE,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QACxB,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;QAC/C,OAAO,EAAE;YACP,kBAAkB,EAAE,KAAK,IAAI,EAAE;gBAC7B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;oBACpB,MAAM,KAAK,CACT,YAAY,OAAO,CAAC,IAAI,iFAAiF,CAC1G,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC;oBAClD,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE;iBAC7D,CAAC,CAAC;gBACH,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBAChD,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAC;AACL,CAAC,CAAC"}
1
+ {"version":3,"file":"configure-from-framework.js","sourceRoot":"","sources":["../../../../src/lib/utils/configure-from-framework.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,IAAqD,EACrD,OAAyE,EACzE,EAAE;IACF,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE;QACxB,GAAG,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;QAC/C,OAAO,EAAE;YACP,kBAAkB,EAAE,KAAK,IAAI,EAAE;gBAC7B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;oBACpB,MAAM,KAAK,CACT,YAAY,OAAO,CAAC,IAAI,iFAAiF,CAC1G,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC;oBAClD,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE;iBAC7D,CAAC,CAAC;gBACH,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,KAAK,CAAC,gCAAgC,CAAC,CAAC;gBAChD,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC;SACF;QACD,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,31 +1,36 @@
1
1
  import { module } from '../../SignalRModule';
2
2
  import { configureFromFramework } from './configure-from-framework';
3
3
  /**
4
+ * Register the SignalR module on a Fusion Framework configurator and add hub
5
+ * configuration in a single call.
6
+ *
7
+ * Accepts either a manual builder callback or a service-discovery shorthand.
8
+ * When the shorthand form is used, the hub URL and authentication token are
9
+ * resolved automatically via the service-discovery and MSAL modules.
10
+ *
11
+ * @param configurator - The module configurator to register the SignalR module on
12
+ * @param name - Hub name identifier (used as key in the hub registry)
13
+ * @param optionsOrCallback - A builder callback for custom configuration, or
14
+ * `{ service, path }` to resolve the hub endpoint through service-discovery
15
+ *
4
16
  * @example
5
- ```ts
6
- import {
7
- enableSignalR,
8
- configurePortalHub,
9
- configureNotificationHub
10
- } from '@equinor/fusion-framework-module-signalr';
11
-
12
- export const configure = (configurator) => {
13
- enableSignalR(configurator, {
14
- name: 'portal',
15
- service: 'portal',
16
- path: '/signalr/hubs/service-message'
17
- });
18
- enableSignalR(configurator, 'notifications');
19
- // custom
20
- enableSignalR(configurator, builder => {
21
- builder.addHub('myHub', {
22
- uri: 'https://foo.bar',
23
- path: '/my_messages'
24
- accessTokenFactory: () => makeToken(),
25
- })
26
- });
27
- }
28
- ```
17
+ * ```ts
18
+ * import { enableSignalR } from '@equinor/fusion-framework-module-signalr';
19
+ *
20
+ * // Using service-discovery shorthand
21
+ * enableSignalR(configurator, 'portal', {
22
+ * service: 'portal',
23
+ * path: '/signalr/hubs/service-message',
24
+ * });
25
+ *
26
+ * // Using a custom builder callback
27
+ * enableSignalR(configurator, 'custom', (builder) => {
28
+ * builder.addHub('custom', {
29
+ * url: 'https://my-service.example.com/hub',
30
+ * options: { accessTokenFactory: () => getToken() },
31
+ * });
32
+ * });
33
+ * ```
29
34
  */
30
35
  export function enableSignalR(
31
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1 +1 @@
1
- {"version":3,"file":"enable-signalr.js","sourceRoot":"","sources":["../../../../src/lib/utils/enable-signalr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAiBpE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,aAAa;AAC3B,8DAA8D;AAC9D,YAA4C,EAC5C,IAAY,EACZ,iBAAyF;IAEzF,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC5C,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YACxD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7C,sBAAsB,CAAC,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAChE,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"enable-signalr.js","sourceRoot":"","sources":["../../../../src/lib/utils/enable-signalr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAmCpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,aAAa;AAC3B,8DAA8D;AAC9D,YAA4C,EAC5C,IAAY,EACZ,iBAAyF;IAEzF,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE,CAAC;QAC5C,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YACxD,CAAC;SACF,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,SAAS,CAAC;YACrB,MAAM;YACN,SAAS,EAAE,CAAC,mBAAmB,EAAE,EAAE;gBACjC,mBAAmB,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7C,sBAAsB,CAAC,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAChE,CAAC;YACJ,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '10.0.2-next.0';
2
+ export const version = '11.0.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,eAAe,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}