@dxos/plugin-graph 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8

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.
@@ -1,11 +1,12 @@
1
1
  // src/graph.ts
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Record from "effect/Record";
4
- import { Capability, Common } from "@dxos/app-framework";
4
+ import { Capabilities, Capability } from "@dxos/app-framework";
5
5
  import { Graph, GraphBuilder, Node } from "@dxos/app-graph";
6
+ import { AppCapabilities } from "@dxos/app-toolkit";
6
7
  var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
7
- const registry = yield* Capability.get(Common.Capability.AtomRegistry);
8
- const extensionsAtom = yield* Capability.atom(Common.Capability.AppGraphBuilder);
8
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
9
+ const extensionsAtom = yield* Capability.atom(AppCapabilities.AppGraphBuilder);
9
10
  const builder = GraphBuilder.from(
10
11
  /* localStorage.getItem(KEY) ?? */
11
12
  void 0,
@@ -20,9 +21,9 @@ var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
20
21
  }, {
21
22
  immediate: true
22
23
  });
23
- void Graph.expand(builder.graph, Node.RootId);
24
+ void Graph.expand(builder.graph, Node.RootId, "child");
24
25
  setupDevtools(builder.graph);
25
- return Capability.contributes(Common.Capability.AppGraph, {
26
+ return Capability.contributes(AppCapabilities.AppGraph, {
26
27
  graph: builder.graph,
27
28
  explore: GraphBuilder.explore
28
29
  }, () => Effect.sync(() => {
@@ -36,4 +37,4 @@ var setupDevtools = (graph) => {
36
37
  export {
37
38
  graph_default as default
38
39
  };
39
- //# sourceMappingURL=graph-PXKA3JXN.mjs.map
40
+ //# sourceMappingURL=graph-MX5UQYEY.mjs.map
@@ -0,0 +1,7 @@
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 { Capabilities, Capability } from '@dxos/app-framework';\nimport { Graph, GraphBuilder, Node } from '@dxos/app-graph';\nimport { AppCapabilities } from '@dxos/app-toolkit';\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(Capabilities.AtomRegistry);\n const extensionsAtom = yield* Capability.atom(AppCapabilities.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, 'child');\n\n setupDevtools(builder.graph);\n\n return Capability.contributes(\n AppCapabilities.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,cAAcC,kBAAkB;AACzC,SAASC,OAAOC,cAAcC,YAAY;AAC1C,SAASC,uBAAuB;AAOhC,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,aAAaC,YAAY;AAChE,QAAMC,iBAAiB,OAAOP,WAAWQ,KAAKC,gBAAgBC,eAAe;AAE7E,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWX;EAAAA;AAKhF,QAAMY,cAAcZ,SAASa,UAC3BT,gBACA,CAACU,eAAAA;AACC,UAAMC,OAAON,aAAaO,kBAAkBF,UAAAA;AAC5C,UAAMG,UAAiBC,cAAOlB,SAASC,IAAIO,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,QAAQ,OAAA;AAE9CC,gBAAc1B,QAAQuB,KAAK;AAE3B,SAAOlC,WAAWsC,YAChB7B,gBAAgB8B,UAChB;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", "Capabilities", "Capability", "Graph", "GraphBuilder", "Node", "AppCapabilities", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "extensionsAtom", "atom", "AppCapabilities", "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
+ }
@@ -10,12 +10,13 @@ import { Operation } from "@dxos/operation";
10
10
  var runAction = async (invoker, capabilityManager, action, params = {}) => runAndForwardErrors(action.data(params).pipe(Effect.provideService(Operation.Service, invoker), Effect.provideService(Capability.Service, capabilityManager), action._actionContext ? Effect.provide(action._actionContext) : Function.identity));
11
11
 
12
12
  // src/GraphPlugin.ts
13
- import { Capability as Capability2, Common, Plugin } from "@dxos/app-framework";
13
+ import { ActivationEvents, Capability as Capability2, Plugin } from "@dxos/app-framework";
14
+ import { AppActivationEvents } from "@dxos/app-toolkit";
14
15
 
15
16
  // src/meta.ts
16
17
  import { trim } from "@dxos/util";
17
18
  var meta = {
18
- id: "dxos.org/plugin/graph",
19
+ id: "org.dxos.plugin.graph",
19
20
  name: "Graph",
20
21
  description: trim`
21
22
  Graph database layer providing relationship modeling and queries for workspace objects.
@@ -24,22 +25,22 @@ var meta = {
24
25
  };
25
26
 
26
27
  // src/GraphPlugin.ts
27
- var Graph = Capability2.lazy("Graph", () => import("./graph-PXKA3JXN.mjs"));
28
+ var Graph = Capability2.lazy("Graph", () => import("./graph-MX5UQYEY.mjs"));
28
29
  var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
29
- activatesOn: Common.ActivationEvent.Startup,
30
+ activatesOn: ActivationEvents.Startup,
30
31
  activatesBefore: [
31
- Common.ActivationEvent.SetupAppGraph,
32
- Common.ActivationEvent.SetupMetadata
32
+ AppActivationEvents.SetupAppGraph,
33
+ AppActivationEvents.SetupMetadata
33
34
  ],
34
35
  activatesAfter: [
35
- Common.ActivationEvent.AppGraphReady
36
+ AppActivationEvents.AppGraphReady
36
37
  ],
37
38
  activate: Graph
38
39
  }), Plugin.make);
39
40
 
40
41
  // src/hooks/useActionRunner.ts
41
42
  import { useCallback } from "react";
42
- import { useOperationInvoker, usePluginManager } from "@dxos/app-framework/react";
43
+ import { useOperationInvoker, usePluginManager } from "@dxos/app-framework/ui";
43
44
  var useActionRunner = () => {
44
45
  const invoker = useOperationInvoker();
45
46
  const pluginManager = usePluginManager();
@@ -52,14 +53,30 @@ var useActionRunner = () => {
52
53
  // src/hooks/useNode.ts
53
54
  import { useAtomValue } from "@effect-atom/atom-react";
54
55
  import * as Option from "effect/Option";
56
+ import { useMemo } from "react";
55
57
  var useNode = (graph, id) => {
56
- return Option.getOrElse(useAtomValue(graph.node(id ?? "")), () => void 0);
58
+ const atom = useMemo(() => graph.node(id ?? ""), [
59
+ graph,
60
+ id
61
+ ]);
62
+ return Option.getOrElse(useAtomValue(atom), () => void 0);
57
63
  };
58
64
  var useConnections = (graph, id, relation) => {
59
65
  return useAtomValue(graph.connections(id ?? "", relation));
60
66
  };
61
67
  var useActions = (graph, id) => {
62
- return useAtomValue(graph.actions(id ?? ""));
68
+ const atom = useMemo(() => graph.actions(id ?? ""), [
69
+ graph,
70
+ id
71
+ ]);
72
+ return useAtomValue(atom);
73
+ };
74
+ var useEdges = (graph, id) => {
75
+ const atom = useMemo(() => graph.edges(id ?? ""), [
76
+ graph,
77
+ id
78
+ ]);
79
+ return useAtomValue(atom);
63
80
  };
64
81
  export {
65
82
  GraphPlugin,
@@ -68,6 +85,7 @@ export {
68
85
  useActionRunner,
69
86
  useActions,
70
87
  useConnections,
88
+ useEdges,
71
89
  useNode
72
90
  };
73
91
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/action.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { type Node } from '@dxos/app-graph';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { Operation, type OperationInvoker } from '@dxos/operation';\n\n/**\n * Run an action with required layers: Operation.Service, Capability.Service, and captured context.\n * @param invoker The operation invoker to use for Operation.Service.\n * @param capabilityManager The capability manager for Capability.Service.\n * @param action The action to execute.\n * @param params Parameters to pass to the action.\n */\nexport const runAction = async (\n invoker: OperationInvoker.OperationInvoker,\n capabilityManager: CapabilityManager.CapabilityManager,\n action: Node.Action,\n params: Node.InvokeProps = {},\n): Promise<void> =>\n runAndForwardErrors(\n action\n .data(params)\n .pipe(\n Effect.provideService(Operation.Service, invoker),\n Effect.provideService(Capability.Service, capabilityManager),\n action._actionContext ? Effect.provide(action._actionContext) : Function.identity,\n ),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability, Common, Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nconst Graph = Capability.lazy('Graph', () => import('./graph'));\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: Common.ActivationEvent.Startup,\n activatesBefore: [Common.ActivationEvent.SetupAppGraph, Common.ActivationEvent.SetupMetadata],\n activatesAfter: [Common.ActivationEvent.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/graph',\n name: 'Graph',\n description: trim`\n Graph database layer providing relationship modeling and queries for workspace objects.\n Build knowledge graphs and explore complex data relationships.\n `,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useOperationInvoker, usePluginManager } from '@dxos/app-framework/react';\nimport { type Node } from '@dxos/app-graph';\n\nimport { runAction } from '../action';\n\n/**\n * Hook that returns a function to run action Effects.\n * Provides Operation.Service, PluginContextService, and captured plugin context.\n */\nexport const useActionRunner = () => {\n const invoker = useOperationInvoker();\n const pluginManager = usePluginManager();\n\n return useCallback(\n (action: Node.Action, params: Node.InvokeProps = {}) =>\n runAction(invoker, pluginManager.capabilities, action, params),\n [invoker, pluginManager.capabilities],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\n\nimport { type Graph, type Node } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.Node<T> | undefined => {\n return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => undefined);\n};\n\nexport const useConnections = (graph: Graph.ReadableGraph, id?: string, relation?: Node.Relation): Node.Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n return useAtomValue(graph.actions(id ?? ''));\n};\n"],
5
- "mappings": ";AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,2BAA2B;AACpC,SAASC,iBAAwC;AAS1C,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BC,oBACEF,OACGG,KAAKF,MAAAA,EACLG,KACQC,sBAAeC,UAAUC,SAAST,OAAAA,GAClCO,sBAAeG,WAAWD,SAASR,iBAAAA,GAC1CC,OAAOS,iBAAwBC,eAAQV,OAAOS,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,cAAAA,aAAYC,QAAQC,cAAc;;;ACC3C,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADNA,IAAMC,QAAQC,YAAWC,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,aAAaC,OAAOC,gBAAgBC;EACpCC,iBAAiB;IAACH,OAAOC,gBAAgBG;IAAeJ,OAAOC,gBAAgBI;;EAC/EC,gBAAgB;IAACN,OAAOC,gBAAgBM;;EACxCC,UAAUlB;AACZ,CAAA,GACAI,OAAOe,IAAI;;;AElBb,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,wBAAwB;AAS/C,IAAMC,kBAAkB,MAAA;AAC7B,QAAMC,UAAUC,oBAAAA;AAChB,QAAMC,gBAAgBC,iBAAAA;AAEtB,SAAOC,YACL,CAACC,QAAqBC,SAA2B,CAAC,MAChDC,UAAUP,SAASE,cAAcM,cAAcH,QAAQC,MAAAA,GACzD;IAACN;IAASE,cAAcM;GAAa;AAEzC;;;ACpBA,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,SAAcC,iBAAUC,aAAaH,MAAMI,KAAKH,MAAM,EAAA,CAAA,GAAM,MAAMI,MAAAA;AACpE;AAEO,IAAMC,iBAAiB,CAACN,OAA4BC,IAAaM,aAAAA;AACtE,SAAOJ,aAAaH,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AAEO,IAAME,aAAa,CAACT,OAA4BC,OAAAA;AACrD,SAAOE,aAAaH,MAAMU,QAAQT,MAAM,EAAA,CAAA;AAC1C;",
6
- "names": ["Effect", "Function", "Capability", "runAndForwardErrors", "Operation", "runAction", "invoker", "capabilityManager", "action", "params", "runAndForwardErrors", "data", "pipe", "provideService", "Operation", "Service", "Capability", "_actionContext", "provide", "identity", "Capability", "Common", "Plugin", "trim", "meta", "id", "name", "description", "trim", "Graph", "Capability", "lazy", "GraphPlugin", "Plugin", "define", "meta", "pipe", "addModule", "activatesOn", "Common", "ActivationEvent", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useNode", "graph", "id", "getOrElse", "useAtomValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { type Node } from '@dxos/app-graph';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { Operation, type OperationInvoker } from '@dxos/operation';\n\n/**\n * Run an action with required layers: Operation.Service, Capability.Service, and captured context.\n * @param invoker The operation invoker to use for Operation.Service.\n * @param capabilityManager The capability manager for Capability.Service.\n * @param action The action to execute.\n * @param params Parameters to pass to the action.\n */\nexport const runAction = async (\n invoker: OperationInvoker.OperationInvoker,\n capabilityManager: CapabilityManager.CapabilityManager,\n action: Node.Action,\n params: Node.InvokeProps = {},\n): Promise<void> =>\n runAndForwardErrors(\n action\n .data(params)\n .pipe(\n Effect.provideService(Operation.Service, invoker),\n Effect.provideService(Capability.Service, capabilityManager),\n action._actionContext ? Effect.provide(action._actionContext) : Function.identity,\n ),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents } from '@dxos/app-toolkit';\n\nimport { meta } from './meta';\n\nconst Graph = Capability.lazy('Graph', () => import('./graph'));\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: ActivationEvents.Startup,\n activatesBefore: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],\n activatesAfter: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.graph',\n name: 'Graph',\n description: trim`\n Graph database layer providing relationship modeling and queries for workspace objects.\n Build knowledge graphs and explore complex data relationships.\n `,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';\nimport { type Node } from '@dxos/app-graph';\n\nimport { runAction } from '../action';\n\n/**\n * Hook that returns a function to run action Effects.\n * Provides Operation.Service, PluginContextService, and captured plugin context.\n */\nexport const useActionRunner = () => {\n const invoker = useOperationInvoker();\n const pluginManager = usePluginManager();\n\n return useCallback(\n (action: Node.Action, params: Node.InvokeProps = {}) =>\n runAction(invoker, pluginManager.capabilities, action, params),\n [invoker, pluginManager.capabilities],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport { useMemo } from 'react';\n\nimport { type Graph, type Node } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.Node<T> | undefined => {\n const atom = useMemo(() => graph.node(id ?? ''), [graph, id]);\n return Option.getOrElse(useAtomValue(atom), () => undefined);\n};\n\nexport const useConnections = (\n graph: Graph.ReadableGraph,\n id: string | undefined,\n relation: Node.RelationInput,\n): Node.Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\n/**\n * React hook to get actions available for a node.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Actions available for the node.\n */\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n const atom = useMemo(() => graph.actions(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n\n/**\n * Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Edge topology for the node.\n */\nexport const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {\n const atom = useMemo(() => graph.edges(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n"],
5
+ "mappings": ";AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,2BAA2B;AACpC,SAASC,iBAAwC;AAS1C,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BC,oBACEF,OACGG,KAAKF,MAAAA,EACLG,KACQC,sBAAeC,UAAUC,SAAST,OAAAA,GAClCO,sBAAeG,WAAWD,SAASR,iBAAAA,GAC1CC,OAAOS,iBAAwBC,eAAQV,OAAOS,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,kBAAkBC,cAAAA,aAAYC,cAAc;AACrD,SAASC,2BAA2B;;;ACApC,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADLA,IAAMC,QAAQC,YAAWC,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,aAAaC,iBAAiBC;EAC9BC,iBAAiB;IAACC,oBAAoBC;IAAeD,oBAAoBE;;EACzEC,gBAAgB;IAACH,oBAAoBI;;EACrCC,UAAUlB;AACZ,CAAA,GACAI,OAAOe,IAAI;;;AEnBb,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,wBAAwB;AAS/C,IAAMC,kBAAkB,MAAA;AAC7B,QAAMC,UAAUC,oBAAAA;AAChB,QAAMC,gBAAgBC,iBAAAA;AAEtB,SAAOC,YACL,CAACC,QAAqBC,SAA2B,CAAC,MAChDC,UAAUP,SAASE,cAAcM,cAAcH,QAAQC,MAAAA,GACzD;IAACN;IAASE,cAAcM;GAAa;AAEzC;;;ACpBA,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AACxB,SAASC,eAAe;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,QAAMC,OAAOC,QAAQ,MAAMH,MAAMI,KAAKH,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC5D,SAAcI,iBAAUC,aAAaJ,IAAAA,GAAO,MAAMK,MAAAA;AACpD;AAEO,IAAMC,iBAAiB,CAC5BR,OACAC,IACAQ,aAAAA;AAEA,SAAOH,aAAaN,MAAMU,YAAYT,MAAM,IAAIQ,QAAAA,CAAAA;AAClD;AASO,IAAME,aAAa,CAACX,OAA4BC,OAAAA;AACrD,QAAMC,OAAOC,QAAQ,MAAMH,MAAMY,QAAQX,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC/D,SAAOK,aAAaJ,IAAAA;AACtB;AASO,IAAMW,WAAW,CAACb,OAA4BC,OAAAA;AACnD,QAAMC,OAAOC,QAAQ,MAAMH,MAAMc,MAAMb,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC7D,SAAOK,aAAaJ,IAAAA;AACtB;",
6
+ "names": ["Effect", "Function", "Capability", "runAndForwardErrors", "Operation", "runAction", "invoker", "capabilityManager", "action", "params", "runAndForwardErrors", "data", "pipe", "provideService", "Operation", "Service", "Capability", "_actionContext", "provide", "identity", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "trim", "meta", "id", "name", "description", "trim", "Graph", "Capability", "lazy", "GraphPlugin", "Plugin", "define", "meta", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "activatesBefore", "AppActivationEvents", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useMemo", "useNode", "graph", "id", "atom", "useMemo", "node", "getOrElse", "useAtomValue", "undefined", "useConnections", "relation", "connections", "useActions", "actions", "useEdges", "edges"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/action.ts":{"bytes":3719,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1365,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":7168,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":2920,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useActionRunner.ts":{"bytes":2537,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"../action"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":3188,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":568,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":815,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6964},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"dist/lib/browser/graph-PXKA3JXN.mjs","kind":"dynamic-import"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":551},"src/GraphPlugin.ts":{"bytesInOutput":478},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useActionRunner.ts":{"bytesInOutput":400},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":406}},"bytes":2449},"dist/lib/browser/graph-PXKA3JXN.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3743},"dist/lib/browser/graph-PXKA3JXN.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1410}},"bytes":1509}}}
1
+ {"inputs":{"src/action.ts":{"bytes":3719,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1365,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":7347,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":3056,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useActionRunner.ts":{"bytes":2530,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"../action"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":5406,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":568,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":815,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8141},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"dist/lib/browser/graph-MX5UQYEY.mjs","kind":"dynamic-import"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useEdges","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":551},"src/GraphPlugin.ts":{"bytesInOutput":530},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useActionRunner.ts":{"bytesInOutput":397},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":703}},"bytes":2807},"dist/lib/browser/graph-MX5UQYEY.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3865},"dist/lib/browser/graph-MX5UQYEY.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1469}},"bytes":1568}}}
@@ -3,11 +3,12 @@ import { createRequire } from 'node:module';const require = createRequire(import
3
3
  // src/graph.ts
4
4
  import * as Effect from "effect/Effect";
5
5
  import * as Record from "effect/Record";
6
- import { Capability, Common } from "@dxos/app-framework";
6
+ import { Capabilities, Capability } from "@dxos/app-framework";
7
7
  import { Graph, GraphBuilder, Node } from "@dxos/app-graph";
8
+ import { AppCapabilities } from "@dxos/app-toolkit";
8
9
  var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
9
- const registry = yield* Capability.get(Common.Capability.AtomRegistry);
10
- const extensionsAtom = yield* Capability.atom(Common.Capability.AppGraphBuilder);
10
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
11
+ const extensionsAtom = yield* Capability.atom(AppCapabilities.AppGraphBuilder);
11
12
  const builder = GraphBuilder.from(
12
13
  /* localStorage.getItem(KEY) ?? */
13
14
  void 0,
@@ -22,9 +23,9 @@ var graph_default = Capability.makeModule(Effect.fnUntraced(function* () {
22
23
  }, {
23
24
  immediate: true
24
25
  });
25
- void Graph.expand(builder.graph, Node.RootId);
26
+ void Graph.expand(builder.graph, Node.RootId, "child");
26
27
  setupDevtools(builder.graph);
27
- return Capability.contributes(Common.Capability.AppGraph, {
28
+ return Capability.contributes(AppCapabilities.AppGraph, {
28
29
  graph: builder.graph,
29
30
  explore: GraphBuilder.explore
30
31
  }, () => Effect.sync(() => {
@@ -38,4 +39,4 @@ var setupDevtools = (graph) => {
38
39
  export {
39
40
  graph_default as default
40
41
  };
41
- //# sourceMappingURL=graph-CR2XR64B.mjs.map
42
+ //# sourceMappingURL=graph-2RMPUX7I.mjs.map
@@ -0,0 +1,7 @@
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 { Capabilities, Capability } from '@dxos/app-framework';\nimport { Graph, GraphBuilder, Node } from '@dxos/app-graph';\nimport { AppCapabilities } from '@dxos/app-toolkit';\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(Capabilities.AtomRegistry);\n const extensionsAtom = yield* Capability.atom(AppCapabilities.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, 'child');\n\n setupDevtools(builder.graph);\n\n return Capability.contributes(\n AppCapabilities.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,cAAcC,kBAAkB;AACzC,SAASC,OAAOC,cAAcC,YAAY;AAC1C,SAASC,uBAAuB;AAOhC,IAAA,gBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,WAAW,OAAOH,WAAWI,IAAIC,aAAaC,YAAY;AAChE,QAAMC,iBAAiB,OAAOP,WAAWQ,KAAKC,gBAAgBC,eAAe;AAE7E,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWX;EAAAA;AAKhF,QAAMY,cAAcZ,SAASa,UAC3BT,gBACA,CAACU,eAAAA;AACC,UAAMC,OAAON,aAAaO,kBAAkBF,UAAAA;AAC5C,UAAMG,UAAiBC,cAAOlB,SAASC,IAAIO,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,QAAQ,OAAA;AAE9CC,gBAAc1B,QAAQuB,KAAK;AAE3B,SAAOlC,WAAWsC,YAChB7B,gBAAgB8B,UAChB;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", "Capabilities", "Capability", "Graph", "GraphBuilder", "Node", "AppCapabilities", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "extensionsAtom", "atom", "AppCapabilities", "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
+ }
@@ -12,12 +12,13 @@ import { Operation } from "@dxos/operation";
12
12
  var runAction = async (invoker, capabilityManager, action, params = {}) => runAndForwardErrors(action.data(params).pipe(Effect.provideService(Operation.Service, invoker), Effect.provideService(Capability.Service, capabilityManager), action._actionContext ? Effect.provide(action._actionContext) : Function.identity));
13
13
 
14
14
  // src/GraphPlugin.ts
15
- import { Capability as Capability2, Common, Plugin } from "@dxos/app-framework";
15
+ import { ActivationEvents, Capability as Capability2, Plugin } from "@dxos/app-framework";
16
+ import { AppActivationEvents } from "@dxos/app-toolkit";
16
17
 
17
18
  // src/meta.ts
18
19
  import { trim } from "@dxos/util";
19
20
  var meta = {
20
- id: "dxos.org/plugin/graph",
21
+ id: "org.dxos.plugin.graph",
21
22
  name: "Graph",
22
23
  description: trim`
23
24
  Graph database layer providing relationship modeling and queries for workspace objects.
@@ -26,22 +27,22 @@ var meta = {
26
27
  };
27
28
 
28
29
  // src/GraphPlugin.ts
29
- var Graph = Capability2.lazy("Graph", () => import("./graph-CR2XR64B.mjs"));
30
+ var Graph = Capability2.lazy("Graph", () => import("./graph-2RMPUX7I.mjs"));
30
31
  var GraphPlugin = Plugin.define(meta).pipe(Plugin.addModule({
31
- activatesOn: Common.ActivationEvent.Startup,
32
+ activatesOn: ActivationEvents.Startup,
32
33
  activatesBefore: [
33
- Common.ActivationEvent.SetupAppGraph,
34
- Common.ActivationEvent.SetupMetadata
34
+ AppActivationEvents.SetupAppGraph,
35
+ AppActivationEvents.SetupMetadata
35
36
  ],
36
37
  activatesAfter: [
37
- Common.ActivationEvent.AppGraphReady
38
+ AppActivationEvents.AppGraphReady
38
39
  ],
39
40
  activate: Graph
40
41
  }), Plugin.make);
41
42
 
42
43
  // src/hooks/useActionRunner.ts
43
44
  import { useCallback } from "react";
44
- import { useOperationInvoker, usePluginManager } from "@dxos/app-framework/react";
45
+ import { useOperationInvoker, usePluginManager } from "@dxos/app-framework/ui";
45
46
  var useActionRunner = () => {
46
47
  const invoker = useOperationInvoker();
47
48
  const pluginManager = usePluginManager();
@@ -54,14 +55,30 @@ var useActionRunner = () => {
54
55
  // src/hooks/useNode.ts
55
56
  import { useAtomValue } from "@effect-atom/atom-react";
56
57
  import * as Option from "effect/Option";
58
+ import { useMemo } from "react";
57
59
  var useNode = (graph, id) => {
58
- return Option.getOrElse(useAtomValue(graph.node(id ?? "")), () => void 0);
60
+ const atom = useMemo(() => graph.node(id ?? ""), [
61
+ graph,
62
+ id
63
+ ]);
64
+ return Option.getOrElse(useAtomValue(atom), () => void 0);
59
65
  };
60
66
  var useConnections = (graph, id, relation) => {
61
67
  return useAtomValue(graph.connections(id ?? "", relation));
62
68
  };
63
69
  var useActions = (graph, id) => {
64
- return useAtomValue(graph.actions(id ?? ""));
70
+ const atom = useMemo(() => graph.actions(id ?? ""), [
71
+ graph,
72
+ id
73
+ ]);
74
+ return useAtomValue(atom);
75
+ };
76
+ var useEdges = (graph, id) => {
77
+ const atom = useMemo(() => graph.edges(id ?? ""), [
78
+ graph,
79
+ id
80
+ ]);
81
+ return useAtomValue(atom);
65
82
  };
66
83
  export {
67
84
  GraphPlugin,
@@ -70,6 +87,7 @@ export {
70
87
  useActionRunner,
71
88
  useActions,
72
89
  useConnections,
90
+ useEdges,
73
91
  useNode
74
92
  };
75
93
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/action.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useActionRunner.ts", "../../../src/hooks/useNode.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { type Node } from '@dxos/app-graph';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { Operation, type OperationInvoker } from '@dxos/operation';\n\n/**\n * Run an action with required layers: Operation.Service, Capability.Service, and captured context.\n * @param invoker The operation invoker to use for Operation.Service.\n * @param capabilityManager The capability manager for Capability.Service.\n * @param action The action to execute.\n * @param params Parameters to pass to the action.\n */\nexport const runAction = async (\n invoker: OperationInvoker.OperationInvoker,\n capabilityManager: CapabilityManager.CapabilityManager,\n action: Node.Action,\n params: Node.InvokeProps = {},\n): Promise<void> =>\n runAndForwardErrors(\n action\n .data(params)\n .pipe(\n Effect.provideService(Operation.Service, invoker),\n Effect.provideService(Capability.Service, capabilityManager),\n action._actionContext ? Effect.provide(action._actionContext) : Function.identity,\n ),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability, Common, Plugin } from '@dxos/app-framework';\n\nimport { meta } from './meta';\n\nconst Graph = Capability.lazy('Graph', () => import('./graph'));\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: Common.ActivationEvent.Startup,\n activatesBefore: [Common.ActivationEvent.SetupAppGraph, Common.ActivationEvent.SetupMetadata],\n activatesAfter: [Common.ActivationEvent.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/graph',\n name: 'Graph',\n description: trim`\n Graph database layer providing relationship modeling and queries for workspace objects.\n Build knowledge graphs and explore complex data relationships.\n `,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useOperationInvoker, usePluginManager } from '@dxos/app-framework/react';\nimport { type Node } from '@dxos/app-graph';\n\nimport { runAction } from '../action';\n\n/**\n * Hook that returns a function to run action Effects.\n * Provides Operation.Service, PluginContextService, and captured plugin context.\n */\nexport const useActionRunner = () => {\n const invoker = useOperationInvoker();\n const pluginManager = usePluginManager();\n\n return useCallback(\n (action: Node.Action, params: Node.InvokeProps = {}) =>\n runAction(invoker, pluginManager.capabilities, action, params),\n [invoker, pluginManager.capabilities],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\n\nimport { type Graph, type Node } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.Node<T> | undefined => {\n return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => undefined);\n};\n\nexport const useConnections = (graph: Graph.ReadableGraph, id?: string, relation?: Node.Relation): Node.Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n return useAtomValue(graph.actions(id ?? ''));\n};\n"],
5
- "mappings": ";;;AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,2BAA2B;AACpC,SAASC,iBAAwC;AAS1C,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BC,oBACEF,OACGG,KAAKF,MAAAA,EACLG,KACQC,sBAAeC,UAAUC,SAAST,OAAAA,GAClCO,sBAAeG,WAAWD,SAASR,iBAAAA,GAC1CC,OAAOS,iBAAwBC,eAAQV,OAAOS,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,cAAAA,aAAYC,QAAQC,cAAc;;;ACC3C,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADNA,IAAMC,QAAQC,YAAWC,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,aAAaC,OAAOC,gBAAgBC;EACpCC,iBAAiB;IAACH,OAAOC,gBAAgBG;IAAeJ,OAAOC,gBAAgBI;;EAC/EC,gBAAgB;IAACN,OAAOC,gBAAgBM;;EACxCC,UAAUlB;AACZ,CAAA,GACAI,OAAOe,IAAI;;;AElBb,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,wBAAwB;AAS/C,IAAMC,kBAAkB,MAAA;AAC7B,QAAMC,UAAUC,oBAAAA;AAChB,QAAMC,gBAAgBC,iBAAAA;AAEtB,SAAOC,YACL,CAACC,QAAqBC,SAA2B,CAAC,MAChDC,UAAUP,SAASE,cAAcM,cAAcH,QAAQC,MAAAA,GACzD;IAACN;IAASE,cAAcM;GAAa;AAEzC;;;ACpBA,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,SAAcC,iBAAUC,aAAaH,MAAMI,KAAKH,MAAM,EAAA,CAAA,GAAM,MAAMI,MAAAA;AACpE;AAEO,IAAMC,iBAAiB,CAACN,OAA4BC,IAAaM,aAAAA;AACtE,SAAOJ,aAAaH,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AAEO,IAAME,aAAa,CAACT,OAA4BC,OAAAA;AACrD,SAAOE,aAAaH,MAAMU,QAAQT,MAAM,EAAA,CAAA;AAC1C;",
6
- "names": ["Effect", "Function", "Capability", "runAndForwardErrors", "Operation", "runAction", "invoker", "capabilityManager", "action", "params", "runAndForwardErrors", "data", "pipe", "provideService", "Operation", "Service", "Capability", "_actionContext", "provide", "identity", "Capability", "Common", "Plugin", "trim", "meta", "id", "name", "description", "trim", "Graph", "Capability", "lazy", "GraphPlugin", "Plugin", "define", "meta", "pipe", "addModule", "activatesOn", "Common", "ActivationEvent", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useNode", "graph", "id", "getOrElse", "useAtomValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './action';\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { type Node } from '@dxos/app-graph';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { Operation, type OperationInvoker } from '@dxos/operation';\n\n/**\n * Run an action with required layers: Operation.Service, Capability.Service, and captured context.\n * @param invoker The operation invoker to use for Operation.Service.\n * @param capabilityManager The capability manager for Capability.Service.\n * @param action The action to execute.\n * @param params Parameters to pass to the action.\n */\nexport const runAction = async (\n invoker: OperationInvoker.OperationInvoker,\n capabilityManager: CapabilityManager.CapabilityManager,\n action: Node.Action,\n params: Node.InvokeProps = {},\n): Promise<void> =>\n runAndForwardErrors(\n action\n .data(params)\n .pipe(\n Effect.provideService(Operation.Service, invoker),\n Effect.provideService(Capability.Service, capabilityManager),\n action._actionContext ? Effect.provide(action._actionContext) : Function.identity,\n ),\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvents, Capability, Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents } from '@dxos/app-toolkit';\n\nimport { meta } from './meta';\n\nconst Graph = Capability.lazy('Graph', () => import('./graph'));\n\n/**\n * Manages the state of the graph for the application.\n * Enables other plugins to register node builders to add nodes to the graph.\n * This includes actions and annotation each other's nodes.\n */\nexport const GraphPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: ActivationEvents.Startup,\n activatesBefore: [AppActivationEvents.SetupAppGraph, AppActivationEvents.SetupMetadata],\n activatesAfter: [AppActivationEvents.AppGraphReady],\n activate: Graph,\n }),\n Plugin.make,\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.graph',\n name: 'Graph',\n description: trim`\n Graph database layer providing relationship modeling and queries for workspace objects.\n Build knowledge graphs and explore complex data relationships.\n `,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback } from 'react';\n\nimport { useOperationInvoker, usePluginManager } from '@dxos/app-framework/ui';\nimport { type Node } from '@dxos/app-graph';\n\nimport { runAction } from '../action';\n\n/**\n * Hook that returns a function to run action Effects.\n * Provides Operation.Service, PluginContextService, and captured plugin context.\n */\nexport const useActionRunner = () => {\n const invoker = useOperationInvoker();\n const pluginManager = usePluginManager();\n\n return useCallback(\n (action: Node.Action, params: Node.InvokeProps = {}) =>\n runAction(invoker, pluginManager.capabilities, action, params),\n [invoker, pluginManager.capabilities],\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\nimport { useMemo } from 'react';\n\nimport { type Graph, type Node } from '@dxos/app-graph';\n\n/**\n * React hook to get a node from the graph.\n *\n * @param graph Graph to find the node in.\n * @param id Id of the node to find.\n * @param timeout Optional timeout in milliseconds to wait for the node to be found.\n * @returns Node if found, undefined otherwise.\n */\n// TODO(wittjosiah): Factor out to @dxos/app-graph/react.\nexport const useNode = <T = any>(graph: Graph.ReadableGraph, id?: string): Node.Node<T> | undefined => {\n const atom = useMemo(() => graph.node(id ?? ''), [graph, id]);\n return Option.getOrElse(useAtomValue(atom), () => undefined);\n};\n\nexport const useConnections = (\n graph: Graph.ReadableGraph,\n id: string | undefined,\n relation: Node.RelationInput,\n): Node.Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\n/**\n * React hook to get actions available for a node.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Actions available for the node.\n */\nexport const useActions = (graph: Graph.ReadableGraph, id?: string): Node.Node[] => {\n const atom = useMemo(() => graph.actions(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n\n/**\n * Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content.\n *\n * @param graph Graph containing the node.\n * @param id Id of the node.\n * @returns Edge topology for the node.\n */\nexport const useEdges = (graph: Graph.ReadableGraph, id?: string): Graph.Edges => {\n const atom = useMemo(() => graph.edges(id ?? ''), [graph, id]);\n return useAtomValue(atom);\n};\n"],
5
+ "mappings": ";;;AAIA,cAAc;;;ACAd,YAAYA,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,kBAA0C;AAEnD,SAASC,2BAA2B;AACpC,SAASC,iBAAwC;AAS1C,IAAMC,YAAY,OACvBC,SACAC,mBACAC,QACAC,SAA2B,CAAC,MAE5BC,oBACEF,OACGG,KAAKF,MAAAA,EACLG,KACQC,sBAAeC,UAAUC,SAAST,OAAAA,GAClCO,sBAAeG,WAAWD,SAASR,iBAAAA,GAC1CC,OAAOS,iBAAwBC,eAAQV,OAAOS,cAAc,IAAaE,iBAAQ,CAAA;;;AC3BzF,SAASC,kBAAkBC,cAAAA,aAAYC,cAAc;AACrD,SAASC,2BAA2B;;;ACApC,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADLA,IAAMC,QAAQC,YAAWC,KAAK,SAAS,MAAM,OAAO,sBAAA,CAAA;AAO7C,IAAMC,cAAcC,OAAOC,OAAOC,IAAAA,EAAMC,KAC7CH,OAAOI,UAAU;EACfC,aAAaC,iBAAiBC;EAC9BC,iBAAiB;IAACC,oBAAoBC;IAAeD,oBAAoBE;;EACzEC,gBAAgB;IAACH,oBAAoBI;;EACrCC,UAAUlB;AACZ,CAAA,GACAI,OAAOe,IAAI;;;AEnBb,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,wBAAwB;AAS/C,IAAMC,kBAAkB,MAAA;AAC7B,QAAMC,UAAUC,oBAAAA;AAChB,QAAMC,gBAAgBC,iBAAAA;AAEtB,SAAOC,YACL,CAACC,QAAqBC,SAA2B,CAAC,MAChDC,UAAUP,SAASE,cAAcM,cAAcH,QAAQC,MAAAA,GACzD;IAACN;IAASE,cAAcM;GAAa;AAEzC;;;ACpBA,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AACxB,SAASC,eAAe;AAajB,IAAMC,UAAU,CAAUC,OAA4BC,OAAAA;AAC3D,QAAMC,OAAOC,QAAQ,MAAMH,MAAMI,KAAKH,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC5D,SAAcI,iBAAUC,aAAaJ,IAAAA,GAAO,MAAMK,MAAAA;AACpD;AAEO,IAAMC,iBAAiB,CAC5BR,OACAC,IACAQ,aAAAA;AAEA,SAAOH,aAAaN,MAAMU,YAAYT,MAAM,IAAIQ,QAAAA,CAAAA;AAClD;AASO,IAAME,aAAa,CAACX,OAA4BC,OAAAA;AACrD,QAAMC,OAAOC,QAAQ,MAAMH,MAAMY,QAAQX,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC/D,SAAOK,aAAaJ,IAAAA;AACtB;AASO,IAAMW,WAAW,CAACb,OAA4BC,OAAAA;AACnD,QAAMC,OAAOC,QAAQ,MAAMH,MAAMc,MAAMb,MAAM,EAAA,GAAK;IAACD;IAAOC;GAAG;AAC7D,SAAOK,aAAaJ,IAAAA;AACtB;",
6
+ "names": ["Effect", "Function", "Capability", "runAndForwardErrors", "Operation", "runAction", "invoker", "capabilityManager", "action", "params", "runAndForwardErrors", "data", "pipe", "provideService", "Operation", "Service", "Capability", "_actionContext", "provide", "identity", "ActivationEvents", "Capability", "Plugin", "AppActivationEvents", "trim", "meta", "id", "name", "description", "trim", "Graph", "Capability", "lazy", "GraphPlugin", "Plugin", "define", "meta", "pipe", "addModule", "activatesOn", "ActivationEvents", "Startup", "activatesBefore", "AppActivationEvents", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "make", "useCallback", "useOperationInvoker", "usePluginManager", "useActionRunner", "invoker", "useOperationInvoker", "pluginManager", "usePluginManager", "useCallback", "action", "params", "runAction", "capabilities", "useAtomValue", "Option", "useMemo", "useNode", "graph", "id", "atom", "useMemo", "node", "getOrElse", "useAtomValue", "undefined", "useConnections", "relation", "connections", "useActions", "actions", "useEdges", "edges"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/action.ts":{"bytes":3719,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1365,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":7168,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":2920,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useActionRunner.ts":{"bytes":2537,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"../action"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":3188,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":568,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":815,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6966},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/graph-CR2XR64B.mjs","kind":"dynamic-import"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/react","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":551},"src/GraphPlugin.ts":{"bytesInOutput":478},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useActionRunner.ts":{"bytesInOutput":400},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":406}},"bytes":2542},"dist/lib/node-esm/graph-CR2XR64B.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3745},"dist/lib/node-esm/graph-CR2XR64B.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1410}},"bytes":1602}}}
1
+ {"inputs":{"src/action.ts":{"bytes":3719,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true}],"format":"esm"},"src/meta.ts":{"bytes":1365,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":7347,"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"format":"esm"},"src/GraphPlugin.ts":{"bytes":3056,"imports":[{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"},{"path":"src/graph.ts","kind":"dynamic-import","original":"./graph"}],"format":"esm"},"src/hooks/useActionRunner.ts":{"bytes":2530,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"../action"}],"format":"esm"},"src/hooks/useNode.ts":{"bytes":5406,"imports":[{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"src/hooks/index.ts":{"bytes":568,"imports":[{"path":"src/hooks/useActionRunner.ts","kind":"import-statement","original":"./useActionRunner"},{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":815,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"src/action.ts","kind":"import-statement","original":"./action"},{"path":"src/GraphPlugin.ts","kind":"import-statement","original":"./GraphPlugin"},{"path":"src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"src/meta.ts","kind":"import-statement","original":"./meta"}],"format":"esm"}},"outputs":{"dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":8143},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Function","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/effect","kind":"import-statement","external":true},{"path":"@dxos/operation","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"dist/lib/node-esm/graph-2RMPUX7I.mjs","kind":"dynamic-import"},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-framework/ui","kind":"import-statement","external":true},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","runAction","useActionRunner","useActions","useConnections","useEdges","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/action.ts":{"bytesInOutput":551},"src/GraphPlugin.ts":{"bytesInOutput":530},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useActionRunner.ts":{"bytesInOutput":397},"src/hooks/index.ts":{"bytesInOutput":0},"src/hooks/useNode.ts":{"bytesInOutput":703}},"bytes":2900},"dist/lib/node-esm/graph-2RMPUX7I.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3867},"dist/lib/node-esm/graph-2RMPUX7I.mjs":{"imports":[{"path":"effect/Effect","kind":"import-statement","external":true},{"path":"effect/Record","kind":"import-statement","external":true},{"path":"@dxos/app-framework","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/app-toolkit","kind":"import-statement","external":true}],"exports":["default"],"entryPoint":"src/graph.ts","inputs":{"src/graph.ts":{"bytesInOutput":1469}},"bytes":1661}}}
@@ -1 +1 @@
1
- {"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMjE;;;;GAIG;AACH,eAAO,MAAM,WAAW,4BAQvB,CAAC"}
1
+ {"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgC,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO3E;;;;GAIG;AACH,eAAO,MAAM,WAAW,4BAQvB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import * as Effect from 'effect/Effect';
2
2
  import { Capability } from '@dxos/app-framework';
3
- import { GraphBuilder } from '@dxos/app-graph';
4
- declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Readonly<{
5
- graph: GraphBuilder.GraphBuilder["graph"];
3
+ import { Graph, GraphBuilder } from '@dxos/app-graph';
4
+ declare const _default: (props: void) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Readonly<{
5
+ graph: Graph.ExpandableGraph;
6
6
  explore: typeof GraphBuilder.explore;
7
7
  }>>>, Error, Capability.Service>;
8
8
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,UAAU,EAAU,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAS,YAAY,EAAQ,MAAM,iBAAiB,CAAC;;;;;AAO5D,wBAqCE"}
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/graph.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,YAAY,EAAQ,MAAM,iBAAiB,CAAC;;;;;AAQ5D,wBAqCE"}
@@ -8,6 +8,21 @@ import { type Graph, type Node } from '@dxos/app-graph';
8
8
  * @returns Node if found, undefined otherwise.
9
9
  */
10
10
  export declare const useNode: <T = any>(graph: Graph.ReadableGraph, id?: string) => Node.Node<T> | undefined;
11
- export declare const useConnections: (graph: Graph.ReadableGraph, id?: string, relation?: Node.Relation) => Node.Node[];
11
+ export declare const useConnections: (graph: Graph.ReadableGraph, id: string | undefined, relation: Node.RelationInput) => Node.Node[];
12
+ /**
13
+ * React hook to get actions available for a node.
14
+ *
15
+ * @param graph Graph containing the node.
16
+ * @param id Id of the node.
17
+ * @returns Actions available for the node.
18
+ */
12
19
  export declare const useActions: (graph: Graph.ReadableGraph, id?: string) => Node.Node[];
20
+ /**
21
+ * Subscribe to just the edge topology (inbound/outbound IDs) of a node without subscribing to node content.
22
+ *
23
+ * @param graph Graph containing the node.
24
+ * @param id Id of the node.
25
+ * @returns Edge topology for the node.
26
+ */
27
+ export declare const useEdges: (graph: Graph.ReadableGraph, id?: string) => Graph.Edges;
13
28
  //# sourceMappingURL=useNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useNode.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,GAAI,CAAC,GAAG,GAAG,EAAE,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,KAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAEzF,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,EAAE,WAAW,IAAI,CAAC,QAAQ,KAAG,IAAI,CAAC,IAAI,EAE3G,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,KAAG,IAAI,CAAC,IAAI,EAE7E,CAAC"}
1
+ {"version":3,"file":"useNode.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useNode.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,GAAI,CAAC,GAAG,GAAG,EAAE,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,KAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAGzF,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,OAAO,KAAK,CAAC,aAAa,EAC1B,IAAI,MAAM,GAAG,SAAS,EACtB,UAAU,IAAI,CAAC,aAAa,KAC3B,IAAI,CAAC,IAAI,EAEX,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,KAAG,IAAI,CAAC,IAAI,EAG7E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,KAAK,CAAC,aAAa,EAAE,KAAK,MAAM,KAAG,KAAK,CAAC,KAGxE,CAAC"}