@dxos/echo-atom 0.8.4-main.e00bdcdb52 → 0.8.4-main.effb148878

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-atom",
3
- "version": "0.8.4-main.e00bdcdb52",
3
+ "version": "0.8.4-main.effb148878",
4
4
  "description": "Effect Atom wrappers for ECHO objects with explicit subscriptions.",
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": "MIT",
11
+ "license": "FSL-1.1-Apache-2.0",
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": false,
14
14
  "type": "module",
@@ -26,16 +26,16 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@effect-atom/atom": "^0.5.1",
29
- "@dxos/echo": "0.8.4-main.e00bdcdb52",
30
- "@dxos/echo-db": "0.8.4-main.e00bdcdb52",
31
- "@dxos/invariant": "0.8.4-main.e00bdcdb52",
32
- "@dxos/util": "0.8.4-main.e00bdcdb52"
29
+ "@dxos/echo-db": "0.8.4-main.effb148878",
30
+ "@dxos/invariant": "0.8.4-main.effb148878",
31
+ "@dxos/util": "0.8.4-main.effb148878",
32
+ "@dxos/echo": "0.8.4-main.effb148878"
33
33
  },
34
34
  "devDependencies": {
35
35
  "effect": "3.20.0",
36
- "@dxos/random": "0.8.4-main.e00bdcdb52",
37
- "@dxos/context": "0.8.4-main.e00bdcdb52",
38
- "@dxos/test-utils": "0.8.4-main.e00bdcdb52"
36
+ "@dxos/random": "0.8.4-main.effb148878",
37
+ "@dxos/test-utils": "0.8.4-main.effb148878",
38
+ "@dxos/context": "0.8.4-main.effb148878"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "effect": "3.20.0"
package/src/atom.ts CHANGED
@@ -8,7 +8,7 @@ import * as Effect from 'effect/Effect';
8
8
  import * as Function from 'effect/Function';
9
9
  import * as Option from 'effect/Option';
10
10
 
11
- import { type Entity, Obj, Ref, Relation } from '@dxos/echo';
11
+ import { Entity, Obj, Ref, Relation } from '@dxos/echo';
12
12
  import { assertArgument } from '@dxos/invariant';
13
13
 
14
14
  import { loadRefTarget } from './ref-utils';
@@ -130,7 +130,12 @@ export function make<T extends Entity.Unknown>(
130
130
 
131
131
  // At this point, objOrRef is definitely T (not a Ref).
132
132
  const obj = objOrRef as T;
133
- assertArgument(Obj.isObject(obj) || Relation.isRelation(obj), 'obj', 'Object must be a reactive object');
133
+ // Accept any kind of entity (Obj, Relation, or persisted Type) the
134
+ // reactive subscription only needs `[KindId]` to be set; the proxy machinery
135
+ // is kind-agnostic. Narrowing to Obj/Relation here used to throw for type
136
+ // entities returned by the schema registry (e.g. persisted RoastLog), which
137
+ // broke the schema-node connector in plugin-space.
138
+ assertArgument(Entity.isEntity(obj), 'obj', 'Object must be a reactive object');
134
139
 
135
140
  // TODO(dmaretskyi): Fix echo types during review.
136
141
  return objectFamily(obj as any);
@@ -7,8 +7,7 @@ import * as Schema from 'effect/Schema';
7
7
  import { afterEach, beforeEach, describe, expect, test } from 'vitest';
8
8
 
9
9
  import { sleep } from '@dxos/async';
10
- import { Obj, type QueryResult, Type } from '@dxos/echo';
11
- import { Filter, Query } from '@dxos/echo';
10
+ import { DXN, Filter, Obj, Query, type QueryResult, Type } from '@dxos/echo';
12
11
  import { type EchoDatabase, RuntimeSchemaRegistry } from '@dxos/echo-db';
13
12
  import { EchoTestBuilder } from '@dxos/echo-db/testing';
14
13
  import { TestSchema } from '@dxos/echo/testing';
@@ -22,13 +21,8 @@ import * as AtomQuery from './query-atom';
22
21
  const TestItem = Schema.Struct({
23
22
  name: Schema.String,
24
23
  value: Schema.Number,
25
- }).pipe(
26
- Type.object({
27
- typename: 'com.example.type.test-item',
28
- version: '0.1.0',
29
- }),
30
- );
31
- type TestItem = Schema.Schema.Type<typeof TestItem>;
24
+ }).pipe(Type.makeObject(DXN.make('com.example.type.testItem', '0.1.0')));
25
+ type TestItem = Type.InstanceType<typeof TestItem>;
32
26
 
33
27
  describe('AtomQuery', () => {
34
28
  let testBuilder: EchoTestBuilder;
@@ -265,21 +259,11 @@ describe('AtomQuery with queues', () => {
265
259
 
266
260
  const SchemaA = Schema.Struct({
267
261
  name: Schema.String,
268
- }).pipe(
269
- Type.object({
270
- typename: 'com.example.type.a',
271
- version: '0.1.0',
272
- }),
273
- );
262
+ }).pipe(Type.makeObject(DXN.make('com.example.type.a', '0.1.0')));
274
263
 
275
264
  const SchemaB = Schema.Struct({
276
265
  value: Schema.Number,
277
- }).pipe(
278
- Type.object({
279
- typename: 'com.example.type.b',
280
- version: '0.1.0',
281
- }),
282
- );
266
+ }).pipe(Type.makeObject(DXN.make('com.example.type.b', '0.1.0')));
283
267
 
284
268
  describe('AtomQuery.fromQuery with schema registry', () => {
285
269
  let schemaRegistry: RuntimeSchemaRegistry;
package/src/query-atom.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { Atom } from '@effect-atom/atom';
6
6
 
7
- import { DXN, Database, type Entity, type Filter, Query, type QueryResult } from '@dxos/echo';
7
+ import { Database, type Entity, type Filter, Key, Query, type QueryResult } from '@dxos/echo';
8
8
  import { WeakDictionary } from '@dxos/util';
9
9
 
10
10
  /**
@@ -68,9 +68,9 @@ const getQueryableIdentifier = (queryable: Database.Queryable): string => {
68
68
  if (Database.isDatabase(queryable)) {
69
69
  return queryable.spaceId;
70
70
  }
71
- // Queue or similar: use dxn if it's a DXN instance.
72
- if ('dxn' in queryable && queryable.dxn instanceof DXN) {
73
- return queryable.dxn.toString();
71
+ // Queue or similar: use uri if it's a URI (EchoURI or DXN).
72
+ if ('uri' in queryable && Key.URI.isURI(queryable.uri)) {
73
+ return queryable.uri;
74
74
  }
75
75
  // Fallback: use id if it's a string.
76
76
  if ('id' in queryable && typeof queryable.id === 'string') {