@dxos/plugin-graph 0.8.4-main.e098934 → 0.8.4-main.e8ec1fe
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-UW77N6TF.mjs → graph-FFQ77VLS.mjs} +6 -7
- package/dist/lib/browser/graph-FFQ77VLS.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +14 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/{graph-UIVRXZE6.mjs → graph-7GDCGF7M.mjs} +6 -7
- package/dist/lib/node-esm/graph-7GDCGF7M.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +14 -11
- 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 +1 -1
- package/dist/types/src/GraphPlugin.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -18
- package/src/GraphPlugin.ts +9 -10
- package/src/graph.ts +4 -4
- package/src/hooks/useNode.ts +5 -5
- package/src/meta.ts +6 -3
- package/dist/lib/browser/graph-UW77N6TF.mjs.map +0 -7
- package/dist/lib/node-esm/graph-UIVRXZE6.mjs.map +0 -7
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/graph.ts
|
|
2
|
-
import
|
|
2
|
+
import * as Record from "effect/Record";
|
|
3
3
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
4
4
|
import { GraphBuilder, ROOT_ID, flattenExtensions } from "@dxos/app-graph";
|
|
5
|
-
var graph_default = async (context) => {
|
|
6
|
-
const registry = context.getCapability(Capabilities.
|
|
5
|
+
var graph_default = (async (context) => {
|
|
6
|
+
const registry = context.getCapability(Capabilities.AtomRegistry);
|
|
7
7
|
const builder = GraphBuilder.from(
|
|
8
8
|
/* localStorage.getItem(KEY) ?? */
|
|
9
9
|
void 0,
|
|
@@ -26,13 +26,12 @@ var graph_default = async (context) => {
|
|
|
26
26
|
}, () => {
|
|
27
27
|
unsubscribe();
|
|
28
28
|
});
|
|
29
|
-
};
|
|
29
|
+
});
|
|
30
30
|
var setupDevtools = (graph) => {
|
|
31
|
-
|
|
32
|
-
(_globalThis = globalThis).composer ?? (_globalThis.composer = {});
|
|
31
|
+
globalThis.composer ??= {};
|
|
33
32
|
globalThis.composer.graph = graph;
|
|
34
33
|
};
|
|
35
34
|
export {
|
|
36
35
|
graph_default as default
|
|
37
36
|
};
|
|
38
|
-
//# sourceMappingURL=graph-
|
|
37
|
+
//# sourceMappingURL=graph-FFQ77VLS.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 Record from 'effect/Record';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { type ExpandableGraph, GraphBuilder, ROOT_ID, flattenExtensions } 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 async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.AtomRegistry);\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 context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = 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) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,cAAkCC,mBAAmB;AAC9D,SAA+BC,cAAcC,SAASC,yBAAyB;AAO/E,IAAA,iBAAe,OAAOC,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,YAAY;AAChE,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,aAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,OAAOC,kBAAkBF,UAAAA;AAC/B,UAAMG,UAAiBC,cAAOhB,SAASiB,IAAIb,QAAQQ,UAAU,CAAA;AAC7D,UAAMM,UAAUH,QAAQI,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACP,KAAKQ,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcpB,QAAQqB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnEP,SAAKU,QAAQ,CAACC,cAAcpB,QAAQsB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKvB,QAAQwB,MAAMC,OAAOC,OAAAA;AAE1BC,gBAAc3B,QAAQwB,KAAK;AAE3B,SAAOI,YAAY9B,aAAa+B,UAAU;IAAEL,OAAOxB,QAAQwB;IAAOM,SAAS9B,QAAQ8B;EAAQ,GAAG,MAAA;AAE5F1B,gBAAAA;EACF,CAAA;AACF;AAGA,IAAMuB,gBAAgB,CAACH,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
|
|
6
|
+
"names": ["Record", "Capabilities", "contributes", "GraphBuilder", "ROOT_ID", "flattenExtensions", "context", "registry", "getCapability", "Capabilities", "AtomRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
+
}
|
|
@@ -5,14 +5,18 @@ export * from "@dxos/app-graph";
|
|
|
5
5
|
import { Events, defineModule, definePlugin, lazy } from "@dxos/app-framework";
|
|
6
6
|
|
|
7
7
|
// src/meta.ts
|
|
8
|
-
|
|
8
|
+
import { trim } from "@dxos/util";
|
|
9
9
|
var meta = {
|
|
10
|
-
id:
|
|
11
|
-
name: "Graph"
|
|
10
|
+
id: "dxos.org/plugin/graph",
|
|
11
|
+
name: "Graph",
|
|
12
|
+
description: trim`
|
|
13
|
+
Graph database layer providing relationship modeling and queries for workspace objects.
|
|
14
|
+
Build knowledge graphs and explore complex data relationships.
|
|
15
|
+
`
|
|
12
16
|
};
|
|
13
17
|
|
|
14
18
|
// src/GraphPlugin.ts
|
|
15
|
-
var GraphPlugin = () =>
|
|
19
|
+
var GraphPlugin = definePlugin(meta, () => [
|
|
16
20
|
defineModule({
|
|
17
21
|
id: `${meta.id}/module/graph`,
|
|
18
22
|
activatesOn: Events.Startup,
|
|
@@ -23,24 +27,23 @@ var GraphPlugin = () => definePlugin(meta, [
|
|
|
23
27
|
activatesAfter: [
|
|
24
28
|
Events.AppGraphReady
|
|
25
29
|
],
|
|
26
|
-
activate: lazy(() => import("./graph-
|
|
30
|
+
activate: lazy(() => import("./graph-FFQ77VLS.mjs"))
|
|
27
31
|
})
|
|
28
32
|
]);
|
|
29
33
|
|
|
30
34
|
// src/hooks/useNode.ts
|
|
31
|
-
import {
|
|
32
|
-
import
|
|
35
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
36
|
+
import * as Option from "effect/Option";
|
|
33
37
|
var useNode = (graph, id) => {
|
|
34
|
-
return Option.getOrElse(
|
|
38
|
+
return Option.getOrElse(useAtomValue(graph.node(id ?? "")), () => void 0);
|
|
35
39
|
};
|
|
36
40
|
var useConnections = (graph, id, relation) => {
|
|
37
|
-
return
|
|
41
|
+
return useAtomValue(graph.connections(id ?? "", relation));
|
|
38
42
|
};
|
|
39
43
|
var useActions = (graph, id) => {
|
|
40
|
-
return
|
|
44
|
+
return useAtomValue(graph.actions(id ?? ""));
|
|
41
45
|
};
|
|
42
46
|
export {
|
|
43
|
-
GRAPH_PLUGIN,
|
|
44
47
|
GraphPlugin,
|
|
45
48
|
meta,
|
|
46
49
|
useActions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useNode.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Events, defineModule, definePlugin, lazy } from '@dxos/app-framework';\n\nimport { meta } from './meta';\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 =
|
|
5
|
-
"mappings": ";AAIA,cAAc;;;ACAd,SAASA,QAAQC,cAAcC,cAAcC,YAAY;;;
|
|
6
|
-
"names": ["Events", "defineModule", "definePlugin", "lazy", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Events, defineModule, definePlugin, lazy } from '@dxos/app-framework';\n\nimport { meta } from './meta';\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 = definePlugin(meta, () => [\n defineModule({\n id: `${meta.id}/module/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\n activatesAfter: [Events.AppGraphReady],\n activate: lazy(() => import('./graph')),\n }),\n]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\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 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\n\nimport { type Node, type ReadableGraph, type Relation } 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: ReadableGraph, id?: string): Node<T> | undefined => {\n return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => undefined);\n};\n\nexport const useConnections = (graph: ReadableGraph, id?: string, relation?: Relation): Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\nexport const useActions = (graph: ReadableGraph, id?: string): Node[] => {\n return useAtomValue(graph.actions(id ?? ''));\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,cAAc;;;ACAd,SAASA,QAAQC,cAAcC,cAAcC,YAAY;;;ACCzD,SAASC,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADDO,IAAMC,cAAcC,aAAaC,MAAM,MAAM;EAClDC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,iBAAiB;MAACF,OAAOG;MAAeH,OAAOI;;IAC/CC,gBAAgB;MAACL,OAAOM;;IACxBC,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;;;AEjBD,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AAajB,IAAMC,UAAU,CAAUC,OAAsBC,OAAAA;AACrD,SAAcC,iBAAUC,aAAaH,MAAMI,KAAKH,MAAM,EAAA,CAAA,GAAM,MAAMI,MAAAA;AACpE;AAEO,IAAMC,iBAAiB,CAACN,OAAsBC,IAAaM,aAAAA;AAChE,SAAOJ,aAAaH,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AAEO,IAAME,aAAa,CAACT,OAAsBC,OAAAA;AAC/C,SAAOE,aAAaH,MAAMU,QAAQT,MAAM,EAAA,CAAA;AAC1C;",
|
|
6
|
+
"names": ["Events", "defineModule", "definePlugin", "lazy", "trim", "meta", "id", "name", "description", "trim", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy", "useAtomValue", "Option", "useNode", "graph", "id", "getOrElse", "useAtomValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1369,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":6297,"imports":[{"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":2709,"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/useNode.ts":{"bytes":3168,"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":461,"imports":[{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":733,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"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":3653},"dist/lib/browser/index.mjs":{"imports":[{"path":"@dxos/app-graph","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-FFQ77VLS.mjs","kind":"dynamic-import"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/GraphPlugin.ts":{"bytesInOutput":417},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useNode.ts":{"bytesInOutput":406},"src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1354},"dist/lib/browser/graph-FFQ77VLS.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3313},"dist/lib/browser/graph-FFQ77VLS.mjs":{"imports":[{"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":1212}},"bytes":1311}}}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// src/graph.ts
|
|
4
|
-
import
|
|
4
|
+
import * as Record from "effect/Record";
|
|
5
5
|
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
6
6
|
import { GraphBuilder, ROOT_ID, flattenExtensions } from "@dxos/app-graph";
|
|
7
|
-
var graph_default = async (context) => {
|
|
8
|
-
const registry = context.getCapability(Capabilities.
|
|
7
|
+
var graph_default = (async (context) => {
|
|
8
|
+
const registry = context.getCapability(Capabilities.AtomRegistry);
|
|
9
9
|
const builder = GraphBuilder.from(
|
|
10
10
|
/* localStorage.getItem(KEY) ?? */
|
|
11
11
|
void 0,
|
|
@@ -28,13 +28,12 @@ var graph_default = async (context) => {
|
|
|
28
28
|
}, () => {
|
|
29
29
|
unsubscribe();
|
|
30
30
|
});
|
|
31
|
-
};
|
|
31
|
+
});
|
|
32
32
|
var setupDevtools = (graph) => {
|
|
33
|
-
|
|
34
|
-
(_globalThis = globalThis).composer ?? (_globalThis.composer = {});
|
|
33
|
+
globalThis.composer ??= {};
|
|
35
34
|
globalThis.composer.graph = graph;
|
|
36
35
|
};
|
|
37
36
|
export {
|
|
38
37
|
graph_default as default
|
|
39
38
|
};
|
|
40
|
-
//# sourceMappingURL=graph-
|
|
39
|
+
//# sourceMappingURL=graph-7GDCGF7M.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 Record from 'effect/Record';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { type ExpandableGraph, GraphBuilder, ROOT_ID, flattenExtensions } 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 async (context: PluginContext) => {\n const registry = context.getCapability(Capabilities.AtomRegistry);\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 context.capabilities(Capabilities.AppGraphBuilder),\n (extensions) => {\n const next = 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) => builder.removeExtension(extension.id));\n next.forEach((extension) => builder.addExtension(extension));\n },\n { immediate: true },\n );\n\n // await builder.initialize();\n void builder.graph.expand(ROOT_ID);\n\n setupDevtools(builder.graph);\n\n return contributes(Capabilities.AppGraph, { graph: builder.graph, explore: builder.explore }, () => {\n // clearInterval(interval);\n unsubscribe();\n });\n};\n\n// Expose the graph to the window for debugging.\nconst setupDevtools = (graph: ExpandableGraph) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.graph = graph;\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAkCC,mBAAmB;AAC9D,SAA+BC,cAAcC,SAASC,yBAAyB;AAO/E,IAAA,iBAAe,OAAOC,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,YAAY;AAChE,QAAMC,UAAUC,aAAaC;;IAAwCC;IAAWP;EAAAA;AAKhF,QAAMQ,cAAcR,SAASS,UAC3BV,QAAQW,aAAaR,aAAaS,eAAe,GACjD,CAACC,eAAAA;AACC,UAAMC,OAAOC,kBAAkBF,UAAAA;AAC/B,UAAMG,UAAiBC,cAAOhB,SAASiB,IAAIb,QAAQQ,UAAU,CAAA;AAC7D,UAAMM,UAAUH,QAAQI,OAAO,CAAC,EAAEC,GAAE,MAAO,CAACP,KAAKQ,KAAK,CAAC,EAAED,IAAIE,OAAM,MAAOA,WAAWF,EAAAA,CAAAA;AACrFF,YAAQK,QAAQ,CAACC,cAAcpB,QAAQqB,gBAAgBD,UAAUJ,EAAE,CAAA;AACnEP,SAAKU,QAAQ,CAACC,cAAcpB,QAAQsB,aAAaF,SAAAA,CAAAA;EACnD,GACA;IAAEG,WAAW;EAAK,CAAA;AAIpB,OAAKvB,QAAQwB,MAAMC,OAAOC,OAAAA;AAE1BC,gBAAc3B,QAAQwB,KAAK;AAE3B,SAAOI,YAAY9B,aAAa+B,UAAU;IAAEL,OAAOxB,QAAQwB;IAAOM,SAAS9B,QAAQ8B;EAAQ,GAAG,MAAA;AAE5F1B,gBAAAA;EACF,CAAA;AACF;AAGA,IAAMuB,gBAAgB,CAACH,UAAAA;AACpBO,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASR,QAAQA;AACvC;",
|
|
6
|
+
"names": ["Record", "Capabilities", "contributes", "GraphBuilder", "ROOT_ID", "flattenExtensions", "context", "registry", "getCapability", "Capabilities", "AtomRegistry", "builder", "GraphBuilder", "from", "undefined", "unsubscribe", "subscribe", "capabilities", "AppGraphBuilder", "extensions", "next", "flattenExtensions", "current", "values", "get", "removed", "filter", "id", "some", "nextId", "forEach", "extension", "removeExtension", "addExtension", "immediate", "graph", "expand", "ROOT_ID", "setupDevtools", "contributes", "AppGraph", "explore", "globalThis", "composer"]
|
|
7
|
+
}
|
|
@@ -7,14 +7,18 @@ export * from "@dxos/app-graph";
|
|
|
7
7
|
import { Events, defineModule, definePlugin, lazy } from "@dxos/app-framework";
|
|
8
8
|
|
|
9
9
|
// src/meta.ts
|
|
10
|
-
|
|
10
|
+
import { trim } from "@dxos/util";
|
|
11
11
|
var meta = {
|
|
12
|
-
id:
|
|
13
|
-
name: "Graph"
|
|
12
|
+
id: "dxos.org/plugin/graph",
|
|
13
|
+
name: "Graph",
|
|
14
|
+
description: trim`
|
|
15
|
+
Graph database layer providing relationship modeling and queries for workspace objects.
|
|
16
|
+
Build knowledge graphs and explore complex data relationships.
|
|
17
|
+
`
|
|
14
18
|
};
|
|
15
19
|
|
|
16
20
|
// src/GraphPlugin.ts
|
|
17
|
-
var GraphPlugin = () =>
|
|
21
|
+
var GraphPlugin = definePlugin(meta, () => [
|
|
18
22
|
defineModule({
|
|
19
23
|
id: `${meta.id}/module/graph`,
|
|
20
24
|
activatesOn: Events.Startup,
|
|
@@ -25,24 +29,23 @@ var GraphPlugin = () => definePlugin(meta, [
|
|
|
25
29
|
activatesAfter: [
|
|
26
30
|
Events.AppGraphReady
|
|
27
31
|
],
|
|
28
|
-
activate: lazy(() => import("./graph-
|
|
32
|
+
activate: lazy(() => import("./graph-7GDCGF7M.mjs"))
|
|
29
33
|
})
|
|
30
34
|
]);
|
|
31
35
|
|
|
32
36
|
// src/hooks/useNode.ts
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
37
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
38
|
+
import * as Option from "effect/Option";
|
|
35
39
|
var useNode = (graph, id) => {
|
|
36
|
-
return Option.getOrElse(
|
|
40
|
+
return Option.getOrElse(useAtomValue(graph.node(id ?? "")), () => void 0);
|
|
37
41
|
};
|
|
38
42
|
var useConnections = (graph, id, relation) => {
|
|
39
|
-
return
|
|
43
|
+
return useAtomValue(graph.connections(id ?? "", relation));
|
|
40
44
|
};
|
|
41
45
|
var useActions = (graph, id) => {
|
|
42
|
-
return
|
|
46
|
+
return useAtomValue(graph.actions(id ?? ""));
|
|
43
47
|
};
|
|
44
48
|
export {
|
|
45
|
-
GRAPH_PLUGIN,
|
|
46
49
|
GraphPlugin,
|
|
47
50
|
meta,
|
|
48
51
|
useActions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/index.ts", "../../../src/GraphPlugin.ts", "../../../src/meta.ts", "../../../src/hooks/useNode.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Events, defineModule, definePlugin, lazy } from '@dxos/app-framework';\n\nimport { meta } from './meta';\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 =
|
|
5
|
-
"mappings": ";;;AAIA,cAAc;;;ACAd,SAASA,QAAQC,cAAcC,cAAcC,YAAY;;;
|
|
6
|
-
"names": ["Events", "defineModule", "definePlugin", "lazy", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from '@dxos/app-graph';\n\nexport * from './GraphPlugin';\nexport * from './hooks';\nexport * from './meta';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Events, defineModule, definePlugin, lazy } from '@dxos/app-framework';\n\nimport { meta } from './meta';\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 = definePlugin(meta, () => [\n defineModule({\n id: `${meta.id}/module/graph`,\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupAppGraph, Events.SetupMetadata],\n activatesAfter: [Events.AppGraphReady],\n activate: lazy(() => import('./graph')),\n }),\n]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\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 2024 DXOS.org\n//\n\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport * as Option from 'effect/Option';\n\nimport { type Node, type ReadableGraph, type Relation } 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: ReadableGraph, id?: string): Node<T> | undefined => {\n return Option.getOrElse(useAtomValue(graph.node(id ?? '')), () => undefined);\n};\n\nexport const useConnections = (graph: ReadableGraph, id?: string, relation?: Relation): Node[] => {\n return useAtomValue(graph.connections(id ?? '', relation));\n};\n\nexport const useActions = (graph: ReadableGraph, id?: string): Node[] => {\n return useAtomValue(graph.actions(id ?? ''));\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,cAAc;;;ACAd,SAASA,QAAQC,cAAcC,cAAcC,YAAY;;;ACCzD,SAASC,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;AAIf;;;ADDO,IAAMC,cAAcC,aAAaC,MAAM,MAAM;EAClDC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,iBAAiB;MAACF,OAAOG;MAAeH,OAAOI;;IAC/CC,gBAAgB;MAACL,OAAOM;;IACxBC,UAAUC,KAAK,MAAM,OAAO,sBAAA,CAAA;EAC9B,CAAA;CACD;;;AEjBD,SAASC,oBAAoB;AAC7B,YAAYC,YAAY;AAajB,IAAMC,UAAU,CAAUC,OAAsBC,OAAAA;AACrD,SAAcC,iBAAUC,aAAaH,MAAMI,KAAKH,MAAM,EAAA,CAAA,GAAM,MAAMI,MAAAA;AACpE;AAEO,IAAMC,iBAAiB,CAACN,OAAsBC,IAAaM,aAAAA;AAChE,SAAOJ,aAAaH,MAAMQ,YAAYP,MAAM,IAAIM,QAAAA,CAAAA;AAClD;AAEO,IAAME,aAAa,CAACT,OAAsBC,OAAAA;AAC/C,SAAOE,aAAaH,MAAMU,QAAQT,MAAM,EAAA,CAAA;AAC1C;",
|
|
6
|
+
"names": ["Events", "defineModule", "definePlugin", "lazy", "trim", "meta", "id", "name", "description", "trim", "GraphPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "Startup", "activatesBefore", "SetupAppGraph", "SetupMetadata", "activatesAfter", "AppGraphReady", "activate", "lazy", "useAtomValue", "Option", "useNode", "graph", "id", "getOrElse", "useAtomValue", "node", "undefined", "useConnections", "relation", "connections", "useActions", "actions"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/meta.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/meta.ts":{"bytes":1369,"imports":[{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"src/graph.ts":{"bytes":6297,"imports":[{"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":2709,"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/useNode.ts":{"bytes":3168,"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":461,"imports":[{"path":"src/hooks/useNode.ts","kind":"import-statement","original":"./useNode"}],"format":"esm"},"src/index.ts":{"bytes":733,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"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":3655},"dist/lib/node-esm/index.mjs":{"imports":[{"path":"@dxos/app-graph","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-7GDCGF7M.mjs","kind":"dynamic-import"},{"path":"@effect-atom/atom-react","kind":"import-statement","external":true},{"path":"effect/Option","kind":"import-statement","external":true}],"exports":["GraphPlugin","meta","useActions","useConnections","useNode"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":33},"src/GraphPlugin.ts":{"bytesInOutput":417},"src/meta.ts":{"bytesInOutput":283},"src/hooks/useNode.ts":{"bytesInOutput":406},"src/hooks/index.ts":{"bytesInOutput":0}},"bytes":1447},"dist/lib/node-esm/graph-7GDCGF7M.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3315},"dist/lib/node-esm/graph-7GDCGF7M.mjs":{"imports":[{"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":1212}},"bytes":1404}}}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Enables other plugins to register node builders to add nodes to the graph.
|
|
4
4
|
* This includes actions and annotation each other's nodes.
|
|
5
5
|
*/
|
|
6
|
-
export declare const GraphPlugin:
|
|
6
|
+
export declare const GraphPlugin: import("@dxos/app-framework").PluginFactory<void>;
|
|
7
7
|
//# sourceMappingURL=GraphPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"GraphPlugin.d.ts","sourceRoot":"","sources":["../../../src/GraphPlugin.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,eAAO,MAAM,WAAW,mDAQtB,CAAC"}
|
package/dist/types/src/meta.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,eAAO,MAAM,IAAI,EAAE,UAOlB,CAAC"}
|