@dxos/react-client 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
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/dist/lib/browser/{chunk-LVTCEDI2.mjs → chunk-U4MCIYKN.mjs} +49 -68
- package/dist/lib/browser/chunk-U4MCIYKN.mjs.map +7 -0
- package/dist/lib/browser/devtools/index.mjs +1 -1
- package/dist/lib/browser/devtools/index.mjs.map +1 -1
- package/dist/lib/browser/echo/index.mjs +1 -1
- package/dist/lib/browser/halo/index.mjs +7 -15
- package/dist/lib/browser/halo/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/mesh/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-Y2HFUT7P.cjs → chunk-UJLDNXPC.cjs} +52 -71
- package/dist/lib/node/chunk-UJLDNXPC.cjs.map +7 -0
- package/dist/lib/node/devtools/index.cjs +2 -2
- package/dist/lib/node/devtools/index.cjs.map +1 -1
- package/dist/lib/node/echo/index.cjs +3 -3
- package/dist/lib/node/halo/index.cjs +9 -16
- package/dist/lib/node/halo/index.cjs.map +4 -4
- package/dist/lib/node/index.cjs +12 -12
- package/dist/lib/node/mesh/index.cjs +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +4 -4
- package/dist/lib/node-esm/{chunk-MXY3GJGN.mjs → chunk-4J4SI7XJ.mjs} +49 -68
- package/dist/lib/node-esm/chunk-4J4SI7XJ.mjs.map +7 -0
- package/dist/lib/node-esm/devtools/index.mjs +1 -1
- package/dist/lib/node-esm/devtools/index.mjs.map +1 -1
- package/dist/lib/node-esm/echo/index.mjs +1 -1
- package/dist/lib/node-esm/halo/index.mjs +7 -15
- package/dist/lib/node-esm/halo/index.mjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/mesh/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/client/ClientProvider.d.ts.map +1 -1
- package/dist/types/src/devtools/useStream.d.ts +1 -1
- package/dist/types/src/devtools/useStream.d.ts.map +1 -1
- package/dist/types/src/halo/index.d.ts +0 -1
- package/dist/types/src/halo/index.d.ts.map +1 -1
- package/package.json +23 -23
- package/src/client/ClientProvider.test.tsx +2 -3
- package/src/client/ClientProvider.tsx +20 -35
- package/src/devtools/useStream.ts +1 -1
- package/src/halo/index.ts +0 -1
- package/dist/lib/browser/chunk-LVTCEDI2.mjs.map +0 -7
- package/dist/lib/node/chunk-Y2HFUT7P.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-MXY3GJGN.mjs.map +0 -7
- package/dist/types/src/halo/Passkey.stories.d.ts +0 -11
- package/dist/types/src/halo/Passkey.stories.d.ts.map +0 -1
- package/dist/types/src/halo/useCredentials.d.ts +0 -3
- package/dist/types/src/halo/useCredentials.d.ts.map +0 -1
- package/src/halo/Passkey.stories.tsx +0 -125
- package/src/halo/useCredentials.ts +0 -13
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_UJLDNXPC_exports = {};
|
|
30
|
+
__export(chunk_UJLDNXPC_exports, {
|
|
31
31
|
AgentHostingContext: () => AgentHostingContext,
|
|
32
32
|
AgentHostingProvider: () => AgentHostingProvider,
|
|
33
33
|
ClientContext: () => ClientContext,
|
|
@@ -40,7 +40,7 @@ __export(chunk_Y2HFUT7P_exports, {
|
|
|
40
40
|
useShellDisplay: () => useShellDisplay,
|
|
41
41
|
useStatus: () => useStatus
|
|
42
42
|
});
|
|
43
|
-
module.exports = __toCommonJS(
|
|
43
|
+
module.exports = __toCommonJS(chunk_UJLDNXPC_exports);
|
|
44
44
|
var import_react = __toESM(require("react"));
|
|
45
45
|
var import_client = require("@dxos/client");
|
|
46
46
|
var import_log = require("@dxos/log");
|
|
@@ -106,24 +106,19 @@ var ClientProvider = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children,
|
|
|
106
106
|
client
|
|
107
107
|
]);
|
|
108
108
|
(0, import_react2.useEffect)(() => {
|
|
109
|
-
let disposed = false;
|
|
110
109
|
const initialize = async (client3) => {
|
|
111
110
|
if (!client3.initialized) {
|
|
112
|
-
await client3.initialize().catch(
|
|
113
|
-
if (!disposed) {
|
|
114
|
-
setError(err);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
111
|
+
await client3.initialize().catch(setError);
|
|
117
112
|
(0, import_log2.log)("client ready", void 0, {
|
|
118
113
|
F: __dxlog_file,
|
|
119
|
-
L:
|
|
114
|
+
L: 132,
|
|
120
115
|
S: void 0,
|
|
121
116
|
C: (f, a) => f(...a)
|
|
122
117
|
});
|
|
123
118
|
await onInitialized?.(client3);
|
|
124
119
|
(0, import_log2.log)("initialization complete", void 0, {
|
|
125
120
|
F: __dxlog_file,
|
|
126
|
-
L:
|
|
121
|
+
L: 134,
|
|
127
122
|
S: void 0,
|
|
128
123
|
C: (f, a) => f(...a)
|
|
129
124
|
});
|
|
@@ -135,77 +130,63 @@ var ClientProvider = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children,
|
|
|
135
130
|
};
|
|
136
131
|
let client2;
|
|
137
132
|
const t = setTimeout(async () => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
await initialize(client2);
|
|
173
|
-
}
|
|
174
|
-
} catch (err) {
|
|
175
|
-
if (!disposed) {
|
|
176
|
-
import_log2.log.catch(err, void 0, {
|
|
177
|
-
F: __dxlog_file,
|
|
178
|
-
L: 168,
|
|
179
|
-
S: void 0,
|
|
180
|
-
C: (f, a) => f(...a)
|
|
181
|
-
});
|
|
182
|
-
}
|
|
133
|
+
if (clientProvider) {
|
|
134
|
+
client2 = await (0, import_util.getAsyncProviderValue)(clientProvider);
|
|
135
|
+
await initialize(client2);
|
|
136
|
+
} else {
|
|
137
|
+
const config = await (0, import_util.getAsyncProviderValue)(configProvider);
|
|
138
|
+
(0, import_log2.log)("resolved config", {
|
|
139
|
+
config
|
|
140
|
+
}, {
|
|
141
|
+
F: __dxlog_file,
|
|
142
|
+
L: 153,
|
|
143
|
+
S: void 0,
|
|
144
|
+
C: (f, a) => f(...a)
|
|
145
|
+
});
|
|
146
|
+
const services = await (0, import_util.getAsyncProviderValue)(servicesProvider, config);
|
|
147
|
+
(0, import_log2.log)("created services", {
|
|
148
|
+
services
|
|
149
|
+
}, {
|
|
150
|
+
F: __dxlog_file,
|
|
151
|
+
L: 155,
|
|
152
|
+
S: void 0,
|
|
153
|
+
C: (f, a) => f(...a)
|
|
154
|
+
});
|
|
155
|
+
client2 = new import_client2.Client({
|
|
156
|
+
config,
|
|
157
|
+
services,
|
|
158
|
+
...options
|
|
159
|
+
});
|
|
160
|
+
(0, import_log2.log)("created client", void 0, {
|
|
161
|
+
F: __dxlog_file,
|
|
162
|
+
L: 157,
|
|
163
|
+
S: void 0,
|
|
164
|
+
C: (f, a) => f(...a)
|
|
165
|
+
});
|
|
166
|
+
await initialize(client2);
|
|
183
167
|
}
|
|
184
168
|
});
|
|
185
169
|
return () => {
|
|
186
170
|
(0, import_log2.log)("clean up", void 0, {
|
|
187
171
|
F: __dxlog_file,
|
|
188
|
-
L:
|
|
172
|
+
L: 163,
|
|
189
173
|
S: void 0,
|
|
190
174
|
C: (f, a) => f(...a)
|
|
191
175
|
});
|
|
192
|
-
disposed = true;
|
|
193
176
|
clearTimeout(t);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
(0, import_log2.log)("destroyed", void 0, {
|
|
197
|
-
F: __dxlog_file,
|
|
198
|
-
L: 182,
|
|
199
|
-
S: void 0,
|
|
200
|
-
C: (f, a) => f(...a)
|
|
201
|
-
});
|
|
202
|
-
}).catch((err) => import_log2.log.catch(err, void 0, {
|
|
177
|
+
void client2?.destroy().then(() => {
|
|
178
|
+
(0, import_log2.log)("destroyed", void 0, {
|
|
203
179
|
F: __dxlog_file,
|
|
204
|
-
L:
|
|
180
|
+
L: 168,
|
|
205
181
|
S: void 0,
|
|
206
182
|
C: (f, a) => f(...a)
|
|
207
|
-
})
|
|
208
|
-
}
|
|
183
|
+
});
|
|
184
|
+
}).catch((err) => import_log2.log.catch(err, void 0, {
|
|
185
|
+
F: __dxlog_file,
|
|
186
|
+
L: 170,
|
|
187
|
+
S: void 0,
|
|
188
|
+
C: (f, a) => f(...a)
|
|
189
|
+
}));
|
|
209
190
|
};
|
|
210
191
|
}, [
|
|
211
192
|
configProvider,
|
|
@@ -331,4 +312,4 @@ var makeClient = ({ config, halo }) => {
|
|
|
331
312
|
useShellDisplay,
|
|
332
313
|
useStatus
|
|
333
314
|
});
|
|
334
|
-
//# sourceMappingURL=chunk-
|
|
315
|
+
//# sourceMappingURL=chunk-UJLDNXPC.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/client/AgentHostingProvider.tsx", "../../../src/client/ClientProvider.tsx", "../../../src/client/context.ts", "../../../src/banner.ts", "../../../src/client/useClient.ts", "../../../src/client/useClientStatus.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\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 2020 DXOS.org\n//\n\nimport React, {\n forwardRef,\n type FunctionComponent,\n type PropsWithChildren,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\n\nimport { Client, type ClientOptions, type ClientServicesProvider, SystemStatus } from '@dxos/client';\nimport { type Config } from '@dxos/config';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { log } from '@dxos/log';\nimport { useControlledValue } from '@dxos/react-hooks';\nimport { getAsyncProviderValue, type MaybePromise, type Provider } from '@dxos/util';\n\nimport { ClientContext, type ClientContextProps } from './context';\nimport { printBanner } from '../banner';\n\n/**\n * Properties for the ClientProvider.\n */\nexport type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> &\n Pick<ClientContextProps, 'status'> &\n PropsWithChildren<{\n /**\n * Client object or async provider to enable to caller to do custom initialization.\n *\n * NOTE: For advanced use cases only.\n */\n client?: Client | Provider<Promise<Client>>;\n\n /**\n * Config object or async provider.\n *\n * NOTE: If a `client` is provided then `config` is ignored.\n */\n // TODO(burdon): Reconcile with ClientOptions.\n config?: Config | Provider<Promise<Config>>;\n\n /**\n * Callback to enable the caller to create a custom ClientServicesProvider.\n *\n * NOTE: If a `client` is provided then `services` is ignored.\n */\n // TODO(burdon): Reconcile with ClientOptions.\n services?: ClientServicesProvider | ((config?: Config) => MaybePromise<ClientServicesProvider>);\n\n /**\n * ReactNode to display until the client is available.\n */\n fallback?: FunctionComponent<Partial<ClientContextProps>>;\n\n /**\n * Enable (by default) registration of Preact signals runtime for reactive ECHO objects.\n * @see https://www.npmjs.com/package/@preact/signals-react\n */\n signalsRuntime?: boolean;\n\n /**\n * Skip the DXOS banner.\n */\n noBanner?: boolean;\n\n /**\n * Post initialization hook to enable to caller to do custom initialization.\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 = forwardRef<Client | undefined, ClientProviderProps>(\n (\n {\n children,\n config: configProvider,\n client: clientProvider,\n services: servicesProvider,\n status: controlledStatus,\n fallback: Fallback = () => null,\n signalsRuntime = true,\n noBanner,\n onInitialized,\n ...options\n },\n forwardedRef,\n ) => {\n useEffect(() => {\n // TODO(wittjosiah): Ideally this should be imported asynchronously because it is optional.\n // Unfortunately, async import seemed to break signals React instrumentation.\n signalsRuntime && registerSignalsRuntime();\n }, []);\n\n // The client is initialized asynchronously.\n // If an error occurs during initialization, it is caught and the state is set.\n // This allows the error to be thrown in the render method.\n // The assumption is that a client initialization error is fatal to the app.\n // This error will be caught by the nearest error boundary.\n const [error, setError] = useState();\n if (error) {\n throw error;\n }\n\n const [client, setClient] = useState(clientProvider instanceof Client ? clientProvider : undefined);\n\n // Provide external access.\n useImperativeHandle(forwardedRef, () => client, [client]);\n\n // Client status subscription.\n const [status, setStatus] = useControlledValue(controlledStatus);\n useEffect(() => {\n if (!client) {\n return;\n }\n\n const subscription = client.status.subscribe((status) => setStatus(status));\n return () => subscription.unsubscribe();\n }, [client]);\n\n // Create and/or initialize client.\n useEffect(() => {\n const initialize = async (client: Client) => {\n if (!client.initialized) {\n await client.initialize().catch(setError);\n log('client ready');\n await onInitialized?.(client);\n log('initialization complete');\n }\n\n setClient(client);\n\n if (!noBanner) {\n printBanner(client);\n }\n };\n\n let client: Client;\n const t = setTimeout(async () => {\n if (clientProvider) {\n // Asynchronously request client.\n client = await getAsyncProviderValue(clientProvider);\n await initialize(client);\n } else {\n // Asynchronously construct client (config may be undefined).\n const config = await getAsyncProviderValue(configProvider);\n log('resolved config', { config });\n const services = await getAsyncProviderValue(servicesProvider, config);\n log('created services', { services });\n client = new Client({ config, services, ...options });\n log('created client');\n await initialize(client);\n }\n });\n\n return () => {\n log('clean up');\n clearTimeout(t);\n void client\n ?.destroy()\n .then(() => {\n log('destroyed');\n })\n .catch((err) => log.catch(err));\n };\n }, [configProvider, clientProvider, servicesProvider, noBanner]);\n\n if (!client?.initialized || status !== SystemStatus.ACTIVE) {\n return <Fallback client={client} status={status} />;\n }\n\n return <ClientContext.Provider value={{ client, status }}>{children}</ClientContext.Provider>;\n },\n);\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Context, createContext } from 'react';\n\nimport { type Client, type SystemStatus } from '@dxos/client';\n\nexport type ClientContextProps = {\n client: Client;\n status?: SystemStatus | null;\n};\n\n/**\n * @internal Use ClientProvider to create or initialize the Client.\n */\nexport const ClientContext: Context<ClientContextProps | undefined> = createContext<ClientContextProps | undefined>(\n undefined,\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 || window.location.hostname === 'localhost') {\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 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", "//\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": ";;;;;;;;;;;;;;;;;;;;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,0CAA0C8C,mBAAmBC,MAAI,QAAA;;;;;;AAC3E,aAAO;IACT;EACF;AACF;",
|
|
6
|
+
"names": ["import_react", "import_client", "import_log", "import_debug", "ClientContext", "createContext", "undefined", "BANNER", "client", "commitHash", "config", "get", "hash", "version", "bannerPrinted", "printBanner", "window", "location", "hostname", "console", "log", "ClientProvider", "forwardRef", "children", "configProvider", "clientProvider", "services", "servicesProvider", "status", "controlledStatus", "fallback", "Fallback", "signalsRuntime", "noBanner", "onInitialized", "options", "forwardedRef", "useEffect", "registerSignalsRuntime", "error", "setError", "useState", "setClient", "Client", "useImperativeHandle", "setStatus", "useControlledValue", "subscription", "subscribe", "unsubscribe", "initialize", "initialized", "catch", "t", "setTimeout", "getAsyncProviderValue", "clearTimeout", "destroy", "then", "err", "SystemStatus", "ACTIVE", "React", "Provider", "value", "useClient", "useContext", "raise", "Error", "useClientStatus", "useConfig", "useShell", "shell", "useShellDisplay", "display", "setDisplay", "onDisplayChange", "useStatus", "AgentHostingContext", "AgentHostingProvider", "props", "agentHostingProviderClient", "makeClient", "useAgentHostingClient", "halo", "agentHostingConfig", "type", "FakeAgentHostingProvider", "AgentManagerClient", "init"]
|
|
7
|
+
}
|
|
@@ -23,13 +23,13 @@ __export(devtools_exports, {
|
|
|
23
23
|
useStream: () => useStream
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(devtools_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_chunk_UJLDNXPC = require("../chunk-UJLDNXPC.cjs");
|
|
27
27
|
__reExport(devtools_exports, require("@dxos/client/devtools"), module.exports);
|
|
28
28
|
var import_debug = require("@dxos/debug");
|
|
29
29
|
var import_react = require("react");
|
|
30
30
|
var import_log = require("@dxos/log");
|
|
31
31
|
var useDevtools = () => {
|
|
32
|
-
const client = (0,
|
|
32
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
33
33
|
return client.services.services.DevtoolsHost ?? (0, import_debug.raise)(new Error("DevtoolsHost not available."));
|
|
34
34
|
};
|
|
35
35
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/react-client/src/devtools/useStream.ts";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/devtools/index.ts", "../../../../src/devtools/useDevtools.ts", "../../../../src/devtools/useStream.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/client/devtools';\n\nexport * from './useDevtools';\nexport * from './useStream';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type DevtoolsHost } from '@dxos/client/devtools';\nimport { raise } from '@dxos/debug';\n\nimport { useClient } from '../client';\n\nexport const useDevtools = (): DevtoolsHost => {\n const client = useClient();\n return client.services.services.DevtoolsHost ?? raise(new Error('DevtoolsHost not available.'));\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type DependencyList, useState, useEffect } from 'react';\n\nimport { type Stream } from '@dxos/codec-protobuf
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/client/devtools';\n\nexport * from './useDevtools';\nexport * from './useStream';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { type DevtoolsHost } from '@dxos/client/devtools';\nimport { raise } from '@dxos/debug';\n\nimport { useClient } from '../client';\n\nexport const useDevtools = (): DevtoolsHost => {\n const client = useClient();\n return client.services.services.DevtoolsHost ?? raise(new Error('DevtoolsHost not available.'));\n};\n", "//\n// Copyright 2021 DXOS.org\n//\n\nimport { type DependencyList, useState, useEffect } from 'react';\n\nimport { type Stream } from '@dxos/codec-protobuf';\nimport { log } from '@dxos/log';\n\n/**\n * Subscribe to service API streams.\n */\nexport const useStream = <T>(streamFactory: () => Stream<T>, defaultValue: T, deps: DependencyList = []): T => {\n const [value, setValue] = useState<T | undefined>(defaultValue);\n useEffect(() => {\n const stream = streamFactory();\n stream.subscribe(\n (response: T) => setValue(response),\n (err) => {\n if (err) {\n log.catch(err);\n }\n },\n );\n\n return () => {\n void stream.close();\n };\n }, deps);\n\n return value ?? defaultValue;\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,6BAAc;ACCd,mBAAsB;ACDtB,mBAAyD;AAGzD,iBAAoB;ADEb,IAAMA,cAAc,MAAA;AACzB,QAAMC,aAASC,iCAAAA;AACf,SAAOD,OAAOE,SAASA,SAASC,oBAAgBC,oBAAM,IAAIC,MAAM,6BAAA,CAAA;AAClE;;ACAO,IAAMC,YAAY,CAAIC,eAAgCC,cAAiBC,OAAuB,CAAA,MAAE;AACrG,QAAM,CAACC,OAAOC,QAAAA,QAAYC,uBAAwBJ,YAAAA;AAClDK,8BAAU,MAAA;AACR,UAAMC,SAASP,cAAAA;AACfO,WAAOC,UACL,CAACC,aAAgBL,SAASK,QAAAA,GAC1B,CAACC,QAAAA;AACC,UAAIA,KAAK;AACPC,uBAAIC,MAAMF,KAAAA,QAAAA;;;;;;MACZ;IACF,CAAA;AAGF,WAAO,MAAA;AACL,WAAKH,OAAOM,MAAK;IACnB;EACF,GAAGX,IAAAA;AAEH,SAAOC,SAASF;AAClB;",
|
|
6
6
|
"names": ["useDevtools", "client", "useClient", "services", "DevtoolsHost", "raise", "Error", "useStream", "streamFactory", "defaultValue", "deps", "value", "setValue", "useState", "useEffect", "stream", "subscribe", "response", "err", "log", "catch", "close"]
|
|
7
7
|
}
|
|
@@ -29,7 +29,7 @@ __export(echo_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(echo_exports);
|
|
31
31
|
var import_chunk_FYOAVV65 = require("../chunk-FYOAVV65.cjs");
|
|
32
|
-
var
|
|
32
|
+
var import_chunk_UJLDNXPC = require("../chunk-UJLDNXPC.cjs");
|
|
33
33
|
__reExport(echo_exports, require("@dxos/client/echo"), module.exports);
|
|
34
34
|
var import_async = require("@dxos/async");
|
|
35
35
|
var import_echo = require("@dxos/client/echo");
|
|
@@ -45,7 +45,7 @@ var import_react_hooks3 = require("@dxos/react-hooks");
|
|
|
45
45
|
var import_react4 = require("react");
|
|
46
46
|
var import_echo4 = require("@dxos/client/echo");
|
|
47
47
|
var useSpace = (spaceKeyLike) => {
|
|
48
|
-
const client = (0,
|
|
48
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
49
49
|
const spaces = (0, import_react_hooks2.useMulticastObservable)(client.spaces);
|
|
50
50
|
const [ready, setReady] = (0, import_react.useState)(false);
|
|
51
51
|
(0, import_react.useEffect)(() => {
|
|
@@ -69,7 +69,7 @@ var useSpace = (spaceKeyLike) => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
var useSpaces = ({ all = false } = {}) => {
|
|
72
|
-
const client = (0,
|
|
72
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
73
73
|
const spaces = (0, import_react_hooks2.useMulticastObservable)(client.spaces);
|
|
74
74
|
return spaces.filter((space) => all || space.state.get() === import_echo2.SpaceState.SPACE_READY);
|
|
75
75
|
};
|
|
@@ -23,7 +23,6 @@ __export(halo_exports, {
|
|
|
23
23
|
DeviceType: () => import_halo.DeviceType,
|
|
24
24
|
KeyStore: () => KeyStore,
|
|
25
25
|
useContacts: () => useContacts,
|
|
26
|
-
useCredentials: () => useCredentials,
|
|
27
26
|
useDevices: () => useDevices,
|
|
28
27
|
useHaloInvitation: () => useHaloInvitation,
|
|
29
28
|
useHaloInvitations: () => useHaloInvitations,
|
|
@@ -32,30 +31,25 @@ __export(halo_exports, {
|
|
|
32
31
|
});
|
|
33
32
|
module.exports = __toCommonJS(halo_exports);
|
|
34
33
|
var import_chunk_FYOAVV65 = require("../chunk-FYOAVV65.cjs");
|
|
35
|
-
var
|
|
34
|
+
var import_chunk_UJLDNXPC = require("../chunk-UJLDNXPC.cjs");
|
|
36
35
|
var import_halo = require("@dxos/client/halo");
|
|
37
36
|
var import_react_hooks = require("@dxos/react-hooks");
|
|
38
37
|
var import_react_hooks2 = require("@dxos/react-hooks");
|
|
39
|
-
var import_react_hooks3 = require("@dxos/react-hooks");
|
|
40
38
|
var import_react = require("react");
|
|
39
|
+
var import_react_hooks3 = require("@dxos/react-hooks");
|
|
41
40
|
var import_react_hooks4 = require("@dxos/react-hooks");
|
|
42
|
-
var import_react_hooks5 = require("@dxos/react-hooks");
|
|
43
41
|
var import_react2 = require("react");
|
|
44
42
|
var useContacts = () => {
|
|
45
|
-
const client = (0,
|
|
43
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
46
44
|
return (0, import_react_hooks.useMulticastObservable)(client.halo.contacts);
|
|
47
45
|
};
|
|
48
|
-
var useCredentials = () => {
|
|
49
|
-
const client = (0, import_chunk_Y2HFUT7P.useClient)();
|
|
50
|
-
return (0, import_react_hooks2.useMulticastObservable)(client.halo.credentials);
|
|
51
|
-
};
|
|
52
46
|
var useDevices = () => {
|
|
53
|
-
const client = (0,
|
|
54
|
-
return (0,
|
|
47
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
48
|
+
return (0, import_react_hooks2.useMulticastObservable)(client.halo.devices);
|
|
55
49
|
};
|
|
56
50
|
var useHaloInvitations = () => {
|
|
57
|
-
const client = (0,
|
|
58
|
-
return (0,
|
|
51
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
52
|
+
return (0, import_react_hooks3.useMulticastObservable)(client.halo.invitations);
|
|
59
53
|
};
|
|
60
54
|
var useHaloInvitation = (invitationId) => {
|
|
61
55
|
const invitations = useHaloInvitations();
|
|
@@ -65,8 +59,8 @@ var useHaloInvitation = (invitationId) => {
|
|
|
65
59
|
return (0, import_chunk_FYOAVV65.useInvitationStatus)(invitation);
|
|
66
60
|
};
|
|
67
61
|
var useIdentity = () => {
|
|
68
|
-
const client = (0,
|
|
69
|
-
return (0,
|
|
62
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
63
|
+
return (0, import_react_hooks4.useMulticastObservable)(client.halo.identity);
|
|
70
64
|
};
|
|
71
65
|
var KeyStore = class {
|
|
72
66
|
constructor(_defaultKeys = []) {
|
|
@@ -113,7 +107,6 @@ var useKeyStore = (defaultKeys = []) => {
|
|
|
113
107
|
DeviceType,
|
|
114
108
|
KeyStore,
|
|
115
109
|
useContacts,
|
|
116
|
-
useCredentials,
|
|
117
110
|
useDevices,
|
|
118
111
|
useHaloInvitation,
|
|
119
112
|
useHaloInvitations,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/halo/index.ts", "../../../../src/halo/useContacts.ts", "../../../../src/halo/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\n// NOTE: Export * fails here.\nexport {\n type Credential,\n type Contact,\n type Identity,\n type Halo,\n Device,\n DeviceKind,\n DeviceType,\n} from '@dxos/client/halo';\n\nexport * from './useContacts';\nexport * from './
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["import_react_hooks", "import_react", "useContacts", "client", "useClient", "useMulticastObservable", "halo", "contacts", "
|
|
3
|
+
"sources": ["../../../../src/halo/index.ts", "../../../../src/halo/useContacts.ts", "../../../../src/halo/useDevices.ts", "../../../../src/halo/useHaloInvitations.ts", "../../../../src/halo/useIdentity.ts", "../../../../src/halo/useKeyStore.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\n// NOTE: Export * fails here.\nexport {\n type Credential,\n type Contact,\n type Identity,\n type Halo,\n Device,\n DeviceKind,\n DeviceType,\n} from '@dxos/client/halo';\n\nexport * from './useContacts';\nexport * from './useDevices';\nexport * from './useHaloInvitations';\nexport * from './useIdentity';\nexport * from './useKeyStore';\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Contact } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Returns all known Contacts across all Spaces.\n * Contacts are known members of a common Space.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useContacts = (): Contact[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.contacts);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport type { Device } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\nexport const useDevices = (): Device[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.devices);\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\nimport { useInvitationStatus, type CancellableInvitationObservable } from '../invitations';\n\nexport const useHaloInvitations = (): CancellableInvitationObservable[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.invitations);\n};\n\nexport const useHaloInvitation = (invitationId?: string) => {\n const invitations = useHaloInvitations();\n const invitation = useMemo(\n () => invitations.find((invitation) => invitation.get().invitationId === invitationId),\n [invitations],\n );\n return useInvitationStatus(invitation);\n};\n", "//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Identity } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Hook returning DXOS identity object.\n * Requires ClientContext to be set via ClientProvider.\n */\nexport const useIdentity = (): Identity | null => {\n const client = useClient();\n return useMulticastObservable(client.halo.identity);\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useMemo, useReducer } from 'react';\n\n// TODO(burdon): Move to settings plugin.\nexport class KeyStore {\n private _keyMap = new Map<string, string>();\n\n constructor(private readonly _defaultKeys: string[] = []) {}\n\n get map() {\n return this._keyMap;\n }\n\n // TODO(burdon): Create subkeys.\n initialize() {\n this._defaultKeys.forEach((key) => {\n const value = localStorage.getItem(key);\n this.setKey(key, value ?? '');\n });\n\n return this;\n }\n\n getKey(key: string) {\n localStorage.getItem(key);\n }\n\n setKey(key: string, value: string) {\n localStorage.setItem(key, '');\n this._keyMap.set(key, value);\n }\n}\n\n/**\n * Settings store.\n * @deprecated Replace with HALO key store when available.\n */\nexport const useKeyStore = (\n defaultKeys: string[] = [],\n): [Map<string, string>, (key: string, value: string) => void] => {\n const [, forceUpdate] = useReducer((x) => x + 1, 0);\n const store = useMemo(() => new KeyStore(defaultKeys).initialize(), [defaultKeys]);\n const setKey = (key: string, value: string) => {\n store.setKey(key, value);\n forceUpdate();\n };\n\n return [store.map, setKey];\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,kBAQO;ACRP,yBAAuC;ACAvC,IAAAA,sBAAuC;ACDvC,mBAAwB;AAExB,IAAAA,sBAAuC;ACDvC,IAAAA,sBAAuC;ACDvC,IAAAC,gBAAoC;AJU7B,IAAMC,cAAc,MAAA;AACzB,QAAMC,aAASC,iCAAAA;AACf,aAAOC,2CAAuBF,OAAOG,KAAKC,QAAQ;AACpD;ACRO,IAAMC,aAAa,MAAA;AACxB,QAAML,aAASC,iCAAAA;AACf,aAAOC,oBAAAA,wBAAuBF,OAAOG,KAAKG,OAAO;AACnD;ACDO,IAAMC,qBAAqB,MAAA;AAChC,QAAMP,aAASC,iCAAAA;AACf,aAAOC,oBAAAA,wBAAuBF,OAAOG,KAAKK,WAAW;AACvD;AAEO,IAAMC,oBAAoB,CAACC,iBAAAA;AAChC,QAAMF,cAAcD,mBAAAA;AACpB,QAAMI,iBAAaC,sBACjB,MAAMJ,YAAYK,KAAK,CAACF,gBAAeA,YAAWG,IAAG,EAAGJ,iBAAiBA,YAAAA,GACzE;IAACF;GAAY;AAEf,aAAOO,2CAAoBJ,UAAAA;AAC7B;ACVO,IAAMK,cAAc,MAAA;AACzB,QAAMhB,aAASC,iCAAAA;AACf,aAAOC,oBAAAA,wBAAuBF,OAAOG,KAAKc,QAAQ;AACpD;ACTO,IAAMC,WAAN,MAAMA;EAGXC,YAA6BC,eAAyB,CAAA,GAAI;SAA7BA,eAAAA;SAFrBC,UAAU,oBAAIC,IAAAA;EAEqC;EAE3D,IAAIC,MAAM;AACR,WAAO,KAAKF;EACd;;EAGAG,aAAa;AACX,SAAKJ,aAAaK,QAAQ,CAACC,QAAAA;AACzB,YAAMC,QAAQC,aAAaC,QAAQH,GAAAA;AACnC,WAAKI,OAAOJ,KAAKC,SAAS,EAAA;IAC5B,CAAA;AAEA,WAAO;EACT;EAEAI,OAAOL,KAAa;AAClBE,iBAAaC,QAAQH,GAAAA;EACvB;EAEAI,OAAOJ,KAAaC,OAAe;AACjCC,iBAAaI,QAAQN,KAAK,EAAA;AAC1B,SAAKL,QAAQY,IAAIP,KAAKC,KAAAA;EACxB;AACF;AAMO,IAAMO,cAAc,CACzBC,cAAwB,CAAA,MAAE;AAE1B,QAAM,CAAA,EAAGC,WAAAA,QAAeC,0BAAW,CAACC,MAAMA,IAAI,GAAG,CAAA;AACjD,QAAMC,YAAQ3B,cAAAA,SAAQ,MAAM,IAAIM,SAASiB,WAAAA,EAAaX,WAAU,GAAI;IAACW;GAAY;AACjF,QAAML,SAAS,CAACJ,KAAaC,UAAAA;AAC3BY,UAAMT,OAAOJ,KAAKC,KAAAA;AAClBS,gBAAAA;EACF;AAEA,SAAO;IAACG,MAAMhB;IAAKO;;AACrB;",
|
|
6
|
+
"names": ["import_react_hooks", "import_react", "useContacts", "client", "useClient", "useMulticastObservable", "halo", "contacts", "useDevices", "devices", "useHaloInvitations", "invitations", "useHaloInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "useIdentity", "identity", "KeyStore", "constructor", "_defaultKeys", "_keyMap", "Map", "map", "initialize", "forEach", "key", "value", "localStorage", "getItem", "setKey", "getKey", "setItem", "set", "useKeyStore", "defaultKeys", "forceUpdate", "useReducer", "x", "store"]
|
|
7
7
|
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -19,21 +19,21 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var node_exports = {};
|
|
21
21
|
__export(node_exports, {
|
|
22
|
-
AgentHostingContext: () =>
|
|
23
|
-
AgentHostingProvider: () =>
|
|
24
|
-
ClientContext: () =>
|
|
25
|
-
ClientProvider: () =>
|
|
26
|
-
useAgentHostingClient: () =>
|
|
27
|
-
useClient: () =>
|
|
28
|
-
useClientStatus: () =>
|
|
29
|
-
useConfig: () =>
|
|
22
|
+
AgentHostingContext: () => import_chunk_UJLDNXPC.AgentHostingContext,
|
|
23
|
+
AgentHostingProvider: () => import_chunk_UJLDNXPC.AgentHostingProvider,
|
|
24
|
+
ClientContext: () => import_chunk_UJLDNXPC.ClientContext,
|
|
25
|
+
ClientProvider: () => import_chunk_UJLDNXPC.ClientProvider,
|
|
26
|
+
useAgentHostingClient: () => import_chunk_UJLDNXPC.useAgentHostingClient,
|
|
27
|
+
useClient: () => import_chunk_UJLDNXPC.useClient,
|
|
28
|
+
useClientStatus: () => import_chunk_UJLDNXPC.useClientStatus,
|
|
29
|
+
useConfig: () => import_chunk_UJLDNXPC.useConfig,
|
|
30
30
|
useMulticastObservable: () => import_react_hooks.useMulticastObservable,
|
|
31
|
-
useShell: () =>
|
|
32
|
-
useShellDisplay: () =>
|
|
33
|
-
useStatus: () =>
|
|
31
|
+
useShell: () => import_chunk_UJLDNXPC.useShell,
|
|
32
|
+
useShellDisplay: () => import_chunk_UJLDNXPC.useShellDisplay,
|
|
33
|
+
useStatus: () => import_chunk_UJLDNXPC.useStatus
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(node_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_chunk_UJLDNXPC = require("./chunk-UJLDNXPC.cjs");
|
|
37
37
|
__reExport(node_exports, require("@dxos/client"), module.exports);
|
|
38
38
|
var import_react_hooks = require("@dxos/react-hooks");
|
|
39
39
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -22,11 +22,11 @@ __export(mesh_exports, {
|
|
|
22
22
|
useNetworkStatus: () => useNetworkStatus
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(mesh_exports);
|
|
25
|
-
var
|
|
25
|
+
var import_chunk_UJLDNXPC = require("../chunk-UJLDNXPC.cjs");
|
|
26
26
|
__reExport(mesh_exports, require("@dxos/client/mesh"), module.exports);
|
|
27
27
|
var import_react_hooks = require("@dxos/react-hooks");
|
|
28
28
|
var useNetworkStatus = () => {
|
|
29
|
-
const client = (0,
|
|
29
|
+
const client = (0, import_chunk_UJLDNXPC.useClient)();
|
|
30
30
|
return (0, import_react_hooks.useMulticastObservable)(client.mesh.networkStatus);
|
|
31
31
|
};
|
|
32
32
|
// Annotate the CommonJS export names for ESM import in node:
|