@dxos/react-client 2.19.4-dev.ef99dda8 → 2.19.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "2.19.4-dev.ef99dda8",
3
+ "version": "2.19.4",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -8,23 +8,24 @@
8
8
  "main": "dist/src/index.js",
9
9
  "types": "dist/src/index.d.ts",
10
10
  "dependencies": {
11
- "@dxos/async": "2.19.4-dev.ef99dda8",
12
- "@dxos/client": "2.19.4-dev.ef99dda8",
13
- "@dxos/config": "2.19.4-dev.ef99dda8",
14
- "@dxos/credentials": "2.19.4-dev.ef99dda8",
15
- "@dxos/crypto": "2.19.4-dev.ef99dda8",
16
- "@dxos/debug": "2.19.4-dev.ef99dda8",
17
- "@dxos/echo-db": "2.19.4-dev.ef99dda8",
18
- "@dxos/util": "2.19.4-dev.ef99dda8",
11
+ "@dxos/async": "2.19.4",
12
+ "@dxos/bot-factory-client": "2.19.4",
13
+ "@dxos/client": "2.19.4",
14
+ "@dxos/config": "2.19.4",
15
+ "@dxos/credentials": "2.19.4",
16
+ "@dxos/crypto": "2.19.4",
17
+ "@dxos/debug": "2.19.4",
18
+ "@dxos/echo-db": "2.19.4",
19
+ "@dxos/util": "2.19.4",
19
20
  "assert": "^2.0.0",
20
21
  "debug": "^4.3.3",
21
22
  "react-display-name": "^0.2.5",
22
23
  "use-subscription": "^1.4.1"
23
24
  },
24
25
  "devDependencies": {
25
- "@dxos/esbuild-plugins": "2.19.4-dev.ef99dda8",
26
+ "@dxos/esbuild-plugins": "2.19.4",
26
27
  "@dxos/esbuild-server": "~1.7.1",
27
- "@dxos/toolchain-node-library": "2.19.3",
28
+ "@dxos/toolchain-node-library": "2.19.4",
28
29
  "@mui/material": "^5.0.1",
29
30
  "@testing-library/react": "^11.0.4",
30
31
  "@testing-library/react-hooks": "5.1.2",
@@ -2,10 +2,10 @@ Invoking: toolchain build:test
2
2
 
3
3
 
4
4
  typescript
5
- OK in 8960 ms
5
+ OK in 4283 ms
6
6
 
7
7
  eslint
8
- OK in 9948 ms
8
+ OK in 8700 ms
9
9
 
10
10
  mocha
11
11
  This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
@@ -13,7 +13,7 @@ This browser doesn't support cancelAnimationFrame. Make sure that you load a pol
13
13
 
14
14
 
15
15
  ClientProvider
16
- ✓ Renders with children (40ms)
16
+ ✓ Renders with children
17
17
  ✓ Provides the client
18
18
 
19
19
  Client hook
@@ -26,8 +26,8 @@ This browser doesn't support cancelAnimationFrame. Make sure that you load a pol
26
26
  ✓ should return custom client config when used properly in a context
27
27
 
28
28
 
29
- 7 passing (369ms)
29
+ 7 passing (379ms)
30
30
 
31
- OK in 3090 ms
31
+ OK in 3156 ms
32
32
 
33
- CHECK COMPLETE in 22007 ms
33
+ CHECK COMPLETE in 16150 ms
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2021 DXOS.org
3
+ //
4
+
5
+ export * from './useBotFactoryClient';
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2021 DXOS.org
3
+ //
4
+
5
+ import { useEffect, useState } from 'react';
6
+
7
+ import { BotFactoryClient } from '@dxos/bot-factory-client';
8
+ import { PublicKey } from '@dxos/crypto';
9
+ import { raise } from '@dxos/debug';
10
+
11
+ import { useClient, useConfig } from '../client';
12
+
13
+ export const useBotFactoryClient = (): BotFactoryClient | undefined => {
14
+ const [botFactoryClient, setBotFactoryClient] = useState<BotFactoryClient>();
15
+
16
+ const client = useClient();
17
+ const config = useConfig();
18
+
19
+ useEffect(() => {
20
+ const botFactoryClient = new BotFactoryClient(client.echo.networkManager);
21
+ const topic = config.get('services.bot.topic') ??
22
+ raise(new Error('Bot factory topic is not provided'));
23
+ setImmediate(async () => {
24
+ await botFactoryClient.start(PublicKey.from(topic));
25
+ setBotFactoryClient(botFactoryClient);
26
+ });
27
+ return () => {
28
+ void botFactoryClient.stop();
29
+ };
30
+ }, []);
31
+
32
+ return botFactoryClient;
33
+ };
@@ -8,3 +8,4 @@ export * from './echo-selections';
8
8
  export * from './invitations';
9
9
  export * from './wns';
10
10
  export * from './util';
11
+ export * from './bot-factory';