@botpress/cli 1.0.1 ā 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/dist/sdk/resolve-integration-interfaces.js +2 -2
- package/dist/sdk/resolve-integration-interfaces.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/hello-world/package.json +2 -2
- package/templates/webhook-message/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@1.0.
|
|
2
|
+
> @botpress/cli@1.0.3 build /home/runner/work/botpress/botpress/packages/cli
|
|
3
3
|
> pnpm run bundle && pnpm run template:gen
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @botpress/cli@1.0.
|
|
6
|
+
> @botpress/cli@1.0.3 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> ts-node -T build.ts
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@1.0.
|
|
10
|
+
> @botpress/cli@1.0.3 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 v1.0.
|
|
14
|
-
š¤ Botpress CLI v1.0.
|
|
15
|
-
š¤ Botpress CLI v1.0.
|
|
16
|
-
š¤ Botpress CLI v1.0.
|
|
17
|
-
[2K[1Gā Generating typings for integration empty-integration...[2K[1G
|
|
18
|
-
[2K[1Gā Typings available at .botpress
|
|
19
|
-
[2K[1Gā Generating typings for integration
|
|
13
|
+
š¤ Botpress CLI v1.0.3
|
|
14
|
+
š¤ Botpress CLI v1.0.3
|
|
15
|
+
š¤ Botpress CLI v1.0.3
|
|
16
|
+
š¤ Botpress CLI v1.0.3
|
|
17
|
+
[2K[1Gā Generating typings for integration empty-integration...[2K[1Gā Typings available at .botpress
|
|
18
|
+
[2K[1Gā Generating typings for bot...[2K[1Gā Generating typings for integration hello-world...[2K[1Gā Typings available at .botpress
|
|
19
|
+
[2K[1Gā Generating typings for integration webhook-message...[2K[1Gā Typings available at .botpress
|
|
20
20
|
[2K[1Gā Typings available at .botpress
|
|
@@ -45,11 +45,11 @@ const resolveInterfaces = (integration) => {
|
|
|
45
45
|
};
|
|
46
46
|
const getImplementationStatements = (integration) => {
|
|
47
47
|
const self = integration;
|
|
48
|
-
if (!self.
|
|
48
|
+
if (!self.interfaces) {
|
|
49
49
|
return {};
|
|
50
50
|
}
|
|
51
51
|
const statements = {};
|
|
52
|
-
for (const [interfaceKey, intrface] of Object.entries(self.
|
|
52
|
+
for (const [interfaceKey, intrface] of Object.entries(self.interfaces)) {
|
|
53
53
|
const { statement } = _resolveInterface(intrface);
|
|
54
54
|
statements[interfaceKey] = statement;
|
|
55
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/sdk/resolve-integration-interfaces.ts"],
|
|
4
|
-
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport _ from 'lodash'\nimport * as utils from '../utils'\n\ntype InterfaceInstance = NonNullable<sdk.IntegrationDefinition['interfaces']>[number]\ntype ResolvedInterface = {\n actions: Record<string, sdk.ActionDefinition>\n events: Record<string, sdk.EventDefinition>\n channels: Record<string, sdk.ChannelDefinition>\n}\ntype InterfaceImplStatement = {\n id?: string\n name: string\n version: string\n entities: Record<string, { name: string }>\n actions: Record<string, { name: string }>\n events: Record<string, { name: string }>\n channels: Record<string, { name: string }>\n}\n\nexport const resolveInterfaces = <I extends sdk.IntegrationDefinition | sdk.IntegrationPackage['definition']>(\n integration: I\n): I => {\n const self = integration as utils.types.Writable<I>\n if (!self.interfaces) {\n return integration\n }\n\n for (const intrface of Object.values(self.interfaces)) {\n const { resolved } = _resolveInterface(intrface)\n\n /**\n * If an action is defined both in the integration and the interface; we merge both.\n * This allows setting more specific properties in the integration, while staying compatible with the interface.\n * Same goes for channels and events.\n */\n\n self.actions = utils.records.mergeRecords(self.actions ?? {}, resolved.actions, _mergeActions)\n self.channels = utils.records.mergeRecords(self.channels ?? {}, resolved.channels, _mergeChannels)\n self.events = utils.records.mergeRecords(self.events ?? {}, resolved.events, _mergeEvents)\n }\n\n return self\n}\n\nexport const getImplementationStatements = (\n integration: sdk.IntegrationDefinition\n): Record<string, InterfaceImplStatement> => {\n const self = integration as utils.types.Writable<sdk.IntegrationDefinition>\n if (!self.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAc;AACd,YAAuB;AAkBhB,MAAM,oBAAoB,CAC/B,gBACM;AACN,QAAM,OAAO;AACb,MAAI,CAAC,KAAK,YAAY;AACpB,WAAO;AAAA,EACT;AAEA,aAAW,YAAY,OAAO,OAAO,KAAK,UAAU,GAAG;AACrD,UAAM,EAAE,SAAS,IAAI,kBAAkB,QAAQ;AAQ/C,SAAK,UAAU,MAAM,QAAQ,aAAa,KAAK,WAAW,CAAC,GAAG,SAAS,SAAS,aAAa;AAC7F,SAAK,WAAW,MAAM,QAAQ,aAAa,KAAK,YAAY,CAAC,GAAG,SAAS,UAAU,cAAc;AACjG,SAAK,SAAS,MAAM,QAAQ,aAAa,KAAK,UAAU,CAAC,GAAG,SAAS,QAAQ,YAAY;AAAA,EAC3F;AAEA,SAAO;AACT;AAEO,MAAM,8BAA8B,CACzC,gBAC2C;AAC3C,QAAM,OAAO;AACb,MAAI,CAAC,KAAK,
|
|
4
|
+
"sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport _ from 'lodash'\nimport * as utils from '../utils'\n\ntype InterfaceInstance = NonNullable<sdk.IntegrationDefinition['interfaces']>[number]\ntype ResolvedInterface = {\n actions: Record<string, sdk.ActionDefinition>\n events: Record<string, sdk.EventDefinition>\n channels: Record<string, sdk.ChannelDefinition>\n}\ntype InterfaceImplStatement = {\n id?: string\n name: string\n version: string\n entities: Record<string, { name: string }>\n actions: Record<string, { name: string }>\n events: Record<string, { name: string }>\n channels: Record<string, { name: string }>\n}\n\nexport const resolveInterfaces = <I extends sdk.IntegrationDefinition | sdk.IntegrationPackage['definition']>(\n integration: I\n): I => {\n const self = integration as utils.types.Writable<I>\n if (!self.interfaces) {\n return integration\n }\n\n for (const intrface of Object.values(self.interfaces)) {\n const { resolved } = _resolveInterface(intrface)\n\n /**\n * If an action is defined both in the integration and the interface; we merge both.\n * This allows setting more specific properties in the integration, while staying compatible with the interface.\n * Same goes for channels and events.\n */\n\n self.actions = utils.records.mergeRecords(self.actions ?? {}, resolved.actions, _mergeActions)\n self.channels = utils.records.mergeRecords(self.channels ?? {}, resolved.channels, _mergeChannels)\n self.events = utils.records.mergeRecords(self.events ?? {}, resolved.events, _mergeEvents)\n }\n\n return self\n}\n\nexport const getImplementationStatements = (\n integration: sdk.IntegrationDefinition\n): Record<string, InterfaceImplStatement> => {\n const self = integration as utils.types.Writable<sdk.IntegrationDefinition>\n if (!self.interfaces) {\n return {}\n }\n\n const statements: Record<string, InterfaceImplStatement> = {}\n for (const [interfaceKey, intrface] of Object.entries(self.interfaces)) {\n const { statement } = _resolveInterface(intrface)\n statements[interfaceKey] = statement\n }\n\n return statements\n}\n\nconst _mergeActions = (a: sdk.ActionDefinition, b: sdk.ActionDefinition): sdk.ActionDefinition => {\n return {\n ...a,\n ...b,\n input: {\n schema: a.input.schema.merge(b.input.schema),\n },\n output: {\n schema: a.output.schema.merge(b.output.schema),\n },\n }\n}\n\nconst _mergeEvents = (a: sdk.EventDefinition, b: sdk.EventDefinition): sdk.EventDefinition => {\n return {\n ...a,\n ...b,\n schema: a.schema.merge(b.schema),\n }\n}\n\nconst _mergeChannels = (a: sdk.ChannelDefinition, b: sdk.ChannelDefinition): sdk.ChannelDefinition => {\n const messages = utils.records.mergeRecords(a.messages, b.messages, _mergeMessage)\n return {\n ...a,\n ...b,\n messages,\n }\n}\n\nconst _mergeMessage = (a: sdk.MessageDefinition, b: sdk.MessageDefinition): sdk.MessageDefinition => {\n return {\n schema: a.schema.merge(b.schema),\n }\n}\n\nconst _resolveInterface = (\n intrface: InterfaceInstance\n): { resolved: ResolvedInterface; statement: InterfaceImplStatement } => {\n const id = 'id' in intrface ? intrface.id : undefined\n const {\n definition: { name, version },\n } = intrface\n\n const resolved: ResolvedInterface = { actions: {}, events: {}, channels: {} }\n const statement: InterfaceImplStatement = {\n id,\n name,\n version,\n entities: _.mapValues(intrface.entities, (entity) => ({ name: entity.name })), // { item: { name: 'issue' } },\n actions: {},\n events: {},\n channels: {},\n }\n\n const entitySchemas = _.mapValues(intrface.entities, (entity) => entity.schema)\n\n // dereference actions\n for (const [actionName, action] of Object.entries(intrface.definition.actions ?? {})) {\n const resolvedInputSchema = action.input.schema.dereference(entitySchemas) as sdk.z.AnyZodObject\n const resolvedOutputSchema = action.output.schema.dereference(entitySchemas) as sdk.z.AnyZodObject\n\n const newActionName = _rename(intrface, actionName)\n resolved.actions[newActionName] = {\n ...action,\n input: { schema: resolvedInputSchema },\n output: { schema: resolvedOutputSchema },\n }\n statement.actions[actionName] = { name: newActionName }\n }\n\n // dereference events\n for (const [eventName, event] of Object.entries(intrface.definition.events ?? {})) {\n const resolvedEventSchema = event.schema.dereference(entitySchemas) as sdk.z.AnyZodObject\n const newEventName = _rename(intrface, eventName)\n resolved.events[newEventName] = { ...event, schema: resolvedEventSchema }\n statement.events[eventName] = { name: newEventName }\n }\n\n // dereference channels\n for (const [channelName, channel] of Object.entries(intrface.definition.channels ?? {})) {\n const messages: Record<string, { schema: sdk.z.AnyZodObject }> = {}\n for (const [messageName, message] of Object.entries(channel.messages)) {\n const resolvedMessageSchema = message.schema.dereference(entitySchemas) as sdk.z.AnyZodObject\n // no renaming for messages as they are already contained within a channel that acts as a namespace\n messages[messageName] = { ...message, schema: resolvedMessageSchema }\n }\n const newChannelName = _rename(intrface, channelName)\n resolved.channels[newChannelName] = { ...channel, messages }\n statement.channels[channelName] = { name: newChannelName }\n }\n\n return { resolved, statement }\n}\n\nconst _rename = (intrface: InterfaceInstance, name: string) => {\n if (!intrface.definition.templateName) {\n return name\n }\n const { entities } = intrface\n const templateProps = _.mapValues(entities, (entity) => entity.name)\n return utils.template.formatHandleBars(intrface.definition.templateName, { ...templateProps, name })\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAc;AACd,YAAuB;AAkBhB,MAAM,oBAAoB,CAC/B,gBACM;AACN,QAAM,OAAO;AACb,MAAI,CAAC,KAAK,YAAY;AACpB,WAAO;AAAA,EACT;AAEA,aAAW,YAAY,OAAO,OAAO,KAAK,UAAU,GAAG;AACrD,UAAM,EAAE,SAAS,IAAI,kBAAkB,QAAQ;AAQ/C,SAAK,UAAU,MAAM,QAAQ,aAAa,KAAK,WAAW,CAAC,GAAG,SAAS,SAAS,aAAa;AAC7F,SAAK,WAAW,MAAM,QAAQ,aAAa,KAAK,YAAY,CAAC,GAAG,SAAS,UAAU,cAAc;AACjG,SAAK,SAAS,MAAM,QAAQ,aAAa,KAAK,UAAU,CAAC,GAAG,SAAS,QAAQ,YAAY;AAAA,EAC3F;AAEA,SAAO;AACT;AAEO,MAAM,8BAA8B,CACzC,gBAC2C;AAC3C,QAAM,OAAO;AACb,MAAI,CAAC,KAAK,YAAY;AACpB,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,aAAqD,CAAC;AAC5D,aAAW,CAAC,cAAc,QAAQ,KAAK,OAAO,QAAQ,KAAK,UAAU,GAAG;AACtE,UAAM,EAAE,UAAU,IAAI,kBAAkB,QAAQ;AAChD,eAAW,gBAAgB;AAAA,EAC7B;AAEA,SAAO;AACT;AAEA,MAAM,gBAAgB,CAAC,GAAyB,MAAkD;AAChG,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO;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ACrB,QAAM,gBAAgB,cAAAA,QAAE,UAAU,UAAU,CAAC,WAAW,OAAO,IAAI;AACnE,SAAO,MAAM,SAAS,iBAAiB,SAAS,WAAW,cAAc,EAAE,GAAG,eAAe,KAAK,CAAC;AACrG;",
|
|
6
6
|
"names": ["_"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Botpress CLI",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "pnpm run bundle && pnpm run template:gen",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@apidevtools/json-schema-ref-parser": "^11.7.0",
|
|
24
|
-
"@botpress/client": "0.33.
|
|
25
|
-
"@botpress/sdk": "1.0.
|
|
24
|
+
"@botpress/client": "0.33.1",
|
|
25
|
+
"@botpress/sdk": "1.0.1",
|
|
26
26
|
"@bpinternal/const": "^0.0.20",
|
|
27
27
|
"@bpinternal/tunnel": "^0.1.1",
|
|
28
28
|
"@bpinternal/yargs-extra": "^0.0.3",
|