@dxos/react-client 2.26.2-dev.96e7d25d → 2.27.1-dev.8a89aadf

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.26.2-dev.96e7d25d",
3
+ "version": "2.27.1-dev.8a89aadf",
4
4
  "description": "React client API",
5
5
  "keywords": [],
6
6
  "license": "AGPL-3.0",
@@ -8,24 +8,23 @@
8
8
  "main": "dist/src/index.js",
9
9
  "types": "dist/src/index.d.ts",
10
10
  "dependencies": {
11
- "@dxos/async": "2.26.2-dev.96e7d25d",
12
- "@dxos/bot-factory-client": "2.26.2-dev.96e7d25d",
13
- "@dxos/client": "2.26.2-dev.96e7d25d",
14
- "@dxos/config": "2.26.2-dev.96e7d25d",
15
- "@dxos/credentials": "2.26.2-dev.96e7d25d",
16
- "@dxos/crypto": "2.26.2-dev.96e7d25d",
17
- "@dxos/debug": "2.26.2-dev.96e7d25d",
18
- "@dxos/echo-db": "2.26.2-dev.96e7d25d",
19
- "@dxos/util": "2.26.2-dev.96e7d25d",
11
+ "@dxos/async": "2.27.1-dev.8a89aadf",
12
+ "@dxos/bot-factory-client": "2.27.1-dev.8a89aadf",
13
+ "@dxos/client": "2.27.1-dev.8a89aadf",
14
+ "@dxos/config": "2.27.1-dev.8a89aadf",
15
+ "@dxos/credentials": "2.27.1-dev.8a89aadf",
16
+ "@dxos/crypto": "2.27.1-dev.8a89aadf",
17
+ "@dxos/debug": "2.27.1-dev.8a89aadf",
18
+ "@dxos/echo-db": "2.27.1-dev.8a89aadf",
19
+ "@dxos/util": "2.27.1-dev.8a89aadf",
20
20
  "assert": "^2.0.0",
21
21
  "debug": "^4.3.3",
22
22
  "react-display-name": "^0.2.5",
23
23
  "use-subscription": "^1.4.1"
24
24
  },
25
25
  "devDependencies": {
26
- "@dxos/esbuild-plugins": "2.26.2-dev.96e7d25d",
27
- "@dxos/esbuild-server": "~1.7.4",
28
- "@dxos/toolchain-node-library": "2.26.1",
26
+ "@dxos/esbuild-plugins": "2.27.1-dev.8a89aadf",
27
+ "@dxos/toolchain-node-library": "2.27.0",
29
28
  "@mui/material": "^5.0.1",
30
29
  "@testing-library/react": "^11.0.4",
31
30
  "@testing-library/react-hooks": "5.1.2",
@@ -58,8 +57,9 @@
58
57
  "forceCloseTests": true
59
58
  },
60
59
  "scripts": {
61
- "book": "esbuild-server book",
60
+ "book": "toolchain book",
62
61
  "build": "toolchain build",
62
+ "build:book": "toolchain build:book",
63
63
  "build:test": "toolchain build:test",
64
64
  "lint": "toolchain lint",
65
65
  "test": "toolchain test"
@@ -6,7 +6,7 @@ import debug from 'debug';
6
6
  import React, { MutableRefObject, ReactNode, useEffect, useState } from 'react';
7
7
 
8
8
  import { Client, ClientOptions } from '@dxos/client';
9
- import { Config, ConfigObject, ConfigV1Object } from '@dxos/config';
9
+ import { Config, ConfigObject } from '@dxos/config';
10
10
  import { MaybeFunction, MaybePromise, getAsyncValue } from '@dxos/util';
11
11
 
12
12
  import { printBanner } from '../banner';
@@ -17,7 +17,7 @@ const log = debug('dxos:react-client');
17
17
  export type ClientProvider = MaybeFunction<MaybePromise<Client>>
18
18
 
19
19
  // TODO(burdon): Why defs?
20
- export type ConfigProvider = MaybeFunction<MaybePromise<Config | ConfigObject | ConfigV1Object>>
20
+ export type ConfigProvider = MaybeFunction<MaybePromise<Config | ConfigObject>>
21
21
 
22
22
  export interface ClientProviderProps {
23
23
  children?: ReactNode
@@ -7,7 +7,7 @@ import expect from 'expect';
7
7
  import React from 'react';
8
8
 
9
9
  import { Client } from '@dxos/client';
10
- import { ConfigV1Object } from '@dxos/config';
10
+ import { ConfigObject } from '@dxos/config';
11
11
 
12
12
  import { ClientProvider } from '../../containers';
13
13
  import { useClient } from './useClient';
@@ -21,7 +21,7 @@ describe('Client hook', () => {
21
21
  });
22
22
 
23
23
  it('should return client when used properly in a context', () => {
24
- const config: ConfigV1Object = {
24
+ const config: ConfigObject = {
25
25
  version: 1,
26
26
  runtime: {
27
27
  client: {
@@ -7,7 +7,7 @@ import expect from 'expect';
7
7
  import React from 'react';
8
8
 
9
9
  import { Client } from '@dxos/client';
10
- import { ConfigV1Object } from '@dxos/config';
10
+ import { ConfigObject } from '@dxos/config';
11
11
 
12
12
  import { ClientProvider } from '../../containers';
13
13
  import { useConfig } from './useConfig';
@@ -29,7 +29,7 @@ describe('Config hook', () => {
29
29
  });
30
30
 
31
31
  it('should return custom client config when used properly in a context', () => {
32
- const config: ConfigV1Object = {
32
+ const config: ConfigObject = {
33
33
  version: 1,
34
34
  runtime: {
35
35
  client: {
@@ -3,3 +3,4 @@
3
3
  //
4
4
 
5
5
  export * from './ProfileInitializer';
6
+ export * from './useTestPartyBootstrap';
@@ -0,0 +1,40 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { useEffect, useState } from 'react';
6
+
7
+ import { Client, Party } from '@dxos/client';
8
+
9
+ /**
10
+ * Hook which returns a set of peers joined in a shared party.
11
+ *
12
+ * Useful for setting up examples or tests which display multiple peers in a single view.
13
+ */
14
+ export const useTestPartyBootstrap = (peerCount = 2) => {
15
+ const [peers, setPeers] = useState<{ client: Client, party: Party }[]>([]);
16
+
17
+ useEffect(() => {
18
+ setImmediate(async () => {
19
+ const peers = [];
20
+ const inviter = new Client();
21
+ await inviter.initialize();
22
+ await inviter.halo.createProfile({ username: 'peer-0' });
23
+ const inviterParty = await inviter.echo.createParty();
24
+ peers.push({ client: inviter, party: inviterParty });
25
+
26
+ for (let i = 1; i < peerCount; i++) {
27
+ const joiner = new Client();
28
+ await joiner.initialize();
29
+ await joiner.halo.createProfile({ username: `peer-${i}` });
30
+ const invitation = await inviterParty.createInvitation();
31
+ const joinerParty = await joiner.echo.acceptInvitation(invitation.descriptor).getParty();
32
+ peers.push({ client: joiner, party: joinerParty });
33
+ }
34
+
35
+ setPeers(peers);
36
+ });
37
+ }, []);
38
+
39
+ return peers;
40
+ };