@botpress/cli 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +11 -11
- package/dist/api/bot-body.js +10 -5
- package/dist/api/bot-body.js.map +2 -2
- package/dist/api/integration-body.js +12 -6
- package/dist/api/integration-body.js.map +2 -2
- package/dist/api/interface-body.js +10 -5
- package/dist/api/interface-body.js.map +2 -2
- package/dist/api/plugin-body.js +10 -5
- package/dist/api/plugin-body.js.map +2 -2
- package/dist/code-generation/bot-implementation/index.js +9 -1
- package/dist/code-generation/bot-implementation/index.js.map +2 -2
- package/dist/code-generation/index.d.ts +1 -1
- package/dist/code-generation/index.js +2 -2
- package/dist/code-generation/index.js.map +2 -2
- package/dist/code-generation/integration-implementation/index.js +2 -2
- package/dist/code-generation/integration-implementation/index.js.map +2 -2
- package/dist/code-generation/secret-module.d.ts +12 -0
- package/dist/code-generation/{integration-implementation/integration-secret.js → secret-module.js} +13 -13
- package/dist/code-generation/secret-module.js.map +7 -0
- package/dist/command-implementations/deploy-command.js +1 -0
- package/dist/command-implementations/deploy-command.js.map +2 -2
- package/dist/command-implementations/dev-command.js +9 -9
- package/dist/command-implementations/dev-command.js.map +2 -2
- package/dist/command-implementations/project-command.d.ts +3 -1
- package/dist/command-implementations/project-command.js +7 -5
- package/dist/command-implementations/project-command.js.map +2 -2
- package/dist/command-implementations/serve-command.js +1 -1
- package/dist/command-implementations/serve-command.js.map +2 -2
- package/dist/linter/base-linter.test.js +4 -2
- package/dist/linter/base-linter.test.js.map +2 -2
- package/dist/linter/ruleset-tests/bot.ruleset.test.js +22 -0
- package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +2 -2
- package/dist/linter/rulesets/bot.ruleset.js +3 -1
- package/dist/linter/rulesets/bot.ruleset.js.map +2 -2
- package/dist/linter/rulesets/integration.ruleset.js +2 -12
- package/dist/linter/rulesets/integration.ruleset.js.map +2 -2
- package/dist/linter/rulesets/shared-rules.d.ts +2 -0
- package/dist/linter/rulesets/shared-rules.js +41 -0
- package/dist/linter/rulesets/shared-rules.js.map +7 -0
- package/dist/utils/schema-utils.d.ts +1 -0
- package/dist/utils/schema-utils.js +5 -2
- package/dist/utils/schema-utils.js.map +2 -2
- 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/dist/code-generation/integration-implementation/integration-secret.d.ts +0 -9
- package/dist/code-generation/integration-implementation/integration-secret.js.map +0 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@6.
|
|
2
|
+
> @botpress/cli@6.2.0 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.
|
|
6
|
+
> @botpress/cli@6.2.0 build:types /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> tsc -p ./tsconfig.build.json
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@6.
|
|
10
|
+
> @botpress/cli@6.2.0 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
11
11
|
> ts-node -T build.ts
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
> @botpress/cli@6.
|
|
14
|
+
> @botpress/cli@6.2.0 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.
|
|
17
|
+
🤖 Botpress CLI v6.2.0
|
|
18
18
|
● Checking if cli is up to date
|
|
19
|
-
🤖 Botpress CLI v6.
|
|
19
|
+
🤖 Botpress CLI v6.2.0
|
|
20
20
|
● Checking if cli is up to date
|
|
21
|
-
🤖 Botpress CLI v6.
|
|
21
|
+
🤖 Botpress CLI v6.2.0
|
|
22
22
|
● Checking if cli is up to date
|
|
23
|
-
🤖 Botpress CLI v6.
|
|
23
|
+
🤖 Botpress CLI v6.2.0
|
|
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
|
|
27
27
|
● Checking if sdk is up to date
|
|
28
28
|
● Checking if sdk is up to date
|
|
29
|
-
○ Generating typings for integration empty-integration...
|
|
30
29
|
○ Generating typings for integration hello-world...
|
|
31
30
|
○ Generating typings for bot...
|
|
32
31
|
✓ Typings available at .botpress
|
|
33
32
|
|
|
34
|
-
○ Generating typings for
|
|
33
|
+
○ Generating typings for integration empty-integration...
|
|
35
34
|
✓ Typings available at .botpress
|
|
36
35
|
|
|
37
36
|
✓ Typings available at .botpress
|
|
38
37
|
|
|
38
|
+
○ Generating typings for plugin empty-plugin...
|
|
39
39
|
✓ Typings available at .botpress
|
|
40
40
|
|
|
41
|
-
🤖 Botpress CLI v6.
|
|
41
|
+
🤖 Botpress CLI v6.2.0
|
|
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...
|
package/dist/api/bot-body.js
CHANGED
|
@@ -43,33 +43,38 @@ const prepareCreateBotBody = async (bot) => ({
|
|
|
43
43
|
input: {
|
|
44
44
|
...action.input,
|
|
45
45
|
schema: await utils.schema.mapZodToJsonSchema(action.input, {
|
|
46
|
-
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer
|
|
46
|
+
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
|
|
47
|
+
toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
|
|
47
48
|
})
|
|
48
49
|
},
|
|
49
50
|
output: {
|
|
50
51
|
...action.output,
|
|
51
52
|
schema: await utils.schema.mapZodToJsonSchema(action.output, {
|
|
52
|
-
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer
|
|
53
|
+
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
|
|
54
|
+
toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
|
|
53
55
|
})
|
|
54
56
|
}
|
|
55
57
|
})) : void 0,
|
|
56
58
|
configuration: bot.configuration ? {
|
|
57
59
|
...bot.configuration,
|
|
58
60
|
schema: await utils.schema.mapZodToJsonSchema(bot.configuration, {
|
|
59
|
-
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer
|
|
61
|
+
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
|
|
62
|
+
toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
|
|
60
63
|
})
|
|
61
64
|
} : void 0,
|
|
62
65
|
events: bot.events ? await utils.records.mapValuesAsync(bot.events, async (event) => ({
|
|
63
66
|
...event,
|
|
64
67
|
schema: await utils.schema.mapZodToJsonSchema(event, {
|
|
65
|
-
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer
|
|
68
|
+
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
|
|
69
|
+
toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
|
|
66
70
|
})
|
|
67
71
|
})) : void 0,
|
|
68
72
|
states: bot.states ? utils.records.filterValues(
|
|
69
73
|
await utils.records.mapValuesAsync(bot.states, async (state) => ({
|
|
70
74
|
...state,
|
|
71
75
|
schema: await utils.schema.mapZodToJsonSchema(state, {
|
|
72
|
-
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer
|
|
76
|
+
useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,
|
|
77
|
+
toJSONSchemaOptions: bot.__advanced?.toJSONSchemaOptions
|
|
73
78
|
})
|
|
74
79
|
})),
|
|
75
80
|
({ type }) => type !== "workflow"
|
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 useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: bot.__advanced?.useLegacyZuiTransformer,\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 }),\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 }),\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 }),\n })),\n ({ type }) => type !== 'workflow'\n ) as types.CreateBotRequestBody['states'])\n : undefined,\n tags: bot.attributes,\n})\n\nexport const prepareUpdateBotBody = (\n localBot: types.UpdateBotRequestBody,\n remoteBot: client.Bot\n): types.UpdateBotRequestBody => ({\n ...localBot,\n states: utils.records.setNullOnMissingValues(localBot.states, remoteBot.states),\n recurringEvents: utils.records.setNullOnMissingValues(localBot.recurringEvents, remoteBot.recurringEvents),\n events: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.events, remoteBot.events),\n remoteItems: remoteBot.events,\n }),\n actions: utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localBot.actions, remoteBot.actions),\n remoteItems: remoteBot.actions,\n }),\n user: {\n ...localBot.user,\n tags: utils.records.setNullOnMissingValues(localBot.user?.tags, remoteBot.user?.tags),\n },\n conversation: {\n ...localBot.conversation,\n tags: utils.records.setNullOnMissingValues(localBot.conversation?.tags, remoteBot.conversation?.tags),\n },\n message: {\n ...localBot.message,\n tags: utils.records.setNullOnMissingValues(localBot.message?.tags, remoteBot.message?.tags),\n },\n integrations: utils.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),\n tags: localBot.tags, // TODO: allow removing bot tags (aka attributes) by setting to null\n})\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,uBAAuB,OAAO,SAAiE;AAAA,EAC1G,MAAM,IAAI;AAAA,EACV,cAAc,IAAI;AAAA,EAClB,SAAS,IAAI;AAAA,EACb,iBAAiB,IAAI;AAAA,EACrB,SAAS,IAAI,UACT,MAAM,MAAM,QAAQ,eAAe,IAAI,SAAS,OAAO,YAAY;AAAA,IACjE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,OAAO;AAAA,QAC1D,yBAAyB,IAAI,YAAY;AAAA,
|
|
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.records.setNullOnMissingValues(localBot.integrations, remoteBot.integrations),\n plugins: utils.records.setNullOnMissingValues(localBot.plugins, remoteBot.plugins),\n tags: localBot.tags, // TODO: allow removing bot tags (aka attributes) by setting to null\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,uBAAuB,OAAO,SAAiE;AAAA,EAC1G,MAAM,IAAI;AAAA,EACV,cAAc,IAAI;AAAA,EAClB,SAAS,IAAI;AAAA,EACb,iBAAiB,IAAI;AAAA,EACrB,SAAS,IAAI,UACT,MAAM,MAAM,QAAQ,eAAe,IAAI,SAAS,OAAO,YAAY;AAAA,IACjE,GAAG;AAAA,IACH,OAAO;AAAA,MACL,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,OAAO;AAAA,QAC1D,yBAAyB,IAAI,YAAY;AAAA,QACzC,qBAAqB,IAAI,YAAY;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,IACA,QAAQ;AAAA,MACN,GAAG,OAAO;AAAA,MACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,QAAQ;AAAA,QAC3D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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,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
|
}
|
|
@@ -42,7 +42,8 @@ const prepareCreateIntegrationBody = async (integration) => ({
|
|
|
42
42
|
events: integration.events ? await utils.records.mapValuesAsync(integration.events, async (event) => ({
|
|
43
43
|
...event,
|
|
44
44
|
schema: await utils.schema.mapZodToJsonSchema(event, {
|
|
45
|
-
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer
|
|
45
|
+
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
|
|
46
|
+
toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
|
|
46
47
|
})
|
|
47
48
|
})) : void 0,
|
|
48
49
|
actions: integration.actions ? await utils.records.mapValuesAsync(integration.actions, async (action) => ({
|
|
@@ -50,13 +51,15 @@ const prepareCreateIntegrationBody = async (integration) => ({
|
|
|
50
51
|
input: {
|
|
51
52
|
...action.input,
|
|
52
53
|
schema: await utils.schema.mapZodToJsonSchema(action.input, {
|
|
53
|
-
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer
|
|
54
|
+
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
|
|
55
|
+
toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
|
|
54
56
|
})
|
|
55
57
|
},
|
|
56
58
|
output: {
|
|
57
59
|
...action.output,
|
|
58
60
|
schema: await utils.schema.mapZodToJsonSchema(action.output, {
|
|
59
|
-
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer
|
|
61
|
+
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
|
|
62
|
+
toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
|
|
60
63
|
})
|
|
61
64
|
}
|
|
62
65
|
})) : void 0,
|
|
@@ -65,20 +68,23 @@ const prepareCreateIntegrationBody = async (integration) => ({
|
|
|
65
68
|
messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
|
|
66
69
|
...message,
|
|
67
70
|
schema: await utils.schema.mapZodToJsonSchema(message, {
|
|
68
|
-
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer
|
|
71
|
+
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
|
|
72
|
+
toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
|
|
69
73
|
})
|
|
70
74
|
}))
|
|
71
75
|
})) : void 0,
|
|
72
76
|
states: integration.states ? await utils.records.mapValuesAsync(integration.states, async (state) => ({
|
|
73
77
|
...state,
|
|
74
78
|
schema: await utils.schema.mapZodToJsonSchema(state, {
|
|
75
|
-
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer
|
|
79
|
+
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
|
|
80
|
+
toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
|
|
76
81
|
})
|
|
77
82
|
})) : void 0,
|
|
78
83
|
entities: integration.entities ? await utils.records.mapValuesAsync(integration.entities, async (entity) => ({
|
|
79
84
|
...entity,
|
|
80
85
|
schema: await utils.schema.mapZodToJsonSchema(entity, {
|
|
81
|
-
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer
|
|
86
|
+
useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,
|
|
87
|
+
toJSONSchemaOptions: integration.__advanced?.toJSONSchemaOptions
|
|
82
88
|
})
|
|
83
89
|
})) : void 0,
|
|
84
90
|
attributes: integration.attributes,
|
|
@@ -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 }),\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 }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: integration.__advanced?.useLegacyZuiTransformer,\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 }),\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 }),\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 }),\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,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,OAAO;AAAA,MACnD,yBAAyB,YAAY,YAAY;AAAA,
|
|
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,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,OAAO;AAAA,MACnD,yBAAyB,YAAY,YAAY;AAAA,MACjD,qBAAqB,YAAY,YAAY;AAAA,IAC/C,CAAC;AAAA,EACH,EAAE,IACF;AAAA,EACJ,SAAS,YAAY,UACjB,MAAM,MAAM,QAAQ,eAAe,YAAY,SAAS,OAAO,YAAY;AAAA,IACzE,GAAG;AAAA,IAC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C,aAAa,CAAC,cAAc,aAAa,CAAC,KAAK,OAAO,QAAQ,MAAM,GAAG;AACjF,QAAI,gBAAgB,eAAe;AAEjC,kBAAY,WAAW,IAAI,qCAAqC,cAAc,aAAa;AAAA,IAC7F,WAAW,cAAc;AAEvB,kBAAY,WAAW,IAAI;AAC3B;AAAA,IACF,WAAW,eAAe;AAExB,kBAAY,WAAW,IAAI;AAC3B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,uCAAuC,CAC3C,cACA,mBACkC;AAAA,EAClC,GAAG;AAAA,EACH,UAAU,MAAM,QAAQ,uBAAuB,cAAc,UAAU,cAAc,QAAQ;AAAA,EAC7F,SAAS;AAAA,IACP,GAAG,cAAc;AAAA,IACjB,MAAM,MAAM,QAAQ,uBAAuB,cAAc,SAAS,MAAM,cAAc,QAAQ,IAAI;AAAA,EACpG;AAAA,EACA,cAAc;AAAA,IACZ,GAAG,cAAc;AAAA,IACjB,MAAM,MAAM,QAAQ,uBAAuB,cAAc,cAAc,MAAM,cAAc,aAAa,IAAI;AAAA,EAC9G;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -41,13 +41,15 @@ const prepareCreateInterfaceBody = async (intrface) => ({
|
|
|
41
41
|
entities: intrface.entities ? await utils.records.mapValuesAsync(intrface.entities, async (entity) => ({
|
|
42
42
|
...entity,
|
|
43
43
|
schema: await utils.schema.mapZodToJsonSchema(entity, {
|
|
44
|
-
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer
|
|
44
|
+
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
|
|
45
|
+
toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
|
|
45
46
|
})
|
|
46
47
|
})) : {},
|
|
47
48
|
events: intrface.events ? await utils.records.mapValuesAsync(intrface.events, async (event) => ({
|
|
48
49
|
...event,
|
|
49
50
|
schema: await utils.schema.mapZodToJsonSchema(event, {
|
|
50
|
-
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer
|
|
51
|
+
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
|
|
52
|
+
toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
|
|
51
53
|
})
|
|
52
54
|
})) : {},
|
|
53
55
|
actions: intrface.actions ? await utils.records.mapValuesAsync(intrface.actions, async (action) => ({
|
|
@@ -55,13 +57,15 @@ const prepareCreateInterfaceBody = async (intrface) => ({
|
|
|
55
57
|
input: {
|
|
56
58
|
...action.input,
|
|
57
59
|
schema: await utils.schema.mapZodToJsonSchema(action.input, {
|
|
58
|
-
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer
|
|
60
|
+
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
|
|
61
|
+
toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
|
|
59
62
|
})
|
|
60
63
|
},
|
|
61
64
|
output: {
|
|
62
65
|
...action.output,
|
|
63
66
|
schema: await utils.schema.mapZodToJsonSchema(action.output, {
|
|
64
|
-
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer
|
|
67
|
+
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
|
|
68
|
+
toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
|
|
65
69
|
})
|
|
66
70
|
}
|
|
67
71
|
})) : {},
|
|
@@ -70,7 +74,8 @@ const prepareCreateInterfaceBody = async (intrface) => ({
|
|
|
70
74
|
messages: await utils.records.mapValuesAsync(channel.messages, async (message) => ({
|
|
71
75
|
...message,
|
|
72
76
|
schema: await utils.schema.mapZodToJsonSchema(message, {
|
|
73
|
-
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer
|
|
77
|
+
useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,
|
|
78
|
+
toJSONSchemaOptions: intrface.__advanced?.toJSONSchemaOptions
|
|
74
79
|
})
|
|
75
80
|
}))
|
|
76
81
|
})) : {},
|
|
@@ -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 }),\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 }),\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 }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: intrface.__advanced?.useLegacyZuiTransformer,\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 }),\n })),\n }))\n : {},\n attributes: intrface.attributes,\n})\n\nexport const prepareUpdateInterfaceBody = (\n localInterface: types.CreateInterfaceRequestBody & { id: string },\n remoteInterface: client.Interface\n): types.UpdateInterfaceRequestBody => {\n const actions = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.actions, remoteInterface.actions),\n remoteItems: remoteInterface.actions,\n })\n const events = utils.attributes.prepareAttributeUpdateBody({\n localItems: utils.records.setNullOnMissingValues(localInterface.events, remoteInterface.events),\n remoteItems: remoteInterface.events,\n })\n const entities = utils.records.setNullOnMissingValues(localInterface.entities, remoteInterface.entities)\n\n const currentChannels: types.UpdateInterfaceRequestBody['channels'] = localInterface.channels\n ? utils.records.mapValues(localInterface.channels, (channel, channelName) => ({\n ...channel,\n messages: utils.records.setNullOnMissingValues(\n channel?.messages,\n remoteInterface.channels[channelName]?.messages\n ),\n }))\n : undefined\n\n const channels = utils.records.setNullOnMissingValues(currentChannels, remoteInterface.channels)\n\n const attributes = utils.records.setNullOnMissingValues(localInterface.attributes, remoteInterface.attributes)\n\n return {\n ...localInterface,\n entities,\n actions,\n events,\n channels,\n attributes,\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,6BAA6B,OACxC,cAC+C;AAAA,EAC/C,MAAM,SAAS;AAAA,EACf,SAAS,SAAS;AAAA,EAClB,OAAO,WAAW,WAAW,SAAS,QAAQ;AAAA,EAC9C,aAAa,iBAAiB,WAAW,SAAS,cAAc;AAAA,EAChE,UAAU,SAAS,WACf,MAAM,MAAM,QAAQ,eAAe,SAAS,UAAU,OAAO,YAAY;AAAA,IACvE,GAAG;AAAA,IACH,QAAQ,MAAM,MAAM,OAAO,mBAAmB,QAAQ;AAAA,MACpD,yBAAyB,SAAS,YAAY;AAAA,
|
|
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,MAAM,OAAO,mBAAmB,QAAQ;AAAA,MACpD,yBAAyB,SAAS,YAAY;AAAA,MAC9C,qBAAqB,SAAS,YAAY;AAAA,IAC5C,CAAC;AAAA,EACH,EAAE,IACF,CAAC;AAAA,EACL,QAAQ,SAAS,SACb,MAAM,MAAM,QAAQ,eAAe,SAAS,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AS,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
|
@@ -50,13 +50,15 @@ const prepareCreatePluginBody = async (plugin) => ({
|
|
|
50
50
|
configuration: plugin.configuration ? {
|
|
51
51
|
...plugin.configuration,
|
|
52
52
|
schema: await utils.schema.mapZodToJsonSchema(plugin.configuration, {
|
|
53
|
-
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer
|
|
53
|
+
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,
|
|
54
|
+
toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions
|
|
54
55
|
})
|
|
55
56
|
} : void 0,
|
|
56
57
|
events: plugin.events ? await utils.records.mapValuesAsync(plugin.events, async (event) => ({
|
|
57
58
|
...event,
|
|
58
59
|
schema: await utils.schema.mapZodToJsonSchema(event, {
|
|
59
|
-
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer
|
|
60
|
+
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,
|
|
61
|
+
toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions
|
|
60
62
|
})
|
|
61
63
|
})) : void 0,
|
|
62
64
|
actions: plugin.actions ? await utils.records.mapValuesAsync(plugin.actions, async (action) => ({
|
|
@@ -64,13 +66,15 @@ const prepareCreatePluginBody = async (plugin) => ({
|
|
|
64
66
|
input: {
|
|
65
67
|
...action.input,
|
|
66
68
|
schema: await utils.schema.mapZodToJsonSchema(action.input, {
|
|
67
|
-
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer
|
|
69
|
+
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,
|
|
70
|
+
toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions
|
|
68
71
|
})
|
|
69
72
|
},
|
|
70
73
|
output: {
|
|
71
74
|
...action.output,
|
|
72
75
|
schema: await utils.schema.mapZodToJsonSchema(action.output, {
|
|
73
|
-
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer
|
|
76
|
+
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,
|
|
77
|
+
toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions
|
|
74
78
|
})
|
|
75
79
|
}
|
|
76
80
|
})) : void 0,
|
|
@@ -78,7 +82,8 @@ const prepareCreatePluginBody = async (plugin) => ({
|
|
|
78
82
|
await utils.records.mapValuesAsync(plugin.states, async (state) => ({
|
|
79
83
|
...state,
|
|
80
84
|
schema: await utils.schema.mapZodToJsonSchema(state, {
|
|
81
|
-
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer
|
|
85
|
+
useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,
|
|
86
|
+
toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions
|
|
82
87
|
})
|
|
83
88
|
})),
|
|
84
89
|
({ type }) => type !== "workflow"
|
|
@@ -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\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 message: {\n tags: plugin.message?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration, {\n useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n }),\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 useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n }),\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 useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n }),\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 useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n }),\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 const dependencies: types.UpdatePluginRequestBody['dependencies'] = {\n integrations: utils.records.setNullOnMissingValues(\n localPlugin.dependencies?.integrations,\n remotePlugin.dependencies?.integrations\n ),\n interfaces: utils.records.setNullOnMissingValues(\n localPlugin.dependencies?.interfaces,\n remotePlugin.dependencies?.interfaces\n ),\n }\n\n // TODO: set null to conversation, user and message tags that are removed\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n attributes,\n dependencies,\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,SAAS;AAAA,IACP,MAAM,OAAO,SAAS,QAAQ,CAAC;AAAA,EACjC;AAAA,EACA,eAAe,OAAO,gBAClB;AAAA,IACE,GAAG,OAAO;AAAA,IACV,QAAQ,MAAM,MAAM,OAAO,mBAAmB,OAAO,eAAe;AAAA,MAClE,yBAAyB,OAAO,YAAY;AAAA,
|
|
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\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 message: {\n tags: plugin.message?.tags ?? {},\n },\n configuration: plugin.configuration\n ? {\n ...plugin.configuration,\n schema: await utils.schema.mapZodToJsonSchema(plugin.configuration, {\n useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions,\n }),\n },\n output: {\n ...action.output,\n schema: await utils.schema.mapZodToJsonSchema(action.output, {\n useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions,\n }),\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 useLegacyZuiTransformer: plugin.__advanced?.useLegacyZuiTransformer,\n toJSONSchemaOptions: plugin.__advanced?.toJSONSchemaOptions,\n }),\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 const dependencies: types.UpdatePluginRequestBody['dependencies'] = {\n integrations: utils.records.setNullOnMissingValues(\n localPlugin.dependencies?.integrations,\n remotePlugin.dependencies?.integrations\n ),\n interfaces: utils.records.setNullOnMissingValues(\n localPlugin.dependencies?.interfaces,\n remotePlugin.dependencies?.interfaces\n ),\n }\n\n // TODO: set null to conversation, user and message tags that are removed\n\n return {\n ...localPlugin,\n actions,\n events,\n states,\n attributes,\n dependencies,\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGhB,MAAM,0BAA0B,OACrC,YAC4C;AAAA,EAC5C,MAAM,OAAO;AAAA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|
|
7
7
|
}
|
|
@@ -33,9 +33,11 @@ __export(bot_implementation_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(bot_implementation_exports);
|
|
34
34
|
var consts = __toESM(require("../consts"));
|
|
35
35
|
var mod = __toESM(require("../module"));
|
|
36
|
+
var import_secret_module = require("../secret-module");
|
|
36
37
|
var import_bot_implementation = require("./bot-implementation");
|
|
37
38
|
class BotIndexModule extends mod.Module {
|
|
38
39
|
_botImplModule;
|
|
40
|
+
_botSecretModule;
|
|
39
41
|
constructor(sdkBotDefinition) {
|
|
40
42
|
super({
|
|
41
43
|
path: consts.INDEX_FILE,
|
|
@@ -45,13 +47,19 @@ class BotIndexModule extends mod.Module {
|
|
|
45
47
|
botImpl.unshift(consts.fromOutDir.implementationDir);
|
|
46
48
|
this.pushDep(botImpl);
|
|
47
49
|
this._botImplModule = botImpl;
|
|
50
|
+
const botSecrets = new import_secret_module.SecretIndexModule(sdkBotDefinition.secrets ?? {});
|
|
51
|
+
botSecrets.unshift(consts.fromOutDir.secretsDir);
|
|
52
|
+
this.pushDep(botSecrets);
|
|
53
|
+
this._botSecretModule = botSecrets;
|
|
48
54
|
}
|
|
49
55
|
async getContent() {
|
|
50
56
|
const botImplImport = this._botImplModule.import(this);
|
|
57
|
+
const botSecretImport = this._botSecretModule.import(this);
|
|
51
58
|
return [
|
|
52
59
|
//
|
|
53
60
|
consts.GENERATED_HEADER,
|
|
54
|
-
`export * from "./${botImplImport}"
|
|
61
|
+
`export * from "./${botImplImport}"`,
|
|
62
|
+
`export * from "./${botSecretImport}"`
|
|
55
63
|
].join("\n");
|
|
56
64
|
}
|
|
57
65
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/code-generation/bot-implementation/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport * as mod from '../module'\nimport * as types from '../typings'\nimport { BotImplementationModule } from './bot-implementation'\n\nclass BotIndexModule extends mod.Module {\n private _botImplModule: BotImplementationModule\n\n public constructor(sdkBotDefinition: sdk.BotDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: '',\n })\n\n const botImpl = new BotImplementationModule(sdkBotDefinition)\n botImpl.unshift(consts.fromOutDir.implementationDir)\n this.pushDep(botImpl)\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,UAAqB;
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport * as mod from '../module'\nimport { SecretIndexModule } from '../secret-module'\nimport * as types from '../typings'\nimport { BotImplementationModule } from './bot-implementation'\n\nclass BotIndexModule extends mod.Module {\n private _botImplModule: BotImplementationModule\n private _botSecretModule: SecretIndexModule\n\n public constructor(sdkBotDefinition: sdk.BotDefinition) {\n super({\n path: consts.INDEX_FILE,\n exportName: '',\n })\n\n const botImpl = new BotImplementationModule(sdkBotDefinition)\n botImpl.unshift(consts.fromOutDir.implementationDir)\n this.pushDep(botImpl)\n this._botImplModule = botImpl\n\n const botSecrets = new SecretIndexModule(sdkBotDefinition.secrets ?? {})\n botSecrets.unshift(consts.fromOutDir.secretsDir)\n this.pushDep(botSecrets)\n this._botSecretModule = botSecrets\n }\n\n public async getContent(): Promise<string> {\n const botImplImport = this._botImplModule.import(this)\n const botSecretImport = this._botSecretModule.import(this)\n\n return [\n //\n consts.GENERATED_HEADER,\n `export * from \"./${botImplImport}\"`,\n `export * from \"./${botSecretImport}\"`,\n ].join('\\n')\n }\n}\n\nexport const generateBotImplementation = async (sdkBotDefinition: sdk.BotDefinition): Promise<types.File[]> => {\n const botIndexModule = new BotIndexModule(sdkBotDefinition)\n return botIndexModule.flatten()\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,UAAqB;AACrB,2BAAkC;AAElC,gCAAwC;AAExC,MAAM,uBAAuB,IAAI,OAAO;AAAA,EAC9B;AAAA,EACA;AAAA,EAED,YAAY,kBAAqC;AACtD,UAAM;AAAA,MACJ,MAAM,OAAO;AAAA,MACb,YAAY;AAAA,IACd,CAAC;AAED,UAAM,UAAU,IAAI,kDAAwB,gBAAgB;AAC5D,YAAQ,QAAQ,OAAO,WAAW,iBAAiB;AACnD,SAAK,QAAQ,OAAO;AACpB,SAAK,iBAAiB;AAEtB,UAAM,aAAa,IAAI,uCAAkB,iBAAiB,WAAW,CAAC,CAAC;AACvE,eAAW,QAAQ,OAAO,WAAW,UAAU;AAC/C,SAAK,QAAQ,UAAU;AACvB,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAEA,MAAa,aAA8B;AACzC,UAAM,gBAAgB,KAAK,eAAe,OAAO,IAAI;AACrD,UAAM,kBAAkB,KAAK,iBAAiB,OAAO,IAAI;AAEzD,WAAO;AAAA;AAAA,MAEL,OAAO;AAAA,MACP,oBAAoB,aAAa;AAAA,MACjC,oBAAoB,eAAe;AAAA,IACrC,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAEO,MAAM,4BAA4B,OAAO,qBAA+D;AAC7G,QAAM,iBAAiB,IAAI,eAAe,gBAAgB;AAC1D,SAAO,eAAe,QAAQ;AAChC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './typings';
|
|
2
|
-
export { secretEnvVariableName } from './
|
|
2
|
+
export { secretEnvVariableName } from './secret-module';
|
|
3
3
|
export { generateBotImplementation } from './bot-implementation';
|
|
4
4
|
export { generateIntegrationImplementation } from './integration-implementation';
|
|
5
5
|
export { generatePluginImplementation } from './plugin-implementation';
|
|
@@ -25,11 +25,11 @@ __export(code_generation_exports, {
|
|
|
25
25
|
generateInterfacePackage: () => import_interface_package.generateInterfacePackage,
|
|
26
26
|
generatePluginImplementation: () => import_plugin_implementation.generatePluginImplementation,
|
|
27
27
|
generatePluginPackage: () => import_plugin_package.generatePluginPackage,
|
|
28
|
-
secretEnvVariableName: () =>
|
|
28
|
+
secretEnvVariableName: () => import_secret_module.secretEnvVariableName
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(code_generation_exports);
|
|
31
31
|
__reExport(code_generation_exports, require("./typings"), module.exports);
|
|
32
|
-
var
|
|
32
|
+
var import_secret_module = require("./secret-module");
|
|
33
33
|
var import_bot_implementation = require("./bot-implementation");
|
|
34
34
|
var import_integration_implementation = require("./integration-implementation");
|
|
35
35
|
var import_plugin_implementation = require("./plugin-implementation");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/code-generation/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './typings'\nexport { secretEnvVariableName } from './
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAc,sBAAd;AACA,
|
|
4
|
+
"sourcesContent": ["export * from './typings'\nexport { secretEnvVariableName } from './secret-module'\nexport { generateBotImplementation } from './bot-implementation'\nexport { generateIntegrationImplementation } from './integration-implementation'\nexport { generatePluginImplementation } from './plugin-implementation'\nexport { generateIntegrationPackage } from './integration-package'\nexport { generateInterfacePackage } from './interface-package'\nexport { generatePluginPackage } from './plugin-package'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oCAAc,sBAAd;AACA,2BAAsC;AACtC,gCAA0C;AAC1C,wCAAkD;AAClD,mCAA6C;AAC7C,iCAA2C;AAC3C,+BAAyC;AACzC,4BAAsC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,15 +32,15 @@ __export(integration_implementation_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(integration_implementation_exports);
|
|
34
34
|
var consts = __toESM(require("../consts"));
|
|
35
|
+
var import_secret_module = require("../secret-module");
|
|
35
36
|
var import_integration_implementation = require("./integration-implementation");
|
|
36
|
-
var import_integration_secret = require("./integration-secret");
|
|
37
37
|
const generateIntegrationImplementationCls = async (sdkIntegrationDefinition, implPath) => {
|
|
38
38
|
const indexModule = new import_integration_implementation.IntegrationImplementationModule(sdkIntegrationDefinition);
|
|
39
39
|
indexModule.unshift(implPath);
|
|
40
40
|
return indexModule.flatten();
|
|
41
41
|
};
|
|
42
42
|
const generateIntegrationSecrets = async (sdkIntegrationDefinition, secretsPath) => {
|
|
43
|
-
const indexModule = new
|
|
43
|
+
const indexModule = new import_secret_module.SecretIndexModule(sdkIntegrationDefinition.secrets ?? {});
|
|
44
44
|
indexModule.unshift(secretsPath);
|
|
45
45
|
return indexModule.flatten();
|
|
46
46
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/code-generation/integration-implementation/index.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport * as consts from '../consts'\nimport { SecretIndexModule } from '../secret-module'\nimport * as types from '../typings'\nimport { IntegrationImplementationModule } from './integration-implementation'\n\nconst generateIntegrationImplementationCls = async (\n sdkIntegrationDefinition: sdk.IntegrationDefinition,\n implPath: string\n): Promise<types.File[]> => {\n const indexModule = new IntegrationImplementationModule(sdkIntegrationDefinition)\n indexModule.unshift(implPath)\n return indexModule.flatten()\n}\n\nconst generateIntegrationSecrets = async (\n sdkIntegrationDefinition: sdk.IntegrationDefinition,\n secretsPath: string\n): Promise<types.File[]> => {\n const indexModule = new SecretIndexModule(sdkIntegrationDefinition.secrets ?? {})\n indexModule.unshift(secretsPath)\n return indexModule.flatten()\n}\n\nconst generateIntegrationImplementationIndex = async (implPath: string, secretsPath: string): Promise<types.File> => {\n let content = ''\n content += `export * from './${implPath}'\\n`\n content += `export * from './${secretsPath}'\\n`\n return {\n path: consts.INDEX_FILE,\n content,\n }\n}\n\nexport const generateIntegrationImplementation = async (\n sdkIntegrationDefinition: sdk.IntegrationDefinition\n): Promise<types.File[]> => {\n const implPath = consts.fromOutDir.implementationDir\n const secretsPath = consts.fromOutDir.secretsDir\n const implFiles = await generateIntegrationImplementationCls(sdkIntegrationDefinition, implPath)\n const secretFiles = await generateIntegrationSecrets(sdkIntegrationDefinition, secretsPath)\n const indexFile = await generateIntegrationImplementationIndex(implPath, secretsPath)\n return [...implFiles, ...secretFiles, indexFile]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AACxB,2BAAkC;AAElC,wCAAgD;AAEhD,MAAM,uCAAuC,OAC3C,0BACA,aAC0B;AAC1B,QAAM,cAAc,IAAI,kEAAgC,wBAAwB;AAChF,cAAY,QAAQ,QAAQ;AAC5B,SAAO,YAAY,QAAQ;AAC7B;AAEA,MAAM,6BAA6B,OACjC,0BACA,gBAC0B;AAC1B,QAAM,cAAc,IAAI,uCAAkB,yBAAyB,WAAW,CAAC,CAAC;AAChF,cAAY,QAAQ,WAAW;AAC/B,SAAO,YAAY,QAAQ;AAC7B;AAEA,MAAM,yCAAyC,OAAO,UAAkB,gBAA6C;AACnH,MAAI,UAAU;AACd,aAAW,oBAAoB,QAAQ;AAAA;AACvC,aAAW,oBAAoB,WAAW;AAAA;AAC1C,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb;AAAA,EACF;AACF;AAEO,MAAM,oCAAoC,OAC/C,6BAC0B;AAC1B,QAAM,WAAW,OAAO,WAAW;AACnC,QAAM,cAAc,OAAO,WAAW;AACtC,QAAM,YAAY,MAAM,qCAAqC,0BAA0B,QAAQ;AAC/F,QAAM,cAAc,MAAM,2BAA2B,0BAA0B,WAAW;AAC1F,QAAM,YAAY,MAAM,uCAAuC,UAAU,WAAW;AACpF,SAAO,CAAC,GAAG,WAAW,GAAG,aAAa,SAAS;AACjD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Module } from './module';
|
|
2
|
+
export declare const secretEnvVariableName: (secretName: string) => string;
|
|
3
|
+
export declare const stripSecretEnvVariablePrefix: (secretName: string) => string;
|
|
4
|
+
type SecretDefinitions = Record<string, {
|
|
5
|
+
optional?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare class SecretIndexModule extends Module {
|
|
8
|
+
private _secrets;
|
|
9
|
+
constructor(_secrets: SecretDefinitions);
|
|
10
|
+
getContent(): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|