@dxos/react-client 2.19.4-dev.ef99dda8 → 2.19.5-dev.9d8264c6
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 +12 -11
- package/react-client.build.log +0 -33
- 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.
|
|
3
|
+
"version": "2.19.5-dev.9d8264c6",
|
|
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.
|
|
12
|
-
"@dxos/client": "2.19.
|
|
13
|
-
"@dxos/
|
|
14
|
-
"@dxos/
|
|
15
|
-
"@dxos/
|
|
16
|
-
"@dxos/
|
|
17
|
-
"@dxos/
|
|
18
|
-
"@dxos/
|
|
11
|
+
"@dxos/async": "2.19.5-dev.9d8264c6",
|
|
12
|
+
"@dxos/bot-factory-client": "2.19.5-dev.9d8264c6",
|
|
13
|
+
"@dxos/client": "2.19.5-dev.9d8264c6",
|
|
14
|
+
"@dxos/config": "2.19.5-dev.9d8264c6",
|
|
15
|
+
"@dxos/credentials": "2.19.5-dev.9d8264c6",
|
|
16
|
+
"@dxos/crypto": "2.19.5-dev.9d8264c6",
|
|
17
|
+
"@dxos/debug": "2.19.5-dev.9d8264c6",
|
|
18
|
+
"@dxos/echo-db": "2.19.5-dev.9d8264c6",
|
|
19
|
+
"@dxos/util": "2.19.5-dev.9d8264c6",
|
|
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.
|
|
26
|
+
"@dxos/esbuild-plugins": "2.19.5-dev.9d8264c6",
|
|
26
27
|
"@dxos/esbuild-server": "~1.7.1",
|
|
27
|
-
"@dxos/toolchain-node-library": "2.19.
|
|
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",
|
package/react-client.build.log
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
Invoking: toolchain build:test
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
typescript
|
|
5
|
-
OK in 8960 ms
|
|
6
|
-
|
|
7
|
-
eslint
|
|
8
|
-
OK in 9948 ms
|
|
9
|
-
|
|
10
|
-
mocha
|
|
11
|
-
This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
|
|
12
|
-
This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ClientProvider
|
|
16
|
-
✓ Renders with children (40ms)
|
|
17
|
-
✓ Provides the client
|
|
18
|
-
|
|
19
|
-
Client hook
|
|
20
|
-
✓ should throw when used outside a context
|
|
21
|
-
✓ should return client when used properly in a context
|
|
22
|
-
|
|
23
|
-
Config hook
|
|
24
|
-
✓ should throw when used outside a context
|
|
25
|
-
✓ should return default client config when no config is passed in a context
|
|
26
|
-
✓ should return custom client config when used properly in a context
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
7 passing (369ms)
|
|
30
|
-
|
|
31
|
-
OK in 3090 ms
|
|
32
|
-
|
|
33
|
-
CHECK COMPLETE in 22007 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