@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.
Files changed (281) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/README.md +188 -46
  3. package/chunk-2R6A6NJE.js +38 -0
  4. package/chunk-3FDDCKAY.js +95 -0
  5. package/chunk-3YWWR6UD.cjs +98 -0
  6. package/chunk-4M2HGY3F.cjs +12 -0
  7. package/chunk-4VK7K4IF.js +29 -0
  8. package/chunk-54MX3Y2M.cjs +15 -0
  9. package/{chunk-MNL65GQB.js → chunk-54N6YD4R.js} +30 -8
  10. package/chunk-5DDMSYH2.js +54 -0
  11. package/chunk-5ZRUF6XZ.cjs +15 -0
  12. package/chunk-6JJ6RA5B.cjs +32 -0
  13. package/chunk-7H75UBMH.cjs +29 -0
  14. package/chunk-B7CINZ27.cjs +43 -0
  15. package/chunk-BA4KTRMX.cjs +15 -0
  16. package/{chunk-TCPZWXKM.js → chunk-BQ2OTUXQ.js} +27 -8
  17. package/chunk-C3JBYESS.cjs +35 -0
  18. package/chunk-C6W6ERQD.js +53 -0
  19. package/{chunk-TRHGCMFH.cjs → chunk-CCS5ALTN.cjs} +8 -8
  20. package/chunk-DTDNBA7W.cjs +59 -0
  21. package/chunk-ETVDSJLY.js +48 -0
  22. package/chunk-F5RPJMNK.js +15 -0
  23. package/chunk-FIKGC2EL.cjs +29 -0
  24. package/{chunk-YPK2BDPO.cjs → chunk-FTIVM52X.cjs} +27 -8
  25. package/chunk-GEWLPVNV.cjs +48 -0
  26. package/{chunk-I7NGIQIM.cjs → chunk-GZ3POWDP.cjs} +30 -8
  27. package/chunk-HISH4ORK.js +59 -0
  28. package/chunk-I4MMTW33.js +98 -0
  29. package/chunk-KRPRS2E5.cjs +46 -0
  30. package/chunk-L2FFL3BY.js +35 -0
  31. package/{chunk-5DYA4LAX.cjs → chunk-LC3TKRMX.cjs} +1 -1
  32. package/chunk-LQULSPET.cjs +55 -0
  33. package/chunk-LTYQTCHM.js +196 -0
  34. package/chunk-MMN2UKTI.cjs +41 -0
  35. package/chunk-NBLW25ME.cjs +67 -0
  36. package/chunk-NS2RDZ7W.js +15 -0
  37. package/chunk-OUOWDGL7.js +15 -0
  38. package/chunk-PT5DDLHC.js +46 -0
  39. package/chunk-Q6FSREKN.js +12 -0
  40. package/chunk-QJR4WFNV.js +55 -0
  41. package/{chunk-DK5NLZ6U.js → chunk-RMEH2UPX.js} +1 -1
  42. package/chunk-RPB226OX.cjs +54 -0
  43. package/chunk-S4ZASMBT.js +43 -0
  44. package/chunk-T62VHXNY.js +67 -0
  45. package/chunk-TLBDBRPJ.js +29 -0
  46. package/chunk-TY76RTXQ.cjs +32 -0
  47. package/chunk-USTEEQQG.js +43 -0
  48. package/chunk-W5P34RYO.cjs +196 -0
  49. package/chunk-XJP6FPN3.js +41 -0
  50. package/chunk-YBMEMKCN.cjs +53 -0
  51. package/chunk-YE2OS2KS.js +32 -0
  52. package/chunk-YHSDCE3I.js +32 -0
  53. package/chunk-YSWBOCXJ.cjs +38 -0
  54. package/chunk-YUCX7HE3.js +15 -0
  55. package/chunk-Z3D4URRD.cjs +43 -0
  56. package/chunk-ZIIR24GM.cjs +95 -0
  57. package/chunk-ZPU6PQES.cjs +15 -0
  58. package/{chunk-CUO2M75Z.js → chunk-ZVZIMJRM.js} +8 -8
  59. package/clients/audit.cjs +8 -0
  60. package/clients/audit.d.cts +10 -0
  61. package/clients/audit.d.ts +10 -0
  62. package/clients/audit.js +8 -0
  63. package/clients/base.cjs +7 -0
  64. package/clients/base.d.cts +10 -0
  65. package/clients/base.d.ts +10 -0
  66. package/clients/base.js +7 -0
  67. package/clients/community-package.cjs +12 -0
  68. package/clients/community-package.d.cts +6 -0
  69. package/clients/community-package.d.ts +6 -0
  70. package/clients/community-package.js +12 -0
  71. package/clients/credential.cjs +10 -0
  72. package/clients/credential.d.cts +6 -0
  73. package/clients/credential.d.ts +6 -0
  74. package/clients/credential.js +10 -0
  75. package/clients/data-table.cjs +10 -0
  76. package/clients/data-table.d.cts +6 -0
  77. package/clients/data-table.d.ts +6 -0
  78. package/clients/data-table.js +10 -0
  79. package/clients/discover.cjs +8 -0
  80. package/clients/discover.d.cts +10 -0
  81. package/clients/discover.d.ts +10 -0
  82. package/clients/discover.js +8 -0
  83. package/clients/execution.cjs +10 -0
  84. package/clients/execution.d.cts +6 -0
  85. package/clients/execution.d.ts +6 -0
  86. package/clients/execution.js +10 -0
  87. package/clients/folder.cjs +10 -0
  88. package/clients/folder.d.cts +6 -0
  89. package/clients/folder.d.ts +6 -0
  90. package/clients/folder.js +10 -0
  91. package/clients/insights.cjs +8 -0
  92. package/clients/insights.d.cts +10 -0
  93. package/clients/insights.d.ts +10 -0
  94. package/clients/insights.js +8 -0
  95. package/clients/n8n-package.cjs +8 -0
  96. package/clients/n8n-package.d.cts +11 -0
  97. package/clients/n8n-package.d.ts +11 -0
  98. package/clients/n8n-package.js +8 -0
  99. package/clients/project.cjs +22 -0
  100. package/clients/project.d.cts +11 -0
  101. package/clients/project.d.ts +11 -0
  102. package/clients/project.js +22 -0
  103. package/clients/source-control.cjs +8 -0
  104. package/clients/source-control.d.cts +10 -0
  105. package/clients/source-control.d.ts +10 -0
  106. package/clients/source-control.js +8 -0
  107. package/clients/tag.cjs +10 -0
  108. package/clients/tag.d.cts +6 -0
  109. package/clients/tag.d.ts +6 -0
  110. package/clients/tag.js +10 -0
  111. package/clients/user.cjs +10 -0
  112. package/clients/user.d.cts +6 -0
  113. package/clients/user.d.ts +6 -0
  114. package/clients/user.js +10 -0
  115. package/clients/variable.cjs +12 -0
  116. package/clients/variable.d.cts +6 -0
  117. package/clients/variable.d.ts +6 -0
  118. package/clients/variable.js +12 -0
  119. package/clients/workflow.cjs +14 -0
  120. package/clients/workflow.d.cts +7 -0
  121. package/clients/workflow.d.ts +7 -0
  122. package/clients/workflow.js +14 -0
  123. package/community-package-CyzAqqwH.d.ts +26 -0
  124. package/community-package-DBpReCPV.d.cts +26 -0
  125. package/credential-BWcrGfqd.d.ts +34 -0
  126. package/credential-CEH7XbGn.d.cts +34 -0
  127. package/data-table-CHGUClGF.d.ts +60 -0
  128. package/data-table-CzR5kl9T.d.cts +60 -0
  129. package/execution-BjR6z5Vu.d.ts +33 -0
  130. package/execution-C0c9utwa.d.cts +33 -0
  131. package/folder-DvgIxSea.d.cts +31 -0
  132. package/folder-bjRPcy2j.d.ts +31 -0
  133. package/http-client.cjs +2 -2
  134. package/http-client.d.cts +6 -18
  135. package/http-client.d.ts +6 -18
  136. package/http-client.js +1 -1
  137. package/index.cjs +86 -44
  138. package/index.d.cts +48 -46
  139. package/index.d.ts +48 -46
  140. package/index.js +100 -58
  141. package/package.json +16 -16
  142. package/project-BS1fXSLW.d.cts +94 -0
  143. package/project-uws9k24H.d.ts +94 -0
  144. package/resources/base.cjs +7 -0
  145. package/resources/base.d.cts +11 -0
  146. package/resources/base.d.ts +11 -0
  147. package/resources/base.js +7 -0
  148. package/resources/community-package.cjs +8 -0
  149. package/resources/community-package.d.cts +6 -0
  150. package/resources/community-package.d.ts +6 -0
  151. package/resources/community-package.js +8 -0
  152. package/resources/credential.cjs +8 -0
  153. package/resources/credential.d.cts +6 -0
  154. package/resources/credential.d.ts +6 -0
  155. package/resources/credential.js +8 -0
  156. package/resources/data-table.cjs +8 -0
  157. package/resources/data-table.d.cts +6 -0
  158. package/resources/data-table.d.ts +6 -0
  159. package/resources/data-table.js +8 -0
  160. package/resources/execution.cjs +8 -0
  161. package/resources/execution.d.cts +6 -0
  162. package/resources/execution.d.ts +6 -0
  163. package/resources/execution.js +8 -0
  164. package/resources/folder.cjs +8 -0
  165. package/resources/folder.d.cts +6 -0
  166. package/resources/folder.d.ts +6 -0
  167. package/resources/folder.js +8 -0
  168. package/resources/project.cjs +11 -0
  169. package/resources/project.d.cts +11 -0
  170. package/resources/project.d.ts +11 -0
  171. package/resources/project.js +11 -0
  172. package/resources/tag.cjs +8 -0
  173. package/resources/tag.d.cts +6 -0
  174. package/resources/tag.d.ts +6 -0
  175. package/resources/tag.js +8 -0
  176. package/resources/user.cjs +8 -0
  177. package/resources/user.d.cts +6 -0
  178. package/resources/user.d.ts +6 -0
  179. package/resources/user.js +8 -0
  180. package/resources/variable.cjs +8 -0
  181. package/resources/variable.d.cts +6 -0
  182. package/resources/variable.d.ts +6 -0
  183. package/resources/variable.js +8 -0
  184. package/resources/workflow.cjs +10 -0
  185. package/resources/workflow.d.cts +7 -0
  186. package/resources/workflow.d.ts +7 -0
  187. package/resources/workflow.js +10 -0
  188. package/tag-CzazpR40.d.cts +27 -0
  189. package/tag-lmf8obZe.d.ts +27 -0
  190. package/types.d.cts +201 -55
  191. package/types.d.ts +201 -55
  192. package/user-B0WdVahA.d.ts +27 -0
  193. package/user-CBa2VjYj.d.cts +27 -0
  194. package/variable-C2LmlaTx.d.ts +29 -0
  195. package/variable-CuCiwy0G.d.cts +29 -0
  196. package/workflow-8pMj_fR_.d.ts +56 -0
  197. package/workflow-B2nxUmWq.d.cts +56 -0
  198. package/chunk-3SBD4UJS.js +0 -15
  199. package/chunk-4AODYIOB.cjs +0 -36
  200. package/chunk-4FXZT5HT.js +0 -27
  201. package/chunk-5FIB7YIT.js +0 -24
  202. package/chunk-5PHEDSSO.cjs +0 -27
  203. package/chunk-5SY4KM4Q.js +0 -15
  204. package/chunk-BWLFUF76.js +0 -36
  205. package/chunk-CES6KIG5.cjs +0 -36
  206. package/chunk-DJCG37LZ.js +0 -32
  207. package/chunk-FHAZIAHR.js +0 -15
  208. package/chunk-FZX275Y3.js +0 -24
  209. package/chunk-JR7A75YV.js +0 -15
  210. package/chunk-M7GX3MEN.cjs +0 -15
  211. package/chunk-NAZ5MLBL.cjs +0 -32
  212. package/chunk-NM6A7DX4.cjs +0 -15
  213. package/chunk-NSCKTOQK.cjs +0 -15
  214. package/chunk-OOMGKLOT.cjs +0 -24
  215. package/chunk-QLAAM7TG.cjs +0 -27
  216. package/chunk-QYAIEIF5.js +0 -36
  217. package/chunk-RATHO5IW.cjs +0 -15
  218. package/chunk-SK4VCTMD.js +0 -27
  219. package/chunk-U7PGEXKS.cjs +0 -36
  220. package/chunk-ZAZJHB3O.cjs +0 -24
  221. package/chunk-ZEQL5KU2.js +0 -36
  222. package/handles/audit.cjs +0 -7
  223. package/handles/audit.d.cts +0 -11
  224. package/handles/audit.d.ts +0 -11
  225. package/handles/audit.js +0 -7
  226. package/handles/community-package.cjs +0 -7
  227. package/handles/community-package.d.cts +0 -17
  228. package/handles/community-package.d.ts +0 -17
  229. package/handles/community-package.js +0 -7
  230. package/handles/credential.cjs +0 -7
  231. package/handles/credential.d.cts +0 -18
  232. package/handles/credential.d.ts +0 -18
  233. package/handles/credential.js +0 -7
  234. package/handles/data-table.cjs +0 -7
  235. package/handles/data-table.d.cts +0 -38
  236. package/handles/data-table.d.ts +0 -38
  237. package/handles/data-table.js +0 -7
  238. package/handles/discover.cjs +0 -7
  239. package/handles/discover.d.cts +0 -15
  240. package/handles/discover.d.ts +0 -15
  241. package/handles/discover.js +0 -7
  242. package/handles/execution.cjs +0 -7
  243. package/handles/execution.d.cts +0 -29
  244. package/handles/execution.d.ts +0 -29
  245. package/handles/execution.js +0 -7
  246. package/handles/folder.cjs +0 -7
  247. package/handles/folder.d.cts +0 -23
  248. package/handles/folder.d.ts +0 -23
  249. package/handles/folder.js +0 -7
  250. package/handles/insights.cjs +0 -7
  251. package/handles/insights.d.cts +0 -15
  252. package/handles/insights.d.ts +0 -15
  253. package/handles/insights.js +0 -7
  254. package/handles/n8n-package.cjs +0 -7
  255. package/handles/n8n-package.d.cts +0 -18
  256. package/handles/n8n-package.d.ts +0 -18
  257. package/handles/n8n-package.js +0 -7
  258. package/handles/project.cjs +0 -7
  259. package/handles/project.d.cts +0 -25
  260. package/handles/project.d.ts +0 -25
  261. package/handles/project.js +0 -7
  262. package/handles/source-control.cjs +0 -7
  263. package/handles/source-control.d.cts +0 -11
  264. package/handles/source-control.d.ts +0 -11
  265. package/handles/source-control.js +0 -7
  266. package/handles/tag.cjs +0 -7
  267. package/handles/tag.d.cts +0 -19
  268. package/handles/tag.d.ts +0 -19
  269. package/handles/tag.js +0 -7
  270. package/handles/user.cjs +0 -7
  271. package/handles/user.d.cts +0 -21
  272. package/handles/user.d.ts +0 -21
  273. package/handles/user.js +0 -7
  274. package/handles/variable.cjs +0 -7
  275. package/handles/variable.d.cts +0 -17
  276. package/handles/variable.d.ts +0 -17
  277. package/handles/variable.js +0 -7
  278. package/handles/workflow.cjs +0 -7
  279. package/handles/workflow.d.cts +0 -35
  280. package/handles/workflow.d.ts +0 -35
  281. package/handles/workflow.js +0 -7
@@ -0,0 +1,48 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkTY76RTXQcjs = require('./chunk-TY76RTXQ.cjs');
4
+
5
+
6
+ var _chunkLC3TKRMXcjs = require('./chunk-LC3TKRMX.cjs');
7
+
8
+
9
+ var _chunk4M2HGY3Fcjs = require('./chunk-4M2HGY3F.cjs');
10
+
11
+ // src/clients/community-package.ts
12
+ var CommunityPackageClient = class extends _chunk4M2HGY3Fcjs.BaseClient {
13
+ async list() {
14
+ return this.http.get("/community-packages");
15
+ }
16
+ async listResources() {
17
+ const communityPackages = await this.list();
18
+ return communityPackages.map((communityPackage) => new (0, _chunkTY76RTXQcjs.CommunityPackageResource)(this, communityPackage));
19
+ }
20
+ async getResource(name) {
21
+ const communityPackages = await this.list();
22
+ const communityPackage = communityPackages.find((entry) => entry.packageName === name);
23
+ if (!communityPackage) {
24
+ throw new (0, _chunkLC3TKRMXcjs.HttpError)(404, `Community package not found: ${name}`, { name });
25
+ }
26
+ return new (0, _chunkTY76RTXQcjs.CommunityPackageResource)(this, communityPackage);
27
+ }
28
+ async install(data) {
29
+ return this.http.post("/community-packages", data);
30
+ }
31
+ async installResource(data) {
32
+ return new (0, _chunkTY76RTXQcjs.CommunityPackageResource)(this, await this.install(data));
33
+ }
34
+ async update(name, data) {
35
+ return this.http.patch(`/community-packages/${name}`, data);
36
+ }
37
+ async updateResource(name, data) {
38
+ return new (0, _chunkTY76RTXQcjs.CommunityPackageResource)(this, await this.update(name, data));
39
+ }
40
+ async uninstall(name) {
41
+ await this.http.delete(`/community-packages/${name}`);
42
+ }
43
+ };
44
+
45
+
46
+
47
+ exports.CommunityPackageClient = CommunityPackageClient;
48
+ //# sourceMappingURL=chunk-GEWLPVNV.cjs.map
@@ -1,21 +1,43 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/handles/workflow.ts
2
- var WorkflowHandle = class {
3
-
4
- constructor(http) {
5
- this.http = http;
6
- }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk3YWWR6UDcjs = require('./chunk-3YWWR6UD.cjs');
4
+
5
+
6
+ var _chunkYBMEMKCNcjs = require('./chunk-YBMEMKCN.cjs');
7
+
8
+
9
+ var _chunk4M2HGY3Fcjs = require('./chunk-4M2HGY3F.cjs');
10
+
11
+ // src/clients/workflow.ts
12
+ var WorkflowClient = class extends _chunk4M2HGY3Fcjs.BaseClient {
7
13
  async list(params) {
8
14
  return this.http.get("/workflows", params);
9
15
  }
10
16
  async get(id, params) {
11
17
  return this.http.get(`/workflows/${id}`, params);
12
18
  }
19
+ async getResource(id, params) {
20
+ return new (0, _chunk3YWWR6UDcjs.WorkflowResource)(this, new (0, _chunkYBMEMKCNcjs.ExecutionClient)(this.http), await this.get(id, params));
21
+ }
22
+ async listResources(params) {
23
+ const response = await this.list(params);
24
+ return {
25
+ data: response.data.map((workflow) => new (0, _chunk3YWWR6UDcjs.WorkflowResource)(this, new (0, _chunkYBMEMKCNcjs.ExecutionClient)(this.http), workflow)),
26
+ nextCursor: response.nextCursor
27
+ };
28
+ }
13
29
  async create(data) {
14
30
  return this.http.post("/workflows", data);
15
31
  }
32
+ async createResource(data) {
33
+ return new (0, _chunk3YWWR6UDcjs.WorkflowResource)(this, new (0, _chunkYBMEMKCNcjs.ExecutionClient)(this.http), await this.create(data));
34
+ }
16
35
  async update(id, data) {
17
36
  return this.http.put(`/workflows/${id}`, data);
18
37
  }
38
+ async updateResource(id, data) {
39
+ return new (0, _chunk3YWWR6UDcjs.WorkflowResource)(this, new (0, _chunkYBMEMKCNcjs.ExecutionClient)(this.http), await this.update(id, data));
40
+ }
19
41
  async delete(id) {
20
42
  return this.http.delete(`/workflows/${id}`);
21
43
  }
@@ -47,5 +69,5 @@ var WorkflowHandle = class {
47
69
 
48
70
 
49
71
 
50
- exports.WorkflowHandle = WorkflowHandle;
51
- //# sourceMappingURL=chunk-I7NGIQIM.cjs.map
72
+ exports.WorkflowClient = WorkflowClient;
73
+ //# sourceMappingURL=chunk-GZ3POWDP.cjs.map
@@ -0,0 +1,59 @@
1
+ import {
2
+ VariableResource
3
+ } from "./chunk-2R6A6NJE.js";
4
+ import {
5
+ HttpError
6
+ } from "./chunk-RMEH2UPX.js";
7
+ import {
8
+ BaseClient
9
+ } from "./chunk-Q6FSREKN.js";
10
+
11
+ // src/clients/variable.ts
12
+ var VariableClient = class extends BaseClient {
13
+ async list(params) {
14
+ return this.http.get("/variables", params);
15
+ }
16
+ async get(id, params) {
17
+ const variable = await this.findVariable(id, params);
18
+ if (!variable) {
19
+ throw new HttpError(404, `Variable not found: ${id}`, { id });
20
+ }
21
+ return variable;
22
+ }
23
+ async getResource(id, params) {
24
+ return new VariableResource(this, await this.get(id, params), params);
25
+ }
26
+ async listResources(params) {
27
+ const response = await this.list(params);
28
+ return {
29
+ data: response.data.map((variable) => new VariableResource(this, variable, params)),
30
+ nextCursor: response.nextCursor
31
+ };
32
+ }
33
+ async create(data) {
34
+ await this.http.post("/variables", data);
35
+ }
36
+ async update(id, data) {
37
+ await this.http.put(`/variables/${id}`, data);
38
+ }
39
+ async delete(id) {
40
+ await this.http.delete(`/variables/${id}`);
41
+ }
42
+ async findVariable(id, params) {
43
+ let cursor = params?.cursor;
44
+ do {
45
+ const response = await this.list({ ...params, cursor });
46
+ const variable = response.data.find((entry) => entry.id === id);
47
+ if (variable) {
48
+ return variable;
49
+ }
50
+ cursor = response.nextCursor;
51
+ } while (cursor);
52
+ return void 0;
53
+ }
54
+ };
55
+
56
+ export {
57
+ VariableClient
58
+ };
59
+ //# sourceMappingURL=chunk-HISH4ORK.js.map
@@ -0,0 +1,98 @@
1
+ import {
2
+ HttpError
3
+ } from "./chunk-RMEH2UPX.js";
4
+ import {
5
+ BaseResource
6
+ } from "./chunk-TLBDBRPJ.js";
7
+
8
+ // src/resources/workflow.ts
9
+ var WorkflowResource = class extends BaseResource {
10
+ constructor(workflows, executionsClient, workflow) {
11
+ super(workflow);
12
+ this.workflows = workflows;
13
+ this.executionsClient = executionsClient;
14
+ }
15
+ workflows;
16
+ executionsClient;
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 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 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
+ export {
96
+ WorkflowResource
97
+ };
98
+ //# sourceMappingURL=chunk-I4MMTW33.js.map
@@ -0,0 +1,46 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk7H75UBMHcjs = require('./chunk-7H75UBMH.cjs');
4
+
5
+
6
+ var _chunk4M2HGY3Fcjs = require('./chunk-4M2HGY3F.cjs');
7
+
8
+ // src/clients/tag.ts
9
+ var TagClient = class extends _chunk4M2HGY3Fcjs.BaseClient {
10
+ async list(params) {
11
+ return this.http.get("/tags", params);
12
+ }
13
+ async get(id) {
14
+ return this.http.get(`/tags/${id}`);
15
+ }
16
+ async getResource(id) {
17
+ return new (0, _chunk7H75UBMHcjs.TagResource)(this, await this.get(id));
18
+ }
19
+ async listResources(params) {
20
+ const response = await this.list(params);
21
+ return {
22
+ data: response.data.map((tag) => new (0, _chunk7H75UBMHcjs.TagResource)(this, tag)),
23
+ nextCursor: response.nextCursor
24
+ };
25
+ }
26
+ async create(data) {
27
+ return this.http.post("/tags", data);
28
+ }
29
+ async createResource(data) {
30
+ return new (0, _chunk7H75UBMHcjs.TagResource)(this, await this.create(data));
31
+ }
32
+ async update(id, data) {
33
+ return this.http.put(`/tags/${id}`, data);
34
+ }
35
+ async updateResource(id, data) {
36
+ return new (0, _chunk7H75UBMHcjs.TagResource)(this, await this.update(id, data));
37
+ }
38
+ async delete(id) {
39
+ return this.http.delete(`/tags/${id}`);
40
+ }
41
+ };
42
+
43
+
44
+
45
+ exports.TagClient = TagClient;
46
+ //# sourceMappingURL=chunk-KRPRS2E5.cjs.map
@@ -0,0 +1,35 @@
1
+ import {
2
+ BaseResource
3
+ } from "./chunk-TLBDBRPJ.js";
4
+
5
+ // src/resources/user.ts
6
+ var UserResource = class extends BaseResource {
7
+ constructor(users, user, params) {
8
+ super(user);
9
+ this.users = users;
10
+ this.params = params;
11
+ }
12
+ users;
13
+ params;
14
+ get id() {
15
+ return this.data.id;
16
+ }
17
+ get email() {
18
+ return this.data.email;
19
+ }
20
+ async refresh() {
21
+ return this.replaceSnapshot(await this.users.get(this.id, this.params));
22
+ }
23
+ async delete() {
24
+ await this.users.delete(this.id);
25
+ }
26
+ async changeRole(newRoleName) {
27
+ await this.users.changeRole(this.id, newRoleName);
28
+ return this.mergeSnapshot({ role: newRoleName });
29
+ }
30
+ };
31
+
32
+ export {
33
+ UserResource
34
+ };
35
+ //# sourceMappingURL=chunk-L2FFL3BY.js.map
@@ -107,4 +107,4 @@ var HttpClient = class {
107
107
 
108
108
 
109
109
  exports.HttpError = HttpError; exports.HttpClient = HttpClient;
110
- //# sourceMappingURL=chunk-5DYA4LAX.cjs.map
110
+ //# sourceMappingURL=chunk-LC3TKRMX.cjs.map
@@ -0,0 +1,55 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkMMN2UKTIcjs = require('./chunk-MMN2UKTI.cjs');
4
+
5
+
6
+ var _chunk4M2HGY3Fcjs = require('./chunk-4M2HGY3F.cjs');
7
+
8
+ // src/clients/credential.ts
9
+ var CredentialClient = class extends _chunk4M2HGY3Fcjs.BaseClient {
10
+ async list(params) {
11
+ return this.http.get("/credentials", params);
12
+ }
13
+ async get(id) {
14
+ return this.http.get(`/credentials/${id}`);
15
+ }
16
+ async getResource(id) {
17
+ return new (0, _chunkMMN2UKTIcjs.CredentialResource)(this, await this.get(id));
18
+ }
19
+ async listResources(params) {
20
+ const response = await this.list(params);
21
+ return {
22
+ data: response.data.map((credential) => new (0, _chunkMMN2UKTIcjs.CredentialResource)(this, credential)),
23
+ nextCursor: response.nextCursor
24
+ };
25
+ }
26
+ async create(data) {
27
+ return this.http.post("/credentials", data);
28
+ }
29
+ async createResource(data) {
30
+ return new (0, _chunkMMN2UKTIcjs.CredentialResource)(this, await this.create(data));
31
+ }
32
+ async update(id, data) {
33
+ return this.http.patch(`/credentials/${id}`, data);
34
+ }
35
+ async updateResource(id, data) {
36
+ return new (0, _chunkMMN2UKTIcjs.CredentialResource)(this, await this.update(id, data));
37
+ }
38
+ async delete(id) {
39
+ return this.http.delete(`/credentials/${id}`);
40
+ }
41
+ async test(id) {
42
+ return this.http.post(`/credentials/${id}/test`);
43
+ }
44
+ async transfer(id, destinationProjectId) {
45
+ await this.http.put(`/credentials/${id}/transfer`, { destinationProjectId });
46
+ }
47
+ async getSchema(credentialTypeName) {
48
+ return this.http.get(`/credentials/schema/${credentialTypeName}`);
49
+ }
50
+ };
51
+
52
+
53
+
54
+ exports.CredentialClient = CredentialClient;
55
+ //# sourceMappingURL=chunk-LQULSPET.cjs.map
@@ -0,0 +1,196 @@
1
+ import {
2
+ DataTableResource
3
+ } from "./chunk-T62VHXNY.js";
4
+ import {
5
+ HttpError
6
+ } from "./chunk-RMEH2UPX.js";
7
+ import {
8
+ BaseResource
9
+ } from "./chunk-TLBDBRPJ.js";
10
+
11
+ // src/resources/project.ts
12
+ var ProjectResource = class extends BaseResource {
13
+ constructor(projects, workflowsClient, foldersClient, variablesClient, dataTablesClient, executionsClient, project) {
14
+ super(project);
15
+ this.projects = projects;
16
+ this.relations = {
17
+ workflows: workflowsClient,
18
+ folders: foldersClient,
19
+ variables: variablesClient,
20
+ dataTables: dataTablesClient,
21
+ executions: executionsClient
22
+ };
23
+ }
24
+ projects;
25
+ relations;
26
+ get id() {
27
+ return this.data.id;
28
+ }
29
+ get name() {
30
+ return this.data.name;
31
+ }
32
+ get type() {
33
+ return this.data.type;
34
+ }
35
+ async update(data) {
36
+ await this.projects.update(this.id, data);
37
+ return this.mergeSnapshot(data);
38
+ }
39
+ async delete() {
40
+ await this.projects.delete(this.id);
41
+ }
42
+ async listMembers(params) {
43
+ return this.projects.listMembers(this.id, params);
44
+ }
45
+ async addMembers(relations) {
46
+ await this.projects.addMembers(this.id, relations);
47
+ }
48
+ async removeMember(userId) {
49
+ await this.projects.removeMember(this.id, userId);
50
+ }
51
+ async changeMemberRole(userId, role) {
52
+ await this.projects.changeMemberRole(this.id, userId, role);
53
+ }
54
+ workflows() {
55
+ return {
56
+ list: (params) => this.relations.workflows.list({ ...params, projectId: this.id }),
57
+ listResources: async (params) => {
58
+ const response = await this.relations.workflows.listResources({ ...params, projectId: this.id });
59
+ return response;
60
+ },
61
+ get: async (id) => {
62
+ if (!await this.hasResourceInProject({
63
+ listPage: (cursor) => this.relations.workflows.list({ projectId: this.id, cursor }),
64
+ matches: (workflow) => workflow.id === id
65
+ })) {
66
+ throw new HttpError(404, `Workflow not found in project: ${id}`, { id, projectId: this.id });
67
+ }
68
+ return this.relations.workflows.get(id);
69
+ },
70
+ getResource: async (id) => {
71
+ if (!await this.hasResourceInProject({
72
+ listPage: (cursor) => this.relations.workflows.list({ projectId: this.id, cursor }),
73
+ matches: (workflow) => workflow.id === id
74
+ })) {
75
+ throw new HttpError(404, `Workflow not found in project: ${id}`, { id, projectId: this.id });
76
+ }
77
+ return this.relations.workflows.getResource(id);
78
+ },
79
+ createResource: (data) => this.relations.workflows.createResource({ ...data, projectId: this.id }),
80
+ create: (data) => this.relations.workflows.create({ ...data, projectId: this.id }),
81
+ update: async (id, data) => {
82
+ if (!await this.hasResourceInProject({
83
+ listPage: (cursor) => this.relations.workflows.list({ projectId: this.id, cursor }),
84
+ matches: (workflow) => workflow.id === id
85
+ })) {
86
+ throw new HttpError(404, `Workflow not found in project: ${id}`, { id, projectId: this.id });
87
+ }
88
+ return this.relations.workflows.update(id, data);
89
+ },
90
+ updateResource: async (id, data) => {
91
+ if (!await this.hasResourceInProject({
92
+ listPage: (cursor) => this.relations.workflows.list({ projectId: this.id, cursor }),
93
+ matches: (workflow) => workflow.id === id
94
+ })) {
95
+ throw new HttpError(404, `Workflow not found in project: ${id}`, { id, projectId: this.id });
96
+ }
97
+ return this.relations.workflows.updateResource(id, data);
98
+ }
99
+ };
100
+ }
101
+ folders() {
102
+ return {
103
+ list: (params) => this.relations.folders.list(params),
104
+ listResources: (params) => this.relations.folders.listResources(params),
105
+ getResource: (id) => this.relations.folders.getResource(id),
106
+ createResource: (data) => this.relations.folders.createResource(data),
107
+ create: (data) => this.relations.folders.create(data),
108
+ get: (id) => this.relations.folders.get(id),
109
+ update: (id, data) => this.relations.folders.update(id, data),
110
+ updateResource: (id, data) => this.relations.folders.updateResource(id, data),
111
+ delete: (id, transferToFolderId) => this.relations.folders.delete(id, transferToFolderId)
112
+ };
113
+ }
114
+ variables() {
115
+ return {
116
+ list: (params) => this.relations.variables.list({ ...params, projectId: this.id }),
117
+ listResources: (params) => this.relations.variables.listResources({ ...params, projectId: this.id }),
118
+ get: (id) => this.relations.variables.get(id, { projectId: this.id }),
119
+ getResource: (id) => this.relations.variables.getResource(id, { projectId: this.id }),
120
+ create: (data) => this.relations.variables.create({ ...data, projectId: this.id }),
121
+ update: (id, data) => this.relations.variables.update(id, { ...data, projectId: this.id }),
122
+ updateResource: async (id, data) => {
123
+ await this.relations.variables.update(id, { ...data, projectId: this.id });
124
+ return this.relations.variables.getResource(id, { projectId: this.id });
125
+ },
126
+ delete: (id) => this.relations.variables.delete(id)
127
+ };
128
+ }
129
+ dataTables() {
130
+ return {
131
+ get: (id) => this.getProjectDataTableOrThrow(id),
132
+ getResource: async (id) => new DataTableResource(this.relations.dataTables, await this.getProjectDataTableOrThrow(id)),
133
+ create: (data) => this.relations.dataTables.create({ ...data, projectId: this.id }),
134
+ createResource: (data) => this.relations.dataTables.createResource({ ...data, projectId: this.id }),
135
+ update: async (id, data) => {
136
+ await this.getProjectDataTableOrThrow(id);
137
+ return this.relations.dataTables.update(id, data);
138
+ },
139
+ updateResource: async (id, data) => {
140
+ await this.getProjectDataTableOrThrow(id);
141
+ return this.relations.dataTables.updateResource(id, data);
142
+ },
143
+ delete: async (id) => {
144
+ await this.getProjectDataTableOrThrow(id);
145
+ await this.relations.dataTables.delete(id);
146
+ }
147
+ };
148
+ }
149
+ executions() {
150
+ return {
151
+ list: (params) => this.relations.executions.list({ ...params, projectId: this.id }),
152
+ listResources: (params) => this.relations.executions.listResources({ ...params, projectId: this.id }),
153
+ get: async (id, params) => {
154
+ if (!await this.hasResourceInProject({
155
+ listPage: (cursor) => this.relations.executions.list({ projectId: this.id, cursor }),
156
+ matches: (execution) => execution.id === id
157
+ })) {
158
+ throw new HttpError(404, `Execution not found in project: ${id}`, { id, projectId: this.id });
159
+ }
160
+ return this.relations.executions.get(id, params);
161
+ },
162
+ getResource: async (id, params) => {
163
+ if (!await this.hasResourceInProject({
164
+ listPage: (cursor) => this.relations.executions.list({ projectId: this.id, cursor }),
165
+ matches: (execution) => execution.id === id
166
+ })) {
167
+ throw new HttpError(404, `Execution not found in project: ${id}`, { id, projectId: this.id });
168
+ }
169
+ return this.relations.executions.getResource(id, params);
170
+ }
171
+ };
172
+ }
173
+ async getProjectDataTableOrThrow(id) {
174
+ const dataTable = await this.relations.dataTables.get(id);
175
+ if (dataTable.projectId !== this.id) {
176
+ throw new HttpError(404, `Data table not found in project: ${id}`, { id, projectId: this.id });
177
+ }
178
+ return dataTable;
179
+ }
180
+ async hasResourceInProject(options) {
181
+ let cursor;
182
+ do {
183
+ const response = await options.listPage(cursor);
184
+ if (response.data.some(options.matches)) {
185
+ return true;
186
+ }
187
+ cursor = response.nextCursor;
188
+ } while (cursor);
189
+ return false;
190
+ }
191
+ };
192
+
193
+ export {
194
+ ProjectResource
195
+ };
196
+ //# sourceMappingURL=chunk-LTYQTCHM.js.map
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkFIKGC2ELcjs = require('./chunk-FIKGC2EL.cjs');
4
+
5
+ // src/resources/credential.ts
6
+ var CredentialResource = class extends _chunkFIKGC2ELcjs.BaseResource {
7
+ constructor(credentials, credential) {
8
+ super(credential);
9
+ this.credentials = credentials;
10
+ }
11
+
12
+ get id() {
13
+ return this.data.id;
14
+ }
15
+ get name() {
16
+ return this.data.name;
17
+ }
18
+ get type() {
19
+ return this.data.type;
20
+ }
21
+ async update(data) {
22
+ return this.replaceSnapshot(await this.credentials.update(this.id, data));
23
+ }
24
+ async delete() {
25
+ return this.credentials.delete(this.id);
26
+ }
27
+ async test() {
28
+ return this.credentials.test(this.id);
29
+ }
30
+ async transfer(destinationProjectId) {
31
+ await this.credentials.transfer(this.id, destinationProjectId);
32
+ }
33
+ async getSchema() {
34
+ return this.credentials.getSchema(this.type);
35
+ }
36
+ };
37
+
38
+
39
+
40
+ exports.CredentialResource = CredentialResource;
41
+ //# sourceMappingURL=chunk-MMN2UKTI.cjs.map