@egose/n8n-client 0.1.1 → 0.2.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.
- package/CHANGELOG.md +21 -1
- package/README.md +188 -46
- package/chunk-2R6A6NJE.js +38 -0
- package/chunk-3FDDCKAY.js +95 -0
- package/chunk-3YWWR6UD.cjs +98 -0
- package/chunk-4M2HGY3F.cjs +12 -0
- package/chunk-4VK7K4IF.js +29 -0
- package/chunk-54MX3Y2M.cjs +15 -0
- package/{chunk-MNL65GQB.js → chunk-54N6YD4R.js} +30 -8
- package/chunk-5DDMSYH2.js +54 -0
- package/chunk-5ZRUF6XZ.cjs +15 -0
- package/chunk-6JJ6RA5B.cjs +32 -0
- package/chunk-7H75UBMH.cjs +29 -0
- package/chunk-B7CINZ27.cjs +43 -0
- package/chunk-BA4KTRMX.cjs +15 -0
- package/{chunk-TCPZWXKM.js → chunk-BQ2OTUXQ.js} +27 -8
- package/chunk-C3JBYESS.cjs +35 -0
- package/chunk-C6W6ERQD.js +53 -0
- package/{chunk-TRHGCMFH.cjs → chunk-CCS5ALTN.cjs} +8 -8
- package/chunk-DTDNBA7W.cjs +59 -0
- package/chunk-ETVDSJLY.js +48 -0
- package/chunk-F5RPJMNK.js +15 -0
- package/chunk-FIKGC2EL.cjs +29 -0
- package/{chunk-YPK2BDPO.cjs → chunk-FTIVM52X.cjs} +27 -8
- package/chunk-GEWLPVNV.cjs +48 -0
- package/{chunk-I7NGIQIM.cjs → chunk-GZ3POWDP.cjs} +30 -8
- package/chunk-HISH4ORK.js +59 -0
- package/chunk-I4MMTW33.js +98 -0
- package/chunk-KRPRS2E5.cjs +46 -0
- package/chunk-L2FFL3BY.js +35 -0
- package/{chunk-5DYA4LAX.cjs → chunk-LC3TKRMX.cjs} +1 -1
- package/chunk-LQULSPET.cjs +55 -0
- package/chunk-LTYQTCHM.js +196 -0
- package/chunk-MMN2UKTI.cjs +41 -0
- package/chunk-NBLW25ME.cjs +67 -0
- package/chunk-NS2RDZ7W.js +15 -0
- package/chunk-OUOWDGL7.js +15 -0
- package/chunk-PT5DDLHC.js +46 -0
- package/chunk-Q6FSREKN.js +12 -0
- package/chunk-QJR4WFNV.js +55 -0
- package/{chunk-DK5NLZ6U.js → chunk-RMEH2UPX.js} +1 -1
- package/chunk-RPB226OX.cjs +54 -0
- package/chunk-S4ZASMBT.js +43 -0
- package/chunk-T62VHXNY.js +67 -0
- package/chunk-TLBDBRPJ.js +29 -0
- package/chunk-TY76RTXQ.cjs +32 -0
- package/chunk-USTEEQQG.js +43 -0
- package/chunk-W5P34RYO.cjs +196 -0
- package/chunk-XJP6FPN3.js +41 -0
- package/chunk-YBMEMKCN.cjs +53 -0
- package/chunk-YE2OS2KS.js +32 -0
- package/chunk-YHSDCE3I.js +32 -0
- package/chunk-YSWBOCXJ.cjs +38 -0
- package/chunk-YUCX7HE3.js +15 -0
- package/chunk-Z3D4URRD.cjs +43 -0
- package/chunk-ZIIR24GM.cjs +95 -0
- package/chunk-ZPU6PQES.cjs +15 -0
- package/{chunk-CUO2M75Z.js → chunk-ZVZIMJRM.js} +8 -8
- package/clients/audit.cjs +8 -0
- package/clients/audit.d.cts +10 -0
- package/clients/audit.d.ts +10 -0
- package/clients/audit.js +8 -0
- package/clients/base.cjs +7 -0
- package/clients/base.d.cts +10 -0
- package/clients/base.d.ts +10 -0
- package/clients/base.js +7 -0
- package/clients/community-package.cjs +12 -0
- package/clients/community-package.d.cts +6 -0
- package/clients/community-package.d.ts +6 -0
- package/clients/community-package.js +12 -0
- package/clients/credential.cjs +10 -0
- package/clients/credential.d.cts +6 -0
- package/clients/credential.d.ts +6 -0
- package/clients/credential.js +10 -0
- package/clients/data-table.cjs +10 -0
- package/clients/data-table.d.cts +6 -0
- package/clients/data-table.d.ts +6 -0
- package/clients/data-table.js +10 -0
- package/clients/discover.cjs +8 -0
- package/clients/discover.d.cts +10 -0
- package/clients/discover.d.ts +10 -0
- package/clients/discover.js +8 -0
- package/clients/execution.cjs +10 -0
- package/clients/execution.d.cts +6 -0
- package/clients/execution.d.ts +6 -0
- package/clients/execution.js +10 -0
- package/clients/folder.cjs +10 -0
- package/clients/folder.d.cts +6 -0
- package/clients/folder.d.ts +6 -0
- package/clients/folder.js +10 -0
- package/clients/insights.cjs +8 -0
- package/clients/insights.d.cts +10 -0
- package/clients/insights.d.ts +10 -0
- package/clients/insights.js +8 -0
- package/clients/n8n-package.cjs +8 -0
- package/clients/n8n-package.d.cts +11 -0
- package/clients/n8n-package.d.ts +11 -0
- package/clients/n8n-package.js +8 -0
- package/clients/project.cjs +22 -0
- package/clients/project.d.cts +11 -0
- package/clients/project.d.ts +11 -0
- package/clients/project.js +22 -0
- package/clients/source-control.cjs +8 -0
- package/clients/source-control.d.cts +10 -0
- package/clients/source-control.d.ts +10 -0
- package/clients/source-control.js +8 -0
- package/clients/tag.cjs +10 -0
- package/clients/tag.d.cts +6 -0
- package/clients/tag.d.ts +6 -0
- package/clients/tag.js +10 -0
- package/clients/user.cjs +10 -0
- package/clients/user.d.cts +6 -0
- package/clients/user.d.ts +6 -0
- package/clients/user.js +10 -0
- package/clients/variable.cjs +12 -0
- package/clients/variable.d.cts +6 -0
- package/clients/variable.d.ts +6 -0
- package/clients/variable.js +12 -0
- package/clients/workflow.cjs +14 -0
- package/clients/workflow.d.cts +7 -0
- package/clients/workflow.d.ts +7 -0
- package/clients/workflow.js +14 -0
- package/community-package-CyzAqqwH.d.ts +26 -0
- package/community-package-DBpReCPV.d.cts +26 -0
- package/credential-BWcrGfqd.d.ts +34 -0
- package/credential-CEH7XbGn.d.cts +34 -0
- package/data-table-CHGUClGF.d.ts +60 -0
- package/data-table-CzR5kl9T.d.cts +60 -0
- package/execution-BjR6z5Vu.d.ts +33 -0
- package/execution-C0c9utwa.d.cts +33 -0
- package/folder-DvgIxSea.d.cts +31 -0
- package/folder-bjRPcy2j.d.ts +31 -0
- package/http-client.cjs +2 -2
- package/http-client.d.cts +6 -18
- package/http-client.d.ts +6 -18
- package/http-client.js +1 -1
- package/index.cjs +86 -44
- package/index.d.cts +48 -46
- package/index.d.ts +48 -46
- package/index.js +100 -58
- package/package.json +16 -16
- package/project-BS1fXSLW.d.cts +94 -0
- package/project-uws9k24H.d.ts +94 -0
- package/resources/base.cjs +7 -0
- package/resources/base.d.cts +11 -0
- package/resources/base.d.ts +11 -0
- package/resources/base.js +7 -0
- package/resources/community-package.cjs +8 -0
- package/resources/community-package.d.cts +6 -0
- package/resources/community-package.d.ts +6 -0
- package/resources/community-package.js +8 -0
- package/resources/credential.cjs +8 -0
- package/resources/credential.d.cts +6 -0
- package/resources/credential.d.ts +6 -0
- package/resources/credential.js +8 -0
- package/resources/data-table.cjs +8 -0
- package/resources/data-table.d.cts +6 -0
- package/resources/data-table.d.ts +6 -0
- package/resources/data-table.js +8 -0
- package/resources/execution.cjs +8 -0
- package/resources/execution.d.cts +6 -0
- package/resources/execution.d.ts +6 -0
- package/resources/execution.js +8 -0
- package/resources/folder.cjs +8 -0
- package/resources/folder.d.cts +6 -0
- package/resources/folder.d.ts +6 -0
- package/resources/folder.js +8 -0
- package/resources/project.cjs +11 -0
- package/resources/project.d.cts +11 -0
- package/resources/project.d.ts +11 -0
- package/resources/project.js +11 -0
- package/resources/tag.cjs +8 -0
- package/resources/tag.d.cts +6 -0
- package/resources/tag.d.ts +6 -0
- package/resources/tag.js +8 -0
- package/resources/user.cjs +8 -0
- package/resources/user.d.cts +6 -0
- package/resources/user.d.ts +6 -0
- package/resources/user.js +8 -0
- package/resources/variable.cjs +8 -0
- package/resources/variable.d.cts +6 -0
- package/resources/variable.d.ts +6 -0
- package/resources/variable.js +8 -0
- package/resources/workflow.cjs +10 -0
- package/resources/workflow.d.cts +7 -0
- package/resources/workflow.d.ts +7 -0
- package/resources/workflow.js +10 -0
- package/tag-CzazpR40.d.cts +27 -0
- package/tag-lmf8obZe.d.ts +27 -0
- package/types.d.cts +201 -55
- package/types.d.ts +201 -55
- package/user-B0WdVahA.d.ts +27 -0
- package/user-CBa2VjYj.d.cts +27 -0
- package/variable-C2LmlaTx.d.ts +29 -0
- package/variable-CuCiwy0G.d.cts +29 -0
- package/workflow-8pMj_fR_.d.ts +56 -0
- package/workflow-B2nxUmWq.d.cts +56 -0
- package/chunk-3SBD4UJS.js +0 -15
- package/chunk-4AODYIOB.cjs +0 -36
- package/chunk-4FXZT5HT.js +0 -27
- package/chunk-5FIB7YIT.js +0 -24
- package/chunk-5PHEDSSO.cjs +0 -27
- package/chunk-5SY4KM4Q.js +0 -15
- package/chunk-BWLFUF76.js +0 -36
- package/chunk-CES6KIG5.cjs +0 -36
- package/chunk-DJCG37LZ.js +0 -32
- package/chunk-FHAZIAHR.js +0 -15
- package/chunk-FZX275Y3.js +0 -24
- package/chunk-JR7A75YV.js +0 -15
- package/chunk-M7GX3MEN.cjs +0 -15
- package/chunk-NAZ5MLBL.cjs +0 -32
- package/chunk-NM6A7DX4.cjs +0 -15
- package/chunk-NSCKTOQK.cjs +0 -15
- package/chunk-OOMGKLOT.cjs +0 -24
- package/chunk-QLAAM7TG.cjs +0 -27
- package/chunk-QYAIEIF5.js +0 -36
- package/chunk-RATHO5IW.cjs +0 -15
- package/chunk-SK4VCTMD.js +0 -27
- package/chunk-U7PGEXKS.cjs +0 -36
- package/chunk-ZAZJHB3O.cjs +0 -24
- package/chunk-ZEQL5KU2.js +0 -36
- package/handles/audit.cjs +0 -7
- package/handles/audit.d.cts +0 -11
- package/handles/audit.d.ts +0 -11
- package/handles/audit.js +0 -7
- package/handles/community-package.cjs +0 -7
- package/handles/community-package.d.cts +0 -17
- package/handles/community-package.d.ts +0 -17
- package/handles/community-package.js +0 -7
- package/handles/credential.cjs +0 -7
- package/handles/credential.d.cts +0 -18
- package/handles/credential.d.ts +0 -18
- package/handles/credential.js +0 -7
- package/handles/data-table.cjs +0 -7
- package/handles/data-table.d.cts +0 -38
- package/handles/data-table.d.ts +0 -38
- package/handles/data-table.js +0 -7
- package/handles/discover.cjs +0 -7
- package/handles/discover.d.cts +0 -15
- package/handles/discover.d.ts +0 -15
- package/handles/discover.js +0 -7
- package/handles/execution.cjs +0 -7
- package/handles/execution.d.cts +0 -29
- package/handles/execution.d.ts +0 -29
- package/handles/execution.js +0 -7
- package/handles/folder.cjs +0 -7
- package/handles/folder.d.cts +0 -23
- package/handles/folder.d.ts +0 -23
- package/handles/folder.js +0 -7
- package/handles/insights.cjs +0 -7
- package/handles/insights.d.cts +0 -15
- package/handles/insights.d.ts +0 -15
- package/handles/insights.js +0 -7
- package/handles/n8n-package.cjs +0 -7
- package/handles/n8n-package.d.cts +0 -18
- package/handles/n8n-package.d.ts +0 -18
- package/handles/n8n-package.js +0 -7
- package/handles/project.cjs +0 -7
- package/handles/project.d.cts +0 -25
- package/handles/project.d.ts +0 -25
- package/handles/project.js +0 -7
- package/handles/source-control.cjs +0 -7
- package/handles/source-control.d.cts +0 -11
- package/handles/source-control.d.ts +0 -11
- package/handles/source-control.js +0 -7
- package/handles/tag.cjs +0 -7
- package/handles/tag.d.cts +0 -19
- package/handles/tag.d.ts +0 -19
- package/handles/tag.js +0 -7
- package/handles/user.cjs +0 -7
- package/handles/user.d.cts +0 -21
- package/handles/user.d.ts +0 -21
- package/handles/user.js +0 -7
- package/handles/variable.cjs +0 -7
- package/handles/variable.d.cts +0 -17
- package/handles/variable.d.ts +0 -17
- package/handles/variable.js +0 -7
- package/handles/workflow.cjs +0 -7
- package/handles/workflow.d.cts +0 -35
- package/handles/workflow.d.ts +0 -35
- package/handles/workflow.js +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
## [0.
|
|
1
|
+
## [0.2.0](https://github.com/egose/n8n-client/compare/v0.1.2...v0.2.0) (2026-06-13)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **website:** add bound resource clients and resource helpers across website API ([06929b2](https://github.com/egose/n8n-client/commit/06929b242b5bca3d81b2a2ffc5b3a54dca127121))
|
|
6
|
+
* **website:** rename resource handles to clients and update factory methods ([cd551cc](https://github.com/egose/n8n-client/commit/cd551cc860cbc0ee3a1b8fbb28985a56704f0c77))
|
|
7
|
+
|
|
8
|
+
### Docs
|
|
9
|
+
|
|
10
|
+
* **website:** document raw versus resource client usage patterns ([1015838](https://github.com/egose/n8n-client/commit/101583834502dd253d705dc5dcad55c4ad68d9d8))
|
|
11
|
+
* **website:** refresh website docs and examples for client naming ([bf646e5](https://github.com/egose/n8n-client/commit/bf646e51b3c95f3e7a94414a8196e1336e2f9037))
|
|
12
|
+
|
|
13
|
+
## [0.1.2](https://github.com/egose/n8n-client/compare/v0.1.1...v0.1.2) (2026-06-13)
|
|
14
|
+
|
|
15
|
+
### Docs
|
|
16
|
+
|
|
17
|
+
* **website:** update api reference and project documentation ([8eb8e1d](https://github.com/egose/n8n-client/commit/8eb8e1dab71a2cf077cf35dc3d88c8b1f580f3cd))
|
|
18
|
+
|
|
19
|
+
### Refactors
|
|
20
|
+
|
|
21
|
+
* **website:** introduce base handle and refine api types ([33202cf](https://github.com/egose/n8n-client/commit/33202cf3bf58a4c3b0d80df81079fe14bcab4fda))
|
|
2
22
|
|
|
3
23
|
## [0.1.0](https://github.com/egose/n8n-client/compare/af6753477e8559b1324897e2af7f99772846a4a2...v0.1.0) (2026-06-11)
|
|
4
24
|
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
<p align="center">
|
|
15
|
-
TypeScript client for the n8n Public API with cursor-based pagination and typed resource
|
|
15
|
+
TypeScript client for the n8n Public API with cursor-based pagination and typed resource clients.
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
|
|
26
26
|
## What It Is
|
|
27
27
|
|
|
28
|
-
`@egose/n8n-client` provides a TypeScript client for the [n8n Public API](https://docs.n8n.io/api/). Instead of manually constructing HTTP requests and parsing responses, you work through resource
|
|
28
|
+
`@egose/n8n-client` provides a TypeScript client for the [n8n Public API](https://docs.n8n.io/api/). Instead of manually constructing HTTP requests and parsing responses, you work through resource clients:
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
31
|
const client = new N8nClient({ baseUrl: 'http://localhost:5678', apiKey: 'your-api-key' }); // pragma: allowlist secret
|
|
32
32
|
|
|
33
|
-
const workflows = await client.
|
|
34
|
-
const workflow = await client.
|
|
35
|
-
const executions = await client.
|
|
33
|
+
const workflows = await client.workflows().list({ limit: 10 });
|
|
34
|
+
const workflow = await client.workflows().get('wf-1');
|
|
35
|
+
const executions = await client.executions().list({ workflowId: 'wf-1', status: 'success' });
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
## Why Use It
|
|
@@ -40,7 +40,7 @@ const executions = await client.execution().list({ workflowId: 'wf-1', status: '
|
|
|
40
40
|
- Typed request/response objects for all n8n API endpoints
|
|
41
41
|
- Cursor-based pagination built in
|
|
42
42
|
- Automatic retry on transient server errors (5xx, 429, 408)
|
|
43
|
-
- Consistent resource
|
|
43
|
+
- Consistent resource client pattern across all resource types
|
|
44
44
|
- Supports both API key and Bearer token authentication
|
|
45
45
|
|
|
46
46
|
## Installation
|
|
@@ -64,38 +64,46 @@ const client = new N8nClient({
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
// List workflows
|
|
67
|
-
const { data: workflows, nextCursor } = await client.
|
|
67
|
+
const { data: workflows, nextCursor } = await client.workflows().list({ limit: 10 });
|
|
68
68
|
|
|
69
69
|
// Create a workflow
|
|
70
|
-
const workflow = await client.
|
|
70
|
+
const workflow = await client.workflows().create({
|
|
71
71
|
name: 'My Workflow',
|
|
72
72
|
nodes: [{ name: 'Start', type: 'n8n-nodes-base.start', position: [250, 300] }],
|
|
73
73
|
connections: {},
|
|
74
|
+
settings: {},
|
|
74
75
|
});
|
|
75
76
|
|
|
76
77
|
// Activate it
|
|
77
|
-
await client.
|
|
78
|
+
await client.workflows().activate(workflow.id);
|
|
78
79
|
|
|
79
80
|
// List executions
|
|
80
|
-
const { data: executions } = await client.
|
|
81
|
+
const { data: executions } = await client.executions().list({ workflowId: workflow.id });
|
|
81
82
|
|
|
82
83
|
// Create a credential
|
|
83
|
-
const credential = await client.
|
|
84
|
+
const credential = await client.credentials().create({
|
|
84
85
|
name: 'My GitHub Token',
|
|
85
86
|
type: 'githubApi',
|
|
86
87
|
data: { accessToken: 'ghp_xxx' },
|
|
87
88
|
});
|
|
88
89
|
|
|
89
90
|
// Test the credential
|
|
90
|
-
const testResult = await client.
|
|
91
|
+
const testResult = await client.credentials().test(credential.id);
|
|
91
92
|
|
|
92
93
|
// Manage tags
|
|
93
|
-
const tag = await client.
|
|
94
|
-
await client.
|
|
94
|
+
const tag = await client.tags().create({ name: 'production' });
|
|
95
|
+
await client.workflows().updateTags(workflow.id, [{ id: tag.id }]);
|
|
95
96
|
|
|
96
97
|
// Manage projects
|
|
97
|
-
const projects = await client.
|
|
98
|
-
await client.
|
|
98
|
+
const projects = await client.projects().list();
|
|
99
|
+
await client.projects().addMembers(projects.data[0].id, [{ userId: 'user-1', role: 'project:editor' }]);
|
|
100
|
+
|
|
101
|
+
// Opt into bound resource objects when you want instance methods
|
|
102
|
+
const project = await client.projects().getResource(projects.data[0].id);
|
|
103
|
+
await project.update({ name: 'Production' });
|
|
104
|
+
|
|
105
|
+
const workflow = await client.workflows().getResource('wf-1');
|
|
106
|
+
await workflow.activate();
|
|
99
107
|
|
|
100
108
|
// Insights
|
|
101
109
|
const summary = await client.insights().getSummary({
|
|
@@ -126,12 +134,131 @@ const client = new N8nClient({
|
|
|
126
134
|
});
|
|
127
135
|
```
|
|
128
136
|
|
|
129
|
-
## Resource
|
|
137
|
+
## Resource Clients
|
|
138
|
+
|
|
139
|
+
Raw collection methods like `list()` and `get()` return plain API response objects.
|
|
140
|
+
|
|
141
|
+
Opt into bound resource objects when you want instance methods:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
const project = await client.projects().getResource('proj-1');
|
|
145
|
+
await project.update({ name: 'Ops' });
|
|
146
|
+
|
|
147
|
+
const workflows = await project.workflows().listResources();
|
|
148
|
+
await workflows.data[0]?.archive();
|
|
149
|
+
|
|
150
|
+
const folders = await project.folders().listResources({ take: '10' });
|
|
151
|
+
await folders.data[0]?.update({ name: 'Archived Workflows' });
|
|
152
|
+
|
|
153
|
+
const renamedFolder = await project.folders().updateResource('folder-id', { name: 'Archived Workflows' });
|
|
154
|
+
|
|
155
|
+
await project.variables().create({ key: 'API_URL', value: 'https://example.com' });
|
|
156
|
+
|
|
157
|
+
const createdWorkflow = await project.workflows().create({
|
|
158
|
+
name: 'Sync',
|
|
159
|
+
nodes: [],
|
|
160
|
+
connections: {},
|
|
161
|
+
settings: {},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const createdFolder = await project.folders().create({ name: 'Operations' });
|
|
165
|
+
|
|
166
|
+
const table = await project.dataTables().createResource({
|
|
167
|
+
name: 'Users',
|
|
168
|
+
columns: [{ name: 'email', type: 'string' }],
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
await table.createColumn({ name: 'active', type: 'boolean' });
|
|
172
|
+
|
|
173
|
+
const recentRuns = await project.executions().listResources({ limit: 10, status: 'success' });
|
|
174
|
+
await recentRuns.data[0]?.getTags();
|
|
175
|
+
|
|
176
|
+
const workflowResource = await client.workflows().getResource('wf-1');
|
|
177
|
+
const workflowRuns = await workflowResource.executions().listResources({ limit: 10 });
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Nested collections follow the same pairing pattern when the API can support it:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const rawWorkflow = await project.workflows().get('wf-1');
|
|
184
|
+
const workflowResource = await project.workflows().getResource('wf-1');
|
|
185
|
+
|
|
186
|
+
const rawFolder = await project.folders().update('folder-id', { name: 'Archive' });
|
|
187
|
+
const folderResource = await project.folders().updateResource('folder-id', { name: 'Archive' });
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The same rule applies at the top-level clients: use `get()` for raw API objects and `getResource()` for bound instances.
|
|
191
|
+
|
|
192
|
+
The current resource layer covers projects, workflows, credentials, folders, tags, and users:
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
const credential = await client.credentials().getResource('cred-1');
|
|
196
|
+
await credential.test();
|
|
197
|
+
|
|
198
|
+
const folder = await client.folders('proj-1').getResource('folder-1');
|
|
199
|
+
await folder.update({ name: 'Archived Workflows' });
|
|
200
|
+
|
|
201
|
+
const user = await client.users().getResource('user-1', { includeRole: true });
|
|
202
|
+
await user.changeRole('global:admin');
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
It also includes resources for executions, variables, and data tables:
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
const execution = await client.executions().getResource(42, { includeData: true });
|
|
209
|
+
await execution.stop();
|
|
210
|
+
|
|
211
|
+
const variable = await client.variables().getResource('var-1');
|
|
212
|
+
await variable.update({ key: 'API_URL', value: 'https://example.com' });
|
|
213
|
+
|
|
214
|
+
const dataTable = await client.dataTables().createResource({
|
|
215
|
+
name: 'Users',
|
|
216
|
+
columns: [{ name: 'email', type: 'string' }],
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
await dataTable.createColumn({ name: 'active', type: 'boolean' });
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Community packages use install/uninstall terminology instead of create/delete:
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
const pkg = await client.communityPackages().installResource({
|
|
226
|
+
name: 'n8n-nodes-foo',
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
await pkg.update({ version: '2.0.0' });
|
|
230
|
+
await pkg.uninstall();
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
When the create endpoint returns the created entity, the client also exposes `createResource()`:
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
const workflow = await client.workflows().createResource({
|
|
237
|
+
name: 'Sync',
|
|
238
|
+
nodes: [],
|
|
239
|
+
connections: {},
|
|
240
|
+
settings: {},
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
const credential = await client.credentials().createResource({
|
|
244
|
+
name: 'Internal API Token',
|
|
245
|
+
type: 'httpHeaderAuth',
|
|
246
|
+
data: { name: 'Authorization', value: 'Bearer token' },
|
|
247
|
+
});
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Rule of thumb:
|
|
251
|
+
|
|
252
|
+
- `create()` mirrors the underlying API/client return type
|
|
253
|
+
- `createResource()` returns a bound resource instance when the API returns the created entity
|
|
254
|
+
- `updateResource()` returns a bound resource instance when the updated result can be represented honestly, either from the update response itself or from a verified follow-up fetch
|
|
255
|
+
|
|
256
|
+
`projects().createResource()` is intentionally not available because `POST /projects` returns no entity or identifier.
|
|
130
257
|
|
|
131
258
|
### Workflow
|
|
132
259
|
|
|
133
260
|
```ts
|
|
134
|
-
const workflowApi = client.
|
|
261
|
+
const workflowApi = client.workflows();
|
|
135
262
|
|
|
136
263
|
// List with filters
|
|
137
264
|
const { data, nextCursor } = await workflowApi.list({
|
|
@@ -144,8 +271,15 @@ const { data, nextCursor } = await workflowApi.list({
|
|
|
144
271
|
|
|
145
272
|
// CRUD
|
|
146
273
|
const workflow = await workflowApi.get('wf-1');
|
|
147
|
-
const
|
|
274
|
+
const workflowResource = await workflowApi.getResource('wf-1');
|
|
275
|
+
const created = await workflowApi.create({ name: 'New', nodes: [], connections: {}, settings: {} });
|
|
148
276
|
const updated = await workflowApi.update('wf-1', { name: 'Updated' });
|
|
277
|
+
const updatedResource = await workflowApi.updateResource('wf-1', {
|
|
278
|
+
name: 'Updated Again',
|
|
279
|
+
nodes: [],
|
|
280
|
+
connections: {},
|
|
281
|
+
settings: {},
|
|
282
|
+
});
|
|
149
283
|
await workflowApi.delete('wf-1');
|
|
150
284
|
|
|
151
285
|
// Actions
|
|
@@ -161,12 +295,15 @@ await workflowApi.updateTags('wf-1', [{ id: 'tag-1' }]);
|
|
|
161
295
|
|
|
162
296
|
// Versioning
|
|
163
297
|
const version = await workflowApi.getVersion('wf-1', 'v-1');
|
|
298
|
+
|
|
299
|
+
// Nested executions
|
|
300
|
+
const runs = await workflowResource.executions().listResources({ limit: 10 });
|
|
164
301
|
```
|
|
165
302
|
|
|
166
303
|
### Execution
|
|
167
304
|
|
|
168
305
|
```ts
|
|
169
|
-
const executionApi = client.
|
|
306
|
+
const executionApi = client.executions();
|
|
170
307
|
|
|
171
308
|
const { data } = await executionApi.list({ status: 'success', workflowId: 'wf-1' });
|
|
172
309
|
const execution = await executionApi.get(1, { includeData: true });
|
|
@@ -182,7 +319,7 @@ await executionApi.updateTags(1, [{ id: 'tag-1' }]);
|
|
|
182
319
|
### Credential
|
|
183
320
|
|
|
184
321
|
```ts
|
|
185
|
-
const credentialApi = client.
|
|
322
|
+
const credentialApi = client.credentials();
|
|
186
323
|
|
|
187
324
|
const { data } = await credentialApi.list({ limit: 10 });
|
|
188
325
|
const credential = await credentialApi.get('c-1');
|
|
@@ -192,6 +329,7 @@ const created = await credentialApi.create({
|
|
|
192
329
|
data: { accessToken: 'ghp_xxx' },
|
|
193
330
|
});
|
|
194
331
|
const updated = await credentialApi.update('c-1', { name: 'GitHub Updated' });
|
|
332
|
+
const updatedResource = await credentialApi.updateResource('c-1', { name: 'GitHub Updated Again' });
|
|
195
333
|
await credentialApi.delete('c-1');
|
|
196
334
|
await credentialApi.test('c-1');
|
|
197
335
|
await credentialApi.transfer('c-1', 'proj-2');
|
|
@@ -201,19 +339,20 @@ const schema = await credentialApi.getSchema('githubApi');
|
|
|
201
339
|
### Tag
|
|
202
340
|
|
|
203
341
|
```ts
|
|
204
|
-
const tagApi = client.
|
|
342
|
+
const tagApi = client.tags();
|
|
205
343
|
|
|
206
344
|
const { data } = await tagApi.list({ limit: 10 });
|
|
207
345
|
const tag = await tagApi.get('t-1');
|
|
208
346
|
const created = await tagApi.create({ name: 'production' });
|
|
209
347
|
const updated = await tagApi.update('t-1', { name: 'prod' });
|
|
348
|
+
const updatedResource = await tagApi.updateResource('t-1', { name: 'production' });
|
|
210
349
|
await tagApi.delete('t-1');
|
|
211
350
|
```
|
|
212
351
|
|
|
213
352
|
### User
|
|
214
353
|
|
|
215
354
|
```ts
|
|
216
|
-
const userApi = client.
|
|
355
|
+
const userApi = client.users();
|
|
217
356
|
|
|
218
357
|
const { data } = await userApi.list({ limit: 10 });
|
|
219
358
|
const user = await userApi.get('u-1');
|
|
@@ -225,7 +364,7 @@ await userApi.changeRole('u-1', 'global:admin');
|
|
|
225
364
|
### Variable
|
|
226
365
|
|
|
227
366
|
```ts
|
|
228
|
-
const variableApi = client.
|
|
367
|
+
const variableApi = client.variables();
|
|
229
368
|
|
|
230
369
|
const { data } = await variableApi.list({ projectId: 'proj-1' });
|
|
231
370
|
await variableApi.create({ key: 'MY_VAR', value: 'hello', projectId: 'proj-1' });
|
|
@@ -236,7 +375,7 @@ await variableApi.delete('v-1');
|
|
|
236
375
|
### Project
|
|
237
376
|
|
|
238
377
|
```ts
|
|
239
|
-
const projectApi = client.
|
|
378
|
+
const projectApi = client.projects();
|
|
240
379
|
|
|
241
380
|
const { data } = await projectApi.list({ limit: 10 });
|
|
242
381
|
await projectApi.create({ name: 'New Project' });
|
|
@@ -253,7 +392,7 @@ await projectApi.removeMember('p-1', 'u-1');
|
|
|
253
392
|
### DataTable
|
|
254
393
|
|
|
255
394
|
```ts
|
|
256
|
-
const dataTableApi = client.
|
|
395
|
+
const dataTableApi = client.dataTables();
|
|
257
396
|
|
|
258
397
|
const { data } = await dataTableApi.list({ limit: 10 });
|
|
259
398
|
const table = await dataTableApi.get('dt-1');
|
|
@@ -265,6 +404,7 @@ const created = await dataTableApi.create({
|
|
|
265
404
|
],
|
|
266
405
|
});
|
|
267
406
|
await dataTableApi.update('dt-1', { name: 'Users Updated' });
|
|
407
|
+
const updatedTable = await dataTableApi.updateResource('dt-1', { name: 'Users Final' });
|
|
268
408
|
await dataTableApi.delete('dt-1');
|
|
269
409
|
|
|
270
410
|
// Rows
|
|
@@ -281,23 +421,25 @@ await dataTableApi.deleteColumn('dt-1', 'col-1');
|
|
|
281
421
|
### Folder
|
|
282
422
|
|
|
283
423
|
```ts
|
|
284
|
-
const folderApi = client.
|
|
424
|
+
const folderApi = client.folders('proj-1');
|
|
285
425
|
|
|
286
426
|
const { data } = await folderApi.list({ take: '10' });
|
|
287
427
|
const folder = await folderApi.get('f-1');
|
|
288
428
|
const created = await folderApi.create({ name: 'My Folder' });
|
|
289
429
|
const updated = await folderApi.update('f-1', { name: 'Renamed' });
|
|
430
|
+
const updatedResource = await folderApi.updateResource('f-1', { name: 'Renamed Again' });
|
|
290
431
|
await folderApi.delete('f-1', 'f-2'); // transfer contents to f-2
|
|
291
432
|
```
|
|
292
433
|
|
|
293
434
|
### Community Package
|
|
294
435
|
|
|
295
436
|
```ts
|
|
296
|
-
const pkgApi = client.
|
|
437
|
+
const pkgApi = client.communityPackages();
|
|
297
438
|
|
|
298
439
|
const packages = await pkgApi.list();
|
|
299
440
|
const installed = await pkgApi.install({ name: 'n8n-nodes-foo' });
|
|
300
441
|
await pkgApi.update('n8n-nodes-foo', { version: '2.0.0' });
|
|
442
|
+
const updatedResource = await pkgApi.updateResource('n8n-nodes-foo', { version: '2.1.0' });
|
|
301
443
|
await pkgApi.uninstall('n8n-nodes-foo');
|
|
302
444
|
```
|
|
303
445
|
|
|
@@ -340,7 +482,7 @@ const capabilities = await client.discover().get({ include: 'schemas' });
|
|
|
340
482
|
import { HttpError } from '@egose/n8n-client';
|
|
341
483
|
|
|
342
484
|
try {
|
|
343
|
-
await client.
|
|
485
|
+
await client.workflows().get('nonexistent');
|
|
344
486
|
} catch (error) {
|
|
345
487
|
if (error instanceof HttpError) {
|
|
346
488
|
console.log(error.status); // 404
|
|
@@ -356,23 +498,23 @@ Transient errors (408, 429, 5xx) are automatically retried up to 3 times with ex
|
|
|
356
498
|
|
|
357
499
|
### N8nClient
|
|
358
500
|
|
|
359
|
-
| Method
|
|
360
|
-
|
|
|
361
|
-
| `
|
|
362
|
-
| `
|
|
363
|
-
| `
|
|
364
|
-
| `
|
|
365
|
-
| `
|
|
366
|
-
| `
|
|
367
|
-
| `
|
|
368
|
-
| `
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `audit()`
|
|
372
|
-
| `insights()`
|
|
373
|
-
| `sourceControl()`
|
|
374
|
-
| `discover()`
|
|
375
|
-
| `n8nPackage()`
|
|
501
|
+
| Method | Returns | Description |
|
|
502
|
+
| --------------------- | ------------------------ | ------------------------------------------------ |
|
|
503
|
+
| `workflows()` | `WorkflowClient` | Workflow CRUD + activate/deactivate/archive/tags |
|
|
504
|
+
| `executions()` | `ExecutionClient` | Execution list/get/delete/retry/stop/tags |
|
|
505
|
+
| `credentials()` | `CredentialClient` | Credential CRUD + test/transfer/schema |
|
|
506
|
+
| `tags()` | `TagClient` | Tag CRUD |
|
|
507
|
+
| `users()` | `UserClient` | User list/get/create/delete/changeRole |
|
|
508
|
+
| `variables()` | `VariableClient` | Variable CRUD |
|
|
509
|
+
| `projects()` | `ProjectClient` | Project CRUD + member management |
|
|
510
|
+
| `dataTables()` | `DataTableClient` | DataTable CRUD + rows/columns |
|
|
511
|
+
| `folders(projectId)` | `FolderClient` | Folder CRUD scoped to project |
|
|
512
|
+
| `communityPackages()` | `CommunityPackageClient` | Package install/update/uninstall |
|
|
513
|
+
| `audit()` | `AuditClient` | Generate security audit |
|
|
514
|
+
| `insights()` | `InsightsClient` | Execution insights summary |
|
|
515
|
+
| `sourceControl()` | `SourceControlClient` | Git-based source control pull |
|
|
516
|
+
| `discover()` | `DiscoverClient` | API capability discovery |
|
|
517
|
+
| `n8nPackage()` | `N8nPackageClient` | Package export/import (beta) |
|
|
376
518
|
|
|
377
519
|
## Documentation
|
|
378
520
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseResource
|
|
3
|
+
} from "./chunk-TLBDBRPJ.js";
|
|
4
|
+
|
|
5
|
+
// src/resources/variable.ts
|
|
6
|
+
var VariableResource = class extends BaseResource {
|
|
7
|
+
constructor(variables, variable, params) {
|
|
8
|
+
super(variable);
|
|
9
|
+
this.variables = variables;
|
|
10
|
+
this.params = params;
|
|
11
|
+
}
|
|
12
|
+
variables;
|
|
13
|
+
params;
|
|
14
|
+
get id() {
|
|
15
|
+
return this.data.id;
|
|
16
|
+
}
|
|
17
|
+
get key() {
|
|
18
|
+
return this.data.key;
|
|
19
|
+
}
|
|
20
|
+
get value() {
|
|
21
|
+
return this.data.value;
|
|
22
|
+
}
|
|
23
|
+
async refresh() {
|
|
24
|
+
return this.replaceSnapshot((await this.variables.getResource(this.id, this.params)).data);
|
|
25
|
+
}
|
|
26
|
+
async update(data) {
|
|
27
|
+
await this.variables.update(this.id, data);
|
|
28
|
+
return this.mergeSnapshot(data);
|
|
29
|
+
}
|
|
30
|
+
async delete() {
|
|
31
|
+
await this.variables.delete(this.id);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
VariableResource
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=chunk-2R6A6NJE.js.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ProjectResource
|
|
3
|
+
} from "./chunk-LTYQTCHM.js";
|
|
4
|
+
import {
|
|
5
|
+
VariableClient
|
|
6
|
+
} from "./chunk-HISH4ORK.js";
|
|
7
|
+
import {
|
|
8
|
+
WorkflowClient
|
|
9
|
+
} from "./chunk-54N6YD4R.js";
|
|
10
|
+
import {
|
|
11
|
+
DataTableClient
|
|
12
|
+
} from "./chunk-BQ2OTUXQ.js";
|
|
13
|
+
import {
|
|
14
|
+
ExecutionClient
|
|
15
|
+
} from "./chunk-C6W6ERQD.js";
|
|
16
|
+
import {
|
|
17
|
+
FolderClient
|
|
18
|
+
} from "./chunk-5DDMSYH2.js";
|
|
19
|
+
import {
|
|
20
|
+
HttpError
|
|
21
|
+
} from "./chunk-RMEH2UPX.js";
|
|
22
|
+
import {
|
|
23
|
+
BaseClient
|
|
24
|
+
} from "./chunk-Q6FSREKN.js";
|
|
25
|
+
|
|
26
|
+
// src/clients/project.ts
|
|
27
|
+
var ProjectClient = class extends BaseClient {
|
|
28
|
+
async list(params) {
|
|
29
|
+
return this.http.get("/projects", params);
|
|
30
|
+
}
|
|
31
|
+
async getResource(id) {
|
|
32
|
+
const project = await this.findProject(id);
|
|
33
|
+
if (!project) {
|
|
34
|
+
throw new HttpError(404, `Project not found: ${id}`, { id });
|
|
35
|
+
}
|
|
36
|
+
return this.createResource(project);
|
|
37
|
+
}
|
|
38
|
+
async listResources(params) {
|
|
39
|
+
const response = await this.list(params);
|
|
40
|
+
return {
|
|
41
|
+
data: response.data.map((project) => this.createResource(project)),
|
|
42
|
+
nextCursor: response.nextCursor
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
async create(data) {
|
|
46
|
+
await this.http.post("/projects", data);
|
|
47
|
+
}
|
|
48
|
+
async update(id, data) {
|
|
49
|
+
await this.http.put(`/projects/${id}`, data);
|
|
50
|
+
}
|
|
51
|
+
async delete(id) {
|
|
52
|
+
await this.http.delete(`/projects/${id}`);
|
|
53
|
+
}
|
|
54
|
+
async listMembers(projectId, params) {
|
|
55
|
+
return this.http.get(`/projects/${projectId}/users`, params);
|
|
56
|
+
}
|
|
57
|
+
async addMembers(projectId, relations) {
|
|
58
|
+
await this.http.post(`/projects/${projectId}/users`, { relations });
|
|
59
|
+
}
|
|
60
|
+
async removeMember(projectId, userId) {
|
|
61
|
+
await this.http.delete(`/projects/${projectId}/users/${userId}`);
|
|
62
|
+
}
|
|
63
|
+
async changeMemberRole(projectId, userId, role) {
|
|
64
|
+
const data = { role };
|
|
65
|
+
await this.http.patch(`/projects/${projectId}/users/${userId}`, data);
|
|
66
|
+
}
|
|
67
|
+
createResource(project) {
|
|
68
|
+
return new ProjectResource(
|
|
69
|
+
this,
|
|
70
|
+
new WorkflowClient(this.http),
|
|
71
|
+
new FolderClient(this.http, project.id),
|
|
72
|
+
new VariableClient(this.http),
|
|
73
|
+
new DataTableClient(this.http),
|
|
74
|
+
new ExecutionClient(this.http),
|
|
75
|
+
project
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
async findProject(id) {
|
|
79
|
+
let cursor;
|
|
80
|
+
do {
|
|
81
|
+
const response = await this.list(cursor ? { cursor } : void 0);
|
|
82
|
+
const project = response.data.find((entry) => entry.id === id);
|
|
83
|
+
if (project) {
|
|
84
|
+
return project;
|
|
85
|
+
}
|
|
86
|
+
cursor = response.nextCursor;
|
|
87
|
+
} while (cursor);
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
ProjectClient
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=chunk-3FDDCKAY.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkLC3TKRMXcjs = require('./chunk-LC3TKRMX.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkFIKGC2ELcjs = require('./chunk-FIKGC2EL.cjs');
|
|
7
|
+
|
|
8
|
+
// src/resources/workflow.ts
|
|
9
|
+
var WorkflowResource = class extends _chunkFIKGC2ELcjs.BaseResource {
|
|
10
|
+
constructor(workflows, executionsClient, workflow) {
|
|
11
|
+
super(workflow);
|
|
12
|
+
this.workflows = workflows;
|
|
13
|
+
this.executionsClient = executionsClient;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
get id() {
|
|
18
|
+
return this.data.id;
|
|
19
|
+
}
|
|
20
|
+
get name() {
|
|
21
|
+
return this.data.name;
|
|
22
|
+
}
|
|
23
|
+
get active() {
|
|
24
|
+
return this.data.active;
|
|
25
|
+
}
|
|
26
|
+
get isArchived() {
|
|
27
|
+
return this.data.isArchived;
|
|
28
|
+
}
|
|
29
|
+
get versionId() {
|
|
30
|
+
return this.data.versionId;
|
|
31
|
+
}
|
|
32
|
+
async update(data) {
|
|
33
|
+
return this.replaceSnapshot(await this.workflows.update(this.id, data));
|
|
34
|
+
}
|
|
35
|
+
async delete() {
|
|
36
|
+
return this.workflows.delete(this.id);
|
|
37
|
+
}
|
|
38
|
+
async activate(data) {
|
|
39
|
+
return this.replaceSnapshot(await this.workflows.activate(this.id, data));
|
|
40
|
+
}
|
|
41
|
+
async deactivate() {
|
|
42
|
+
return this.replaceSnapshot(await this.workflows.deactivate(this.id));
|
|
43
|
+
}
|
|
44
|
+
async archive() {
|
|
45
|
+
return this.replaceSnapshot(await this.workflows.archive(this.id));
|
|
46
|
+
}
|
|
47
|
+
async unarchive() {
|
|
48
|
+
return this.replaceSnapshot(await this.workflows.unarchive(this.id));
|
|
49
|
+
}
|
|
50
|
+
async transfer(destinationProjectId) {
|
|
51
|
+
await this.workflows.transfer(this.id, destinationProjectId);
|
|
52
|
+
}
|
|
53
|
+
async getTags() {
|
|
54
|
+
return this.workflows.getTags(this.id);
|
|
55
|
+
}
|
|
56
|
+
async updateTags(tags) {
|
|
57
|
+
const updatedTags = await this.workflows.updateTags(this.id, tags);
|
|
58
|
+
this.mergeSnapshot({ tags: updatedTags });
|
|
59
|
+
return updatedTags;
|
|
60
|
+
}
|
|
61
|
+
async getVersion(versionId) {
|
|
62
|
+
return this.workflows.getVersion(this.id, versionId);
|
|
63
|
+
}
|
|
64
|
+
executions() {
|
|
65
|
+
return {
|
|
66
|
+
list: (params) => this.executionsClient.list({ ...params, workflowId: this.id }),
|
|
67
|
+
listResources: (params) => this.executionsClient.listResources({ ...params, workflowId: this.id }),
|
|
68
|
+
get: async (id, params) => {
|
|
69
|
+
if (!await this.hasExecutionInWorkflow(id)) {
|
|
70
|
+
throw new (0, _chunkLC3TKRMXcjs.HttpError)(404, `Execution not found in workflow: ${id}`, { id, workflowId: this.id });
|
|
71
|
+
}
|
|
72
|
+
return this.executionsClient.get(id, params);
|
|
73
|
+
},
|
|
74
|
+
getResource: async (id, params) => {
|
|
75
|
+
if (!await this.hasExecutionInWorkflow(id)) {
|
|
76
|
+
throw new (0, _chunkLC3TKRMXcjs.HttpError)(404, `Execution not found in workflow: ${id}`, { id, workflowId: this.id });
|
|
77
|
+
}
|
|
78
|
+
return this.executionsClient.getResource(id, params);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async hasExecutionInWorkflow(id) {
|
|
83
|
+
let cursor;
|
|
84
|
+
do {
|
|
85
|
+
const response = await this.executionsClient.list({ workflowId: this.id, cursor });
|
|
86
|
+
if (response.data.some((execution) => execution.id === id)) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
cursor = response.nextCursor;
|
|
90
|
+
} while (cursor);
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
exports.WorkflowResource = WorkflowResource;
|
|
98
|
+
//# sourceMappingURL=chunk-3YWWR6UD.cjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/clients/base.ts
|
|
2
|
+
var BaseClient = class {
|
|
3
|
+
constructor(http) {
|
|
4
|
+
this.http = http;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.BaseClient = BaseClient;
|
|
12
|
+
//# sourceMappingURL=chunk-4M2HGY3F.cjs.map
|