@botpress/cli 5.0.0 → 5.0.2

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.
Files changed (42) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/dist/command-implementations/lint-command.js +6 -3
  3. package/dist/command-implementations/lint-command.js.map +2 -2
  4. package/dist/linter/base-linter.d.ts +1 -1
  5. package/dist/linter/base-linter.js +23 -2
  6. package/dist/linter/base-linter.js.map +2 -2
  7. package/dist/linter/bot-linter.d.ts +2 -1
  8. package/dist/linter/bot-linter.js +2 -2
  9. package/dist/linter/bot-linter.js.map +2 -2
  10. package/dist/linter/integration-linter.d.ts +2 -1
  11. package/dist/linter/integration-linter.js +2 -2
  12. package/dist/linter/integration-linter.js.map +2 -2
  13. package/dist/linter/interface-linter.d.ts +2 -1
  14. package/dist/linter/interface-linter.js +2 -2
  15. package/dist/linter/interface-linter.js.map +2 -2
  16. package/dist/linter/ruleset-tests/bot.ruleset.test.js +322 -0
  17. package/dist/linter/ruleset-tests/bot.ruleset.test.js.map +2 -2
  18. package/dist/linter/ruleset-tests/integration.ruleset.test.js +713 -0
  19. package/dist/linter/ruleset-tests/integration.ruleset.test.js.map +2 -2
  20. package/dist/linter/ruleset-tests/interface.ruleset.test.js +502 -0
  21. package/dist/linter/ruleset-tests/interface.ruleset.test.js.map +2 -2
  22. package/dist/linter/rulesets/bot.ruleset.d.ts +12 -36
  23. package/dist/linter/rulesets/bot.ruleset.js +24 -6
  24. package/dist/linter/rulesets/bot.ruleset.js.map +2 -2
  25. package/dist/linter/rulesets/integration.ruleset.d.ts +27 -81
  26. package/dist/linter/rulesets/integration.ruleset.js +48 -16
  27. package/dist/linter/rulesets/integration.ruleset.js.map +2 -2
  28. package/dist/linter/rulesets/interface.ruleset.d.ts +10 -30
  29. package/dist/linter/rulesets/interface.ruleset.js +32 -8
  30. package/dist/linter/rulesets/interface.ruleset.js.map +2 -2
  31. package/dist/linter/spectral-functions.d.ts +25 -5
  32. package/dist/linter/spectral-functions.js +107 -6
  33. package/dist/linter/spectral-functions.js.map +2 -2
  34. package/dist/utils/file-watcher.d.ts +1 -1
  35. package/dist/utils/file-watcher.js +2 -2
  36. package/dist/utils/file-watcher.js.map +3 -3
  37. package/package.json +4 -2
  38. package/templates/empty-bot/package.json +1 -1
  39. package/templates/empty-integration/package.json +1 -1
  40. package/templates/empty-plugin/package.json +1 -1
  41. package/templates/hello-world/package.json +1 -1
  42. package/templates/webhook-message/package.json +1 -1
@@ -1,36 +1,36 @@
1
1
 
2
- > @botpress/cli@5.0.0 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@5.0.2 build /home/runner/work/botpress/botpress/packages/cli
3
3
  > pnpm run build:types && pnpm run bundle && pnpm run template:gen
4
4
 
5
5
 
6
- > @botpress/cli@5.0.0 build:types /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@5.0.2 build:types /home/runner/work/botpress/botpress/packages/cli
7
7
  > tsc -p ./tsconfig.build.json
8
8
 
9
9
 
10
- > @botpress/cli@5.0.0 bundle /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@5.0.2 bundle /home/runner/work/botpress/botpress/packages/cli
11
11
  > ts-node -T build.ts
12
12
 
13
13
 
14
- > @botpress/cli@5.0.0 template:gen /home/runner/work/botpress/botpress/packages/cli
14
+ > @botpress/cli@5.0.2 template:gen /home/runner/work/botpress/botpress/packages/cli
15
15
  > pnpm -r --stream -F @bp-templates/* exec bp gen
16
16
 
17
- 🤖 Botpress CLI v5.0.0
17
+ 🤖 Botpress CLI v5.0.2
18
+ 🤖 Botpress CLI v5.0.2
18
19
  ● Checking if cli is up to date
19
- 🤖 Botpress CLI v5.0.0
20
20
  ● Checking if cli is up to date
21
- 🤖 Botpress CLI v5.0.0
21
+ 🤖 Botpress CLI v5.0.2
22
22
  ● Checking if cli is up to date
23
- 🤖 Botpress CLI v5.0.0
23
+ 🤖 Botpress CLI v5.0.2
24
24
  ● Checking if cli is up to date
25
25
  ● Checking if sdk is up to date
26
26
  ● Checking if sdk is up to date
27
27
  ● Checking if sdk is up to date
28
28
  ● Checking if sdk is up to date
29
+ ○ Generating typings for integration hello-world...
30
+ ○ Generating typings for bot...
29
31
  ○ Generating typings for plugin empty-plugin...
30
32
  ✓ Typings available at .botpress
31
33
 
32
- ○ Generating typings for integration hello-world...
33
- ○ Generating typings for bot...
34
34
  ✓ Typings available at .botpress
35
35
 
36
36
  ○ Generating typings for integration empty-integration...
@@ -38,7 +38,7 @@
38
38
 
39
39
  ✓ Typings available at .botpress
40
40
 
41
- 🤖 Botpress CLI v5.0.0
41
+ 🤖 Botpress CLI v5.0.2
42
42
  ● Checking if cli is up to date
43
43
  ● Checking if sdk is up to date
44
44
  ○ Generating typings for integration webhook-message...
@@ -73,7 +73,7 @@ class LintCommand extends import_project_command.ProjectCommand {
73
73
  definition.events[eventName] = this._dereferenceEventDefinition(eventDef);
74
74
  }
75
75
  const parsedInterfaceDefinition = await apiUtils.prepareCreateInterfaceBody(definition);
76
- const linter = new import_interface_linter.InterfaceLinter(parsedInterfaceDefinition);
76
+ const linter = new import_interface_linter.InterfaceLinter(parsedInterfaceDefinition, this.logger);
77
77
  await linter.lint();
78
78
  linter.logResults(this.logger);
79
79
  if (linter.hasErrors()) {
@@ -84,7 +84,7 @@ class LintCommand extends import_project_command.ProjectCommand {
84
84
  async _runLintForBot(definition) {
85
85
  const strippedDefinition = this._stripAutoGeneratedContentFromBot(definition);
86
86
  const parsedBotDefinition = await apiUtils.prepareCreateBotBody(strippedDefinition);
87
- const linter = new import_bot_linter.BotLinter(parsedBotDefinition);
87
+ const linter = new import_bot_linter.BotLinter(parsedBotDefinition, this.logger);
88
88
  await linter.lint();
89
89
  linter.logResults(this.logger);
90
90
  if (linter.hasErrors()) {
@@ -101,7 +101,10 @@ class LintCommand extends import_project_command.ProjectCommand {
101
101
  async _runLintForIntegration(definition) {
102
102
  const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition);
103
103
  const parsedIntegrationDefinition = await this.prepareCreateIntegrationBody(strippedDefinition);
104
- const linter = new import_integration_linter.IntegrationLinter({ ...parsedIntegrationDefinition, secrets: strippedDefinition.secrets });
104
+ const linter = new import_integration_linter.IntegrationLinter(
105
+ { ...parsedIntegrationDefinition, secrets: strippedDefinition.secrets },
106
+ this.logger
107
+ );
105
108
  await linter.lint();
106
109
  linter.logResults(this.logger);
107
110
  if (linter.hasErrors()) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/command-implementations/lint-command.ts"],
4
- "sourcesContent": ["import {\n type IntegrationDefinition,\n type BotDefinition,\n type InterfaceDefinition,\n ActionDefinition,\n z,\n EventDefinition,\n} from '@botpress/sdk'\nimport * as apiUtils from '../api'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { BotLinter } from '../linter/bot-linter'\nimport { IntegrationLinter } from '../linter/integration-linter'\nimport { InterfaceLinter } from '../linter/interface-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 { projectType, resolveProjectDefinition } = this.readProjectDefinitionFromFS()\n const projectDef = await resolveProjectDefinition()\n if (projectDef.bpLintDisabled) {\n this.logger.warn(\n 'Linting is disabled for this project because of a bplint directive. To enable linting, remove the \"bplint-disable\" directive from the project definition file'\n )\n return\n }\n\n switch (projectType) {\n case 'integration': {\n const projectDef = await resolveProjectDefinition()\n return this._runLintForIntegration(projectDef.definition)\n }\n case 'bot': {\n const projectDef = await resolveProjectDefinition()\n return this._runLintForBot(projectDef.definition)\n }\n case 'interface': {\n const projectDef = await resolveProjectDefinition()\n return this._runLintForInterface(projectDef.definition)\n }\n default:\n throw new errors.UnsupportedProjectType()\n }\n }\n\n private async _runLintForInterface(definition: InterfaceDefinition): Promise<void> {\n for (const [actionName, actionDef] of Object.entries(definition.actions)) {\n definition.actions[actionName] = this._dereferenceActionDefinition(actionDef)\n }\n\n for (const [eventName, eventDef] of Object.entries(definition.events)) {\n definition.events[eventName] = this._dereferenceEventDefinition(eventDef)\n }\n\n const parsedInterfaceDefinition = await apiUtils.prepareCreateInterfaceBody(definition)\n const linter = new InterfaceLinter(parsedInterfaceDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Interface definition contains linting errors')\n }\n\n this.logger.success('Interface definition is valid')\n }\n\n private async _runLintForBot(definition: BotDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromBot(definition)\n const parsedBotDefinition = await apiUtils.prepareCreateBotBody(strippedDefinition)\n const linter = new BotLinter(parsedBotDefinition)\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Bot definition contains linting errors')\n }\n\n this.logger.success('Bot definition is valid')\n }\n\n private _stripAutoGeneratedContentFromBot(definition: BotDefinition) {\n return {\n ...definition,\n integrations: {},\n } as BotDefinition\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition)\n const parsedIntegrationDefinition = await this.prepareCreateIntegrationBody(strippedDefinition)\n const linter = new IntegrationLinter({ ...parsedIntegrationDefinition, secrets: strippedDefinition.secrets })\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Integration definition contains linting errors')\n }\n\n this.logger.success('Integration definition is valid')\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 const interfacesStatements = definition.interfaces ?? {}\n for (const iface of Object.values(interfacesStatements)) {\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 private _dereferenceActionDefinition = (actionDef: ActionDefinition): ActionDefinition => {\n const inputRefs = actionDef.input.schema.getReferences()\n const outputRefs = actionDef.output.schema.getReferences()\n\n const inputRefSchemas = Object.fromEntries(inputRefs.map((ref) => [ref, this._replaceRef(ref)]))\n const outputRefSchemas = Object.fromEntries(outputRefs.map((ref) => [ref, this._replaceRef(ref)]))\n\n actionDef.input.schema = actionDef.input.schema.dereference(inputRefSchemas) as z.ZodObject\n actionDef.output.schema = actionDef.output.schema.dereference(outputRefSchemas) as z.ZodObject\n\n return actionDef\n }\n\n private _dereferenceEventDefinition = (eventDef: EventDefinition): EventDefinition => {\n const refs = eventDef.schema.getReferences()\n\n const refSchemas = Object.fromEntries(refs.map((ref) => [ref, this._replaceRef(ref)]))\n\n eventDef.schema = eventDef.schema.dereference(refSchemas) as z.ZodObject\n\n return eventDef\n }\n\n private _replaceRef = (refUri: string): z.ZodObject => z.object({}).title(refUri).describe(refUri)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAOO;AACP,eAA0B;AAE1B,aAAwB;AACxB,wBAA0B;AAC1B,gCAAkC;AAClC,8BAAgC;AAChC,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,EAAE,aAAa,yBAAyB,IAAI,KAAK,4BAA4B;AACnF,UAAM,aAAa,MAAM,yBAAyB;AAClD,QAAI,WAAW,gBAAgB;AAC7B,WAAK,OAAO;AAAA,QACV;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,oBAAoB,OAAO,OAAO,MAAM,OAAO,GAAG;AAC3D,oBAAY,IAAI,iBAAiB,IAAI;AAAA,MACvC;AACA,iBAAW,mBAAmB,OAAO,OAAO,MAAM,MAAM,GAAG;AACzD,mBAAW,IAAI,gBAAgB,IAAI;AAAA,MACrC;AAAA,IACF;AAEA,WAAO,EAAE,aAAa,WAAW;AAAA,EACnC;AAAA,EAEQ,+BAA+B,CAAC,cAAkD;AACxF,UAAM,YAAY,UAAU,MAAM,OAAO,cAAc;AACvD,UAAM,aAAa,UAAU,OAAO,OAAO,cAAc;AAEzD,UAAM,kBAAkB,OAAO,YAAY,UAAU,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC;AAC/F,UAAM,mBAAmB,OAAO,YAAY,WAAW,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC;AAEjG,cAAU,MAAM,SAAS,UAAU,MAAM,OAAO,YAAY,eAAe;AAC3E,cAAU,OAAO,SAAS,UAAU,OAAO,OAAO,YAAY,gBAAgB;AAE9E,WAAO;AAAA,EACT;AAAA,EAEQ,8BAA8B,CAAC,aAA+C;AACpF,UAAM,OAAO,SAAS,OAAO,cAAc;AAE3C,UAAM,aAAa,OAAO,YAAY,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC;AAErF,aAAS,SAAS,SAAS,OAAO,YAAY,UAAU;AAExD,WAAO;AAAA,EACT;AAAA,EAEQ,cAAc,CAAC,WAAgC,aAAE,OAAO,CAAC,CAAC,EAAE,MAAM,MAAM,EAAE,SAAS,MAAM;AACnG;",
4
+ "sourcesContent": ["import {\n type IntegrationDefinition,\n type BotDefinition,\n type InterfaceDefinition,\n ActionDefinition,\n z,\n EventDefinition,\n} from '@botpress/sdk'\nimport * as apiUtils from '../api'\nimport type commandDefinitions from '../command-definitions'\nimport * as errors from '../errors'\nimport { BotLinter } from '../linter/bot-linter'\nimport { IntegrationLinter } from '../linter/integration-linter'\nimport { InterfaceLinter } from '../linter/interface-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 { projectType, resolveProjectDefinition } = this.readProjectDefinitionFromFS()\n const projectDef = await resolveProjectDefinition()\n if (projectDef.bpLintDisabled) {\n this.logger.warn(\n 'Linting is disabled for this project because of a bplint directive. To enable linting, remove the \"bplint-disable\" directive from the project definition file'\n )\n return\n }\n\n switch (projectType) {\n case 'integration': {\n const projectDef = await resolveProjectDefinition()\n return this._runLintForIntegration(projectDef.definition)\n }\n case 'bot': {\n const projectDef = await resolveProjectDefinition()\n return this._runLintForBot(projectDef.definition)\n }\n case 'interface': {\n const projectDef = await resolveProjectDefinition()\n return this._runLintForInterface(projectDef.definition)\n }\n default:\n throw new errors.UnsupportedProjectType()\n }\n }\n\n private async _runLintForInterface(definition: InterfaceDefinition): Promise<void> {\n for (const [actionName, actionDef] of Object.entries(definition.actions)) {\n definition.actions[actionName] = this._dereferenceActionDefinition(actionDef)\n }\n\n for (const [eventName, eventDef] of Object.entries(definition.events)) {\n definition.events[eventName] = this._dereferenceEventDefinition(eventDef)\n }\n\n const parsedInterfaceDefinition = await apiUtils.prepareCreateInterfaceBody(definition)\n const linter = new InterfaceLinter(parsedInterfaceDefinition, this.logger)\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Interface definition contains linting errors')\n }\n\n this.logger.success('Interface definition is valid')\n }\n\n private async _runLintForBot(definition: BotDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromBot(definition)\n const parsedBotDefinition = await apiUtils.prepareCreateBotBody(strippedDefinition)\n const linter = new BotLinter(parsedBotDefinition, this.logger)\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Bot definition contains linting errors')\n }\n\n this.logger.success('Bot definition is valid')\n }\n\n private _stripAutoGeneratedContentFromBot(definition: BotDefinition) {\n return {\n ...definition,\n integrations: {},\n } as BotDefinition\n }\n\n private async _runLintForIntegration(definition: IntegrationDefinition): Promise<void> {\n const strippedDefinition = this._stripAutoGeneratedContentFromIntegration(definition)\n const parsedIntegrationDefinition = await this.prepareCreateIntegrationBody(strippedDefinition)\n const linter = new IntegrationLinter(\n { ...parsedIntegrationDefinition, secrets: strippedDefinition.secrets },\n this.logger\n )\n\n await linter.lint()\n linter.logResults(this.logger)\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError('Integration definition contains linting errors')\n }\n\n this.logger.success('Integration definition is valid')\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 const interfacesStatements = definition.interfaces ?? {}\n for (const iface of Object.values(interfacesStatements)) {\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 private _dereferenceActionDefinition = (actionDef: ActionDefinition): ActionDefinition => {\n const inputRefs = actionDef.input.schema.getReferences()\n const outputRefs = actionDef.output.schema.getReferences()\n\n const inputRefSchemas = Object.fromEntries(inputRefs.map((ref) => [ref, this._replaceRef(ref)]))\n const outputRefSchemas = Object.fromEntries(outputRefs.map((ref) => [ref, this._replaceRef(ref)]))\n\n actionDef.input.schema = actionDef.input.schema.dereference(inputRefSchemas) as z.ZodObject\n actionDef.output.schema = actionDef.output.schema.dereference(outputRefSchemas) as z.ZodObject\n\n return actionDef\n }\n\n private _dereferenceEventDefinition = (eventDef: EventDefinition): EventDefinition => {\n const refs = eventDef.schema.getReferences()\n\n const refSchemas = Object.fromEntries(refs.map((ref) => [ref, this._replaceRef(ref)]))\n\n eventDef.schema = eventDef.schema.dereference(refSchemas) as z.ZodObject\n\n return eventDef\n }\n\n private _replaceRef = (refUri: string): z.ZodObject => z.object({}).title(refUri).describe(refUri)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAOO;AACP,eAA0B;AAE1B,aAAwB;AACxB,wBAA0B;AAC1B,gCAAkC;AAClC,8BAAgC;AAChC,6BAA+B;AAGxB,MAAM,oBAAoB,sCAAsC;AAAA,EACrE,MAAa,MAAqB;AAChC,UAAM,EAAE,aAAa,yBAAyB,IAAI,KAAK,4BAA4B;AACnF,UAAM,aAAa,MAAM,yBAAyB;AAClD,QAAI,WAAW,gBAAgB;AAC7B,WAAK,OAAO;AAAA,QACV;AAAA,MACF;AACA;AAAA,IACF;AAEA,YAAQ,aAAa;AAAA,MACnB,KAAK,eAAe;AAClB,cAAMA,cAAa,MAAM,yBAAyB;AAClD,eAAO,KAAK,uBAAuBA,YAAW,UAAU;AAAA,MAC1D;AAAA,MACA,KAAK,OAAO;AACV,cAAMA,cAAa,MAAM,yBAAyB;AAClD,eAAO,KAAK,eAAeA,YAAW,UAAU;AAAA,MAClD;AAAA,MACA,KAAK,aAAa;AAChB,cAAMA,cAAa,MAAM,yBAAyB;AAClD,eAAO,KAAK,qBAAqBA,YAAW,UAAU;AAAA,MACxD;AAAA,MACA;AACE,cAAM,IAAI,OAAO,uBAAuB;AAAA,IAC5C;AAAA,EACF;AAAA,EAEA,MAAc,qBAAqB,YAAgD;AACjF,eAAW,CAAC,YAAY,SAAS,KAAK,OAAO,QAA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/F,UAAM,mBAAmB,OAAO,YAAY,WAAW,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC;AAEjG,cAAU,MAAM,SAAS,UAAU,MAAM,OAAO,YAAY,eAAe;AAC3E,cAAU,OAAO,SAAS,UAAU,OAAO,OAAO,YAAY,gBAAgB;AAE9E,WAAO;AAAA,EACT;AAAA,EAEQ,8BAA8B,CAAC,aAA+C;AACpF,UAAM,OAAO,SAAS,OAAO,cAAc;AAE3C,UAAM,aAAa,OAAO,YAAY,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC;AAErF,aAAS,SAAS,SAAS,OAAO,YAAY,UAAU;AAExD,WAAO;AAAA,EACT;AAAA,EAEQ,cAAc,CAAC,WAAgC,aAAE,OAAO,CAAC,CAAC,EAAE,MAAM,MAAM,EAAE,SAAS,MAAM;AACnG;",
6
6
  "names": ["projectDef"]
7
7
  }
@@ -5,7 +5,7 @@ export declare abstract class BaseLinter<TDefinition> {
5
5
  private readonly _spectral;
6
6
  private readonly _spectralDocument;
7
7
  private _results;
8
- protected constructor(definition: TDefinition, ruleset: RulesetDefinition);
8
+ protected constructor(definition: TDefinition, ruleset: RulesetDefinition, logger?: Logger);
9
9
  lint(): Promise<void>;
10
10
  logResults(logger: Logger): void;
11
11
  getSortedResults(): {
@@ -23,11 +23,31 @@ __export(base_linter_exports, {
23
23
  module.exports = __toCommonJS(base_linter_exports);
24
24
  var import_spectral_core = require("@stoplight/spectral-core");
25
25
  var import_spectral_parsers = require("@stoplight/spectral-parsers");
26
+ var import_spectral_functions = require("./spectral-functions");
27
+ const _injectLoggerIntoRulesetOptions = (ruleset, logger) => {
28
+ if ("rules" in ruleset) {
29
+ for (const ruleName in ruleset.rules) {
30
+ const rule = ruleset.rules[ruleName];
31
+ if (typeof rule !== "object" || !("then" in rule)) {
32
+ continue;
33
+ }
34
+ const ruleThens = Array.isArray(rule.then) ? rule.then : [rule.then];
35
+ for (const then of ruleThens) {
36
+ if (then.function.name === import_spectral_functions.TRUTHY_WITH_MESSAGE_ID) {
37
+ const options = then.functionOptions ?? {};
38
+ options.logger = logger;
39
+ then.functionOptions = options;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ };
26
45
  class BaseLinter {
27
46
  _spectral;
28
47
  _spectralDocument;
29
48
  _results = [];
30
- constructor(definition, ruleset) {
49
+ constructor(definition, ruleset, logger) {
50
+ _injectLoggerIntoRulesetOptions(ruleset, logger);
31
51
  const json = JSON.stringify(definition);
32
52
  this._spectralDocument = new import_spectral_core.Document(json, import_spectral_parsers.Json);
33
53
  this._spectral = new import_spectral_core.Spectral();
@@ -38,7 +58,8 @@ class BaseLinter {
38
58
  }
39
59
  logResults(logger) {
40
60
  for (const result of this.getSortedResults()) {
41
- const message = `${result.path}: ${result.message}`;
61
+ const resultPath = result.path.trim() || "{root}";
62
+ const message = `${resultPath}: ${result.message}`;
42
63
  this._logResultMessage(logger, message, result.severity);
43
64
  }
44
65
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/linter/base-linter.ts"],
4
- "sourcesContent": ["import { Spectral, Document, type ISpectralDiagnostic, type RulesetDefinition } from '@stoplight/spectral-core'\nimport { Json as JsonParser, type JsonParserResult } from '@stoplight/spectral-parsers'\nimport { type Logger } from '../logger'\n\ntype ProblemSeverity = 0 | 1 | 2 | 3\n\nexport abstract class BaseLinter<TDefinition> {\n private readonly _spectral: Spectral\n private readonly _spectralDocument: Document<unknown, JsonParserResult<unknown>>\n private _results: ISpectralDiagnostic[] = []\n\n protected constructor(definition: TDefinition, ruleset: RulesetDefinition) {\n const json = JSON.stringify(definition)\n this._spectralDocument = new Document(json, JsonParser)\n this._spectral = new Spectral()\n this._spectral.setRuleset(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 public hasErrors() {\n return this._results.some((result) => result.severity === 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,2BAAqF;AACrF,8BAA0D;AAKnD,MAAe,WAAwB;AAAA,EAC3B;AAAA,EACA;AAAA,EACT,WAAkC,CAAC;AAAA,EAEjC,YAAY,YAAyB,SAA4B;AACzE,UAAM,OAAO,KAAK,UAAU,UAAU;AACtC,SAAK,oBAAoB,IAAI,8BAAS,MAAM,wBAAAA,IAAU;AACtD,SAAK,YAAY,IAAI,8BAAS;AAC9B,SAAK,UAAU,WAAW,OAAO;AAAA,EACnC;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,IAAI,KAAK,OAAO,OAAO;AAEjD,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,EAEO,YAAY;AACjB,WAAO,KAAK,SAAS,KAAK,CAAC,WAAW,OAAO,aAAa,CAAC;AAAA,EAC7D;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,QAAQ,EAAE,KAAK,QAAQ,OAAO;AAAA,EAChD;AACF;",
4
+ "sourcesContent": ["import { Spectral, Document, type ISpectralDiagnostic, type RulesetDefinition } from '@stoplight/spectral-core'\nimport { Json as JsonParser, type JsonParserResult } from '@stoplight/spectral-parsers'\nimport { type Logger } from '../logger'\nimport { TRUTHY_WITH_MESSAGE_ID } from './spectral-functions'\n\ntype ProblemSeverity = 0 | 1 | 2 | 3\n\nconst _injectLoggerIntoRulesetOptions = (ruleset: RulesetDefinition, logger?: Logger) => {\n // This is the most jankiest thing I've ever done but\n // Spectral was never designed to be extended at all\n if ('rules' in ruleset) {\n for (const ruleName in ruleset.rules) {\n const rule = ruleset.rules[ruleName]\n if (typeof rule !== 'object' || !('then' in rule)) {\n continue\n }\n\n const ruleThens = Array.isArray(rule.then) ? rule.then : [rule.then]\n for (const then of ruleThens) {\n if (then.function.name === TRUTHY_WITH_MESSAGE_ID) {\n const options = (then.functionOptions ?? {}) as Record<string, unknown>\n options.logger = logger\n then.functionOptions = options\n }\n }\n }\n }\n}\n\nexport abstract class BaseLinter<TDefinition> {\n private readonly _spectral: Spectral\n private readonly _spectralDocument: Document<unknown, JsonParserResult<unknown>>\n private _results: ISpectralDiagnostic[] = []\n\n protected constructor(definition: TDefinition, ruleset: RulesetDefinition, logger?: Logger) {\n _injectLoggerIntoRulesetOptions(ruleset, logger)\n\n const json = JSON.stringify(definition)\n this._spectralDocument = new Document(json, JsonParser)\n this._spectral = new Spectral()\n this._spectral.setRuleset(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 resultPath = result.path.trim() || '{root}'\n const message = `${resultPath}: ${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 public hasErrors() {\n return this._results.some((result) => result.severity === 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,2BAAqF;AACrF,8BAA0D;AAE1D,gCAAuC;AAIvC,MAAM,kCAAkC,CAAC,SAA4B,WAAoB;AAGvF,MAAI,WAAW,SAAS;AACtB,eAAW,YAAY,QAAQ,OAAO;AACpC,YAAM,OAAO,QAAQ,MAAM,QAAQ;AACnC,UAAI,OAAO,S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,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,QAAQ,EAAE,KAAK,QAAQ,OAAO;AAAA,EAChD;AACF;",
6
6
  "names": ["JsonParser"]
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import { CreateBotRequestBody } from '../api';
2
+ import { type Logger } from '../logger';
2
3
  import { BaseLinter } from './base-linter';
3
4
  export declare class BotLinter extends BaseLinter<CreateBotRequestBody> {
4
- constructor(definition: CreateBotRequestBody);
5
+ constructor(definition: CreateBotRequestBody, logger?: Logger);
5
6
  }
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(bot_linter_exports);
24
24
  var import_base_linter = require("./base-linter");
25
25
  var import_bot = require("./rulesets/bot.ruleset");
26
26
  class BotLinter extends import_base_linter.BaseLinter {
27
- constructor(definition) {
28
- super(definition, import_bot.BOT_RULESET);
27
+ constructor(definition, logger) {
28
+ super(definition, import_bot.BOT_RULESET, logger);
29
29
  }
30
30
  }
31
31
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/linter/bot-linter.ts"],
4
- "sourcesContent": ["import { CreateBotRequestBody } from '../api'\nimport { BaseLinter } from './base-linter'\nimport { BOT_RULESET } from './rulesets/bot.ruleset'\n\nexport class BotLinter extends BaseLinter<CreateBotRequestBody> {\n public constructor(definition: CreateBotRequestBody) {\n super(definition, BOT_RULESET)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA2B;AAC3B,iBAA4B;AAErB,MAAM,kBAAkB,8BAAiC;AAAA,EACvD,YAAY,YAAkC;AACnD,UAAM,YAAY,sBAAW;AAAA,EAC/B;AACF;",
4
+ "sourcesContent": ["import { CreateBotRequestBody } from '../api'\nimport { type Logger } from '../logger'\nimport { BaseLinter } from './base-linter'\nimport { BOT_RULESET } from './rulesets/bot.ruleset'\n\nexport class BotLinter extends BaseLinter<CreateBotRequestBody> {\n public constructor(definition: CreateBotRequestBody, logger?: Logger) {\n super(definition, BOT_RULESET, logger)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA2B;AAC3B,iBAA4B;AAErB,MAAM,kBAAkB,8BAAiC;AAAA,EACvD,YAAY,YAAkC,QAAiB;AACpE,UAAM,YAAY,wBAAa,MAAM;AAAA,EACvC;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,8 @@
1
1
  import * as sdk from '@botpress/sdk';
2
2
  import { CreateIntegrationRequestBody } from '../api';
3
+ import { type Logger } from '../logger';
3
4
  import { BaseLinter } from './base-linter';
4
5
  export type AggregateIntegrationBody = Omit<CreateIntegrationRequestBody, 'secrets'> & Pick<sdk.IntegrationDefinitionProps, 'secrets'>;
5
6
  export declare class IntegrationLinter extends BaseLinter<AggregateIntegrationBody> {
6
- constructor(definition: AggregateIntegrationBody);
7
+ constructor(definition: AggregateIntegrationBody, logger?: Logger);
7
8
  }
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(integration_linter_exports);
24
24
  var import_base_linter = require("./base-linter");
25
25
  var import_integration = require("./rulesets/integration.ruleset");
26
26
  class IntegrationLinter extends import_base_linter.BaseLinter {
27
- constructor(definition) {
28
- super(definition, import_integration.INTEGRATION_RULESET);
27
+ constructor(definition, logger) {
28
+ super(definition, import_integration.INTEGRATION_RULESET, logger);
29
29
  }
30
30
  }
31
31
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/linter/integration-linter.ts"],
4
- "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { CreateIntegrationRequestBody } from '../api'\nimport { BaseLinter } from './base-linter'\nimport { INTEGRATION_RULESET } from './rulesets/integration.ruleset'\n\n// The CreateIntegrationBody type does not contain the descriptions for the secrets\nexport type AggregateIntegrationBody = Omit<CreateIntegrationRequestBody, 'secrets'> &\n Pick<sdk.IntegrationDefinitionProps, 'secrets'>\n\nexport class IntegrationLinter extends BaseLinter<AggregateIntegrationBody> {\n public constructor(definition: AggregateIntegrationBody) {\n super(definition, INTEGRATION_RULESET)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA2B;AAC3B,yBAAoC;AAM7B,MAAM,0BAA0B,8BAAqC;AAAA,EACnE,YAAY,YAAsC;AACvD,UAAM,YAAY,sCAAmB;AAAA,EACvC;AACF;",
4
+ "sourcesContent": ["import * as sdk from '@botpress/sdk'\nimport { CreateIntegrationRequestBody } from '../api'\nimport { type Logger } from '../logger'\nimport { BaseLinter } from './base-linter'\nimport { INTEGRATION_RULESET } from './rulesets/integration.ruleset'\n\n// The CreateIntegrationBody type does not contain the descriptions for the secrets\nexport type AggregateIntegrationBody = Omit<CreateIntegrationRequestBody, 'secrets'> &\n Pick<sdk.IntegrationDefinitionProps, 'secrets'>\n\nexport class IntegrationLinter extends BaseLinter<AggregateIntegrationBody> {\n public constructor(definition: AggregateIntegrationBody, logger?: Logger) {\n super(definition, INTEGRATION_RULESET, logger)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAA2B;AAC3B,yBAAoC;AAM7B,MAAM,0BAA0B,8BAAqC;AAAA,EACnE,YAAY,YAAsC,QAAiB;AACxE,UAAM,YAAY,wCAAqB,MAAM;AAAA,EAC/C;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import { CreateInterfaceRequestBody } from '../api';
2
+ import { type Logger } from '../logger';
2
3
  import { BaseLinter } from './base-linter';
3
4
  export declare class InterfaceLinter extends BaseLinter<CreateInterfaceRequestBody> {
4
- constructor(definition: CreateInterfaceRequestBody);
5
+ constructor(definition: CreateInterfaceRequestBody, logger?: Logger);
5
6
  }
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(interface_linter_exports);
24
24
  var import_base_linter = require("./base-linter");
25
25
  var import_interface = require("./rulesets/interface.ruleset");
26
26
  class InterfaceLinter extends import_base_linter.BaseLinter {
27
- constructor(definition) {
28
- super(definition, import_interface.INTERFACE_RULESET);
27
+ constructor(definition, logger) {
28
+ super(definition, import_interface.INTERFACE_RULESET, logger);
29
29
  }
30
30
  }
31
31
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/linter/interface-linter.ts"],
4
- "sourcesContent": ["import { CreateInterfaceRequestBody } from '../api'\nimport { BaseLinter } from './base-linter'\nimport { INTERFACE_RULESET } from './rulesets/interface.ruleset'\n\nexport class InterfaceLinter extends BaseLinter<CreateInterfaceRequestBody> {\n public constructor(definition: CreateInterfaceRequestBody) {\n super(definition, INTERFACE_RULESET)\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA2B;AAC3B,uBAAkC;AAE3B,MAAM,wBAAwB,8BAAuC;AAAA,EACnE,YAAY,YAAwC;AACzD,UAAM,YAAY,kCAAiB;AAAA,EACrC;AACF;",
4
+ "sourcesContent": ["import { CreateInterfaceRequestBody } from '../api'\nimport { type Logger } from '../logger'\nimport { BaseLinter } from './base-linter'\nimport { INTERFACE_RULESET } from './rulesets/interface.ruleset'\n\nexport class InterfaceLinter extends BaseLinter<CreateInterfaceRequestBody> {\n public constructor(definition: CreateInterfaceRequestBody, logger?: Logger) {\n super(definition, INTERFACE_RULESET, logger)\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAA2B;AAC3B,uBAAkC;AAE3B,MAAM,wBAAwB,8BAAuC;AAAA,EACnE,YAAY,YAAwC,QAAiB;AAC1E,UAAM,YAAY,oCAAmB,MAAM;AAAA,EAC7C;AACF;",
6
6
  "names": []
7
7
  }