@eventcatalog/linter 0.1.1 → 1.0.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.
- package/README.md +50 -18
- package/package.json +14 -17
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -73
- package/dist/cli/index.js.map +0 -1
- package/dist/config/index.d.ts +0 -29
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -196
- package/dist/config/index.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -24
- package/dist/index.js.map +0 -1
- package/dist/parser/index.d.ts +0 -17
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -43
- package/dist/parser/index.js.map +0 -1
- package/dist/reporters/index.d.ts +0 -16
- package/dist/reporters/index.d.ts.map +0 -1
- package/dist/reporters/index.js +0 -155
- package/dist/reporters/index.js.map +0 -1
- package/dist/scanner/index.d.ts +0 -14
- package/dist/scanner/index.d.ts.map +0 -1
- package/dist/scanner/index.js +0 -102
- package/dist/scanner/index.js.map +0 -1
- package/dist/schemas/channel.d.ts +0 -389
- package/dist/schemas/channel.d.ts.map +0 -1
- package/dist/schemas/channel.js +0 -20
- package/dist/schemas/channel.js.map +0 -1
- package/dist/schemas/common.d.ts +0 -550
- package/dist/schemas/common.d.ts.map +0 -1
- package/dist/schemas/common.js +0 -144
- package/dist/schemas/common.js.map +0 -1
- package/dist/schemas/data-store.d.ts +0 -348
- package/dist/schemas/data-store.d.ts.map +0 -1
- package/dist/schemas/data-store.js +0 -17
- package/dist/schemas/data-store.js.map +0 -1
- package/dist/schemas/domain.d.ts +0 -381
- package/dist/schemas/domain.d.ts.map +0 -1
- package/dist/schemas/domain.js +0 -13
- package/dist/schemas/domain.js.map +0 -1
- package/dist/schemas/entity.d.ts +0 -382
- package/dist/schemas/entity.d.ts.map +0 -1
- package/dist/schemas/entity.js +0 -24
- package/dist/schemas/entity.js.map +0 -1
- package/dist/schemas/flow.d.ts +0 -733
- package/dist/schemas/flow.d.ts.map +0 -1
- package/dist/schemas/flow.js +0 -70
- package/dist/schemas/flow.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -3815
- package/dist/schemas/index.d.ts.map +0 -1
- package/dist/schemas/index.js +0 -50
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/message.d.ts +0 -1076
- package/dist/schemas/message.d.ts.map +0 -1
- package/dist/schemas/message.js +0 -17
- package/dist/schemas/message.js.map +0 -1
- package/dist/schemas/service.d.ts +0 -417
- package/dist/schemas/service.d.ts.map +0 -1
- package/dist/schemas/service.js +0 -15
- package/dist/schemas/service.js.map +0 -1
- package/dist/schemas/team.d.ts +0 -45
- package/dist/schemas/team.d.ts.map +0 -1
- package/dist/schemas/team.js +0 -20
- package/dist/schemas/team.js.map +0 -1
- package/dist/schemas/user.d.ts +0 -48
- package/dist/schemas/user.d.ts.map +0 -1
- package/dist/schemas/user.js +0 -21
- package/dist/schemas/user.js.map +0 -1
- package/dist/types/index.d.ts +0 -82
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/validators/best-practices-validator.d.ts +0 -4
- package/dist/validators/best-practices-validator.d.ts.map +0 -1
- package/dist/validators/best-practices-validator.js +0 -38
- package/dist/validators/best-practices-validator.js.map +0 -1
- package/dist/validators/index.d.ts +0 -8
- package/dist/validators/index.d.ts.map +0 -1
- package/dist/validators/index.js +0 -31
- package/dist/validators/index.js.map +0 -1
- package/dist/validators/reference-validator.d.ts +0 -12
- package/dist/validators/reference-validator.d.ts.map +0 -1
- package/dist/validators/reference-validator.js +0 -201
- package/dist/validators/reference-validator.js.map +0 -1
- package/dist/validators/schema-validator.d.ts +0 -5
- package/dist/validators/schema-validator.d.ts.map +0 -1
- package/dist/validators/schema-validator.js +0 -62
- package/dist/validators/schema-validator.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A comprehensive linter for EventCatalog that validates frontmatter schemas and resource references to ensure your event-driven architecture documentation is correct and consistent.
|
|
4
4
|
|
|
5
|
-
[](https://badge.fury.io/js/@eventcatalog%2Flinter)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
8
|
## 🚀 Features
|
|
@@ -207,23 +207,32 @@ module.exports = {
|
|
|
207
207
|
|
|
208
208
|
### Available Rules
|
|
209
209
|
|
|
210
|
-
| Rule Name
|
|
211
|
-
|
|
|
212
|
-
| **Schema Validation Rules**
|
|
213
|
-
| `schema/required-fields`
|
|
214
|
-
| `schema/valid-type`
|
|
215
|
-
| `schema/valid-semver`
|
|
216
|
-
| `schema/valid-email`
|
|
217
|
-
| `schema/validation-error`
|
|
218
|
-
| **Reference Validation Rules**
|
|
219
|
-
| `refs/owner-exists`
|
|
220
|
-
| `refs/valid-version-range`
|
|
221
|
-
| `refs/resource-exists`
|
|
222
|
-
|
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
225
|
-
|
|
226
|
-
|
|
210
|
+
| Rule Name | Description | Accepted Values | Default |
|
|
211
|
+
| ------------------------------------- | ----------------------------------------------------------------- | ---------------------- | ------- |
|
|
212
|
+
| **Schema Validation Rules** |
|
|
213
|
+
| `schema/required-fields` | Validates that required fields are present in frontmatter | `error`, `warn`, `off` | `error` |
|
|
214
|
+
| `schema/valid-type` | Validates that field types are correct (strings, arrays, objects) | `error`, `warn`, `off` | `error` |
|
|
215
|
+
| `schema/valid-semver` | Validates semantic version format (1.0.0, 2.1.3-beta) | `error`, `warn`, `off` | `error` |
|
|
216
|
+
| `schema/valid-email` | Validates email address format in user frontmatter | `error`, `warn`, `off` | `error` |
|
|
217
|
+
| `schema/validation-error` | General schema validation errors | `error`, `warn`, `off` | `error` |
|
|
218
|
+
| **Reference Validation Rules** |
|
|
219
|
+
| `refs/owner-exists` | Ensures referenced owners (users/teams) exist | `error`, `warn`, `off` | `error` |
|
|
220
|
+
| `refs/valid-version-range` | Validates version references and patterns | `error`, `warn`, `off` | `error` |
|
|
221
|
+
| `refs/resource-exists` | Ensures referenced resources exist | `error`, `warn`, `off` | `error` |
|
|
222
|
+
| `refs/channel-exists` | Ensures channels referenced in sends/receives `to`/`from` exist | `error`, `warn`, `off` | `error` |
|
|
223
|
+
| `refs/container-exists` | Ensures containers referenced in `writesTo`/`readsFrom` exist | `error`, `warn`, `off` | `error` |
|
|
224
|
+
| `refs/orphan-messages` | Detects events/commands/queries with no producer and no consumer | `error`, `warn`, `off` | `warn` |
|
|
225
|
+
| **Best Practice Rules** |
|
|
226
|
+
| `best-practices/summary-required` | Requires summary field for better documentation | `error`, `warn`, `off` | `error` |
|
|
227
|
+
| `best-practices/owner-required` | Requires at least one owner for accountability | `error`, `warn`, `off` | `error` |
|
|
228
|
+
| `best-practices/description-required` | Requires markdown body content beyond just frontmatter | `error`, `warn`, `off` | `warn` |
|
|
229
|
+
| `best-practices/schema-required` | Requires `schemaPath` on events, commands, and queries | `error`, `warn`, `off` | `warn` |
|
|
230
|
+
| **Versioning Rules** |
|
|
231
|
+
| `versions/no-deprecated-references` | Warns when referencing a deprecated resource | `error`, `warn`, `off` | `warn` |
|
|
232
|
+
| **Structural Rules** |
|
|
233
|
+
| `structure/duplicate-resource-ids` | Detects duplicate resources with same type, id, and version | `error`, `warn`, `off` | `error` |
|
|
234
|
+
|
|
235
|
+
**Note**: Rules defaulting to `warn` will show warnings but won't fail the linter unless `--fail-on-warning` is used. You can promote them to `error` for stricter validation.
|
|
227
236
|
|
|
228
237
|
### Configuration Examples
|
|
229
238
|
|
|
@@ -326,10 +335,20 @@ If no `.eventcatalogrc.js` file is found, the linter uses default rules where al
|
|
|
326
335
|
- ✅ Services referenced in domains exist
|
|
327
336
|
- ✅ Events/Commands/Queries referenced in services exist
|
|
328
337
|
- ✅ Entities referenced in domains/services exist
|
|
338
|
+
- ✅ Channels referenced in sends/receives `to`/`from` exist
|
|
339
|
+
- ✅ Containers referenced in `writesTo`/`readsFrom` exist
|
|
329
340
|
- ✅ Users/Teams referenced as owners exist
|
|
330
341
|
- ✅ Flow steps reference existing services/messages
|
|
331
342
|
- ✅ Entity properties reference existing entities
|
|
332
343
|
- ✅ Version-specific references are valid
|
|
344
|
+
- ✅ Orphan messages (no producer and no consumer) are detected
|
|
345
|
+
- ✅ References to deprecated resources are flagged
|
|
346
|
+
- ✅ Duplicate resource IDs (same type, id, and version) are detected
|
|
347
|
+
|
|
348
|
+
### Documentation Quality
|
|
349
|
+
|
|
350
|
+
- ✅ Resources have markdown body content (not just frontmatter)
|
|
351
|
+
- ✅ Events/Commands/Queries have a `schemaPath` defined
|
|
333
352
|
|
|
334
353
|
### Example EventCatalog Structure
|
|
335
354
|
|
|
@@ -641,11 +660,24 @@ The linter provides descriptive rule names in parentheses to help identify and f
|
|
|
641
660
|
- `(refs/owner-exists)` - Referenced owner (user/team) doesn't exist
|
|
642
661
|
- `(refs/valid-version-range)` - Referenced version doesn't exist or invalid pattern
|
|
643
662
|
- `(refs/resource-exists)` - Referenced resource doesn't exist
|
|
663
|
+
- `(refs/channel-exists)` - Referenced channel in sends/receives to/from doesn't exist
|
|
664
|
+
- `(refs/container-exists)` - Referenced container in writesTo/readsFrom doesn't exist
|
|
665
|
+
- `(refs/orphan-messages)` - Event/command/query has no producer and no consumer
|
|
644
666
|
|
|
645
667
|
### Best Practice Rules
|
|
646
668
|
|
|
647
669
|
- `(best-practices/summary-required)` - Summary field is missing
|
|
648
670
|
- `(best-practices/owner-required)` - At least one owner is required
|
|
671
|
+
- `(best-practices/description-required)` - Markdown body content is missing
|
|
672
|
+
- `(best-practices/schema-required)` - schemaPath is missing on event/command/query
|
|
673
|
+
|
|
674
|
+
### Versioning Rules
|
|
675
|
+
|
|
676
|
+
- `(versions/no-deprecated-references)` - Referencing a deprecated resource
|
|
677
|
+
|
|
678
|
+
### Structural Rules
|
|
679
|
+
|
|
680
|
+
- `(structure/duplicate-resource-ids)` - Duplicate resource with same type, id, and version
|
|
649
681
|
|
|
650
682
|
### Parse Errors
|
|
651
683
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventcatalog/linter",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A linter for EventCatalog to validate frontmatter and resource references",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/event-catalog/
|
|
7
|
+
"url": "https://github.com/event-catalog/eventcatalog"
|
|
8
8
|
},
|
|
9
|
-
"main": "dist/index.js",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.mjs",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
10
12
|
"bin": {
|
|
11
13
|
"eventcatalog-linter": "./dist/cli/index.js"
|
|
12
14
|
},
|
|
@@ -30,17 +32,15 @@
|
|
|
30
32
|
"gray-matter": "^4.0.3",
|
|
31
33
|
"ora": "^8.0.1",
|
|
32
34
|
"semver": "^7.7.2",
|
|
33
|
-
"zod": "^3.25.76"
|
|
35
|
+
"zod": "^3.25.76",
|
|
36
|
+
"@eventcatalog/sdk": "2.13.0"
|
|
34
37
|
},
|
|
35
38
|
"devDependencies": {
|
|
36
|
-
"@changesets/cli": "^2.27.7",
|
|
37
39
|
"@types/node": "^20.10.5",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^6.15.0",
|
|
39
|
-
"@typescript-eslint/parser": "^6.15.0",
|
|
40
40
|
"prettier": "^3.3.3",
|
|
41
|
-
"
|
|
41
|
+
"tsup": "^8.1.0",
|
|
42
42
|
"typescript": "^5.3.3",
|
|
43
|
-
"vitest": "^
|
|
43
|
+
"vitest": "^3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist"
|
|
@@ -49,14 +49,11 @@
|
|
|
49
49
|
"node": ">=16.0.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"build": "
|
|
53
|
-
"
|
|
54
|
-
"test": "vitest",
|
|
55
|
-
"test:
|
|
56
|
-
"typecheck": "tsc --noEmit",
|
|
52
|
+
"build": "tsup",
|
|
53
|
+
"build:bin": "tsup",
|
|
54
|
+
"test": "vitest --run",
|
|
55
|
+
"test:ci": "vitest --run",
|
|
57
56
|
"format": "prettier --write .",
|
|
58
|
-
"format:diff": "prettier --list-different ."
|
|
59
|
-
"changeset": "changeset",
|
|
60
|
-
"release": "changeset publish"
|
|
57
|
+
"format:diff": "prettier --list-different ."
|
|
61
58
|
}
|
|
62
59
|
}
|
package/dist/cli/index.d.ts
DELETED
package/dist/cli/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
package/dist/cli/index.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const commander_1 = require("commander");
|
|
8
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
-
const ora_1 = __importDefault(require("ora"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const scanner_1 = require("../scanner");
|
|
12
|
-
const parser_1 = require("../parser");
|
|
13
|
-
const validators_1 = require("../validators");
|
|
14
|
-
const reporters_1 = require("../reporters");
|
|
15
|
-
const config_1 = require("../config");
|
|
16
|
-
const program = new commander_1.Command();
|
|
17
|
-
program
|
|
18
|
-
.name('eventcatalog-linter')
|
|
19
|
-
.description('Lint your EventCatalog for frontmatter and reference validation')
|
|
20
|
-
.version('0.1.0')
|
|
21
|
-
.argument('[directory]', 'EventCatalog directory to lint', '.')
|
|
22
|
-
.option('-v, --verbose', 'Show verbose output', false)
|
|
23
|
-
.option('--fail-on-warning', 'Exit with non-zero code on warnings', false)
|
|
24
|
-
.action(async (directory, options) => {
|
|
25
|
-
const rootDir = path_1.default.resolve(directory);
|
|
26
|
-
const spinner = (0, ora_1.default)('Loading configuration...').start();
|
|
27
|
-
try {
|
|
28
|
-
// Load configuration
|
|
29
|
-
const config = (0, config_1.loadConfig)(rootDir);
|
|
30
|
-
const dependencies = (0, config_1.loadEventCatalogConfig)(rootDir);
|
|
31
|
-
spinner.text = 'Scanning EventCatalog files...';
|
|
32
|
-
const allFiles = await (0, scanner_1.scanCatalogFiles)(rootDir);
|
|
33
|
-
// Filter out ignored files
|
|
34
|
-
const files = allFiles.filter((file) => !(0, config_1.shouldIgnoreFile)(file.relativePath, config.ignorePatterns || []));
|
|
35
|
-
const ignoredCount = allFiles.length - files.length;
|
|
36
|
-
if (ignoredCount > 0) {
|
|
37
|
-
spinner.text = `Found ${files.length} catalog files (${ignoredCount} ignored)`;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
spinner.text = `Found ${files.length} catalog files`;
|
|
41
|
-
}
|
|
42
|
-
if (files.length === 0) {
|
|
43
|
-
spinner.warn('No EventCatalog files found');
|
|
44
|
-
process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
spinner.text = 'Parsing frontmatter...';
|
|
47
|
-
const { parsed, errors: parseErrors } = await (0, parser_1.parseAllFiles)(files);
|
|
48
|
-
spinner.text = 'Validating catalog...';
|
|
49
|
-
const rawValidationErrors = (0, validators_1.validateCatalog)(parsed, dependencies);
|
|
50
|
-
// Apply rule configuration to each file's errors
|
|
51
|
-
const validationErrors = parsed.flatMap((parsedFile) => {
|
|
52
|
-
const fileErrors = rawValidationErrors.filter((error) => error.file === parsedFile.file.relativePath);
|
|
53
|
-
const effectiveRules = (0, config_1.getEffectiveRules)(parsedFile.file.relativePath, config);
|
|
54
|
-
return (0, config_1.applyRuleSeverity)(fileErrors, effectiveRules);
|
|
55
|
-
});
|
|
56
|
-
spinner.stop();
|
|
57
|
-
const summary = (0, reporters_1.reportErrors)(validationErrors, parseErrors, options.verbose);
|
|
58
|
-
// Show scan summary
|
|
59
|
-
if (summary.totalErrors === 0) {
|
|
60
|
-
console.log(chalk_1.default.dim(`\n ${files.length} files checked`));
|
|
61
|
-
}
|
|
62
|
-
if (summary.totalErrors > 0 || (options.failOnWarning && summary.totalWarnings > 0)) {
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
spinner.fail('An error occurred');
|
|
68
|
-
console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
program.parse();
|
|
73
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;;;AAEA,yCAAoC;AACpC,kDAA0B;AAC1B,8CAAsB;AACtB,gDAAwB;AACxB,wCAA8C;AAC9C,sCAA0C;AAC1C,8CAAgD;AAChD,4CAA4C;AAE5C,sCAAuH;AAEvH,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,qBAAqB,CAAC;KAC3B,WAAW,CAAC,iEAAiE,CAAC;KAC9E,OAAO,CAAC,OAAO,CAAC;KAChB,QAAQ,CAAC,aAAa,EAAE,gCAAgC,EAAE,GAAG,CAAC;KAC9D,MAAM,CAAC,eAAe,EAAE,qBAAqB,EAAE,KAAK,CAAC;KACrD,MAAM,CAAC,mBAAmB,EAAE,qCAAqC,EAAE,KAAK,CAAC;KACzE,MAAM,CAAC,KAAK,EAAE,SAAiB,EAAE,OAA+B,EAAE,EAAE;IACnE,MAAM,OAAO,GA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AC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/config/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ValidationError } from '../types';
|
|
2
|
-
export type RuleSeverity = 'error' | 'warn' | 'off';
|
|
3
|
-
export interface RuleConfig {
|
|
4
|
-
severity: RuleSeverity;
|
|
5
|
-
options?: Record<string, any>;
|
|
6
|
-
}
|
|
7
|
-
export interface ConfigOverride {
|
|
8
|
-
files: string[];
|
|
9
|
-
rules: Record<string, RuleSeverity | [RuleSeverity, Record<string, any>]>;
|
|
10
|
-
}
|
|
11
|
-
export interface LinterConfig {
|
|
12
|
-
rules: Record<string, RuleSeverity | [RuleSeverity, Record<string, any>]>;
|
|
13
|
-
ignorePatterns?: string[];
|
|
14
|
-
overrides?: ConfigOverride[];
|
|
15
|
-
}
|
|
16
|
-
export declare const DEFAULT_IGNORE_PATTERNS: string[];
|
|
17
|
-
export declare const DEFAULT_RULES: Record<string, RuleSeverity>;
|
|
18
|
-
export interface DependencyEntry {
|
|
19
|
-
id: string;
|
|
20
|
-
version?: string;
|
|
21
|
-
}
|
|
22
|
-
export type CatalogDependencies = Record<string, DependencyEntry[]>;
|
|
23
|
-
export declare const loadEventCatalogConfig: (rootDir: string) => CatalogDependencies;
|
|
24
|
-
export declare const loadConfig: (rootDir: string) => LinterConfig;
|
|
25
|
-
export declare const parseRuleConfig: (rule: RuleSeverity | [RuleSeverity, Record<string, any>]) => RuleConfig;
|
|
26
|
-
export declare const shouldIgnoreFile: (filePath: string, ignorePatterns: string[]) => boolean;
|
|
27
|
-
export declare const getEffectiveRules: (filePath: string, config: LinterConfig) => Record<string, RuleConfig>;
|
|
28
|
-
export declare const applyRuleSeverity: (errors: ValidationError[], rules: Record<string, RuleConfig>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,MAAM,KAAG,YAiC5C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAG,UAW1F,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,EAAE,gBAAgB,MAAM,EAAE,KAAG,OAgB7E,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,EAAE,QAAQ,YAAY,KAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAwBnG,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,EAAE,EAAE,OAAO,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,KAAG,eAAe,EAmB/G,CAAC"}
|
package/dist/config/index.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.applyRuleSeverity = exports.getEffectiveRules = exports.shouldIgnoreFile = exports.parseRuleConfig = exports.loadConfig = exports.loadEventCatalogConfig = exports.DEFAULT_RULES = exports.DEFAULT_IGNORE_PATTERNS = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
exports.DEFAULT_IGNORE_PATTERNS = ['dependencies/**'];
|
|
10
|
-
exports.DEFAULT_RULES = {
|
|
11
|
-
'schema/required-fields': 'error',
|
|
12
|
-
'schema/valid-semver': 'error',
|
|
13
|
-
'schema/valid-email': 'error',
|
|
14
|
-
'refs/owner-exists': 'error',
|
|
15
|
-
'refs/valid-version-range': 'error',
|
|
16
|
-
'best-practices/summary-required': 'error',
|
|
17
|
-
'best-practices/owner-required': 'error',
|
|
18
|
-
'naming/service-id-format': 'error',
|
|
19
|
-
'naming/event-id-format': 'error',
|
|
20
|
-
'versions/consistent-format': 'error',
|
|
21
|
-
'versions/no-deprecated': 'error',
|
|
22
|
-
};
|
|
23
|
-
const PLURAL_TO_SINGULAR = {
|
|
24
|
-
events: 'event',
|
|
25
|
-
commands: 'command',
|
|
26
|
-
queries: 'query',
|
|
27
|
-
services: 'service',
|
|
28
|
-
domains: 'domain',
|
|
29
|
-
entities: 'entity',
|
|
30
|
-
channels: 'channel',
|
|
31
|
-
flows: 'flow',
|
|
32
|
-
users: 'user',
|
|
33
|
-
teams: 'team',
|
|
34
|
-
};
|
|
35
|
-
const loadEventCatalogConfig = (rootDir) => {
|
|
36
|
-
const configPath = path_1.default.join(rootDir, 'eventcatalog.config.js');
|
|
37
|
-
if (!fs_1.default.existsSync(configPath)) {
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
delete require.cache[require.resolve(configPath)];
|
|
42
|
-
const config = require(configPath);
|
|
43
|
-
if (!config.dependencies || typeof config.dependencies !== 'object') {
|
|
44
|
-
return {};
|
|
45
|
-
}
|
|
46
|
-
const dependencies = {};
|
|
47
|
-
for (const [pluralKey, entries] of Object.entries(config.dependencies)) {
|
|
48
|
-
const singularType = PLURAL_TO_SINGULAR[pluralKey];
|
|
49
|
-
if (!singularType || !Array.isArray(entries))
|
|
50
|
-
continue;
|
|
51
|
-
dependencies[singularType] = entries
|
|
52
|
-
.filter((entry) => entry && typeof entry.id === 'string')
|
|
53
|
-
.map((entry) => ({ id: entry.id, version: entry.version }));
|
|
54
|
-
}
|
|
55
|
-
return dependencies;
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.warn(`Warning: Could not load eventcatalog.config.js: ${error instanceof Error ? error.message : String(error)}`);
|
|
59
|
-
return {};
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
exports.loadEventCatalogConfig = loadEventCatalogConfig;
|
|
63
|
-
const loadConfig = (rootDir) => {
|
|
64
|
-
const configPath = path_1.default.join(rootDir, '.eventcatalogrc.js');
|
|
65
|
-
if (!fs_1.default.existsSync(configPath)) {
|
|
66
|
-
// Return default config if no config file exists
|
|
67
|
-
return {
|
|
68
|
-
rules: exports.DEFAULT_RULES,
|
|
69
|
-
ignorePatterns: exports.DEFAULT_IGNORE_PATTERNS,
|
|
70
|
-
overrides: [],
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
try {
|
|
74
|
-
// Clear module cache to ensure fresh load
|
|
75
|
-
delete require.cache[require.resolve(configPath)];
|
|
76
|
-
const config = require(configPath);
|
|
77
|
-
// Merge with defaults
|
|
78
|
-
const mergedConfig = {
|
|
79
|
-
rules: { ...exports.DEFAULT_RULES, ...config.rules },
|
|
80
|
-
ignorePatterns: [...exports.DEFAULT_IGNORE_PATTERNS, ...(config.ignorePatterns || [])],
|
|
81
|
-
overrides: config.overrides || [],
|
|
82
|
-
};
|
|
83
|
-
return mergedConfig;
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
console.warn(`Warning: Could not load .eventcatalogrc.js: ${error instanceof Error ? error.message : String(error)}`);
|
|
87
|
-
return {
|
|
88
|
-
rules: exports.DEFAULT_RULES,
|
|
89
|
-
ignorePatterns: exports.DEFAULT_IGNORE_PATTERNS,
|
|
90
|
-
overrides: [],
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
exports.loadConfig = loadConfig;
|
|
95
|
-
const parseRuleConfig = (rule) => {
|
|
96
|
-
if (Array.isArray(rule)) {
|
|
97
|
-
return {
|
|
98
|
-
severity: rule[0],
|
|
99
|
-
options: rule[1],
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
severity: rule,
|
|
104
|
-
options: {},
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
exports.parseRuleConfig = parseRuleConfig;
|
|
108
|
-
const shouldIgnoreFile = (filePath, ignorePatterns) => {
|
|
109
|
-
if (!ignorePatterns || ignorePatterns.length === 0) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
113
|
-
for (const pattern of ignorePatterns) {
|
|
114
|
-
// Simple glob matching for now
|
|
115
|
-
const regex = new RegExp(pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*'));
|
|
116
|
-
if (regex.test(normalizedPath)) {
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return false;
|
|
121
|
-
};
|
|
122
|
-
exports.shouldIgnoreFile = shouldIgnoreFile;
|
|
123
|
-
const getEffectiveRules = (filePath, config) => {
|
|
124
|
-
let effectiveRules = { ...config.rules };
|
|
125
|
-
// Apply overrides
|
|
126
|
-
if (config.overrides) {
|
|
127
|
-
for (const override of config.overrides) {
|
|
128
|
-
const matchesFile = override.files.some((pattern) => {
|
|
129
|
-
const regex = new RegExp(pattern.replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*'));
|
|
130
|
-
return regex.test(filePath);
|
|
131
|
-
});
|
|
132
|
-
if (matchesFile) {
|
|
133
|
-
effectiveRules = { ...effectiveRules, ...override.rules };
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// Parse rules into RuleConfig objects
|
|
138
|
-
const parsedRules = {};
|
|
139
|
-
for (const [ruleName, ruleValue] of Object.entries(effectiveRules)) {
|
|
140
|
-
parsedRules[ruleName] = (0, exports.parseRuleConfig)(ruleValue);
|
|
141
|
-
}
|
|
142
|
-
return parsedRules;
|
|
143
|
-
};
|
|
144
|
-
exports.getEffectiveRules = getEffectiveRules;
|
|
145
|
-
const applyRuleSeverity = (errors, rules) => {
|
|
146
|
-
const result = [];
|
|
147
|
-
for (const error of errors) {
|
|
148
|
-
// Map validation errors to rule names
|
|
149
|
-
const ruleName = mapErrorToRuleName(error);
|
|
150
|
-
const rule = rules[ruleName];
|
|
151
|
-
if (!rule || rule.severity === 'off') {
|
|
152
|
-
continue; // Skip disabled rules
|
|
153
|
-
}
|
|
154
|
-
result.push({
|
|
155
|
-
...error,
|
|
156
|
-
severity: rule.severity === 'warn' ? 'warning' : 'error',
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return result;
|
|
160
|
-
};
|
|
161
|
-
exports.applyRuleSeverity = applyRuleSeverity;
|
|
162
|
-
const mapErrorToRuleName = (error) => {
|
|
163
|
-
// Map validation errors to rule names based on the error type and content
|
|
164
|
-
if (error.type === 'schema') {
|
|
165
|
-
// Check field-specific rules first
|
|
166
|
-
if (error.field === 'summary') {
|
|
167
|
-
return 'best-practices/summary-required';
|
|
168
|
-
}
|
|
169
|
-
if (error.field === 'owners') {
|
|
170
|
-
return 'best-practices/owner-required';
|
|
171
|
-
}
|
|
172
|
-
// Check message content for specific validation types
|
|
173
|
-
if (error.message.includes('email') || error.message.includes('Invalid email')) {
|
|
174
|
-
return 'schema/valid-email';
|
|
175
|
-
}
|
|
176
|
-
if (error.message.includes('version') || error.message.includes('semantic')) {
|
|
177
|
-
return 'schema/valid-semver';
|
|
178
|
-
}
|
|
179
|
-
if (error.message.includes('Required') || error.message.includes('Expected')) {
|
|
180
|
-
return 'schema/required-fields';
|
|
181
|
-
}
|
|
182
|
-
return 'schema/required-fields';
|
|
183
|
-
}
|
|
184
|
-
if (error.type === 'reference') {
|
|
185
|
-
if (error.message.includes('user') || error.message.includes('team')) {
|
|
186
|
-
return 'refs/owner-exists';
|
|
187
|
-
}
|
|
188
|
-
if (error.message.includes('version')) {
|
|
189
|
-
return 'refs/valid-version-range';
|
|
190
|
-
}
|
|
191
|
-
// Service, domain, entity, and other references are always validated and not configurable
|
|
192
|
-
return 'schema/required-fields'; // Map to a default rule so they remain as errors
|
|
193
|
-
}
|
|
194
|
-
return 'schema/required-fields';
|
|
195
|
-
};
|
|
196
|
-
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./schemas"), exports);
|
|
19
|
-
__exportStar(require("./scanner"), exports);
|
|
20
|
-
__exportStar(require("./parser"), exports);
|
|
21
|
-
__exportStar(require("./validators"), exports);
|
|
22
|
-
__exportStar(require("./reporters"), exports);
|
|
23
|
-
__exportStar(require("./config"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,+CAA6B;AAC7B,8CAA4B;AAC5B,2CAAyB"}
|
package/dist/parser/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CatalogFile } from '../scanner';
|
|
2
|
-
export interface ParsedFile {
|
|
3
|
-
file: CatalogFile;
|
|
4
|
-
frontmatter: Record<string, unknown>;
|
|
5
|
-
content: string;
|
|
6
|
-
raw: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ParseError {
|
|
9
|
-
file: CatalogFile;
|
|
10
|
-
error: Error;
|
|
11
|
-
}
|
|
12
|
-
export declare const parseFrontmatter: (file: CatalogFile) => Promise<ParsedFile | ParseError>;
|
|
13
|
-
export declare const parseAllFiles: (files: CatalogFile[]) => Promise<{
|
|
14
|
-
parsed: ParsedFile[];
|
|
15
|
-
errors: ParseError[];
|
|
16
|
-
}>;
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC;CACd;AAED,eAAO,MAAM,gBAAgB,GAAU,MAAM,WAAW,KAAG,OAAO,CAAC,UAAU,GAAG,UAAU,CAiBzF,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,OAAO,WAAW,EAAE,KACnB,OAAO,CAAC;IACT,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB,CAeA,CAAC"}
|
package/dist/parser/index.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseAllFiles = exports.parseFrontmatter = void 0;
|
|
7
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
-
const gray_matter_1 = __importDefault(require("gray-matter"));
|
|
9
|
-
const parseFrontmatter = async (file) => {
|
|
10
|
-
try {
|
|
11
|
-
const fileContent = await promises_1.default.readFile(file.path, 'utf-8');
|
|
12
|
-
const { data, content } = (0, gray_matter_1.default)(fileContent);
|
|
13
|
-
return {
|
|
14
|
-
file,
|
|
15
|
-
frontmatter: data,
|
|
16
|
-
content,
|
|
17
|
-
raw: fileContent,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return {
|
|
22
|
-
file,
|
|
23
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.parseFrontmatter = parseFrontmatter;
|
|
28
|
-
const parseAllFiles = async (files) => {
|
|
29
|
-
const results = await Promise.all(files.map(exports.parseFrontmatter));
|
|
30
|
-
const parsed = [];
|
|
31
|
-
const errors = [];
|
|
32
|
-
for (const result of results) {
|
|
33
|
-
if ('error' in result) {
|
|
34
|
-
errors.push(result);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
parsed.push(result);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return { parsed, errors };
|
|
41
|
-
};
|
|
42
|
-
exports.parseAllFiles = parseAllFiles;
|
|
43
|
-
//# sourceMappingURL=index.js.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CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC,CAAC;AApBW,QAAA,aAAa,iBAoBxB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ValidationError } from '../types';
|
|
2
|
-
import { ParseError } from '../parser';
|
|
3
|
-
export interface ReportSummary {
|
|
4
|
-
totalErrors: number;
|
|
5
|
-
totalWarnings: number;
|
|
6
|
-
schemaErrors: number;
|
|
7
|
-
referenceErrors: number;
|
|
8
|
-
parseErrors: number;
|
|
9
|
-
filesChecked: number;
|
|
10
|
-
filesWithErrors: number;
|
|
11
|
-
}
|
|
12
|
-
export declare const formatError: (error: ValidationError, showFilename?: boolean) => string;
|
|
13
|
-
export declare const formatParseError: (error: ParseError, showFilename?: boolean) => string;
|
|
14
|
-
export declare const groupErrorsByFile: (errors: ValidationError[]) => Map<string, ValidationError[]>;
|
|
15
|
-
export declare const reportErrors: (validationErrors: ValidationError[], parseErrors: ParseError[], verbose?: boolean) => ReportSummary;
|
|
16
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,eAAe,EAAE,eAAc,OAAc,KAAG,MAelF,CAAC;AAsBF,eAAO,MAAM,gBAAgB,GAAI,OAAO,UAAU,EAAE,eAAc,OAAc,KAAG,MAWlF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,QAAQ,eAAe,EAAE,KAAG,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAW1F,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,kBAAkB,eAAe,EAAE,EACnC,aAAa,UAAU,EAAE,EACzB,UAAS,OAAe,KACvB,aAyFF,CAAC"}
|