@botpress/cli 0.2.8 → 0.3.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 (70) hide show
  1. package/dist/code-generation/const.js +1 -1
  2. package/dist/code-generation/const.js.map +1 -1
  3. package/dist/code-generation/{event.js → generators.js} +15 -19
  4. package/dist/code-generation/generators.js.map +7 -0
  5. package/dist/code-generation/index.js +40 -8
  6. package/dist/code-generation/index.js.map +2 -2
  7. package/dist/code-generation/integration-implementation.js +157 -0
  8. package/dist/code-generation/integration-implementation.js.map +7 -0
  9. package/dist/code-generation/integration-instance.js +101 -39
  10. package/dist/code-generation/integration-instance.js.map +2 -2
  11. package/dist/code-generation/{action.js → integration-schemas/actions-module.js} +41 -19
  12. package/dist/code-generation/integration-schemas/actions-module.js.map +7 -0
  13. package/dist/code-generation/integration-schemas/channels-module.js +114 -0
  14. package/dist/code-generation/integration-schemas/channels-module.js.map +7 -0
  15. package/dist/code-generation/{configuration.js → integration-schemas/configuration-module.js} +11 -10
  16. package/dist/code-generation/integration-schemas/configuration-module.js.map +7 -0
  17. package/dist/code-generation/integration-schemas/events-module.js +64 -0
  18. package/dist/code-generation/integration-schemas/events-module.js.map +7 -0
  19. package/dist/code-generation/integration-schemas/states-module.js +64 -0
  20. package/dist/code-generation/integration-schemas/states-module.js.map +7 -0
  21. package/dist/code-generation/module.js +5 -5
  22. package/dist/code-generation/module.js.map +2 -2
  23. package/dist/code-generation/typings.js.map +1 -1
  24. package/dist/command-implementations/deploy-command.js +2 -20
  25. package/dist/command-implementations/deploy-command.js.map +3 -3
  26. package/dist/command-implementations/dev-command.js +8 -7
  27. package/dist/command-implementations/dev-command.js.map +3 -3
  28. package/dist/command-implementations/project-command.js +54 -1
  29. package/dist/command-implementations/project-command.js.map +2 -2
  30. package/dist/{code-generation/message.js → utils/guard-utils.js} +9 -20
  31. package/dist/utils/guard-utils.js.map +7 -0
  32. package/dist/utils/index.js +9 -0
  33. package/dist/utils/index.js.map +2 -2
  34. package/dist/utils/record-utils.js +9 -0
  35. package/dist/utils/record-utils.js.map +2 -2
  36. package/dist/{code-generation/channel.js → utils/schema-utils.js} +25 -22
  37. package/dist/utils/schema-utils.js.map +7 -0
  38. package/dist/utils/type-utils.js +17 -0
  39. package/dist/utils/type-utils.js.map +7 -0
  40. package/package.json +6 -5
  41. package/templates/echo-bot/package.json +2 -2
  42. package/templates/echo-bot/src/index.ts +7 -20
  43. package/templates/empty-integration/.botpress/implementation/actions/index.ts +0 -1
  44. package/templates/empty-integration/.botpress/implementation/channels/channel/index.ts +6 -34
  45. package/templates/empty-integration/.botpress/implementation/channels/channel/{audio.ts → messages/audio.ts} +1 -1
  46. package/templates/empty-integration/.botpress/implementation/channels/channel/{card.ts → messages/card.ts} +1 -1
  47. package/templates/empty-integration/.botpress/implementation/channels/channel/{carousel.ts → messages/carousel.ts} +1 -1
  48. package/templates/empty-integration/.botpress/implementation/channels/channel/{choice.ts → messages/choice.ts} +1 -1
  49. package/templates/empty-integration/.botpress/implementation/channels/channel/{dropdown.ts → messages/dropdown.ts} +1 -1
  50. package/templates/empty-integration/.botpress/implementation/channels/channel/{file.ts → messages/file.ts} +1 -1
  51. package/templates/empty-integration/.botpress/implementation/channels/channel/{image.ts → messages/image.ts} +1 -1
  52. package/templates/empty-integration/.botpress/implementation/channels/channel/messages/index.ts +39 -0
  53. package/templates/empty-integration/.botpress/implementation/channels/channel/{location.ts → messages/location.ts} +1 -1
  54. package/templates/empty-integration/.botpress/implementation/channels/channel/{markdown.ts → messages/markdown.ts} +1 -1
  55. package/templates/empty-integration/.botpress/implementation/channels/channel/{text.ts → messages/text.ts} +1 -1
  56. package/templates/empty-integration/.botpress/implementation/channels/channel/{video.ts → messages/video.ts} +1 -1
  57. package/templates/empty-integration/.botpress/implementation/channels/index.ts +1 -2
  58. package/templates/empty-integration/.botpress/implementation/{configuration.ts → configuration/index.ts} +2 -2
  59. package/templates/empty-integration/.botpress/implementation/events/index.ts +0 -1
  60. package/templates/empty-integration/.botpress/implementation/index.ts +30 -12
  61. package/templates/empty-integration/.botpress/implementation/states/index.ts +6 -0
  62. package/templates/empty-integration/.botpress/secrets/index.ts +0 -1
  63. package/templates/empty-integration/package.json +2 -2
  64. package/dist/code-generation/action.js.map +0 -7
  65. package/dist/code-generation/channel.js.map +0 -7
  66. package/dist/code-generation/configuration.js.map +0 -7
  67. package/dist/code-generation/event.js.map +0 -7
  68. package/dist/code-generation/integration-impl.js +0 -147
  69. package/dist/code-generation/integration-impl.js.map +0 -7
  70. package/dist/code-generation/message.js.map +0 -7
@@ -8,8 +8,8 @@
8
8
  "author": "",
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "@botpress/client": "0.3.1",
12
- "@botpress/sdk": "0.2.2",
11
+ "@botpress/client": "0.3.2",
12
+ "@botpress/sdk": "0.3.0",
13
13
  "zod": "^3.20.6"
14
14
  },
15
15
  "devDependencies": {
@@ -1,24 +1,11 @@
1
- import type { Client } from '@botpress/client'
2
- import { Bot, messages } from '@botpress/sdk'
3
- import type { z } from 'zod'
1
+ import { Bot } from '@botpress/sdk'
2
+ import { z } from 'zod'
4
3
  // import * as botpress from '.botpress' /** uncomment to get generated code */
5
4
 
6
- type DefaultMessages = typeof messages.defaults
7
- type DefaultMessageType = keyof DefaultMessages
8
- type DefaultMessagePayload<T extends DefaultMessageType> = z.infer<DefaultMessages[T]['schema']>
9
-
10
- type CreateMessageProps = Parameters<Client['createMessage']>[0]
11
- type CreateMessageBody<T extends DefaultMessageType> = Omit<CreateMessageProps, 'type' | 'payload'> & {
12
- type: T
13
- payload: DefaultMessagePayload<T>
14
- }
15
-
16
- const logger = console
17
-
18
5
  const bot = new Bot({
19
- integrations: [],
6
+ integrations: {},
20
7
  configuration: {
21
- schema: {},
8
+ schema: z.object({}),
22
9
  },
23
10
  states: {},
24
11
  events: {},
@@ -26,7 +13,7 @@ const bot = new Bot({
26
13
  })
27
14
 
28
15
  bot.message(async ({ message, client, ctx }) => {
29
- logger.info('Received message', message)
16
+ console.info('Received message', message)
30
17
 
31
18
  await client.createMessage({
32
19
  conversationId: message.conversationId,
@@ -36,9 +23,9 @@ bot.message(async ({ message, client, ctx }) => {
36
23
  payload: {
37
24
  text: `You said: ${message.payload.text}`,
38
25
  },
39
- } satisfies CreateMessageBody<'text'>)
26
+ })
40
27
 
41
- logger.info('text message sent')
28
+ console.info('text message sent')
42
29
  })
43
30
 
44
31
  export default bot
@@ -2,6 +2,5 @@
2
2
  // This file is generated
3
3
  // Do not edit this file
4
4
 
5
-
6
5
  export type Actions = {
7
6
  }
@@ -2,39 +2,11 @@
2
2
  // This file is generated
3
3
  // Do not edit this file
4
4
 
5
- import type * as text from "./text";
6
- export * as text from "./text";
7
- import type * as markdown from "./markdown";
8
- export * as markdown from "./markdown";
9
- import type * as image from "./image";
10
- export * as image from "./image";
11
- import type * as audio from "./audio";
12
- export * as audio from "./audio";
13
- import type * as video from "./video";
14
- export * as video from "./video";
15
- import type * as file from "./file";
16
- export * as file from "./file";
17
- import type * as location from "./location";
18
- export * as location from "./location";
19
- import type * as carousel from "./carousel";
20
- export * as carousel from "./carousel";
21
- import type * as card from "./card";
22
- export * as card from "./card";
23
- import type * as dropdown from "./dropdown";
24
- export * as dropdown from "./dropdown";
25
- import type * as choice from "./choice";
26
- export * as choice from "./choice";
5
+ import { Messages } from './messages/index'
6
+ export * from './messages/index'
27
7
 
28
8
  export type ChannelChannel = {
29
- text: text.Text;
30
- markdown: markdown.Markdown;
31
- image: image.Image;
32
- audio: audio.Audio;
33
- video: video.Video;
34
- file: file.File;
35
- location: location.Location;
36
- carousel: carousel.Carousel;
37
- card: card.Card;
38
- dropdown: dropdown.Dropdown;
39
- choice: choice.Choice;
40
- }
9
+ messages: Messages
10
+ message: { "tags": {} }
11
+ conversation: { "tags": {}, "creation": { "enabled": false, "requiredTags": [] } }
12
+ }
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -0,0 +1,39 @@
1
+ /* tslint:disable */
2
+ // This file is generated
3
+ // Do not edit this file
4
+ import * as text from "./text";
5
+ export * as text from "./text";
6
+ import * as markdown from "./markdown";
7
+ export * as markdown from "./markdown";
8
+ import * as image from "./image";
9
+ export * as image from "./image";
10
+ import * as audio from "./audio";
11
+ export * as audio from "./audio";
12
+ import * as video from "./video";
13
+ export * as video from "./video";
14
+ import * as file from "./file";
15
+ export * as file from "./file";
16
+ import * as location from "./location";
17
+ export * as location from "./location";
18
+ import * as carousel from "./carousel";
19
+ export * as carousel from "./carousel";
20
+ import * as card from "./card";
21
+ export * as card from "./card";
22
+ import * as dropdown from "./dropdown";
23
+ export * as dropdown from "./dropdown";
24
+ import * as choice from "./choice";
25
+ export * as choice from "./choice";
26
+
27
+ export type Messages = {
28
+ text: text.Text;
29
+ markdown: markdown.Markdown;
30
+ image: image.Image;
31
+ audio: audio.Audio;
32
+ video: video.Video;
33
+ file: file.File;
34
+ location: location.Location;
35
+ carousel: carousel.Carousel;
36
+ card: card.Card;
37
+ dropdown: dropdown.Dropdown;
38
+ choice: choice.Choice;
39
+ }
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -1,8 +1,7 @@
1
1
  /* tslint:disable */
2
2
  // This file is generated
3
3
  // Do not edit this file
4
-
5
- import type * as channel from "./channel/index";
4
+ import * as channel from "./channel/index";
6
5
  export * as channel from "./channel/index";
7
6
 
8
7
  export type Channels = {
@@ -1,4 +1,4 @@
1
- /* eslint-disable */
1
+ /* tslint:disable */
2
2
  /**
3
3
  * This file was automatically generated by json-schema-to-typescript.
4
4
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -6,5 +6,5 @@
6
6
  */
7
7
 
8
8
  export interface Configuration {
9
- [k: string]: unknown;
9
+ [k: string]: any;
10
10
  }
@@ -2,6 +2,5 @@
2
2
  // This file is generated
3
3
  // Do not edit this file
4
4
 
5
-
6
5
  export type Events = {
7
6
  }
@@ -1,18 +1,36 @@
1
1
  /* tslint:disable */
2
2
  // This file is generated
3
3
  // Do not edit this file
4
+ /* tslint:disable */
5
+ // This file is generated
6
+ // Do not edit this file
7
+
8
+ import * as sdk from "@botpress/sdk"
9
+
10
+ import type * as configuration from "./configuration/index"
11
+ import type * as actions from "./actions/index"
12
+ import type * as channels from "./channels/index"
13
+ import type * as events from "./events/index"
14
+ import type * as states from "./states/index"
15
+ export * as configuration from "./configuration/index"
16
+ export * as actions from "./actions/index"
17
+ export * as channels from "./channels/index"
18
+ export * as events from "./events/index"
19
+ export * as states from "./states/index"
20
+
21
+ type TIntegration = {
22
+ name: "empty-integration"
23
+ version: "0.2.0"
24
+ configuration: configuration.Configuration
25
+ actions: actions.Actions
26
+ channels: channels.Channels
27
+ events: events.Events
28
+ states: states.States
29
+ user: { "tags": {}, "creation": { "enabled": false, "requiredTags": [] } }
30
+ }
4
31
 
5
- import * as sdk from "@botpress/sdk";
32
+ export type IntegrationProps = sdk.IntegrationProps<TIntegration>
6
33
 
7
- import type * as configuration from "./configuration";
8
- import type * as actions from "./actions/index";
9
- import type * as channels from "./channels/index";
10
- import type * as events from "./events/index";
11
- export * as configuration from "./configuration";
12
- export * as actions from "./actions/index";
13
- export * as channels from "./channels/index";
14
- export * as events from "./events/index";
34
+ export class Integration extends sdk.Integration<TIntegration> {}
15
35
 
16
- export class Integration
17
- extends sdk.Integration<configuration.Configuration, actions.Actions, channels.Channels, events.Events> {}
18
- export type IntegrationProps = sdk.IntegrationProps<configuration.Configuration, actions.Actions, channels.Channels, events.Events>;
36
+ export type Client = sdk.IntegrationSpecificClient<TIntegration>
@@ -0,0 +1,6 @@
1
+ /* tslint:disable */
2
+ // This file is generated
3
+ // Do not edit this file
4
+
5
+ export type States = {
6
+ }
@@ -1,7 +1,6 @@
1
1
  /* tslint:disable */
2
2
  // This file is generated
3
3
  // Do not edit this file
4
-
5
4
  class Secrets {
6
5
  }
7
6
  export const secrets = new Secrets()
@@ -8,8 +8,8 @@
8
8
  "author": "",
9
9
  "license": "MIT",
10
10
  "dependencies": {
11
- "@botpress/client": "0.3.1",
12
- "@botpress/sdk": "0.2.2",
11
+ "@botpress/client": "0.3.2",
12
+ "@botpress/sdk": "0.3.0",
13
13
  "zod": "^3.20.6"
14
14
  },
15
15
  "devDependencies": {
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/code-generation/action.ts"],
4
- "sourcesContent": ["import { compile } from 'json-schema-to-typescript'\nimport { casing } from '../utils'\nimport { Module, ModuleDef, ReExportTypeModule } from './module'\nimport type * as types from './typings'\n\ntype ActionInput = types.Action['input']\ntype ActionOutput = types.Action['output']\n\nexport class ActionInputModule extends Module {\n public static async create(input: ActionInput): Promise<ActionInputModule> {\n const schema = input.schema ?? {}\n const filename = 'input.ts'\n const def: ModuleDef = {\n path: filename,\n exportName: 'Input',\n content: await compile(schema, filename),\n }\n return new ActionInputModule(def)\n }\n}\n\nexport class ActionOutputModule extends Module {\n public static async create(output: ActionOutput): Promise<ActionOutputModule> {\n const schema = output.schema ?? {}\n const filename = 'output.ts'\n const def: ModuleDef = {\n path: filename,\n exportName: 'Output',\n content: await compile(schema, filename),\n }\n return new ActionOutputModule(def)\n }\n}\n\nexport class ActionModule extends ReExportTypeModule {\n public static async create(actionName: string, action: types.Action): Promise<ActionModule> {\n const inputModule = await ActionInputModule.create(action.input ?? {})\n const outputModule = await ActionOutputModule.create(action.output ?? {})\n\n const inst = new ActionModule({\n exportName: `Action${casing.to.pascalCase(actionName)}`,\n })\n\n inst.pushDep(inputModule)\n inst.pushDep(outputModule)\n\n return inst\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAwB;AACxB,mBAAuB;AACvB,oBAAsD;AAM/C,MAAM,0BAA0B,qBAAO;AAAA,EAC5C,aAAoB,OAAO,OAAgD;AACzE,UAAM,SAAS,MAAM,UAAU,CAAC;AAChC,UAAM,WAAW;AACjB,UAAM,MAAiB;AAAA,MACrB,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,SAAS,UAAM,0CAAQ,QAAQ,QAAQ;AAAA,IACzC;AACA,WAAO,IAAI,kBAAkB,GAAG;AAAA,EAClC;AACF;AAEO,MAAM,2BAA2B,qBAAO;AAAA,EAC7C,aAAoB,OAAO,QAAmD;AAC5E,UAAM,SAAS,OAAO,UAAU,CAAC;AACjC,UAAM,WAAW;AACjB,UAAM,MAAiB;AAAA,MACrB,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,SAAS,UAAM,0CAAQ,QAAQ,QAAQ;AAAA,IACzC;AACA,WAAO,IAAI,mBAAmB,GAAG;AAAA,EACnC;AACF;AAEO,MAAM,qBAAqB,iCAAmB;AAAA,EACnD,aAAoB,OAAO,YAAoB,QAA6C;AAC1F,UAAM,cAAc,MAAM,kBAAkB,OAAO,OAAO,SAAS,CAAC,CAAC;AACrE,UAAM,eAAe,MAAM,mBAAmB,OAAO,OAAO,UAAU,CAAC,CAAC;AAExE,UAAM,OAAO,IAAI,aAAa;AAAA,MAC5B,YAAY,SAAS,oBAAO,GAAG,WAAW,UAAU;AAAA,IACtD,CAAC;AAED,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AAEzB,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/code-generation/channel.ts"],
4
- "sourcesContent": ["import bluebird from 'bluebird'\nimport { casing } from '../utils'\nimport { MessageModule } from './message'\nimport { ReExportTypeModule } from './module'\nimport type { Channel } from './typings'\n\nexport class ChannelModule extends ReExportTypeModule {\n public static async create(channelName: string, channel: Channel): Promise<ChannelModule> {\n const messages = channel.messages ?? {}\n const messageModules = await bluebird.map(Object.entries(messages), ([messageName, message]) =>\n MessageModule.create(messageName, message)\n )\n\n const inst = new ChannelModule({\n exportName: `Channel${casing.to.pascalCase(channelName)}`,\n })\n inst.pushDep(...messageModules)\n return inst\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAqB;AACrB,mBAAuB;AACvB,qBAA8B;AAC9B,oBAAmC;AAG5B,MAAM,sBAAsB,iCAAmB;AAAA,EACpD,aAAoB,OAAO,aAAqB,SAA0C;AACxF,UAAM,WAAW,QAAQ,YAAY,CAAC;AACtC,UAAM,iBAAiB,MAAM,gBAAAA,QAAS;AAAA,MAAI,OAAO,QAAQ,QAAQ;AAAA,MAAG,CAAC,CAAC,aAAa,OAAO,MACxF,6BAAc,OAAO,aAAa,OAAO;AAAA,IAC3C;AAEA,UAAM,OAAO,IAAI,cAAc;AAAA,MAC7B,YAAY,UAAU,oBAAO,GAAG,WAAW,WAAW;AAAA,IACxD,CAAC;AACD,SAAK,QAAQ,GAAG,cAAc;AAC9B,WAAO;AAAA,EACT;AACF;",
6
- "names": ["bluebird"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/code-generation/configuration.ts"],
4
- "sourcesContent": ["import { compile } from 'json-schema-to-typescript'\nimport { Module } from './module'\nimport type * as types from './typings'\n\nexport class ConfigurationModule extends Module {\n public static async create(configuration: types.Config): Promise<ConfigurationModule> {\n const schema = configuration.schema ?? {}\n const filename = 'configuration'\n return new ConfigurationModule({\n path: `${filename}.ts`,\n exportName: 'Configuration',\n content: await compile(schema, filename),\n })\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAwB;AACxB,oBAAuB;AAGhB,MAAM,4BAA4B,qBAAO;AAAA,EAC9C,aAAoB,OAAO,eAA2D;AACpF,UAAM,SAAS,cAAc,UAAU,CAAC;AACxC,UAAM,WAAW;AACjB,WAAO,IAAI,oBAAoB;AAAA,MAC7B,MAAM,GAAG;AAAA,MACT,YAAY;AAAA,MACZ,SAAS,UAAM,0CAAQ,QAAQ,QAAQ;AAAA,IACzC,CAAC;AAAA,EACH;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/code-generation/event.ts"],
4
- "sourcesContent": ["import { compile } from 'json-schema-to-typescript'\nimport { casing } from '../utils'\nimport { Module, ModuleDef } from './module'\nimport type { Event } from './typings'\n\nexport class EventModule extends Module {\n public static async create(name: string, event: Event): Promise<EventModule> {\n const schema = event.schema ?? {}\n const def: ModuleDef = {\n path: `${name}.ts`,\n exportName: casing.to.pascalCase(name),\n content: await compile(schema, name),\n }\n return new EventModule(def)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAwB;AACxB,mBAAuB;AACvB,oBAAkC;AAG3B,MAAM,oBAAoB,qBAAO;AAAA,EACtC,aAAoB,OAAO,MAAc,OAAoC;AAC3E,UAAM,SAAS,MAAM,UAAU,CAAC;AAChC,UAAM,MAAiB;AAAA,MACrB,MAAM,GAAG;AAAA,MACT,YAAY,oBAAO,GAAG,WAAW,IAAI;AAAA,MACrC,SAAS,UAAM,0CAAQ,QAAQ,IAAI;AAAA,IACrC;AACA,WAAO,IAAI,YAAY,GAAG;AAAA,EAC5B;AACF;",
6
- "names": []
7
- }
@@ -1,147 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- 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 integration_impl_exports = {};
26
- __export(integration_impl_exports, {
27
- IntegrationImplementationIndexModule: () => IntegrationImplementationIndexModule
28
- });
29
- module.exports = __toCommonJS(integration_impl_exports);
30
- var import_bluebird = __toESM(require("bluebird"));
31
- var import_action = require("./action");
32
- var import_channel = require("./channel");
33
- var import_configuration = require("./configuration");
34
- var import_const = require("./const");
35
- var import_event = require("./event");
36
- var import_module = require("./module");
37
- class IntegrationImplementationIndexModule extends import_module.Module {
38
- constructor(configModule, actionsModule, channelsModule, eventsModule, integrationID, def) {
39
- super(def);
40
- this.configModule = configModule;
41
- this.actionsModule = actionsModule;
42
- this.channelsModule = channelsModule;
43
- this.eventsModule = eventsModule;
44
- this.integrationID = integrationID;
45
- }
46
- static async create(integration) {
47
- const configModule = await import_configuration.ConfigurationModule.create(integration.configuration ?? { schema: {} });
48
- const actionsModule = await ActionsModule.create(integration.actions ?? {});
49
- actionsModule.unshift("actions");
50
- const channelsModule = await ChannelsModule.create(integration.channels ?? {});
51
- channelsModule.unshift("channels");
52
- const eventsModule = await EventsModule.create(integration.events ?? {});
53
- eventsModule.unshift("events");
54
- const { name, version } = integration;
55
- const inst = new IntegrationImplementationIndexModule(
56
- configModule,
57
- actionsModule,
58
- channelsModule,
59
- eventsModule,
60
- { name, version },
61
- {
62
- path: import_const.INDEX_FILE,
63
- exportName: "Integration",
64
- content: ""
65
- }
66
- );
67
- inst.pushDep(configModule);
68
- inst.pushDep(actionsModule);
69
- inst.pushDep(channelsModule);
70
- inst.pushDep(eventsModule);
71
- return inst;
72
- }
73
- get content() {
74
- let content = import_const.GENERATED_HEADER;
75
- const { configModule, actionsModule, channelsModule, eventsModule } = this;
76
- content += 'import * as sdk from "@botpress/sdk";\n\n';
77
- const configImport = configModule.import(this);
78
- const actionsImport = actionsModule.import(this);
79
- const channelsImport = channelsModule.import(this);
80
- const eventsImport = eventsModule.import(this);
81
- content += `import type * as ${configModule.name} from "./${configImport}";
82
- `;
83
- content += `import type * as ${actionsModule.name} from "./${actionsImport}";
84
- `;
85
- content += `import type * as ${channelsModule.name} from "./${channelsImport}";
86
- `;
87
- content += `import type * as ${eventsModule.name} from "./${eventsImport}";
88
- `;
89
- content += `export * as ${configModule.name} from "./${configImport}";
90
- `;
91
- content += `export * as ${actionsModule.name} from "./${actionsImport}";
92
- `;
93
- content += `export * as ${channelsModule.name} from "./${channelsImport}";
94
- `;
95
- content += `export * as ${eventsModule.name} from "./${eventsImport}";
96
- `;
97
- content += "\n";
98
- content += `export class Integration
99
- extends sdk.Integration<${configModule.name}.${configModule.exports}, ${actionsModule.name}.${actionsModule.exports}, ${channelsModule.name}.${channelsModule.exports}, ${eventsModule.name}.${eventsModule.exports}> {}
100
- `;
101
- content += `export type IntegrationProps = sdk.IntegrationProps<${configModule.name}.${configModule.exports}, ${actionsModule.name}.${actionsModule.exports}, ${channelsModule.name}.${channelsModule.exports}, ${eventsModule.name}.${eventsModule.exports}>;
102
- `;
103
- return content;
104
- }
105
- }
106
- class ChannelsModule extends import_module.ReExportTypeModule {
107
- static async create(channels) {
108
- const channelModules = await import_bluebird.default.map(Object.entries(channels), async ([channelName, channel]) => {
109
- const mod = await import_channel.ChannelModule.create(channelName, channel);
110
- return mod.unshift(channelName);
111
- });
112
- const inst = new ChannelsModule({ exportName: "Channels" });
113
- inst.pushDep(...channelModules);
114
- return inst;
115
- }
116
- }
117
- class ActionsModule extends import_module.ReExportTypeModule {
118
- static async create(actions) {
119
- const actionModules = await import_bluebird.default.map(Object.entries(actions), async ([actionName, action]) => {
120
- const mod = await import_action.ActionModule.create(actionName, action);
121
- return mod.unshift(actionName);
122
- });
123
- const inst = new ActionsModule({
124
- exportName: "Actions"
125
- });
126
- inst.pushDep(...actionModules);
127
- return inst;
128
- }
129
- }
130
- class EventsModule extends import_module.ReExportTypeModule {
131
- static async create(events) {
132
- const eventModules = await import_bluebird.default.map(
133
- Object.entries(events),
134
- async ([eventName, event]) => import_event.EventModule.create(eventName, event)
135
- );
136
- const inst = new EventsModule({
137
- exportName: "Events"
138
- });
139
- inst.pushDep(...eventModules);
140
- return inst;
141
- }
142
- }
143
- // Annotate the CommonJS export names for ESM import in node:
144
- 0 && (module.exports = {
145
- IntegrationImplementationIndexModule
146
- });
147
- //# sourceMappingURL=integration-impl.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/code-generation/integration-impl.ts"],
4
- "sourcesContent": ["import type { IntegrationDefinition } from '@botpress/sdk'\nimport bluebird from 'bluebird'\nimport { ActionModule } from './action'\nimport { ChannelModule } from './channel'\nimport { ConfigurationModule } from './configuration'\nimport { GENERATED_HEADER, INDEX_FILE } from './const'\nimport { EventModule } from './event'\nimport { Module, ModuleDef, ReExportTypeModule } from './module'\nimport type * as types from './typings'\n\nexport class IntegrationImplementationIndexModule extends Module {\n public static async create(integration: IntegrationDefinition): Promise<IntegrationImplementationIndexModule> {\n const configModule = await ConfigurationModule.create(integration.configuration ?? { schema: {} })\n\n const actionsModule = await ActionsModule.create(integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = await ChannelsModule.create(integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = await EventsModule.create(integration.events ?? {})\n eventsModule.unshift('events')\n\n const { name, version } = integration\n const inst = new IntegrationImplementationIndexModule(\n configModule,\n actionsModule,\n channelsModule,\n eventsModule,\n { name, version },\n {\n path: INDEX_FILE,\n exportName: 'Integration',\n content: '',\n }\n )\n\n inst.pushDep(configModule)\n inst.pushDep(actionsModule)\n inst.pushDep(channelsModule)\n inst.pushDep(eventsModule)\n return inst\n }\n\n private constructor(\n private configModule: ConfigurationModule,\n private actionsModule: ActionsModule,\n private channelsModule: ChannelsModule,\n private eventsModule: EventsModule,\n private integrationID: { name: string; version: string },\n def: ModuleDef\n ) {\n super(def)\n }\n\n public override get content(): string {\n let content = GENERATED_HEADER\n\n const { configModule, actionsModule, channelsModule, eventsModule } = this\n\n content += 'import * as sdk from \"@botpress/sdk\";\\n\\n'\n\n const configImport = configModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n\n content += `import type * as ${configModule.name} from \"./${configImport}\";\\n`\n content += `import type * as ${actionsModule.name} from \"./${actionsImport}\";\\n`\n content += `import type * as ${channelsModule.name} from \"./${channelsImport}\";\\n`\n content += `import type * as ${eventsModule.name} from \"./${eventsImport}\";\\n`\n content += `export * as ${configModule.name} from \"./${configImport}\";\\n`\n content += `export * as ${actionsModule.name} from \"./${actionsImport}\";\\n`\n content += `export * as ${channelsModule.name} from \"./${channelsImport}\";\\n`\n content += `export * as ${eventsModule.name} from \"./${eventsImport}\";\\n`\n\n content += '\\n'\n\n content += `export class Integration\n extends sdk.Integration<${configModule.name}.${configModule.exports}, ${actionsModule.name}.${actionsModule.exports}, ${channelsModule.name}.${channelsModule.exports}, ${eventsModule.name}.${eventsModule.exports}> {}\\n`\n\n content += `export type IntegrationProps = sdk.IntegrationProps<${configModule.name}.${configModule.exports}, ${actionsModule.name}.${actionsModule.exports}, ${channelsModule.name}.${channelsModule.exports}, ${eventsModule.name}.${eventsModule.exports}>;\\n`\n\n return content\n }\n}\n\nclass ChannelsModule extends ReExportTypeModule {\n public static async create(channels: Record<string, types.Channel>): Promise<ChannelsModule> {\n const channelModules = await bluebird.map(Object.entries(channels), async ([channelName, channel]) => {\n const mod = await ChannelModule.create(channelName, channel)\n return mod.unshift(channelName)\n })\n const inst = new ChannelsModule({ exportName: 'Channels' })\n inst.pushDep(...channelModules)\n return inst\n }\n}\n\nclass ActionsModule extends ReExportTypeModule {\n public static async create(actions: Record<string, types.Action>): Promise<ActionsModule> {\n const actionModules = await bluebird.map(Object.entries(actions), async ([actionName, action]) => {\n const mod = await ActionModule.create(actionName, action)\n return mod.unshift(actionName)\n })\n\n const inst = new ActionsModule({\n exportName: 'Actions',\n })\n\n inst.pushDep(...actionModules)\n return inst\n }\n}\n\nclass EventsModule extends ReExportTypeModule {\n public static async create(events: Record<string, types.Event>): Promise<EventsModule> {\n const eventModules = await bluebird.map(Object.entries(events), async ([eventName, event]) =>\n EventModule.create(eventName, event)\n )\n\n const inst = new EventsModule({\n exportName: 'Events',\n })\n inst.pushDep(...eventModules)\n return inst\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAqB;AACrB,oBAA6B;AAC7B,qBAA8B;AAC9B,2BAAoC;AACpC,mBAA6C;AAC7C,mBAA4B;AAC5B,oBAAsD;AAG/C,MAAM,6CAA6C,qBAAO;AAAA,EAkCvD,YACE,cACA,eACA,gBACA,cACA,eACR,KACA;AACA,UAAM,GAAG;AAPD;AACA;AACA;AACA;AACA;AAAA,EAIV;AAAA,EA1CA,aAAoB,OAAO,aAAmF;AAC5G,UAAM,eAAe,MAAM,yCAAoB,OAAO,YAAY,iBAAiB,EAAE,QAAQ,CAAC,EAAE,CAAC;AAEjG,UAAM,gBAAgB,MAAM,cAAc,OAAO,YAAY,WAAW,CAAC,CAAC;AAC1E,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,MAAM,eAAe,OAAO,YAAY,YAAY,CAAC,CAAC;AAC7E,mBAAe,QAAQ,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,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/code-generation/message.ts"],
4
- "sourcesContent": ["import { compile } from 'json-schema-to-typescript'\nimport { casing } from '../utils'\nimport { Module, ModuleDef } from './module'\nimport type { Message } from './typings'\n\nexport class MessageModule extends Module {\n public static async create(name: string, message: Message): Promise<MessageModule> {\n const schema = message.schema ?? {}\n const def: ModuleDef = {\n path: `${name}.ts`,\n exportName: casing.to.pascalCase(name),\n content: await compile(schema, name),\n }\n return new MessageModule(def)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAwB;AACxB,mBAAuB;AACvB,oBAAkC;AAG3B,MAAM,sBAAsB,qBAAO;AAAA,EACxC,aAAoB,OAAO,MAAc,SAA0C;AACjF,UAAM,SAAS,QAAQ,UAAU,CAAC;AAClC,UAAM,MAAiB;AAAA,MACrB,MAAM,GAAG;AAAA,MACT,YAAY,oBAAO,GAAG,WAAW,IAAI;AAAA,MACrC,SAAS,UAAM,0CAAQ,QAAQ,IAAI;AAAA,IACrC;AACA,WAAO,IAAI,cAAc,GAAG;AAAA,EAC9B;AACF;",
6
- "names": []
7
- }