@botpress/cli 4.7.0 → 4.8.1
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.
- package/.turbo/turbo-build.log +11 -11
- package/dist/api/bot-body.js +5 -2
- package/dist/api/bot-body.js.map +2 -2
- package/dist/api/integration-body.js +5 -2
- package/dist/api/integration-body.js.map +2 -2
- package/dist/api/interface-body.js +5 -2
- package/dist/api/interface-body.js.map +2 -2
- package/dist/api/plugin-body.js +5 -2
- package/dist/api/plugin-body.js.map +2 -2
- package/dist/code-generation/integration-package/integration-package-definition/index.js +2 -0
- package/dist/code-generation/integration-package/integration-package-definition/index.js.map +2 -2
- package/dist/code-generation/interface-package/interface-package-definition/index.js +3 -0
- package/dist/code-generation/interface-package/interface-package-definition/index.js.map +2 -2
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js +2 -0
- package/dist/code-generation/plugin-package/plugin-package-definition/index.js.map +2 -2
- package/dist/code-generation/typings.js.map +1 -1
- package/package.json +3 -3
- package/templates/empty-bot/package.json +2 -2
- package/templates/empty-integration/package.json +2 -2
- package/templates/empty-plugin/package.json +1 -1
- package/templates/hello-world/package.json +2 -2
- package/templates/webhook-message/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@4.
|
|
2
|
+
> @botpress/cli@4.8.1 build /home/runner/work/botpress/botpress/packages/cli
|
|
3
3
|
> pnpm run bundle && pnpm run template:gen
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/cli@4.
|
|
6
|
+
> @botpress/cli@4.8.1 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> ts-node -T build.ts
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@4.
|
|
10
|
+
> @botpress/cli@4.8.1 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.
|
|
14
|
-
🤖 Botpress CLI v4.
|
|
15
|
-
🤖 Botpress CLI v4.
|
|
16
|
-
🤖 Botpress CLI v4.
|
|
13
|
+
🤖 Botpress CLI v4.8.1
|
|
14
|
+
🤖 Botpress CLI v4.8.1
|
|
15
|
+
🤖 Botpress CLI v4.8.1
|
|
16
|
+
🤖 Botpress CLI v4.8.1
|
|
17
17
|
○ Generating typings for plugin empty-plugin...
|
|
18
18
|
✓ Typings available at .botpress
|
|
19
19
|
|
|
20
|
-
○ Generating typings for
|
|
20
|
+
○ Generating typings for bot...
|
|
21
21
|
✓ Typings available at .botpress
|
|
22
22
|
|
|
23
|
-
○ Generating typings for integration
|
|
24
|
-
○ Generating typings for bot...
|
|
23
|
+
○ Generating typings for integration empty-integration...
|
|
25
24
|
✓ Typings available at .botpress
|
|
26
25
|
|
|
26
|
+
○ Generating typings for integration hello-world...
|
|
27
27
|
✓ Typings available at .botpress
|
|
28
28
|
|
|
29
|
-
🤖 Botpress CLI v4.
|
|
29
|
+
🤖 Botpress CLI v4.8.1
|
|
30
30
|
○ Generating typings for integration webhook-message...
|
|
31
31
|
✓ Typings available at .botpress
|
|
32
32
|
|
package/dist/api/bot-body.js
CHANGED
|
@@ -63,7 +63,8 @@ const prepareCreateBotBody = async (bot) => ({
|
|
|
63
63
|
schema: await utils.schema.mapZodToJsonSchema(state)
|
|
64
64
|
})),
|
|
65
65
|
({ type }) => type !== "workflow"
|
|
66
|
-
) : void 0
|
|
66
|
+
) : void 0,
|
|
67
|
+
tags: bot.attributes
|
|
67
68
|
});
|
|
68
69
|
const prepareUpdateBotBody = (localBot, remoteBot) => ({
|
|
69
70
|
...localBot,
|
|
@@ -90,7 +91,9 @@ const prepareUpdateBotBody = (localBot, remoteBot) => ({
|
|
|
90
91
|
tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags)
|
|
91
92
|
},
|
|
92
93
|
integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),
|
|
93
|
-
plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins)
|
|
94
|
+
plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),
|
|
95
|
+
tags: localBot.tags
|
|
96
|
+
// TODO: allow removing bot tags (aka attributes) by setting to null
|
|
94
97
|
});
|
|
95
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
96
99
|
0 && (module.exports = {
|
package/dist/api/bot-body.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api/bot-body.ts"],
|
|
4
|
-
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateBotBody = async (bot: sdk.BotDefinition): Promise<types.CreateBotRequestBody> => ({\n user: bot.user,\n conversation: bot.conversation,\n message: bot.message,\n recurringEvents: bot.recurringEvents,\n actions: bot.actions\n ? await utils.records.mapValuesAsync(bot.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n configuration: bot.configuration\n ? {\n ...bot.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.configuration),\n }\n : undefined,\n events: bot.events\n ? await utils.records.mapValuesAsync(bot.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n states: bot.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(bot.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreateBotRequestBody['states'])\n : undefined,\n})\n\nexport const prepareUpdateBotBody = (\n localBot: types.UpdateBotRequestBody,\n remoteBot: client.Bot\n): types.UpdateBotRequestBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n remoteItems: remoteBot.events,\n }),\n actions: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions),\n remoteItems: remoteBot.actions,\n }),\n user: {\n ...localBot.user,\n tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags),\n },\n conversation: {\n ...localBot.conversation,\n tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags),\n },\n message: {\n ...localBot.message,\n tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags),\n },\n integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),\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,SACP,MAAM,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,eAAe,IAAI,QAAQ,OAAO,WAAW;AAAA,MAC/D,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,IACrD,EAAE;AAAA,IACF,CAAC,EAAE,KAAK,MAAM,SAAS;AAAA,EACzB,IACA;
|
|
4
|
+
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateBotBody = async (bot: sdk.BotDefinition): Promise<types.CreateBotRequestBody> => ({\n user: bot.user,\n conversation: bot.conversation,\n message: bot.message,\n recurringEvents: bot.recurringEvents,\n actions: bot.actions\n ? await utils.records.mapValuesAsync(bot.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n configuration: bot.configuration\n ? {\n ...bot.configuration,\n schema: await utils.schema.mapZodToJsonSchema(bot.configuration),\n }\n : undefined,\n events: bot.events\n ? await utils.records.mapValuesAsync(bot.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n states: bot.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(bot.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreateBotRequestBody['states'])\n : undefined,\n tags: bot.attributes,\n})\n\nexport const prepareUpdateBotBody = (\n localBot: types.UpdateBotRequestBody,\n remoteBot: client.Bot\n): types.UpdateBotRequestBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n remoteItems: remoteBot.events,\n }),\n actions: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions),\n remoteItems: remoteBot.actions,\n }),\n user: {\n ...localBot.user,\n tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags),\n },\n conversation: {\n ...localBot.conversation,\n tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags),\n },\n message: {\n ...localBot.message,\n tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags),\n },\n integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),\n tags: localBot.tags, // TODO: allow removing bot tags (aka attributes) by setting to null\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,uBAAuB,OAAO,SAAiE;AAAA,EAC1G,MAAM,IAAI;AAAA,EACV,cAAc,IAAI;AAAA,EAClB,SAAS,IAAI;AAAA,EACb,iBAAiB,IAAI;AAAA,EACrB,SAAS,IAAI,UACT,MAAM,MAAM,QAAQ,eAAe,IAAI,SAAS,OAAO,YAAY;AAAA,IACjE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAA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a,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,QAAQ,uBAAuB,SAAS,cAAc,UAAU,YAAY;AAAA,EAChG,SAAS,MAAM,QAAQ,uBAAuB,SAAS,SAAS,UAAU,OAAO;AAAA,EACjF,MAAM,SAAS;AAAA;AACjB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -68,7 +68,8 @@ const prepareCreateIntegrationBody = async (integration) => ({
|
|
|
68
68
|
entities: integration.entities ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({
|
|
69
69
|
...entity,
|
|
70
70
|
schema: await utils.schema.mapZodToJsonSchema(entity)
|
|
71
|
-
})) : void 0
|
|
71
|
+
})) : void 0,
|
|
72
|
+
attributes: integration.attributes
|
|
72
73
|
});
|
|
73
74
|
const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
|
|
74
75
|
const actions = utils.attributes.prepareAttributeUpdateBody({
|
|
@@ -93,6 +94,7 @@ const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
|
|
|
93
94
|
);
|
|
94
95
|
const readme = localIntegration.readme;
|
|
95
96
|
const icon = localIntegration.icon;
|
|
97
|
+
const attributes = utils.records.setNullOnMissingValues(localIntegration.attributes, remoteIntegration.attributes);
|
|
96
98
|
return {
|
|
97
99
|
..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),
|
|
98
100
|
actions,
|
|
@@ -104,7 +106,8 @@ const prepareUpdateIntegrationBody = (localIntegration, remoteIntegration) => {
|
|
|
104
106
|
interfaces,
|
|
105
107
|
configurations,
|
|
106
108
|
readme,
|
|
107
|
-
icon
|
|
109
|
+
icon,
|
|
110
|
+
attributes
|
|
108
111
|
};
|
|
109
112
|
};
|
|
110
113
|
const _maybeRemoveVrlScripts = (localIntegration, remoteIntegration) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api/integration-body.ts"],
|
|
4
|
-
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateIntegrationBody = async (\n integration: sdk.IntegrationDefinition | sdk.IntegrationPackage['definition']\n): Promise<types.CreateIntegrationRequestBody> => ({\n name: integration.name,\n version: integration.version,\n title: 'title' in integration ? integration.title : undefined,\n description: 'description' in integration ? integration.description : undefined,\n user: integration.user,\n events: integration.events\n ? await utils.records.mapValuesAsync(integration.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: integration.actions\n ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n channels: integration.channels\n ? await utils.records.mapValuesAsync(integration.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : undefined,\n states: integration.states\n ? await utils.records.mapValuesAsync(integration.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n }))\n : undefined,\n entities: integration.entities\n ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : undefined,\n})\n\ntype UpdateIntegrationChannelsBody = NonNullable<types.UpdateIntegrationRequestBody['channels']>\ntype UpdateIntegrationChannelBody = UpdateIntegrationChannelsBody[string]\ntype Channels = client.Integration['channels']\ntype Channel = client.Integration['channels'][string]\nexport const prepareUpdateIntegrationBody = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions),\n remoteItems: remoteIntegration.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events),\n remoteItems: remoteIntegration.events,\n })\n const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states)\n const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities)\n const user = {\n ...localIntegration.user,\n tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags),\n }\n\n const channels = _prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels)\n\n const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces)\n\n const configurations = utils.records.setNullOnMissingValues(\n localIntegration.configurations,\n remoteIntegration.configurations\n )\n\n const readme = localIntegration.readme\n const icon = localIntegration.icon\n return {\n ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\n readme,\n icon,\n }\n}\n\nconst _maybeRemoveVrlScripts = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const newIntegration = structuredClone(localIntegration)\n\n if (\n remoteIntegration.configuration?.identifier?.linkTemplateScript &&\n !localIntegration.configuration?.identifier?.linkTemplateScript\n ) {\n newIntegration.configuration ??= remoteIntegration.configuration\n newIntegration.configuration.identifier ??= remoteIntegration.configuration.identifier\n newIntegration.configuration.identifier.linkTemplateScript = null\n newIntegration.configuration.identifier.required = false\n }\n\n if (remoteIntegration.identifier.extractScript && !localIntegration.identifier?.extractScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.extractScript = null\n }\n\n if (remoteIntegration.identifier.fallbackHandlerScript && !localIntegration.identifier?.fallbackHandlerScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.fallbackHandlerScript = null\n }\n\n for (const configName of Object.keys(localIntegration.configurations ?? {})) {\n if (\n remoteIntegration.configurations[configName]?.identifier.linkTemplateScript &&\n !localIntegration.configurations?.[configName]?.identifier?.linkTemplateScript\n ) {\n newIntegration.configurations ??= remoteIntegration.configurations\n newIntegration.configurations[configName] ??= remoteIntegration.configurations[configName]\n newIntegration.configurations[configName].identifier ??= remoteIntegration.configurations[configName].identifier\n newIntegration.configurations[configName].identifier.linkTemplateScript = null\n newIntegration.configurations[configName].identifier.required = false\n }\n }\n\n return newIntegration\n}\n\nconst _prepareUpdateIntegrationChannelsBody = (\n localChannels: UpdateIntegrationChannelsBody,\n remoteChannels: Channels\n): UpdateIntegrationChannelsBody => {\n const channelBody: UpdateIntegrationChannelsBody = {}\n\n const zipped = utils.records.zipObjects(localChannels, remoteChannels)\n for (const [channelName, [localChannel, remoteChannel]] of Object.entries(zipped)) {\n if (localChannel && remoteChannel) {\n // channel has to be updated\n channelBody[channelName] = _prepareUpdateIntegrationChannelBody(localChannel, remoteChannel)\n } else if (localChannel) {\n // channel has to be created\n channelBody[channelName] = localChannel\n continue\n } else if (remoteChannel) {\n // channel has to be deleted\n channelBody[channelName] = null\n continue\n }\n }\n\n return channelBody\n}\n\nconst _prepareUpdateIntegrationChannelBody = (\n localChannel: UpdateIntegrationChannelBody,\n remoteChannel: Channel\n): UpdateIntegrationChannelBody => ({\n ...localChannel,\n messages: utils.records.setNullOnMissingValues(localChannel?.messages, remoteChannel.messages),\n message: {\n ...localChannel?.message,\n tags: utils.records.setNullOnMissingValues(localChannel?.message?.tags, remoteChannel.message.tags),\n },\n conversation: {\n ...localChannel?.conversation,\n tags: utils.records.setNullOnMissingValues(localChannel?.conversation?.tags, remoteChannel.conversation.tags),\n },\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,+BAA+B,OAC1C,iBACiD;AAAA,EACjD,MAAM,YAAY;AAAA,EAClB,SAAS,YAAY;AAAA,EACrB,OAAO,WAAW,cAAc,YAAY,QAAQ;AAAA,EACpD,aAAa,iBAAiB,cAAc,YAAY,cAAc;AAAA,EACtE,MAAM,YAAY;AAAA,EAClB,QAAQ,YAAY,SAChB,MAAM,MAAM,QAAQ,eAAe,YAAY,QAAQ,OAAO,WAAW;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AAAA,EACJ,SAAS,YAAY,UACjB,MAAM,MAAM,QAAQ,eAAe,YAAY,SAAS,OAAO,YAAY;AAAA,IACzE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,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,MACjF,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO;AAAA,IACvD,EAAE;AAAA,EACJ,EAAE,IACF;AAAA,EACJ,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,UAAU,YAAY,WAClB,MAAM,MAAM,QAAQ,eAAe,YAAY,UAAU,OAAO,YAAY;AAAA,IAC1E,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,MAAM;AAAA,EACtD,EAAE,IACF;
|
|
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 attributes: integration.attributes,\n})\n\ntype UpdateIntegrationChannelsBody = NonNullable<types.UpdateIntegrationRequestBody['channels']>\ntype UpdateIntegrationChannelBody = UpdateIntegrationChannelsBody[string]\ntype Channels = client.Integration['channels']\ntype Channel = client.Integration['channels'][string]\nexport const prepareUpdateIntegrationBody = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.actions, remoteIntegration.actions),\n remoteItems: remoteIntegration.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localIntegration.events, remoteIntegration.events),\n remoteItems: remoteIntegration.events,\n })\n const states = utils.records.setNullOnMissingValues(localIntegration.states, remoteIntegration.states)\n const entities = utils.records.setNullOnMissingValues(localIntegration.entities, remoteIntegration.entities)\n const user = {\n ...localIntegration.user,\n tags: utils.records.setNullOnMissingValues(localIntegration.user?.tags, remoteIntegration.user?.tags),\n }\n\n const channels = _prepareUpdateIntegrationChannelsBody(localIntegration.channels ?? {}, remoteIntegration.channels)\n\n const interfaces = utils.records.setNullOnMissingValues(localIntegration.interfaces, remoteIntegration.interfaces)\n\n const configurations = utils.records.setNullOnMissingValues(\n localIntegration.configurations,\n remoteIntegration.configurations\n )\n\n const readme = localIntegration.readme\n const icon = localIntegration.icon\n\n const attributes = utils.records.setNullOnMissingValues(localIntegration.attributes, remoteIntegration.attributes)\n\n return {\n ..._maybeRemoveVrlScripts(localIntegration, remoteIntegration),\n actions,\n events,\n states,\n entities,\n user,\n channels,\n interfaces,\n configurations,\n readme,\n icon,\n attributes,\n }\n}\n\nconst _maybeRemoveVrlScripts = (\n localIntegration: types.UpdateIntegrationRequestBody,\n remoteIntegration: client.Integration\n): types.UpdateIntegrationRequestBody => {\n const newIntegration = structuredClone(localIntegration)\n\n if (\n remoteIntegration.configuration?.identifier?.linkTemplateScript &&\n !localIntegration.configuration?.identifier?.linkTemplateScript\n ) {\n newIntegration.configuration ??= remoteIntegration.configuration\n newIntegration.configuration.identifier ??= remoteIntegration.configuration.identifier\n newIntegration.configuration.identifier.linkTemplateScript = null\n newIntegration.configuration.identifier.required = false\n }\n\n if (remoteIntegration.identifier.extractScript && !localIntegration.identifier?.extractScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.extractScript = null\n }\n\n if (remoteIntegration.identifier.fallbackHandlerScript && !localIntegration.identifier?.fallbackHandlerScript) {\n newIntegration.identifier ??= remoteIntegration.identifier\n newIntegration.identifier.fallbackHandlerScript = null\n }\n\n for (const configName of Object.keys(localIntegration.configurations ?? {})) {\n if (\n remoteIntegration.configurations[configName]?.identifier.linkTemplateScript &&\n !localIntegration.configurations?.[configName]?.identifier?.linkTemplateScript\n ) {\n newIntegration.configurations ??= remoteIntegration.configurations\n newIntegration.configurations[configName] ??= remoteIntegration.configurations[configName]\n newIntegration.configurations[configName].identifier ??= remoteIntegration.configurations[configName].identifier\n newIntegration.configurations[configName].identifier.linkTemplateScript = null\n newIntegration.configurations[configName].identifier.required = false\n }\n }\n\n return newIntegration\n}\n\nconst _prepareUpdateIntegrationChannelsBody = (\n localChannels: UpdateIntegrationChannelsBody,\n remoteChannels: Channels\n): UpdateIntegrationChannelsBody => {\n const channelBody: UpdateIntegrationChannelsBody = {}\n\n const zipped = utils.records.zipObjects(localChannels, remoteChannels)\n for (const [channelName, [localChannel, remoteChannel]] of Object.entries(zipped)) {\n if (localChannel && remoteChannel) {\n // channel has to be updated\n channelBody[channelName] = _prepareUpdateIntegrationChannelBody(localChannel, remoteChannel)\n } else if (localChannel) {\n // channel has to be created\n channelBody[channelName] = localChannel\n continue\n } else if (remoteChannel) {\n // channel has to be deleted\n channelBody[channelName] = null\n continue\n }\n }\n\n return channelBody\n}\n\nconst _prepareUpdateIntegrationChannelBody = (\n localChannel: UpdateIntegrationChannelBody,\n remoteChannel: Channel\n): UpdateIntegrationChannelBody => ({\n ...localChannel,\n messages: utils.records.setNullOnMissingValues(localChannel?.messages, remoteChannel.messages),\n message: {\n ...localChannel?.message,\n tags: utils.records.setNullOnMissingValues(localChannel?.message?.tags, remoteChannel.message.tags),\n },\n conversation: {\n ...localChannel?.conversation,\n tags: utils.records.setNullOnMissingValues(localChannel?.conversation?.tags, remoteChannel.conversation.tags),\n },\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,+BAA+B,OAC1C,iBACiD;AAAA,EACjD,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,aAA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(message)
|
|
65
65
|
}))
|
|
66
|
-
})) : {}
|
|
66
|
+
})) : {},
|
|
67
|
+
attributes: intrface.attributes
|
|
67
68
|
});
|
|
68
69
|
const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
|
|
69
70
|
const actions = utils.attributes.prepareAttributeUpdateBody({
|
|
@@ -83,12 +84,14 @@ const prepareUpdateInterfaceBody = (localInterface, remoteInterface) => {
|
|
|
83
84
|
)
|
|
84
85
|
})) : void 0;
|
|
85
86
|
const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels);
|
|
87
|
+
const attributes = utils.records.setNullOnMissingValues(localInterface.attributes, remoteInterface.attributes);
|
|
86
88
|
return {
|
|
87
89
|
...localInterface,
|
|
88
90
|
entities,
|
|
89
91
|
actions,
|
|
90
92
|
events,
|
|
91
|
-
channels
|
|
93
|
+
channels,
|
|
94
|
+
attributes
|
|
92
95
|
};
|
|
93
96
|
};
|
|
94
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api/interface-body.ts"],
|
|
4
|
-
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateInterfaceBody = async (\n intrface: sdk.InterfaceDefinition | sdk.InterfacePackage['definition']\n): Promise<types.CreateInterfaceRequestBody> => ({\n name: intrface.name,\n version: intrface.version,\n title: 'title' in intrface ? intrface.title : undefined,\n description: 'description' in intrface ? intrface.description : undefined,\n entities: intrface.entities\n ? await utils.records.mapValuesAsync(intrface.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : {},\n events: intrface.events\n ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : {},\n actions: intrface.actions\n ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : {},\n channels: intrface.channels\n ? await utils.records.mapValuesAsync(intrface.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : {},\n})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: types.CreateInterfaceRequestBody & { id: string },\n remoteInterface: client.Interface\n): types.UpdateInterfaceRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),\n remoteItems: remoteInterface.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events),\n remoteItems: remoteInterface.events,\n })\n const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities)\n\n const currentChannels: types.UpdateInterfaceRequestBody['channels'] = localInterface.channels\n ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({\n ...channel,\n messages: utils.records.setNullOnMissingValues(\n channel?.messages,\n remoteInterface.channels[channelName]?.messages\n ),\n }))\n : undefined\n\n const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels)\n\n return {\n ...localInterface,\n entities,\n actions,\n events,\n channels,\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,6BAA6B,OACxC,cAC+C;AAAA,EAC/C,MAAM,SAAS;AAAA,EACf,SAAS,SAAS;AAAA,EAClB,OAAO,WAAW,WAAW,SAAS,QAAQ;AAAA,EAC9C,aAAa,iBAAiB,WAAW,SAAS,cAAc;AAAA,EAChE,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,YAAY;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,MAAM;AAAA,EACtD,EAAE,IACF,CAAC;AAAA,EACL,QAAQ,SAAS,SACb,MAAM,MAAM,QAAQ,eAAe,SAAS,QAAQ,OAAO,WAAW;AAAA,IACpE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF,CAAC;AAAA,EACL,SAAS,SAAS,UACd,MAAM,MAAM,QAAQ,eAAe,SAAS,SAAS,OAAO,YAAY;AAAA,IACtE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF,CAAC;AAAA,EACL,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,aAAa;AAAA,IACxE,GAAG;AAAA,IACH,UAAU,MAAM,MAAM,QAAQ,eAAe,QAAQ,UAAU,OAAO,aAAa;AAAA,MACjF,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO;AAAA,IACvD,EAAE;AAAA,EACJ,EAAE,IACF,CAAC;
|
|
4
|
+
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreateInterfaceBody = async (\n intrface: sdk.InterfaceDefinition | sdk.InterfacePackage['definition']\n): Promise<types.CreateInterfaceRequestBody> => ({\n name: intrface.name,\n version: intrface.version,\n title: 'title' in intrface ? intrface.title : undefined,\n description: 'description' in intrface ? intrface.description : undefined,\n entities: intrface.entities\n ? await utils.records.mapValuesAsync(intrface.entities, async (entity) => ({\n ...entity,\n schema: await utils.schema.mapZodToJsonSchema(entity),\n }))\n : {},\n events: intrface.events\n ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : {},\n actions: intrface.actions\n ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : {},\n channels: intrface.channels\n ? await utils.records.mapValuesAsync(intrface.channels, async (channel) => ({\n ...channel,\n messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({\n ...message,\n schema: await utils.schema.mapZodToJsonSchema(message),\n })),\n }))\n : {},\n attributes: intrface.attributes,\n})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: types.CreateInterfaceRequestBody & { id: string },\n remoteInterface: client.Interface\n): types.UpdateInterfaceRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),\n remoteItems: remoteInterface.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events),\n remoteItems: remoteInterface.events,\n })\n const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities)\n\n const currentChannels: types.UpdateInterfaceRequestBody['channels'] = localInterface.channels\n ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({\n ...channel,\n messages: utils.records.setNullOnMissingValues(\n channel?.messages,\n remoteInterface.channels[channelName]?.messages\n ),\n }))\n : undefined\n\n const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels)\n\n const attributes = utils.records.setNullOnMissingValues(localInterface.attributes, remoteInterface.attributes)\n\n return {\n ...localInterface,\n entities,\n actions,\n events,\n channels,\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EAAE;AAAA,EACJ,EAAE,IACF,CAAC;AAAA,EACL,YAAY,SAAS;AACvB;AAEO,MAAM,6BAA6B,CACxC,gBACA,oBACqC;AACrC,QAAM,UAAU,MAAM,WAAW,2BAA2B;AAAA,IAC1D,YAAY,MAAM,QAAQ,uBAAuB,eAAe,SAAS,gBAAgB,OAAO;AAAA,IAChG,aAAa,gBAAgB;AAAA,EAC/B,CAAC;AACD,QAAM,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACzD,YAAY,MAAM,QAAQ,uBAAuB,eAAe,QAAQ,gBAAgB,MAAM;AAAA,IAC9F,aAAa,gBAAgB;AAAA,EAC/B,CAAC;AACD,QAAM,WAAW,MAAM,QAAQ,uBAAuB,eAAe,UAAU,gBAAgB,QAAQ;AAEvG,QAAM,kBAAgE,eAAe,WACjF,MAAM,QAAQ,UAAU,eAAe,UAAU,CAAC,SAAS,iBAAiB;AAAA,IAC1E,GAAG;AAAA,IACH,UAAU,MAAM,QAAQ;AAAA,MACtB,SAAS;AAAA,MACT,gBAAgB,SAAS,WAAW,GAAG;AAAA,IACzC;AAAA,EACF,EAAE,IACF;AAEJ,QAAM,WAAW,MAAM,QAAQ,uBAAuB,iBAAiB,gBAAgB,QAAQ;AAE/F,QAAM,aAAa,MAAM,QAAQ,uBAAuB,eAAe,YAAY,gBAAgB,UAAU;AAE7G,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/api/plugin-body.js
CHANGED
|
@@ -69,7 +69,8 @@ const prepareCreatePluginBody = async (plugin) => ({
|
|
|
69
69
|
schema: await utils.schema.mapZodToJsonSchema(state)
|
|
70
70
|
})),
|
|
71
71
|
({ type }) => type !== "workflow"
|
|
72
|
-
) : void 0
|
|
72
|
+
) : void 0,
|
|
73
|
+
attributes: plugin.attributes
|
|
73
74
|
});
|
|
74
75
|
const prepareUpdatePluginBody = (localPlugin, remotePlugin) => {
|
|
75
76
|
const actions = utils.attributes.prepareAttributeUpdateBody({
|
|
@@ -81,13 +82,15 @@ const prepareUpdatePluginBody = (localPlugin, remotePlugin) => {
|
|
|
81
82
|
remoteItems: remotePlugin.events
|
|
82
83
|
});
|
|
83
84
|
const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states);
|
|
85
|
+
const attributes = utils.records.setNullOnMissingValues(localPlugin.attributes, remotePlugin.attributes);
|
|
84
86
|
return {
|
|
85
87
|
...localPlugin,
|
|
86
88
|
actions,
|
|
87
89
|
events,
|
|
88
90
|
states,
|
|
89
|
-
user: localPlugin.user
|
|
91
|
+
user: localPlugin.user,
|
|
90
92
|
// TODO: allow deleting user tags with null
|
|
93
|
+
attributes
|
|
91
94
|
};
|
|
92
95
|
};
|
|
93
96
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/api/plugin-body.ts"],
|
|
4
|
-
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreatePluginBody = async (\n plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']\n): Promise<types.CreatePluginRequestBody> => ({\n name: plugin.name,\n version: plugin.version,\n title: 'title' in plugin ? plugin.title : undefined,\n description: 'description' in plugin ? plugin.description : undefined,\n user: {\n tags: plugin.user?.tags ?? {},\n },\n conversation: {\n tags: plugin.conversation?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration),\n }\n : undefined,\n events: plugin.events\n ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: plugin.actions\n ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n states: plugin.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreatePluginRequestBody['states'])\n : undefined,\n})\n\nexport const prepareUpdatePluginBody = (\n localPlugin: types.UpdatePluginRequestBody,\n remotePlugin: client.Plugin\n): types.UpdatePluginRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions),\n remoteItems: remotePlugin.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events),\n remoteItems: remotePlugin.events,\n })\n const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states)\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n user: localPlugin.user, // TODO: allow deleting user tags with null\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,0BAA0B,OACrC,YAC4C;AAAA,EAC5C,MAAM,OAAO;AAAA,EACb,SAAS,OAAO;AAAA,EAChB,OAAO,WAAW,SAAS,OAAO,QAAQ;AAAA,EAC1C,aAAa,iBAAiB,SAAS,OAAO,cAAc;AAAA,EAC5D,MAAM;AAAA,IACJ,MAAM,OAAO,MAAM,QAAQ,CAAC;AAAA,EAC9B;AAAA,EACA,cAAc;AAAA,IACZ,MAAM,OAAO,cAAc,QAAQ,CAAC;AAAA,EACtC;AAAA,EACA,eAAe,OAAO,gBAClB;AAAA,IACE,GAAG,OAAO;AAAA,IACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,aAAa;AAAA,EACpE,IACA;AAAA,EACJ,QAAQ,OAAO,SACX,MAAM,MAAM,QAAQ,eAAe,OAAO,QAAQ,OAAO,WAAW;AAAA,IAClE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,EACrD,EAAE,IACF;AAAA,EACJ,SAAS,OAAO,UACZ,MAAM,MAAM,QAAQ,eAAe,OAAO,SAAS,OAAO,YAAY;AAAA,IACpE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,KAAK;AAAA,IAC5D;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,MAAM;AAAA,IAC7D;AAAA,EACF,EAAE,IACF;AAAA,EACJ,QAAQ,OAAO,SACV,MAAM,QAAQ;AAAA,IACb,MAAM,MAAM,QAAQ,eAAe,OAAO,QAAQ,OAAO,WAAW;AAAA,MAClE,GAAG;AAAA,MACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,KAAK;AAAA,IACrD,EAAE;AAAA,IACF,CAAC,EAAE,KAAK,MAAM,SAAS;AAAA,EACzB,IACA;
|
|
4
|
+
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as sdk from '@botpress/sdk'\nimport * as utils from '../utils'\nimport * as types from './types'\n\nexport const prepareCreatePluginBody = async (\n plugin: sdk.PluginDefinition | sdk.PluginPackage['definition']\n): Promise<types.CreatePluginRequestBody> => ({\n name: plugin.name,\n version: plugin.version,\n title: 'title' in plugin ? plugin.title : undefined,\n description: 'description' in plugin ? plugin.description : undefined,\n user: {\n tags: plugin.user?.tags ?? {},\n },\n conversation: {\n tags: plugin.conversation?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration),\n }\n : undefined,\n events: plugin.events\n ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({\n ...event,\n schema: await utils.schema.mapZodToJsonSchema(event),\n }))\n : undefined,\n actions: plugin.actions\n ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({\n ...action,\n input: {\n ...action.input,\n schema: await utils.schema.mapZodToJsonSchema(action.input),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output),\n },\n }))\n : undefined,\n states: plugin.states\n ? (utils.records.filterValues(\n await utils.records.mapValuesAsync(plugin.states, async (state) => ({\n ...state,\n schema: await utils.schema.mapZodToJsonSchema(state),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreatePluginRequestBody['states'])\n : undefined,\n attributes: plugin.attributes,\n})\n\nexport const prepareUpdatePluginBody = (\n localPlugin: types.UpdatePluginRequestBody,\n remotePlugin: client.Plugin\n): types.UpdatePluginRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.actions, remotePlugin.actions),\n remoteItems: remotePlugin.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localPlugin.events, remotePlugin.events),\n remoteItems: remotePlugin.events,\n })\n const states = utils.records.setNullOnMissingValues(localPlugin.states, remotePlugin.states)\n\n const attributes = utils.records.setNullOnMissingValues(localPlugin.attributes, remotePlugin.attributes)\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n user: localPlugin.user, // TODO: allow deleting user tags with null\n attributes,\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,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EAC5B,CAAC;AACD,QAAM,SAAS,MAAM,WAAW,2BAA2B;AAAA,IACzD,YAAY,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAAA,IACxF,aAAa,aAAa;AAAA,EAC5B,CAAC;AACD,QAAM,SAAS,MAAM,QAAQ,uBAAuB,YAAY,QAAQ,aAAa,MAAM;AAE3F,QAAM,aAAa,MAAM,QAAQ,uBAAuB,YAAY,YAAY,aAAa,UAAU;AAEvG,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM,YAAY;AAAA;AAAA,IAClB;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -104,6 +104,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
|
|
|
104
104
|
tags: this._integration.user?.tags ?? {},
|
|
105
105
|
creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] }
|
|
106
106
|
};
|
|
107
|
+
const integrationAttributes = this._integration.attributes ? (0, import_generators.stringifySingleLine)(this._integration.attributes) : "{}";
|
|
107
108
|
content += [
|
|
108
109
|
consts.GENERATED_HEADER,
|
|
109
110
|
'import * as sdk from "@botpress/sdk"',
|
|
@@ -128,6 +129,7 @@ class IntegrationPackageDefinitionModule extends import_module.Module {
|
|
|
128
129
|
"export default {",
|
|
129
130
|
` name: "${this._integration.name}",`,
|
|
130
131
|
` version: "${this._integration.version}",`,
|
|
132
|
+
` attributes: ${integrationAttributes},`,
|
|
131
133
|
` user: ${(0, import_generators.stringifySingleLine)(user)},`,
|
|
132
134
|
` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,
|
|
133
135
|
` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,
|
package/dist/code-generation/integration-package/integration-package-definition/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/integration-package/integration-package-definition/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { ConfigurationsModule } from './configurations-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype IntegrationPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n configurationsModule: ConfigurationsModule\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n entitiesModule: EntitiesModule\n interfacesModule: InterfacesModule\n}\n\nexport class IntegrationPackageDefinitionModule extends Module {\n private _dependencies: IntegrationPackageModuleDependencies\n\n public constructor(private _integration: types.IntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_integration.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const configurationsModule = new ConfigurationsModule(_integration.configurations ?? {})\n configurationsModule.unshift('configurations')\n\n const actionsModule = new ActionsModule(_integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_integration.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_integration.states ?? {})\n statesModule.unshift('states')\n\n const entitiesModule = new EntitiesModule(_integration.entities ?? {})\n entitiesModule.unshift('entities')\n\n const interfacesModule = new InterfacesModule(_integration.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n this._dependencies = {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n } = this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const configurationsImport = configurationsModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n\n const user = {\n tags: this._integration.user?.tags ?? {},\n creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] },\n }\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._integration.name}\",`,\n ` version: \"${this._integration.version}\",`,\n ` user: ${stringifySingleLine(user)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n '} satisfies sdk.IntegrationPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,kCAA2C;AAC3C,mCAAqC;AACrC,6BAA+B;AAC/B,2BAA6B;AAC7B,+BAAiC;AACjC,2BAA6B;AActB,MAAM,2CAA2C,qBAAO;AAAA,EAGtD,YAAoB,cAA2C;AACpE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,aAAa,iBAAiB,CAAC,CAAC;AAC3F,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,uBAAuB,IAAI,kDAAqB,aAAa,kBAAkB,CAAC,CAAC;AACvF,yBAAqB,QAAQ,gBAAgB;AAE7C,UAAM,gBAAgB,IAAI,oCAAc,aAAa,WAAW,CAAC,CAAC;AAClE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,sCAAe,aAAa,YAAY,CAAC,CAAC;AACrE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,eAAe,IAAI,kCAAa,aAAa,UAAU,CAAC,CAAC;AAC/D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,eAAe,IAAI,kCAAa,aAAa,UAAU,CAAC,CAAC;AAC/D,iBAA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Ae,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,qBAAqB,gBAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,aAAa;AAAA,MAC9B,eAAe,KAAK,aAAa;AAAA,MACjC,eAAW,uCAAoB,IAAI;AAAA,MACnC,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,qBAAqB,qBAAqB,QAAQ,qBAAqB;AAAA,MACvE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
4
|
+
"sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { ConfigurationsModule } from './configurations-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype IntegrationPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n configurationsModule: ConfigurationsModule\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n entitiesModule: EntitiesModule\n interfacesModule: InterfacesModule\n}\n\nexport class IntegrationPackageDefinitionModule extends Module {\n private _dependencies: IntegrationPackageModuleDependencies\n\n public constructor(private _integration: types.IntegrationDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_integration.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const configurationsModule = new ConfigurationsModule(_integration.configurations ?? {})\n configurationsModule.unshift('configurations')\n\n const actionsModule = new ActionsModule(_integration.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_integration.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_integration.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_integration.states ?? {})\n statesModule.unshift('states')\n\n const entitiesModule = new EntitiesModule(_integration.entities ?? {})\n entitiesModule.unshift('entities')\n\n const interfacesModule = new InterfacesModule(_integration.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n this._dependencies = {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const {\n defaultConfigModule,\n configurationsModule,\n actionsModule,\n channelsModule,\n eventsModule,\n statesModule,\n entitiesModule,\n interfacesModule,\n } = this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const configurationsImport = configurationsModule.import(this)\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n\n const user = {\n tags: this._integration.user?.tags ?? {},\n creation: this._integration.user?.creation ?? { enabled: false, requiredTags: [] },\n }\n\n const integrationAttributes = this._integration.attributes\n ? stringifySingleLine(this._integration.attributes)\n : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${configurationsModule.name} from \"./${configurationsImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._integration.name}\",`,\n ` version: \"${this._integration.version}\",`,\n ` attributes: ${integrationAttributes},`,\n ` user: ${stringifySingleLine(user)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` configurations: ${configurationsModule.name}.${configurationsModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`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A,MAChD,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,qBAAqB,gBAAgB;AAAA,MACpD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,eAAe,gBAAgB;AAAA,MAC9C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,aAAa;AAAA,MAC9B,eAAe,KAAK,aAAa;AAAA,MACjC,iBAAiB;AAAA,MACjB,eAAW,uCAAoB,IAAI;AAAA,MACnC,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,qBAAqB,qBAAqB,QAAQ,qBAAqB;AAAA,MACvE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,6 +32,7 @@ __export(interface_package_definition_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(interface_package_definition_exports);
|
|
34
34
|
var consts = __toESM(require("../../consts"));
|
|
35
|
+
var import_generators = require("../../generators");
|
|
35
36
|
var import_module = require("../../module");
|
|
36
37
|
var import_actions_module = require("./actions-module");
|
|
37
38
|
var import_channels_module = require("./channels-module");
|
|
@@ -70,6 +71,7 @@ class InterfacePackageDefinitionModule extends import_module.Module {
|
|
|
70
71
|
const channelsImport = channelsModule.import(this);
|
|
71
72
|
const eventsImport = eventsModule.import(this);
|
|
72
73
|
const entitiesImport = entitiesModule.import(this);
|
|
74
|
+
const interfaceAttributes = this._interface.attributes ? (0, import_generators.stringifySingleLine)(this._interface.attributes) : "{}";
|
|
73
75
|
content += [
|
|
74
76
|
consts.GENERATED_HEADER,
|
|
75
77
|
'import * as sdk from "@botpress/sdk"',
|
|
@@ -86,6 +88,7 @@ class InterfacePackageDefinitionModule extends import_module.Module {
|
|
|
86
88
|
"export default {",
|
|
87
89
|
` name: "${this._interface.name}",`,
|
|
88
90
|
` version: "${this._interface.version}",`,
|
|
91
|
+
` attributes: ${interfaceAttributes},`,
|
|
89
92
|
` actions: ${actionsModule.name}.${actionsModule.exportName},`,
|
|
90
93
|
` channels: ${channelsModule.name}.${channelsModule.exportName},`,
|
|
91
94
|
` events: ${eventsModule.name}.${eventsModule.exportName},`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/interface-package/interface-package-definition/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as consts from '../../consts'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport * as types from './typings'\n\ntype InterfacePackageModuleDependencies = {\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n entitiesModule: EntitiesModule\n}\n\nexport class InterfacePackageDefinitionModule extends Module {\n private _dependencies: InterfacePackageModuleDependencies\n\n public constructor(private _interface: types.InterfaceDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const actionsModule = new ActionsModule(_interface.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_interface.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_interface.events ?? {})\n eventsModule.unshift('events')\n\n const entitiesModule = new EntitiesModule(_interface.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n actionsModule,\n channelsModule,\n eventsModule,\n entitiesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { actionsModule, channelsModule, eventsModule, entitiesModule } = this._dependencies\n\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._interface.name}\",`,\n ` version: \"${this._interface.version}\",`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n '} satisfies sdk.InterfacePackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,6BAA+B;AAC/B,2BAA6B;AAUtB,MAAM,yCAAyC,qBAAO;AAAA,EAGpD,YAAoB,YAAuC;AAChE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;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MAClD,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,eAAe,eAAe,QAAQ,eAAe;AAAA,MACrD;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
4
|
+
"sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { ChannelsModule } from './channels-module'\nimport { EntitiesModule } from './entities-module'\nimport { EventsModule } from './events-module'\nimport * as types from './typings'\n\ntype InterfacePackageModuleDependencies = {\n actionsModule: ActionsModule\n channelsModule: ChannelsModule\n eventsModule: EventsModule\n entitiesModule: EntitiesModule\n}\n\nexport class InterfacePackageDefinitionModule extends Module {\n private _dependencies: InterfacePackageModuleDependencies\n\n public constructor(private _interface: types.InterfaceDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const actionsModule = new ActionsModule(_interface.actions ?? {})\n actionsModule.unshift('actions')\n\n const channelsModule = new ChannelsModule(_interface.channels ?? {})\n channelsModule.unshift('channels')\n\n const eventsModule = new EventsModule(_interface.events ?? {})\n eventsModule.unshift('events')\n\n const entitiesModule = new EntitiesModule(_interface.entities ?? {})\n entitiesModule.unshift('entities')\n\n this._dependencies = {\n actionsModule,\n channelsModule,\n eventsModule,\n entitiesModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { actionsModule, channelsModule, eventsModule, entitiesModule } = this._dependencies\n\n const actionsImport = actionsModule.import(this)\n const channelsImport = channelsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const entitiesImport = entitiesModule.import(this)\n\n const interfaceAttributes = this._interface.attributes ? stringifySingleLine(this._interface.attributes) : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${channelsModule.name} from \"./${channelsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${entitiesModule.name} from \"./${entitiesImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._interface.name}\",`,\n ` version: \"${this._interface.version}\",`,\n ` attributes: ${interfaceAttributes},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` channels: ${channelsModule.name}.${channelsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` entities: ${entitiesModule.name}.${entitiesModule.exportName},`,\n '} satisfies sdk.InterfacePackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,6BAA+B;AAC/B,6BAA+B;AAC/B,2BAA6B;AAUtB,MAAM,yCAAyC,qBAAO;AAAA,EAGpD,YAAoB,YAAuC;AAChE,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,gBAAgB,IAAI,oCAAc,WAAW,WAAW,CAAC,CAAC;AAChE,kBAAc,QAAQ,SAAS;AAE/B,UAAM,iBAAiB,IAAI,sCAAe,WAAW,YAAY,CAAC,CAAC;AACnE,mBAAe,QAAQ,UAAU;AAEjC,UAAM,eAAe,IAAI,kCAAa,WAAW,UAAU,CAAC,CAAC;AAC7D,iBAAa,QAAQ,QAAQ;AAE7B,UAAM,iBAAiB,IAAI,sCAAe,WAAW,YAAY,CAA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|
@@ -87,6 +87,7 @@ class PluginPackageDefinitionModule extends import_module.Module {
|
|
|
87
87
|
const conversation = {
|
|
88
88
|
tags: this._plugin.conversation?.tags ?? {}
|
|
89
89
|
};
|
|
90
|
+
const pluginAttributes = this._plugin.attributes ? (0, import_generators.stringifySingleLine)(this._plugin.attributes) : "{}";
|
|
90
91
|
content += [
|
|
91
92
|
consts.GENERATED_HEADER,
|
|
92
93
|
'import * as sdk from "@botpress/sdk"',
|
|
@@ -107,6 +108,7 @@ class PluginPackageDefinitionModule extends import_module.Module {
|
|
|
107
108
|
"export default {",
|
|
108
109
|
` name: "${this._plugin.name}",`,
|
|
109
110
|
` version: "${this._plugin.version}",`,
|
|
111
|
+
` attributes: ${pluginAttributes},`,
|
|
110
112
|
` user: ${(0, import_generators.stringifySingleLine)(user)},`,
|
|
111
113
|
` conversation: ${(0, import_generators.stringifySingleLine)(conversation)},`,
|
|
112
114
|
` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/code-generation/plugin-package/plugin-package-definition/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { RecurringEventsModule } from './recurring-events-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype PluginPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n actionsModule: ActionsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n interfacesModule: InterfacesModule\n recurringEventsModule: RecurringEventsModule\n}\n\nexport class PluginPackageDefinitionModule extends Module {\n private _dependencies: PluginPackageModuleDependencies\n\n public constructor(private _plugin: types.PluginDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_plugin.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const actionsModule = new ActionsModule(_plugin.actions ?? {})\n actionsModule.unshift('actions')\n\n const eventsModule = new EventsModule(_plugin.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_plugin.states ?? {})\n statesModule.unshift('states')\n\n const interfacesModule = new InterfacesModule(_plugin.dependencies?.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n const recurringEventsModule = new RecurringEventsModule(_plugin.recurringEvents ?? {})\n recurringEventsModule.unshift('recurringEvents')\n\n this._dependencies = {\n defaultConfigModule,\n actionsModule,\n eventsModule,\n statesModule,\n interfacesModule,\n recurringEventsModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { defaultConfigModule, actionsModule, eventsModule, statesModule, interfacesModule, recurringEventsModule } =\n this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const actionsImport = actionsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n const recurringEventsImport = recurringEventsModule.import(this)\n\n const user = {\n tags: this._plugin.user?.tags ?? {},\n }\n\n const conversation = {\n tags: this._plugin.conversation?.tags ?? {},\n }\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `import * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._plugin.name}\",`,\n ` version: \"${this._plugin.version}\",`,\n ` user: ${stringifySingleLine(user)},`,\n ` conversation: ${stringifySingleLine(conversation)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n ` recurringEvents: ${recurringEventsModule.name}.${recurringEventsModule.exportName},`,\n '} satisfies sdk.PluginPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,kCAA2C;AAC3C,2BAA6B;AAC7B,+BAAiC;AACjC,qCAAsC;AACtC,2BAA6B;AAYtB,MAAM,sCAAsC,qBAAO;AAAA,EAGjD,YAAoB,SAAiC;AAC1D,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,QAAQ,iBAAiB,CAAC,CAAC;AACtF,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,gBAAgB,IAAI,oCAAc,QAAQ,WAAW,CAAC,CAAC;AAC7D,kBAAc,QAAQ,SAAS;AAE/B,UAAM,eAAe,IAAI,kCAAa,QAAQ,UAAU,CAAC,CAAC;AAC1D,iBAAa,QAAQ,QAAQ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AChD,eAAe,sBAAsB,gBAAgB;AAAA,MACrD,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,sBAAsB,gBAAgB;AAAA,MACrD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,QAAQ;AAAA,MACzB,eAAe,KAAK,QAAQ;AAAA,MAC5B,eAAW,uCAAoB,IAAI;AAAA,MACnC,uBAAmB,uCAAoB,YAAY;AAAA,MACnD,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D,sBAAsB,sBAAsB,QAAQ,sBAAsB;AAAA,MAC1E;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
4
|
+
"sourcesContent": ["import * as consts from '../../consts'\nimport { stringifySingleLine } from '../../generators'\nimport { Module } from '../../module'\nimport { ActionsModule } from './actions-module'\nimport { DefaultConfigurationModule } from './configuration-module'\nimport { EventsModule } from './events-module'\nimport { InterfacesModule } from './interfaces-module'\nimport { RecurringEventsModule } from './recurring-events-module'\nimport { StatesModule } from './states-module'\nimport * as types from './typings'\n\ntype PluginPackageModuleDependencies = {\n defaultConfigModule: DefaultConfigurationModule\n actionsModule: ActionsModule\n eventsModule: EventsModule\n statesModule: StatesModule\n interfacesModule: InterfacesModule\n recurringEventsModule: RecurringEventsModule\n}\n\nexport class PluginPackageDefinitionModule extends Module {\n private _dependencies: PluginPackageModuleDependencies\n\n public constructor(private _plugin: types.PluginDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: consts.DEFAULT_EXPORT_NAME,\n })\n\n const defaultConfigModule = new DefaultConfigurationModule(_plugin.configuration ?? {})\n defaultConfigModule.unshift('configuration')\n\n const actionsModule = new ActionsModule(_plugin.actions ?? {})\n actionsModule.unshift('actions')\n\n const eventsModule = new EventsModule(_plugin.events ?? {})\n eventsModule.unshift('events')\n\n const statesModule = new StatesModule(_plugin.states ?? {})\n statesModule.unshift('states')\n\n const interfacesModule = new InterfacesModule(_plugin.dependencies?.interfaces ?? {})\n interfacesModule.unshift('interfaces')\n\n const recurringEventsModule = new RecurringEventsModule(_plugin.recurringEvents ?? {})\n recurringEventsModule.unshift('recurringEvents')\n\n this._dependencies = {\n defaultConfigModule,\n actionsModule,\n eventsModule,\n statesModule,\n interfacesModule,\n recurringEventsModule,\n }\n\n for (const dep of Object.values(this._dependencies)) {\n this.pushDep(dep)\n }\n }\n\n public async getContent() {\n let content = ''\n\n const { defaultConfigModule, actionsModule, eventsModule, statesModule, interfacesModule, recurringEventsModule } =\n this._dependencies\n\n const defaultConfigImport = defaultConfigModule.import(this)\n const actionsImport = actionsModule.import(this)\n const eventsImport = eventsModule.import(this)\n const statesImport = statesModule.import(this)\n const interfacesImport = interfacesModule.import(this)\n const recurringEventsImport = recurringEventsModule.import(this)\n\n const user = {\n tags: this._plugin.user?.tags ?? {},\n }\n\n const conversation = {\n tags: this._plugin.conversation?.tags ?? {},\n }\n\n const pluginAttributes = this._plugin.attributes ? stringifySingleLine(this._plugin.attributes) : '{}'\n\n content += [\n consts.GENERATED_HEADER,\n 'import * as sdk from \"@botpress/sdk\"',\n '',\n `import * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `import * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `import * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `import * as ${statesModule.name} from \"./${statesImport}\"`,\n `import * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `import * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n `export * as ${defaultConfigModule.name} from \"./${defaultConfigImport}\"`,\n `export * as ${actionsModule.name} from \"./${actionsImport}\"`,\n `export * as ${eventsModule.name} from \"./${eventsImport}\"`,\n `export * as ${statesModule.name} from \"./${statesImport}\"`,\n `export * as ${interfacesModule.name} from \"./${interfacesImport}\"`,\n `export * as ${recurringEventsModule.name} from \"./${recurringEventsImport}\"`,\n '',\n 'export default {',\n ` name: \"${this._plugin.name}\",`,\n ` version: \"${this._plugin.version}\",`,\n ` attributes: ${pluginAttributes},`,\n ` user: ${stringifySingleLine(user)},`,\n ` conversation: ${stringifySingleLine(conversation)},`,\n ` configuration: ${defaultConfigModule.name}.${defaultConfigModule.exportName},`,\n ` actions: ${actionsModule.name}.${actionsModule.exportName},`,\n ` events: ${eventsModule.name}.${eventsModule.exportName},`,\n ` states: ${statesModule.name}.${statesModule.exportName},`,\n ` interfaces: ${interfacesModule.name}.${interfacesModule.exportName},`,\n ` recurringEvents: ${recurringEventsModule.name}.${recurringEventsModule.exportName},`,\n '} satisfies sdk.PluginPackage[\"definition\"]',\n ].join('\\n')\n\n return content\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AACxB,wBAAoC;AACpC,oBAAuB;AACvB,4BAA8B;AAC9B,kCAA2C;AAC3C,2BAA6B;AAC7B,+BAAiC;AACjC,qCAAsC;AACtC,2BAA6B;AAYtB,MAAM,sCAAsC,qBAAO;AAAA,EAGjD,YAAoB,SAAiC;AAC1D,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY,OAAO;AAAA,IACrB,CAAC;AAJwB;AAMzB,UAAM,sBAAsB,IAAI,uDAA2B,QAAQ,iBAAiB,CAAC,CAAC;AACtF,wBAAoB,QAAQ,eAAe;AAE3C,UAAM,gBAAgB,IAAI,oCAAc,QAAQ,WAAW,CAAC,CAAC;AAC7D,kBAAc,QAAQ,SAAS;AAE/B,UAAM,eAAe,IAAI,kCA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AAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,sBAAsB,gBAAgB;AAAA,MACrD,eAAe,oBAAoB,gBAAgB;AAAA,MACnD,eAAe,cAAc,gBAAgB;AAAA,MAC7C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,aAAa,gBAAgB;AAAA,MAC5C,eAAe,iBAAiB,gBAAgB;AAAA,MAChD,eAAe,sBAAsB,gBAAgB;AAAA,MACrD;AAAA,MACA;AAAA,MACA,YAAY,KAAK,QAAQ;AAAA,MACzB,eAAe,KAAK,QAAQ;AAAA,MAC5B,iBAAiB;AAAA,MACjB,eAAW,uCAAoB,IAAI;AAAA,MACnC,uBAAmB,uCAAoB,YAAY;AAAA,MACnD,oBAAoB,oBAAoB,QAAQ,oBAAoB;AAAA,MACpE,cAAc,cAAc,QAAQ,cAAc;AAAA,MAClD,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,aAAa,aAAa,QAAQ,aAAa;AAAA,MAC/C,iBAAiB,iBAAiB,QAAQ,iBAAiB;AAAA,MAC3D,sBAAsB,sBAAsB,QAAQ,sBAAsB;AAAA,MAC1E;AAAA,IACF,EAAE,KAAK,IAAI;AAEX,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/code-generation/typings.ts"],
|
|
4
|
-
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as utils from '../utils'\n\ntype NameVersion = { name: string; version: string }\ntype PackageRef = { id?: string; name: string; version: string }\ntype Schema = Record<string, any>\ntype Aliases = Record<string, { name: string }>\n\ntype TitleDescription = { title?: string; description?: string }\ntype Tags = { tags: Record<string, {}> }\ntype InputOutput = { input: { schema: Schema }; output: { schema: Schema } }\ntype Attributes = { attributes?: Record<string, string> }\n\nexport type File = { path: string; content: string }\n\nexport type IntegrationDefinition = PackageRef & {\n
|
|
4
|
+
"sourcesContent": ["import * as client from '@botpress/client'\nimport * as utils from '../utils'\n\ntype NameVersion = { name: string; version: string }\ntype PackageRef = { id?: string; name: string; version: string }\ntype Schema = Record<string, any>\ntype Aliases = Record<string, { name: string }>\n\ntype TitleDescription = { title?: string; description?: string }\ntype Tags = { tags: Record<string, {}> }\ntype InputOutput = { input: { schema: Schema }; output: { schema: Schema } }\ntype Attributes = { attributes?: Record<string, string> }\n\nexport type File = { path: string; content: string }\n\nexport type IntegrationDefinition = PackageRef &\n Attributes & {\n interfaces?: Record<\n string,\n {\n id?: string\n entities?: Aliases\n actions?: Aliases\n events?: Aliases\n channels?: Aliases\n }\n >\n configuration?: TitleDescription & {\n schema?: Schema\n }\n configurations?: Record<\n string,\n TitleDescription & {\n schema?: Schema\n }\n >\n channels?: Record<\n string,\n TitleDescription & {\n messages: Record<string, TitleDescription & { schema: Schema }>\n conversation?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n message?: {\n tags?: Record<string, {}>\n }\n }\n >\n states?: Record<\n string,\n TitleDescription & {\n type: client.State['type']\n schema: Schema\n }\n >\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription &\n Attributes & {\n billable?: boolean\n cacheable?: boolean\n input: {\n schema: Schema\n }\n output: {\n schema: Schema\n }\n }\n >\n entities?: Record<string, TitleDescription & { schema: Schema }>\n user?: {\n tags?: Record<string, {}>\n creation?: {\n enabled: boolean\n requiredTags: string[]\n }\n }\n }\n\nexport type InterfaceDefinition = PackageRef &\n Attributes & {\n entities?: Record<string, TitleDescription & { schema: Schema }>\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<\n string,\n TitleDescription &\n Attributes & {\n billable?: boolean\n cacheable?: boolean\n input: { schema: Schema }\n output: { schema: Schema }\n }\n >\n channels?: Record<string, TitleDescription & { messages: Record<string, TitleDescription & { schema: Schema }> }>\n }\n\nexport type RecurringEventDefinition = {\n type: string\n payload: Record<string, any>\n schedule: { cron: string }\n}\n\nexport type PluginDefinition = PackageRef &\n Attributes & {\n configuration?: TitleDescription & { schema?: Schema }\n user?: { tags: Record<string, {}> }\n conversation?: Tags\n states?: Record<string, TitleDescription & { type: client.State['type']; schema: Schema }>\n events?: Record<string, TitleDescription & Attributes & { schema: Schema }>\n actions?: Record<string, TitleDescription & Attributes & InputOutput>\n workflows?: Record<string, TitleDescription & Tags & InputOutput>\n dependencies?: {\n interfaces?: Record<string, PackageRef>\n integrations?: Record<string, PackageRef>\n }\n recurringEvents?: Record<string, RecurringEventDefinition>\n }\n\nexport type IntegrationInstallablePackage = NameVersion & {\n integration: IntegrationDefinition\n devId?: string\n path?: utils.path.AbsolutePath\n}\n\nexport type InterfaceInstallablePackage = NameVersion & {\n interface: InterfaceDefinition\n path?: utils.path.AbsolutePath\n}\n\nexport type PluginInstallablePackage = NameVersion & {\n plugin: PluginDefinition\n path?: utils.path.AbsolutePath\n code: string\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.1",
|
|
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.
|
|
25
|
-
"@botpress/sdk": "4.
|
|
24
|
+
"@botpress/client": "1.15.0",
|
|
25
|
+
"@botpress/sdk": "4.8.1",
|
|
26
26
|
"@bpinternal/const": "^0.1.0",
|
|
27
27
|
"@bpinternal/tunnel": "^0.1.1",
|
|
28
28
|
"@bpinternal/yargs-extra": "^0.0.3",
|