@dxos/react-client 0.8.4-main.a4bbb77 → 0.8.4-main.ae835ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/echo/index.mjs.map +2 -2
- package/dist/lib/browser/halo/index.mjs +5 -19
- package/dist/lib/browser/halo/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node-esm/echo/index.mjs.map +2 -2
- package/dist/lib/node-esm/halo/index.mjs +5 -19
- package/dist/lib/node-esm/halo/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs.map +1 -1
- package/dist/types/src/echo/useQuery.d.ts +3 -3
- package/dist/types/src/echo/useQuery.d.ts.map +1 -1
- package/dist/types/src/echo/useSchema.d.ts +1 -1
- package/dist/types/src/echo/useSchema.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/withClientProvider.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -27
- package/src/echo/useQuery.test.tsx +6 -5
- package/src/echo/useQuery.ts +5 -14
- package/src/echo/useSchema.ts +2 -2
- package/src/testing/ClientRepeater.tsx +1 -1
- package/src/testing/withClientProvider.stories.tsx +6 -8
- package/tsconfig.json +0 -3
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.ae835ea",
|
|
4
4
|
"description": "React client API",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -86,43 +86,42 @@
|
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"react-error-boundary": "^4.0.13",
|
|
89
|
-
"@dxos/async": "0.8.4-main.
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/echo": "0.8.4-main.
|
|
95
|
-
"@dxos/
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/
|
|
98
|
-
"@dxos/
|
|
99
|
-
"@dxos/
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/
|
|
102
|
-
"@dxos/
|
|
103
|
-
"@dxos/util": "0.8.4-main.a4bbb77"
|
|
89
|
+
"@dxos/async": "0.8.4-main.ae835ea",
|
|
90
|
+
"@dxos/codec-protobuf": "0.8.4-main.ae835ea",
|
|
91
|
+
"@dxos/config": "0.8.4-main.ae835ea",
|
|
92
|
+
"@dxos/debug": "0.8.4-main.ae835ea",
|
|
93
|
+
"@dxos/context": "0.8.4-main.ae835ea",
|
|
94
|
+
"@dxos/echo": "0.8.4-main.ae835ea",
|
|
95
|
+
"@dxos/echo-signals": "0.8.4-main.ae835ea",
|
|
96
|
+
"@dxos/client": "0.8.4-main.ae835ea",
|
|
97
|
+
"@dxos/invariant": "0.8.4-main.ae835ea",
|
|
98
|
+
"@dxos/log": "0.8.4-main.ae835ea",
|
|
99
|
+
"@dxos/node-std": "0.8.4-main.ae835ea",
|
|
100
|
+
"@dxos/protocols": "0.8.4-main.ae835ea",
|
|
101
|
+
"@dxos/react-hooks": "0.8.4-main.ae835ea",
|
|
102
|
+
"@dxos/util": "0.8.4-main.ae835ea"
|
|
104
103
|
},
|
|
105
104
|
"devDependencies": {
|
|
106
|
-
"@types/react": "~19.2.
|
|
107
|
-
"@types/react-dom": "~19.2.
|
|
105
|
+
"@types/react": "~19.2.2",
|
|
106
|
+
"@types/react-dom": "~19.2.2",
|
|
108
107
|
"react": "~19.2.0",
|
|
109
108
|
"react-dom": "~19.2.0",
|
|
110
109
|
"typedoc": "0.28.1",
|
|
111
|
-
"@dxos/
|
|
112
|
-
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.
|
|
113
|
-
"@dxos/
|
|
114
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
115
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
116
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
110
|
+
"@dxos/random": "0.8.4-main.ae835ea",
|
|
111
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.ae835ea",
|
|
112
|
+
"@dxos/react-ui": "0.8.4-main.ae835ea",
|
|
113
|
+
"@dxos/react-ui-theme": "0.8.4-main.ae835ea",
|
|
114
|
+
"@dxos/storybook-utils": "0.8.4-main.ae835ea",
|
|
115
|
+
"@dxos/test-utils": "0.8.4-main.ae835ea"
|
|
117
116
|
},
|
|
118
117
|
"peerDependencies": {
|
|
119
118
|
"react": "^19.0.0",
|
|
120
119
|
"react-dom": "^19.0.0"
|
|
121
120
|
},
|
|
122
121
|
"optionalDependencies": {
|
|
123
|
-
"@dxos/
|
|
124
|
-
"@dxos/react-ui
|
|
125
|
-
"@dxos/
|
|
122
|
+
"@dxos/random": "0.8.4-main.ae835ea",
|
|
123
|
+
"@dxos/react-ui": "0.8.4-main.ae835ea",
|
|
124
|
+
"@dxos/react-ui-theme": "0.8.4-main.ae835ea"
|
|
126
125
|
},
|
|
127
126
|
"publishConfig": {
|
|
128
127
|
"access": "public"
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { renderHook } from '@testing-library/react';
|
|
6
6
|
import { describe, expect, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import { Expando, Filter
|
|
8
|
+
import { Expando, Filter } from '@dxos/client/echo';
|
|
9
|
+
import { Obj, Type } from '@dxos/echo';
|
|
9
10
|
|
|
10
11
|
import { createClient, createClientContextProvider } from '../testing/util';
|
|
11
12
|
|
|
@@ -19,9 +20,9 @@ describe('useQuery', () => {
|
|
|
19
20
|
const wrapper = await createClientContextProvider(client);
|
|
20
21
|
|
|
21
22
|
// Create 3 test objects: Alice, Bob, Charlie.
|
|
22
|
-
const alice =
|
|
23
|
-
const bob =
|
|
24
|
-
const charlie =
|
|
23
|
+
const alice = Obj.make(Type.Expando, { name: 'Alice' });
|
|
24
|
+
const bob = Obj.make(Type.Expando, { name: 'Bob' });
|
|
25
|
+
const charlie = Obj.make(Type.Expando, { name: 'Charlie' });
|
|
25
26
|
|
|
26
27
|
space!.db.add(alice);
|
|
27
28
|
space!.db.add(bob);
|
|
@@ -82,7 +83,7 @@ describe('useQuery', () => {
|
|
|
82
83
|
const wrapper = await createClientContextProvider(client);
|
|
83
84
|
|
|
84
85
|
// Create 10 test objects: 1, 2, 3, ..., 10.
|
|
85
|
-
const objects = Array.from({ length: 10 }, (_, i) =>
|
|
86
|
+
const objects = Array.from({ length: 10 }, (_, i) => Obj.make(Type.Expando, { value: i + 1 }));
|
|
86
87
|
|
|
87
88
|
objects.forEach((obj) => space!.db.add(obj));
|
|
88
89
|
await space!.db.flush();
|
package/src/echo/useQuery.ts
CHANGED
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useMemo, useSyncExternalStore } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
type Echo,
|
|
9
|
-
Filter,
|
|
10
|
-
type Live,
|
|
11
|
-
Query,
|
|
12
|
-
type Queryable,
|
|
13
|
-
type Queue,
|
|
14
|
-
type Space,
|
|
15
|
-
isSpace,
|
|
16
|
-
} from '@dxos/client/echo';
|
|
7
|
+
import { type Echo, Filter, type Live, Query, type Queryable, type Space, isSpace } from '@dxos/client/echo';
|
|
17
8
|
|
|
18
9
|
const EMPTY_ARRAY: never[] = [];
|
|
19
10
|
|
|
@@ -22,13 +13,13 @@ const noop = () => {};
|
|
|
22
13
|
// TODO(dmaretskyi): Queries are fully serializable, so we can remove `deps` argument.
|
|
23
14
|
interface UseQueryFn {
|
|
24
15
|
<Q extends Query.Any>(
|
|
25
|
-
spaceOrEcho: Space | Echo |
|
|
16
|
+
spaceOrEcho: Space | Echo | Queryable | undefined,
|
|
26
17
|
query: Q,
|
|
27
18
|
deps?: any[],
|
|
28
19
|
): Live<Query.Type<Q>>[];
|
|
29
20
|
|
|
30
21
|
<F extends Filter.Any>(
|
|
31
|
-
spaceOrEcho: Space | Echo |
|
|
22
|
+
spaceOrEcho: Space | Echo | Queryable | undefined,
|
|
32
23
|
filter: F,
|
|
33
24
|
deps?: any[],
|
|
34
25
|
): Live<Filter.Type<F>>[];
|
|
@@ -38,8 +29,8 @@ interface UseQueryFn {
|
|
|
38
29
|
* Create subscription.
|
|
39
30
|
*/
|
|
40
31
|
export const useQuery: UseQueryFn = (
|
|
41
|
-
// TODO(burdon): Remove Space and just requre Queryable
|
|
42
|
-
resource: Space | Queryable | undefined,
|
|
32
|
+
// TODO(burdon): Remove Space and just requre Queryable.
|
|
33
|
+
resource: Space | Echo | Queryable | undefined,
|
|
43
34
|
queryOrFilter: Query.Any | Filter.Any,
|
|
44
35
|
deps?: any[],
|
|
45
36
|
): Live<unknown>[] => {
|
package/src/echo/useSchema.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import { useMemo, useSyncExternalStore } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type Client } from '@dxos/client';
|
|
9
9
|
import { type Space } from '@dxos/client/echo';
|
|
10
|
-
import { type BaseSchema } from '@dxos/echo
|
|
10
|
+
import { type BaseSchema } from '@dxos/echo/internal';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Subscribe to and retrieve schema changes from a space's schema registry.
|
|
@@ -6,7 +6,7 @@ import React, { type FC, useEffect, useRef, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Client, type PublicKey } from '@dxos/client';
|
|
8
8
|
import { TestBuilder, performInvitation } from '@dxos/client/testing';
|
|
9
|
-
import { type TypedObject } from '@dxos/echo
|
|
9
|
+
import { type TypedObject } from '@dxos/echo/internal';
|
|
10
10
|
import { registerSignalsRuntime } from '@dxos/echo-signals/react';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
@@ -6,7 +6,7 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
10
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
11
11
|
import { render } from '@dxos/storybook-utils';
|
|
12
12
|
|
|
@@ -66,11 +66,9 @@ export const Default: Story = {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
export const Multiple: Story = {
|
|
69
|
-
decorators: [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
},
|
|
75
|
-
},
|
|
69
|
+
decorators: [
|
|
70
|
+
withTheme,
|
|
71
|
+
withLayout({ classNames: 'grid grid-cols-3' }),
|
|
72
|
+
withMultiClientProvider({ ...clientProps, numClients: 3 }),
|
|
73
|
+
],
|
|
76
74
|
};
|