n8n: checked against a live instance; archived workflows left out
Inspect on a real n8n showed the workflow and run lists answer as the reader expects, with nothing empty. Workflows marked isArchived are no longer listed or counted. Test and INTEGRATIONS.md updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
386d77b351
commit
01fb5d6335
3 files changed
+11
-5
No files matched your search
@@ -4,8 +4,8 @@
|
||||
* Reading only: the workflows (and which are switched on), and the most recent runs, from which each workflow's **last run** and how many runs failed in the last day are worked out —
|
||||
* an automation that has been failing since Tuesday is what is worth hearing about. Nothing is sent to n8n but GET requests for these.
|
||||
*
|
||||
* Endpoints and field names are from n8n's published public API (`/api/v1/workflows`, `/api/v1/executions`) and have not been checked against a live server here; every field is
|
||||
* read defensively. Only the newest 250 runs are looked at, so a workflow that runs more rarely than that many other runs may show no run.
|
||||
* Endpoints and field names are from n8n's published public API (`/api/v1/workflows`, `/api/v1/executions`) and were checked against a live server (Inspect: every field the reader
|
||||
* uses had a value); every field is still read defensively. Only the newest 250 runs are looked at, so a workflow that runs more rarely than that many other runs may show no run.
|
||||
*/
|
||||
import { requestJson } from "../httpJson.js";
|
||||
import { withDiagLogging } from "../../services/diagLog.js";
|
||||
@@ -48,13 +48,14 @@ const iso = (v: unknown): string | null => {
|
||||
export const FAILED_STATUSES = new Set(["error", "crashed"]);
|
||||
const PAGES = 4;
|
||||
|
||||
/** Pure: the workflows of one page. */
|
||||
/** Pure: the workflows of one page, archived ones left out. */
|
||||
export function parseWorkflows(raw: unknown): { id: string; name: string; active: boolean }[] {
|
||||
const out: { id: string; name: string; active: boolean }[] = [];
|
||||
for (const item of Array.isArray(obj(raw).data) ? (obj(raw).data as unknown[]) : []) {
|
||||
const w = obj(item);
|
||||
const id = str(w.id);
|
||||
if (!id) continue;
|
||||
// An archived workflow is out of the way in n8n (and never active): it isn't one to list or count.
|
||||
if (!id || w.isArchived === true) continue;
|
||||
out.push({ id, name: str(w.name) ?? id, active: w.active === true });
|
||||
}
|
||||
return out;
|
||||
|
||||
Reference in new issue
Block a user