@botpress/cli 6.8.1 → 6.8.3

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.
@@ -1,26 +1,26 @@
1
1
 
2
- > @botpress/cli@6.8.1 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@6.8.3 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run build:types && pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@6.8.1 build:types /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@6.8.3 build:types /home/runner/work/botpress/botpress/packages/cli
7
7
  > tsc -p ./tsconfig.build.json
8
8
 
9
9
 
10
- > @botpress/cli@6.8.1 bundle /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@6.8.3 bundle /home/runner/work/botpress/botpress/packages/cli
11
11
  > ts-node -T build.ts
12
12
 
13
13
 
14
- > @botpress/cli@6.8.1 template:gen /home/runner/work/botpress/botpress/packages/cli
14
+ > @botpress/cli@6.8.3 template:gen /home/runner/work/botpress/botpress/packages/cli
15
15
  > pnpm -r --stream -F @bp-templates/* exec bp gen
16
16
 
17
- 🤖 Botpress CLI v6.8.1
17
+ 🤖 Botpress CLI v6.8.3
18
+ 🤖 Botpress CLI v6.8.3
18
19
  ● Checking if cli is up to date
19
- 🤖 Botpress CLI v6.8.1
20
20
  ● Checking if cli is up to date
21
- 🤖 Botpress CLI v6.8.1
21
+ 🤖 Botpress CLI v6.8.3
22
22
  ● Checking if cli is up to date
23
- 🤖 Botpress CLI v6.8.1
23
+ 🤖 Botpress CLI v6.8.3
24
24
  ● Checking if cli is up to date
25
25
  ● Checking if sdk is up to date
26
26
  ● Checking if sdk is up to date
@@ -29,16 +29,16 @@
29
29
  ○ Generating typings for integration empty-integration...
30
30
  ✓ Typings available at .botpress
31
31
 
32
+ ○ Generating typings for bot...
32
33
  ○ Generating typings for integration hello-world...
33
- ○ Generating typings for plugin empty-plugin...
34
34
  ✓ Typings available at .botpress
35
35
 
36
- ○ Generating typings for bot...
36
+ ○ Generating typings for plugin empty-plugin...
37
37
  ✓ Typings available at .botpress
38
38
 
39
39
  ✓ Typings available at .botpress
40
40
 
41
- 🤖 Botpress CLI v6.8.1
41
+ 🤖 Botpress CLI v6.8.3
42
42
  ● Checking if cli is up to date
43
43
  ● Checking if sdk is up to date
44
44
  ○ Generating typings for integration webhook-message...
@@ -32,19 +32,25 @@ __export(bot_body_exports, {
32
32
  prepareUpdateBotBody: () => prepareUpdateBotBody
33
33
  });
34
34
  module.exports = __toCommonJS(bot_body_exports);
35
+ var errors = __toESM(require("../errors"));
35
36
  var utils = __toESM(require("../utils"));
36
37
  const prepareCreateBotBody = async (bot) => ({
37
38
  user: bot.user,
38
39
  conversation: bot.conversation,
39
40
  message: bot.message,
40
41
  recurringEvents: bot.recurringEvents,
41
- actions: bot.actions ? await utils.records.mapValuesAsync(bot.actions, async (action) => ({
42
+ actions: bot.actions ? await utils.records.mapValuesAsync(bot.actions, async (action, actionName) => ({
42
43
  ...action,
43
44
  input: {
44
45
  ...action.input,
45
46
  schema: await utils.schema.mapZodToJsonSchema(action.input, {
46
47
  useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
47
48
  toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
49
+ }).catch((thrown) => {
50
+ throw errors.BotpressCLIError.wrap(
51
+ thrown,
52
+ `Failed to convert ZUI to JSON schema for bot action ${actionName} input`
53
+ );
48
54
  })
49
55
  },
50
56
  output: {
@@ -52,6 +58,11 @@ const prepareCreateBotBody = async (bot) => ({
52
58
  schema: await utils.schema.mapZodToJsonSchema(action.output, {
53
59
  useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
54
60
  toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
61
+ }).catch((thrown) => {
62
+ throw errors.BotpressCLIError.wrap(
63
+ thrown,
64
+ `Failed to convert ZUI to JSON schema for bot action ${actionName} output`
65
+ );
55
66
  })
56
67
  }
57
68
  })) : void 0,
@@ -60,21 +71,33 @@ const prepareCreateBotBody = async (bot) => ({
60
71
  schema: await utils.schema.mapZodToJsonSchema(bot.configuration, {
61
72
  useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
62
73
  toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
74
+ }).catch((thrown) => {
75
+ throw errors.BotpressCLIError.wrap(thrown, "Failed to convert ZUI to JSON schema for bot configuration");
63
76
  })
64
77
  } : void 0,
65
- events: bot.events ? await utils.records.mapValuesAsync(bot.events, async (event) => ({
78
+ events: bot.events ? await utils.records.mapValuesAsync(bot.events, async (event, eventName) => ({
66
79
  ...event,
67
80
  schema: await utils.schema.mapZodToJsonSchema(event, {
68
81
  useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
69
82
  toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
83
+ }).catch((thrown) => {
84
+ throw errors.BotpressCLIError.wrap(
85
+ thrown,
86
+ `Failed to convert ZUI to JSON schema for bot event ${eventName}`
87
+ );
70
88
  })
71
89
  })) : void 0,
72
90
  states: bot.states ? utils.records.filterValues(
73
- await utils.records.mapValuesAsync(bot.states, async (state) => ({
91
+ await utils.records.mapValuesAsync(bot.states, async (state, stateName) => ({
74
92
  ...state,
75
93
  schema: await utils.schema.mapZodToJsonSchema(state, {
76
94
  useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
77
95
  toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
96
+ }).catch((thrown) => {
97
+ throw errors.BotpressCLIError.wrap(
98
+ thrown,
99
+ `Failed to convert ZUI to JSON schema for bot state ${stateName}`
100
+ );
78
101
  })
79
102
  })),
80
103
  ({ type }) => type !== "workflow"
@@ -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 useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n }),\n },\n }))\n : undefined,\n configuration: bot.configuration\n ? {\n ...bot.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.configuration, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n }),\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.integrations.prepareIntegrationsUpdate(\n utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n remoteBot.integrations\n ),\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,OAAO;AAAA,QAC1D,yBAAyB,IAAI,YAAY;AAAA,QACzC,qBAAqB,IAAI,YAAY;AAAA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AS,iBAAiB,UAAU,eAAe;AAAA,EACzG,QAAQ,MAAM,WAAW,2BAA2B;AAAA,IAClD,YAAY,MAAM,QAAQ,uBAAuB,SAAS,QAAQ,UAAU,MAAM;AAAA,IAClF,aAAa,UAAU;AAAA,EACzB,CAAC;AAAA,EACD,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACnD,YAAY,MAAM,QAAQ,uBAAuB,SAAS,SAAS,UAAU,OAAO;AAAA,IACpF,aAAa,UAAU;AAAA,EACzB,CAAC;AAAA,EACD,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,aAAa;AAAA,IAC/B,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAAA,IAClF,UAAU;AAAA,EACZ;AAAA,EACA,SAAS,MAAM,QAAQ,uBAAuB,SAAS,SAAS,UAAU,OAAO;AAAA,EACjF,MAAM,SAAS;AAAA;AACjB;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\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, actionName) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema\n .mapZodToJsonSchema(action.input, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for bot action ${actionName} input`\n )\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema\n .mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for bot action ${actionName} output`\n )\n }),\n },\n }))\n : undefined,\n configuration: bot.configuration\n ? {\n ...bot.configuration,\n schema: await utils.schema\n .mapZodToJsonSchema(bot.configuration, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, 'Failed to convert ZUI to JSON schema for bot configuration')\n }),\n }\n : undefined,\n events: bot.events\n ? await utils.records.mapValuesAsync(bot.events, async (event, eventName) => ({\n ...event,\n schema: await utils.schema\n .mapZodToJsonSchema(event, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for bot event ${eventName}`\n )\n }),\n }))\n : undefined,\n states: bot.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(bot.states, async (state, stateName) => ({\n ...state,\n schema: await utils.schema\n .mapZodToJsonSchema(state, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `Failed to convert ZUI to JSON schema for bot state ${stateName}`\n )\n }),\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.integrations.prepareIntegrationsUpdate(\n utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n remoteBot.integrations\n ),\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,aAAwB;AACxB,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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U,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,aAAa;AAAA,IAC/B,MAAM,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAAA,IAClF,UAAU;AAAA,EACZ;AAAA,EACA,SAAS,MAAM,QAAQ,uBAAuB,SAAS,SAAS,UAAU,OAAO;AAAA,EACjF,MAAM,SAAS;AAAA;AACjB;",
6
6
  "names": []
7
7
  }
@@ -32,64 +32,83 @@ __export(integration_body_exports, {
32
32
  prepareUpdateIntegrationBody: () => prepareUpdateIntegrationBody
33
33
  });
34
34
  module.exports = __toCommonJS(integration_body_exports);
35
+ var errors = __toESM(require("../errors"));
35
36
  var utils = __toESM(require("../utils"));
36
- const prepareCreateIntegrationBody = async (integration) => ({
37
- name: integration.name,
38
- version: integration.version,
39
- title: "title" in integration ? integration.title : void 0,
40
- description: "description" in integration ? integration.description : void 0,
41
- user: integration.user,
42
- events: integration.events ? await utils.records.mapValuesAsync(integration.events, async (event) => ({
43
- ...event,
44
- schema: await utils.schema.mapZodToJsonSchema(event, {
45
- useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
46
- toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
47
- })
48
- })) : void 0,
49
- actions: integration.actions ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({
50
- ...action,
51
- input: {
52
- ...action.input,
53
- schema: await utils.schema.mapZodToJsonSchema(action.input, {
37
+ const prepareCreateIntegrationBody = async (integration) => {
38
+ const base = `Failed to convert ZUI to JSON schema for integration ${integration.name}`;
39
+ return {
40
+ name: integration.name,
41
+ version: integration.version,
42
+ title: "title" in integration ? integration.title : void 0,
43
+ description: "description" in integration ? integration.description : void 0,
44
+ user: integration.user,
45
+ events: integration.events ? await utils.records.mapValuesAsync(integration.events, async (event, eventName) => ({
46
+ ...event,
47
+ schema: await utils.schema.mapZodToJsonSchema(event, {
54
48
  useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
55
49
  toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
50
+ }).catch((thrown) => {
51
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for event ${eventName}`);
56
52
  })
57
- },
58
- output: {
59
- ...action.output,
60
- schema: await utils.schema.mapZodToJsonSchema(action.output, {
53
+ })) : void 0,
54
+ actions: integration.actions ? await utils.records.mapValuesAsync(integration.actions, async (action, actionName) => ({
55
+ ...action,
56
+ input: {
57
+ ...action.input,
58
+ schema: await utils.schema.mapZodToJsonSchema(action.input, {
59
+ useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
60
+ toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
61
+ }).catch((thrown) => {
62
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} input`);
63
+ })
64
+ },
65
+ output: {
66
+ ...action.output,
67
+ schema: await utils.schema.mapZodToJsonSchema(action.output, {
68
+ useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
69
+ toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
70
+ }).catch((thrown) => {
71
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} output`);
72
+ })
73
+ }
74
+ })) : void 0,
75
+ channels: integration.channels ? await utils.records.mapValuesAsync(integration.channels, async (channel, channelName) => ({
76
+ ...channel,
77
+ messages: await utils.records.mapValuesAsync(channel.messages, async (message, messageName) => ({
78
+ ...message,
79
+ schema: await utils.schema.mapZodToJsonSchema(message, {
80
+ useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
81
+ toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
82
+ }).catch((thrown) => {
83
+ throw errors.BotpressCLIError.wrap(
84
+ thrown,
85
+ `${base} for channel ${channelName} for message ${messageName}`
86
+ );
87
+ })
88
+ }))
89
+ })) : void 0,
90
+ states: integration.states ? await utils.records.mapValuesAsync(integration.states, async (state, stateName) => ({
91
+ ...state,
92
+ schema: await utils.schema.mapZodToJsonSchema(state, {
61
93
  useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
62
94
  toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
95
+ }).catch((thrown) => {
96
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for state ${stateName}`);
63
97
  })
64
- }
65
- })) : void 0,
66
- channels: integration.channels ? await utils.records.mapValuesAsync(integration.channels, async (channel) => ({
67
- ...channel,
68
- messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
69
- ...message,
70
- schema: await utils.schema.mapZodToJsonSchema(message, {
98
+ })) : void 0,
99
+ entities: integration.entities ? await utils.records.mapValuesAsync(integration.entities, async (entity, entityName) => ({
100
+ ...entity,
101
+ schema: await utils.schema.mapZodToJsonSchema(entity, {
71
102
  useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
72
103
  toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
104
+ }).catch((thrown) => {
105
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for entity ${entityName}`);
73
106
  })
74
- }))
75
- })) : void 0,
76
- states: integration.states ? await utils.records.mapValuesAsync(integration.states, async (state) => ({
77
- ...state,
78
- schema: await utils.schema.mapZodToJsonSchema(state, {
79
- useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
80
- toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
81
- })
82
- })) : void 0,
83
- entities: integration.entities ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({
84
- ...entity,
85
- schema: await utils.schema.mapZodToJsonSchema(entity, {
86
- useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
87
- toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
88
- })
89
- })) : void 0,
90
- attributes: integration.attributes,
91
- extraOperations: "__advanced" in integration ? integration.__advanced?.extraOperations : void 0
92
- });
107
+ })) : void 0,
108
+ attributes: integration.attributes,
109
+ extraOperations: "__advanced" in integration ? integration.__advanced?.extraOperations : void 0
110
+ };
111
+ };
93
112
  const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
94
113
  const actions = utils.attributes.prepareAttributeUpdateBody({
95
114
  localItems: utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions),
@@ -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\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 useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n }),\n }))\n : undefined,\n attributes: integration.attributes,\n extraOperations: '__advanced' in integration ? integration.__advanced?.extraOperations : 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\n const attributes = utils.records.setNullOnMissingValues(localIntegration.attributes, remoteIntegration.attributes)\n\n const extraOperations = localIntegration.extraOperations\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 extraOperations,\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,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AAG,YAAY,oBAC5D;AACA,qBAAe,mBAAmB,kBAAkB;AACpD,qBAAe,eAAe,UAAU,MAAM,kBAAkB,eAAe,UAAU;AACzF,qBAAe,eAAe,UAAU,EAAE,eAAe,kBAAkB,eAAe,UAAU,EAAE;AACtG,qBAAe,eAAe,UAAU,EAAE,WAAW,qBAAqB;AAC1E,qBAAe,eAAe,UAAU,EAAE,WAAW,WAAW;AAAA,IAClE;AAAA,EACF;AAEA,SAAO;AACT;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;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateIntegrationBody = async (\n integration: sdk.IntegrationDefinition\n): Promise<types.CreateIntegrationRequestBody> => {\n const base = `Failed to convert ZUI to JSON schema for integration ${integration.name}`\n return {\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, eventName) => ({\n ...event,\n schema: await utils.schema\n .mapZodToJsonSchema(event, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for event ${eventName}`)\n }),\n }))\n : undefined,\n actions: integration.actions\n ? await utils.records.mapValuesAsync(integration.actions, async (action, actionName) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema\n .mapZodToJsonSchema(action.input, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} input`)\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema\n .mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} output`)\n }),\n },\n }))\n : undefined,\n channels: integration.channels\n ? await utils.records.mapValuesAsync(integration.channels, async (channel, channelName) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message, messageName) => ({\n ...message,\n schema: await utils.schema\n .mapZodToJsonSchema(message, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `${base} for channel ${channelName} for message ${messageName}`\n )\n }),\n })),\n }))\n : undefined,\n states: integration.states\n ? await utils.records.mapValuesAsync(integration.states, async (state, stateName) => ({\n ...state,\n schema: await utils.schema\n .mapZodToJsonSchema(state, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for state ${stateName}`)\n }),\n }))\n : undefined,\n entities: integration.entities\n ? await utils.records.mapValuesAsync(integration.entities, async (entity, entityName) => ({\n ...entity,\n schema: await utils.schema\n .mapZodToJsonSchema(entity, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for entity ${entityName}`)\n }),\n }))\n : undefined,\n attributes: integration.attributes,\n extraOperations: '__advanced' in integration ? integration.__advanced?.extraOperations : undefined,\n }\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 const extraOperations = localIntegration.extraOperations\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 extraOperations,\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,aAAwB;AACxB,YAAuB;AAGhB,MAAM,+BAA+B,OAC1C,gBACgD;AAChD,QAAM,OAAO,wDAAwD,YAAY,IAAI;AACrF,SAAO;AAAA,IACL,MAAM,YAAY;AAAA,IAClB,SAAS,YAAY;AAAA,IACrB,OAAO,WAAW,cAAc,YAAY,QAAQ;AAAA,IACpD,aAAa,iBAAiB,cA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jF,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
  }
@@ -32,55 +32,72 @@ __export(interface_body_exports, {
32
32
  prepareUpdateInterfaceBody: () => prepareUpdateInterfaceBody
33
33
  });
34
34
  module.exports = __toCommonJS(interface_body_exports);
35
+ var errors = __toESM(require("../errors"));
35
36
  var utils = __toESM(require("../utils"));
36
- const prepareCreateInterfaceBody = async (intrface) => ({
37
- name: intrface.name,
38
- version: intrface.version,
39
- title: "title" in intrface ? intrface.title : void 0,
40
- description: "description" in intrface ? intrface.description : void 0,
41
- entities: intrface.entities ? await utils.records.mapValuesAsync(intrface.entities, async (entity) => ({
42
- ...entity,
43
- schema: await utils.schema.mapZodToJsonSchema(entity, {
44
- useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
45
- toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
46
- })
47
- })) : {},
48
- events: intrface.events ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({
49
- ...event,
50
- schema: await utils.schema.mapZodToJsonSchema(event, {
51
- useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
52
- toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
53
- })
54
- })) : {},
55
- actions: intrface.actions ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({
56
- ...action,
57
- input: {
58
- ...action.input,
59
- schema: await utils.schema.mapZodToJsonSchema(action.input, {
60
- useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
61
- toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
62
- })
63
- },
64
- output: {
65
- ...action.output,
66
- schema: await utils.schema.mapZodToJsonSchema(action.output, {
37
+ const prepareCreateInterfaceBody = async (intrface) => {
38
+ const base = `Failed to convert ZUI to JSON schema for interface ${intrface.name}`;
39
+ return {
40
+ name: intrface.name,
41
+ version: intrface.version,
42
+ title: "title" in intrface ? intrface.title : void 0,
43
+ description: "description" in intrface ? intrface.description : void 0,
44
+ entities: intrface.entities ? await utils.records.mapValuesAsync(intrface.entities, async (entity, entityName) => ({
45
+ ...entity,
46
+ schema: await utils.schema.mapZodToJsonSchema(entity, {
67
47
  useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
68
48
  toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
49
+ }).catch((thrown) => {
50
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for entity ${entityName}`);
69
51
  })
70
- }
71
- })) : {},
72
- channels: intrface.channels ? await utils.records.mapValuesAsync(intrface.channels, async (channel) => ({
73
- ...channel,
74
- messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
75
- ...message,
76
- schema: await utils.schema.mapZodToJsonSchema(message, {
52
+ })) : {},
53
+ events: intrface.events ? await utils.records.mapValuesAsync(intrface.events, async (event, eventName) => ({
54
+ ...event,
55
+ schema: await utils.schema.mapZodToJsonSchema(event, {
77
56
  useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
78
57
  toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
58
+ }).catch((thrown) => {
59
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for event ${eventName}`);
79
60
  })
80
- }))
81
- })) : {},
82
- attributes: intrface.attributes
83
- });
61
+ })) : {},
62
+ actions: intrface.actions ? await utils.records.mapValuesAsync(intrface.actions, async (action, actionName) => ({
63
+ ...action,
64
+ input: {
65
+ ...action.input,
66
+ schema: await utils.schema.mapZodToJsonSchema(action.input, {
67
+ useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
68
+ toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
69
+ }).catch((thrown) => {
70
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} input`);
71
+ })
72
+ },
73
+ output: {
74
+ ...action.output,
75
+ schema: await utils.schema.mapZodToJsonSchema(action.output, {
76
+ useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
77
+ toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
78
+ }).catch((thrown) => {
79
+ throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} output`);
80
+ })
81
+ }
82
+ })) : {},
83
+ channels: intrface.channels ? await utils.records.mapValuesAsync(intrface.channels, async (channel, channelName) => ({
84
+ ...channel,
85
+ messages: await utils.records.mapValuesAsync(channel.messages, async (message, messageName) => ({
86
+ ...message,
87
+ schema: await utils.schema.mapZodToJsonSchema(message, {
88
+ useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
89
+ toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
90
+ }).catch((thrown) => {
91
+ throw errors.BotpressCLIError.wrap(
92
+ thrown,
93
+ `${base} for channel ${channelName} for message ${messageName}`
94
+ );
95
+ })
96
+ }))
97
+ })) : {},
98
+ attributes: intrface.attributes
99
+ };
100
+ };
84
101
  const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
85
102
  const actions = utils.attributes.prepareAttributeUpdateBody({
86
103
  localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),
@@ -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\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 useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n }),\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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AAAA,IACH,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;",
4
+ "sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as errors from '../errors'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateInterfaceBody = async (\n intrface: sdk.InterfaceDefinition\n): Promise<types.CreateInterfaceRequestBody> => {\n const base = `Failed to convert ZUI to JSON schema for interface ${intrface.name}`\n return {\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, entityName) => ({\n ...entity,\n schema: await utils.schema\n .mapZodToJsonSchema(entity, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for entity ${entityName}`)\n }),\n }))\n : {},\n events: intrface.events\n ? await utils.records.mapValuesAsync(intrface.events, async (event, eventName) => ({\n ...event,\n schema: await utils.schema\n .mapZodToJsonSchema(event, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for event ${eventName}`)\n }),\n }))\n : {},\n actions: intrface.actions\n ? await utils.records.mapValuesAsync(intrface.actions, async (action, actionName) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema\n .mapZodToJsonSchema(action.input, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} input`)\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema\n .mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(thrown, `${base} for action ${actionName} output`)\n }),\n },\n }))\n : {},\n channels: intrface.channels\n ? await utils.records.mapValuesAsync(intrface.channels, async (channel, channelName) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message, messageName) => ({\n ...message,\n schema: await utils.schema\n .mapZodToJsonSchema(message, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions,\n })\n .catch((thrown) => {\n throw errors.BotpressCLIError.wrap(\n thrown,\n `${base} for channel ${channelName} for message ${messageName}`\n )\n }),\n })),\n }))\n : {},\n attributes: intrface.attributes,\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 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,aAAwB;AACxB,YAAuB;AAGhB,MAAM,6BAA6B,OACxC,aAC8C;AAC9C,QAAM,OAAO,sDAAsD,SAAS,IAAI;AAChF,SAAO;AAAA,IACL,MAAM,SAAS;AAAA,IACf,SAAS,SAAS;AAAA,IAClB,OAAO,WAAW,WAAW,SAAS,QAAQ;AAAA,IAC9C,aAAa,iBAAiB,WAAW,SAAS,cAAc;AAA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