@botpress/cli 5.5.0 → 5.5.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.
@@ -1,44 +1,44 @@
1
1
 
2
- > @botpress/cli@5.5.0 build /home/runner/work/botpress/botpress/packages/cli
2
+ > @botpress/cli@5.5.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.5.0 build:types /home/runner/work/botpress/botpress/packages/cli
6
+ > @botpress/cli@5.5.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.5.0 bundle /home/runner/work/botpress/botpress/packages/cli
10
+ > @botpress/cli@5.5.2 bundle /home/runner/work/botpress/botpress/packages/cli
11
11
  > ts-node -T build.ts
12
12
 
13
13
 
14
- > @botpress/cli@5.5.0 template:gen /home/runner/work/botpress/botpress/packages/cli
14
+ > @botpress/cli@5.5.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.5.0
17
+ 🤖 Botpress CLI v5.5.2
18
+ 🤖 Botpress CLI v5.5.2
18
19
  ● Checking if cli is up to date
19
- 🤖 Botpress CLI v5.5.0
20
20
  ● Checking if cli is up to date
21
- 🤖 Botpress CLI v5.5.0
21
+ 🤖 Botpress CLI v5.5.2
22
22
  ● Checking if cli is up to date
23
- 🤖 Botpress CLI v5.5.0
23
+ 🤖 Botpress CLI v5.5.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 empty-integration...
29
30
  ○ Generating typings for plugin empty-plugin...
31
+ ○ Generating typings for integration hello-world...
30
32
  ✓ Typings available at .botpress
31
33
 
32
- ○ Generating typings for bot...
33
- ○ Generating typings for integration hello-world...
34
- ○ Generating typings for integration empty-integration...
35
34
  ✓ Typings available at .botpress
36
35
 
36
+ ○ Generating typings for bot...
37
37
  ✓ Typings available at .botpress
38
38
 
39
39
  ✓ Typings available at .botpress
40
40
 
41
- 🤖 Botpress CLI v5.5.0
41
+ 🤖 Botpress CLI v5.5.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...
@@ -38,6 +38,10 @@ var import_bot_linter = require("../linter/bot-linter");
38
38
  var import_integration_linter = require("../linter/integration-linter");
39
39
  var import_interface_linter = require("../linter/interface-linter");
40
40
  var import_project_command = require("./project-command");
41
+ const _getIssuesDetectedMessage = (linter, nonEmptyPrefix = "") => {
42
+ const message = linter.getIssuesCountBySeverity().map(({ name, count }) => `${count} ${name}(s)`).join(", ");
43
+ return message.length > 0 ? `${nonEmptyPrefix}${message}` : "";
44
+ };
41
45
  class LintCommand extends import_project_command.ProjectCommand {
42
46
  async run() {
43
47
  const { projectType, resolveProjectDefinition } = this.readProjectDefinitionFromFS();
@@ -76,10 +80,11 @@ class LintCommand extends import_project_command.ProjectCommand {
76
80
  const linter = new import_interface_linter.InterfaceLinter(parsedInterfaceDefinition, this.logger);
77
81
  await linter.lint();
78
82
  linter.logResults(this.logger);
83
+ const issueCountsSuffix = _getIssuesDetectedMessage(linter, " - ");
79
84
  if (linter.hasErrors()) {
80
- throw new errors.BotpressCLIError("Interface definition contains linting errors");
85
+ throw new errors.BotpressCLIError(`Interface definition contains linting errors${issueCountsSuffix}`);
81
86
  }
82
- this.logger.success("Interface definition is valid");
87
+ this.logger.success(`Interface definition is valid${issueCountsSuffix}`);
83
88
  }
84
89
  async _runLintForBot(definition) {
85
90
  const strippedDefinition = this._stripAutoGeneratedContentFromBot(definition);
@@ -87,10 +92,11 @@ class LintCommand extends import_project_command.ProjectCommand {
87
92
  const linter = new import_bot_linter.BotLinter(parsedBotDefinition, this.logger);
88
93
  await linter.lint();
89
94
  linter.logResults(this.logger);
95
+ const issueCountsSuffix = _getIssuesDetectedMessage(linter, " - ");
90
96
  if (linter.hasErrors()) {
91
- throw new errors.BotpressCLIError("Bot definition contains linting errors");
97
+ throw new errors.BotpressCLIError(`Bot definition contains linting errors${issueCountsSuffix}`);
92
98
  }
93
- this.logger.success("Bot definition is valid");
99
+ this.logger.success(`Bot definition is valid${issueCountsSuffix}`);
94
100
  }
95
101
  _stripAutoGeneratedContentFromBot(definition) {
96
102
  return {
@@ -107,10 +113,11 @@ class LintCommand extends import_project_command.ProjectCommand {
107
113
  );
108
114
  await linter.lint();
109
115
  linter.logResults(this.logger);
116
+ const issueCountsSuffix = _getIssuesDetectedMessage(linter, " - ");
110
117
  if (linter.hasErrors()) {
111
- throw new errors.BotpressCLIError("Integration definition contains linting errors");
118
+ throw new errors.BotpressCLIError(`Integration definition contains linting errors${issueCountsSuffix}`);
112
119
  }
113
- this.logger.success("Integration definition is valid");
120
+ this.logger.success(`Integration definition is valid${issueCountsSuffix}`);
114
121
  }
115
122
  _stripAutoGeneratedContentFromIntegration(definition) {
116
123
  const { actionNames, eventNames } = this._getAutoGeneratedContentOfIntegration(definition);
@@ -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, 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,QAAQ,WAAW,OAAO,GAAG;AACxE,iBAAW,QAAQ,UAAU,IAAI,KAAK,6BAA6B,SAAS;AAAA,IAC9E;AAEA,eAAW,CAAC,WAAW,QAAQ,KAAK,OAAO,QAAQ,WAAW,MAAM,GAAG;AACrE,iBAAW,OAAO,SAAS,IAAI,KAAK,4BAA4B,QAAQ;AAAA,IAC1E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E,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 { BaseLinter } from '../linter/base-linter'\nimport { BotLinter } from '../linter/bot-linter'\nimport { IntegrationLinter } from '../linter/integration-linter'\nimport { InterfaceLinter } from '../linter/interface-linter'\nimport { ProjectCommand } from './project-command'\n\nconst _getIssuesDetectedMessage = (linter: BaseLinter<unknown>, nonEmptyPrefix: string = '') => {\n const message = linter\n .getIssuesCountBySeverity()\n .map(({ name, count }) => `${count} ${name}(s)`)\n .join(', ')\n\n return message.length > 0 ? `${nonEmptyPrefix}${message}` : ''\n}\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 const issueCountsSuffix = _getIssuesDetectedMessage(linter, ' - ')\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError(`Interface definition contains linting errors${issueCountsSuffix}`)\n }\n\n this.logger.success(`Interface definition is valid${issueCountsSuffix}`)\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 const issueCountsSuffix = _getIssuesDetectedMessage(linter, ' - ')\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError(`Bot definition contains linting errors${issueCountsSuffix}`)\n }\n\n this.logger.success(`Bot definition is valid${issueCountsSuffix}`)\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 const issueCountsSuffix = _getIssuesDetectedMessage(linter, ' - ')\n\n if (linter.hasErrors()) {\n throw new errors.BotpressCLIError(`Integration definition contains linting errors${issueCountsSuffix}`)\n }\n\n this.logger.success(`Integration definition is valid${issueCountsSuffix}`)\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;AAExB,wBAA0B;AAC1B,gCAAkC;AAClC,8BAAgC;AAChC,6BAA+B;AAE/B,MAAM,4BAA4B,CAAC,QAA6B,iBAAyB,OAAO;AAC9F,QAAM,UAAU,OACb,yBAAyB,EACzB,IAAI,CAAC,EAAE,MAAM,MAAM,MAAM,GAAG,KAAK,IAAI,IAAI,KAAK,EAC9C,KAAK,IAAI;AAEZ,SAAO,QAAQ,SAAS,IAAI,GAAG,cAAc,GAAG,OAAO,KAAK;AAC9D;AAGO,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,QAAQ,WAAW,OAA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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;",
6
6
  "names": ["projectDef"]
7
7
  }
@@ -1,6 +1,12 @@
1
1
  import { type RulesetDefinition } from '@stoplight/spectral-core';
2
+ import { DiagnosticSeverity } from '@stoplight/types';
2
3
  import { type Logger } from '../logger';
3
- type ProblemSeverity = 0 | 1 | 2 | 3;
4
+ declare enum ProblemSeverity {
5
+ Error = 0,
6
+ Warning = 1,
7
+ Info = 2,
8
+ Debug = 3
9
+ }
4
10
  export declare abstract class BaseLinter<TDefinition> {
5
11
  private readonly _spectral;
6
12
  private readonly _spectralDocument;
@@ -11,11 +17,19 @@ export declare abstract class BaseLinter<TDefinition> {
11
17
  getSortedResults(): {
12
18
  message: string;
13
19
  path: string;
14
- severity: ProblemSeverity;
20
+ severity: StoplightServerity;
15
21
  }[];
16
22
  hasErrors(): boolean;
23
+ getIssuesCountBySeverity(): ResultSeverityCount[];
17
24
  private _getResults;
18
25
  private _simplifyPath;
19
26
  private _logResultMessage;
20
27
  }
28
+ type ResultSeverityCount = {
29
+ severityLevel: ProblemSeverity;
30
+ name: string;
31
+ count: number;
32
+ };
33
+ type EnumToIndices<T extends {}> = `${Extract<T, number>}` extends `${infer N extends number}` ? N : never;
34
+ type StoplightServerity = EnumToIndices<DiagnosticSeverity>;
21
35
  export {};
@@ -24,6 +24,13 @@ 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
26
  var import_spectral_functions = require("./spectral-functions");
27
+ var ProblemSeverity = /* @__PURE__ */ ((ProblemSeverity2) => {
28
+ ProblemSeverity2[ProblemSeverity2["Error"] = 0] = "Error";
29
+ ProblemSeverity2[ProblemSeverity2["Warning"] = 1] = "Warning";
30
+ ProblemSeverity2[ProblemSeverity2["Info"] = 2] = "Info";
31
+ ProblemSeverity2[ProblemSeverity2["Debug"] = 3] = "Debug";
32
+ return ProblemSeverity2;
33
+ })(ProblemSeverity || {});
27
34
  const _injectLoggerIntoRulesetOptions = (ruleset, logger) => {
28
35
  if ("rules" in ruleset) {
29
36
  for (const ruleName in ruleset.rules) {
@@ -69,6 +76,24 @@ class BaseLinter {
69
76
  hasErrors() {
70
77
  return this._results.some((result) => result.severity === 0);
71
78
  }
79
+ getIssuesCountBySeverity() {
80
+ return Object.values(
81
+ this._getResults().reduce(
82
+ (acc, { severity }) => {
83
+ if (!acc.hasOwnProperty(severity)) {
84
+ acc[severity] = {
85
+ severityLevel: severity,
86
+ name: ProblemSeverity[severity] ?? "Unknown",
87
+ count: 0
88
+ };
89
+ }
90
+ acc[severity].count += 1;
91
+ return acc;
92
+ },
93
+ {}
94
+ )
95
+ ).toSorted((a, b) => a.severityLevel - b.severityLevel);
96
+ }
72
97
  _getResults() {
73
98
  return this._results.map((result) => ({
74
99
  message: result.message,
@@ -81,10 +106,10 @@ class BaseLinter {
81
106
  }
82
107
  _logResultMessage(logger, message, severity) {
83
108
  const logLevelMapping = {
84
- 0: logger.error,
85
- 1: logger.warn,
86
- 2: logger.log,
87
- 3: logger.debug
109
+ [0 /* Error */]: logger.error,
110
+ [1 /* Warning */]: logger.warn,
111
+ [2 /* Info */]: logger.log,
112
+ [3 /* Debug */]: logger.debug
88
113
  };
89
114
  logLevelMapping[severity].call(logger, message);
90
115
  }
@@ -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'\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,SAAS,YAAY,EAAE,UAAU,OAAO;AACjD;AAAA,MACF;AAEA,YAAM,YAAY,MAAM,QAAQ,KAAK,IAAI,IAAI,KAAK,OAAO,CAAC,KAAK,IAAI;AACnE,iBAAW,QAAQ,WAAW;AAC5B,YAAI,KAAK,SAAS,SAAS,kDAAwB;AACjD,gBAAM,UAAW,KAAK,mBAAmB,CAAC;AAC1C,kBAAQ,SAAS;AACjB,eAAK,kBAAkB;AAAA,QACzB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AAgB,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
- "names": ["JsonParser"]
4
+ "sourcesContent": ["import { Spectral, Document, type ISpectralDiagnostic, type RulesetDefinition } from '@stoplight/spectral-core'\nimport { Json as JsonParser, type JsonParserResult } from '@stoplight/spectral-parsers'\nimport { DiagnosticSeverity } from '@stoplight/types'\nimport { type Logger } from '../logger'\nimport { TRUTHY_WITH_MESSAGE_ID } from './spectral-functions'\n\nenum ProblemSeverity {\n Error = 0,\n Warning = 1,\n Info = 2,\n Debug = 3,\n}\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 public getIssuesCountBySeverity() {\n return Object.values(\n this._getResults().reduce(\n (acc, { severity }) => {\n if (!acc.hasOwnProperty(severity)) {\n acc[severity] = {\n severityLevel: severity,\n name: ProblemSeverity[severity] ?? 'Unknown',\n count: 0,\n }\n }\n\n acc[severity].count += 1\n return acc\n },\n {} as Record<ProblemSeverity, ResultSeverityCount>\n )\n ).toSorted((a, b) => a.severityLevel - b.severityLevel)\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 StoplightServerity,\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 [ProblemSeverity.Error]: logger.error,\n [ProblemSeverity.Warning]: logger.warn,\n [ProblemSeverity.Info]: logger.log,\n [ProblemSeverity.Debug]: logger.debug,\n } as const satisfies Record<StoplightServerity, Function>\n\n logLevelMapping[severity].call(logger, message)\n }\n}\n\ntype ResultSeverityCount = {\n severityLevel: ProblemSeverity\n name: string\n count: number\n}\n\ntype EnumToIndices<T extends {}> = `${Extract<T, number>}` extends `${infer N extends number}` ? N : never\ntype StoplightServerity = EnumToIndices<DiagnosticSeverity>\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAqF;AACrF,8BAA0D;AAG1D,gCAAuC;AAEvC,IAAK,kBAAL,kBAAKA,qBAAL;AACE,EAAAA,kCAAA,WAAQ,KA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KAAK,QAAQ,OAAO;AAAA,EAChD;AACF;",
6
+ "names": ["ProblemSeverity", "JsonParser"]
7
7
  }
@@ -0,0 +1,8 @@
1
+ import { RulesetDefinition as SpectralRulesetDefinition } from '@stoplight/spectral-core';
2
+ import { Ruleset } from './ruleset-tests/common';
3
+ type RulesetDefinition = SpectralRulesetDefinition & Ruleset;
4
+ /** Applies build-time transformations to the ruleset. See remarks for details.
5
+ *
6
+ * @remark Replaces "{{callToAction}}" placeholders with their corresponding words (e.g. "SHOULD" or "MUST") */
7
+ export declare const preprocessRuleset: (ruleset: RulesetDefinition) => RulesetDefinition;
8
+ export {};
@@ -0,0 +1,75 @@
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 ruleset_functions_exports = {};
20
+ __export(ruleset_functions_exports, {
21
+ preprocessRuleset: () => preprocessRuleset
22
+ });
23
+ module.exports = __toCommonJS(ruleset_functions_exports);
24
+ var import_types = require("@stoplight/types");
25
+ const preprocessRuleset = (ruleset) => {
26
+ if ("rules" in ruleset) {
27
+ for (const ruleName in ruleset.rules) {
28
+ let rule = ruleset.rules[ruleName];
29
+ if (typeof rule !== "object") {
30
+ continue;
31
+ }
32
+ rule = _replaceCallToActionPlaceholders(rule);
33
+ ruleset.rules[ruleName] = rule;
34
+ }
35
+ }
36
+ return ruleset;
37
+ };
38
+ const _getCallToActionWord = (severity) => {
39
+ switch (severity) {
40
+ case import_types.DiagnosticSeverity.Error:
41
+ case "error":
42
+ return "MUST";
43
+ case import_types.DiagnosticSeverity.Warning:
44
+ case "warn":
45
+ return "SHOULD";
46
+ case import_types.DiagnosticSeverity.Information:
47
+ case "info":
48
+ return "SHOULD";
49
+ case import_types.DiagnosticSeverity.Hint:
50
+ case "hint":
51
+ return "SHOULD";
52
+ default:
53
+ return "SHOULD";
54
+ }
55
+ };
56
+ const _replaceCallToActionPlaceholders = (ruleDef) => {
57
+ const { severity } = ruleDef;
58
+ if (severity === void 0) {
59
+ return ruleDef;
60
+ }
61
+ const callToActionWord = _getCallToActionWord(severity);
62
+ let { description, message } = ruleDef;
63
+ description = description?.replaceAll("{{callToAction}}", callToActionWord);
64
+ message = message?.replaceAll("{{callToAction}}", callToActionWord);
65
+ return {
66
+ ...ruleDef,
67
+ description,
68
+ message
69
+ };
70
+ };
71
+ // Annotate the CommonJS export names for ESM import in node:
72
+ 0 && (module.exports = {
73
+ preprocessRuleset
74
+ });
75
+ //# sourceMappingURL=ruleset-functions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/linter/ruleset-functions.ts"],
4
+ "sourcesContent": ["import { RuleDefinition, RulesetDefinition as SpectralRulesetDefinition } from '@stoplight/spectral-core'\nimport { DiagnosticSeverity } from '@stoplight/types'\nimport { Ruleset } from './ruleset-tests/common'\n\ntype RulesetDefinition = SpectralRulesetDefinition & Ruleset\n\n/** Applies build-time transformations to the ruleset. See remarks for details.\n *\n * @remark Replaces \"{{callToAction}}\" placeholders with their corresponding words (e.g. \"SHOULD\" or \"MUST\") */\nexport const preprocessRuleset = (ruleset: RulesetDefinition): RulesetDefinition => {\n if ('rules' in ruleset) {\n for (const ruleName in ruleset.rules) {\n let rule = ruleset.rules[ruleName]\n if (typeof rule !== 'object') {\n continue\n }\n\n rule = _replaceCallToActionPlaceholders(rule)\n ruleset.rules[ruleName] = rule\n }\n }\n\n return ruleset\n}\n\nconst _getCallToActionWord = (severity: Exclude<RuleDefinition['severity'], undefined>): string => {\n switch (severity) {\n case DiagnosticSeverity.Error:\n case 'error':\n return 'MUST'\n case DiagnosticSeverity.Warning:\n case 'warn':\n return 'SHOULD'\n case DiagnosticSeverity.Information:\n case 'info':\n return 'SHOULD'\n case DiagnosticSeverity.Hint:\n case 'hint':\n return 'SHOULD'\n default:\n return 'SHOULD'\n }\n}\n\nconst _replaceCallToActionPlaceholders = (ruleDef: RuleDefinition): RuleDefinition => {\n const { severity } = ruleDef\n if (severity === undefined) {\n return ruleDef\n }\n\n const callToActionWord = _getCallToActionWord(severity)\n let { description, message } = ruleDef\n\n description = description?.replaceAll('{{callToAction}}', callToActionWord)\n message = message?.replaceAll('{{callToAction}}', callToActionWord)\n return {\n ...ruleDef,\n description,\n message,\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAmC;AAQ5B,MAAM,oBAAoB,CAAC,YAAkD;AAClF,MAAI,WAAW,SAAS;AACtB,eAAW,YAAY,QAAQ,OAAO;AACpC,UAAI,OAAO,QAAQ,MAAM,QAAQ;AACjC,UAAI,OAAO,SAAS,UAAU;AAC5B;AAAA,MACF;AAEA,aAAO,iCAAiC,IAAI;AAC5C,cAAQ,MAAM,QAAQ,IAAI;AAAA,IAC5B;AAAA,EACF;AAEA,SAAO;AACT;AAEA,MAAM,uBAAuB,CAAC,aAAqE;AACjG,UAAQ,UAAU;AAAA,IAChB,KAAK,gCAAmB;AAAA,IACxB,KAAK;AACH,aAAO;AAAA,IACT,KAAK,gCAAmB;AAAA,IACxB,KAAK;AACH,aAAO;AAAA,IACT,KAAK,gCAAmB;AAAA,IACxB,KAAK;AACH,aAAO;AAAA,IACT,KAAK,gCAAmB;AAAA,IACxB,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,MAAM,mCAAmC,CAAC,YAA4C;AACpF,QAAM,EAAE,SAAS,IAAI;AACrB,MAAI,aAAa,QAAW;AAC1B,WAAO;AAAA,EACT;AAEA,QAAM,mBAAmB,qBAAqB,QAAQ;AACtD,MAAI,EAAE,aAAa,QAAQ,IAAI;AAE/B,gBAAc,aAAa,WAAW,oBAAoB,gBAAgB;AAC1E,YAAU,SAAS,WAAW,oBAAoB,gBAAgB;AAClE,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -2,8 +2,7 @@ import { type ISpectralDiagnostic, type RuleDefinition } from '@stoplight/spectr
2
2
  export type RecursivePartial<T> = {
3
3
  [P in Extract<keyof T, string>]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
4
4
  };
5
- type Ruleset = {
5
+ export type Ruleset = {
6
6
  rules: Record<string, Readonly<RuleDefinition>>;
7
7
  };
8
8
  export declare const createDescribeRule: <TDefinition>() => <TRuleset extends Ruleset>(ruleset: TRuleset) => <TPartialDefinition extends RecursivePartial<TDefinition>>(ruleName: Extract<keyof (typeof ruleset)["rules"], string>, fn: (lint: (definition: TPartialDefinition) => Promise<ISpectralDiagnostic[]>) => void) => import("vitest").SuiteCollector<object>;
9
- export {};
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/linter/ruleset-tests/common.ts"],
4
- "sourcesContent": ["import { Document, type ISpectralDiagnostic, Spectral, type RuleDefinition } from '@stoplight/spectral-core'\nimport { Json as JsonParser } from '@stoplight/spectral-parsers'\nimport { describe } from 'vitest'\n\nexport type RecursivePartial<T> = {\n [P in Extract<keyof T, string>]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object | undefined\n ? RecursivePartial<T[P]>\n : T[P]\n}\n\ntype Ruleset = {\n rules: Record<string, Readonly<RuleDefinition>>\n}\n\nexport const createDescribeRule =\n <TDefinition>() =>\n <TRuleset extends Ruleset>(ruleset: TRuleset) =>\n <TPartialDefinition extends RecursivePartial<TDefinition>>(\n ruleName: Extract<keyof (typeof ruleset)['rules'], string>,\n fn: (lint: (definition: TPartialDefinition) => Promise<ISpectralDiagnostic[]>) => void\n ) =>\n describe.concurrent(ruleName, () => {\n const spectral = new Spectral()\n spectral.setRuleset({ ...ruleset, rules: { [ruleName]: ruleset.rules[ruleName]! } })\n\n const lintFn = (definition: TPartialDefinition) =>\n spectral.run(new Document(JSON.stringify(definition), JsonParser))\n\n fn(lintFn)\n })\n"],
4
+ "sourcesContent": ["import { Document, type ISpectralDiagnostic, Spectral, type RuleDefinition } from '@stoplight/spectral-core'\nimport { Json as JsonParser } from '@stoplight/spectral-parsers'\nimport { describe } from 'vitest'\n\nexport type RecursivePartial<T> = {\n [P in Extract<keyof T, string>]?: T[P] extends (infer U)[]\n ? RecursivePartial<U>[]\n : T[P] extends object | undefined\n ? RecursivePartial<T[P]>\n : T[P]\n}\n\nexport type Ruleset = {\n rules: Record<string, Readonly<RuleDefinition>>\n}\n\nexport const createDescribeRule =\n <TDefinition>() =>\n <TRuleset extends Ruleset>(ruleset: TRuleset) =>\n <TPartialDefinition extends RecursivePartial<TDefinition>>(\n ruleName: Extract<keyof (typeof ruleset)['rules'], string>,\n fn: (lint: (definition: TPartialDefinition) => Promise<ISpectralDiagnostic[]>) => void\n ) =>\n describe.concurrent(ruleName, () => {\n const spectral = new Spectral()\n spectral.setRuleset({ ...ruleset, rules: { [ruleName]: ruleset.rules[ruleName]! } })\n\n const lintFn = (definition: TPartialDefinition) =>\n spectral.run(new Document(JSON.stringify(definition), JsonParser))\n\n fn(lintFn)\n })\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAkF;AAClF,8BAAmC;AACnC,oBAAyB;AAclB,MAAM,qBACX,MACA,CAA2B,YAC3B,CACE,UACA,OAEA,uBAAS,WAAW,UAAU,MAAM;AAClC,QAAM,WAAW,IAAI,8BAAS;AAC9B,WAAS,WAAW,EAAE,GAAG,SAAS,OAAO,EAAE,CAAC,QAAQ,GAAG,QAAQ,MAAM,QAAQ,EAAG,EAAE,CAAC;AAEnF,QAAM,SAAS,CAAC,eACd,SAAS,IAAI,IAAI,8BAAS,KAAK,UAAU,UAAU,GAAG,wBAAAA,IAAU,CAAC;AAEnE,KAAG,MAAM;AACX,CAAC;",
6
6
  "names": ["JsonParser"]
7
7
  }
@@ -1,141 +1 @@
1
- export declare const BOT_RULESET: {
2
- extends: never[];
3
- rules: {
4
- 'event-outputparams-should-have-title': {
5
- description: string;
6
- message: string;
7
- severity: "warn";
8
- given: string;
9
- then: {
10
- field: string;
11
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
12
- }[];
13
- };
14
- 'event-outputparams-must-have-description': {
15
- description: string;
16
- message: string;
17
- severity: "error";
18
- given: string;
19
- then: {
20
- field: string;
21
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
22
- }[];
23
- };
24
- 'configuration-fields-must-have-a-title': {
25
- description: string;
26
- message: string;
27
- severity: "error";
28
- given: string;
29
- then: {
30
- field: string;
31
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
32
- }[];
33
- };
34
- 'configuration-fields-must-have-a-description': {
35
- description: string;
36
- message: string;
37
- severity: "error";
38
- given: string;
39
- then: {
40
- field: string;
41
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
42
- }[];
43
- };
44
- 'user-tags-should-have-a-title': {
45
- description: string;
46
- message: string;
47
- severity: "warn";
48
- given: string;
49
- then: {
50
- field: string;
51
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
52
- }[];
53
- };
54
- 'user-tags-must-have-a-description': {
55
- description: string;
56
- message: string;
57
- severity: "error";
58
- given: string;
59
- then: {
60
- field: string;
61
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
62
- }[];
63
- };
64
- 'conversation-tags-should-have-a-title': {
65
- description: string;
66
- message: string;
67
- severity: "warn";
68
- given: string;
69
- then: {
70
- field: string;
71
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
72
- }[];
73
- };
74
- 'conversation-tags-must-have-a-description': {
75
- description: string;
76
- message: string;
77
- severity: "error";
78
- given: string;
79
- then: {
80
- field: string;
81
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
82
- }[];
83
- };
84
- 'message-tags-should-have-a-title': {
85
- description: string;
86
- message: string;
87
- severity: "warn";
88
- given: string;
89
- then: {
90
- field: string;
91
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
92
- }[];
93
- };
94
- 'message-tags-must-have-a-description': {
95
- description: string;
96
- message: string;
97
- severity: "error";
98
- given: string;
99
- then: {
100
- field: string;
101
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
102
- }[];
103
- };
104
- 'legacy-zui-title-should-be-removed': {
105
- description: string;
106
- severity: "error";
107
- given: string;
108
- then: {
109
- function: import("@stoplight/spectral-core").RulesetFunctionWithValidator<unknown, null>;
110
- }[];
111
- };
112
- 'legacy-zui-examples-should-be-removed': {
113
- description: string;
114
- severity: "hint";
115
- given: string;
116
- then: {
117
- function: import("@stoplight/spectral-core").RulesetFunctionWithValidator<unknown, null>;
118
- }[];
119
- };
120
- 'state-fields-should-have-title': {
121
- description: string;
122
- message: string;
123
- severity: "warn";
124
- given: string;
125
- then: {
126
- field: string;
127
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
128
- }[];
129
- };
130
- 'state-fields-must-have-description': {
131
- description: string;
132
- message: string;
133
- severity: "error";
134
- given: string;
135
- then: {
136
- field: string;
137
- function: import("@stoplight/spectral-core").RulesetFunction<any, any> | import("@stoplight/spectral-core").RulesetFunctionWithValidator<any, any>;
138
- }[];
139
- };
140
- };
141
- };
1
+ export declare const BOT_RULESET: import("@stoplight/spectral-core").RulesetDefinition & import("../ruleset-tests/common").Ruleset;