@dxos/react-client 0.8.4-main.ef1bc66f44 → 0.8.4-main.f466a3d56e
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 -3
- package/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/{chunk-PFF63FPR.mjs → chunk-3LVU7RNK.mjs} +2 -2
- package/dist/lib/browser/{chunk-TSF6Y5VB.mjs → chunk-CZMIVAGI.mjs} +1 -1
- package/dist/lib/browser/{chunk-TSF6Y5VB.mjs.map → chunk-CZMIVAGI.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-5UKA2BMA.mjs → chunk-XT352YI6.mjs} +11 -56
- package/dist/lib/browser/chunk-XT352YI6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LO3TU5CK.mjs → chunk-YHE6WD44.mjs} +3 -13
- package/dist/lib/browser/{chunk-LO3TU5CK.mjs.map → chunk-YHE6WD44.mjs.map} +2 -2
- package/dist/lib/browser/devtools/index.mjs +3 -8
- package/dist/lib/browser/devtools/index.mjs.map +2 -2
- package/dist/lib/browser/echo/index.mjs +26 -97
- package/dist/lib/browser/echo/index.mjs.map +4 -4
- package/dist/lib/browser/halo/index.mjs +3 -3
- package/dist/lib/browser/halo/index.mjs.map +2 -2
- package/dist/lib/browser/index.mjs +6 -21
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/invitations/index.mjs +1 -1
- package/dist/lib/browser/mesh/index.mjs +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +15 -64
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{chunk-NETTSER2.mjs → chunk-CUDKNAMV.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-AQJH2UNZ.mjs → chunk-RQJPEHDY.mjs} +3 -13
- package/dist/lib/node-esm/{chunk-AQJH2UNZ.mjs.map → chunk-RQJPEHDY.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-T3QTQHBD.mjs → chunk-WL3Z5HOH.mjs} +11 -56
- package/dist/lib/node-esm/chunk-WL3Z5HOH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-373DPHEQ.mjs → chunk-WUTK2IJF.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-373DPHEQ.mjs.map → chunk-WUTK2IJF.mjs.map} +2 -2
- package/dist/lib/node-esm/devtools/index.mjs +3 -8
- package/dist/lib/node-esm/devtools/index.mjs.map +2 -2
- package/dist/lib/node-esm/echo/index.mjs +26 -97
- package/dist/lib/node-esm/echo/index.mjs.map +4 -4
- package/dist/lib/node-esm/halo/index.mjs +3 -3
- package/dist/lib/node-esm/halo/index.mjs.map +2 -2
- package/dist/lib/node-esm/index.mjs +6 -21
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/invitations/index.mjs +1 -1
- package/dist/lib/node-esm/mesh/index.mjs +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +15 -64
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/banner.d.ts.map +1 -1
- package/dist/types/src/client/AgentHostingProvider.d.ts.map +1 -1
- package/dist/types/src/client/ClientProvider.d.ts +1 -1
- package/dist/types/src/client/ClientProvider.d.ts.map +1 -1
- package/dist/types/src/client/useClientStatus.d.ts.map +1 -1
- package/dist/types/src/devtools/useStream.d.ts.map +1 -1
- package/dist/types/src/echo/index.d.ts +0 -1
- package/dist/types/src/echo/index.d.ts.map +1 -1
- package/dist/types/src/echo/useMembers.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts +1 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaceProperties.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaces.d.ts +9 -7
- package/dist/types/src/echo/useSpaces.d.ts.map +1 -1
- package/dist/types/src/echo/useSubscription.d.ts.map +1 -1
- package/dist/types/src/echo/useSyncState.d.ts.map +1 -1
- package/dist/types/src/halo/Passkey.stories.d.ts.map +1 -1
- package/dist/types/src/halo/useHaloInvitations.d.ts.map +1 -1
- package/dist/types/src/halo/useKeyStore.d.ts.map +1 -1
- package/dist/types/src/invitations/useInvitationStatus.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.d.ts +2 -2
- package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.stories.d.ts.map +1 -1
- package/dist/types/src/testing/context.d.ts +2 -1
- package/dist/types/src/testing/context.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.stories.d.ts +1 -1
- package/dist/types/src/testing/withClientProvider.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/docs/README.md +38 -38
- package/moon.yml +1 -4
- package/package.json +27 -51
- package/src/client/ClientProvider.test.tsx +0 -1
- package/src/client/ClientProvider.tsx +0 -1
- package/src/client/useConfig.test.tsx +0 -1
- package/src/echo/index.ts +0 -1
- package/src/echo/useSpaceInvitations.ts +1 -2
- package/src/echo/useSpaces.test.tsx +6 -13
- package/src/echo/useSpaces.ts +17 -31
- package/src/echo/useSyncState.ts +1 -5
- package/src/halo/Passkey.stories.tsx +4 -7
- package/src/halo/useDevices.test.tsx +0 -1
- package/src/testing/ClientRepeater.stories.tsx +4 -7
- package/src/testing/ClientRepeater.tsx +4 -5
- package/src/testing/context.tsx +2 -1
- package/src/testing/util.tsx +0 -1
- package/src/testing/withClientProvider.stories.tsx +6 -8
- package/src/testing/withClientProvider.tsx +6 -39
- package/tsconfig.json +6 -0
- package/typedoc.json +1 -1
- package/vitest.config.ts +0 -2
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/chunk-5UKA2BMA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T3QTQHBD.mjs.map +0 -7
- package/dist/types/src/echo/useQueue.d.ts +0 -11
- package/dist/types/src/echo/useQueue.d.ts.map +0 -1
- package/src/echo/useQueue.ts +0 -74
- /package/dist/lib/browser/{chunk-PFF63FPR.mjs.map → chunk-3LVU7RNK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-NETTSER2.mjs.map → chunk-CUDKNAMV.mjs.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useInvitationStatus
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-RQJPEHDY.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useClient
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-CUDKNAMV.mjs";
|
|
8
|
+
import "../chunk-WUTK2IJF.mjs";
|
|
9
9
|
|
|
10
10
|
// src/echo/index.ts
|
|
11
11
|
export * from "@dxos/client/echo";
|
|
@@ -18,35 +18,21 @@ import { HaloSpaceMember } from "@dxos/client/echo";
|
|
|
18
18
|
import { useMulticastObservable as useMulticastObservable2 } from "@dxos/react-hooks";
|
|
19
19
|
|
|
20
20
|
// src/echo/useSpaces.ts
|
|
21
|
-
import { useState } from "react";
|
|
22
21
|
import { PublicKey } from "@dxos/client";
|
|
23
22
|
import { SpaceState } from "@dxos/client/echo";
|
|
24
|
-
import {
|
|
23
|
+
import { useMulticastObservable } from "@dxos/react-hooks";
|
|
25
24
|
var useSpace = (spaceId) => {
|
|
26
25
|
const client = useClient();
|
|
27
26
|
const spaces = useMulticastObservable(client.spaces);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (spaceId) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
await client.spaces.waitUntilReady();
|
|
34
|
-
setReady(true);
|
|
35
|
-
}, [
|
|
36
|
-
client,
|
|
37
|
-
spaceId
|
|
38
|
-
]);
|
|
39
|
-
if (spaceId) {
|
|
40
|
-
return spaces.find((space) => {
|
|
41
|
-
if (spaceId instanceof PublicKey) {
|
|
42
|
-
return space.key.equals(spaceId);
|
|
43
|
-
}
|
|
44
|
-
return space.id === spaceId;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (ready && client.halo.identity.get()) {
|
|
48
|
-
return client.spaces.default;
|
|
27
|
+
if (!spaceId) {
|
|
28
|
+
return void 0;
|
|
49
29
|
}
|
|
30
|
+
return spaces.find((space) => {
|
|
31
|
+
if (spaceId instanceof PublicKey) {
|
|
32
|
+
return space.key.equals(spaceId);
|
|
33
|
+
}
|
|
34
|
+
return space.id === spaceId;
|
|
35
|
+
});
|
|
50
36
|
};
|
|
51
37
|
var useDatabase = (spaceId) => {
|
|
52
38
|
const space = useSpace(spaceId);
|
|
@@ -68,57 +54,8 @@ var useMembers = (spaceKey) => {
|
|
|
68
54
|
return members.filter((member) => member.role !== HaloSpaceMember.Role.REMOVED);
|
|
69
55
|
};
|
|
70
56
|
|
|
71
|
-
// src/echo/useQueue.ts
|
|
72
|
-
import { useEffect, useMemo, useRef } from "react";
|
|
73
|
-
import { raise } from "@dxos/debug";
|
|
74
|
-
var MIN_POLL_INTERVAL = 1e3;
|
|
75
|
-
var useQueue = (queueDxn, options = {}) => {
|
|
76
|
-
const client = useClient();
|
|
77
|
-
const mountedRef = useRef(true);
|
|
78
|
-
const queue = useMemo(() => {
|
|
79
|
-
if (!queueDxn) {
|
|
80
|
-
return void 0;
|
|
81
|
-
}
|
|
82
|
-
const { spaceId } = queueDxn.asQueueDXN() ?? raise(new TypeError("Invalid queue DXN"));
|
|
83
|
-
return client.spaces.get(spaceId)?.queues.get(queueDxn);
|
|
84
|
-
}, [
|
|
85
|
-
client,
|
|
86
|
-
queueDxn?.toString()
|
|
87
|
-
]);
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
void queue?.refresh();
|
|
90
|
-
}, [
|
|
91
|
-
queue
|
|
92
|
-
]);
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
let timeout;
|
|
95
|
-
mountedRef.current = true;
|
|
96
|
-
const poll = () => {
|
|
97
|
-
if (!mountedRef.current) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
void queue?.refresh().finally(() => {
|
|
101
|
-
if (mountedRef.current && options.pollInterval) {
|
|
102
|
-
timeout = setTimeout(poll, Math.max(options.pollInterval ?? 0, MIN_POLL_INTERVAL));
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
if (options.pollInterval) {
|
|
107
|
-
poll();
|
|
108
|
-
}
|
|
109
|
-
return () => {
|
|
110
|
-
mountedRef.current = false;
|
|
111
|
-
clearTimeout(timeout);
|
|
112
|
-
};
|
|
113
|
-
}, [
|
|
114
|
-
queue,
|
|
115
|
-
options.pollInterval
|
|
116
|
-
]);
|
|
117
|
-
return queue;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
57
|
// src/echo/useSpaceInvitations.ts
|
|
121
|
-
import { useMemo
|
|
58
|
+
import { useMemo } from "react";
|
|
122
59
|
import { MulticastObservable as MulticastObservable2 } from "@dxos/async";
|
|
123
60
|
import { useMulticastObservable as useMulticastObservable3 } from "@dxos/react-hooks";
|
|
124
61
|
var useSpaceInvitations = (spaceId) => {
|
|
@@ -127,7 +64,7 @@ var useSpaceInvitations = (spaceId) => {
|
|
|
127
64
|
};
|
|
128
65
|
var useSpaceInvitation = (spaceId, invitationId) => {
|
|
129
66
|
const invitations = useSpaceInvitations(spaceId);
|
|
130
|
-
const invitation =
|
|
67
|
+
const invitation = useMemo(() => invitations.find((invitation2) => invitation2.get().invitationId === invitationId), [
|
|
131
68
|
invitations
|
|
132
69
|
]);
|
|
133
70
|
return useInvitationStatus(invitation);
|
|
@@ -146,13 +83,13 @@ var useSpaceProperties = (spaceId) => {
|
|
|
146
83
|
};
|
|
147
84
|
|
|
148
85
|
// src/echo/useSubscription.ts
|
|
149
|
-
import { useEffect
|
|
86
|
+
import { useEffect, useRef } from "react";
|
|
150
87
|
import { createSubscription } from "@dxos/client/echo";
|
|
151
88
|
var useSubscription = (cb, selection) => {
|
|
152
|
-
const callbackRef =
|
|
89
|
+
const callbackRef = useRef(cb);
|
|
153
90
|
callbackRef.current = cb;
|
|
154
|
-
const subscriptionRef =
|
|
155
|
-
|
|
91
|
+
const subscriptionRef = useRef(null);
|
|
92
|
+
useEffect(() => {
|
|
156
93
|
subscriptionRef.current = createSubscription(() => {
|
|
157
94
|
callbackRef.current();
|
|
158
95
|
});
|
|
@@ -163,19 +100,15 @@ var useSubscription = (cb, selection) => {
|
|
|
163
100
|
};
|
|
164
101
|
|
|
165
102
|
// src/echo/useSyncState.ts
|
|
166
|
-
import { useEffect as
|
|
103
|
+
import { useEffect as useEffect2, useState } from "react";
|
|
167
104
|
import { Context } from "@dxos/context";
|
|
168
|
-
import {
|
|
105
|
+
import { isEdgePeerId } from "@dxos/echo-protocol";
|
|
169
106
|
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/echo/useSyncState.ts";
|
|
170
|
-
var isEdgePeerId = (peerId, spaceId) => peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);
|
|
171
107
|
var useSyncState = () => {
|
|
172
108
|
const client = useClient();
|
|
173
|
-
const [spaceState, setSpaceState] =
|
|
174
|
-
|
|
175
|
-
const ctx = new Context(void 0, {
|
|
176
|
-
F: __dxlog_file,
|
|
177
|
-
L: 25
|
|
178
|
-
});
|
|
109
|
+
const [spaceState, setSpaceState] = useState({});
|
|
110
|
+
useEffect2(() => {
|
|
111
|
+
const ctx = new Context(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 14 });
|
|
179
112
|
const createSubscriptions = (spaces) => {
|
|
180
113
|
for (const space of spaces) {
|
|
181
114
|
if (spaceState[space.id]) {
|
|
@@ -205,12 +138,9 @@ var useSyncState = () => {
|
|
|
205
138
|
return spaceState;
|
|
206
139
|
};
|
|
207
140
|
var useSpaceSyncState = (space) => {
|
|
208
|
-
const [spaceState, setSpaceState] =
|
|
209
|
-
|
|
210
|
-
const ctx = new Context(void 0, {
|
|
211
|
-
F: __dxlog_file,
|
|
212
|
-
L: 64
|
|
213
|
-
});
|
|
141
|
+
const [spaceState, setSpaceState] = useState();
|
|
142
|
+
useEffect2(() => {
|
|
143
|
+
const ctx = new Context(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 49 });
|
|
214
144
|
space.internal.db.subscribeToSyncState(ctx, ({ peers = [] }) => {
|
|
215
145
|
const syncState = peers.find((state) => isEdgePeerId(state.peerId, space.id));
|
|
216
146
|
if (syncState) {
|
|
@@ -228,7 +158,6 @@ var useSpaceSyncState = (space) => {
|
|
|
228
158
|
export {
|
|
229
159
|
useDatabase,
|
|
230
160
|
useMembers,
|
|
231
|
-
useQueue,
|
|
232
161
|
useSpace,
|
|
233
162
|
useSpaceInvitation,
|
|
234
163
|
useSpaceInvitations,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/echo/index.ts", "../../../../src/echo/useMembers.ts", "../../../../src/echo/useSpaces.ts", "../../../../src/echo/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/echo';\nexport * from '@dxos/echo-react';\n\nexport * from './useMembers';\nexport * from './useQueue';\nexport * from './useSpaces';\nexport * from './useSpaceInvitations';\nexport * from './useSpaceProperties';\nexport * from './useSubscription';\nexport * from './useSyncState';\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 2020 DXOS.org\n//\n\nimport { useState } from 'react';\n\nimport { PublicKey } from '@dxos/client';\nimport { type Space, type SpaceId, SpaceState } from '@dxos/client/echo';\nimport { useAsyncEffect, 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 the default space 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 const [ready, setReady] = useState(false);\n\n useAsyncEffect(async () => {\n // Only wait for ready if looking for the default space.\n if (spaceId) {\n return;\n }\n\n await client.spaces.waitUntilReady();\n setReady(true);\n }, [client, spaceId]);\n\n if (spaceId) {\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\n if (ready && client.halo.identity.get()) {\n return client.spaces.default;\n }\n};\n\n/**\n * Get a Space database by the id of the space.\n * The space is not guaranteed to be in the ready state.\n * Returns the default space 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 */\nexport const useDatabase = (spaceId?: SpaceId): Space['db'] | undefined => {\n const space = useSpace(spaceId);\n return space?.db;\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 2025 DXOS.org\n//\n\nimport { useEffect, useMemo, useRef } from 'react';\n\nimport { type Queue } from '@dxos/client/echo';\nimport { raise } from '@dxos/debug';\nimport { type Entity } from '@dxos/echo';\nimport { type DXN } from '@dxos/keys';\n\nimport { useClient } from '../client';\n\nconst MIN_POLL_INTERVAL = 1_000;\n\nexport type UseQueueOptions = {\n pollInterval?: number;\n};\n\n/**\n * Polls the given Edge queue.\n */\n// TODO(burdon): Replace polling with socket?\n// TODO(dmaretskyi): Move into client package.\n// TODO(dmaretskyi): Consider passing the space into the hook to support queue DXNs without space id.\n// TODO(ZaymonFC): If queue is unchanged returned object should be refferentially stable on poll.\nexport const useQueue = <T extends Entity.Unknown>(\n queueDxn?: DXN,\n options: UseQueueOptions = {},\n): Queue<T> | undefined => {\n const client = useClient();\n const mountedRef = useRef(true);\n\n const queue = useMemo<Queue<T> | undefined>(() => {\n if (!queueDxn) {\n return undefined;\n }\n\n const { spaceId } = queueDxn.asQueueDXN() ?? raise(new TypeError('Invalid queue DXN'));\n return client.spaces.get(spaceId)?.queues.get<T>(queueDxn);\n }, [client, queueDxn?.toString()]);\n\n useEffect(() => {\n void queue?.refresh();\n }, [queue]);\n\n useEffect(() => {\n let timeout: NodeJS.Timeout;\n mountedRef.current = true;\n\n const poll = () => {\n if (!mountedRef.current) {\n return;\n }\n\n void queue?.refresh().finally(() => {\n if (mountedRef.current && options.pollInterval) {\n timeout = setTimeout(poll, Math.max(options.pollInterval ?? 0, MIN_POLL_INTERVAL));\n }\n });\n };\n\n if (options.pollInterval) {\n poll();\n }\n\n return () => {\n mountedRef.current = false;\n clearTimeout(timeout);\n };\n }, [queue, options.pollInterval]);\n\n return queue;\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/client/echo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';\n\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 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 { type SpaceId } from '@dxos/keys';\nimport { EdgeService } from '@dxos/protocols';\n\nimport { useClient } from '../client';\n\nconst isEdgePeerId = (peerId: string, spaceId: SpaceId) =>\n peerId.startsWith(`${EdgeService.AUTOMERGE_REPLICATOR}:${spaceId}`);\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.subscribeToSyncState(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.subscribeToSyncState(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"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAIA,cAAc;AACd,cAAc;;;ACDd,SAASA,2BAA2B;AACpC,SAASC,aAAAA,kBAAqC;AAC9C,SAASC,uBAAyC;AAClD,SAASC,0BAAAA,+BAA8B;;;ACHvC,SAASC,
|
|
6
|
-
"names": ["MulticastObservable", "PublicKey", "HaloSpaceMember", "useMulticastObservable", "
|
|
3
|
+
"sources": ["../../../../src/echo/index.ts", "../../../../src/echo/useMembers.ts", "../../../../src/echo/useSpaces.ts", "../../../../src/echo/useSpaceInvitations.ts", "../../../../src/echo/useSpaceProperties.ts", "../../../../src/echo/useSubscription.ts", "../../../../src/echo/useSyncState.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/echo';\nexport * from '@dxos/echo-react';\n\nexport * from './useMembers';\nexport * from './useSpaces';\nexport * from './useSpaceInvitations';\nexport * from './useSpaceProperties';\nexport * from './useSubscription';\nexport * from './useSyncState';\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 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\n/**\n * Get a Space database by the id of the space.\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 * @deprecated Use useSpace.\n */\nexport const useDatabase = (spaceId?: SpaceId): Space['db'] | undefined => {\n const space = useSpace(spaceId);\n return space?.db;\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 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 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.subscribeToSyncState(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.subscribeToSyncState(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"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["MulticastObservable", "PublicKey", "HaloSpaceMember", "useMulticastObservable", "PublicKey", "SpaceState", "useMulticastObservable", "useSpace", "spaceId", "client", "useClient", "spaces", "useMulticastObservable", "undefined", "find", "space", "PublicKey", "key", "equals", "id", "useDatabase", "db", "useSpaces", "all", "filter", "state", "get", "SpaceState", "SPACE_READY", "useMembers", "spaceKey", "spaces", "useSpaces", "all", "space", "find", "PublicKey", "key", "equals", "id", "undefined", "members", "useMulticastObservable", "MulticastObservable", "empty", "filter", "member", "role", "HaloSpaceMember", "Role", "REMOVED", "useMemo", "MulticastObservable", "useMulticastObservable", "useSpaceInvitations", "spaceId", "space", "useSpace", "useMulticastObservable", "invitations", "MulticastObservable", "empty", "useSpaceInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "MulticastObservable", "SpaceState", "useObject", "useMulticastObservable", "useSpaceProperties", "spaceId", "space", "useSpace", "spaceState", "useMulticastObservable", "state", "MulticastObservable", "empty", "properties", "SpaceState", "SPACE_READY", "undefined", "useObject", "useEffect", "useRef", "createSubscription", "useSubscription", "cb", "selection", "callbackRef", "current", "subscriptionRef", "unsubscribe", "update", "useEffect", "useState", "Context", "isEdgePeerId", "spaceState", "setSpaceState", "useEffect", "Context", "createSubscriptions", "space", "spaces", "id", "onDispose", "syncState", "client", "internal", "peers", "find", "isEdgePeerId", "state"]
|
|
7
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useInvitationStatus
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-RQJPEHDY.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useClient
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-CUDKNAMV.mjs";
|
|
8
|
+
import "../chunk-WUTK2IJF.mjs";
|
|
9
9
|
|
|
10
10
|
// src/halo/index.ts
|
|
11
11
|
import { Device, DeviceKind, DeviceType } from "@dxos/client/halo";
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/halo/index.ts", "../../../../src/halo/useContacts.ts", "../../../../src/halo/useCredentials.ts", "../../../../src/halo/useDevices.ts", "../../../../src/halo/useHaloInvitations.ts", "../../../../src/halo/useIdentity.ts", "../../../../src/halo/useKeyStore.ts"],
|
|
4
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 './useCredentials';\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 { Credential } from '@dxos/client/halo';\nimport { useMulticastObservable } from '@dxos/react-hooks';\n\nimport { useClient } from '../client';\n\nexport const useCredentials = (): Credential[] => {\n const client = useClient();\n return useMulticastObservable(client.halo.credentials);\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 { type CancellableInvitationObservable, useInvitationStatus } 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(): this {\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): void {\n localStorage.getItem(key);\n }\n\n setKey(key: string, value: string): void {\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,SAKEA,QACAC,YACAC,kBACK;;;ACRP,SAASC,8BAA8B;AAShC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,uBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,iBAAiB,MAAA;AAC5B,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;;;ACPA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,aAAa,MAAA;AACxB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,OAAO;AACnD;;;ACRA,SAASC,eAAe;AAExB,SAASC,0BAAAA,+BAA8B;AAKhC,IAAMC,qBAAqB,MAAA;AAChC,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;AAEO,IAAMC,oBAAoB,CAACC,iBAAAA;AAChC,QAAMF,cAAcL,mBAAAA;AACpB,QAAMQ,aAAaC,QACjB,MAAMJ,YAAYK,KAAK,CAACF,gBAAeA,YAAWG,IAAG,EAAGJ,iBAAiBA,YAAAA,GACzE;IAACF;GAAY;AAEf,SAAOO,oBAAoBJ,UAAAA;AAC7B;;;AClBA,SAASK,0BAAAA,+BAA8B;AAQhC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,WAAAA,UAASC,kBAAkB;AAG7B,IAAMC,WAAN,MAAMA;;EACHC,UAAU,oBAAIC,IAAAA;EAEtB,YAA6BC,eAAyB,CAAA,GAAI;SAA7BA,eAAAA;EAA8B;EAE3D,IAAIC,MAAM;AACR,WAAO,KAAKH;EACd;;EAGAI,aAAmB;AACjB,SAAKF,aAAaG,QAAQ,CAACC,QAAAA;AACzB,YAAMC,QAAQC,aAAaC,QAAQH,GAAAA;AACnC,WAAKI,OAAOJ,KAAKC,SAAS,EAAA;IAC5B,CAAA;AAEA,WAAO;EACT;EAEAI,OAAOL,KAAmB;AACxBE,iBAAaC,QAAQH,GAAAA;EACvB;EAEAI,OAAOJ,KAAaC,OAAqB;AACvCC,iBAAaI,QAAQN,KAAK,EAAA;AAC1B,SAAKN,QAAQa,IAAIP,KAAKC,KAAAA;EACxB;AACF;AAMO,IAAMO,cAAc,CACzBC,cAAwB,CAAA,MAAE;AAE1B,QAAM,CAAA,EAAGC,WAAAA,
|
|
6
|
-
"names": ["Device", "DeviceKind", "DeviceType", "useMulticastObservable", "useContacts", "client", "useClient", "useMulticastObservable", "halo", "contacts", "useMulticastObservable", "useCredentials", "client", "useClient", "useMulticastObservable", "halo", "credentials", "useMulticastObservable", "useDevices", "client", "useClient", "useMulticastObservable", "halo", "devices", "useMemo", "useMulticastObservable", "useHaloInvitations", "client", "useClient", "useMulticastObservable", "halo", "invitations", "useHaloInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "useMulticastObservable", "useIdentity", "client", "useClient", "useMulticastObservable", "halo", "identity", "useMemo", "useReducer", "KeyStore", "_keyMap", "Map", "_defaultKeys", "map", "initialize", "forEach", "key", "value", "localStorage", "getItem", "setKey", "getKey", "setItem", "set", "useKeyStore", "defaultKeys", "forceUpdate", "
|
|
5
|
+
"mappings": ";;;;;;;;;;AAKA,SAKEA,QACAC,YACAC,kBACK;;;ACRP,SAASC,8BAA8B;AAShC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,uBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,iBAAiB,MAAA;AAC5B,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;;;ACPA,SAASC,0BAAAA,+BAA8B;AAIhC,IAAMC,aAAa,MAAA;AACxB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,OAAO;AACnD;;;ACRA,SAASC,eAAe;AAExB,SAASC,0BAAAA,+BAA8B;AAKhC,IAAMC,qBAAqB,MAAA;AAChC,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,WAAW;AACvD;AAEO,IAAMC,oBAAoB,CAACC,iBAAAA;AAChC,QAAMF,cAAcL,mBAAAA;AACpB,QAAMQ,aAAaC,QACjB,MAAMJ,YAAYK,KAAK,CAACF,gBAAeA,YAAWG,IAAG,EAAGJ,iBAAiBA,YAAAA,GACzE;IAACF;GAAY;AAEf,SAAOO,oBAAoBJ,UAAAA;AAC7B;;;AClBA,SAASK,0BAAAA,+BAA8B;AAQhC,IAAMC,cAAc,MAAA;AACzB,QAAMC,SAASC,UAAAA;AACf,SAAOC,wBAAuBF,OAAOG,KAAKC,QAAQ;AACpD;;;ACZA,SAASC,WAAAA,UAASC,kBAAkB;AAG7B,IAAMC,WAAN,MAAMA;;EACHC,UAAU,oBAAIC,IAAAA;EAEtB,YAA6BC,eAAyB,CAAA,GAAI;SAA7BA,eAAAA;EAA8B;EAE3D,IAAIC,MAAM;AACR,WAAO,KAAKH;EACd;;EAGAI,aAAmB;AACjB,SAAKF,aAAaG,QAAQ,CAACC,QAAAA;AACzB,YAAMC,QAAQC,aAAaC,QAAQH,GAAAA;AACnC,WAAKI,OAAOJ,KAAKC,SAAS,EAAA;IAC5B,CAAA;AAEA,WAAO;EACT;EAEAI,OAAOL,KAAmB;AACxBE,iBAAaC,QAAQH,GAAAA;EACvB;EAEAI,OAAOJ,KAAaC,OAAqB;AACvCC,iBAAaI,QAAQN,KAAK,EAAA;AAC1B,SAAKN,QAAQa,IAAIP,KAAKC,KAAAA;EACxB;AACF;AAMO,IAAMO,cAAc,CACzBC,cAAwB,CAAA,MAAE;AAE1B,QAAM,CAAA,EAAGC,WAAAA,IAAelB,WAAW,CAACmB,MAAMA,IAAI,GAAG,CAAA;AACjD,QAAMC,QAAQrB,SAAQ,MAAM,IAAIE,SAASgB,WAAAA,EAAaX,WAAU,GAAI;IAACW;GAAY;AACjF,QAAML,SAAS,CAACJ,KAAaC,UAAAA;AAC3BW,UAAMR,OAAOJ,KAAKC,KAAAA;AAClBS,gBAAAA;EACF;AAEA,SAAO;IAACE,MAAMf;IAAKO;;AACrB;",
|
|
6
|
+
"names": ["Device", "DeviceKind", "DeviceType", "useMulticastObservable", "useContacts", "client", "useClient", "useMulticastObservable", "halo", "contacts", "useMulticastObservable", "useCredentials", "client", "useClient", "useMulticastObservable", "halo", "credentials", "useMulticastObservable", "useDevices", "client", "useClient", "useMulticastObservable", "halo", "devices", "useMemo", "useMulticastObservable", "useHaloInvitations", "client", "useClient", "useMulticastObservable", "halo", "invitations", "useHaloInvitation", "invitationId", "invitation", "useMemo", "find", "get", "useInvitationStatus", "useMulticastObservable", "useIdentity", "client", "useClient", "useMulticastObservable", "halo", "identity", "useMemo", "useReducer", "KeyStore", "_keyMap", "Map", "_defaultKeys", "map", "initialize", "forEach", "key", "value", "localStorage", "getItem", "setKey", "getKey", "setItem", "set", "useKeyStore", "defaultKeys", "forceUpdate", "x", "store"]
|
|
7
7
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CUDKNAMV.mjs";
|
|
5
5
|
import {
|
|
6
6
|
ClientProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WL3Z5HOH.mjs";
|
|
8
8
|
import {
|
|
9
9
|
ClientContext
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WUTK2IJF.mjs";
|
|
11
11
|
|
|
12
12
|
// src/index.ts
|
|
13
13
|
export * from "@dxos/client";
|
|
@@ -32,23 +32,13 @@ var useAgentHostingClient = () => {
|
|
|
32
32
|
var makeClient = ({ config, halo }) => {
|
|
33
33
|
const agentHostingConfig = config.get("runtime.services.agentHosting");
|
|
34
34
|
if (!agentHostingConfig) {
|
|
35
|
-
log("no agent hosting configured", void 0, {
|
|
36
|
-
F: __dxlog_file,
|
|
37
|
-
L: 39,
|
|
38
|
-
S: void 0,
|
|
39
|
-
C: (f, a) => f(...a)
|
|
40
|
-
});
|
|
35
|
+
log("no agent hosting configured", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 27, S: void 0 });
|
|
41
36
|
return null;
|
|
42
37
|
}
|
|
43
38
|
let agentHostingProviderClient = null;
|
|
44
39
|
switch (agentHostingConfig.type) {
|
|
45
40
|
case "LOCAL_TESTING": {
|
|
46
|
-
log("using FakeAgentHostingProvider", void 0, {
|
|
47
|
-
F: __dxlog_file,
|
|
48
|
-
L: 47,
|
|
49
|
-
S: void 0,
|
|
50
|
-
C: (f, a) => f(...a)
|
|
51
|
-
});
|
|
41
|
+
log("using FakeAgentHostingProvider", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 35, S: void 0 });
|
|
52
42
|
return new FakeAgentHostingProvider();
|
|
53
43
|
}
|
|
54
44
|
case "AGENTHOSTING_API": {
|
|
@@ -60,12 +50,7 @@ var makeClient = ({ config, halo }) => {
|
|
|
60
50
|
}
|
|
61
51
|
}
|
|
62
52
|
default: {
|
|
63
|
-
log.error("Unknown agent hosting provider type: " + agentHostingConfig.type, void 0, {
|
|
64
|
-
F: __dxlog_file,
|
|
65
|
-
L: 62,
|
|
66
|
-
S: void 0,
|
|
67
|
-
C: (f, a) => f(...a)
|
|
68
|
-
});
|
|
53
|
+
log.error("Unknown agent hosting provider type: " + agentHostingConfig.type, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 50, S: void 0 });
|
|
69
54
|
return null;
|
|
70
55
|
}
|
|
71
56
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
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
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
|
|
6
|
-
"names": ["useMulticastObservable", "React", "createContext", "useContext", "useState", "AgentManagerClient", "FakeAgentHostingProvider", "log", "AgentHostingContext", "
|
|
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;aACA;AAEJ,eAAA;MAEA;IAAS;;AAGT,UAAA,MAAA,0CAAA,mBAAA,MAAA,QAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AACF,aAAA;IACF;;;;;AC7DA,SAASS,WAAWC,YAAAA,iBAAgB;AAI7B,IAAMC,kBAAkB,CAACC,WAAAA;AAC9B,QAAM,CAACC,QAAQC,SAAAA,IAAaJ,UAAAA;AAC5BD,YAAU,MAAA;AACR,QAAI,CAACG,QAAQ;AACX;IACF;AAEA,UAAMG,eAAeH,OAAOC,OAAOG,UAAU,CAACH,YAAWC,UAAUD,OAAAA,CAAAA;AACnE,WAAO,MAAME,aAAaE,YAAW;EACvC,GAAG;IAACL;IAAQE;GAAU;AAEtB,SAAOD;AACT;;;AChBA,SAASK,cAAAA,mBAAkB;AAE3B,SAASC,aAAa;AAQf,IAAMC,YAAY,MAAA;AACvB,QAAM,EAAEC,OAAM,IAAKC,YAAWC,aAAAA,KAAkBC,MAAM,IAAIC,MAAM,wBAAA,CAAA;AAChE,SAAOJ,OAAOK;AAChB;;;ACbA,SAASC,aAAAA,YAAWC,YAAAA,iBAAgB;AAS7B,IAAMC,WAAW,MAAA;AACtB,QAAMC,SAASC,UAAAA;AACf,SAAOD,OAAOE;AAChB;AAKO,IAAMC,kBAAkB,MAAA;AAC7B,QAAMH,SAASC,UAAAA;AACf,QAAM,CAACG,SAASC,UAAAA,IAAcC,UAASN,OAAOE,MAAME,OAAO;AAC3DG,EAAAA,WAAU,MAAMP,OAAOE,MAAMM,gBAAgBH,UAAAA,GAAa;IAACL;GAAO;AAClE,SAAOI;AACT;;;ACtBA,SAASK,cAAAA,mBAAkB;AAG3B,SAASC,SAAAA,cAAa;AAIf,IAAMC,YAAY,MAAA;AACvB,QAAM,EAAEC,OAAM,IAAKC,YAAWC,aAAAA,KAAkBC,OAAM,IAAIC,MAAM,wBAAA,CAAA;AAChE,SAAOJ;AACT;",
|
|
6
|
+
"names": ["useMulticastObservable", "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
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
useClient
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-CUDKNAMV.mjs";
|
|
5
|
+
import "../chunk-WUTK2IJF.mjs";
|
|
6
6
|
|
|
7
7
|
// src/mesh/index.ts
|
|
8
8
|
export * from "@dxos/client/mesh";
|