{
  "schemaVersion": "flowdrome.workflow.v1",
  "id": "",
  "name": "Run counter & shared config",
  "version": "0",
  "status": "draft",
  "nodes": [
    {
      "id": "seed",
      "type": "input.inject",
      "label": "Job start",
      "category": "trigger",
      "config": {
        "contentType": "application/json",
        "payload": {
          "job": "night-batch"
        }
      },
      "position": {
        "x": 0,
        "y": 23
      }
    },
    {
      "id": "count",
      "type": "storage.global-key-value",
      "label": "Bump run counter",
      "category": "utility",
      "config": {
        "operation": "increment",
        "key": "demo.nightBatch.runs",
        "amount": 1
      },
      "position": {
        "x": 530,
        "y": 23
      }
    },
    {
      "id": "vars",
      "type": "utility.set-variable",
      "label": "Set $vars",
      "category": "utility",
      "config": {
        "assignments": [
          {
            "name": "batchWindow",
            "value": "02:00-04:00"
          }
        ]
      },
      "position": {
        "x": 1060,
        "y": 0
      }
    },
    {
      "id": "out",
      "type": "utility.console",
      "label": "Run banner",
      "category": "utility",
      "config": {
        "message": "run #{{ $json.value }} of {{ $json.key }} · window {{ $vars.batchWindow }}"
      },
      "position": {
        "x": 1590,
        "y": 0
      }
    }
  ],
  "edges": [
    {
      "id": "e0",
      "sourceNodeId": "seed",
      "sourcePort": "output",
      "targetNodeId": "count",
      "targetPort": "input"
    },
    {
      "id": "e1",
      "sourceNodeId": "count",
      "sourcePort": "found",
      "targetNodeId": "vars",
      "targetPort": "input"
    },
    {
      "id": "e2",
      "sourceNodeId": "count",
      "sourcePort": "notFound",
      "targetNodeId": "vars",
      "targetPort": "input"
    },
    {
      "id": "e3",
      "sourceNodeId": "vars",
      "sourcePort": "output",
      "targetNodeId": "out",
      "targetPort": "input"
    }
  ],
  "triggers": [
    {
      "id": "t0",
      "nodeId": "seed"
    }
  ],
  "meta": {
    "snippets": [],
    "source": "template-gallery",
    "description": "Global Key/Value keeps a counter across EVERY run of every workflow (Test twice and watch it climb), while Set Variable seeds run-local $vars downstream nodes can read with {{ $vars.… }}."
  }
}