@ductape/sdk 0.0.4-v5 → 0.0.4-v51

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 (338) hide show
  1. package/README.md +1 -1
  2. package/dist/api/services/appApi.service.d.ts +48 -2
  3. package/dist/api/services/appApi.service.js +101 -2
  4. package/dist/api/services/appApi.service.js.map +1 -1
  5. package/dist/api/services/pricingApi.service.d.ts +10 -0
  6. package/dist/api/services/pricingApi.service.js +34 -0
  7. package/dist/api/services/pricingApi.service.js.map +1 -0
  8. package/dist/api/services/processorApi.service.d.ts +12 -2
  9. package/dist/api/services/processorApi.service.js +12 -2
  10. package/dist/api/services/processorApi.service.js.map +1 -1
  11. package/dist/api/services/productsApi.service.d.ts +40 -1
  12. package/dist/api/services/productsApi.service.js +105 -1
  13. package/dist/api/services/productsApi.service.js.map +1 -1
  14. package/dist/api/services/userApi.service.js +1 -0
  15. package/dist/api/services/userApi.service.js.map +1 -1
  16. package/dist/api/services/workspaceApi.service.js +1 -0
  17. package/dist/api/services/workspaceApi.service.js.map +1 -1
  18. package/dist/api/services/workspaceSecretsApi.service.d.ts +75 -0
  19. package/dist/api/services/workspaceSecretsApi.service.js +62 -0
  20. package/dist/api/services/workspaceSecretsApi.service.js.map +1 -0
  21. package/dist/api/urls.d.ts +6 -1
  22. package/dist/api/urls.js +12 -2
  23. package/dist/api/urls.js.map +1 -1
  24. package/dist/api/utils/cache.utils.d.ts +1 -1
  25. package/dist/api/utils/cache.utils.js +10 -4
  26. package/dist/api/utils/cache.utils.js.map +1 -1
  27. package/dist/api/utils/strings.utils.d.ts +2 -0
  28. package/dist/api/utils/strings.utils.js +14 -0
  29. package/dist/api/utils/strings.utils.js.map +1 -1
  30. package/dist/apps/services/app.service.d.ts +51 -33
  31. package/dist/apps/services/app.service.js +488 -244
  32. package/dist/apps/services/app.service.js.map +1 -1
  33. package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
  34. package/dist/apps/validators/joi-validators/create.appAction.validator.js +21 -2
  35. package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
  36. package/dist/apps/validators/joi-validators/create.appWebhook.validator.d.ts +1 -2
  37. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js +2 -15
  38. package/dist/apps/validators/joi-validators/create.appWebhook.validator.js.map +1 -1
  39. package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -1
  40. package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
  41. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
  42. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
  43. package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
  44. package/dist/apps/validators/joi-validators/update.appWebhook.validator.d.ts +1 -2
  45. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js +2 -14
  46. package/dist/apps/validators/joi-validators/update.appWebhook.validator.js.map +1 -1
  47. package/dist/clients/pricing.client.d.ts +3 -0
  48. package/dist/clients/pricing.client.js +33 -0
  49. package/dist/clients/pricing.client.js.map +1 -0
  50. package/dist/database/adapters/base.adapter.d.ts +176 -0
  51. package/dist/database/adapters/base.adapter.js +31 -0
  52. package/dist/database/adapters/base.adapter.js.map +1 -0
  53. package/dist/database/adapters/dynamodb.adapter.d.ts +91 -0
  54. package/dist/database/adapters/dynamodb.adapter.js +1608 -0
  55. package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
  56. package/dist/database/adapters/mongodb.adapter.d.ts +71 -0
  57. package/dist/database/adapters/mongodb.adapter.js +1072 -0
  58. package/dist/database/adapters/mongodb.adapter.js.map +1 -0
  59. package/dist/database/adapters/mysql.adapter.d.ts +146 -0
  60. package/dist/database/adapters/mysql.adapter.js +1492 -0
  61. package/dist/database/adapters/mysql.adapter.js.map +1 -0
  62. package/dist/database/adapters/postgresql.adapter.d.ts +147 -0
  63. package/dist/database/adapters/postgresql.adapter.js +1603 -0
  64. package/dist/database/adapters/postgresql.adapter.js.map +1 -0
  65. package/dist/database/database.service.d.ts +232 -0
  66. package/dist/database/database.service.js +802 -0
  67. package/dist/database/database.service.js.map +1 -0
  68. package/dist/database/index.d.ts +18 -0
  69. package/dist/database/index.js +98 -0
  70. package/dist/database/index.js.map +1 -0
  71. package/dist/database/types/aggregation.types.d.ts +261 -0
  72. package/dist/database/types/aggregation.types.js +21 -0
  73. package/dist/database/types/aggregation.types.js.map +1 -0
  74. package/dist/database/types/connection.types.d.ts +132 -0
  75. package/dist/database/types/connection.types.js +6 -0
  76. package/dist/database/types/connection.types.js.map +1 -0
  77. package/dist/database/types/database.types.d.ts +175 -0
  78. package/dist/database/types/database.types.js +75 -0
  79. package/dist/database/types/database.types.js.map +1 -0
  80. package/dist/database/types/index.d.ts +12 -0
  81. package/dist/database/types/index.js +37 -0
  82. package/dist/database/types/index.js.map +1 -0
  83. package/dist/database/types/index.types.d.ts +220 -0
  84. package/dist/database/types/index.types.js +27 -0
  85. package/dist/database/types/index.types.js.map +1 -0
  86. package/dist/database/types/migration.types.d.ts +205 -0
  87. package/dist/database/types/migration.types.js +44 -0
  88. package/dist/database/types/migration.types.js.map +1 -0
  89. package/dist/database/types/query.types.d.ts +305 -0
  90. package/dist/database/types/query.types.js +57 -0
  91. package/dist/database/types/query.types.js.map +1 -0
  92. package/dist/database/types/result.types.d.ts +220 -0
  93. package/dist/database/types/result.types.js +6 -0
  94. package/dist/database/types/result.types.js.map +1 -0
  95. package/dist/database/types/schema.types.d.ts +190 -0
  96. package/dist/database/types/schema.types.js +69 -0
  97. package/dist/database/types/schema.types.js.map +1 -0
  98. package/dist/database/utils/helpers.d.ts +66 -0
  99. package/dist/database/utils/helpers.js +501 -0
  100. package/dist/database/utils/helpers.js.map +1 -0
  101. package/dist/database/utils/migration.utils.d.ts +151 -0
  102. package/dist/database/utils/migration.utils.js +476 -0
  103. package/dist/database/utils/migration.utils.js.map +1 -0
  104. package/dist/database/utils/transaction.d.ts +64 -0
  105. package/dist/database/utils/transaction.js +130 -0
  106. package/dist/database/utils/transaction.js.map +1 -0
  107. package/dist/database/validators/connection.validator.d.ts +20 -0
  108. package/dist/database/validators/connection.validator.js +267 -0
  109. package/dist/database/validators/connection.validator.js.map +1 -0
  110. package/dist/database/validators/query.validator.d.ts +31 -0
  111. package/dist/database/validators/query.validator.js +305 -0
  112. package/dist/database/validators/query.validator.js.map +1 -0
  113. package/dist/database/validators/schema.validator.d.ts +31 -0
  114. package/dist/database/validators/schema.validator.js +334 -0
  115. package/dist/database/validators/schema.validator.js.map +1 -0
  116. package/dist/graph/adapters/arangodb.adapter.d.ts +80 -0
  117. package/dist/graph/adapters/arangodb.adapter.js +1393 -0
  118. package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
  119. package/dist/graph/adapters/base.adapter.d.ts +228 -0
  120. package/dist/graph/adapters/base.adapter.js +38 -0
  121. package/dist/graph/adapters/base.adapter.js.map +1 -0
  122. package/dist/graph/adapters/index.d.ts +10 -0
  123. package/dist/graph/adapters/index.js +23 -0
  124. package/dist/graph/adapters/index.js.map +1 -0
  125. package/dist/graph/adapters/memgraph.adapter.d.ts +85 -0
  126. package/dist/graph/adapters/memgraph.adapter.js +1491 -0
  127. package/dist/graph/adapters/memgraph.adapter.js.map +1 -0
  128. package/dist/graph/adapters/neo4j.adapter.d.ts +88 -0
  129. package/dist/graph/adapters/neo4j.adapter.js +1861 -0
  130. package/dist/graph/adapters/neo4j.adapter.js.map +1 -0
  131. package/dist/graph/adapters/neptune.adapter.d.ts +87 -0
  132. package/dist/graph/adapters/neptune.adapter.js +1430 -0
  133. package/dist/graph/adapters/neptune.adapter.js.map +1 -0
  134. package/dist/graph/graph.service.d.ts +278 -0
  135. package/dist/graph/graph.service.js +687 -0
  136. package/dist/graph/graph.service.js.map +1 -0
  137. package/dist/graph/index.d.ts +11 -0
  138. package/dist/graph/index.js +42 -0
  139. package/dist/graph/index.js.map +1 -0
  140. package/dist/graph/types/connection.types.d.ts +158 -0
  141. package/dist/graph/types/connection.types.js +43 -0
  142. package/dist/graph/types/connection.types.js.map +1 -0
  143. package/dist/graph/types/graph.types.d.ts +144 -0
  144. package/dist/graph/types/graph.types.js +84 -0
  145. package/dist/graph/types/graph.types.js.map +1 -0
  146. package/dist/graph/types/index.d.ts +11 -0
  147. package/dist/graph/types/index.js +35 -0
  148. package/dist/graph/types/index.js.map +1 -0
  149. package/dist/graph/types/node.types.d.ts +193 -0
  150. package/dist/graph/types/node.types.js +49 -0
  151. package/dist/graph/types/node.types.js.map +1 -0
  152. package/dist/graph/types/path.types.d.ts +224 -0
  153. package/dist/graph/types/path.types.js +38 -0
  154. package/dist/graph/types/path.types.js.map +1 -0
  155. package/dist/graph/types/query.types.d.ts +247 -0
  156. package/dist/graph/types/query.types.js +23 -0
  157. package/dist/graph/types/query.types.js.map +1 -0
  158. package/dist/graph/types/relationship.types.d.ts +224 -0
  159. package/dist/graph/types/relationship.types.js +35 -0
  160. package/dist/graph/types/relationship.types.js.map +1 -0
  161. package/dist/graph/types/result.types.d.ts +237 -0
  162. package/dist/graph/types/result.types.js +7 -0
  163. package/dist/graph/types/result.types.js.map +1 -0
  164. package/dist/graph/validators/index.d.ts +81 -0
  165. package/dist/graph/validators/index.js +243 -0
  166. package/dist/graph/validators/index.js.map +1 -0
  167. package/dist/imports/imports.service.d.ts +3 -3
  168. package/dist/imports/imports.service.js +7 -7
  169. package/dist/imports/imports.service.js.map +1 -1
  170. package/dist/imports/imports.types.d.ts +8 -0
  171. package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
  172. package/dist/imports/repos/postmanV21.repo.js +29 -2
  173. package/dist/imports/repos/postmanV21.repo.js.map +1 -1
  174. package/dist/index.d.ts +1244 -150
  175. package/dist/index.js +1309 -209
  176. package/dist/index.js.map +1 -1
  177. package/dist/inputs/inputs.service.js +2 -2
  178. package/dist/inputs/inputs.service.js.map +1 -1
  179. package/dist/inputs/utils/inputs.utils.create.js +1 -1
  180. package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
  181. package/dist/logs/logs.types.d.ts +5 -0
  182. package/dist/logs/logs.types.js +1 -0
  183. package/dist/logs/logs.types.js.map +1 -1
  184. package/dist/parsers/index.d.ts +3 -0
  185. package/dist/parsers/index.js +27 -0
  186. package/dist/parsers/index.js.map +1 -0
  187. package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
  188. package/dist/parsers/pipelines/postman.pipelines.js +103 -0
  189. package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
  190. package/dist/parsers/types/postman.types.d.ts +200 -0
  191. package/dist/parsers/types/postman.types.js +3 -0
  192. package/dist/parsers/types/postman.types.js.map +1 -0
  193. package/dist/parsers/utils/postman.utils.d.ts +12 -0
  194. package/dist/parsers/utils/postman.utils.js +116 -0
  195. package/dist/parsers/utils/postman.utils.js.map +1 -0
  196. package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
  197. package/dist/parsers/validators/postman-auth.validators.js +127 -0
  198. package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
  199. package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
  200. package/dist/parsers/validators/postman-request.validators.js +139 -0
  201. package/dist/parsers/validators/postman-request.validators.js.map +1 -0
  202. package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
  203. package/dist/parsers/validators/postman-response.validators.js +150 -0
  204. package/dist/parsers/validators/postman-response.validators.js.map +1 -0
  205. package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
  206. package/dist/parsers/validators/postman-variable.validators.js +163 -0
  207. package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
  208. package/dist/pricing/pricing.repo.d.ts +0 -0
  209. package/dist/pricing/pricing.repo.js +1 -0
  210. package/dist/pricing/pricing.repo.js.map +1 -0
  211. package/dist/pricing/pricing.service.d.ts +24 -0
  212. package/dist/pricing/pricing.service.js +51 -0
  213. package/dist/pricing/pricing.service.js.map +1 -0
  214. package/dist/pricing/pricing.types.d.ts +76 -0
  215. package/dist/pricing/pricing.types.js +21 -0
  216. package/dist/pricing/pricing.types.js.map +1 -0
  217. package/dist/pricing/utils/string.utils.d.ts +1 -0
  218. package/dist/pricing/utils/string.utils.js +9 -0
  219. package/dist/pricing/utils/string.utils.js.map +1 -0
  220. package/dist/processor/repos/sms.repo.d.ts +4 -4
  221. package/dist/processor/repos/sms.repo.js +23 -10
  222. package/dist/processor/repos/sms.repo.js.map +1 -1
  223. package/dist/processor/services/messagebrokers/kafka.service.js +0 -2
  224. package/dist/processor/services/messagebrokers/kafka.service.js.map +1 -1
  225. package/dist/processor/services/messagebrokers/rabbitmq.service.d.ts +9 -1
  226. package/dist/processor/services/messagebrokers/rabbitmq.service.js +40 -11
  227. package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +1 -1
  228. package/dist/processor/services/processor.service.d.ts +38 -10
  229. package/dist/processor/services/processor.service.js +533 -248
  230. package/dist/processor/services/processor.service.js.map +1 -1
  231. package/dist/processor/services/request.service.d.ts +36 -0
  232. package/dist/processor/services/request.service.js +304 -0
  233. package/dist/processor/services/request.service.js.map +1 -0
  234. package/dist/processor/types/request.types.d.ts +14 -0
  235. package/dist/processor/types/request.types.js +3 -0
  236. package/dist/processor/types/request.types.js.map +1 -0
  237. package/dist/processor/utils/processor.utils.d.ts +3 -0
  238. package/dist/processor/utils/processor.utils.js +84 -22
  239. package/dist/processor/utils/processor.utils.js.map +1 -1
  240. package/dist/processor/utils/request.utils.d.ts +20 -0
  241. package/dist/processor/utils/request.utils.js +113 -0
  242. package/dist/processor/utils/request.utils.js.map +1 -0
  243. package/dist/products/services/products.service.d.ts +114 -77
  244. package/dist/products/services/products.service.js +805 -362
  245. package/dist/products/services/products.service.js.map +1 -1
  246. package/dist/products/services/utils/crypt.utils.d.ts +1 -0
  247. package/dist/products/services/utils/crypt.utils.js +17 -0
  248. package/dist/products/services/utils/crypt.utils.js.map +1 -0
  249. package/dist/products/services/utils/functions.utils.d.ts +13 -0
  250. package/dist/products/services/utils/functions.utils.js +289 -0
  251. package/dist/products/services/utils/functions.utils.js.map +1 -0
  252. package/dist/products/services/utils/objects.utils.d.ts +13 -0
  253. package/dist/products/services/utils/objects.utils.js +89 -0
  254. package/dist/products/services/utils/objects.utils.js.map +1 -0
  255. package/dist/products/services/utils/string.utils.d.ts +12 -0
  256. package/dist/products/services/utils/string.utils.js +168 -0
  257. package/dist/products/services/utils/string.utils.js.map +1 -0
  258. package/dist/products/utils/string.utils.d.ts +1 -1
  259. package/dist/products/utils/string.utils.js +14 -2
  260. package/dist/products/utils/string.utils.js.map +1 -1
  261. package/dist/products/validators/index.d.ts +4 -1
  262. package/dist/products/validators/index.js +7 -1
  263. package/dist/products/validators/index.js.map +1 -1
  264. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.d.ts +15 -4
  265. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js +501 -109
  266. package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js.map +1 -1
  267. package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
  268. package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
  269. package/dist/products/validators/joi-validators/create.productGraph.validator.d.ts +3 -0
  270. package/dist/products/validators/joi-validators/create.productGraph.validator.js +82 -0
  271. package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -0
  272. package/dist/products/validators/joi-validators/create.productGraphAction.validator.d.ts +14 -0
  273. package/dist/products/validators/joi-validators/create.productGraphAction.validator.js +696 -0
  274. package/dist/products/validators/joi-validators/create.productGraphAction.validator.js.map +1 -0
  275. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
  276. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
  277. package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
  278. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js +1 -0
  279. package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +1 -1
  280. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +9 -4
  281. package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
  282. package/dist/products/validators/joi-validators/create.productNotification.validator.js +5 -2
  283. package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
  284. package/dist/products/validators/joi-validators/create.userAuth.validator.js +1 -0
  285. package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +1 -1
  286. package/dist/products/validators/joi-validators/update.dataValue.validator.js +1 -0
  287. package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
  288. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.d.ts +6 -0
  289. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js +28 -26
  290. package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js.map +1 -1
  291. package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
  292. package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
  293. package/dist/products/validators/joi-validators/update.productGraph.validator.d.ts +3 -0
  294. package/dist/products/validators/joi-validators/update.productGraph.validator.js +87 -0
  295. package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -0
  296. package/dist/products/validators/joi-validators/update.productGraphAction.validator.d.ts +7 -0
  297. package/dist/products/validators/joi-validators/update.productGraphAction.validator.js +72 -0
  298. package/dist/products/validators/joi-validators/update.productGraphAction.validator.js.map +1 -0
  299. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js +1 -0
  300. package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js.map +1 -1
  301. package/dist/products/validators/joi-validators/update.userAuth.validator.js +1 -0
  302. package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +1 -1
  303. package/dist/test/test.health.d.ts +1 -0
  304. package/dist/test/test.health.js +49 -0
  305. package/dist/test/test.health.js.map +1 -0
  306. package/dist/test/test.import.js +51 -4
  307. package/dist/test/test.import.js.map +1 -1
  308. package/dist/test/test.imports.js +22 -7
  309. package/dist/test/test.imports.js.map +1 -1
  310. package/dist/test/test.notifiers.d.ts +1 -0
  311. package/dist/test/test.notifiers.js +85 -0
  312. package/dist/test/test.notifiers.js.map +1 -0
  313. package/dist/test/test.processor.js +30 -115
  314. package/dist/test/test.processor.js.map +1 -1
  315. package/dist/test/test.products.d.ts +1 -0
  316. package/dist/test/test.products.js +49 -0
  317. package/dist/test/test.products.js.map +1 -0
  318. package/dist/tsconfig.tsbuildinfo +1 -0
  319. package/dist/types/appBuilder.types.d.ts +5 -12
  320. package/dist/types/enums.d.ts +4 -1
  321. package/dist/types/enums.js +3 -0
  322. package/dist/types/enums.js.map +1 -1
  323. package/dist/types/index.types.d.ts +4 -0
  324. package/dist/types/pricing.types.d.ts +4 -0
  325. package/dist/types/pricing.types.js +3 -0
  326. package/dist/types/pricing.types.js.map +1 -0
  327. package/dist/types/processor.types.d.ts +67 -11
  328. package/dist/types/processor.types.js.map +1 -1
  329. package/dist/types/productsBuilder.types.d.ts +132 -14
  330. package/dist/types/productsBuilder.types.js +69 -4
  331. package/dist/types/productsBuilder.types.js.map +1 -1
  332. package/dist/types/request-tracker.interface.d.ts +0 -0
  333. package/dist/types/request-tracker.interface.js +1 -0
  334. package/dist/types/request-tracker.interface.js.map +1 -0
  335. package/dist/utils/constants.d.ts +1 -0
  336. package/dist/utils/constants.js +5 -0
  337. package/dist/utils/constants.js.map +1 -0
  338. package/package.json +17 -3
@@ -10,7 +10,7 @@ const inputs_service_1 = __importDefault(require("../../inputs/inputs.service"))
10
10
  const string_utils_1 = require("../utils/string.utils");
11
11
  const strings_utils_1 = require("../../api/utils/strings.utils");
12
12
  const workspaceApi_service_1 = require("../../api/services/workspaceApi.service");
13
- const string_utils_2 = require("../../products/utils/string.utils");
13
+ const string_utils_2 = require("../../products/services/utils/string.utils");
14
14
  const objects_utils_1 = require("../utils/objects.utils");
15
15
  const create_appWebhook_validator_1 = require("../validators/joi-validators/create.appWebhook.validator");
16
16
  const update_appWebhook_validator_1 = require("../validators/joi-validators/update.appWebhook.validator");
@@ -36,7 +36,7 @@ class AppBuilderService {
36
36
  }
37
37
  else {
38
38
  const app = await this.createNewApp(data);
39
- await this.initializeApp(app._id);
39
+ //await this.initializeApp(app._id);
40
40
  }
41
41
  return { app_id: this.app._id };
42
42
  }
@@ -44,12 +44,20 @@ class AppBuilderService {
44
44
  throw e;
45
45
  }
46
46
  }
47
- initAppVersion() {
48
- this.appVersion = this.app.versions.find((version) => version.latest === true);
47
+ initAppVersion(versionTag) {
48
+ if (versionTag) {
49
+ this.appVersion = this.app.versions.find((version) => version.tag === versionTag);
50
+ if (!this.appVersion) {
51
+ throw new Error(`Version ${versionTag} not found`);
52
+ }
53
+ }
54
+ else {
55
+ this.appVersion = this.app.versions.find((version) => version.latest === true);
56
+ }
49
57
  }
50
58
  async initializeAppByTag(app_tag) {
51
59
  try {
52
- this.app = await this.appApi.fetchAppByTag(app_tag, this.getUserAccess());
60
+ this.app = await this.appApi.initApp(app_tag, this.getUserAccess());
53
61
  this.app_id = this.app._id;
54
62
  this.initAppVersion();
55
63
  }
@@ -59,7 +67,7 @@ class AppBuilderService {
59
67
  }
60
68
  async initializeApp(app_id) {
61
69
  try {
62
- this.app = await this.appApi.fetchApp(app_id, this.getUserAccess());
70
+ this.app = await this.appApi.initApp(app_id, this.getUserAccess());
63
71
  this.app_id = app_id;
64
72
  this.initAppVersion();
65
73
  }
@@ -106,7 +114,7 @@ class AppBuilderService {
106
114
  throw new Error('App not initialized');
107
115
  await validators_1.UpdateAppBuilderSchema.validateAsync(data);
108
116
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { component: types_1.AppComponents.APP, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
109
- await this.initializeApp(this.app_id);
117
+ //await this.initializeApp(this.app_id);
110
118
  }
111
119
  catch (e) {
112
120
  throw e;
@@ -115,10 +123,11 @@ class AppBuilderService {
115
123
  async createEnv(data, throwErrorIfExists = false) {
116
124
  try {
117
125
  // TODO: figure out a way to check if this has run before, halt if it has
118
- if (!this.fetchEnv(data.slug, false)) {
126
+ const existingEnv = await this.fetchEnv(data.slug, false);
127
+ if (!existingEnv) {
119
128
  await validators_1.CreateAppEnvSchema.validateAsync(data);
120
129
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { component: types_1.AppComponents.ENV, action: types_1.RequestAction.CREATE }), this.getUserAccess());
121
- await this.initializeApp(this.app_id);
130
+ //await this.initializeApp(this.app_id);
122
131
  }
123
132
  else {
124
133
  if (throwErrorIfExists)
@@ -131,24 +140,29 @@ class AppBuilderService {
131
140
  }
132
141
  async updateEnv(slug, data) {
133
142
  try {
134
- // const { _id } = this.fetchEnv(slug);
143
+ // const { _id } = await this.fetchEnv(slug);
135
144
  await validators_1.UpdateAppEnvSchema.validateAsync(Object.assign(Object.assign({}, data), { slug }));
136
- if (data.slug && this.fetchEnv(data.slug)) {
137
- throw new Error(`slug ${slug} is in use`); // TODO: also check on the backend
145
+ if (data.slug) {
146
+ const existingEnv = await this.fetchEnv(data.slug, false);
147
+ if (existingEnv) {
148
+ throw new Error(`slug ${slug} is in use`); // TODO: also check on the backend
149
+ }
138
150
  }
139
151
  // TODO: check
140
152
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ slug }, data), { component: types_1.AppComponents.ENV, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
141
- await this.initializeApp(this.app_id);
153
+ //await this.initializeApp(this.app_id);
142
154
  }
143
155
  catch (e) {
144
156
  throw e;
145
157
  }
146
158
  }
147
- fetchEnvs() {
148
- return this.appVersion.envs;
159
+ async fetchEnvs() {
160
+ const components = await this.appApi.fetchAppComponents(this.app_id, 'env', this.getUserAccess(), this.appVersion.tag);
161
+ return components;
149
162
  }
150
- fetchEnv(slug, throwErrorIfExists = true) {
151
- const env = this.appVersion.envs.find((data) => data.slug === slug);
163
+ async fetchEnv(slug, throwErrorIfExists = true) {
164
+ const envs = await this.fetchEnvs();
165
+ const env = envs.find((data) => data.slug === slug);
152
166
  if (!env && throwErrorIfExists)
153
167
  throw new Error(`Env ${slug} not found`);
154
168
  return env;
@@ -179,139 +193,423 @@ class AppBuilderService {
179
193
  },
180
194
  };
181
195
  }
196
+ // Helper function to merge metadata into parsed schema data
197
+ mergeMetadataIntoSchema(parsedData, metadataMap) {
198
+ if (!metadataMap || Object.keys(metadataMap).length === 0) {
199
+ return parsedData;
200
+ }
201
+ return parsedData.map(item => {
202
+ const metadata = metadataMap[item.key || ''];
203
+ if (metadata) {
204
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, item), (metadata.minLength !== undefined ? { minLength: metadata.minLength } : {})), (metadata.maxLength !== undefined ? { maxLength: metadata.maxLength } : {})), (metadata.required !== undefined ? { required: metadata.required } : {})), (metadata.type !== undefined ? { type: metadata.type } : {}));
205
+ }
206
+ return item;
207
+ });
208
+ }
209
+ // Helper function to merge nested metadata for body fields
210
+ mergeNestedBodyMetadata(parsedData, fieldsMetadata) {
211
+ if (!fieldsMetadata || Object.keys(fieldsMetadata).length === 0) {
212
+ return parsedData;
213
+ }
214
+ const applyMetadataRecursively = (data, pathPrefix = '') => {
215
+ return data.map((item) => {
216
+ const fullPath = pathPrefix ? `${pathPrefix}.${item.key}` : item.key;
217
+ const metadata = fieldsMetadata[fullPath];
218
+ let updatedItem = Object.assign({}, item);
219
+ if (metadata) {
220
+ updatedItem = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedItem), (metadata.minLength !== undefined ? { minLength: metadata.minLength } : {})), (metadata.maxLength !== undefined ? { maxLength: metadata.maxLength } : {})), (metadata.required !== undefined ? { required: metadata.required } : {})), (metadata.type !== undefined ? { type: metadata.type } : {}));
221
+ }
222
+ // Recursively apply to nested data (if the parsed item has nested structure)
223
+ if (updatedItem.data && Array.isArray(updatedItem.data) && updatedItem.data.length > 0) {
224
+ updatedItem.data = applyMetadataRecursively(updatedItem.data, fullPath);
225
+ }
226
+ return updatedItem;
227
+ });
228
+ };
229
+ return applyMetadataRecursively(parsedData);
230
+ }
182
231
  async createAction(data, throwErrorIfExists = false) {
232
+ // Validate schema
233
+ await validators_1.CreateAppActionSchema.validateAsync(data);
234
+ data.tag = (0, string_utils_1.tagify)(data.tag);
235
+ const { tag } = data;
236
+ // Check if action already exists
237
+ let exists;
183
238
  try {
184
- let url = data.resource;
185
- if (!data.resource)
186
- throw new Error('resource is required');
187
- data.resource = (0, strings_utils_1.extractURLPath)(url);
188
- await validators_1.CreateAppActionSchema.validateAsync(data);
189
- data.tag = (0, string_utils_1.tagify)(data.tag);
190
- const { tag } = data;
191
- let exists;
192
- try {
193
- exists = this.fetchAction(tag);
194
- }
195
- catch (e) {
196
- exists = false;
197
- }
198
- if (!exists) {
199
- data.resource = url;
200
- //await this.updateActionProcess(tag, { ...data }, RequestAction.CREATE);
201
- }
202
- if (exists && throwErrorIfExists) {
203
- throw new Error(`App action ${tag} already exists`);
204
- }
239
+ exists = await this.fetchAction(tag);
205
240
  }
206
241
  catch (e) {
207
- throw e;
242
+ exists = false;
243
+ }
244
+ if (exists && throwErrorIfExists) {
245
+ throw new Error(`App action ${tag} already exists`);
246
+ }
247
+ if (exists) {
248
+ return; // Silently skip if already exists and not throwing error
249
+ }
250
+ // Build the action body (similar to updateAction but without fetching existing action)
251
+ const body = {
252
+ tag: data.tag,
253
+ name: data.name,
254
+ method: data.method,
255
+ request_type: data.request_type || types_1.DataFormats.JSON,
256
+ description: data.description || '',
257
+ responses: [],
258
+ envs: data.envs || []
259
+ };
260
+ // Batch all parsing operations for parallel execution
261
+ const parseOperations = [];
262
+ const parseKeys = [];
263
+ // Prepare params parsing
264
+ if (data.params) {
265
+ parseKeys.push('params');
266
+ parseOperations.push(this.inputsService.parseJson({
267
+ data: data.params.sample,
268
+ expected: types_1.ExpectedValues.PARSESAMPLE,
269
+ category: types_1.Categories.PARAMS
270
+ }).then(parsedData => ({
271
+ key: 'params',
272
+ parsedData: parsedData,
273
+ metadata: this.extractMetadata(data.params)
274
+ })));
275
+ }
276
+ // Prepare query parsing
277
+ if (data.query) {
278
+ parseKeys.push('query');
279
+ parseOperations.push(this.inputsService.parseJson({
280
+ data: data.query.sample,
281
+ expected: types_1.ExpectedValues.PARSESAMPLE,
282
+ category: types_1.Categories.QUERY
283
+ }).then(parsedData => ({
284
+ key: 'query',
285
+ parsedData: parsedData,
286
+ metadata: this.extractMetadata(data.query)
287
+ })));
288
+ }
289
+ // Prepare body parsing
290
+ if (data.body) {
291
+ const fieldsMetadata = data.body.fieldsMetadata;
292
+ const bodySample = data.body.sample || data.body;
293
+ parseKeys.push('body');
294
+ parseOperations.push(this.inputsService.parseJson({
295
+ data: bodySample,
296
+ expected: types_1.ExpectedValues.PARSESAMPLE,
297
+ category: types_1.Categories.BODY
298
+ }).then(parsedData => ({
299
+ key: 'body',
300
+ parsedData: parsedData,
301
+ fieldsMetadata,
302
+ bodySample,
303
+ metadata: fieldsMetadata ? null : this.extractMetadata(data.body)
304
+ })));
305
+ }
306
+ // Prepare headers parsing
307
+ if (data.headers) {
308
+ parseKeys.push('headers');
309
+ parseOperations.push(this.inputsService.parseJson({
310
+ data: data.headers.sample,
311
+ expected: types_1.ExpectedValues.PARSESAMPLE,
312
+ category: types_1.Categories.HEADER
313
+ }).then(parsedData => ({
314
+ key: 'headers',
315
+ parsedData: parsedData,
316
+ metadata: this.extractMetadata(data.headers)
317
+ })));
318
+ }
319
+ // Prepare response parsing
320
+ if (data.response) {
321
+ parseKeys.push('response');
322
+ parseOperations.push(this.inputsService.parseJson({
323
+ data: data.response.body,
324
+ expected: types_1.ExpectedValues.PARSESAMPLE
325
+ }).then(parsedData => ({
326
+ key: 'response',
327
+ parsedData: parsedData
328
+ })));
329
+ }
330
+ // Execute all parsing operations in parallel
331
+ const parseResults = await Promise.all(parseOperations);
332
+ // Process parsed results
333
+ for (const result of parseResults) {
334
+ switch (result.key) {
335
+ case 'params':
336
+ body.params = {
337
+ type: types_1.InputsTypes.JSON,
338
+ sample: JSON.stringify(data.params.sample),
339
+ data: this.mergeMetadataIntoSchema(result.parsedData, result.metadata)
340
+ };
341
+ break;
342
+ case 'query':
343
+ body.query = {
344
+ type: types_1.InputsTypes.JSON,
345
+ sample: JSON.stringify(data.query.sample),
346
+ data: this.mergeMetadataIntoSchema(result.parsedData, result.metadata)
347
+ };
348
+ break;
349
+ case 'body':
350
+ let finalData = result.parsedData;
351
+ if (result.fieldsMetadata) {
352
+ finalData = this.mergeNestedBodyMetadata(result.parsedData, result.fieldsMetadata);
353
+ }
354
+ else if (result.metadata && Object.keys(result.metadata).length > 0) {
355
+ finalData = this.mergeMetadataIntoSchema(result.parsedData, result.metadata);
356
+ }
357
+ body.body = {
358
+ type: types_1.InputsTypes.JSON,
359
+ sample: JSON.stringify(result.bodySample),
360
+ data: finalData
361
+ };
362
+ break;
363
+ case 'headers':
364
+ body.headers = {
365
+ type: types_1.InputsTypes.JSON,
366
+ sample: JSON.stringify(data.headers.sample),
367
+ data: this.mergeMetadataIntoSchema(result.parsedData, result.metadata)
368
+ };
369
+ break;
370
+ case 'response':
371
+ const response = {
372
+ name: data.response.name || `Response - ${data.response.status_code}`,
373
+ tag: data.tag,
374
+ response_format: data.response.response_format,
375
+ status_code: data.response.status_code,
376
+ success: data.response.success,
377
+ body: {
378
+ sample: JSON.stringify(data.response.body),
379
+ type: types_1.InputsTypes.JSON,
380
+ data: result.parsedData,
381
+ status_code: data.response.status_code,
382
+ }
383
+ };
384
+ body.responses = [response];
385
+ break;
386
+ }
208
387
  }
388
+ // Handle resource URL parsing (only if not already provided params/query)
389
+ if (data.resource) {
390
+ const { params, query: queryData } = await this.extractResourceData(data.resource);
391
+ body.resource = (0, strings_utils_1.extractURLPath)(data.resource);
392
+ // Merge resource-extracted params/query with existing ones
393
+ body.params = Object.assign(Object.assign({}, body.params), params);
394
+ body.query = Object.assign(Object.assign({}, body.query), queryData);
395
+ }
396
+ // Create action via API
397
+ await this.updateActionProcess(tag, body, types_1.RequestAction.CREATE);
398
+ // Update local cache instead of full app refetch
399
+ //this.appVersion.actions.push(body as IAppAction);
209
400
  }
210
- fetchActions() {
211
- return this.appVersion.actions;
401
+ // Helper method to extract metadata from data object
402
+ extractMetadata(data) {
403
+ const metadataMap = {};
404
+ if (data && data.data && Array.isArray(data.data)) {
405
+ data.data.forEach((item) => {
406
+ if (item.metadata) {
407
+ metadataMap[item.key] = item.metadata;
408
+ }
409
+ });
410
+ }
411
+ return metadataMap;
212
412
  }
213
- fetchAction(identifier) {
214
- const action = this.appVersion.actions.find((data) => data.tag === identifier || data._id === identifier);
413
+ async fetchActions() {
414
+ const components = await this.appApi.fetchAppComponents(this.app_id, 'action', this.getUserAccess(), this.appVersion.tag);
415
+ return components;
416
+ }
417
+ async fetchAction(identifier) {
418
+ const actions = await this.fetchActions();
419
+ const action = actions.find((data) => data.tag === identifier || data._id === identifier);
215
420
  if (!action)
216
421
  throw new Error(`Action ${identifier} not found`);
217
422
  return action;
218
423
  }
219
424
  async updateAction(tag, data) {
425
+ // Validate schema
220
426
  await validators_1.UpdateAppActionSchema.validateAsync(data);
221
- const action = this.fetchAction(tag);
427
+ const action = await this.fetchAction(tag);
222
428
  const body = action;
223
429
  if (!action) {
224
430
  throw new Error(`Action ${tag} not found`);
225
431
  }
432
+ // Batch all parsing operations for parallel execution
433
+ const parseOperations = [];
434
+ // Prepare params parsing
226
435
  if (data.params) {
227
- body.params = {
228
- type: types_1.InputsTypes.JSON,
229
- sample: JSON.stringify(data.params),
230
- data: await this.inputsService.parseJson({ data: data.params, expected: types_1.ExpectedValues.PARSESAMPLE, category: types_1.Categories.PARAMS })
231
- };
436
+ parseOperations.push(this.inputsService.parseJson({
437
+ data: data.params.sample,
438
+ expected: types_1.ExpectedValues.PARSESAMPLE,
439
+ category: types_1.Categories.PARAMS
440
+ }).then(parsedData => ({
441
+ key: 'params',
442
+ parsedData: parsedData
443
+ })));
232
444
  }
445
+ // Prepare query parsing
233
446
  if (data.query) {
234
- body.query = {
235
- type: types_1.InputsTypes.JSON,
236
- sample: JSON.stringify(data.query),
237
- data: await this.inputsService.parseJson({ data: data.query, expected: types_1.ExpectedValues.PARSESAMPLE, category: types_1.Categories.QUERY })
238
- };
447
+ parseOperations.push(this.inputsService.parseJson({
448
+ data: data.query.sample,
449
+ expected: types_1.ExpectedValues.PARSESAMPLE,
450
+ category: types_1.Categories.QUERY
451
+ }).then(parsedData => ({
452
+ key: 'query',
453
+ parsedData: parsedData
454
+ })));
239
455
  }
456
+ // Prepare body parsing
240
457
  if (data.body) {
241
- body.body = {
242
- type: types_1.InputsTypes.JSON,
243
- sample: JSON.stringify(data.body),
244
- data: await this.inputsService.parseJson({ data: data.body, expected: types_1.ExpectedValues.PARSESAMPLE, category: types_1.Categories.BODY })
245
- };
458
+ parseOperations.push(this.inputsService.parseJson({
459
+ data: data.body.sample,
460
+ expected: types_1.ExpectedValues.PARSESAMPLE,
461
+ category: types_1.Categories.BODY
462
+ }).then(parsedData => ({
463
+ key: 'body',
464
+ parsedData: parsedData
465
+ })));
246
466
  }
467
+ // Prepare headers parsing
247
468
  if (data.headers) {
248
- body.headers = {
249
- type: types_1.InputsTypes.JSON,
250
- sample: data.headers,
251
- data: await this.inputsService.parseJson({ data: data.headers, expected: types_1.ExpectedValues.PARSESAMPLE, category: types_1.Categories.HEADER })
252
- };
469
+ parseOperations.push(this.inputsService.parseJson({
470
+ data: data.headers.sample,
471
+ expected: types_1.ExpectedValues.PARSESAMPLE,
472
+ category: types_1.Categories.HEADER
473
+ }).then(parsedData => ({
474
+ key: 'headers',
475
+ parsedData: parsedData
476
+ })));
477
+ }
478
+ // Prepare response parsing
479
+ if (data.response) {
480
+ parseOperations.push(this.inputsService.parseJson({
481
+ data: data.response.body,
482
+ expected: types_1.ExpectedValues.PARSESAMPLE
483
+ }).then(parsedData => ({
484
+ key: 'response',
485
+ parsedData: parsedData
486
+ })));
487
+ }
488
+ // Execute all parsing operations in parallel
489
+ const parseResults = await Promise.all(parseOperations);
490
+ // Process parsed results
491
+ for (const result of parseResults) {
492
+ switch (result.key) {
493
+ case 'params':
494
+ body.params = {
495
+ type: types_1.InputsTypes.JSON,
496
+ sample: JSON.stringify(data.params),
497
+ data: result.parsedData
498
+ };
499
+ break;
500
+ case 'query':
501
+ body.query = {
502
+ type: types_1.InputsTypes.JSON,
503
+ sample: JSON.stringify(data.query),
504
+ data: result.parsedData
505
+ };
506
+ break;
507
+ case 'body':
508
+ body.body = {
509
+ type: types_1.InputsTypes.JSON,
510
+ sample: JSON.stringify(data.body),
511
+ data: result.parsedData
512
+ };
513
+ break;
514
+ case 'headers':
515
+ body.headers = {
516
+ type: types_1.InputsTypes.JSON,
517
+ sample: JSON.stringify(data.headers),
518
+ data: result.parsedData
519
+ };
520
+ break;
521
+ case 'response':
522
+ body.responses = action.responses;
523
+ const response = {
524
+ name: `Response - ${data.response.status_code}`,
525
+ response_format: data.response.response_format,
526
+ status_code: data.response.status_code,
527
+ success: data.response.success,
528
+ body: {
529
+ sample: JSON.stringify(data.response.body),
530
+ type: types_1.InputsTypes.JSON,
531
+ data: result.parsedData,
532
+ status_code: data.response.status_code,
533
+ }
534
+ };
535
+ const statusIndex = body.responses.findIndex((resp) => resp.status_code === data.response.status_code);
536
+ if (data.response.success === true) {
537
+ const index = action.responses.findIndex((resp) => resp.success === true);
538
+ if (index > -1) {
539
+ body.responses[index] = response;
540
+ }
541
+ else {
542
+ if (statusIndex > -1) {
543
+ body.responses.splice(statusIndex, 1);
544
+ }
545
+ body.responses.push(response);
546
+ }
547
+ }
548
+ else {
549
+ if (statusIndex > -1) {
550
+ body.responses.splice(statusIndex, 1);
551
+ }
552
+ body.responses.push(response);
553
+ }
554
+ break;
555
+ }
253
556
  }
557
+ // Handle resource URL parsing
254
558
  if (data.resource) {
255
559
  const { params, query: queryData } = await this.extractResourceData(data.resource);
256
560
  body.resource = (0, strings_utils_1.extractURLPath)(data.resource);
561
+ // Merge resource-extracted params/query with existing ones
257
562
  body.params = Object.assign(Object.assign({}, body.params), params);
258
563
  body.query = Object.assign(Object.assign({}, body.query), queryData);
259
564
  }
565
+ // Update simple fields
260
566
  if (data.description) {
261
567
  body.description = data.description;
262
568
  }
263
- /*if(body.description === ''){
264
- body.description = undefined
265
- }*/
266
569
  if (data.method) {
267
570
  body.method = data.method;
268
571
  }
269
572
  if (data.request_type) {
270
573
  body.request_type = data.request_type;
271
574
  }
272
- if (data.response) {
273
- body.responses = action.responses;
274
- const response = {
275
- name: `Response - ${data.response.status_code}`,
276
- response_format: data.response.response_format,
277
- status_code: data.response.status_code,
278
- success: data.response.success,
279
- body: {
280
- sample: JSON.stringify(data.response.body),
281
- type: types_1.InputsTypes.JSON,
282
- data: await this.inputsService.parseJson({
283
- data: data.response.body,
284
- expected: types_1.ExpectedValues.PARSESAMPLE
285
- }),
286
- status_code: data.response.status_code,
287
- }
288
- };
289
- const statusIndex = body.responses.findIndex((resp) => resp.status_code === data.response.status_code);
290
- if (data.response.success === true) {
291
- const index = action.responses.findIndex((resp) => resp.success === true);
292
- if (index > -1) {
293
- body.responses[index] = response;
294
- }
295
- else {
296
- if (statusIndex > -1) {
297
- body.responses.splice(statusIndex, 1);
298
- }
299
- body.responses.push(response);
300
- }
301
- }
302
- else {
303
- if (statusIndex > -1) {
304
- body.responses.splice(statusIndex, 1);
305
- }
306
- body.responses.push(response);
307
- }
575
+ if (data.envs) {
576
+ body.envs = data.envs;
308
577
  }
578
+ // Update action via API
309
579
  await this.updateActionProcess(tag, body, types_1.RequestAction.UPDATE);
580
+ // Update local cache instead of full app refetch
581
+ //const actionIndex = this.appVersion.actions.findIndex(a => a.tag === tag || a._id === action._id);
582
+ //if (actionIndex > -1) {
583
+ //this.appVersion.actions[actionIndex] = body as IAppAction;
584
+ //}
310
585
  }
311
586
  async updateActionProcess(tag, data, action) {
312
- const query = Object.assign({ component: types_1.AppComponents.ACTION, action: types_1.RequestAction.UPDATE, tag }, data);
587
+ const query = Object.assign({ component: types_1.AppComponents.ACTION, action,
588
+ tag }, data);
313
589
  await this.appApi.updateApp(this.app_id, query, this.getUserAccess());
314
590
  }
591
+ async updateManyActions(tags, data) {
592
+ try {
593
+ if (!tags || tags.length === 0) {
594
+ throw new Error('At least one action tag is required');
595
+ }
596
+ if (!data.key) {
597
+ throw new Error('Key is required');
598
+ }
599
+ // Call the backend bulk update endpoint once
600
+ await this.appApi.updateApp(this.app_id, {
601
+ component: types_1.AppComponents.ACTION_BULK,
602
+ action: 'update_multiple_shared_variable',
603
+ action_tags: tags,
604
+ variable_type: data.category,
605
+ variable_key: data.key,
606
+ variable_value: data.value,
607
+ }, this.getUserAccess());
608
+ }
609
+ catch (e) {
610
+ throw e;
611
+ }
612
+ }
315
613
  async createActionRequestData(category, tag, payload, throwErrorIfExists = false) {
316
614
  try {
317
615
  const bodyData = await this.fetchActionRequestData(category, tag);
@@ -341,10 +639,10 @@ class AppBuilderService {
341
639
  return Object.assign(Object.assign({}, payload), { sample, data });
342
640
  }
343
641
  // private fetc
344
- fetchActionRequestData(category, tag) {
642
+ async fetchActionRequestData(category, tag) {
345
643
  try {
346
644
  let data;
347
- const action = this.fetchAction(tag);
645
+ const action = await this.fetchAction(tag);
348
646
  if (category === types_1.Categories.BODY) {
349
647
  const { body } = action;
350
648
  data = body.data;
@@ -370,10 +668,10 @@ class AppBuilderService {
370
668
  throw e;
371
669
  }
372
670
  }
373
- fetchActionRequestSample(category, tag) {
671
+ async fetchActionRequestSample(category, tag) {
374
672
  try {
375
673
  let sample;
376
- const action = this.fetchAction(tag);
674
+ const action = await this.fetchAction(tag);
377
675
  if (category === types_1.Categories.BODY) {
378
676
  const { body } = action;
379
677
  sample = body.sample;
@@ -401,10 +699,10 @@ class AppBuilderService {
401
699
  }
402
700
  async createAppActionResponse(action_tag, payload) {
403
701
  try {
404
- this.fetchAction(action_tag);
702
+ await this.fetchAction(action_tag);
405
703
  await validators_1.CreateAppActionResponseSchema.validateAsync(Object.assign({}, payload));
406
704
  payload.tag = (0, string_utils_1.tagify)(payload.tag);
407
- const exists = this.fetchAppActionResponse(action_tag, payload.tag);
705
+ const exists = await this.fetchAppActionResponse(action_tag, payload.tag);
408
706
  if (!exists) {
409
707
  payload = await this.parseResponsePayload(payload);
410
708
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, payload), { action_tag, action: types_1.RequestAction.CREATE, component: types_1.AppComponents.ACTION_RESPONSE }), this.getUserAccess());
@@ -451,19 +749,21 @@ class AppBuilderService {
451
749
  payload.body.data = data;
452
750
  payload.body.sample = JSON.stringify(payload.body.sample);
453
751
  if (payload.envs && payload.envs.length) {
454
- payload.envs = payload.envs.map((slug) => {
455
- const { _id: env_id } = this.fetchEnv(slug);
456
- return env_id;
457
- });
752
+ const envIds = await Promise.all(payload.envs.map(async (slug) => {
753
+ const env = await this.fetchEnv(slug);
754
+ return env._id;
755
+ }));
756
+ payload.envs = envIds;
458
757
  }
459
758
  return payload;
460
759
  }
461
- fetchAppActionResponse(action_tag, response_tag, throwErrorIfExists = false) {
462
- const { responses } = this.fetchAction(action_tag);
463
- const action = responses.find((data) => data.tag === response_tag);
464
- if (!action && throwErrorIfExists)
760
+ async fetchAppActionResponse(action_tag, response_tag, throwErrorIfExists = false) {
761
+ const action = await this.fetchAction(action_tag);
762
+ const { responses } = action;
763
+ const response = responses.find((data) => data.tag === response_tag);
764
+ if (!response && throwErrorIfExists)
465
765
  throw new Error(`Response ${response_tag} not found`);
466
- return action;
766
+ return response;
467
767
  }
468
768
  /*async extractEventData(data: Partial<IAppEvent>): Promise<Partial<IAppEvent>> {
469
769
  if (data.response) {
@@ -541,7 +841,7 @@ class AppBuilderService {
541
841
  this.getUserAccess(),
542
842
  );
543
843
 
544
- await this.initializeApp(this.app_id);
844
+ //await this.initializeApp(this.app_id);
545
845
  } catch (e) {
546
846
  throw e;
547
847
  }
@@ -572,7 +872,7 @@ class AppBuilderService {
572
872
  this.getUserAccess(),
573
873
  );
574
874
 
575
- await this.initializeApp(this.app_id);
875
+ //await this.initializeApp(this.app_id);
576
876
  } catch (e) {
577
877
  throw e;
578
878
  }
@@ -647,11 +947,11 @@ class AppBuilderService {
647
947
  throw new Error(`token has to have one of body, headers, params or query set`);
648
948
  }
649
949
  if (setup_type === types_1.AuthTypes.CREDENTIALS) {
650
- this.fetchAction(action_tag);
950
+ await this.fetchAction(action_tag);
651
951
  }
652
952
  data = await this.extractAuthData(Object.assign({}, data));
653
953
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.CREATE, component: types_1.AppComponents.AUTH }), this.getUserAccess());
654
- await this.initializeApp(this.app_id);
954
+ //await this.initializeApp(this.app_id);
655
955
  }
656
956
  catch (e) {
657
957
  throw e;
@@ -660,21 +960,23 @@ class AppBuilderService {
660
960
  async updateAuth(tag, data) {
661
961
  try {
662
962
  await validators_1.UpdateAppAuthSchema.validateAsync(data);
663
- const auth = this.fetchAuth(tag);
963
+ const auth = await this.fetchAuth(tag);
664
964
  data = await this.extractAuthData(Object.assign(Object.assign({}, auth), data));
665
965
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ tag }, data), { action: types_1.RequestAction.UPDATE, component: types_1.AppComponents.AUTH }), this.getUserAccess());
666
- await this.initializeApp(this.app_id);
667
- await this.initializeApp(this.app_id);
966
+ //await this.initializeApp(this.app_id);
967
+ //await this.initializeApp(this.app_id);
668
968
  }
669
969
  catch (e) {
670
970
  throw e;
671
971
  }
672
972
  }
673
- fetchAuths() {
674
- return this.appVersion.auths;
973
+ async fetchAuths() {
974
+ const components = await this.appApi.fetchAppComponents(this.app_id, 'auth', this.getUserAccess(), this.appVersion.tag);
975
+ return components;
675
976
  }
676
- fetchAuth(tag) {
677
- const auth = this.appVersion.auths.find((data) => data.tag === tag);
977
+ async fetchAuth(tag) {
978
+ const auths = await this.fetchAuths();
979
+ const auth = auths.find((data) => data.tag === tag);
678
980
  if (!auth)
679
981
  throw new Error(`Auth ${tag} not found`);
680
982
  return auth;
@@ -682,13 +984,13 @@ class AppBuilderService {
682
984
  async createVariable(data, throwErrorIfExists = false) {
683
985
  try {
684
986
  await validators_1.CreateAppVariableSchema.validateAsync(data);
685
- const exists = this.fetchVariable(data.key, false);
987
+ const exists = await this.fetchVariable(data.key, false);
686
988
  if (exists && throwErrorIfExists)
687
989
  throw new Error(`Variable ${data.key} exists`);
688
990
  if (!exists) {
689
991
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.CREATE, component: types_1.AppComponents.VARIABLE }), this.getUserAccess());
690
992
  }
691
- await this.initializeApp(this.app_id);
993
+ //await this.initializeApp(this.app_id);
692
994
  }
693
995
  catch (e) {
694
996
  throw e;
@@ -697,19 +999,21 @@ class AppBuilderService {
697
999
  async updateVariable(key, data) {
698
1000
  try {
699
1001
  await validators_1.UpdateAppVariableSchema.validateAsync(data);
700
- this.fetchVariable(key);
1002
+ await this.fetchVariable(key);
701
1003
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { key, action: types_1.RequestAction.UPDATE, component: types_1.AppComponents.VARIABLE }), this.getUserAccess());
702
- await this.initializeApp(this.app_id);
1004
+ //await this.initializeApp(this.app_id);
703
1005
  }
704
1006
  catch (e) {
705
1007
  throw e;
706
1008
  }
707
1009
  }
708
- fetchVariables() {
709
- return this.appVersion.variables;
1010
+ async fetchVariables() {
1011
+ const components = await this.appApi.fetchAppComponents(this.app_id, 'variable', this.getUserAccess(), this.appVersion.tag);
1012
+ return components;
710
1013
  }
711
- fetchVariable(key, throwErrorIfExists = true) {
712
- const variable = this.appVersion.variables.find((data) => data.key === key);
1014
+ async fetchVariable(key, throwErrorIfExists = true) {
1015
+ const variables = await this.fetchVariables();
1016
+ const variable = variables.find((data) => data.key === key);
713
1017
  if (!variable && throwErrorIfExists)
714
1018
  throw new Error(`Variable ${key} not found`);
715
1019
  return variable;
@@ -717,11 +1021,11 @@ class AppBuilderService {
717
1021
  async createConstant(data, throwErrorIfExists = false) {
718
1022
  try {
719
1023
  await validators_1.CreateAppConstantSchema.validateAsync(data);
720
- const exists = this.fetchConstant(data.key, false);
1024
+ const exists = await this.fetchConstant(data.key, false);
721
1025
  if (exists && throwErrorIfExists)
722
1026
  throw new Error(`Constant ${data.key} exists`);
723
1027
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.CREATE, component: types_1.AppComponents.CONSTANT }), this.getUserAccess());
724
- await this.initializeApp(this.app_id);
1028
+ //await this.initializeApp(this.app_id);
725
1029
  }
726
1030
  catch (e) {
727
1031
  throw e;
@@ -729,15 +1033,17 @@ class AppBuilderService {
729
1033
  }
730
1034
  async updateConstant(key, data) {
731
1035
  await validators_1.UpdateAppConstantSchema.validateAsync(data);
732
- this.fetchConstant(key);
1036
+ await this.fetchConstant(key);
733
1037
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.UPDATE, component: types_1.AppComponents.CONSTANT }), this.getUserAccess());
734
- await this.initializeApp(this.app_id);
1038
+ //await this.initializeApp(this.app_id);
735
1039
  }
736
- fetchConstants() {
737
- return this.appVersion.constants;
1040
+ async fetchConstants() {
1041
+ const components = await this.appApi.fetchAppComponents(this.app_id, 'constant', this.getUserAccess(), this.appVersion.tag);
1042
+ return components;
738
1043
  }
739
- fetchConstant(key, throwErrorIfExists = true) {
740
- const variable = this.appVersion.constants.find((data) => data.key === key);
1044
+ async fetchConstant(key, throwErrorIfExists = true) {
1045
+ const constants = await this.fetchConstants();
1046
+ const variable = constants.find((data) => data.key === key);
741
1047
  if (!variable && throwErrorIfExists)
742
1048
  throw new Error(`Constant ${key} not found`);
743
1049
  return variable;
@@ -747,17 +1053,19 @@ class AppBuilderService {
747
1053
  if (stages.length === 0) {
748
1054
  throw new Error(`Missing locators in ${locator}`);
749
1055
  }
1056
+ // Convert stages to string[] for functions expecting string[]
1057
+ const stringStages = stages.map(stage => String(stage));
750
1058
  if (locator.startsWith('$Body{')) {
751
- await this.updateValidation(types_1.AppCategories.BODY, stages, update);
1059
+ await this.updateValidation(types_1.AppCategories.BODY, stringStages, update);
752
1060
  }
753
1061
  else if (locator.startsWith('$Query{')) {
754
- await this.updateValidation(types_1.AppCategories.QUERY, stages, update);
1062
+ await this.updateValidation(types_1.AppCategories.QUERY, stringStages, update);
755
1063
  }
756
1064
  else if (locator.startsWith('$Params{')) {
757
- await this.updateValidation(types_1.AppCategories.PARAMS, stages, update);
1065
+ await this.updateValidation(types_1.AppCategories.PARAMS, stringStages, update);
758
1066
  }
759
1067
  else if (locator.startsWith('$Header{')) {
760
- await this.updateValidation(types_1.AppCategories.HEADER, stages, update);
1068
+ await this.updateValidation(types_1.AppCategories.HEADER, stringStages, update);
761
1069
  }
762
1070
  else {
763
1071
  throw new Error(`Invalid input ${locator}`);
@@ -766,7 +1074,7 @@ class AppBuilderService {
766
1074
  async updateValidation(category, stages, update) {
767
1075
  try {
768
1076
  const action_tag = stages[0];
769
- const action = this.fetchAction(action_tag);
1077
+ const action = await this.fetchAction(action_tag);
770
1078
  const data = action[category];
771
1079
  let level = -1;
772
1080
  let key = '';
@@ -805,8 +1113,8 @@ class AppBuilderService {
805
1113
  'responses',
806
1114
  ...exclude,
807
1115
  ]);
808
- await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ tag: action_tag }, cleaned_action), { component: types_1.AppComponents.VALIDATION, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
809
- await this.initializeApp(this.app_id);
1116
+ await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ tag: action_tag }, action), { component: types_1.AppComponents.VALIDATION, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
1117
+ //await this.initializeApp(this.app_id);
810
1118
  }
811
1119
  catch (e) {
812
1120
  throw e;
@@ -815,41 +1123,15 @@ class AppBuilderService {
815
1123
  async createWebhook(data, throwErrorIfExists = false) {
816
1124
  try {
817
1125
  // TODO: figure out a way to check if this has run before, halt if it has
818
- if (!this.fetchWebhook(data.tag)) {
1126
+ const existingWebhook = await this.fetchWebhook(data.tag);
1127
+ if (!existingWebhook) {
819
1128
  await create_appWebhook_validator_1.IAppWebhookSchema.validateAsync(data);
820
- data.envs = data.envs.map((env) => {
821
- const exists = this.fetchEnv(env.slug);
822
- if (!exists) {
823
- throw new Error(`Env ${env.slug} does not exist`);
824
- }
825
- if (env.sample) {
826
- const bodyTemplate = env.sample.body ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.body), 'body') : [];
827
- const queryTemplate = env.sample.query
828
- ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.query), 'query')
829
- : [];
830
- const paramsTemplate = env.sample.params
831
- ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.params), 'params')
832
- : [];
833
- const headerTemplate = env.sample.headers
834
- ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.headers), 'headers')
835
- : [];
836
- env.sample_data = [...bodyTemplate, ...queryTemplate, ...paramsTemplate, ...headerTemplate];
837
- }
838
- return env;
839
- });
840
- const envs = this.fetchEnvs();
841
- envs.map((env) => {
842
- const exists = data.envs.findIndex((dbEnv) => dbEnv.slug === env.slug);
843
- if (exists === -1) {
844
- throw new Error(`Product env ${env.slug} is not defined, please provide webhook registration details`);
845
- }
846
- });
847
1129
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { component: types_1.AppComponents.WEBHOOK, action: types_1.RequestAction.CREATE }), this.getUserAccess());
848
- await this.initializeApp(this.app_id);
1130
+ //await this.initializeApp(this.app_id);
849
1131
  }
850
1132
  else {
851
1133
  if (throwErrorIfExists)
852
- throw new Error(`Database ${data.tag} already exists`);
1134
+ throw new Error(`Webhook ${data.tag} already exists`);
853
1135
  }
854
1136
  }
855
1137
  catch (e) {
@@ -858,68 +1140,30 @@ class AppBuilderService {
858
1140
  }
859
1141
  async updateWebhook(tag, data) {
860
1142
  try {
861
- const { _id, envs } = this.fetchWebhook(tag);
1143
+ const webhook = await this.fetchWebhook(tag);
1144
+ const { _id } = webhook;
862
1145
  await update_appWebhook_validator_1.IAppWebhookUpdateSchema.validateAsync(data); // Change to update;
863
- if (data.tag && this.fetchWebhook(data.tag)) {
864
- throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
865
- }
866
- data.envs = data.envs.map((env) => {
867
- const exists = this.fetchEnv(env.slug);
868
- if (!exists) {
869
- throw new Error(`Env ${env.slug} does not exist`);
870
- }
871
- if (env.sample) {
872
- const bodyTemplate = env.sample.body ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.body), 'body') : [];
873
- const queryTemplate = env.sample.query ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.query), 'query') : [];
874
- const paramsTemplate = env.sample.params
875
- ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.params), 'params')
876
- : [];
877
- const headerTemplate = env.sample.headers
878
- ? (0, string_utils_2.extractPlaceholders)(JSON.stringify(env.sample.headers), 'headers')
879
- : [];
880
- env.sample_data = [...bodyTemplate, ...queryTemplate, ...paramsTemplate, ...headerTemplate];
881
- }
882
- return env;
883
- });
884
- const overwrite = [];
885
- const newEnvs = [];
886
- envs.map((env) => {
887
- const exists = data.envs.findIndex((dataEnv) => env.slug === dataEnv.slug);
888
- if (!this.fetchEnv(env.slug)) {
889
- throw new Error(`Product Environment ${env.slug} doesn't exist`);
890
- }
891
- if (exists === -1) {
892
- newEnvs.push(data.envs[exists]);
1146
+ if (data.tag) {
1147
+ const existingWebhook = await this.fetchWebhook(data.tag);
1148
+ if (existingWebhook) {
1149
+ throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
893
1150
  }
894
- else {
895
- overwrite.push(Object.assign(Object.assign({}, env), data.envs[exists]));
896
- }
897
- });
898
- const unchanged = [];
899
- envs.map((env) => {
900
- const newEnv = newEnvs.findIndex((dataEnv) => env.slug === dataEnv.slug) > -1;
901
- const overwriteEnv = overwrite.findIndex((dataEnv) => env.slug === dataEnv.slug) > -1;
902
- if (!newEnv && !overwriteEnv) {
903
- unchanged.push(env);
904
- }
905
- });
906
- data.envs = [...unchanged, ...overwrite, ...newEnvs];
907
- data.envs = [...overwrite, ...newEnvs];
1151
+ }
908
1152
  await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ _id }, data), { component: types_1.AppComponents.WEBHOOK, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
909
- await this.initializeApp(this.app_id);
1153
+ //await this.initializeApp(this.app_id);
910
1154
  }
911
1155
  catch (e) {
912
1156
  throw e;
913
1157
  }
914
1158
  }
915
- fetchWebhook(tag) {
916
- var _a, _b;
917
- const exists = (_b = (_a = this.appVersion) === null || _a === void 0 ? void 0 : _a.webhooks) === null || _b === void 0 ? void 0 : _b.find((data) => data.tag === tag);
1159
+ async fetchWebhook(tag) {
1160
+ const webhooks = await this.fetchWebhooks();
1161
+ const exists = webhooks === null || webhooks === void 0 ? void 0 : webhooks.find((data) => data.tag === tag);
918
1162
  return exists;
919
1163
  }
920
- fetchWebhooks() {
921
- var _a;
922
- return (_a = this.appVersion) === null || _a === void 0 ? void 0 : _a.webhooks;
1164
+ async fetchWebhooks() {
1165
+ const components = await this.appApi.fetchAppComponents(this.app_id, 'webhook', this.getUserAccess(), this.appVersion.tag);
1166
+ return components;
923
1167
  }
924
1168
  async createWebhookEvent(data, throwErrorIfExists = false) {
925
1169
  try {
@@ -931,7 +1175,7 @@ class AppBuilderService {
931
1175
  if (!webhookTag || !tag) {
932
1176
  throw new Error(`tag is expected to be defined as "webhook_tag:event_tag"`);
933
1177
  }
934
- const exists = this.fetchWebhookEvent(data.tag);
1178
+ const exists = await this.fetchWebhookEvent(data.tag);
935
1179
  data.tag = tag;
936
1180
  if (!exists) {
937
1181
  if (!data.selector.startsWith('$Event{')) {
@@ -953,7 +1197,7 @@ class AppBuilderService {
953
1197
  throw new Error("Selector value is not allowed to be an object|array|null|undefined");
954
1198
  }
955
1199
  //check other webhooksevents to see if there are other places where selector and selectorValue match up
956
- const existing = this.fetchWebhookEvents(webhookTag);
1200
+ const existing = await this.fetchWebhookEvents(webhookTag);
957
1201
  existing === null || existing === void 0 ? void 0 : existing.map((event) => {
958
1202
  if (event.selector === data.selector && event.selectorValue === current) {
959
1203
  throw new Error(`Selector ${data.selector} with value ${current} already exists on event ${event.tag}`);
@@ -968,7 +1212,7 @@ class AppBuilderService {
968
1212
  const payload = Object.assign(Object.assign({}, data), { webhookTag,
969
1213
  tag, component: types_1.AppComponents.WEBHOOK_EVENT, action: types_1.RequestAction.CREATE });
970
1214
  await this.appApi.updateApp(this.app_id, payload, this.getUserAccess());
971
- await this.initializeApp(this.app_id);
1215
+ //await this.initializeApp(this.app_id);
972
1216
  }
973
1217
  else {
974
1218
  if (throwErrorIfExists)
@@ -1017,7 +1261,7 @@ class AppBuilderService {
1017
1261
  throw new Error("Selector value is not allowed to be an object|array|null|undefined");
1018
1262
  }
1019
1263
  //check other webhooksevents to see if there are other places where selector and selectorValue match up
1020
- const existing = this.fetchWebhookEvents(webhookTag);
1264
+ const existing = await this.fetchWebhookEvents(webhookTag);
1021
1265
  existing === null || existing === void 0 ? void 0 : existing.map((event) => {
1022
1266
  if (event.selector === data.selector && event.selectorValue === current && event.tag !== tag) {
1023
1267
  throw new Error(`Selector ${data.selector} with value ${current} already exists on event ${event.tag}`);
@@ -1035,26 +1279,26 @@ class AppBuilderService {
1035
1279
  webhookTag, component: types_1.AppComponents.WEBHOOK_EVENT, action: types_1.RequestAction.UPDATE });
1036
1280
  // Update product and reinitialize
1037
1281
  await this.appApi.updateApp(this.app_id, payload, this.getUserAccess());
1038
- await this.initializeApp(this.app_id);
1282
+ //await this.initializeApp(this.app_id);
1039
1283
  }
1040
1284
  catch (error) {
1041
1285
  throw error;
1042
1286
  }
1043
1287
  }
1044
- fetchWebhookEvent(tag) {
1288
+ async fetchWebhookEvent(tag) {
1045
1289
  const [webhookTag, eventTag] = tag.split(':');
1046
1290
  ;
1047
1291
  if (!webhookTag || !eventTag) {
1048
1292
  throw new Error(`webhook events should be in the format webhook_tag:event_tag`);
1049
1293
  }
1050
- const events = this.fetchWebhookEvents(webhookTag);
1294
+ const events = await this.fetchWebhookEvents(webhookTag);
1051
1295
  const event = events.find((event) => {
1052
1296
  return event.tag === eventTag;
1053
1297
  });
1054
1298
  return event;
1055
1299
  }
1056
- fetchWebhookEvents(tag) {
1057
- const webhook = this.fetchWebhook(tag);
1300
+ async fetchWebhookEvents(tag) {
1301
+ const webhook = await this.fetchWebhook(tag);
1058
1302
  if (!webhook) {
1059
1303
  throw new Error(`Webhook ${tag} does not exist`);
1060
1304
  }