@nielspeter/eess-ts 0.4.0 → 0.5.0
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/dist/builders/call-rule-builder.d.ts.map +1 -1
- package/dist/builders/call-rule-builder.js +2 -1
- package/dist/builders/call-rule-builder.js.map +1 -1
- package/dist/builders/class-rule-builder.d.ts.map +1 -1
- package/dist/builders/class-rule-builder.js +7 -25
- package/dist/builders/class-rule-builder.js.map +1 -1
- package/dist/builders/correspondence-builder.d.ts.map +1 -1
- package/dist/builders/correspondence-builder.js +6 -14
- package/dist/builders/correspondence-builder.js.map +1 -1
- package/dist/builders/cross-layer-builder.d.ts.map +1 -1
- package/dist/builders/cross-layer-builder.js +7 -6
- package/dist/builders/cross-layer-builder.js.map +1 -1
- package/dist/builders/function-rule-builder.d.ts.map +1 -1
- package/dist/builders/function-rule-builder.js +4 -13
- package/dist/builders/function-rule-builder.js.map +1 -1
- package/dist/builders/module-rule-builder.d.ts.map +1 -1
- package/dist/builders/module-rule-builder.js +4 -16
- package/dist/builders/module-rule-builder.js.map +1 -1
- package/dist/builders/slice-rule-builder.d.ts.map +1 -1
- package/dist/builders/slice-rule-builder.js +4 -3
- package/dist/builders/slice-rule-builder.js.map +1 -1
- package/dist/builders/type-rule-builder.d.ts.map +1 -1
- package/dist/builders/type-rule-builder.js +4 -13
- package/dist/builders/type-rule-builder.js.map +1 -1
- package/dist/cli/commands/baseline.d.ts +5 -1
- package/dist/cli/commands/baseline.d.ts.map +1 -1
- package/dist/cli/commands/baseline.js +47 -5
- package/dist/cli/commands/baseline.js.map +1 -1
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +155 -13
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/explain.js +1 -1
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/init.js +1 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/import-rule-module.d.ts.map +1 -1
- package/dist/cli/import-rule-module.js +1 -14
- package/dist/cli/import-rule-module.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +4 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/load-rules.d.ts.map +1 -1
- package/dist/cli/load-rules.js +5 -4
- package/dist/cli/load-rules.js.map +1 -1
- package/dist/cli/resolve-config.d.ts +0 -8
- package/dist/cli/resolve-config.d.ts.map +1 -1
- package/dist/cli/resolve-config.js +18 -48
- package/dist/cli/resolve-config.js.map +1 -1
- package/dist/cli/rule-file-findings.d.ts.map +1 -1
- package/dist/cli/rule-file-findings.js +60 -2
- package/dist/cli/rule-file-findings.js.map +1 -1
- package/dist/cli/watch.d.ts +13 -43
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +8 -148
- package/dist/cli/watch.js.map +1 -1
- package/dist/conditions/call.d.ts.map +1 -1
- package/dist/conditions/call.js +4 -3
- package/dist/conditions/call.js.map +1 -1
- package/dist/conditions/cross-layer.js +2 -2
- package/dist/conditions/cross-layer.js.map +1 -1
- package/dist/conditions/dependency.js +2 -2
- package/dist/conditions/dependency.js.map +1 -1
- package/dist/conditions/exports.d.ts.map +1 -1
- package/dist/conditions/exports.js +31 -37
- package/dist/conditions/exports.js.map +1 -1
- package/dist/conditions/function.js +1 -1
- package/dist/conditions/function.js.map +1 -1
- package/dist/conditions/jsx.js +1 -1
- package/dist/conditions/jsx.js.map +1 -1
- package/dist/conditions/members.d.ts.map +1 -1
- package/dist/conditions/members.js +3 -2
- package/dist/conditions/members.js.map +1 -1
- package/dist/conditions/reverse-dependency.d.ts.map +1 -1
- package/dist/conditions/reverse-dependency.js +47 -2
- package/dist/conditions/reverse-dependency.js.map +1 -1
- package/dist/conditions/slice.js +1 -1
- package/dist/conditions/slice.js.map +1 -1
- package/dist/conditions/structural.js +1 -1
- package/dist/conditions/structural.js.map +1 -1
- package/dist/core/check-all.d.ts.map +1 -1
- package/dist/core/check-all.js +61 -7
- package/dist/core/check-all.js.map +1 -1
- package/dist/core/combinators.d.ts.map +1 -1
- package/dist/core/combinators.js +20 -27
- package/dist/core/combinators.js.map +1 -1
- package/dist/core/descendant-cache.d.ts.map +1 -1
- package/dist/core/descendant-cache.js +5 -7
- package/dist/core/descendant-cache.js.map +1 -1
- package/dist/core/diagnose.js +15 -7
- package/dist/core/diagnose.js.map +1 -1
- package/dist/core/disk-set.js +1 -1
- package/dist/core/disk-set.js.map +1 -1
- package/dist/core/element-cache.js +1 -1
- package/dist/core/element-cache.js.map +1 -1
- package/dist/core/exclusion-comments.d.ts +15 -50
- package/dist/core/exclusion-comments.d.ts.map +1 -1
- package/dist/core/exclusion-comments.js +4 -307
- package/dist/core/exclusion-comments.js.map +1 -1
- package/dist/core/execute-rule.d.ts +8 -0
- package/dist/core/execute-rule.d.ts.map +1 -1
- package/dist/core/execute-rule.js +99 -13
- package/dist/core/execute-rule.js.map +1 -1
- package/dist/core/glob-evaluator.js +2 -2
- package/dist/core/glob-evaluator.js.map +1 -1
- package/dist/core/invalidate-on-modify.d.ts +20 -0
- package/dist/core/invalidate-on-modify.d.ts.map +1 -0
- package/dist/core/invalidate-on-modify.js +26 -0
- package/dist/core/invalidate-on-modify.js.map +1 -0
- package/dist/core/line-index.d.ts.map +1 -1
- package/dist/core/line-index.js +6 -8
- package/dist/core/line-index.js.map +1 -1
- package/dist/core/metric-violation.d.ts +1 -1
- package/dist/core/module-edges.d.ts.map +1 -1
- package/dist/core/module-edges.js +26 -25
- package/dist/core/module-edges.js.map +1 -1
- package/dist/core/orphan-exclusions.d.ts.map +1 -1
- package/dist/core/orphan-exclusions.js +15 -5
- package/dist/core/orphan-exclusions.js.map +1 -1
- package/dist/core/path-universe.d.ts +10 -42
- package/dist/core/path-universe.d.ts.map +1 -1
- package/dist/core/path-universe.js +0 -20
- package/dist/core/path-universe.js.map +1 -1
- package/dist/core/project.d.ts.map +1 -1
- package/dist/core/project.js +6 -5
- package/dist/core/project.js.map +1 -1
- package/dist/core/rule-builder.d.ts +22 -1
- package/dist/core/rule-builder.d.ts.map +1 -1
- package/dist/core/rule-builder.js +38 -20
- package/dist/core/rule-builder.js.map +1 -1
- package/dist/core/rule-declaration.d.ts.map +1 -1
- package/dist/core/rule-declaration.js +14 -52
- package/dist/core/rule-declaration.js.map +1 -1
- package/dist/core/terminal-builder.d.ts +17 -13
- package/dist/core/terminal-builder.d.ts.map +1 -1
- package/dist/core/terminal-builder.js +41 -21
- package/dist/core/terminal-builder.js.map +1 -1
- package/dist/core/terminal-execution.d.ts +22 -6
- package/dist/core/terminal-execution.d.ts.map +1 -1
- package/dist/core/terminal-execution.js +39 -7
- package/dist/core/terminal-execution.js.map +1 -1
- package/dist/core/ts-comment-mask.d.ts +2 -0
- package/dist/core/ts-comment-mask.d.ts.map +1 -0
- package/dist/core/ts-comment-mask.js +102 -0
- package/dist/core/ts-comment-mask.js.map +1 -0
- package/dist/core/vacuity-diagnosis.js +1 -1
- package/dist/core/vacuity-diagnosis.js.map +1 -1
- package/dist/graphql/graphql-rule-builder.d.ts +95 -0
- package/dist/graphql/graphql-rule-builder.d.ts.map +1 -0
- package/dist/graphql/graphql-rule-builder.js +127 -0
- package/dist/graphql/graphql-rule-builder.js.map +1 -0
- package/dist/graphql/index.d.ts +1 -0
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +1 -0
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/resolver-rule-builder.d.ts +22 -76
- package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
- package/dist/graphql/resolver-rule-builder.js +8 -130
- package/dist/graphql/resolver-rule-builder.js.map +1 -1
- package/dist/graphql/schema-loader.d.ts.map +1 -1
- package/dist/graphql/schema-loader.js +4 -3
- package/dist/graphql/schema-loader.js.map +1 -1
- package/dist/graphql/schema-predicates.d.ts.map +1 -1
- package/dist/graphql/schema-predicates.js +17 -12
- package/dist/graphql/schema-predicates.js.map +1 -1
- package/dist/graphql/schema-rule-builder.d.ts +21 -67
- package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
- package/dist/graphql/schema-rule-builder.js +6 -120
- package/dist/graphql/schema-rule-builder.js.map +1 -1
- package/dist/helpers/baseline-generator.d.ts +9 -0
- package/dist/helpers/baseline-generator.d.ts.map +1 -1
- package/dist/helpers/baseline-generator.js +9 -0
- package/dist/helpers/baseline-generator.js.map +1 -1
- package/dist/helpers/baseline.d.ts.map +1 -1
- package/dist/helpers/baseline.js +4 -4
- package/dist/helpers/baseline.js.map +1 -1
- package/dist/helpers/body-traversal.d.ts.map +1 -1
- package/dist/helpers/body-traversal.js +13 -0
- package/dist/helpers/body-traversal.js.map +1 -1
- package/dist/helpers/callback-extractor.js +6 -38
- package/dist/helpers/callback-extractor.js.map +1 -1
- package/dist/helpers/complexity.d.ts +1 -1
- package/dist/helpers/complexity.js +1 -1
- package/dist/helpers/diff-aware.d.ts +11 -39
- package/dist/helpers/diff-aware.d.ts.map +1 -1
- package/dist/helpers/diff-aware.js +11 -79
- package/dist/helpers/diff-aware.js.map +1 -1
- package/dist/helpers/matchers.d.ts.map +1 -1
- package/dist/helpers/matchers.js +51 -67
- package/dist/helpers/matchers.js.map +1 -1
- package/dist/index.d.ts +15 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -18
- package/dist/index.js.map +1 -1
- package/dist/models/arch-function.d.ts +26 -2
- package/dist/models/arch-function.d.ts.map +1 -1
- package/dist/models/arch-function.js +51 -17
- package/dist/models/arch-function.js.map +1 -1
- package/dist/models/arch-jsx-element.d.ts.map +1 -1
- package/dist/models/arch-jsx-element.js +16 -17
- package/dist/models/arch-jsx-element.js.map +1 -1
- package/dist/predicates/jsx.d.ts.map +1 -1
- package/dist/predicates/jsx.js +2 -1
- package/dist/predicates/jsx.js.map +1 -1
- package/dist/presets/agent-guardrails.d.ts +29 -3
- package/dist/presets/agent-guardrails.d.ts.map +1 -1
- package/dist/presets/agent-guardrails.js +185 -1
- package/dist/presets/agent-guardrails.js.map +1 -1
- package/dist/presets/boundaries.d.ts +2 -2
- package/dist/presets/boundaries.d.ts.map +1 -1
- package/dist/presets/data-layer.d.ts +2 -2
- package/dist/presets/data-layer.d.ts.map +1 -1
- package/dist/presets/index.d.ts +4 -1
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +11 -1
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/layered.d.ts +2 -2
- package/dist/presets/layered.d.ts.map +1 -1
- package/dist/presets/recommended.d.ts +3 -3
- package/dist/presets/recommended.d.ts.map +1 -1
- package/dist/presets/shared.d.ts +8 -11
- package/dist/presets/shared.d.ts.map +1 -1
- package/dist/presets/shared.js +57 -28
- package/dist/presets/shared.js.map +1 -1
- package/dist/rules/metrics-function.d.ts.map +1 -1
- package/dist/rules/metrics-function.js +59 -62
- package/dist/rules/metrics-function.js.map +1 -1
- package/dist/rules/metrics.d.ts.map +1 -1
- package/dist/rules/metrics.js +62 -59
- package/dist/rules/metrics.js.map +1 -1
- package/dist/smells/clusters.d.ts +78 -0
- package/dist/smells/clusters.d.ts.map +1 -0
- package/dist/smells/clusters.js +124 -0
- package/dist/smells/clusters.js.map +1 -0
- package/dist/smells/duplicate-bodies.d.ts +38 -4
- package/dist/smells/duplicate-bodies.d.ts.map +1 -1
- package/dist/smells/duplicate-bodies.js +93 -44
- package/dist/smells/duplicate-bodies.js.map +1 -1
- package/dist/smells/duplicate-report.d.ts +90 -0
- package/dist/smells/duplicate-report.d.ts.map +1 -0
- package/dist/smells/duplicate-report.js +344 -0
- package/dist/smells/duplicate-report.js.map +1 -0
- package/dist/smells/fingerprint.d.ts +12 -0
- package/dist/smells/fingerprint.d.ts.map +1 -1
- package/dist/smells/fingerprint.js +8 -2
- package/dist/smells/fingerprint.js.map +1 -1
- package/dist/smells/inconsistent-siblings.js +1 -1
- package/dist/smells/inconsistent-siblings.js.map +1 -1
- package/dist/smells/similar-pairs.d.ts +9 -8
- package/dist/smells/similar-pairs.d.ts.map +1 -1
- package/dist/smells/similar-pairs.js +83 -1
- package/dist/smells/similar-pairs.js.map +1 -1
- package/dist/smells/smell-builder.d.ts.map +1 -1
- package/dist/smells/smell-builder.js +3 -2
- package/dist/smells/smell-builder.js.map +1 -1
- package/dist/smells/variation.d.ts +47 -0
- package/dist/smells/variation.d.ts.map +1 -0
- package/dist/smells/variation.js +90 -0
- package/dist/smells/variation.js.map +1 -0
- package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
- package/dist/tsconfig/tsconfig-builder.js +3 -2
- package/dist/tsconfig/tsconfig-builder.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-comment-mask.d.ts","sourceRoot":"","sources":["../../src/core/ts-comment-mask.ts"],"names":[],"mappings":"AAoEA,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoC3E"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { Project, SyntaxKind } from 'ts-morph';
|
|
3
|
+
/**
|
|
4
|
+
* `eess-ts`'s comment masker, injected into the kernel's one exclusion-comment
|
|
5
|
+
* parser (ADR-012).
|
|
6
|
+
*
|
|
7
|
+
* The kernel has no AST and cannot get one — it declares zero dependencies so
|
|
8
|
+
* that `eess-md` does not inherit a TypeScript parser. Its default masker is a
|
|
9
|
+
* regex scan, which is correct but coarse. This is the accurate version for
|
|
10
|
+
* TypeScript, and it is all that ever justified `eess-ts` carrying a second copy
|
|
11
|
+
* of the parser. Now only the masker is this package's; the parsing is not.
|
|
12
|
+
*
|
|
13
|
+
* The kernel composes: this runs first, its default runs over the output. So
|
|
14
|
+
* this can only blank MORE than the default, never less.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Every string-like literal, blanked — [ts-archunit bug 0043](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0043-an-exclusion-directive-inside-a-string-literal-suppresses.md).
|
|
18
|
+
*
|
|
19
|
+
* The scan below is line-based, and a line-based scan cannot tell a directive
|
|
20
|
+
* from the same characters inside a string. Measured before this existed: all
|
|
21
|
+
* three of `"…"`, `'…'` and `` `…` `` containing the directive text produced a
|
|
22
|
+
* **live exclusion** that silenced a real finding — silently, because a
|
|
23
|
+
* directive carrying a reason never triggers the undocumented-exclusion warning.
|
|
24
|
+
*
|
|
25
|
+
* **Newlines are preserved**, and that is the load-bearing part: the scan below
|
|
26
|
+
* is line-based and reports `line` on every exclusion, so a mask that dropped a
|
|
27
|
+
* newline would misreport every directive after it.
|
|
28
|
+
*
|
|
29
|
+
* Characters are replaced with spaces rather than removed, which keeps
|
|
30
|
+
* intra-line offsets stable too — but nothing downstream consumes a column, so
|
|
31
|
+
* that half is defence in depth rather than a guarded property. Measured:
|
|
32
|
+
* collapsing the blanks to `''`, and masking one character short, both leave the
|
|
33
|
+
* suite green. Recorded rather than dressed up — a sabotage row that survives
|
|
34
|
+
* for a real reason is a different thing from a missing guard.
|
|
35
|
+
*
|
|
36
|
+
* ## Why a parse, and not a scan
|
|
37
|
+
*
|
|
38
|
+
* The first attempt used `ts.createScanner`, which is the real lexer and fixed
|
|
39
|
+
* the three plain cases. It left two: `` `${x} // …` `` and JSX text. A bare
|
|
40
|
+
* scanner has no parser context, so it cannot know when to re-scan a template
|
|
41
|
+
* middle or JSX children, and both were classified as code — meaning the `//`
|
|
42
|
+
* inside them became a comment. Measured, not predicted.
|
|
43
|
+
*
|
|
44
|
+
* So: parse, and blank the literals. Everything remaining is code, where `//`
|
|
45
|
+
* genuinely does start a comment.
|
|
46
|
+
*
|
|
47
|
+
* A **ts-morph** project rather than the raw compiler API, per
|
|
48
|
+
* [ADR-002](../../../../adr/002-ts-morph-ast-engine.md), reusing one in-memory project
|
|
49
|
+
* across calls so the cost is a parse rather than a project construction. The
|
|
50
|
+
* whole scan is gated on a rule having already produced a violation in the file,
|
|
51
|
+
* so nothing is parsed for a clean run.
|
|
52
|
+
*
|
|
53
|
+
* A `TemplateExpression` is blanked **whole**, including its `${…}`
|
|
54
|
+
* substitutions. A comment is legal inside a substitution, so this can miss a
|
|
55
|
+
* real directive there — it errs toward *not* suppressing, which is the safe
|
|
56
|
+
* direction for a mechanism whose failure mode is a silent green.
|
|
57
|
+
*/
|
|
58
|
+
const LITERAL_KINDS = [
|
|
59
|
+
SyntaxKind.StringLiteral,
|
|
60
|
+
SyntaxKind.NoSubstitutionTemplateLiteral,
|
|
61
|
+
SyntaxKind.TemplateExpression,
|
|
62
|
+
SyntaxKind.RegularExpressionLiteral,
|
|
63
|
+
SyntaxKind.JsxText,
|
|
64
|
+
];
|
|
65
|
+
let scratch;
|
|
66
|
+
export function maskTsLiterals(sourceText, filePath) {
|
|
67
|
+
scratch ??= new Project({ useInMemoryFileSystem: true });
|
|
68
|
+
// `.tsx` so JSX parses; a `.ts` parse reads `<div>` as a type assertion and
|
|
69
|
+
// the JsxText case silently stops being covered.
|
|
70
|
+
const sourceFile = scratch.createSourceFile(`/scan/${path.basename(filePath)}.tsx`, sourceText, {
|
|
71
|
+
overwrite: true,
|
|
72
|
+
});
|
|
73
|
+
const out = sourceText.split('');
|
|
74
|
+
for (const kind of LITERAL_KINDS) {
|
|
75
|
+
for (const node of sourceFile.getDescendantsOfKind(kind)) {
|
|
76
|
+
for (let i = node.getStart(); i < node.getEnd(); i++) {
|
|
77
|
+
if (out[i] !== undefined && out[i] !== '\n')
|
|
78
|
+
out[i] = ' ';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const withoutLiteralText = out.join('');
|
|
83
|
+
// Block comments too, and this is not tidying — it is the difference between
|
|
84
|
+
// documenting the feature and invoking it.
|
|
85
|
+
//
|
|
86
|
+
// The grammar is `//`-only and always has been (a `/* … */` directive produced
|
|
87
|
+
// no exclusion before this fix and still produces none). But a JSDoc block
|
|
88
|
+
// that *mentions* the directive in prose puts the characters on a line, and
|
|
89
|
+
// the line scan below cannot tell prose from a directive.
|
|
90
|
+
//
|
|
91
|
+
// Found the hard way: this very file's docstring explains the bug, contains
|
|
92
|
+
// the directive text, and the moment comments started being read correctly it
|
|
93
|
+
// declared a live exclusion against `preset/boundaries/no-cross-boundary` —
|
|
94
|
+
// caught by this repo's own preset fan-out test. Any user writing a code
|
|
95
|
+
// comment about the feature would hit the same thing.
|
|
96
|
+
//
|
|
97
|
+
// Safe to do with a regex here, and only here: every string, template and
|
|
98
|
+
// regex literal has already been blanked, so a surviving `/*` is a real
|
|
99
|
+
// block-comment start.
|
|
100
|
+
return withoutLiteralText.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, ' '));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=ts-comment-mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-comment-mask.js","sourceRoot":"","sources":["../../src/core/ts-comment-mask.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,aAAa,GAAG;IACpB,UAAU,CAAC,aAAa;IACxB,UAAU,CAAC,6BAA6B;IACxC,UAAU,CAAC,kBAAkB;IAC7B,UAAU,CAAC,wBAAwB;IACnC,UAAU,CAAC,OAAO;CACV,CAAA;AAEV,IAAI,OAA4B,CAAA;AAEhC,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,QAAgB;IACjE,OAAO,KAAK,IAAI,OAAO,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAA;IACxD,4EAA4E;IAC5E,iDAAiD;IACjD,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,QAA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
import { diagnoseGlob, FAULT_ADVICE, ON_DISK_ADVICE } from './glob-diagnosis.js';
|
|
3
3
|
import { globSitesOf, isDeadGlobTree, isDeadSite } from './glob-evaluator.js';
|
|
4
4
|
import { pathUniverse } from './path-universe.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vacuity-diagnosis.js","sourceRoot":"","sources":["../../src/core/vacuity-diagnosis.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"vacuity-diagnosis.js","sourceRoot":"","sources":["../../src/core/vacuity-diagnosis.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE7E;;;;;;;GAOG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,CAAS;IAC1C,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;AAChF,CAAC;AAED;;;;;;;GAOG;AACH,iFAAiF;AACjF,2EAA2E;AAC3E,mDAAmD;AACnD,0DAA0D;AAC1D,MA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;QACb,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,MAAM;QACf,iDAAiD;QACjD,UAAU,EAAE,MAAM;QAClB,aAAa,EAAE,IAAI;KACpB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Condition, Predicate, RuleDescription } from '@nielspeter/eess';
|
|
2
|
+
import type { CollectResult } from '../core/terminal-builder.js';
|
|
3
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
4
|
+
/**
|
|
5
|
+
* What `SchemaRuleBuilder` and `ResolverRuleBuilder` both are.
|
|
6
|
+
*
|
|
7
|
+
* The two were one class written twice: identical `_predicates`/`_conditions`
|
|
8
|
+
* fields, identical `that`/`and`/`should`/`andShould`, `copy`,
|
|
9
|
+
* `assertsSomething`, `describeRule`, `selected`, `examinedUnits` and
|
|
10
|
+
* `collectViolations` — `no-copy-paste` reported the last pair as literally the
|
|
11
|
+
* same text. Extracting the shared body into a free function only shortened the
|
|
12
|
+
* copy; the honest reading of the finding is that the class is the duplicate.
|
|
13
|
+
*
|
|
14
|
+
* Neither extends `RuleBuilder`, because a GraphQL element is not a ts-morph
|
|
15
|
+
* node and the predicate/condition surfaces are the schema's own. What they do
|
|
16
|
+
* share is every piece of the ADR-010 evidence path, which is precisely where
|
|
17
|
+
* two copies have already cost this repo something: they once derived their
|
|
18
|
+
* `examined` count separately and disagreed, so a chain whose `.that()`
|
|
19
|
+
* selected nothing reported 14 units examined, handed its conditions 0, and
|
|
20
|
+
* passed green with `diagnose()` silent (plan 0096). One class is what makes
|
|
21
|
+
* "the preview derives from the same computation the gate uses" structural.
|
|
22
|
+
*
|
|
23
|
+
* Subclasses supply the four things that genuinely differ: where elements come
|
|
24
|
+
* from, the noun this family counts, the subject its description opens with,
|
|
25
|
+
* and the conditions its assertion-less remedy should name.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class GraphqlRuleBuilder<T> extends TerminalBuilder {
|
|
28
|
+
protected _predicates: Predicate<T>[];
|
|
29
|
+
protected _conditions: Condition<T>[];
|
|
30
|
+
/**
|
|
31
|
+
* Per-instance rather than per-module, which is what a generic class allows:
|
|
32
|
+
* a single module-level `selectionMemo<T>()` cannot be typed for two element
|
|
33
|
+
* types. Keying is still by builder identity, and `copy()` hands the clone
|
|
34
|
+
* the same map, so the caching behaviour is the one the two modules had.
|
|
35
|
+
*/
|
|
36
|
+
private readonly selectionOf;
|
|
37
|
+
/** Every candidate, before any predicate runs. */
|
|
38
|
+
protected abstract getElements(): T[];
|
|
39
|
+
/** The conditions this builder's assertion-less remedy should name, e.g. `'haveFields(...)'`. */
|
|
40
|
+
protected abstract conditionExamples(): string;
|
|
41
|
+
/** The noun the rule description opens with — `schema that …`, `resolvers that …`. */
|
|
42
|
+
protected abstract descriptionSubject(): string;
|
|
43
|
+
/** Begin the predicate phase. Purely a readability marker. */
|
|
44
|
+
that(): this;
|
|
45
|
+
/** Add another predicate (AND). */
|
|
46
|
+
and(): this;
|
|
47
|
+
/** Begin the condition phase. */
|
|
48
|
+
should(): this;
|
|
49
|
+
/** Add another condition (AND). */
|
|
50
|
+
andShould(): this;
|
|
51
|
+
/**
|
|
52
|
+
* An independent copy, carrying both lists.
|
|
53
|
+
*
|
|
54
|
+
* These builders do not extend `RuleBuilder`, so they do not inherit that
|
|
55
|
+
* class's override — and neither `that()` nor `should()` forked here at all,
|
|
56
|
+
* which made the bug 0016 leak worse on this hierarchy than on the main one:
|
|
57
|
+
* a held `schema()` selection accumulated every predicate and condition of
|
|
58
|
+
* every rule derived from it. `docs/graphql.md` teaches exactly that shape.
|
|
59
|
+
*/
|
|
60
|
+
protected copy(): this;
|
|
61
|
+
/**
|
|
62
|
+
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
63
|
+
*
|
|
64
|
+
* True once a condition has been added.
|
|
65
|
+
*
|
|
66
|
+
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
67
|
+
* contract and the reason this is public rather than protected.
|
|
68
|
+
*/
|
|
69
|
+
assertsSomething(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The remedy for this builder's assertion-less state, as one string.
|
|
72
|
+
*
|
|
73
|
+
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
74
|
+
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
75
|
+
* what this builder is missing.
|
|
76
|
+
*/
|
|
77
|
+
assertionAdvice(): string;
|
|
78
|
+
/** Named by id or description, not 'unnamed' (plan 0070 §4). */
|
|
79
|
+
describeRule(): RuleDescription;
|
|
80
|
+
/**
|
|
81
|
+
* The set the conditions receive — plan 0096, and the ONE method every reader
|
|
82
|
+
* calls: `collectViolations()`, `examinedUnits()` and `diagnose()`'s preview
|
|
83
|
+
* all come through here, so none of them can answer "what did this rule look
|
|
84
|
+
* at" differently from the others.
|
|
85
|
+
*/
|
|
86
|
+
protected selected(): T[];
|
|
87
|
+
/**
|
|
88
|
+
* How many units this rule actually examined — ADR-010's evidence that a pass
|
|
89
|
+
* was constructed rather than defaulted. The selection, not what precedes it.
|
|
90
|
+
*/
|
|
91
|
+
examinedUnits(): number;
|
|
92
|
+
protected collectViolations(): CollectResult;
|
|
93
|
+
protected buildRuleDescription(): string;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=graphql-rule-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-rule-builder.d.ts","sourceRoot":"","sources":["../../src/graphql/graphql-rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAQ7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,kBAAkB,CAAC,CAAC,CAAE,SAAQ,eAAe;IACjE,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAK;IAC1C,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAK;IAE1C;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAEjD,kDAAkD;IAClD,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,CAAC,EAAE;IAErC,iGAAiG;IACjG,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,MAAM;IAE9C,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,MAAM;IAI/C,8DAA8D;IAC9D,IAAI,IAAI,IAAI;IAIZ,mCAAmC;IACnC,GAAG,IAAI,IAAI;IAIX,iCAAiC;IACjC,MAAM,IAAI,IAAI;IAId,mCAAmC;IACnC,SAAS,IAAI,IAAI;IAMjB;;;;;;;;OAQG;cACgB,IAAI,IAAI,IAAI;IAO/B;;;;;;;OAOG;IACM,gBAAgB,IAAI,OAAO;IAIpC;;;;;;OAMG;IACM,eAAe,IAAI,MAAM;IAOlC,gEAAgE;IACvD,YAAY,IAAI,eAAe;IAOxC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,IAAI,CAAC,EAAE;IAIzB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB,SAAS,CAAC,iBAAiB,IAAI,aAAa;IAc5C,SAAS,CAAC,oBAAoB,IAAI,MAAM;CAGzC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { conditionContextFrom, evaluateConditions, matchingElements, ruleDescriptionOf, selectionMemo, } from '@nielspeter/eess/internal';
|
|
2
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
3
|
+
/**
|
|
4
|
+
* What `SchemaRuleBuilder` and `ResolverRuleBuilder` both are.
|
|
5
|
+
*
|
|
6
|
+
* The two were one class written twice: identical `_predicates`/`_conditions`
|
|
7
|
+
* fields, identical `that`/`and`/`should`/`andShould`, `copy`,
|
|
8
|
+
* `assertsSomething`, `describeRule`, `selected`, `examinedUnits` and
|
|
9
|
+
* `collectViolations` — `no-copy-paste` reported the last pair as literally the
|
|
10
|
+
* same text. Extracting the shared body into a free function only shortened the
|
|
11
|
+
* copy; the honest reading of the finding is that the class is the duplicate.
|
|
12
|
+
*
|
|
13
|
+
* Neither extends `RuleBuilder`, because a GraphQL element is not a ts-morph
|
|
14
|
+
* node and the predicate/condition surfaces are the schema's own. What they do
|
|
15
|
+
* share is every piece of the ADR-010 evidence path, which is precisely where
|
|
16
|
+
* two copies have already cost this repo something: they once derived their
|
|
17
|
+
* `examined` count separately and disagreed, so a chain whose `.that()`
|
|
18
|
+
* selected nothing reported 14 units examined, handed its conditions 0, and
|
|
19
|
+
* passed green with `diagnose()` silent (plan 0096). One class is what makes
|
|
20
|
+
* "the preview derives from the same computation the gate uses" structural.
|
|
21
|
+
*
|
|
22
|
+
* Subclasses supply the four things that genuinely differ: where elements come
|
|
23
|
+
* from, the noun this family counts, the subject its description opens with,
|
|
24
|
+
* and the conditions its assertion-less remedy should name.
|
|
25
|
+
*/
|
|
26
|
+
export class GraphqlRuleBuilder extends TerminalBuilder {
|
|
27
|
+
_predicates = [];
|
|
28
|
+
_conditions = [];
|
|
29
|
+
/**
|
|
30
|
+
* Per-instance rather than per-module, which is what a generic class allows:
|
|
31
|
+
* a single module-level `selectionMemo<T>()` cannot be typed for two element
|
|
32
|
+
* types. Keying is still by builder identity, and `copy()` hands the clone
|
|
33
|
+
* the same map, so the caching behaviour is the one the two modules had.
|
|
34
|
+
*/
|
|
35
|
+
selectionOf = selectionMemo();
|
|
36
|
+
// --- Chain methods (readability markers; the phase is implicit) ---
|
|
37
|
+
/** Begin the predicate phase. Purely a readability marker. */
|
|
38
|
+
that() {
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/** Add another predicate (AND). */
|
|
42
|
+
and() {
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/** Begin the condition phase. */
|
|
46
|
+
should() {
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/** Add another condition (AND). */
|
|
50
|
+
andShould() {
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
// --- Evaluation ---
|
|
54
|
+
/**
|
|
55
|
+
* An independent copy, carrying both lists.
|
|
56
|
+
*
|
|
57
|
+
* These builders do not extend `RuleBuilder`, so they do not inherit that
|
|
58
|
+
* class's override — and neither `that()` nor `should()` forked here at all,
|
|
59
|
+
* which made the bug 0016 leak worse on this hierarchy than on the main one:
|
|
60
|
+
* a held `schema()` selection accumulated every predicate and condition of
|
|
61
|
+
* every rule derived from it. `docs/graphql.md` teaches exactly that shape.
|
|
62
|
+
*/
|
|
63
|
+
copy() {
|
|
64
|
+
const clone = super.copy();
|
|
65
|
+
clone._predicates = [...this._predicates];
|
|
66
|
+
clone._conditions = [...this._conditions];
|
|
67
|
+
return clone;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
71
|
+
*
|
|
72
|
+
* True once a condition has been added.
|
|
73
|
+
*
|
|
74
|
+
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
75
|
+
* contract and the reason this is public rather than protected.
|
|
76
|
+
*/
|
|
77
|
+
assertsSomething() {
|
|
78
|
+
return this._conditions.length > 0;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The remedy for this builder's assertion-less state, as one string.
|
|
82
|
+
*
|
|
83
|
+
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
84
|
+
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
85
|
+
* what this builder is missing.
|
|
86
|
+
*/
|
|
87
|
+
assertionAdvice() {
|
|
88
|
+
return ('this rule has no condition, so it asserts nothing and can never fail. Add a ' +
|
|
89
|
+
`condition after .should(), e.g. ${this.conditionExamples()}.`);
|
|
90
|
+
}
|
|
91
|
+
/** Named by id or description, not 'unnamed' (plan 0070 §4). */
|
|
92
|
+
describeRule() {
|
|
93
|
+
return {
|
|
94
|
+
...super.describeRule(),
|
|
95
|
+
rule: this._metadata?.id ?? this.buildRuleDescription(),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The set the conditions receive — plan 0096, and the ONE method every reader
|
|
100
|
+
* calls: `collectViolations()`, `examinedUnits()` and `diagnose()`'s preview
|
|
101
|
+
* all come through here, so none of them can answer "what did this rule look
|
|
102
|
+
* at" differently from the others.
|
|
103
|
+
*/
|
|
104
|
+
selected() {
|
|
105
|
+
return this.selectionOf(this, () => matchingElements(this.getElements(), this._predicates));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* How many units this rule actually examined — ADR-010's evidence that a pass
|
|
109
|
+
* was constructed rather than defaulted. The selection, not what precedes it.
|
|
110
|
+
*/
|
|
111
|
+
examinedUnits() {
|
|
112
|
+
return this.selected().length;
|
|
113
|
+
}
|
|
114
|
+
collectViolations() {
|
|
115
|
+
// The kernel's. The zero-evidence early exit and the `examined` count travel
|
|
116
|
+
// with it, so they cannot be derived apart.
|
|
117
|
+
return evaluateConditions(this.selected(), this._conditions, conditionContextFrom({
|
|
118
|
+
metadata: this._metadata,
|
|
119
|
+
reason: this._reason,
|
|
120
|
+
rule: this.buildRuleDescription(),
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
buildRuleDescription() {
|
|
124
|
+
return ruleDescriptionOf(this._predicates, this._conditions, this.descriptionSubject());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=graphql-rule-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-rule-builder.js","sourceRoot":"","sources":["../../src/graphql/graphql-rule-builder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,GACd,MAAM,2BAA2B,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AAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAC7F,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAA;IAC/B,CAAC;IAES,iBAAiB;QACzB,6EAA6E;QAC7E,4CAA4C;QAC5C,OAAO,kBAAkB,CACvB,IAAI,CAAC,QAAQ,EAAE,EACf,IAAI,CAAC,WAAW,EAChB,oBAAoB,CAAC;YACnB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE;SAClC,CAAC,CACH,CAAA;IACH,CAAC;IAES,oBAAoB;QAC5B,OAAO,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAA;IACzF,CAAC;CACF"}
|
package/dist/graphql/index.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export declare function schemaFromSDL(sdl: string, sourcePath?: string): SchemaR
|
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
67
|
export declare function resolvers(p: ArchProject, glob: string): ResolverRuleBuilder;
|
|
68
|
+
export { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
68
69
|
export { SchemaRuleBuilder } from './schema-rule-builder.js';
|
|
69
70
|
export { ResolverRuleBuilder } from './resolver-rule-builder.js';
|
|
70
71
|
export { resolveFieldReturning } from './resolver-rule-builder.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,OAAO,EA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
// --- Re-exports ---
|
|
83
|
+
export { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
83
84
|
export { SchemaRuleBuilder } from './schema-rule-builder.js';
|
|
84
85
|
export { ResolverRuleBuilder } from './resolver-rule-builder.js';
|
|
85
86
|
export { resolveFieldReturning } from './resolver-rule-builder.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,uBAAuB;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAC,aAAmC,EAAE,IAAY;IACtE,MAAM,OAAO,GACX,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;IAChG,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAChD,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,UAAmB;IAC5D,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IACjD,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,SAAS,CAAC,CAAc,EAAE,IAAY;IACpD,MAAM,WAAW,GAAG,CAAC,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE;QAC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,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACjC,CAAC;IACD,OAAO,OAAO,CAAC,YAAY,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import type { RuleDescription } from '@nielspeter/eess';
|
|
2
|
-
import type { CollectResult } from '../core/terminal-builder.js';
|
|
3
1
|
import type { SourceFile } from 'ts-morph';
|
|
4
2
|
import type { Predicate } from '@nielspeter/eess';
|
|
5
3
|
import type { ArchProject } from '../core/project.js';
|
|
6
4
|
import type { GlobNode } from '@nielspeter/eess';
|
|
7
|
-
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
8
5
|
import type { ExpressionMatcher } from '../helpers/matchers.js';
|
|
9
6
|
import type { ArchFunction } from '../models/arch-function.js';
|
|
7
|
+
import { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
10
8
|
/**
|
|
11
9
|
* Predicate: filter to resolver functions for fields returning types matching the pattern.
|
|
12
10
|
*
|
|
@@ -17,12 +15,27 @@ import type { ArchFunction } from '../models/arch-function.js';
|
|
|
17
15
|
* @param pattern - Regex or string to match against the resolved return type text
|
|
18
16
|
*/
|
|
19
17
|
export declare function resolveFieldReturning(pattern: RegExp | string): Predicate<ArchFunction>;
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Fluent rule builder for GraphQL resolver architecture rules.
|
|
20
|
+
*
|
|
21
|
+
* Operates on TypeScript resolver files analyzed through the ArchFunction model.
|
|
22
|
+
* Reuses the body analysis engine from plan 0011 for conditions like contain/notContain.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* resolvers(p, 'src/resolvers/**')
|
|
27
|
+
* .that()
|
|
28
|
+
* .resolveFieldReturning(/^[A-Z]/)
|
|
29
|
+
* .should()
|
|
30
|
+
* .contain(call('loader.load'))
|
|
31
|
+
* .because('prevent N+1 queries')
|
|
32
|
+
* .check()
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class ResolverRuleBuilder extends GraphqlRuleBuilder<ArchFunction> {
|
|
21
36
|
private readonly sourceFiles;
|
|
22
37
|
private readonly glob?;
|
|
23
38
|
private readonly project?;
|
|
24
|
-
private _predicates;
|
|
25
|
-
private _conditions;
|
|
26
39
|
/**
|
|
27
40
|
* @param sourceFiles - The resolver files, already filtered by `resolvers()`.
|
|
28
41
|
* @param glob - The glob they were filtered by, for diagnostics only.
|
|
@@ -55,22 +68,6 @@ export declare class ResolverRuleBuilder extends TerminalBuilder {
|
|
|
55
68
|
* Filter to resolver functions for fields returning types matching the pattern.
|
|
56
69
|
*/
|
|
57
70
|
resolveFieldReturning(pattern: RegExp | string): this;
|
|
58
|
-
/**
|
|
59
|
-
* Begin the predicate phase. Purely a readability marker.
|
|
60
|
-
*/
|
|
61
|
-
that(): this;
|
|
62
|
-
/**
|
|
63
|
-
* Add another predicate (AND).
|
|
64
|
-
*/
|
|
65
|
-
and(): this;
|
|
66
|
-
/**
|
|
67
|
-
* Begin the condition phase.
|
|
68
|
-
*/
|
|
69
|
-
should(): this;
|
|
70
|
-
/**
|
|
71
|
-
* Add another condition (AND).
|
|
72
|
-
*/
|
|
73
|
-
andShould(): this;
|
|
74
71
|
/**
|
|
75
72
|
* Assert that the resolver body contains at least one match.
|
|
76
73
|
*/
|
|
@@ -83,50 +80,6 @@ export declare class ResolverRuleBuilder extends TerminalBuilder {
|
|
|
83
80
|
* Assert: must NOT contain 'bad' AND must contain 'good'.
|
|
84
81
|
*/
|
|
85
82
|
useInsteadOf(bad: ExpressionMatcher, good: ExpressionMatcher): this;
|
|
86
|
-
/**
|
|
87
|
-
* An independent copy, carrying both lists.
|
|
88
|
-
*
|
|
89
|
-
* This builder does not extend `RuleBuilder`, so it does not inherit that
|
|
90
|
-
* class's override — and neither `that()` nor `should()` forked here at all,
|
|
91
|
-
* which made the bug 0016 leak worse on this hierarchy than on the main one:
|
|
92
|
-
* a held `schema()` selection accumulated every predicate and condition of
|
|
93
|
-
* every rule derived from it. `docs/graphql.md` teaches exactly that shape.
|
|
94
|
-
*/
|
|
95
|
-
protected copy(): this;
|
|
96
|
-
/**
|
|
97
|
-
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
98
|
-
*
|
|
99
|
-
* True once a condition has been added.
|
|
100
|
-
*
|
|
101
|
-
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
102
|
-
* contract and the reason this is public rather than protected.
|
|
103
|
-
*/
|
|
104
|
-
assertsSomething(): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* The remedy for this builder's assertion-less state, as one string.
|
|
107
|
-
*
|
|
108
|
-
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
109
|
-
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
110
|
-
* what this builder is missing.
|
|
111
|
-
*/
|
|
112
|
-
assertionAdvice(): string;
|
|
113
|
-
/** Named by id or description, not 'unnamed' (plan 0070 §4). */
|
|
114
|
-
describeRule(): RuleDescription;
|
|
115
|
-
/**
|
|
116
|
-
* The set the conditions receive — plan 0096, and the ONE method both readers
|
|
117
|
-
* call.
|
|
118
|
-
*
|
|
119
|
-
* The first attempt at 0096 let `collectViolations()` and the evidence
|
|
120
|
-
* accessor derive this separately, and they disagreed inside one commit: this
|
|
121
|
-
* builder counted PRE-predicate while its sibling `SchemaRuleBuilder` counted
|
|
122
|
-
* post. Measured, a chain whose `.that()` selected nothing reported 14 units
|
|
123
|
-
* examined, handed its conditions 0, and passed green with `diagnose()`
|
|
124
|
-
* silent — the fail-open cell ADR-009 exists to close, inside the wave that
|
|
125
|
-
* closes it. Sharing the method is what makes "the preview derives from the
|
|
126
|
-
* same computation the gate uses" structural rather than a claim.
|
|
127
|
-
*/
|
|
128
|
-
private selected;
|
|
129
|
-
/** Units this rule examined — plan 0096. The selection, not what precedes it. */
|
|
130
83
|
/**
|
|
131
84
|
* This family counts resolvers — the resolver functions it selected.
|
|
132
85
|
*
|
|
@@ -136,15 +89,8 @@ export declare class ResolverRuleBuilder extends TerminalBuilder {
|
|
|
136
89
|
* was and was not looked at.
|
|
137
90
|
*/
|
|
138
91
|
protected examinedUnitNoun(): string;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
* The resolvers this rule selected.
|
|
144
|
-
*/
|
|
145
|
-
examinedUnits(): number;
|
|
146
|
-
protected collectViolations(): CollectResult;
|
|
147
|
-
private getElements;
|
|
148
|
-
private buildRuleDescription;
|
|
92
|
+
protected descriptionSubject(): string;
|
|
93
|
+
protected conditionExamples(): string;
|
|
94
|
+
protected getElements(): ArchFunction[];
|
|
149
95
|
}
|
|
150
96
|
//# sourceMappingURL=resolver-rule-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver-rule-builder.d.ts","sourceRoot":"","sources":["../../src/graphql/resolver-rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolver-rule-builder.d.ts","sourceRoot":"","sources":["../../src/graphql/resolver-rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAGhD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAO9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,CAYvF;AAED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