diff --git a/main.go b/main.go index 5fea49ec..850f79ef 100644 --- a/main.go +++ b/main.go @@ -155,6 +155,7 @@ func main() { // Setup the plugin systems resourceController := resource.NewController(log, settingsProvider, stateDir.PluginStore) + graphService := resource.NewGraphService(resourceController.Graph()) settingsController := settings.NewController(log, settingsProvider, settingsStore) @@ -256,6 +257,7 @@ func main() { services := []application.Service{ // 1. Controllers — need ctx before plugin loading application.NewService(&resource.ServiceWrapper{Ctrl: resourceController}), + application.NewService(graphService), application.NewService(&settings.ServiceWrapper{Ctrl: settingsController}), application.NewService(&exec.ServiceWrapper{Ctrl: execController}), application.NewService(&networker.ServiceWrapper{Ctrl: networkerController}), diff --git a/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/index.ts b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/index.ts new file mode 100644 index 00000000..89ee68f0 --- /dev/null +++ b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/index.ts @@ -0,0 +1,13 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export { + DependencyNode, + DependencyTree, + GraphEdge, + GraphNode +} from "./models.js"; + +export type { + RelationshipType +} from "./models.js"; diff --git a/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/models.ts b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/models.ts new file mode 100644 index 00000000..f3d888c6 --- /dev/null +++ b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/models.ts @@ -0,0 +1,165 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Create as $Create } from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as resource$0 from "../../../../../../plugin-sdk/pkg/v1/resource/models.js"; + +export class DependencyNode { + "edge": GraphEdge; + "children": DependencyNode[]; + + /** Creates a new DependencyNode instance. */ + constructor($$source: Partial = {}) { + if (!("edge" in $$source)) { + this["edge"] = (new GraphEdge()); + } + if (!("children" in $$source)) { + this["children"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new DependencyNode instance from a string or object. + */ + static createFrom($$source: any = {}): DependencyNode { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("edge" in $$parsedSource) { + $$parsedSource["edge"] = $$createField0_0($$parsedSource["edge"]); + } + if ("children" in $$parsedSource) { + $$parsedSource["children"] = $$createField1_0($$parsedSource["children"]); + } + return new DependencyNode($$parsedSource as Partial); + } +} + +export class DependencyTree { + "root": GraphNode; + "children": DependencyNode[]; + + /** Creates a new DependencyTree instance. */ + constructor($$source: Partial = {}) { + if (!("root" in $$source)) { + this["root"] = (new GraphNode()); + } + if (!("children" in $$source)) { + this["children"] = []; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new DependencyTree instance from a string or object. + */ + static createFrom($$source: any = {}): DependencyTree { + const $$createField0_0 = $$createType3; + const $$createField1_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("root" in $$parsedSource) { + $$parsedSource["root"] = $$createField0_0($$parsedSource["root"]); + } + if ("children" in $$parsedSource) { + $$parsedSource["children"] = $$createField1_0($$parsedSource["children"]); + } + return new DependencyTree($$parsedSource as Partial); + } +} + +export class GraphEdge { + "source": GraphNode; + "target": GraphNode; + "type": RelationshipType; + "label": string; + + /** Creates a new GraphEdge instance. */ + constructor($$source: Partial = {}) { + if (!("source" in $$source)) { + this["source"] = (new GraphNode()); + } + if (!("target" in $$source)) { + this["target"] = (new GraphNode()); + } + if (!("type" in $$source)) { + this["type"] = resource$0.RelationshipType.$zero; + } + if (!("label" in $$source)) { + this["label"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new GraphEdge instance from a string or object. + */ + static createFrom($$source: any = {}): GraphEdge { + const $$createField0_0 = $$createType3; + const $$createField1_0 = $$createType3; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("source" in $$parsedSource) { + $$parsedSource["source"] = $$createField0_0($$parsedSource["source"]); + } + if ("target" in $$parsedSource) { + $$parsedSource["target"] = $$createField1_0($$parsedSource["target"]); + } + return new GraphEdge($$parsedSource as Partial); + } +} + +/** + * GraphNode identifies a specific resource instance in the graph. + */ +export class GraphNode { + "pluginId": string; + "connectionId": string; + "resourceKey": string; + "id": string; + "namespace"?: string; + + /** Creates a new GraphNode instance. */ + constructor($$source: Partial = {}) { + if (!("pluginId" in $$source)) { + this["pluginId"] = ""; + } + if (!("connectionId" in $$source)) { + this["connectionId"] = ""; + } + if (!("resourceKey" in $$source)) { + this["resourceKey"] = ""; + } + if (!("id" in $$source)) { + this["id"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new GraphNode instance from a string or object. + */ + static createFrom($$source: any = {}): GraphNode { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new GraphNode($$parsedSource as Partial); + } +} + +/** + * RelationshipType re-exports from SDK for convenience. + */ +export type RelationshipType = resource$0.RelationshipType; + +// Private type creation functions +const $$createType0 = GraphEdge.createFrom; +const $$createType1 = DependencyNode.createFrom; +const $$createType2 = $Create.Array($$createType1); +const $$createType3 = GraphNode.createFrom; diff --git a/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graphservice.ts b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graphservice.ts new file mode 100644 index 00000000..26ed2175 --- /dev/null +++ b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graphservice.ts @@ -0,0 +1,49 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * GraphService exposes graph query methods to the frontend via Wails binding. + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as graph$0 from "./graph/models.js"; + +/** + * GetDependencyTree follows all outgoing edges recursively. + */ +export function GetDependencyTree(pluginID: string, connectionID: string, resourceKey: string, $namespace: string, id: string, maxDepth: number): $CancellablePromise { + return $Call.ByID(3749557463, pluginID, connectionID, resourceKey, $namespace, id, maxDepth).then(($result: any) => { + return $$createType1($result); + }); +} + +/** + * GetRelated returns edges connected to the given node. + */ +export function GetRelated(pluginID: string, connectionID: string, resourceKey: string, $namespace: string, id: string, direction: string, relType: string | null): $CancellablePromise { + return $Call.ByID(3912521777, pluginID, connectionID, resourceKey, $namespace, id, direction, relType).then(($result: any) => { + return $$createType3($result); + }); +} + +/** + * GetRelationshipChain follows edges of a specific type up to maxDepth hops. + */ +export function GetRelationshipChain(pluginID: string, connectionID: string, resourceKey: string, $namespace: string, id: string, relType: string, maxDepth: number): $CancellablePromise { + return $Call.ByID(1916045973, pluginID, connectionID, resourceKey, $namespace, id, relType, maxDepth).then(($result: any) => { + return $$createType4($result); + }); +} + +// Private type creation functions +const $$createType0 = graph$0.DependencyTree.createFrom; +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = graph$0.GraphEdge.createFrom; +const $$createType3 = $Create.Array($$createType2); +const $$createType4 = $Create.Array($$createType3); diff --git a/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/index.ts b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/index.ts index 5aff3bc3..7d513c69 100644 --- a/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/index.ts +++ b/packages/omniviewdev-runtime/src/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/index.ts @@ -1,8 +1,10 @@ // Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL // This file is automatically generated. DO NOT EDIT +import * as GraphService from "./graphservice.js"; import * as ServiceWrapper from "./servicewrapper.js"; export { + GraphService, ServiceWrapper };