@dxos/react-client 0.8.4-main.1da679c → 0.8.4-main.21d9917
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 +11 -0
- package/.storybook/preview.mts +8 -0
- package/dist/lib/browser/chunk-5UKA2BMA.mjs +179 -0
- package/dist/lib/browser/chunk-5UKA2BMA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BXOLJYAY.mjs → chunk-LO3TU5CK.mjs} +4 -4
- package/dist/lib/browser/chunk-LO3TU5CK.mjs.map +7 -0
- package/dist/lib/browser/chunk-PFF63FPR.mjs +16 -0
- package/dist/lib/browser/chunk-PFF63FPR.mjs.map +7 -0
- package/dist/lib/browser/chunk-TSF6Y5VB.mjs +8 -0
- package/dist/lib/browser/chunk-TSF6Y5VB.mjs.map +7 -0
- package/dist/lib/browser/devtools/index.mjs +2 -1
- package/dist/lib/browser/devtools/index.mjs.map +1 -1
- package/dist/lib/browser/echo/index.mjs +46 -93
- package/dist/lib/browser/echo/index.mjs.map +4 -4
- package/dist/lib/browser/halo/index.mjs +8 -21
- package/dist/lib/browser/halo/index.mjs.map +2 -2
- package/dist/lib/browser/index.mjs +114 -12
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invitations/index.mjs +1 -1
- package/dist/lib/browser/mesh/index.mjs +2 -1
- package/dist/lib/browser/mesh/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +91 -83
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-373DPHEQ.mjs +10 -0
- package/dist/lib/node-esm/chunk-373DPHEQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-256IHY6F.mjs → chunk-AQJH2UNZ.mjs} +4 -4
- package/dist/lib/node-esm/chunk-AQJH2UNZ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NETTSER2.mjs +17 -0
- package/dist/lib/node-esm/chunk-NETTSER2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-T3QTQHBD.mjs +180 -0
- package/dist/lib/node-esm/chunk-T3QTQHBD.mjs.map +7 -0
- package/dist/lib/node-esm/devtools/index.mjs +2 -1
- package/dist/lib/node-esm/devtools/index.mjs.map +1 -1
- package/dist/lib/node-esm/echo/index.mjs +46 -93
- package/dist/lib/node-esm/echo/index.mjs.map +4 -4
- package/dist/lib/node-esm/halo/index.mjs +8 -21
- package/dist/lib/node-esm/halo/index.mjs.map +2 -2
- package/dist/lib/node-esm/index.mjs +114 -12
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invitations/index.mjs +1 -1
- package/dist/lib/node-esm/mesh/index.mjs +2 -1
- package/dist/lib/node-esm/mesh/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +91 -83
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/client/ClientProvider.d.ts +0 -10
- package/dist/types/src/client/ClientProvider.d.ts.map +1 -1
- package/dist/types/src/echo/index.d.ts +2 -2
- package/dist/types/src/echo/index.d.ts.map +1 -1
- package/dist/types/src/echo/useMembers.d.ts +2 -2
- package/dist/types/src/echo/useMembers.d.ts.map +1 -1
- package/dist/types/src/echo/useQueue.d.ts +2 -2
- package/dist/types/src/echo/useQueue.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts +3 -2
- package/dist/types/src/echo/useSpaceInvitations.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaceProperties.d.ts +13 -0
- package/dist/types/src/echo/useSpaceProperties.d.ts.map +1 -0
- package/dist/types/src/echo/useSpaces.d.ts +17 -8
- package/dist/types/src/echo/useSpaces.d.ts.map +1 -1
- package/dist/types/src/echo/useSubscription.d.ts +1 -1
- package/dist/types/src/echo/useSubscription.d.ts.map +1 -1
- package/dist/types/src/halo/Passkey.stories.d.ts +1 -1
- package/dist/types/src/halo/Passkey.stories.d.ts.map +1 -1
- package/dist/types/src/invitations/useInvitationStatus.d.ts +1 -1
- package/dist/types/src/invitations/useInvitationStatus.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.d.ts +6 -5
- package/dist/types/src/testing/ClientRepeater.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.stories.d.ts +0 -1
- package/dist/types/src/testing/ClientRepeater.stories.d.ts.map +1 -1
- package/dist/types/src/testing/context.d.ts +4 -2
- package/dist/types/src/testing/context.d.ts.map +1 -1
- package/dist/types/src/testing/withClientProvider.d.ts +5 -9
- 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/moon.yml +4 -0
- package/package.json +35 -32
- package/src/client/ClientProvider.tsx +12 -26
- package/src/echo/index.ts +2 -2
- package/src/echo/useMembers.ts +5 -3
- package/src/echo/useQueue.ts +2 -2
- package/src/echo/useSpaceInvitations.ts +9 -4
- package/src/echo/useSpaceProperties.ts +28 -0
- package/src/echo/useSpaces.test.tsx +1 -1
- package/src/echo/useSpaces.ts +33 -12
- package/src/echo/useSubscription.ts +1 -1
- package/src/echo/useSyncState.ts +2 -2
- package/src/halo/Passkey.stories.tsx +11 -14
- package/src/invitations/useInvitationStatus.ts +9 -8
- package/src/playwright/playwright.config.ts +1 -1
- package/src/testing/ClientRepeater.stories.tsx +9 -6
- package/src/testing/ClientRepeater.tsx +12 -15
- package/src/testing/context.tsx +4 -3
- package/src/testing/withClientProvider.stories.tsx +12 -9
- package/src/testing/withClientProvider.tsx +75 -59
- package/tsconfig.json +3 -6
- package/vitest.config.ts +12 -16
- package/dist/lib/browser/chunk-BXOLJYAY.mjs.map +0 -7
- package/dist/lib/browser/chunk-TA2HGRAF.mjs +0 -309
- package/dist/lib/browser/chunk-TA2HGRAF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-256IHY6F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZJMNF7GC.mjs +0 -311
- package/dist/lib/node-esm/chunk-ZJMNF7GC.mjs.map +0 -7
- package/dist/types/src/echo/useQuery.d.ts +0 -11
- package/dist/types/src/echo/useQuery.d.ts.map +0 -1
- package/dist/types/src/echo/useQuery.test.d.ts +0 -2
- package/dist/types/src/echo/useQuery.test.d.ts.map +0 -1
- package/dist/types/src/echo/useSchema.d.ts +0 -8
- package/dist/types/src/echo/useSchema.d.ts.map +0 -1
- package/src/echo/useQuery.test.tsx +0 -129
- package/src/echo/useQuery.ts +0 -64
- package/src/echo/useSchema.ts +0 -54
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
ClientProvider
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-T3QTQHBD.mjs";
|
|
5
|
+
import "../chunk-373DPHEQ.mjs";
|
|
5
6
|
|
|
6
7
|
// src/testing/index.ts
|
|
7
8
|
export * from "@dxos/client/testing";
|
|
@@ -10,24 +11,20 @@ export * from "@dxos/client/testing";
|
|
|
10
11
|
import { createContext, useContext } from "react";
|
|
11
12
|
import { raise } from "@dxos/debug";
|
|
12
13
|
var ClientStory = /* @__PURE__ */ createContext(void 0);
|
|
13
|
-
var
|
|
14
|
+
var useClientStory = () => {
|
|
14
15
|
return useContext(ClientStory) ?? raise(new Error("Missing ClientStory"));
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
// src/testing/ClientRepeater.tsx
|
|
18
|
-
import React, {
|
|
19
|
+
import React, { useRef, useState } from "react";
|
|
19
20
|
import { Client } from "@dxos/client";
|
|
20
21
|
import { TestBuilder, performInvitation } from "@dxos/client/testing";
|
|
21
|
-
import { registerSignalsRuntime } from "@dxos/echo-signals/react";
|
|
22
22
|
import { faker } from "@dxos/random";
|
|
23
23
|
import { useAsyncEffect } from "@dxos/react-hooks";
|
|
24
24
|
var ClientRepeater = (props) => {
|
|
25
|
-
const { component: Component, controls: Controls, count = 1, types, createIdentity, createSpace,
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
registerSignalsRuntime();
|
|
28
|
-
}, []);
|
|
25
|
+
const { component: Component, controls: Controls, count = 1, types, createIdentity, createSpace, onCreateSpace } = props;
|
|
29
26
|
const [clients, setClients] = useState(props.clients ?? []);
|
|
30
|
-
const [
|
|
27
|
+
const [spaceId, setSpaceId] = useState();
|
|
31
28
|
const testBuilder = useRef(new TestBuilder());
|
|
32
29
|
useAsyncEffect(async () => {
|
|
33
30
|
const clients2 = [
|
|
@@ -45,8 +42,8 @@ var ClientRepeater = (props) => {
|
|
|
45
42
|
const space = await client.spaces.create({
|
|
46
43
|
name: faker.commerce.productName()
|
|
47
44
|
});
|
|
48
|
-
|
|
49
|
-
await
|
|
45
|
+
setSpaceId(space.id);
|
|
46
|
+
await onCreateSpace?.({
|
|
50
47
|
client,
|
|
51
48
|
space
|
|
52
49
|
}, {});
|
|
@@ -68,26 +65,28 @@ var ClientRepeater = (props) => {
|
|
|
68
65
|
}, /* @__PURE__ */ React.createElement(Component, {
|
|
69
66
|
id: index,
|
|
70
67
|
count: clients.length,
|
|
71
|
-
|
|
68
|
+
spaceId,
|
|
72
69
|
...props.args
|
|
73
70
|
}))));
|
|
74
71
|
};
|
|
75
72
|
|
|
76
73
|
// src/testing/withClientProvider.tsx
|
|
77
|
-
import React2, {
|
|
74
|
+
import React2, { useCallback, useEffect, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
78
75
|
import { ErrorBoundary as NaturalErrorBoundary } from "react-error-boundary";
|
|
79
76
|
import { Trigger } from "@dxos/async";
|
|
80
77
|
import { TestBuilder as TestBuilder2, performInvitation as performInvitation2 } from "@dxos/client/testing";
|
|
81
78
|
import { log } from "@dxos/log";
|
|
82
79
|
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/react-client/src/testing/withClientProvider.tsx";
|
|
83
|
-
var initializeClient = async (client, { createIdentity, createSpace,
|
|
80
|
+
var initializeClient = async (client, { createIdentity, createSpace, onCreateIdentity, onCreateSpace, onInitialized }, context) => {
|
|
84
81
|
await onInitialized?.(client);
|
|
85
82
|
if (createIdentity || createSpace) {
|
|
86
83
|
if (!client.halo.identity.get()) {
|
|
87
84
|
await client.halo.createIdentity();
|
|
88
|
-
await
|
|
85
|
+
await client.spaces.waitUntilReady();
|
|
86
|
+
await client.spaces.default.waitUntilReady();
|
|
87
|
+
await onCreateIdentity?.({
|
|
89
88
|
client
|
|
90
|
-
});
|
|
89
|
+
}, context);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
let space;
|
|
@@ -95,24 +94,26 @@ var initializeClient = async (client, { createIdentity, createSpace, onSpaceCrea
|
|
|
95
94
|
space = await client.spaces.create({
|
|
96
95
|
name: "Test Space"
|
|
97
96
|
});
|
|
98
|
-
await
|
|
97
|
+
await space.waitUntilReady();
|
|
98
|
+
await onCreateSpace?.({
|
|
99
99
|
client,
|
|
100
100
|
space
|
|
101
101
|
}, context);
|
|
102
102
|
}
|
|
103
103
|
return {
|
|
104
|
-
space
|
|
104
|
+
space,
|
|
105
|
+
spaceId: space?.id
|
|
105
106
|
};
|
|
106
107
|
};
|
|
107
|
-
var withClientProvider = ({ createIdentity, createSpace,
|
|
108
|
+
var withClientProvider = ({ createIdentity, createSpace, onCreateSpace, onCreateIdentity, onInitialized, ...props } = {}) => {
|
|
108
109
|
return (Story, context) => {
|
|
109
110
|
const [data, setData] = useState2({});
|
|
110
111
|
const handleInitialized = async (client) => {
|
|
111
112
|
const data2 = await initializeClient(client, {
|
|
112
113
|
createIdentity,
|
|
113
114
|
createSpace,
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
onCreateSpace,
|
|
116
|
+
onCreateIdentity,
|
|
116
117
|
onInitialized
|
|
117
118
|
}, context);
|
|
118
119
|
setData(data2);
|
|
@@ -125,83 +126,91 @@ var withClientProvider = ({ createIdentity, createSpace, onSpaceCreated, onIdent
|
|
|
125
126
|
}, /* @__PURE__ */ React2.createElement(Story, null))));
|
|
126
127
|
};
|
|
127
128
|
};
|
|
128
|
-
var
|
|
129
|
-
id: 0
|
|
130
|
-
});
|
|
131
|
-
var useMultiClient = () => useContext2(MultiClientContext);
|
|
132
|
-
var withMultiClientProvider = ({ numClients = 2, createIdentity, createSpace, onSpaceCreated, onIdentityCreated, onInitialized, ...props }) => {
|
|
129
|
+
var withMultiClientProvider = ({ numClients = 2, createIdentity, createSpace, onCreateSpace, onCreateIdentity, onInitialized, ...props }) => {
|
|
133
130
|
return (Story, context) => {
|
|
134
|
-
const builder = useRef2(new TestBuilder2());
|
|
135
|
-
const hostRef = useRef2();
|
|
136
131
|
const spaceReady = useRef2(new Trigger());
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
132
|
+
const [spaceId, setSpaceId] = useState2();
|
|
133
|
+
const clients = useMemo(() => {
|
|
134
|
+
const buidler = new TestBuilder2();
|
|
135
|
+
return Array.from({
|
|
136
|
+
length: numClients
|
|
137
|
+
}).map(() => {
|
|
138
|
+
return {
|
|
139
|
+
services: buidler.createLocalClientServices()
|
|
140
|
+
};
|
|
145
141
|
});
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
142
|
+
}, [
|
|
143
|
+
numClients
|
|
144
|
+
]);
|
|
145
|
+
const handleInitialized = useCallback(async (client, index) => {
|
|
146
|
+
if (index === 0) {
|
|
147
|
+
const { space } = await initializeClient(client, {
|
|
148
|
+
createIdentity,
|
|
149
|
+
createSpace,
|
|
150
|
+
onCreateSpace,
|
|
151
|
+
onCreateIdentity,
|
|
152
|
+
onInitialized
|
|
153
|
+
}, context);
|
|
154
|
+
log.info("inviting", {
|
|
155
|
+
index,
|
|
156
|
+
spaceId: space?.id
|
|
157
|
+
}, {
|
|
158
|
+
F: __dxlog_file,
|
|
159
|
+
L: 150,
|
|
160
|
+
S: void 0,
|
|
161
|
+
C: (f, a) => f(...a)
|
|
162
|
+
});
|
|
163
|
+
setSpaceId(space?.id);
|
|
164
|
+
spaceReady.current.wake(space);
|
|
165
|
+
} else {
|
|
166
|
+
await initializeClient(client, {
|
|
167
|
+
createIdentity,
|
|
168
|
+
onInitialized
|
|
169
|
+
}, context);
|
|
170
|
+
log.info("waiting", {
|
|
171
|
+
index
|
|
172
|
+
}, {
|
|
173
|
+
F: __dxlog_file,
|
|
174
|
+
L: 157,
|
|
175
|
+
S: void 0,
|
|
176
|
+
C: (f, a) => f(...a)
|
|
177
|
+
});
|
|
178
|
+
const space = await spaceReady.current.wait();
|
|
179
|
+
if (space) {
|
|
180
|
+
log.info("joining", {
|
|
181
|
+
index,
|
|
182
|
+
spaceId: space.id
|
|
159
183
|
}, {
|
|
160
184
|
F: __dxlog_file,
|
|
161
|
-
L:
|
|
185
|
+
L: 160,
|
|
162
186
|
S: void 0,
|
|
163
187
|
C: (f, a) => f(...a)
|
|
164
188
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}, context);
|
|
170
|
-
const space = await spaceReady.current.wait();
|
|
171
|
-
if (space) {
|
|
172
|
-
log.info("joining", {
|
|
173
|
-
index
|
|
174
|
-
}, {
|
|
175
|
-
F: __dxlog_file,
|
|
176
|
-
L: 152,
|
|
177
|
-
S: void 0,
|
|
178
|
-
C: (f, a) => f(...a)
|
|
179
|
-
});
|
|
180
|
-
await Promise.all(performInvitation2({
|
|
181
|
-
host: space,
|
|
182
|
-
guest: client.spaces
|
|
183
|
-
}));
|
|
184
|
-
}
|
|
189
|
+
await Promise.all(performInvitation2({
|
|
190
|
+
host: space,
|
|
191
|
+
guest: client.spaces
|
|
192
|
+
}));
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
|
-
};
|
|
188
|
-
return /* @__PURE__ */ React2.createElement(
|
|
189
|
-
|
|
190
|
-
}
|
|
195
|
+
}, []);
|
|
196
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
197
|
+
className: "absolute inset-0 grid grid-flow-col auto-cols-fr gap-4 overflow-hidden"
|
|
198
|
+
}, clients.map((client, index) => /* @__PURE__ */ React2.createElement(ClientProvider, {
|
|
191
199
|
key: index,
|
|
200
|
+
services: client.services,
|
|
201
|
+
onInitialized: (client2) => handleInitialized(client2, index),
|
|
202
|
+
...props
|
|
203
|
+
}, /* @__PURE__ */ React2.createElement(ClientStory.Provider, {
|
|
192
204
|
value: {
|
|
193
|
-
|
|
205
|
+
index,
|
|
206
|
+
spaceId
|
|
194
207
|
}
|
|
195
|
-
}, /* @__PURE__ */ React2.createElement(
|
|
196
|
-
services: builder.current.createLocalClientServices(),
|
|
197
|
-
onInitialized: (client) => handleInitialized(client, index),
|
|
198
|
-
...props
|
|
199
|
-
}, /* @__PURE__ */ React2.createElement(Story, null)))));
|
|
208
|
+
}, /* @__PURE__ */ React2.createElement(ErrorBoundary, null, /* @__PURE__ */ React2.createElement(Story, null))))));
|
|
200
209
|
};
|
|
201
210
|
};
|
|
202
211
|
var ErrorBoundary = ({ children }) => {
|
|
203
212
|
const [error, setError] = useState2();
|
|
204
|
-
|
|
213
|
+
useEffect(() => {
|
|
205
214
|
const handleError = (event) => {
|
|
206
215
|
setError(event.reason);
|
|
207
216
|
};
|
|
@@ -238,8 +247,7 @@ var ErrorFallback = ({ error }) => {
|
|
|
238
247
|
export {
|
|
239
248
|
ClientRepeater,
|
|
240
249
|
ClientStory,
|
|
241
|
-
|
|
242
|
-
useMultiClient,
|
|
250
|
+
useClientStory,
|
|
243
251
|
withClientProvider,
|
|
244
252
|
withMultiClientProvider
|
|
245
253
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/testing/index.ts", "../../../../src/testing/context.tsx", "../../../../src/testing/ClientRepeater.tsx", "../../../../src/testing/withClientProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/testing';\n\nexport * from './context';\nexport * from './ClientRepeater';\nexport * from './withClientProvider';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { type Space } from '@dxos/client/echo';\nimport { raise } from '@dxos/debug';\n\nexport type ClientStory = {\n space?: Space;\n};\n\n// TODO(wittjosiah): Add to multi-client as well.\nexport const ClientStory = createContext<ClientStory | undefined>(undefined);\n\nexport const useClientProvider = (): ClientStory => {\n return useContext(ClientStory) ?? raise(new Error('Missing ClientStory'));\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { type FC, useEffect, useRef, useState } from 'react';\n\nimport { Client, type PublicKey } from '@dxos/client';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { type TypedObject } from '@dxos/echo-schema';\nimport { registerSignalsRuntime } from '@dxos/echo-signals/react';\nimport { faker } from '@dxos/random';\nimport { useAsyncEffect } from '@dxos/react-hooks';\n\nimport { ClientProvider } from '../client';\n\nimport { type WithClientProviderProps } from './withClientProvider';\n\nexport type ClientRepeatedComponentProps = { id: number; count: number; spaceKey?: PublicKey };\n\nexport type ClientRepeaterControlsProps = { clients: Client[] };\n\n// TODO(burdon): Reconcile with ClientProviderProps.\nexport type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {\n className?: string;\n component: FC<ClientRepeatedComponentProps>;\n controls?: FC<ClientRepeaterControlsProps>;\n count?: number;\n clients?: Client[];\n types?: TypedObject[];\n args?: Omit<P, 'id' | 'count'>;\n} & Pick<WithClientProviderProps, 'createIdentity' | 'createSpace' | 'onSpaceCreated'>;\n\n/**\n * Utility component for Storybook stories which sets up clients for n peers.\n * The `Component` property is rendered n times, once for each peer.\n * @deprecated use `withClientProvider`.\n */\n// TODO(burdon): To discuss: evolve ClientRepeater with optional decorator that uses it.\n// NOTE: This is specifically not a storybook decorator because it broke stories as a decorator.\n// This seems primarily due to the fact that it required top-level await for the clients to initialize.\n// Storybook seemed to handle it alright, but Chromatic had a lot of trouble with it.\n// There was also a question of whether or not calling the story function multiple times was a good idea.\nexport const ClientRepeater = <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => {\n const {\n component: Component,\n controls: Controls,\n count = 1,\n types,\n createIdentity,\n createSpace,\n onSpaceCreated,\n } = props;\n useEffect(() => {\n registerSignalsRuntime();\n }, []);\n\n const [clients, setClients] = useState(props.clients ?? []);\n const [spaceKey, setSpaceKey] = useState<PublicKey>();\n\n const testBuilder = useRef(new TestBuilder());\n useAsyncEffect(async () => {\n const clients = [...Array(count)].map(\n (_) => new Client({ services: testBuilder.current.createLocalClientServices(), types }),\n );\n\n await Promise.all(clients.map((client) => client.initialize()));\n if (createIdentity || createSpace) {\n await Promise.all(clients.map((client) => client.halo.createIdentity()));\n }\n\n if (createSpace) {\n const client = clients[0];\n const space = await client.spaces.create({ name: faker.commerce.productName() });\n setSpaceKey(space.key);\n await onSpaceCreated?.({ client, space }, {});\n await Promise.all(clients.slice(1).flatMap((client) => performInvitation({ host: space, guest: client.spaces })));\n }\n\n setClients(clients);\n }, []);\n\n if (clients.length === 0) {\n return null;\n }\n\n return (\n <>\n {Controls && <Controls clients={clients} />}\n {clients.map((client, index) => (\n <ClientProvider key={index} client={client}>\n <Component id={index} count={clients.length} spaceKey={spaceKey} {...{ ...props.args }} />\n </ClientProvider>\n ))}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport React, { type PropsWithChildren, createContext, useContext, useEffect, useRef, useState } from 'react';\nimport { type FallbackProps, ErrorBoundary as NaturalErrorBoundary } from 'react-error-boundary';\n\nimport { Trigger } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { ClientProvider, type ClientProviderProps } from '../client';\n\nimport { ClientStory } from './context';\n\ntype InitializeProps = {\n createIdentity?: boolean;\n createSpace?: boolean;\n onInitialized?: (client: Client) => MaybePromise<void>;\n onIdentityCreated?: (props: { client: Client }) => MaybePromise<void>;\n // NOTE: context must be untyped until ClientRepeater is removed.\n onSpaceCreated?: (props: { client: Client; space: Space }, context: StoryContext | any) => MaybePromise<void>;\n};\n\n/**\n * Initialize client, identity and first space.\n */\nconst initializeClient = async (\n client: Client,\n { createIdentity, createSpace, onSpaceCreated, onIdentityCreated, onInitialized }: InitializeProps,\n context: StoryContext,\n): Promise<ClientStory> => {\n await onInitialized?.(client);\n\n if (createIdentity || createSpace) {\n if (!client.halo.identity.get()) {\n await client.halo.createIdentity();\n await onIdentityCreated?.({ client });\n }\n }\n\n let space: Space | undefined;\n if (createSpace) {\n space = await client.spaces.create({ name: 'Test Space' });\n await onSpaceCreated?.({ client, space }, context);\n }\n\n return { space };\n};\n\nexport type WithClientProviderProps = InitializeProps & Omit<ClientProviderProps, 'onInitialized'>;\n\n/**\n * Decorator that provides the client context.\n */\nexport const withClientProvider = ({\n createIdentity,\n createSpace,\n onSpaceCreated,\n onIdentityCreated,\n onInitialized,\n ...props\n}: WithClientProviderProps = {}): Decorator => {\n return (Story, context) => {\n const [data, setData] = useState<ClientStory>({});\n const handleInitialized = async (client: Client) => {\n const data = await initializeClient(\n client,\n {\n createIdentity,\n createSpace,\n onSpaceCreated,\n onIdentityCreated,\n onInitialized,\n },\n context,\n );\n\n setData(data);\n };\n\n return (\n <ErrorBoundary>\n <ClientProvider onInitialized={handleInitialized} {...props}>\n <ClientStory.Provider value={data}>\n <Story />\n </ClientStory.Provider>\n </ClientProvider>\n </ErrorBoundary>\n );\n };\n};\n\n// TODO(burdon): Implement context per client for context.\n// TODO(burdon): Callback once all invitations have completed.\n// TODO(burdon): Delay/jitter for creation of other clients.\nexport type WithMultiClientProviderProps = InitializeProps &\n Omit<ClientProviderProps, 'onInitialized'> & { numClients?: number };\n\nconst MultiClientContext = createContext<{ id: number }>({ id: 0 });\n\nexport const useMultiClient = () => useContext(MultiClientContext);\n\n/**\n * Decorator that creates a scaffold for multiple clients.\n * Orchestrates invitations between a randomly selected host and the remaining clients.\n * NOTE: Should come before withLayout.\n */\nexport const withMultiClientProvider = ({\n numClients = 2,\n createIdentity,\n createSpace,\n onSpaceCreated,\n onIdentityCreated,\n onInitialized,\n ...props\n}: WithMultiClientProviderProps): Decorator => {\n return (Story, context) => {\n const builder = useRef(new TestBuilder());\n const hostRef = useRef<Client>();\n const spaceReady = useRef(new Trigger<Space | undefined>());\n\n // Handle invitations.\n // NOTE: The zeroth client isn't necessarily the first to be initialized.\n const handleInitialized = async (client: Client, index: number) => {\n log.info('initialized', { index });\n if (createSpace) {\n if (!hostRef.current) {\n hostRef.current = client;\n const { space } = await initializeClient(\n client,\n {\n createIdentity,\n createSpace,\n onSpaceCreated,\n onIdentityCreated,\n onInitialized,\n },\n context,\n );\n\n spaceReady.current.wake(space);\n log.info('inviting', { index });\n } else {\n await initializeClient(client, { createIdentity, onInitialized }, context);\n const space = await spaceReady.current.wait();\n if (space) {\n log.info('joining', { index });\n await Promise.all(performInvitation({ host: space, guest: client.spaces }));\n }\n }\n }\n };\n\n return (\n <ErrorBoundary>\n {Array.from({ length: numClients }).map((_, index) => (\n <MultiClientContext.Provider key={index} value={{ id: index }}>\n <ClientProvider\n services={builder.current.createLocalClientServices()}\n onInitialized={(client) => handleInitialized(client, index)}\n {...props}\n >\n <Story />\n </ClientProvider>\n </MultiClientContext.Provider>\n ))}\n </ErrorBoundary>\n );\n };\n};\n\nconst ErrorBoundary = ({ children }: PropsWithChildren) => {\n const [error, setError] = useState<Error>();\n useEffect(() => {\n const handleError = (event: PromiseRejectionEvent) => {\n setError(event.reason);\n };\n\n window.addEventListener('unhandledrejection', handleError);\n return () => window.removeEventListener('unhandledrejection', handleError);\n }, []);\n\n if (error) {\n return <ErrorFallback error={error} resetErrorBoundary={() => setError(undefined)} />;\n }\n\n return <NaturalErrorBoundary FallbackComponent={ErrorFallback}>{children}</NaturalErrorBoundary>;\n};\n\nconst ErrorFallback = ({ error }: FallbackProps) => {\n const { name, message, stack } =\n error instanceof Error ? error : { name: 'Error', message: String(error), stack: undefined };\n return (\n <div role='alert' className='flex flex-col p-4 gap-4 overflow-auto'>\n <h1 className='text-xl text-red-500'>{name}</h1>\n <div className='text-lg'>{message}</div>\n {stack && <pre className='whitespace-pre-wrap text-sm text-subdued'>{stack}</pre>}\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["createContext", "useContext", "raise", "ClientStory", "createContext", "undefined", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2020 DXOS.org\n//\n\nexport * from '@dxos/client/testing';\n\nexport * from './context';\nexport * from './ClientRepeater';\nexport * from './withClientProvider';\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { type Space, type SpaceId } from '@dxos/client/echo';\nimport { raise } from '@dxos/debug';\n\nexport type ClientStory = {\n index?: number;\n spaceId?: SpaceId;\n space?: Space;\n};\n\nexport const ClientStory = createContext<ClientStory | undefined>(undefined);\n\nexport const useClientStory = (): ClientStory => {\n return useContext(ClientStory) ?? raise(new Error('Missing ClientStory'));\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { type FC, useRef, useState } from 'react';\n\nimport { Client } from '@dxos/client';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { type Type } from '@dxos/echo';\nimport { faker } from '@dxos/random';\nimport { useAsyncEffect } from '@dxos/react-hooks';\n\nimport { ClientProvider } from '../client';\nimport { type SpaceId } from '../echo';\n\nimport { type WithClientProviderProps } from './withClientProvider';\n\nexport type ClientRepeatedComponentProps = { id: number; count: number; spaceId?: SpaceId };\n\nexport type ClientRepeaterControlsProps = { clients: Client[] };\n\n// TODO(burdon): Reconcile with ClientProviderProps.\nexport type ClientRepeaterProps<P extends ClientRepeatedComponentProps> = {\n className?: string;\n component: FC<ClientRepeatedComponentProps>;\n controls?: FC<ClientRepeaterControlsProps>;\n count?: number;\n clients?: Client[];\n types?: Type.Obj.Any[];\n args?: Omit<P, 'id' | 'count'>;\n} & Pick<WithClientProviderProps, 'createIdentity' | 'createSpace' | 'onCreateSpace'>;\n\n/**\n * Utility component for Storybook stories which sets up clients for n peers.\n * The `Component` property is rendered n times, once for each peer.\n * @deprecated use `withClientProvider`.\n */\n// TODO(burdon): To discuss: evolve ClientRepeater with optional decorator that uses it.\n// NOTE: This is specifically not a storybook decorator because it broke stories as a decorator.\n// This seems primarily due to the fact that it required top-level await for the clients to initialize.\n// Storybook seemed to handle it alright, but Chromatic had a lot of trouble with it.\n// There was also a question of whether or not calling the story function multiple times was a good idea.\nexport const ClientRepeater = <P extends ClientRepeatedComponentProps>(props: ClientRepeaterProps<P>) => {\n const {\n component: Component,\n controls: Controls,\n count = 1,\n types,\n createIdentity,\n createSpace,\n onCreateSpace,\n } = props;\n\n const [clients, setClients] = useState(props.clients ?? []);\n const [spaceId, setSpaceId] = useState<SpaceId>();\n\n const testBuilder = useRef(new TestBuilder());\n useAsyncEffect(async () => {\n const clients = [...Array(count)].map(\n (_) => new Client({ services: testBuilder.current.createLocalClientServices(), types }),\n );\n\n await Promise.all(clients.map((client) => client.initialize()));\n if (createIdentity || createSpace) {\n await Promise.all(clients.map((client) => client.halo.createIdentity()));\n }\n\n if (createSpace) {\n const client = clients[0];\n const space = await client.spaces.create({ name: faker.commerce.productName() });\n setSpaceId(space.id);\n await onCreateSpace?.({ client, space }, {});\n await Promise.all(clients.slice(1).flatMap((client) => performInvitation({ host: space, guest: client.spaces })));\n }\n\n setClients(clients);\n }, []);\n\n if (clients.length === 0) {\n return null;\n }\n\n return (\n <>\n {Controls && <Controls clients={clients} />}\n {clients.map((client, index) => (\n <ClientProvider key={index} client={client}>\n <Component id={index} count={clients.length} spaceId={spaceId} {...{ ...props.args }} />\n </ClientProvider>\n ))}\n </>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport React, { type PropsWithChildren, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { type FallbackProps, ErrorBoundary as NaturalErrorBoundary } from 'react-error-boundary';\n\nimport { Trigger } from '@dxos/async';\nimport { type Client } from '@dxos/client';\nimport { type Space, type SpaceId } from '@dxos/client/echo';\nimport { TestBuilder, performInvitation } from '@dxos/client/testing';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { ClientProvider, type ClientProviderProps } from '../client';\n\nimport { ClientStory } from './context';\n\ntype InitializeProps = {\n createIdentity?: boolean;\n createSpace?: boolean;\n onInitialized?: (client: Client) => MaybePromise<void>;\n onCreateIdentity?: (props: { client: Client }, context: StoryContext | any) => MaybePromise<void>;\n // NOTE: context must be untyped until ClientRepeater is removed.\n onCreateSpace?: (props: { client: Client; space: Space }, context: StoryContext | any) => MaybePromise<void>;\n};\n\n/**\n * Initialize client, identity and first space.\n */\nconst initializeClient = async (\n client: Client,\n { createIdentity, createSpace, onCreateIdentity, onCreateSpace, onInitialized }: InitializeProps,\n context: StoryContext,\n): Promise<ClientStory> => {\n await onInitialized?.(client);\n\n if (createIdentity || createSpace) {\n if (!client.halo.identity.get()) {\n await client.halo.createIdentity();\n await client.spaces.waitUntilReady();\n await client.spaces.default.waitUntilReady();\n await onCreateIdentity?.({ client }, context);\n }\n }\n\n let space: Space | undefined;\n if (createSpace) {\n space = await client.spaces.create({ name: 'Test Space' });\n await space.waitUntilReady(); // Is this required?\n await onCreateSpace?.({ client, space }, context);\n }\n\n return { space, spaceId: space?.id };\n};\n\nexport type WithClientProviderProps = InitializeProps & Omit<ClientProviderProps, 'onInitialized'>;\n\n/**\n * Decorator that provides the client context.\n */\nexport const withClientProvider = ({\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n ...props\n}: WithClientProviderProps = {}): Decorator => {\n return (Story, context) => {\n const [data, setData] = useState<ClientStory>({});\n const handleInitialized = async (client: Client) => {\n const data = await initializeClient(\n client,\n {\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n },\n context,\n );\n\n setData(data);\n };\n\n return (\n <ErrorBoundary>\n <ClientProvider onInitialized={handleInitialized} {...props}>\n <ClientStory.Provider value={data}>\n <Story />\n </ClientStory.Provider>\n </ClientProvider>\n </ErrorBoundary>\n );\n };\n};\n\n// TODO(burdon): Implement context per client for context.\n// TODO(burdon): Callback once all invitations have completed.\n// TODO(burdon): Delay/jitter for creation of other clients.\nexport type WithMultiClientProviderProps = InitializeProps &\n Omit<ClientProviderProps, 'onInitialized'> & { numClients?: number };\n\n/**\n * Decorator that creates a scaffold for multiple clients.\n * Orchestrates invitations between a randomly selected host and the remaining clients.\n */\nexport const withMultiClientProvider = ({\n numClients = 2,\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n ...props\n}: WithMultiClientProviderProps): Decorator => {\n return (Story, context) => {\n const spaceReady = useRef(new Trigger<Space | undefined>());\n const [spaceId, setSpaceId] = useState<SpaceId>();\n\n const clients = useMemo(() => {\n const buidler = new TestBuilder();\n return Array.from({ length: numClients }).map(() => {\n return {\n services: buidler.createLocalClientServices(),\n };\n });\n }, [numClients]);\n\n // Handle invitations.\n // NOTE: The zeroth client isn't necessarily the first to be initialized.\n const handleInitialized = useCallback(async (client: Client, index: number) => {\n if (index === 0) {\n // Initialize host.\n const { space } = await initializeClient(\n client,\n {\n createIdentity,\n createSpace,\n onCreateSpace,\n onCreateIdentity,\n onInitialized,\n },\n context,\n );\n\n log.info('inviting', { index, spaceId: space?.id });\n setSpaceId(space?.id);\n spaceReady.current.wake(space);\n } else {\n // Initialize guest.\n await initializeClient(client, { createIdentity, onInitialized }, context);\n\n log.info('waiting', { index });\n const space = await spaceReady.current.wait();\n if (space) {\n log.info('joining', { index, spaceId: space.id });\n await Promise.all(\n performInvitation({\n host: space,\n guest: client.spaces,\n }),\n );\n }\n }\n }, []);\n\n return (\n <div className='absolute inset-0 grid grid-flow-col auto-cols-fr gap-4 overflow-hidden'>\n {clients.map((client, index) => (\n <ClientProvider\n key={index}\n services={client.services}\n onInitialized={(client) => handleInitialized(client, index)}\n {...props}\n >\n <ClientStory.Provider value={{ index, spaceId }}>\n <ErrorBoundary>\n <Story />\n </ErrorBoundary>\n </ClientStory.Provider>\n </ClientProvider>\n ))}\n </div>\n );\n };\n};\n\nconst ErrorBoundary = ({ children }: PropsWithChildren) => {\n const [error, setError] = useState<Error>();\n useEffect(() => {\n const handleError = (event: PromiseRejectionEvent) => {\n setError(event.reason);\n };\n\n window.addEventListener('unhandledrejection', handleError);\n return () => window.removeEventListener('unhandledrejection', handleError);\n }, []);\n\n if (error) {\n return <ErrorFallback error={error} resetErrorBoundary={() => setError(undefined)} />;\n }\n\n return <NaturalErrorBoundary FallbackComponent={ErrorFallback}>{children}</NaturalErrorBoundary>;\n};\n\nconst ErrorFallback = ({ error }: FallbackProps) => {\n const { name, message, stack } =\n error instanceof Error ? error : { name: 'Error', message: String(error), stack: undefined };\n\n return (\n <div role='alert' className='flex flex-col p-4 gap-4 overflow-auto'>\n <h1 className='text-xl text-red-500'>{name}</h1>\n <div className='text-lg'>{message}</div>\n {stack && <pre className='whitespace-pre-wrap text-sm text-subdued'>{stack}</pre>}\n </div>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAIA,cAAc;;;ACAd,SAASA,eAAeC,kBAAkB;AAG1C,SAASC,aAAa;AAQf,IAAMC,cAAcC,8BAAuCC,MAAAA;AAE3D,IAAMC,iBAAiB,MAAA;AAC5B,SAAOC,WAAWJ,WAAAA,KAAgBK,MAAM,IAAIC,MAAM,qBAAA,CAAA;AACpD;;;ACfA,OAAOC,SAAkBC,QAAQC,gBAAg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oBAAoB,MAAMT,SAASU,MAAAA;;EACzE;AAEA,SAAO,gBAAAjD,OAAA,cAACkD,sBAAAA;IAAqBC,mBAAmBJ;KAAgBV,QAAAA;AAClE;AAEA,IAAMU,gBAAgB,CAAC,EAAET,MAAK,MAAiB;AAC7C,QAAM,EAAEhD,MAAM8D,SAASC,MAAK,IAC1Bf,iBAAiBgB,QAAQhB,QAAQ;IAAEhD,MAAM;IAAS8D,SAASG,OAAOjB,KAAAA;IAAQe,OAAOJ;EAAU;AAE7F,SACE,gBAAAjD,OAAA,cAACkC,OAAAA;IAAIsB,MAAK;IAAQrB,WAAU;KAC1B,gBAAAnC,OAAA,cAACyD,MAAAA;IAAGtB,WAAU;KAAwB7C,IAAAA,GACtC,gBAAAU,OAAA,cAACkC,OAAAA;IAAIC,WAAU;KAAWiB,OAAAA,GACzBC,SAAS,gBAAArD,OAAA,cAAC0D,OAAAA;IAAIvB,WAAU;KAA4CkB,KAAAA,CAAAA;AAG3E;",
|
|
6
|
+
"names": ["createContext", "useContext", "raise", "ClientStory", "createContext", "undefined", "useClientStory", "useContext", "raise", "Error", "React", "useRef", "useState", "Client", "TestBuilder", "performInvitation", "faker", "useAsyncEffect", "ClientRepeater", "props", "component", "Component", "controls", "Controls", "count", "types", "createIdentity", "createSpace", "onCreateSpace", "clients", "setClients", "useState", "spaceId", "setSpaceId", "testBuilder", "useRef", "TestBuilder", "useAsyncEffect", "Array", "map", "_", "Client", "services", "current", "createLocalClientServices", "Promise", "all", "client", "initialize", "halo", "space", "spaces", "create", "name", "faker", "commerce", "productName", "id", "slice", "flatMap", "performInvitation", "host", "guest", "length", "index", "ClientProvider", "key", "args", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "ErrorBoundary", "NaturalErrorBoundary", "Trigger", "TestBuilder", "performInvitation", "log", "initializeClient", "client", "createIdentity", "createSpace", "onCreateIdentity", "onCreateSpace", "onInitialized", "context", "halo", "identity", "get", "spaces", "waitUntilReady", "default", "space", "create", "name", "spaceId", "id", "withClientProvider", "props", "Story", "data", "setData", "useState", "handleInitialized", "React", "ErrorBoundary", "ClientProvider", "ClientStory", "Provider", "value", "withMultiClientProvider", "numClients", "spaceReady", "useRef", "Trigger", "setSpaceId", "clients", "useMemo", "buidler", "TestBuilder", "Array", "from", "length", "map", "services", "createLocalClientServices", "useCallback", "index", "log", "info", "current", "wake", "wait", "Promise", "all", "performInvitation", "host", "guest", "div", "className", "key", "children", "error", "setError", "useEffect", "handleError", "event", "reason", "window", "addEventListener", "removeEventListener", "ErrorFallback", "resetErrorBoundary", "undefined", "NaturalErrorBoundary", "FallbackComponent", "message", "stack", "Error", "String", "role", "h1", "pre"]
|
|
7
7
|
}
|
|
@@ -29,11 +29,6 @@ export type ClientProviderProps = Omit<ClientOptions, 'config' | 'services'> & P
|
|
|
29
29
|
* ReactNode to display until the client is available.
|
|
30
30
|
*/
|
|
31
31
|
fallback?: FunctionComponent<Partial<ClientContextProps>>;
|
|
32
|
-
/**
|
|
33
|
-
* Enable (by default) registration of Preact signals runtime for reactive ECHO objects.
|
|
34
|
-
* @see https://www.npmjs.com/package/@preact/signals-react
|
|
35
|
-
*/
|
|
36
|
-
signalsRuntime?: boolean;
|
|
37
32
|
/**
|
|
38
33
|
* Skip the DXOS banner.
|
|
39
34
|
*/
|
|
@@ -70,11 +65,6 @@ export declare const ClientProvider: React.ForwardRefExoticComponent<Omit<Client
|
|
|
70
65
|
* ReactNode to display until the client is available.
|
|
71
66
|
*/
|
|
72
67
|
fallback?: FunctionComponent<Partial<ClientContextProps>>;
|
|
73
|
-
/**
|
|
74
|
-
* Enable (by default) registration of Preact signals runtime for reactive ECHO objects.
|
|
75
|
-
* @see https://www.npmjs.com/package/@preact/signals-react
|
|
76
|
-
*/
|
|
77
|
-
signalsRuntime?: boolean;
|
|
78
68
|
/**
|
|
79
69
|
* Skip the DXOS banner.
|
|
80
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientProvider.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,sBAAsB,EAAgB,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ClientProvider.d.ts","sourceRoot":"","sources":["../../../../src/client/ClientProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,sBAAsB,EAAgB,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAyB,MAAM,YAAY,CAAC;AAIrF,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,UAAU,CAAC,GAC1E,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,GAClC,iBAAiB,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5C;;;;OAIG;IAEH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5C;;;;OAIG;IAEH,QAAQ,CAAC,EAAE,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAEhG;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAE1D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACxD,CAAC,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,cAAc;IA3CvB;;;;OAIG;aACM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;;OAIG;aAEM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAE3C;;;;OAIG;eAEQ,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,sBAAsB,CAAC,CAAC;IAE/F;;OAEG;eACQ,iBAAiB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzD;;OAEG;eACQ,OAAO;IAElB;;OAEG;oBACa,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC;;;4CAgHzD,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from '@dxos/client/echo';
|
|
2
|
+
export * from '@dxos/echo-react';
|
|
2
3
|
export * from './useMembers';
|
|
3
|
-
export * from './useQuery';
|
|
4
4
|
export * from './useQueue';
|
|
5
|
-
export * from './useSchema';
|
|
6
5
|
export * from './useSpaces';
|
|
7
6
|
export * from './useSpaceInvitations';
|
|
7
|
+
export * from './useSpaceProperties';
|
|
8
8
|
export * from './useSubscription';
|
|
9
9
|
export * from './useSyncState';
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/echo/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/echo/index.ts"],"names":[],"mappings":"AAIA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PublicKeyLike } from '@dxos/client';
|
|
2
2
|
import { type SpaceMember } from '@dxos/client/echo';
|
|
3
|
-
export declare const useMembers: (spaceKey:
|
|
3
|
+
export declare const useMembers: (spaceKey: PublicKeyLike | undefined) => SpaceMember[];
|
|
4
4
|
//# sourceMappingURL=useMembers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMembers.d.ts","sourceRoot":"","sources":["../../../../src/echo/useMembers.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"useMembers.d.ts","sourceRoot":"","sources":["../../../../src/echo/useMembers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKtE,eAAO,MAAM,UAAU,GAAI,UAAU,aAAa,GAAG,SAAS,KAAG,WAAW,EAU3E,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Queue } from '@dxos/client/echo';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Entity } from '@dxos/echo';
|
|
3
3
|
import { type DXN } from '@dxos/keys';
|
|
4
4
|
export type UseQueueOptions = {
|
|
5
5
|
pollInterval?: number;
|
|
@@ -7,5 +7,5 @@ export type UseQueueOptions = {
|
|
|
7
7
|
/**
|
|
8
8
|
* Polls the given Edge queue.
|
|
9
9
|
*/
|
|
10
|
-
export declare const useQueue: <T extends
|
|
10
|
+
export declare const useQueue: <T extends Entity.Unknown>(queueDxn?: DXN, options?: UseQueueOptions) => Queue<T> | undefined;
|
|
11
11
|
//# sourceMappingURL=useQueue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQueue.d.ts","sourceRoot":"","sources":["../../../../src/echo/useQueue.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"useQueue.d.ts","sourceRoot":"","sources":["../../../../src/echo/useQueue.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAMtC,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;GAEG;AAKH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,CAAC,OAAO,EAC/C,WAAW,GAAG,EACd,UAAS,eAAoB,KAC5B,KAAK,CAAC,CAAC,CAAC,GAAG,SA4Cb,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PublicKey } from '@dxos/client';
|
|
2
|
+
import { type SpaceId } from '@dxos/client/echo';
|
|
2
3
|
import { type CancellableInvitationObservable } from '../invitations';
|
|
3
|
-
export declare const useSpaceInvitations: (
|
|
4
|
-
export declare const useSpaceInvitation: (
|
|
4
|
+
export declare const useSpaceInvitations: (spaceId?: SpaceId | PublicKey) => CancellableInvitationObservable[];
|
|
5
|
+
export declare const useSpaceInvitation: (spaceId?: SpaceId | PublicKey, invitationId?: string) => import("../invitations").InvitationStatus;
|
|
5
6
|
//# sourceMappingURL=useSpaceInvitations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSpaceInvitations.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSpaceInvitations.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"useSpaceInvitations.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSpaceInvitations.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,KAAK,+BAA+B,EAAuB,MAAM,gBAAgB,CAAC;AAM3F,eAAO,MAAM,mBAAmB,GAAI,UAAU,OAAO,GAAG,SAAS,KAAG,+BAA+B,EAGlG,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAI,UAAU,OAAO,GAAG,SAAS,EAAE,eAAe,MAAM,8CAOtF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SpaceProperties } from '@dxos/client/echo';
|
|
2
|
+
import { type Key, type Obj } from '@dxos/echo';
|
|
3
|
+
import { type ObjectUpdateCallback } from '@dxos/echo-react';
|
|
4
|
+
/**
|
|
5
|
+
* Subscribe to a space's properties with reactive updates.
|
|
6
|
+
* Returns undefined if the space is undefined or not ready yet.
|
|
7
|
+
* Automatically waits for the space to be ready before returning properties.
|
|
8
|
+
*
|
|
9
|
+
* @param spaceId - The space ID to get properties from (can be undefined).
|
|
10
|
+
* @returns A tuple of [snapshot, updateCallback] or [undefined, no-op] if not ready.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useSpaceProperties: (spaceId: Key.SpaceId | undefined) => [Obj.Snapshot<SpaceProperties> | undefined, ObjectUpdateCallback<SpaceProperties>];
|
|
13
|
+
//# sourceMappingURL=useSpaceProperties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpaceProperties.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSpaceProperties.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,KAAK,oBAAoB,EAAa,MAAM,kBAAkB,CAAC;AAKxE;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,GAAG,CAAC,OAAO,GAAG,SAAS,KAC/B,CAAC,GAAG,CAAC,QAAQ,CAAC,eAAe,CAAC,GAAG,SAAS,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAKnF,CAAC"}
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type Space } from '@dxos/client/echo';
|
|
1
|
+
import { PublicKey } from '@dxos/client';
|
|
2
|
+
import { type Space, type SpaceId } from '@dxos/client/echo';
|
|
3
3
|
/**
|
|
4
|
-
* Get a specific Space using its
|
|
4
|
+
* Get a specific Space using its id.
|
|
5
5
|
* The space is not guaranteed to be in the ready state.
|
|
6
|
-
* Returns the default space if no
|
|
6
|
+
* Returns the default space if no id is provided.
|
|
7
7
|
* Requires a ClientProvider somewhere in the parent tree.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param spaceId the id of the space to look for
|
|
10
10
|
*/
|
|
11
|
-
export declare const useSpace: (
|
|
12
|
-
|
|
11
|
+
export declare const useSpace: (spaceId?: SpaceId | PublicKey) => Space | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get a Space database by the id of the space.
|
|
14
|
+
* The space is not guaranteed to be in the ready state.
|
|
15
|
+
* Returns the default space if no id is provided.
|
|
16
|
+
* Requires a ClientProvider somewhere in the parent tree.
|
|
17
|
+
*
|
|
18
|
+
* @param spaceId the id of the space to look for
|
|
19
|
+
*/
|
|
20
|
+
export declare const useDatabase: (spaceId?: SpaceId) => Space["db"] | undefined;
|
|
21
|
+
export type UseSpacesProps = {
|
|
13
22
|
/**
|
|
14
23
|
* Return uninitialized spaces as well.
|
|
15
24
|
*/
|
|
@@ -21,5 +30,5 @@ export type UseSpacesParams = {
|
|
|
21
30
|
* By default, only ready spaces are returned.
|
|
22
31
|
* @returns an array of Spaces
|
|
23
32
|
*/
|
|
24
|
-
export declare const useSpaces: ({ all }?:
|
|
33
|
+
export declare const useSpaces: ({ all }?: UseSpacesProps) => Space[];
|
|
25
34
|
//# sourceMappingURL=useSpaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSpaces.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSpaces.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useSpaces.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSpaces.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,OAAO,EAAc,MAAM,mBAAmB,CAAC;AAKzE;;;;;;;GAOG;AAGH,eAAO,MAAM,QAAQ,GAAI,UAAU,OAAO,GAAG,SAAS,KAAG,KAAK,GAAG,SA4BhE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,OAAO,KAAG,KAAK,CAAC,IAAI,CAAC,GAAG,SAG7D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,UAAiB,cAAmB,KAAG,KAAK,EAMrE,CAAC"}
|
|
@@ -3,5 +3,5 @@ import { type Selection, type SubscriptionHandle } from '@dxos/client/echo';
|
|
|
3
3
|
* Create reactive selection.
|
|
4
4
|
* Calls the callback when the selection changes and during the first render.
|
|
5
5
|
*/
|
|
6
|
-
export declare const useSubscription: (cb: () => void, selection: Selection) => SubscriptionHandle |
|
|
6
|
+
export declare const useSubscription: (cb: () => void, selection: Selection) => SubscriptionHandle | null;
|
|
7
7
|
//# sourceMappingURL=useSubscription.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSubscription.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSubscription.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAsB,MAAM,mBAAmB,CAAC;AAEhG;;;GAGG;AAEH,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,IAAI,EAAE,WAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"useSubscription.d.ts","sourceRoot":"","sources":["../../../../src/echo/useSubscription.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,kBAAkB,EAAsB,MAAM,mBAAmB,CAAC;AAEhG;;;GAGG;AAEH,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,IAAI,EAAE,WAAW,SAAS,8BAmBnE,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import '@dxos-theme';
|
|
2
1
|
import { type StoryObj } from '@storybook/react-vite';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
declare const meta: {
|
|
5
4
|
title: string;
|
|
6
5
|
render: () => React.JSX.Element;
|
|
6
|
+
decorators: import("@storybook/react").Decorator[];
|
|
7
7
|
};
|
|
8
8
|
export default meta;
|
|
9
9
|
type Story = StoryObj<typeof meta>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Passkey.stories.d.ts","sourceRoot":"","sources":["../../../../src/halo/Passkey.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"Passkey.stories.d.ts","sourceRoot":"","sources":["../../../../src/halo/Passkey.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAsB,MAAM,OAAO,CAAC;AA8I3C,QAAA,MAAM,IAAI;;;;CAIM,CAAC;AAEjB,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -36,7 +36,7 @@ export type InvitationStatus = {
|
|
|
36
36
|
multiUse?: boolean;
|
|
37
37
|
shareable?: boolean;
|
|
38
38
|
result: InvitationResult;
|
|
39
|
-
error?:
|
|
39
|
+
error?: Error;
|
|
40
40
|
cancel(): void;
|
|
41
41
|
connect(observable: CancellableInvitationObservable): void;
|
|
42
42
|
authenticate(authCode: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInvitationStatus.d.ts","sourceRoot":"","sources":["../../../../src/invitations/useInvitationStatus.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAEL,KAAK,+BAA+B,EACpC,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAGlC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,WAAW,EAAE,SAAS,GAAG,IAAI,CAAC;IAC9B,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"useInvitationStatus.d.ts","sourceRoot":"","sources":["../../../../src/invitations/useInvitationStatus.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAEL,KAAK,+BAA+B,EACpC,UAAU,EAEX,MAAM,0BAA0B,CAAC;A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