{
  "name": "02 \u2014 Verify ingestion",
  "settings": {
    "executionOrder": "v1"
  },
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "verify-ingestion",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "a2000000-0000-4000-8000-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -400,
        0
      ]
    },
    {
      "parameters": {
        "operation": "getAll",
        "tableId": "documents",
        "returnAll": true,
        "orderBy": "id.asc",
        "filters": {}
      },
      "id": "a2000000-0000-4000-8000-000000000002",
      "name": "Sample Rows",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        -180,
        0
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      },
      "notes": "returnAll with executeOnce. Without executeOnce this runs once per input item, and repeated full-table reads carrying 1536 floats per row trip the task runner.",
      "executeOnce": true
    },
    {
      "parameters": {
        "jsCode": "const rows = $input.all().map((r) => r.json);\nconst lengths = rows.map((r) => (r.content ?? '').length);\nconst first = rows[0] ?? {};\nconst embedding = typeof first.embedding === 'string' ? JSON.parse(first.embedding) : first.embedding;\nreturn [{ json: {\n  rowCount: rows.length,\n  embeddingDimensions: Array.isArray(embedding) ? embedding.length : null,\n  chunkChars: { min: Math.min(...lengths), max: Math.max(...lengths), mean: Math.round(lengths.reduce((a,b)=>a+b,0)/lengths.length), total: lengths.reduce((a,b)=>a+b,0) },\n  sampleChunk: (rows[1]?.content ?? first.content ?? '').slice(0, 600),\n  sampleMetadata: rows[1]?.metadata ?? first.metadata ?? null,\n} }];"
      },
      "id": "a2000000-0000-4000-8000-000000000003",
      "name": "Summarise",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        40,
        0
      ],
      "notes": "No executeOnce here: it would clamp the node to the first item and report a row count of 1."
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Sample Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample Rows": {
      "main": [
        [
          {
            "node": "Summarise",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}