@babsey/code-graph 0.9.3 → 0.9.6

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.
@@ -0,0 +1,22 @@
1
+ import { IConnection } from '@baklavajs/core';
2
+ import { AbstractCodeNode } from '../codeNode';
3
+ import { CodeGraph } from '../codeGraph';
4
+ export interface ITopologicalSortingResult {
5
+ calculationOrder: AbstractCodeNode[];
6
+ connectionsFromNode: Map<AbstractCodeNode, IConnection[]>;
7
+ /** NodeInterface.id -> parent Node.id */
8
+ interfaceIdToNodeId: Map<string, string>;
9
+ }
10
+ export declare class CycleError extends Error {
11
+ constructor();
12
+ }
13
+ /** Uses Kahn's algorithm to topologically sort the nodes in the graph */
14
+ export declare function sortTopologically(graph: CodeGraph): ITopologicalSortingResult;
15
+ /** Uses Kahn's algorithm to topologically sort the nodes in the graph */
16
+ export declare function sortTopologically(nodes: ReadonlyArray<AbstractCodeNode>, connections: ReadonlyArray<IConnection>): ITopologicalSortingResult;
17
+ /** This overload is only used for internal purposes */
18
+ export declare function sortTopologically(nodesorGraph: ReadonlyArray<AbstractCodeNode> | CodeGraph, connections?: ReadonlyArray<IConnection>): ITopologicalSortingResult;
19
+ /** Checks whether a graph contains a cycle */
20
+ export declare function containsCycle(graph: CodeGraph): boolean;
21
+ /** Checks whether the provided set of nodes and connections contains a cycle */
22
+ export declare function containsCycle(nodes: ReadonlyArray<AbstractCodeNode>, connections: ReadonlyArray<IConnection>): boolean;
@@ -50,6 +50,10 @@ export declare class CodeGraph extends Graph implements IBaklavaEventEmitter, IB
50
50
  * @param to code node interface
51
51
  */
52
52
  addConnection(from: CodeNodeInterface, to: CodeNodeInterface): void;
53
+ /**
54
+ * Execute calls of nodes before running graph.
55
+ */
56
+ beforeRun(): void;
53
57
  /**
54
58
  * Clear code graph.
55
59
  */
@@ -48,6 +48,7 @@ export declare abstract class AbstractCodeNode extends AbstractNode {
48
48
  set variableName(value: string);
49
49
  abstract afterGraphLoaded(): void;
50
50
  abstract afterLoaded(): void;
51
+ abstract beforeRun(): void;
51
52
  abstract onConnected(): void;
52
53
  abstract onGraphUpdate(): void;
53
54
  abstract onUnconnected(): void;
@@ -5,6 +5,7 @@ export type NodeInstanceOf<T> = T extends new () => Node<infer A, infer B> ? Nod
5
5
  export interface ICodeNodeDefinition<I, O> extends INodeDefinition<I, O> {
6
6
  afterGraphLoaded?: () => void;
7
7
  afterLoaded?: () => void;
8
+ beforeRun?: () => void;
8
9
  codeTemplate?: (node?: AbstractCodeNode) => string;
9
10
  modules?: string[];
10
11
  name?: string;
@@ -21,6 +21,7 @@ export interface DynamicNodeUpdateResult {
21
21
  export interface IDynamicCodeNodeDefinition<I, O> extends IDynamicNodeDefinition<I, O> {
22
22
  afterGraphLoaded?: () => void;
23
23
  afterLoaded?: () => void;
24
+ beforeRun?: () => void;
24
25
  codeTemplate?: (node?: AbstractCodeNode) => string;
25
26
  name?: string;
26
27
  modules?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babsey/code-graph",
3
- "version": "0.9.3",
3
+ "version": "0.9.6",
4
4
  "author": "babsey <spreizer@web.de>",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,10 +55,10 @@
55
55
  "@vue/language-core": "~3.2",
56
56
  "@vue/tsconfig": "~0.8",
57
57
  "eslint": "~9.39",
58
- "eslint-plugin-vue": "~10.6",
58
+ "eslint-plugin-vue": "~10.7",
59
59
  "jiti": "~2.6",
60
60
  "npm-run-all2": "~8.0",
61
- "prettier": "~3.7",
61
+ "prettier": "~3.8",
62
62
  "rimraf": "~6.1",
63
63
  "sass-embedded": "~1.97",
64
64
  "typescript": "~5.9",