@dxos/react-client 0.8.4-main.03d5cd7b56 → 0.8.4-main.05e74ebcff
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/echo/index.mjs +9 -59
- package/dist/lib/browser/echo/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/node-esm/echo/index.mjs +9 -59
- package/dist/lib/node-esm/echo/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs.map +2 -2
- 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/useSpaceInvitations.d.ts +1 -1
- package/dist/types/src/echo/useSpaceInvitations.d.ts.map +1 -1
- package/dist/types/src/echo/useSpaces.d.ts +2 -1
- package/dist/types/src/echo/useSpaces.d.ts.map +1 -1
- package/dist/types/src/testing/ClientRepeater.d.ts +1 -1
- package/dist/types/src/testing/ClientRepeater.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/withClientProvider.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -25
- package/src/echo/index.ts +0 -1
- package/src/echo/useSpaceInvitations.ts +1 -1
- package/src/echo/useSpaces.ts +2 -1
- package/src/testing/ClientRepeater.tsx +1 -1
- package/src/testing/context.tsx +2 -1
- package/src/testing/withClientProvider.tsx +2 -1
- package/tsconfig.json +3 -0
- package/dist/types/src/echo/useQueue.d.ts +0 -12
- package/dist/types/src/echo/useQueue.d.ts.map +0 -1
- package/src/echo/useQueue.ts +0 -73
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-client",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.05e74ebcff",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/dxos/dxos"
|
|
10
10
|
},
|
|
11
|
-
"license": "
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
12
12
|
"author": "DXOS.org",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
@@ -64,20 +64,21 @@
|
|
|
64
64
|
},
|
|
65
65
|
"types": "dist/types/src/index.d.ts",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/debug": "0.8.4-main.
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/react-hooks": "0.8.4-main.
|
|
80
|
-
"@dxos/util": "0.8.4-main.
|
|
67
|
+
"@dxos/client": "0.8.4-main.05e74ebcff",
|
|
68
|
+
"@dxos/codec-protobuf": "0.8.4-main.05e74ebcff",
|
|
69
|
+
"@dxos/async": "0.8.4-main.05e74ebcff",
|
|
70
|
+
"@dxos/config": "0.8.4-main.05e74ebcff",
|
|
71
|
+
"@dxos/echo": "0.8.4-main.05e74ebcff",
|
|
72
|
+
"@dxos/debug": "0.8.4-main.05e74ebcff",
|
|
73
|
+
"@dxos/context": "0.8.4-main.05e74ebcff",
|
|
74
|
+
"@dxos/invariant": "0.8.4-main.05e74ebcff",
|
|
75
|
+
"@dxos/echo-react": "0.8.4-main.05e74ebcff",
|
|
76
|
+
"@dxos/keys": "0.8.4-main.05e74ebcff",
|
|
77
|
+
"@dxos/log": "0.8.4-main.05e74ebcff",
|
|
78
|
+
"@dxos/node-std": "0.8.4-main.05e74ebcff",
|
|
79
|
+
"@dxos/react-hooks": "0.8.4-main.05e74ebcff",
|
|
80
|
+
"@dxos/util": "0.8.4-main.05e74ebcff",
|
|
81
|
+
"@dxos/protocols": "0.8.4-main.05e74ebcff"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@types/react": "~19.2.7",
|
|
@@ -85,21 +86,21 @@
|
|
|
85
86
|
"react": "~19.2.3",
|
|
86
87
|
"react-dom": "~19.2.3",
|
|
87
88
|
"typedoc": "0.28.1",
|
|
88
|
-
"@dxos/random": "0.8.4-main.
|
|
89
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
93
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
89
|
+
"@dxos/random": "0.8.4-main.05e74ebcff",
|
|
90
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.05e74ebcff",
|
|
91
|
+
"@dxos/react-ui": "0.8.4-main.05e74ebcff",
|
|
92
|
+
"@dxos/storybook-utils": "0.8.4-main.05e74ebcff",
|
|
93
|
+
"@dxos/test-utils": "0.8.4-main.05e74ebcff",
|
|
94
|
+
"@dxos/ui-theme": "0.8.4-main.05e74ebcff"
|
|
94
95
|
},
|
|
95
96
|
"peerDependencies": {
|
|
96
97
|
"react": "~19.2.3",
|
|
97
98
|
"react-dom": "~19.2.3"
|
|
98
99
|
},
|
|
99
100
|
"optionalDependencies": {
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/ui
|
|
102
|
-
"@dxos/
|
|
101
|
+
"@dxos/ui-theme": "0.8.4-main.05e74ebcff",
|
|
102
|
+
"@dxos/react-ui": "0.8.4-main.05e74ebcff",
|
|
103
|
+
"@dxos/random": "0.8.4-main.05e74ebcff"
|
|
103
104
|
},
|
|
104
105
|
"publishConfig": {
|
|
105
106
|
"access": "public"
|
package/src/echo/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { MulticastObservable } from '@dxos/async';
|
|
8
8
|
import { type PublicKey } from '@dxos/client';
|
|
9
|
-
import { type SpaceId } from '@dxos/
|
|
9
|
+
import { type SpaceId } from '@dxos/keys';
|
|
10
10
|
import { useMulticastObservable } from '@dxos/react-hooks';
|
|
11
11
|
|
|
12
12
|
import { type CancellableInvitationObservable, useInvitationStatus } from '../invitations';
|
package/src/echo/useSpaces.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { PublicKey } from '@dxos/client';
|
|
6
|
-
import { type Space,
|
|
6
|
+
import { type Space, SpaceState } from '@dxos/client/echo';
|
|
7
|
+
import { type SpaceId } from '@dxos/keys';
|
|
7
8
|
import { useMulticastObservable } from '@dxos/react-hooks';
|
|
8
9
|
|
|
9
10
|
import { useClient } from '../client';
|
|
@@ -7,11 +7,11 @@ import React, { type FC, useRef, useState } from 'react';
|
|
|
7
7
|
import { Client } from '@dxos/client';
|
|
8
8
|
import { TestBuilder, performInvitation } from '@dxos/client/testing';
|
|
9
9
|
import { type Type } from '@dxos/echo';
|
|
10
|
+
import { type SpaceId } from '@dxos/keys';
|
|
10
11
|
import { random } from '@dxos/random';
|
|
11
12
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
12
13
|
|
|
13
14
|
import { ClientProvider } from '../client';
|
|
14
|
-
import { type SpaceId } from '../echo';
|
|
15
15
|
import { type WithClientProviderProps } from './withClientProvider';
|
|
16
16
|
|
|
17
17
|
export type ClientRepeatedComponentProps = { id: number; count: number; spaceId?: SpaceId };
|
package/src/testing/context.tsx
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { createContext, useContext } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Space
|
|
7
|
+
import { type Space } from '@dxos/client/echo';
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
|
+
import { type SpaceId } from '@dxos/keys';
|
|
9
10
|
|
|
10
11
|
export type ClientStory = {
|
|
11
12
|
index?: number;
|
|
@@ -7,8 +7,9 @@ import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
9
|
import { type Client } from '@dxos/client';
|
|
10
|
-
import { type Space
|
|
10
|
+
import { type Space } from '@dxos/client/echo';
|
|
11
11
|
import { TestBuilder, performInvitation } from '@dxos/client/testing';
|
|
12
|
+
import { type SpaceId } from '@dxos/keys';
|
|
12
13
|
import { log } from '@dxos/log';
|
|
13
14
|
import { ErrorBoundary } from '@dxos/react-ui';
|
|
14
15
|
import { type MaybePromise } from '@dxos/util';
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Queue } from '@dxos/client/echo';
|
|
2
|
-
import { type Entity } from '@dxos/echo';
|
|
3
|
-
import { type DXN } from '@dxos/keys';
|
|
4
|
-
export type UseQueueOptions = {
|
|
5
|
-
pollInterval?: number;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Polls the given Edge queue.
|
|
9
|
-
* @deprecated Use `useQuery` instead.
|
|
10
|
-
*/
|
|
11
|
-
export declare const useQueue: <T extends Entity.Unknown>(queueDxn?: DXN, options?: UseQueueOptions) => Queue<T> | undefined;
|
|
12
|
-
//# sourceMappingURL=useQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;;;GAGG;AAGH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,CAAC,OAAO,aACpC,GAAG,YACL,eAAe,KACvB,KAAK,CAAC,CAAC,CAAC,GAAG,SA4Cb,CAAC"}
|
package/src/echo/useQueue.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type Queue } from '@dxos/client/echo';
|
|
8
|
-
import { raise } from '@dxos/debug';
|
|
9
|
-
import { type Entity } from '@dxos/echo';
|
|
10
|
-
import { type DXN } from '@dxos/keys';
|
|
11
|
-
|
|
12
|
-
import { useClient } from '../client';
|
|
13
|
-
|
|
14
|
-
const MIN_POLL_INTERVAL = 1_000;
|
|
15
|
-
|
|
16
|
-
export type UseQueueOptions = {
|
|
17
|
-
pollInterval?: number;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Polls the given Edge queue.
|
|
22
|
-
* @deprecated Use `useQuery` instead.
|
|
23
|
-
*/
|
|
24
|
-
// TODO(dmaretskyi): Move into client package.
|
|
25
|
-
// TODO(dmaretskyi): Consider passing the space into the hook to support queue DXNs without space id.
|
|
26
|
-
export const useQueue = <T extends Entity.Unknown>(
|
|
27
|
-
queueDxn?: DXN,
|
|
28
|
-
options: UseQueueOptions = {},
|
|
29
|
-
): Queue<T> | undefined => {
|
|
30
|
-
const client = useClient();
|
|
31
|
-
const mountedRef = useRef(true);
|
|
32
|
-
|
|
33
|
-
const queue = useMemo<Queue<T> | undefined>(() => {
|
|
34
|
-
if (!queueDxn) {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const { spaceId } = queueDxn.asQueueDXN() ?? raise(new TypeError('Invalid queue DXN'));
|
|
39
|
-
return client.spaces.get(spaceId)?.queues.get<T>(queueDxn);
|
|
40
|
-
}, [client, queueDxn?.toString()]);
|
|
41
|
-
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
void queue?.refresh();
|
|
44
|
-
}, [queue]);
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
let timeout: NodeJS.Timeout;
|
|
48
|
-
mountedRef.current = true;
|
|
49
|
-
|
|
50
|
-
const poll = () => {
|
|
51
|
-
if (!mountedRef.current) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
void queue?.refresh().finally(() => {
|
|
56
|
-
if (mountedRef.current && options.pollInterval) {
|
|
57
|
-
timeout = setTimeout(poll, Math.max(options.pollInterval ?? 0, MIN_POLL_INTERVAL));
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
if (options.pollInterval) {
|
|
63
|
-
poll();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return () => {
|
|
67
|
-
mountedRef.current = false;
|
|
68
|
-
clearTimeout(timeout);
|
|
69
|
-
};
|
|
70
|
-
}, [queue, options.pollInterval]);
|
|
71
|
-
|
|
72
|
-
return queue;
|
|
73
|
-
};
|