@equinor/fusion-framework-react-module-signalr 4.0.2 → 4.0.3

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.
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * @packageDocumentation
11
11
  */
12
- export { useSignalRProvider as useProviderTopic } from './use-signalr-provider';
13
- export { useTopic } from './use-signalr';
12
+ export { useSignalRProvider as useProviderTopic } from './useSignalRProvider';
13
+ export { useTopic } from './useTopic';
14
14
  export { Topic, enableSignalR } from '@equinor/fusion-framework-module-signalr';
15
15
  export type { ISignalRConfigurator, SignalRHubConfig, SignalRModule, } from '@equinor/fusion-framework-module-signalr';
@@ -0,0 +1,11 @@
1
+ import type { ISignalRProvider, Topic } from '@equinor/fusion-framework-module-signalr';
2
+ /**
3
+ * Hook for connecting to a SignalR hub topic via the given provider.
4
+ *
5
+ * @template T - The type of data emitted by the topic
6
+ * @param provider - The SignalR provider used to establish the connection
7
+ * @param hubId - The id of the hub to connect to
8
+ * @param topicId - The id of the topic within the hub to subscribe to
9
+ * @returns The connected topic
10
+ */
11
+ export declare const useSignalRProvider: <T>(provider: ISignalRProvider, hubId: string, topicId: string) => Topic<T>;
@@ -0,0 +1,11 @@
1
+ import { useSignalRProvider } from './useSignalRProvider';
2
+ /**
3
+ * Hook for connecting to a SignalR hub topic, resolving the provider from the framework automatically.
4
+ *
5
+ * @template T - The type of data emitted by the topic
6
+ * @param hubId - The id of the hub to connect to
7
+ * @param topicId - The id of the topic within the hub to subscribe to
8
+ * @returns The connected topic
9
+ */
10
+ export declare const useTopic: <T>(hubId: string, topicId: string) => ReturnType<typeof useSignalRProvider<T>>;
11
+ export default useTopic;
@@ -1 +1 @@
1
- export declare const version = "4.0.2";
1
+ export declare const version = "4.0.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-react-module-signalr",
3
- "version": "4.0.2",
3
+ "version": "4.0.3",
4
4
  "description": "",
5
5
  "sideEffects": false,
6
6
  "main": "dist/esm/index.js",
@@ -23,18 +23,18 @@
23
23
  "directory": "packages/react/modules/signalr"
24
24
  },
25
25
  "dependencies": {
26
- "@equinor/fusion-framework-module-signalr": "^13.0.0"
26
+ "@equinor/fusion-framework-module-signalr": "^13.0.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/react": "^19.2.7",
30
30
  "react": "^19.2.1",
31
- "typescript": "^6.0.3",
32
- "@equinor/fusion-framework-react-module": "^4.0.1"
31
+ "typescript": "^7.0.2",
32
+ "@equinor/fusion-framework-react-module": "^4.0.2"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@types/react": "^18.0.0 || ^19.0.0",
36
36
  "react": "^18.0.0 || ^19.0.0",
37
- "@equinor/fusion-framework-react-module": "^4.0.1"
37
+ "@equinor/fusion-framework-react-module": "^4.0.2"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@types/react": {
package/src/index.ts CHANGED
@@ -9,8 +9,8 @@
9
9
  *
10
10
  * @packageDocumentation
11
11
  */
12
- export { useSignalRProvider as useProviderTopic } from './use-signalr-provider';
13
- export { useTopic } from './use-signalr';
12
+ export { useSignalRProvider as useProviderTopic } from './useSignalRProvider';
13
+ export { useTopic } from './useTopic';
14
14
 
15
15
  export { Topic, enableSignalR } from '@equinor/fusion-framework-module-signalr';
16
16
 
@@ -0,0 +1,20 @@
1
+ import { useMemo } from 'react';
2
+ import type { ISignalRProvider, Topic } from '@equinor/fusion-framework-module-signalr';
3
+
4
+ /**
5
+ * Hook for connecting to a SignalR hub topic via the given provider.
6
+ *
7
+ * @template T - The type of data emitted by the topic
8
+ * @param provider - The SignalR provider used to establish the connection
9
+ * @param hubId - The id of the hub to connect to
10
+ * @param topicId - The id of the topic within the hub to subscribe to
11
+ * @returns The connected topic
12
+ */
13
+ export const useSignalRProvider = <T>(
14
+ provider: ISignalRProvider,
15
+ hubId: string,
16
+ topicId: string,
17
+ ): Topic<T> => {
18
+ const topic = useMemo(() => provider.connect<T>(hubId, topicId), [provider, hubId, topicId]);
19
+ return topic;
20
+ };
@@ -0,0 +1,20 @@
1
+ import { useModule } from '@equinor/fusion-framework-react-module';
2
+ import { moduleKey } from '@equinor/fusion-framework-module-signalr';
3
+
4
+ import { useSignalRProvider } from './useSignalRProvider';
5
+
6
+ /**
7
+ * Hook for connecting to a SignalR hub topic, resolving the provider from the framework automatically.
8
+ *
9
+ * @template T - The type of data emitted by the topic
10
+ * @param hubId - The id of the hub to connect to
11
+ * @param topicId - The id of the topic within the hub to subscribe to
12
+ * @returns The connected topic
13
+ */
14
+ export const useTopic = <T>(
15
+ hubId: string,
16
+ topicId: string,
17
+ ): ReturnType<typeof useSignalRProvider<T>> =>
18
+ useSignalRProvider(useModule(moduleKey), hubId, topicId);
19
+
20
+ export default useTopic;
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '4.0.2';
2
+ export const version = '4.0.3';
@@ -1,6 +0,0 @@
1
- import { useMemo } from 'react';
2
- export const useSignalRProvider = (provider, hubId, topicId) => {
3
- const topic = useMemo(() => provider.connect(hubId, topicId), [provider, hubId, topicId]);
4
- return topic;
5
- };
6
- //# sourceMappingURL=use-signalr-provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-signalr-provider.js","sourceRoot":"","sources":["../../src/use-signalr-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,QAA0B,EAC1B,KAAa,EACb,OAAe,EACL,EAAE;IACZ,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAI,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7F,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { useModule } from '@equinor/fusion-framework-react-module';
2
- import { moduleKey } from '@equinor/fusion-framework-module-signalr';
3
- import { useSignalRProvider } from './use-signalr-provider';
4
- export const useTopic = (hubId, topicId) => useSignalRProvider(useModule(moduleKey), hubId, topicId);
5
- export default useTopic;
6
- //# sourceMappingURL=use-signalr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-signalr.js","sourceRoot":"","sources":["../../src/use-signalr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,KAAa,EACb,OAAe,EAC2B,EAAE,CAC5C,kBAAkB,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAE3D,eAAe,QAAQ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { ISignalRProvider, Topic } from '@equinor/fusion-framework-module-signalr';
2
- export declare const useSignalRProvider: <T>(provider: ISignalRProvider, hubId: string, topicId: string) => Topic<T>;
@@ -1,3 +0,0 @@
1
- import { useSignalRProvider } from './use-signalr-provider';
2
- export declare const useTopic: <T>(hubId: string, topicId: string) => ReturnType<typeof useSignalRProvider<T>>;
3
- export default useTopic;
@@ -1,11 +0,0 @@
1
- import { useMemo } from 'react';
2
- import type { ISignalRProvider, Topic } from '@equinor/fusion-framework-module-signalr';
3
-
4
- export const useSignalRProvider = <T>(
5
- provider: ISignalRProvider,
6
- hubId: string,
7
- topicId: string,
8
- ): Topic<T> => {
9
- const topic = useMemo(() => provider.connect<T>(hubId, topicId), [provider, hubId, topicId]);
10
- return topic;
11
- };
@@ -1,12 +0,0 @@
1
- import { useModule } from '@equinor/fusion-framework-react-module';
2
- import { moduleKey } from '@equinor/fusion-framework-module-signalr';
3
-
4
- import { useSignalRProvider } from './use-signalr-provider';
5
-
6
- export const useTopic = <T>(
7
- hubId: string,
8
- topicId: string,
9
- ): ReturnType<typeof useSignalRProvider<T>> =>
10
- useSignalRProvider(useModule(moduleKey), hubId, topicId);
11
-
12
- export default useTopic;