@botpress/cli 2.2.3 → 2.2.5

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 (385) hide show
  1. package/.turbo/turbo-build.log +13 -13
  2. package/dist/api/bot-body.js +0 -0
  3. package/dist/api/bot-body.js.map +0 -0
  4. package/dist/api/client.js +0 -0
  5. package/dist/api/client.js.map +0 -0
  6. package/dist/api/find-previous-version.js +0 -0
  7. package/dist/api/find-previous-version.js.map +0 -0
  8. package/dist/api/find-previous-version.test.js +0 -0
  9. package/dist/api/find-previous-version.test.js.map +0 -0
  10. package/dist/api/index.js +0 -0
  11. package/dist/api/index.js.map +0 -0
  12. package/dist/api/integration-body.js +0 -0
  13. package/dist/api/integration-body.js.map +0 -0
  14. package/dist/api/interface-body.js +0 -0
  15. package/dist/api/interface-body.js.map +0 -0
  16. package/dist/api/paging.js +0 -0
  17. package/dist/api/paging.js.map +0 -0
  18. package/dist/api/plugin-body.js +0 -0
  19. package/dist/api/plugin-body.js.map +0 -0
  20. package/dist/api/types.js +0 -0
  21. package/dist/api/types.js.map +0 -0
  22. package/dist/chat/index.js +0 -0
  23. package/dist/chat/index.js.map +0 -0
  24. package/dist/code-generation/bot-implementation/bot-implementation.js +0 -0
  25. package/dist/code-generation/bot-implementation/bot-implementation.js.map +0 -0
  26. package/dist/code-generation/bot-implementation/bot-plugins/index.js +0 -0
  27. package/dist/code-generation/bot-implementation/bot-plugins/index.js.map +0 -0
  28. package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js +0 -0
  29. package/dist/code-generation/bot-implementation/bot-plugins/plugin-module.js.map +0 -0
  30. package/dist/code-generation/bot-implementation/bot-typings/actions-module.js +0 -0
  31. package/dist/code-generation/bot-implementation/bot-typings/actions-module.js.map +0 -0
  32. package/dist/code-generation/bot-implementation/bot-typings/events-module.js +0 -0
  33. package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +0 -0
  34. package/dist/code-generation/bot-implementation/bot-typings/index.js +0 -0
  35. package/dist/code-generation/bot-implementation/bot-typings/index.js.map +0 -0
  36. package/dist/code-generation/bot-implementation/bot-typings/states-module.js +0 -0
  37. package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +0 -0
  38. package/dist/code-generation/bot-implementation/index.js +0 -0
  39. package/dist/code-generation/bot-implementation/index.js.map +0 -0
  40. package/dist/code-generation/consts.js +0 -0
  41. package/dist/code-generation/consts.js.map +0 -0
  42. package/dist/code-generation/generators.js +0 -0
  43. package/dist/code-generation/generators.js.map +0 -0
  44. package/dist/code-generation/index.js +0 -0
  45. package/dist/code-generation/index.js.map +0 -0
  46. package/dist/code-generation/integration-implementation/index.js +0 -0
  47. package/dist/code-generation/integration-implementation/index.js.map +0 -0
  48. package/dist/code-generation/integration-implementation/integration-implementation.js +0 -0
  49. package/dist/code-generation/integration-implementation/integration-implementation.js.map +0 -0
  50. package/dist/code-generation/integration-implementation/integration-secret.js +0 -0
  51. package/dist/code-generation/integration-implementation/integration-secret.js.map +0 -0
  52. package/dist/code-generation/integration-implementation/integration-typings/actions-module.js +0 -0
  53. package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map +0 -0
  54. package/dist/code-generation/integration-implementation/integration-typings/channels-module.js +0 -0
  55. package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +0 -0
  56. package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js +0 -0
  57. package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js.map +0 -0
  58. package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js +0 -0
  59. package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +0 -0
  60. package/dist/code-generation/integration-implementation/integration-typings/entities-module.js +0 -0
  61. package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map +0 -0
  62. package/dist/code-generation/integration-implementation/integration-typings/events-module.js +0 -0
  63. package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map +0 -0
  64. package/dist/code-generation/integration-implementation/integration-typings/index.js +0 -0
  65. package/dist/code-generation/integration-implementation/integration-typings/index.js.map +0 -0
  66. package/dist/code-generation/integration-implementation/integration-typings/states-module.js +0 -0
  67. package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +0 -0
  68. package/dist/code-generation/integration-package/index.js +0 -0
  69. package/dist/code-generation/integration-package/index.js.map +0 -0
  70. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +0 -0
  71. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +0 -0
  72. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js +0 -0
  73. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +0 -0
  74. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js +0 -0
  75. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js.map +0 -0
  76. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js +0 -0
  77. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +0 -0
  78. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js +0 -0
  79. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +0 -0
  80. package/dist/code-generation/integration-package/integration-package-definition/events-module.js +0 -0
  81. package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +0 -0
  82. package/dist/code-generation/integration-package/integration-package-definition/index.js +0 -0
  83. package/dist/code-generation/integration-package/integration-package-definition/index.js.map +0 -0
  84. package/dist/code-generation/integration-package/integration-package-definition/states-module.js +0 -0
  85. package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +0 -0
  86. package/dist/code-generation/integration-package/integration-package-definition/typings.js +0 -0
  87. package/dist/code-generation/integration-package/integration-package-definition/typings.js.map +0 -0
  88. package/dist/code-generation/interface-implementation/index.js +0 -0
  89. package/dist/code-generation/interface-implementation/index.js.map +0 -0
  90. package/dist/code-generation/interface-implementation/integration-typings/actions-module.js +0 -0
  91. package/dist/code-generation/interface-implementation/integration-typings/actions-module.js.map +0 -0
  92. package/dist/code-generation/interface-implementation/integration-typings/channels-module.js +0 -0
  93. package/dist/code-generation/interface-implementation/integration-typings/channels-module.js.map +0 -0
  94. package/dist/code-generation/interface-implementation/integration-typings/entities-module.js +0 -0
  95. package/dist/code-generation/interface-implementation/integration-typings/entities-module.js.map +0 -0
  96. package/dist/code-generation/interface-implementation/integration-typings/events-module.js +0 -0
  97. package/dist/code-generation/interface-implementation/integration-typings/events-module.js.map +0 -0
  98. package/dist/code-generation/interface-implementation/integration-typings/index.js +0 -0
  99. package/dist/code-generation/interface-implementation/integration-typings/index.js.map +0 -0
  100. package/dist/code-generation/interface-package/index.js +0 -0
  101. package/dist/code-generation/interface-package/index.js.map +0 -0
  102. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +0 -0
  103. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +0 -0
  104. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js +0 -0
  105. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +0 -0
  106. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js +0 -0
  107. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +0 -0
  108. package/dist/code-generation/interface-package/interface-package-definition/events-module.js +0 -0
  109. package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +0 -0
  110. package/dist/code-generation/interface-package/interface-package-definition/index.js +0 -0
  111. package/dist/code-generation/interface-package/interface-package-definition/index.js.map +0 -0
  112. package/dist/code-generation/interface-package/interface-package-definition/typings.js +0 -0
  113. package/dist/code-generation/interface-package/interface-package-definition/typings.js.map +0 -0
  114. package/dist/code-generation/module.js +0 -0
  115. package/dist/code-generation/module.js.map +0 -0
  116. package/dist/code-generation/plugin-implementation/index.js +0 -0
  117. package/dist/code-generation/plugin-implementation/index.js.map +0 -0
  118. package/dist/code-generation/plugin-implementation/plugin-implementation.js +0 -0
  119. package/dist/code-generation/plugin-implementation/plugin-implementation.js.map +0 -0
  120. package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js +0 -0
  121. package/dist/code-generation/plugin-implementation/plugin-typings/actions-module.js.map +0 -0
  122. package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js +0 -0
  123. package/dist/code-generation/plugin-implementation/plugin-typings/configuration-module.js.map +0 -0
  124. package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js +0 -0
  125. package/dist/code-generation/plugin-implementation/plugin-typings/events-module.js.map +0 -0
  126. package/dist/code-generation/plugin-implementation/plugin-typings/index.js +0 -0
  127. package/dist/code-generation/plugin-implementation/plugin-typings/index.js.map +0 -0
  128. package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js +0 -0
  129. package/dist/code-generation/plugin-implementation/plugin-typings/states-module.js.map +0 -0
  130. package/dist/code-generation/plugin-package/index.js +0 -0
  131. package/dist/code-generation/plugin-package/index.js.map +0 -0
  132. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js +0 -0
  133. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +0 -0
  134. package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js +0 -0
  135. package/dist/code-generation/plugin-package/plugin-package-definition/configuration-module.js.map +0 -0
  136. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js +0 -0
  137. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +0 -0
  138. package/dist/code-generation/plugin-package/plugin-package-definition/index.js +0 -0
  139. package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +0 -0
  140. package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js +0 -0
  141. package/dist/code-generation/plugin-package/plugin-package-definition/states-module.js.map +0 -0
  142. package/dist/code-generation/plugin-package/plugin-package-definition/typings.js +0 -0
  143. package/dist/code-generation/plugin-package/plugin-package-definition/typings.js.map +0 -0
  144. package/dist/code-generation/strings.js +0 -0
  145. package/dist/code-generation/strings.js.map +0 -0
  146. package/dist/code-generation/typings.js +0 -0
  147. package/dist/code-generation/typings.js.map +0 -0
  148. package/dist/command-definitions.js +0 -0
  149. package/dist/command-definitions.js.map +0 -0
  150. package/dist/command-implementations/add-command.js +0 -0
  151. package/dist/command-implementations/add-command.js.map +0 -0
  152. package/dist/command-implementations/base-command.js +0 -0
  153. package/dist/command-implementations/base-command.js.map +0 -0
  154. package/dist/command-implementations/bot-commands.js +0 -0
  155. package/dist/command-implementations/bot-commands.js.map +0 -0
  156. package/dist/command-implementations/build-command.js +0 -0
  157. package/dist/command-implementations/build-command.js.map +0 -0
  158. package/dist/command-implementations/bundle-command.js +12 -11
  159. package/dist/command-implementations/bundle-command.js.map +2 -2
  160. package/dist/command-implementations/chat-command.js +0 -0
  161. package/dist/command-implementations/chat-command.js.map +0 -0
  162. package/dist/command-implementations/deploy-command.js +0 -0
  163. package/dist/command-implementations/deploy-command.js.map +0 -0
  164. package/dist/command-implementations/dev-command.js +0 -0
  165. package/dist/command-implementations/dev-command.js.map +0 -0
  166. package/dist/command-implementations/gen-command.js +0 -0
  167. package/dist/command-implementations/gen-command.js.map +0 -0
  168. package/dist/command-implementations/global-command.js +0 -0
  169. package/dist/command-implementations/global-command.js.map +0 -0
  170. package/dist/command-implementations/index.js +0 -0
  171. package/dist/command-implementations/index.js.map +0 -0
  172. package/dist/command-implementations/init-command.js +0 -0
  173. package/dist/command-implementations/init-command.js.map +0 -0
  174. package/dist/command-implementations/integration-commands.js +0 -0
  175. package/dist/command-implementations/integration-commands.js.map +0 -0
  176. package/dist/command-implementations/interface-commands.js +0 -0
  177. package/dist/command-implementations/interface-commands.js.map +0 -0
  178. package/dist/command-implementations/lint-command.js +0 -0
  179. package/dist/command-implementations/lint-command.js.map +0 -0
  180. package/dist/command-implementations/login-command.js +0 -0
  181. package/dist/command-implementations/login-command.js.map +0 -0
  182. package/dist/command-implementations/logout-command.js +0 -0
  183. package/dist/command-implementations/logout-command.js.map +0 -0
  184. package/dist/command-implementations/plugin-commands.js +0 -0
  185. package/dist/command-implementations/plugin-commands.js.map +0 -0
  186. package/dist/command-implementations/project-command.js +4 -8
  187. package/dist/command-implementations/project-command.js.map +2 -2
  188. package/dist/command-implementations/read-command.js +0 -0
  189. package/dist/command-implementations/read-command.js.map +0 -0
  190. package/dist/command-implementations/serve-command.js +0 -0
  191. package/dist/command-implementations/serve-command.js.map +0 -0
  192. package/dist/command-tree.js +0 -0
  193. package/dist/command-tree.js.map +0 -0
  194. package/dist/config.js +0 -0
  195. package/dist/config.js.map +0 -0
  196. package/dist/consts.js +0 -0
  197. package/dist/consts.js.map +0 -0
  198. package/dist/errors.js +0 -0
  199. package/dist/errors.js.map +0 -0
  200. package/dist/index.js +0 -0
  201. package/dist/index.js.map +0 -0
  202. package/dist/init.js +0 -0
  203. package/dist/init.js.map +0 -0
  204. package/dist/linter/base-linter.js +0 -0
  205. package/dist/linter/base-linter.js.map +0 -0
  206. package/dist/linter/base-linter.test.js +0 -0
  207. package/dist/linter/base-linter.test.js.map +0 -0
  208. package/dist/linter/bot-linter.js +0 -0
  209. package/dist/linter/bot-linter.js.map +0 -0
  210. package/dist/linter/integration-linter.js +0 -0
  211. package/dist/linter/integration-linter.js.map +0 -0
  212. package/dist/linter/interface-linter.js +0 -0
  213. package/dist/linter/interface-linter.js.map +0 -0
  214. package/dist/linter/ruleset-tests/bot.ruleset.test.js +0 -0
  215. package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +0 -0
  216. package/dist/linter/ruleset-tests/common.js +0 -0
  217. package/dist/linter/ruleset-tests/common.js.map +0 -0
  218. package/dist/linter/ruleset-tests/integration.ruleset.test.js +0 -0
  219. package/dist/linter/ruleset-tests/integration.ruleset.test.js.map +0 -0
  220. package/dist/linter/ruleset-tests/interface.ruleset.test.js +0 -0
  221. package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +0 -0
  222. package/dist/linter/rulesets/bot.ruleset.js +0 -0
  223. package/dist/linter/rulesets/bot.ruleset.js.map +0 -0
  224. package/dist/linter/rulesets/integration.ruleset.js +0 -0
  225. package/dist/linter/rulesets/integration.ruleset.js.map +0 -0
  226. package/dist/linter/rulesets/interface.ruleset.js +0 -0
  227. package/dist/linter/rulesets/interface.ruleset.js.map +0 -0
  228. package/dist/linter/spectral-functions.js +0 -0
  229. package/dist/linter/spectral-functions.js.map +0 -0
  230. package/dist/logger/base-logger.js +0 -0
  231. package/dist/logger/base-logger.js.map +0 -0
  232. package/dist/logger/index.js +0 -0
  233. package/dist/logger/index.js.map +0 -0
  234. package/dist/package-ref.js +0 -0
  235. package/dist/package-ref.js.map +0 -0
  236. package/dist/package-ref.test.js +0 -0
  237. package/dist/package-ref.test.js.map +0 -0
  238. package/dist/register-yargs.js +0 -0
  239. package/dist/register-yargs.js.map +0 -0
  240. package/dist/root.js +0 -0
  241. package/dist/root.js.map +0 -0
  242. package/dist/sdk/index.js +0 -0
  243. package/dist/sdk/index.js.map +0 -0
  244. package/dist/sdk/resolve-bot-interfaces.js +0 -0
  245. package/dist/sdk/resolve-bot-interfaces.js.map +0 -0
  246. package/dist/sdk/resolve-integration-interfaces.js +0 -0
  247. package/dist/sdk/resolve-integration-interfaces.js.map +0 -0
  248. package/dist/sdk/validate-bot.js +0 -0
  249. package/dist/sdk/validate-bot.js.map +0 -0
  250. package/dist/sdk/validate-integration.js +0 -0
  251. package/dist/sdk/validate-integration.js.map +0 -0
  252. package/dist/typings.js +0 -0
  253. package/dist/typings.js.map +0 -0
  254. package/dist/utils/cache-utils.js +0 -0
  255. package/dist/utils/cache-utils.js.map +0 -0
  256. package/dist/utils/case-utils.js +0 -0
  257. package/dist/utils/case-utils.js.map +0 -0
  258. package/dist/utils/case-utils.test.js +0 -0
  259. package/dist/utils/case-utils.test.js.map +0 -0
  260. package/dist/utils/esbuild-utils.js +38 -55
  261. package/dist/utils/esbuild-utils.js.map +3 -3
  262. package/dist/utils/event-emitter.js +0 -0
  263. package/dist/utils/event-emitter.js.map +0 -0
  264. package/dist/utils/file-watcher.js +0 -0
  265. package/dist/utils/file-watcher.js.map +0 -0
  266. package/dist/utils/guard-utils.js +0 -0
  267. package/dist/utils/guard-utils.js.map +0 -0
  268. package/dist/utils/id-utils.js +0 -0
  269. package/dist/utils/id-utils.js.map +0 -0
  270. package/dist/utils/index.js +0 -0
  271. package/dist/utils/index.js.map +0 -0
  272. package/dist/utils/object-utils.js +0 -0
  273. package/dist/utils/object-utils.js.map +0 -0
  274. package/dist/utils/path-utils.js +0 -0
  275. package/dist/utils/path-utils.js.map +0 -0
  276. package/dist/utils/path-utils.test.js +0 -0
  277. package/dist/utils/path-utils.test.js.map +0 -0
  278. package/dist/utils/pkgjson-utils.js +0 -0
  279. package/dist/utils/pkgjson-utils.js.map +0 -0
  280. package/dist/utils/promise-utils.js +0 -0
  281. package/dist/utils/promise-utils.js.map +0 -0
  282. package/dist/utils/promise-utils.test.js +0 -0
  283. package/dist/utils/promise-utils.test.js.map +0 -0
  284. package/dist/utils/prompt-utils.js +0 -0
  285. package/dist/utils/prompt-utils.js.map +0 -0
  286. package/dist/utils/record-utils.js +0 -0
  287. package/dist/utils/record-utils.js.map +0 -0
  288. package/dist/utils/record-utils.test.js +0 -0
  289. package/dist/utils/record-utils.test.js.map +0 -0
  290. package/dist/utils/require-utils.js +0 -0
  291. package/dist/utils/require-utils.js.map +0 -0
  292. package/dist/utils/require-utils.test.js +0 -0
  293. package/dist/utils/require-utils.test.js.map +0 -0
  294. package/dist/utils/schema-utils.js +0 -0
  295. package/dist/utils/schema-utils.js.map +0 -0
  296. package/dist/utils/schema-utils.test.js +0 -0
  297. package/dist/utils/schema-utils.test.js.map +0 -0
  298. package/dist/utils/semver-utils.js +0 -0
  299. package/dist/utils/semver-utils.js.map +0 -0
  300. package/dist/utils/string-utils.js +0 -0
  301. package/dist/utils/string-utils.js.map +0 -0
  302. package/dist/utils/template-utils.js +0 -0
  303. package/dist/utils/template-utils.js.map +0 -0
  304. package/dist/utils/tunnel-utils.js +0 -0
  305. package/dist/utils/tunnel-utils.js.map +0 -0
  306. package/dist/utils/type-utils.js +0 -0
  307. package/dist/utils/type-utils.js.map +0 -0
  308. package/dist/utils/url-utils.js +0 -0
  309. package/dist/utils/url-utils.js.map +0 -0
  310. package/dist/worker/child-entrypoint.js +0 -0
  311. package/dist/worker/child-entrypoint.js.map +0 -0
  312. package/dist/worker/child-wrapper.js +0 -0
  313. package/dist/worker/child-wrapper.js.map +0 -0
  314. package/dist/worker/config.js +0 -0
  315. package/dist/worker/config.js.map +0 -0
  316. package/dist/worker/index.js +0 -0
  317. package/dist/worker/index.js.map +0 -0
  318. package/dist/worker/is-child.js +0 -0
  319. package/dist/worker/is-child.js.map +0 -0
  320. package/dist/worker/worker-state.js +0 -0
  321. package/dist/worker/worker-state.js.map +0 -0
  322. package/dist/worker/worker.js +0 -0
  323. package/dist/worker/worker.js.map +0 -0
  324. package/package.json +2 -2
  325. package/templates/empty-bot/.botpress/implementation/index.ts +0 -0
  326. package/templates/empty-bot/.botpress/implementation/plugins/index.ts +0 -0
  327. package/templates/empty-bot/.botpress/implementation/typings/actions/index.ts +0 -0
  328. package/templates/empty-bot/.botpress/implementation/typings/events/index.ts +0 -0
  329. package/templates/empty-bot/.botpress/implementation/typings/index.ts +0 -0
  330. package/templates/empty-bot/.botpress/implementation/typings/integrations/index.ts +0 -0
  331. package/templates/empty-bot/.botpress/implementation/typings/states/index.ts +0 -0
  332. package/templates/empty-bot/.botpress/index.ts +0 -0
  333. package/templates/empty-bot/package.json +1 -1
  334. package/templates/empty-integration/.botpress/implementation/index.ts +0 -0
  335. package/templates/empty-integration/.botpress/implementation/typings/actions/index.ts +0 -0
  336. package/templates/empty-integration/.botpress/implementation/typings/channels/index.ts +0 -0
  337. package/templates/empty-integration/.botpress/implementation/typings/configuration/index.ts +0 -0
  338. package/templates/empty-integration/.botpress/implementation/typings/configurations/index.ts +0 -0
  339. package/templates/empty-integration/.botpress/implementation/typings/entities/index.ts +0 -0
  340. package/templates/empty-integration/.botpress/implementation/typings/events/index.ts +0 -0
  341. package/templates/empty-integration/.botpress/implementation/typings/index.ts +0 -0
  342. package/templates/empty-integration/.botpress/implementation/typings/states/index.ts +0 -0
  343. package/templates/empty-integration/.botpress/index.ts +0 -0
  344. package/templates/empty-integration/.botpress/secrets/index.ts +0 -0
  345. package/templates/empty-integration/package.json +1 -1
  346. package/templates/empty-plugin/.botpress/implementation/index.ts +0 -0
  347. package/templates/empty-plugin/.botpress/implementation/typings/actions/index.ts +0 -0
  348. package/templates/empty-plugin/.botpress/implementation/typings/configuration/index.ts +0 -0
  349. package/templates/empty-plugin/.botpress/implementation/typings/events/index.ts +0 -0
  350. package/templates/empty-plugin/.botpress/implementation/typings/index.ts +0 -0
  351. package/templates/empty-plugin/.botpress/implementation/typings/integrations/index.ts +0 -0
  352. package/templates/empty-plugin/.botpress/implementation/typings/interfaces/index.ts +0 -0
  353. package/templates/empty-plugin/.botpress/implementation/typings/states/index.ts +0 -0
  354. package/templates/empty-plugin/.botpress/index.ts +0 -0
  355. package/templates/empty-plugin/package.json +1 -1
  356. package/templates/hello-world/.botpress/implementation/index.ts +0 -0
  357. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/index.ts +0 -0
  358. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/input.ts +0 -0
  359. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/output.ts +0 -0
  360. package/templates/hello-world/.botpress/implementation/typings/actions/index.ts +0 -0
  361. package/templates/hello-world/.botpress/implementation/typings/channels/index.ts +0 -0
  362. package/templates/hello-world/.botpress/implementation/typings/configuration/index.ts +0 -0
  363. package/templates/hello-world/.botpress/implementation/typings/configurations/index.ts +0 -0
  364. package/templates/hello-world/.botpress/implementation/typings/entities/index.ts +0 -0
  365. package/templates/hello-world/.botpress/implementation/typings/events/index.ts +0 -0
  366. package/templates/hello-world/.botpress/implementation/typings/index.ts +0 -0
  367. package/templates/hello-world/.botpress/implementation/typings/states/index.ts +0 -0
  368. package/templates/hello-world/.botpress/index.ts +0 -0
  369. package/templates/hello-world/.botpress/secrets/index.ts +0 -0
  370. package/templates/hello-world/package.json +1 -1
  371. package/templates/webhook-message/.botpress/implementation/index.ts +0 -0
  372. package/templates/webhook-message/.botpress/implementation/typings/actions/index.ts +0 -0
  373. package/templates/webhook-message/.botpress/implementation/typings/channels/index.ts +0 -0
  374. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/index.ts +0 -0
  375. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/index.ts +0 -0
  376. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/text.ts +0 -0
  377. package/templates/webhook-message/.botpress/implementation/typings/configuration/index.ts +0 -0
  378. package/templates/webhook-message/.botpress/implementation/typings/configurations/index.ts +0 -0
  379. package/templates/webhook-message/.botpress/implementation/typings/entities/index.ts +0 -0
  380. package/templates/webhook-message/.botpress/implementation/typings/events/index.ts +0 -0
  381. package/templates/webhook-message/.botpress/implementation/typings/index.ts +0 -0
  382. package/templates/webhook-message/.botpress/implementation/typings/states/index.ts +0 -0
  383. package/templates/webhook-message/.botpress/index.ts +0 -0
  384. package/templates/webhook-message/.botpress/secrets/index.ts +0 -0
  385. package/templates/webhook-message/package.json +1 -1
@@ -126,8 +126,7 @@ class ProjectCommand extends import_global_command.GlobalCommand {
126
126
  }
127
127
  const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition);
128
128
  const { outputFiles } = await utils.esbuild.buildEntrypoint({
129
- cwd: abs.workDir,
130
- outfile: "",
129
+ absWorkingDir: abs.workDir,
131
130
  entrypoint: rel.integrationDefinition,
132
131
  write: false,
133
132
  minify: false
@@ -149,8 +148,7 @@ class ProjectCommand extends import_global_command.GlobalCommand {
149
148
  }
150
149
  const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition);
151
150
  const { outputFiles } = await utils.esbuild.buildEntrypoint({
152
- cwd: abs.workDir,
153
- outfile: "",
151
+ absWorkingDir: abs.workDir,
154
152
  entrypoint: rel.interfaceDefinition,
155
153
  write: false,
156
154
  minify: false
@@ -170,8 +168,7 @@ class ProjectCommand extends import_global_command.GlobalCommand {
170
168
  }
171
169
  const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition);
172
170
  const { outputFiles } = await utils.esbuild.buildEntrypoint({
173
- cwd: abs.workDir,
174
- outfile: "",
171
+ absWorkingDir: abs.workDir,
175
172
  entrypoint: rel.botDefinition,
176
173
  write: false,
177
174
  minify: false
@@ -193,8 +190,7 @@ class ProjectCommand extends import_global_command.GlobalCommand {
193
190
  }
194
191
  const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition);
195
192
  const { outputFiles } = await utils.esbuild.buildEntrypoint({
196
- cwd: abs.workDir,
197
- outfile: "",
193
+ absWorkingDir: abs.workDir,
198
194
  entrypoint: rel.pluginDefinition,
199
195
  write: false,
200
196
  minify: false
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/project-command.ts"],
4
- "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport bluebird from 'bluebird'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport { ApiClient } from '../api/client'\nimport * as codegen from '../code-generation'\nimport type * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { formatPackageRef, PackageRef } from '../package-ref'\nimport { validateIntegrationDefinition, resolveInterfaces, resolveBotInterfaces, validateBotDefinition } from '../sdk'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>\nexport type ProjectCache = { botId: string; devId: string }\n\ntype ConfigurableProjectPaths = { workDir: string }\ntype ConstantProjectPaths = typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype IntegrationInstance = NonNullable<sdk.BotDefinition['integrations']>[string]\ntype RemoteIntegrationInstance = utils.types.Merge<IntegrationInstance, { id: string }>\ntype LocalIntegrationInstance = utils.types.Merge<IntegrationInstance, { uri?: string }>\ntype BotIntegrationRequest = NonNullable<NonNullable<client.ClientInputs['updateBot']['integrations']>[string]>\n\ntype LintIgnoredConfig = { bpLintDisabled?: boolean }\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition = LintIgnoredConfig &\n (\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n )\n\nclass ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {\n public constructor(argv: CommandArgv<ProjectCommandDefinition>) {\n const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir)\n super({\n workDir: absWorkDir,\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected override async bootstrap() {\n await super.bootstrap()\n await this._notifyUpdateSdk()\n }\n\n protected get projectPaths() {\n return new ProjectPaths(this.argv)\n }\n\n protected get projectCache() {\n return new utils.cache.FSKeyValueCache<ProjectCache>(this.projectPaths.abs.projectCacheFile)\n }\n\n protected async fetchBotIntegrationInstances(\n botDefinition: sdk.BotDefinition,\n api: ApiClient\n ): Promise<Record<string, BotIntegrationRequest>> {\n const integrationList = _(botDefinition.integrations).values().filter(utils.guards.is.defined).value()\n\n const { remoteInstances, localInstances } = this._splitApiAndLocalIntegrationInstances(integrationList)\n\n const fetchedInstances: RemoteIntegrationInstance[] = await bluebird.map(localInstances, async (instance) => {\n const ref: PackageRef = { type: 'name', name: instance.name, version: instance.version }\n const integration = await api.findIntegration(ref)\n if (!integration) {\n const formattedRef = formatPackageRef(ref)\n throw new errors.BotpressCLIError(`Integration \"${formattedRef}\" not found`)\n }\n return { ...instance, id: integration.id }\n })\n\n return _([...fetchedInstances, ...remoteInstances])\n .keyBy((i) => i.id)\n .mapValues(({ enabled, configurationType, configuration }) => ({\n enabled,\n configurationType: configurationType ?? null,\n configuration,\n }))\n .value()\n }\n\n private _splitApiAndLocalIntegrationInstances(instances: IntegrationInstance[]): {\n remoteInstances: RemoteIntegrationInstance[]\n localInstances: LocalIntegrationInstance[]\n } {\n const remoteInstances: RemoteIntegrationInstance[] = []\n const localInstances: LocalIntegrationInstance[] = []\n for (const instance of instances) {\n const { id } = instance\n if (id) {\n remoteInstances.push({ ...instance, id })\n } else {\n localInstances.push(instance)\n }\n }\n\n return { remoteInstances, localInstances }\n }\n\n protected async readProjectDefinitionFromFS(): Promise<ProjectDefinition> {\n const projectPaths = this.projectPaths\n try {\n const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths)\n if (integrationDefinition) {\n return { type: 'integration', ...integrationDefinition }\n }\n const interfaceDefinition = await this._readInterfaceDefinitionFromFS(projectPaths)\n if (interfaceDefinition) {\n return { type: 'interface', ...interfaceDefinition }\n }\n const botDefinition = await this._readBotDefinitionFromFS(projectPaths)\n if (botDefinition) {\n return { type: 'bot', ...botDefinition }\n }\n const pluginDefinition = await this._readPluginDefinitionFromFS(projectPaths)\n if (pluginDefinition) {\n return { type: 'plugin', ...pluginDefinition }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\n }\n\n throw new errors.ProjectDefinitionNotFoundError(this.projectPaths.abs.workDir)\n }\n\n private async _readIntegrationDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition'>\n ): Promise<({ definition: sdk.IntegrationDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.integrationDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n let { default: definition } = utils.require.requireJsCode<{ default: sdk.IntegrationDefinition }>(artifact.text)\n definition = resolveInterfaces(definition)\n validateIntegrationDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<({ definition: sdk.InterfaceDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.interfaceDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.InterfaceDefinition }>(artifact.text)\n\n return { definition, bpLintDisabled }\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<({ definition: sdk.BotDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.botDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n let { default: definition } = utils.require.requireJsCode<{ default: sdk.BotDefinition }>(artifact.text)\n definition = resolveBotInterfaces(definition)\n validateBotDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readPluginDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'pluginDefinition'>\n ): Promise<({ definition: sdk.PluginDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.pluginDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n cwd: abs.workDir,\n outfile: '',\n entrypoint: rel.pluginDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.PluginDefinition }>(artifact.text)\n // TODO: validate plugin definition\n return { definition, bpLintDisabled }\n }\n\n private async _isBpLintDisabled(definitionPath: string): Promise<boolean> {\n const tsContent = await fs.promises.readFile(definitionPath, 'utf-8')\n const regex = /\\/\\* bplint-disable \\*\\//\n return regex.test(tsContent)\n }\n\n protected displayWebhookUrls(bot: client.Bot) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n this.logger.log('Integrations:')\n for (const integration of Object.values(bot.integrations).filter(utils.guards.is.defined)) {\n if (!integration.enabled) {\n this.logger.log(`${chalk.grey(integration.name)} ${chalk.italic('(disabled)')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 2 },\n })\n } else {\n this.logger.log(`${chalk.bold(integration.name)} : ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 2 },\n })\n }\n }\n }\n\n protected async promptSecrets(\n integrationDef: sdk.IntegrationDefinition,\n argv: YargsConfig<typeof config.schemas.secrets>,\n opts: { formatEnv?: boolean; knownSecrets?: string[] } = {}\n ): Promise<Record<string, string | null>> {\n const formatEnv = opts.formatEnv ?? false\n const knownSecrets = opts.knownSecrets ?? []\n\n const { secrets: secretDefinitions } = integrationDef\n if (!secretDefinitions) {\n return {}\n }\n\n const secretArgv = this._parseArgvSecrets(argv.secrets)\n const invalidSecret = Object.keys(secretArgv).find((s) => !secretDefinitions[s])\n if (invalidSecret) {\n throw new errors.BotpressCLIError(`Secret ${invalidSecret} is not defined in integration definition`)\n }\n\n const values: Record<string, string | null> = {}\n for (const [secretName, { optional }] of Object.entries(secretDefinitions)) {\n const argvSecret = secretArgv[secretName]\n if (argvSecret) {\n this.logger.debug(`Using secret \"${secretName}\" from argv`)\n values[secretName] = argvSecret\n continue\n }\n\n const alreadyKnown = knownSecrets.includes(secretName)\n let mode: string\n if (alreadyKnown) {\n mode = 'already set'\n } else if (optional) {\n mode = 'optional'\n } else {\n mode = 'required'\n }\n\n const prompted = await this.prompt.text(`Enter value for secret \"${secretName}\" (${mode})`)\n if (prompted) {\n values[secretName] = prompted\n continue\n }\n\n if (alreadyKnown) {\n this.logger.log(`Secret \"${secretName}\" is unchanged`)\n } else if (optional) {\n this.logger.warn(`Secret \"${secretName}\" is unassigned`)\n } else {\n throw new errors.BotpressCLIError(`Secret \"${secretName}\" is required`)\n }\n }\n\n for (const secretName of knownSecrets) {\n const isDefined = secretName in secretDefinitions\n if (isDefined) {\n continue\n }\n const prompted = await this.prompt.confirm(`Secret \"${secretName}\" was removed. Do you wish to delete it?`)\n if (prompted) {\n this.logger.log(`Deleting secret \"${secretName}\"`, { prefix: { symbol: '\u00D7', fg: 'red' } })\n values[secretName] = null\n }\n }\n\n if (!formatEnv) {\n return values\n }\n\n const envVariables = _.mapKeys(values, (_v, k) => codegen.secretEnvVariableName(k))\n return envVariables\n }\n\n protected async readIntegrationConfigDefinition<C extends client.ClientInputs['createIntegration']['configuration']>(\n config: C\n ): Promise<C> {\n if (!config?.identifier) {\n return config\n }\n return {\n ...config,\n identifier: {\n ...config.identifier,\n linkTemplateScript: await this.readProjectFile(config.identifier.linkTemplateScript),\n },\n }\n }\n\n protected readProjectFile = async (filePath: string | undefined): Promise<string | undefined> => {\n if (!filePath) {\n return undefined\n }\n const absoluteFilePath = utils.path.absoluteFrom(this.projectPaths.abs.workDir, filePath)\n return fs.promises.readFile(absoluteFilePath, 'utf-8').catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not read file \"${absoluteFilePath}\"`)\n })\n }\n\n private _parseArgvSecrets(argvSecrets: string[]): Record<string, string> {\n const parsed: Record<string, string> = {}\n for (const secret of argvSecrets) {\n const [key, value] = utils.string.splitOnce(secret, '=')\n if (!value) {\n throw new errors.BotpressCLIError(\n `Secret \"${key}\" is missing a value. Expected format: \"SECRET_NAME=secretValue\"`\n )\n }\n parsed[key!] = value\n }\n\n return parsed\n }\n\n private _notifyUpdateSdk = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if sdk is up to date')\n\n const { workDir } = this.projectPaths.abs\n const projectPkgJson = await utils.pkgJson.readPackageJson(workDir)\n if (!projectPkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const sdkPackageName = '@botpress/sdk'\n const actualSdkVersion = utils.pkgJson.findDependency(projectPkgJson, sdkPackageName)\n if (!actualSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in project package.json`)\n return\n }\n\n if (actualSdkVersion.startsWith('workspace:')) {\n return\n }\n\n const actualCleanedSdkVersion = semver.valid(semver.coerce(actualSdkVersion))\n if (!actualCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${actualSdkVersion}\" in project package.json`)\n return\n }\n\n const cliPkgJson = await this.readPkgJson()\n const expectedSdkVersion = utils.pkgJson.findDependency(cliPkgJson, sdkPackageName)\n if (!expectedSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in cli package.json`)\n return\n }\n\n const expectedCleanedSdkVersion = semver.valid(semver.coerce(expectedSdkVersion))\n if (!expectedCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${expectedSdkVersion}\" in cli package.json`)\n return\n }\n\n if (semver.eq(actualCleanedSdkVersion, expectedCleanedSdkVersion)) {\n return\n }\n\n const diff = semver.diff(actualCleanedSdkVersion, expectedCleanedSdkVersion)\n if (!diff) {\n this.logger.debug(`Could not compare versions \"${actualCleanedSdkVersion}\" and \"${expectedCleanedSdkVersion}\"`)\n return\n }\n\n const errorMsg = `Project SDK version is \"${actualCleanedSdkVersion}\", but expected \"${expectedCleanedSdkVersion}\"`\n if (utils.semver.releases.lt(diff, 'minor')) {\n this.logger.debug(`${errorMsg}. This may cause compatibility issues.`)\n return\n }\n\n this.logger.warn(chalk.bold(`${errorMsg}. This will cause compatibility issues.`))\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown)\n this.logger.debug(`Failed to check if sdk is up to date: ${err.message}`)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AAEnB,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,yBAA6C;AAC7C,iBAA8G;AAE9G,YAAuB;AACvB,4BAA8B;AAyB9B,MAAM,qBAAqB,MAAM,KAAK,UAAiC;AAAA,EAC9D,YAAY,MAA6C;AAC9D,UAAM,aAAa,MAAM,KAAK,aAAa,MAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AACzE,UAAM;AAAA,MACJ,SAAS;AAAA,MACT,GAAG,cAAAA,QAAE,UAAU,OAAO,aAAa,CAAC,MAAM,MAAM,KAAK,aAAa,YAAY,CAAC,CAAC;AAAA,IAClF,CAAC;AAAA,EACH;AACF;AAEO,MAAe,uBAA2D,oCAAiB;AAAA,EAChG,MAAyB,YAAY;AACnC,UAAM,MAAM,UAAU;AACtB,UAAM,KAAK,iBAAiB;AAAA,EAC9B;AAAA,EAEA,IAAc,eAAe;AAC3B,WAAO,IAAI,aAAa,KAAK,IAAI;AAAA,EACnC;AAAA,EAEA,IAAc,eAAe;AAC3B,WAAO,IAAI,MAAM,MAAM,gBAA8B,K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C9B,aAAK,OAAO,MAAM,wBAAwB,yCAAyC;AACnF;AAAA,MACF;AAEA,UAAI,cAAAA,QAAO,GAAG,yBAAyB,yBAAyB,GAAG;AACjE;AAAA,MACF;AAEA,YAAM,OAAO,cAAAA,QAAO,KAAK,yBAAyB,yBAAyB;AAC3E,UAAI,CAAC,MAAM;AACT,aAAK,OAAO,MAAM,+BAA+B,iCAAiC,4BAA4B;AAC9G;AAAA,MACF;AAEA,YAAM,WAAW,2BAA2B,2CAA2C;AACvF,UAAI,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,GAAG;AAC3C,aAAK,OAAO,MAAM,GAAG,gDAAgD;AACrE;AAAA,MACF;AAEA,WAAK,OAAO,KAAK,aAAAD,QAAM,KAAK,GAAG,iDAAiD,CAAC;AAAA,IACnF,SAAS,QAAP;AACA,YAAM,MAAM,OAAO,iBAAiB,IAAI,MAAM;AAC9C,WAAK,OAAO,MAAM,yCAAyC,IAAI,SAAS;AAAA,IAC1E;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport bluebird from 'bluebird'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport { ApiClient } from '../api/client'\nimport * as codegen from '../code-generation'\nimport type * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { formatPackageRef, PackageRef } from '../package-ref'\nimport { validateIntegrationDefinition, resolveInterfaces, resolveBotInterfaces, validateBotDefinition } from '../sdk'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>\nexport type ProjectCache = { botId: string; devId: string }\n\ntype ConfigurableProjectPaths = { workDir: string }\ntype ConstantProjectPaths = typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype IntegrationInstance = NonNullable<sdk.BotDefinition['integrations']>[string]\ntype RemoteIntegrationInstance = utils.types.Merge<IntegrationInstance, { id: string }>\ntype LocalIntegrationInstance = utils.types.Merge<IntegrationInstance, { uri?: string }>\ntype BotIntegrationRequest = NonNullable<NonNullable<client.ClientInputs['updateBot']['integrations']>[string]>\n\ntype LintIgnoredConfig = { bpLintDisabled?: boolean }\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition = LintIgnoredConfig &\n (\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n )\n\nclass ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {\n public constructor(argv: CommandArgv<ProjectCommandDefinition>) {\n const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir)\n super({\n workDir: absWorkDir,\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected override async bootstrap() {\n await super.bootstrap()\n await this._notifyUpdateSdk()\n }\n\n protected get projectPaths() {\n return new ProjectPaths(this.argv)\n }\n\n protected get projectCache() {\n return new utils.cache.FSKeyValueCache<ProjectCache>(this.projectPaths.abs.projectCacheFile)\n }\n\n protected async fetchBotIntegrationInstances(\n botDefinition: sdk.BotDefinition,\n api: ApiClient\n ): Promise<Record<string, BotIntegrationRequest>> {\n const integrationList = _(botDefinition.integrations).values().filter(utils.guards.is.defined).value()\n\n const { remoteInstances, localInstances } = this._splitApiAndLocalIntegrationInstances(integrationList)\n\n const fetchedInstances: RemoteIntegrationInstance[] = await bluebird.map(localInstances, async (instance) => {\n const ref: PackageRef = { type: 'name', name: instance.name, version: instance.version }\n const integration = await api.findIntegration(ref)\n if (!integration) {\n const formattedRef = formatPackageRef(ref)\n throw new errors.BotpressCLIError(`Integration \"${formattedRef}\" not found`)\n }\n return { ...instance, id: integration.id }\n })\n\n return _([...fetchedInstances, ...remoteInstances])\n .keyBy((i) => i.id)\n .mapValues(({ enabled, configurationType, configuration }) => ({\n enabled,\n configurationType: configurationType ?? null,\n configuration,\n }))\n .value()\n }\n\n private _splitApiAndLocalIntegrationInstances(instances: IntegrationInstance[]): {\n remoteInstances: RemoteIntegrationInstance[]\n localInstances: LocalIntegrationInstance[]\n } {\n const remoteInstances: RemoteIntegrationInstance[] = []\n const localInstances: LocalIntegrationInstance[] = []\n for (const instance of instances) {\n const { id } = instance\n if (id) {\n remoteInstances.push({ ...instance, id })\n } else {\n localInstances.push(instance)\n }\n }\n\n return { remoteInstances, localInstances }\n }\n\n protected async readProjectDefinitionFromFS(): Promise<ProjectDefinition> {\n const projectPaths = this.projectPaths\n try {\n const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths)\n if (integrationDefinition) {\n return { type: 'integration', ...integrationDefinition }\n }\n const interfaceDefinition = await this._readInterfaceDefinitionFromFS(projectPaths)\n if (interfaceDefinition) {\n return { type: 'interface', ...interfaceDefinition }\n }\n const botDefinition = await this._readBotDefinitionFromFS(projectPaths)\n if (botDefinition) {\n return { type: 'bot', ...botDefinition }\n }\n const pluginDefinition = await this._readPluginDefinitionFromFS(projectPaths)\n if (pluginDefinition) {\n return { type: 'plugin', ...pluginDefinition }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\n }\n\n throw new errors.ProjectDefinitionNotFoundError(this.projectPaths.abs.workDir)\n }\n\n private async _readIntegrationDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition'>\n ): Promise<({ definition: sdk.IntegrationDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.integrationDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n let { default: definition } = utils.require.requireJsCode<{ default: sdk.IntegrationDefinition }>(artifact.text)\n definition = resolveInterfaces(definition)\n validateIntegrationDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<({ definition: sdk.InterfaceDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.interfaceDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.InterfaceDefinition }>(artifact.text)\n\n return { definition, bpLintDisabled }\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<({ definition: sdk.BotDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.botDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n let { default: definition } = utils.require.requireJsCode<{ default: sdk.BotDefinition }>(artifact.text)\n definition = resolveBotInterfaces(definition)\n validateBotDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readPluginDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'pluginDefinition'>\n ): Promise<({ definition: sdk.PluginDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.pluginDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.pluginDefinition,\n write: false,\n minify: false,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.PluginDefinition }>(artifact.text)\n // TODO: validate plugin definition\n return { definition, bpLintDisabled }\n }\n\n private async _isBpLintDisabled(definitionPath: string): Promise<boolean> {\n const tsContent = await fs.promises.readFile(definitionPath, 'utf-8')\n const regex = /\\/\\* bplint-disable \\*\\//\n return regex.test(tsContent)\n }\n\n protected displayWebhookUrls(bot: client.Bot) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n this.logger.log('Integrations:')\n for (const integration of Object.values(bot.integrations).filter(utils.guards.is.defined)) {\n if (!integration.enabled) {\n this.logger.log(`${chalk.grey(integration.name)} ${chalk.italic('(disabled)')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 2 },\n })\n } else {\n this.logger.log(`${chalk.bold(integration.name)} : ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 2 },\n })\n }\n }\n }\n\n protected async promptSecrets(\n integrationDef: sdk.IntegrationDefinition,\n argv: YargsConfig<typeof config.schemas.secrets>,\n opts: { formatEnv?: boolean; knownSecrets?: string[] } = {}\n ): Promise<Record<string, string | null>> {\n const formatEnv = opts.formatEnv ?? false\n const knownSecrets = opts.knownSecrets ?? []\n\n const { secrets: secretDefinitions } = integrationDef\n if (!secretDefinitions) {\n return {}\n }\n\n const secretArgv = this._parseArgvSecrets(argv.secrets)\n const invalidSecret = Object.keys(secretArgv).find((s) => !secretDefinitions[s])\n if (invalidSecret) {\n throw new errors.BotpressCLIError(`Secret ${invalidSecret} is not defined in integration definition`)\n }\n\n const values: Record<string, string | null> = {}\n for (const [secretName, { optional }] of Object.entries(secretDefinitions)) {\n const argvSecret = secretArgv[secretName]\n if (argvSecret) {\n this.logger.debug(`Using secret \"${secretName}\" from argv`)\n values[secretName] = argvSecret\n continue\n }\n\n const alreadyKnown = knownSecrets.includes(secretName)\n let mode: string\n if (alreadyKnown) {\n mode = 'already set'\n } else if (optional) {\n mode = 'optional'\n } else {\n mode = 'required'\n }\n\n const prompted = await this.prompt.text(`Enter value for secret \"${secretName}\" (${mode})`)\n if (prompted) {\n values[secretName] = prompted\n continue\n }\n\n if (alreadyKnown) {\n this.logger.log(`Secret \"${secretName}\" is unchanged`)\n } else if (optional) {\n this.logger.warn(`Secret \"${secretName}\" is unassigned`)\n } else {\n throw new errors.BotpressCLIError(`Secret \"${secretName}\" is required`)\n }\n }\n\n for (const secretName of knownSecrets) {\n const isDefined = secretName in secretDefinitions\n if (isDefined) {\n continue\n }\n const prompted = await this.prompt.confirm(`Secret \"${secretName}\" was removed. Do you wish to delete it?`)\n if (prompted) {\n this.logger.log(`Deleting secret \"${secretName}\"`, { prefix: { symbol: '\u00D7', fg: 'red' } })\n values[secretName] = null\n }\n }\n\n if (!formatEnv) {\n return values\n }\n\n const envVariables = _.mapKeys(values, (_v, k) => codegen.secretEnvVariableName(k))\n return envVariables\n }\n\n protected async readIntegrationConfigDefinition<C extends client.ClientInputs['createIntegration']['configuration']>(\n config: C\n ): Promise<C> {\n if (!config?.identifier) {\n return config\n }\n return {\n ...config,\n identifier: {\n ...config.identifier,\n linkTemplateScript: await this.readProjectFile(config.identifier.linkTemplateScript),\n },\n }\n }\n\n protected readProjectFile = async (filePath: string | undefined): Promise<string | undefined> => {\n if (!filePath) {\n return undefined\n }\n const absoluteFilePath = utils.path.absoluteFrom(this.projectPaths.abs.workDir, filePath)\n return fs.promises.readFile(absoluteFilePath, 'utf-8').catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not read file \"${absoluteFilePath}\"`)\n })\n }\n\n private _parseArgvSecrets(argvSecrets: string[]): Record<string, string> {\n const parsed: Record<string, string> = {}\n for (const secret of argvSecrets) {\n const [key, value] = utils.string.splitOnce(secret, '=')\n if (!value) {\n throw new errors.BotpressCLIError(\n `Secret \"${key}\" is missing a value. Expected format: \"SECRET_NAME=secretValue\"`\n )\n }\n parsed[key!] = value\n }\n\n return parsed\n }\n\n private _notifyUpdateSdk = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if sdk is up to date')\n\n const { workDir } = this.projectPaths.abs\n const projectPkgJson = await utils.pkgJson.readPackageJson(workDir)\n if (!projectPkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const sdkPackageName = '@botpress/sdk'\n const actualSdkVersion = utils.pkgJson.findDependency(projectPkgJson, sdkPackageName)\n if (!actualSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in project package.json`)\n return\n }\n\n if (actualSdkVersion.startsWith('workspace:')) {\n return\n }\n\n const actualCleanedSdkVersion = semver.valid(semver.coerce(actualSdkVersion))\n if (!actualCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${actualSdkVersion}\" in project package.json`)\n return\n }\n\n const cliPkgJson = await this.readPkgJson()\n const expectedSdkVersion = utils.pkgJson.findDependency(cliPkgJson, sdkPackageName)\n if (!expectedSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in cli package.json`)\n return\n }\n\n const expectedCleanedSdkVersion = semver.valid(semver.coerce(expectedSdkVersion))\n if (!expectedCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${expectedSdkVersion}\" in cli package.json`)\n return\n }\n\n if (semver.eq(actualCleanedSdkVersion, expectedCleanedSdkVersion)) {\n return\n }\n\n const diff = semver.diff(actualCleanedSdkVersion, expectedCleanedSdkVersion)\n if (!diff) {\n this.logger.debug(`Could not compare versions \"${actualCleanedSdkVersion}\" and \"${expectedCleanedSdkVersion}\"`)\n return\n }\n\n const errorMsg = `Project SDK version is \"${actualCleanedSdkVersion}\", but expected \"${expectedCleanedSdkVersion}\"`\n if (utils.semver.releases.lt(diff, 'minor')) {\n this.logger.debug(`${errorMsg}. This may cause compatibility issues.`)\n return\n }\n\n this.logger.warn(chalk.bold(`${errorMsg}. This will cause compatibility issues.`))\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown)\n this.logger.debug(`Failed to check if sdk is up to date: ${err.message}`)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AAEnB,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,yBAA6C;AAC7C,iBAA8G;AAE9G,YAAuB;AACvB,4BAA8B;AAyB9B,MAAM,qBAAqB,MAAM,KAAK,UAAiC;AAAA,EAC9D,YAAY,MAA6C;AAC9D,UAAM,aAAa,MAAM,KAAK,aAAa,MAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AACzE,UAAM;AAAA,MACJ,SAAS;AAAA,MACT,GAAG,cAAAA,QAAE,UAAU,OAAO,aAAa,CAAC,MAAM,MAAM,KAAK,aAAa,YAAY,CAAC,CAAC;AAAA,IAClF,CAAC;AAAA,EACH;AACF;AAEO,MAAe,uBAA2D,oCAAiB;AAAA,EAChG,MAAyB,YAAY;AACnC,UAAM,MAAM,UAAU;AACtB,UAAM,KAAK,iBAAiB;AAAA,EAC9B;AAAA,EAE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AM,cAAAA,QAAO,OAAO,kBAAkB,CAAC;AAChF,UAAI,CAAC,2BAA2B;AAC9B,aAAK,OAAO,MAAM,wBAAwB,yCAAyC;AACnF;AAAA,MACF;AAEA,UAAI,cAAAA,QAAO,GAAG,yBAAyB,yBAAyB,GAAG;AACjE;AAAA,MACF;AAEA,YAAM,OAAO,cAAAA,QAAO,KAAK,yBAAyB,yBAAyB;AAC3E,UAAI,CAAC,MAAM;AACT,aAAK,OAAO,MAAM,+BAA+B,iCAAiC,4BAA4B;AAC9G;AAAA,MACF;AAEA,YAAM,WAAW,2BAA2B,2CAA2C;AACvF,UAAI,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,GAAG;AAC3C,aAAK,OAAO,MAAM,GAAG,gDAAgD;AACrE;AAAA,MACF;AAEA,WAAK,OAAO,KAAK,aAAAD,QAAM,KAAK,GAAG,iDAAiD,CAAC;AAAA,IACnF,SAAS,QAAP;AACA,YAAM,MAAM,OAAO,iBAAiB,IAAI,MAAM;AAC9C,WAAK,OAAO,MAAM,yCAAyC,IAAI,SAAS;AAAA,IAC1E;AAAA,EACF;AACF;",
6
6
  "names": ["_", "bluebird", "fs", "chalk", "semver"]
7
7
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/config.js CHANGED
File without changes
File without changes
package/dist/consts.js CHANGED
File without changes
File without changes
package/dist/errors.js CHANGED
File without changes
File without changes
package/dist/index.js CHANGED
File without changes
package/dist/index.js.map CHANGED
File without changes
package/dist/init.js CHANGED
File without changes
package/dist/init.js.map CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/root.js CHANGED
File without changes
package/dist/root.js.map CHANGED
File without changes
package/dist/sdk/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/typings.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,15 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
18
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
30
  var esbuild_utils_exports = {};
20
31
  __export(esbuild_utils_exports, {
@@ -22,66 +33,38 @@ __export(esbuild_utils_exports, {
22
33
  buildEntrypoint: () => buildEntrypoint
23
34
  });
24
35
  module.exports = __toCommonJS(esbuild_utils_exports);
25
- var import_esbuild = require("esbuild");
26
- const keepNames = true;
27
- function buildCode({
28
- cwd,
29
- minify = true,
30
- bundle = true,
31
- sourcemap = false,
32
- logLevel = "silent",
33
- outfile,
34
- code,
35
- write,
36
- platform = "node"
37
- }) {
38
- return (0, import_esbuild.build)({
36
+ var esb = __toESM(require("esbuild"));
37
+ __reExport(esbuild_utils_exports, require("esbuild"), module.exports);
38
+ const DEFAULT_OPTIONS = {
39
+ bundle: true,
40
+ sourcemap: false,
41
+ logLevel: "silent",
42
+ platform: "node",
43
+ target: "es2020",
44
+ legalComments: "none",
45
+ logOverride: { "equals-negative-zero": "silent" },
46
+ keepNames: true
47
+ // important : https://github.com/node-fetch/node-fetch/issues/784#issuecomment-1014768204
48
+ };
49
+ function buildCode(p) {
50
+ const { code, ...props } = p;
51
+ return esb.build({
52
+ ...DEFAULT_OPTIONS,
53
+ ...props,
39
54
  stdin: {
40
55
  contents: code,
41
- resolveDir: cwd,
56
+ resolveDir: props.absWorkingDir,
42
57
  loader: "ts"
43
- },
44
- logOverride: {
45
- "equals-negative-zero": "silent"
46
- },
47
- platform,
48
- target: "es2020",
49
- sourcemap,
50
- minify,
51
- bundle,
52
- outfile,
53
- absWorkingDir: cwd,
54
- logLevel,
55
- keepNames,
56
- write,
57
- legalComments: "none"
58
+ }
58
59
  });
59
60
  }
60
- function buildEntrypoint({
61
- cwd,
62
- minify = true,
63
- bundle = true,
64
- sourcemap = false,
65
- logLevel = "silent",
66
- outfile,
67
- entrypoint,
68
- write
69
- }) {
70
- return (0, import_esbuild.build)({
71
- entryPoints: [entrypoint],
72
- logOverride: {
73
- "equals-negative-zero": "silent"
74
- },
75
- platform: "node",
76
- target: "es2020",
77
- sourcemap,
78
- minify,
79
- bundle,
80
- outfile,
81
- absWorkingDir: cwd,
82
- logLevel,
83
- keepNames,
84
- write
61
+ function buildEntrypoint(p) {
62
+ const { entrypoint, ...props } = p;
63
+ return esb.build({
64
+ ...DEFAULT_OPTIONS,
65
+ ...props,
66
+ outfile: void 0,
67
+ entryPoints: [entrypoint]
85
68
  });
86
69
  }
87
70
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/esbuild-utils.ts"],
4
- "sourcesContent": ["import { build as esbuild, LogLevel, Platform, BuildResult, OutputFile } from 'esbuild'\n\ntype BaseProps<W extends boolean = true> = {\n cwd: string\n outfile: string\n minify?: boolean\n sourcemap?: boolean\n bundle?: boolean\n logLevel?: LogLevel\n write: W\n platform?: Platform\n}\n\nexport type BuildCodeProps<W extends boolean = true> = BaseProps<W> & {\n code: string\n}\n\nexport type BuildEntrypointProps<W extends boolean = true> = BaseProps<W> & {\n entrypoint: string\n}\n\nconst keepNames = true // important : https://github.com/node-fetch/node-fetch/issues/784#issuecomment-1014768204\n\nexport function buildCode(p: BuildCodeProps<true>): Promise<BuildResult>\nexport function buildCode(p: BuildCodeProps<false>): Promise<BuildResult & { outputFiles: OutputFile[] }>\nexport function buildCode<W extends boolean>({\n cwd,\n minify = true,\n bundle = true,\n sourcemap = false,\n logLevel = 'silent',\n outfile,\n code,\n write,\n platform = 'node',\n}: BuildCodeProps<W>) {\n return esbuild({\n stdin: {\n contents: code,\n resolveDir: cwd,\n loader: 'ts',\n },\n logOverride: {\n 'equals-negative-zero': 'silent',\n },\n platform,\n target: 'es2020',\n sourcemap,\n minify,\n bundle,\n outfile,\n absWorkingDir: cwd,\n logLevel,\n keepNames,\n write,\n legalComments: 'none',\n })\n}\n\nexport function buildEntrypoint(p: BuildEntrypointProps<true>): Promise<BuildResult>\nexport function buildEntrypoint(p: BuildEntrypointProps<false>): Promise<BuildResult & { outputFiles: OutputFile[] }>\nexport function buildEntrypoint<W extends boolean>({\n cwd,\n minify = true,\n bundle = true,\n sourcemap = false,\n logLevel = 'silent',\n outfile,\n entrypoint,\n write,\n}: BuildEntrypointProps<W>) {\n return esbuild({\n entryPoints: [entrypoint],\n logOverride: {\n 'equals-negative-zero': 'silent',\n },\n platform: 'node',\n target: 'es2020',\n sourcemap,\n minify,\n bundle,\n outfile,\n absWorkingDir: cwd,\n logLevel,\n keepNames,\n write,\n })\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAA8E;AAqB9E,MAAM,YAAY;AAIX,SAAS,UAA6B;AAAA,EAC3C;AAAA,EACA,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AACb,GAAsB;AACpB,aAAO,eAAAA,OAAQ;AAAA,IACb,OAAO;AAAA,MACL,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX,wBAAwB;AAAA,IAC1B;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,EACjB,CAAC;AACH;AAIO,SAAS,gBAAmC;AAAA,EACjD;AAAA,EACA,SAAS;AAAA,EACT,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AACF,GAA4B;AAC1B,aAAO,eAAAA,OAAQ;AAAA,IACb,aAAa,CAAC,UAAU;AAAA,IACxB,aAAa;AAAA,MACX,wBAAwB;AAAA,IAC1B;AAAA,IACA,UAAU;AAAA,IACV,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
6
- "names": ["esbuild"]
4
+ "sourcesContent": ["import * as esb from 'esbuild'\n\nexport * from 'esbuild'\n\ntype BaseProps = esb.BuildOptions & {\n absWorkingDir: string\n}\n\nexport type BuildCodeProps = BaseProps & {\n code: string\n write: true\n outfile: string\n}\n\nexport type BuildEntrypointProps = BaseProps & {\n entrypoint: string\n write: false\n}\n\nconst DEFAULT_OPTIONS: esb.BuildOptions = {\n bundle: true,\n sourcemap: false,\n logLevel: 'silent',\n platform: 'node',\n target: 'es2020',\n legalComments: 'none',\n logOverride: { 'equals-negative-zero': 'silent' },\n keepNames: true, // important : https://github.com/node-fetch/node-fetch/issues/784#issuecomment-1014768204\n}\n\n/**\n * Bundles a string of typescript code and writes the output to a file\n */\nexport function buildCode(p: BuildCodeProps): Promise<esb.BuildResult> {\n const { code, ...props } = p\n return esb.build({\n ...DEFAULT_OPTIONS,\n ...props,\n stdin: {\n contents: code,\n resolveDir: props.absWorkingDir,\n loader: 'ts',\n },\n })\n}\n\n/**\n * Bundles a typescript file and returns the output as a string\n */\nexport function buildEntrypoint(p: BuildEntrypointProps): Promise<esb.BuildResult & { outputFiles: esb.OutputFile[] }> {\n const { entrypoint, ...props } = p\n return esb.build({\n ...DEFAULT_OPTIONS,\n ...props,\n outfile: undefined,\n entryPoints: [entrypoint],\n })\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAAqB;AAErB,kCAAc,oBAFd;AAmBA,MAAM,kBAAoC;AAAA,EACxC,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,aAAa,EAAE,wBAAwB,SAAS;AAAA,EAChD,WAAW;AAAA;AACb;AAKO,SAAS,UAAU,GAA6C;AACrE,QAAM,EAAE,MAAM,GAAG,MAAM,IAAI;AAC3B,SAAO,IAAI,MAAM;AAAA,IACf,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO;AAAA,MACL,UAAU;AAAA,MACV,YAAY,MAAM;AAAA,MAClB,QAAQ;AAAA,IACV;AAAA,EACF,CAAC;AACH;AAKO,SAAS,gBAAgB,GAAuF;AACrH,QAAM,EAAE,YAAY,GAAG,MAAM,IAAI;AACjC,SAAO,IAAI,MAAM;AAAA,IACf,GAAG;AAAA,IACH,GAAG;AAAA,IACH,SAAS;AAAA,IACT,aAAa,CAAC,UAAU;AAAA,EAC1B,CAAC;AACH;",
6
+ "names": []
7
7
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes