@botpress/cli 2.0.3 → 2.0.4

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 (378) hide show
  1. package/e2e/tests/install-interfaces.ts +1 -0
  2. package/e2e/tests/install-package.ts +1 -0
  3. package/package.json +1 -1
  4. package/.turbo/turbo-build.log +0 -22
  5. package/dist/api/bot-body.js +0 -89
  6. package/dist/api/bot-body.js.map +0 -7
  7. package/dist/api/client.js +0 -162
  8. package/dist/api/client.js.map +0 -7
  9. package/dist/api/find-previous-version.js +0 -66
  10. package/dist/api/find-previous-version.js.map +0 -7
  11. package/dist/api/find-previous-version.test.js +0 -76
  12. package/dist/api/find-previous-version.test.js.map +0 -7
  13. package/dist/api/index.js +0 -23
  14. package/dist/api/index.js.map +0 -7
  15. package/dist/api/integration-body.js +0 -146
  16. package/dist/api/integration-body.js.map +0 -7
  17. package/dist/api/interface-body.js +0 -95
  18. package/dist/api/interface-body.js.map +0 -7
  19. package/dist/api/paging.js +0 -42
  20. package/dist/api/paging.js.map +0 -7
  21. package/dist/api/plugin-body.js +0 -84
  22. package/dist/api/plugin-body.js.map +0 -7
  23. package/dist/api/types.js +0 -17
  24. package/dist/api/types.js.map +0 -7
  25. package/dist/code-generation/bot-implementation/bot-implementation.js +0 -116
  26. package/dist/code-generation/bot-implementation/bot-implementation.js.map +0 -7
  27. package/dist/code-generation/bot-implementation/bot-plugins/index.js +0 -80
  28. package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +0 -7
  29. package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +0 -129
  30. package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +0 -7
  31. package/dist/code-generation/bot-implementation/bot-typings/actions-module.js +0 -88
  32. package/dist/code-generation/bot-implementation/bot-typings/actions-module.js.map +0 -7
  33. package/dist/code-generation/bot-implementation/bot-typings/events-module.js +0 -63
  34. package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +0 -7
  35. package/dist/code-generation/bot-implementation/bot-typings/index.js +0 -109
  36. package/dist/code-generation/bot-implementation/bot-typings/index.js.map +0 -7
  37. package/dist/code-generation/bot-implementation/bot-typings/states-module.js +0 -64
  38. package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +0 -7
  39. package/dist/code-generation/bot-implementation/index.js +0 -66
  40. package/dist/code-generation/bot-implementation/index.js.map +0 -7
  41. package/dist/code-generation/consts.js +0 -45
  42. package/dist/code-generation/consts.js.map +0 -7
  43. package/dist/code-generation/generators.js +0 -81
  44. package/dist/code-generation/generators.js.map +0 -7
  45. package/dist/code-generation/index.js +0 -49
  46. package/dist/code-generation/index.js.map +0 -7
  47. package/dist/code-generation/integration-implementation/index.js +0 -70
  48. package/dist/code-generation/integration-implementation/index.js.map +0 -7
  49. package/dist/code-generation/integration-implementation/integration-implementation.js +0 -114
  50. package/dist/code-generation/integration-implementation/integration-implementation.js.map +0 -7
  51. package/dist/code-generation/integration-implementation/integration-secret.js +0 -78
  52. package/dist/code-generation/integration-implementation/integration-secret.js.map +0 -7
  53. package/dist/code-generation/integration-implementation/integration-typings/actions-module.js +0 -88
  54. package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map +0 -7
  55. package/dist/code-generation/integration-implementation/integration-typings/channels-module.js +0 -107
  56. package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +0 -7
  57. package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js +0 -62
  58. package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js.map +0 -7
  59. package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js +0 -70
  60. package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +0 -7
  61. package/dist/code-generation/integration-implementation/integration-typings/entities-module.js +0 -63
  62. package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map +0 -7
  63. package/dist/code-generation/integration-implementation/integration-typings/events-module.js +0 -63
  64. package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map +0 -7
  65. package/dist/code-generation/integration-implementation/integration-typings/index.js +0 -128
  66. package/dist/code-generation/integration-implementation/integration-typings/index.js.map +0 -7
  67. package/dist/code-generation/integration-implementation/integration-typings/states-module.js +0 -64
  68. package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +0 -7
  69. package/dist/code-generation/integration-package/index.js +0 -94
  70. package/dist/code-generation/integration-package/index.js.map +0 -7
  71. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +0 -88
  72. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +0 -7
  73. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js +0 -107
  74. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +0 -7
  75. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js +0 -63
  76. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js.map +0 -7
  77. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js +0 -70
  78. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +0 -7
  79. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js +0 -63
  80. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +0 -7
  81. package/dist/code-generation/integration-package/integration-package-definition/events-module.js +0 -66
  82. package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +0 -7
  83. package/dist/code-generation/integration-package/integration-package-definition/index.js +0 -140
  84. package/dist/code-generation/integration-package/integration-package-definition/index.js.map +0 -7
  85. package/dist/code-generation/integration-package/integration-package-definition/states-module.js +0 -66
  86. package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +0 -7
  87. package/dist/code-generation/integration-package/integration-package-definition/typings.js +0 -17
  88. package/dist/code-generation/integration-package/integration-package-definition/typings.js.map +0 -7
  89. package/dist/code-generation/interface-implementation/index.js +0 -29
  90. package/dist/code-generation/interface-implementation/index.js.map +0 -7
  91. package/dist/code-generation/interface-implementation/integration-typings/actions-module.js +0 -88
  92. package/dist/code-generation/interface-implementation/integration-typings/actions-module.js.map +0 -7
  93. package/dist/code-generation/interface-implementation/integration-typings/channels-module.js +0 -107
  94. package/dist/code-generation/interface-implementation/integration-typings/channels-module.js.map +0 -7
  95. package/dist/code-generation/interface-implementation/integration-typings/entities-module.js +0 -63
  96. package/dist/code-generation/interface-implementation/integration-typings/entities-module.js.map +0 -7
  97. package/dist/code-generation/interface-implementation/integration-typings/events-module.js +0 -63
  98. package/dist/code-generation/interface-implementation/integration-typings/events-module.js.map +0 -7
  99. package/dist/code-generation/interface-implementation/integration-typings/index.js +0 -121
  100. package/dist/code-generation/interface-implementation/integration-typings/index.js.map +0 -7
  101. package/dist/code-generation/interface-package/index.js +0 -94
  102. package/dist/code-generation/interface-package/index.js.map +0 -7
  103. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +0 -88
  104. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +0 -7
  105. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js +0 -98
  106. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +0 -7
  107. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js +0 -63
  108. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +0 -7
  109. package/dist/code-generation/interface-package/interface-package-definition/events-module.js +0 -66
  110. package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +0 -7
  111. package/dist/code-generation/interface-package/interface-package-definition/index.js +0 -104
  112. package/dist/code-generation/interface-package/interface-package-definition/index.js.map +0 -7
  113. package/dist/code-generation/interface-package/interface-package-definition/typings.js +0 -17
  114. package/dist/code-generation/interface-package/interface-package-definition/typings.js.map +0 -7
  115. package/dist/code-generation/module.js +0 -183
  116. package/dist/code-generation/module.js.map +0 -7
  117. package/dist/code-generation/plugin-implementation/index.js +0 -60
  118. package/dist/code-generation/plugin-implementation/index.js.map +0 -7
  119. package/dist/code-generation/plugin-implementation/plugin-implementation.js +0 -90
  120. package/dist/code-generation/plugin-implementation/plugin-implementation.js.map +0 -7
  121. package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js +0 -88
  122. package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js.map +0 -7
  123. package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js +0 -61
  124. package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js.map +0 -7
  125. package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js +0 -63
  126. package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js.map +0 -7
  127. package/dist/code-generation/plugin-implementation/plugin-typings/index.js +0 -150
  128. package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +0 -7
  129. package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js +0 -64
  130. package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js.map +0 -7
  131. package/dist/code-generation/plugin-package/index.js +0 -151
  132. package/dist/code-generation/plugin-package/index.js.map +0 -7
  133. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js +0 -88
  134. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +0 -7
  135. package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js +0 -56
  136. package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js.map +0 -7
  137. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js +0 -66
  138. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +0 -7
  139. package/dist/code-generation/plugin-package/plugin-package-definition/index.js +0 -107
  140. package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +0 -7
  141. package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js +0 -66
  142. package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js.map +0 -7
  143. package/dist/code-generation/plugin-package/plugin-package-definition/typings.js +0 -17
  144. package/dist/code-generation/plugin-package/plugin-package-definition/typings.js.map +0 -7
  145. package/dist/code-generation/strings.js +0 -115
  146. package/dist/code-generation/strings.js.map +0 -7
  147. package/dist/code-generation/typings.js +0 -17
  148. package/dist/code-generation/typings.js.map +0 -7
  149. package/dist/command-definitions.js +0 -84
  150. package/dist/command-definitions.js.map +0 -7
  151. package/dist/command-implementations/add-command.js +0 -249
  152. package/dist/command-implementations/add-command.js.map +0 -7
  153. package/dist/command-implementations/base-command.js +0 -69
  154. package/dist/command-implementations/base-command.js.map +0 -7
  155. package/dist/command-implementations/bot-commands.js +0 -117
  156. package/dist/command-implementations/bot-commands.js.map +0 -7
  157. package/dist/command-implementations/build-command.js +0 -53
  158. package/dist/command-implementations/build-command.js.map +0 -7
  159. package/dist/command-implementations/bundle-command.js +0 -87
  160. package/dist/command-implementations/bundle-command.js.map +0 -7
  161. package/dist/command-implementations/deploy-command.js +0 -481
  162. package/dist/command-implementations/deploy-command.js.map +0 -7
  163. package/dist/command-implementations/dev-command.js +0 -345
  164. package/dist/command-implementations/dev-command.js.map +0 -7
  165. package/dist/command-implementations/gen-command.js +0 -110
  166. package/dist/command-implementations/gen-command.js.map +0 -7
  167. package/dist/command-implementations/global-command.js +0 -137
  168. package/dist/command-implementations/global-command.js.map +0 -7
  169. package/dist/command-implementations/index.js +0 -103
  170. package/dist/command-implementations/index.js.map +0 -7
  171. package/dist/command-implementations/init-command.js +0 -162
  172. package/dist/command-implementations/init-command.js.map +0 -7
  173. package/dist/command-implementations/integration-commands.js +0 -130
  174. package/dist/command-implementations/integration-commands.js.map +0 -7
  175. package/dist/command-implementations/interface-commands.js +0 -110
  176. package/dist/command-implementations/interface-commands.js.map +0 -7
  177. package/dist/command-implementations/lint-command.js +0 -151
  178. package/dist/command-implementations/lint-command.js.map +0 -7
  179. package/dist/command-implementations/login-command.js +0 -82
  180. package/dist/command-implementations/login-command.js.map +0 -7
  181. package/dist/command-implementations/logout-command.js +0 -35
  182. package/dist/command-implementations/logout-command.js.map +0 -7
  183. package/dist/command-implementations/plugin-commands.js +0 -111
  184. package/dist/command-implementations/plugin-commands.js.map +0 -7
  185. package/dist/command-implementations/project-command.js +0 -383
  186. package/dist/command-implementations/project-command.js.map +0 -7
  187. package/dist/command-implementations/read-command.js +0 -70
  188. package/dist/command-implementations/read-command.js.map +0 -7
  189. package/dist/command-implementations/serve-command.js +0 -68
  190. package/dist/command-implementations/serve-command.js.map +0 -7
  191. package/dist/command-tree.js +0 -60
  192. package/dist/command-tree.js.map +0 -7
  193. package/dist/config.js +0 -332
  194. package/dist/config.js.map +0 -7
  195. package/dist/consts.js +0 -124
  196. package/dist/consts.js.map +0 -7
  197. package/dist/errors.js +0 -202
  198. package/dist/errors.js.map +0 -7
  199. package/dist/index.js +0 -51
  200. package/dist/index.js.map +0 -7
  201. package/dist/init.js +0 -50
  202. package/dist/init.js.map +0 -7
  203. package/dist/linter/base-linter.js +0 -75
  204. package/dist/linter/base-linter.js.map +0 -7
  205. package/dist/linter/base-linter.test.js +0 -187
  206. package/dist/linter/base-linter.test.js.map +0 -7
  207. package/dist/linter/bot-linter.js +0 -35
  208. package/dist/linter/bot-linter.js.map +0 -7
  209. package/dist/linter/integration-linter.js +0 -35
  210. package/dist/linter/integration-linter.js.map +0 -7
  211. package/dist/linter/interface-linter.js +0 -35
  212. package/dist/linter/interface-linter.js.map +0 -7
  213. package/dist/linter/ruleset-tests/bot.ruleset.test.js +0 -358
  214. package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +0 -7
  215. package/dist/linter/ruleset-tests/common.js +0 -37
  216. package/dist/linter/ruleset-tests/common.js.map +0 -7
  217. package/dist/linter/ruleset-tests/integration.ruleset.test.js +0 -887
  218. package/dist/linter/ruleset-tests/integration.ruleset.test.js.map +0 -7
  219. package/dist/linter/ruleset-tests/interface.ruleset.test.js +0 -383
  220. package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +0 -7
  221. package/dist/linter/rulesets/bot.ruleset.js +0 -191
  222. package/dist/linter/rulesets/bot.ruleset.js.map +0 -7
  223. package/dist/linter/rulesets/integration.ruleset.js +0 -378
  224. package/dist/linter/rulesets/integration.ruleset.js.map +0 -7
  225. package/dist/linter/rulesets/interface.ruleset.js +0 -157
  226. package/dist/linter/rulesets/interface.ruleset.js.map +0 -7
  227. package/dist/linter/spectral-functions.js +0 -36
  228. package/dist/linter/spectral-functions.js.map +0 -7
  229. package/dist/logger/base-logger.js +0 -170
  230. package/dist/logger/base-logger.js.map +0 -7
  231. package/dist/logger/index.js +0 -86
  232. package/dist/logger/index.js.map +0 -7
  233. package/dist/package-ref.js +0 -107
  234. package/dist/package-ref.js.map +0 -7
  235. package/dist/package-ref.test.js +0 -109
  236. package/dist/package-ref.test.js.map +0 -7
  237. package/dist/register-yargs.js +0 -91
  238. package/dist/register-yargs.js.map +0 -7
  239. package/dist/root.js +0 -41
  240. package/dist/root.js.map +0 -7
  241. package/dist/sdk/index.js +0 -22
  242. package/dist/sdk/index.js.map +0 -7
  243. package/dist/sdk/resolve-bot-interfaces.js +0 -43
  244. package/dist/sdk/resolve-bot-interfaces.js.map +0 -7
  245. package/dist/sdk/resolve-integration-interfaces.js +0 -161
  246. package/dist/sdk/resolve-integration-interfaces.js.map +0 -7
  247. package/dist/sdk/validate-bot.js +0 -88
  248. package/dist/sdk/validate-bot.js.map +0 -7
  249. package/dist/sdk/validate-integration.js +0 -72
  250. package/dist/sdk/validate-integration.js.map +0 -7
  251. package/dist/typings.js +0 -17
  252. package/dist/typings.js.map +0 -7
  253. package/dist/utils/cache-utils.js +0 -104
  254. package/dist/utils/cache-utils.js.map +0 -7
  255. package/dist/utils/case-utils.js +0 -84
  256. package/dist/utils/case-utils.js.map +0 -7
  257. package/dist/utils/case-utils.test.js +0 -75
  258. package/dist/utils/case-utils.test.js.map +0 -7
  259. package/dist/utils/esbuild-utils.js +0 -92
  260. package/dist/utils/esbuild-utils.js.map +0 -7
  261. package/dist/utils/event-emitter.js +0 -63
  262. package/dist/utils/event-emitter.js.map +0 -7
  263. package/dist/utils/file-watcher.js +0 -73
  264. package/dist/utils/file-watcher.js.map +0 -7
  265. package/dist/utils/guard-utils.js +0 -32
  266. package/dist/utils/guard-utils.js.map +0 -7
  267. package/dist/utils/id-utils.js +0 -59
  268. package/dist/utils/id-utils.js.map +0 -7
  269. package/dist/utils/index.js +0 -99
  270. package/dist/utils/index.js.map +0 -7
  271. package/dist/utils/object-utils.js +0 -32
  272. package/dist/utils/object-utils.js.map +0 -7
  273. package/dist/utils/path-utils.js +0 -106
  274. package/dist/utils/path-utils.js.map +0 -7
  275. package/dist/utils/path-utils.test.js +0 -72
  276. package/dist/utils/path-utils.test.js.map +0 -7
  277. package/dist/utils/pkgjson-utils.js +0 -57
  278. package/dist/utils/pkgjson-utils.js.map +0 -7
  279. package/dist/utils/promise-utils.js +0 -33
  280. package/dist/utils/promise-utils.js.map +0 -7
  281. package/dist/utils/promise-utils.test.js +0 -14
  282. package/dist/utils/promise-utils.test.js.map +0 -7
  283. package/dist/utils/prompt-utils.js +0 -105
  284. package/dist/utils/prompt-utils.js.map +0 -7
  285. package/dist/utils/record-utils.js +0 -118
  286. package/dist/utils/record-utils.js.map +0 -7
  287. package/dist/utils/record-utils.test.js +0 -38
  288. package/dist/utils/record-utils.test.js.map +0 -7
  289. package/dist/utils/require-utils.js +0 -90
  290. package/dist/utils/require-utils.js.map +0 -7
  291. package/dist/utils/require-utils.test.js +0 -54
  292. package/dist/utils/require-utils.test.js.map +0 -7
  293. package/dist/utils/schema-utils.js +0 -64
  294. package/dist/utils/schema-utils.js.map +0 -7
  295. package/dist/utils/schema-utils.test.js +0 -50
  296. package/dist/utils/schema-utils.test.js.map +0 -7
  297. package/dist/utils/semver-utils.js +0 -45
  298. package/dist/utils/semver-utils.js.map +0 -7
  299. package/dist/utils/string-utils.js +0 -42
  300. package/dist/utils/string-utils.js.map +0 -7
  301. package/dist/utils/template-utils.js +0 -51
  302. package/dist/utils/template-utils.js.map +0 -7
  303. package/dist/utils/tunnel-utils.js +0 -129
  304. package/dist/utils/tunnel-utils.js.map +0 -7
  305. package/dist/utils/type-utils.js +0 -17
  306. package/dist/utils/type-utils.js.map +0 -7
  307. package/dist/utils/url-utils.js +0 -67
  308. package/dist/utils/url-utils.js.map +0 -7
  309. package/dist/worker/child-entrypoint.js +0 -58
  310. package/dist/worker/child-entrypoint.js.map +0 -7
  311. package/dist/worker/child-wrapper.js +0 -119
  312. package/dist/worker/child-wrapper.js.map +0 -7
  313. package/dist/worker/config.js +0 -44
  314. package/dist/worker/config.js.map +0 -7
  315. package/dist/worker/index.js +0 -32
  316. package/dist/worker/index.js.map +0 -7
  317. package/dist/worker/is-child.js +0 -55
  318. package/dist/worker/is-child.js.map +0 -7
  319. package/dist/worker/worker-state.js +0 -71
  320. package/dist/worker/worker-state.js.map +0 -7
  321. package/dist/worker/worker.js +0 -91
  322. package/dist/worker/worker.js.map +0 -7
  323. package/templates/empty-bot/.botpress/implementation/index.ts +0 -50
  324. package/templates/empty-bot/.botpress/implementation/plugins/index.ts +0 -11
  325. package/templates/empty-bot/.botpress/implementation/typings/actions/index.ts +0 -6
  326. package/templates/empty-bot/.botpress/implementation/typings/events/index.ts +0 -6
  327. package/templates/empty-bot/.botpress/implementation/typings/index.ts +0 -20
  328. package/templates/empty-bot/.botpress/implementation/typings/integrations/index.ts +0 -6
  329. package/templates/empty-bot/.botpress/implementation/typings/states/index.ts +0 -6
  330. package/templates/empty-bot/.botpress/index.ts +0 -5
  331. package/templates/empty-integration/.botpress/implementation/index.ts +0 -57
  332. package/templates/empty-integration/.botpress/implementation/typings/actions/index.ts +0 -6
  333. package/templates/empty-integration/.botpress/implementation/typings/channels/index.ts +0 -6
  334. package/templates/empty-integration/.botpress/implementation/typings/configuration/index.ts +0 -2
  335. package/templates/empty-integration/.botpress/implementation/typings/configurations/index.ts +0 -6
  336. package/templates/empty-integration/.botpress/implementation/typings/entities/index.ts +0 -6
  337. package/templates/empty-integration/.botpress/implementation/typings/events/index.ts +0 -6
  338. package/templates/empty-integration/.botpress/implementation/typings/index.ts +0 -31
  339. package/templates/empty-integration/.botpress/implementation/typings/states/index.ts +0 -6
  340. package/templates/empty-integration/.botpress/index.ts +0 -2
  341. package/templates/empty-integration/.botpress/secrets/index.ts +0 -6
  342. package/templates/empty-plugin/.botpress/implementation/index.ts +0 -35
  343. package/templates/empty-plugin/.botpress/implementation/typings/actions/index.ts +0 -6
  344. package/templates/empty-plugin/.botpress/implementation/typings/configuration/index.ts +0 -2
  345. package/templates/empty-plugin/.botpress/implementation/typings/events/index.ts +0 -6
  346. package/templates/empty-plugin/.botpress/implementation/typings/index.ts +0 -26
  347. package/templates/empty-plugin/.botpress/implementation/typings/integrations/index.ts +0 -6
  348. package/templates/empty-plugin/.botpress/implementation/typings/interfaces/index.ts +0 -6
  349. package/templates/empty-plugin/.botpress/implementation/typings/states/index.ts +0 -6
  350. package/templates/empty-plugin/.botpress/index.ts +0 -1
  351. package/templates/hello-world/.botpress/implementation/index.ts +0 -57
  352. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/index.ts +0 -12
  353. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/input.ts +0 -5
  354. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/output.ts +0 -5
  355. package/templates/hello-world/.botpress/implementation/typings/actions/index.ts +0 -9
  356. package/templates/hello-world/.botpress/implementation/typings/channels/index.ts +0 -6
  357. package/templates/hello-world/.botpress/implementation/typings/configuration/index.ts +0 -2
  358. package/templates/hello-world/.botpress/implementation/typings/configurations/index.ts +0 -6
  359. package/templates/hello-world/.botpress/implementation/typings/entities/index.ts +0 -6
  360. package/templates/hello-world/.botpress/implementation/typings/events/index.ts +0 -6
  361. package/templates/hello-world/.botpress/implementation/typings/index.ts +0 -31
  362. package/templates/hello-world/.botpress/implementation/typings/states/index.ts +0 -6
  363. package/templates/hello-world/.botpress/index.ts +0 -2
  364. package/templates/hello-world/.botpress/secrets/index.ts +0 -6
  365. package/templates/webhook-message/.botpress/implementation/index.ts +0 -57
  366. package/templates/webhook-message/.botpress/implementation/typings/actions/index.ts +0 -6
  367. package/templates/webhook-message/.botpress/implementation/typings/channels/index.ts +0 -9
  368. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/index.ts +0 -12
  369. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/index.ts +0 -9
  370. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/text.ts +0 -5
  371. package/templates/webhook-message/.botpress/implementation/typings/configuration/index.ts +0 -8
  372. package/templates/webhook-message/.botpress/implementation/typings/configurations/index.ts +0 -6
  373. package/templates/webhook-message/.botpress/implementation/typings/entities/index.ts +0 -6
  374. package/templates/webhook-message/.botpress/implementation/typings/events/index.ts +0 -6
  375. package/templates/webhook-message/.botpress/implementation/typings/index.ts +0 -31
  376. package/templates/webhook-message/.botpress/implementation/typings/states/index.ts +0 -6
  377. package/templates/webhook-message/.botpress/index.ts +0 -2
  378. package/templates/webhook-message/.botpress/secrets/index.ts +0 -6
@@ -1,146 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var integration_body_exports = {};
30
- __export(integration_body_exports, {
31
- prepareCreateIntegrationBody: () => prepareCreateIntegrationBody,
32
- prepareUpdateIntegrationBody: () => prepareUpdateIntegrationBody
33
- });
34
- module.exports = __toCommonJS(integration_body_exports);
35
- var utils = __toESM(require("../utils"));
36
- const prepareCreateIntegrationBody = async (integration) => ({
37
- name: integration.name,
38
- version: integration.version,
39
- title: integration.title,
40
- description: integration.description,
41
- icon: integration.icon,
42
- readme: integration.readme,
43
- user: integration.user,
44
- identifier: integration.identifier,
45
- secrets: void 0,
46
- interfaces: {},
47
- configuration: integration.configuration ? {
48
- ...integration.configuration,
49
- schema: await utils.schema.mapZodToJsonSchema(integration.configuration)
50
- } : void 0,
51
- configurations: integration.configurations ? await utils.records.mapValuesAsync(integration.configurations, async (configuration) => ({
52
- ...configuration,
53
- schema: await utils.schema.mapZodToJsonSchema(configuration)
54
- })) : void 0,
55
- events: integration.events ? await utils.records.mapValuesAsync(integration.events, async (event) => ({
56
- ...event,
57
- schema: await utils.schema.mapZodToJsonSchema(event)
58
- })) : void 0,
59
- actions: integration.actions ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({
60
- ...action,
61
- input: {
62
- ...action.input,
63
- schema: await utils.schema.mapZodToJsonSchema(action.input)
64
- },
65
- output: {
66
- ...action.output,
67
- schema: await utils.schema.mapZodToJsonSchema(action.output)
68
- }
69
- })) : void 0,
70
- channels: integration.channels ? await utils.records.mapValuesAsync(integration.channels, async (channel) => ({
71
- ...channel,
72
- messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
73
- ...message,
74
- schema: await utils.schema.mapZodToJsonSchema(message)
75
- }))
76
- })) : void 0,
77
- states: integration.states ? await utils.records.mapValuesAsync(integration.states, async (state) => ({
78
- ...state,
79
- schema: await utils.schema.mapZodToJsonSchema(state)
80
- })) : void 0,
81
- entities: integration.entities ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({
82
- ...entity,
83
- schema: await utils.schema.mapZodToJsonSchema(entity)
84
- })) : void 0
85
- });
86
- const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
87
- const actions = utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions);
88
- const events = utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events);
89
- const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states);
90
- const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities);
91
- const user = {
92
- ...localIntegration.user,
93
- tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags)
94
- };
95
- const channels = prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels);
96
- const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces);
97
- const configurations = utils.records.setNullOnMissingValues(
98
- localIntegration.configurations,
99
- remoteIntegration.configurations
100
- );
101
- return {
102
- ...localIntegration,
103
- actions,
104
- events,
105
- states,
106
- entities,
107
- user,
108
- channels,
109
- interfaces,
110
- configurations
111
- };
112
- };
113
- const prepareUpdateIntegrationChannelsBody = (localChannels, remoteChannels) => {
114
- const channelBody = {};
115
- const zipped = utils.records.zipObjects(localChannels, remoteChannels);
116
- for (const [channelName, [localChannel, remoteChannel]] of Object.entries(zipped)) {
117
- if (localChannel && remoteChannel) {
118
- channelBody[channelName] = prepareUpdateIntegrationChannelBody(localChannel, remoteChannel);
119
- } else if (localChannel) {
120
- channelBody[channelName] = localChannel;
121
- continue;
122
- } else if (remoteChannel) {
123
- channelBody[channelName] = null;
124
- continue;
125
- }
126
- }
127
- return channelBody;
128
- };
129
- const prepareUpdateIntegrationChannelBody = (localChannel, remoteChannel) => ({
130
- ...localChannel,
131
- messages: utils.records.setNullOnMissingValues(localChannel?.messages, remoteChannel.messages),
132
- message: {
133
- ...localChannel?.message,
134
- tags: utils.records.setNullOnMissingValues(localChannel?.message?.tags, remoteChannel.message.tags)
135
- },
136
- conversation: {
137
- ...localChannel?.conversation,
138
- tags: utils.records.setNullOnMissingValues(localChannel?.conversation?.tags, remoteChannel.conversation.tags)
139
- }
140
- });
141
- // Annotate the CommonJS export names for ESM import in node:
142
- 0 && (module.exports = {
143
- prepareCreateIntegrationBody,
144
- prepareUpdateIntegrationBody
145
- });
146
- //# sourceMappingURL=integration-body.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api/integration-body.ts"],
4
- "sourcesContent": ["import type { Client, Integration } from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\n\nexport type CreateIntegrationBody = Parameters<Client['createIntegration']>[0]\nexport type UpdateIntegrationBody = Parameters<Client['updateIntegration']>[0]\n\ntype UpdateIntegrationChannelsBody = NonNullable<UpdateIntegrationBody['channels']>\ntype UpdateIntegrationChannelBody = UpdateIntegrationChannelsBody[string]\n\ntype Channels = Integration['channels']\ntype Channel = Integration['channels'][string]\n\nexport const prepareCreateIntegrationBody = async (\n integration: sdk.IntegrationDefinition\n): Promise<CreateIntegrationBody> => ({\n name: integration.name,\n version: integration.version,\n title: integration.title,\n description: integration.description,\n icon: integration.icon,\n readme: integration.readme,\n user: integration.user,\n identifier: integration.identifier,\n secrets: undefined,\n interfaces: {},\n configuration: integration.configuration\n ? {\n ...integration.configuration,\n schema: await utils.schema.mapZodToJsonSchema(integration.configuration),\n }\n : undefined,\n configurations: integration.configurations\n ? await utils.records.mapValuesAsync(integration.configurations, async (configuration) => ({\n ...configuration,\n schema: await utils.schema.mapZodToJsonSchema(configuration),\n }))\n : undefined,\n events: integration.events\n ? await utils.records.mapValuesAsync(integration.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: integration.actions\n ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n channels: integration.channels\n ? await utils.records.mapValuesAsync(integration.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : undefined,\n states: integration.states\n ? await utils.records.mapValuesAsync(integration.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n entities: integration.entities\n ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : undefined,\n})\n\nexport const prepareUpdateIntegrationBody = (\n localIntegration: UpdateIntegrationBody,\n remoteIntegration: Integration\n): UpdateIntegrationBody => {\n const actions = utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions)\n const events = utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events)\n const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states)\n const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities)\n const user = {\n ...localIntegration.user,\n tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags),\n }\n\n const channels = prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels)\n\n const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces)\n\n const configurations = utils.records.setNullOnMissingValues(\n localIntegration.configurations,\n remoteIntegration.configurations\n )\n\n return {\n ...localIntegration,\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\n }\n}\n\nconst prepareUpdateIntegrationChannelsBody = (\n localChannels: UpdateIntegrationChannelsBody,\n remoteChannels: Channels\n): UpdateIntegrationChannelsBody => {\n const channelBody: UpdateIntegrationChannelsBody = {}\n\n const zipped = utils.records.zipObjects(localChannels, remoteChannels)\n for (const [channelName, [localChannel, remoteChannel]] of Object.entries(zipped)) {\n if (localChannel && remoteChannel) {\n // channel has to be updated\n channelBody[channelName] = prepareUpdateIntegrationChannelBody(localChannel, remoteChannel)\n } else if (localChannel) {\n // channel has to be created\n channelBody[channelName] = localChannel\n continue\n } else if (remoteChannel) {\n // channel has to be deleted\n channelBody[channelName] = null\n continue\n }\n }\n\n return channelBody\n}\n\nconst prepareUpdateIntegrationChannelBody = (\n localChannel: UpdateIntegrationChannelBody,\n remoteChannel: Channel\n): UpdateIntegrationChannelBody => ({\n ...localChannel,\n messages: utils.records.setNullOnMissingValues(localChannel?.messages, remoteChannel.messages),\n message: {\n ...localChannel?.message,\n tags: utils.records.setNullOnMissingValues(localChannel?.message?.tags, remoteChannel.message.tags),\n },\n conversation: {\n ...localChannel?.conversation,\n tags: utils.records.setNullOnMissingValues(localChannel?.conversation?.tags, remoteChannel.conversation.tags),\n },\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAWhB,MAAM,+BAA+B,OAC1C,iBACoC;AAAA,EACpC,MAAM,YAAY;AAAA,EAClB,SAAS,YAAY;AAAA,EACrB,OAAO,YAAY;AAAA,EACnB,aAAa,YAAY;AAAA,EACzB,MAAM,YAAY;AAAA,EAClB,QAAQ,YAAY;AAAA,EACpB,MAAM,YAAY;AAAA,EAClB,YAAY,YAAY;AAAA,EACxB,SAAS;AAAA,EACT,YAAY,CAAC;AAAA,EACb,eAAe,YAAY,gBACvB;AAAA,IACE,GAAG,YAAY;AAAA,IACf,QAAQ,MAAM,MAAM,OAAO,mBAAmB,YAAY,aAAa;AAAA,EACzE,IACA;AAAA,EACJ,gBAAgB,YAAY,iBACxB,MAAM,MAAM,QAAQ,eAAe,YAAY,gBAAgB,OAAO,mBAAmB;AAAA,IACvF,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,aAAa;AAAA,EAC7D,EAAE,IACF;AAAA,EACJ,QAAQ,YAAY,SAChB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;AAAA,EAC7F,SAAS;AAAA,IACP,GAAG,cAAc;AAAA,IACjB,MAAM,MAAM,QAAQ,uBAAuB,cAAc,SAAS,MAAM,cAAc,QAAQ,IAAI;AAAA,EACpG;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,cAAc;AAAA,IACjB,MAAM,MAAM,QAAQ,uBAAuB,cAAc,cAAc,MAAM,cAAc,aAAa,IAAI;AAAA,EAC9G;AACF;",
6
- "names": []
7
- }
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var interface_body_exports = {};
30
- __export(interface_body_exports, {
31
- prepareCreateInterfaceBody: () => prepareCreateInterfaceBody,
32
- prepareUpdateInterfaceBody: () => prepareUpdateInterfaceBody
33
- });
34
- module.exports = __toCommonJS(interface_body_exports);
35
- var utils = __toESM(require("../utils"));
36
- const prepareCreateInterfaceBody = async (intrface) => ({
37
- name: intrface.name,
38
- version: intrface.version,
39
- entities: intrface.entities ? await utils.records.mapValuesAsync(intrface.entities, async (entity) => ({
40
- ...entity,
41
- schema: await utils.schema.mapZodToJsonSchema(entity)
42
- })) : {},
43
- events: intrface.events ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({
44
- ...event,
45
- schema: await utils.schema.mapZodToJsonSchema(event)
46
- })) : {},
47
- actions: intrface.actions ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({
48
- ...action,
49
- input: {
50
- ...action.input,
51
- schema: await utils.schema.mapZodToJsonSchema(action.input)
52
- },
53
- output: {
54
- ...action.output,
55
- schema: await utils.schema.mapZodToJsonSchema(action.output)
56
- }
57
- })) : {},
58
- channels: intrface.channels ? await utils.records.mapValuesAsync(intrface.channels, async (channel) => ({
59
- ...channel,
60
- messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
61
- ...message,
62
- schema: await utils.schema.mapZodToJsonSchema(message)
63
- }))
64
- })) : {},
65
- nameTemplate: intrface.templateName ? {
66
- script: intrface.templateName,
67
- language: "handlebars"
68
- } : void 0
69
- });
70
- const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
71
- const actions = utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions);
72
- const events = utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events);
73
- const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities);
74
- const currentChannels = localInterface.channels ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({
75
- ...channel,
76
- messages: utils.records.setNullOnMissingValues(
77
- channel?.messages,
78
- remoteInterface.channels[channelName]?.messages
79
- )
80
- })) : void 0;
81
- const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels);
82
- return {
83
- ...localInterface,
84
- entities,
85
- actions,
86
- events,
87
- channels
88
- };
89
- };
90
- // Annotate the CommonJS export names for ESM import in node:
91
- 0 && (module.exports = {
92
- prepareCreateInterfaceBody,
93
- prepareUpdateInterfaceBody
94
- });
95
- //# sourceMappingURL=interface-body.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api/interface-body.ts"],
4
- "sourcesContent": ["import type { Client, Interface } from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\n\nexport type CreateInterfaceBody = Parameters<Client['createInterface']>[0]\nexport type UpdateInterfaceBody = Parameters<Client['updateInterface']>[0]\n\nexport const prepareCreateInterfaceBody = async (intrface: sdk.InterfaceDefinition): Promise<CreateInterfaceBody> => ({\n name: intrface.name,\n version: intrface.version,\n entities: intrface.entities\n ? await utils.records.mapValuesAsync(intrface.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : {},\n events: intrface.events\n ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : {},\n actions: intrface.actions\n ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : {},\n channels: intrface.channels\n ? await utils.records.mapValuesAsync(intrface.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : {},\n nameTemplate: intrface.templateName\n ? {\n script: intrface.templateName,\n language: 'handlebars',\n }\n : undefined,\n})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: CreateInterfaceBody & { id: string },\n remoteInterface: Interface\n): UpdateInterfaceBody => {\n const actions = utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions)\n const events = utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events)\n const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities)\n\n const currentChannels: UpdateInterfaceBody['channels'] = localInterface.channels\n ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({\n ...channel,\n messages: utils.records.setNullOnMissingValues(\n channel?.messages,\n remoteInterface.channels[channelName]?.messages\n ),\n }))\n : undefined\n\n const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels)\n\n return {\n ...localInterface,\n entities,\n actions,\n events,\n channels,\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAKhB,MAAM,6BAA6B,OAAO,cAAqE;AAAA,EACpH,MAAM,SAAS;AAAA,EACf,SAAS,SAAS;AAAA,EAClB,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,YAAY;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,MAAM;AAAA,EACtD,EAAE,IACF,CAAC;AAAA,EACL,QAAQ,SAAS,SACb,MAAM,MAAM,QAAQ,eAAe,SAAS,QAAQ,OAAO,WAAW;AAAA,IACpE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF,CAAC;AAAA,EACL,SAAS,SAAS,UACd,MAAM,MAAM,QAAQ,eAAe,SAAS,SAAS,OAAO,YAAY;AAAA,IACtE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF,CAAC;AAAA,EACL,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,aAAa;AAAA,IACxE,GAAG;AAAA,IACH,UAAU,MAAM,MAAM,QAAQ,eAAe,QAAQ,UAAU,OAAO,aAAa;AAAA,MACjF,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO;AAAA,IACvD,EAAE;AAAA,EACJ,EAAE,IACF,CAAC;AAAA,EACL,cAAc,SAAS,eACnB;AAAA,IACE,QAAQ,SAAS;AAAA,IACjB,UAAU;AAAA,EACZ,IACA;AACN;AAEO,MAAM,6BAA6B,CACxC,gBACA,oBACwB;AACxB,QAAM,UAAU,MAAM,QAAQ,uBAAuB,eAAe,SAAS,gBAAgB,OAAO;AACpG,QAAM,SAAS,MAAM,QAAQ,uBAAuB,eAAe,QAAQ,gBAAgB,MAAM;AACjG,QAAM,WAAW,MAAM,QAAQ,uBAAuB,eAAe,UAAU,gBAAgB,QAAQ;AAEvG,QAAM,kBAAmD,eAAe,WACpE,MAAM,QAAQ,UAAU,eAAe,UAAU,CAAC,SAAS,iBAAiB;AAAA,IAC1E,GAAG;AAAA,IACH,UAAU,MAAM,QAAQ;AAAA,MACtB,SAAS;AAAA,MACT,gBAAgB,SAAS,WAAW,GAAG;AAAA,IACzC;AAAA,EACF,EAAE,IACF;AAEJ,QAAM,WAAW,MAAM,QAAQ,uBAAuB,iBAAiB,gBAAgB,QAAQ;AAE/F,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var paging_exports = {};
20
- __export(paging_exports, {
21
- listAllPages: () => listAllPages
22
- });
23
- module.exports = __toCommonJS(paging_exports);
24
- async function listAllPages(lister, mapper) {
25
- let nextToken;
26
- const all = [];
27
- do {
28
- const { meta, ...r } = await lister({ nextToken });
29
- all.push(r);
30
- nextToken = meta.nextToken;
31
- } while (nextToken);
32
- if (!mapper) {
33
- return all;
34
- }
35
- const mapped = all.flatMap((r) => mapper(r));
36
- return mapped;
37
- }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- listAllPages
41
- });
42
- //# sourceMappingURL=paging.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api/paging.ts"],
4
- "sourcesContent": ["export type PageLister<R extends object> = (t: { nextToken?: string }) => Promise<R & { meta: { nextToken?: string } }>\n\nexport async function listAllPages<R extends object>(lister: PageLister<R>): Promise<R[]>\nexport async function listAllPages<R extends object, M>(lister: PageLister<R>, mapper?: (r: R) => M[]): Promise<M[]>\nexport async function listAllPages<R extends object, M>(lister: PageLister<R>, mapper?: (r: R) => M[]) {\n let nextToken: string | undefined\n const all: R[] = []\n\n do {\n const { meta, ...r } = await lister({ nextToken })\n all.push(r as R)\n nextToken = meta.nextToken\n } while (nextToken)\n\n if (!mapper) {\n return all\n }\n\n const mapped: M[] = all.flatMap((r) => mapper(r))\n return mapped\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,eAAsB,aAAkC,QAAuB,QAAwB;AACrG,MAAI;AACJ,QAAM,MAAW,CAAC;AAElB,KAAG;AACD,UAAM,EAAE,MAAM,GAAG,EAAE,IAAI,MAAM,OAAO,EAAE,UAAU,CAAC;AACjD,QAAI,KAAK,CAAM;AACf,gBAAY,KAAK;AAAA,EACnB,SAAS;AAET,MAAI,CAAC,QAAQ;AACX,WAAO;AAAA,EACT;AAEA,QAAM,SAAc,IAAI,QAAQ,CAAC,MAAM,OAAO,CAAC,CAAC;AAChD,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var plugin_body_exports = {};
30
- __export(plugin_body_exports, {
31
- prepareCreatePluginBody: () => prepareCreatePluginBody,
32
- prepareUpdatePluginBody: () => prepareUpdatePluginBody
33
- });
34
- module.exports = __toCommonJS(plugin_body_exports);
35
- var utils = __toESM(require("../utils"));
36
- const prepareCreatePluginBody = async (plugin) => ({
37
- name: plugin.name,
38
- version: plugin.version,
39
- user: {
40
- tags: plugin.user?.tags ?? {}
41
- },
42
- configuration: plugin.configuration ? {
43
- ...plugin.configuration,
44
- schema: await utils.schema.mapZodToJsonSchema(plugin.configuration)
45
- } : void 0,
46
- events: plugin.events ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({
47
- ...event,
48
- schema: await utils.schema.mapZodToJsonSchema(event)
49
- })) : void 0,
50
- actions: plugin.actions ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({
51
- ...action,
52
- input: {
53
- ...action.input,
54
- schema: await utils.schema.mapZodToJsonSchema(action.input)
55
- },
56
- output: {
57
- ...action.output,
58
- schema: await utils.schema.mapZodToJsonSchema(action.output)
59
- }
60
- })) : void 0,
61
- states: plugin.states ? await utils.records.mapValuesAsync(plugin.states, async (state) => ({
62
- ...state,
63
- schema: await utils.schema.mapZodToJsonSchema(state)
64
- })) : void 0
65
- });
66
- const prepareUpdatePluginBody = (localPlugin, remotePlugin) => {
67
- const actions = utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions);
68
- const events = utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events);
69
- const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states);
70
- return {
71
- ...localPlugin,
72
- actions,
73
- events,
74
- states,
75
- user: localPlugin.user
76
- // TODO: allow deleting user tags with null
77
- };
78
- };
79
- // Annotate the CommonJS export names for ESM import in node:
80
- 0 && (module.exports = {
81
- prepareCreatePluginBody,
82
- prepareUpdatePluginBody
83
- });
84
- //# sourceMappingURL=plugin-body.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api/plugin-body.ts"],
4
- "sourcesContent": ["import type { Client, Plugin } from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\n\nexport type CreatePluginBody = utils.types.Merge<\n Parameters<Client['createPlugin']>[0],\n {\n code?: string\n }\n>\nexport type UpdatePluginBody = Parameters<Client['updatePlugin']>[0]\n\nexport const prepareCreatePluginBody = async (plugin: sdk.PluginDefinition): Promise<CreatePluginBody> => ({\n name: plugin.name,\n version: plugin.version,\n user: {\n tags: plugin.user?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration),\n }\n : undefined,\n events: plugin.events\n ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: plugin.actions\n ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n states: plugin.states\n ? await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n})\n\nexport const prepareUpdatePluginBody = (localPlugin: UpdatePluginBody, remotePlugin: Plugin): UpdatePluginBody => {\n const actions = utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions)\n const events = utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events)\n const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states)\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n user: localPlugin.user, // TODO: allow deleting user tags with null\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAUhB,MAAM,0BAA0B,OAAO,YAA6D;AAAA,EACzG,MAAM,OAAO;AAAA,EACb,SAAS,OAAO;AAAA,EAChB,MAAM;AAAA,IACJ,MAAM,OAAO,MAAM,QAAQ,CAAC;AAAA,EAC9B;AAAA,E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object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
17
- //# sourceMappingURL=types.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/api/types.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport { Logger } from 'src/logger'\nimport { ApiClient } from './client'\n\nexport type ApiClientProps = {\n apiUrl: string\n token: string\n workspaceId: string\n}\n\nexport type ApiClientFactory = {\n newClient: (props: ApiClientProps, logger: Logger) => ApiClient\n}\n\nexport type PublicIntegration = client.Integration\nexport type PrivateIntegration = client.Integration & { workspaceId: string }\nexport type Integration = client.Integration & { workspaceId?: string }\nexport type IntegrationSummary = client.ClientOutputs['listIntegrations']['integrations'][number]\n\nexport type BotSummary = client.ClientOutputs['listBots']['bots'][number]\n\nexport type Interface = client.Interface\nexport type Plugin = client.Plugin\n\nexport type BaseOperation = (...args: any[]) => Promise<any>\nexport type Operations = {\n [K in keyof client.Client as client.Client[K] extends BaseOperation ? K : never]: client.Client[K]\n}\nexport type Requests = {\n [K in keyof Operations]: Parameters<Operations[K]>[0]\n}\nexport type Responses = {\n [K in keyof Operations]: ReturnType<Operations[K]>\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var bot_implementation_exports = {};
30
- __export(bot_implementation_exports, {
31
- BotImplementationModule: () => BotImplementationModule
32
- });
33
- module.exports = __toCommonJS(bot_implementation_exports);
34
- var consts = __toESM(require("../consts"));
35
- var import_module = require("../module");
36
- var import_bot_plugins = require("./bot-plugins");
37
- var import_bot_typings = require("./bot-typings");
38
- class BotImplementationModule extends import_module.Module {
39
- _typingsModule;
40
- _pluginsModule;
41
- constructor(bot) {
42
- super({
43
- exportName: "Bot",
44
- path: consts.INDEX_FILE
45
- });
46
- this._typingsModule = new import_bot_typings.BotTypingsModule(bot);
47
- this._typingsModule.unshift("typings");
48
- this.pushDep(this._typingsModule);
49
- this._pluginsModule = new import_bot_plugins.BotPluginsIndexModule(bot);
50
- this._pluginsModule.unshift(consts.fromOutDir.pluginsDir);
51
- this.pushDep(this._pluginsModule);
52
- }
53
- async getContent() {
54
- const {
55
- //
56
- _typingsModule: typingsModule,
57
- _pluginsModule: pluginsModule
58
- } = this;
59
- const typingsImport = typingsModule.import(this);
60
- const pluginsImport = pluginsModule.import(this);
61
- return [
62
- consts.GENERATED_HEADER,
63
- 'import * as sdk from "@botpress/sdk"',
64
- `import * as ${typingsModule.name} from "./${typingsImport}"`,
65
- `import * as ${pluginsModule.name} from "./${pluginsImport}"`,
66
- "",
67
- `export * from "./${typingsImport}"`,
68
- `export * from "./${pluginsImport}"`,
69
- "",
70
- `type TPlugins = ${pluginsModule.name}.TPlugins`,
71
- `type TBot = sdk.DefaultBot<${typingsModule.name}.${typingsModule.exportName}>`,
72
- "",
73
- "export type BotProps = {",
74
- ' actions: sdk.BotProps<TBot, TPlugins>["actions"]',
75
- "}",
76
- "",
77
- "export class Bot extends sdk.Bot<TBot, TPlugins> {",
78
- " public constructor(props: BotProps) {",
79
- " super({",
80
- " actions: props.actions,",
81
- ` plugins: ${pluginsModule.name}.${pluginsModule.exportName}`,
82
- " })",
83
- " }",
84
- "}",
85
- "",
86
- "// extra types",
87
- "",
88
- "type AsyncFunction = (...args: any[]) => Promise<any>",
89
- "export type EventHandlers = Required<{",
90
- " [K in keyof Bot['eventHandlers']]: NonNullable<Bot['eventHandlers'][K]>[number]",
91
- "}>",
92
- "export type MessageHandlers = Required<{",
93
- " [K in keyof Bot['messageHandlers']]: NonNullable<Bot['messageHandlers'][K]>[number]",
94
- "}>",
95
- "",
96
- "export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]",
97
- "export type EventHandlerProps = Parameters<EventHandlers['*']>[0]",
98
- "",
99
- "export type Client = (MessageHandlerProps | EventHandlerProps)['client']",
100
- "export type ClientOperation = keyof {",
101
- " [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null",
102
- "}",
103
- "export type ClientInputs = {",
104
- " [K in ClientOperation]: Parameters<Client[K]>[0]",
105
- "}",
106
- "export type ClientOutputs = {",
107
- " [K in ClientOperation]: Awaited<ReturnType<Client[K]>>",
108
- "}"
109
- ].join("\n");
110
- }
111
- }
112
- // Annotate the CommonJS export names for ESM import in node:
113
- 0 && (module.exports = {
114
- BotImplementationModule
115
- });
116
- //# sourceMappingURL=bot-implementation.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/code-generation/bot-implementation/bot-implementation.ts"],
4
- "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { Module } from '../module'\nimport { BotPluginsIndexModule } from './bot-plugins'\nimport { BotTypingsModule } from './bot-typings'\n\nexport class BotImplementationModule extends Module {\n private _typingsModule: BotTypingsModule\n private _pluginsModule: BotPluginsIndexModule\n\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'Bot',\n path: consts.INDEX_FILE,\n })\n\n this._typingsModule = new BotTypingsModule(bot)\n this._typingsModule.unshift('typings')\n this.pushDep(this._typingsModule)\n\n this._pluginsModule = new BotPluginsIndexModule(bot)\n this._pluginsModule.unshift(consts.fromOutDir.pluginsDir)\n this.pushDep(this._pluginsModule)\n }\n\n public async getContent() {\n const {\n //\n _typingsModule: typingsModule,\n _pluginsModule: pluginsModule,\n } = this\n\n const typingsImport = typingsModule.import(this)\n const pluginsImport = pluginsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${typingsModule.name} from \"./${typingsImport}\"`,\n `import * as ${pluginsModule.name} from \"./${pluginsImport}\"`,\n '',\n `export * from \"./${typingsImport}\"`,\n `export * from \"./${pluginsImport}\"`,\n '',\n `type TPlugins = ${pluginsModule.name}.TPlugins`,\n `type TBot = sdk.DefaultBot<${typingsModule.name}.${typingsModule.exportName}>`,\n '',\n 'export type BotProps = {',\n ' actions: sdk.BotProps<TBot, TPlugins>[\"actions\"]',\n '}',\n '',\n 'export class Bot extends sdk.Bot<TBot, TPlugins> {',\n ' public constructor(props: BotProps) {',\n ' super({',\n ' actions: props.actions,',\n ` plugins: ${pluginsModule.name}.${pluginsModule.exportName}`,\n ' })',\n ' }',\n '}',\n '',\n '// extra types',\n '',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n 'export type EventHandlers = Required<{',\n \" [K in keyof Bot['eventHandlers']]: NonNullable<Bot['eventHandlers'][K]>[number]\",\n '}>',\n 'export type MessageHandlers = Required<{',\n \" [K in keyof Bot['messageHandlers']]: NonNullable<Bot['messageHandlers'][K]>[number]\",\n '}>',\n '',\n \"export type MessageHandlerProps = Parameters<MessageHandlers['*']>[0]\",\n \"export type EventHandlerProps = Parameters<EventHandlers['*']>[0]\",\n '',\n \"export type Client = (MessageHandlerProps | EventHandlerProps)['client']\",\n 'export type ClientOperation = keyof {',\n ' [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null',\n '}',\n 'export type ClientInputs = {',\n ' [K in ClientOperation]: Parameters<Client[K]>[0]',\n '}',\n 'export type ClientOutputs = {',\n ' [K in ClientOperation]: Awaited<ReturnType<Client[K]>>',\n '}',\n ].join('\\n')\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAuB;AACvB,yBAAsC;AACtC,yBAAiC;AAE1B,MAAM,gCAAgC,qBAAO;AAAA,EAC1C;AAAA,EACA;AAAA,EAED,YAAY,KAAwB;AACzC,UAAM;AAAA,MACJ,YAAY;AAAA,MACZ,MAAM,OAAO;AAAA,IACf,CAAC;AAED,SAAK,iBAAiB,IAAI,oCAAiB,GAAG;AAC9C,SAAK,eAAe,QAAQ,SAAS;AACrC,SAAK,QAAQ,KAAK,cAAc;AAEhC,SAAK,iBAAiB,IAAI,yCAAsB,GAAG;AACnD,SAAK,eAAe,QAAQ,OAAO,WAAW,UAAU;AACxD,SAAK,QAAQ,KAAK,cAAc;AAAA,EAClC;AAAA,EAEA,MAAa,aAAa;AACxB,UA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