@dxos/plugin-graph 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7
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/{graph-PXKA3JXN.mjs → graph-MX5UQYEY.mjs} +7 -6
- package/dist/lib/browser/graph-MX5UQYEY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/{graph-CR2XR64B.mjs → graph-2RMPUX7I.mjs} +7 -6
- package/dist/lib/node-esm/graph-2RMPUX7I.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +13 -8
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/GraphPlugin.d.ts.map +1 -1
- package/dist/types/src/graph.d.ts +3 -3
- package/dist/types/src/graph.d.ts.map +1 -1
- package/dist/types/src/hooks/useNode.d.ts +3 -1
- package/dist/types/src/hooks/useNode.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -17
- package/src/GraphPlugin.ts +5 -4
- package/src/graph.ts +7 -6
- package/src/hooks/useActionRunner.ts +1 -1
- package/src/hooks/useNode.ts +10 -1
- package/src/meta.ts +1 -1
- package/dist/lib/browser/graph-PXKA3JXN.mjs.map +0 -7
- package/dist/lib/node-esm/graph-CR2XR64B.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-graph",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.6fa680abb7",
|
|
4
4
|
"description": "DXOS Surface plugin for constructing knowledge graphs",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -29,30 +29,31 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
32
|
+
"@dxos/app-framework": "0.8.4-main.6fa680abb7",
|
|
33
|
+
"@dxos/app-graph": "0.8.4-main.6fa680abb7",
|
|
34
|
+
"@dxos/debug": "0.8.4-main.6fa680abb7",
|
|
35
|
+
"@dxos/app-toolkit": "0.8.4-main.6fa680abb7",
|
|
36
|
+
"@dxos/async": "0.8.4-main.6fa680abb7",
|
|
37
|
+
"@dxos/operation": "0.8.4-main.6fa680abb7",
|
|
38
|
+
"@dxos/effect": "0.8.4-main.6fa680abb7",
|
|
39
|
+
"@dxos/util": "0.8.4-main.6fa680abb7"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@effect-atom/atom-react": "^0.
|
|
42
|
-
"@effect/platform": "0.
|
|
42
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
43
|
+
"@effect/platform": "0.94.4",
|
|
43
44
|
"@types/react": "~19.2.7",
|
|
44
45
|
"@types/react-dom": "~19.2.3",
|
|
45
|
-
"effect": "3.19.
|
|
46
|
+
"effect": "3.19.16",
|
|
46
47
|
"react": "~19.2.3",
|
|
47
48
|
"react-dom": "~19.2.3",
|
|
48
|
-
"vite": "7.1.
|
|
49
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
50
|
-
"@dxos/react-client": "0.8.4-main.
|
|
49
|
+
"vite": "^7.1.11",
|
|
50
|
+
"@dxos/storybook-utils": "0.8.4-main.6fa680abb7",
|
|
51
|
+
"@dxos/react-client": "0.8.4-main.6fa680abb7"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"@effect-atom/atom-react": "^0.
|
|
54
|
-
"@effect/platform": "0.
|
|
55
|
-
"effect": "3.19.
|
|
54
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
55
|
+
"@effect/platform": "0.94.4",
|
|
56
|
+
"effect": "3.19.16",
|
|
56
57
|
"react": "~19.2.3",
|
|
57
58
|
"react-dom": "~19.2.3"
|
|
58
59
|
},
|
package/src/GraphPlugin.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
8
|
import { meta } from './meta';
|
|
8
9
|
|
|
@@ -15,9 +16,9 @@ const Graph = Capability.lazy('Graph', () => import('./graph'));
|
|
|
15
16
|
*/
|
|
16
17
|
export const GraphPlugin = Plugin.define(meta).pipe(
|
|
17
18
|
Plugin.addModule({
|
|
18
|
-
activatesOn:
|
|
19
|
-
activatesBefore: [
|
|
20
|
-
activatesAfter: [
|
|
19
|
+
activatesOn: ActivationEvents.Startup,
|
|
20
|
+
activatesBefore: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],
|
|
21
|
+
activatesAfter: [AppActivationEvents.AppGraphReady],
|
|
21
22
|
activate: Graph,
|
|
22
23
|
}),
|
|
23
24
|
Plugin.make,
|
package/src/graph.ts
CHANGED
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import * as Record from 'effect/Record';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
import { Graph, GraphBuilder, Node } from '@dxos/app-graph';
|
|
10
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
11
|
|
|
11
12
|
// TODO(wittjosiah): Remove or restore graph caching.
|
|
12
13
|
// import { meta } from './meta';
|
|
13
14
|
|
|
14
|
-
// const KEY = `${meta.id}
|
|
15
|
+
// const KEY = `${meta.id}.app-graph`;
|
|
15
16
|
|
|
16
17
|
export default Capability.makeModule(
|
|
17
18
|
Effect.fnUntraced(function* () {
|
|
18
|
-
const registry = yield* Capability.get(
|
|
19
|
-
const extensionsAtom = yield* Capability.atom(
|
|
19
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
20
|
+
const extensionsAtom = yield* Capability.atom(AppCapabilities.AppGraphBuilder);
|
|
20
21
|
|
|
21
22
|
const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);
|
|
22
23
|
// const interval = setInterval(() => {
|
|
@@ -36,12 +37,12 @@ export default Capability.makeModule(
|
|
|
36
37
|
);
|
|
37
38
|
|
|
38
39
|
// await builder.initialize();
|
|
39
|
-
void Graph.expand(builder.graph, Node.RootId);
|
|
40
|
+
void Graph.expand(builder.graph, Node.RootId, 'child');
|
|
40
41
|
|
|
41
42
|
setupDevtools(builder.graph);
|
|
42
43
|
|
|
43
44
|
return Capability.contributes(
|
|
44
|
-
|
|
45
|
+
AppCapabilities.AppGraph,
|
|
45
46
|
{ graph: builder.graph, explore: GraphBuilder.explore },
|
|
46
47
|
() =>
|
|
47
48
|
Effect.sync(() => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useOperationInvoker, usePluginManager } from '@dxos/app-framework/
|
|
7
|
+
import { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';
|
|
8
8
|
import { type Node } from '@dxos/app-graph';
|
|
9
9
|
|
|
10
10
|
import { runAction } from '../action';
|
package/src/hooks/useNode.ts
CHANGED
|
@@ -20,10 +20,19 @@ export const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.
|
|
|
20
20
|
return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => undefined);
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export const useConnections = (
|
|
23
|
+
export const useConnections = (
|
|
24
|
+
graph: Graph.ReadableGraph,
|
|
25
|
+
id: string | undefined,
|
|
26
|
+
relation: Node.RelationInput,
|
|
27
|
+
): Node.Node[] => {
|
|
24
28
|
return useAtomValue(graph.connections(id ?? '', relation));
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {
|
|
28
32
|
return useAtomValue(graph.actions(id ?? ''));
|
|
29
33
|
};
|
|
34
|
+
|
|
35
|
+
/** Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content. */
|
|
36
|
+
export const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {
|
|
37
|
+
return useAtomValue(graph.edges(id ?? ''));
|
|
38
|
+
};
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.graph',
|
|
10
10
|
name: 'Graph',
|
|
11
11
|
description: trim`
|
|
12
12
|
Graph database layer providing relationship modeling and queries for workspace objects.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Graph, GraphBuilder, Node } from '@dxos/app-graph';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { meta } from './meta';\n\n// const KEY = `${meta.id}/app-graph`;\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Common.Capability.AtomRegistry);\n const extensionsAtom = yield* Capability.atom(Common.Capability.AppGraphBuilder);\n\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n extensionsAtom,\n (extensions) => {\n const next = GraphBuilder.flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));\n next.forEach((extension) => GraphBuilder.addExtension(builder, extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void Graph.expand(builder.graph, Node.RootId);\n\n setupDevtools(builder.graph);\n\n return Capability.contributes(\n Common.Capability.AppGraph,\n { graph: builder.graph, explore: GraphBuilder.explore },\n () =>\n Effect.sync(() => {\n // clearInterval(interval);\n unsubscribe();\n }),\n );\n }),\n);\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: Graph.ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,OAAOC,cAAcC,YAAY;AAO1C,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,OAAOL,WAAWM,YAAY;AACrE,QAAMC,iBAAiB,OAAOP,WAAWQ,KAAKH,OAAOL,WAAWS,eAAe;AAE/E,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWV;EAAAA;AAKhF,QAAMW,cAAcX,SAASY,UAC3BR,gBACA,CAACS,eAAAA;AACC,UAAMC,OAAON,aAAaO,kBAAkBF,UAAAA;AAC5C,UAAMG,UAAiBC,cAAOjB,SAASC,IAAIM,QAAQM,UAAU,CAAA;AAC7D,UAAMK,UAAUF,QAAQG,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACN,KAAKO,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAchB,aAAaiB,gBAAgBlB,SAASiB,UAAUJ,EAAE,CAAA;AACjFN,SAAKS,QAAQ,CAACC,cAAchB,aAAakB,aAAanB,SAASiB,SAAAA,CAAAA;EACjE,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKC,MAAMC,OAAOtB,QAAQuB,OAAOC,KAAKC,MAAM;AAE5CC,gBAAc1B,QAAQuB,KAAK;AAE3B,SAAOjC,WAAWqC,YAChBhC,OAAOL,WAAWsC,UAClB;IAAEL,OAAOvB,QAAQuB;IAAOM,SAAS5B,aAAa4B;EAAQ,GACtD,MACSC,YAAK,MAAA;AAEV1B,gBAAAA;EACF,CAAA,CAAA;AAEN,CAAA,CAAA;AAIF,IAAMsB,gBAAgB,CAACH,UAAAA;AACpBQ,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAST,QAAQA;AACvC;",
|
|
6
|
-
"names": ["Effect", "Record", "Capability", "Common", "Graph", "GraphBuilder", "Node", "Capability", "makeModule", "fnUntraced", "registry", "get", "Common", "AtomRegistry", "extensionsAtom", "atom", "AppGraphBuilder", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "extensions", "next", "flattenExtensions", "current", "values", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "Graph", "expand", "graph", "Node", "RootId", "setupDevtools", "contributes", "AppGraph", "explore", "sync", "globalThis", "composer"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Record from 'effect/Record';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Graph, GraphBuilder, Node } from '@dxos/app-graph';\n\n// TODO(wittjosiah): Remove or restore graph caching.\n// import { meta } from './meta';\n\n// const KEY = `${meta.id}/app-graph`;\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Common.Capability.AtomRegistry);\n const extensionsAtom = yield* Capability.atom(Common.Capability.AppGraphBuilder);\n\n const builder = GraphBuilder.from(/* localStorage.getItem(KEY) ?? */ undefined, registry);\n // const interval = setInterval(() => {\n // localStorage.setItem(KEY, builder.graph.pickle());\n // }, 5_000);\n\n const unsubscribe = registry.subscribe(\n extensionsAtom,\n (extensions) => {\n const next = GraphBuilder.flattenExtensions(extensions);\n const current = Record.values(registry.get(builder.extensions));\n const removed = current.filter(({ id }) => !next.some(({ id: nextId }) => nextId === id));\n removed.forEach((extension) => GraphBuilder.removeExtension(builder, extension.id));\n next.forEach((extension) => GraphBuilder.addExtension(builder, extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void Graph.expand(builder.graph, Node.RootId);\n\n setupDevtools(builder.graph);\n\n return Capability.contributes(\n Common.Capability.AppGraph,\n { graph: builder.graph, explore: GraphBuilder.explore },\n () =>\n Effect.sync(() => {\n // clearInterval(interval);\n unsubscribe();\n }),\n );\n }),\n);\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: Graph.ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
-
"mappings": ";;;AAIA,YAAYA,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,OAAOC,cAAcC,YAAY;AAO1C,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,OAAOL,WAAWM,YAAY;AACrE,QAAMC,iBAAiB,OAAOP,WAAWQ,KAAKH,OAAOL,WAAWS,eAAe;AAE/E,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWV;EAAAA;AAKhF,QAAMW,cAAcX,SAASY,UAC3BR,gBACA,CAACS,eAAAA;AACC,UAAMC,OAAON,aAAaO,kBAAkBF,UAAAA;AAC5C,UAAMG,UAAiBC,cAAOjB,SAASC,IAAIM,QAAQM,UAAU,CAAA;AAC7D,UAAMK,UAAUF,QAAQG,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACN,KAAKO,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAchB,aAAaiB,gBAAgBlB,SAASiB,UAAUJ,EAAE,CAAA;AACjFN,SAAKS,QAAQ,CAACC,cAAchB,aAAakB,aAAanB,SAASiB,SAAAA,CAAAA;EACjE,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKC,MAAMC,OAAOtB,QAAQuB,OAAOC,KAAKC,MAAM;AAE5CC,gBAAc1B,QAAQuB,KAAK;AAE3B,SAAOjC,WAAWqC,YAChBhC,OAAOL,WAAWsC,UAClB;IAAEL,OAAOvB,QAAQuB;IAAOM,SAAS5B,aAAa4B;EAAQ,GACtD,MACSC,YAAK,MAAA;AAEV1B,gBAAAA;EACF,CAAA,CAAA;AAEN,CAAA,CAAA;AAIF,IAAMsB,gBAAgB,CAACH,UAAAA;AACpBQ,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAAST,QAAQA;AACvC;",
|
|
6
|
-
"names": ["Effect", "Record", "Capability", "Common", "Graph", "GraphBuilder", "Node", "Capability", "makeModule", "fnUntraced", "registry", "get", "Common", "AtomRegistry", "extensionsAtom", "atom", "AppGraphBuilder", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "extensions", "next", "flattenExtensions", "current", "values", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "Graph", "expand", "graph", "Node", "RootId", "setupDevtools", "contributes", "AppGraph", "explore", "sync", "globalThis", "composer"]
|
|
7
|
-
}
|