@botpress/cli 0.11.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/dist/api/bot-body.js.map +2 -2
  3. package/dist/api/client.js +14 -28
  4. package/dist/api/client.js.map +3 -3
  5. package/dist/api/find-previous-version.js.map +1 -1
  6. package/dist/api/index.js +23 -0
  7. package/dist/api/index.js.map +7 -0
  8. package/dist/api/interface-body.js +25 -10
  9. package/dist/api/interface-body.js.map +2 -2
  10. package/dist/code-generation/bot-implementation/bot-implementation.js +92 -0
  11. package/dist/code-generation/bot-implementation/bot-implementation.js.map +7 -0
  12. package/dist/code-generation/{integration-schemas → bot-implementation/bot-typings}/events-module.js +15 -22
  13. package/dist/code-generation/bot-implementation/bot-typings/events-module.js.map +7 -0
  14. package/dist/code-generation/bot-implementation/bot-typings/index.js +96 -0
  15. package/dist/code-generation/bot-implementation/bot-typings/index.js.map +7 -0
  16. package/dist/code-generation/{integration-schemas → bot-implementation/bot-typings}/states-module.js +17 -22
  17. package/dist/code-generation/bot-implementation/bot-typings/states-module.js.map +7 -0
  18. package/dist/code-generation/bot-implementation/index.js +56 -0
  19. package/dist/code-generation/bot-implementation/index.js.map +7 -0
  20. package/dist/code-generation/{const.js → consts.js} +9 -4
  21. package/dist/code-generation/consts.js.map +7 -0
  22. package/dist/code-generation/generators.js +37 -7
  23. package/dist/code-generation/generators.js.map +2 -2
  24. package/dist/code-generation/index.js +15 -105
  25. package/dist/code-generation/index.js.map +3 -3
  26. package/dist/code-generation/integration-implementation/index.js +66 -0
  27. package/dist/code-generation/integration-implementation/index.js.map +7 -0
  28. package/dist/code-generation/integration-implementation/integration-implementation.js +110 -0
  29. package/dist/code-generation/integration-implementation/integration-implementation.js.map +7 -0
  30. package/dist/code-generation/{integration-secret.js → integration-implementation/integration-secret.js} +17 -7
  31. package/dist/code-generation/integration-implementation/integration-secret.js.map +7 -0
  32. package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/actions-module.js +28 -40
  33. package/dist/code-generation/integration-implementation/integration-typings/actions-module.js.map +7 -0
  34. package/dist/code-generation/integration-implementation/integration-typings/channels-module.js +103 -0
  35. package/dist/code-generation/integration-implementation/integration-typings/channels-module.js.map +7 -0
  36. package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/configuration-module.js +18 -20
  37. package/dist/code-generation/integration-implementation/integration-typings/configuration-module.js.map +7 -0
  38. package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/configurations-module.js +21 -27
  39. package/dist/code-generation/integration-implementation/integration-typings/configurations-module.js.map +7 -0
  40. package/dist/code-generation/{integration-schemas → integration-implementation/integration-typings}/entities-module.js +15 -22
  41. package/dist/code-generation/integration-implementation/integration-typings/entities-module.js.map +7 -0
  42. package/dist/code-generation/integration-implementation/integration-typings/events-module.js +59 -0
  43. package/dist/code-generation/integration-implementation/integration-typings/events-module.js.map +7 -0
  44. package/dist/code-generation/integration-implementation/integration-typings/index.js +128 -0
  45. package/dist/code-generation/integration-implementation/integration-typings/index.js.map +7 -0
  46. package/dist/code-generation/integration-implementation/integration-typings/states-module.js +60 -0
  47. package/dist/code-generation/integration-implementation/integration-typings/states-module.js.map +7 -0
  48. package/dist/code-generation/integration-package/index.js +81 -0
  49. package/dist/code-generation/integration-package/index.js.map +7 -0
  50. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js +84 -0
  51. package/dist/code-generation/integration-package/integration-package-definition/actions-module.js.map +7 -0
  52. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js +103 -0
  53. package/dist/code-generation/integration-package/integration-package-definition/channels-module.js.map +7 -0
  54. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js +58 -0
  55. package/dist/code-generation/integration-package/integration-package-definition/configuration-module.js.map +7 -0
  56. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js +66 -0
  57. package/dist/code-generation/integration-package/integration-package-definition/configurations-module.js.map +7 -0
  58. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js +59 -0
  59. package/dist/code-generation/integration-package/integration-package-definition/entities-module.js.map +7 -0
  60. package/dist/code-generation/integration-package/integration-package-definition/events-module.js +62 -0
  61. package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +7 -0
  62. package/dist/code-generation/integration-package/integration-package-definition/index.js +136 -0
  63. package/dist/code-generation/integration-package/integration-package-definition/index.js.map +7 -0
  64. package/dist/code-generation/integration-package/integration-package-definition/states-module.js +62 -0
  65. package/dist/code-generation/integration-package/integration-package-definition/states-module.js.map +7 -0
  66. package/dist/code-generation/integration-package/integration-package-definition/typings.js +17 -0
  67. package/dist/code-generation/integration-package/integration-package-definition/typings.js.map +7 -0
  68. package/dist/code-generation/interface-package/index.js +81 -0
  69. package/dist/code-generation/interface-package/index.js.map +7 -0
  70. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js +84 -0
  71. package/dist/code-generation/interface-package/interface-package-definition/actions-module.js.map +7 -0
  72. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js +94 -0
  73. package/dist/code-generation/interface-package/interface-package-definition/channels-module.js.map +7 -0
  74. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js +59 -0
  75. package/dist/code-generation/interface-package/interface-package-definition/entities-module.js.map +7 -0
  76. package/dist/code-generation/interface-package/interface-package-definition/events-module.js +62 -0
  77. package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +7 -0
  78. package/dist/code-generation/interface-package/interface-package-definition/index.js +100 -0
  79. package/dist/code-generation/interface-package/interface-package-definition/index.js.map +7 -0
  80. package/dist/code-generation/interface-package/interface-package-definition/typings.js +17 -0
  81. package/dist/code-generation/interface-package/interface-package-definition/typings.js.map +7 -0
  82. package/dist/code-generation/module.js +60 -16
  83. package/dist/code-generation/module.js.map +2 -2
  84. package/dist/code-generation/strings.js +5 -2
  85. package/dist/code-generation/strings.js.map +2 -2
  86. package/dist/code-generation/typings.js.map +1 -1
  87. package/dist/command-implementations/add-command.js +102 -91
  88. package/dist/command-implementations/add-command.js.map +3 -3
  89. package/dist/command-implementations/bundle-command.js +16 -9
  90. package/dist/command-implementations/bundle-command.js.map +2 -2
  91. package/dist/command-implementations/deploy-command.js +27 -19
  92. package/dist/command-implementations/deploy-command.js.map +2 -2
  93. package/dist/command-implementations/dev-command.js +15 -12
  94. package/dist/command-implementations/dev-command.js.map +2 -2
  95. package/dist/command-implementations/gen-command.js +31 -12
  96. package/dist/command-implementations/gen-command.js.map +3 -3
  97. package/dist/command-implementations/init-command.js +2 -2
  98. package/dist/command-implementations/init-command.js.map +2 -2
  99. package/dist/command-implementations/integration-commands.js +5 -5
  100. package/dist/command-implementations/integration-commands.js.map +2 -2
  101. package/dist/command-implementations/interface-commands.js +5 -5
  102. package/dist/command-implementations/interface-commands.js.map +2 -2
  103. package/dist/command-implementations/lint-command.js +3 -1
  104. package/dist/command-implementations/lint-command.js.map +3 -3
  105. package/dist/command-implementations/project-command.js +40 -23
  106. package/dist/command-implementations/project-command.js.map +3 -3
  107. package/dist/command-implementations/read-command.js +0 -5
  108. package/dist/command-implementations/read-command.js.map +2 -2
  109. package/dist/config.js +22 -7
  110. package/dist/config.js.map +2 -2
  111. package/dist/consts.js +15 -6
  112. package/dist/consts.js.map +2 -2
  113. package/dist/errors.js +19 -11
  114. package/dist/errors.js.map +2 -2
  115. package/dist/logger/index.js +4 -2
  116. package/dist/logger/index.js.map +2 -2
  117. package/dist/{integration-ref.js → package-ref.js} +11 -11
  118. package/dist/package-ref.js.map +7 -0
  119. package/dist/{integration-ref.test.js → package-ref.test.js} +18 -18
  120. package/dist/package-ref.test.js.map +7 -0
  121. package/dist/sdk/index.js +21 -0
  122. package/dist/sdk/index.js.map +7 -0
  123. package/dist/sdk/resolve-bot-interfaces.js +38 -0
  124. package/dist/sdk/resolve-bot-interfaces.js.map +7 -0
  125. package/dist/sdk/resolve-integration-interfaces.js +148 -0
  126. package/dist/sdk/resolve-integration-interfaces.js.map +7 -0
  127. package/dist/utils/index.js +3 -0
  128. package/dist/utils/index.js.map +2 -2
  129. package/dist/utils/path-utils.js +25 -8
  130. package/dist/utils/path-utils.js.map +3 -3
  131. package/dist/utils/path-utils.test.js +69 -0
  132. package/dist/utils/path-utils.test.js.map +7 -0
  133. package/dist/utils/record-utils.js +25 -0
  134. package/dist/utils/record-utils.js.map +3 -3
  135. package/dist/utils/schema-utils.js +11 -0
  136. package/dist/utils/schema-utils.js.map +2 -2
  137. package/dist/utils/schema-utils.test.js +51 -0
  138. package/dist/utils/schema-utils.test.js.map +7 -0
  139. package/dist/utils/template-utils.js +47 -0
  140. package/dist/utils/template-utils.js.map +7 -0
  141. package/dist/utils/type-utils.js.map +1 -1
  142. package/e2e/index.ts +2 -0
  143. package/e2e/tests/install-package.ts +163 -0
  144. package/e2e/utils.ts +25 -2
  145. package/package.json +5 -4
  146. package/templates/empty-bot/.botpress/implementation/index.ts +41 -0
  147. package/templates/empty-bot/.botpress/implementation/typings/index.ts +17 -0
  148. package/templates/empty-bot/.botpress/implementation/typings/integrations/index.ts +6 -0
  149. package/templates/empty-bot/.botpress/index.ts +1 -0
  150. package/templates/empty-bot/bot.definition.ts +2 -0
  151. package/templates/{echo-bot → empty-bot}/package.json +2 -2
  152. package/templates/empty-bot/src/index.ts +5 -0
  153. package/templates/empty-integration/.botpress/implementation/index.ts +7 -35
  154. package/templates/empty-integration/.botpress/implementation/typings/configuration/index.ts +2 -0
  155. package/templates/empty-integration/.botpress/implementation/typings/index.ts +31 -0
  156. package/templates/empty-integration/package.json +1 -1
  157. package/templates/hello-world/.botpress/implementation/index.ts +7 -35
  158. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/input.ts +5 -0
  159. package/templates/hello-world/.botpress/implementation/typings/actions/helloWorld/output.ts +5 -0
  160. package/templates/hello-world/.botpress/implementation/typings/configuration/index.ts +2 -0
  161. package/templates/hello-world/.botpress/implementation/typings/index.ts +31 -0
  162. package/templates/hello-world/package.json +1 -1
  163. package/templates/webhook-message/.botpress/implementation/index.ts +7 -35
  164. package/templates/webhook-message/.botpress/implementation/typings/channels/webhook/messages/text.ts +5 -0
  165. package/templates/webhook-message/.botpress/implementation/typings/configuration/index.ts +8 -0
  166. package/templates/webhook-message/.botpress/implementation/typings/events/index.ts +6 -0
  167. package/templates/webhook-message/.botpress/implementation/typings/index.ts +31 -0
  168. package/templates/webhook-message/.botpress/implementation/typings/states/index.ts +6 -0
  169. package/templates/webhook-message/package.json +1 -1
  170. package/dist/code-generation/const.js.map +0 -7
  171. package/dist/code-generation/integration-implementation.js +0 -192
  172. package/dist/code-generation/integration-implementation.js.map +0 -7
  173. package/dist/code-generation/integration-instance.js +0 -185
  174. package/dist/code-generation/integration-instance.js.map +0 -7
  175. package/dist/code-generation/integration-schemas/actions-module.js.map +0 -7
  176. package/dist/code-generation/integration-schemas/channels-module.js +0 -117
  177. package/dist/code-generation/integration-schemas/channels-module.js.map +0 -7
  178. package/dist/code-generation/integration-schemas/configuration-module.js.map +0 -7
  179. package/dist/code-generation/integration-schemas/configurations-module.js.map +0 -7
  180. package/dist/code-generation/integration-schemas/entities-module.js.map +0 -7
  181. package/dist/code-generation/integration-schemas/events-module.js.map +0 -7
  182. package/dist/code-generation/integration-schemas/states-module.js.map +0 -7
  183. package/dist/code-generation/integration-secret.js.map +0 -7
  184. package/dist/code-generation/map-integration.js +0 -76
  185. package/dist/code-generation/map-integration.js.map +0 -7
  186. package/dist/integration-ref.js.map +0 -7
  187. package/dist/integration-ref.test.js.map +0 -7
  188. package/templates/echo-bot/src/index.ts +0 -30
  189. package/templates/empty-integration/.botpress/implementation/configuration/index.ts +0 -10
  190. package/templates/hello-world/.botpress/implementation/actions/helloWorld/input.ts +0 -10
  191. package/templates/hello-world/.botpress/implementation/actions/helloWorld/output.ts +0 -10
  192. package/templates/hello-world/.botpress/implementation/configuration/index.ts +0 -10
  193. package/templates/webhook-message/.botpress/implementation/channels/webhook/messages/text.ts +0 -10
  194. package/templates/webhook-message/.botpress/implementation/configuration/index.ts +0 -13
  195. /package/templates/{empty-integration/.botpress/implementation → empty-bot/.botpress/implementation/typings}/events/index.ts +0 -0
  196. /package/templates/{empty-integration/.botpress/implementation → empty-bot/.botpress/implementation/typings}/states/index.ts +0 -0
  197. /package/templates/{echo-bot → empty-bot}/tsconfig.json +0 -0
  198. /package/templates/empty-integration/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
  199. /package/templates/empty-integration/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
  200. /package/templates/empty-integration/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
  201. /package/templates/empty-integration/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
  202. /package/templates/{hello-world/.botpress/implementation → empty-integration/.botpress/implementation/typings}/events/index.ts +0 -0
  203. /package/templates/{hello-world/.botpress/implementation → empty-integration/.botpress/implementation/typings}/states/index.ts +0 -0
  204. /package/templates/hello-world/.botpress/implementation/{actions → typings/actions}/helloWorld/index.ts +0 -0
  205. /package/templates/hello-world/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
  206. /package/templates/hello-world/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
  207. /package/templates/hello-world/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
  208. /package/templates/hello-world/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
  209. /package/templates/{webhook-message/.botpress/implementation → hello-world/.botpress/implementation/typings}/events/index.ts +0 -0
  210. /package/templates/{webhook-message/.botpress/implementation → hello-world/.botpress/implementation/typings}/states/index.ts +0 -0
  211. /package/templates/webhook-message/.botpress/implementation/{actions → typings/actions}/index.ts +0 -0
  212. /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/index.ts +0 -0
  213. /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/webhook/index.ts +0 -0
  214. /package/templates/webhook-message/.botpress/implementation/{channels → typings/channels}/webhook/messages/index.ts +0 -0
  215. /package/templates/webhook-message/.botpress/implementation/{configurations → typings/configurations}/index.ts +0 -0
  216. /package/templates/webhook-message/.botpress/implementation/{entities → typings/entities}/index.ts +0 -0
@@ -1,20 +1,20 @@
1
1
 
2
- > @botpress/cli@0.11.6 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@1.0.0 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@0.11.6 bundle /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@1.0.0 bundle /home/runner/work/botpress/botpress/packages/cli
7
7
  > ts-node -T build.ts
8
8
 
9
9
 
10
- > @botpress/cli@0.11.6 template:gen /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@1.0.0 template:gen /home/runner/work/botpress/botpress/packages/cli
11
11
  > pnpm -r --stream -F @bp-templates/* exec bp gen
12
12
 
13
- 🤖 Botpress CLI v0.11.6
14
- 🤖 Botpress CLI v0.11.6
15
- 🤖 Botpress CLI v0.11.6
16
- 🤖 Botpress CLI v0.11.6
17
- No typings to generate for bot projects
18
- ○ Generating typings for integration webhook-message...○ Generating typings for integration empty-integration...○ Generating typings for integration hello-world...✓ Typings available at .botpress
13
+ 🤖 Botpress CLI v1.0.0
14
+ 🤖 Botpress CLI v1.0.0
15
+ 🤖 Botpress CLI v1.0.0
16
+ 🤖 Botpress CLI v1.0.0
17
+ ○ Generating typings for integration hello-world...○ Generating typings for integration empty-integration...✓ Typings available at .botpress
18
+ ○ Generating typings for bot...○ Generating typings for integration webhook-message...✓ Typings available at .botpress
19
19
  ✓ Typings available at .botpress
20
20
  ✓ Typings available at .botpress
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/bot-body.ts"],
4
- "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\n\nexport type CreateBotBody = Parameters<client.Client['createBot']>[0]\nexport type UpdateBotBody = Parameters<client.Client['updateBot']>[0]\n\nexport const prepareCreateBotBody = async (bot: sdk.Bot): Promise<CreateBotBody> => ({\n ...bot.props,\n configuration: bot.props.configuration\n ? {\n ...bot.props.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.props.configuration),\n }\n : undefined,\n events: bot.props.events\n ? await utils.records.mapValuesAsync(bot.props.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n states: bot.props.states\n ? await utils.records.mapValuesAsync(bot.props.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n})\n\nexport const prepareUpdateBotBody = (localBot: UpdateBotBody, remoteBot: client.Bot): UpdateBotBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n user: {\n ...localBot.user,\n tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags),\n },\n conversation: {\n ...localBot.conversation,\n tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags),\n },\n message: {\n ...localBot.message,\n tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags),\n },\n integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAKhB,MAAM,uBAAuB,OAAO,SAA0C;AAAA,EACnF,GAAG,IAAI;AAAA,EACP,eAAe,IAAI,MAAM,gBACrB;AAAA,IACE,GAAG,IAAI,MAAM;AAAA,IACb,QAAQ,MAAM,MAAM,OAAO,mBAAmB,IAAI,MAAM,aAAa;AAAA,EACvE,IACA;AAAA,EACJ,QAAQ,IAAI,MAAM,SACd,MAAM,MAAM,QAAQ,eAAe,IAAI,MAAM,QAAQ,OAAO,WAAW;AAAA,IACrE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AAAA,EACJ,QAAQ,IAAI,MAAM,SACd,MAAM,MAAM,QAAQ,eAAe,IAAI,MAAM,QAAQ,OAAO,WAAW;AAAA,IACrE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AACN;AAEO,MAAM,uBAAuB,CAAC,UAAyB,eAA0C;AAAA,EACtG,GAAG;AAAA,EACH,QAAQ,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,EAC9E,iBAAiB,MAAM,QAAQ,uBAAuB,SAAS,iBAAiB,UAAU,eAAe;AAAA,EACzG,QAAQ,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,EAC9E,MAAM;AAAA,IACJ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,MAAM,MAAM,UAAU,MAAM,IAAI;AAAA,EACtF;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,cAAc,MAAM,UAAU,cAAc,IAAI;AAAA,EACtG;AAAA,EACA,SAAS;AAAA,IACP,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,SAAS,MAAM,UAAU,SAAS,IAAI;AAAA,EAC5F;AAAA,EACA,cAAc,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAClG;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\n\nexport type CreateBotBody = Parameters<client.Client['createBot']>[0]\nexport type UpdateBotBody = Parameters<client.Client['updateBot']>[0]\n\nexport const prepareCreateBotBody = async (bot: sdk.BotDefinition): Promise<CreateBotBody> => ({\n ...bot.props,\n configuration: bot.props.configuration\n ? {\n ...bot.props.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.props.configuration),\n }\n : undefined,\n events: bot.props.events\n ? await utils.records.mapValuesAsync(bot.props.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n states: bot.props.states\n ? await utils.records.mapValuesAsync(bot.props.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n})\n\nexport const prepareUpdateBotBody = (localBot: UpdateBotBody, remoteBot: client.Bot): UpdateBotBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n user: {\n ...localBot.user,\n tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags),\n },\n conversation: {\n ...localBot.conversation,\n tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags),\n },\n message: {\n ...localBot.message,\n tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags),\n },\n integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAKhB,MAAM,uBAAuB,OAAO,SAAoD;AAAA,EAC7F,GAAG,IAAI;AAAA,EACP,eAAe,IAAI,MAAM,gBACrB;AAAA,IACE,GAAG,IAAI,MAAM;AAAA,IACb,QAAQ,MAAM,MAAM,OAAO,mBAAmB,IAAI,MAAM,aAAa;AAAA,EACvE,IACA;AAAA,EACJ,QAAQ,IAAI,MAAM,SACd,MAAM,MAAM,QAAQ,eAAe,IAAI,MAAM,QAAQ,OAAO,WAAW;AAAA,IACrE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AAAA,EACJ,QAAQ,IAAI,MAAM,SACd,MAAM,MAAM,QAAQ,eAAe,IAAI,MAAM,QAAQ,OAAO,WAAW;AAAA,IACrE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AACN;AAEO,MAAM,uBAAuB,CAAC,UAAyB,eAA0C;AAAA,EACtG,GAAG;AAAA,EACH,QAAQ,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,EAC9E,iBAAiB,MAAM,QAAQ,uBAAuB,SAAS,iBAAiB,UAAU,eAAe;AAAA,EACzG,QAAQ,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,EAC9E,MAAM;AAAA,IACJ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,MAAM,MAAM,UAAU,MAAM,IAAI;AAAA,EACtF;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,cAAc,MAAM,UAAU,cAAc,IAAI;AAAA,EACtG;AAAA,EACA,SAAS;AAAA,IACP,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,SAAS,MAAM,UAAU,SAAS,IAAI;AAAA,EAC5F;AAAA,EACA,cAAc,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAClG;",
6
6
  "names": []
7
7
  }
@@ -29,8 +29,7 @@ __export(client_exports, {
29
29
  });
30
30
  module.exports = __toCommonJS(client_exports);
31
31
  var client = __toESM(require("@botpress/client"));
32
- var import_lodash = __toESM(require("lodash"));
33
- var import_integration_ref = require("../integration-ref");
32
+ var import_package_ref = require("../package-ref");
34
33
  var import_find_previous_version = require("./find-previous-version");
35
34
  var paging = __toESM(require("./paging"));
36
35
  __reExport(client_exports, require("./types"), module.exports);
@@ -62,7 +61,7 @@ class ApiClient {
62
61
  return this.client.updateWorkspace({ id: this.workspaceId, ...props });
63
62
  }
64
63
  async findIntegration(ref) {
65
- const formatted = (0, import_integration_ref.formatIntegrationRef)(ref);
64
+ const formatted = (0, import_package_ref.formatPackageRef)(ref);
66
65
  const privateIntegration = await this.findPrivateIntegration(ref);
67
66
  if (privateIntegration) {
68
67
  this._logger.debug(`Found integration "${formatted}" in workspace`);
@@ -78,45 +77,26 @@ class ApiClient {
78
77
  async findPrivateIntegration(ref) {
79
78
  const { workspaceId } = this;
80
79
  if (ref.type === "id") {
81
- return this.validateStatus(
82
- () => this.client.getIntegration(ref).then((r) => ({ ...r.integration, workspaceId })),
83
- 404
84
- );
80
+ return this.client.getIntegration(ref).then((r) => ({ ...r.integration, workspaceId })).catch(this._returnUndefinedOnError("ResourceNotFound"));
85
81
  }
86
- return this.validateStatus(
87
- () => this.client.getIntegrationByName(ref).then((r) => ({ ...r.integration, workspaceId })),
88
- 404
89
- );
82
+ return this.client.getIntegrationByName(ref).then((r) => ({ ...r.integration, workspaceId })).catch(this._returnUndefinedOnError("ResourceNotFound"));
90
83
  }
91
84
  async findPublicIntegration(ref) {
92
85
  if (ref.type === "id") {
93
- return this.validateStatus(() => this.client.getPublicIntegrationById(ref).then((r) => r.integration), 404);
86
+ return this.client.getPublicIntegrationById(ref).then((r) => r.integration).catch(this._returnUndefinedOnError("ResourceNotFound"));
94
87
  }
95
- return this.validateStatus(() => this.client.getPublicIntegration(ref).then((r) => r.integration), 404);
88
+ return this.client.getPublicIntegration(ref).then((r) => r.integration).catch(this._returnUndefinedOnError("ResourceNotFound"));
96
89
  }
97
90
  async findPublicInterface(ref) {
98
91
  if (ref.type === "id") {
99
- return this.validateStatus(() => this.client.getInterface(ref).then((r) => r.interface), 404);
92
+ return this.client.getInterface(ref).then((r) => r.interface).catch(this._returnUndefinedOnError("ResourceNotFound"));
100
93
  }
101
- return this.validateStatus(() => this.client.getInterfaceByName(ref).then((r) => r.interface), 404);
94
+ return this.client.getInterfaceByName(ref).then((r) => r.interface).catch(this._returnUndefinedOnError("ResourceNotFound"));
102
95
  }
103
96
  async testLogin() {
104
97
  await this.client.listBots({});
105
98
  }
106
99
  listAllPages = paging.listAllPages;
107
- async validateStatus(fn, allowedStatuses) {
108
- try {
109
- const v = await fn();
110
- return v;
111
- } catch (err) {
112
- const allowedStatusesArray = import_lodash.default.isArray(allowedStatuses) ? allowedStatuses : [allowedStatuses];
113
- const isAllowed = client.isApiError(err) && err.code && allowedStatusesArray.includes(err.code);
114
- if (isAllowed) {
115
- return;
116
- }
117
- throw err;
118
- }
119
- }
120
100
  async findPreviousIntegrationVersion(ref) {
121
101
  const previous = await (0, import_find_previous_version.findPreviousIntegrationVersion)(this.client, ref);
122
102
  if (!previous) {
@@ -128,6 +108,12 @@ class ApiClient {
128
108
  const allBots = await this.listAllPages(this.client.listBots, (r) => r.bots);
129
109
  return allBots.find((b) => b.name === name);
130
110
  }
111
+ _returnUndefinedOnError = (type) => (thrown) => {
112
+ if (client.isApiError(thrown) && thrown.type === type) {
113
+ return;
114
+ }
115
+ throw thrown;
116
+ };
131
117
  }
132
118
  // Annotate the CommonJS export names for ESM import in node:
133
119
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/client.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport _ from 'lodash'\nimport { formatIntegrationRef, ApiIntegrationRef as IntegrationRef, NameIntegrationRef } from '../integration-ref'\nimport type { Logger } from '../logger'\nimport { findPreviousIntegrationVersion } from './find-previous-version'\nimport * as paging from './paging'\nimport {\n ApiClientProps,\n PublicIntegration,\n PrivateIntegration,\n Integration,\n Requests,\n Responses,\n Interface,\n BotSummary,\n} from './types'\n\nexport * from './types'\n\n/**\n * This class is used to wrap the Botpress API and provide a more convenient way to interact with it.\n */\nexport class ApiClient {\n public readonly client: client.Client\n public readonly url: string\n public readonly token: string\n public readonly workspaceId: string\n\n public static newClient = (props: ApiClientProps, logger: Logger) => new ApiClient(props, logger)\n\n public constructor(props: ApiClientProps, private _logger: Logger) {\n const { apiUrl, token, workspaceId } = props\n this.client = new client.Client({ apiUrl, token, workspaceId })\n this.url = apiUrl\n this.token = token\n this.workspaceId = workspaceId\n }\n\n public get isBotpressWorkspace(): boolean {\n return [\n '6a76fa10-e150-4ff6-8f59-a300feec06c1',\n '95de33eb-1551-4af9-9088-e5dcb02efd09',\n '11111111-1111-1111-aaaa-111111111111',\n ].includes(this.workspaceId)\n }\n\n public async getWorkspace(): Promise<Responses['getWorkspace']> {\n return this.client.getWorkspace({ id: this.workspaceId })\n }\n\n public async updateWorkspace(props: Omit<Requests['updateWorkspace'], 'id'>): Promise<Responses['updateWorkspace']> {\n return this.client.updateWorkspace({ id: this.workspaceId, ...props })\n }\n\n public async findIntegration(ref: IntegrationRef): Promise<Integration | undefined> {\n const formatted = formatIntegrationRef(ref)\n\n const privateIntegration = await this.findPrivateIntegration(ref)\n if (privateIntegration) {\n this._logger.debug(`Found integration \"${formatted}\" in workspace`)\n return privateIntegration\n }\n\n const publicIntegration = await this.findPublicIntegration(ref)\n if (publicIntegration) {\n this._logger.debug(`Found integration \"${formatted}\" in hub`)\n return publicIntegration\n }\n\n return\n }\n\n public async findPrivateIntegration(ref: IntegrationRef): Promise<PrivateIntegration | undefined> {\n const { workspaceId } = this\n if (ref.type === 'id') {\n return this.validateStatus(\n () => this.client.getIntegration(ref).then((r) => ({ ...r.integration, workspaceId })),\n 404\n )\n }\n return this.validateStatus(\n () => this.client.getIntegrationByName(ref).then((r) => ({ ...r.integration, workspaceId })),\n 404\n )\n }\n\n public async findPublicIntegration(ref: IntegrationRef): Promise<PublicIntegration | undefined> {\n if (ref.type === 'id') {\n return this.validateStatus(() => this.client.getPublicIntegrationById(ref).then((r) => r.integration), 404)\n }\n return this.validateStatus(() => this.client.getPublicIntegration(ref).then((r) => r.integration), 404)\n }\n\n public async findPublicInterface(ref: IntegrationRef): Promise<Interface | undefined> {\n if (ref.type === 'id') {\n return this.validateStatus(() => this.client.getInterface(ref).then((r) => r.interface), 404)\n }\n return this.validateStatus(() => this.client.getInterfaceByName(ref).then((r) => r.interface), 404)\n }\n\n public async testLogin(): Promise<void> {\n await this.client.listBots({})\n }\n\n public listAllPages = paging.listAllPages\n\n public async validateStatus<V>(fn: () => Promise<V>, allowedStatuses: number | number[]): Promise<V | undefined> {\n try {\n const v = await fn()\n return v\n } catch (err) {\n const allowedStatusesArray = _.isArray(allowedStatuses) ? allowedStatuses : [allowedStatuses]\n const isAllowed = client.isApiError(err) && err.code && allowedStatusesArray.includes(err.code)\n if (isAllowed) {\n return\n }\n throw err\n }\n }\n\n public async findPreviousIntegrationVersion(ref: NameIntegrationRef): Promise<Integration | undefined> {\n const previous = await findPreviousIntegrationVersion(this.client, ref)\n if (!previous) {\n return\n }\n return this.findIntegration({ type: 'id', id: previous.id })\n }\n\n public async findBotByName(name: string): Promise<BotSummary | undefined> {\n // api does not allow filtering bots by name\n const allBots = await this.listAllPages(this.client.listBots, (r) => r.bots)\n return allBots.find((b) => b.name === name)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,oBAAc;AACd,6BAA8F;AAE9F,mCAA+C;AAC/C,aAAwB;AAYxB,2BAAc,oBAjBd;AAsBO,MAAM,UAAU;AAAA,EAQd,YAAY,OAA+B,SAAiB;AAAjB;AAChD,UAAM,EAAE,QAAQ,OAAO,YAAY,IAAI;AACvC,SAAK,SAAS,IAAI,OAAO,OAAO,EAAE,QAAQ,OAAO,YAAY,CAAC;AAC9D,SAAK,MAAM;AACX,SAAK,QAAQ;AACb,SAAK,cAAc;AAAA,EACrB;AAAA,EAbgB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,OAAc,YAAY,CAAC,OAAuB,WAAmB,IAAI,UAAU,OAAO,MAAM;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AAQ,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAAA,EAC5C;AACF;",
6
- "names": ["_"]
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport type { Logger } from '../logger'\nimport { formatPackageRef, ApiPackageRef, NamePackageRef } from '../package-ref'\nimport { findPreviousIntegrationVersion } from './find-previous-version'\nimport * as paging from './paging'\nimport {\n ApiClientProps,\n PublicIntegration,\n PrivateIntegration,\n Integration,\n Requests,\n Responses,\n Interface,\n BotSummary,\n} from './types'\n\nexport * from './types'\n\n/**\n * This class is used to wrap the Botpress API and provide a more convenient way to interact with it.\n */\nexport class ApiClient {\n public readonly client: client.Client\n public readonly url: string\n public readonly token: string\n public readonly workspaceId: string\n\n public static newClient = (props: ApiClientProps, logger: Logger) => new ApiClient(props, logger)\n\n public constructor(props: ApiClientProps, private _logger: Logger) {\n const { apiUrl, token, workspaceId } = props\n this.client = new client.Client({ apiUrl, token, workspaceId })\n this.url = apiUrl\n this.token = token\n this.workspaceId = workspaceId\n }\n\n public get isBotpressWorkspace(): boolean {\n return [\n '6a76fa10-e150-4ff6-8f59-a300feec06c1',\n '95de33eb-1551-4af9-9088-e5dcb02efd09',\n '11111111-1111-1111-aaaa-111111111111',\n ].includes(this.workspaceId)\n }\n\n public async getWorkspace(): Promise<Responses['getWorkspace']> {\n return this.client.getWorkspace({ id: this.workspaceId })\n }\n\n public async updateWorkspace(props: Omit<Requests['updateWorkspace'], 'id'>): Promise<Responses['updateWorkspace']> {\n return this.client.updateWorkspace({ id: this.workspaceId, ...props })\n }\n\n public async findIntegration(ref: ApiPackageRef): Promise<Integration | undefined> {\n const formatted = formatPackageRef(ref)\n\n const privateIntegration = await this.findPrivateIntegration(ref)\n if (privateIntegration) {\n this._logger.debug(`Found integration \"${formatted}\" in workspace`)\n return privateIntegration\n }\n\n const publicIntegration = await this.findPublicIntegration(ref)\n if (publicIntegration) {\n this._logger.debug(`Found integration \"${formatted}\" in hub`)\n return publicIntegration\n }\n\n return\n }\n\n public async findPrivateIntegration(ref: ApiPackageRef): Promise<PrivateIntegration | undefined> {\n const { workspaceId } = this\n if (ref.type === 'id') {\n return this.client\n .getIntegration(ref)\n .then((r) => ({ ...r.integration, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getIntegrationByName(ref)\n .then((r) => ({ ...r.integration, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicIntegration(ref: ApiPackageRef): Promise<PublicIntegration | undefined> {\n if (ref.type === 'id') {\n return this.client\n .getPublicIntegrationById(ref)\n .then((r) => r.integration)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getPublicIntegration(ref)\n .then((r) => r.integration)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicInterface(ref: ApiPackageRef): Promise<Interface | undefined> {\n if (ref.type === 'id') {\n return this.client\n .getInterface(ref)\n .then((r) => r.interface)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getInterfaceByName(ref)\n .then((r) => r.interface)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async testLogin(): Promise<void> {\n await this.client.listBots({})\n }\n\n public listAllPages = paging.listAllPages\n\n public async findPreviousIntegrationVersion(ref: NamePackageRef): Promise<Integration | undefined> {\n const previous = await findPreviousIntegrationVersion(this.client, ref)\n if (!previous) {\n return\n }\n return this.findIntegration({ type: 'id', id: previous.id })\n }\n\n public async findBotByName(name: string): Promise<BotSummary | undefined> {\n // api does not allow filtering bots by name\n const allBots = await this.listAllPages(this.client.listBots, (r) => r.bots)\n return allBots.find((b) => b.name === name)\n }\n\n private _returnUndefinedOnError =\n (type: client.ApiError['type']) =>\n (thrown: any): undefined => {\n if (client.isApiError(thrown) && thrown.type === type) {\n return\n }\n throw thrown\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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AA,EAEA,MAAa,cAAc,MAA+C;AAExE,UAAM,UAAU,MAAM,KAAK,aAAa,KAAK,OAAO,UAAU,CAAC,MAAM,EAAE,IAAI;AAC3E,WAAO,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AAAA,EAC5C;AAAA,EAEQ,0BACN,CAAC,SACD,CAAC,WAA2B;AAC1B,QAAI,OAAO,WAAW,MAAM,KAAK,OAAO,SAAS,MAAM;AACrD;AAAA,IACF;AACA,UAAM;AAAA,EACR;AACJ;",
6
+ "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/find-previous-version.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport semver from 'semver'\nimport { NameIntegrationRef } from '../integration-ref'\nimport * as paging from './paging'\nimport { IntegrationSummary } from './types'\n\nexport const findPreviousIntegrationVersion = async (\n client: client.Client,\n ref: NameIntegrationRef\n): Promise<IntegrationSummary | undefined> => {\n const { name, version: targetVersion } = ref\n const allVersions = await paging.listAllPages(\n async ({ nextToken }) => client.listIntegrations({ name, nextToken }),\n (r) => r.integrations\n )\n\n const orderedVersions = allVersions.sort((a, b) => semver.compare(b.version, a.version))\n const latestVersion = orderedVersions[0]\n if (!latestVersion) {\n return\n }\n\n type VersionIdx = [number, IntegrationSummary]\n\n let current: VersionIdx = [0, latestVersion]\n while (semver.gte(current[1].version, targetVersion)) {\n const nextIdx = current[0] + 1\n const nextIntegration = orderedVersions[nextIdx]\n if (!nextIntegration) {\n break\n }\n current = [nextIdx, nextIntegration]\n }\n\n const previous = current[1]\n if (semver.gte(previous.version, targetVersion)) {\n return\n }\n\n return previous\n}\n"],
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport semver from 'semver'\nimport { NamePackageRef } from '../package-ref'\nimport * as paging from './paging'\nimport { IntegrationSummary } from './types'\n\nexport const findPreviousIntegrationVersion = async (\n client: client.Client,\n ref: NamePackageRef\n): Promise<IntegrationSummary | undefined> => {\n const { name, version: targetVersion } = ref\n const allVersions = await paging.listAllPages(\n async ({ nextToken }) => client.listIntegrations({ name, nextToken }),\n (r) => r.integrations\n )\n\n const orderedVersions = allVersions.sort((a, b) => semver.compare(b.version, a.version))\n const latestVersion = orderedVersions[0]\n if (!latestVersion) {\n return\n }\n\n type VersionIdx = [number, IntegrationSummary]\n\n let current: VersionIdx = [0, latestVersion]\n while (semver.gte(current[1].version, targetVersion)) {\n const nextIdx = current[0] + 1\n const nextIntegration = orderedVersions[nextIdx]\n if (!nextIntegration) {\n break\n }\n current = [nextIdx, nextIntegration]\n }\n\n const previous = current[1]\n if (semver.gte(previous.version, targetVersion)) {\n return\n }\n\n return previous\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAmB;AAEnB,aAAwB;AAGjB,MAAM,iCAAiC,OAC5CA,SACA,QAC4C;AAC5C,QAAM,EAAE,MAAM,SAAS,cAAc,IAAI;AACzC,QAAM,cAAc,MAAM,OAAO;AAAA,IAC/B,OAAO,EAAE,UAAU,MAAMA,QAAO,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAAA,IACpE,CAAC,MAAM,EAAE;AAAA,EACX;AAEA,QAAM,kBAAkB,YAAY,KAAK,CAAC,GAAG,MAAM,cAAAC,QAAO,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;AACvF,QAAM,gBAAgB,gBAAgB;AACtC,MAAI,CAAC,eAAe;AAClB;AAAA,EACF;AAIA,MAAI,UAAsB,CAAC,GAAG,aAAa;AAC3C,SAAO,cAAAA,QAAO,IAAI,QAAQ,GAAG,SAAS,aAAa,GAAG;AACpD,UAAM,UAAU,QAAQ,KAAK;AAC7B,UAAM,kBAAkB,gBAAgB;AACxC,QAAI,CAAC,iBAAiB;AACpB;AAAA,IACF;AACA,cAAU,CAAC,SAAS,eAAe;AAAA,EACrC;AAEA,QAAM,WAAW,QAAQ;AACzB,MAAI,cAAAA,QAAO,IAAI,SAAS,SAAS,aAAa,GAAG;AAC/C;AAAA,EACF;AAEA,SAAO;AACT;",
6
6
  "names": ["client", "semver"]
7
7
  }
@@ -0,0 +1,23 @@
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 __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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var api_exports = {};
17
+ module.exports = __toCommonJS(api_exports);
18
+ __reExport(api_exports, require("./client"), module.exports);
19
+ __reExport(api_exports, require("./types"), module.exports);
20
+ __reExport(api_exports, require("./integration-body"), module.exports);
21
+ __reExport(api_exports, require("./interface-body"), module.exports);
22
+ __reExport(api_exports, require("./bot-body"), module.exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/api/index.ts"],
4
+ "sourcesContent": ["export * from './client'\nexport * from './types'\nexport * from './integration-body'\nexport * from './interface-body'\nexport * from './bot-body'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,oBADd;AAEA,wBAAc,+BAFd;AAGA,wBAAc,6BAHd;AAIA,wBAAc,uBAJd;",
6
+ "names": []
7
+ }
@@ -28,7 +28,6 @@ __export(interface_body_exports, {
28
28
  prepareUpdateInterfaceBody: () => prepareUpdateInterfaceBody
29
29
  });
30
30
  module.exports = __toCommonJS(interface_body_exports);
31
- var import_sdk = require("@botpress/sdk");
32
31
  var utils = __toESM(require("../utils"));
33
32
  const prepareCreateInterfaceBody = async (intrface) => ({
34
33
  name: intrface.name,
@@ -39,35 +38,51 @@ const prepareCreateInterfaceBody = async (intrface) => ({
39
38
  })) : {},
40
39
  events: intrface.events ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({
41
40
  ...event,
42
- schema: await utils.schema.mapZodToJsonSchema(_dereference(intrface, event))
41
+ schema: await utils.schema.mapZodToJsonSchema(event)
43
42
  })) : {},
44
43
  actions: intrface.actions ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({
45
44
  ...action,
46
45
  input: {
47
46
  ...action.input,
48
- schema: await utils.schema.mapZodToJsonSchema(_dereference(intrface, action.input))
47
+ schema: await utils.schema.mapZodToJsonSchema(action.input)
49
48
  },
50
49
  output: {
51
50
  ...action.output,
52
- schema: await utils.schema.mapZodToJsonSchema(_dereference(intrface, action.output))
51
+ schema: await utils.schema.mapZodToJsonSchema(action.output)
53
52
  }
54
- })) : {}
53
+ })) : {},
54
+ channels: intrface.channels ? await utils.records.mapValuesAsync(intrface.channels, async (channel) => ({
55
+ ...channel,
56
+ messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
57
+ ...message,
58
+ schema: await utils.schema.mapZodToJsonSchema(message)
59
+ }))
60
+ })) : {},
61
+ nameTemplate: intrface.templateName ? {
62
+ script: intrface.templateName,
63
+ language: "handlebars"
64
+ } : void 0
55
65
  });
56
66
  const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
57
67
  const actions = utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions);
58
68
  const events = utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events);
59
69
  const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities);
70
+ const currentChannels = localInterface.channels ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({
71
+ ...channel,
72
+ messages: utils.records.setNullOnMissingValues(
73
+ channel?.messages,
74
+ remoteInterface.channels[channelName]?.messages
75
+ )
76
+ })) : void 0;
77
+ const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels);
60
78
  return {
61
79
  ...localInterface,
62
80
  entities,
63
81
  actions,
64
- events
82
+ events,
83
+ channels
65
84
  };
66
85
  };
67
- const _dereference = (intrface, { schema }) => {
68
- const typeArguments = utils.records.mapValues(intrface.entities, (_, entityName) => import_sdk.z.ref(entityName));
69
- return { schema: schema(typeArguments) };
70
- };
71
86
  // Annotate the CommonJS export names for ESM import in node:
72
87
  0 && (module.exports = {
73
88
  prepareCreateInterfaceBody,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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 { AnyZodObject, GenericZuiSchema, z } 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.InterfaceDeclaration): 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(_dereference(intrface, 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(_dereference(intrface, action.input)),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(_dereference(intrface, action.output)),\n },\n }))\n : {},\n})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: UpdateInterfaceBody,\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 return {\n ...localInterface,\n entities,\n actions,\n events,\n }\n}\n\nconst _dereference = (\n intrface: sdk.InterfaceDeclaration,\n { schema }: { schema: GenericZuiSchema<Record<string, z.ZodRef>, AnyZodObject> }\n): { schema: AnyZodObject } => {\n const typeArguments = utils.records.mapValues(intrface.entities, (_, entityName) => z.ref(entityName))\n return { schema: schema(typeArguments) }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,iBAAkD;AAClD,YAAuB;AAKhB,MAAM,6BAA6B,OAAO,cAAsE;AAAA,EACrH,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,aAAa,UAAU,KAAK,CAAC;AAAA,EAC7E,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,aAAa,UAAU,OAAO,KAAK,CAAC;AAAA,IACpF;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,aAAa,UAAU,OAAO,MAAM,CAAC;AAAA,IACrF;AAAA,EACF,EAAE,IACF,CAAC;AACP;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;AACvG,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,eAAe,CACnB,UACA,EAAE,OAAO,MACoB;AAC7B,QAAM,gBAAgB,MAAM,QAAQ,UAAU,SAAS,UAAU,CAAC,GAAG,eAAe,aAAE,IAAI,UAAU,CAAC;AACrG,SAAO,EAAE,QAAQ,OAAO,aAAa,EAAE;AACzC;",
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.InterfaceDeclaration): 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,cAAsE;AAAA,EACrH,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,OA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,SAAS,cAAc;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
6
  "names": []
7
7
  }
@@ -0,0 +1,92 @@
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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var bot_implementation_exports = {};
26
+ __export(bot_implementation_exports, {
27
+ BotImplementationModule: () => BotImplementationModule
28
+ });
29
+ module.exports = __toCommonJS(bot_implementation_exports);
30
+ var consts = __toESM(require("../consts"));
31
+ var import_module = require("../module");
32
+ var import_bot_typings = require("./bot-typings");
33
+ class BotImplementationModule extends import_module.Module {
34
+ _typingsModule;
35
+ constructor(bot) {
36
+ super({
37
+ exportName: "Bot",
38
+ path: consts.INDEX_FILE
39
+ });
40
+ this._typingsModule = new import_bot_typings.BotTypingsModule(bot);
41
+ this._typingsModule.unshift("typings");
42
+ this.pushDep(this._typingsModule);
43
+ }
44
+ async getContent() {
45
+ const typingsImport = this._typingsModule.import(this);
46
+ return [
47
+ consts.GENERATED_HEADER,
48
+ 'import * as sdk from "@botpress/sdk"',
49
+ `import * as ${this._typingsModule.name} from "./${typingsImport}"`,
50
+ `export * from "./${typingsImport}"`,
51
+ "",
52
+ `type TBot = ${this._typingsModule.name}.${this._typingsModule.exportName}`,
53
+ "",
54
+ "export class Bot extends sdk.Bot<TBot> {}",
55
+ "",
56
+ "// extra types",
57
+ "",
58
+ "type AsyncFunction = (...args: any[]) => Promise<any>",
59
+ "export type EventHandler = Parameters<Bot['event']>[0]",
60
+ "export type EventHandlerProps = Parameters<EventHandler>[0]",
61
+ "export type MessageHandler = Parameters<Bot['message']>[0]",
62
+ "export type MessageHandlerProps = Parameters<MessageHandler>[0]",
63
+ "export type Client = EventHandlerProps['client']",
64
+ "export type ClientOperation = keyof {",
65
+ " [K in keyof Client as Client[K] extends AsyncFunction ? K : never]: null",
66
+ "}",
67
+ "export type ClientInputs = {",
68
+ " [K in ClientOperation]: Parameters<Client[K]>[0]",
69
+ "}",
70
+ "export type ClientOutputs = {",
71
+ " [K in ClientOperation]: Awaited<ReturnType<Client[K]>>",
72
+ "}",
73
+ "// @deprecated",
74
+ "export type BotEvent = EventHandlerProps['event']",
75
+ "// @deprecated",
76
+ "export type BotEvents = {",
77
+ " [K in BotEvent['type']]: Extract<BotEvent, { type: K }>",
78
+ "}",
79
+ "// @deprecated",
80
+ "export type BotState = ClientOutputs['getState']['state']",
81
+ "// @deprecated",
82
+ "export type BotStates = {",
83
+ " [K in BotState['name']]: Extract<BotState, { type: K }>['payload']",
84
+ "}"
85
+ ].join("\n");
86
+ }
87
+ }
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ BotImplementationModule
91
+ });
92
+ //# sourceMappingURL=bot-implementation.js.map
@@ -0,0 +1,7 @@
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 { BotTypingsModule } from './bot-typings'\n\nexport class BotImplementationModule extends Module {\n private _typingsModule: BotTypingsModule\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\n public async getContent() {\n const typingsImport = this._typingsModule.import(this)\n\n return [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n `import * as ${this._typingsModule.name} from \"./${typingsImport}\"`,\n `export * from \"./${typingsImport}\"`,\n '',\n `type TBot = ${this._typingsModule.name}.${this._typingsModule.exportName}`,\n '',\n 'export class Bot extends sdk.Bot<TBot> {}',\n '',\n '// extra types',\n '',\n 'type AsyncFunction = (...args: any[]) => Promise<any>',\n \"export type EventHandler = Parameters<Bot['event']>[0]\",\n 'export type EventHandlerProps = Parameters<EventHandler>[0]',\n \"export type MessageHandler = Parameters<Bot['message']>[0]\",\n 'export type MessageHandlerProps = Parameters<MessageHandler>[0]',\n \"export type Client = 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 '// @deprecated',\n \"export type BotEvent = EventHandlerProps['event']\",\n '// @deprecated',\n 'export type BotEvents = {',\n \" [K in BotEvent['type']]: Extract<BotEvent, { type: K }>\",\n '}',\n '// @deprecated',\n \"export type BotState = ClientOutputs['getState']['state']\",\n '// @deprecated',\n 'export type BotStates = {',\n \" [K in BotState['name']]: Extract<BotState, { type: K }>['payload']\",\n '}',\n ].join('\\n')\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,oBAAuB;AACvB,yBAAiC;AAE1B,MAAM,gCAAgC,qBAAO;AAAA,EAC1C;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;AAAA,EAClC;AAAA,EAEA,MAAa,aAAa;AACxB,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AAErD,WAAO;AAAA,MACL,OAAO;AAAA,MACP;AAAA,MACA,eAAe,KAAK,eAAe,gBAAgB;AAAA,MACnD,oBAAoB;AAAA,MACpB;AAAA,MACA,eAAe,KAAK,eAAe,QAAQ,KAAK,eAAe;AAAA,MAC/D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;",
6
+ "names": []
7
+ }
@@ -28,34 +28,27 @@ __export(events_module_exports, {
28
28
  EventsModule: () => EventsModule
29
29
  });
30
30
  module.exports = __toCommonJS(events_module_exports);
31
- var import_bluebird = __toESM(require("bluebird"));
32
- var import_generators = require("../generators");
33
- var import_module = require("../module");
34
- var strings = __toESM(require("../strings"));
31
+ var import_generators = require("../../generators");
32
+ var import_module = require("../../module");
33
+ var strings = __toESM(require("../../strings"));
35
34
  class EventModule extends import_module.Module {
36
- static async create(name, event) {
35
+ constructor(name, _event) {
37
36
  const eventName = name;
38
- const schema = event.schema;
39
37
  const exportName = strings.typeName(eventName);
40
- const def = {
41
- path: `${name}.ts`,
42
- exportName,
43
- content: await (0, import_generators.jsonSchemaToTypeScriptType)(schema, exportName)
44
- };
45
- return new EventModule(def);
38
+ super({ path: `${name}.ts`, exportName });
39
+ this._event = _event;
40
+ }
41
+ async getContent() {
42
+ return (0, import_generators.zuiSchemaToTypeScriptType)(this._event.schema, this.exportName);
46
43
  }
47
44
  }
48
45
  class EventsModule extends import_module.ReExportTypeModule {
49
- static async create(events) {
50
- const eventModules = await import_bluebird.default.map(
51
- Object.entries(events),
52
- async ([eventName, event]) => EventModule.create(eventName, event)
53
- );
54
- const inst = new EventsModule({
55
- exportName: strings.typeName("events")
56
- });
57
- inst.pushDep(...eventModules);
58
- return inst;
46
+ constructor(events) {
47
+ super({ exportName: strings.typeName("events") });
48
+ for (const [eventName, event] of Object.entries(events)) {
49
+ const module2 = new EventModule(eventName, event);
50
+ this.pushDep(module2);
51
+ }
59
52
  }
60
53
  }
61
54
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/code-generation/bot-implementation/bot-typings/events-module.ts"],
4
+ "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { zuiSchemaToTypeScriptType } from '../../generators'\nimport { Module, ReExportTypeModule } from '../../module'\nimport * as strings from '../../strings'\n\nexport class EventModule extends Module {\n public constructor(name: string, private _event: sdk.BotEventDefinition) {\n const eventName = name\n const exportName = strings.typeName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return zuiSchemaToTypeScriptType(this._event.schema, this.exportName)\n }\n}\n\nexport class EventsModule extends ReExportTypeModule {\n public constructor(events: Record<string, sdk.BotEventDefinition>) {\n super({ exportName: strings.typeName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA0C;AAC1C,oBAA2C;AAC3C,cAAyB;AAElB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YAAY,MAAsB,QAAgC;AACvE,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,SAAS,SAAS;AAC7C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHD;AAAA,EAIzC;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,6CAA0B,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EACtE;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EAC5C,YAAY,QAAgD;AACjE,UAAM,EAAE,YAAY,QAAQ,SAAS,QAAQ,EAAE,CAAC;AAChD,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
+ "names": ["module"]
7
+ }
@@ -0,0 +1,96 @@
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
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var bot_typings_exports = {};
26
+ __export(bot_typings_exports, {
27
+ BotTypingsModule: () => BotTypingsModule
28
+ });
29
+ module.exports = __toCommonJS(bot_typings_exports);
30
+ var consts = __toESM(require("../../consts"));
31
+ var import_integration_typings = require("../../integration-implementation/integration-typings");
32
+ var import_module = require("../../module");
33
+ var import_events_module = require("./events-module");
34
+ var import_states_module = require("./states-module");
35
+ class BotIntegrationsModule extends import_module.ReExportTypeModule {
36
+ constructor(bot) {
37
+ super({
38
+ exportName: "Integrations"
39
+ });
40
+ for (const [alias, integration] of Object.entries(bot.integrations ?? {})) {
41
+ const integrationModule = new import_integration_typings.IntegrationTypingsModule(integration.definition);
42
+ integrationModule.unshift(alias);
43
+ this.pushDep(integrationModule);
44
+ }
45
+ }
46
+ }
47
+ class BotTypingsModule extends import_module.Module {
48
+ _dependencies;
49
+ constructor(bot) {
50
+ super({
51
+ exportName: "TBot",
52
+ path: consts.INDEX_FILE
53
+ });
54
+ const integrationsModule = new BotIntegrationsModule(bot);
55
+ integrationsModule.unshift("integrations");
56
+ this.pushDep(integrationsModule);
57
+ const eventsModule = new import_events_module.EventsModule(bot.events ?? {});
58
+ eventsModule.unshift("events");
59
+ this.pushDep(eventsModule);
60
+ const statesModule = new import_states_module.StatesModule(bot.states ?? {});
61
+ statesModule.unshift("states");
62
+ this.pushDep(statesModule);
63
+ this._dependencies = {
64
+ integrationsModule,
65
+ eventsModule,
66
+ statesModule
67
+ };
68
+ }
69
+ async getContent() {
70
+ const { integrationsModule, eventsModule, statesModule } = this._dependencies;
71
+ const integrationsImport = integrationsModule.import(this);
72
+ const eventsImport = eventsModule.import(this);
73
+ const statesImport = statesModule.import(this);
74
+ return [
75
+ consts.GENERATED_HEADER,
76
+ `import * as ${integrationsModule.name} from './${integrationsImport}'`,
77
+ `import * as ${eventsModule.name} from './${eventsModule.name}'`,
78
+ `import * as ${statesModule.name} from './${statesModule.name}'`,
79
+ "",
80
+ `export * as ${integrationsModule.name} from './${integrationsImport}'`,
81
+ `export * as ${eventsModule.name} from './${eventsImport}'`,
82
+ `export * as ${statesModule.name} from './${statesImport}'`,
83
+ "",
84
+ "export type TBot = {",
85
+ ` integrations: ${integrationsModule.name}.${integrationsModule.exportName}`,
86
+ ` events: ${eventsModule.name}.${eventsModule.exportName}`,
87
+ ` states: ${statesModule.name}.${statesModule.exportName}`,
88
+ "}"
89
+ ].join("\n");
90
+ }
91
+ }
92
+ // Annotate the CommonJS export names for ESM import in node:
93
+ 0 && (module.exports = {
94
+ BotTypingsModule
95
+ });
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/code-generation/bot-implementation/bot-typings/index.ts"],
4
+ "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../../consts'\nimport { IntegrationTypingsModule } from '../../integration-implementation/integration-typings'\nimport { Module, ReExportTypeModule } from '../../module'\nimport { EventsModule } from './events-module'\nimport { StatesModule } from './states-module'\n\nclass BotIntegrationsModule extends ReExportTypeModule {\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'Integrations',\n })\n\n for (const [alias, integration] of Object.entries(bot.integrations ?? {})) {\n const integrationModule = new IntegrationTypingsModule(integration.definition)\n integrationModule.unshift(alias)\n this.pushDep(integrationModule)\n }\n }\n}\n\ntype BotTypingsIndexDependencies = {\n integrationsModule: BotIntegrationsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n}\n\nexport class BotTypingsModule extends Module {\n private _dependencies: BotTypingsIndexDependencies\n\n public constructor(bot: sdk.BotDefinition) {\n super({\n exportName: 'TBot',\n path: consts.INDEX_FILE,\n })\n\n const integrationsModule = new BotIntegrationsModule(bot)\n integrationsModule.unshift('integrations')\n this.pushDep(integrationsModule)\n\n const eventsModule = new EventsModule(bot.events ?? {})\n eventsModule.unshift('events')\n this.pushDep(eventsModule)\n\n const statesModule = new StatesModule(bot.states ?? {})\n statesModule.unshift('states')\n this.pushDep(statesModule)\n\n this._dependencies = {\n integrationsModule,\n eventsModule,\n statesModule,\n }\n }\n\n public async getContent() {\n const { integrationsModule, eventsModule, statesModule } = this._dependencies\n\n const integrationsImport = integrationsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n return [\n consts.GENERATED_HEADER,\n `import * as ${integrationsModule.name} from './${integrationsImport}'`,\n `import * as ${eventsModule.name} from './${eventsModule.name}'`,\n `import * as ${statesModule.name} from './${statesModule.name}'`,\n '',\n `export * as ${integrationsModule.name} from './${integrationsImport}'`,\n `export * as ${eventsModule.name} from './${eventsImport}'`,\n `export * as ${statesModule.name} from './${statesImport}'`,\n '',\n 'export type TBot = {',\n ` integrations: ${integrationsModule.name}.${integrationsModule.exportName}`,\n ` events: ${eventsModule.name}.${eventsModule.exportName}`,\n ` states: ${statesModule.name}.${statesModule.exportName}`,\n '}',\n ].join('\\n')\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,iCAAyC;AACzC,oBAA2C;AAC3C,2BAA6B;AAC7B,2BAA6B;AAE7B,MAAM,8BAA8B,iCAAmB;AAAA,EAC9C,YAAY,KAAwB;AACzC,UAAM;AAAA,MACJ,YAAY;AAAA,IACd,CAAC;AAED,eAAW,CAAC,OAAO,WAAW,KAAK,OAAO,QAAQ,IAAI,gBAAgB,CAAC,CAAC,GAAG;AACzE,YAAM,oB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