@botpress/cli 0.9.7 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
1
 
2
- > @botpress/cli@0.9.7 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@0.11.1 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@0.9.7 bundle /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@0.11.1 bundle /home/runner/work/botpress/botpress/packages/cli
7
7
  > ts-node -T build.ts
8
8
 
9
9
 
10
- > @botpress/cli@0.9.7 template:gen /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@0.11.1 template:gen /home/runner/work/botpress/botpress/packages/cli
11
11
  > pnpm -r --stream -F @bp-templates/* exec bp gen
12
12
 
13
- šŸ¤– Botpress CLI v0.9.7
14
- šŸ¤– Botpress CLI v0.9.7
15
- šŸ¤– Botpress CLI v0.9.7
16
- šŸ¤– Botpress CLI v0.9.7
13
+ šŸ¤– Botpress CLI v0.11.1
14
+ šŸ¤– Botpress CLI v0.11.1
15
+ šŸ¤– Botpress CLI v0.11.1
16
+ šŸ¤– Botpress CLI v0.11.1
17
17
  ⚠ No typings to generate for bot projects
18
- ā—‹ Generating typings for integration hello-world...ā—‹ Generating typings for integration empty-integration...ā—‹ Generating typings for integration webhook-message...āœ“ Typings available at .botpress
18
+ ā—‹ Generating typings for integration hello-world...ā—‹ Generating typings for integration webhook-message...ā—‹ Generating typings for integration empty-integration...āœ“ Typings available at .botpress
19
19
  āœ“ Typings available at .botpress
20
20
  āœ“ Typings available at .botpress
@@ -64,7 +64,8 @@ var command_definitions_default = {
64
64
  serve: { description: "Serve your project locally", schema: config.schemas.serve },
65
65
  deploy: { description: "Deploy your project to the cloud", schema: config.schemas.deploy },
66
66
  add: { description: "Install an integration in your bot", schema: config.schemas.add },
67
- dev: { description: "Run your project in dev mode", schema: config.schemas.dev }
67
+ dev: { description: "Run your project in dev mode", schema: config.schemas.dev },
68
+ lint: { description: "EXPERIMENTAL: Lint an integration definition", schema: config.schemas.lint }
68
69
  };
69
70
  // Annotate the CommonJS export names for ESM import in node:
70
71
  0 && (module.exports = {});
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/command-definitions.ts"],
4
- "sourcesContent": ["import type { DefinitionTree } from './command-tree'\nimport * as config from './config'\n\nexport default {\n login: { description: 'Login to Botpress Cloud', schema: config.schemas.login },\n logout: { description: 'Logout of Botpress Cloud', schema: config.schemas.logout },\n bots: {\n description: 'Bot related commands',\n subcommands: {\n create: { description: 'Create new bot', schema: config.schemas.createBot, alias: 'new' },\n get: { description: 'Get bot', schema: config.schemas.getBot },\n delete: { description: 'Delete bot', schema: config.schemas.deleteBot, alias: 'rm' },\n list: { description: 'List bots', schema: config.schemas.listBots, alias: 'ls' },\n },\n },\n integrations: {\n description: 'Integration related commands',\n subcommands: {\n get: { description: 'Get integration', schema: config.schemas.getIntegration },\n delete: { description: 'Delete integration', schema: config.schemas.deleteIntegration, alias: 'rm' },\n list: { description: 'List integrations', schema: config.schemas.listIntegrations, alias: 'ls' },\n },\n },\n interfaces: {\n description: 'Interface related commands',\n subcommands: {\n get: { description: 'Get interface', schema: config.schemas.getInterface },\n delete: { description: 'Delete interface', schema: config.schemas.deleteInterface, alias: 'rm' },\n list: { description: 'List interfaces', schema: config.schemas.listInterfaces, alias: 'ls' },\n },\n },\n init: { description: 'Initialize a new project', schema: config.schemas.init },\n generate: { description: 'Generate typings for intellisense', schema: config.schemas.generate, alias: 'gen' },\n bundle: { description: 'Bundle a botpress project', schema: config.schemas.bundle },\n build: { description: 'Generate typings and bundle a botpress project', schema: config.schemas.build },\n read: { description: 'Read and parse an integration definition', schema: config.schemas.read },\n serve: { description: 'Serve your project locally', schema: config.schemas.serve },\n deploy: { description: 'Deploy your project to the cloud', schema: config.schemas.deploy },\n add: { description: 'Install an integration in your bot', schema: config.schemas.add },\n dev: { description: 'Run your project in dev mode', schema: config.schemas.dev },\n} satisfies DefinitionTree\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AAExB,IAAO,8BAAQ;AAAA,EACb,OAAO,EAAE,aAAa,2BAA2B,QAAQ,OAAO,QAAQ,MAAM;AAAA,EAC9E,QAAQ,EAAE,aAAa,4BAA4B,QAAQ,OAAO,QAAQ,OAAO;AAAA,EACjF,MAAM;AAAA,IACJ,aAAa;AAAA,IACb,aAAa;AAAA,MACX,QAAQ,EAAE,aAAa,kBAAkB,QAAQ,OAAO,QAAQ,WAAW,OAAO,MAAM;AAAA,MACxF,KAAK,EAAE,aAAa,WAAW,QAAQ,OAAO,QAAQ,OAAO;AAAA,MAC7D,QAAQ,EAAE,aAAa,cAAc,QAAQ,OAAO,QAAQ,WAAW,OAAO,KAAK;AAAA,MACnF,MAAM,EAAE,aAAa,aAAa,QAAQ,OAAO,QAAQ,UAAU,OAAO,KAAK;AAAA,IACjF;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;AAAA,MACX,KAAK,EAAE,aAAa,mBAAmB,QAAQ,OAAO,QAAQ,eAAe;AAAA,MAC7E,QAAQ,EAAE,aAAa,sBAAsB,QAAQ,OAAO,QAAQ,mBAAmB,OAAO,KAAK;AAAA,MACnG,MAAM,EAAE,aAAa,qBAAqB,QAAQ,OAAO,QAAQ,kBAAkB,OAAO,KAAK;AAAA,IACjG;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,aAAa;AAAA,IACb,aAAa;AAAA,MACX,KAAK,EAAE,aAAa,iBAAiB,QAAQ,OAAO,QAAQ,aAAa;AAAA,MACzE,QAAQ,EAAE,aAAa,oBAAoB,QAAQ,OAAO,QAAQ,iBAAiB,OAAO,KAAK;AAAA,MAC/F,MAAM,EAAE,aAAa,mBAAmB,QAAQ,OAAO,QAAQ,gBAAgB,OAAO,KAAK;AAAA,IAC7F;AAAA,EACF;AAAA,EACA,MAAM,EAAE,aAAa,4BAA4B,QAAQ,OAAO,QAAQ,KAAK;AAAA,EAC7E,UAAU,EAAE,aAAa,qCAAqC,QAAQ,OAAO,QAAQ,UAAU,OAAO,MAAM;AAAA,EAC5G,QAAQ,EAAE,aAAa,6BAA6B,QAAQ,OAAO,QAAQ,OAAO;AAAA,EAClF,OAAO,EAAE,aAAa,kDAAkD,QAAQ,OAAO,QAAQ,MAAM;AAAA,EACrG,MAAM,EAAE,aAAa,4CAA4C,QAAQ,OAAO,QAAQ,KAAK;AAAA,EAC7F,OAAO,EAAE,aAAa,8BAA8B,QAAQ,OAAO,QAAQ,MAAM;AAAA,EACjF,QAAQ,EAAE,aAAa,oCAAoC,QAAQ,OAAO,QAAQ,OAAO;AAAA,EACzF,KAAK,EAAE,aAAa,sCAAsC,QAAQ,OAAO,QAAQ,IAAI;AAAA,EACrF,KAAK,EAAE,aAAa,gCAAgC,QAAQ,OAAO,QAAQ,IAAI;AACjF;",
4
+ "sourcesContent": ["import type { DefinitionTree } from './command-tree'\nimport * as config from './config'\n\nexport default {\n login: { description: 'Login to Botpress Cloud', schema: config.schemas.login },\n logout: { description: 'Logout of Botpress Cloud', schema: config.schemas.logout },\n bots: {\n description: 'Bot related commands',\n subcommands: {\n create: { description: 'Create new bot', schema: config.schemas.createBot, alias: 'new' },\n get: { description: 'Get bot', schema: config.schemas.getBot },\n delete: { description: 'Delete bot', schema: config.schemas.deleteBot, alias: 'rm' },\n list: { description: 'List bots', schema: config.schemas.listBots, alias: 'ls' },\n },\n },\n integrations: {\n description: 'Integration related commands',\n subcommands: {\n get: { description: 'Get integration', schema: config.schemas.getIntegration },\n delete: { description: 'Delete integration', schema: config.schemas.deleteIntegration, alias: 'rm' },\n list: { description: 'List integrations', schema: config.schemas.listIntegrations, alias: 'ls' },\n },\n },\n interfaces: {\n description: 'Interface related commands',\n subcommands: {\n get: { description: 'Get interface', schema: config.schemas.getInterface },\n delete: { description: 'Delete interface', schema: config.schemas.deleteInterface, alias: 'rm' },\n list: { description: 'List interfaces', schema: config.schemas.listInterfaces, alias: 'ls' },\n },\n },\n init: { description: 'Initialize a new project', schema: config.schemas.init },\n generate: { description: 'Generate typings for intellisense', schema: config.schemas.generate, alias: 'gen' },\n bundle: { description: 'Bundle a botpress project', schema: config.schemas.bundle },\n build: { description: 'Generate typings and bundle a botpress project', schema: config.schemas.build },\n read: { description: 'Read and parse an integration definition', schema: config.schemas.read },\n serve: { description: 'Serve your project locally', schema: config.schemas.serve },\n deploy: { description: 'Deploy your project to the cloud', schema: config.schemas.deploy },\n add: { description: 'Install an integration in your bot', schema: config.schemas.add },\n dev: { description: 'Run your project in dev mode', schema: config.schemas.dev },\n lint: { description: 'EXPERIMENTAL: Lint an integration definition', schema: config.schemas.lint },\n} satisfies DefinitionTree\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,aAAwB;AAExB,IAAO,8BAAQ;AAAA,EACb,OAAO,EAAE,aAAa,2BAA2B,QAAQ,OAAO,QAAQ,MAAM;AAAA,EAC9E,QAAQ,EAAE,aAAa,4BAA4B,QAAQ,OAAO,QAAQ,OAAO;AAAA,EACjF,MAAM;AAAA,IACJ,aAAa;AAAA,IACb,aAAa;AAAA,MACX,QAAQ,EAAE,aAAa,kBAAkB,QAAQ,OAAO,QAAQ,WAAW,OAAO,MAAM;AAAA,MACxF,KAAK,EAAE,aAAa,WAAW,QAAQ,OAAO,QAAQ,OAAO;AAAA,MAC7D,QAAQ,EAAE,aAAa,cAAc,QAAQ,OAAO,QAAQ,WAAW,OAAO,KAAK;AAAA,MACnF,MAAM,EAAE,aAAa,aAAa,QAAQ,OAAO,QAAQ,UAAU,OAAO,KAAK;AAAA,IACjF;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,aAAa;AAAA,IACb,aAAa;A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[]
7
7
  }
@@ -40,6 +40,7 @@ var import_gen_command = require("./gen-command");
40
40
  var import_init_command = require("./init-command");
41
41
  var integrations = __toESM(require("./integration-commands"));
42
42
  var interfaces = __toESM(require("./interface-commands"));
43
+ var import_lint_command = require("./lint-command");
43
44
  var import_login_command = require("./login-command");
44
45
  var import_logout_command = require("./logout-command");
45
46
  var import_read_command = require("./read-command");
@@ -82,7 +83,8 @@ var command_implementations_default = {
82
83
  serve: getHandler(import_serve_command.ServeCommand),
83
84
  deploy: getHandler(import_deploy_command.DeployCommand),
84
85
  add: getHandler(import_add_command.AddCommand),
85
- dev: getHandler(import_dev_command.DevCommand)
86
+ dev: getHandler(import_dev_command.DevCommand),
87
+ lint: getHandler(import_lint_command.LintCommand)
86
88
  };
87
89
  // Annotate the CommonJS export names for ESM import in node:
88
90
  0 && (module.exports = {});
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/index.ts"],
4
- "sourcesContent": ["import { ApiClient } from '../api/client'\nimport type commandDefinitions from '../command-definitions'\nimport type { ImplementationTree } from '../command-tree'\nimport { Logger } from '../logger'\nimport type { CommandArgv } from '../typings'\nimport * as utils from '../utils'\nimport { AddCommand } from './add-command'\nimport type { BaseCommand } from './base-command'\nimport * as bots from './bot-commands'\nimport { BuildCommand } from './build-command'\nimport { BundleCommand } from './bundle-command'\nimport { DeployCommand } from './deploy-command'\nimport { DevCommand } from './dev-command'\nimport { GenerateCommand } from './gen-command'\nimport type { GlobalCommand, GlobalCommandDefinition } from './global-command'\nimport { InitCommand } from './init-command'\nimport * as integrations from './integration-commands'\nimport * as interfaces from './interface-commands'\nimport { LoginCommand } from './login-command'\nimport { LogoutCommand } from './logout-command'\nimport { ReadCommand } from './read-command'\nimport { ServeCommand } from './serve-command'\n\ntype GlobalCtor<C extends GlobalCommandDefinition> = new (\n ...args: ConstructorParameters<typeof GlobalCommand<C>>\n) => BaseCommand<C>\n\nconst getHandler =\n <C extends GlobalCommandDefinition>(cls: GlobalCtor<C>) =>\n async (argv: CommandArgv<C>) => {\n const logger = new Logger(argv)\n const prompt = new utils.prompt.CLIPrompt(argv, logger)\n return new cls(ApiClient, prompt, logger, argv).handler()\n }\n\nexport default {\n login: getHandler(LoginCommand),\n logout: getHandler(LogoutCommand),\n bots: {\n subcommands: {\n create: getHandler(bots.CreateBotCommand),\n get: getHandler(bots.GetBotCommand),\n delete: getHandler(bots.DeleteBotCommand),\n list: getHandler(bots.ListBotsCommand),\n },\n },\n integrations: {\n subcommands: {\n get: getHandler(integrations.GetIntegrationCommand),\n list: getHandler(integrations.ListIntegrationsCommand),\n delete: getHandler(integrations.DeleteIntegrationCommand),\n },\n },\n interfaces: {\n subcommands: {\n get: getHandler(interfaces.GetInterfaceCommand),\n list: getHandler(interfaces.ListInterfacesCommand),\n delete: getHandler(interfaces.DeleteInterfaceCommand),\n },\n },\n init: getHandler(InitCommand),\n generate: getHandler(GenerateCommand),\n bundle: getHandler(BundleCommand),\n build: getHandler(BuildCommand),\n read: getHandler(ReadCommand),\n serve: getHandler(ServeCommand),\n deploy: getHandler(DeployCommand),\n add: getHandler(AddCommand),\n dev: getHandler(DevCommand),\n} satisfies ImplementationTree<typeof commandDefinitions>\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA0B;AAG1B,oBAAuB;AAEvB,YAAuB;AACvB,yBAA2B;AAE3B,WAAsB;AACtB,2BAA6B;AAC7B,4BAA8B;AAC9B,4BAA8B;AAC9B,yBAA2B;AAC3B,yBAAgC;AAEhC,0BAA4B;AAC5B,mBAA8B;AAC9B,iBAA4B;AAC5B,2BAA6B;AAC7B,4BAA8B;AAC9B,0BAA4B;AAC5B,2BAA6B;AAM7B,MAAM,aACJ,CAAoC,QACpC,OAAO,SAAyB;AAC9B,QAAM,SAAS,IAAI,qBAAO,IAAI;AAC9B,QAAM,SAAS,IAAI,MAAM,OAAO,UAAU,MAAM,MAAM;AACtD,SAAO,IAAI,IAAI,yBAAW,QAAQ,QAAQ,IAAI,EAAE,QAAQ;AAC1D;AAEF,IAAO,kCAAQ;AAAA,EACb,OAAO,WAAW,iCAAY;AAAA,EAC9B,QAAQ,WAAW,mCAAa;AAAA,EAChC,MAAM;AAAA,IACJ,aAAa;AAAA,MACX,QAAQ,WAAW,KAAK,gBAAgB;AAAA,MACxC,KAAK,WAAW,KAAK,aAAa;AAAA,MAClC,QAAQ,WAAW,KAAK,gBAAgB;AAAA,MACxC,MAAM,WAAW,KAAK,eAAe;AAAA,IACvC;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ,aAAa;AAAA,MACX,KAAK,WAAW,aAAa,qBAAqB;AAAA,MAClD,MAAM,WAAW,aAAa,uBAAuB;AAAA,MACrD,QAAQ,WAAW,aAAa,wBAAwB;AAAA,IAC1D;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV,aAAa;AAAA,MACX,KAAK,WAAW,WAAW,mBAAmB;AAAA,MAC9C,MAAM,WAAW,WAAW,qBAAqB;AAAA,MACjD,QAAQ,WAAW,WAAW,sBAAsB;AAAA,IACtD;AAAA,EACF;AAAA,EACA,MAAM,WAAW,+BAAW;AAAA,EAC5B,UAAU,WAAW,kCAAe;AAAA,EACpC,QAAQ,WAAW,mCAAa;AAAA,EAChC,OAAO,WAAW,iCAAY;AAAA,EAC9B,MAAM,WAAW,+BAAW;AAAA,EAC5B,OAAO,WAAW,iCAAY;AAAA,EAC9B,QAAQ,WAAW,mCAAa;AAAA,EAChC,KAAK,WAAW,6BAAU;AAAA,EAC1B,KAAK,WAAW,6BAAU;AAC5B;",
4
+ "sourcesContent": ["import { ApiClient } from '../api/client'\nimport type commandDefinitions from '../command-definitions'\nimport type { ImplementationTree } from '../command-tree'\nimport { Logger } from '../logger'\nimport type { CommandArgv } from '../typings'\nimport * as utils from '../utils'\nimport { AddCommand } from './add-command'\nimport type { BaseCommand } from './base-command'\nimport * as bots from './bot-commands'\nimport { BuildCommand } from './build-command'\nimport { BundleCommand } from './bundle-command'\nimport { DeployCommand } from './deploy-command'\nimport { DevCommand } from './dev-command'\nimport { GenerateCommand } from './gen-command'\nimport type { GlobalCommand, GlobalCommandDefinition } from './global-command'\nimport { InitCommand } from './init-command'\nimport * as integrations from './integration-commands'\nimport * as interfaces from './interface-commands'\nimport { LintCommand } from './lint-command'\nimport { LoginCommand } from './login-command'\nimport { LogoutCommand } from './logout-command'\nimport { ReadCommand } from './read-command'\nimport { ServeCommand } from './serve-command'\n\ntype GlobalCtor<C extends GlobalCommandDefinition> = new (\n ...args: ConstructorParameters<typeof GlobalCommand<C>>\n) => BaseCommand<C>\n\nconst getHandler =\n <C extends GlobalCommandDefinition>(cls: GlobalCtor<C>) =>\n async (argv: CommandArgv<C>) => {\n const logger = new Logger(argv)\n const prompt = new utils.prompt.CLIPrompt(argv, logger)\n return new cls(ApiClient, prompt, logger, argv).handler()\n }\n\nexport default {\n login: getHandler(LoginCommand),\n logout: getHandler(LogoutCommand),\n bots: {\n subcommands: {\n create: getHandler(bots.CreateBotCommand),\n get: getHandler(bots.GetBotCommand),\n delete: getHandler(bots.DeleteBotCommand),\n list: getHandler(bots.ListBotsCommand),\n },\n },\n integrations: {\n subcommands: {\n get: getHandler(integrations.GetIntegrationCommand),\n list: getHandler(integrations.ListIntegrationsCommand),\n delete: getHandler(integrations.DeleteIntegrationCommand),\n },\n },\n interfaces: {\n subcommands: {\n get: getHandler(interfaces.GetInterfaceCommand),\n list: getHandler(interfaces.ListInterfacesCommand),\n delete: getHandler(interfaces.DeleteInterfaceCommand),\n },\n },\n init: getHandler(InitCommand),\n generate: getHandler(GenerateCommand),\n bundle: getHandler(BundleCommand),\n build: getHandler(BuildCommand),\n read: getHandler(ReadCommand),\n serve: getHandler(ServeCommand),\n deploy: getHandler(DeployCommand),\n add: getHandler(AddCommand),\n dev: getHandler(DevCommand),\n lint: getHandler(LintCommand),\n} satisfies ImplementationTree<typeof commandDefinitions>\n"],
5
+ "mappings":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UAAU,WAAW,kCAAe;AAAA,EACpC,QAAQ,WAAW,mCAAa;AAAA,EAChC,OAAO,WAAW,iCAAY;AAAA,EAC9B,MAAM,WAAW,+BAAW;AAAA,EAC5B,OAAO,WAAW,iCAAY;AAAA,EAC9B,QAAQ,WAAW,mCAAa;AAAA,EAChC,KAAK,WAAW,6BAAU;AAAA,EAC1B,KAAK,WAAW,6BAAU;AAAA,EAC1B,MAAM,WAAW,+BAAW;AAC9B;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var lint_command_exports = {};
26
+ __export(lint_command_exports, {
27
+ LintCommand: () => LintCommand
28
+ });
29
+ module.exports = __toCommonJS(lint_command_exports);
30
+ var import_integration_body = require("../api/integration-body");
31
+ var errors = __toESM(require("../errors"));
32
+ var import_integration_linter = require("../linter/integration-linter");
33
+ var import_project_command = require("./project-command");
34
+ class LintCommand extends import_project_command.ProjectCommand {
35
+ async run() {
36
+ const projectDef = await this.readProjectDefinitionFromFS();
37
+ switch (projectDef.type) {
38
+ case "integration":
39
+ return this._runLintForIntegration(projectDef.definition);
40
+ case "bot":
41
+ throw new errors.BotpressCLIError("Bot linting is not yet implemented");
42
+ case "interface":
43
+ throw new errors.BotpressCLIError("Interface linting is not yet implemented");
44
+ default:
45
+ throw new errors.BotpressCLIError("Unsupported project type");
46
+ }
47
+ }
48
+ async _runLintForIntegration(definition) {
49
+ const parsedIntegrationDefinition = (0, import_integration_body.prepareCreateIntegrationBody)(definition);
50
+ const linter = new import_integration_linter.IntegrationLinter(parsedIntegrationDefinition);
51
+ await linter.lint();
52
+ linter.logResults(this.logger);
53
+ }
54
+ }
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ LintCommand
58
+ });
59
+ //# sourceMappingURL=lint-command.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 = prepareCreateIntegrationBody(definition)\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,kCAA8B,sDAA6B,UAAU;AAC3E,UAAM,SAAS,IAAI,4CAAkB,2BAA2B;AAEhE,UAAM,OAAO,KAAK;AAClB,WAAO,WAAW,KAAK,MAAM;AAAA,EAC/B;AACF;",
6
+ "names": []
7
+ }
package/dist/config.js CHANGED
@@ -254,6 +254,9 @@ const initSchema = {
254
254
  type: { type: "string", choices: ["bot", "integration"] },
255
255
  name: { type: "string", description: "The name of the project" }
256
256
  };
257
+ const lintSchema = {
258
+ ...projectSchema
259
+ };
257
260
  const schemas = {
258
261
  global: globalSchema,
259
262
  project: projectSchema,
@@ -279,7 +282,8 @@ const schemas = {
279
282
  serve: serveSchema,
280
283
  deploy: deploySchema,
281
284
  add: addSchema,
282
- dev: devSchema
285
+ dev: devSchema,
286
+ lint: lintSchema
283
287
  };
284
288
  // Annotate the CommonJS export names for ESM import in node:
285
289
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/config.ts"],
4
- "sourcesContent": ["import * as consts from './consts'\nimport type { CommandOption, CommandSchema } from './typings'\n\n// command options\n\nconst port = {\n type: 'number',\n description: 'The port to use',\n} satisfies CommandOption\n\nconst workDir = {\n type: 'string',\n description: 'The path to the project',\n default: process.cwd(),\n} satisfies CommandOption\n\nconst noBuild = {\n type: 'boolean',\n description: 'Skip the build step',\n default: false,\n} satisfies CommandOption\n\nconst apiUrl = {\n type: 'string',\n description: 'The URL of the Botpress server',\n} satisfies CommandOption\n\nconst token = {\n type: 'string',\n description: 'You Personal Access Token ',\n} satisfies CommandOption\n\nconst workspaceId = {\n type: 'string',\n description: 'The Workspace Id to deploy to',\n} satisfies CommandOption\n\nconst secrets = {\n type: 'string',\n description: 'Values for the integration secrets',\n array: true,\n default: [],\n} satisfies CommandOption\n\nconst botRef = {\n type: 'string',\n description: 'The bot ID. Bot Name is not supported.',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n type: 'string',\n description: 'The integration ID or name with optional version. Ex: teams or teams@0.2.0',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst interfaceRef = {\n ...integrationRef,\n description: 'The interface ID or name with optional version. Ex: teams or teams@0.2.0',\n} satisfies CommandOption\n\nconst sourceMap = { type: 'boolean', description: 'Generate sourcemaps', default: false } satisfies CommandOption\n\nconst minify = { type: 'boolean', description: 'Minify the bundled code', default: true } satisfies CommandOption\n\nconst dev = {\n type: 'boolean',\n description: 'List only dev bots / dev integrations',\n default: false,\n} satisfies CommandOption\n\nconst isPublic = {\n type: 'boolean',\n description: 'Weither or not to deploy the integration publicly',\n default: false,\n} satisfies CommandOption\n\n// base schemas\n\nconst globalSchema = {\n verbose: {\n type: 'boolean',\n description: 'Enable verbose logging',\n alias: 'v',\n default: false,\n },\n confirm: {\n type: 'boolean',\n description: 'Confirm all prompts',\n alias: 'y',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Prevent logging anything else than raw json in stdout. Useful for piping output to other tools',\n default: false,\n },\n botpressHome: {\n type: 'string',\n description: 'The path to the Botpress home directory',\n default: consts.defaultBotpressHome,\n },\n} satisfies CommandSchema\n\nconst projectSchema = {\n ...globalSchema,\n entryPoint: { type: 'string', description: 'The entry point of the project', default: consts.defaultEntrypoint },\n outDir: { type: 'string', description: 'The output directory', default: consts.defaultOutputFolder },\n workDir,\n} satisfies CommandSchema\n\nconst credentialsSchema = {\n apiUrl,\n workspaceId,\n token,\n} satisfies CommandSchema\n\nconst secretsSchema = {\n secrets,\n} satisfies CommandSchema\n\n// command schemas\n\nconst generateSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst bundleSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst buildSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst readSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst serveSchema = {\n ...projectSchema,\n ...secretsSchema,\n port,\n} satisfies CommandSchema\n\nconst deploySchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n botId: { type: 'string', description: 'The bot ID to deploy. Only used when deploying a bot' },\n noBuild,\n createNewBot: { type: 'boolean', description: 'Create a new bot when deploying. Only used when deploying a bot' },\n sourceMap,\n minify,\n public: isPublic,\n allowDeprecated: {\n type: 'boolean',\n description: 'Allow deprecated features in the project',\n default: false,\n },\n} satisfies CommandSchema\n\nconst devSchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n sourceMap,\n minify,\n port,\n tunnelUrl: {\n type: 'string',\n description: 'The tunnel HTTP URL to use',\n default: consts.defaultTunnelUrl,\n },\n} satisfies CommandSchema\n\nconst addSchema = {\n ...projectSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst loginSchema = {\n ...globalSchema,\n token,\n workspaceId,\n apiUrl: { ...apiUrl, default: consts.defaultBotpressApiUrl },\n} satisfies CommandSchema\n\nconst logoutSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst createBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name of the bot to create' },\n ifNotExists: {\n type: 'boolean',\n description: 'Do not create if a bot with the same name already exists',\n default: false,\n },\n} satisfies CommandSchema\n\nconst getBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst deleteBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst listBotsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n dev,\n} satisfies CommandSchema\n\nconst getIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst listIntegrationsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing integrations' },\n versionNumber: { type: 'string', description: 'The version filter when listing integrations' },\n dev,\n} satisfies CommandSchema\n\nconst deleteIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst getInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst listInterfacesSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deleteInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration'] as const },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\n\n login: loginSchema,\n logout: logoutSchema,\n createBot: createBotSchema,\n getBot: getBotSchema,\n deleteBot: deleteBotSchema,\n listBots: listBotsSchema,\n getIntegration: getIntegrationSchema,\n listIntegrations: listIntegrationsSchema,\n deleteIntegration: deleteIntegrationSchema,\n getInterface: getInterfaceSchema,\n listInterfaces: listInterfacesSchema,\n deleteInterface: deleteInterfaceSchema,\n init: initSchema,\n generate: generateSchema,\n bundle: bundleSchema,\n build: buildSchema,\n read: readSchema,\n serve: serveSchema,\n deploy: deploySchema,\n add: addSchema,\n dev: devSchema,\n} as const\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAKxB,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS,QAAQ,IAAI;AACvB;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AACX;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,QAAQ;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,cAAc;AAAA,EAClB,MAAM;AAAA,EACN,aAAa;AACf;AAEA,MAAM,UAAU;AAAA,EACd,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS,CAAC;AACZ;AAEA,MAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,KAAK;AACP;AAEA,MAAM,iBAAiB;AAAA,EACrB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,KAAK;AACP;AAEA,MAAM,eAAe;AAAA,EACnB,GAAG;AAAA,EACH,aAAa;AACf;AAEA,MAAM,YAAY,EAAE,MAAM,WAAW,aAAa,uBAAuB,SAAS,MAAM;AAExF,MAAM,SAAS,EAAE,MAAM,WAAW,aAAa,2BAA2B,SAAS,KAAK;AAExF,MAAM,MAAM;AAAA,EACV,MAAM;AAAA,EACN,aAAa;AAAA,EACb,SAAS;AACX;AAE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EACH;AACF;AAEA,MAAM,qBAAqB;AAAA,EACzB,GAAG;AAAA,EACH,GAAG;AAAA,EACH;AACF;AAEA,MAAM,uBAAuB;AAAA,EAC3B,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,wBAAwB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AAAA,EACH;AACF;AAEA,MAAM,aAAa;AAAA,EACjB,GAAG;AAAA,EACH;AAAA,EACA,MAAM,EAAE,MAAM,UAAU,SAAS,CAAC,OAAO,aAAa,EAAW;AAAA,EACjE,MAAM,EAAE,MAAM,UAAU,aAAa,0BAA0B;AACjE;AAIO,MAAM,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EAET,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,KAAK;AACP;",
4
+ "sourcesContent": ["import * as consts from './consts'\nimport type { CommandOption, CommandSchema } from './typings'\n\n// command options\n\nconst port = {\n type: 'number',\n description: 'The port to use',\n} satisfies CommandOption\n\nconst workDir = {\n type: 'string',\n description: 'The path to the project',\n default: process.cwd(),\n} satisfies CommandOption\n\nconst noBuild = {\n type: 'boolean',\n description: 'Skip the build step',\n default: false,\n} satisfies CommandOption\n\nconst apiUrl = {\n type: 'string',\n description: 'The URL of the Botpress server',\n} satisfies CommandOption\n\nconst token = {\n type: 'string',\n description: 'You Personal Access Token ',\n} satisfies CommandOption\n\nconst workspaceId = {\n type: 'string',\n description: 'The Workspace Id to deploy to',\n} satisfies CommandOption\n\nconst secrets = {\n type: 'string',\n description: 'Values for the integration secrets',\n array: true,\n default: [],\n} satisfies CommandOption\n\nconst botRef = {\n type: 'string',\n description: 'The bot ID. Bot Name is not supported.',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst integrationRef = {\n type: 'string',\n description: 'The integration ID or name with optional version. Ex: teams or teams@0.2.0',\n demandOption: true,\n positional: true,\n idx: 0,\n} satisfies CommandOption\n\nconst interfaceRef = {\n ...integrationRef,\n description: 'The interface ID or name with optional version. Ex: teams or teams@0.2.0',\n} satisfies CommandOption\n\nconst sourceMap = { type: 'boolean', description: 'Generate sourcemaps', default: false } satisfies CommandOption\n\nconst minify = { type: 'boolean', description: 'Minify the bundled code', default: true } satisfies CommandOption\n\nconst dev = {\n type: 'boolean',\n description: 'List only dev bots / dev integrations',\n default: false,\n} satisfies CommandOption\n\nconst isPublic = {\n type: 'boolean',\n description: 'Weither or not to deploy the integration publicly',\n default: false,\n} satisfies CommandOption\n\n// base schemas\n\nconst globalSchema = {\n verbose: {\n type: 'boolean',\n description: 'Enable verbose logging',\n alias: 'v',\n default: false,\n },\n confirm: {\n type: 'boolean',\n description: 'Confirm all prompts',\n alias: 'y',\n default: false,\n },\n json: {\n type: 'boolean',\n description: 'Prevent logging anything else than raw json in stdout. Useful for piping output to other tools',\n default: false,\n },\n botpressHome: {\n type: 'string',\n description: 'The path to the Botpress home directory',\n default: consts.defaultBotpressHome,\n },\n} satisfies CommandSchema\n\nconst projectSchema = {\n ...globalSchema,\n entryPoint: { type: 'string', description: 'The entry point of the project', default: consts.defaultEntrypoint },\n outDir: { type: 'string', description: 'The output directory', default: consts.defaultOutputFolder },\n workDir,\n} satisfies CommandSchema\n\nconst credentialsSchema = {\n apiUrl,\n workspaceId,\n token,\n} satisfies CommandSchema\n\nconst secretsSchema = {\n secrets,\n} satisfies CommandSchema\n\n// command schemas\n\nconst generateSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst bundleSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst buildSchema = {\n ...projectSchema,\n sourceMap,\n minify,\n} satisfies CommandSchema\n\nconst readSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\nconst serveSchema = {\n ...projectSchema,\n ...secretsSchema,\n port,\n} satisfies CommandSchema\n\nconst deploySchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n botId: { type: 'string', description: 'The bot ID to deploy. Only used when deploying a bot' },\n noBuild,\n createNewBot: { type: 'boolean', description: 'Create a new bot when deploying. Only used when deploying a bot' },\n sourceMap,\n minify,\n public: isPublic,\n allowDeprecated: {\n type: 'boolean',\n description: 'Allow deprecated features in the project',\n default: false,\n },\n} satisfies CommandSchema\n\nconst devSchema = {\n ...projectSchema,\n ...credentialsSchema,\n ...secretsSchema,\n sourceMap,\n minify,\n port,\n tunnelUrl: {\n type: 'string',\n description: 'The tunnel HTTP URL to use',\n default: consts.defaultTunnelUrl,\n },\n} satisfies CommandSchema\n\nconst addSchema = {\n ...projectSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst loginSchema = {\n ...globalSchema,\n token,\n workspaceId,\n apiUrl: { ...apiUrl, default: consts.defaultBotpressApiUrl },\n} satisfies CommandSchema\n\nconst logoutSchema = {\n ...globalSchema,\n} satisfies CommandSchema\n\nconst createBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name of the bot to create' },\n ifNotExists: {\n type: 'boolean',\n description: 'Do not create if a bot with the same name already exists',\n default: false,\n },\n} satisfies CommandSchema\n\nconst getBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst deleteBotSchema = {\n ...globalSchema,\n ...credentialsSchema,\n botRef,\n} satisfies CommandSchema\n\nconst listBotsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n dev,\n} satisfies CommandSchema\n\nconst getIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst listIntegrationsSchema = {\n ...globalSchema,\n ...credentialsSchema,\n name: { type: 'string', description: 'The name filter when listing integrations' },\n versionNumber: { type: 'string', description: 'The version filter when listing integrations' },\n dev,\n} satisfies CommandSchema\n\nconst deleteIntegrationSchema = {\n ...globalSchema,\n ...credentialsSchema,\n integrationRef,\n} satisfies CommandSchema\n\nconst getInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst listInterfacesSchema = {\n ...globalSchema,\n ...credentialsSchema,\n} satisfies CommandSchema\n\nconst deleteInterfaceSchema = {\n ...globalSchema,\n ...credentialsSchema,\n interfaceRef,\n} satisfies CommandSchema\n\nconst initSchema = {\n ...globalSchema,\n workDir,\n type: { type: 'string', choices: ['bot', 'integration'] as const },\n name: { type: 'string', description: 'The name of the project' },\n} satisfies CommandSchema\n\nconst lintSchema = {\n ...projectSchema,\n} satisfies CommandSchema\n\n// exports\n\nexport const schemas = {\n global: globalSchema,\n project: projectSchema,\n credentials: credentialsSchema,\n secrets: secretsSchema,\n\n login: loginSchema,\n logout: logoutSchema,\n createBot: createBotSchema,\n getBot: getBotSchema,\n deleteBot: deleteBotSchema,\n listBots: listBotsSchema,\n getIntegration: getIntegrationSchema,\n listIntegrations: listIntegrationsSchema,\n deleteIntegration: deleteIntegrationSchema,\n getInterface: getInterfaceSchema,\n listInterfaces: listInterfacesSchema,\n deleteInterface: deleteInterfaceSchema,\n init: initSchema,\n generate: generateSchema,\n bundle: bundleSchema,\n build: buildSchema,\n read: readSchema,\n serve: serveSchema,\n deploy: deploySchema,\n add: addSchema,\n dev: devSchema,\n lint: lintSchema,\n} as const\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAwB;AAKxB,MAAM,OAAO;AAAA,EACX,MAAM;AAAA,E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C,OAAO,aAAa,EAAW;AAAA,EACjE,MAAM,EAAE,MAAM,UAAU,aAAa,0BAA0B;AACjE;AAEA,MAAM,aAAa;AAAA,EACjB,GAAG;AACL;AAIO,MAAM,UAAU;AAAA,EACrB,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,EACb,SAAS;AAAA,EAET,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
- var import_node_test = require("node:test");
3
2
  var import_vitest = require("vitest");
4
3
  var import_integration_ref = require("./integration-ref");
5
4
  const path = "/my/path";
6
5
  const prefixedUlid = "intver_01HF58RDKE3M7K5RJ5XZ7GF6HE";
7
6
  const uuid = "a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11";
8
7
  const name = "myintegration";
9
- (0, import_node_test.describe)("parseIntegrationRef", () => {
8
+ (0, import_vitest.describe)("parseIntegrationRef", () => {
10
9
  (0, import_vitest.test)("parse empty string should return undefined", () => {
11
10
  const ref = "";
12
11
  const result = (0, import_integration_ref.parseIntegrationRef)(ref);
@@ -62,7 +61,7 @@ const name = "myintegration";
62
61
  (0, import_vitest.expect)(result).toEqual(expected);
63
62
  });
64
63
  });
65
- (0, import_node_test.describe)("formatIntegrationRef", () => {
64
+ (0, import_vitest.describe)("formatIntegrationRef", () => {
66
65
  (0, import_vitest.test)("format with a path should return path", () => {
67
66
  const ref = { type: "path", path };
68
67
  const result = (0, import_integration_ref.formatIntegrationRef)(ref);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/integration-ref.test.ts"],
4
- "sourcesContent": ["import { describe } from 'node:test'\nimport { test, expect } from 'vitest'\nimport { formatIntegrationRef, IntegrationRef, parseIntegrationRef } from './integration-ref'\n\nconst path = '/my/path'\nconst prefixedUlid = 'intver_01HF58RDKE3M7K5RJ5XZ7GF6HE'\nconst uuid = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'\nconst name = 'myintegration'\n\ndescribe('parseIntegrationRef', () => {\n test('parse empty string should return undefined', () => {\n // arrange\n const ref = ''\n // act\n const result = parseIntegrationRef(ref)\n // assert\n expect(result).toBeUndefined()\n })\n\n test('parse with invalid version should return undefined', () => {\n // arrange\n const ref0 = `${name}@lol`\n const ref1 = `${name}@1`\n const ref2 = `${name}@1.0`\n // act\n const result0 = parseIntegrationRef(ref0)\n const result1 = parseIntegrationRef(ref1)\n const result2 = parseIntegrationRef(ref2)\n // assert\n expect(result0).toBeUndefined()\n expect(result1).toBeUndefined()\n expect(result2).toBeUndefined()\n })\n\n test('parse with an absolute path should return path', () => {\n // arrange\n const ref = path\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'path', path: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a prefixed ULID sets `id` type', () => {\n // arrange\n const ref = prefixedUlid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a legacy UUID sets `id` type', () => {\n // arrange\n const ref = uuid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and latest should return name and latest', () => {\n // arrange\n const version = 'latest'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with only a name should return name and latest', () => {\n // arrange\n const ref = name\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version: 'latest' }\n expect(result).toEqual(expected)\n })\n})\n\ndescribe('formatIntegrationRef', () => {\n test('format with a path should return path', () => {\n // arrange\n const ref: IntegrationRef = { type: 'path', path }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.path)\n })\n\n test('format with a prefixed ULID uses `id` type', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: prefixedUlid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a legacy UUID uses `id` type', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: uuid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref: IntegrationRef = { type: 'name', name, version }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(`${name}@${version}`)\n })\n})\n"],
5
- "mappings": ";AAAA,uBAAyB;AACzB,oBAA6B;AAC7B,6BAA0E;AAE1E,MAAM,OAAO;AACb,MAAM,eAAe;AACrB,MAAM,OAAO;AACb,MAAM,OAAO;AAAA,IAEb,2BAAS,uBAAuB,MAAM;AACpC,0BAAK,8CAA8C,MAAM;AAEvD,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,8BAAO,MAAM,EAAE,cAAc;AAAA,EAC/B,CAAC;AAED,0BAAK,sDAAsD,MAAM;AAE/D,UAAM,OAAO,GAAG;A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EAAE,QAAQ,QAAQ;AAAA,EACjC,CAAC;AAED,0BAAK,wDAAwD,MAAM;AAEjE,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,UAAM,WAA2B,EAAE,MAAM,QAAQ,MAAM,SAAS,SAAS;AACzE,8BAAO,MAAM,EAAE,QAAQ,QAAQ;AAAA,EACjC,CAAC;AACH,CAAC;AAAA,IAED,2BAAS,wBAAwB,MAAM;AACrC,0BAAK,yCAAyC,MAAM;AAElD,UAAM,MAAsB,EAAE,MAAM,QAAQ,KAAK;AAEjD,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,IAAI,IAAI;AAAA,EACjC,CAAC;AAED,0BAAK,8CAA8C,MAAM;AAEvD,UAAM,MAAsB,EAAE,MAAM,MAAM,IAAI,aAAa;AAE3D,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,IAAI,EAAE;AAAA,EAC/B,CAAC;AAED,0BAAK,4CAA4C,MAAM;AAErD,UAAM,MAAsB,EAAE,MAAM,MAAM,IAAI,KAAK;AAEnD,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,IAAI,EAAE;AAAA,EAC/B,CAAC;AAED,0BAAK,iEAAiE,MAAM;AAE1E,UAAM,UAAU;AAChB,UAAM,MAAsB,EAAE,MAAM,QAAQ,MAAM,QAAQ;AAE1D,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,GAAG,QAAQ,SAAS;AAAA,EAC7C,CAAC;AACH,CAAC;",
4
+ "sourcesContent": ["import { test, expect, describe } from 'vitest'\nimport { formatIntegrationRef, IntegrationRef, parseIntegrationRef } from './integration-ref'\n\nconst path = '/my/path'\nconst prefixedUlid = 'intver_01HF58RDKE3M7K5RJ5XZ7GF6HE'\nconst uuid = 'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'\nconst name = 'myintegration'\n\ndescribe('parseIntegrationRef', () => {\n test('parse empty string should return undefined', () => {\n // arrange\n const ref = ''\n // act\n const result = parseIntegrationRef(ref)\n // assert\n expect(result).toBeUndefined()\n })\n\n test('parse with invalid version should return undefined', () => {\n // arrange\n const ref0 = `${name}@lol`\n const ref1 = `${name}@1`\n const ref2 = `${name}@1.0`\n // act\n const result0 = parseIntegrationRef(ref0)\n const result1 = parseIntegrationRef(ref1)\n const result2 = parseIntegrationRef(ref2)\n // assert\n expect(result0).toBeUndefined()\n expect(result1).toBeUndefined()\n expect(result2).toBeUndefined()\n })\n\n test('parse with an absolute path should return path', () => {\n // arrange\n const ref = path\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'path', path: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a prefixed ULID sets `id` type', () => {\n // arrange\n const ref = prefixedUlid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a legacy UUID sets `id` type', () => {\n // arrange\n const ref = uuid\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'id', id: ref }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with a name and latest should return name and latest', () => {\n // arrange\n const version = 'latest'\n const ref = `${name}@${version}`\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version }\n expect(result).toEqual(expected)\n })\n\n test('parse with only a name should return name and latest', () => {\n // arrange\n const ref = name\n // act\n const result = parseIntegrationRef(ref)\n // assert\n const expected: IntegrationRef = { type: 'name', name, version: 'latest' }\n expect(result).toEqual(expected)\n })\n})\n\ndescribe('formatIntegrationRef', () => {\n test('format with a path should return path', () => {\n // arrange\n const ref: IntegrationRef = { type: 'path', path }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.path)\n })\n\n test('format with a prefixed ULID uses `id` type', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: prefixedUlid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a legacy UUID uses `id` type', () => {\n // arrange\n const ref: IntegrationRef = { type: 'id', id: uuid }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(ref.id)\n })\n\n test('format with a name and version should return name and version', () => {\n // arrange\n const version = '1.0.0'\n const ref: IntegrationRef = { type: 'name', name, version }\n // act\n const result = formatIntegrationRef(ref)\n // assert\n expect(result).toEqual(`${name}@${version}`)\n })\n})\n"],
5
+ "mappings": ";AAAA,oBAAuC;AACvC,6BAA0E;AAE1E,MAAM,OAAO;AACb,MAAM,eAAe;AACrB,MAAM,OAAO;AACb,MAAM,OAAO;AAAA,IAEb,wBAAS,uBAAuB,MAAM;AACpC,0BAAK,8CAA8C,MAAM;AAEvD,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,8BAAO,MAAM,EAAE,cAAc;AAAA,EAC/B,CAAC;AAED,0BAAK,sDAAsD,MAAM;AAE/D,UAAM,OAAO,GAAG;AAChB,UAAM,OAAO,GAAG;AAChB,UAAM,OAAO,GAAG;AAEhB,UAAM,cAAU,4CAAoB,IAAI;AACxC,UAAM,cAAU,4CAAoB,IAAI;AACxC,UAAM,cAAU,4CAAoB,IAAI;AAExC,8BAAO,OAAO,EAAE,cAAc;AAC9B,8BAAO,OAAO,EAAE,cAAc;AAC9B,8BAAO,OAAO,EAAE,cAAc;AAAA,EAChC,CAAC;AAED,0BAAK,kDAAkD,MAAM;AAE3D,UAAM,MAAM;AAEZ,UAAM,aAAS,4CAAoB,GAAG;AAEtC,UAAM,WAA2B,EAAE,MAAM,QAAQ,MAAM,I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vC,8BAAO,MAAM,EAAE,QAAQ,IAAI,IAAI;AAAA,EACjC,CAAC;AAED,0BAAK,8CAA8C,MAAM;AAEvD,UAAM,MAAsB,EAAE,MAAM,MAAM,IAAI,aAAa;AAE3D,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,IAAI,EAAE;AAAA,EAC/B,CAAC;AAED,0BAAK,4CAA4C,MAAM;AAErD,UAAM,MAAsB,EAAE,MAAM,MAAM,IAAI,KAAK;AAEnD,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,IAAI,EAAE;AAAA,EAC/B,CAAC;AAED,0BAAK,iEAAiE,MAAM;AAE1E,UAAM,UAAU;AAChB,UAAM,MAAsB,EAAE,MAAM,QAAQ,MAAM,QAAQ;AAE1D,UAAM,aAAS,6CAAqB,GAAG;AAEvC,8BAAO,MAAM,EAAE,QAAQ,GAAG,QAAQ,SAAS;AAAA,EAC7C,CAAC;AACH,CAAC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var integration_linter_exports = {};
20
+ __export(integration_linter_exports, {
21
+ IntegrationLinter: () => IntegrationLinter
22
+ });
23
+ module.exports = __toCommonJS(integration_linter_exports);
24
+ var import_spectral_core = require("@stoplight/spectral-core");
25
+ var import_spectral_parsers = require("@stoplight/spectral-parsers");
26
+ var import_integration = require("./rulesets/integration.ruleset");
27
+ class IntegrationLinter {
28
+ _spectral;
29
+ _spectralDocument;
30
+ _results = [];
31
+ constructor(definition) {
32
+ const json = JSON.stringify(definition).replaceAll('"$ref":', '"_$ref":');
33
+ this._spectralDocument = new import_spectral_core.Document(json, import_spectral_parsers.Json);
34
+ this._spectral = new import_spectral_core.Spectral();
35
+ this._spectral.setRuleset(import_integration.INTEGRATION_RULESET);
36
+ }
37
+ async lint() {
38
+ this._results = await this._spectral.run(this._spectralDocument);
39
+ }
40
+ logResults(logger) {
41
+ for (const result of this.getSortedResults()) {
42
+ const message = `${result.path}: ${result.message}`;
43
+ this._logResultMessage(logger, message, result.severity);
44
+ }
45
+ }
46
+ getSortedResults() {
47
+ return this._getResults().sort((a, b) => a.path > b.path ? 1 : a.path < b.path ? -1 : 0);
48
+ }
49
+ _getResults() {
50
+ return this._results.map((result) => ({
51
+ message: result.message,
52
+ path: this._simplifyPath(result.path),
53
+ severity: result.severity
54
+ }));
55
+ }
56
+ _simplifyPath(path) {
57
+ return path.join(".").replaceAll(".properties.", ".").replaceAll(".x-zui", "");
58
+ }
59
+ _logResultMessage(logger, message, severity) {
60
+ const logLevelMapping = {
61
+ 0: logger.error,
62
+ 1: logger.warn,
63
+ 2: logger.log,
64
+ 3: logger.debug
65
+ };
66
+ logLevelMapping[severity].call(logger, message);
67
+ }
68
+ }
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ IntegrationLinter
72
+ });
73
+ //# sourceMappingURL=integration-linter.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/linter/integration-linter.ts"],
4
+ "sourcesContent": ["import { Spectral, Document, ISpectralDiagnostic } from '@stoplight/spectral-core'\nimport { Json as JsonParser, JsonParserResult } from '@stoplight/spectral-parsers'\nimport { CreateIntegrationBody } from '../api/integration-body'\nimport { Logger } from '../logger'\nimport { INTEGRATION_RULESET } from './rulesets/integration.ruleset'\n\ntype ProblemSeverity = 0 | 1 | 2 | 3\n\nexport class IntegrationLinter {\n private readonly _spectral: Spectral\n private readonly _spectralDocument: Document<unknown, JsonParserResult<unknown>>\n private _results: ISpectralDiagnostic[] = []\n\n public constructor(definition: CreateIntegrationBody) {\n const json = JSON.stringify(definition).replaceAll('\"$ref\":', '\"_$ref\":')\n this._spectralDocument = new Document(json, JsonParser)\n this._spectral = new Spectral()\n\n this._spectral.setRuleset(INTEGRATION_RULESET)\n }\n\n public async lint(): Promise<void> {\n this._results = await this._spectral.run(this._spectralDocument)\n }\n\n public logResults(logger: Logger) {\n for (const result of this.getSortedResults()) {\n const message = `${result.path}: ${result.message}`\n\n this._logResultMessage(logger, message, result.severity)\n }\n }\n\n public getSortedResults() {\n return this._getResults().sort((a, b) => (a.path > b.path ? 1 : a.path < b.path ? -1 : 0))\n }\n\n private _getResults() {\n return this._results.map((result) => ({\n message: result.message,\n path: this._simplifyPath(result.path),\n severity: result.severity as ProblemSeverity,\n }))\n }\n\n private _simplifyPath(path: (string | number)[]) {\n return path.join('.').replaceAll('.properties.', '.').replaceAll('.x-zui', '')\n }\n\n private _logResultMessage(logger: Logger, message: string, severity: ProblemSeverity) {\n const logLevelMapping = {\n 0: logger.error,\n 1: logger.warn,\n 2: logger.log,\n 3: logger.debug,\n } as const\n\n logLevelMapping[severity].call(logger, message)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAwD;AACxD,8BAAqD;AAGrD,yBAAoC;AAI7B,MAAM,kBAAkB;AAAA,EACZ;AAAA,EACA;AAAA,EACT,WAAkC,CAAC;AAAA,EAEpC,YAAY,YAAmC;AACpD,UAAM,OAAO,KAAK,UAAU,UAAU,EAAE,WAAW,WAAW,UAAU;AACxE,SAAK,oBAAoB,IAAI,8BAAS,MAAM,wBAAAA,IAAU;AACtD,SAAK,YAAY,IAAI,8BAAS;AAE9B,SAAK,UAAU,WAAW,sCAAmB;AAAA,EAC/C;AAAA,EAEA,MAAa,OAAsB;AACjC,SAAK,WAAW,MAAM,KAAK,UAAU,IAAI,KAAK,iBAAiB;AAAA,EACjE;AAAA,EAEO,WAAW,QAAgB;AAChC,eAAW,UAAU,KAAK,iBAAiB,GAAG;AAC5C,YAAM,UAAU,GAAG,OAAO,SAAS,OAAO;AAE1C,WAAK,kBAAkB,QAAQ,SAAS,OAAO,QAAQ;AAAA,IACzD;AAAA,EACF;AAAA,EAEO,mBAAmB;AACxB,WAAO,KAAK,YAAY,EAAE,KAAK,CAAC,GAAG,MAAO,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,OAAO,EAAE,OAAO,KAAK,CAAE;AAAA,EAC3F;AAAA,EAEQ,cAAc;AACpB,WAAO,KAAK,SAAS,IAAI,CAAC,YAAY;AAAA,MACpC,SAAS,OAAO;AAAA,MAChB,MAAM,KAAK,cAAc,OAAO,IAAI;AAAA,MACpC,UAAU,OAAO;AAAA,IACnB,EAAE;AAAA,EACJ;AAAA,EAEQ,cAAc,MAA2B;AAC/C,WAAO,KAAK,KAAK,GAAG,EAAE,WAAW,gBAAgB,GAAG,EAAE,WAAW,UAAU,EAAE;AAAA,EAC/E;AAAA,EAEQ,kBAAkB,QAAgB,SAAiB,UAA2B;AACpF,UAAM,kBAAkB;AAAA,MACtB,GAAG,OAAO;AAAA,MACV,GAAG,OAAO;AAAA,MACV,GAAG,OAAO;AAAA,MACV,GAAG,OAAO;AAAA,IACZ;AAEA,oBAAgB,UAAU,KAAK,QAAQ,OAAO;AAAA,EAChD;AACF;",
6
+ "names": ["JsonParser"]
7
+ }
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ var import_vitest = require("vitest");
3
+ var import_integration_body = require("../api/integration-body");
4
+ var import_integration_linter = require("./integration-linter");
5
+ var import_sdk = require("@botpress/sdk");
6
+ const EMPTY_STRING = "";
7
+ const TRUTHY_STRING = "truthy";
8
+ const ACTION_NAME = "actionName";
9
+ const EVENT_NAME = "eventName";
10
+ const CONFIG_NAME = "configName";
11
+ const PARAM_NAME = "paramName";
12
+ const TAG_NAME = "tagName";
13
+ const CHANNEL_NAME = "channelName";
14
+ const STATE_NAME = "stateName";
15
+ const MESSAGE_TYPE = "text";
16
+ const VALID_INTEGRATION = {
17
+ name: TRUTHY_STRING,
18
+ title: TRUTHY_STRING,
19
+ description: TRUTHY_STRING,
20
+ version: TRUTHY_STRING,
21
+ readme: TRUTHY_STRING,
22
+ icon: TRUTHY_STRING,
23
+ actions: {
24
+ [ACTION_NAME]: {
25
+ title: TRUTHY_STRING,
26
+ description: TRUTHY_STRING,
27
+ input: {
28
+ schema: import_sdk.z.object({
29
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
30
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
31
+ },
32
+ output: {
33
+ schema: import_sdk.z.object({
34
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
35
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
36
+ }
37
+ }
38
+ },
39
+ events: {
40
+ [EVENT_NAME]: {
41
+ title: TRUTHY_STRING,
42
+ description: TRUTHY_STRING,
43
+ schema: import_sdk.z.object({
44
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
45
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
46
+ }
47
+ },
48
+ configuration: {
49
+ schema: import_sdk.z.object({
50
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
51
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
52
+ },
53
+ configurations: {
54
+ [CONFIG_NAME]: {
55
+ title: TRUTHY_STRING,
56
+ description: TRUTHY_STRING,
57
+ schema: import_sdk.z.object({
58
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
59
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
60
+ }
61
+ },
62
+ user: {
63
+ tags: {
64
+ [TAG_NAME]: {
65
+ title: TRUTHY_STRING,
66
+ description: TRUTHY_STRING
67
+ }
68
+ }
69
+ },
70
+ channels: {
71
+ [CHANNEL_NAME]: {
72
+ title: TRUTHY_STRING,
73
+ description: TRUTHY_STRING,
74
+ messages: {
75
+ [MESSAGE_TYPE]: {
76
+ schema: import_sdk.z.object({
77
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
78
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
79
+ }
80
+ },
81
+ message: {
82
+ tags: {
83
+ [TAG_NAME]: {
84
+ title: TRUTHY_STRING,
85
+ description: TRUTHY_STRING
86
+ }
87
+ }
88
+ },
89
+ conversation: {
90
+ tags: {
91
+ [TAG_NAME]: {
92
+ title: TRUTHY_STRING,
93
+ description: TRUTHY_STRING
94
+ }
95
+ }
96
+ }
97
+ }
98
+ },
99
+ states: {
100
+ [STATE_NAME]: {
101
+ type: "integration",
102
+ schema: import_sdk.z.object({
103
+ [PARAM_NAME]: import_sdk.z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING)
104
+ }).title(TRUTHY_STRING).describe(TRUTHY_STRING)
105
+ }
106
+ }
107
+ };
108
+ const mockLogger = {
109
+ log: import_vitest.vi.fn((message) => void 0),
110
+ warn: import_vitest.vi.fn((message) => void 0),
111
+ error: import_vitest.vi.fn((message) => void 0),
112
+ debug: import_vitest.vi.fn((message) => void 0)
113
+ };
114
+ const lintDefinition = async (definition) => {
115
+ const integrationDefinition = new import_sdk.IntegrationDefinition(definition);
116
+ const linter = new import_integration_linter.IntegrationLinter((0, import_integration_body.prepareCreateIntegrationBody)(integrationDefinition));
117
+ await linter.lint();
118
+ return linter;
119
+ };
120
+ const lintDefinitionAndReturnResults = async (definition) => {
121
+ const linter = await lintDefinition(definition);
122
+ return linter.getSortedResults();
123
+ };
124
+ const lintDefinitionAndLogResults = async (definition) => {
125
+ const linter = await lintDefinition(definition);
126
+ linter.logResults(mockLogger);
127
+ };
128
+ import_vitest.describe.concurrent("Integration Linter", () => {
129
+ (0, import_vitest.test)("should lint a valid definition without giving errors", async () => {
130
+ const definition = VALID_INTEGRATION;
131
+ const results = await lintDefinitionAndReturnResults(definition);
132
+ (0, import_vitest.expect)(results).toEqual([]);
133
+ });
134
+ (0, import_vitest.test)("should report an error when missing required fields", async () => {
135
+ const definition = {
136
+ ...VALID_INTEGRATION,
137
+ title: EMPTY_STRING
138
+ };
139
+ const results = await lintDefinitionAndReturnResults(definition);
140
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
141
+ });
142
+ (0, import_vitest.test)("should report an error when missing a title in an action input schema", async () => {
143
+ const definition = {
144
+ ...VALID_INTEGRATION,
145
+ actions: {
146
+ [ACTION_NAME]: {
147
+ ...VALID_INTEGRATION.actions[ACTION_NAME],
148
+ input: {
149
+ schema: import_sdk.z.object({
150
+ [PARAM_NAME]: import_sdk.z.string().describe(TRUTHY_STRING)
151
+ })
152
+ }
153
+ }
154
+ }
155
+ };
156
+ const results = await lintDefinitionAndReturnResults(definition);
157
+ (0, import_vitest.expect)(results[0]?.message).toContain("title");
158
+ });
159
+ (0, import_vitest.test)("should log as an error when severity is 0", async () => {
160
+ const definition = {
161
+ ...VALID_INTEGRATION,
162
+ title: EMPTY_STRING
163
+ };
164
+ await lintDefinitionAndLogResults(definition);
165
+ (0, import_vitest.expect)(mockLogger.error).toHaveBeenCalled();
166
+ });
167
+ (0, import_vitest.test)("should log as a warning when severity is 1", async () => {
168
+ const definition = {
169
+ ...VALID_INTEGRATION,
170
+ user: {
171
+ tags: {
172
+ [TAG_NAME]: {}
173
+ }
174
+ }
175
+ };
176
+ await lintDefinitionAndLogResults(definition);
177
+ (0, import_vitest.expect)(mockLogger.warn).toHaveBeenCalled();
178
+ });
179
+ });
180
+ //# sourceMappingURL=integration-linter.test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/linter/integration-linter.test.ts"],
4
+ "sourcesContent": ["import { test, expect, describe, vi } from 'vitest'\nimport { prepareCreateIntegrationBody } from '../api/integration-body'\nimport { IntegrationLinter } from './integration-linter'\nimport { IntegrationDefinition, IntegrationDefinitionProps, z } from '@botpress/sdk'\nimport { Logger } from 'src/logger'\n\nconst EMPTY_STRING = ''\nconst TRUTHY_STRING = 'truthy'\nconst ACTION_NAME = 'actionName'\nconst EVENT_NAME = 'eventName'\nconst CONFIG_NAME = 'configName'\nconst PARAM_NAME = 'paramName'\nconst TAG_NAME = 'tagName'\nconst CHANNEL_NAME = 'channelName'\nconst STATE_NAME = 'stateName'\nconst MESSAGE_TYPE = 'text'\n\nconst VALID_INTEGRATION = {\n name: TRUTHY_STRING,\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n version: TRUTHY_STRING,\n readme: TRUTHY_STRING,\n icon: TRUTHY_STRING,\n actions: {\n [ACTION_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n input: {\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n output: {\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n },\n },\n events: {\n [EVENT_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n },\n configuration: {\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n configurations: {\n [CONFIG_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n },\n user: {\n tags: {\n [TAG_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n },\n },\n },\n channels: {\n [CHANNEL_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n messages: {\n [MESSAGE_TYPE]: {\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n },\n message: {\n tags: {\n [TAG_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n },\n },\n },\n conversation: {\n tags: {\n [TAG_NAME]: {\n title: TRUTHY_STRING,\n description: TRUTHY_STRING,\n },\n },\n },\n },\n },\n states: {\n [STATE_NAME]: {\n type: 'integration',\n schema: z\n .object({\n [PARAM_NAME]: z.string().title(TRUTHY_STRING).describe(TRUTHY_STRING),\n })\n .title(TRUTHY_STRING)\n .describe(TRUTHY_STRING),\n },\n },\n} as const satisfies IntegrationDefinitionProps\n\nconst mockLogger = {\n log: vi.fn((message) => void message),\n warn: vi.fn((message) => void message),\n error: vi.fn((message) => void message),\n debug: vi.fn((message) => void message),\n}\n\nconst lintDefinition = async (definition: IntegrationDefinitionProps) => {\n const integrationDefinition = new IntegrationDefinition(definition)\n const linter = new IntegrationLinter(prepareCreateIntegrationBody(integrationDefinition))\n await linter.lint()\n return linter\n}\n\nconst lintDefinitionAndReturnResults = async (definition: IntegrationDefinitionProps) => {\n const linter = await lintDefinition(definition)\n return linter.getSortedResults()\n}\n\nconst lintDefinitionAndLogResults = async (definition: IntegrationDefinitionProps) => {\n const linter = await lintDefinition(definition)\n linter.logResults(mockLogger as any)\n}\n\ndescribe.concurrent('Integration Linter', () => {\n test('should lint a valid definition without giving errors', async () => {\n // arrange\n const definition = VALID_INTEGRATION\n\n // act\n const results = await lintDefinitionAndReturnResults(definition)\n\n expect(results).toEqual([])\n })\n\n test('should report an error when missing required fields', async () => {\n // arrange\n const definition = {\n ...VALID_INTEGRATION,\n title: EMPTY_STRING,\n } as const\n\n // act\n const results = await lintDefinitionAndReturnResults(definition)\n\n // assert\n expect(results[0]?.message).toContain('title')\n })\n\n test('should report an error when missing a title in an action input schema', async () => {\n // arrange\n const definition = {\n ...VALID_INTEGRATION,\n actions: {\n [ACTION_NAME]: {\n ...VALID_INTEGRATION.actions[ACTION_NAME],\n input: {\n schema: z.object({\n [PARAM_NAME]: z.string().describe(TRUTHY_STRING),\n }),\n },\n },\n },\n } as const\n\n // act\n const results = await lintDefinitionAndReturnResults(definition)\n\n // assert\n expect(results[0]?.message).toContain('title')\n })\n\n test('should log as an error when severity is 0', async () => {\n // arrange\n const definition = {\n ...VALID_INTEGRATION,\n title: EMPTY_STRING,\n } as const\n\n // act\n await lintDefinitionAndLogResults(definition)\n\n // assert\n expect(mockLogger.error).toHaveBeenCalled()\n })\n\n test('should log as a warning when severity is 1', async () => {\n // arrange\n const definition = {\n ...VALID_INTEGRATION,\n user: {\n tags: {\n [TAG_NAME]: {},\n },\n },\n } as const\n\n // act\n await lintDefinitionAndLogResults(definition)\n\n // assert\n expect(mockLogger.warn).toHaveBeenCalled()\n })\n})\n"],
5
+ "mappings": ";AAAA,oBAA2C;AAC3C,8BAA6C;AAC7C,gCAAkC;AAClC,iBAAqE;AAGrE,MAAM,eAAe;AACrB,MAAM,gBAAgB;AACtB,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,cAAc;AACpB,MAAM,aAAa;AACnB,MAAM,WAAW;AACjB,MAAM,eAAe;AACrB,MAAM,aAAa;AACnB,MAAM,eAAe;AAErB,MAAM,oBAAoB;AAAA,EACxB,MA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