@botpress/cli 0.9.1 ā 0.9.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 +8 -8
- package/dist/command-implementations/integration-commands.js +18 -8
- package/dist/command-implementations/integration-commands.js.map +2 -2
- package/package.json +1 -1
- package/templates/empty-integration/src/index.ts +1 -1
- package/templates/hello-world/src/index.ts +1 -1
- package/templates/webhook-message/src/index.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
|
|
2
|
-
> @botpress/cli@0.9.
|
|
2
|
+
> @botpress/cli@0.9.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@0.9.
|
|
6
|
+
> @botpress/cli@0.9.3 bundle /home/runner/work/botpress/botpress/packages/cli
|
|
7
7
|
> ts-node -T build.ts
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
> @botpress/cli@0.9.
|
|
10
|
+
> @botpress/cli@0.9.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 v0.9.
|
|
14
|
-
š¤ Botpress CLI v0.9.
|
|
15
|
-
š¤ Botpress CLI v0.9.
|
|
16
|
-
š¤ Botpress CLI v0.9.
|
|
13
|
+
š¤ Botpress CLI v0.9.3
|
|
14
|
+
š¤ Botpress CLI v0.9.3
|
|
15
|
+
š¤ Botpress CLI v0.9.3
|
|
16
|
+
š¤ Botpress CLI v0.9.3
|
|
17
17
|
ā No typings to generate for bot projects
|
|
18
|
-
[2K[1Gā Generating typings for integration
|
|
18
|
+
[2K[1Gā Generating typings for integration webhook-message...[2K[1Gā Generating typings for integration empty-integration...[2K[1Gā Generating typings for integration hello-world...[2K[1Gā Typings available at .botpress
|
|
19
19
|
[2K[1Gā Typings available at .botpress
|
|
20
20
|
[2K[1Gā Typings available at .botpress
|
|
@@ -85,6 +85,22 @@ class DeleteIntegrationCommand extends import_global_command.GlobalCommand {
|
|
|
85
85
|
if (parsedRef.type === "path") {
|
|
86
86
|
throw new errors.BotpressCLIError("Cannot delete local integration");
|
|
87
87
|
}
|
|
88
|
+
let integrationId;
|
|
89
|
+
if (parsedRef.type === "id") {
|
|
90
|
+
integrationId = parsedRef.id;
|
|
91
|
+
} else {
|
|
92
|
+
const integration = await this._findIntegration(api, parsedRef);
|
|
93
|
+
integrationId = integration.id;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
await api.client.deleteIntegration({ id: integrationId });
|
|
97
|
+
} catch (thrown) {
|
|
98
|
+
throw errors.BotpressCLIError.wrap(thrown, `Could not delete integration ${this.argv.integrationRef}`);
|
|
99
|
+
}
|
|
100
|
+
this.logger.success(`Integration ${import_chalk.default.bold(this.argv.integrationRef)} deleted`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
_findIntegration = async (api, parsedRef) => {
|
|
88
104
|
let integration;
|
|
89
105
|
try {
|
|
90
106
|
integration = await api.findPrivateIntegration(parsedRef);
|
|
@@ -98,14 +114,8 @@ class DeleteIntegrationCommand extends import_global_command.GlobalCommand {
|
|
|
98
114
|
}
|
|
99
115
|
throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} not found`);
|
|
100
116
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
} catch (thrown) {
|
|
104
|
-
throw errors.BotpressCLIError.wrap(thrown, `Could not delete integration ${this.argv.integrationRef}`);
|
|
105
|
-
}
|
|
106
|
-
this.logger.success(`Integration ${import_chalk.default.bold(this.argv.integrationRef)} deleted`);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
117
|
+
return integration;
|
|
118
|
+
};
|
|
109
119
|
}
|
|
110
120
|
// Annotate the CommonJS export names for ESM import in node:
|
|
111
121
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/command-implementations/integration-commands.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import chalk from 'chalk'\nimport _ from 'lodash'\nimport { ApiClient, Integration } from 'src/api/client'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { NameIntegrationRef, parseIntegrationRef } from '../integration-ref'\nimport { GlobalCommand } from './global-command'\n\nexport type GetIntegrationCommandDefinition = typeof commandDefinitions.integrations.subcommands.get\nexport class GetIntegrationCommand extends GlobalCommand<GetIntegrationCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parseIntegrationRef(this.argv.integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidIntegrationReferenceError(this.argv.integrationRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot get local integration')\n }\n\n try {\n const integration = await api.findIntegration(parsedRef)\n if (integration) {\n this.logger.success(`Integration ${chalk.bold(this.argv.integrationRef)}:`)\n this.logger.json(integration)\n return\n }\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${this.argv.integrationRef}`)\n }\n\n throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} not found`)\n }\n}\n\nexport type ListIntegrationsCommandDefinition = typeof commandDefinitions.integrations.subcommands.list\nexport class ListIntegrationsCommand extends GlobalCommand<ListIntegrationsCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n\n const { dev, name, versionNumber: version } = this.argv\n\n const privateLister = (req: { nextToken?: string }) =>\n api.client.listIntegrations({ nextToken: req.nextToken, dev, name, version })\n\n const dummyLister: typeof privateLister = async () => ({ integrations: [], meta: {} })\n const publicLister = dev\n ? dummyLister\n : (req: { nextToken?: string }) => api.client.listPublicIntegrations({ nextToken: req.nextToken, name, version })\n\n try {\n const privateIntegrations = await api.listAllPages(privateLister, (r) => r.integrations)\n const publicIntegrations = await api.listAllPages(publicLister, (r) => r.integrations)\n const integrations = _.uniqBy([...privateIntegrations, ...publicIntegrations], (i) => i.id)\n\n this.logger.success('Integrations:')\n this.logger.json(integrations)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, 'Could not list integrations')\n }\n }\n}\n\nexport type DeleteIntegrationCommandDefinition = typeof commandDefinitions.integrations.subcommands.delete\nexport class DeleteIntegrationCommand extends GlobalCommand<DeleteIntegrationCommandDefinition> {\n public async run(): Promise<void> {\n const api = await this.ensureLoginAndCreateClient(this.argv)\n const parsedRef = parseIntegrationRef(this.argv.integrationRef)\n if (!parsedRef) {\n throw new errors.InvalidIntegrationReferenceError(this.argv.integrationRef)\n }\n if (parsedRef.type === 'path') {\n throw new errors.BotpressCLIError('Cannot delete local integration')\n }\n\n let integrationId: string | undefined\n if (parsedRef.type === 'id') {\n integrationId = parsedRef.id\n } else {\n const integration = await this._findIntegration(api, parsedRef)\n integrationId = integration.id\n }\n\n try {\n await api.client.deleteIntegration({ id: integrationId })\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not delete integration ${this.argv.integrationRef}`)\n }\n\n this.logger.success(`Integration ${chalk.bold(this.argv.integrationRef)} deleted`)\n return\n }\n\n private _findIntegration = async (api: ApiClient, parsedRef: NameIntegrationRef) => {\n let integration: Integration | undefined\n\n try {\n integration = await api.findPrivateIntegration(parsedRef)\n } catch (thrown) {\n throw errors.BotpressCLIError.wrap(thrown, `Could not get integration ${this.argv.integrationRef}`)\n }\n\n if (!integration) {\n const publicIntegration = await api.findPublicIntegration(parsedRef)\n if (publicIntegration) {\n throw new errors.BotpressCLIError(`Integration ${this.argv.integrationRef} does not belong to your workspace`)\n }\n\n throw new errors.BotpressCLI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AAD,QAAM,KAAK,KAAK,KAAK,cAAc,WAAW;AACjF;AAAA,EACF;AAAA,EAEQ,mBAAmB,OAAO,KAAgB,cAAkC;AAClF,QAAI;AAEJ,QAAI;AACF,oBAAc,MAAM,IAAI,uBAAuB,SAAS;AAAA,IAC1D,SAAS,QAAP;AACA,YAAM,OAAO,iBAAiB,KAAK,QAAQ,6BAA6B,KAAK,KAAK,gBAAgB;AAAA,IACpG;AAEA,QAAI,CAAC,aAAa;AAChB,YAAM,oBAAoB,MAAM,IAAI,sBAAsB,SAAS;AACnE,UAAI,mBAAmB;AACrB,cAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,kDAAkD;AAAA,MAC/G;AAEA,YAAM,IAAI,OAAO,iBAAiB,eAAe,KAAK,KAAK,0BAA0B;AAAA,IACvF;AAEA,WAAO;AAAA,EACT;AACF;",
|
|
6
6
|
"names": ["chalk", "_"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import * as bp from '.botpress'
|
|
|
4
4
|
export default new bp.Integration({
|
|
5
5
|
register: async () => {
|
|
6
6
|
/**
|
|
7
|
-
* This is called when
|
|
7
|
+
* This is called when an integration configuration is saved.
|
|
8
8
|
* You should use this handler to instanciate ressources in the external service and ensure that the configuration is valid.
|
|
9
9
|
*/
|
|
10
10
|
throw new sdk.RuntimeError('Invalid configuration') // replace this with your own validation logic
|
|
@@ -4,7 +4,7 @@ import * as bp from '.botpress'
|
|
|
4
4
|
export default new bp.Integration({
|
|
5
5
|
register: async () => {
|
|
6
6
|
/**
|
|
7
|
-
* This is called when
|
|
7
|
+
* This is called when an integration configuration is saved.
|
|
8
8
|
* You should use this handler to instanciate ressources in the external service and ensure that the configuration is valid.
|
|
9
9
|
*/
|
|
10
10
|
throw new sdk.RuntimeError('Invalid configuration') // replace this with your own validation logic
|
|
@@ -11,7 +11,7 @@ const reqBodySchema = sdk.z.object({
|
|
|
11
11
|
export default new bp.Integration({
|
|
12
12
|
register: async () => {
|
|
13
13
|
/**
|
|
14
|
-
* This is called when
|
|
14
|
+
* This is called when an integration configuration is saved.
|
|
15
15
|
* You should use this handler to instanciate ressources in the external service and ensure that the configuration is valid.
|
|
16
16
|
*/
|
|
17
17
|
throw new sdk.RuntimeError('Invalid configuration') // replace this with your own validation logic
|