@botpress/cli 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
1
 
2
- > @botpress/cli@0.11.3 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@0.11.4 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.11.3 bundle /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@0.11.4 bundle /home/runner/work/botpress/botpress/packages/cli
7
7
  > ts-node -T build.ts
8
8
 
9
9
 
10
- > @botpress/cli@0.11.3 template:gen /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@0.11.4 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.11.3
14
- šŸ¤– Botpress CLI v0.11.3
15
- šŸ¤– Botpress CLI v0.11.3
16
- šŸ¤– Botpress CLI v0.11.3
13
+ šŸ¤– Botpress CLI v0.11.4
14
+ šŸ¤– Botpress CLI v0.11.4
15
+ šŸ¤– Botpress CLI v0.11.4
16
+ šŸ¤– Botpress CLI v0.11.4
17
17
  ⚠ No typings to generate for bot projects
18
- ā—‹ Generating typings for integration webhook-message...ā—‹ Generating typings for integration hello-world...ā—‹ Generating typings for integration empty-integration...āœ“ Typings available at .botpress
18
+ ā—‹ Generating typings for integration hello-world...ā—‹ Generating typings for integration empty-integration...ā—‹ Generating typings for integration webhook-message...āœ“ Typings available at .botpress
19
19
  āœ“ Typings available at .botpress
20
20
  āœ“ Typings available at .botpress
@@ -46,11 +46,33 @@ class LintCommand extends import_project_command.ProjectCommand {
46
46
  }
47
47
  }
48
48
  async _runLintForIntegration(definition) {
49
- const parsedIntegrationDefinition = await (0, import_integration_body.prepareCreateIntegrationBody)(definition, { dereference: true });
49
+ const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition);
50
+ const parsedIntegrationDefinition = await (0, import_integration_body.prepareCreateIntegrationBody)(strippedDefinition, { dereference: true });
50
51
  const linter = new import_integration_linter.IntegrationLinter(parsedIntegrationDefinition);
51
52
  await linter.lint();
52
53
  linter.logResults(this.logger);
53
54
  }
55
+ _stripAutoGeneratedContentFromIntegration(definition) {
56
+ const { actionNames, eventNames } = this._getAutoGeneratedContentOfIntegration(definition);
57
+ return {
58
+ ...definition,
59
+ actions: Object.fromEntries(Object.entries(definition.actions ?? {}).filter(([key]) => !actionNames.has(key))),
60
+ events: Object.fromEntries(Object.entries(definition.events ?? {}).filter(([key]) => !eventNames.has(key)))
61
+ };
62
+ }
63
+ _getAutoGeneratedContentOfIntegration(definition) {
64
+ const actionNames = /* @__PURE__ */ new Set();
65
+ const eventNames = /* @__PURE__ */ new Set();
66
+ for (const iface of Object.values(definition.interfaces)) {
67
+ for (const actionDefinition of Object.values(iface.actions)) {
68
+ actionNames.add(actionDefinition.name);
69
+ }
70
+ for (const eventDefinition of Object.values(iface.events)) {
71
+ eventNames.add(eventDefinition.name);
72
+ }
73
+ }
74
+ return { actionNames, eventNames };
75
+ }
54
76
  }
55
77
  // Annotate the CommonJS export names for ESM import in node:
56
78
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/lint-command.ts"],
4
- "sourcesContent": ["import { IntegrationDefinition } from '@botpress/sdk'\nimport { prepareCreateIntegrationBody } from '../api/integration-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { IntegrationLinter } from '../linter/integration-linter'\nimport { ProjectCommand } from './project-command'\n\nexport type LintCommandDefinition = typeof commandDefinitions.lint\nexport class LintCommand extends ProjectCommand<LintCommandDefinition> {\n public async run(): Promise<void> {\n const projectDef = await this.readProjectDefinitionFromFS()\n\n switch (projectDef.type) {\n case 'integration':\n return this._runLintForIntegration(projectDef.definition)\n case 'bot':\n throw new errors.BotpressCLIError('Bot linting is not yet implemented')\n case 'interface':\n throw new errors.BotpressCLIError('Interface linting is not yet implemented')\n default:\n throw new errors.BotpressCLIError('Unsupported project type')\n }\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const parsedIntegrationDefinition = await prepareCreateIntegrationBody(definition, { dereference: true })\n const linter = new IntegrationLinter(parsedIntegrationDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA6C;AAE7C,aAAwB;AACxB,gCAAkC;AAClC,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,YAAQ,WAAW,MAAM;AAAA,MACvB,KAAK;AACH,eAAO,KAAK,uBAAuB,WAAW,UAAU;AAAA,MAC1D,KAAK;AACH,cAAM,IAAI,OAAO,iBAAiB,oCAAoC;AAAA,MACxE,KAAK;AACH,cAAM,IAAI,OAAO,iBAAiB,0CAA0C;AAAA,MAC9E;AACE,cAAM,IAAI,OAAO,iBAAiB,0BAA0B;AAAA,IAChE;AAAA,EACF;AAAA,EAEA,MAAc,uBAAuB,YAAkD;AACrF,UAAM,8BAA8B,UAAM,sDAA6B,YAAY,EAAE,aAAa,KAAK,CAAC;AACxG,UAAM,SAAS,IAAI,4CAAkB,2BAA2B;AAEhE,UAAM,OAAO,KAAK;AAClB,WAAO,WAAW,KAAK,MAAM;AAAA,EAC/B;AACF;",
4
+ "sourcesContent": ["import { IntegrationDefinition } from '@botpress/sdk'\nimport { prepareCreateIntegrationBody } from '../api/integration-body'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { IntegrationLinter } from '../linter/integration-linter'\nimport { ProjectCommand } from './project-command'\n\nexport type LintCommandDefinition = typeof commandDefinitions.lint\nexport class LintCommand extends ProjectCommand<LintCommandDefinition> {\n public async run(): Promise<void> {\n const projectDef = await this.readProjectDefinitionFromFS()\n\n switch (projectDef.type) {\n case 'integration':\n return this._runLintForIntegration(projectDef.definition)\n case 'bot':\n throw new errors.BotpressCLIError('Bot linting is not yet implemented')\n case 'interface':\n throw new errors.BotpressCLIError('Interface linting is not yet implemented')\n default:\n throw new errors.BotpressCLIError('Unsupported project type')\n }\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition)\n const parsedIntegrationDefinition = await prepareCreateIntegrationBody(strippedDefinition, { dereference: true })\n const linter = new IntegrationLinter(parsedIntegrationDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\n }\n\n private _stripAutoGeneratedContentFromIntegration(definition: IntegrationDefinition) {\n const { actionNames, eventNames } = this._getAutoGeneratedContentOfIntegration(definition)\n\n return {\n ...definition,\n actions: Object.fromEntries(Object.entries(definition.actions ?? {}).filter(([key]) => !actionNames.has(key))),\n events: Object.fromEntries(Object.entries(definition.events ?? {}).filter(([key]) => !eventNames.has(key))),\n } as IntegrationDefinition\n }\n\n private _getAutoGeneratedContentOfIntegration(definition: IntegrationDefinition) {\n const actionNames = new Set<string>()\n const eventNames = new Set<string>()\n\n for (const iface of Object.values(definition.interfaces)) {\n for (const actionDefinition of Object.values(iface.actions)) {\n actionNames.add(actionDefinition.name)\n }\n for (const eventDefinition of Object.values(iface.events)) {\n eventNames.add(eventDefinition.name)\n }\n }\n\n return { actionNames, eventNames } as const\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,8BAA6C;AAE7C,aAAwB;AACxB,gCAAkC;AAClC,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,aAAa,MAAM,KAAK,4BAA4B;AAE1D,YAAQ,WAAW,MAAM;AAAA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,IAAI;AAAA,MACrC;AAAA,IACF;AAEA,WAAO,EAAE,aAAa,WAAW;AAAA,EACnC;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botpress/cli",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "Botpress CLI",
5
5
  "scripts": {
6
6
  "build": "pnpm run bundle && pnpm run template:gen",