@botpress/cli 4.3.5 → 4.4.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 +11 -11
  2. package/dist/api/bot-body.js +8 -1
  3. package/dist/api/bot-body.js.map +2 -2
  4. package/dist/api/integration-body.js +8 -11
  5. package/dist/api/integration-body.js.map +2 -2
  6. package/dist/api/interface-body.js +8 -14
  7. package/dist/api/interface-body.js.map +2 -2
  8. package/dist/api/plugin-body.js +8 -2
  9. package/dist/api/plugin-body.js.map +2 -2
  10. package/dist/code-generation/integration-package/integration-package-definition/events-module.js +5 -6
  11. package/dist/code-generation/integration-package/integration-package-definition/events-module.js.map +2 -2
  12. package/dist/code-generation/interface-package/interface-package-definition/events-module.js +5 -6
  13. package/dist/code-generation/interface-package/interface-package-definition/events-module.js.map +2 -2
  14. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js +7 -4
  15. package/dist/code-generation/plugin-package/plugin-package-definition/actions-module.js.map +2 -2
  16. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js +5 -6
  17. package/dist/code-generation/plugin-package/plugin-package-definition/events-module.js.map +2 -2
  18. package/dist/code-generation/typings.js.map +1 -1
  19. package/dist/utils/attribute-utils.js +52 -0
  20. package/dist/utils/attribute-utils.js.map +7 -0
  21. package/dist/utils/index.js +3 -0
  22. package/dist/utils/index.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.3.5 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@4.4.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.3.5 bundle /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@4.4.0 bundle /home/runner/work/botpress/botpress/packages/cli
7
7
  > ts-node -T build.ts
8
8
 
9
9
 
10
- > @botpress/cli@4.3.5 template:gen /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@4.4.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.3.5
14
- 🤖 Botpress CLI v4.3.5
15
- 🤖 Botpress CLI v4.3.5
16
- 🤖 Botpress CLI v4.3.5
17
- ○ Generating typings for bot...
13
+ 🤖 Botpress CLI v4.4.0
14
+ 🤖 Botpress CLI v4.4.0
15
+ 🤖 Botpress CLI v4.4.0
16
+ 🤖 Botpress CLI v4.4.0
17
+ ○ Generating typings for plugin empty-plugin...
18
18
  ✓ Typings available at .botpress
19
19
 
20
20
  ○ Generating typings for integration hello-world...
21
21
  ✓ Typings available at .botpress
22
22
 
23
- ○ Generating typings for plugin empty-plugin...
23
+ ○ Generating typings for integration empty-integration...
24
24
  ✓ Typings available at .botpress
25
25
 
26
- ○ Generating typings for integration empty-integration...
26
+ ○ Generating typings for bot...
27
27
  ✓ Typings available at .botpress
28
28
 
29
- 🤖 Botpress CLI v4.3.5
29
+ 🤖 Botpress CLI v4.4.0
30
30
  ○ Generating typings for integration webhook-message...
31
31
  ✓ Typings available at .botpress
32
32
 
@@ -66,7 +66,14 @@ const prepareUpdateBotBody = (localBot, remoteBot) => ({
66
66
  ...localBot,
67
67
  states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),
68
68
  recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),
69
- events: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),
69
+ events: utils.attributes.prepareAttributeUpdateBody({
70
+ localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),
71
+ remoteItems: remoteBot.events
72
+ }),
73
+ actions: utils.attributes.prepareAttributeUpdateBody({
74
+ localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions),
75
+ remoteItems: remoteBot.actions
76
+ }),
70
77
  user: {
71
78
  ...localBot.user,
72
79
  tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags)
@@ -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 ? await utils.records.mapValuesAsync(bot.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\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.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n user: {\n ...localBot.user,\n tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags),\n },\n conversation: {\n ...localBot.conversation,\n tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags),\n },\n message: {\n ...localBot.message,\n tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags),\n },\n integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;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,EAAE,IACF;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,EAAE,IACF;AACN;AAEO,MAAM,uBAAuB,CAClC,UACA,eACgC;AAAA,EAChC,GAAG;AAAA,EACH,QAAQ,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,EAC9E,iBAAiB,MAAM,QAAQ,uBAAuB,SAAS,iBAAiB,UAAU,eAAe;AAAA,EACzG,QAAQ,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,EAC9E,MAAM;AAAA,IACJ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,MAAM,MAAM,UAAU,MAAM,IAAI;AAAA,EACtF;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,cAAc,MAAM,UAAU,cAAc,IAAI;AAAA,EACtG;AAAA,EACA,SAAS;AAAA,IACP,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,SAAS,MAAM,UAAU,SAAS,IAAI;AAAA,EAC5F;AAAA,EACA,cAAc,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAClG;",
4
+ "sourcesContent": ["import * 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 ? await utils.records.mapValuesAsync(bot.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\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;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Z,MAAM,MAAM,QAAQ,uBAAuB,SAAS,MAAM,MAAM,UAAU,MAAM,IAAI;AAAA,EACtF;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,cAAc,MAAM,UAAU,cAAc,IAAI;AAAA,EACtG;AAAA,EACA,SAAS;AAAA,IACP,GAAG,SAAS;AAAA,IACZ,MAAM,MAAM,QAAQ,uBAAuB,SAAS,SAAS,MAAM,UAAU,SAAS,IAAI;AAAA,EAC5F;AAAA,EACA,cAAc,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAClG;",
6
6
  "names": []
7
7
  }
@@ -71,17 +71,14 @@ const prepareCreateIntegrationBody = async (integration) => ({
71
71
  })) : void 0
72
72
  });
73
73
  const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
74
- const actions = utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions);
75
- for (const [actionName, action] of Object.entries(actions)) {
76
- if (!action || !remoteIntegration.actions[actionName]) {
77
- continue;
78
- }
79
- action.attributes = utils.records.setNullOnMissingValues(
80
- action.attributes,
81
- remoteIntegration.actions[actionName].attributes
82
- );
83
- }
84
- const events = utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events);
74
+ const actions = utils.attributes.prepareAttributeUpdateBody({
75
+ localItems: utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions),
76
+ remoteItems: remoteIntegration.actions
77
+ });
78
+ const events = utils.attributes.prepareAttributeUpdateBody({
79
+ localItems: utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events),
80
+ remoteItems: remoteIntegration.events
81
+ });
85
82
  const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states);
86
83
  const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities);
87
84
  const user = {
@@ -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.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions)\n\n for (const [actionName, action] of Object.entries(actions)) {\n if (!action || !remoteIntegration.actions[actionName]) {\n continue\n }\n\n action.attributes = utils.records.setNullOnMissingValues(\n action.attributes,\n remoteIntegration.actions[actionName].attributes\n )\n }\n\n const events = utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events)\n const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states)\n const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities)\n const user = {\n ...localIntegration.user,\n tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags),\n }\n\n const channels = _prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels)\n\n const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces)\n\n const configurations = utils.records.setNullOnMissingValues(\n localIntegration.configurations,\n remoteIntegration.configurations\n )\n\n return {\n ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\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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AAe;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;",
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 return {\n ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\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,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF;AAAA,EACJ,UAAU,YAAY,WAClB,MAAM,MAAM,QAAQ,eAAe,YAAY,UAAU,OAAO,aAAa;AAAA,IAC3E,GAAG;AAAA,IACH,UAAU,MAAM,MAAM,QAAQ,eAAe,QAAQ,UAAU,OAAO,aAAa;AAAA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;AAEA,MAAM,wCAAwC,CAC5C,eACA,mBACkC;AAClC,QAAM,cAA6C,CAAC;AAEpD,QAAM,SAAS,MAAM,QAAQ,WAAW,eAAe,cAAc;AACrE,aAAW,CAAC,aAAa,CAAC,cAAc,aAAa,CAAC,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjF,QAAI,gBAAgB,eAAe;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
  }
@@ -66,20 +66,14 @@ const prepareCreateInterfaceBody = async (intrface) => ({
66
66
  })) : {}
67
67
  });
68
68
  const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
69
- const actions = utils.records.setNullOnMissingValues(
70
- localInterface.actions,
71
- remoteInterface.actions
72
- );
73
- for (const [actionName, action] of Object.entries(actions)) {
74
- if (!action || !remoteInterface.actions[actionName]) {
75
- continue;
76
- }
77
- action.attributes = utils.records.setNullOnMissingValues(
78
- action.attributes,
79
- remoteInterface.actions[actionName].attributes
80
- );
81
- }
82
- const events = utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events);
69
+ const actions = utils.attributes.prepareAttributeUpdateBody({
70
+ localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),
71
+ remoteItems: remoteInterface.actions
72
+ });
73
+ const events = utils.attributes.prepareAttributeUpdateBody({
74
+ localItems: utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events),
75
+ remoteItems: remoteInterface.events
76
+ });
83
77
  const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities);
84
78
  const currentChannels = localInterface.channels ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({
85
79
  ...channel,
@@ -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.records.setNullOnMissingValues(\n localInterface.actions,\n remoteInterface.actions\n ) as types.CreateInterfaceRequestBody['actions'] &\n Pick<NonNullable<types.UpdateInterfaceRequestBody['actions']>, 'attributes'>\n\n for (const [actionName, action] of Object.entries(actions)) {\n if (!action || !remoteInterface.actions[actionName]) {\n continue\n }\n\n action.attributes = utils.records.setNullOnMissingValues(\n action.attributes,\n remoteInterface.actions[actionName].attributes\n )\n }\n\n const events = utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events)\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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,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})\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,I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G;AAAA,IACzC;AAAA,EACF,EAAE,IACF;AAEJ,QAAM,WAAW,MAAM,QAAQ,uBAAuB,iBAAiB,gBAAgB,QAAQ;AAE/F,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -69,8 +69,14 @@ const prepareCreatePluginBody = async (plugin) => ({
69
69
  })) : void 0
70
70
  });
71
71
  const prepareUpdatePluginBody = (localPlugin, remotePlugin) => {
72
- const actions = utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions);
73
- const events = utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events);
72
+ const actions = utils.attributes.prepareAttributeUpdateBody({
73
+ localItems: utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions),
74
+ remoteItems: remotePlugin.actions
75
+ });
76
+ const events = utils.attributes.prepareAttributeUpdateBody({
77
+ localItems: utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events),
78
+ remoteItems: remotePlugin.events
79
+ });
74
80
  const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states);
75
81
  return {
76
82
  ...localPlugin,
@@ -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 ? await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n})\n\nexport const prepareUpdatePluginBody = (\n localPlugin: types.UpdatePluginRequestBody,\n remotePlugin: client.Plugin\n): types.UpdatePluginRequestBody => {\n const actions = utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions)\n const events = utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events)\n const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states)\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n user: localPlugin.user, // TODO: allow deleting user tags with null\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;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,SACX,MAAM,MAAM,QAAQ,eAAe,OAAO,QAAQ,OAAO,WAAW;AAAA,IAClE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AACN;AAEO,MAAM,0BAA0B,CACrC,aACA,iBACkC;AAClC,QAAM,UAAU,MAAM,QAAQ,uBAAuB,YAAY,SAAS,aAAa,OAAO;AAC9F,QAAM,SAAS,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAC3F,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 ? await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n})\n\nexport const prepareUpdatePluginBody = (\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,O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AM,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;",
6
6
  "names": []
7
7
  }
@@ -44,14 +44,13 @@ class EventModule extends import_module.Module {
44
44
  this._event = _event;
45
45
  }
46
46
  async getContent() {
47
- return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(
48
- this._event.schema,
49
- this.exportName,
50
- gen.primitiveRecordToTypescriptValues({
47
+ return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._event.schema, this.exportName, {
48
+ ...gen.primitiveRecordToTypescriptValues({
51
49
  title: this._event.title,
52
50
  description: this._event.description
53
- })
54
- );
51
+ }),
52
+ ...this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : void 0
53
+ });
55
54
  }
56
55
  }
57
56
  class EventsModule extends import_module.ReExportVariableModule {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/integration-package/integration-package-definition/events-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(\n this._event.schema,\n this.exportName,\n gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n })\n )\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,KAAK;AAAA,MACL,IAAI,kCAAkC;AAAA,QACpC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._event.schema, this.exportName, {\n ...gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n }),\n ...(this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : undefined),\n })\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,YAAY;AAAA,MAC1E,GAAG,IAAI,kCAAkC;AAAA,QACvC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,MACD,GAAI,KAAK,OAAO,aAAa,EAAE,YAAY,IAAI,oBAAoB,KAAK,OAAO,UAAU,EAAE,IAAI;AAAA,IACjG,CAAC;AAAA,EACH;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
6
  "names": ["module"]
7
7
  }
@@ -47,14 +47,13 @@ class EventModule extends import_module.Module {
47
47
  if (!this._event.schema) {
48
48
  return `export const ${this.exportName} = z.object({});`;
49
49
  }
50
- return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(
51
- this._event.schema,
52
- this.exportName,
53
- gen.primitiveRecordToTypescriptValues({
50
+ return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._event.schema, this.exportName, {
51
+ ...gen.primitiveRecordToTypescriptValues({
54
52
  title: this._event.title,
55
53
  description: this._event.description
56
- })
57
- );
54
+ }),
55
+ ...this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : void 0
56
+ });
58
57
  }
59
58
  }
60
59
  class EventsModule extends import_module.ReExportVariableModule {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/interface-package/interface-package-definition/events-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n if (!this._event.schema) {\n return `export const ${this.exportName} = z.object({});`\n }\n return jsonSchemaToTypescriptZuiSchema(\n this._event.schema,\n this.exportName,\n gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n })\n )\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,CAAC,KAAK,OAAO,QAAQ;AACvB,aAAO,gBAAgB,KAAK;AAAA,IAC9B;AACA,eAAO;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,KAAK;AAAA,MACL,IAAI,kCAAkC;AAAA,QACpC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n if (!this._event.schema) {\n return `export const ${this.exportName} = z.object({});`\n }\n return jsonSchemaToTypescriptZuiSchema(this._event.schema, this.exportName, {\n ...gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n }),\n ...(this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : undefined),\n })\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,QAAI,CAAC,KAAK,OAAO,QAAQ;AACvB,aAAO,gBAAgB,KAAK;AAAA,IAC9B;AACA,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,YAAY;AAAA,MAC1E,GAAG,IAAI,kCAAkC;AAAA,QACvC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,MACD,GAAI,KAAK,OAAO,aAAa,EAAE,YAAY,IAAI,oBAAoB,KAAK,OAAO,UAAU,EAAE,IAAI;AAAA,IACjG,CAAC;AAAA,EACH;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
6
  "names": ["module"]
7
7
  }
@@ -64,10 +64,13 @@ class ActionModule extends import_module.ReExportVariableModule {
64
64
  constructor(actionName, action) {
65
65
  super({
66
66
  exportName: strings.varName(actionName),
67
- extraProps: gen.primitiveRecordToTypescriptValues({
68
- title: action.title,
69
- description: action.description
70
- })
67
+ extraProps: {
68
+ ...gen.primitiveRecordToTypescriptValues({
69
+ title: action.title,
70
+ description: action.description
71
+ }),
72
+ ...action.attributes ? { attributes: gen.stringifySingleLine(action.attributes) } : void 0
73
+ }
71
74
  });
72
75
  const inputModule = new ActionInputModule(action.input);
73
76
  const outputModule = new ActionOutputModule(action.output);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/actions-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\ntype ActionInput = types.ActionDefinition['input']\ntype ActionOutput = types.ActionDefinition['output']\n\nexport class ActionInputModule extends Module {\n public constructor(private _input: ActionInput) {\n const name = 'input'\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._input.schema, this.exportName)\n }\n}\n\nexport class ActionOutputModule extends Module {\n public constructor(private _output: ActionOutput) {\n const name = 'output'\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._output.schema, this.exportName)\n }\n}\n\nexport class ActionModule extends ReExportVariableModule {\n public constructor(actionName: string, action: types.ActionDefinition) {\n super({\n exportName: strings.varName(actionName),\n extraProps: gen.primitiveRecordToTypescriptValues({\n title: action.title,\n description: action.description,\n }),\n })\n\n const inputModule = new ActionInputModule(action.input)\n const outputModule = new ActionOutputModule(action.output)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n }\n}\n\nexport class ActionsModule extends ReExportVariableModule {\n public constructor(actions: Record<string, types.ActionDefinition>) {\n super({ exportName: strings.varName('actions') })\n for (const [actionName, action] of Object.entries(actions)) {\n const module = new ActionModule(actionName, action)\n module.unshift(actionName)\n this.pushDep(module)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAMlB,MAAM,0BAA0B,qBAAO;AAAA,EACrC,YAAoB,QAAqB;AAC9C,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,QAAQ,IAAI;AACvC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,UAAU;AAAA,EAC5E;AACF;AAEO,MAAM,2BAA2B,qBAAO;AAAA,EACtC,YAAoB,SAAuB;AAChD,UAAM,OAAO;AACb,UAAM,aAAa,QAAQ,QAAQ,IAAI;AACvC,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAHf;AAAA,EAI3B;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,QAAQ,QAAQ,KAAK,UAAU;AAAA,EAC7E;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,YAAoB,QAAgC;AACrE,UAAM;AAAA,MACJ,YAAY,QAAQ,QAAQ,UAAU;AAAA,MACtC,YAAY,IAAI,kCAAkC;AAAA,QAChD,OAAO,OAAO;AAAA,QACd,aAAa,OAAO;AAAA,MACtB,CAAC;AAAA,IACH,CAAC;AAED,UAAM,cAAc,IAAI,kBAAkB,OAAO,KAAK;AACtD,UAAM,eAAe,IAAI,mBAAmB,OAAO,MAAM;AAEzD,SAAK,QAAQ,WAAW;AACxB,SAAK,QAAQ,YAAY;AAAA,EAC3B;AACF;AAEO,MAAM,sBAAsB,qCAAuB;AAAA,EACjD,YAAY,SAAiD;AAClE,UAAM,EAAE,YAAY,QAAQ,QAAQ,SAAS,EAAE,CAAC;AAChD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC1D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,MAAAA,QAAO,QAAQ,UAAU;AACzB,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\ntype ActionInput = types.ActionDefinition['input']\ntype ActionOutput = types.ActionDefinition['output']\n\nexport class ActionInputModule extends Module {\n public constructor(private _input: ActionInput) {\n const name = 'input'\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._input.schema, this.exportName)\n }\n}\n\nexport class ActionOutputModule extends Module {\n public constructor(private _output: ActionOutput) {\n const name = 'output'\n const exportName = strings.varName(name)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._output.schema, this.exportName)\n }\n}\n\nexport class ActionModule extends ReExportVariableModule {\n public constructor(actionName: string, action: types.ActionDefinition) {\n super({\n exportName: strings.varName(actionName),\n extraProps: {\n ...gen.primitiveRecordToTypescriptValues({\n title: action.title,\n description: action.description,\n }),\n ...(action.attributes ? { attributes: gen.stringifySingleLine(action.attributes) } : undefined),\n },\n })\n\n const inputModule = new ActionInputModule(action.input)\n const outputModule = new ActionOutputModule(action.output)\n\n this.pushDep(inputModule)\n this.pushDep(outputModule)\n }\n}\n\nexport class ActionsModule extends ReExportVariableModule {\n public constructor(actions: Record<string, types.ActionDefinition>) {\n super({ exportName: strings.varName('actions') })\n for (const [actionName, action] of Object.entries(actions)) {\n const module = new ActionModule(actionName, action)\n module.unsh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AAM,sBAAsB,qCAAuB;AAAA,EACjD,YAAY,SAAiD;AAClE,UAAM,EAAE,YAAY,QAAQ,QAAQ,SAAS,EAAE,CAAC;AAChD,eAAW,CAAC,YAAY,MAAM,KAAK,OAAO,QAAQ,OAAO,GAAG;AAC1D,YAAMA,UAAS,IAAI,aAAa,YAAY,MAAM;AAClD,MAAAA,QAAO,QAAQ,UAAU;AACzB,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
6
  "names": ["module"]
7
7
  }
@@ -44,14 +44,13 @@ class EventModule extends import_module.Module {
44
44
  this._event = _event;
45
45
  }
46
46
  async getContent() {
47
- return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(
48
- this._event.schema,
49
- this.exportName,
50
- gen.primitiveRecordToTypescriptValues({
47
+ return (0, import_generators.jsonSchemaToTypescriptZuiSchema)(this._event.schema, this.exportName, {
48
+ ...gen.primitiveRecordToTypescriptValues({
51
49
  title: this._event.title,
52
50
  description: this._event.description
53
- })
54
- );
51
+ }),
52
+ ...this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : void 0
53
+ });
55
54
  }
56
55
  }
57
56
  class EventsModule extends import_module.ReExportVariableModule {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/events-module.ts"],
4
- "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(\n this._event.schema,\n this.exportName,\n gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n })\n )\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO;AAAA,MACL,KAAK,OAAO;AAAA,MACZ,KAAK;AAAA,MACL,IAAI,kCAAkC;AAAA,QACpC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { jsonSchemaToTypescriptZuiSchema } from '../../generators'\nimport * as gen from '../../generators'\nimport { Module, ReExportVariableModule } from '../../module'\nimport * as strings from '../../strings'\nimport * as types from './typings'\n\nexport class EventModule extends Module {\n public constructor(\n name: string,\n private _event: types.EventDefinition\n ) {\n const eventName = name\n const exportName = strings.varName(eventName)\n super({ path: `${name}.ts`, exportName })\n }\n\n public async getContent() {\n return jsonSchemaToTypescriptZuiSchema(this._event.schema, this.exportName, {\n ...gen.primitiveRecordToTypescriptValues({\n title: this._event.title,\n description: this._event.description,\n }),\n ...(this._event.attributes ? { attributes: gen.stringifySingleLine(this._event.attributes) } : undefined),\n })\n }\n}\n\nexport class EventsModule extends ReExportVariableModule {\n public constructor(events: Record<string, types.EventDefinition>) {\n super({ exportName: strings.varName('events') })\n for (const [eventName, event] of Object.entries(events)) {\n const module = new EventModule(eventName, event)\n this.pushDep(module)\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAgD;AAChD,UAAqB;AACrB,oBAA+C;AAC/C,cAAyB;AAGlB,MAAM,oBAAoB,qBAAO;AAAA,EAC/B,YACL,MACQ,QACR;AACA,UAAM,YAAY;AAClB,UAAM,aAAa,QAAQ,QAAQ,SAAS;AAC5C,UAAM,EAAE,MAAM,GAAG,WAAW,WAAW,CAAC;AAJhC;AAAA,EAKV;AAAA,EAEA,MAAa,aAAa;AACxB,eAAO,mDAAgC,KAAK,OAAO,QAAQ,KAAK,YAAY;AAAA,MAC1E,GAAG,IAAI,kCAAkC;AAAA,QACvC,OAAO,KAAK,OAAO;AAAA,QACnB,aAAa,KAAK,OAAO;AAAA,MAC3B,CAAC;AAAA,MACD,GAAI,KAAK,OAAO,aAAa,EAAE,YAAY,IAAI,oBAAoB,KAAK,OAAO,UAAU,EAAE,IAAI;AAAA,IACjG,CAAC;AAAA,EACH;AACF;AAEO,MAAM,qBAAqB,qCAAuB;AAAA,EAChD,YAAY,QAA+C;AAChE,UAAM,EAAE,YAAY,QAAQ,QAAQ,QAAQ,EAAE,CAAC;AAC/C,eAAW,CAAC,WAAW,KAAK,KAAK,OAAO,QAAQ,MAAM,GAAG;AACvD,YAAMA,UAAS,IAAI,YAAY,WAAW,KAAK;AAC/C,WAAK,QAAQA,OAAM;AAAA,IACrB;AAAA,EACF;AACF;",
6
6
  "names": ["module"]
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 } }\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 & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription & {\n billable?: boolean\n cacheable?: boolean\n input: {\n schema: Schema\n }\n output: {\n schema: Schema\n }\n attributes?: Record<string, string>\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 & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription & {\n billable?: boolean\n cacheable?: boolean\n input: { schema: Schema }\n output: { schema: Schema }\n attributes?: Record<string, string>\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 & { schema: Schema }>\n actions?: Record<string, TitleDescription & 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 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"],
5
5
  "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var attribute_utils_exports = {};
30
+ __export(attribute_utils_exports, {
31
+ prepareAttributeUpdateBody: () => prepareAttributeUpdateBody
32
+ });
33
+ module.exports = __toCommonJS(attribute_utils_exports);
34
+ var records = __toESM(require("./record-utils"));
35
+ const prepareAttributeUpdateBody = ({
36
+ localItems,
37
+ remoteItems
38
+ }) => {
39
+ const clonedLocalItems = structuredClone(localItems);
40
+ for (const [itemName, item] of Object.entries(clonedLocalItems)) {
41
+ if (!item || !remoteItems || !remoteItems[itemName]) {
42
+ continue;
43
+ }
44
+ item.attributes = records.setNullOnMissingValues(item.attributes, remoteItems[itemName].attributes ?? {});
45
+ }
46
+ return clonedLocalItems;
47
+ };
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ prepareAttributeUpdateBody
51
+ });
52
+ //# sourceMappingURL=attribute-utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/attribute-utils.ts"],
4
+ "sourcesContent": ["import * as records from './record-utils'\n\ntype ItemsWithAttributes = Record<\n string,\n {\n attributes?: {\n [key: string]: string | null\n }\n } | null\n>\n\nexport const prepareAttributeUpdateBody = <TLocalItems extends ItemsWithAttributes>({\n localItems,\n remoteItems,\n}: {\n localItems: TLocalItems\n remoteItems: ItemsWithAttributes\n}): TLocalItems => {\n const clonedLocalItems = structuredClone(localItems)\n\n for (const [itemName, item] of Object.entries(clonedLocalItems)) {\n if (!item || !remoteItems || !remoteItems[itemName]) {\n continue\n }\n\n item.attributes = records.setNullOnMissingValues(item.attributes, remoteItems[itemName].attributes ?? {})\n }\n\n return clonedLocalItems\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAAyB;AAWlB,MAAM,6BAA6B,CAA0C;AAAA,EAClF;AAAA,EACA;AACF,MAGmB;AACjB,QAAM,mBAAmB,gBAAgB,UAAU;AAEnD,aAAW,CAAC,UAAU,IAAI,KAAK,OAAO,QAAQ,gBAAgB,GAAG;AAC/D,QAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,YAAY,QAAQ,GAAG;AACnD;AAAA,IACF;AAEA,SAAK,aAAa,QAAQ,uBAAuB,KAAK,YAAY,YAAY,QAAQ,EAAE,cAAc,CAAC,CAAC;AAAA,EAC1G;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -28,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var utils_exports = {};
30
30
  __export(utils_exports, {
31
+ attributes: () => attributes,
31
32
  cache: () => cache,
32
33
  casing: () => casing,
33
34
  emitter: () => emitter,
@@ -51,6 +52,7 @@ __export(utils_exports, {
51
52
  url: () => url
52
53
  });
53
54
  module.exports = __toCommonJS(utils_exports);
55
+ var attributes = __toESM(require("./attribute-utils"));
54
56
  var cache = __toESM(require("./cache-utils"));
55
57
  var casing = __toESM(require("./case-utils"));
56
58
  var emitter = __toESM(require("./event-emitter"));
@@ -74,6 +76,7 @@ var types = __toESM(require("./type-utils"));
74
76
  var url = __toESM(require("./url-utils"));
75
77
  // Annotate the CommonJS export names for ESM import in node:
76
78
  0 && (module.exports = {
79
+ attributes,
77
80
  cache,
78
81
  casing,
79
82
  emitter,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/index.ts"],
4
- "sourcesContent": ["export * as cache from './cache-utils'\nexport * as casing from './case-utils'\nexport * as emitter from './event-emitter'\nexport * as esbuild from './esbuild-utils'\nexport * as filewatcher from './file-watcher'\nexport * as guards from './guard-utils'\nexport * as id from './id-utils'\nexport * as object from './object-utils'\nexport * as path from './path-utils'\nexport * as pkgJson from './pkgjson-utils'\nexport * as promises from './promise-utils'\nexport * as prompt from './prompt-utils'\nexport * as records from './record-utils'\nexport * as require from './require-utils'\nexport * as schema from './schema-utils'\nexport * as semver from './semver-utils'\nexport * as string from './string-utils'\nexport * as template from './template-utils'\nexport * as tunnel from './tunnel-utils'\nexport * as types from './type-utils'\nexport * as url from './url-utils'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,aAAwB;AACxB,cAAyB;AACzB,cAAyB;AACzB,kBAA6B;AAC7B,aAAwB;AACxB,SAAoB;AACpB,aAAwB;AACxB,WAAsB;AACtB,cAAyB;AACzB,eAA0B;AAC1B,aAAwB;AACxB,cAAyB;AACzB,IAAAA,WAAyB;AACzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,eAA0B;AAC1B,aAAwB;AACxB,YAAuB;AACvB,UAAqB;",
4
+ "sourcesContent": ["export * as attributes from './attribute-utils'\nexport * as cache from './cache-utils'\nexport * as casing from './case-utils'\nexport * as emitter from './event-emitter'\nexport * as esbuild from './esbuild-utils'\nexport * as filewatcher from './file-watcher'\nexport * as guards from './guard-utils'\nexport * as id from './id-utils'\nexport * as object from './object-utils'\nexport * as path from './path-utils'\nexport * as pkgJson from './pkgjson-utils'\nexport * as promises from './promise-utils'\nexport * as prompt from './prompt-utils'\nexport * as records from './record-utils'\nexport * as require from './require-utils'\nexport * as schema from './schema-utils'\nexport * as semver from './semver-utils'\nexport * as string from './string-utils'\nexport * as template from './template-utils'\nexport * as tunnel from './tunnel-utils'\nexport * as types from './type-utils'\nexport * as url from './url-utils'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAC5B,YAAuB;AACvB,aAAwB;AACxB,cAAyB;AACzB,cAAyB;AACzB,kBAA6B;AAC7B,aAAwB;AACxB,SAAoB;AACpB,aAAwB;AACxB,WAAsB;AACtB,cAAyB;AACzB,eAA0B;AAC1B,aAAwB;AACxB,cAAyB;AACzB,IAAAA,WAAyB;AACzB,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,eAA0B;AAC1B,aAAwB;AACxB,YAAuB;AACvB,UAAqB;",
6
6
  "names": ["require"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "4.3.5",
3
+ "version": "4.4.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.8.0",
25
- "@botpress/sdk": "4.3.3",
24
+ "@botpress/client": "1.9.0",
25
+ "@botpress/sdk": "4.4.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.8.0",
9
- "@botpress/sdk": "4.3.3"
8
+ "@botpress/client": "1.9.0",
9
+ "@botpress/sdk": "4.4.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.8.0",
10
- "@botpress/sdk": "4.3.3"
9
+ "@botpress/client": "1.9.0",
10
+ "@botpress/sdk": "4.4.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.3.3"
9
+ "@botpress/sdk": "4.4.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.8.0",
10
- "@botpress/sdk": "4.3.3"
9
+ "@botpress/client": "1.9.0",
10
+ "@botpress/sdk": "4.4.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.8.0",
10
- "@botpress/sdk": "4.3.3",
9
+ "@botpress/client": "1.9.0",
10
+ "@botpress/sdk": "4.4.0",
11
11
  "axios": "^1.6.8"
12
12
  },
13
13
  "devDependencies": {