Add graph ID creation / serialisation (#790)

- Updates UUIDv4 generator
- Adds a unique id & revision support to graphs
- `revision` to be incremented downstream (e.g. on save)
- `id` automatically assigned if not provided
This commit is contained in:
filtered
2025-03-17 05:41:08 +11:00
committed by GitHub
parent 3447ea1981
commit dbc605e4da
9 changed files with 71 additions and 10 deletions

View File

@@ -240,6 +240,7 @@ LGraph {
"fixedtime": 0,
"fixedtime_lapse": 0.01,
"globaltime": 0,
"id": "ca9da7d8-fddd-4707-ad32-67be9be13140",
"inputs": {},
"iteration": 0,
"last_update_time": 0,
@@ -249,6 +250,7 @@ LGraph {
"nodes_executedAction": [],
"nodes_executing": [],
"outputs": {},
"revision": 0,
"runningtime": 0,
"starttime": 0,
"state": {
@@ -285,6 +287,7 @@ LGraph {
"fixedtime": 0,
"fixedtime_lapse": 0.01,
"globaltime": 0,
"id": "d175890f-716a-4ece-ba33-1d17a513b7be",
"inputs": {},
"iteration": 0,
"last_update_time": 0,
@@ -294,6 +297,7 @@ LGraph {
"nodes_executedAction": [],
"nodes_executing": [],
"outputs": {},
"revision": 0,
"runningtime": 0,
"starttime": 0,
"state": {

View File

@@ -246,6 +246,7 @@ LGraph {
"fixedtime": 0,
"fixedtime_lapse": 0.01,
"globaltime": 0,
"id": "b4e984f1-b421-4d24-b8b4-ff895793af13",
"inputs": {},
"iteration": 0,
"last_update_time": 0,
@@ -255,6 +256,7 @@ LGraph {
"nodes_executedAction": [],
"nodes_executing": [],
"outputs": {},
"revision": 0,
"runningtime": 0,
"starttime": 0,
"state": {

View File

@@ -240,6 +240,7 @@ LGraph {
"fixedtime": 0,
"fixedtime_lapse": 0.01,
"globaltime": 0,
"id": "ca9da7d8-fddd-4707-ad32-67be9be13140",
"inputs": {},
"iteration": 0,
"last_update_time": 0,
@@ -249,6 +250,7 @@ LGraph {
"nodes_executedAction": [],
"nodes_executing": [],
"outputs": {},
"revision": 0,
"runningtime": 0,
"starttime": 0,
"state": {
@@ -285,6 +287,7 @@ LGraph {
"fixedtime": 0,
"fixedtime_lapse": 0.01,
"globaltime": 0,
"id": "d175890f-716a-4ece-ba33-1d17a513b7be",
"inputs": {},
"iteration": 0,
"last_update_time": 0,
@@ -294,6 +297,7 @@ LGraph {
"nodes_executedAction": [],
"nodes_executing": [],
"outputs": {},
"revision": 0,
"runningtime": 0,
"starttime": 0,
"state": {

View File

@@ -179,5 +179,6 @@ LiteGraphGlobal {
"throw_errors": true,
"use_legacy_node_error_indicator": false,
"use_uuids": false,
"uuidv4": [Function],
}
`;

View File

@@ -1,6 +1,8 @@
import type { ISerialisedGraph, SerialisableGraph } from "@/litegraph"
export const oldSchemaGraph: ISerialisedGraph = {
id: "b4e984f1-b421-4d24-b8b4-ff895793af13",
revision: 0,
version: 0.4,
config: {},
last_node_id: 0,
@@ -23,6 +25,8 @@ export const oldSchemaGraph: ISerialisedGraph = {
}
export const minimalSerialisableGraph: SerialisableGraph = {
id: "d175890f-716a-4ece-ba33-1d17a513b7be",
revision: 0,
version: 1,
config: {},
state: {
@@ -37,6 +41,8 @@ export const minimalSerialisableGraph: SerialisableGraph = {
}
export const basicSerialisableGraph: SerialisableGraph = {
id: "ca9da7d8-fddd-4707-ad32-67be9be13140",
revision: 0,
version: 1,
config: {},
state: {