@dxos/react-client 2.19.4-dev.54bbea97 → 2.19.4-dev.58858ba5
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/.rush/temp/package-deps_build.json +5 -3
- package/.rush/temp/package-deps_build:test.json +5 -3
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/dist/src/hooks/bot-factory/index.d.ts +2 -0
- package/dist/src/hooks/bot-factory/index.d.ts.map +1 -0
- package/dist/src/hooks/bot-factory/index.js +17 -0
- package/dist/src/hooks/bot-factory/index.js.map +1 -0
- package/dist/src/hooks/bot-factory/useBotFactoryClient.d.ts +3 -0
- package/dist/src/hooks/bot-factory/useBotFactoryClient.d.ts.map +1 -0
- package/dist/src/hooks/bot-factory/useBotFactoryClient.js +31 -0
- package/dist/src/hooks/bot-factory/useBotFactoryClient.js.map +1 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +1 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -10
- package/react-client.build.log +6 -6
- package/src/hooks/bot-factory/index.ts +5 -0
- package/src/hooks/bot-factory/useBotFactoryClient.ts +33 -0
- package/src/hooks/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-client",
|
|
3
|
-
"version": "2.19.4-dev.
|
|
3
|
+
"version": "2.19.4-dev.58858ba5",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "AGPL-3.0",
|
|
@@ -8,21 +8,22 @@
|
|
|
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.
|
|
12
|
-
"@dxos/client": "2.19.4-dev.
|
|
13
|
-
"@dxos/
|
|
14
|
-
"@dxos/
|
|
15
|
-
"@dxos/
|
|
16
|
-
"@dxos/
|
|
17
|
-
"@dxos/
|
|
18
|
-
"@dxos/
|
|
11
|
+
"@dxos/async": "2.19.4-dev.58858ba5",
|
|
12
|
+
"@dxos/bot-factory-client": "2.19.4-dev.58858ba5",
|
|
13
|
+
"@dxos/client": "2.19.4-dev.58858ba5",
|
|
14
|
+
"@dxos/config": "2.19.4-dev.58858ba5",
|
|
15
|
+
"@dxos/credentials": "2.19.4-dev.58858ba5",
|
|
16
|
+
"@dxos/crypto": "2.19.4-dev.58858ba5",
|
|
17
|
+
"@dxos/debug": "2.19.4-dev.58858ba5",
|
|
18
|
+
"@dxos/echo-db": "2.19.4-dev.58858ba5",
|
|
19
|
+
"@dxos/util": "2.19.4-dev.58858ba5",
|
|
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.
|
|
26
|
+
"@dxos/esbuild-plugins": "2.19.4-dev.58858ba5",
|
|
26
27
|
"@dxos/esbuild-server": "~1.7.1",
|
|
27
28
|
"@dxos/toolchain-node-library": "2.19.3",
|
|
28
29
|
"@mui/material": "^5.0.1",
|
package/react-client.build.log
CHANGED
|
@@ -2,10 +2,10 @@ Invoking: toolchain build:test
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
typescript
|
|
5
|
-
OK in
|
|
5
|
+
OK in 5043 ms
|
|
6
6
|
|
|
7
7
|
eslint
|
|
8
|
-
OK in
|
|
8
|
+
OK in 9837 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 (
|
|
16
|
+
✓ Renders with children (39ms)
|
|
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 (
|
|
29
|
+
7 passing (441ms)
|
|
30
30
|
|
|
31
|
-
OK in
|
|
31
|
+
OK in 3542 ms
|
|
32
32
|
|
|
33
|
-
CHECK COMPLETE in
|
|
33
|
+
CHECK COMPLETE in 18431 ms
|
|
@@ -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
|
+
};
|
package/src/hooks/index.ts
CHANGED