@dxos/app-graph 0.6.13-main.ed424a1 → 0.6.13
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 +2 -2
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +2 -2
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +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/package.json +17 -19
- package/src/graph-builder.test.ts +7 -2
- package/src/graph.test.ts +9 -4
- package/src/graph.ts +2 -2
- package/src/stories/EchoGraph.stories.tsx +9 -7
- package/dist/lib/node-esm/index.mjs +0 -808
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
package/dist/lib/node/meta.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/sdk/app-graph/src/node.ts":{"bytes":5363,"imports":[],"format":"esm"},"packages/sdk/app-graph/src/graph.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/sdk/app-graph/src/node.ts":{"bytes":5363,"imports":[],"format":"esm"},"packages/sdk/app-graph/src/graph.ts":{"bytes":53358,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/sdk/app-graph/src/node.ts","kind":"import-statement","original":"./node"}],"format":"esm"},"packages/sdk/app-graph/src/graph-builder.ts":{"bytes":44291,"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/sdk/app-graph/src/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-graph/src/node.ts","kind":"import-statement","original":"./node"},{"path":"main-thread-scheduling","kind":"dynamic-import","external":true}],"format":"esm"},"packages/sdk/app-graph/src/index.ts":{"bytes":672,"imports":[{"path":"packages/sdk/app-graph/src/graph.ts","kind":"import-statement","original":"./graph"},{"path":"packages/sdk/app-graph/src/graph-builder.ts","kind":"import-statement","original":"./graph-builder"},{"path":"packages/sdk/app-graph/src/node.ts","kind":"import-statement","original":"./node"}],"format":"esm"}},"outputs":{"packages/sdk/app-graph/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":51885},"packages/sdk/app-graph/dist/lib/node/index.cjs":{"imports":[{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/async","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@preact/signals-core","kind":"import-statement","external":true},{"path":"@dxos/echo-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"main-thread-scheduling","kind":"dynamic-import","external":true}],"exports":["ACTION_GROUP_TYPE","ACTION_TYPE","Graph","GraphBuilder","ROOT_ID","ROOT_TYPE","actionGroupSymbol","cleanup","createExtension","getGraph","isAction","isActionGroup","isActionLike","isGraphNode","memoize","toSignal"],"entryPoint":"packages/sdk/app-graph/src/index.ts","inputs":{"packages/sdk/app-graph/src/graph.ts":{"bytesInOutput":12978},"packages/sdk/app-graph/src/node.ts":{"bytesInOutput":477},"packages/sdk/app-graph/src/index.ts":{"bytesInOutput":0},"packages/sdk/app-graph/src/graph-builder.ts":{"bytesInOutput":9193}},"bytes":23091}}}
|
|
@@ -70,7 +70,7 @@ export declare class Graph {
|
|
|
70
70
|
* If a node is not found within the graph and an `onInitialNode` callback is provided,
|
|
71
71
|
* it is called with the id and type of the node, potentially initializing the node.
|
|
72
72
|
*/
|
|
73
|
-
findNode(id: string
|
|
73
|
+
findNode(id: string): Node | undefined;
|
|
74
74
|
/**
|
|
75
75
|
* Wait for a node to be added to the graph.
|
|
76
76
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAgB,KAAK,UAAU,EAAgB,MAAM,QAAQ,CAAC;AAM/F,eAAO,MAAM,QAAQ,SAAU,IAAI,KAAG,KAIrC,CAAC;AAEF,eAAO,MAAM,OAAO,SAAS,CAAC;AAC9B,eAAO,MAAM,SAAS,4BAA4B,CAAC;AACnD,eAAO,MAAM,WAAW,8BAA8B,CAAC;AACvD,eAAO,MAAM,iBAAiB,mCAAmC,CAAC;AAElE,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI;IACvF,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAKF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,GAAG,IAAI,CAAC;IAExD;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,QAAQ,CAA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E;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,EAAE,GAAG,SAAS;IAkC/F,OAAO,CAAC,QAAQ;IAgEhB,OAAO,CAAC,WAAW;IAwCnB,OAAO,CAAC,QAAQ;IA6BhB,OAAO,CAAC,WAAW;IAiCnB;;;;;;;;;OASG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;IAa9D,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,SAAS;CAyBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EchoGraph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/EchoGraph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;
|
|
1
|
+
{"version":3,"file":"EchoGraph.stories.d.ts","sourceRoot":"","sources":["../../../../src/stories/EchoGraph.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAA8B,MAAM,OAAO,CAAC;;;;;;AA0PnD,wBAaE;AAEF,eAAO,MAAM,OAAO,IAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/app-graph",
|
|
3
|
-
"version": "0.6.13
|
|
3
|
+
"version": "0.6.13",
|
|
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",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"browser": "./dist/lib/browser/index.mjs",
|
|
12
12
|
"node": {
|
|
13
|
-
"
|
|
14
|
-
"default": "./dist/lib/node-esm/index.mjs"
|
|
13
|
+
"default": "./dist/lib/node/index.cjs"
|
|
15
14
|
},
|
|
16
15
|
"types": "./dist/types/src/index.d.ts"
|
|
17
16
|
}
|
|
@@ -27,13 +26,13 @@
|
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"@preact/signals-core": "^1.6.0",
|
|
29
28
|
"main-thread-scheduling": "^14.1.1",
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/echo-
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
29
|
+
"@dxos/debug": "0.6.13",
|
|
30
|
+
"@dxos/async": "0.6.13",
|
|
31
|
+
"@dxos/echo-schema": "0.6.13",
|
|
32
|
+
"@dxos/echo-signals": "0.6.13",
|
|
33
|
+
"@dxos/invariant": "0.6.13",
|
|
34
|
+
"@dxos/log": "0.6.13",
|
|
35
|
+
"@dxos/util": "0.6.13"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
38
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -41,17 +40,16 @@
|
|
|
41
40
|
"@types/react-dom": "~18.2.0",
|
|
42
41
|
"react": "~18.2.0",
|
|
43
42
|
"react-dom": "~18.2.0",
|
|
44
|
-
"vite": "5.4
|
|
45
|
-
"@dxos/random": "0.6.13
|
|
46
|
-
"@dxos/react-
|
|
47
|
-
"@dxos/react-
|
|
48
|
-
"@dxos/react-ui-theme": "0.6.13
|
|
49
|
-
"@dxos/storybook-utils": "0.6.13
|
|
43
|
+
"vite": "^5.3.4",
|
|
44
|
+
"@dxos/random": "0.6.13",
|
|
45
|
+
"@dxos/react-client": "0.6.13",
|
|
46
|
+
"@dxos/react-ui": "0.6.13",
|
|
47
|
+
"@dxos/react-ui-theme": "0.6.13",
|
|
48
|
+
"@dxos/storybook-utils": "0.6.13"
|
|
50
49
|
},
|
|
51
50
|
"peerDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"react": "
|
|
54
|
-
"react-dom": "~18.2.0"
|
|
51
|
+
"react": "^18.0.0",
|
|
52
|
+
"react-dom": "^18.0.0"
|
|
55
53
|
},
|
|
56
54
|
"publishConfig": {
|
|
57
55
|
"access": "public"
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { batch, signal } from '@preact/signals-core';
|
|
6
|
-
import {
|
|
6
|
+
import chai, { expect } from 'chai';
|
|
7
|
+
import chaiAsPromised from 'chai-as-promised';
|
|
8
|
+
|
|
9
|
+
import { describe, test } from '@dxos/test';
|
|
7
10
|
|
|
8
11
|
import { ACTION_TYPE } from './graph';
|
|
9
12
|
import { GraphBuilder, createExtension, memoize } from './graph-builder';
|
|
10
13
|
import { type Node } from './node';
|
|
11
14
|
|
|
15
|
+
chai.use(chaiAsPromised);
|
|
16
|
+
|
|
12
17
|
const exampleId = (id: number) => `dx:test:${id}`;
|
|
13
18
|
const EXAMPLE_ID = exampleId(1);
|
|
14
19
|
const EXAMPLE_TYPE = 'dxos.org/type/example';
|
|
@@ -254,7 +259,7 @@ describe('GraphBuilder', () => {
|
|
|
254
259
|
expect(actions?.[0].id).to.equal('action');
|
|
255
260
|
expect(actions?.[0].type).to.equal(ACTION_TYPE);
|
|
256
261
|
|
|
257
|
-
await expect(graph.waitForNode('not-action', 10)).
|
|
262
|
+
await expect(graph.waitForNode('not-action', 10)).to.be.rejected;
|
|
258
263
|
|
|
259
264
|
await graph.expand(graph.root);
|
|
260
265
|
const nodes = graph.nodes(graph.root);
|
package/src/graph.test.ts
CHANGED
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { effect } from '@preact/signals-core';
|
|
6
|
-
import {
|
|
6
|
+
import { expect } from 'chai';
|
|
7
7
|
|
|
8
8
|
import { updateCounter } from '@dxos/echo-schema/testing';
|
|
9
|
-
import {
|
|
9
|
+
import { registerSignalRuntime } from '@dxos/echo-signals';
|
|
10
|
+
import { describe, test } from '@dxos/test';
|
|
10
11
|
|
|
11
12
|
import { Graph, ROOT_ID, ROOT_TYPE, getGraph } from './graph';
|
|
12
13
|
import { type Node, type NodeFilter } from './node';
|
|
13
14
|
|
|
14
|
-
registerSignalsRuntime();
|
|
15
|
-
|
|
16
15
|
const longestPaths = new Map<string, string[]>();
|
|
17
16
|
|
|
18
17
|
const filterLongestPath: NodeFilter = (node, connectedNode): node is Node => {
|
|
@@ -250,6 +249,7 @@ describe('Graph', () => {
|
|
|
250
249
|
});
|
|
251
250
|
|
|
252
251
|
test('waitForNode', async () => {
|
|
252
|
+
registerSignalRuntime();
|
|
253
253
|
const graph = new Graph();
|
|
254
254
|
const promise = graph.waitForNode('test1');
|
|
255
255
|
graph._addNodes([{ id: 'test1', type: 'test', data: 1 }]);
|
|
@@ -259,6 +259,7 @@ describe('Graph', () => {
|
|
|
259
259
|
});
|
|
260
260
|
|
|
261
261
|
test('updates are constrained on data', () => {
|
|
262
|
+
registerSignalRuntime();
|
|
262
263
|
const graph = new Graph();
|
|
263
264
|
const [node1] = graph._addNodes([{ id: 'test1', type: 'test', data: 1 }]);
|
|
264
265
|
using updates = updateCounter(() => {
|
|
@@ -274,6 +275,7 @@ describe('Graph', () => {
|
|
|
274
275
|
});
|
|
275
276
|
|
|
276
277
|
test('updates are constrained on properties', () => {
|
|
278
|
+
registerSignalRuntime();
|
|
277
279
|
const graph = new Graph();
|
|
278
280
|
const [node1] = graph._addNodes([{ id: 'test1', type: 'test', properties: { value: 1 } }]);
|
|
279
281
|
using updates = updateCounter(() => {
|
|
@@ -287,6 +289,7 @@ describe('Graph', () => {
|
|
|
287
289
|
});
|
|
288
290
|
|
|
289
291
|
test('updates are constrained on connected nodes', () => {
|
|
292
|
+
registerSignalRuntime();
|
|
290
293
|
const graph = new Graph();
|
|
291
294
|
const [node1] = graph._addNodes([{ id: 'test1', type: 'test', properties: { value: 1 } }]);
|
|
292
295
|
using updates = updateCounter(() => {
|
|
@@ -466,6 +469,7 @@ describe('Graph', () => {
|
|
|
466
469
|
});
|
|
467
470
|
|
|
468
471
|
test('traversing the graph subscribes to changes', () => {
|
|
472
|
+
registerSignalRuntime();
|
|
469
473
|
const graph = new Graph();
|
|
470
474
|
|
|
471
475
|
graph._addNodes([
|
|
@@ -538,6 +542,7 @@ describe('Graph', () => {
|
|
|
538
542
|
});
|
|
539
543
|
|
|
540
544
|
test('traversal can be reactive', async () => {
|
|
545
|
+
registerSignalRuntime();
|
|
541
546
|
const graph = new Graph();
|
|
542
547
|
const latest: Record<string, any> = {};
|
|
543
548
|
const updates: Record<string, number> = {};
|
package/src/graph.ts
CHANGED
|
@@ -144,9 +144,9 @@ export class Graph {
|
|
|
144
144
|
* If a node is not found within the graph and an `onInitialNode` callback is provided,
|
|
145
145
|
* it is called with the id and type of the node, potentially initializing the node.
|
|
146
146
|
*/
|
|
147
|
-
findNode(id: string
|
|
147
|
+
findNode(id: string): Node | undefined {
|
|
148
148
|
const existingNode = this._nodes[id];
|
|
149
|
-
if (!existingNode
|
|
149
|
+
if (!existingNode) {
|
|
150
150
|
void this._onInitialNode?.(id);
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -7,19 +7,19 @@ import '@dxos-theme';
|
|
|
7
7
|
import { Pause, Play, Plus, Timer } from '@phosphor-icons/react';
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
|
|
10
|
+
import { type EchoReactiveObject, create } from '@dxos/echo-schema';
|
|
11
|
+
import { registerSignalRuntime } from '@dxos/echo-signals';
|
|
12
|
+
import { faker } from '@dxos/random';
|
|
13
|
+
import { type Client, useClient } from '@dxos/react-client';
|
|
10
14
|
import {
|
|
11
|
-
create,
|
|
12
|
-
type Echo,
|
|
13
|
-
type EchoReactiveObject,
|
|
14
|
-
type FilterSource,
|
|
15
15
|
type Space,
|
|
16
16
|
SpaceState,
|
|
17
17
|
isSpace,
|
|
18
|
+
type Echo,
|
|
19
|
+
type FilterSource,
|
|
18
20
|
type QueryOptions,
|
|
19
21
|
type Query,
|
|
20
|
-
} from '@dxos/client/echo';
|
|
21
|
-
import { faker } from '@dxos/random';
|
|
22
|
-
import { type Client, useClient } from '@dxos/react-client';
|
|
22
|
+
} from '@dxos/react-client/echo';
|
|
23
23
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
24
24
|
import { Button, DensityProvider, Input, Select, useAsyncEffect } from '@dxos/react-ui';
|
|
25
25
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
@@ -35,6 +35,8 @@ const DEFAULT_PERIOD = 500;
|
|
|
35
35
|
|
|
36
36
|
const EMPTY_ARRAY: never[] = [];
|
|
37
37
|
|
|
38
|
+
registerSignalRuntime();
|
|
39
|
+
|
|
38
40
|
enum Action {
|
|
39
41
|
CREATE_SPACE = 'CREATE_SPACE',
|
|
40
42
|
CLOSE_SPACE = 'CLOSE_SPACE',
|