@dxos/echo-solid 0.8.4-main.c85a9c8dae → 0.8.4-main.e00bdcdb52

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/echo-solid",
3
- "version": "0.8.4-main.c85a9c8dae",
3
+ "version": "0.8.4-main.e00bdcdb52",
4
4
  "description": "Solid.js integration for ECHO.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -20,9 +20,6 @@
20
20
  }
21
21
  },
22
22
  "types": "dist/types/src/index.d.ts",
23
- "typesVersions": {
24
- "*": {}
25
- },
26
23
  "files": [
27
24
  "dist",
28
25
  "src"
@@ -30,16 +27,16 @@
30
27
  "dependencies": {
31
28
  "@effect-atom/atom": "^0.5.1",
32
29
  "@solid-primitives/utils": "^6.3.2",
33
- "@dxos/echo": "0.8.4-main.c85a9c8dae",
34
- "@dxos/effect-atom-solid": "0.8.4-main.c85a9c8dae",
35
- "@dxos/echo-atom": "0.8.4-main.c85a9c8dae"
30
+ "@dxos/echo-atom": "0.8.4-main.e00bdcdb52",
31
+ "@dxos/echo": "0.8.4-main.e00bdcdb52",
32
+ "@dxos/effect-atom-solid": "0.8.4-main.e00bdcdb52"
36
33
  },
37
34
  "devDependencies": {
38
35
  "@solidjs/testing-library": "^0.8.10",
39
36
  "solid-js": "^1.9.11",
40
- "vite-plugin-solid": "^2.11.10",
41
- "vitest": "3.2.4",
42
- "@dxos/echo-db": "0.8.4-main.c85a9c8dae"
37
+ "vite-plugin-solid": "^2.11.12",
38
+ "vitest": "4.1.5",
39
+ "@dxos/echo-db": "0.8.4-main.e00bdcdb52"
43
40
  },
44
41
  "peerDependencies": {
45
42
  "solid-js": "^1.9.11"
@@ -8,8 +8,8 @@ import { describe, expect, test } from 'vitest';
8
8
 
9
9
  import type { Entity } from '@dxos/echo';
10
10
  import { Obj } from '@dxos/echo';
11
- import { TestSchema } from '@dxos/echo/testing';
12
11
  import { createObject } from '@dxos/echo-db';
12
+ import { TestSchema } from '@dxos/echo/testing';
13
13
  import { Registry } from '@dxos/effect-atom-solid';
14
14
  import { RegistryProvider } from '@dxos/effect-atom-solid';
15
15
 
@@ -86,9 +86,9 @@ describe('useObject', () => {
86
86
  expect(result).toBe('Test');
87
87
  expect(getByTestId('value').textContent).toBe('Test');
88
88
 
89
- // Update the property via Obj.change.
90
- Obj.change(obj, (o) => {
91
- o.name = 'Updated';
89
+ // Update the property via Obj.update.
90
+ Obj.update(obj, (obj) => {
91
+ obj.name = 'Updated';
92
92
  });
93
93
 
94
94
  // Wait for reactivity to update.
@@ -118,9 +118,9 @@ describe('useObject', () => {
118
118
  expect(valueAccessor?.()?.name).toBe('Test');
119
119
  expect(getByTestId('name').textContent).toBe('Test');
120
120
 
121
- // Update a property via Obj.change.
122
- Obj.change(obj, (o) => {
123
- o.name = 'Updated';
121
+ // Update a property via Obj.update.
122
+ Obj.update(obj, (obj) => {
123
+ obj.name = 'Updated';
124
124
  });
125
125
 
126
126
  // Wait for reactivity to update.
@@ -149,9 +149,9 @@ describe('useObject', () => {
149
149
 
150
150
  expect(result).toBe('Test');
151
151
 
152
- // Update a different property via Obj.change.
153
- Obj.change(obj, (o) => {
154
- o.email = 'newemail@example.com';
152
+ // Update a different property via Obj.update.
153
+ Obj.update(obj, (obj) => {
154
+ obj.email = 'newemail@example.com';
155
155
  });
156
156
 
157
157
  // Name should still be 'Test'.
package/src/useObject.ts CHANGED
@@ -160,20 +160,20 @@ export function useObject<T extends Obj.Unknown, K extends keyof T>(
160
160
  return;
161
161
  }
162
162
 
163
- Obj.change(obj, (o: any) => {
163
+ Obj.update(obj, (obj: any) => {
164
164
  if (typeof updateOrValue === 'function') {
165
- const returnValue = (updateOrValue as (obj: unknown) => unknown)(property !== undefined ? o[property] : o);
165
+ const returnValue = (updateOrValue as (obj: unknown) => unknown)(property !== undefined ? obj[property] : obj);
166
166
  if (returnValue !== undefined) {
167
167
  if (property === undefined) {
168
168
  throw new Error('Cannot re-assign the entire object');
169
169
  }
170
- o[property] = returnValue;
170
+ obj[property] = returnValue;
171
171
  }
172
172
  } else {
173
173
  if (property === undefined) {
174
174
  throw new Error('Cannot re-assign the entire object');
175
175
  }
176
- o[property] = updateOrValue;
176
+ obj[property] = updateOrValue;
177
177
  }
178
178
  });
179
179
  };
@@ -182,8 +182,9 @@ export function useObject<T extends Obj.Unknown, K extends keyof T>(
182
182
  // For property subscriptions on refs, we subscribe to trigger re-render on load.
183
183
  useObjectValue(registry, objOrRef);
184
184
  return [useObjectProperty(registry, liveObj, property), callback as ObjectPropUpdateCallback<T[K]>];
185
+ } else {
186
+ return [useObjectValue(registry, objOrRef), callback as ObjectUpdateCallback<T>];
185
187
  }
186
- return [useObjectValue(registry, objOrRef), callback as ObjectUpdateCallback<T>];
187
188
  }
188
189
 
189
190
  /**
@@ -7,8 +7,8 @@ import { type JSX, createSignal } from 'solid-js';
7
7
  import { afterEach, beforeEach, describe, expect, test } from 'vitest';
8
8
 
9
9
  import { Filter, Obj, Query } from '@dxos/echo';
10
- import { TestSchema } from '@dxos/echo/testing';
11
10
  import { EchoTestBuilder } from '@dxos/echo-db/testing';
11
+ import { TestSchema } from '@dxos/echo/testing';
12
12
 
13
13
  import { useQuery } from './useQuery';
14
14
 
@@ -7,8 +7,8 @@ import { type JSX, createMemo } from 'solid-js';
7
7
  import { afterEach, beforeEach, describe, expect, test } from 'vitest';
8
8
 
9
9
  import { Type } from '@dxos/echo';
10
- import { TestSchema } from '@dxos/echo/testing';
11
10
  import { EchoTestBuilder } from '@dxos/echo-db/testing';
11
+ import { TestSchema } from '@dxos/echo/testing';
12
12
 
13
13
  import { useSchema } from './useSchema';
14
14
 
@@ -100,7 +100,7 @@ describe('useSchema', () => {
100
100
  // The runtime registry query subscription doesn't fire when schemas are registered.
101
101
  // See: packages/core/echo/echo-db/src/proxy-db/runtime-schema-registry.ts:57
102
102
  let schemaAccessor: (() => any) | undefined;
103
- const typename = 'example.com/type/Person';
103
+ const typename = 'com.example.type.person';
104
104
 
105
105
  function TestComponent() {
106
106
  const schema = useSchema(db, typename);