@dxos/react-client 0.6.10 → 0.6.11-staging.32b42e4

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.
Files changed (103) hide show
  1. package/dist/lib/browser/{chunk-NLQLAARM.mjs → chunk-BLQHBTRS.mjs} +67 -39
  2. package/dist/lib/browser/chunk-BLQHBTRS.mjs.map +7 -0
  3. package/dist/lib/browser/devtools/index.mjs +6 -18
  4. package/dist/lib/browser/devtools/index.mjs.map +3 -3
  5. package/dist/lib/browser/echo/index.mjs +4 -4
  6. package/dist/lib/browser/echo/index.mjs.map +1 -1
  7. package/dist/lib/browser/halo/index.mjs +5 -5
  8. package/dist/lib/browser/halo/index.mjs.map +1 -1
  9. package/dist/lib/browser/index.mjs +4 -2
  10. package/dist/lib/browser/index.mjs.map +2 -2
  11. package/dist/lib/browser/mesh/index.mjs +2 -2
  12. package/dist/lib/browser/mesh/index.mjs.map +1 -1
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/testing/index.mjs +108 -12
  15. package/dist/lib/browser/testing/index.mjs.map +4 -4
  16. package/dist/lib/node/{chunk-E3S6YHNJ.cjs → chunk-D7WQQFA3.cjs} +62 -39
  17. package/dist/lib/node/chunk-D7WQQFA3.cjs.map +7 -0
  18. package/dist/lib/node/devtools/index.cjs +8 -20
  19. package/dist/lib/node/devtools/index.cjs.map +3 -3
  20. package/dist/lib/node/echo/index.cjs +10 -10
  21. package/dist/lib/node/echo/index.cjs.map +2 -2
  22. package/dist/lib/node/halo/index.cjs +13 -13
  23. package/dist/lib/node/halo/index.cjs.map +2 -2
  24. package/dist/lib/node/index.cjs +16 -14
  25. package/dist/lib/node/index.cjs.map +2 -2
  26. package/dist/lib/node/mesh/index.cjs +4 -4
  27. package/dist/lib/node/mesh/index.cjs.map +1 -1
  28. package/dist/lib/node/meta.json +1 -1
  29. package/dist/lib/node/testing/index.cjs +106 -10
  30. package/dist/lib/node/testing/index.cjs.map +4 -4
  31. package/dist/types/src/client/AgentHostingProvider.d.ts +6 -0
  32. package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -1
  33. package/dist/types/src/client/{ClientContext.d.ts → ClientProvider.d.ts} +15 -20
  34. package/dist/types/src/client/ClientProvider.d.ts.map +1 -0
  35. package/dist/types/src/client/ClientProvider.test.d.ts +2 -0
  36. package/dist/types/src/client/ClientProvider.test.d.ts.map +1 -0
  37. package/dist/types/src/client/context.d.ts +9 -0
  38. package/dist/types/src/client/context.d.ts.map +1 -0
  39. package/dist/types/src/client/index.d.ts +4 -1
  40. package/dist/types/src/client/index.d.ts.map +1 -1
  41. package/dist/types/src/client/useClient.d.ts +6 -0
  42. package/dist/types/src/client/useClient.d.ts.map +1 -0
  43. package/dist/types/src/client/useClientServices.d.ts +1 -1
  44. package/dist/types/src/client/useClientServices.d.ts.map +1 -1
  45. package/dist/types/src/client/useClientStatus.d.ts +3 -0
  46. package/dist/types/src/client/useClientStatus.d.ts.map +1 -0
  47. package/dist/types/src/devtools/useDevtools.d.ts.map +1 -1
  48. package/dist/types/src/index.d.ts +1 -1
  49. package/dist/types/src/testing/ClientRepeater.d.ts +6 -5
  50. package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
  51. package/dist/types/src/testing/{decorators.stories.d.ts → ClientRepeater.stories.d.ts} +3 -3
  52. package/dist/types/src/testing/ClientRepeater.stories.d.ts.map +1 -0
  53. package/dist/types/src/testing/index.d.ts +1 -0
  54. package/dist/types/src/testing/index.d.ts.map +1 -1
  55. package/dist/types/src/testing/util.d.ts +12 -0
  56. package/dist/types/src/testing/util.d.ts.map +1 -0
  57. package/dist/types/src/testing/withClientProvider.d.ts +26 -0
  58. package/dist/types/src/testing/withClientProvider.d.ts.map +1 -0
  59. package/dist/types/src/testing/withClientProvider.stories.d.ts +13 -0
  60. package/dist/types/src/testing/withClientProvider.stories.d.ts.map +1 -0
  61. package/package.json +23 -20
  62. package/src/client/AgentHostingProvider.tsx +7 -6
  63. package/src/client/{ClientContext.test.tsx → ClientProvider.test.tsx} +2 -1
  64. package/src/client/ClientProvider.tsx +156 -0
  65. package/src/client/context.ts +20 -0
  66. package/src/client/index.ts +7 -1
  67. package/src/client/useClient.ts +18 -0
  68. package/src/client/useClientServices.ts +2 -2
  69. package/src/client/useClientStatus.ts +21 -0
  70. package/src/client/useConfig.test.tsx +1 -1
  71. package/src/client/useConfig.ts +1 -1
  72. package/src/client/useShell.ts +1 -1
  73. package/src/client/useStatus.ts +1 -1
  74. package/src/devtools/useDevtools.ts +3 -7
  75. package/src/echo/useMembers.ts +1 -1
  76. package/src/echo/useSpaceInvitations.ts +1 -1
  77. package/src/echo/useSpaces.test.tsx +10 -34
  78. package/src/echo/useSpaces.ts +1 -1
  79. package/src/halo/useContacts.ts +1 -1
  80. package/src/halo/useDevices.test.tsx +3 -10
  81. package/src/halo/useDevices.ts +1 -1
  82. package/src/halo/useHaloInvitations.ts +1 -1
  83. package/src/halo/useIdentity.ts +1 -1
  84. package/src/index.ts +1 -1
  85. package/src/mesh/useNetworkStatus.ts +1 -1
  86. package/src/testing/ClientRepeater.stories.tsx +58 -0
  87. package/src/testing/ClientRepeater.tsx +14 -13
  88. package/src/testing/index.ts +1 -0
  89. package/src/testing/util.tsx +34 -0
  90. package/src/testing/withClientProvider.stories.tsx +56 -0
  91. package/src/testing/withClientProvider.tsx +142 -0
  92. package/tsconfig.json +9 -3
  93. package/dist/lib/browser/chunk-NLQLAARM.mjs.map +0 -7
  94. package/dist/lib/node/chunk-E3S6YHNJ.cjs.map +0 -7
  95. package/dist/types/src/client/ClientContext.d.ts.map +0 -1
  96. package/dist/types/src/client/ClientContext.stories.d.ts +0 -15
  97. package/dist/types/src/client/ClientContext.stories.d.ts.map +0 -1
  98. package/dist/types/src/client/ClientContext.test.d.ts +0 -2
  99. package/dist/types/src/client/ClientContext.test.d.ts.map +0 -1
  100. package/dist/types/src/testing/decorators.stories.d.ts.map +0 -1
  101. package/src/client/ClientContext.stories.tsx +0 -94
  102. package/src/client/ClientContext.tsx +0 -182
  103. package/src/testing/decorators.stories.tsx +0 -63
@@ -4,37 +4,23 @@
4
4
 
5
5
  import { act, renderHook } from '@testing-library/react';
6
6
  import { expect } from 'chai';
7
- import React from 'react';
8
7
 
9
- import { Client, fromHost } from '@dxos/client';
10
8
  import { describe, test } from '@dxos/test';
11
9
 
12
10
  import { useSpace, useSpaces } from './useSpaces';
13
- import { ClientContext } from '../client';
11
+ import { createClient, createContextProvider } from '../testing/util';
14
12
 
15
13
  describe('useSpaces', () => {
16
14
  test('lists existing spaces', async () => {
17
- const client = new Client({ services: fromHost() });
18
- await client.initialize();
19
- await client.halo.createIdentity();
20
- await client.spaces.isReady.wait();
21
- // TODO(wittjosiah): Factor out.
22
- const wrapper = ({ children }: any) => (
23
- <ClientContext.Provider value={{ client }}>{children}</ClientContext.Provider>
24
- );
15
+ const { client } = await createClient({ createIdentity: true });
16
+ const wrapper = await createContextProvider(client);
25
17
  const { result } = renderHook(() => useSpaces(), { wrapper });
26
18
  expect(result.current.length).to.eq(1);
27
19
  });
28
20
 
29
21
  test('updates when new spaces are created', async () => {
30
- const client = new Client({ services: fromHost() });
31
- await client.initialize();
32
- await client.halo.createIdentity();
33
- await client.spaces.isReady.wait();
34
- // TODO(wittjosiah): Factor out.
35
- const wrapper = ({ children }: any) => (
36
- <ClientContext.Provider value={{ client }}>{children}</ClientContext.Provider>
37
- );
22
+ const { client } = await createClient({ createIdentity: true });
23
+ const wrapper = await createContextProvider(client);
38
24
  const { result, rerender } = renderHook(() => useSpaces(), { wrapper });
39
25
  expect(result.current.length).to.eq(1);
40
26
  await act(async () => {
@@ -47,12 +33,8 @@ describe('useSpaces', () => {
47
33
 
48
34
  describe('useSpace', () => {
49
35
  test('gets default space', async () => {
50
- const client = new Client({ services: fromHost() });
51
- await client.initialize();
52
- // TODO(wittjosiah): Factor out.
53
- const wrapper = ({ children }: any) => (
54
- <ClientContext.Provider value={{ client }}>{children}</ClientContext.Provider>
55
- );
36
+ const { client } = await createClient();
37
+ const wrapper = await createContextProvider(client);
56
38
  const { result, rerender } = renderHook(() => useSpace(), { wrapper });
57
39
  expect(result.current).to.be.undefined;
58
40
  await act(async () => {
@@ -64,15 +46,9 @@ describe('useSpace', () => {
64
46
  });
65
47
 
66
48
  test('gets space by key', async () => {
67
- const client = new Client({ services: fromHost() });
68
- await client.initialize();
69
- await client.halo.createIdentity();
70
- const space = await client.spaces.create();
71
- // TODO(wittjosiah): Factor out.
72
- const wrapper = ({ children }: any) => (
73
- <ClientContext.Provider value={{ client }}>{children}</ClientContext.Provider>
74
- );
75
- const { result } = renderHook(() => useSpace(space.key), { wrapper });
49
+ const { client, space } = await createClient({ createIdentity: true, createSpace: true });
50
+ const wrapper = await createContextProvider(client);
51
+ const { result } = renderHook(() => useSpace(space!.key), { wrapper });
76
52
  expect(result.current).to.not.be.undefined;
77
53
  });
78
54
  });
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
6
6
 
7
7
  import { type PublicKeyLike } from '@dxos/client';
8
8
  import { type Space, SpaceState } from '@dxos/client/echo';
9
- import { useMulticastObservable } from '@dxos/react-async';
9
+ import { useMulticastObservable } from '@dxos/react-hooks';
10
10
 
11
11
  import { useClient } from '../client';
12
12
 
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import type { Contact } from '@dxos/client/halo';
6
- import { useMulticastObservable } from '@dxos/react-async';
6
+ import { useMulticastObservable } from '@dxos/react-hooks';
7
7
 
8
8
  import { useClient } from '../client';
9
9
 
@@ -4,23 +4,16 @@
4
4
 
5
5
  import { renderHook } from '@testing-library/react';
6
6
  import { expect } from 'chai';
7
- import React from 'react';
8
7
 
9
- import { Client, fromHost } from '@dxos/client';
10
8
  import { describe, test } from '@dxos/test';
11
9
 
12
10
  import { useDevices } from './useDevices';
13
- import { ClientContext } from '../client';
11
+ import { createClient, createContextProvider } from '../testing/util';
14
12
 
15
13
  describe('useDevices', () => {
16
14
  test('lists existing devices', async () => {
17
- const client = new Client({ services: fromHost() });
18
- await client.initialize();
19
- await client.halo.createIdentity();
20
- // TODO(wittjosiah): Factor out.
21
- const wrapper = ({ children }: any) => (
22
- <ClientContext.Provider value={{ client }}>{children}</ClientContext.Provider>
23
- );
15
+ const { client } = await createClient({ createIdentity: true });
16
+ const wrapper = await createContextProvider(client);
24
17
  const { result } = renderHook(() => useDevices(), { wrapper });
25
18
  expect(result.current?.length).to.eq(1);
26
19
  });
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import type { Device } from '@dxos/client/halo';
6
- import { useMulticastObservable } from '@dxos/react-async';
6
+ import { useMulticastObservable } from '@dxos/react-hooks';
7
7
 
8
8
  import { useClient } from '../client';
9
9
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { useMemo } from 'react';
6
6
 
7
- import { useMulticastObservable } from '@dxos/react-async';
7
+ import { useMulticastObservable } from '@dxos/react-hooks';
8
8
 
9
9
  import { useClient } from '../client';
10
10
  import { useInvitationStatus, type CancellableInvitationObservable } from '../invitations';
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type Identity } from '@dxos/client/halo';
6
- import { useMulticastObservable } from '@dxos/react-async';
6
+ import { useMulticastObservable } from '@dxos/react-hooks';
7
7
 
8
8
  import { useClient } from '../client';
9
9
 
package/src/index.ts CHANGED
@@ -3,6 +3,6 @@
3
3
  //
4
4
 
5
5
  export * from '@dxos/client';
6
- export { useMulticastObservable } from '@dxos/react-async';
6
+ export { useMulticastObservable } from '@dxos/react-hooks';
7
7
 
8
8
  export * from './client';
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { type NetworkStatus } from '@dxos/client/mesh';
6
- import { useMulticastObservable } from '@dxos/react-async';
6
+ import { useMulticastObservable } from '@dxos/react-hooks';
7
7
 
8
8
  import { useClient } from '../client';
9
9
 
@@ -0,0 +1,58 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import React from 'react';
8
+
9
+ import { Input } from '@dxos/react-ui';
10
+ import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
11
+ import { withTheme } from '@dxos/storybook-utils';
12
+
13
+ import { ClientRepeater, type ClientRepeatedComponentProps } from './ClientRepeater';
14
+ import { useClient } from '../client';
15
+ import { useSpace } from '../echo';
16
+
17
+ export default {
18
+ title: 'react-client/ClientRepeater',
19
+ decorators: [withTheme],
20
+ };
21
+
22
+ const JsonPanel = ({ value }: { value: any }) => (
23
+ <SyntaxHighlighter language='json'>{JSON.stringify(value, undefined, 2)}</SyntaxHighlighter>
24
+ );
25
+
26
+ const ClientStory = () => {
27
+ const client = useClient();
28
+ return <JsonPanel value={client.toJSON()} />;
29
+ };
30
+
31
+ const ClientSpace = ({ spaceKey }: ClientRepeatedComponentProps) => {
32
+ const client = useClient();
33
+ const space = useSpace(spaceKey);
34
+ if (!space?.isOpen) {
35
+ return null;
36
+ }
37
+
38
+ return (
39
+ <div className='flex flex-col'>
40
+ <Input.Root>
41
+ <Input.TextInput
42
+ placeholder='Name'
43
+ value={space.properties.name}
44
+ onChange={(event) => (space.properties.name = event.target.value)}
45
+ />
46
+ </Input.Root>
47
+ <JsonPanel value={client.toJSON()} />
48
+ </div>
49
+ );
50
+ };
51
+
52
+ export const Default = {
53
+ render: () => <ClientRepeater component={ClientStory} count={2} />,
54
+ };
55
+
56
+ export const Space = {
57
+ render: () => <ClientRepeater component={ClientSpace} count={2} createSpace />,
58
+ };
@@ -2,7 +2,7 @@
2
2
  // Copyright 2022 DXOS.org
3
3
  //
4
4
 
5
- import React, { useState, type FC, useEffect } from 'react';
5
+ import React, { useState, type FC, useEffect, useRef } from 'react';
6
6
 
7
7
  import { Client, type PublicKey } from '@dxos/client';
8
8
  import { type Space } from '@dxos/client/echo';
@@ -12,15 +12,13 @@ import { registerSignalFactory } from '@dxos/echo-signals/react';
12
12
  import { faker } from '@dxos/random';
13
13
  import { type MaybePromise } from '@dxos/util';
14
14
 
15
- import { ClientContext } from '../client';
15
+ import { ClientProvider } from '../client';
16
16
 
17
- const testBuilder = new TestBuilder();
17
+ export type ClientRepeatedComponentProps = { id: number; count: number; spaceKey?: PublicKey };
18
18
 
19
- export type RepeatedComponentProps = { id: number; count: number };
20
-
21
- export type ClientRepeaterProps<P extends RepeatedComponentProps> = {
22
- component: FC<any>;
19
+ export type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {
23
20
  className?: string;
21
+ component: FC<ClientRepeatedComponentProps>;
24
22
  controls?: FC<{ clients: Client[] }>;
25
23
  clients?: Client[];
26
24
  count?: number;
@@ -36,12 +34,12 @@ export type ClientRepeaterProps<P extends RepeatedComponentProps> = {
36
34
  * Utility component for Storybook stories which sets up clients for n peers.
37
35
  * The `Component` property is rendered n times, once for each peer.
38
36
  */
37
+ // TODO(burdon): To discuss: evolve ClientRepeater with optional decorator that uses it.
39
38
  // NOTE: This is specifically not a storybook decorator because it broke stories as a decorator.
40
39
  // This seems primarily due to the fact that it required top-level await for the clients to initialize.
41
40
  // Storybook seemed to handle it alright, but Chromatic had a lot of trouble with it.
42
41
  // There was also a question of whether or not calling the story function multiple times was a good idea.
43
- // TODO(wittjosiah): Rename.
44
- export const ClientRepeater = <P extends RepeatedComponentProps>(props: ClientRepeaterProps<P>) => {
42
+ export const ClientRepeater = <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => {
45
43
  const {
46
44
  component: Component,
47
45
  controls: Controls,
@@ -58,9 +56,12 @@ export const ClientRepeater = <P extends RepeatedComponentProps>(props: ClientRe
58
56
  const [clients, setClients] = useState(props.clients ?? []);
59
57
  const [spaceKey, setSpaceKey] = useState<PublicKey>();
60
58
 
59
+ const testBuilder = useRef(new TestBuilder());
61
60
  useEffect(() => {
62
61
  const timeout = setTimeout(async () => {
63
- const clients = [...Array(count)].map((_) => new Client({ services: testBuilder.createLocalClientServices() }));
62
+ const clients = [...Array(count)].map(
63
+ (_) => new Client({ services: testBuilder.current.createLocalClientServices() }),
64
+ );
64
65
  await Promise.all(clients.map((client) => client.initialize()));
65
66
  types && clients.map((client) => client.addTypes(types));
66
67
 
@@ -91,9 +92,9 @@ export const ClientRepeater = <P extends RepeatedComponentProps>(props: ClientRe
91
92
  <>
92
93
  {Controls && <Controls clients={clients} />}
93
94
  {clients.map((client, index) => (
94
- <ClientContext.Provider key={index} value={{ client }}>
95
- <Component id={index} count={clients.length} {...{ ...props.args, spaceKey }} />
96
- </ClientContext.Provider>
95
+ <ClientProvider key={index} client={client}>
96
+ <Component id={index} count={clients.length} spaceKey={spaceKey} {...{ ...props.args }} />
97
+ </ClientProvider>
97
98
  ))}
98
99
  </>
99
100
  );
@@ -5,3 +5,4 @@
5
5
  export * from '@dxos/client/testing';
6
6
 
7
7
  export * from './ClientRepeater';
8
+ export * from './withClientProvider';
@@ -0,0 +1,34 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Client, fromHost } from '@dxos/client';
8
+ import { type Space } from '@dxos/client/echo';
9
+
10
+ import { ClientContext } from '../client';
11
+
12
+ export const createClient = async ({
13
+ createIdentity,
14
+ createSpace,
15
+ }: { createIdentity?: boolean; createSpace?: boolean } = {}) => {
16
+ const client = new Client({ services: fromHost() });
17
+ await client.initialize();
18
+ if (createIdentity) {
19
+ await client.halo.createIdentity();
20
+ }
21
+
22
+ let space: Space | undefined;
23
+ if (createSpace) {
24
+ space = await client.spaces.create();
25
+ await client.spaces.isReady.wait();
26
+ }
27
+
28
+ return { client, space };
29
+ };
30
+
31
+ // TODO(burdon): Change to ClientProvider.
32
+ export const createContextProvider = async (client: Client) => {
33
+ return ({ children }: any) => <ClientContext.Provider value={{ client }}>{children}</ClientContext.Provider>;
34
+ };
@@ -0,0 +1,56 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import '@dxos-theme';
6
+
7
+ import React from 'react';
8
+
9
+ import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
10
+ import { withLayout, withTheme } from '@dxos/storybook-utils';
11
+
12
+ import { withClientProvider, withMultiClientProvider } from './withClientProvider';
13
+ import { useClient } from '../client';
14
+ import { type Space, useSpaces } from '../echo';
15
+
16
+ const SpaceInfo = ({ space }: { space: Space }) => {
17
+ const name = space.isOpen ? space.properties.name : '';
18
+ return <SyntaxHighlighter language='json'>{JSON.stringify({ id: space.id, name }, null, 2)}</SyntaxHighlighter>;
19
+ };
20
+
21
+ const Test = () => {
22
+ const client = useClient();
23
+ const spaces = useSpaces();
24
+ if (!client) {
25
+ return null;
26
+ }
27
+
28
+ return (
29
+ <div className='flex flex-col min-w-[28rem] divide-y divide-separator border border-separator rounded'>
30
+ <SyntaxHighlighter language='json'>{JSON.stringify(client.toJSON(), null, 2)}</SyntaxHighlighter>
31
+ {spaces.map((space) => (
32
+ <SpaceInfo key={space.id} space={space} />
33
+ ))}
34
+ </div>
35
+ );
36
+ };
37
+
38
+ export default {
39
+ title: 'react-client/withClientProvider',
40
+ component: Test,
41
+ decorators: [withTheme, withClientProvider({ createIdentity: true })],
42
+ };
43
+
44
+ export const Default = {};
45
+
46
+ export const Multiple = {
47
+ decorators: [
48
+ withMultiClientProvider({
49
+ numClients: 3,
50
+ createIdentity: true,
51
+ createSpace: true,
52
+ }),
53
+ withLayout({ classNames: ['flex gap-2'] }),
54
+ withTheme,
55
+ ],
56
+ };
@@ -0,0 +1,142 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type Decorator } from '@storybook/react';
6
+ import React, { useRef } from 'react';
7
+ import { type FallbackProps, ErrorBoundary } from 'react-error-boundary';
8
+
9
+ import { Trigger } from '@dxos/async';
10
+ import { type Client } from '@dxos/client';
11
+ import { type Space } from '@dxos/client/echo';
12
+ import { performInvitation, TestBuilder } from '@dxos/client/testing';
13
+ import { type MaybePromise } from '@dxos/util';
14
+
15
+ import { ClientProvider, type ClientProviderProps } from '../client';
16
+
17
+ type InitializeProps = {
18
+ createIdentity?: boolean;
19
+ createSpace?: boolean;
20
+ onSpaceCreated?: (client: Client, space: Space) => MaybePromise<void>;
21
+ };
22
+
23
+ /**
24
+ * Initialize client, identity and first space.
25
+ */
26
+ const initializeClient = async (
27
+ client: Client,
28
+ {
29
+ createIdentity,
30
+ createSpace,
31
+ onSpaceCreated,
32
+ onInitialized,
33
+ }: InitializeProps & Pick<WithClientProviderProps, 'onInitialized'>,
34
+ ): Promise<Space | undefined> => {
35
+ if (createIdentity) {
36
+ await client.halo.createIdentity();
37
+ }
38
+
39
+ let space: Space | undefined;
40
+ if (createSpace) {
41
+ space = await client.spaces.create({ name: 'Test Space' });
42
+ await onSpaceCreated?.(client, space);
43
+ }
44
+
45
+ await onInitialized?.(client);
46
+ return space;
47
+ };
48
+
49
+ export type WithClientProviderProps = InitializeProps & ClientProviderProps;
50
+
51
+ /**
52
+ * Decorator that provides the client context.
53
+ */
54
+ export const withClientProvider = ({
55
+ createIdentity,
56
+ createSpace,
57
+ onSpaceCreated,
58
+ onInitialized,
59
+ ...props
60
+ }: WithClientProviderProps = {}): Decorator => {
61
+ const handleInitialized = async (client: Client) => {
62
+ await initializeClient(client, { createIdentity, createSpace, onSpaceCreated, onInitialized });
63
+ };
64
+
65
+ return (Story) => (
66
+ <ErrorBoundary FallbackComponent={ErrorFallback}>
67
+ <ClientProvider onInitialized={handleInitialized} {...props}>
68
+ <Story />
69
+ </ClientProvider>
70
+ </ErrorBoundary>
71
+ );
72
+ };
73
+
74
+ // TODO(burdon): Implement context per client for context.
75
+ // TODO(burdon): Callback once all invitations have completed.
76
+ // TODO(burdon): Delay/jitter for creation of other clients.
77
+ export type WithMultiClientProviderProps = InitializeProps & ClientProviderProps & { numClients?: number };
78
+
79
+ /**
80
+ * Decorator that creates a scaffold for multiple clients.
81
+ * Orchestrates invitations between a randomly selected host and the remaining clients.
82
+ * NOTE: Should come before withLayout.
83
+ */
84
+ export const withMultiClientProvider = ({
85
+ numClients = 2,
86
+ createIdentity,
87
+ createSpace,
88
+ onSpaceCreated,
89
+ onInitialized,
90
+ ...props
91
+ }: WithMultiClientProviderProps): Decorator => {
92
+ return (Story) => {
93
+ const builder = useRef(new TestBuilder());
94
+ const hostRef = useRef<Client>();
95
+ const spaceReady = useRef(new Trigger<Space | undefined>());
96
+
97
+ // Handle invitations.
98
+ const handleClientInitialized = async (client: Client) => {
99
+ if (createSpace) {
100
+ if (!hostRef.current) {
101
+ hostRef.current = client;
102
+ const space = await initializeClient(client, { createIdentity, createSpace, onSpaceCreated, onInitialized });
103
+ spaceReady.current.wake(space);
104
+ } else {
105
+ await initializeClient(client, { createIdentity, onInitialized });
106
+ const space = await spaceReady.current.wait();
107
+ if (space) {
108
+ await Promise.all(performInvitation({ host: space, guest: client.spaces }));
109
+ }
110
+ }
111
+ }
112
+ };
113
+
114
+ return (
115
+ <>
116
+ {Array.from({ length: numClients }).map((_, index) => (
117
+ <ErrorBoundary key={index} FallbackComponent={ErrorFallback}>
118
+ <ClientProvider
119
+ services={builder.current.createLocalClientServices()}
120
+ onInitialized={handleClientInitialized}
121
+ {...props}
122
+ >
123
+ <Story />
124
+ </ClientProvider>
125
+ </ErrorBoundary>
126
+ ))}
127
+ </>
128
+ );
129
+ };
130
+ };
131
+
132
+ const ErrorFallback = ({ error }: FallbackProps) => {
133
+ const { name, message, stack } =
134
+ error instanceof Error ? error : { name: 'Error', message: String(error), stack: undefined };
135
+ return (
136
+ <div role='alert' className='flex flex-col gap-4'>
137
+ <h1 className='text-xl text-red-500'>{name}</h1>
138
+ <div className='text-lg'>{message}</div>
139
+ {stack && <pre className='text-sm text-subdued'>{stack}</pre>}
140
+ </div>
141
+ );
142
+ };
package/tsconfig.json CHANGED
@@ -35,9 +35,6 @@
35
35
  {
36
36
  "path": "../../common/random"
37
37
  },
38
- {
39
- "path": "../../common/react-async"
40
- },
41
38
  {
42
39
  "path": "../../common/util"
43
40
  },
@@ -47,9 +44,18 @@
47
44
  {
48
45
  "path": "../../core/echo/echo-signals"
49
46
  },
47
+ {
48
+ "path": "../../core/protocols"
49
+ },
50
+ {
51
+ "path": "../../ui/primitives/react-hooks"
52
+ },
50
53
  {
51
54
  "path": "../../ui/react-ui"
52
55
  },
56
+ {
57
+ "path": "../../ui/react-ui-syntax-highlighter"
58
+ },
53
59
  {
54
60
  "path": "../../ui/react-ui-theme"
55
61
  },
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/client/AgentHostingProvider.tsx", "../../../src/client/ClientContext.tsx", "../../../src/banner.ts", "../../../src/client/useClientServices.ts", "../../../src/client/useConfig.ts", "../../../src/client/useShell.ts", "../../../src/client/useStatus.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { createContext, type PropsWithChildren, useContext, useState } from 'react';\n\nimport { type AgentHostingProviderClient, AgentManagerClient, FakeAgentHostingProvider } from '@dxos/client';\nimport { type Halo } from '@dxos/client/halo';\nimport { type Config } from '@dxos/config';\nimport { log } from '@dxos/log';\n\nimport { useClient } from '../client';\n\n/*\n * Interface for invoking the agent hosting provider client.\n * @experimental\n */\n\nexport type AgentHostingProviderProps = { config: Config; halo: Halo };\n\nexport const AgentHostingContext = createContext<AgentHostingProviderClient | null>(null);\n\nexport const AgentHostingProvider = (props: PropsWithChildren<{}>) => {\n const client = useClient();\n const [agentHostingProviderClient] = useState(makeClient(client));\n return (\n <AgentHostingContext.Provider value={agentHostingProviderClient}> {props.children}</AgentHostingContext.Provider>\n );\n};\n\nexport const useAgentHostingClient = () => {\n return useContext(AgentHostingContext);\n};\n\nconst makeClient = ({ config, halo }: AgentHostingProviderProps) => {\n const agentHostingConfig = config.get('runtime.services.agentHosting');\n if (!agentHostingConfig) {\n log('no agent hosting configured');\n return null;\n }\n\n // TODO(nf): Dynamically discover based on runtime config.\n let agentHostingProviderClient: AgentHostingProviderClient | null = null;\n switch (agentHostingConfig.type) {\n case 'LOCAL_TESTING': {\n log('using FakeAgentHostingProvider');\n return new FakeAgentHostingProvider();\n }\n\n case 'AGENTHOSTING_API': {\n agentHostingProviderClient = new AgentManagerClient(config, halo);\n if (agentHostingProviderClient.init()) {\n return agentHostingProviderClient;\n } else {\n // Not authorized or error initializing\n return null;\n }\n }\n\n default: {\n log.error('Unknown agent hosting provider type: ' + agentHostingConfig.type);\n return null;\n }\n }\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport React, {\n type ReactNode,\n useState,\n type Context,\n createContext,\n useContext,\n useEffect,\n type FunctionComponent,\n useMemo,\n} from 'react';\n\nimport {\n Client,\n SystemStatus,\n type ClientOptions,\n type ClientServices,\n type ClientServicesProvider,\n} from '@dxos/client';\nimport { type Config } from '@dxos/config';\nimport { raise } from '@dxos/debug';\nimport { registerSignalFactory } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { getAsyncValue, type MaybePromise, type Provider } from '@dxos/util'; // TODO(burdon): Deprecate \"util\"?\n\nimport { printBanner } from '../banner';\n\n// TODO(burdon): Reconcile with ClientOptions.\nexport type ClientContextProps = {\n client: Client;\n\n // Optionally expose services (e.g., for devtools).\n // TODO(burdon): Can't this just be accessed via `client.services`?\n services?: ClientServices;\n\n status?: SystemStatus | null;\n};\n\nexport const ClientContext: Context<ClientContextProps | undefined> = createContext<ClientContextProps | undefined>(\n undefined,\n);\n\n/**\n * Hook returning instance of DXOS client.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useClient = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client;\n};\n\n/**\n * Properties for the ClientProvider.\n */\nexport type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> & {\n children?: ReactNode;\n\n /**\n * Config object or async provider.\n */\n config?: Config | Provider<Promise<Config>>;\n\n /**\n * Callback to enable the caller to create a custom ClientServicesProvider.\n *\n * Most apps won't need this.\n */\n services?: (config?: Config) => MaybePromise<ClientServicesProvider>;\n\n /**\n * Client object or async provider to enable to caller to do custom initialization.\n *\n * Most apps won't need this.\n */\n // TODO(wittjosiah): Remove async and just use to keeping reference to client?\n // (Prefering `onInitialized` for custom initialization.)\n client?: Client | Provider<Promise<Client>>;\n\n /**\n * ReactNode to display until the client is available.\n */\n // TODO(wittjosiah): Rename to `placeholder`.\n fallback?: FunctionComponent<Partial<ClientContextProps>>;\n\n /**\n * Set to false to stop default signal factory from being registered.\n */\n registerSignalFactory?: boolean;\n\n /**\n * Post initialization hook to enable to caller to do custom initialization.\n *\n * @param Client\n */\n onInitialized?: (client: Client) => MaybePromise<void>;\n};\n\n/**\n * Root component that provides the DXOS client instance to child components.\n * To be used with the `useClient` hook.\n */\nexport const ClientProvider = ({\n children,\n config: configProvider,\n services: createServices,\n client: clientProvider,\n fallback: Fallback = () => null,\n registerSignalFactory: register = true,\n onInitialized,\n ...options\n}: ClientProviderProps) => {\n useMemo(() => {\n // TODO(wittjosiah): Ideally this should be imported asynchronosly because it is optional.\n // Unfortunately, async import seemed to break signals React instrumentation.\n register && registerSignalFactory();\n }, []);\n\n const [client, setClient] = useState(clientProvider instanceof Client ? clientProvider : undefined);\n const [status, setStatus] = useState<SystemStatus | null>(null);\n const [error, setError] = useState();\n if (error) {\n throw error;\n }\n\n useEffect(() => {\n if (!client) {\n return;\n }\n\n const subscription = client.status.subscribe((status) => setStatus(status));\n return () => subscription.unsubscribe();\n }, [client, setStatus]);\n\n useEffect(() => {\n const done = async (client: Client) => {\n await client.initialize().catch(setError);\n log('client ready');\n await onInitialized?.(client);\n log('initialization complete');\n setClient(client);\n setStatus(client.status.get() ?? SystemStatus.ACTIVE);\n printBanner(client);\n };\n\n const timeout = setTimeout(async () => {\n if (clientProvider) {\n // Asynchronously request client.\n const client = await getAsyncValue(clientProvider);\n await done(client);\n } else {\n // Asynchronously construct client (config may be undefined).\n const config = await getAsyncValue(configProvider);\n log('resolved config', { config });\n const services = await createServices?.(config);\n log('created services', { services });\n const client = new Client({ config, services, ...options });\n log('created client');\n await done(client);\n }\n });\n\n return () => {\n log('clean up');\n clearTimeout(timeout);\n void client?.destroy().catch((err) => log.catch(err));\n };\n }, [clientProvider, configProvider, createServices]);\n\n if (!client || status !== SystemStatus.ACTIVE) {\n return <Fallback client={client} status={status} />;\n }\n\n // prettier-ignore\n return (\n <ClientContext.Provider value={{ client, status }}>\n {children}\n </ClientContext.Provider>\n );\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type Client } from '@dxos/client';\n\n// http://patorjk.com/software/taag/#p=testall&f=Patorjk-HeX&t=DXOS\nconst BANNER = (client: Client) => {\n const commitHash = client.config.get('runtime.app.build.commitHash');\n const hash = commitHash ? ` App Commit ${commitHash} \\n` : '';\n\n return (\n '\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\______/\\\\/\\\\/\\\\/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__/\\\\/\\\\_________\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\______/\\\\/\\\\______/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\___\\n' +\n '_/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\__________/\\\\/\\\\_\\n' +\n '_/\\\\/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\____/\\\\/\\\\/\\\\/\\\\/\\\\___\\n' +\n `\\n DXOS Client ${client.version} \\n${hash}`\n );\n};\n\nlet bannerPrinted = false;\n\nexport const printBanner = (client: Client) => {\n if (bannerPrinted) {\n return;\n }\n\n bannerPrinted = true;\n // eslint-disable-next-line no-console\n console.log(`%c${BANNER(client)}`, 'font-family: monospace;');\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport type { ClientServices } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\nexport const useClientServices = (): ClientServices | undefined => {\n const { services } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return services;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\n/**\n * Hook returning config object used to initialize the DXOS client instance.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useConfig = () => {\n const { client } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return client.config;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Shell, type ShellDisplay } from '@dxos/client';\n\nimport { useClient } from './ClientContext';\n\n/**\n * Helper hook to access the shell.\n */\nexport const useShell = (): Shell => {\n const client = useClient();\n return client.shell;\n};\n\n/**\n * Hook to access the shell’s display state.\n */\nexport const useShellDisplay = (): ShellDisplay => {\n const client = useClient();\n const [display, setDisplay] = useState(client.shell.display);\n useEffect(() => client.shell.onDisplayChange(setDisplay), [client]);\n return display;\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { type SystemStatus } from '@dxos/client';\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './ClientContext';\n\nexport const useStatus = (): SystemStatus | null | undefined => {\n const { status } = useContext(ClientContext) ?? raise(new Error('Missing ClientContext.'));\n return status;\n};\n"],
5
- "mappings": ";AAIA,OAAOA,UAASC,iBAAAA,gBAAuCC,cAAAA,aAAYC,YAAAA,iBAAgB;AAEnF,SAA0CC,oBAAoBC,gCAAgC;AAG9F,SAASC,OAAAA,YAAW;;;ACLpB,OAAOC,SAELC,UAEAC,eACAC,YACAC,WAEAC,eACK;AAEP,SACEC,QACAC,oBAIK;AAEP,SAASC,aAAa;AACtB,SAASC,6BAA6B;AACtC,SAASC,WAAW;AACpB,SAASC,qBAAuD;;;ACnBhE,IAAMC,SAAS,CAACC,WAAAA;AACd,QAAMC,aAAaD,OAAOE,OAAOC,IAA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AACvBE,IAAAA,KAAI,+BAAA,QAAA;;;;;;AACJ,WAAO;EACT;AAGA,MAAIb,6BAAgE;AACpE,UAAQW,mBAAmBG,MAAI;IAC7B,KAAK,iBAAiB;AACpBD,MAAAA,KAAI,kCAAA,QAAA;;;;;;AACJ,aAAO,IAAIE,yBAAAA;IACb;IAEA,KAAK,oBAAoB;AACvBf,mCAA6B,IAAIgB,mBAAmBP,QAAQC,IAAAA;AAC5D,UAAIV,2BAA2BiB,KAAI,GAAI;AACrC,eAAOjB;MACT,OAAO;AAEL,eAAO;MACT;IACF;IAEA,SAAS;AACPa,MAAAA,KAAIK,MAAM,0CAA0CP,mBAAmBG,MAAI,QAAA;;;;;;AAC3E,aAAO;IACT;EACF;AACF;",
6
- "names": ["React", "createContext", "useContext", "useState", "AgentManagerClient", "FakeAgentHostingProvider", "log", "React", "useState", "createContext", "useContext", "useEffect", "useMemo", "Client", "SystemStatus", "raise", "registerSignalFactory", "log", "getAsyncValue", "BANNER", "client", "commitHash", "config", "get", "hash", "version", "bannerPrinted", "printBanner", "console", "log", "ClientContext", "createContext", "undefined", "useClient", "client", "useContext", "raise", "Error", "ClientProvider", "children", "config", "configProvider", "services", "createServices", "clientProvider", "fallback", "Fallback", "registerSignalFactory", "register", "onInitialized", "options", "useMemo", "setClient", "useState", "Client", "status", "setStatus", "error", "setError", "useEffect", "subscription", "subscribe", "unsubscribe", "done", "initialize", "catch", "log", "get", "SystemStatus", "ACTIVE", "printBanner", "timeout", "setTimeout", "getAsyncValue", "clearTimeout", "destroy", "err", "Provider", "value", "useContext", "raise", "useClientServices", "services", "useContext", "ClientContext", "raise", "Error", "useContext", "raise", "useConfig", "client", "useContext", "ClientContext", "raise", "Error", "config", "useEffect", "useState", "useShell", "client", "useClient", "shell", "useShellDisplay", "display", "setDisplay", "useState", "useEffect", "onDisplayChange", "useContext", "raise", "useStatus", "status", "useContext", "ClientContext", "raise", "Error", "AgentHostingContext", "createContext", "AgentHostingProvider", "props", "client", "useClient", "agentHostingProviderClient", "useState", "makeClient", "React", "Provider", "value", "children", "useAgentHostingClient", "useContext", "config", "halo", "agentHostingConfig", "get", "log", "type", "FakeAgentHostingProvider", "AgentManagerClient", "init", "error"]
7
- }