@dxos/app-graph 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/index.mjs +173 -190
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +173 -190
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/graph-builder.d.ts +1 -1
- package/dist/types/src/graph-builder.d.ts.map +1 -1
- package/dist/types/src/graph.d.ts +1 -1
- package/dist/types/src/graph.d.ts.map +1 -1
- package/dist/types/src/stories/EchoGraph.stories.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +1 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -22
- package/src/graph-builder.test.ts +8 -7
- package/src/graph-builder.ts +6 -3
- package/src/graph.test.ts +1 -1
- package/src/graph.ts +5 -3
- package/src/signals-integration.test.ts +6 -6
- package/src/stories/EchoGraph.stories.tsx +4 -3
- package/src/testing.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/app-graph",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.ae835ea",
|
|
4
4
|
"description": "Constructs knowledge graphs for the purpose of building applications on top of",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -27,33 +27,32 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@preact/signals-core": "^1.12.1",
|
|
29
29
|
"main-thread-scheduling": "^14.1.1",
|
|
30
|
-
"@dxos/async": "0.8.4-main.
|
|
31
|
-
"@dxos/debug": "0.8.4-main.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/util": "0.8.4-main.a4bbb77"
|
|
30
|
+
"@dxos/async": "0.8.4-main.ae835ea",
|
|
31
|
+
"@dxos/debug": "0.8.4-main.ae835ea",
|
|
32
|
+
"@dxos/invariant": "0.8.4-main.ae835ea",
|
|
33
|
+
"@dxos/echo-signals": "0.8.4-main.ae835ea",
|
|
34
|
+
"@dxos/live-object": "0.8.4-main.ae835ea",
|
|
35
|
+
"@dxos/log": "0.8.4-main.ae835ea",
|
|
36
|
+
"@dxos/util": "0.8.4-main.ae835ea",
|
|
37
|
+
"@dxos/echo": "0.8.4-main.ae835ea"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"@effect-rx/rx-react": "0.42.4",
|
|
42
41
|
"@effect/platform": "0.92.1",
|
|
43
|
-
"@types/react": "~19.2.
|
|
44
|
-
"@types/react-dom": "~19.2.
|
|
42
|
+
"@types/react": "~19.2.2",
|
|
43
|
+
"@types/react-dom": "~19.2.2",
|
|
45
44
|
"effect": "3.18.3",
|
|
46
45
|
"react": "~19.2.0",
|
|
47
46
|
"react-dom": "~19.2.0",
|
|
48
47
|
"vite": "7.1.9",
|
|
49
|
-
"@dxos/echo-db": "0.8.4-main.
|
|
50
|
-
"@dxos/random": "0.8.4-main.
|
|
51
|
-
"@dxos/react-client": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
53
|
-
"@dxos/react-ui-list": "0.8.4-main.
|
|
54
|
-
"@dxos/react-ui-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
48
|
+
"@dxos/echo-db": "0.8.4-main.ae835ea",
|
|
49
|
+
"@dxos/random": "0.8.4-main.ae835ea",
|
|
50
|
+
"@dxos/react-client": "0.8.4-main.ae835ea",
|
|
51
|
+
"@dxos/react-ui": "0.8.4-main.ae835ea",
|
|
52
|
+
"@dxos/react-ui-list": "0.8.4-main.ae835ea",
|
|
53
|
+
"@dxos/react-ui-theme": "0.8.4-main.ae835ea",
|
|
54
|
+
"@dxos/react-ui-tabs": "0.8.4-main.ae835ea",
|
|
55
|
+
"@dxos/storybook-utils": "0.8.4-main.ae835ea"
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
58
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -61,8 +60,8 @@
|
|
|
61
60
|
"effect": "3.14.21",
|
|
62
61
|
"react": "^19.0.0",
|
|
63
62
|
"react-dom": "^19.0.0",
|
|
64
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
65
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
63
|
+
"@dxos/react-ui": "0.8.4-main.ae835ea",
|
|
64
|
+
"@dxos/react-ui-theme": "0.8.4-main.ae835ea"
|
|
66
65
|
},
|
|
67
66
|
"publishConfig": {
|
|
68
67
|
"access": "public"
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
7
8
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
8
9
|
|
|
9
10
|
import { Trigger, sleep } from '@dxos/async';
|
|
@@ -238,7 +239,7 @@ describe('GraphBuilder', () => {
|
|
|
238
239
|
id: 'root',
|
|
239
240
|
connector: (node) =>
|
|
240
241
|
Rx.make((get) =>
|
|
241
|
-
pipe(
|
|
242
|
+
Function.pipe(
|
|
242
243
|
get(node),
|
|
243
244
|
Option.flatMap((node) => (node.id === 'root' ? Option.some(get(name)) : Option.none())),
|
|
244
245
|
Option.filter((name) => name !== 'removed'),
|
|
@@ -330,7 +331,7 @@ describe('GraphBuilder', () => {
|
|
|
330
331
|
id: 'root',
|
|
331
332
|
connector: (node) =>
|
|
332
333
|
Rx.make((get) =>
|
|
333
|
-
pipe(
|
|
334
|
+
Function.pipe(
|
|
334
335
|
get(node),
|
|
335
336
|
Option.flatMap((node) => (node.id === 'root' ? Option.some(get(name)) : Option.none())),
|
|
336
337
|
Option.filter((name) => name !== 'removed'),
|
|
@@ -343,7 +344,7 @@ describe('GraphBuilder', () => {
|
|
|
343
344
|
id: 'connector1',
|
|
344
345
|
connector: (node) =>
|
|
345
346
|
Rx.make((get) =>
|
|
346
|
-
pipe(
|
|
347
|
+
Function.pipe(
|
|
347
348
|
get(node),
|
|
348
349
|
Option.flatMap((node) => (node.id === EXAMPLE_ID ? Option.some(get(sub)) : Option.none())),
|
|
349
350
|
Option.map((sub) => [{ id: exampleId(2), type: EXAMPLE_TYPE, data: sub }]),
|
|
@@ -355,7 +356,7 @@ describe('GraphBuilder', () => {
|
|
|
355
356
|
id: 'connector2',
|
|
356
357
|
connector: (node) =>
|
|
357
358
|
Rx.make((get) =>
|
|
358
|
-
pipe(
|
|
359
|
+
Function.pipe(
|
|
359
360
|
get(node),
|
|
360
361
|
Option.flatMap((node) => (node.id === EXAMPLE_ID ? Option.some(node.data) : Option.none())),
|
|
361
362
|
Option.map((data) => [{ id: exampleId(3), type: EXAMPLE_TYPE, data }]),
|
|
@@ -439,7 +440,7 @@ describe('GraphBuilder', () => {
|
|
|
439
440
|
id: 'connector',
|
|
440
441
|
connector: (node) => {
|
|
441
442
|
return Rx.make((get) =>
|
|
442
|
-
pipe(
|
|
443
|
+
Function.pipe(
|
|
443
444
|
get(node),
|
|
444
445
|
Option.map((node) => (node.data ? node.data + 1 : 1)),
|
|
445
446
|
Option.filter((data) => data <= 5),
|
|
@@ -475,7 +476,7 @@ describe('GraphBuilder', () => {
|
|
|
475
476
|
id: 'connector',
|
|
476
477
|
connector: (node) =>
|
|
477
478
|
Rx.make((get) =>
|
|
478
|
-
pipe(
|
|
479
|
+
Function.pipe(
|
|
479
480
|
get(node),
|
|
480
481
|
Option.map((node) => (node.data ? node.data + 1 : 1)),
|
|
481
482
|
Option.filter((data) => data <= 5),
|
package/src/graph-builder.ts
CHANGED
|
@@ -4,7 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { effect } from '@preact/signals-core';
|
|
7
|
-
import
|
|
7
|
+
import * as Array from 'effect/Array';
|
|
8
|
+
import * as Function from 'effect/Function';
|
|
9
|
+
import * as Option from 'effect/Option';
|
|
10
|
+
import * as Record from 'effect/Record';
|
|
8
11
|
|
|
9
12
|
import { type CleanupFn, type MulticastObservable, type Trigger } from '@dxos/async';
|
|
10
13
|
import { log } from '@dxos/log';
|
|
@@ -289,7 +292,7 @@ export class GraphBuilder {
|
|
|
289
292
|
|
|
290
293
|
private readonly _resolvers = Rx.family<string, Rx.Rx<Option.Option<NodeArg<any>>>>((id) => {
|
|
291
294
|
return Rx.make((get) => {
|
|
292
|
-
return pipe(
|
|
295
|
+
return Function.pipe(
|
|
293
296
|
get(this._extensions),
|
|
294
297
|
Record.values,
|
|
295
298
|
Array.sortBy(byPosition),
|
|
@@ -307,7 +310,7 @@ export class GraphBuilder {
|
|
|
307
310
|
const [id, relation] = key.split('+');
|
|
308
311
|
const node = this._graph.node(id);
|
|
309
312
|
|
|
310
|
-
return pipe(
|
|
313
|
+
return Function.pipe(
|
|
311
314
|
get(this._extensions),
|
|
312
315
|
Record.values,
|
|
313
316
|
// TODO(wittjosiah): Sort on write rather than read.
|
package/src/graph.test.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
7
|
import { assert, describe, expect, onTestFinished, test } from 'vitest';
|
|
8
8
|
|
|
9
9
|
import { Graph, ROOT_ID, ROOT_TYPE, getGraph } from './graph';
|
package/src/graph.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
8
|
+
import * as Record from 'effect/Record';
|
|
7
9
|
|
|
8
10
|
import { Event, Trigger } from '@dxos/async';
|
|
9
11
|
import { todo } from '@dxos/debug';
|
|
@@ -285,7 +287,7 @@ export class Graph implements WritableGraph {
|
|
|
285
287
|
const toJSON = (node: Node, seen: string[] = []): any => {
|
|
286
288
|
const nodes = get(this.connections(node.id));
|
|
287
289
|
const obj: Record<string, any> = {
|
|
288
|
-
id: node.id
|
|
290
|
+
id: node.id,
|
|
289
291
|
type: node.type,
|
|
290
292
|
};
|
|
291
293
|
if (node.properties.label) {
|
|
@@ -553,7 +555,7 @@ export class Graph implements WritableGraph {
|
|
|
553
555
|
}
|
|
554
556
|
|
|
555
557
|
getPath({ source = 'root', target }: { source?: string; target: string }): Option.Option<string[]> {
|
|
556
|
-
return pipe(
|
|
558
|
+
return Function.pipe(
|
|
557
559
|
this.getNode(source),
|
|
558
560
|
Option.flatMap((node) => {
|
|
559
561
|
let found: Option.Option<string[]> = Option.none();
|
|
@@ -7,11 +7,11 @@ import { signal } from '@preact/signals-core';
|
|
|
7
7
|
import { afterEach, beforeEach, describe, expect, onTestFinished, test } from 'vitest';
|
|
8
8
|
|
|
9
9
|
import { Trigger } from '@dxos/async';
|
|
10
|
+
import { Obj, Type } from '@dxos/echo';
|
|
11
|
+
import { Ref } from '@dxos/echo/internal';
|
|
10
12
|
import { Filter } from '@dxos/echo-db';
|
|
11
13
|
import { EchoTestBuilder } from '@dxos/echo-db/testing';
|
|
12
|
-
import { Expando, Ref } from '@dxos/echo-schema';
|
|
13
14
|
import { registerSignalsRuntime } from '@dxos/echo-signals';
|
|
14
|
-
import { live } from '@dxos/live-object';
|
|
15
15
|
|
|
16
16
|
import { ROOT_ID } from './graph';
|
|
17
17
|
import { GraphBuilder, createExtension, rxFromSignal } from './graph-builder';
|
|
@@ -174,15 +174,15 @@ describe('signals integration', () => {
|
|
|
174
174
|
const registry = Registry.make();
|
|
175
175
|
await using peer = await dbBuilder.createPeer();
|
|
176
176
|
await using db = await peer.createDatabase();
|
|
177
|
-
db.add(
|
|
178
|
-
db.add(
|
|
177
|
+
db.add(Obj.make(Type.Expando, { name: 'a' }));
|
|
178
|
+
db.add(Obj.make(Type.Expando, { name: 'b' }));
|
|
179
179
|
|
|
180
180
|
const builder = new GraphBuilder({ registry });
|
|
181
181
|
builder.addExtension(
|
|
182
182
|
createExtension({
|
|
183
183
|
id: 'expando',
|
|
184
184
|
connector: () => {
|
|
185
|
-
const query = db.query(Filter.type(Expando));
|
|
185
|
+
const query = db.query(Filter.type(Type.Expando));
|
|
186
186
|
|
|
187
187
|
return Rx.make((get) => {
|
|
188
188
|
const objects = get(rxFromQuery(query));
|
|
@@ -205,7 +205,7 @@ describe('signals integration', () => {
|
|
|
205
205
|
graph.expand(ROOT_ID);
|
|
206
206
|
expect(count).to.eq(2);
|
|
207
207
|
|
|
208
|
-
const object = db.add(
|
|
208
|
+
const object = db.add(Obj.make(Type.Expando, { name: 'c' }));
|
|
209
209
|
await db.flush();
|
|
210
210
|
expect(count).to.eq(3);
|
|
211
211
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Registry, RegistryContext, Rx, useRxValue } from '@effect-rx/rx-react';
|
|
6
6
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
|
-
import
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Option from 'effect/Option';
|
|
8
9
|
import React, { type PropsWithChildren, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
9
10
|
|
|
10
11
|
import {
|
|
@@ -60,7 +61,7 @@ const createGraph = (client: Client, registry: Registry.Registry): ExpandableGra
|
|
|
60
61
|
id: 'space',
|
|
61
62
|
connector: (node) =>
|
|
62
63
|
Rx.make((get) =>
|
|
63
|
-
pipe(
|
|
64
|
+
Function.pipe(
|
|
64
65
|
get(node),
|
|
65
66
|
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
66
67
|
Option.map(() => {
|
|
@@ -84,7 +85,7 @@ const createGraph = (client: Client, registry: Registry.Registry): ExpandableGra
|
|
|
84
85
|
connector: (node) => {
|
|
85
86
|
let query: QueryResult<Live<Expando>> | undefined;
|
|
86
87
|
return Rx.make((get) =>
|
|
87
|
-
pipe(
|
|
88
|
+
Function.pipe(
|
|
88
89
|
get(node),
|
|
89
90
|
Option.flatMap((node) => (isSpace(node.data) ? Option.some(node.data) : Option.none())),
|
|
90
91
|
Option.map((space) => {
|
package/src/testing.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
|
|
7
|
+
import { type AnyEchoObject } from '@dxos/echo/internal';
|
|
7
8
|
import { type QueryResult } from '@dxos/echo-db';
|
|
8
|
-
import { type AnyEchoObject } from '@dxos/echo-schema';
|
|
9
9
|
|
|
10
10
|
export const rxFromQuery = <T extends AnyEchoObject>(query: QueryResult<T>): Rx.Rx<T[]> => {
|
|
11
11
|
return Rx.make((get) => {
|