Repository navigation
feat: cover workflow versions, data tables, and admin endpoints - #23
Conversation
Adds workflow publish/unpublish/archive/unarchive/delete/history/version, execution stop (single and bulk), and the datatable, credential, tag, folder, user, project member, and audit commands. workflow view now shows the draft and published version IDs.
3639798 to
a0fe7a5
Compare
|
🔏 Readiness attested — the Readiness summaryPR Readiness Check (#23, 795490e) |
Summary
Covers the public API endpoints n8nctl was missing. Rebased onto
mainafter #22 (source-control) merged.workflow publish [--version],unpublish,archive,unarchive,delete,history,version <id> <version-id>;workflow viewnow shows draft vs published version IDsexecution stop <id>,execution stop --status ... [--workflow] [--started-after/--started-before]dt)list,view,rows,insert,update,upsert,delete-rowswith--where <col><op><value>/--filter <json>/--or/--dry-runcred)list,test,schema,deletelist,create,rename,deletelist,view,create,update,delete [--transfer-to](all--project)user list [--project],user view <id-or-email>,project member list/add/set-role/removeaudit [--categories] [--days-abandoned]Design notes:
versionId,activeVersionId,isArchived) is decoded into a separateWorkflowStateinstead of being added toWorkflow.workflow pullserializesWorkflowto disk, and these fields change on every save.update,upsertanddelete-rowsrequire a filter. The server rejects a filterless row delete anyway, and the CLI also has no command that clears a whole table.--wheresends values as strings. On stage, n8n convertedrequestduration>1000(number column) andid=1correctly. Date columns do not compare exactly against the stored UTC timestamps (inserted>=2026-01-27T22:21:00Zreturned a 22:19 row), so the README says to check date filters withrowsor--dry-runfirst.cmdutilpackage (client,--json, cursor hint) instead of copyinggetClient/printJSONagain. The existing packages are left as they are.Testing
go test -race ./...andgolangci-lint run ./...pass. httptest coverage includes request paths, query encoding, request bodies (including the empty{}publish body and filter JSON in the row-delete query),--whereparsing (all operators,=inside values, empty values, bad input),--dataparsing, and the stop flag validation.wf view/history/version,cred list,tag list,user list,project member list,dt list/view/rowswith>,=,~,--sortand--jsoncursor.folder listreturns 403 because the stage key has nofolder:*scope.insert(array and stdin),update --dry-run(verified nothing changed),update,upserton an existing and a new key,delete-rows --or --dry-run,delete-rows, filterlessdelete-rowsrejected. The table was then deleted (HTTP 204).publish,publish --version <older>(view shows "draft has unpublished changes"),unpublish,archive,unarchive,deletewhile published (n8n returns 409 "Unpublish it before deleting", now in the help text), then archive anddelete(view returns 404 afterwards).--filter/--datanumber precision (UseNumber), trailing data after the JSON value ({"a":1}]was accepted), config errors hidden behind a generic message,execution stopwording, and RFC 3339 validation for--started-after/--started-before. Folder move to the project root stays unsupported because the API has no documented way to do it; the help text says so.workflow pushto an already-published workflow re-publishes the new version right away. This is documented in the README.credential test(it calls external services),audit,tag create/rename/delete,folderwrites (no scope),project member add/set-role/remove(would change real permissions), and bulkexecution stop.