@dxos/react-client 0.8.4-main.72ec0f3 → 0.8.4-main.7ace549

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-client",
3
- "version": "0.8.4-main.72ec0f3",
3
+ "version": "0.8.4-main.7ace549",
4
4
  "description": "React client API",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -86,20 +86,20 @@
86
86
  },
87
87
  "dependencies": {
88
88
  "react-error-boundary": "^4.0.13",
89
- "@dxos/client": "0.8.4-main.72ec0f3",
90
- "@dxos/async": "0.8.4-main.72ec0f3",
91
- "@dxos/config": "0.8.4-main.72ec0f3",
92
- "@dxos/codec-protobuf": "0.8.4-main.72ec0f3",
93
- "@dxos/context": "0.8.4-main.72ec0f3",
94
- "@dxos/debug": "0.8.4-main.72ec0f3",
95
- "@dxos/echo": "0.8.4-main.72ec0f3",
96
- "@dxos/invariant": "0.8.4-main.72ec0f3",
97
- "@dxos/echo-signals": "0.8.4-main.72ec0f3",
98
- "@dxos/node-std": "0.8.4-main.72ec0f3",
99
- "@dxos/log": "0.8.4-main.72ec0f3",
100
- "@dxos/protocols": "0.8.4-main.72ec0f3",
101
- "@dxos/util": "0.8.4-main.72ec0f3",
102
- "@dxos/react-hooks": "0.8.4-main.72ec0f3"
89
+ "@dxos/async": "0.8.4-main.7ace549",
90
+ "@dxos/client": "0.8.4-main.7ace549",
91
+ "@dxos/codec-protobuf": "0.8.4-main.7ace549",
92
+ "@dxos/context": "0.8.4-main.7ace549",
93
+ "@dxos/config": "0.8.4-main.7ace549",
94
+ "@dxos/echo-signals": "0.8.4-main.7ace549",
95
+ "@dxos/invariant": "0.8.4-main.7ace549",
96
+ "@dxos/debug": "0.8.4-main.7ace549",
97
+ "@dxos/echo": "0.8.4-main.7ace549",
98
+ "@dxos/protocols": "0.8.4-main.7ace549",
99
+ "@dxos/react-hooks": "0.8.4-main.7ace549",
100
+ "@dxos/log": "0.8.4-main.7ace549",
101
+ "@dxos/node-std": "0.8.4-main.7ace549",
102
+ "@dxos/util": "0.8.4-main.7ace549"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@types/react": "~19.2.2",
@@ -107,21 +107,21 @@
107
107
  "react": "~19.2.0",
108
108
  "react-dom": "~19.2.0",
109
109
  "typedoc": "0.28.1",
110
- "@dxos/random": "0.8.4-main.72ec0f3",
111
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.72ec0f3",
112
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3",
113
- "@dxos/react-ui": "0.8.4-main.72ec0f3",
114
- "@dxos/storybook-utils": "0.8.4-main.72ec0f3",
115
- "@dxos/test-utils": "0.8.4-main.72ec0f3"
110
+ "@dxos/random": "0.8.4-main.7ace549",
111
+ "@dxos/react-ui-theme": "0.8.4-main.7ace549",
112
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.7ace549",
113
+ "@dxos/react-ui": "0.8.4-main.7ace549",
114
+ "@dxos/storybook-utils": "0.8.4-main.7ace549",
115
+ "@dxos/test-utils": "0.8.4-main.7ace549"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "react": "^19.0.0",
119
119
  "react-dom": "^19.0.0"
120
120
  },
121
121
  "optionalDependencies": {
122
- "@dxos/random": "0.8.4-main.72ec0f3",
123
- "@dxos/react-ui": "0.8.4-main.72ec0f3",
124
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3"
122
+ "@dxos/random": "0.8.4-main.7ace549",
123
+ "@dxos/react-ui": "0.8.4-main.7ace549",
124
+ "@dxos/react-ui-theme": "0.8.4-main.7ace549"
125
125
  },
126
126
  "publishConfig": {
127
127
  "access": "public"
@@ -5,7 +5,7 @@
5
5
  import { renderHook } from '@testing-library/react';
6
6
  import { describe, expect, test } from 'vitest';
7
7
 
8
- import { Expando, Filter } from '@dxos/client/echo';
8
+ import { Filter } from '@dxos/client/echo';
9
9
  import { Obj, Type } from '@dxos/echo';
10
10
 
11
11
  import { createClient, createClientContextProvider } from '../testing/util';
@@ -35,7 +35,7 @@ describe('useQuery', () => {
35
35
  // Setup useQuery hook that captures every render.
36
36
  renderHook(
37
37
  () => {
38
- const objects = useQuery(space, Filter.type(Expando));
38
+ const objects = useQuery(space, Filter.type(Type.Expando));
39
39
 
40
40
  // Capture the names in this render.
41
41
  const namesInThisRender = objects.map((obj) => obj.name);
@@ -94,7 +94,7 @@ describe('useQuery', () => {
94
94
  // Setup useQuery hook that captures every render.
95
95
  renderHook(
96
96
  () => {
97
- const queryObjects = useQuery(space, Filter.type(Expando));
97
+ const queryObjects = useQuery(space, Filter.type(Type.Expando));
98
98
 
99
99
  // Capture the values in this render.
100
100
  const valuesInThisRender = queryObjects.map((obj) => obj.value);
@@ -4,7 +4,8 @@
4
4
 
5
5
  import { useMemo, useSyncExternalStore } from 'react';
6
6
 
7
- import { type Echo, Filter, type Live, Query, type Queryable, type Space, isSpace } from '@dxos/client/echo';
7
+ import { type Database, type Echo, type Entity, Filter, Query, type Space, isSpace } from '@dxos/client/echo';
8
+ import { type AnyProperties } from '@dxos/echo/internal';
8
9
 
9
10
  const EMPTY_ARRAY: never[] = [];
10
11
 
@@ -12,17 +13,17 @@ const noop = () => {};
12
13
 
13
14
  // TODO(dmaretskyi): Queries are fully serializable, so we can remove `deps` argument.
14
15
  interface UseQueryFn {
15
- <Q extends Query.Any>(
16
- spaceOrEcho: Space | Echo | Queryable | undefined,
16
+ <Q extends Query.Any, O extends Entity.Entity<Query.Type<Q>> = Entity.Entity<Query.Type<Q>>>(
17
+ spaceOrEcho: Space | Echo | Database.Queryable | undefined,
17
18
  query: Q,
18
19
  deps?: any[],
19
- ): Live<Query.Type<Q>>[];
20
+ ): O[];
20
21
 
21
- <F extends Filter.Any>(
22
- spaceOrEcho: Space | Echo | Queryable | undefined,
22
+ <F extends Filter.Any, O extends Entity.Entity<Filter.Type<F>> = Entity.Entity<Filter.Type<F>>>(
23
+ spaceOrEcho: Space | Echo | Database.Queryable | undefined,
23
24
  filter: F,
24
25
  deps?: any[],
25
- ): Live<Filter.Type<F>>[];
26
+ ): O[];
26
27
  }
27
28
 
28
29
  /**
@@ -31,10 +32,10 @@ interface UseQueryFn {
31
32
  // TODO(burdon): Sort?
32
33
  export const useQuery: UseQueryFn = (
33
34
  // TODO(burdon): CRITICAL: Remove Space and just requre Queryable.
34
- resource: Space | Echo | Queryable | undefined,
35
+ resource: Space | Echo | Database.Queryable | undefined,
35
36
  queryOrFilter: Query.Any | Filter.Any,
36
37
  deps?: any[],
37
- ): Live<unknown>[] => {
38
+ ): Entity.Entity<AnyProperties>[] => {
38
39
  const query = Filter.is(queryOrFilter) ? Query.select(queryOrFilter) : queryOrFilter;
39
40
 
40
41
  const { getObjects, subscribe } = useMemo(() => {
@@ -59,6 +60,6 @@ export const useQuery: UseQueryFn = (
59
60
 
60
61
  // https://beta.reactjs.org/reference/react/useSyncExternalStore
61
62
  // NOTE: This hook will resubscribe whenever the callback passed to the first argument changes; make sure it is stable.
62
- const objects = useSyncExternalStore<Live<unknown>[] | undefined>(subscribe, getObjects);
63
+ const objects = useSyncExternalStore<Entity.Entity<AnyProperties>[] | undefined>(subscribe, getObjects);
63
64
  return objects ?? [];
64
65
  };
@@ -6,7 +6,7 @@ import { useEffect, useMemo, useRef } from 'react';
6
6
 
7
7
  import { type Queue } from '@dxos/client/echo';
8
8
  import { raise } from '@dxos/debug';
9
- import { type Obj, type Relation } from '@dxos/echo';
9
+ import { type Entity } from '@dxos/echo';
10
10
  import { type DXN } from '@dxos/keys';
11
11
 
12
12
  import { useClient } from '../client';
@@ -24,7 +24,7 @@ export type UseQueueOptions = {
24
24
  // TODO(dmaretskyi): Move into client package.
25
25
  // TODO(dmaretskyi): Consider passing the space into the hook to support queue DXNs without space id.
26
26
  // TODO(ZaymonFC): If queue is unchanged returned object should be refferentially stable on poll.
27
- export const useQueue = <T extends Obj.Any | Relation.Any>(
27
+ export const useQueue = <T extends Entity.Unknown>(
28
28
  queueDxn?: DXN,
29
29
  options: UseQueueOptions = {},
30
30
  ): Queue<T> | undefined => {