@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
package/.storybook/main.mts
CHANGED
package/.storybook/preview.mts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { preview } from '../../../../tools/storybook-react/.storybook/preview';
|
|
5
|
+
import { preview } from '../../../../tools/storybook-react/.storybook/preview.ts';
|
|
6
6
|
|
|
7
|
-
export * from '../../../../tools/storybook-react/.storybook/preview';
|
|
7
|
+
export * from '../../../../tools/storybook-react/.storybook/preview.ts';
|
|
8
8
|
export default preview;
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @dxos/react-client
|
|
2
|
+
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c9da903: Move the `useFlush` hook from `@dxos/plugin-assistant/hooks` to `@dxos/react-client/echo`. It operates on a `Space`, so it belongs with the other space hooks; import it from `@dxos/react-client/echo` instead of `@dxos/plugin-assistant/hooks`.
|
|
8
|
+
- Updated dependencies [f9ba47a]
|
|
9
|
+
- Updated dependencies [4e64123]
|
|
10
|
+
- Updated dependencies [c035062]
|
|
11
|
+
- Updated dependencies [aea1e6e]
|
|
12
|
+
- Updated dependencies [46ec569]
|
|
13
|
+
- Updated dependencies [b5ecf54]
|
|
14
|
+
- Updated dependencies [3f6ac61]
|
|
15
|
+
- Updated dependencies [091ebe4]
|
|
16
|
+
- Updated dependencies [eec72c5]
|
|
17
|
+
- Updated dependencies [3f1fc67]
|
|
18
|
+
- Updated dependencies [6df314a]
|
|
19
|
+
- Updated dependencies [856c4f0]
|
|
20
|
+
- Updated dependencies [46ec569]
|
|
21
|
+
- Updated dependencies [f8637f1]
|
|
22
|
+
- Updated dependencies [b8c0825]
|
|
23
|
+
- Updated dependencies [4e64123]
|
|
24
|
+
- Updated dependencies [6a03a30]
|
|
25
|
+
- Updated dependencies [7b270f2]
|
|
26
|
+
- Updated dependencies [7b270f2]
|
|
27
|
+
- Updated dependencies [af5fbf4]
|
|
28
|
+
- Updated dependencies [d547045]
|
|
29
|
+
- Updated dependencies [410a019]
|
|
30
|
+
- Updated dependencies [f6a01e3]
|
|
31
|
+
- Updated dependencies [9cde1c6]
|
|
32
|
+
- Updated dependencies [923d5be]
|
|
33
|
+
- Updated dependencies [85893fe]
|
|
34
|
+
- Updated dependencies [12fd785]
|
|
35
|
+
- Updated dependencies [d547045]
|
|
36
|
+
- Updated dependencies [5f08a6a]
|
|
37
|
+
- Updated dependencies [f15c632]
|
|
38
|
+
- Updated dependencies [3761762]
|
|
39
|
+
- Updated dependencies [4bb7e3b]
|
|
40
|
+
- Updated dependencies [41141d8]
|
|
41
|
+
- Updated dependencies [686fac1]
|
|
42
|
+
- Updated dependencies [ac51564]
|
|
43
|
+
- @dxos/echo@0.11.0
|
|
44
|
+
- @dxos/async@0.11.0
|
|
45
|
+
- @dxos/client@0.11.0
|
|
46
|
+
- @dxos/util@0.11.0
|
|
47
|
+
- @dxos/keys@0.11.0
|
|
48
|
+
- @dxos/log@0.11.0
|
|
49
|
+
- @dxos/echo-react@0.11.0
|
|
50
|
+
- @dxos/config@0.11.0
|
|
51
|
+
- @dxos/codec-protobuf@0.11.0
|
|
52
|
+
- @dxos/react-hooks@0.11.0
|
|
53
|
+
- @dxos/context@0.11.0
|
|
54
|
+
- @dxos/echo-protocol@0.11.0
|
|
55
|
+
- @dxos/debug@0.11.0
|
|
56
|
+
- @dxos/invariant@0.11.0
|
|
57
|
+
- @dxos/node-std@0.11.0
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { n as ClientContext } from "./chunk-context.mjs";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
|
3
|
+
import { Client, SystemStatus } from "@dxos/client";
|
|
4
|
+
import { log } from "@dxos/log";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useAsyncEffect, useControlledState } from "@dxos/react-hooks";
|
|
7
|
+
import { getAsyncProviderValue } from "@dxos/util";
|
|
8
|
+
//#region src/banner.ts
|
|
9
|
+
var BANNER = (client) => {
|
|
10
|
+
const commitHash = client.config.get("runtime.app.build.commitHash");
|
|
11
|
+
const hash = commitHash ? ` App Commit ${commitHash} \n` : "";
|
|
12
|
+
return `
|
|
13
|
+
_/\\/\\/\\/\\/\\____/\\/\\____/\\/\\____/\\/\\/\\/\\______/\\/\\/\\/\\/\\_
|
|
14
|
+
_/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\____/\\/\\__/\\/\\_________
|
|
15
|
+
_/\\/\\____/\\/\\______/\\/\\______/\\/\\____/\\/\\____/\\/\\/\\/\\___
|
|
16
|
+
_/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\____/\\/\\__________/\\/\\_
|
|
17
|
+
_/\\/\\/\\/\\/\\____/\\/\\____/\\/\\____/\\/\\/\\/\\____/\\/\\/\\/\\/\\___
|
|
18
|
+
\n DXOS Client ${client.version} \n${hash}`;
|
|
19
|
+
};
|
|
20
|
+
var bannerPrinted = false;
|
|
21
|
+
var printBanner = (client) => {
|
|
22
|
+
if (bannerPrinted || window.location.hostname === "localhost") return;
|
|
23
|
+
bannerPrinted = true;
|
|
24
|
+
console.log(`%c${BANNER(client)}`, "font-family: monospace;");
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/client/ClientProvider.tsx
|
|
28
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/client/ClientProvider.tsx";
|
|
29
|
+
/**
|
|
30
|
+
* Root component that provides the DXOS client instance to child components.
|
|
31
|
+
* To be used with the `useClient` hook.
|
|
32
|
+
*/
|
|
33
|
+
var ClientProvider = forwardRef(({ children, config: configProp, client: clientProp, services: servicesProp, status: statusProp, fallback: Fallback = () => null, noBanner, onInitialized, ...options }, forwardedRef) => {
|
|
34
|
+
const [error, setError] = useState();
|
|
35
|
+
if (error) throw error;
|
|
36
|
+
const [client, setClient] = useState(clientProp instanceof Client ? clientProp : void 0);
|
|
37
|
+
useImperativeHandle(forwardedRef, () => client, [client]);
|
|
38
|
+
const [status, setStatus] = useControlledState(statusProp);
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!client) return;
|
|
41
|
+
const subscription = client.status.subscribe((status) => setStatus(status));
|
|
42
|
+
return () => subscription.unsubscribe();
|
|
43
|
+
}, [client]);
|
|
44
|
+
useAsyncEffect(async () => {
|
|
45
|
+
let disposed = false;
|
|
46
|
+
const initialize = async (client) => {
|
|
47
|
+
if (!client.initialized) {
|
|
48
|
+
await client.initialize().catch((err) => {
|
|
49
|
+
if (!disposed) setError(err);
|
|
50
|
+
});
|
|
51
|
+
log("client ready", void 0, {
|
|
52
|
+
"~LogMeta": "~LogMeta",
|
|
53
|
+
F: __dxlog_file,
|
|
54
|
+
L: 123,
|
|
55
|
+
S: void 0
|
|
56
|
+
});
|
|
57
|
+
await onInitialized?.(client);
|
|
58
|
+
log("initialization complete", void 0, {
|
|
59
|
+
"~LogMeta": "~LogMeta",
|
|
60
|
+
F: __dxlog_file,
|
|
61
|
+
L: 125,
|
|
62
|
+
S: void 0
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
setClient(client);
|
|
66
|
+
if (!noBanner) printBanner(client);
|
|
67
|
+
};
|
|
68
|
+
let client;
|
|
69
|
+
try {
|
|
70
|
+
if (clientProp) {
|
|
71
|
+
client = await getAsyncProviderValue(clientProp);
|
|
72
|
+
await initialize(client);
|
|
73
|
+
} else {
|
|
74
|
+
const config = await getAsyncProviderValue(configProp);
|
|
75
|
+
log("resolved config", { config }, {
|
|
76
|
+
"~LogMeta": "~LogMeta",
|
|
77
|
+
F: __dxlog_file,
|
|
78
|
+
L: 143,
|
|
79
|
+
S: void 0
|
|
80
|
+
});
|
|
81
|
+
const services = await getAsyncProviderValue(servicesProp, config);
|
|
82
|
+
log("created services", { services }, {
|
|
83
|
+
"~LogMeta": "~LogMeta",
|
|
84
|
+
F: __dxlog_file,
|
|
85
|
+
L: 145,
|
|
86
|
+
S: void 0
|
|
87
|
+
});
|
|
88
|
+
client = new Client({
|
|
89
|
+
config,
|
|
90
|
+
services,
|
|
91
|
+
...options
|
|
92
|
+
});
|
|
93
|
+
log("created client", void 0, {
|
|
94
|
+
"~LogMeta": "~LogMeta",
|
|
95
|
+
F: __dxlog_file,
|
|
96
|
+
L: 147,
|
|
97
|
+
S: void 0
|
|
98
|
+
});
|
|
99
|
+
await initialize(client);
|
|
100
|
+
}
|
|
101
|
+
} catch (err) {
|
|
102
|
+
if (!disposed) log.catch(err, void 0, {
|
|
103
|
+
"~LogMeta": "~LogMeta",
|
|
104
|
+
F: __dxlog_file,
|
|
105
|
+
L: 152,
|
|
106
|
+
S: void 0
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return () => {
|
|
110
|
+
log("clean up", void 0, {
|
|
111
|
+
"~LogMeta": "~LogMeta",
|
|
112
|
+
F: __dxlog_file,
|
|
113
|
+
L: 157,
|
|
114
|
+
S: void 0
|
|
115
|
+
});
|
|
116
|
+
disposed = true;
|
|
117
|
+
if (!clientProp) client?.destroy().then(() => {
|
|
118
|
+
log("destroyed", void 0, {
|
|
119
|
+
"~LogMeta": "~LogMeta",
|
|
120
|
+
F: __dxlog_file,
|
|
121
|
+
L: 164,
|
|
122
|
+
S: void 0
|
|
123
|
+
});
|
|
124
|
+
}).catch((err) => log.catch(err, void 0, {
|
|
125
|
+
"~LogMeta": "~LogMeta",
|
|
126
|
+
F: __dxlog_file,
|
|
127
|
+
L: 166,
|
|
128
|
+
S: void 0
|
|
129
|
+
}));
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
configProp,
|
|
133
|
+
clientProp,
|
|
134
|
+
servicesProp,
|
|
135
|
+
noBanner
|
|
136
|
+
]);
|
|
137
|
+
if (!client?.initialized || status !== SystemStatus.ACTIVE) return /* @__PURE__ */ jsx(Fallback, {
|
|
138
|
+
client,
|
|
139
|
+
status
|
|
140
|
+
});
|
|
141
|
+
return /* @__PURE__ */ jsx(ClientContext.Provider, {
|
|
142
|
+
value: {
|
|
143
|
+
client,
|
|
144
|
+
status
|
|
145
|
+
},
|
|
146
|
+
children
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
//#endregion
|
|
150
|
+
export { ClientProvider as t };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=chunk-ClientProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-ClientProvider.mjs","names":[],"sources":["../../src/banner.ts","../../src/client/ClientProvider.tsx"],"sourcesContent":["//\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 2020 DXOS.org\n//\n\nimport React, {\n type FunctionComponent,\n type PropsWithChildren,\n forwardRef,\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 { log } from '@dxos/log';\nimport { useAsyncEffect, useControlledState } from '@dxos/react-hooks';\nimport { type MaybePromise, type Provider, getAsyncProviderValue } from '@dxos/util';\n\nimport { printBanner } from '../banner';\nimport { ClientContext, type ClientContextProps } from './context';\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 * 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: configProp,\n client: clientProp,\n services: servicesProp,\n status: statusProp,\n fallback: Fallback = () => null,\n noBanner,\n onInitialized,\n ...options\n },\n forwardedRef,\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(clientProp instanceof Client ? clientProp : undefined);\n\n // Provide external access.\n useImperativeHandle(forwardedRef, () => client, [client]);\n\n // Client status subscription.\n const [status, setStatus] = useControlledState(statusProp);\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 useAsyncEffect(async () => {\n let disposed = false;\n const initialize = async (client: Client) => {\n if (!client.initialized) {\n await client.initialize().catch((err) => {\n if (!disposed) {\n setError(err);\n }\n });\n log('client ready');\n await onInitialized?.(client);\n log('initialization complete');\n }\n\n setClient(client);\n if (!noBanner) {\n printBanner(client);\n }\n };\n\n let client: Client;\n try {\n if (clientProp) {\n // Asynchronously request client.\n client = await getAsyncProviderValue(clientProp);\n await initialize(client);\n } else {\n // Asynchronously construct client (config may be undefined).\n const config = await getAsyncProviderValue(configProp);\n log('resolved config', { config });\n const services = await getAsyncProviderValue(servicesProp, config);\n log('created services', { services });\n client = new Client({ config, services, ...options });\n log('created client');\n await initialize(client);\n }\n } catch (err) {\n if (!disposed) {\n log.catch(err);\n }\n }\n\n return () => {\n log('clean up');\n disposed = true;\n // Only destroy if the client is not provided by the parent.\n if (!clientProp) {\n void client\n ?.destroy()\n .then(() => {\n log('destroyed');\n })\n .catch((err) => log.catch(err));\n }\n };\n }, [configProp, clientProp, servicesProp, 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"],"mappings":";;;;;;;;AAOA,IAAM,UAAU,WAAmB;CACjC,MAAM,aAAa,OAAO,OAAO,IAAI,8BAA8B;CACnE,MAAM,OAAO,aAAa,eAAe,WAAW,OAAO;CAE3D,OACE;;;;;;iBAMkB,OAAO,QAAQ,KAAK;AAE1C;AAEA,IAAI,gBAAgB;AAEpB,IAAa,eAAe,WAAmB;CAC7C,IAAI,iBAAiB,OAAO,SAAS,aAAa,aAChD;CAGF,gBAAgB;CAEhB,QAAQ,IAAI,KAAK,OA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import { createContext, useContext } from "react";
|
|
2
|
+
//#region src/client/context.ts
|
|
3
|
+
/**
|
|
4
|
+
* @internal Use ClientProvider to create or initialize the Client.
|
|
5
|
+
*/
|
|
6
|
+
var ClientContext = createContext(void 0);
|
|
7
|
+
var AgentHostingContext = createContext(null);
|
|
8
|
+
var useAgentHostingClient = () => {
|
|
9
|
+
return useContext(AgentHostingContext);
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ClientContext as n, useAgentHostingClient as r, AgentHostingContext as t };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=chunk-context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-context.mjs","names":[],"sources":["../../src/client/context.ts"],"sourcesContent":["//\n// Copyright 2020 DXOS.org\n//\n\nimport { type Context, createContext, useContext } from 'react';\n\nimport { type AgentHostingProviderClient, 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// Kept out of `AgentHostingProvider.tsx`: react-refresh only fast-refreshes a module whose exports\n// are all components, so a context and hook exported beside the provider make it a reload boundary\n// for everything downstream of it.\nexport const AgentHostingContext = createContext<AgentHostingProviderClient | null>(null);\n\nexport const useAgentHostingClient = () => {\n return useContext(AgentHostingContext);\n};\n"],"mappings":";;;;;AAgBA,IAAa,gBAAyD,cACpE,KAAA,CACF;AAKA,IAAa,sBAAsB,cAAiD,IAAI;AAExF,IAAa,8BAA8B;CACzC,OAAO,WAAW,mBAAmB;AACvC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { n as ClientContext } from "./chunk-context.mjs";
|
|
2
|
+
import { raise } from "@dxos/debug";
|
|
3
|
+
import { useContext } from "react";
|
|
4
|
+
//#region src/client/useClient.ts
|
|
5
|
+
/**
|
|
6
|
+
* Hook returning instance of DXOS client.
|
|
7
|
+
* Requires ClientContext to be set via ClientProvider.
|
|
8
|
+
*/
|
|
9
|
+
var useClient = () => {
|
|
10
|
+
const { client } = useContext(ClientContext) ?? raise(/* @__PURE__ */ new Error("Missing ClientContext."));
|
|
11
|
+
return client;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { useClient as t };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=chunk-useClient.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-useClient.mjs","names":[],"sources":["../../src/client/useClient.ts"],"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"],"mappings":";;;;;;;;AAcA,IAAa,kBAAkB;CAC7B,MAAM,EAAE,WAAW,WAAW,aAAa,KAAK,sBAAM,IAAI,MAAM,wBAAwB,CAAC;CACzF,OAAO;AACT"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { t as useClient } from "./chunk-useClient.mjs";
|
|
2
|
+
import { raise } from "@dxos/debug";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { log } from "@dxos/log";
|
|
5
|
+
export * from "@dxos/client/devtools";
|
|
6
|
+
//#region src/devtools/useDevtools.ts
|
|
7
|
+
var useDevtools = () => {
|
|
8
|
+
return useClient().services.services.DevtoolsHost ?? raise(/* @__PURE__ */ new Error("DevtoolsHost not available."));
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/devtools/useStream.ts
|
|
12
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/devtools/useStream.ts";
|
|
13
|
+
/**
|
|
14
|
+
* Subscribe to service API streams.
|
|
15
|
+
*/
|
|
16
|
+
var useStream = (streamFactory, defaultValue, deps = []) => {
|
|
17
|
+
const [value, setValue] = useState(defaultValue);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const stream = streamFactory();
|
|
20
|
+
stream.subscribe((response) => setValue(response), (err) => {
|
|
21
|
+
if (err) log.catch(err, void 0, {
|
|
22
|
+
"~LogMeta": "~LogMeta",
|
|
23
|
+
F: __dxlog_file,
|
|
24
|
+
L: 21,
|
|
25
|
+
S: void 0
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
stream.close();
|
|
30
|
+
};
|
|
31
|
+
}, deps);
|
|
32
|
+
return value ?? defaultValue;
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { useDevtools, useStream };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=devtools.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools.mjs","names":[],"sources":["../../src/devtools/useDevtools.ts","../../src/devtools/useStream.ts"],"sourcesContent":["//\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, useEffect, useState } from 'react';\n\nimport { type Stream } from '@dxos/codec-protobuf/stream';\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"],"mappings":";;;;;;AASA,IAAa,oBAAkC;CAE7C,OADe,UACR,CAAA,CAAO,SAAS,SAAS,gBAAgB,sBAAM,IAAI,MAAM,6BAA6B,CAAC;AAChG;;;;;;;ACAA,IAAa,aAAgB,eAAgC,cAAiB,OAAuB,CAAC,MAAS;CAC7G,MAAM,CAAC,OAAO,YAAY,SAAwB,YAAY;CAC9D,gBAAgB;EACd,MAAM,SAAS,cAAc;EAC7B,OAAO,WACJ,aAAgB,SAAS,QAAQ,IACjC,QAAQ;GACP,IAAI,KACF,IAAI,MAAM,KAAE,KAAA,GAAA;IAAA,YAAA;IAAA,GAAA;IAAA,GAAA;IAAA,GAAA,KAAA;GAAA,CAAC;EAEjB,CACF;EAEA,aAAa;GACX,OAAY,MAAM;EACpB;CACF,GAAG,IAAI;CAEP,OAAO,SAAS;AAClB"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { t as useClient } from "./chunk-useClient.mjs";
|
|
2
|
+
import { useInvitationStatus } from "./invitations.mjs";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { PublicKey } from "@dxos/client";
|
|
5
|
+
import { useMulticastObservable } from "@dxos/react-hooks";
|
|
6
|
+
import { HaloSpaceMember, SpaceState, createSubscription } from "@dxos/client/echo";
|
|
7
|
+
import { useObject } from "@dxos/echo-react";
|
|
8
|
+
import { MulticastObservable } from "@dxos/async";
|
|
9
|
+
import { Context } from "@dxos/context";
|
|
10
|
+
import { isEdgePeerId } from "@dxos/echo-protocol";
|
|
11
|
+
export * from "@dxos/client/echo";
|
|
12
|
+
export * from "@dxos/echo-react";
|
|
13
|
+
//#region src/echo/useSpaces.ts
|
|
14
|
+
/**
|
|
15
|
+
* Get a specific Space using its id.
|
|
16
|
+
* The space is not guaranteed to be in the ready state.
|
|
17
|
+
* Returns undefined if no id is provided.
|
|
18
|
+
* Requires a ClientProvider somewhere in the parent tree.
|
|
19
|
+
*
|
|
20
|
+
* @param spaceId the id of the space to look for.
|
|
21
|
+
*/
|
|
22
|
+
var useSpace = (spaceId) => {
|
|
23
|
+
const spaces = useMulticastObservable(useClient().spaces);
|
|
24
|
+
if (!spaceId) return;
|
|
25
|
+
return spaces.find((space) => {
|
|
26
|
+
if (spaceId instanceof PublicKey) return space.key.equals(spaceId);
|
|
27
|
+
return space.id === spaceId;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Get all Spaces available to current user.
|
|
32
|
+
* Requires a ClientProvider somewhere in the parent tree.
|
|
33
|
+
* By default, only ready spaces are returned.
|
|
34
|
+
* @returns an array of Spaces.
|
|
35
|
+
*/
|
|
36
|
+
var useSpaces = ({ all = false } = {}) => {
|
|
37
|
+
return useMulticastObservable(useClient().spaces).filter((space) => all || space.state.get() === SpaceState.SPACE_READY);
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/echo/useMembers.ts
|
|
41
|
+
var useMembers = (spaceKey) => {
|
|
42
|
+
const spaces = useSpaces({ all: true });
|
|
43
|
+
return (useMulticastObservable((spaceKey ? spaces.find((space) => spaceKey instanceof PublicKey ? space.key.equals(spaceKey) : space.id === spaceKey) : void 0)?.members ?? MulticastObservable.empty()) ?? []).filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/echo/useSpaceInvitations.ts
|
|
47
|
+
var useSpaceInvitations = (spaceId) => {
|
|
48
|
+
return useMulticastObservable(useSpace(spaceId)?.invitations ?? MulticastObservable.empty()) ?? [];
|
|
49
|
+
};
|
|
50
|
+
var useSpaceInvitation = (spaceId, invitationId) => {
|
|
51
|
+
const invitations = useSpaceInvitations(spaceId);
|
|
52
|
+
return useInvitationStatus(useMemo(() => invitations.find((invitation) => invitation.get().invitationId === invitationId), [invitations]));
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/echo/useSpaceProperties.ts
|
|
56
|
+
/**
|
|
57
|
+
* Subscribe to a space's properties with reactive updates.
|
|
58
|
+
* Returns undefined if the space is undefined or not ready yet.
|
|
59
|
+
* Automatically waits for the space to be ready before returning properties.
|
|
60
|
+
*
|
|
61
|
+
* @param spaceId - The space ID to get properties from (can be undefined).
|
|
62
|
+
* @returns A tuple of [snapshot, updateCallback] or [undefined, no-op] if not ready.
|
|
63
|
+
*/
|
|
64
|
+
var useSpaceProperties = (spaceId) => {
|
|
65
|
+
const space = useSpace(spaceId);
|
|
66
|
+
return useObject(useMulticastObservable(space?.state ?? MulticastObservable.empty()) === SpaceState.SPACE_READY ? space?.properties : void 0);
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/echo/useFlush.ts
|
|
70
|
+
/**
|
|
71
|
+
* Flushes a space's database to storage, exposing a transient `idle → flushing → flushed → idle`
|
|
72
|
+
* state suitable for driving a toolbar affordance.
|
|
73
|
+
*/
|
|
74
|
+
var useFlush = (space) => {
|
|
75
|
+
const [state, setState] = useState("idle");
|
|
76
|
+
const resetTimer = useRef(null);
|
|
77
|
+
return {
|
|
78
|
+
state,
|
|
79
|
+
handleFlush: useCallback(() => {
|
|
80
|
+
if (!space) return;
|
|
81
|
+
queueMicrotask(async () => {
|
|
82
|
+
if (resetTimer.current) clearTimeout(resetTimer.current);
|
|
83
|
+
setState("flushing");
|
|
84
|
+
await space.db.flush();
|
|
85
|
+
setState("flushed");
|
|
86
|
+
resetTimer.current = setTimeout(() => {
|
|
87
|
+
setState("idle");
|
|
88
|
+
resetTimer.current = null;
|
|
89
|
+
}, 1e3);
|
|
90
|
+
});
|
|
91
|
+
}, [space])
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/echo/useSubscription.ts
|
|
96
|
+
/**
|
|
97
|
+
* Create reactive selection.
|
|
98
|
+
* Calls the callback when the selection changes and during the first render.
|
|
99
|
+
*/
|
|
100
|
+
var useSubscription = (cb, selection) => {
|
|
101
|
+
const callbackRef = useRef(cb);
|
|
102
|
+
callbackRef.current = cb;
|
|
103
|
+
const subscriptionRef = useRef(null);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
subscriptionRef.current = createSubscription(() => {
|
|
106
|
+
callbackRef.current();
|
|
107
|
+
});
|
|
108
|
+
return () => subscriptionRef.current?.unsubscribe();
|
|
109
|
+
}, []);
|
|
110
|
+
subscriptionRef.current?.update(selection);
|
|
111
|
+
return subscriptionRef.current;
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/echo/useSyncState.ts
|
|
115
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/echo/useSyncState.ts";
|
|
116
|
+
/**
|
|
117
|
+
* Hook Subscribes to sync state for each space.
|
|
118
|
+
*/
|
|
119
|
+
var useSyncState = () => {
|
|
120
|
+
const client = useClient();
|
|
121
|
+
const [spaceState, setSpaceState] = useState({});
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
const ctx = new Context(void 0, {
|
|
124
|
+
"~LogMeta": "~LogMeta",
|
|
125
|
+
F: __dxlog_file,
|
|
126
|
+
L: 21
|
|
127
|
+
});
|
|
128
|
+
const createSubscriptions = (spaces) => {
|
|
129
|
+
for (const space of spaces) {
|
|
130
|
+
if (spaceState[space.id]) continue;
|
|
131
|
+
ctx.onDispose(space.internal.db.subscribeToAutomergeSyncState(ctx, ({ peers = [] }) => {
|
|
132
|
+
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
133
|
+
if (syncState) setSpaceState((spaceState) => ({
|
|
134
|
+
...spaceState,
|
|
135
|
+
[space.id]: syncState
|
|
136
|
+
}));
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
createSubscriptions(client.spaces.get());
|
|
141
|
+
client.spaces.subscribe((spaces) => {
|
|
142
|
+
createSubscriptions(spaces);
|
|
143
|
+
});
|
|
144
|
+
return () => {
|
|
145
|
+
ctx.dispose();
|
|
146
|
+
};
|
|
147
|
+
}, [client]);
|
|
148
|
+
return spaceState;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Hook Subscribes to sync state for a single space.
|
|
152
|
+
*/
|
|
153
|
+
var useSpaceSyncState = (space) => {
|
|
154
|
+
const [spaceState, setSpaceState] = useState();
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
const ctx = new Context(void 0, {
|
|
157
|
+
"~LogMeta": "~LogMeta",
|
|
158
|
+
F: __dxlog_file,
|
|
159
|
+
L: 60
|
|
160
|
+
});
|
|
161
|
+
space.internal.db.subscribeToAutomergeSyncState(ctx, ({ peers = [] }) => {
|
|
162
|
+
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
163
|
+
if (syncState) setSpaceState(syncState);
|
|
164
|
+
});
|
|
165
|
+
return () => {
|
|
166
|
+
ctx.dispose();
|
|
167
|
+
};
|
|
168
|
+
}, [space]);
|
|
169
|
+
return spaceState;
|
|
170
|
+
};
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/echo/useFeedSyncState.ts
|
|
173
|
+
var DEFAULT_POLL_INTERVAL_MS = 5e3;
|
|
174
|
+
/**
|
|
175
|
+
* Polls feed replication state per space.
|
|
176
|
+
*/
|
|
177
|
+
var useFeedSyncState = (pollIntervalMs = DEFAULT_POLL_INTERVAL_MS) => {
|
|
178
|
+
const client = useClient();
|
|
179
|
+
const [feedSyncState, setFeedSyncState] = useState({});
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
const feedService = client.services.services.FeedService;
|
|
182
|
+
if (!feedService) return;
|
|
183
|
+
let cancelled = false;
|
|
184
|
+
const poll = async () => {
|
|
185
|
+
const spaces = client.spaces.get();
|
|
186
|
+
const entries = await Promise.all(spaces.map(async (space) => {
|
|
187
|
+
try {
|
|
188
|
+
const state = ((await feedService.getSyncState({ spaceId: space.id })).namespaces ?? []).reduce((acc, entry) => {
|
|
189
|
+
acc.pending += Number(entry.blocksToPull ?? 0) + Number(entry.blocksToPush ?? 0);
|
|
190
|
+
acc.total += Number(entry.totalBlocks ?? 0);
|
|
191
|
+
return acc;
|
|
192
|
+
}, {
|
|
193
|
+
pending: 0,
|
|
194
|
+
total: 0
|
|
195
|
+
});
|
|
196
|
+
return [space.id, state];
|
|
197
|
+
} catch {
|
|
198
|
+
return [space.id, {
|
|
199
|
+
pending: 0,
|
|
200
|
+
total: 0
|
|
201
|
+
}];
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
if (!cancelled) setFeedSyncState(Object.fromEntries(entries));
|
|
205
|
+
};
|
|
206
|
+
poll();
|
|
207
|
+
const interval = setInterval(() => void poll(), pollIntervalMs);
|
|
208
|
+
const spacesSubscription = client.spaces.subscribe(() => {
|
|
209
|
+
poll();
|
|
210
|
+
});
|
|
211
|
+
return () => {
|
|
212
|
+
cancelled = true;
|
|
213
|
+
clearInterval(interval);
|
|
214
|
+
spacesSubscription.unsubscribe();
|
|
215
|
+
};
|
|
216
|
+
}, [client, pollIntervalMs]);
|
|
217
|
+
return feedSyncState;
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/echo/useRegistry.ts
|
|
221
|
+
/**
|
|
222
|
+
* Returns the hypergraph registry attached to the current client.
|
|
223
|
+
*/
|
|
224
|
+
var useRegistry = () => {
|
|
225
|
+
return useClient().graph.registry;
|
|
226
|
+
};
|
|
227
|
+
//#endregion
|
|
228
|
+
export { useFeedSyncState, useFlush, useMembers, useRegistry, useSpace, useSpaceInvitation, useSpaceInvitations, useSpaceProperties, useSpaceSyncState, useSpaces, useSubscription, useSyncState };
|
|
229
|
+
|
|
230
|
+
//# sourceMappingURL=echo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echo.mjs","names":[],"sources":["../../src/echo/useSpaces.ts","../../src/echo/useMembers.ts","../../src/echo/useSpaceInvitations.ts","../../src/echo/useSpaceProperties.ts","../../src/echo/useFlush.ts","../../src/echo/useSubscription.ts","../../src/echo/useSyncState.ts","../../src/echo/useFeedSyncState.ts","../../src/echo/useRegistry.ts"],"sourcesContent":["//\n// Copyright 2020 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/client';\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { type SpaceId } from '@dxos/keys';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\n/**\n * Get a specific Space using its id.\n * The space is not guaranteed to be in the ready state.\n * Returns undefined if no id is provided.\n * Requires a ClientProvider somewhere in the parent tree.\n *\n * @param spaceId the id of the space to look for.\n */\n// TODO(wittjosiah): Currently unable to remove `PublicKey` from this api.\n// When initially joining a space that is all that is returned.\nexport const useSpace = (spaceId?: SpaceId | PublicKey): Space | undefined => {\n const client = useClient();\n const spaces = useMulticastObservable<Space[]>(client.spaces);\n if (!spaceId) {\n return undefined;\n }\n\n return spaces.find((space) => {\n if (spaceId instanceof PublicKey) {\n return space.key.equals(spaceId);\n }\n\n return space.id === spaceId;\n });\n};\n\nexport type UseSpacesProps = {\n /**\n * Return uninitialized spaces as well.\n */\n all?: boolean;\n};\n\n/**\n * Get all Spaces available to current user.\n * Requires a ClientProvider somewhere in the parent tree.\n * By default, only ready spaces are returned.\n * @returns an array of Spaces.\n */\nexport const useSpaces = ({ all = false }: UseSpacesProps = {}): Space[] => {\n const client = useClient();\n const spaces = useMulticastObservable<Space[]>(client.spaces);\n\n // TODO(dmaretskyi): Array reference equality.\n return spaces.filter((space) => all || space.state.get() === SpaceState.SPACE_READY);\n};\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { MulticastObservable } from '@dxos/async';\nimport { PublicKey, type PublicKeyLike } from '@dxos/client';\nimport { HaloSpaceMember, type SpaceMember } from '@dxos/client/echo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useSpaces } from './useSpaces';\n\nexport const useMembers = (spaceKey: PublicKeyLike | undefined): SpaceMember[] => {\n // TODO(dmaretskyi): useSpace hook for spaces that are not ready.\n const spaces = useSpaces({ all: true });\n const space = spaceKey\n ? spaces.find((space) => (spaceKey instanceof PublicKey ? space.key.equals(spaceKey) : space.id === spaceKey))\n : undefined;\n\n // EMPTY_OBSERVABLE needs to be a stable reference to avoid re-subscribing on every render.\n const members = useMulticastObservable(space?.members ?? MulticastObservable.empty()) ?? [];\n return members.filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);\n};\n","//\n// Copyright 2022 DXOS.org\n//\n\nimport { useMemo } from 'react';\n\nimport { MulticastObservable } from '@dxos/async';\nimport { type PublicKey } from '@dxos/client';\nimport { type SpaceId } from '@dxos/keys';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';\nimport { useSpace } from './useSpaces';\n\n// TODO(wittjosiah): Currently unable to remove `PublicKey` from this api.\n// When initially joining a space that is all that is returned.\nexport const useSpaceInvitations = (spaceId?: SpaceId | PublicKey): CancellableInvitationObservable[] => {\n const space = useSpace(spaceId);\n return useMulticastObservable(space?.invitations ?? MulticastObservable.empty()) ?? [];\n};\n\n// TODO(wittjosiah): Currently unable to remove `PublicKey` from this api.\n// When initially joining a space that is all that is returned.\nexport const useSpaceInvitation = (spaceId?: SpaceId | PublicKey, invitationId?: string) => {\n const invitations = useSpaceInvitations(spaceId);\n const invitation = useMemo(\n () => invitations.find((invitation) => invitation.get().invitationId === invitationId),\n [invitations],\n );\n return useInvitationStatus(invitation);\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { MulticastObservable } from '@dxos/async';\nimport { type SpaceProperties, SpaceState } from '@dxos/client/echo';\nimport { type Key, type Obj } from '@dxos/echo';\nimport { type ObjectUpdateCallback, useObject } from '@dxos/echo-react';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useSpace } from './useSpaces';\n\n/**\n * Subscribe to a space's properties with reactive updates.\n * Returns undefined if the space is undefined or not ready yet.\n * Automatically waits for the space to be ready before returning properties.\n *\n * @param spaceId - The space ID to get properties from (can be undefined).\n * @returns A tuple of [snapshot, updateCallback] or [undefined, no-op] if not ready.\n */\nexport const useSpaceProperties = (\n spaceId: Key.SpaceId | undefined,\n): [Obj.Snapshot<SpaceProperties> | undefined, ObjectUpdateCallback<SpaceProperties>] => {\n const space = useSpace(spaceId);\n const spaceState = useMulticastObservable(space?.state ?? MulticastObservable.empty());\n const properties = spaceState === SpaceState.SPACE_READY ? space?.properties : undefined;\n return useObject(properties);\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useRef, useState } from 'react';\n\nimport { type Space } from '@dxos/client/echo';\n\n/**\n * Flushes a space's database to storage, exposing a transient `idle → flushing → flushed → idle`\n * state suitable for driving a toolbar affordance.\n */\nexport const useFlush = (space?: Space) => {\n const [state, setState] = useState<'idle' | 'flushing' | 'flushed'>('idle');\n const resetTimer = useRef<NodeJS.Timeout | null>(null);\n\n const handleFlush = useCallback(() => {\n if (!space) {\n return;\n }\n\n queueMicrotask(async () => {\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n\n setState('flushing');\n await space.db.flush();\n setState('flushed');\n\n resetTimer.current = setTimeout(() => {\n setState('idle');\n resetTimer.current = null;\n }, 1_000);\n });\n }, [space]);\n\n return { state, handleFlush };\n};\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useRef } from 'react';\n\nimport { type Selection, type SubscriptionHandle, createSubscription } from '@dxos/client/echo';\n\n/**\n * Create reactive selection.\n * Calls the callback when the selection changes and during the first render.\n */\n// TODO(wittjosiah): Is this still needed with signals reactivity? If not, remove or update jsdoc with usage info.\nexport const useSubscription = (cb: () => void, selection: Selection) => {\n // Make sure that the callback is always the one from the latest render.\n // Without this, we would always call the callback from the initial render,\n // which might contain stale data.\n const callbackRef = useRef(cb);\n callbackRef.current = cb;\n\n const subscriptionRef = useRef<SubscriptionHandle>(null);\n\n useEffect(() => {\n subscriptionRef.current = createSubscription(() => {\n callbackRef.current();\n });\n\n return () => subscriptionRef.current?.unsubscribe();\n }, []);\n\n subscriptionRef.current?.update(selection);\n return subscriptionRef.current;\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type PeerSyncState, type Space, type SpaceSyncStateMap } from '@dxos/client/echo';\nimport { Context } from '@dxos/context';\nimport { isEdgePeerId } from '@dxos/echo-protocol';\n\nimport { useClient } from '../client';\n\n/**\n * Hook Subscribes to sync state for each space.\n */\nexport const useSyncState = (): SpaceSyncStateMap => {\n const client = useClient();\n const [spaceState, setSpaceState] = useState<SpaceSyncStateMap>({});\n\n useEffect(() => {\n const ctx = new Context();\n const createSubscriptions = (spaces: Space[]) => {\n for (const space of spaces) {\n if (spaceState[space.id]) {\n continue;\n }\n\n ctx.onDispose(\n space.internal.db.subscribeToAutomergeSyncState(ctx, ({ peers = [] }) => {\n const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));\n if (syncState) {\n setSpaceState((spaceState) => ({ ...spaceState, [space.id]: syncState }));\n }\n }),\n );\n }\n };\n\n createSubscriptions(client.spaces.get());\n client.spaces.subscribe((spaces) => {\n createSubscriptions(spaces);\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [client]);\n\n return spaceState;\n};\n\n/**\n * Hook Subscribes to sync state for a single space.\n */\n// TODO(wittjosiah): Reconcile w/ useSyncState.\nexport const useSpaceSyncState = (space: Space): PeerSyncState | undefined => {\n const [spaceState, setSpaceState] = useState<PeerSyncState>();\n\n useEffect(() => {\n const ctx = new Context();\n space.internal.db.subscribeToAutomergeSyncState(ctx, ({ peers = [] }) => {\n const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));\n if (syncState) {\n setSpaceState(syncState);\n }\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [space]);\n\n return spaceState;\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type SpaceId } from '@dxos/keys';\n\nimport { useClient } from '../client';\n\nconst DEFAULT_POLL_INTERVAL_MS = 5_000;\n\nexport type FeedSyncState = {\n /** Combined blocks to pull + push across namespaces. */\n pending: number;\n /** Total blocks stored locally across namespaces. */\n total: number;\n};\n\nexport type FeedSyncStateMap = Record<SpaceId, FeedSyncState>;\n\n/**\n * Polls feed replication state per space.\n */\nexport const useFeedSyncState = (pollIntervalMs = DEFAULT_POLL_INTERVAL_MS): FeedSyncStateMap => {\n const client = useClient();\n const [feedSyncState, setFeedSyncState] = useState<FeedSyncStateMap>({});\n\n useEffect(() => {\n const feedService = client.services.services.FeedService;\n if (!feedService) {\n return;\n }\n\n let cancelled = false;\n\n const poll = async () => {\n const spaces = client.spaces.get();\n const entries = await Promise.all(\n spaces.map(async (space) => {\n try {\n const response = await feedService.getSyncState({ spaceId: space.id });\n const state = (response.namespaces ?? []).reduce<FeedSyncState>(\n (acc, entry) => {\n acc.pending += Number(entry.blocksToPull ?? 0) + Number(entry.blocksToPush ?? 0);\n acc.total += Number(entry.totalBlocks ?? 0);\n return acc;\n },\n { pending: 0, total: 0 },\n );\n return [space.id, state] as const;\n } catch {\n return [space.id, { pending: 0, total: 0 }] as const;\n }\n }),\n );\n\n if (!cancelled) {\n setFeedSyncState(Object.fromEntries(entries));\n }\n };\n\n void poll();\n const interval = setInterval(() => void poll(), pollIntervalMs);\n\n const spacesSubscription = client.spaces.subscribe(() => {\n void poll();\n });\n\n return () => {\n cancelled = true;\n clearInterval(interval);\n spacesSubscription.unsubscribe();\n };\n }, [client, pollIntervalMs]);\n\n return feedSyncState;\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Registry } from '@dxos/echo';\n\nimport { useClient } from '../client';\n\n/**\n * Returns the hypergraph registry attached to the current client.\n */\nexport const useRegistry = (): Registry.Registry => {\n const client = useClient();\n return client.graph.registry;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,YAAY,YAAqD;CAE5E,MAAM,SAAS,uBADA,UACgC,CAAA,CAAO,MAAM;CAC5D,IAAI,CAAC,SAC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