feat: make node definitions type safe with zod

This commit is contained in:
2024-04-22 00:33:04 +02:00
parent 4c7c4cac2c
commit ad197db873
28 changed files with 221 additions and 147 deletions

View File

@@ -51,7 +51,7 @@ export class GraphManager extends EventEmitter<{ "save": Graph, "result": any, "
}
this.inputSockets.set(s);
});
this.execute = throttle(() => this._execute(), 50);
this.execute = throttle(() => this._execute(), 10);
}
serialize(): Graph {
@@ -83,7 +83,7 @@ export class GraphManager extends EventEmitter<{ "save": Graph, "result": any, "
this.emit("result", this.serialize());
}
getNodeTypes() {
getNodeDefinitions() {
return this.registry.getAllNodes();
}
@@ -184,7 +184,7 @@ export class GraphManager extends EventEmitter<{ "save": Graph, "result": any, "
// load settings
const settingTypes: Record<string, NodeInput> = {};
const settingValues = graph.settings || {};
const types = this.getNodeTypes();
const types = this.getNodeDefinitions();
for (const type of types) {
if (type.inputs) {
for (const key in type.inputs) {