@egose/n8n-client 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +8 -0
  3. package/{chunk-6JJ6RA5B.cjs → chunk-2T5KNPFX.cjs} +8 -1
  4. package/{chunk-RPB226OX.cjs → chunk-6MUNAE5L.cjs} +6 -6
  5. package/{chunk-3FDDCKAY.js → chunk-AS5WBSR3.js} +6 -6
  6. package/{chunk-TY76RTXQ.cjs → chunk-CWQXMALU.cjs} +7 -1
  7. package/{chunk-YSWBOCXJ.cjs → chunk-D4GV65GT.cjs} +10 -1
  8. package/{chunk-KRPRS2E5.cjs → chunk-DYUXQTFU.cjs} +6 -6
  9. package/{chunk-7H75UBMH.cjs → chunk-FB754K3A.cjs} +7 -1
  10. package/{chunk-4VK7K4IF.js → chunk-FOZHT2ZK.js} +7 -1
  11. package/{chunk-T62VHXNY.js → chunk-FSN23TT6.js} +7 -1
  12. package/{chunk-NBLW25ME.cjs → chunk-GUTI2M4U.cjs} +7 -1
  13. package/{chunk-GZ3POWDP.cjs → chunk-I2VZ7J4P.cjs} +6 -6
  14. package/{chunk-MMN2UKTI.cjs → chunk-JFTS6N3U.cjs} +11 -1
  15. package/{chunk-54N6YD4R.js → chunk-KBFYNP56.js} +2 -2
  16. package/{chunk-ETVDSJLY.js → chunk-KKFA5PJR.js} +2 -2
  17. package/{chunk-I4MMTW33.js → chunk-KMFHNXIH.js} +13 -1
  18. package/{chunk-W5P34RYO.cjs → chunk-O7AV3KS4.cjs} +31 -3
  19. package/{chunk-2R6A6NJE.js → chunk-PEUZAXIY.js} +10 -1
  20. package/{chunk-DTDNBA7W.cjs → chunk-TFMO4KWG.cjs} +4 -4
  21. package/{chunk-3YWWR6UD.cjs → chunk-TUWIRWCR.cjs} +14 -2
  22. package/{chunk-ZIIR24GM.cjs → chunk-U7CFNNJT.cjs} +11 -11
  23. package/{chunk-YE2OS2KS.js → chunk-UCSJX4UC.js} +8 -1
  24. package/{chunk-BQ2OTUXQ.js → chunk-UZYRG5OI.js} +2 -2
  25. package/{chunk-PT5DDLHC.js → chunk-VOCYFQYV.js} +2 -2
  26. package/{chunk-5DDMSYH2.js → chunk-W23TMDMQ.js} +2 -2
  27. package/{chunk-XJP6FPN3.js → chunk-WDO7B3R6.js} +11 -1
  28. package/{chunk-FTIVM52X.cjs → chunk-WO3YZAZT.cjs} +6 -6
  29. package/{chunk-YHSDCE3I.js → chunk-WQJUADC6.js} +7 -1
  30. package/{chunk-LQULSPET.cjs → chunk-WWVQNBTG.cjs} +6 -6
  31. package/{chunk-QJR4WFNV.js → chunk-YAYKWLOQ.js} +2 -2
  32. package/{chunk-GEWLPVNV.cjs → chunk-YWK563XR.cjs} +6 -6
  33. package/{chunk-LTYQTCHM.js → chunk-Z7XHC77E.js} +30 -2
  34. package/{chunk-HISH4ORK.js → chunk-ZPE32BQU.js} +2 -2
  35. package/clients/community-package.cjs +3 -3
  36. package/clients/community-package.d.cts +1 -1
  37. package/clients/community-package.d.ts +1 -1
  38. package/clients/community-package.js +2 -2
  39. package/clients/credential.cjs +3 -3
  40. package/clients/credential.d.cts +1 -1
  41. package/clients/credential.d.ts +1 -1
  42. package/clients/credential.js +2 -2
  43. package/clients/data-table.cjs +3 -3
  44. package/clients/data-table.d.cts +1 -1
  45. package/clients/data-table.d.ts +1 -1
  46. package/clients/data-table.js +2 -2
  47. package/clients/folder.cjs +3 -3
  48. package/clients/folder.d.cts +1 -1
  49. package/clients/folder.d.ts +1 -1
  50. package/clients/folder.js +2 -2
  51. package/clients/project.cjs +11 -11
  52. package/clients/project.d.cts +5 -5
  53. package/clients/project.d.ts +5 -5
  54. package/clients/project.js +10 -10
  55. package/clients/tag.cjs +3 -3
  56. package/clients/tag.d.cts +1 -1
  57. package/clients/tag.d.ts +1 -1
  58. package/clients/tag.js +2 -2
  59. package/clients/variable.cjs +3 -3
  60. package/clients/variable.d.cts +1 -1
  61. package/clients/variable.d.ts +1 -1
  62. package/clients/variable.js +2 -2
  63. package/clients/workflow.cjs +3 -3
  64. package/clients/workflow.d.cts +1 -1
  65. package/clients/workflow.d.ts +1 -1
  66. package/clients/workflow.js +2 -2
  67. package/{community-package-DBpReCPV.d.cts → community-package-BvmF_pP6.d.cts} +1 -0
  68. package/{community-package-CyzAqqwH.d.ts → community-package-xeQrLKme.d.ts} +1 -0
  69. package/{credential-CEH7XbGn.d.cts → credential-DPt1le6v.d.cts} +1 -0
  70. package/{credential-BWcrGfqd.d.ts → credential-Knm3Xhxp.d.ts} +1 -0
  71. package/{data-table-CHGUClGF.d.ts → data-table-Cg92UE2v.d.ts} +1 -0
  72. package/{data-table-CzR5kl9T.d.cts → data-table-ablBPGNU.d.cts} +1 -0
  73. package/{folder-DvgIxSea.d.cts → folder-DDe0xOyE.d.cts} +1 -0
  74. package/{folder-bjRPcy2j.d.ts → folder-JrOxuQPO.d.ts} +1 -0
  75. package/index.cjs +67 -26
  76. package/index.d.cts +74 -16
  77. package/index.d.ts +74 -16
  78. package/index.js +57 -16
  79. package/package.json +1 -1
  80. package/{project-BS1fXSLW.d.cts → project-CfXFXbv5.d.cts} +13 -4
  81. package/{project-uws9k24H.d.ts → project-DwqDoil4.d.ts} +13 -4
  82. package/resources/community-package.cjs +2 -2
  83. package/resources/community-package.d.cts +1 -1
  84. package/resources/community-package.d.ts +1 -1
  85. package/resources/community-package.js +1 -1
  86. package/resources/credential.cjs +2 -2
  87. package/resources/credential.d.cts +1 -1
  88. package/resources/credential.d.ts +1 -1
  89. package/resources/credential.js +1 -1
  90. package/resources/data-table.cjs +2 -2
  91. package/resources/data-table.d.cts +1 -1
  92. package/resources/data-table.d.ts +1 -1
  93. package/resources/data-table.js +1 -1
  94. package/resources/folder.cjs +2 -2
  95. package/resources/folder.d.cts +1 -1
  96. package/resources/folder.d.ts +1 -1
  97. package/resources/folder.js +1 -1
  98. package/resources/project.cjs +3 -3
  99. package/resources/project.d.cts +5 -5
  100. package/resources/project.d.ts +5 -5
  101. package/resources/project.js +2 -2
  102. package/resources/tag.cjs +2 -2
  103. package/resources/tag.d.cts +1 -1
  104. package/resources/tag.d.ts +1 -1
  105. package/resources/tag.js +1 -1
  106. package/resources/variable.cjs +2 -2
  107. package/resources/variable.d.cts +1 -1
  108. package/resources/variable.d.ts +1 -1
  109. package/resources/variable.js +1 -1
  110. package/resources/workflow.cjs +2 -2
  111. package/resources/workflow.d.cts +1 -1
  112. package/resources/workflow.d.ts +1 -1
  113. package/resources/workflow.js +1 -1
  114. package/{tag-lmf8obZe.d.ts → tag-5nOUYuYG.d.ts} +1 -0
  115. package/{tag-CzazpR40.d.cts → tag-DGGIqWix.d.cts} +1 -0
  116. package/types.d.cts +350 -0
  117. package/types.d.ts +350 -0
  118. package/{variable-CuCiwy0G.d.cts → variable-8kNQCTQx.d.cts} +1 -0
  119. package/{variable-C2LmlaTx.d.ts → variable-MVqhrcW-.d.ts} +1 -0
  120. package/{workflow-B2nxUmWq.d.cts → workflow-BD375xvs.d.cts} +1 -0
  121. package/{workflow-8pMj_fR_.d.ts → workflow-CLUVboDB.d.ts} +1 -0
package/types.d.cts CHANGED
@@ -1,44 +1,95 @@
1
1
  import { PaginationParams } from './pagination.cjs';
2
2
  export { PaginatedResponse } from './pagination.cjs';
3
3
 
4
+ /** JSON primitive value — string, number, boolean, or null. */
4
5
  type JsonPrimitive = string | number | boolean | null;
6
+ /** Any valid JSON value — primitives, objects, or arrays. */
5
7
  type JsonValue = JsonPrimitive | JsonObject | JsonArray;
8
+ /** JSON object — arbitrary key-value map with JSON values. */
6
9
  interface JsonObject {
7
10
  [key: string]: JsonValue;
8
11
  }
12
+ /** JSON array of arbitrary JSON values. */
9
13
  interface JsonArray extends Array<JsonValue> {
10
14
  }
15
+ /**
16
+ * Constructor config for `N8nClient`. Exactly one auth method must be provided.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const config: N8nClientConfig = {
21
+ * baseUrl: 'http://localhost:5678',
22
+ * apiKey: process.env.N8N_API_KEY,
23
+ * };
24
+ * ```
25
+ */
11
26
  type N8nClientConfig = {
27
+ /** Base URL of the n8n instance (e.g. `http://localhost:5678`). */
12
28
  baseUrl: string;
13
29
  } & ({
30
+ /** n8n API key — sent as `X-N8N-API-KEY` header. Mutually exclusive with `bearerToken`. */
14
31
  apiKey: string;
15
32
  bearerToken?: never;
16
33
  } | {
34
+ /** JWT bearer token — sent as `Authorization: Bearer` header. Mutually exclusive with `apiKey`. */
17
35
  bearerToken: string;
18
36
  apiKey?: never;
19
37
  });
38
+ /**
39
+ * Error shape used by the client for non-2xx HTTP responses.
40
+ *
41
+ * The runtime class thrown by HTTP operations is `HttpError`; this interface
42
+ * describes the compatible `{ status, data, message }` shape.
43
+ *
44
+ * @property status - HTTP status code
45
+ * @property data - Raw error response body from the n8n API
46
+ */
20
47
  interface N8nApiError extends Error {
21
48
  status: number;
22
49
  data: unknown;
23
50
  }
51
+ /**
52
+ * Full workflow object returned by the n8n API.
53
+ *
54
+ * This is a read-only representation. For creating or updating workflows,
55
+ * use `WorkflowCreate` or `WorkflowUpdate`.
56
+ */
24
57
  interface Workflow {
58
+ /** Unique workflow identifier. */
25
59
  id: string;
60
+ /** Display name of the workflow. */
26
61
  name: string;
62
+ /** Optional description. */
27
63
  description?: string;
64
+ /** Whether the workflow is currently active (has active triggers). */
28
65
  active: boolean;
66
+ /** ISO 8601 timestamp of creation. */
29
67
  createdAt: string;
68
+ /** ISO 8601 timestamp of last update. */
30
69
  updatedAt: string;
70
+ /** Whether the workflow has been archived. */
31
71
  isArchived: boolean;
72
+ /** Current version identifier — change on every save. */
32
73
  versionId: string;
74
+ /** Number of active triggers in the workflow. */
33
75
  triggerCount: number;
76
+ /** Array of workflow nodes (steps). */
34
77
  nodes: WorkflowNode[];
78
+ /** Node connection graph — maps source nodes to their output connections. */
35
79
  connections: WorkflowConnections;
80
+ /** Workflow-level settings. */
36
81
  settings?: WorkflowSettings;
82
+ /** Static data persisted between executions. */
37
83
  staticData?: string | JsonObject | null;
84
+ /** Pinned input data keyed by node name. */
38
85
  pinData?: WorkflowPinData | null;
86
+ /** Workflow metadata (template IDs, onboarding state). */
39
87
  meta?: WorkflowMeta | null;
88
+ /** Tags attached to the workflow. */
40
89
  tags?: Tag[];
90
+ /** Projects this workflow is shared with. */
41
91
  shared?: SharedWorkflow[];
92
+ /** Active version details, if versioning is enabled. */
42
93
  activeVersion?: ActiveVersion | null;
43
94
  }
44
95
  interface ActiveVersion {
@@ -52,73 +103,192 @@ interface ActiveVersion {
52
103
  createdAt: string;
53
104
  updatedAt: string;
54
105
  }
106
+ /**
107
+ * Payload for creating a new workflow.
108
+ *
109
+ * All fields except `description`, `staticData`, `pinData`, and `projectId` are required.
110
+ * The API does not accept partial updates — see `WorkflowUpdate` for the update shape.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * await client.workflows().create({
115
+ * name: 'My Workflow',
116
+ * nodes: [{ name: 'Start', type: 'n8n-nodes-base.start', position: [0, 0], parameters: {} }],
117
+ * connections: {},
118
+ * settings: { executionOrder: 'v1' },
119
+ * });
120
+ * ```
121
+ */
55
122
  interface WorkflowCreate {
123
+ /** Display name for the workflow. */
56
124
  name: string;
125
+ /** Optional description. */
57
126
  description?: string;
127
+ /** Array of workflow nodes (steps). Include the trigger/start nodes your workflow needs. */
58
128
  nodes: WorkflowNode[];
129
+ /** Node connection graph — maps source nodes to their output connections. */
59
130
  connections: WorkflowConnections;
131
+ /** Workflow-level execution settings. */
60
132
  settings: WorkflowSettings;
133
+ /** Static data persisted between executions. */
61
134
  staticData?: string | JsonObject | null;
135
+ /** Pinned input data keyed by node name. */
62
136
  pinData?: WorkflowPinData | null;
137
+ /** Target project ID — if omitted, the workflow is created in the caller's personal space. */
63
138
  projectId?: string;
64
139
  }
140
+ /**
141
+ * Full workflow update body. The n8n API requires the complete workflow object,
142
+ * not a partial patch. Always fetch the current workflow first, modify it, then
143
+ * pass the full body to `update()`.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * const current = await client.workflows().get('wf-1');
148
+ * await client.workflows().update('wf-1', {
149
+ * name: 'New Name',
150
+ * nodes: current.nodes,
151
+ * connections: current.connections,
152
+ * settings: current.settings ?? {},
153
+ * });
154
+ * ```
155
+ */
65
156
  interface WorkflowUpdate {
157
+ /** Display name for the workflow. */
66
158
  name: string;
159
+ /** Optional description. */
67
160
  description?: string;
161
+ /** Array of workflow nodes (steps). */
68
162
  nodes: WorkflowNode[];
163
+ /** Node connection graph. */
69
164
  connections: WorkflowConnections;
165
+ /** Workflow-level execution settings. */
70
166
  settings: WorkflowSettings;
167
+ /** Static data persisted between executions. */
71
168
  staticData?: string | JsonObject | null;
169
+ /** Pinned input data keyed by node name. */
72
170
  pinData?: WorkflowPinData | null;
73
171
  }
172
+ /**
173
+ * Workflow-level execution settings.
174
+ *
175
+ * All fields are optional. Common patterns:
176
+ * - `executionOrder: 'v1'` — common for new workflows
177
+ * - `errorWorkflow: 'wf-id'` — workflow to run on execution failure
178
+ * - `timezone: 'America/New_York'` — override instance timezone
179
+ */
74
180
  interface WorkflowSettings {
181
+ /** Save execution progress for long-running workflows. */
75
182
  saveExecutionProgress?: boolean;
183
+ /** Save manually triggered executions. */
76
184
  saveManualExecutions?: boolean;
185
+ /** Whether to save execution data on error: `'all'` or `'none'`. */
77
186
  saveDataErrorExecution?: 'all' | 'none';
187
+ /** Whether to save execution data on success: `'all'` or `'none'`. */
78
188
  saveDataSuccessExecution?: 'all' | 'none';
189
+ /** Execution timeout in seconds. */
79
190
  executionTimeout?: number;
191
+ /** ID of the workflow to execute on error. */
80
192
  errorWorkflow?: string;
193
+ /** Workflow timezone (e.g. `'America/New_York'`). */
81
194
  timezone?: string;
195
+ /** Execution order — `'v1'` is a common default for new workflows. */
82
196
  executionOrder?: string;
197
+ /** Which workflows can call this one: `'any'`, `'none'`, `'workflowsFromAList'`, `'workflowsFromSameOwner'`. */
83
198
  callerPolicy?: 'any' | 'none' | 'workflowsFromAList' | 'workflowsFromSameOwner';
199
+ /** Comma-separated list of workflow IDs allowed to call this one (when `callerPolicy` is `'workflowsFromAList'`). */
84
200
  callerIds?: string;
201
+ /** Time saved per execution in milliseconds. */
85
202
  timeSavedPerExecution?: number;
203
+ /** Data redaction policy for execution logs. */
86
204
  redactionPolicy?: 'none' | 'non-manual' | 'manual-only' | 'all';
205
+ /** Whether this workflow is available in the MCP interface. */
87
206
  availableInMCP?: boolean;
207
+ /** Custom telemetry tags attached to executions. */
88
208
  customTelemetryTags?: WorkflowTelemetryTag[];
89
209
  }
210
+ /**
211
+ * A single node (step) in a workflow graph.
212
+ *
213
+ * Nodes are the building blocks of n8n workflows. Each node has a `type`
214
+ * that determines its behavior (e.g. `'n8n-nodes-base.httpRequest'`).
215
+ */
90
216
  interface WorkflowNode {
217
+ /** Optional node identifier — auto-generated if omitted. */
91
218
  id?: string;
219
+ /** Display name for the node (must be unique within the workflow). */
92
220
  name: string;
221
+ /** Node type identifier (e.g. `'n8n-nodes-base.httpRequest'`, `'n8n-nodes-base.start'`). */
93
222
  type: string;
223
+ /** Node type version — determines which parameter schema to use. */
94
224
  typeVersion?: number;
225
+ /** Canvas position as `[x, y]` coordinates. */
95
226
  position: number[];
227
+ /** Node-specific parameters — shape varies by node type. */
96
228
  parameters?: JsonObject;
229
+ /** Credentials required by this node, keyed by credential type name. */
97
230
  credentials?: JsonObject;
231
+ /** Whether the node is disabled (skipped during execution). */
98
232
  disabled?: boolean;
233
+ /** Whether to show notes in the flow diagram. */
99
234
  notesInFlow?: boolean;
235
+ /** User-facing notes about this node. */
100
236
  notes?: string;
237
+ /** Webhook ID for webhook trigger nodes. */
101
238
  webhookId?: string;
239
+ /** Whether to execute this node only once per execution. */
102
240
  executeOnce?: boolean;
241
+ /** Whether to always output data, even on empty results. */
103
242
  alwaysOutputData?: boolean;
243
+ /** Whether to retry on failure. */
104
244
  retryOnFail?: boolean;
245
+ /** Maximum number of retry attempts (when `retryOnFail` is true). */
105
246
  maxTries?: number;
247
+ /** Wait time between retries in milliseconds. */
106
248
  waitBetweenTries?: number;
249
+ /** Whether to continue execution even if this node fails. */
107
250
  continueOnFail?: boolean;
251
+ /** Error handling strategy: `'continueRegularOutput'`, `'continueErrorOutput'`, `'stopWorkflow'`. */
108
252
  onError?: string;
253
+ /** Custom telemetry tags for this node. */
109
254
  customTelemetryTags?: WorkflowNodeTelemetryTags;
255
+ /** ISO 8601 timestamp of creation (read-only). */
110
256
  createdAt?: string;
257
+ /** ISO 8601 timestamp of last update (read-only). */
111
258
  updatedAt?: string;
112
259
  }
260
+ /**
261
+ * A single connection between two nodes.
262
+ *
263
+ * @property node - Target node name
264
+ * @property type - Connection type (e.g. `'main'`, `'ai_tool'`)
265
+ * @property index - Output index on the source node
266
+ */
113
267
  interface WorkflowConnection {
268
+ /** Name of the target node. */
114
269
  node: string;
270
+ /** Connection type — typically `'main'` for standard data flow. */
115
271
  type: string;
272
+ /** Output index on the source node (0-based). */
116
273
  index: number;
117
274
  }
275
+ /** Array of connections from a single output. */
118
276
  type WorkflowConnectionBranch = WorkflowConnection[];
277
+ /** Maps connection type names to arrays of connection branches. */
119
278
  interface WorkflowConnectionTypeMap {
120
279
  [connectionType: string]: WorkflowConnectionBranch[];
121
280
  }
281
+ /**
282
+ * Workflow connection graph. Maps source node names to their output connections.
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * const connections: WorkflowConnections = {
287
+ * 'Start': { 'main': [[{ node: 'HTTP Request', type: 'main', index: 0 }]] },
288
+ * 'HTTP Request': { 'main': [[{ node: 'End', type: 'main', index: 0 }]] },
289
+ * };
290
+ * ```
291
+ */
122
292
  interface WorkflowConnections {
123
293
  [sourceNode: string]: WorkflowConnectionTypeMap;
124
294
  }
@@ -181,20 +351,52 @@ interface WorkflowActivateRequest {
181
351
  name?: string;
182
352
  description?: string;
183
353
  }
354
+ /**
355
+ * Execution status enum — the current state of a workflow run.
356
+ *
357
+ * | Status | Meaning |
358
+ * |--------|---------|
359
+ * | `'success'` | Completed without errors |
360
+ * | `'error'` | Completed with errors |
361
+ * | `'running'` | Currently executing |
362
+ * | `'waiting'` | Waiting for input or a webhook callback |
363
+ * | `'new'` | Created but not yet started |
364
+ * | `'canceled'` | Manually canceled |
365
+ * | `'crashed'` | Fatal error during execution |
366
+ * | `'unknown'` | Status could not be determined |
367
+ */
184
368
  type ExecutionStatus = 'canceled' | 'crashed' | 'error' | 'new' | 'running' | 'success' | 'unknown' | 'waiting';
369
+ /** How the execution was triggered. */
185
370
  type ExecutionMode = 'cli' | 'error' | 'integrated' | 'internal' | 'manual' | 'retry' | 'trigger' | 'webhook' | 'evaluation' | 'chat';
371
+ /**
372
+ * A single workflow execution record.
373
+ *
374
+ * Use `includeData: true` in list/get params to include full execution data (input/output for each node).
375
+ */
186
376
  interface Execution {
377
+ /** Numeric execution ID. */
187
378
  id: number;
379
+ /** Full execution data — only populated when `includeData: true`. */
188
380
  data?: JsonObject;
381
+ /** Whether the execution completed (success or error). */
189
382
  finished: boolean;
383
+ /** How the execution was triggered. */
190
384
  mode: ExecutionMode;
385
+ /** ID of the original execution this one retried, if applicable. */
191
386
  retryOf?: number;
387
+ /** ID of the successful retry, if this execution was retried. */
192
388
  retrySuccessId?: number;
389
+ /** ISO 8601 timestamp of when the execution started. */
193
390
  startedAt: string;
391
+ /** ISO 8601 timestamp of when the execution stopped. */
194
392
  stoppedAt?: string;
393
+ /** ID of the workflow that was executed. */
195
394
  workflowId: number;
395
+ /** ISO 8601 timestamp when a wait node should resume. */
196
396
  waitTill?: string;
397
+ /** Custom data attached to the execution. */
197
398
  customData?: JsonObject;
399
+ /** Current execution status. */
198
400
  status: ExecutionStatus;
199
401
  }
200
402
  interface ExecutionListResponse {
@@ -224,27 +426,66 @@ interface ExecutionGetParams {
224
426
  interface ExecutionRetryRequest {
225
427
  loadWorkflow?: boolean;
226
428
  }
429
+ /**
430
+ * A stored credential — authentication material for external services.
431
+ *
432
+ * The `data` field contains the actual secrets and its shape varies by credential type.
433
+ * Use `type` to determine which fields are expected.
434
+ */
227
435
  interface Credential {
436
+ /** Unique credential identifier. */
228
437
  id: string;
438
+ /** Display name. */
229
439
  name: string;
440
+ /** Credential type (e.g. `'httpHeaderAuth'`, `'aws'`, `'slackOAuth2Api'`). */
230
441
  type: string;
442
+ /** Secret data — shape depends on `type`. Omitted in most list responses. */
231
443
  data?: JsonObject;
444
+ /** Whether this credential can be resolved by other credentials. */
232
445
  isResolvable?: boolean;
446
+ /** ISO 8601 timestamp of creation. */
233
447
  createdAt: string;
448
+ /** ISO 8601 timestamp of last update. */
234
449
  updatedAt: string;
235
450
  }
451
+ /**
452
+ * Payload for creating a new credential.
453
+ *
454
+ * @example
455
+ * ```ts
456
+ * await client.credentials().create({
457
+ * name: 'AWS Credentials',
458
+ * type: 'aws',
459
+ * data: { accessKey: 'AKIA...', secretKey: '...' },
460
+ * projectId: 'proj-1', // optional — target project
461
+ * });
462
+ * ```
463
+ */
236
464
  interface CredentialCreate {
465
+ /** Display name for the credential. */
237
466
  name: string;
467
+ /** Credential type identifier (e.g. `'httpHeaderAuth'`). */
238
468
  type: string;
469
+ /** Secret data — shape depends on `type`. */
239
470
  data: JsonObject;
471
+ /** Target project ID — if omitted, credential is created in the caller's personal space. */
240
472
  projectId?: string;
241
473
  }
474
+ /**
475
+ * Payload for updating a credential. All fields are optional (partial patch).
476
+ */
242
477
  interface CredentialUpdate {
478
+ /** New display name. */
243
479
  name?: string;
480
+ /** New credential type. */
244
481
  type?: string;
482
+ /** New secret data — shape depends on `type`. */
245
483
  data?: JsonObject;
484
+ /** Whether the credential is global (shared across projects). */
246
485
  isGlobal?: boolean;
486
+ /** Whether the credential can be resolved by other credentials. */
247
487
  isResolvable?: boolean;
488
+ /** Whether the credential has partial data (for staged updates). */
248
489
  isPartialData?: boolean;
249
490
  }
250
491
  interface CredentialResponse {
@@ -332,31 +573,56 @@ interface UserGetParams {
332
573
  interface UserRoleChangeRequest {
333
574
  newRoleName: string;
334
575
  }
576
+ /**
577
+ * Environment variable stored in n8n.
578
+ *
579
+ * Variables are project-scoped when `project` is present. Note that the n8n
580
+ * API does not expose `GET /variables/{id}`, so client lookups by ID are
581
+ * implemented as paginated searches.
582
+ */
335
583
  interface Variable {
584
+ /** Unique variable identifier. */
336
585
  id: string;
586
+ /** Variable key name (e.g. `API_URL`). */
337
587
  key: string;
588
+ /** Variable value as stored by n8n. */
338
589
  value: string;
590
+ /** Optional variable type metadata from the API. */
339
591
  type?: string;
592
+ /** Owning project, when included by the API response. */
340
593
  project?: Project;
341
594
  }
595
+ /** Payload for creating or replacing a variable. */
342
596
  interface VariableCreate {
597
+ /** Variable key name (e.g. `API_URL`). */
343
598
  key: string;
599
+ /** Variable value. */
344
600
  value: string;
601
+ /** Target project ID. */
345
602
  projectId?: string;
346
603
  }
604
+ /** Cursor-paginated variable list response. */
347
605
  interface VariableListResponse {
348
606
  data: Variable[];
349
607
  nextCursor?: string;
350
608
  }
609
+ /** Filters for listing variables. */
351
610
  interface VariableListParams extends PaginationParams {
611
+ /** Restrict results to a specific project. */
352
612
  projectId?: string;
613
+ /** Filter to variables with empty values. */
353
614
  state?: 'empty';
354
615
  }
616
+ /** n8n project visible to the authenticated caller. */
355
617
  interface Project {
618
+ /** Unique project identifier. */
356
619
  id: string;
620
+ /** Display name. */
357
621
  name: string;
622
+ /** Optional project type from the API. */
358
623
  type?: string;
359
624
  }
625
+ /** Member of a project with the resolved project role. */
360
626
  interface ProjectMember {
361
627
  id: string;
362
628
  email: string;
@@ -366,76 +632,109 @@ interface ProjectMember {
366
632
  updatedAt: string;
367
633
  role: string;
368
634
  }
635
+ /** Cursor-paginated project list response. */
369
636
  interface ProjectListResponse {
370
637
  data: Project[];
371
638
  nextCursor?: string;
372
639
  }
640
+ /** Cursor-paginated project member list response. */
373
641
  interface ProjectMemberListResponse {
374
642
  data: ProjectMember[];
375
643
  nextCursor?: string;
376
644
  }
645
+ /** Payload for creating or renaming a project. */
377
646
  interface ProjectMutation {
647
+ /** Project display name. */
378
648
  name: string;
379
649
  }
650
+ /** Member assignment used when adding users to a project. */
380
651
  interface ProjectMemberRelation {
652
+ /** User ID to add to the project. */
381
653
  userId: string;
654
+ /** Project role name (e.g. `project:editor`). */
382
655
  role: string;
383
656
  }
657
+ /** Payload for changing an existing member role in a project. */
384
658
  interface ProjectMemberRoleChangeRequest {
385
659
  role: string;
386
660
  }
661
+ /** A data table owned by a project. */
387
662
  interface DataTable {
663
+ /** Unique data table identifier. */
388
664
  id: string;
665
+ /** Display name. */
389
666
  name: string;
667
+ /** Current table columns. */
390
668
  columns: DataTableColumn[];
669
+ /** Owning project ID. */
391
670
  projectId: string;
392
671
  createdAt: string;
393
672
  updatedAt: string;
394
673
  }
674
+ /** Column metadata within a data table. */
395
675
  interface DataTableColumn {
396
676
  id: string;
397
677
  name: string;
398
678
  dataTableId: string;
679
+ /** Column type returned by the current public API. */
399
680
  type: 'string' | 'number' | 'boolean' | 'date';
400
681
  index: number;
401
682
  }
683
+ /** Single row in a data table. Additional fields are dynamic column values. */
402
684
  interface DataTableRow {
403
685
  id: number;
404
686
  createdAt?: string;
405
687
  updatedAt?: string;
406
688
  [key: string]: JsonValue | undefined;
407
689
  }
690
+ /**
691
+ * Payload for creating a data table.
692
+ *
693
+ * The create API accepts a broader set of column types than the read response,
694
+ * including `json`.
695
+ */
408
696
  interface CreateDataTableRequest {
697
+ /** Table name. */
409
698
  name: string;
699
+ /** Initial columns to create. */
410
700
  columns: Array<{
411
701
  name: string;
412
702
  type: 'string' | 'number' | 'boolean' | 'date' | 'json';
413
703
  }>;
704
+ /** Target project ID. */
414
705
  projectId?: string;
415
706
  }
707
+ /** Payload for renaming a data table. */
416
708
  interface UpdateDataTableRequest {
417
709
  name: string;
418
710
  }
711
+ /** Payload for adding a new column to a data table. */
419
712
  interface CreateColumnRequest {
420
713
  name: string;
421
714
  type: 'string' | 'number' | 'boolean' | 'date';
715
+ /** Optional insertion index. */
422
716
  index?: number;
423
717
  }
718
+ /** Payload for updating a column name or order. */
424
719
  interface UpdateColumnRequest {
425
720
  name?: string;
426
721
  index?: number;
427
722
  }
723
+ /** Filters for listing data tables. */
428
724
  interface DataTableListParams extends PaginationParams {
429
725
  filter?: string;
430
726
  sortBy?: string;
431
727
  }
728
+ /** Filters for listing rows within a data table. */
432
729
  interface DataTableRowListParams extends PaginationParams {
433
730
  filter?: string;
434
731
  sortBy?: string;
435
732
  search?: string;
436
733
  }
734
+ /** Base payload for inserting rows into a data table. */
437
735
  interface InsertRowsRequest {
438
736
  data: JsonObject[];
737
+ /** Determines whether the API returns counts, row IDs, or full rows. */
439
738
  returnType?: 'count' | 'id' | 'all';
440
739
  }
441
740
  interface InsertRowsCountRequest extends InsertRowsRequest {
@@ -447,11 +746,32 @@ interface InsertRowsIdsRequest extends InsertRowsRequest {
447
746
  interface InsertRowsAllRequest extends InsertRowsRequest {
448
747
  returnType: 'all';
449
748
  }
749
+ /**
750
+ * Filter expression for data table row operations.
751
+ *
752
+ * Supports AND/OR logic with multiple filter conditions.
753
+ *
754
+ * @example
755
+ * ```ts
756
+ * const filter: DataTableFilter = {
757
+ * type: 'and',
758
+ * filters: [
759
+ * { columnName: 'status', condition: 'eq', value: 'active' },
760
+ * { columnName: 'age', condition: 'gte', value: 18 },
761
+ * ],
762
+ * };
763
+ * ```
764
+ */
450
765
  interface DataTableFilter {
766
+ /** Logic operator for combining filters: `'and'` (default) or `'or'`. */
451
767
  type?: 'and' | 'or';
768
+ /** Array of filter conditions. */
452
769
  filters: Array<{
770
+ /** Column name to filter on. */
453
771
  columnName: string;
772
+ /** Comparison operator: `'eq'`, `'neq'`, `'like'`, `'ilike'`, `'gt'`, `'gte'`, `'lt'`, `'lte'`. */
454
773
  condition: 'eq' | 'neq' | 'like' | 'ilike' | 'gt' | 'gte' | 'lt' | 'lte';
774
+ /** Value to compare against. */
455
775
  value: JsonValue;
456
776
  }>;
457
777
  }
@@ -495,33 +815,41 @@ interface DataTableListResponse {
495
815
  data: DataTable[];
496
816
  nextCursor?: string;
497
817
  }
818
+ /** Cursor-paginated data table row list response. */
498
819
  interface DataTableRowListResponse {
499
820
  data: DataTableRow[];
500
821
  nextCursor?: string;
501
822
  }
823
+ /** Project-scoped folder used to organize workflows. */
502
824
  interface Folder {
503
825
  id: string;
504
826
  name: string;
827
+ /** Parent folder ID when nested. */
505
828
  parentFolderId?: string;
506
829
  createdAt: string;
507
830
  updatedAt: string;
508
831
  }
832
+ /** Payload for creating a folder. */
509
833
  interface FolderCreate {
510
834
  name: string;
511
835
  parentFolderId?: string;
512
836
  }
837
+ /** Partial update payload for a folder. */
513
838
  interface FolderUpdate {
514
839
  name?: string;
515
840
  parentFolderId?: string;
516
841
  }
842
+ /** Folder list response for project-scoped folder endpoints. */
517
843
  interface FolderListResponse {
518
844
  count: number;
519
845
  data: Folder[];
520
846
  }
847
+ /** Extended folder response with aggregate counts. */
521
848
  interface FolderDetail extends Folder {
522
849
  totalSubFolders?: number;
523
850
  totalWorkflows?: number;
524
851
  }
852
+ /** Filters for listing folders inside a project. */
525
853
  interface FolderListParams extends PaginationParams {
526
854
  filter?: string;
527
855
  select?: string;
@@ -529,6 +857,7 @@ interface FolderListParams extends PaginationParams {
529
857
  skip?: string;
530
858
  take?: string;
531
859
  }
860
+ /** Installed n8n community package. */
532
861
  interface CommunityPackage {
533
862
  packageName: string;
534
863
  installedVersion: string;
@@ -540,16 +869,19 @@ interface CommunityPackage {
540
869
  updateAvailable?: string;
541
870
  failedLoading?: boolean;
542
871
  }
872
+ /** Single node contributed by a community package. */
543
873
  interface CommunityPackageNode {
544
874
  name: string;
545
875
  type: string;
546
876
  latestVersion: number;
547
877
  }
878
+ /** Payload for installing a community package. */
548
879
  interface InstallCommunityPackageRequest {
549
880
  name: string;
550
881
  version?: string;
551
882
  verify?: boolean;
552
883
  }
884
+ /** Payload for updating an installed community package. */
553
885
  interface UpdateCommunityPackageRequest {
554
886
  version?: string;
555
887
  verify?: boolean;
@@ -693,11 +1025,29 @@ interface ImportPackageResponse {
693
1025
  workflows: ImportPackageWorkflow[];
694
1026
  bindings: ImportPackageBindings;
695
1027
  }
1028
+ /**
1029
+ * Options for `N8nPackageClient.importPackage()`.
1030
+ *
1031
+ * `workflowConflictPolicy` is required — there is no default.
1032
+ *
1033
+ * @example
1034
+ * ```ts
1035
+ * await client.n8nPackage().importPackage(fileBlob, {
1036
+ * projectId: 'proj-123',
1037
+ * workflowConflictPolicy: 'new-version',
1038
+ * });
1039
+ * ```
1040
+ */
696
1041
  interface ImportPackageOptions {
1042
+ /** Target project for imported workflows. */
697
1043
  projectId?: string;
1044
+ /** Target folder for imported workflows. */
698
1045
  folderId?: string;
1046
+ /** How to match existing credentials: `'id-only'`. */
699
1047
  credentialMatchingMode?: 'id-only';
1048
+ /** Fail if referenced credentials are missing: `'must-preexist'`. */
700
1049
  credentialMissingMode?: 'must-preexist';
1050
+ /** How to handle workflow name conflicts: `'new-version'`, `'fail'`, or `'skip'`. Required. */
701
1051
  workflowConflictPolicy: 'new-version' | 'fail' | 'skip';
702
1052
  }
703
1053
  interface ImportPackageConflictError {