@botpress/cli 4.6.0 → 4.8.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 (28) hide show
  1. package/.turbo/turbo-build.log +10 -10
  2. package/dist/api/bot-body.js +6 -2
  3. package/dist/api/bot-body.js.map +2 -2
  4. package/dist/api/client.js +7 -0
  5. package/dist/api/client.js.map +2 -2
  6. package/dist/api/integration-body.js +5 -2
  7. package/dist/api/integration-body.js.map +2 -2
  8. package/dist/api/interface-body.js +5 -2
  9. package/dist/api/interface-body.js.map +2 -2
  10. package/dist/api/plugin-body.js +5 -2
  11. package/dist/api/plugin-body.js.map +2 -2
  12. package/dist/code-generation/integration-package/integration-package-definition/index.js +2 -0
  13. package/dist/code-generation/integration-package/integration-package-definition/index.js.map +2 -2
  14. package/dist/code-generation/interface-package/interface-package-definition/index.js +3 -0
  15. package/dist/code-generation/interface-package/interface-package-definition/index.js.map +2 -2
  16. package/dist/code-generation/plugin-package/plugin-package-definition/index.js +2 -0
  17. package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +2 -2
  18. package/dist/code-generation/typings.js.map +1 -1
  19. package/dist/command-implementations/plugin-commands.js +2 -2
  20. package/dist/command-implementations/plugin-commands.js.map +2 -2
  21. package/dist/command-implementations/project-command.js +6 -1
  22. package/dist/command-implementations/project-command.js.map +2 -2
  23. package/package.json +3 -3
  24. package/templates/empty-bot/package.json +2 -2
  25. package/templates/empty-integration/package.json +2 -2
  26. package/templates/empty-plugin/package.json +1 -1
  27. package/templates/hello-world/package.json +2 -2
  28. package/templates/webhook-message/package.json +2 -2
@@ -1,32 +1,32 @@
1
1
 
2
- > @botpress/cli@4.6.0 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@4.8.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@4.6.0 bundle /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@4.8.0 bundle /home/runner/work/botpress/botpress/packages/cli
7
7
  > ts-node -T build.ts
8
8
 
9
9
 
10
- > @botpress/cli@4.6.0 template:gen /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@4.8.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 v4.6.0
14
- 🤖 Botpress CLI v4.6.0
15
- 🤖 Botpress CLI v4.6.0
16
- 🤖 Botpress CLI v4.6.0
17
- ○ Generating typings for plugin empty-plugin...
13
+ 🤖 Botpress CLI v4.8.0
14
+ 🤖 Botpress CLI v4.8.0
15
+ 🤖 Botpress CLI v4.8.0
16
+ 🤖 Botpress CLI v4.8.0
18
17
  ○ Generating typings for bot...
19
18
  ✓ Typings available at .botpress
20
19
 
20
+ ○ Generating typings for integration empty-integration...
21
21
  ✓ Typings available at .botpress
22
22
 
23
- ○ Generating typings for integration empty-integration...
23
+ ○ Generating typings for plugin empty-plugin...
24
24
  ✓ Typings available at .botpress
25
25
 
26
26
  ○ Generating typings for integration hello-world...
27
27
  ✓ Typings available at .botpress
28
28
 
29
- 🤖 Botpress CLI v4.6.0
29
+ 🤖 Botpress CLI v4.8.0
30
30
  ○ Generating typings for integration webhook-message...
31
31
  ✓ Typings available at .botpress
32
32
 
@@ -63,7 +63,8 @@ const prepareCreateBotBody = async (bot) => ({
63
63
  schema: await utils.schema.mapZodToJsonSchema(state)
64
64
  })),
65
65
  ({ type }) => type !== "workflow"
66
- ) : void 0
66
+ ) : void 0,
67
+ tags: bot.attributes
67
68
  });
68
69
  const prepareUpdateBotBody = (localBot, remoteBot) => ({
69
70
  ...localBot,
@@ -89,7 +90,10 @@ const prepareUpdateBotBody = (localBot, remoteBot) => ({
89
90
  ...localBot.message,
90
91
  tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags)
91
92
  },
92
- integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations)
93
+ integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),
94
+ plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),
95
+ tags: localBot.tags
96
+ // TODO: allow removing bot tags (aka attributes) by setting to null
93
97
  });
94
98
  // Annotate the CommonJS export names for ESM import in node:
95
99
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/bot-body.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateBotBody = async (bot: sdk.BotDefinition): Promise<types.CreateBotRequestBody> => ({\n user: bot.user,\n conversation: bot.conversation,\n message: bot.message,\n recurringEvents: bot.recurringEvents,\n actions: bot.actions\n ? await utils.records.mapValuesAsync(bot.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n configuration: bot.configuration\n ? {\n ...bot.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.configuration),\n }\n : undefined,\n events: bot.events\n ? await utils.records.mapValuesAsync(bot.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n states: bot.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(bot.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreateBotRequestBody['states'])\n : undefined,\n})\n\nexport const prepareUpdateBotBody = (\n localBot: types.UpdateBotRequestBody,\n remoteBot: client.Bot\n): types.UpdateBotRequestBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n remoteItems: remoteBot.events,\n }),\n actions: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions),\n remoteItems: remoteBot.actions,\n }),\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;AAGhB,MAAM,uBAAuB,OAAO,SAAiE;AAAA,EAC1G,MAAM,IAAI;AAAA,EACV,cAAc,IAAI;AAAA,EAClB,SAAS,IAAI;AAAA,EACb,iBAAiB,IAAI;AAAA,EACrB,SAAS,IAAI,UACT,MAAM,MAAM,QAAQ,eAAe,IAAI,SAAS,OAAO,YAAY;AAAA,IACjE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF;AAAA,EACJ,eAAe,IAAI,gBACf;AAAA,IACE,GAAG,IAAI;AAAA,IACP,QAAQ,MAAM,MAAM,OAAO,mBAAmB,IAAI,aAAa;AAAA,EACjE,IACA;AAAA,EACJ,QAAQ,IAAI,SACR,MAAM,MAAM,QAAQ,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AAAA,EAC5F;AAAA,EACA,cAAc,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAClG;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateBotBody = async (bot: sdk.BotDefinition): Promise<types.CreateBotRequestBody> => ({\n user: bot.user,\n conversation: bot.conversation,\n message: bot.message,\n recurringEvents: bot.recurringEvents,\n actions: bot.actions\n ? await utils.records.mapValuesAsync(bot.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n configuration: bot.configuration\n ? {\n ...bot.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.configuration),\n }\n : undefined,\n events: bot.events\n ? await utils.records.mapValuesAsync(bot.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n states: bot.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(bot.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreateBotRequestBody['states'])\n : undefined,\n tags: bot.attributes,\n})\n\nexport const prepareUpdateBotBody = (\n localBot: types.UpdateBotRequestBody,\n remoteBot: client.Bot\n): types.UpdateBotRequestBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n remoteItems: remoteBot.events,\n }),\n actions: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions),\n remoteItems: remoteBot.actions,\n }),\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 plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),\n tags: localBot.tags, // TODO: allow removing bot tags (aka attributes) by setting to null\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,uBAAuB,OAAO,SAAiE;AAAA,EAC1G,MAAM,IAAI;AAAA,EACV,cAAc,IAAI;AAAA,EAClB,SAAS,IAAI;AAAA,EACb,iBAAiB,IAAI;AAAA,EACrB,SAAS,IAAI,UACT,MAAM,MAAM,QAAQ,eAAe,IAAI,SAAS,OAAO,YAAY;AAAA,IACjE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF;AAAA,EACJ,eAAe,IAAI,gBACf;AAAA,IACE,GAAG,IAAI;AAAA,IACP,QAAQ,MAAM,MAAM,OAAO,mBAAmB,IAAI,aAAa;AAAA,EACjE,IACA;AAAA,EACJ,QAAQ,IAAI,SACR,MAAM,MAAM,QAAQ,eAAe,IAAI,QAAQ,OAAO,WAAW;AAAA,IAC/D,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,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SAAS,MAAM,QAAQ,uBAAuB,SAAS,SAAS,UAAU,OAAO;AAAA,EACjF,MAAM,SAAS;AAAA;AACjB;",
6
6
  "names": []
7
7
  }
@@ -158,6 +158,13 @@ class ApiClient {
158
158
  }
159
159
  return this.client.getPublicPlugin(ref).then((r) => ({ ...r.plugin, public: true })).catch(this._returnUndefinedOnError("ResourceNotFound"));
160
160
  }
161
+ async getPublicOrPrivatePlugin(ref) {
162
+ const plugin = await this.findPublicOrPrivatePlugin(ref);
163
+ if (!plugin) {
164
+ throw new Error(`Plugin "${(0, import_package_ref.formatPackageRef)(ref)}" not found`);
165
+ }
166
+ return plugin;
167
+ }
161
168
  async findPublicOrPrivatePlugin(ref) {
162
169
  const formatted = (0, import_package_ref.formatPackageRef)(ref);
163
170
  const privatePlugin = await this.findPrivatePlugin(ref);
@@ -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 yn from 'yn'\nimport type { Logger } from '../logger'\nimport { formatPackageRef, ApiPackageRef, NamePackageRef } from '../package-ref'\nimport * as utils from '../utils'\nimport { findPreviousIntegrationVersion } from './find-previous-version'\nimport * as paging from './paging'\n\nimport {\n ApiClientProps,\n PublicIntegration,\n PrivateIntegration,\n PublicOrPrivateIntegration,\n PublicInterface,\n PrivateInterface,\n PublicOrPrivateInterface,\n PrivatePlugin,\n PublicPlugin,\n PublicOrPrivatePlugin,\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 public readonly botId?: string\n\n public static newClient = (props: ApiClientProps, logger: Logger) => new ApiClient(props, logger)\n\n public constructor(\n props: ApiClientProps,\n private _logger: Logger\n ) {\n const { apiUrl, token, workspaceId, botId } = props\n this.client = new client.Client({ apiUrl, token, workspaceId, botId })\n this.url = apiUrl\n this.token = token\n this.workspaceId = workspaceId\n this.botId = botId\n }\n\n public get isBotpressWorkspace(): boolean {\n // this environment variable is undocumented and only used internally for dev purposes\n const isBotpressWorkspace = yn(process.env.BP_IS_BOTPRESS_WORKSPACE)\n if (isBotpressWorkspace !== undefined) {\n return isBotpressWorkspace\n }\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<client.ClientOutputs['getWorkspace']> {\n return this.client.getWorkspace({ id: this.workspaceId })\n }\n\n public async findWorkspaceByHandle(handle: string): Promise<client.ClientOutputs['getWorkspace'] | undefined> {\n const { workspaces } = await this.client.listWorkspaces({ handle })\n return workspaces[0] // There should be only one workspace with a given handle\n }\n\n public switchWorkspace(workspaceId: string): ApiClient {\n return ApiClient.newClient({ apiUrl: this.url, token: this.token, workspaceId }, this._logger)\n }\n\n public switchBot(botId: string): ApiClient {\n return ApiClient.newClient(\n { apiUrl: this.url, token: this.token, botId, workspaceId: this.workspaceId },\n this._logger\n )\n }\n\n public async updateWorkspace(\n props: utils.types.SafeOmit<client.ClientInputs['updateWorkspace'], 'id'>\n ): Promise<client.ClientOutputs['updateWorkspace']> {\n return this.client.updateWorkspace({ id: this.workspaceId, ...props })\n }\n\n public async getPublicOrPrivateIntegration(ref: ApiPackageRef): Promise<PublicOrPrivateIntegration> {\n const integration = await this.findPublicOrPrivateIntegration(ref)\n if (!integration) {\n throw new Error(`Integration \"${formatPackageRef(ref)}\" not found`)\n }\n return integration\n }\n\n public async findPublicOrPrivateIntegration(ref: ApiPackageRef): Promise<PublicOrPrivateIntegration | 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, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getPublicIntegration(ref)\n .then((r) => ({ ...r.integration, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicOrPrivateInterface(ref: ApiPackageRef): Promise<PublicOrPrivateInterface | undefined> {\n const formatted = formatPackageRef(ref)\n\n const privateInterface = await this.findPrivateInterface(ref)\n if (privateInterface) {\n this._logger.debug(`Found interface \"${formatted}\" in workspace`)\n return privateInterface\n }\n\n const publicInterface = await this.findPublicInterface(ref)\n if (publicInterface) {\n this._logger.debug(`Found interface \"${formatted}\" in hub`)\n return publicInterface\n }\n\n return\n }\n\n public async findPrivateInterface(ref: ApiPackageRef): Promise<PrivateInterface | undefined> {\n const { workspaceId } = this\n if (ref.type === 'id') {\n return this.client\n .getInterface(ref)\n .then((r) => ({ ...r.interface, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getInterfaceByName(ref)\n .then((r) => ({ ...r.interface, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async getPublicInterface(ref: ApiPackageRef): Promise<PublicInterface> {\n const intrface = await this.findPublicInterface(ref)\n if (!intrface) {\n throw new Error(`Interface \"${formatPackageRef(ref)}\" not found`)\n }\n return intrface\n }\n\n public async findPublicInterface(ref: ApiPackageRef): Promise<PublicInterface | undefined> {\n if (ref.type === 'id') {\n return this.client\n .getPublicInterfaceById(ref)\n .then((r) => ({ ...r.interface, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n return this.client\n .getPublicInterface(ref)\n .then((r) => ({ ...r.interface, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicPlugin(ref: ApiPackageRef): Promise<PublicPlugin | undefined> {\n if (ref.type === 'id') {\n return this.client\n .getPublicPluginById(ref)\n .then((r) => ({ ...r.plugin, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n return this.client\n .getPublicPlugin(ref)\n .then((r) => ({ ...r.plugin, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicOrPrivatePlugin(ref: ApiPackageRef): Promise<PublicOrPrivatePlugin | undefined> {\n const formatted = formatPackageRef(ref)\n\n const privatePlugin = await this.findPrivatePlugin(ref)\n if (privatePlugin) {\n this._logger.debug(`Found plugin \"${formatted}\" in workspace`)\n return privatePlugin\n }\n\n const publicPlugin = await this.findPublicPlugin(ref)\n if (publicPlugin) {\n this._logger.debug(`Found plugin \"${formatted}\" in hub`)\n return publicPlugin\n }\n\n return\n }\n\n public async findPrivatePlugin(ref: ApiPackageRef): Promise<PrivatePlugin | undefined> {\n const { workspaceId } = this\n if (ref.type === 'id') {\n return this.client\n .getPlugin(ref)\n .then((r) => ({ ...r.plugin, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getPluginByName(ref)\n .then((r) => ({ ...r.plugin, workspaceId }))\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<PublicOrPrivateIntegration | undefined> {\n const previous = await findPreviousIntegrationVersion(this.client, ref)\n if (!previous) {\n return\n }\n return this.findPublicOrPrivateIntegration({ 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,aAAwB;AACxB,gBAAe;AAEf,yBAAgE;AAEhE,mCAA+C;AAC/C,aAAwB;AAgBxB,2BAAc,oBAtBd;AA2BO,MAAM,UAAU;AAAA,EASd,YACL,OACQ,SACR;AADQ;AAER,UAAM,EAAE,QAAQ,OAAO,aAAa,MAAM,IAAI;AAC9C,SAAK,SAAS,IAAI,OAAO,OAAO,EAAE,QAAQ,OAAO,aAAa,MAAM,CAAC;AACrE,SAAK,MAAM;AACX,SAAK,QAAQ;AACb,SAAK,cAAc;AACnB,SAAK,QAAQ;AAAA,EACf;AAAA,EAlBgB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEhB,OAAc,YAAY,CAAC,OAAuB,WAAmB,IAAI,UAAU,OAAO,MAAM;AAAA,EAchG,IAAW,sBAA+B;AAExC,UAAM,0BAAsB,UAAAA,SAAG,QAAQ,IAAI,wBAAwB;AACnE,QAAI,wBAAwB,QAAW;AACrC,aAAO;AAAA,IACT;AACA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF,EAAE,SAAS,KAAK,WAAW;AAAA,EAC7B;AAAA,EAEA,MAAa,eAA8D;AACzE,WAAO,KAAK,OAAO,aAAa,EAAE,IAAI,KAAK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SAAS,MAAM;AACrD;AAAA,IACF;AACA,UAAM;AAAA,EACR;AACJ;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport yn from 'yn'\nimport type { Logger } from '../logger'\nimport { formatPackageRef, ApiPackageRef, NamePackageRef } from '../package-ref'\nimport * as utils from '../utils'\nimport { findPreviousIntegrationVersion } from './find-previous-version'\nimport * as paging from './paging'\n\nimport {\n ApiClientProps,\n PublicIntegration,\n PrivateIntegration,\n PublicOrPrivateIntegration,\n PublicInterface,\n PrivateInterface,\n PublicOrPrivateInterface,\n PrivatePlugin,\n PublicPlugin,\n PublicOrPrivatePlugin,\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 public readonly botId?: string\n\n public static newClient = (props: ApiClientProps, logger: Logger) => new ApiClient(props, logger)\n\n public constructor(\n props: ApiClientProps,\n private _logger: Logger\n ) {\n const { apiUrl, token, workspaceId, botId } = props\n this.client = new client.Client({ apiUrl, token, workspaceId, botId })\n this.url = apiUrl\n this.token = token\n this.workspaceId = workspaceId\n this.botId = botId\n }\n\n public get isBotpressWorkspace(): boolean {\n // this environment variable is undocumented and only used internally for dev purposes\n const isBotpressWorkspace = yn(process.env.BP_IS_BOTPRESS_WORKSPACE)\n if (isBotpressWorkspace !== undefined) {\n return isBotpressWorkspace\n }\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<client.ClientOutputs['getWorkspace']> {\n return this.client.getWorkspace({ id: this.workspaceId })\n }\n\n public async findWorkspaceByHandle(handle: string): Promise<client.ClientOutputs['getWorkspace'] | undefined> {\n const { workspaces } = await this.client.listWorkspaces({ handle })\n return workspaces[0] // There should be only one workspace with a given handle\n }\n\n public switchWorkspace(workspaceId: string): ApiClient {\n return ApiClient.newClient({ apiUrl: this.url, token: this.token, workspaceId }, this._logger)\n }\n\n public switchBot(botId: string): ApiClient {\n return ApiClient.newClient(\n { apiUrl: this.url, token: this.token, botId, workspaceId: this.workspaceId },\n this._logger\n )\n }\n\n public async updateWorkspace(\n props: utils.types.SafeOmit<client.ClientInputs['updateWorkspace'], 'id'>\n ): Promise<client.ClientOutputs['updateWorkspace']> {\n return this.client.updateWorkspace({ id: this.workspaceId, ...props })\n }\n\n public async getPublicOrPrivateIntegration(ref: ApiPackageRef): Promise<PublicOrPrivateIntegration> {\n const integration = await this.findPublicOrPrivateIntegration(ref)\n if (!integration) {\n throw new Error(`Integration \"${formatPackageRef(ref)}\" not found`)\n }\n return integration\n }\n\n public async findPublicOrPrivateIntegration(ref: ApiPackageRef): Promise<PublicOrPrivateIntegration | 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, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getPublicIntegration(ref)\n .then((r) => ({ ...r.integration, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicOrPrivateInterface(ref: ApiPackageRef): Promise<PublicOrPrivateInterface | undefined> {\n const formatted = formatPackageRef(ref)\n\n const privateInterface = await this.findPrivateInterface(ref)\n if (privateInterface) {\n this._logger.debug(`Found interface \"${formatted}\" in workspace`)\n return privateInterface\n }\n\n const publicInterface = await this.findPublicInterface(ref)\n if (publicInterface) {\n this._logger.debug(`Found interface \"${formatted}\" in hub`)\n return publicInterface\n }\n\n return\n }\n\n public async findPrivateInterface(ref: ApiPackageRef): Promise<PrivateInterface | undefined> {\n const { workspaceId } = this\n if (ref.type === 'id') {\n return this.client\n .getInterface(ref)\n .then((r) => ({ ...r.interface, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getInterfaceByName(ref)\n .then((r) => ({ ...r.interface, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async getPublicInterface(ref: ApiPackageRef): Promise<PublicInterface> {\n const intrface = await this.findPublicInterface(ref)\n if (!intrface) {\n throw new Error(`Interface \"${formatPackageRef(ref)}\" not found`)\n }\n return intrface\n }\n\n public async findPublicInterface(ref: ApiPackageRef): Promise<PublicInterface | undefined> {\n if (ref.type === 'id') {\n return this.client\n .getPublicInterfaceById(ref)\n .then((r) => ({ ...r.interface, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n return this.client\n .getPublicInterface(ref)\n .then((r) => ({ ...r.interface, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async findPublicPlugin(ref: ApiPackageRef): Promise<PublicPlugin | undefined> {\n if (ref.type === 'id') {\n return this.client\n .getPublicPluginById(ref)\n .then((r) => ({ ...r.plugin, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n return this.client\n .getPublicPlugin(ref)\n .then((r) => ({ ...r.plugin, public: true }) as const)\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n\n public async getPublicOrPrivatePlugin(ref: ApiPackageRef): Promise<PublicOrPrivatePlugin> {\n const plugin = await this.findPublicOrPrivatePlugin(ref)\n if (!plugin) {\n throw new Error(`Plugin \"${formatPackageRef(ref)}\" not found`)\n }\n return plugin\n }\n\n public async findPublicOrPrivatePlugin(ref: ApiPackageRef): Promise<PublicOrPrivatePlugin | undefined> {\n const formatted = formatPackageRef(ref)\n\n const privatePlugin = await this.findPrivatePlugin(ref)\n if (privatePlugin) {\n this._logger.debug(`Found plugin \"${formatted}\" in workspace`)\n return privatePlugin\n }\n\n const publicPlugin = await this.findPublicPlugin(ref)\n if (publicPlugin) {\n this._logger.debug(`Found plugin \"${formatted}\" in hub`)\n return publicPlugin\n }\n\n return\n }\n\n public async findPrivatePlugin(ref: ApiPackageRef): Promise<PrivatePlugin | undefined> {\n const { workspaceId } = this\n if (ref.type === 'id') {\n return this.client\n .getPlugin(ref)\n .then((r) => ({ ...r.plugin, workspaceId }))\n .catch(this._returnUndefinedOnError('ResourceNotFound'))\n }\n return this.client\n .getPluginByName(ref)\n .then((r) => ({ ...r.plugin, workspaceId }))\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<PublicOrPrivateIntegration | undefined> {\n const previous = await findPreviousIntegrationVersion(this.client, ref)\n if (!previous) {\n return\n }\n return this.findPublicOrPrivateIntegration({ 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 }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AAc;AAChB,WAAK,QAAQ,MAAM,iBAAiB,mBAAmB;AACvD,aAAO;AAAA,IACT;AAEA;AAAA,EACF;AAAA,EAEA,MAAa,kBAAkB,KAAwD;AACrF,UAAM,EAAE,YAAY,IAAI;AACxB,QAAI,IAAI,SAAS,MAAM;AACrB,aAAO,KAAK,OACT,UAAU,GAAG,EACb,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,YAAY,EAAE,EAC1C,MAAM,KAAK,wBAAwB,kBAAkB,CAAC;AAAA,IAC3D;AACA,WAAO,KAAK,OACT,gBAAgB,GAAG,EACnB,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,YAAY,EAAE,EAC1C,MAAM,KAAK,wBAAwB,kBAAkB,CAAC;AAAA,EAC3D;AAAA,EAEA,MAAa,YAA2B;AACtC,UAAM,KAAK,OAAO,SAAS,CAAC,CAAC;AAAA,EAC/B;AAAA,EAEO,eAAe,OAAO;AAAA,EAE7B,MAAa,+BAA+B,KAAsE;AAChH,UAAM,WAAW,UAAM,6DAA+B,KAAK,QAAQ,GAAG;AACtE,QAAI,CAAC,UAAU;AACb;AAAA,IACF;AACA,WAAO,KAAK,+BAA+B,EAAE,MAAM,MAAM,IAAI,SAAS,GAAG,CAAC;AAAA,EAC5E;AAAA,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
6
  "names": ["yn"]
7
7
  }
@@ -68,7 +68,8 @@ const prepareCreateIntegrationBody = async (integration) => ({
68
68
  entities: integration.entities ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({
69
69
  ...entity,
70
70
  schema: await utils.schema.mapZodToJsonSchema(entity)
71
- })) : void 0
71
+ })) : void 0,
72
+ attributes: integration.attributes
72
73
  });
73
74
  const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
74
75
  const actions = utils.attributes.prepareAttributeUpdateBody({
@@ -93,6 +94,7 @@ const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
93
94
  );
94
95
  const readme = localIntegration.readme;
95
96
  const icon = localIntegration.icon;
97
+ const attributes = utils.records.setNullOnMissingValues(localIntegration.attributes, remoteIntegration.attributes);
96
98
  return {
97
99
  ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),
98
100
  actions,
@@ -104,7 +106,8 @@ const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
104
106
  interfaces,
105
107
  configurations,
106
108
  readme,
107
- icon
109
+ icon,
110
+ attributes
108
111
  };
109
112
  };
110
113
  const _maybeRemoveVrlScripts = (localIntegration, remoteIntegration) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/integration-body.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateIntegrationBody = async (\n integration: sdk.IntegrationDefinition | sdk.IntegrationPackage['definition']\n): Promise<types.CreateIntegrationRequestBody> => ({\n name: integration.name,\n version: integration.version,\n title: 'title' in integration ? integration.title : undefined,\n description: 'description' in integration ? integration.description : undefined,\n user: integration.user,\n events: integration.events\n ? await utils.records.mapValuesAsync(integration.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: integration.actions\n ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n channels: integration.channels\n ? await utils.records.mapValuesAsync(integration.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : undefined,\n states: integration.states\n ? await utils.records.mapValuesAsync(integration.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n entities: integration.entities\n ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : undefined,\n})\n\ntype UpdateIntegrationChannelsBody = NonNullable<types.UpdateIntegrationRequestBody['channels']>\ntype UpdateIntegrationChannelBody = UpdateIntegrationChannelsBody[string]\ntype Channels = client.Integration['channels']\ntype Channel = client.Integration['channels'][string]\nexport const prepareUpdateIntegrationBody = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions),\n remoteItems: remoteIntegration.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events),\n remoteItems: remoteIntegration.events,\n })\n const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states)\n const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities)\n const user = {\n ...localIntegration.user,\n tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags),\n }\n\n const channels = _prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels)\n\n const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces)\n\n const configurations = utils.records.setNullOnMissingValues(\n localIntegration.configurations,\n remoteIntegration.configurations\n )\n\n const readme = localIntegration.readme\n const icon = localIntegration.icon\n return {\n ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\n readme,\n icon,\n }\n}\n\nconst _maybeRemoveVrlScripts = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const newIntegration = structuredClone(localIntegration)\n\n if (\n remoteIntegration.configuration?.identifier?.linkTemplateScript &&\n !localIntegration.configuration?.identifier?.linkTemplateScript\n ) {\n newIntegration.configuration ??= remoteIntegration.configuration\n newIntegration.configuration.identifier ??= remoteIntegration.configuration.identifier\n newIntegration.configuration.identifier.linkTemplateScript = null\n newIntegration.configuration.identifier.required = false\n }\n\n if (remoteIntegration.identifier.extractScript && !localIntegration.identifier?.extractScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.extractScript = null\n }\n\n if (remoteIntegration.identifier.fallbackHandlerScript && !localIntegration.identifier?.fallbackHandlerScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.fallbackHandlerScript = null\n }\n\n for (const configName of Object.keys(localIntegration.configurations ?? {})) {\n if (\n remoteIntegration.configurations[configName]?.identifier.linkTemplateScript &&\n !localIntegration.configurations?.[configName]?.identifier?.linkTemplateScript\n ) {\n newIntegration.configurations ??= remoteIntegration.configurations\n newIntegration.configurations[configName] ??= remoteIntegration.configurations[configName]\n newIntegration.configurations[configName].identifier ??= remoteIntegration.configurations[configName].identifier\n newIntegration.configurations[configName].identifier.linkTemplateScript = null\n newIntegration.configurations[configName].identifier.required = false\n }\n }\n\n return newIntegration\n}\n\nconst _prepareUpdateIntegrationChannelsBody = (\n localChannels: UpdateIntegrationChannelsBody,\n remoteChannels: Channels\n): UpdateIntegrationChannelsBody => {\n const channelBody: UpdateIntegrationChannelsBody = {}\n\n const zipped = utils.records.zipObjects(localChannels, remoteChannels)\n for (const [channelName, [localChannel, remoteChannel]] of Object.entries(zipped)) {\n if (localChannel && remoteChannel) {\n // channel has to be updated\n channelBody[channelName] = _prepareUpdateIntegrationChannelBody(localChannel, remoteChannel)\n } else if (localChannel) {\n // channel has to be created\n channelBody[channelName] = localChannel\n continue\n } else if (remoteChannel) {\n // channel has to be deleted\n channelBody[channelName] = null\n continue\n }\n }\n\n return channelBody\n}\n\nconst _prepareUpdateIntegrationChannelBody = (\n localChannel: UpdateIntegrationChannelBody,\n remoteChannel: Channel\n): UpdateIntegrationChannelBody => ({\n ...localChannel,\n messages: utils.records.setNullOnMissingValues(localChannel?.messages, remoteChannel.messages),\n message: {\n ...localChannel?.message,\n tags: utils.records.setNullOnMissingValues(localChannel?.message?.tags, remoteChannel.message.tags),\n },\n conversation: {\n ...localChannel?.conversation,\n tags: utils.records.setNullOnMissingValues(localChannel?.conversation?.tags, remoteChannel.conversation.tags),\n },\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,+BAA+B,OAC1C,iBACiD;AAAA,EACjD,MAAM,YAAY;AAAA,EAClB,SAAS,YAAY;AAAA,EACrB,OAAO,WAAW,cAAc,YAAY,QAAQ;AAAA,EACpD,aAAa,iBAAiB,cAAc,YAAY,cAAc;AAAA,EACtE,MAAM,YAAY;AAAA,EAClB,QAAQ,YAAY,SAChB,MAAM,MAAM,QAAQ,eAAe,YAAY,QAAQ,OAAO,WAAW;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AAAA,EACJ,SAAS,YAAY,UACjB,MAAM,MAAM,QAAQ,eAAe,YAAY,SAAS,OAAO,YAAY;AAAA,IACzE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA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utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateIntegrationBody = async (\n integration: sdk.IntegrationDefinition | sdk.IntegrationPackage['definition']\n): Promise<types.CreateIntegrationRequestBody> => ({\n name: integration.name,\n version: integration.version,\n title: 'title' in integration ? integration.title : undefined,\n description: 'description' in integration ? integration.description : undefined,\n user: integration.user,\n events: integration.events\n ? await utils.records.mapValuesAsync(integration.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: integration.actions\n ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n channels: integration.channels\n ? await utils.records.mapValuesAsync(integration.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : undefined,\n states: integration.states\n ? await utils.records.mapValuesAsync(integration.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n entities: integration.entities\n ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : undefined,\n attributes: integration.attributes,\n})\n\ntype UpdateIntegrationChannelsBody = NonNullable<types.UpdateIntegrationRequestBody['channels']>\ntype UpdateIntegrationChannelBody = UpdateIntegrationChannelsBody[string]\ntype Channels = client.Integration['channels']\ntype Channel = client.Integration['channels'][string]\nexport const prepareUpdateIntegrationBody = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions),\n remoteItems: remoteIntegration.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events),\n remoteItems: remoteIntegration.events,\n })\n const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states)\n const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities)\n const user = {\n ...localIntegration.user,\n tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags),\n }\n\n const channels = _prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels)\n\n const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces)\n\n const configurations = utils.records.setNullOnMissingValues(\n localIntegration.configurations,\n remoteIntegration.configurations\n )\n\n const readme = localIntegration.readme\n const icon = localIntegration.icon\n\n const attributes = utils.records.setNullOnMissingValues(localIntegration.attributes, remoteIntegration.attributes)\n\n return {\n ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\n readme,\n icon,\n attributes,\n }\n}\n\nconst _maybeRemoveVrlScripts = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const newIntegration = structuredClone(localIntegration)\n\n if (\n remoteIntegration.configuration?.identifier?.linkTemplateScript &&\n !localIntegration.configuration?.identifier?.linkTemplateScript\n ) {\n newIntegration.configuration ??= remoteIntegration.configuration\n newIntegration.configuration.identifier ??= remoteIntegration.configuration.identifier\n newIntegration.configuration.identifier.linkTemplateScript = null\n newIntegration.configuration.identifier.required = false\n }\n\n if (remoteIntegration.identifier.extractScript && !localIntegration.identifier?.extractScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.extractScript = null\n }\n\n if (remoteIntegration.identifier.fallbackHandlerScript && !localIntegration.identifier?.fallbackHandlerScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.fallbackHandlerScript = null\n }\n\n for (const configName of Object.keys(localIntegration.configurations ?? {})) {\n if (\n remoteIntegration.configurations[configName]?.identifier.linkTemplateScript &&\n !localIntegration.configurations?.[configName]?.identifier?.linkTemplateScript\n ) {\n newIntegration.configurations ??= remoteIntegration.configurations\n newIntegration.configurations[configName] ??= remoteIntegration.configurations[configName]\n newIntegration.configurations[configName].identifier ??= remoteIntegration.configurations[configName].identifier\n newIntegration.configurations[configName].identifier.linkTemplateScript = null\n newIntegration.configurations[configName].identifier.required = false\n }\n }\n\n return newIntegration\n}\n\nconst _prepareUpdateIntegrationChannelsBody = (\n localChannels: UpdateIntegrationChannelsBody,\n remoteChannels: Channels\n): UpdateIntegrationChannelsBody => {\n const channelBody: UpdateIntegrationChannelsBody = {}\n\n const zipped = utils.records.zipObjects(localChannels, remoteChannels)\n for (const [channelName, [localChannel, remoteChannel]] of Object.entries(zipped)) {\n if (localChannel && remoteChannel) {\n // channel has to be updated\n channelBody[channelName] = _prepareUpdateIntegrationChannelBody(localChannel, remoteChannel)\n } else if (localChannel) {\n // channel has to be created\n channelBody[channelName] = localChannel\n continue\n } else if (remoteChannel) {\n // channel has to be deleted\n channelBody[channelName] = null\n continue\n }\n }\n\n return channelBody\n}\n\nconst _prepareUpdateIntegrationChannelBody = (\n localChannel: UpdateIntegrationChannelBody,\n remoteChannel: Channel\n): UpdateIntegrationChannelBody => ({\n ...localChannel,\n messages: utils.records.setNullOnMissingValues(localChannel?.messages, remoteChannel.messages),\n message: {\n ...localChannel?.message,\n tags: utils.records.setNullOnMissingValues(localChannel?.message?.tags, remoteChannel.message.tags),\n },\n conversation: {\n ...localChannel?.conversation,\n tags: utils.records.setNullOnMissingValues(localChannel?.conversation?.tags, remoteChannel.conversation.tags),\n },\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,+BAA+B,OAC1C,iBACiD;AAAA,EACjD,M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Ae;AAEjC,kBAAY,WAAW,IAAI,qCAAqC,cAAc,aAAa;AAAA,IAC7F,WAAW,cAAc;AAEvB,kBAAY,WAAW,IAAI;AAC3B;AAAA,IACF,WAAW,eAAe;AAExB,kBAAY,WAAW,IAAI;AAC3B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,uCAAuC,CAC3C,cACA,mBACkC;AAAA,EAClC,GAAG;AAAA,EACH,UAAU,MAAM,QAAQ,uBAAuB,cAAc,UAAU,cAAc,QAAQ;AAAA,EAC7F,SAAS;AAAA,IACP,GAAG,cAAc;AAAA,IACjB,MAAM,MAAM,QAAQ,uBAAuB,cAAc,SAAS,MAAM,cAAc,QAAQ,IAAI;AAAA,EACpG;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,cAAc;AAAA,IACjB,MAAM,MAAM,QAAQ,uBAAuB,cAAc,cAAc,MAAM,cAAc,aAAa,IAAI;AAAA,EAC9G;AACF;",
6
6
  "names": []
7
7
  }
@@ -63,7 +63,8 @@ const prepareCreateInterfaceBody = async (intrface) => ({
63
63
  ...message,
64
64
  schema: await utils.schema.mapZodToJsonSchema(message)
65
65
  }))
66
- })) : {}
66
+ })) : {},
67
+ attributes: intrface.attributes
67
68
  });
68
69
  const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
69
70
  const actions = utils.attributes.prepareAttributeUpdateBody({
@@ -83,12 +84,14 @@ const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
83
84
  )
84
85
  })) : void 0;
85
86
  const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels);
87
+ const attributes = utils.records.setNullOnMissingValues(localInterface.attributes, remoteInterface.attributes);
86
88
  return {
87
89
  ...localInterface,
88
90
  entities,
89
91
  actions,
90
92
  events,
91
- channels
93
+ channels,
94
+ attributes
92
95
  };
93
96
  };
94
97
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/interface-body.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateInterfaceBody = async (\n intrface: sdk.InterfaceDefinition | sdk.InterfacePackage['definition']\n): Promise<types.CreateInterfaceRequestBody> => ({\n name: intrface.name,\n version: intrface.version,\n title: 'title' in intrface ? intrface.title : undefined,\n description: 'description' in intrface ? intrface.description : undefined,\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})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: types.CreateInterfaceRequestBody & { id: string },\n remoteInterface: client.Interface\n): types.UpdateInterfaceRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),\n remoteItems: remoteInterface.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events),\n remoteItems: remoteInterface.events,\n })\n const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities)\n\n const currentChannels: types.UpdateInterfaceRequestBody['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;AAGhB,MAAM,6BAA6B,OACxC,cAC+C;AAAA,EAC/C,MAAM,SAAS;AAAA,EACf,SAAS,SAAS;AAAA,EAClB,OAAO,WAAW,WAAW,SAAS,QAAQ;AAAA,EAC9C,aAAa,iBAAiB,WAAW,SAAS,cAAc;AAAA,EAChE,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,YAAY;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,MAAM;AAAA,EACtD,EAAE,IACF,CAAC;AAAA,EACL,QAAQ,SAAS,SACb,MAAM,MAAM,QAAQ,eAAe,SAAS,QAAQ,OAAO,WAAW;AAAA,IACpE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF,CAAC;AAAA,EACL,SAAS,SAAS,UACd,MAAM,MAAM,QAAQ,eAAe,SAAS,SAAS,OAAO,YAAY;AAAA,IACtE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF,CAAC;AAAA,EACL,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,aAAa;AAAA,IACxE,GAAG;AAAA,IACH,UAAU,MAAM,MAAM,QAAQ,eAAe,QAAQ,UAAU,OAAO,aAAa;AAAA,MACjF,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO;AAAA,IACvD,EAAE;AAAA,EACJ,EAAE,IACF,CAAC;AACP;AAEO,MAAM,6BAA6B,CACxC,gBACA,oBACqC;AACrC,QAAM,UAAU,MAAM,WAAW,2BAA2B;AAAA,IAC1D,YAAY,MAAM,QAAQ,uBAAuB,eAAe,SAAS,gBAAgB,OAAO;AAAA,IAChG,aAAa,gBAAgB;AAAA,EAC/B,CAAC;AACD,QAAM,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACzD,YAAY,MAAM,QAAQ,uBAAuB,eAAe,QAAQ,gBAAgB,MAAM;AAAA,IAC9F,aAAa,gBAAgB;AAAA,EAC/B,CAAC;AACD,QAAM,WAAW,MAAM,QAAQ,uBAAuB,eAAe,UAAU,gBAAgB,QAAQ;AAEvG,QAAM,kBAAgE,eAAe,WACjF,MAAM,QAAQ,UAAU,eAAe,UAAU,CAAC,SAAS,iBAAiB;AAAA,IAC1E,GAAG;AAAA,IACH,UAAU,MAAM,QAAQ;AAAA,MACtB,SAAS;AAAA,MACT,gBAAgB,SAAS,WAAW,GAAG;AAAA,IACzC;AAAA,EACF,EAAE,IACF;AAEJ,QAAM,WAAW,MAAM,QAAQ,uBAAuB,iBAAiB,gBAAgB,QAAQ;AAE/F,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateInterfaceBody = async (\n intrface: sdk.InterfaceDefinition | sdk.InterfacePackage['definition']\n): Promise<types.CreateInterfaceRequestBody> => ({\n name: intrface.name,\n version: intrface.version,\n title: 'title' in intrface ? intrface.title : undefined,\n description: 'description' in intrface ? intrface.description : undefined,\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 attributes: intrface.attributes,\n})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: types.CreateInterfaceRequestBody & { id: string },\n remoteInterface: client.Interface\n): types.UpdateInterfaceRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),\n remoteItems: remoteInterface.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events),\n remoteItems: remoteInterface.events,\n })\n const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities)\n\n const currentChannels: types.UpdateInterfaceRequestBody['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 const attributes = utils.records.setNullOnMissingValues(localInterface.attributes, remoteInterface.attributes)\n\n return {\n ...localInterface,\n entities,\n actions,\n events,\n channels,\n attributes,\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,6BAA6B,OACxC,cAC+C;AAAA,EAC/C,MAAM,SAAS;AAAA,EACf,SAAS,SAAS;AAAA,EAClB,OAAO,WAAW,WAAW,SAAS,QAAQ;AAAA,EAC9C,aAAa,iBAAiB,WAAW,SAAS,cAAc;AAAA,EAChE,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,YAAY;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,MAAM;AAAA,EACtD,EAAE,IACF,CAAC;AAAA,EACL,QAAQ,SAAS,SACb,MAAM,MAAM,QAAQ,eAAe,SAAS,QAAQ,OAAO,WAAW;AAAA,IACpE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF,CAAC;AAAA,EACL,SAAS,SAAS,UACd,MAAM,MAAM,QAAQ,eAAe,SAAS,SAAS,OAAO,YAAY;AAAA,IACtE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF,CAAC;AAAA,EACL,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,aAAa;AAAA,IACxE,GAAG;AAAA,IACH,UAAU,MAAM,MAAM,QAAQ,eAAe,QAAQ,UAAU,OAAO,aAAa;AAAA,MACjF,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO;AAAA,IACvD,EAAE;AAAA,EACJ,EAAE,IACF,CAAC;AAAA,EACL,YAAY,SAAS;AACvB;AAEO,MAAM,6BAA6B,CACxC,gBACA,oBACqC;AACrC,QAAM,UAAU,MAAM,WAAW,2BAA2B;AAAA,IAC1D,YAAY,MAAM,QAAQ,uBAAuB,eAAe,SAAS,gBAAgB,OAAO;AAAA,IAChG,aAAa,gBAAgB;AAAA,EAC/B,CAAC;AACD,QAAM,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACzD,YAAY,MAAM,QAAQ,uBAAuB,eAAe,QAAQ,gBAAgB,MAAM;AAAA,IAC9F,aAAa,gBAAgB;AAAA,EAC/B,CAAC;AACD,QAAM,WAAW,MAAM,QAAQ,uBAAuB,eAAe,UAAU,gBAAgB,QAAQ;AAEvG,QAAM,kBAAgE,eAAe,WACjF,MAAM,QAAQ,UAAU,eAAe,UAAU,CAAC,SAAS,iBAAiB;AAAA,IAC1E,GAAG;AAAA,IACH,UAAU,MAAM,QAAQ;AAAA,MACtB,SAAS;AAAA,MACT,gBAAgB,SAAS,WAAW,GAAG;AAAA,IACzC;AAAA,EACF,EAAE,IACF;AAEJ,QAAM,WAAW,MAAM,QAAQ,uBAAuB,iBAAiB,gBAAgB,QAAQ;AAE/F,QAAM,aAAa,MAAM,QAAQ,uBAAuB,eAAe,YAAY,gBAAgB,UAAU;AAE7G,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -69,7 +69,8 @@ const prepareCreatePluginBody = async (plugin) => ({
69
69
  schema: await utils.schema.mapZodToJsonSchema(state)
70
70
  })),
71
71
  ({ type }) => type !== "workflow"
72
- ) : void 0
72
+ ) : void 0,
73
+ attributes: plugin.attributes
73
74
  });
74
75
  const prepareUpdatePluginBody = (localPlugin, remotePlugin) => {
75
76
  const actions = utils.attributes.prepareAttributeUpdateBody({
@@ -81,13 +82,15 @@ const prepareUpdatePluginBody = (localPlugin, remotePlugin) => {
81
82
  remoteItems: remotePlugin.events
82
83
  });
83
84
  const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states);
85
+ const attributes = utils.records.setNullOnMissingValues(localPlugin.attributes, remotePlugin.attributes);
84
86
  return {
85
87
  ...localPlugin,
86
88
  actions,
87
89
  events,
88
90
  states,
89
- user: localPlugin.user
91
+ user: localPlugin.user,
90
92
  // TODO: allow deleting user tags with null
93
+ attributes
91
94
  };
92
95
  };
93
96
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/api/plugin-body.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreatePluginBody = async (\n plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']\n): Promise<types.CreatePluginRequestBody> => ({\n name: plugin.name,\n version: plugin.version,\n title: 'title' in plugin ? plugin.title : undefined,\n description: 'description' in plugin ? plugin.description : undefined,\n user: {\n tags: plugin.user?.tags ?? {},\n },\n conversation: {\n tags: plugin.conversation?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration),\n }\n : undefined,\n events: plugin.events\n ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: plugin.actions\n ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n states: plugin.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreatePluginRequestBody['states'])\n : undefined,\n})\n\nexport const prepareUpdatePluginBody = (\n localPlugin: types.UpdatePluginRequestBody,\n remotePlugin: client.Plugin\n): types.UpdatePluginRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions),\n remoteItems: remotePlugin.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events),\n remoteItems: remotePlugin.events,\n })\n const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states)\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n user: localPlugin.user, // TODO: allow deleting user tags with null\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,0BAA0B,OACrC,YAC4C;AAAA,EAC5C,MAAM,OAAO;AAAA,EACb,SAAS,OAAO;AAAA,EAChB,OAAO,WAAW,SAAS,OAAO,QAAQ;AAAA,EAC1C,aAAa,iBAAiB,SAAS,OAAO,cAAc;AAAA,EAC5D,MAAM;AAAA,IACJ,MAAM,OAAO,MAAM,QAAQ,CAAC;AAAA,EAC9B;AAAA,EACA,cAAc;AAAA,IACZ,MAAM,OAAO,cAAc,QAAQ,CAAC;AAAA,EACtC;AAAA,EACA,eAAe,OAAO,gBAClB;AAAA,IACE,GAAG,OAAO;AAAA,IACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,aAAa;AAAA,EACpE,IACA;AAAA,EACJ,QAAQ,OAAO,SACX,MAAM,MAAM,QAAQ,eAAe,OAAO,QAAQ,OAAO,WAAW;AAAA,IAClE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AAAA,EACJ,SAAS,OAAO,UACZ,MAAM,MAAM,QAAQ,eAAe,OAAO,SAAS,OAAO,YAAY;AAAA,IACpE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF;AAAA,EACJ,QAAQ,OAAO,SACV,MAAM,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,eAAe,OAAO,QAAQ,OAAO,WAAW;AAAA,MAClE,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,IACrD,EAAE;AAAA,IACF,CAAC,EAAE,KAAK,MAAM,SAAS;AAAA,EACzB,IACA;AACN;AAEO,MAAM,0BAA0B,CACrC,aACA,iBACkC;AAClC,QAAM,UAAU,MAAM,WAAW,2BAA2B;AAAA,IAC1D,YAAY,MAAM,QAAQ,uBAAuB,YAAY,SAAS,aAAa,OAAO;AAAA,IAC1F,aAAa,aAAa;AAAA,EAC5B,CAAC;AACD,QAAM,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACzD,YAAY,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAAA,IACxF,aAAa,aAAa;AAAA,EAC5B,CAAC;AACD,QAAM,SAAS,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAE3F,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,YAAY;AAAA;AAAA,EACpB;AACF;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreatePluginBody = async (\n plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']\n): Promise<types.CreatePluginRequestBody> => ({\n name: plugin.name,\n version: plugin.version,\n title: 'title' in plugin ? plugin.title : undefined,\n description: 'description' in plugin ? plugin.description : undefined,\n user: {\n tags: plugin.user?.tags ?? {},\n },\n conversation: {\n tags: plugin.conversation?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration),\n }\n : undefined,\n events: plugin.events\n ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: plugin.actions\n ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n states: plugin.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreatePluginRequestBody['states'])\n : undefined,\n attributes: plugin.attributes,\n})\n\nexport const prepareUpdatePluginBody = (\n localPlugin: types.UpdatePluginRequestBody,\n remotePlugin: client.Plugin\n): types.UpdatePluginRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions),\n remoteItems: remotePlugin.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events),\n remoteItems: remotePlugin.events,\n })\n const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states)\n\n const attributes = utils.records.setNullOnMissingValues(localPlugin.attributes, remotePlugin.attributes)\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n user: localPlugin.user, // TODO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,MAAM,OAAO,mBAAmB,KAAK;AAAA,IACrD,EAAE;AAAA,IACF,CAAC,EAAE,KAAK,MAAM,SAAS;AAAA,EACzB,IACA;AAAA,EACJ,YAAY,OAAO;AACrB;AAEO,MAAM,0BAA0B,CACrC,aACA,iBACkC;AAClC,QAAM,UAAU,MAAM,WAAW,2BAA2B;AAAA,IAC1D,YAAY,MAAM,QAAQ,uBAAuB,YAAY,SAAS,aAAa,OAAO;AAAA,IAC1F,aAAa,aAAa;AAAA,EAC5B,CAAC;AACD,QAAM,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACzD,YAAY,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAAA,IACxF,aAAa,aAAa;AAAA,EAC5B,CAAC;AACD,QAAM,SAAS,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAE3F,QAAM,aAAa,MAAM,QAAQ,uBAAuB,YAAY,YAAY,aAAa,UAAU;AAEvG,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,YAAY;AAAA;AAAA,IAClB;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -104,6 +104,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
104
104
  tags: this._integration.user?.tags ?? {},
105
105
  creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] }
106
106
  };
107
+ const integrationAttributes = this._integration.attributes ? (0, import_generators.stringifySingleLine)(this._integration.attributes) : "{}";
107
108
  content += [
108
109
  consts.GENERATED_HEADER,
109
110
  'import * as sdk from "@botpress/sdk"',
@@ -128,6 +129,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
128
129
  "export default {",
129
130
  ` name: "${this._integration.name}",`,
130
131
  ` version: "${this._integration.version}",`,
132
+ ` attributes: ${integrationAttributes},`,
131
133
  ` user: ${(0, import_generators.stringifySingleLine)(user)},`,
132
134
  ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,
133
135
  ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/integration-package/integration-package-definition/index.ts"],
4
- "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { ConfigurationsModule } from './configurations-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype IntegrationPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n configurationsModule: ConfigurationsModule\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n entitiesModule: EntitiesModule\n interfacesModule: InterfacesModule\n}\n\nexport class IntegrationPackageDefinitionModule extends Module {\n private _dependencies: IntegrationPackageModuleDependencies\n\n public constructor(private _integration: types.IntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_integration.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const configurationsModule = new ConfigurationsModule(_integration.configurations ?? {})\n configurationsModule.unshift('configurations')\n\n const actionsModule = new ActionsModule(_integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_integration.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_integration.states ?? {})\n statesModule.unshift('states')\n\n const entitiesModule = new EntitiesModule(_integration.entities ?? {})\n entitiesModule.unshift('entities')\n\n const interfacesModule = new InterfacesModule(_integration.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n this._dependencies = {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n } = this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const configurationsImport = configurationsModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n\n const user = {\n tags: this._integration.user?.tags ?? {},\n creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] },\n }\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._integration.name}\",`,\n ` version: \"${this._integration.version}\",`,\n ` user: ${stringifySingleLine(user)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n '} satisfies sdk.IntegrationPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,kCAA2C;AAC3C,mCAAqC;AACrC,6BAA+B;AAC/B,2BAA6B;AAC7B,+BAAiC;AACjC,2BAA6B;AActB,MAAM,2CAA2C,qBAAO;AAAA,EAGtD,YAAoB,cAA2C;AACpE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,aAAa,iBAAiB,CAAC,CAAC;AAC3F,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,uBAAuB,IAAI,kDAAqB,aAAa,kBAAkB,CAAC,CAAC;AACvF,yBAAqB,QAAQ,gBAAgB;AAE7C,UAAM,gBAAgB,IAAI,oCAAc,aAAa,WAAW,CAAC,CAAC;AAClE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,sCAAe,aAAa,YAAY,CAAC,CAAC;AACrE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,eAAe,IAAI,kCAAa,aAAa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MACA,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,qBAAqB,gBAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,qBAAqB,gBAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,aAAa;AAAA,MAC9B,eAAe,KAAK,aAAa;AAAA,MACjC,eAAW,uCAAoB,IAAI;AAAA,MACnC,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,qBAAqB,qBAAqB,QAAQ,qBAAqB;AAAA,MACvE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { ConfigurationsModule } from './configurations-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype IntegrationPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n configurationsModule: ConfigurationsModule\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n entitiesModule: EntitiesModule\n interfacesModule: InterfacesModule\n}\n\nexport class IntegrationPackageDefinitionModule extends Module {\n private _dependencies: IntegrationPackageModuleDependencies\n\n public constructor(private _integration: types.IntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_integration.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const configurationsModule = new ConfigurationsModule(_integration.configurations ?? {})\n configurationsModule.unshift('configurations')\n\n const actionsModule = new ActionsModule(_integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_integration.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_integration.states ?? {})\n statesModule.unshift('states')\n\n const entitiesModule = new EntitiesModule(_integration.entities ?? {})\n entitiesModule.unshift('entities')\n\n const interfacesModule = new InterfacesModule(_integration.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n this._dependencies = {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n } = this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const configurationsImport = configurationsModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n\n const user = {\n tags: this._integration.user?.tags ?? {},\n creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] },\n }\n\n const integrationAttributes = this._integration.attributes\n ? stringifySingleLine(this._integration.attributes)\n : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._integration.name}\",`,\n ` version: \"${this._integration.version}\",`,\n ` attributes: ${integrationAttributes},`,\n ` user: ${stringifySingleLine(user)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n '} satisfies sdk.IntegrationPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,kCAA2C;AAC3C,mCAAqC;AACrC,6BAA+B;AAC/B,2BAA6B;AAC7B,+BAAiC;AACjC,2BAA6B;AActB,MAAM,2CAA2C,qBAAO;AAAA,EAGtD,YAAoB,cAA2C;AACpE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,aAAa,iBAAiB,CAAC,CAAC;AAC3F,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,uBAAuB,IAAI,kDAAqB,aAAa,kBAAkB,CAAC,CAAC;AACvF,yBAAqB,QAAQ,gBAAgB;AAE7C,UAAM,gBAAgB,IAAI,oCAAc,aAAa,WAAW,CAAC,CAAC;AAClE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,sCAAe,aAAa,YAAY,CAAC,CAAC;AACrE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,eAAe,IAAI,kCAAa,aAAa,UAAU,CAAC,CAAC;AAC/D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,eAAe,IAAI,kCAAa,aAAa,UAAU,CAAC,CAAC;AAC/D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,iBAAiB,IAAI,sCAAe,aAAa,YAAY,CAAC,CAAC;AACrE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,mBAAmB,I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,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,qBAAqB,gBAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,aAAa;AAAA,MAC9B,eAAe,KAAK,aAAa;AAAA,MACjC,iBAAiB;AAAA,MACjB,eAAW,uCAAoB,IAAI;AAAA,MACnC,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,qBAAqB,qBAAqB,QAAQ,qBAAqB;AAAA,MACvE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -32,6 +32,7 @@ __export(interface_package_definition_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(interface_package_definition_exports);
34
34
  var consts = __toESM(require("../../consts"));
35
+ var import_generators = require("../../generators");
35
36
  var import_module = require("../../module");
36
37
  var import_actions_module = require("./actions-module");
37
38
  var import_channels_module = require("./channels-module");
@@ -70,6 +71,7 @@ class InterfacePackageDefinitionModule extends import_module.Module {
70
71
  const channelsImport = channelsModule.import(this);
71
72
  const eventsImport = eventsModule.import(this);
72
73
  const entitiesImport = entitiesModule.import(this);
74
+ const interfaceAttributes = this._interface.attributes ? (0, import_generators.stringifySingleLine)(this._interface.attributes) : "{}";
73
75
  content += [
74
76
  consts.GENERATED_HEADER,
75
77
  'import * as sdk from "@botpress/sdk"',
@@ -86,6 +88,7 @@ class InterfacePackageDefinitionModule extends import_module.Module {
86
88
  "export default {",
87
89
  ` name: "${this._interface.name}",`,
88
90
  ` version: "${this._interface.version}",`,
91
+ ` attributes: ${interfaceAttributes},`,
89
92
  ` actions: ${actionsModule.name}.${actionsModule.exportName},`,
90
93
  ` channels: ${channelsModule.name}.${channelsModule.exportName},`,
91
94
  ` events: ${eventsModule.name}.${eventsModule.exportName},`,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/index.ts"],
4
- "sourcesContent": ["import * as consts from '../../consts'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport * as types from './typings'\n\ntype InterfacePackageModuleDependencies = {\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n entitiesModule: EntitiesModule\n}\n\nexport class InterfacePackageDefinitionModule extends Module {\n private _dependencies: InterfacePackageModuleDependencies\n\n public constructor(private _interface: types.InterfaceDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const actionsModule = new ActionsModule(_interface.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_interface.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_interface.events ?? {})\n eventsModule.unshift('events')\n\n const entitiesModule = new EntitiesModule(_interface.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n actionsModule,\n channelsModule,\n eventsModule,\n entitiesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { actionsModule, channelsModule, eventsModule, entitiesModule } = this._dependencies\n\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._interface.name}\",`,\n ` version: \"${this._interface.version}\",`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n '} satisfies sdk.InterfacePackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,6BAA+B;AAC/B,2BAA6B;AAUtB,MAAM,yCAAyC,qBAAO;AAAA,EAGpD,YAAoB,YAAuC;AAChE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,gBAAgB,IAAI,oCAAc,WAAW,WAAW,CAAC,CAAC;AAChE,kBAAc,QAAQ,SAAS;AAE/B,UAA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AQ,eAAe;AAAA,MACrD;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport * as types from './typings'\n\ntype InterfacePackageModuleDependencies = {\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n entitiesModule: EntitiesModule\n}\n\nexport class InterfacePackageDefinitionModule extends Module {\n private _dependencies: InterfacePackageModuleDependencies\n\n public constructor(private _interface: types.InterfaceDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const actionsModule = new ActionsModule(_interface.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_interface.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_interface.events ?? {})\n eventsModule.unshift('events')\n\n const entitiesModule = new EntitiesModule(_interface.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n actionsModule,\n channelsModule,\n eventsModule,\n entitiesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { actionsModule, channelsModule, eventsModule, entitiesModule } = this._dependencies\n\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n const interfaceAttributes = this._interface.attributes ? stringifySingleLine(this._interface.attributes) : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._interface.name}\",`,\n ` version: \"${this._interface.version}\",`,\n ` attributes: ${interfaceAttributes},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n '} satisfies sdk.InterfacePackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,6BAA+B;AAC/B,2BAA6B;AAUtB,MAAM,yCAAyC,qBAAO;AAAA,EAGpD,YAAoB,YAAuC;AAChE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,gBAAgB,IAAI,oCAAc,WAAW,WAAW,CAAC,CAAC;AAChE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,sCAAe,WAAW,YAAY,CAAC,CAAC;AACnE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,eAAe,IAAI,kCAAa,WAAW,UAAU,CAAC,CAAC;AAC7D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,iBAAiB,IAAI,sCAAe,WAAW,YAAY,CAAC,CAAC;AACnE,mBAAe,QAAQ,UAAU;AAEjC,SAAK,gBAAgB;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,eAAW,OAAO,OAAO,OAAO,KAAK,aAAa,GAAG;AACnD,WAAK,QAAQ,GAAG;AAAA,IAClB;AAAA,EACF;AAAA,EA9BQ;AAAA,EAgCR,MAAa,aAAa;AACxB,QAAI,UAAU;AAEd,UAAM,EAAE,eAAe,gBAAgB,cAAc,eAAe,IAAI,KAAK;AAE7E,UAAM,gBAAgB,cAAc,OAAO,IAAI;AAC/C,UAAM,iBAAiB,eAAe,OAAO,IAAI;AACjD,UAAM,eAAe,aAAa,OAAO,IAAI;AAC7C,UAAM,iBAAiB,eAAe,OAAO,IAAI;AAEjD,UAAM,sBAAsB,KAAK,WAAW,iBAAa,uCAAoB,KAAK,WAAW,UAAU,IAAI;AAE3G,eAAW;AAAA,MACT,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C;AAAA,MACA;AAAA,MACA,YAAY,KAAK,WAAW;AAAA,MAC5B,eAAe,KAAK,WAAW;AAAA,MAC/B,iBAAiB;AAAA,MACjB,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -87,6 +87,7 @@ class PluginPackageDefinitionModule extends import_module.Module {
87
87
  const conversation = {
88
88
  tags: this._plugin.conversation?.tags ?? {}
89
89
  };
90
+ const pluginAttributes = this._plugin.attributes ? (0, import_generators.stringifySingleLine)(this._plugin.attributes) : "{}";
90
91
  content += [
91
92
  consts.GENERATED_HEADER,
92
93
  'import * as sdk from "@botpress/sdk"',
@@ -107,6 +108,7 @@ class PluginPackageDefinitionModule extends import_module.Module {
107
108
  "export default {",
108
109
  ` name: "${this._plugin.name}",`,
109
110
  ` version: "${this._plugin.version}",`,
111
+ ` attributes: ${pluginAttributes},`,
110
112
  ` user: ${(0, import_generators.stringifySingleLine)(user)},`,
111
113
  ` conversation: ${(0, import_generators.stringifySingleLine)(conversation)},`,
112
114
  ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/index.ts"],
4
- "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { RecurringEventsModule } from './recurring-events-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype PluginPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n actionsModule: ActionsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n interfacesModule: InterfacesModule\n recurringEventsModule: RecurringEventsModule\n}\n\nexport class PluginPackageDefinitionModule extends Module {\n private _dependencies: PluginPackageModuleDependencies\n\n public constructor(private _plugin: types.PluginDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_plugin.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const actionsModule = new ActionsModule(_plugin.actions ?? {})\n actionsModule.unshift('actions')\n\n const eventsModule = new EventsModule(_plugin.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_plugin.states ?? {})\n statesModule.unshift('states')\n\n const interfacesModule = new InterfacesModule(_plugin.dependencies?.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n const recurringEventsModule = new RecurringEventsModule(_plugin.recurringEvents ?? {})\n recurringEventsModule.unshift('recurringEvents')\n\n this._dependencies = {\n defaultConfigModule,\n actionsModule,\n eventsModule,\n statesModule,\n interfacesModule,\n recurringEventsModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { defaultConfigModule, actionsModule, eventsModule, statesModule, interfacesModule, recurringEventsModule } =\n this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const actionsImport = actionsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n const recurringEventsImport = recurringEventsModule.import(this)\n\n const user = {\n tags: this._plugin.user?.tags ?? {},\n }\n\n const conversation = {\n tags: this._plugin.conversation?.tags ?? {},\n }\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `import * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._plugin.name}\",`,\n ` version: \"${this._plugin.version}\",`,\n ` user: ${stringifySingleLine(user)},`,\n ` conversation: ${stringifySingleLine(conversation)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n ` recurringEvents: ${recurringEventsModule.name}.${recurringEventsModule.exportName},`,\n '} satisfies sdk.PluginPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,kCAA2C;AAC3C,2BAA6B;AAC7B,+BAAiC;AACjC,qCAAsC;AACtC,2BAA6B;AAYtB,MAAM,sCAAsC,qBAAO;AAAA,EAGjD,YAAoB,SAAiC;AAC1D,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,QAAQ,iBAAiB,CAAC,CAAC;AACtF,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,gBAAgB,IAAI,oCAAc,QAAQ,WAAW,CAAC,CAAC;AAC7D,kBAAc,QAAQ,SAAS;AAE/B,UAAM,eAAe,IAAI,kCAAa,QAAQ,UAAU,CAAC,CAAC;AAC1D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,eAAe,IAAI,kCAAa,QAAQ,UAAU,CAAC,CAAC;AAC1D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,mBAAmB,IAAI,0CAAiB,QAAQ,cAAc,cAAc,CAAC,CAAC;AACpF,qBAAiB,QAAQ,YAAY;AAErC,UAAM,wBAAwB,IAAI,qDAAsB,QAAQ,mBAAmB,CAAC,CAAC;AACrF,0BAAs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AA,MACA,YAAY,KAAK,QAAQ;AAAA,MACzB,eAAe,KAAK,QAAQ;AAAA,MAC5B,eAAW,uCAAoB,IAAI;AAAA,MACnC,uBAAmB,uCAAoB,YAAY;AAAA,MACnD,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D,sBAAsB,sBAAsB,QAAQ,sBAAsB;AAAA,MAC1E;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
4
+ "sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { RecurringEventsModule } from './recurring-events-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype PluginPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n actionsModule: ActionsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n interfacesModule: InterfacesModule\n recurringEventsModule: RecurringEventsModule\n}\n\nexport class PluginPackageDefinitionModule extends Module {\n private _dependencies: PluginPackageModuleDependencies\n\n public constructor(private _plugin: types.PluginDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_plugin.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const actionsModule = new ActionsModule(_plugin.actions ?? {})\n actionsModule.unshift('actions')\n\n const eventsModule = new EventsModule(_plugin.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_plugin.states ?? {})\n statesModule.unshift('states')\n\n const interfacesModule = new InterfacesModule(_plugin.dependencies?.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n const recurringEventsModule = new RecurringEventsModule(_plugin.recurringEvents ?? {})\n recurringEventsModule.unshift('recurringEvents')\n\n this._dependencies = {\n defaultConfigModule,\n actionsModule,\n eventsModule,\n statesModule,\n interfacesModule,\n recurringEventsModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { defaultConfigModule, actionsModule, eventsModule, statesModule, interfacesModule, recurringEventsModule } =\n this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const actionsImport = actionsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n const recurringEventsImport = recurringEventsModule.import(this)\n\n const user = {\n tags: this._plugin.user?.tags ?? {},\n }\n\n const conversation = {\n tags: this._plugin.conversation?.tags ?? {},\n }\n\n const pluginAttributes = this._plugin.attributes ? stringifySingleLine(this._plugin.attributes) : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `import * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._plugin.name}\",`,\n ` version: \"${this._plugin.version}\",`,\n ` attributes: ${pluginAttributes},`,\n ` user: ${stringifySingleLine(user)},`,\n ` conversation: ${stringifySingleLine(conversation)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n ` recurringEvents: ${recurringEventsModule.name}.${recurringEventsModule.exportName},`,\n '} satisfies sdk.PluginPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,kCAA2C;AAC3C,2BAA6B;AAC7B,+BAAiC;AACjC,qCAAsC;AACtC,2BAA6B;AAYtB,MAAM,sCAAsC,qBAAO;AAAA,EAGjD,YAAoB,SAAiC;AAC1D,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,QAAQ,iBAAiB,CAAC,CAAC;AACtF,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,gBAAgB,IAAI,oCAAc,QAAQ,WAAW,CAAC,CAAC;AAC7D,kBAAc,QAAQ,SAAS;AAE/B,UAAM,eAAe,IAAI,kCAAa,QAAQ,UAAU,CAAC,CAAC;AAC1D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,eAAe,IAAI,kCAAa,QAAQ,UAAU,CAAC,CAAC;AAC1D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,mBAAmB,IAAI,0CAAiB,QAAQ,cAAc,cAAc,CAAC,CAAC;AACpF,qBAAiB,QAAQ,YAAY;AAErC,UAAM,wBAAwB,IAAI,qDAAsB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AAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,sBAAsB,gBAAgB;AAAA,MACrD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,QAAQ;AAAA,MACzB,eAAe,KAAK,QAAQ;AAAA,MAC5B,iBAAiB;AAAA,MACjB,eAAW,uCAAoB,IAAI;AAAA,MACnC,uBAAmB,uCAAoB,YAAY;AAAA,MACnD,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D,sBAAsB,sBAAsB,QAAQ,sBAAsB;AAAA,MAC1E;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/code-generation/typings.ts"],
4
- "sourcesContent": ["import * as client from '@botpress/client'\nimport * as utils from '../utils'\n\ntype NameVersion = { name: string; version: string }\ntype PackageRef = { id?: string; name: string; version: string }\ntype Schema = Record<string, any>\ntype Aliases = Record<string, { name: string }>\n\ntype TitleDescription = { title?: string; description?: string }\ntype Tags = { tags: Record<string, {}> }\ntype InputOutput = { input: { schema: Schema }; output: { schema: Schema } }\ntype Attributes = { attributes?: Record<string, string> }\n\nexport type File = { path: string; content: string }\n\nexport type IntegrationDefinition = PackageRef & {\n interfaces?: Record<\n string,\n {\n id?: string\n entities?: Aliases\n actions?: Aliases\n events?: Aliases\n channels?: Aliases\n }\n >\n configuration?: TitleDescription & {\n schema?: Schema\n }\n configurations?: Record<\n string,\n TitleDescription & {\n schema?: Schema\n }\n >\n channels?: Record<\n string,\n TitleDescription & {\n messages: Record<string, TitleDescription & { schema: Schema }>\n conversation?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n message?: {\n tags?: Record<string, {}>\n }\n }\n >\n states?: Record<\n string,\n TitleDescription & {\n type: client.State['type']\n schema: Schema\n }\n >\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription &\n Attributes & {\n billable?: boolean\n cacheable?: boolean\n input: {\n schema: Schema\n }\n output: {\n schema: Schema\n }\n }\n >\n entities?: Record<string, TitleDescription & { schema: Schema }>\n user?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n}\n\nexport type InterfaceDefinition = PackageRef & {\n entities?: Record<string, TitleDescription & { schema: Schema }>\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription &\n Attributes & {\n billable?: boolean\n cacheable?: boolean\n input: { schema: Schema }\n output: { schema: Schema }\n }\n >\n channels?: Record<string, TitleDescription & { messages: Record<string, TitleDescription & { schema: Schema }> }>\n}\n\nexport type RecurringEventDefinition = {\n type: string\n payload: Record<string, any>\n schedule: { cron: string }\n}\n\nexport type PluginDefinition = PackageRef & {\n configuration?: TitleDescription & { schema?: Schema }\n user?: { tags: Record<string, {}> }\n conversation?: Tags\n states?: Record<string, TitleDescription & { type: client.State['type']; schema: Schema }>\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<string, TitleDescription & Attributes & InputOutput>\n workflows?: Record<string, TitleDescription & Tags & InputOutput>\n dependencies?: {\n interfaces?: Record<string, PackageRef>\n integrations?: Record<string, PackageRef>\n }\n recurringEvents?: Record<string, RecurringEventDefinition>\n}\n\nexport type IntegrationInstallablePackage = NameVersion & {\n integration: IntegrationDefinition\n devId?: string\n path?: utils.path.AbsolutePath\n}\n\nexport type InterfaceInstallablePackage = NameVersion & {\n interface: InterfaceDefinition\n path?: utils.path.AbsolutePath\n}\n\nexport type PluginInstallablePackage = NameVersion & {\n plugin: PluginDefinition\n path?: utils.path.AbsolutePath\n code: string\n}\n"],
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as utils from '../utils'\n\ntype NameVersion = { name: string; version: string }\ntype PackageRef = { id?: string; name: string; version: string }\ntype Schema = Record<string, any>\ntype Aliases = Record<string, { name: string }>\n\ntype TitleDescription = { title?: string; description?: string }\ntype Tags = { tags: Record<string, {}> }\ntype InputOutput = { input: { schema: Schema }; output: { schema: Schema } }\ntype Attributes = { attributes?: Record<string, string> }\n\nexport type File = { path: string; content: string }\n\nexport type IntegrationDefinition = PackageRef &\n Attributes & {\n interfaces?: Record<\n string,\n {\n id?: string\n entities?: Aliases\n actions?: Aliases\n events?: Aliases\n channels?: Aliases\n }\n >\n configuration?: TitleDescription & {\n schema?: Schema\n }\n configurations?: Record<\n string,\n TitleDescription & {\n schema?: Schema\n }\n >\n channels?: Record<\n string,\n TitleDescription & {\n messages: Record<string, TitleDescription & { schema: Schema }>\n conversation?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n message?: {\n tags?: Record<string, {}>\n }\n }\n >\n states?: Record<\n string,\n TitleDescription & {\n type: client.State['type']\n schema: Schema\n }\n >\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription &\n Attributes & {\n billable?: boolean\n cacheable?: boolean\n input: {\n schema: Schema\n }\n output: {\n schema: Schema\n }\n }\n >\n entities?: Record<string, TitleDescription & { schema: Schema }>\n user?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n }\n\nexport type InterfaceDefinition = PackageRef &\n Attributes & {\n entities?: Record<string, TitleDescription & { schema: Schema }>\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription &\n Attributes & {\n billable?: boolean\n cacheable?: boolean\n input: { schema: Schema }\n output: { schema: Schema }\n }\n >\n channels?: Record<string, TitleDescription & { messages: Record<string, TitleDescription & { schema: Schema }> }>\n }\n\nexport type RecurringEventDefinition = {\n type: string\n payload: Record<string, any>\n schedule: { cron: string }\n}\n\nexport type PluginDefinition = PackageRef &\n Attributes & {\n configuration?: TitleDescription & { schema?: Schema }\n user?: { tags: Record<string, {}> }\n conversation?: Tags\n states?: Record<string, TitleDescription & { type: client.State['type']; schema: Schema }>\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<string, TitleDescription & Attributes & InputOutput>\n workflows?: Record<string, TitleDescription & Tags & InputOutput>\n dependencies?: {\n interfaces?: Record<string, PackageRef>\n integrations?: Record<string, PackageRef>\n }\n recurringEvents?: Record<string, RecurringEventDefinition>\n }\n\nexport type IntegrationInstallablePackage = NameVersion & {\n integration: IntegrationDefinition\n devId?: string\n path?: utils.path.AbsolutePath\n}\n\nexport type InterfaceInstallablePackage = NameVersion & {\n interface: InterfaceDefinition\n path?: utils.path.AbsolutePath\n}\n\nexport type PluginInstallablePackage = NameVersion & {\n plugin: PluginDefinition\n path?: utils.path.AbsolutePath\n code: string\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -48,7 +48,7 @@ class GetPluginCommand extends import_global_command.GlobalCommand {
48
48
  throw new errors.BotpressCLIError("Cannot get local plugin");
49
49
  }
50
50
  try {
51
- const plugin = await api.findPublicPlugin(parsedRef);
51
+ const plugin = await api.findPublicOrPrivatePlugin(parsedRef);
52
52
  if (plugin) {
53
53
  this.logger.success(`Plugin ${import_chalk.default.bold(this.argv.pluginRef)}:`);
54
54
  this.logger.json(plugin);
@@ -85,7 +85,7 @@ class DeletePluginCommand extends import_global_command.GlobalCommand {
85
85
  }
86
86
  let plugin;
87
87
  try {
88
- plugin = await api.findPublicPlugin(parsedRef);
88
+ plugin = await api.findPublicOrPrivatePlugin(parsedRef);
89
89
  } catch (thrown) {
90
90
  throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`);
91
91
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/plugin-commands.ts"],
4
- "sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetPluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.get\nexport class GetPluginCommand extends GlobalCommand<GetPluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local plugin')\n }\n\n try {\n const plugin = await api.findPublicPlugin(parsedRef)\n if (plugin) {\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)}:`)\n this.logger.json(plugin)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n}\n\nexport type ListPluginsCommandDefinition = typeof commandDefinitions.plugins.subcommands.list\nexport class ListPluginsCommand extends GlobalCommand<ListPluginsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const lister = (req: { nextToken?: string }) => api.client.listPlugins({ nextToken: req.nextToken })\n\n try {\n const plugins = await api.listAllPages(lister, (r) => r.plugins)\n\n this.logger.success('Plugins:')\n this.logger.json(plugins)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list plugins')\n }\n }\n}\n\nexport type DeletePluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.delete\nexport class DeletePluginCommand extends GlobalCommand<DeletePluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local plugin')\n }\n\n let plugin: client.Plugin | undefined\n try {\n plugin = await api.findPublicPlugin(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n if (!plugin) {\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n\n try {\n await api.client.deletePlugin({ id: plugin.id })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete plugin ${this.argv.pluginRef}`)\n }\n\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)} deleted`)\n return\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,yBAAyB,oCAA0C;AAAA,EAC9E,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,SAAS;AACrD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,SAAS;AAAA,IACnE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,yBAAyB;AAAA,IAC7D;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,IAAI,iBAAiB,SAAS;AACnD,UAAI,QAAQ;AACV,aAAK,OAAO,QAAQ,UAAU,aAAAA,QAAM,KAAK,KAAK,KAAK,SAAS,IAAI;AAChE,aAAK,OAAO,KAAK,MAAM;AACvB;AAAA,MACF;AAAA,IACF,SAAS,QAAP;AACA,YAAM,OAA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D,SAAS,QAAP;AACA,YAAM,OAAO,iBAAiB,KAAK,QAAQ,2BAA2B,KAAK,KAAK,WAAW;AAAA,IAC7F;AAEA,SAAK,OAAO,QAAQ,UAAU,aAAAA,QAAM,KAAK,KAAK,KAAK,SAAS,WAAW;AACvE;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport chalk from 'chalk'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { parsePackageRef } from '../package-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetPluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.get\nexport class GetPluginCommand extends GlobalCommand<GetPluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local plugin')\n }\n\n try {\n const plugin = await api.findPublicOrPrivatePlugin(parsedRef)\n if (plugin) {\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)}:`)\n this.logger.json(plugin)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n}\n\nexport type ListPluginsCommandDefinition = typeof commandDefinitions.plugins.subcommands.list\nexport class ListPluginsCommand extends GlobalCommand<ListPluginsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const lister = (req: { nextToken?: string }) => api.client.listPlugins({ nextToken: req.nextToken })\n\n try {\n const plugins = await api.listAllPages(lister, (r) => r.plugins)\n\n this.logger.success('Plugins:')\n this.logger.json(plugins)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list plugins')\n }\n }\n}\n\nexport type DeletePluginCommandDefinition = typeof commandDefinitions.plugins.subcommands.delete\nexport class DeletePluginCommand extends GlobalCommand<DeletePluginCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parsePackageRef(this.argv.pluginRef)\n if (!parsedRef) {\n throw new errors.InvalidPackageReferenceError(this.argv.pluginRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local plugin')\n }\n\n let plugin: client.Plugin | undefined\n try {\n plugin = await api.findPublicOrPrivatePlugin(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get plugin ${this.argv.pluginRef}`)\n }\n\n if (!plugin) {\n throw new errors.BotpressCLIError(`Plugin ${this.argv.pluginRef} not found`)\n }\n\n try {\n await api.client.deletePlugin({ id: plugin.id })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete plugin ${this.argv.pluginRef}`)\n }\n\n this.logger.success(`Plugin ${chalk.bold(this.argv.pluginRef)} deleted`)\n return\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAkB;AAElB,aAAwB;AACxB,yBAAgC;AAChC,4BAA8B;AAGvB,MAAM,yBAAyB,oCAA0C;AAAA,EAC9E,MAAa,MAAqB;AAChC,UAAM,MAAM,MAAM,KAAK,2BAA2B,KAAK,IAAI;AAC3D,UAAM,gBAAY,oCAAgB,KAAK,KAAK,SAAS;AACrD,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,OAAO,6BAA6B,KAAK,KAAK,SAAS;AAAA,IACnE;AACA,QAAI,UAAU,SAAS,QAAQ;AAC7B,YAAM,IAAI,OAAO,iBAAiB,yBAAyB;AAAA,IAC7D;AAEA,QAAI;AACF,YAAM,SAAS,MAAM,IAAI,0BAA0B,SAAS;AAC5D,UAAI,QAAQ;AACV,aAAK,OAAO,QAAQ,U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O,iBAAiB,UAAU,KAAK,KAAK,qBAAqB;AAAA,IAC7E;AAEA,QAAI;AACF,YAAM,IAAI,OAAO,aAAa,EAAE,IAAI,OAAO,GAAG,CAAC;AAAA,IACjD,SAAS,QAAP;AACA,YAAM,OAAO,iBAAiB,KAAK,QAAQ,2BAA2B,KAAK,KAAK,WAAW;AAAA,IAC7F;AAEA,SAAK,OAAO,QAAQ,UAAU,aAAAA,QAAM,KAAK,KAAK,KAAK,SAAS,WAAW;AACvE;AAAA,EACF;AACF;",
6
6
  "names": ["chalk"]
7
7
  }
@@ -286,8 +286,13 @@ class ProjectCommand extends import_global_command.GlobalCommand {
286
286
  botDef.integrations ?? {},
287
287
  ({ name, version }) => api.getPublicOrPrivateIntegration({ type: "name", name, version })
288
288
  );
289
+ const plugins = await this._fetchDependencies(
290
+ botDef.plugins ?? {},
291
+ ({ name, version }) => api.getPublicOrPrivatePlugin({ type: "name", name, version })
292
+ );
289
293
  return {
290
- integrations: (0, import_lodash.default)(integrations).keyBy((i) => i.id).value()
294
+ integrations: (0, import_lodash.default)(integrations).keyBy((i) => i.id).value(),
295
+ plugins
291
296
  };
292
297
  }
293
298
  async prepareIntegrationDependencies(integrationDef, api) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/project-command.ts"],
4
- "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport type * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { validateIntegrationDefinition, validateBotDefinition } from '../sdk'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>\nexport type ProjectCache = { botId: string; devId: string }\n\ntype ConfigurableProjectPaths = { workDir: string }\ntype ConstantProjectPaths = typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype LintIgnoredConfig = { bpLintDisabled?: boolean }\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition = LintIgnoredConfig &\n (\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n )\n\nclass ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {\n public constructor(argv: CommandArgv<ProjectCommandDefinition>) {\n const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir)\n super({\n workDir: absWorkDir,\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected override async bootstrap() {\n await super.bootstrap()\n await this._notifyUpdateSdk()\n }\n\n protected get projectPaths() {\n return new ProjectPaths(this.argv)\n }\n\n protected get projectCache() {\n return new utils.cache.FSKeyValueCache<ProjectCache>(this.projectPaths.abs.projectCacheFile)\n }\n\n protected async readProjectDefinitionFromFS(): Promise<ProjectDefinition> {\n const projectPaths = this.projectPaths\n try {\n const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths)\n if (integrationDefinition) {\n return { type: 'integration', ...integrationDefinition }\n }\n const interfaceDefinition = await this._readInterfaceDefinitionFromFS(projectPaths)\n if (interfaceDefinition) {\n return { type: 'interface', ...interfaceDefinition }\n }\n const botDefinition = await this._readBotDefinitionFromFS(projectPaths)\n if (botDefinition) {\n return { type: 'bot', ...botDefinition }\n }\n const pluginDefinition = await this._readPluginDefinitionFromFS(projectPaths)\n if (pluginDefinition) {\n return { type: 'plugin', ...pluginDefinition }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\n }\n\n throw new errors.ProjectDefinitionNotFoundError(this.projectPaths.abs.workDir)\n }\n\n private async _readIntegrationDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition'>\n ): Promise<({ definition: sdk.IntegrationDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.integrationDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.IntegrationDefinition }>(artifact.text)\n validateIntegrationDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<({ definition: sdk.InterfaceDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.interfaceDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.InterfaceDefinition }>(artifact.text)\n\n return { definition, bpLintDisabled }\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<({ definition: sdk.BotDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.botDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.BotDefinition }>(artifact.text)\n validateBotDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readPluginDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'pluginDefinition'>\n ): Promise<({ definition: sdk.PluginDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.pluginDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.pluginDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.PluginDefinition }>(artifact.text)\n // TODO: validate plugin definition\n return { definition, bpLintDisabled }\n }\n\n private async _isBpLintDisabled(definitionPath: string): Promise<boolean> {\n const tsContent = await fs.promises.readFile(definitionPath, 'utf-8')\n const regex = /\\/\\* bplint-disable \\*\\//\n return regex.test(tsContent)\n }\n\n protected displayWebhookUrls(bot: client.Bot) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n this.logger.log('Integrations:')\n for (const integration of Object.values(bot.integrations).filter(utils.guards.is.defined)) {\n if (!integration.enabled) {\n this.logger.log(`${chalk.grey(integration.name)} ${chalk.italic('(disabled)')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 2 },\n })\n } else {\n this.logger.log(`${chalk.bold(integration.name)} : ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 2 },\n })\n }\n }\n }\n\n protected async promptSecrets(\n integrationDef: sdk.IntegrationDefinition,\n argv: YargsConfig<typeof config.schemas.secrets>,\n opts: { formatEnv?: boolean; knownSecrets?: string[] } = {}\n ): Promise<Record<string, string | null>> {\n const formatEnv = opts.formatEnv ?? false\n const knownSecrets = opts.knownSecrets ?? []\n\n const { secrets: secretDefinitions } = integrationDef\n if (!secretDefinitions) {\n return {}\n }\n\n const secretArgv = this._parseArgvSecrets(argv.secrets)\n const invalidSecret = Object.keys(secretArgv).find((s) => !secretDefinitions[s])\n if (invalidSecret) {\n throw new errors.BotpressCLIError(`Secret ${invalidSecret} is not defined in integration definition`)\n }\n\n const values: Record<string, string | null> = {}\n for (const [secretName, { optional }] of Object.entries(secretDefinitions)) {\n const argvSecret = secretArgv[secretName]\n if (argvSecret) {\n this.logger.debug(`Using secret \"${secretName}\" from argv`)\n values[secretName] = argvSecret\n continue\n }\n\n const alreadyKnown = knownSecrets.includes(secretName)\n let mode: string\n if (alreadyKnown) {\n mode = 'already set'\n } else if (optional) {\n mode = 'optional'\n } else {\n mode = 'required'\n }\n\n const prompted = await this.prompt.text(`Enter value for secret \"${secretName}\" (${mode})`)\n if (prompted) {\n values[secretName] = prompted\n continue\n }\n\n if (alreadyKnown) {\n this.logger.log(`Secret \"${secretName}\" is unchanged`)\n } else if (optional) {\n this.logger.warn(`Secret \"${secretName}\" is unassigned`)\n } else {\n throw new errors.BotpressCLIError(`Secret \"${secretName}\" is required`)\n }\n }\n\n for (const secretName of knownSecrets) {\n const isDefined = secretName in secretDefinitions\n if (isDefined) {\n continue\n }\n const prompted = await this.prompt.confirm(`Secret \"${secretName}\" was removed. Do you wish to delete it?`)\n if (prompted) {\n this.logger.log(`Deleting secret \"${secretName}\"`, { prefix: { symbol: '\u00D7', fg: 'red' } })\n values[secretName] = null\n }\n }\n\n if (!formatEnv) {\n return values\n }\n\n const envVariables = _.mapKeys(values, (_v, k) => codegen.secretEnvVariableName(k))\n return envVariables\n }\n\n protected async prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n const partialBody = await apiUtils.prepareCreateIntegrationBody(integrationDef)\n\n let code: string | undefined = undefined\n if (fs.existsSync(this.projectPaths.abs.outFileCJS)) {\n code = await this.readProjectFile(this.projectPaths.abs.outFileCJS)\n }\n\n const icon = await this.readProjectFile(integrationDef.icon, 'base64')\n const readme = await this.readProjectFile(integrationDef.readme, 'base64')\n const extractScript = await this.readProjectFile(integrationDef.identifier?.extractScript)\n const fallbackHandlerScript = await this.readProjectFile(integrationDef.identifier?.fallbackHandlerScript)\n return {\n ...partialBody,\n code,\n icon,\n readme,\n identifier: {\n extractScript,\n fallbackHandlerScript,\n },\n configuration: integrationDef.configuration\n ? {\n schema: await utils.schema.mapZodToJsonSchema(integrationDef.configuration),\n identifier: {\n required: integrationDef.configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(\n integrationDef.configuration.identifier?.linkTemplateScript\n ),\n },\n }\n : undefined,\n configurations: integrationDef.configurations\n ? await utils.records.mapValuesAsync(integrationDef.configurations, async (configuration) => ({\n title: configuration.title,\n description: configuration.description,\n schema: await utils.schema.mapZodToJsonSchema(configuration),\n identifier: {\n required: configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(configuration.identifier?.linkTemplateScript),\n },\n }))\n : undefined,\n }\n }\n\n protected async prepareBotDependencies(\n botDef: sdk.BotDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.UpdateBotRequestBody>> {\n const integrations = await this._fetchDependencies(botDef.integrations ?? {}, ({ name, version }) =>\n api.getPublicOrPrivateIntegration({ type: 'name', name, version })\n )\n return {\n integrations: _(integrations)\n .keyBy((i) => i.id)\n .value(),\n }\n }\n\n protected async prepareIntegrationDependencies(\n integrationDef: sdk.IntegrationDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreateIntegrationRequestBody>> {\n const interfaces = await this._fetchDependencies(integrationDef.interfaces ?? {}, ({ name, version }) =>\n api.getPublicInterface({ type: 'name', name, version })\n )\n return { interfaces }\n }\n\n protected async preparePluginDependencies(\n pluginDef: sdk.PluginDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreatePluginRequestBody>> {\n const integrations = await this._fetchDependencies(pluginDef.integrations ?? {}, ({ name, version }) =>\n api.getPublicOrPrivateIntegration({ type: 'name', name, version })\n )\n const interfaces = await this._fetchDependencies(pluginDef.interfaces ?? {}, ({ name, version }) =>\n api.getPublicInterface({ type: 'name', name, version })\n )\n return {\n dependencies: {\n integrations,\n interfaces,\n },\n }\n }\n\n private _fetchDependencies = async <T extends { id?: string; name: string; version: string }>(\n deps: Record<string, T>,\n fetcher: (dep: T) => Promise<{ id: string }>\n ): Promise<Record<string, T & { id: string }>> => {\n const isRemote = (dep: T): dep is T & { id: string } => dep.id !== undefined\n return utils.records.mapValuesAsync(deps, async (dep): Promise<T & { id: string }> => {\n if (isRemote(dep)) {\n return dep\n }\n const { id } = await fetcher(dep)\n return { ...dep, id }\n })\n }\n\n protected readProjectFile = async (\n filePath: string | undefined,\n encoding: BufferEncoding = 'utf-8'\n ): Promise<string | undefined> => {\n if (!filePath) {\n return undefined\n }\n const absoluteFilePath = utils.path.absoluteFrom(this.projectPaths.abs.workDir, filePath)\n return fs.promises.readFile(absoluteFilePath, encoding).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not read file \"${absoluteFilePath}\"`)\n })\n }\n\n private _parseArgvSecrets(argvSecrets: string[]): Record<string, string> {\n const parsed: Record<string, string> = {}\n for (const secret of argvSecrets) {\n const [key, value] = utils.string.splitOnce(secret, '=')\n if (!value) {\n throw new errors.BotpressCLIError(\n `Secret \"${key}\" is missing a value. Expected format: \"SECRET_NAME=secretValue\"`\n )\n }\n parsed[key!] = value\n }\n\n return parsed\n }\n\n private _notifyUpdateSdk = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if sdk is up to date')\n\n const { workDir } = this.projectPaths.abs\n const projectPkgJson = await utils.pkgJson.readPackageJson(workDir)\n if (!projectPkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const sdkPackageName = '@botpress/sdk'\n const actualSdkVersion = utils.pkgJson.findDependency(projectPkgJson, sdkPackageName)\n if (!actualSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in project package.json`)\n return\n }\n\n if (actualSdkVersion.startsWith('workspace:')) {\n return\n }\n\n const actualCleanedSdkVersion = semver.valid(semver.coerce(actualSdkVersion))\n if (!actualCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${actualSdkVersion}\" in project package.json`)\n return\n }\n\n const cliPkgJson = await this.readPkgJson()\n const expectedSdkVersion = utils.pkgJson.findDependency(cliPkgJson, sdkPackageName)\n if (!expectedSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in cli package.json`)\n return\n }\n\n const expectedCleanedSdkVersion = semver.valid(semver.coerce(expectedSdkVersion))\n if (!expectedCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${expectedSdkVersion}\" in cli package.json`)\n return\n }\n\n if (semver.eq(actualCleanedSdkVersion, expectedCleanedSdkVersion)) {\n return\n }\n\n const diff = semver.diff(actualCleanedSdkVersion, expectedCleanedSdkVersion)\n if (!diff) {\n this.logger.debug(`Could not compare versions \"${actualCleanedSdkVersion}\" and \"${expectedCleanedSdkVersion}\"`)\n return\n }\n\n const errorMsg = `Project SDK version is \"${actualCleanedSdkVersion}\", but expected \"${expectedCleanedSdkVersion}\"`\n if (utils.semver.releases.lt(diff, 'minor')) {\n this.logger.debug(`${errorMsg}. This may cause compatibility issues.`)\n return\n }\n\n this.logger.warn(chalk.bold(`${errorMsg}. This will cause compatibility issues.`))\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown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A,UAAI,iBAAiB,WAAW,YAAY,GAAG;AAC7C;AAAA,MACF;AAEA,YAAM,0BAA0B,cAAAE,QAAO,MAAM,cAAAA,QAAO,OAAO,gBAAgB,CAAC;AAC5E,UAAI,CAAC,yBAAyB;AAC5B,aAAK,OAAO,MAAM,wBAAwB,2CAA2C;AACrF;AAAA,MACF;AAEA,YAAM,aAAa,MAAM,KAAK,YAAY;AAC1C,YAAM,qBAAqB,MAAM,QAAQ,eAAe,YAAY,cAAc;AAClF,UAAI,CAAC,oBAAoB;AACvB,aAAK,OAAO,MAAM,8BAA8B,qCAAqC;AACrF;AAAA,MACF;AAEA,YAAM,4BAA4B,cAAAA,QAAO,MAAM,cAAAA,QAAO,OAAO,kBAAkB,CAAC;AAChF,UAAI,CAAC,2BAA2B;AAC9B,aAAK,OAAO,MAAM,wBAAwB,yCAAyC;AACnF;AAAA,MACF;AAEA,UAAI,cAAAA,QAAO,GAAG,yBAAyB,yBAAyB,GAAG;AACjE;AAAA,MACF;AAEA,YAAM,OAAO,cAAAA,QAAO,KAAK,yBAAyB,yBAAyB;AAC3E,UAAI,CAAC,MAAM;AACT,aAAK,OAAO,MAAM,+BAA+B,iCAAiC,4BAA4B;AAC9G;AAAA,MACF;AAEA,YAAM,WAAW,2BAA2B,2CAA2C;AACvF,UAAI,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,GAAG;AAC3C,aAAK,OAAO,MAAM,GAAG,gDAAgD;AACrE;AAAA,MACF;AAEA,WAAK,OAAO,KAAK,aAAAD,QAAM,KAAK,GAAG,iDAAiD,CAAC;AAAA,IACnF,SAAS,QAAP;AACA,YAAM,MAAM,OAAO,iBAAiB,IAAI,MAAM;AAC9C,WAAK,OAAO,MAAM,yCAAyC,IAAI,SAAS;AAAA,IAC1E;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import type * as client from '@botpress/client'\nimport type * as sdk from '@botpress/sdk'\nimport type { YargsConfig } from '@bpinternal/yargs-extra'\nimport chalk from 'chalk'\nimport fs from 'fs'\nimport _ from 'lodash'\nimport semver from 'semver'\nimport * as apiUtils from '../api'\nimport * as codegen from '../code-generation'\nimport type * as config from '../config'\nimport * as consts from '../consts'\nimport * as errors from '../errors'\nimport { validateIntegrationDefinition, validateBotDefinition } from '../sdk'\nimport type { CommandArgv, CommandDefinition } from '../typings'\nimport * as utils from '../utils'\nimport { GlobalCommand } from './global-command'\n\nexport type ProjectCommandDefinition = CommandDefinition<typeof config.schemas.project>\nexport type ProjectCache = { botId: string; devId: string }\n\ntype ConfigurableProjectPaths = { workDir: string }\ntype ConstantProjectPaths = typeof consts.fromWorkDir\ntype AllProjectPaths = ConfigurableProjectPaths & ConstantProjectPaths\n\ntype LintIgnoredConfig = { bpLintDisabled?: boolean }\n\nexport type ProjectType = ProjectDefinition['type']\nexport type ProjectDefinition = LintIgnoredConfig &\n (\n | { type: 'integration'; definition: sdk.IntegrationDefinition }\n | { type: 'interface'; definition: sdk.InterfaceDefinition }\n | { type: 'bot'; definition: sdk.BotDefinition }\n | { type: 'plugin'; definition: sdk.PluginDefinition }\n )\n\nclass ProjectPaths extends utils.path.PathStore<keyof AllProjectPaths> {\n public constructor(argv: CommandArgv<ProjectCommandDefinition>) {\n const absWorkDir = utils.path.absoluteFrom(utils.path.cwd(), argv.workDir)\n super({\n workDir: absWorkDir,\n ..._.mapValues(consts.fromWorkDir, (p) => utils.path.absoluteFrom(absWorkDir, p)),\n })\n }\n}\n\nexport abstract class ProjectCommand<C extends ProjectCommandDefinition> extends GlobalCommand<C> {\n protected override async bootstrap() {\n await super.bootstrap()\n await this._notifyUpdateSdk()\n }\n\n protected get projectPaths() {\n return new ProjectPaths(this.argv)\n }\n\n protected get projectCache() {\n return new utils.cache.FSKeyValueCache<ProjectCache>(this.projectPaths.abs.projectCacheFile)\n }\n\n protected async readProjectDefinitionFromFS(): Promise<ProjectDefinition> {\n const projectPaths = this.projectPaths\n try {\n const integrationDefinition = await this._readIntegrationDefinitionFromFS(projectPaths)\n if (integrationDefinition) {\n return { type: 'integration', ...integrationDefinition }\n }\n const interfaceDefinition = await this._readInterfaceDefinitionFromFS(projectPaths)\n if (interfaceDefinition) {\n return { type: 'interface', ...interfaceDefinition }\n }\n const botDefinition = await this._readBotDefinitionFromFS(projectPaths)\n if (botDefinition) {\n return { type: 'bot', ...botDefinition }\n }\n const pluginDefinition = await this._readPluginDefinitionFromFS(projectPaths)\n if (pluginDefinition) {\n return { type: 'plugin', ...pluginDefinition }\n }\n } catch (thrown: unknown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Error while reading project definition')\n }\n\n throw new errors.ProjectDefinitionNotFoundError(this.projectPaths.abs.workDir)\n }\n\n private async _readIntegrationDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'integrationDefinition'>\n ): Promise<({ definition: sdk.IntegrationDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.integrationDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.integrationDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.integrationDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read integration definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.IntegrationDefinition }>(artifact.text)\n validateIntegrationDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readInterfaceDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'interfaceDefinition'>\n ): Promise<({ definition: sdk.InterfaceDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.interfaceDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.interfaceDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.interfaceDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read interface definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.InterfaceDefinition }>(artifact.text)\n\n return { definition, bpLintDisabled }\n }\n\n private async _readBotDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'botDefinition'>\n ): Promise<({ definition: sdk.BotDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.botDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.botDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.botDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read bot definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.BotDefinition }>(artifact.text)\n validateBotDefinition(definition)\n return { definition, bpLintDisabled }\n }\n\n private async _readPluginDefinitionFromFS(\n projectPaths: utils.path.PathStore<'workDir' | 'pluginDefinition'>\n ): Promise<({ definition: sdk.PluginDefinition } & LintIgnoredConfig) | undefined> {\n const abs = projectPaths.abs\n const rel = projectPaths.rel('workDir')\n\n if (!fs.existsSync(abs.pluginDefinition)) {\n return\n }\n\n const bpLintDisabled = await this._isBpLintDisabled(abs.pluginDefinition)\n\n const { outputFiles } = await utils.esbuild.buildEntrypoint({\n absWorkingDir: abs.workDir,\n entrypoint: rel.pluginDefinition,\n })\n\n const artifact = outputFiles[0]\n if (!artifact) {\n throw new errors.BotpressCLIError('Could not read plugin definition')\n }\n\n const { default: definition } = utils.require.requireJsCode<{ default: sdk.PluginDefinition }>(artifact.text)\n // TODO: validate plugin definition\n return { definition, bpLintDisabled }\n }\n\n private async _isBpLintDisabled(definitionPath: string): Promise<boolean> {\n const tsContent = await fs.promises.readFile(definitionPath, 'utf-8')\n const regex = /\\/\\* bplint-disable \\*\\//\n return regex.test(tsContent)\n }\n\n protected displayWebhookUrls(bot: client.Bot) {\n if (!_.keys(bot.integrations).length) {\n this.logger.debug('No integrations in bot')\n return\n }\n\n this.logger.log('Integrations:')\n for (const integration of Object.values(bot.integrations).filter(utils.guards.is.defined)) {\n if (!integration.enabled) {\n this.logger.log(`${chalk.grey(integration.name)} ${chalk.italic('(disabled)')}: ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CB', indent: 2 },\n })\n } else {\n this.logger.log(`${chalk.bold(integration.name)} : ${integration.webhookUrl}`, {\n prefix: { symbol: '\u25CF', indent: 2 },\n })\n }\n }\n }\n\n protected async promptSecrets(\n integrationDef: sdk.IntegrationDefinition,\n argv: YargsConfig<typeof config.schemas.secrets>,\n opts: { formatEnv?: boolean; knownSecrets?: string[] } = {}\n ): Promise<Record<string, string | null>> {\n const formatEnv = opts.formatEnv ?? false\n const knownSecrets = opts.knownSecrets ?? []\n\n const { secrets: secretDefinitions } = integrationDef\n if (!secretDefinitions) {\n return {}\n }\n\n const secretArgv = this._parseArgvSecrets(argv.secrets)\n const invalidSecret = Object.keys(secretArgv).find((s) => !secretDefinitions[s])\n if (invalidSecret) {\n throw new errors.BotpressCLIError(`Secret ${invalidSecret} is not defined in integration definition`)\n }\n\n const values: Record<string, string | null> = {}\n for (const [secretName, { optional }] of Object.entries(secretDefinitions)) {\n const argvSecret = secretArgv[secretName]\n if (argvSecret) {\n this.logger.debug(`Using secret \"${secretName}\" from argv`)\n values[secretName] = argvSecret\n continue\n }\n\n const alreadyKnown = knownSecrets.includes(secretName)\n let mode: string\n if (alreadyKnown) {\n mode = 'already set'\n } else if (optional) {\n mode = 'optional'\n } else {\n mode = 'required'\n }\n\n const prompted = await this.prompt.text(`Enter value for secret \"${secretName}\" (${mode})`)\n if (prompted) {\n values[secretName] = prompted\n continue\n }\n\n if (alreadyKnown) {\n this.logger.log(`Secret \"${secretName}\" is unchanged`)\n } else if (optional) {\n this.logger.warn(`Secret \"${secretName}\" is unassigned`)\n } else {\n throw new errors.BotpressCLIError(`Secret \"${secretName}\" is required`)\n }\n }\n\n for (const secretName of knownSecrets) {\n const isDefined = secretName in secretDefinitions\n if (isDefined) {\n continue\n }\n const prompted = await this.prompt.confirm(`Secret \"${secretName}\" was removed. Do you wish to delete it?`)\n if (prompted) {\n this.logger.log(`Deleting secret \"${secretName}\"`, { prefix: { symbol: '\u00D7', fg: 'red' } })\n values[secretName] = null\n }\n }\n\n if (!formatEnv) {\n return values\n }\n\n const envVariables = _.mapKeys(values, (_v, k) => codegen.secretEnvVariableName(k))\n return envVariables\n }\n\n protected async prepareCreateIntegrationBody(\n integrationDef: sdk.IntegrationDefinition\n ): Promise<apiUtils.CreateIntegrationRequestBody> {\n const partialBody = await apiUtils.prepareCreateIntegrationBody(integrationDef)\n\n let code: string | undefined = undefined\n if (fs.existsSync(this.projectPaths.abs.outFileCJS)) {\n code = await this.readProjectFile(this.projectPaths.abs.outFileCJS)\n }\n\n const icon = await this.readProjectFile(integrationDef.icon, 'base64')\n const readme = await this.readProjectFile(integrationDef.readme, 'base64')\n const extractScript = await this.readProjectFile(integrationDef.identifier?.extractScript)\n const fallbackHandlerScript = await this.readProjectFile(integrationDef.identifier?.fallbackHandlerScript)\n return {\n ...partialBody,\n code,\n icon,\n readme,\n identifier: {\n extractScript,\n fallbackHandlerScript,\n },\n configuration: integrationDef.configuration\n ? {\n schema: await utils.schema.mapZodToJsonSchema(integrationDef.configuration),\n identifier: {\n required: integrationDef.configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(\n integrationDef.configuration.identifier?.linkTemplateScript\n ),\n },\n }\n : undefined,\n configurations: integrationDef.configurations\n ? await utils.records.mapValuesAsync(integrationDef.configurations, async (configuration) => ({\n title: configuration.title,\n description: configuration.description,\n schema: await utils.schema.mapZodToJsonSchema(configuration),\n identifier: {\n required: configuration.identifier?.required,\n linkTemplateScript: await this.readProjectFile(configuration.identifier?.linkTemplateScript),\n },\n }))\n : undefined,\n }\n }\n\n protected async prepareBotDependencies(\n botDef: sdk.BotDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.UpdateBotRequestBody>> {\n const integrations = await this._fetchDependencies(botDef.integrations ?? {}, ({ name, version }) =>\n api.getPublicOrPrivateIntegration({ type: 'name', name, version })\n )\n const plugins = await this._fetchDependencies(botDef.plugins ?? {}, ({ name, version }) =>\n api.getPublicOrPrivatePlugin({ type: 'name', name, version })\n )\n return {\n integrations: _(integrations)\n .keyBy((i) => i.id)\n .value(),\n plugins,\n }\n }\n\n protected async prepareIntegrationDependencies(\n integrationDef: sdk.IntegrationDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreateIntegrationRequestBody>> {\n const interfaces = await this._fetchDependencies(integrationDef.interfaces ?? {}, ({ name, version }) =>\n api.getPublicInterface({ type: 'name', name, version })\n )\n return { interfaces }\n }\n\n protected async preparePluginDependencies(\n pluginDef: sdk.PluginDefinition,\n api: apiUtils.ApiClient\n ): Promise<Partial<apiUtils.CreatePluginRequestBody>> {\n const integrations = await this._fetchDependencies(pluginDef.integrations ?? {}, ({ name, version }) =>\n api.getPublicOrPrivateIntegration({ type: 'name', name, version })\n )\n const interfaces = await this._fetchDependencies(pluginDef.interfaces ?? {}, ({ name, version }) =>\n api.getPublicInterface({ type: 'name', name, version })\n )\n return {\n dependencies: {\n integrations,\n interfaces,\n },\n }\n }\n\n private _fetchDependencies = async <T extends { id?: string; name: string; version: string }>(\n deps: Record<string, T>,\n fetcher: (dep: T) => Promise<{ id: string }>\n ): Promise<Record<string, T & { id: string }>> => {\n const isRemote = (dep: T): dep is T & { id: string } => dep.id !== undefined\n return utils.records.mapValuesAsync(deps, async (dep): Promise<T & { id: string }> => {\n if (isRemote(dep)) {\n return dep\n }\n const { id } = await fetcher(dep)\n return { ...dep, id }\n })\n }\n\n protected readProjectFile = async (\n filePath: string | undefined,\n encoding: BufferEncoding = 'utf-8'\n ): Promise<string | undefined> => {\n if (!filePath) {\n return undefined\n }\n const absoluteFilePath = utils.path.absoluteFrom(this.projectPaths.abs.workDir, filePath)\n return fs.promises.readFile(absoluteFilePath, encoding).catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `Could not read file \"${absoluteFilePath}\"`)\n })\n }\n\n private _parseArgvSecrets(argvSecrets: string[]): Record<string, string> {\n const parsed: Record<string, string> = {}\n for (const secret of argvSecrets) {\n const [key, value] = utils.string.splitOnce(secret, '=')\n if (!value) {\n throw new errors.BotpressCLIError(\n `Secret \"${key}\" is missing a value. Expected format: \"SECRET_NAME=secretValue\"`\n )\n }\n parsed[key!] = value\n }\n\n return parsed\n }\n\n private _notifyUpdateSdk = async (): Promise<void> => {\n try {\n this.logger.debug('Checking if sdk is up to date')\n\n const { workDir } = this.projectPaths.abs\n const projectPkgJson = await utils.pkgJson.readPackageJson(workDir)\n if (!projectPkgJson) {\n this.logger.debug(`Could not find package.json at \"${workDir}\"`)\n return\n }\n\n const sdkPackageName = '@botpress/sdk'\n const actualSdkVersion = utils.pkgJson.findDependency(projectPkgJson, sdkPackageName)\n if (!actualSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in project package.json`)\n return\n }\n\n if (actualSdkVersion.startsWith('workspace:')) {\n return\n }\n\n const actualCleanedSdkVersion = semver.valid(semver.coerce(actualSdkVersion))\n if (!actualCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${actualSdkVersion}\" in project package.json`)\n return\n }\n\n const cliPkgJson = await this.readPkgJson()\n const expectedSdkVersion = utils.pkgJson.findDependency(cliPkgJson, sdkPackageName)\n if (!expectedSdkVersion) {\n this.logger.debug(`Could not find dependency \"${sdkPackageName}\" in cli package.json`)\n return\n }\n\n const expectedCleanedSdkVersion = semver.valid(semver.coerce(expectedSdkVersion))\n if (!expectedCleanedSdkVersion) {\n this.logger.debug(`Invalid sdk version \"${expectedSdkVersion}\" in cli package.json`)\n return\n }\n\n if (semver.eq(actualCleanedSdkVersion, expectedCleanedSdkVersion)) {\n return\n }\n\n const diff = semver.diff(actualCleanedSdkVersion, expectedCleanedSdkVersion)\n if (!diff) {\n this.logger.debug(`Could not compare versions \"${actualCleanedSdkVersion}\" and \"${expectedCleanedSdkVersion}\"`)\n return\n }\n\n const errorMsg = `Project SDK version is \"${actualCleanedSdkVersion}\", but expected \"${expectedCleanedSdkVersion}\"`\n if (utils.semver.releases.lt(diff, 'minor')) {\n this.logger.debug(`${errorMsg}. This may cause compatibility issues.`)\n return\n }\n\n this.logger.warn(chalk.bold(`${errorMsg}. This will cause compatibility issues.`))\n } catch (thrown) {\n const err = errors.BotpressCLIError.map(thrown)\n this.logger.debug(`Failed to check if sdk is up to date: ${err.message}`)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAkB;AAClB,gBAAe;AACf,oBAAc;AACd,oBAAmB;AACnB,eAA0B;AAC1B,cAAyB;AAEzB,aAAwB;AACxB,aAAwB;AACxB,iBAAqE;AAErE,YAAuB;AACvB,4BAA8B;AAoB9B,MAAM,qBAAqB,MAAM,KAAK,UAAiC;AAAA,EAC9D,YAAY,MAA6C;AAC9D,UAAM,aAAa,MAAM,KAAK,aAAa,MAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AACzE,UAAM;AAAA,MACJ,SAAS;AAAA,MACT,GAAG,cAAAA,QAAE,UAAU,OAAO,aAAa,CAAC,MAAM,MAAM,KAAK,aAAa,YAAY,CAAC,CAAC;AAAA,IAClF,CAAC;AAAA,EACH;AACF;AAEO,MAAe,uBAA2D,oCAAiB;AAAA,EAChG,MAAyB,YAAY;AACnC,UAAM,MAAM,UAAU;AACtB,UAAM,KAAK,iBAAiB;AAAA,EAC9B;AAAA,EAEA,IAAc,eAAe;AAC3B,WAAO,IAAI,aAAa,KAAK,IAAI;AAAA,EACnC;AAAA,EAEA,IAAc,eAAe;AAC3B,WAAO,IAAI,MAAM,MAAM,gBAA8B,KAA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BAAyB;AAC3E,UAAI,CAAC,MAAM;AACT,aAAK,OAAO,MAAM,+BAA+B,iCAAiC,4BAA4B;AAC9G;AAAA,MACF;AAEA,YAAM,WAAW,2BAA2B,2CAA2C;AACvF,UAAI,MAAM,OAAO,SAAS,GAAG,MAAM,OAAO,GAAG;AAC3C,aAAK,OAAO,MAAM,GAAG,gDAAgD;AACrE;AAAA,MACF;AAEA,WAAK,OAAO,KAAK,aAAAD,QAAM,KAAK,GAAG,iDAAiD,CAAC;AAAA,IACnF,SAAS,QAAP;AACA,YAAM,MAAM,OAAO,iBAAiB,IAAI,MAAM;AAC9C,WAAK,OAAO,MAAM,yCAAyC,IAAI,SAAS;AAAA,IAC1E;AAAA,EACF;AACF;",
6
6
  "names": ["_", "fs", "chalk", "semver"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run bundle && pnpm run template:gen",
@@ -21,8 +21,8 @@
21
21
  "dependencies": {
22
22
  "@apidevtools/json-schema-ref-parser": "^11.7.0",
23
23
  "@botpress/chat": "0.5.1",
24
- "@botpress/client": "1.12.0",
25
- "@botpress/sdk": "4.7.0",
24
+ "@botpress/client": "1.14.0",
25
+ "@botpress/sdk": "4.8.0",
26
26
  "@bpinternal/const": "^0.1.0",
27
27
  "@bpinternal/tunnel": "^0.1.1",
28
28
  "@bpinternal/yargs-extra": "^0.0.3",
@@ -5,8 +5,8 @@
5
5
  },
6
6
  "private": true,
7
7
  "dependencies": {
8
- "@botpress/client": "1.12.0",
9
- "@botpress/sdk": "4.7.0"
8
+ "@botpress/client": "1.14.0",
9
+ "@botpress/sdk": "4.8.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^18.19.67",
@@ -6,8 +6,8 @@
6
6
  },
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@botpress/client": "1.12.0",
10
- "@botpress/sdk": "4.7.0"
9
+ "@botpress/client": "1.14.0",
10
+ "@botpress/sdk": "4.8.0"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^18.19.67",
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@botpress/sdk": "4.7.0"
9
+ "@botpress/sdk": "4.8.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "^18.19.67",
@@ -6,8 +6,8 @@
6
6
  },
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@botpress/client": "1.12.0",
10
- "@botpress/sdk": "4.7.0"
9
+ "@botpress/client": "1.14.0",
10
+ "@botpress/sdk": "4.8.0"
11
11
  },
12
12
  "devDependencies": {
13
13
  "@types/node": "^18.19.67",
@@ -6,8 +6,8 @@
6
6
  },
7
7
  "private": true,
8
8
  "dependencies": {
9
- "@botpress/client": "1.12.0",
10
- "@botpress/sdk": "4.7.0",
9
+ "@botpress/client": "1.14.0",
10
+ "@botpress/sdk": "4.8.0",
11
11
  "axios": "^1.6.8"
12
12
  },
13
13
  "devDependencies": {