@dxos/react-client 0.10.0 → 0.11.0
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/.storybook/main.mts +1 -1
- package/.storybook/preview.mts +2 -2
- package/CHANGELOG.md +57 -0
- package/dist/lib/chunk-ClientProvider.mjs +152 -0
- package/dist/lib/chunk-ClientProvider.mjs.map +1 -0
- package/dist/lib/chunk-context.mjs +14 -0
- package/dist/lib/chunk-context.mjs.map +1 -0
- package/dist/lib/chunk-useClient.mjs +16 -0
- package/dist/lib/chunk-useClient.mjs.map +1 -0
- package/dist/lib/devtools.mjs +37 -0
- package/dist/lib/devtools.mjs.map +1 -0
- package/dist/lib/echo.mjs +230 -0
- package/dist/lib/echo.mjs.map +1 -0
- package/dist/lib/halo.mjs +85 -0
- package/dist/lib/halo.mjs.map +1 -0
- package/dist/lib/index.mjs +108 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/invitations.mjs +130 -0
- package/dist/lib/invitations.mjs.map +1 -0
- package/dist/lib/mesh.mjs +14 -0
- package/dist/lib/mesh.mjs.map +1 -0
- package/dist/lib/testing.mjs +206 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/types/src/client/AgentHostingProvider.d.ts +0 -3
- package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -1
- package/dist/types/src/client/context.d.ts +4 -1
- package/dist/types/src/client/context.d.ts.map +1 -1
- package/dist/types/src/echo/index.d.ts +1 -0
- package/dist/types/src/echo/index.d.ts.map +1 -1
- package/dist/types/src/echo/useFeedSyncState.d.ts +1 -1
- package/dist/types/src/echo/useFlush.d.ts +10 -0
- package/dist/types/src/echo/useFlush.d.ts.map +1 -0
- package/dist/types/src/echo/useSpaces.d.ts +0 -10
- package/dist/types/src/echo/useSpaces.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +1 -12
- package/package.json +32 -45
- package/src/client/AgentHostingProvider.tsx +5 -8
- package/src/client/context.ts +11 -2
- package/src/echo/index.ts +1 -0
- package/src/echo/useFeedSyncState.ts +4 -4
- package/src/echo/useFlush.ts +39 -0
- package/src/echo/useSpaces.ts +0 -14
- package/src/echo/useSyncState.ts +2 -2
- package/src/halo/Passkey.stories.tsx +1 -1
- package/src/testing/withClientProvider.stories.tsx +1 -1
- package/vite.config.ts +19 -0
- package/dist/lib/browser/chunk-3LVU7RNK.mjs +0 -16
- package/dist/lib/browser/chunk-3LVU7RNK.mjs.map +0 -7
- package/dist/lib/browser/chunk-CZMIVAGI.mjs +0 -8
- package/dist/lib/browser/chunk-CZMIVAGI.mjs.map +0 -7
- package/dist/lib/browser/chunk-SSDQ6NXU.mjs +0 -153
- package/dist/lib/browser/chunk-SSDQ6NXU.mjs.map +0 -7
- package/dist/lib/browser/chunk-XT352YI6.mjs +0 -134
- package/dist/lib/browser/chunk-XT352YI6.mjs.map +0 -7
- package/dist/lib/browser/devtools/index.mjs +0 -39
- package/dist/lib/browser/devtools/index.mjs.map +0 -7
- package/dist/lib/browser/echo/index.mjs +0 -239
- package/dist/lib/browser/echo/index.mjs.map +0 -7
- package/dist/lib/browser/halo/index.mjs +0 -109
- package/dist/lib/browser/halo/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -119
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/invitations/index.mjs +0 -17
- package/dist/lib/browser/invitations/index.mjs.map +0 -7
- package/dist/lib/browser/mesh/index.mjs +0 -18
- package/dist/lib/browser/mesh/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs +0 -204
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -3
- package/dist/lib/browser/worker.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CUDKNAMV.mjs +0 -17
- package/dist/lib/node-esm/chunk-CUDKNAMV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JZNSBWIR.mjs +0 -155
- package/dist/lib/node-esm/chunk-JZNSBWIR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WL3Z5HOH.mjs +0 -135
- package/dist/lib/node-esm/chunk-WL3Z5HOH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WUTK2IJF.mjs +0 -10
- package/dist/lib/node-esm/chunk-WUTK2IJF.mjs.map +0 -7
- package/dist/lib/node-esm/devtools/index.mjs +0 -40
- package/dist/lib/node-esm/devtools/index.mjs.map +0 -7
- package/dist/lib/node-esm/echo/index.mjs +0 -240
- package/dist/lib/node-esm/echo/index.mjs.map +0 -7
- package/dist/lib/node-esm/halo/index.mjs +0 -110
- package/dist/lib/node-esm/halo/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -120
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/invitations/index.mjs +0 -18
- package/dist/lib/node-esm/invitations/index.mjs.map +0 -7
- package/dist/lib/node-esm/mesh/index.mjs +0 -19
- package/dist/lib/node-esm/mesh/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -205
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -5
- package/dist/lib/node-esm/worker.mjs.map +0 -7
- package/dist/types/src/worker.d.ts +0 -2
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/worker.ts +0 -5
- package/vitest.config.ts +0 -16
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useClient
|
|
3
|
-
} from "./chunk-3LVU7RNK.mjs";
|
|
4
|
-
import {
|
|
5
|
-
ClientProvider
|
|
6
|
-
} from "./chunk-XT352YI6.mjs";
|
|
7
|
-
import {
|
|
8
|
-
ClientContext
|
|
9
|
-
} from "./chunk-CZMIVAGI.mjs";
|
|
10
|
-
|
|
11
|
-
// src/index.ts
|
|
12
|
-
export * from "@dxos/client";
|
|
13
|
-
import { useMulticastObservable } from "@dxos/react-hooks";
|
|
14
|
-
|
|
15
|
-
// src/client/AgentHostingProvider.tsx
|
|
16
|
-
import React, { createContext, useContext, useState } from "react";
|
|
17
|
-
import { AgentManagerClient, FakeAgentHostingProvider } from "@dxos/client";
|
|
18
|
-
import { log } from "@dxos/log";
|
|
19
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/client/AgentHostingProvider.tsx";
|
|
20
|
-
var AgentHostingContext = /* @__PURE__ */ createContext(null);
|
|
21
|
-
var AgentHostingProvider = (props) => {
|
|
22
|
-
const client = useClient();
|
|
23
|
-
const [agentHostingProviderClient] = useState(makeClient(client));
|
|
24
|
-
return /* @__PURE__ */ React.createElement(AgentHostingContext.Provider, {
|
|
25
|
-
value: agentHostingProviderClient
|
|
26
|
-
}, " ", props.children);
|
|
27
|
-
};
|
|
28
|
-
var useAgentHostingClient = () => {
|
|
29
|
-
return useContext(AgentHostingContext);
|
|
30
|
-
};
|
|
31
|
-
var makeClient = ({ config, halo }) => {
|
|
32
|
-
const agentHostingConfig = config.get("runtime.services.agentHosting");
|
|
33
|
-
if (!agentHostingConfig) {
|
|
34
|
-
log("no agent hosting configured", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 27, S: void 0 });
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
let agentHostingProviderClient = null;
|
|
38
|
-
switch (agentHostingConfig.type) {
|
|
39
|
-
case "LOCAL_TESTING": {
|
|
40
|
-
log("using FakeAgentHostingProvider", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 35, S: void 0 });
|
|
41
|
-
return new FakeAgentHostingProvider();
|
|
42
|
-
}
|
|
43
|
-
case "AGENTHOSTING_API": {
|
|
44
|
-
agentHostingProviderClient = new AgentManagerClient(config, halo);
|
|
45
|
-
if (agentHostingProviderClient.init()) {
|
|
46
|
-
return agentHostingProviderClient;
|
|
47
|
-
} else {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
default: {
|
|
52
|
-
log.error("Unknown agent hosting provider type: " + agentHostingConfig.type, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 50, S: void 0 });
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
// src/client/useClientStatus.ts
|
|
59
|
-
import { useEffect, useState as useState2 } from "react";
|
|
60
|
-
var useClientStatus = (client) => {
|
|
61
|
-
const [status, setStatus] = useState2();
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
if (!client) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const subscription = client.status.subscribe((status2) => setStatus(status2));
|
|
67
|
-
return () => subscription.unsubscribe();
|
|
68
|
-
}, [
|
|
69
|
-
client,
|
|
70
|
-
setStatus
|
|
71
|
-
]);
|
|
72
|
-
return status;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// src/client/useConfig.ts
|
|
76
|
-
import { useContext as useContext2 } from "react";
|
|
77
|
-
import { raise } from "@dxos/debug";
|
|
78
|
-
var useConfig = () => {
|
|
79
|
-
const { client } = useContext2(ClientContext) ?? raise(new Error("Missing ClientContext."));
|
|
80
|
-
return client.config;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/client/useShell.ts
|
|
84
|
-
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
85
|
-
var useShell = () => {
|
|
86
|
-
const client = useClient();
|
|
87
|
-
return client.shell;
|
|
88
|
-
};
|
|
89
|
-
var useShellDisplay = () => {
|
|
90
|
-
const client = useClient();
|
|
91
|
-
const [display, setDisplay] = useState3(client.shell.display);
|
|
92
|
-
useEffect2(() => client.shell.onDisplayChange(setDisplay), [
|
|
93
|
-
client
|
|
94
|
-
]);
|
|
95
|
-
return display;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// src/client/useStatus.ts
|
|
99
|
-
import { useContext as useContext3 } from "react";
|
|
100
|
-
import { raise as raise2 } from "@dxos/debug";
|
|
101
|
-
var useStatus = () => {
|
|
102
|
-
const { status } = useContext3(ClientContext) ?? raise2(new Error("Missing ClientContext."));
|
|
103
|
-
return status;
|
|
104
|
-
};
|
|
105
|
-
export {
|
|
106
|
-
AgentHostingContext,
|
|
107
|
-
AgentHostingProvider,
|
|
108
|
-
ClientContext,
|
|
109
|
-
ClientProvider,
|
|
110
|
-
useAgentHostingClient,
|
|
111
|
-
useClient,
|
|
112
|
-
useClientStatus,
|
|
113
|
-
useConfig,
|
|
114
|
-
useMulticastObservable,
|
|
115
|
-
useShell,
|
|
116
|
-
useShellDisplay,
|
|
117
|
-
useStatus
|
|
118
|
-
};
|
|
119
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/index.ts", "../../../src/client/AgentHostingProvider.tsx", "../../../src/client/useClientStatus.ts", "../../../src/client/useConfig.ts", "../../../src/client/useShell.ts", "../../../src/client/useStatus.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client';\nexport { useMulticastObservable } from '@dxos/react-hooks';\n\nexport * from './client';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type PropsWithChildren, createContext, 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\nexport type AgentHostingProviderProps = { config: Config; halo: Halo };\n\nexport const AgentHostingContext = createContext<AgentHostingProviderClient | null>(null);\n\n/**\n * Experimental agent hosting provider.\n * @param props\n * @constructor\n * @deprecated\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 2024 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Client, type SystemStatus } from '@dxos/client';\n\nexport const useClientStatus = (client: Client) => {\n const [status, setStatus] = useState<SystemStatus | null>();\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 return status;\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from './context';\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 './useClient';\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 './context';\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,cAAc;AACd,SAASA,8BAA8B;;;ACDvC,OAAOC,SAAiCC,eAAeC,YAAYC,gBAAgB;AAEnF,SAA0CC,oBAAoBC,gCAAgC;AAG9F,SAASC,WAAW;AAMpB,IAAA,eAAaC;;AAUJC,IAAAA,uBAA2B,CAAGC,UAAAA;AACrC,QAAA,SAAA,UACE;QAA8BC,CAAAA,0BAAOF,IAAAA,SAAAA,WAAAA,MAAAA,CAAAA;SAAoCG,sBAAQ,cAAA,oBAAA,UAAA;IAEnF,OAAA;EAEF,GAAO,KAAA,MAAMC,QAAAA;;AAEX,IAAA,wBAAA,MAAA;AAEF,SAAMC,WAAgBC,mBAAyC;;IAE7D,aAAKC,CAAAA,EAAAA,QAAoB,KAAA,MAAA;QACvBC,qBAAI,OAAA,IAAA,+BAAA;MACJ,CAAA,oBAAO;AACT,QAAA,+BAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AAEA,WAAA;EACA;MAEE,6BAAK;6BAAiB,MAAA;;AAGtB,UAAA,kCAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AAEK,aAAA,IAAA,yBAAA;IAAoB;;mCAGdR,IAAAA,mBAAAA,QAAAA,IAAAA;AACT,UAAA,2BAAO,KAAA,GAAA;AACL,eAAA;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astObservable", "React", "createContext", "useContext", "useState", "AgentManagerClient", "FakeAgentHostingProvider", "log", "AgentHostingContext", "agentHostingProviderClient", "useState", "value", "children", "useAgentHostingClient", "makeClient", "config", "agentHostingConfig", "log", "useEffect", "useState", "useClientStatus", "client", "status", "setStatus", "subscription", "subscribe", "unsubscribe", "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"]
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AuthenticatingInvitationObservable,
|
|
3
|
-
CancellableInvitationObservable,
|
|
4
|
-
Invitation,
|
|
5
|
-
InvitationEncoder,
|
|
6
|
-
InvitationsProxy,
|
|
7
|
-
useInvitationStatus
|
|
8
|
-
} from "../chunk-SSDQ6NXU.mjs";
|
|
9
|
-
export {
|
|
10
|
-
AuthenticatingInvitationObservable,
|
|
11
|
-
CancellableInvitationObservable,
|
|
12
|
-
Invitation,
|
|
13
|
-
InvitationEncoder,
|
|
14
|
-
InvitationsProxy,
|
|
15
|
-
useInvitationStatus
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useClient
|
|
3
|
-
} from "../chunk-3LVU7RNK.mjs";
|
|
4
|
-
import "../chunk-CZMIVAGI.mjs";
|
|
5
|
-
|
|
6
|
-
// src/mesh/index.ts
|
|
7
|
-
export * from "@dxos/client/mesh";
|
|
8
|
-
|
|
9
|
-
// src/mesh/useNetworkStatus.ts
|
|
10
|
-
import { useMulticastObservable } from "@dxos/react-hooks";
|
|
11
|
-
var useNetworkStatus = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
return useMulticastObservable(client.mesh.networkStatus);
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
useNetworkStatus
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/mesh/index.ts", "../../../../src/mesh/useNetworkStatus.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/mesh';\n\nexport * from './useNetworkStatus';\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type NetworkStatus } from '@dxos/client/mesh';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Creates a network status subscription.\n */\nexport const useNetworkStatus = (): NetworkStatus => {\n const client = useClient();\n return useMulticastObservable(client.mesh.networkStatus);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,cAAc;;;ACCd,SAASA,8BAA8B;AAOhC,IAAMC,mBAAmB,MAAA;AAC9B,QAAMC,SAASC,UAAAA;AACf,SAAOC,uBAAuBF,OAAOG,KAAKC,aAAa;AACzD;",
|
|
6
|
-
"names": ["useMulticastObservable", "useNetworkStatus", "client", "useClient", "useMulticastObservable", "mesh", "networkStatus"]
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":{"src/client/AgentHostingProvider.tsx":{"bytes":6817,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/banner.ts":{"bytes":3744,"imports":[],"format":"esm"},"src/client/context.ts":{"bytes":1194,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/client/ClientProvider.tsx":{"bytes":15846,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"src/banner.ts","kind":"import-statement","original":"../banner"},{"path":"src/client/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/client/useClient.ts":{"bytes":1556,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"src/client/context.ts","kind":"import-statement","original":"../client/context"}],"format":"esm"},"src/client/useClientStatus.ts":{"bytes":1872,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/client/useConfig.ts":{"bytes":1657,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"src/client/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/client/useShell.ts":{"bytes":2242,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/client/useClient.ts","kind":"import-statement","original":"./useClient"}],"format":"esm"},"src/client/useStatus.ts":{"bytes":1377,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"src/client/context.ts","kind":"import-statement","original":"./context"}],"format":"esm"},"src/client/index.ts":{"bytes":1067,"imports":[{"path":"src/client/AgentHostingProvider.tsx","kind":"import-statement","original":"./AgentHostingProvider"},{"path":"src/client/ClientProvider.tsx","kind":"import-statement","original":"./ClientProvider"},{"path":"src/client/context.ts","kind":"import-statement","original":"./context"},{"path":"src/client/useClient.ts","kind":"import-statement","original":"./useClient"},{"path":"src/client/useClientStatus.ts","kind":"import-statement","original":"./useClientStatus"},{"path":"src/client/useConfig.ts","kind":"import-statement","original":"./useConfig"},{"path":"src/client/useShell.ts","kind":"import-statement","original":"./useShell"},{"path":"src/client/useStatus.ts","kind":"import-statement","original":"./useStatus"}],"format":"esm"},"src/devtools/useDevtools.ts":{"bytes":1305,"imports":[{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/devtools/useStream.ts":{"bytes":2683,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/devtools/index.ts":{"bytes":595,"imports":[{"path":"@dxos/client/devtools","kind":"import-statement","external":true},{"path":"src/devtools/useDevtools.ts","kind":"import-statement","original":"./useDevtools"},{"path":"src/devtools/useStream.ts","kind":"import-statement","original":"./useStream"}],"format":"esm"},"src/echo/useSpaces.ts":{"bytes":6283,"imports":[{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/echo/useMembers.ts":{"bytes":3380,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/echo/useSpaces.ts","kind":"import-statement","original":"./useSpaces"}],"format":"esm"},"src/invitations/useInvitationStatus.ts":{"bytes":20307,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client/invitations","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"format":"esm"},"src/invitations/index.ts":{"bytes":1198,"imports":[{"path":"@dxos/client/invitations","kind":"import-statement","external":true},{"path":"src/invitations/useInvitationStatus.ts","kind":"import-statement","original":"./useInvitationStatus"}],"format":"esm"},"src/echo/useSpaceInvitations.ts":{"bytes":3945,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/invitations/index.ts","kind":"import-statement","original":"../invitations"},{"path":"src/echo/useSpaces.ts","kind":"import-statement","original":"./useSpaces"}],"format":"esm"},"src/echo/useSpaceProperties.ts":{"bytes":3500,"imports":[{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/echo/useSpaces.ts","kind":"import-statement","original":"./useSpaces"}],"format":"esm"},"src/echo/useSubscription.ts":{"bytes":3440,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true}],"format":"esm"},"src/echo/useSyncState.ts":{"bytes":7194,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/echo/useFeedSyncState.ts":{"bytes":7676,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/echo/useRegistry.ts":{"bytes":1132,"imports":[{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/echo/index.ts":{"bytes":1331,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-react","kind":"import-statement","external":true},{"path":"src/echo/useMembers.ts","kind":"import-statement","original":"./useMembers"},{"path":"src/echo/useSpaces.ts","kind":"import-statement","original":"./useSpaces"},{"path":"src/echo/useSpaceInvitations.ts","kind":"import-statement","original":"./useSpaceInvitations"},{"path":"src/echo/useSpaceProperties.ts","kind":"import-statement","original":"./useSpaceProperties"},{"path":"src/echo/useSubscription.ts","kind":"import-statement","original":"./useSubscription"},{"path":"src/echo/useSyncState.ts","kind":"import-statement","original":"./useSyncState"},{"path":"src/echo/useFeedSyncState.ts","kind":"import-statement","original":"./useFeedSyncState"},{"path":"src/echo/useRegistry.ts","kind":"import-statement","original":"./useRegistry"}],"format":"esm"},"src/halo/useContacts.ts":{"bytes":1618,"imports":[{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/halo/useCredentials.ts":{"bytes":1250,"imports":[{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/halo/useDevices.ts":{"bytes":1202,"imports":[{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/halo/useHaloInvitations.ts":{"bytes":2626,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"},{"path":"src/invitations/index.ts","kind":"import-statement","original":"../invitations"}],"format":"esm"},"src/halo/useIdentity.ts":{"bytes":1488,"imports":[{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/halo/useKeyStore.ts":{"bytes":4446,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/halo/index.ts":{"bytes":1365,"imports":[{"path":"@dxos/client/halo","kind":"import-statement","external":true},{"path":"src/halo/useContacts.ts","kind":"import-statement","original":"./useContacts"},{"path":"src/halo/useCredentials.ts","kind":"import-statement","original":"./useCredentials"},{"path":"src/halo/useDevices.ts","kind":"import-statement","original":"./useDevices"},{"path":"src/halo/useHaloInvitations.ts","kind":"import-statement","original":"./useHaloInvitations"},{"path":"src/halo/useIdentity.ts","kind":"import-statement","original":"./useIdentity"},{"path":"src/halo/useKeyStore.ts","kind":"import-statement","original":"./useKeyStore"}],"format":"esm"},"src/index.ts":{"bytes":680,"imports":[{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"./client"}],"format":"esm"},"src/mesh/useNetworkStatus.ts":{"bytes":1408,"imports":[{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/mesh/index.ts":{"bytes":507,"imports":[{"path":"@dxos/client/mesh","kind":"import-statement","external":true},{"path":"src/mesh/useNetworkStatus.ts","kind":"import-statement","original":"./useNetworkStatus"}],"format":"esm"},"src/testing/context.tsx":{"bytes":1581,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"format":"esm"},"src/testing/ClientRepeater.tsx":{"bytes":10392,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"}],"format":"esm"},"src/testing/withClientProvider.tsx":{"bytes":17977,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"src/client/index.ts","kind":"import-statement","original":"../client"},{"path":"src/testing/context.tsx","kind":"import-statement","original":"./context"}],"format":"esm"},"src/testing/index.ts":{"bytes":709,"imports":[{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"src/testing/context.tsx","kind":"import-statement","original":"./context"},{"path":"src/testing/ClientRepeater.tsx","kind":"import-statement","original":"./ClientRepeater"},{"path":"src/testing/withClientProvider.tsx","kind":"import-statement","original":"./withClientProvider"}],"format":"esm"},"src/worker.ts":{"bytes":401,"imports":[{"path":"@dxos/client/worker","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/lib/browser/devtools/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2196},"dist/lib/browser/devtools/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-3LVU7RNK.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"@dxos/client/devtools","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["useDevtools","useStream"],"entryPoint":"src/devtools/index.ts","inputs":{"src/devtools/index.ts":{"bytesInOutput":39},"src/devtools/useDevtools.ts":{"bytesInOutput":195},"src/devtools/useStream.ts":{"bytesInOutput":631}},"bytes":1112},"dist/lib/browser/echo/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":18838},"dist/lib/browser/echo/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-SSDQ6NXU.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-3LVU7RNK.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/context","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["useDatabase","useFeedSyncState","useMembers","useRegistry","useSpace","useSpaceInvitation","useSpaceInvitations","useSpaceProperties","useSpaceSyncState","useSpaces","useSubscription","useSyncState"],"entryPoint":"src/echo/index.ts","inputs":{"src/echo/index.ts":{"bytesInOutput":69},"src/echo/useMembers.ts":{"bytesInOutput":659},"src/echo/useSpaces.ts":{"bytesInOutput":781},"src/echo/useSpaceInvitations.ts":{"bytesInOutput":660},"src/echo/useSpaceProperties.ts":{"bytesInOutput":563},"src/echo/useSubscription.ts":{"bytesInOutput":508},"src/echo/useSyncState.ts":{"bytesInOutput":1735},"src/echo/useFeedSyncState.ts":{"bytesInOutput":1718},"src/echo/useRegistry.ts":{"bytesInOutput":91}},"bytes":7485},"dist/lib/browser/halo/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6965},"dist/lib/browser/halo/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-SSDQ6NXU.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-3LVU7RNK.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"@dxos/client/halo","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["Device","DeviceKind","DeviceType","KeyStore","useContacts","useCredentials","useDevices","useHaloInvitation","useHaloInvitations","useIdentity","useKeyStore"],"entryPoint":"src/halo/index.ts","inputs":{"src/halo/index.ts":{"bytesInOutput":68},"src/halo/useContacts.ts":{"bytesInOutput":174},"src/halo/useCredentials.ts":{"bytesInOutput":208},"src/halo/useDevices.ts":{"bytesInOutput":200},"src/halo/useHaloInvitations.ts":{"bytesInOutput":521},"src/halo/useIdentity.ts":{"bytesInOutput":202},"src/halo/useKeyStore.ts":{"bytesInOutput":937}},"bytes":2873},"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":7138},"dist/lib/browser/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-3LVU7RNK.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-XT352YI6.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["AgentHostingContext","AgentHostingProvider","ClientContext","ClientProvider","useAgentHostingClient","useClient","useClientStatus","useConfig","useMulticastObservable","useShell","useShellDisplay","useStatus"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":90},"src/client/AgentHostingProvider.tsx":{"bytesInOutput":1700},"src/client/useClientStatus.ts":{"bytesInOutput":383},"src/client/useConfig.ts":{"bytesInOutput":234},"src/client/useShell.ts":{"bytesInOutput":377},"src/client/useStatus.ts":{"bytesInOutput":238}},"bytes":3629},"dist/lib/browser/invitations/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":93},"dist/lib/browser/invitations/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-SSDQ6NXU.mjs","kind":"import-statement"}],"exports":["AuthenticatingInvitationObservable","CancellableInvitationObservable","Invitation","InvitationEncoder","InvitationsProxy","useInvitationStatus"],"entryPoint":"src/invitations/index.ts","inputs":{},"bytes":388},"dist/lib/browser/chunk-SSDQ6NXU.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10410},"dist/lib/browser/chunk-SSDQ6NXU.mjs":{"imports":[{"path":"@dxos/client/invitations","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client/invitations","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true}],"exports":["AuthenticatingInvitationObservable","CancellableInvitationObservable","Invitation","InvitationEncoder","InvitationsProxy","useInvitationStatus"],"inputs":{"src/invitations/index.ts":{"bytesInOutput":198},"src/invitations/useInvitationStatus.ts":{"bytesInOutput":4615}},"bytes":5128},"dist/lib/browser/mesh/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":936},"dist/lib/browser/mesh/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-3LVU7RNK.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"@dxos/client/mesh","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"exports":["useNetworkStatus"],"entryPoint":"src/mesh/index.ts","inputs":{"src/mesh/index.ts":{"bytesInOutput":35},"src/mesh/useNetworkStatus.ts":{"bytesInOutput":184}},"bytes":425},"dist/lib/browser/chunk-3LVU7RNK.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":807},"dist/lib/browser/chunk-3LVU7RNK.mjs":{"imports":[{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true}],"exports":["useClient"],"inputs":{"src/client/useClient.ts":{"bytesInOutput":211}},"bytes":364},"dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15608},"dist/lib/browser/testing/index.mjs":{"imports":[{"path":"dist/lib/browser/chunk-XT352YI6.mjs","kind":"import-statement"},{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/debug","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/random","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/client/testing","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"exports":["ClientRepeater","ClientStory","useClientStory","withClientProvider","withMultiClientProvider"],"entryPoint":"src/testing/index.ts","inputs":{"src/testing/index.ts":{"bytesInOutput":38},"src/testing/context.tsx":{"bytesInOutput":254},"src/testing/ClientRepeater.tsx":{"bytesInOutput":1851},"src/testing/withClientProvider.tsx":{"bytesInOutput":4257}},"bytes":6763},"dist/lib/browser/chunk-XT352YI6.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":9977},"dist/lib/browser/chunk-XT352YI6.mjs":{"imports":[{"path":"dist/lib/browser/chunk-CZMIVAGI.mjs","kind":"import-statement"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/client","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"exports":["ClientProvider"],"inputs":{"src/client/ClientProvider.tsx":{"bytesInOutput":3513},"src/banner.ts":{"bytesInOutput":817}},"bytes":4546},"dist/lib/browser/chunk-CZMIVAGI.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":694},"dist/lib/browser/chunk-CZMIVAGI.mjs":{"imports":[{"path":"react","kind":"import-statement","external":true}],"exports":["ClientContext"],"inputs":{"src/client/context.ts":{"bytesInOutput":82}},"bytes":180},"dist/lib/browser/worker.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":206},"dist/lib/browser/worker.mjs":{"imports":[{"path":"@dxos/client/worker","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/worker.ts","inputs":{"src/worker.ts":{"bytesInOutput":37}},"bytes":90}}}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ClientProvider
|
|
3
|
-
} from "../chunk-XT352YI6.mjs";
|
|
4
|
-
import "../chunk-CZMIVAGI.mjs";
|
|
5
|
-
|
|
6
|
-
// src/testing/index.ts
|
|
7
|
-
export * from "@dxos/client/testing";
|
|
8
|
-
|
|
9
|
-
// src/testing/context.tsx
|
|
10
|
-
import { createContext, useContext } from "react";
|
|
11
|
-
import { raise } from "@dxos/debug";
|
|
12
|
-
var ClientStory = /* @__PURE__ */ createContext(void 0);
|
|
13
|
-
var useClientStory = () => {
|
|
14
|
-
return useContext(ClientStory) ?? raise(new Error("Missing ClientStory"));
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/testing/ClientRepeater.tsx
|
|
18
|
-
import React, { useRef, useState } from "react";
|
|
19
|
-
import { Client } from "@dxos/client";
|
|
20
|
-
import { TestBuilder, performInvitation } from "@dxos/client/testing";
|
|
21
|
-
import { random } from "@dxos/random";
|
|
22
|
-
import { useAsyncEffect } from "@dxos/react-hooks";
|
|
23
|
-
var ClientRepeater = (props) => {
|
|
24
|
-
const { component: Component, controls: Controls, count = 1, types, createIdentity, createSpace, onCreateSpace } = props;
|
|
25
|
-
const [clients, setClients] = useState(props.clients ?? []);
|
|
26
|
-
const [spaceId, setSpaceId] = useState();
|
|
27
|
-
const testBuilder = useRef(new TestBuilder());
|
|
28
|
-
useAsyncEffect(async () => {
|
|
29
|
-
const clients2 = [
|
|
30
|
-
...Array(count)
|
|
31
|
-
].map((_) => new Client({
|
|
32
|
-
services: testBuilder.current.createLocalClientServices(),
|
|
33
|
-
types
|
|
34
|
-
}));
|
|
35
|
-
await Promise.all(clients2.map((client) => client.initialize()));
|
|
36
|
-
if (createIdentity || createSpace) {
|
|
37
|
-
await Promise.all(clients2.map((client) => client.halo.createIdentity()));
|
|
38
|
-
}
|
|
39
|
-
if (createSpace) {
|
|
40
|
-
const client = clients2[0];
|
|
41
|
-
const space = await client.spaces.create({
|
|
42
|
-
name: random.commerce.productName()
|
|
43
|
-
});
|
|
44
|
-
setSpaceId(space.id);
|
|
45
|
-
await onCreateSpace?.({
|
|
46
|
-
client,
|
|
47
|
-
space
|
|
48
|
-
}, {});
|
|
49
|
-
await Promise.all(clients2.slice(1).flatMap((client2) => performInvitation({
|
|
50
|
-
host: space,
|
|
51
|
-
guest: client2.spaces
|
|
52
|
-
})));
|
|
53
|
-
}
|
|
54
|
-
setClients(clients2);
|
|
55
|
-
}, []);
|
|
56
|
-
if (clients.length === 0) {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, Controls && /* @__PURE__ */ React.createElement(Controls, {
|
|
60
|
-
clients
|
|
61
|
-
}), clients.map((client, index) => /* @__PURE__ */ React.createElement(ClientProvider, {
|
|
62
|
-
key: index,
|
|
63
|
-
client
|
|
64
|
-
}, /* @__PURE__ */ React.createElement(Component, {
|
|
65
|
-
id: index,
|
|
66
|
-
count: clients.length,
|
|
67
|
-
spaceId,
|
|
68
|
-
...props.args
|
|
69
|
-
}))));
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// src/testing/withClientProvider.tsx
|
|
73
|
-
import React2, { useCallback, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
74
|
-
import { Trigger } from "@dxos/async";
|
|
75
|
-
import { TestBuilder as TestBuilder2, performInvitation as performInvitation2 } from "@dxos/client/testing";
|
|
76
|
-
import { log } from "@dxos/log";
|
|
77
|
-
import { ErrorBoundary } from "@dxos/react-ui";
|
|
78
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/testing/withClientProvider.tsx";
|
|
79
|
-
var initializeClient = async (client, { createIdentity, createSpace, onCreateIdentity, onCreateSpace, onInitialized }, context) => {
|
|
80
|
-
await onInitialized?.(client);
|
|
81
|
-
if (createIdentity || createSpace) {
|
|
82
|
-
if (!client.halo.identity.get()) {
|
|
83
|
-
await client.halo.createIdentity();
|
|
84
|
-
await onCreateIdentity?.({
|
|
85
|
-
client
|
|
86
|
-
}, context);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
let space;
|
|
90
|
-
if (createSpace) {
|
|
91
|
-
space = await client.spaces.create({
|
|
92
|
-
name: "Test Space"
|
|
93
|
-
});
|
|
94
|
-
await space.waitUntilReady();
|
|
95
|
-
await onCreateSpace?.({
|
|
96
|
-
client,
|
|
97
|
-
space
|
|
98
|
-
}, context);
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
space,
|
|
102
|
-
spaceId: space?.id
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
var withClientProvider = ({ createIdentity, createSpace, onCreateSpace, onCreateIdentity, onInitialized, ...props } = {}) => {
|
|
106
|
-
return (Story, context) => {
|
|
107
|
-
const [data, setData] = useState2({});
|
|
108
|
-
const handleInitialized = async (client) => {
|
|
109
|
-
const data2 = await initializeClient(client, {
|
|
110
|
-
createIdentity,
|
|
111
|
-
createSpace,
|
|
112
|
-
onCreateSpace,
|
|
113
|
-
onCreateIdentity,
|
|
114
|
-
onInitialized
|
|
115
|
-
}, context);
|
|
116
|
-
setData(data2);
|
|
117
|
-
};
|
|
118
|
-
return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
119
|
-
name: "client-provider"
|
|
120
|
-
}, /* @__PURE__ */ React2.createElement(ClientProvider, {
|
|
121
|
-
onInitialized: handleInitialized,
|
|
122
|
-
...props
|
|
123
|
-
}, /* @__PURE__ */ React2.createElement(ClientStory.Provider, {
|
|
124
|
-
value: data
|
|
125
|
-
}, /* @__PURE__ */ React2.createElement(Story, null))));
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
var withMultiClientProvider = ({ numClients = 2, createIdentity, createSpace, onCreateSpace, onCreateIdentity, onInitialized, ...props }) => {
|
|
129
|
-
return (Story, context) => {
|
|
130
|
-
const spaceReady = useRef2(new Trigger());
|
|
131
|
-
const [spaceId, setSpaceId] = useState2();
|
|
132
|
-
const clients = useMemo(() => {
|
|
133
|
-
const buidler = new TestBuilder2();
|
|
134
|
-
return Array.from({
|
|
135
|
-
length: numClients
|
|
136
|
-
}).map(() => {
|
|
137
|
-
return {
|
|
138
|
-
services: buidler.createLocalClientServices()
|
|
139
|
-
};
|
|
140
|
-
});
|
|
141
|
-
}, [
|
|
142
|
-
numClients
|
|
143
|
-
]);
|
|
144
|
-
const handleInitialized = useCallback(async (client, index) => {
|
|
145
|
-
if (index === 0) {
|
|
146
|
-
const { space } = await initializeClient(client, {
|
|
147
|
-
createIdentity,
|
|
148
|
-
createSpace,
|
|
149
|
-
onCreateSpace,
|
|
150
|
-
onCreateIdentity,
|
|
151
|
-
onInitialized
|
|
152
|
-
}, context);
|
|
153
|
-
log.info("inviting", {
|
|
154
|
-
index,
|
|
155
|
-
spaceId: space?.id
|
|
156
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 95, S: void 0 });
|
|
157
|
-
setSpaceId(space?.id);
|
|
158
|
-
spaceReady.current.wake(space);
|
|
159
|
-
} else {
|
|
160
|
-
await initializeClient(client, {
|
|
161
|
-
createIdentity,
|
|
162
|
-
onInitialized
|
|
163
|
-
}, context);
|
|
164
|
-
log.info("waiting", {
|
|
165
|
-
index
|
|
166
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 107, S: void 0 });
|
|
167
|
-
const space = await spaceReady.current.wait();
|
|
168
|
-
if (space) {
|
|
169
|
-
log.info("joining", {
|
|
170
|
-
index,
|
|
171
|
-
spaceId: space.id
|
|
172
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 112, S: void 0 });
|
|
173
|
-
await Promise.all(performInvitation2({
|
|
174
|
-
host: space,
|
|
175
|
-
guest: client.spaces
|
|
176
|
-
}));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, []);
|
|
180
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
181
|
-
className: "absolute inset-0 grid grid-flow-col auto-cols-fr gap-4 overflow-hidden"
|
|
182
|
-
}, clients.map((client, index) => /* @__PURE__ */ React2.createElement(ClientProvider, {
|
|
183
|
-
key: index,
|
|
184
|
-
services: client.services,
|
|
185
|
-
onInitialized: (client2) => handleInitialized(client2, index),
|
|
186
|
-
...props
|
|
187
|
-
}, /* @__PURE__ */ React2.createElement(ClientStory.Provider, {
|
|
188
|
-
value: {
|
|
189
|
-
index,
|
|
190
|
-
spaceId
|
|
191
|
-
}
|
|
192
|
-
}, /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
193
|
-
name: "client-provider"
|
|
194
|
-
}, /* @__PURE__ */ React2.createElement(Story, null))))));
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
export {
|
|
198
|
-
ClientRepeater,
|
|
199
|
-
ClientStory,
|
|
200
|
-
useClientStory,
|
|
201
|
-
withClientProvider,
|
|
202
|
-
withMultiClientProvider
|
|
203
|
-
};
|
|
204
|
-
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/index.ts", "../../../../src/testing/context.tsx", "../../../../src/testing/ClientRepeater.tsx", "../../../../src/testing/withClientProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/testing';\n\nexport * from './context';\nexport * from './ClientRepeater';\nexport * from './withClientProvider';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { type Space } from '@dxos/client/echo';\nimport { raise } from '@dxos/debug';\nimport { type SpaceId } from '@dxos/keys';\n\nexport type ClientStory = {\n index?: number;\n spaceId?: SpaceId;\n space?: Space;\n};\n\nexport const ClientStory = createContext<ClientStory | undefined>(undefined);\n\nexport const useClientStory = (): ClientStory => {\n return useContext(ClientStory) ?? raise(new Error('Missing ClientStory'));\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { type FC, useRef, useState } from 'react';\n\nimport { Client } from '@dxos/client';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { type Type } from '@dxos/echo';\nimport { type SpaceId } from '@dxos/keys';\nimport { random } from '@dxos/random';\nimport { useAsyncEffect } from '@dxos/react-hooks';\n\nimport { ClientProvider } from '../client';\nimport { type WithClientProviderProps } from './withClientProvider';\n\nexport type ClientRepeatedComponentProps = { id: number; count: number; spaceId?: SpaceId };\n\nexport type ClientRepeaterControlsProps = { clients: Client[] };\n\n// TODO(burdon): Reconcile with ClientProviderProps.\nexport type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {\n className?: string;\n component: FC<ClientRepeatedComponentProps>;\n controls?: FC<ClientRepeaterControlsProps>;\n count?: number;\n clients?: Client[];\n types?: Type.AnyObj[];\n args?: Omit<P, 'id' | 'count'>;\n} & Pick<WithClientProviderProps, 'createIdentity' | 'createSpace' | 'onCreateSpace'>;\n\n/**\n * Utility component for Storybook stories which sets up clients for n peers.\n * The `Component` property is rendered n times, once for each peer.\n * @deprecated use `withClientProvider`.\n */\n// TODO(burdon): To discuss: evolve ClientRepeater with optional decorator that uses it.\n// NOTE: This is specifically not a storybook decorator because it broke stories as a decorator.\n// This seems primarily due to the fact that it required top-level await for the clients to initialize.\n// Storybook seemed to handle it alright, but Chromatic had a lot of trouble with it.\n// There was also a question of whether or not calling the story function multiple times was a good idea.\nexport const ClientRepeater = <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => {\n const {\n component: Component,\n controls: Controls,\n count = 1,\n types,\n createIdentity,\n createSpace,\n onCreateSpace,\n } = props;\n\n const [clients, setClients] = useState(props.clients ?? []);\n const [spaceId, setSpaceId] = useState<SpaceId>();\n\n const testBuilder = useRef(new TestBuilder());\n useAsyncEffect(async () => {\n const clients = [...Array(count)].map(\n (_) => new Client({ services: testBuilder.current.createLocalClientServices(), types }),\n );\n\n await Promise.all(clients.map((client) => client.initialize()));\n if (createIdentity || createSpace) {\n await Promise.all(clients.map((client) => client.halo.createIdentity()));\n }\n\n if (createSpace) {\n const client = clients[0];\n const space = await client.spaces.create({ name: random.commerce.productName() });\n setSpaceId(space.id);\n await onCreateSpace?.({ client, space }, {});\n await Promise.all(clients.slice(1).flatMap((client) => performInvitation({ host: space, guest: client.spaces })));\n }\n\n setClients(clients);\n }, []);\n\n if (clients.length === 0) {\n return null;\n }\n\n return (\n <>\n {Controls && <Controls clients={clients} />}\n {clients.map((client, index) => (\n <ClientProvider key={index} client={client}>\n <Component id={index} count={clients.length} spaceId={spaceId} {...{ ...props.args }} />\n </ClientProvider>\n ))}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { Trigger } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { type SpaceId } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { ErrorBoundary } from '@dxos/react-ui';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { ClientProvider, type ClientProviderProps } from '../client';\nimport { ClientStory } from './context';\n\ntype InitializeProps = {\n createIdentity?: boolean;\n createSpace?: boolean;\n onInitialized?: (client: Client) => MaybePromise<void>;\n onCreateIdentity?: (props: { client: Client }, context: StoryContext | any) => MaybePromise<void>;\n // NOTE: context must be untyped until ClientRepeater is removed.\n onCreateSpace?: (props: { client: Client; space: Space }, context: StoryContext | any) => MaybePromise<void>;\n};\n\n/**\n * Initialize client, identity and first space.\n */\nconst initializeClient = async (\n client: Client,\n { createIdentity, createSpace, onCreateIdentity, onCreateSpace, onInitialized }: InitializeProps,\n context: StoryContext,\n): Promise<ClientStory> => {\n await onInitialized?.(client);\n\n if (createIdentity || createSpace) {\n if (!client.halo.identity.get()) {\n await client.halo.createIdentity();\n await onCreateIdentity?.({ client }, context);\n }\n }\n\n let space: Space | undefined;\n if (createSpace) {\n space = await client.spaces.create({ name: 'Test Space' });\n await space.waitUntilReady(); // Is this required?\n await onCreateSpace?.({ client, space }, context);\n }\n\n return { space, spaceId: space?.id };\n};\n\nexport type WithClientProviderProps = InitializeProps & Omit<ClientProviderProps, 'onInitialized'>;\n\n/**\n * Decorator that provides the client context.\n */\nexport const withClientProvider = ({\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n ...props\n}: WithClientProviderProps = {}): Decorator => {\n return (Story, context) => {\n const [data, setData] = useState<ClientStory>({});\n const handleInitialized = async (client: Client) => {\n const data = await initializeClient(\n client,\n {\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n },\n context,\n );\n\n setData(data);\n };\n\n return (\n <ErrorBoundary name='client-provider'>\n <ClientProvider onInitialized={handleInitialized} {...props}>\n <ClientStory.Provider value={data}>\n <Story />\n </ClientStory.Provider>\n </ClientProvider>\n </ErrorBoundary>\n );\n };\n};\n\n// TODO(burdon): Implement context per client for context.\n// TODO(burdon): Callback once all invitations have completed.\n// TODO(burdon): Delay/jitter for creation of other clients.\nexport type WithMultiClientProviderProps = InitializeProps &\n Omit<ClientProviderProps, 'onInitialized'> & { numClients?: number };\n\n/**\n * Decorator that creates a scaffold for multiple clients.\n * Orchestrates invitations between a randomly selected host and the remaining clients.\n */\nexport const withMultiClientProvider = ({\n numClients = 2,\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n ...props\n}: WithMultiClientProviderProps): Decorator => {\n return (Story, context) => {\n const spaceReady = useRef(new Trigger<Space | undefined>());\n const [spaceId, setSpaceId] = useState<SpaceId>();\n\n const clients = useMemo(() => {\n const buidler = new TestBuilder();\n return Array.from({ length: numClients }).map(() => {\n return {\n services: buidler.createLocalClientServices(),\n };\n });\n }, [numClients]);\n\n // Handle invitations.\n // NOTE: The zeroth client isn't necessarily the first to be initialized.\n const handleInitialized = useCallback(async (client: Client, index: number) => {\n if (index === 0) {\n // Initialize host.\n const { space } = await initializeClient(\n client,\n {\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n },\n context,\n );\n\n log.info('inviting', { index, spaceId: space?.id });\n setSpaceId(space?.id);\n spaceReady.current.wake(space);\n } else {\n // Initialize guest.\n await initializeClient(client, { createIdentity, onInitialized }, context);\n\n log.info('waiting', { index });\n const space = await spaceReady.current.wait();\n if (space) {\n log.info('joining', { index, spaceId: space.id });\n await Promise.all(\n performInvitation({\n host: space,\n guest: client.spaces,\n }),\n );\n }\n }\n }, []);\n\n return (\n <div className='absolute inset-0 grid grid-flow-col auto-cols-fr gap-4 overflow-hidden'>\n {clients.map((client, index) => (\n <ClientProvider\n key={index}\n services={client.services}\n onInitialized={(client) => handleInitialized(client, index)}\n {...props}\n >\n <ClientStory.Provider value={{ index, spaceId }}>\n <ErrorBoundary name='client-provider'>\n <Story />\n </ErrorBoundary>\n </ClientStory.Provider>\n </ClientProvider>\n ))}\n </div>\n );\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,cAAc;;;ACAd,SAASA,eAAeC,kBAAkB;AAG1C,SAASC,aAAa;AASf,IAAMC,cAAcH,8BAAuCI,MAAAA;AAE3D,IAAMC,iBAAiB,MAAA;AAC5B,SAAOJ,WAAWE,WAAAA,KAAgBD,MAAM,IAAII,MAAM,qBAAA,CAAA;AACpD;;;AChBA,OAAOC,SAAkBC,QAAQC,gBAAgB;AAEjD,SAASC,cAAc;AACvB,SAASC,aAAaC,yBAAyB;AAG/C,SAASC,cAAc;AACvB,SAASC,sBAAsB;AA8BxB,IAAMC,iBAAiB,CAAyCC,UAAAA;AACrE,QAAM,EACJC,WAAWC,WACXC,UAAUC,UACVC,QAAQ,GACRC,OACAC,gBACAC,aACAC,cAAa,IACX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OA;eACLF,IAAAA,CAAAA,QAAUzB,UAAe,gBAAAW,OAAA,cAAA,gBAAA;MACzBF,KAAAA;MACC,UAAQ,OAAA;qBAET,CAAAT,YAAA,kBAACoC,SAAYC,KAAQ;MAACxB,GAAAA;OAASc,gBAAAA,OAAAA,cAAAA,YAAAA,UAAAA;aAAOxB;QAAQ;;MAC7BmC;OACb,gBAAA3B,OAAA,cAACG,eAAAA;MAOf,MAAA;IACA,GAAA,gBAAAH,OAAA,cAAA,OAAA,IAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;",
|
|
6
|
-
"names": ["createContext", "useContext", "raise", "ClientStory", "undefined", "useClientStory", "Error", "React", "useRef", "useState", "Client", "TestBuilder", "performInvitation", "random", "useAsyncEffect", "ClientRepeater", "props", "component", "Component", "controls", "Controls", "count", "types", "createIdentity", "createSpace", "onCreateSpace", "clients", "setClients", "useState", "spaceId", "setSpaceId", "testBuilder", "useRef", "TestBuilder", "useAsyncEffect", "Array", "map", "_", "Client", "services", "current", "createLocalClientServices", "Promise", "all", "client", "initialize", "halo", "space", "spaces", "create", "name", "random", "commerce", "productName", "id", "slice", "flatMap", "performInvitation", "host", "guest", "length", "index", "ClientProvider", "key", "args", "React", "useCallback", "useMemo", "useRef", "useState", "Trigger", "TestBuilder", "performInvitation", "log", "ErrorBoundary", "createIdentity", "createSpace", "identity", "halo", "onCreateIdentity", "client", "context", "space", "spaceId", "data", "useState", "handleInitialized", "initializeClient", "onCreateSpace", "onInitialized", "setData", "React", "ClientProvider", "value", "Story", "spaceReady", "Trigger", "setSpaceId", "clients", "useMemo", "buidler", "TestBuilder", "Array", "length", "numClients", "services", "info", "index", "id", "current", "log", "Promise", "performInvitation", "guest", "spaces", "className", "ClientStory", "Provider", "name"]
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ClientContext
|
|
4
|
-
} from "./chunk-WUTK2IJF.mjs";
|
|
5
|
-
|
|
6
|
-
// src/client/useClient.ts
|
|
7
|
-
import { useContext } from "react";
|
|
8
|
-
import { raise } from "@dxos/debug";
|
|
9
|
-
var useClient = () => {
|
|
10
|
-
const { client } = useContext(ClientContext) ?? raise(new Error("Missing ClientContext."));
|
|
11
|
-
return client;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
useClient
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=chunk-CUDKNAMV.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/client/useClient.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { ClientContext } from '../client/context';\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"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,kBAAkB;AAE3B,SAASC,aAAa;AAQf,IAAMC,YAAY,MAAA;AACvB,QAAM,EAAEC,OAAM,IAAKC,WAAWC,aAAAA,KAAkBC,MAAM,IAAIC,MAAM,wBAAA,CAAA;AAChE,SAAOJ;AACT;",
|
|
6
|
-
"names": ["useContext", "raise", "useClient", "client", "useContext", "ClientContext", "raise", "Error"]
|
|
7
|
-
}
|