@flowcore/sdk 1.4.2

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 (298) hide show
  1. package/README.md +41 -0
  2. package/esm/commands/api-key/api-key.create.d.ts +34 -0
  3. package/esm/commands/api-key/api-key.create.d.ts.map +1 -0
  4. package/esm/commands/api-key/api-key.create.js +74 -0
  5. package/esm/commands/api-key/api-key.delete.d.ts +28 -0
  6. package/esm/commands/api-key/api-key.delete.d.ts.map +1 -0
  7. package/esm/commands/api-key/api-key.delete.js +60 -0
  8. package/esm/commands/api-key/api-key.list.d.ts +27 -0
  9. package/esm/commands/api-key/api-key.list.d.ts.map +1 -0
  10. package/esm/commands/api-key/api-key.list.js +58 -0
  11. package/esm/commands/data-core/data-core.create.d.ts +39 -0
  12. package/esm/commands/data-core/data-core.create.d.ts.map +1 -0
  13. package/esm/commands/data-core/data-core.create.js +32 -0
  14. package/esm/commands/data-core/data-core.delete-request.d.ts +37 -0
  15. package/esm/commands/data-core/data-core.delete-request.d.ts.map +1 -0
  16. package/esm/commands/data-core/data-core.delete-request.js +94 -0
  17. package/esm/commands/data-core/data-core.exists.d.ts +37 -0
  18. package/esm/commands/data-core/data-core.exists.d.ts.map +1 -0
  19. package/esm/commands/data-core/data-core.exists.js +33 -0
  20. package/esm/commands/data-core/data-core.fetch.d.ts +51 -0
  21. package/esm/commands/data-core/data-core.fetch.d.ts.map +1 -0
  22. package/esm/commands/data-core/data-core.fetch.js +48 -0
  23. package/esm/commands/data-core/data-core.list.d.ts +33 -0
  24. package/esm/commands/data-core/data-core.list.d.ts.map +1 -0
  25. package/esm/commands/data-core/data-core.list.js +40 -0
  26. package/esm/commands/data-core/data-core.update.d.ts +41 -0
  27. package/esm/commands/data-core/data-core.update.d.ts.map +1 -0
  28. package/esm/commands/data-core/data-core.update.js +43 -0
  29. package/esm/commands/event-type/event-type.create.d.ts +35 -0
  30. package/esm/commands/event-type/event-type.create.d.ts.map +1 -0
  31. package/esm/commands/event-type/event-type.create.js +32 -0
  32. package/esm/commands/event-type/event-type.delete-request.d.ts +37 -0
  33. package/esm/commands/event-type/event-type.delete-request.d.ts.map +1 -0
  34. package/esm/commands/event-type/event-type.delete-request.js +98 -0
  35. package/esm/commands/event-type/event-type.exists.d.ts +37 -0
  36. package/esm/commands/event-type/event-type.exists.d.ts.map +1 -0
  37. package/esm/commands/event-type/event-type.exists.js +33 -0
  38. package/esm/commands/event-type/event-type.fetch.d.ts +45 -0
  39. package/esm/commands/event-type/event-type.fetch.d.ts.map +1 -0
  40. package/esm/commands/event-type/event-type.fetch.js +48 -0
  41. package/esm/commands/event-type/event-type.list.d.ts +31 -0
  42. package/esm/commands/event-type/event-type.list.d.ts.map +1 -0
  43. package/esm/commands/event-type/event-type.list.js +36 -0
  44. package/esm/commands/event-type/event-type.update.d.ts +37 -0
  45. package/esm/commands/event-type/event-type.update.d.ts.map +1 -0
  46. package/esm/commands/event-type/event-type.update.js +39 -0
  47. package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts +53 -0
  48. package/esm/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -0
  49. package/esm/commands/events/events.fetch-time-buckets-by-names.js +40 -0
  50. package/esm/commands/events/events.fetch.d.ts +58 -0
  51. package/esm/commands/events/events.fetch.d.ts.map +1 -0
  52. package/esm/commands/events/events.fetch.js +54 -0
  53. package/esm/commands/flow-type/flow-type.create.d.ts +35 -0
  54. package/esm/commands/flow-type/flow-type.create.d.ts.map +1 -0
  55. package/esm/commands/flow-type/flow-type.create.js +32 -0
  56. package/esm/commands/flow-type/flow-type.delete-request.d.ts +47 -0
  57. package/esm/commands/flow-type/flow-type.delete-request.d.ts.map +1 -0
  58. package/esm/commands/flow-type/flow-type.delete-request.js +118 -0
  59. package/esm/commands/flow-type/flow-type.exists.d.ts +39 -0
  60. package/esm/commands/flow-type/flow-type.exists.d.ts.map +1 -0
  61. package/esm/commands/flow-type/flow-type.exists.js +33 -0
  62. package/esm/commands/flow-type/flow-type.fetch.d.ts +51 -0
  63. package/esm/commands/flow-type/flow-type.fetch.d.ts.map +1 -0
  64. package/esm/commands/flow-type/flow-type.fetch.js +48 -0
  65. package/esm/commands/flow-type/flow-type.list.d.ts +31 -0
  66. package/esm/commands/flow-type/flow-type.list.d.ts.map +1 -0
  67. package/esm/commands/flow-type/flow-type.list.js +36 -0
  68. package/esm/commands/flow-type/flow-type.update.d.ts +37 -0
  69. package/esm/commands/flow-type/flow-type.update.d.ts.map +1 -0
  70. package/esm/commands/flow-type/flow-type.update.js +39 -0
  71. package/esm/commands/index.d.ts +32 -0
  72. package/esm/commands/index.d.ts.map +1 -0
  73. package/esm/commands/index.js +39 -0
  74. package/esm/commands/secret/secret.create.d.ts +30 -0
  75. package/esm/commands/secret/secret.create.d.ts.map +1 -0
  76. package/esm/commands/secret/secret.create.js +60 -0
  77. package/esm/commands/secret/secret.delete.d.ts +28 -0
  78. package/esm/commands/secret/secret.delete.d.ts.map +1 -0
  79. package/esm/commands/secret/secret.delete.js +61 -0
  80. package/esm/commands/secret/secret.list.d.ts +26 -0
  81. package/esm/commands/secret/secret.list.d.ts.map +1 -0
  82. package/esm/commands/secret/secret.list.js +63 -0
  83. package/esm/commands/tenant/tenant.fetch.d.ts +43 -0
  84. package/esm/commands/tenant/tenant.fetch.d.ts.map +1 -0
  85. package/esm/commands/tenant/tenant.fetch.js +77 -0
  86. package/esm/commands/tenant/tenant.list.d.ts +20 -0
  87. package/esm/commands/tenant/tenant.list.d.ts.map +1 -0
  88. package/esm/commands/tenant/tenant.list.js +65 -0
  89. package/esm/commands/variable/variable.create.d.ts +31 -0
  90. package/esm/commands/variable/variable.create.d.ts.map +1 -0
  91. package/esm/commands/variable/variable.create.js +66 -0
  92. package/esm/commands/variable/variable.delete.d.ts +28 -0
  93. package/esm/commands/variable/variable.delete.d.ts.map +1 -0
  94. package/esm/commands/variable/variable.delete.js +63 -0
  95. package/esm/commands/variable/variable.list.d.ts +27 -0
  96. package/esm/commands/variable/variable.list.d.ts.map +1 -0
  97. package/esm/commands/variable/variable.list.js +69 -0
  98. package/esm/common/command.d.ts +63 -0
  99. package/esm/common/command.d.ts.map +1 -0
  100. package/esm/common/command.js +91 -0
  101. package/esm/common/flowcore-client.d.ts +39 -0
  102. package/esm/common/flowcore-client.d.ts.map +1 -0
  103. package/esm/common/flowcore-client.js +72 -0
  104. package/esm/contracts/api-key.d.ts +14 -0
  105. package/esm/contracts/api-key.d.ts.map +1 -0
  106. package/esm/contracts/api-key.js +9 -0
  107. package/esm/contracts/data-core.d.ts +38 -0
  108. package/esm/contracts/data-core.d.ts.map +1 -0
  109. package/esm/contracts/data-core.js +38 -0
  110. package/esm/contracts/event-type.d.ts +33 -0
  111. package/esm/contracts/event-type.d.ts.map +1 -0
  112. package/esm/contracts/event-type.js +33 -0
  113. package/esm/contracts/event.d.ts +20 -0
  114. package/esm/contracts/event.d.ts.map +1 -0
  115. package/esm/contracts/event.js +15 -0
  116. package/esm/contracts/flow-type.d.ts +32 -0
  117. package/esm/contracts/flow-type.d.ts.map +1 -0
  118. package/esm/contracts/flow-type.js +31 -0
  119. package/esm/contracts/index.d.ts +4 -0
  120. package/esm/contracts/index.d.ts.map +1 -0
  121. package/esm/contracts/index.js +1 -0
  122. package/esm/contracts/tenant.d.ts +50 -0
  123. package/esm/contracts/tenant.d.ts.map +1 -0
  124. package/esm/contracts/tenant.js +33 -0
  125. package/esm/contracts/variable.d.ts +13 -0
  126. package/esm/contracts/variable.d.ts.map +1 -0
  127. package/esm/contracts/variable.js +8 -0
  128. package/esm/exceptions/client-error.d.ts +9 -0
  129. package/esm/exceptions/client-error.d.ts.map +1 -0
  130. package/esm/exceptions/client-error.js +20 -0
  131. package/esm/exceptions/command-error.d.ts +7 -0
  132. package/esm/exceptions/command-error.d.ts.map +1 -0
  133. package/esm/exceptions/command-error.js +8 -0
  134. package/esm/exceptions/index.d.ts +4 -0
  135. package/esm/exceptions/index.d.ts.map +1 -0
  136. package/esm/exceptions/index.js +3 -0
  137. package/esm/exceptions/invalid-response.d.ts +8 -0
  138. package/esm/exceptions/invalid-response.d.ts.map +1 -0
  139. package/esm/exceptions/invalid-response.js +15 -0
  140. package/esm/exceptions/not-found.d.ts +7 -0
  141. package/esm/exceptions/not-found.d.ts.map +1 -0
  142. package/esm/exceptions/not-found.js +8 -0
  143. package/esm/mod.d.ts +6 -0
  144. package/esm/mod.d.ts.map +1 -0
  145. package/esm/mod.js +5 -0
  146. package/esm/package.json +3 -0
  147. package/esm/utils/parse-response-helper.d.ts +6 -0
  148. package/esm/utils/parse-response-helper.d.ts.map +1 -0
  149. package/esm/utils/parse-response-helper.js +16 -0
  150. package/package.json +28 -0
  151. package/script/commands/api-key/api-key.create.d.ts +34 -0
  152. package/script/commands/api-key/api-key.create.d.ts.map +1 -0
  153. package/script/commands/api-key/api-key.create.js +78 -0
  154. package/script/commands/api-key/api-key.delete.d.ts +28 -0
  155. package/script/commands/api-key/api-key.delete.d.ts.map +1 -0
  156. package/script/commands/api-key/api-key.delete.js +64 -0
  157. package/script/commands/api-key/api-key.list.d.ts +27 -0
  158. package/script/commands/api-key/api-key.list.d.ts.map +1 -0
  159. package/script/commands/api-key/api-key.list.js +62 -0
  160. package/script/commands/data-core/data-core.create.d.ts +39 -0
  161. package/script/commands/data-core/data-core.create.d.ts.map +1 -0
  162. package/script/commands/data-core/data-core.create.js +36 -0
  163. package/script/commands/data-core/data-core.delete-request.d.ts +37 -0
  164. package/script/commands/data-core/data-core.delete-request.d.ts.map +1 -0
  165. package/script/commands/data-core/data-core.delete-request.js +98 -0
  166. package/script/commands/data-core/data-core.exists.d.ts +37 -0
  167. package/script/commands/data-core/data-core.exists.d.ts.map +1 -0
  168. package/script/commands/data-core/data-core.exists.js +37 -0
  169. package/script/commands/data-core/data-core.fetch.d.ts +51 -0
  170. package/script/commands/data-core/data-core.fetch.d.ts.map +1 -0
  171. package/script/commands/data-core/data-core.fetch.js +52 -0
  172. package/script/commands/data-core/data-core.list.d.ts +33 -0
  173. package/script/commands/data-core/data-core.list.d.ts.map +1 -0
  174. package/script/commands/data-core/data-core.list.js +44 -0
  175. package/script/commands/data-core/data-core.update.d.ts +41 -0
  176. package/script/commands/data-core/data-core.update.d.ts.map +1 -0
  177. package/script/commands/data-core/data-core.update.js +47 -0
  178. package/script/commands/event-type/event-type.create.d.ts +35 -0
  179. package/script/commands/event-type/event-type.create.d.ts.map +1 -0
  180. package/script/commands/event-type/event-type.create.js +36 -0
  181. package/script/commands/event-type/event-type.delete-request.d.ts +37 -0
  182. package/script/commands/event-type/event-type.delete-request.d.ts.map +1 -0
  183. package/script/commands/event-type/event-type.delete-request.js +102 -0
  184. package/script/commands/event-type/event-type.exists.d.ts +37 -0
  185. package/script/commands/event-type/event-type.exists.d.ts.map +1 -0
  186. package/script/commands/event-type/event-type.exists.js +37 -0
  187. package/script/commands/event-type/event-type.fetch.d.ts +45 -0
  188. package/script/commands/event-type/event-type.fetch.d.ts.map +1 -0
  189. package/script/commands/event-type/event-type.fetch.js +52 -0
  190. package/script/commands/event-type/event-type.list.d.ts +31 -0
  191. package/script/commands/event-type/event-type.list.d.ts.map +1 -0
  192. package/script/commands/event-type/event-type.list.js +40 -0
  193. package/script/commands/event-type/event-type.update.d.ts +37 -0
  194. package/script/commands/event-type/event-type.update.d.ts.map +1 -0
  195. package/script/commands/event-type/event-type.update.js +43 -0
  196. package/script/commands/events/events.fetch-time-buckets-by-names.d.ts +53 -0
  197. package/script/commands/events/events.fetch-time-buckets-by-names.d.ts.map +1 -0
  198. package/script/commands/events/events.fetch-time-buckets-by-names.js +44 -0
  199. package/script/commands/events/events.fetch.d.ts +58 -0
  200. package/script/commands/events/events.fetch.d.ts.map +1 -0
  201. package/script/commands/events/events.fetch.js +58 -0
  202. package/script/commands/flow-type/flow-type.create.d.ts +35 -0
  203. package/script/commands/flow-type/flow-type.create.d.ts.map +1 -0
  204. package/script/commands/flow-type/flow-type.create.js +36 -0
  205. package/script/commands/flow-type/flow-type.delete-request.d.ts +47 -0
  206. package/script/commands/flow-type/flow-type.delete-request.d.ts.map +1 -0
  207. package/script/commands/flow-type/flow-type.delete-request.js +122 -0
  208. package/script/commands/flow-type/flow-type.exists.d.ts +39 -0
  209. package/script/commands/flow-type/flow-type.exists.d.ts.map +1 -0
  210. package/script/commands/flow-type/flow-type.exists.js +37 -0
  211. package/script/commands/flow-type/flow-type.fetch.d.ts +51 -0
  212. package/script/commands/flow-type/flow-type.fetch.d.ts.map +1 -0
  213. package/script/commands/flow-type/flow-type.fetch.js +52 -0
  214. package/script/commands/flow-type/flow-type.list.d.ts +31 -0
  215. package/script/commands/flow-type/flow-type.list.d.ts.map +1 -0
  216. package/script/commands/flow-type/flow-type.list.js +40 -0
  217. package/script/commands/flow-type/flow-type.update.d.ts +37 -0
  218. package/script/commands/flow-type/flow-type.update.d.ts.map +1 -0
  219. package/script/commands/flow-type/flow-type.update.js +43 -0
  220. package/script/commands/index.d.ts +32 -0
  221. package/script/commands/index.d.ts.map +1 -0
  222. package/script/commands/index.js +55 -0
  223. package/script/commands/secret/secret.create.d.ts +30 -0
  224. package/script/commands/secret/secret.create.d.ts.map +1 -0
  225. package/script/commands/secret/secret.create.js +64 -0
  226. package/script/commands/secret/secret.delete.d.ts +28 -0
  227. package/script/commands/secret/secret.delete.d.ts.map +1 -0
  228. package/script/commands/secret/secret.delete.js +65 -0
  229. package/script/commands/secret/secret.list.d.ts +26 -0
  230. package/script/commands/secret/secret.list.d.ts.map +1 -0
  231. package/script/commands/secret/secret.list.js +67 -0
  232. package/script/commands/tenant/tenant.fetch.d.ts +43 -0
  233. package/script/commands/tenant/tenant.fetch.d.ts.map +1 -0
  234. package/script/commands/tenant/tenant.fetch.js +81 -0
  235. package/script/commands/tenant/tenant.list.d.ts +20 -0
  236. package/script/commands/tenant/tenant.list.d.ts.map +1 -0
  237. package/script/commands/tenant/tenant.list.js +69 -0
  238. package/script/commands/variable/variable.create.d.ts +31 -0
  239. package/script/commands/variable/variable.create.d.ts.map +1 -0
  240. package/script/commands/variable/variable.create.js +70 -0
  241. package/script/commands/variable/variable.delete.d.ts +28 -0
  242. package/script/commands/variable/variable.delete.d.ts.map +1 -0
  243. package/script/commands/variable/variable.delete.js +67 -0
  244. package/script/commands/variable/variable.list.d.ts +27 -0
  245. package/script/commands/variable/variable.list.d.ts.map +1 -0
  246. package/script/commands/variable/variable.list.js +73 -0
  247. package/script/common/command.d.ts +63 -0
  248. package/script/common/command.d.ts.map +1 -0
  249. package/script/common/command.js +96 -0
  250. package/script/common/flowcore-client.d.ts +39 -0
  251. package/script/common/flowcore-client.d.ts.map +1 -0
  252. package/script/common/flowcore-client.js +76 -0
  253. package/script/contracts/api-key.d.ts +14 -0
  254. package/script/contracts/api-key.d.ts.map +1 -0
  255. package/script/contracts/api-key.js +12 -0
  256. package/script/contracts/data-core.d.ts +38 -0
  257. package/script/contracts/data-core.d.ts.map +1 -0
  258. package/script/contracts/data-core.js +42 -0
  259. package/script/contracts/event-type.d.ts +33 -0
  260. package/script/contracts/event-type.d.ts.map +1 -0
  261. package/script/contracts/event-type.js +37 -0
  262. package/script/contracts/event.d.ts +20 -0
  263. package/script/contracts/event.d.ts.map +1 -0
  264. package/script/contracts/event.js +18 -0
  265. package/script/contracts/flow-type.d.ts +32 -0
  266. package/script/contracts/flow-type.d.ts.map +1 -0
  267. package/script/contracts/flow-type.js +35 -0
  268. package/script/contracts/index.d.ts +4 -0
  269. package/script/contracts/index.d.ts.map +1 -0
  270. package/script/contracts/index.js +2 -0
  271. package/script/contracts/tenant.d.ts +50 -0
  272. package/script/contracts/tenant.d.ts.map +1 -0
  273. package/script/contracts/tenant.js +37 -0
  274. package/script/contracts/variable.d.ts +13 -0
  275. package/script/contracts/variable.d.ts.map +1 -0
  276. package/script/contracts/variable.js +11 -0
  277. package/script/exceptions/client-error.d.ts +9 -0
  278. package/script/exceptions/client-error.d.ts.map +1 -0
  279. package/script/exceptions/client-error.js +24 -0
  280. package/script/exceptions/command-error.d.ts +7 -0
  281. package/script/exceptions/command-error.d.ts.map +1 -0
  282. package/script/exceptions/command-error.js +12 -0
  283. package/script/exceptions/index.d.ts +4 -0
  284. package/script/exceptions/index.d.ts.map +1 -0
  285. package/script/exceptions/index.js +19 -0
  286. package/script/exceptions/invalid-response.d.ts +8 -0
  287. package/script/exceptions/invalid-response.d.ts.map +1 -0
  288. package/script/exceptions/invalid-response.js +19 -0
  289. package/script/exceptions/not-found.d.ts +7 -0
  290. package/script/exceptions/not-found.d.ts.map +1 -0
  291. package/script/exceptions/not-found.js +12 -0
  292. package/script/mod.d.ts +6 -0
  293. package/script/mod.d.ts.map +1 -0
  294. package/script/mod.js +21 -0
  295. package/script/package.json +3 -0
  296. package/script/utils/parse-response-helper.d.ts +6 -0
  297. package/script/utils/parse-response-helper.d.ts.map +1 -0
  298. package/script/utils/parse-response-helper.js +20 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-core.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAI5E;;GAEG;AACH,KAAK,sBAAsB,GAAG;IAC5B,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,UAAU,wBAAwB;IAChC,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,GAAG,wBAAwB,CAAA;AAElF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC7E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAUpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAWjE"}
@@ -0,0 +1,48 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { DataCoreSchema } from "../../contracts/data-core.js";
4
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
+ import { NotFoundException } from "../../exceptions/not-found.js";
6
+ /**
7
+ * Fetch a data core
8
+ */
9
+ export class DataCoreFetchCommand extends Command {
10
+ /**
11
+ * Get the method
12
+ */
13
+ getMethod() {
14
+ return "GET";
15
+ }
16
+ /**
17
+ * Get the base url
18
+ */
19
+ getBaseUrl() {
20
+ return "https://data-core-2.api.flowcore.io";
21
+ }
22
+ /**
23
+ * Get the path
24
+ */
25
+ getPath() {
26
+ if ("dataCoreId" in this.input) {
27
+ return `/api/v1/data-cores/${this.input.dataCoreId}`;
28
+ }
29
+ const queryParams = new URLSearchParams();
30
+ queryParams.set("tenantId", this.input.tenantId);
31
+ queryParams.set("name", this.input.dataCore);
32
+ return `/api/v1/data-cores?${queryParams.toString()}`;
33
+ }
34
+ /**
35
+ * Parse the response
36
+ */
37
+ parseResponse(rawResponse) {
38
+ if ("dataCoreId" in this.input) {
39
+ const response = parseResponseHelper(DataCoreSchema, rawResponse);
40
+ return response;
41
+ }
42
+ const response = parseResponseHelper(Type.Array(DataCoreSchema), rawResponse);
43
+ if (response.length === 0) {
44
+ throw new NotFoundException("DataCore", this.input.dataCore);
45
+ }
46
+ return response[0];
47
+ }
48
+ }
@@ -0,0 +1,33 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type DataCore } from "../../contracts/data-core.js";
3
+ /**
4
+ * The input for the data core fetch by name command
5
+ */
6
+ export type DataCoreListInput = {
7
+ /** The tenant id */
8
+ tenantId?: string;
9
+ /** The tenant name */
10
+ tenant?: string;
11
+ };
12
+ /**
13
+ * Fetch all data cores for a tenant
14
+ */
15
+ export declare class DataCoreListCommand extends Command<DataCoreListInput, DataCore[]> {
16
+ /**
17
+ * Get the method
18
+ */
19
+ protected getMethod(): string;
20
+ /**
21
+ * Get the base url
22
+ */
23
+ protected getBaseUrl(): string;
24
+ /**
25
+ * Get the path
26
+ */
27
+ protected getPath(): string;
28
+ /**
29
+ * Parse the response
30
+ */
31
+ protected parseResponse(rawResponse: unknown): DataCore[];
32
+ }
33
+ //# sourceMappingURL=data-core.list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-core.list.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oBAAoB;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,OAAO,CAAC,iBAAiB,EAAE,QAAQ,EAAE,CAAC;IAC7E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAWpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,EAAE;CAGnE"}
@@ -0,0 +1,40 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { DataCoreSchema } from "../../contracts/data-core.js";
4
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
+ /**
6
+ * Fetch all data cores for a tenant
7
+ */
8
+ export class DataCoreListCommand extends Command {
9
+ /**
10
+ * Get the method
11
+ */
12
+ getMethod() {
13
+ return "GET";
14
+ }
15
+ /**
16
+ * Get the base url
17
+ */
18
+ getBaseUrl() {
19
+ return "https://data-core-2.api.flowcore.io";
20
+ }
21
+ /**
22
+ * Get the path
23
+ */
24
+ getPath() {
25
+ const queryParams = new URLSearchParams();
26
+ if (this.input.tenantId) {
27
+ queryParams.set("tenantId", this.input.tenantId);
28
+ }
29
+ if (this.input.tenant) {
30
+ queryParams.set("tenant", this.input.tenant);
31
+ }
32
+ return `/api/v1/data-cores?${queryParams.toString()}`;
33
+ }
34
+ /**
35
+ * Parse the response
36
+ */
37
+ parseResponse(rawResponse) {
38
+ return parseResponseHelper(Type.Array(DataCoreSchema), rawResponse);
39
+ }
40
+ }
@@ -0,0 +1,41 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type DataCore } from "../../contracts/data-core.js";
3
+ /**
4
+ * The input for the data core update command
5
+ */
6
+ export type DataCoreUpdateInput = {
7
+ /** The id of the data core */
8
+ dataCoreId: string;
9
+ /** The description of the data core */
10
+ description?: string;
11
+ /** The access control of the data core */
12
+ accessControl?: "public" | "private";
13
+ /** Whether the data core is delete protected */
14
+ deleteProtected?: boolean;
15
+ };
16
+ /**
17
+ * Update a data core
18
+ */
19
+ export declare class DataCoreUpdateCommand extends Command<DataCoreUpdateInput, DataCore> {
20
+ /**
21
+ * Get the method
22
+ */
23
+ protected getMethod(): string;
24
+ /**
25
+ * Get the base url
26
+ */
27
+ protected getBaseUrl(): string;
28
+ /**
29
+ * Get the path
30
+ */
31
+ protected getPath(): string;
32
+ /**
33
+ * Get the body for the request
34
+ */
35
+ protected getBody(): string | undefined;
36
+ /**
37
+ * Parse the response
38
+ */
39
+ protected parseResponse(rawResponse: unknown): DataCore;
40
+ }
41
+ //# sourceMappingURL=data-core.update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-core.update.d.ts","sourceRoot":"","sources":["../../../src/commands/data-core/data-core.update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,8BAA8B,CAAA;AAG5E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0CAA0C;IAC1C,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IACpC,gDAAgD;IAChD,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC;IAC/E;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,OAAO,IAAI,MAAM,GAAG,SAAS;IAQhD;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ;CAGjE"}
@@ -0,0 +1,43 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { DataCoreSchema } from "../../contracts/data-core.js";
3
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
+ import { CommandError } from "../../exceptions/command-error.js";
5
+ /**
6
+ * Update a data core
7
+ */
8
+ export class DataCoreUpdateCommand extends Command {
9
+ /**
10
+ * Get the method
11
+ */
12
+ getMethod() {
13
+ return "PATCH";
14
+ }
15
+ /**
16
+ * Get the base url
17
+ */
18
+ getBaseUrl() {
19
+ return "https://data-core-2.api.flowcore.io";
20
+ }
21
+ /**
22
+ * Get the path
23
+ */
24
+ getPath() {
25
+ return `/api/v1/data-cores/${this.input.dataCoreId}`;
26
+ }
27
+ /**
28
+ * Get the body for the request
29
+ */
30
+ getBody() {
31
+ const { dataCoreId: _dataCoreId, ...payload } = this.input;
32
+ if (Object.keys(payload).length === 0) {
33
+ throw new CommandError(this.constructor.name, "No fields to update");
34
+ }
35
+ return JSON.stringify(payload);
36
+ }
37
+ /**
38
+ * Parse the response
39
+ */
40
+ parseResponse(rawResponse) {
41
+ return parseResponseHelper(DataCoreSchema, rawResponse);
42
+ }
43
+ }
@@ -0,0 +1,35 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type EventType } from "../../contracts/event-type.js";
3
+ /**
4
+ * The input for the event type create command
5
+ */
6
+ export type EventTypeCreateInput = {
7
+ /** The id of the flow type */
8
+ flowTypeId: string;
9
+ /** The name of the event type */
10
+ name: string;
11
+ /** The description of the event type */
12
+ description: string;
13
+ };
14
+ /**
15
+ * Create an event type
16
+ */
17
+ export declare class EventTypeCreateCommand extends Command<EventTypeCreateInput, EventType> {
18
+ /**
19
+ * Get the method
20
+ */
21
+ protected getMethod(): string;
22
+ /**
23
+ * Get the base url
24
+ */
25
+ protected getBaseUrl(): string;
26
+ /**
27
+ * Get the path
28
+ */
29
+ protected getPath(): string;
30
+ /**
31
+ * Parse the response
32
+ */
33
+ protected parseResponse(rawResponse: unknown): EventType;
34
+ }
35
+ //# sourceMappingURL=event-type.create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-type.create.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,+BAA+B,CAAA;AAG/E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,oBAAoB,EAAE,SAAS,CAAC;IAClF;;OAEG;cACgB,SAAS,IAAI,MAAM;IAGtC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS;CAGlE"}
@@ -0,0 +1,32 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { EventTypeSchema } from "../../contracts/event-type.js";
3
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
+ /**
5
+ * Create an event type
6
+ */
7
+ export class EventTypeCreateCommand extends Command {
8
+ /**
9
+ * Get the method
10
+ */
11
+ getMethod() {
12
+ return "POST";
13
+ }
14
+ /**
15
+ * Get the base url
16
+ */
17
+ getBaseUrl() {
18
+ return "https://event-type-2.api.flowcore.io";
19
+ }
20
+ /**
21
+ * Get the path
22
+ */
23
+ getPath() {
24
+ return `/api/v1/event-types`;
25
+ }
26
+ /**
27
+ * Parse the response
28
+ */
29
+ parseResponse(rawResponse) {
30
+ return parseResponseHelper(EventTypeSchema, rawResponse);
31
+ }
32
+ }
@@ -0,0 +1,37 @@
1
+ import { GraphQlCommand } from "../../common/command.js";
2
+ import type { FlowcoreClient } from "../../common/flowcore-client.js";
3
+ /**
4
+ * The input for the event type delete request command
5
+ */
6
+ export type EventTypeDeleteRequestInput = {
7
+ /** The id of the event type */
8
+ eventTypeId: string;
9
+ /** Wait for the event type to be deleted (default: true) */
10
+ waitForDelete?: boolean;
11
+ };
12
+ /**
13
+ * Request to delete a event type
14
+ */
15
+ export declare class EventTypeDeleteRequestCommand extends GraphQlCommand<EventTypeDeleteRequestInput, boolean> {
16
+ /**
17
+ * The allowed modes for the command
18
+ */
19
+ protected allowedModes: ("apiKey" | "bearer")[];
20
+ /**
21
+ * Create a new event type delete request command
22
+ */
23
+ constructor(input: EventTypeDeleteRequestInput);
24
+ /**
25
+ * Parse the response
26
+ */
27
+ protected parseResponse(response: unknown): boolean;
28
+ /**
29
+ * Get the body for the request
30
+ */
31
+ protected getBody(): string;
32
+ /**
33
+ * Wait for the response (timeout: 25 seconds)
34
+ */
35
+ protected waitForResponse(client: FlowcoreClient, response: boolean): Promise<boolean>;
36
+ }
37
+ //# sourceMappingURL=event-type.delete-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-type.delete-request.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.delete-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAGrE;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IAEnB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AA+BD;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,cAAc,CAAC,2BAA2B,EAAE,OAAO,CAAC;IACrG;;OAEG;IACH,UAAmB,YAAY,EAAE,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAa;IAErE;;OAEG;gBACS,KAAK,EAAE,2BAA2B;IAO9C;;OAEG;cACgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAW5D;;OAEG;cACgB,OAAO,IAAI,MAAM;IAQpC;;OAEG;cACsB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAkBtG"}
@@ -0,0 +1,98 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { GraphQlCommand } from "../../common/command.js";
3
+ import { CommandError } from "../../exceptions/command-error.js";
4
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
5
+ import { NotFoundException } from "../../exceptions/not-found.js";
6
+ import { EventTypeExistsCommand } from "./event-type.exists.js";
7
+ const graphQlQuery = `
8
+ mutation FLOWCORE_SDK_EVENT_TYPE_DELETE_REQUEST($eventTypeId: ID!) {
9
+ eventType(id: $eventTypeId) {
10
+ requestDelete {
11
+ deleting
12
+ }
13
+ }
14
+ }
15
+ `;
16
+ const responseSchema = Type.Object({
17
+ errors: Type.Optional(Type.Array(Type.Object({
18
+ message: Type.String(),
19
+ }))),
20
+ data: Type.Union([
21
+ Type.Object({
22
+ eventType: Type.Object({
23
+ requestDelete: Type.Union([
24
+ Type.Object({
25
+ deleting: Type.Boolean(),
26
+ }),
27
+ Type.Null(),
28
+ ]),
29
+ }),
30
+ }),
31
+ Type.Null(),
32
+ ]),
33
+ });
34
+ /**
35
+ * Request to delete a event type
36
+ */
37
+ export class EventTypeDeleteRequestCommand extends GraphQlCommand {
38
+ /**
39
+ * Create a new event type delete request command
40
+ */
41
+ constructor(input) {
42
+ super({
43
+ ...input,
44
+ waitForDelete: input.waitForDelete ?? true,
45
+ });
46
+ /**
47
+ * The allowed modes for the command
48
+ */
49
+ Object.defineProperty(this, "allowedModes", {
50
+ enumerable: true,
51
+ configurable: true,
52
+ writable: true,
53
+ value: ["bearer"]
54
+ });
55
+ }
56
+ /**
57
+ * Parse the response
58
+ */
59
+ parseResponse(response) {
60
+ const parsedResponse = parseResponseHelper(responseSchema, response);
61
+ if (parsedResponse.errors) {
62
+ throw new CommandError(this.constructor.name, parsedResponse.errors[0].message);
63
+ }
64
+ if (!parsedResponse.data?.eventType?.requestDelete) {
65
+ throw new NotFoundException("EventType", this.input.eventTypeId);
66
+ }
67
+ return parsedResponse.data.eventType.requestDelete.deleting;
68
+ }
69
+ /**
70
+ * Get the body for the request
71
+ */
72
+ getBody() {
73
+ const { waitForDelete: _, ...rest } = this.input;
74
+ return JSON.stringify({
75
+ query: graphQlQuery,
76
+ variables: rest,
77
+ });
78
+ }
79
+ /**
80
+ * Wait for the response (timeout: 25 seconds)
81
+ */
82
+ async waitForResponse(client, response) {
83
+ if (!this.input.waitForDelete) {
84
+ return response;
85
+ }
86
+ const start = Date.now();
87
+ while (Date.now() - start < 25_000) {
88
+ const response = await client.execute(new EventTypeExistsCommand({
89
+ eventTypeId: this.input.eventTypeId,
90
+ }));
91
+ if (!response.exists) {
92
+ break;
93
+ }
94
+ await new Promise((resolve) => setTimeout(resolve, 100));
95
+ }
96
+ return response;
97
+ }
98
+ }
@@ -0,0 +1,37 @@
1
+ import { Command } from "../../common/command.js";
2
+ /**
3
+ * The input for the event type exists command
4
+ */
5
+ export interface EventTypeExistsInput {
6
+ /** The id of the event type */
7
+ eventTypeId: string;
8
+ }
9
+ /**
10
+ * The output for the event type exists command
11
+ */
12
+ export interface EventTypeExistsOutput {
13
+ /** Whether the event type exists */
14
+ exists: boolean;
15
+ }
16
+ /**
17
+ * Check if an event type exists
18
+ */
19
+ export declare class EventTypeExistsCommand extends Command<EventTypeExistsInput, EventTypeExistsOutput> {
20
+ /**
21
+ * Get the method
22
+ */
23
+ protected getMethod(): string;
24
+ /**
25
+ * Get the base url
26
+ */
27
+ protected getBaseUrl(): string;
28
+ /**
29
+ * Get the path
30
+ */
31
+ protected getPath(): string;
32
+ /**
33
+ * Parse the response
34
+ */
35
+ protected parseResponse(rawResponse: unknown): EventTypeExistsOutput;
36
+ }
37
+ //# sourceMappingURL=event-type.exists.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-type.exists.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.exists.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAGjD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,MAAM,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,OAAO,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;IAC9F;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAIpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,qBAAqB;CAI9E"}
@@ -0,0 +1,33 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
4
+ /**
5
+ * Check if an event type exists
6
+ */
7
+ export class EventTypeExistsCommand extends Command {
8
+ /**
9
+ * Get the method
10
+ */
11
+ getMethod() {
12
+ return "GET";
13
+ }
14
+ /**
15
+ * Get the base url
16
+ */
17
+ getBaseUrl() {
18
+ return "https://event-type-2.api.flowcore.io";
19
+ }
20
+ /**
21
+ * Get the path
22
+ */
23
+ getPath() {
24
+ return `/api/v1/event-types/${this.input.eventTypeId}/exists`;
25
+ }
26
+ /**
27
+ * Parse the response
28
+ */
29
+ parseResponse(rawResponse) {
30
+ const response = parseResponseHelper(Type.Object({ exists: Type.Boolean() }), rawResponse);
31
+ return response;
32
+ }
33
+ }
@@ -0,0 +1,45 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type EventType } from "../../contracts/event-type.js";
3
+ interface EventTypeFetchByIdInput {
4
+ /** The id of the event type */
5
+ eventTypeId: string;
6
+ /** The id of the flow type */
7
+ flowTypeId?: never;
8
+ /** The name of the event type */
9
+ eventType?: never;
10
+ }
11
+ interface EventTypeFetchByNameInput {
12
+ /** The id of the flow type */
13
+ flowTypeId: string;
14
+ /** The name of the event type */
15
+ eventType: string;
16
+ /** The id of the event type */
17
+ eventTypeId?: never;
18
+ }
19
+ /**
20
+ * The input for the event type fetch command
21
+ */
22
+ export type EventTypeFetchInput = EventTypeFetchByIdInput | EventTypeFetchByNameInput;
23
+ /**
24
+ * Fetch an event type
25
+ */
26
+ export declare class EventTypeFetchCommand extends Command<EventTypeFetchInput, EventType> {
27
+ /**
28
+ * Get the method
29
+ */
30
+ protected getMethod(): string;
31
+ /**
32
+ * Get the base url
33
+ */
34
+ protected getBaseUrl(): string;
35
+ /**
36
+ * Get the path
37
+ */
38
+ protected getPath(): string;
39
+ /**
40
+ * Parse the response
41
+ */
42
+ protected parseResponse(rawResponse: unknown): EventType;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=event-type.fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-type.fetch.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.fetch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AACjD,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,+BAA+B,CAAA;AAI/E,UAAU,uBAAuB;IAC/B,+BAA+B;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAA;IAClB,iCAAiC;IACjC,SAAS,CAAC,EAAE,KAAK,CAAA;CAClB;AAED,UAAU,yBAAyB;IACjC,8BAA8B;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,yBAAyB,CAAA;AAErF;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,OAAO,CAAC,mBAAmB,EAAE,SAAS,CAAC;IAChF;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAUpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS;CAWlE"}
@@ -0,0 +1,48 @@
1
+ import { Type } from "@sinclair/typebox";
2
+ import { Command } from "../../common/command.js";
3
+ import { EventTypeSchema } from "../../contracts/event-type.js";
4
+ import { NotFoundException } from "../../exceptions/not-found.js";
5
+ import { parseResponseHelper } from "../../utils/parse-response-helper.js";
6
+ /**
7
+ * Fetch an event type
8
+ */
9
+ export class EventTypeFetchCommand extends Command {
10
+ /**
11
+ * Get the method
12
+ */
13
+ getMethod() {
14
+ return "GET";
15
+ }
16
+ /**
17
+ * Get the base url
18
+ */
19
+ getBaseUrl() {
20
+ return "https://event-type-2.api.flowcore.io";
21
+ }
22
+ /**
23
+ * Get the path
24
+ */
25
+ getPath() {
26
+ if ("eventTypeId" in this.input) {
27
+ return `/api/v1/event-types/${this.input.eventTypeId}`;
28
+ }
29
+ const queryParams = new URLSearchParams();
30
+ queryParams.set("flowTypeId", this.input.flowTypeId);
31
+ queryParams.set("name", this.input.eventType);
32
+ return `/api/v1/event-types?${queryParams.toString()}`;
33
+ }
34
+ /**
35
+ * Parse the response
36
+ */
37
+ parseResponse(rawResponse) {
38
+ if ("eventTypeId" in this.input) {
39
+ const response = parseResponseHelper(EventTypeSchema, rawResponse);
40
+ return response;
41
+ }
42
+ const response = parseResponseHelper(Type.Array(EventTypeSchema), rawResponse);
43
+ if (response.length === 0) {
44
+ throw new NotFoundException("EventType", this.input.eventType);
45
+ }
46
+ return response[0];
47
+ }
48
+ }
@@ -0,0 +1,31 @@
1
+ import { Command } from "../../common/command.js";
2
+ import { type EventType } from "../../contracts/event-type.js";
3
+ /**
4
+ * The input for the event type list command
5
+ */
6
+ export type EventTypeListInput = {
7
+ /** The flow type id */
8
+ flowTypeId: string;
9
+ };
10
+ /**
11
+ * Fetch all event types for a flow type
12
+ */
13
+ export declare class EventTypeListCommand extends Command<EventTypeListInput, EventType[]> {
14
+ /**
15
+ * Get the method
16
+ */
17
+ protected getMethod(): string;
18
+ /**
19
+ * Get the base url
20
+ */
21
+ protected getBaseUrl(): string;
22
+ /**
23
+ * Get the path
24
+ */
25
+ protected getPath(): string;
26
+ /**
27
+ * Parse the response
28
+ */
29
+ protected parseResponse(rawResponse: unknown): EventType[];
30
+ }
31
+ //# sourceMappingURL=event-type.list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-type.list.d.ts","sourceRoot":"","sources":["../../../src/commands/event-type/event-type.list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEjD,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,+BAA+B,CAAA;AAG/E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,OAAO,CAAC,kBAAkB,EAAE,SAAS,EAAE,CAAC;IAChF;;OAEG;cACgB,SAAS,IAAI,MAAM;IAItC;;OAEG;cACgB,UAAU,IAAI,MAAM;IAIvC;;OAEG;cACgB,OAAO,IAAI,MAAM;IAMpC;;OAEG;cACgB,aAAa,CAAC,WAAW,EAAE,OAAO,GAAG,SAAS,EAAE;CAIpE"}