@goodbones/core 0.1.0-beta.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.
Files changed (147) hide show
  1. package/LICENSE +21 -0
  2. package/build/dts/core/baseline.d.ts +16 -0
  3. package/build/dts/core/baseline.d.ts.map +1 -0
  4. package/build/dts/core/coverage.d.ts +47 -0
  5. package/build/dts/core/coverage.d.ts.map +1 -0
  6. package/build/dts/core/exports.d.ts +38 -0
  7. package/build/dts/core/exports.d.ts.map +1 -0
  8. package/build/dts/core/graph.d.ts +40 -0
  9. package/build/dts/core/graph.d.ts.map +1 -0
  10. package/build/dts/core/imports.d.ts +29 -0
  11. package/build/dts/core/imports.d.ts.map +1 -0
  12. package/build/dts/core/members.d.ts +26 -0
  13. package/build/dts/core/members.d.ts.map +1 -0
  14. package/build/dts/core/patterns.d.ts +17 -0
  15. package/build/dts/core/patterns.d.ts.map +1 -0
  16. package/build/dts/core/structure.d.ts +48 -0
  17. package/build/dts/core/structure.d.ts.map +1 -0
  18. package/build/dts/core/surface.d.ts +39 -0
  19. package/build/dts/core/surface.d.ts.map +1 -0
  20. package/build/dts/domain/architecture-config.d.ts +322 -0
  21. package/build/dts/domain/architecture-config.d.ts.map +1 -0
  22. package/build/dts/domain/architecture-error.d.ts +35 -0
  23. package/build/dts/domain/architecture-error.d.ts.map +1 -0
  24. package/build/dts/domain/facts.d.ts +26 -0
  25. package/build/dts/domain/facts.d.ts.map +1 -0
  26. package/build/dts/domain/violation.d.ts +11 -0
  27. package/build/dts/domain/violation.d.ts.map +1 -0
  28. package/build/dts/index.d.ts +23 -0
  29. package/build/dts/index.d.ts.map +1 -0
  30. package/build/dts/infrastructure/fact-extractor-fake.d.ts +4 -0
  31. package/build/dts/infrastructure/fact-extractor-fake.d.ts.map +1 -0
  32. package/build/dts/infrastructure/file-system-fake.d.ts +3 -0
  33. package/build/dts/infrastructure/file-system-fake.d.ts.map +1 -0
  34. package/build/dts/infrastructure/file-system-live.d.ts +3 -0
  35. package/build/dts/infrastructure/file-system-live.d.ts.map +1 -0
  36. package/build/dts/infrastructure/manifest-file.d.ts +3 -0
  37. package/build/dts/infrastructure/manifest-file.d.ts.map +1 -0
  38. package/build/dts/infrastructure/module-resolver-fake.d.ts +3 -0
  39. package/build/dts/infrastructure/module-resolver-fake.d.ts.map +1 -0
  40. package/build/dts/infrastructure/walk.d.ts +4 -0
  41. package/build/dts/infrastructure/walk.d.ts.map +1 -0
  42. package/build/dts/load/policy.d.ts +42 -0
  43. package/build/dts/load/policy.d.ts.map +1 -0
  44. package/build/dts/manifest/compile.d.ts +26 -0
  45. package/build/dts/manifest/compile.d.ts.map +1 -0
  46. package/build/dts/manifest/glob.d.ts +14 -0
  47. package/build/dts/manifest/glob.d.ts.map +1 -0
  48. package/build/dts/manifest/manifest.d.ts +208 -0
  49. package/build/dts/manifest/manifest.d.ts.map +1 -0
  50. package/build/dts/ports/fact-extractor.d.ts +5 -0
  51. package/build/dts/ports/fact-extractor.d.ts.map +1 -0
  52. package/build/dts/ports/file-system.d.ts +5 -0
  53. package/build/dts/ports/file-system.d.ts.map +1 -0
  54. package/build/dts/ports/language.d.ts +14 -0
  55. package/build/dts/ports/language.d.ts.map +1 -0
  56. package/build/dts/ports/module-resolver.d.ts +12 -0
  57. package/build/dts/ports/module-resolver.d.ts.map +1 -0
  58. package/build/dts/testing.d.ts +4 -0
  59. package/build/dts/testing.d.ts.map +1 -0
  60. package/build/esm/core/baseline.js +30 -0
  61. package/build/esm/core/baseline.js.map +1 -0
  62. package/build/esm/core/coverage.js +75 -0
  63. package/build/esm/core/coverage.js.map +1 -0
  64. package/build/esm/core/exports.js +102 -0
  65. package/build/esm/core/exports.js.map +1 -0
  66. package/build/esm/core/graph.js +259 -0
  67. package/build/esm/core/graph.js.map +1 -0
  68. package/build/esm/core/imports.js +103 -0
  69. package/build/esm/core/imports.js.map +1 -0
  70. package/build/esm/core/members.js +106 -0
  71. package/build/esm/core/members.js.map +1 -0
  72. package/build/esm/core/patterns.js +75 -0
  73. package/build/esm/core/patterns.js.map +1 -0
  74. package/build/esm/core/structure.js +257 -0
  75. package/build/esm/core/structure.js.map +1 -0
  76. package/build/esm/core/surface.js +137 -0
  77. package/build/esm/core/surface.js.map +1 -0
  78. package/build/esm/domain/architecture-config.js +312 -0
  79. package/build/esm/domain/architecture-config.js.map +1 -0
  80. package/build/esm/domain/architecture-error.js +41 -0
  81. package/build/esm/domain/architecture-error.js.map +1 -0
  82. package/build/esm/domain/facts.js +2 -0
  83. package/build/esm/domain/facts.js.map +1 -0
  84. package/build/esm/domain/violation.js +8 -0
  85. package/build/esm/domain/violation.js.map +1 -0
  86. package/build/esm/index.js +22 -0
  87. package/build/esm/index.js.map +1 -0
  88. package/build/esm/infrastructure/fact-extractor-fake.js +24 -0
  89. package/build/esm/infrastructure/fact-extractor-fake.js.map +1 -0
  90. package/build/esm/infrastructure/file-system-fake.js +10 -0
  91. package/build/esm/infrastructure/file-system-fake.js.map +1 -0
  92. package/build/esm/infrastructure/file-system-live.js +27 -0
  93. package/build/esm/infrastructure/file-system-live.js.map +1 -0
  94. package/build/esm/infrastructure/manifest-file.js +15 -0
  95. package/build/esm/infrastructure/manifest-file.js.map +1 -0
  96. package/build/esm/infrastructure/module-resolver-fake.js +33 -0
  97. package/build/esm/infrastructure/module-resolver-fake.js.map +1 -0
  98. package/build/esm/infrastructure/walk.js +45 -0
  99. package/build/esm/infrastructure/walk.js.map +1 -0
  100. package/build/esm/load/policy.js +207 -0
  101. package/build/esm/load/policy.js.map +1 -0
  102. package/build/esm/manifest/compile.js +706 -0
  103. package/build/esm/manifest/compile.js.map +1 -0
  104. package/build/esm/manifest/glob.js +77 -0
  105. package/build/esm/manifest/glob.js.map +1 -0
  106. package/build/esm/manifest/manifest.js +303 -0
  107. package/build/esm/manifest/manifest.js.map +1 -0
  108. package/build/esm/ports/fact-extractor.js +2 -0
  109. package/build/esm/ports/fact-extractor.js.map +1 -0
  110. package/build/esm/ports/file-system.js +2 -0
  111. package/build/esm/ports/file-system.js.map +1 -0
  112. package/build/esm/ports/language.js +2 -0
  113. package/build/esm/ports/language.js.map +1 -0
  114. package/build/esm/ports/module-resolver.js +2 -0
  115. package/build/esm/ports/module-resolver.js.map +1 -0
  116. package/build/esm/testing.js +7 -0
  117. package/build/esm/testing.js.map +1 -0
  118. package/package.json +61 -0
  119. package/src/core/baseline.ts +62 -0
  120. package/src/core/coverage.ts +154 -0
  121. package/src/core/exports.ts +171 -0
  122. package/src/core/graph.ts +331 -0
  123. package/src/core/imports.ts +160 -0
  124. package/src/core/members.ts +161 -0
  125. package/src/core/patterns.ts +116 -0
  126. package/src/core/structure.ts +349 -0
  127. package/src/core/surface.ts +181 -0
  128. package/src/domain/architecture-config.ts +370 -0
  129. package/src/domain/architecture-error.ts +59 -0
  130. package/src/domain/facts.ts +47 -0
  131. package/src/domain/violation.ts +24 -0
  132. package/src/index.ts +136 -0
  133. package/src/infrastructure/fact-extractor-fake.ts +28 -0
  134. package/src/infrastructure/file-system-fake.ts +14 -0
  135. package/src/infrastructure/file-system-live.ts +27 -0
  136. package/src/infrastructure/manifest-file.ts +17 -0
  137. package/src/infrastructure/module-resolver-fake.ts +39 -0
  138. package/src/infrastructure/walk.ts +54 -0
  139. package/src/load/policy.ts +344 -0
  140. package/src/manifest/compile.ts +1011 -0
  141. package/src/manifest/glob.ts +108 -0
  142. package/src/manifest/manifest.ts +408 -0
  143. package/src/ports/fact-extractor.ts +12 -0
  144. package/src/ports/file-system.ts +8 -0
  145. package/src/ports/language.ts +39 -0
  146. package/src/ports/module-resolver.ts +28 -0
  147. package/src/testing.ts +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Data Quail
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,16 @@
1
+ import type { Violation } from "../domain/violation.js";
2
+ export type Baseline = {
3
+ readonly version: 1;
4
+ readonly entries: ReadonlyArray<string>;
5
+ };
6
+ export declare const EMPTY_BASELINE: Baseline;
7
+ export declare const baselineOf: (violations: Iterable<Violation>) => Baseline;
8
+ export declare const decodeBaseline: (raw: unknown) => Baseline;
9
+ export declare const serializeBaseline: (baseline: Baseline) => string;
10
+ export type BaselineFilter = {
11
+ readonly isBaselined: (violation: Violation) => boolean;
12
+ };
13
+ export declare const makeBaselineFilter: (baseline: Baseline) => BaselineFilter;
14
+ export declare const staleEntriesOf: (baseline: Baseline, violations: Iterable<Violation>) => ReadonlyArray<string>;
15
+ export declare const unbaselined: (baseline: Baseline, violations: Iterable<Violation>) => ReadonlyArray<Violation>;
16
+ //# sourceMappingURL=baseline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline.d.ts","sourceRoot":"","sources":["../../../src/core/baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAcxD,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAsC,CAAC;AAEpE,eAAO,MAAM,UAAU,eAAgB,QAAQ,CAAC,SAAS,CAAC,KAAG,QAG3D,CAAC;AAEH,eAAO,MAAM,cAAc,QAAS,OAAO,KAAG,QAK7C,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAc,QAAQ,KAAG,MACb,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,aAAc,QAAQ,KAAG,cAGvD,CAAC;AAIF,eAAO,MAAM,cAAc,aACf,QAAQ,cACN,QAAQ,CAAC,SAAS,CAAC,KAC9B,aAAa,CAAC,MAAM,CAGtB,CAAC;AAEF,eAAO,MAAM,WAAW,aACZ,QAAQ,cACN,QAAQ,CAAC,SAAS,CAAC,KAC9B,aAAa,CAAC,SAAS,CAGzB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { CompiledGraph } from "./graph.js";
2
+ import type { CompiledImportRule } from "./imports.js";
3
+ import type { CompiledMemberRule } from "./members.js";
4
+ import type { CompiledStructure } from "./structure.js";
5
+ import type { CompiledSurfaceRule } from "./surface.js";
6
+ export type FamilyCoverage = {
7
+ readonly covered: number;
8
+ readonly total: number;
9
+ };
10
+ export type StructureCoverage = {
11
+ readonly enumerated: number;
12
+ readonly open: number;
13
+ readonly total: number;
14
+ };
15
+ export type Coverage = {
16
+ readonly files: number;
17
+ readonly imports: FamilyCoverage;
18
+ readonly structure: StructureCoverage;
19
+ readonly members: FamilyCoverage;
20
+ readonly surface: FamilyCoverage;
21
+ readonly graph: FamilyCoverage;
22
+ };
23
+ export type CoverageInputs = {
24
+ readonly importRules: ReadonlyArray<CompiledImportRule>;
25
+ readonly structure: CompiledStructure;
26
+ readonly memberRules: ReadonlyArray<CompiledMemberRule>;
27
+ readonly surfaceRules: ReadonlyArray<CompiledSurfaceRule>;
28
+ readonly graph: CompiledGraph;
29
+ };
30
+ export declare const coverageOf: (policy: CoverageInputs, files: ReadonlyArray<string>) => Coverage;
31
+ export type CoverageFloors = {
32
+ readonly imports?: number;
33
+ readonly structure?: number;
34
+ readonly members?: number;
35
+ readonly surface?: number;
36
+ readonly graph?: number;
37
+ };
38
+ export type CoverageFamily = keyof CoverageFloors;
39
+ export declare const fractionOf: (covered: number, total: number) => number;
40
+ export declare const fractionsOf: (coverage: Coverage) => Readonly<Record<CoverageFamily, number>>;
41
+ export type Shortfall = {
42
+ readonly family: CoverageFamily;
43
+ readonly actual: number;
44
+ readonly floor: number;
45
+ };
46
+ export declare const coverageShortfalls: (coverage: Coverage, floors: CoverageFloors) => ReadonlyArray<Shortfall>;
47
+ //# sourceMappingURL=coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../../src/core/coverage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAOxD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAE9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,QAAQ,CAAC,IAAI,EAAE,M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Q,KAAG,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAMtF,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,aACnB,QAAQ,UACV,cAAc,KACrB,aAAa,CAAC,SAAS,CAczB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import * as Result from "effect/Result";
2
+ import type { BindingKind, ExportProbe, ExportRule } from "../domain/architecture-config.js";
3
+ import type { ImportUnresolved, PatternInvalid } from "../domain/architecture-error.js";
4
+ import type { Binding } from "../domain/facts.js";
5
+ import type { Violation } from "../domain/violation.js";
6
+ import type { FactExtractor } from "../ports/fact-extractor.js";
7
+ import type { ModuleResolver } from "../ports/module-resolver.js";
8
+ export type { Binding } from "../domain/facts.js";
9
+ export type CompiledExportRule = {
10
+ readonly name: string;
11
+ readonly message: string;
12
+ readonly from: ReadonlyArray<RegExp>;
13
+ readonly fromNot: ReadonlyArray<RegExp>;
14
+ readonly to: ReadonlyArray<string>;
15
+ readonly toNot: ReadonlyArray<string>;
16
+ readonly symbols: ReadonlySet<string> | null;
17
+ readonly kinds: ReadonlyArray<BindingKind>;
18
+ readonly fix: "subpath-namespace-import" | null;
19
+ readonly probe: ExportProbe;
20
+ };
21
+ export declare const compileExportRule: (rule: ExportRule) => Result.Result<CompiledExportRule, PatternInvalid>;
22
+ export declare const compileExportRules: (rules: ReadonlyArray<ExportRule>) => Result.Result<ReadonlyArray<CompiledExportRule>, PatternInvalid>;
23
+ export type BindingEdge = {
24
+ readonly importer: string;
25
+ readonly specifier: string;
26
+ readonly bindings: ReadonlyArray<Binding>;
27
+ };
28
+ export type SelectedExportRule = readonly [CompiledExportRule, RegExpExecArray];
29
+ export declare const exportRulesSelecting: (rules: ReadonlyArray<CompiledExportRule>, importer: string) => ReadonlyArray<SelectedExportRule>;
30
+ export type ExportViolation = {
31
+ readonly violation: Violation;
32
+ readonly rule: CompiledExportRule;
33
+ readonly bindings: ReadonlyArray<Binding>;
34
+ };
35
+ export declare const evaluateSelectedBindings: (selected: ReadonlyArray<SelectedExportRule>, resolver: ModuleResolver, edge: BindingEdge) => Result.Result<ReadonlyArray<ExportViolation>, ImportUnresolved>;
36
+ export declare const evaluateBindingEdge: (rules: ReadonlyArray<CompiledExportRule>, resolver: ModuleResolver, edge: BindingEdge) => Result.Result<ReadonlyArray<ExportViolation>, ImportUnresolved>;
37
+ export declare const exportRulesFailingTheirProbe: (rules: ReadonlyArray<CompiledExportRule>, extractor: FactExtractor) => ReadonlyArray<CompiledExportRule>;
38
+ //# sourceMappingURL=exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../../src/core/exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AASlE,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAIlD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAA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AAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,wBAAwB,aACzB,aAAa,CAAC,kBAAkB,CAAC,YACjC,cAAc,QAClB,WAAW,KAChB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,gBAAgB,CAkChE,CAAC;AAEF,eAAO,MAAM,mBAAmB,UACvB,aAAa,CAAC,kBAAkB,CAAC,YAC9B,cAAc,QAClB,WAAW,KAChB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,gBAAgB,CACqB,CAAC;AAMvF,eAAO,MAAM,4BAA4B,UAChC,aAAa,CAAC,kBAAkB,CAAC,aAC7B,aAAa,KACvB,aAAa,CAAC,kBAAkB,CAc/B,CAAC"}
@@ -0,0 +1,40 @@
1
+ import * as Result from "effect/Result";
2
+ import type { GraphConfig, GraphProbe } from "../domain/architecture-config.js";
3
+ import type { PatternInvalid } from "../domain/architecture-error.js";
4
+ import type { Violation } from "../domain/violation.js";
5
+ export type Graph = {
6
+ readonly files: ReadonlyArray<string>;
7
+ readonly edges: ReadonlyMap<string, ReadonlyArray<string>>;
8
+ };
9
+ export type CompiledGraphCycleRule = {
10
+ readonly name: string;
11
+ readonly message: string;
12
+ readonly within: ReadonlyArray<RegExp>;
13
+ readonly withinNot: ReadonlyArray<RegExp>;
14
+ readonly probe: GraphProbe;
15
+ };
16
+ export type CompiledGraphOrphanRule = CompiledGraphCycleRule & {
17
+ readonly entry: ReadonlyArray<RegExp>;
18
+ };
19
+ export type CompiledGraphReachRule = {
20
+ readonly name: string;
21
+ readonly message: string;
22
+ readonly from: ReadonlyArray<RegExp>;
23
+ readonly fromNot: ReadonlyArray<RegExp>;
24
+ readonly to: ReadonlyArray<RegExp>;
25
+ readonly toNot: ReadonlyArray<RegExp>;
26
+ readonly via: ReadonlyArray<RegExp>;
27
+ readonly probe: GraphProbe;
28
+ };
29
+ export type CompiledGraph = {
30
+ readonly cycles: ReadonlyArray<CompiledGraphCycleRule>;
31
+ readonly orphans: ReadonlyArray<CompiledGraphOrphanRule>;
32
+ readonly reach: ReadonlyArray<CompiledGraphReachRule>;
33
+ };
34
+ export declare const EMPTY_GRAPH_RULES: CompiledGraph;
35
+ export declare const hasGraphRules: (rules: CompiledGraph) => boolean;
36
+ export declare const compileGraphRules: (config: GraphConfig | undefined) => Result.Result<CompiledGraph, PatternInvalid>;
37
+ export declare const evaluateGraph: (rules: CompiledGraph, graph: Graph) => ReadonlyArray<Violation>;
38
+ export declare const graphOf: (probe: GraphProbe) => Graph;
39
+ export declare const graphRulesFailingTheirProbe: (rules: CompiledGraph) => ReadonlyArray<string>;
40
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/core/graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,WAAW,EAGX,UAAU,EAEX,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMxD,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAA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eAAO,MAAM,2BAA2B,UAAW,aAAa,KAAG,aAAa,CAAC,MAAM,CAUtF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import * as Result from "effect/Result";
2
+ import type { ImportProbe, ImportProbeTarget, ImportRule } from "../domain/architecture-config.js";
3
+ import type { ImportUnresolved, PatternInvalid } from "../domain/architecture-error.js";
4
+ import type { Violation } from "../domain/violation.js";
5
+ import type { DependencyKind, ModuleResolver, ResolvedTarget } from "../ports/module-resolver.js";
6
+ export type CompiledImportRule = {
7
+ readonly name: string;
8
+ readonly message: string;
9
+ readonly from: ReadonlyArray<RegExp>;
10
+ readonly fromNot: ReadonlyArray<RegExp>;
11
+ readonly to: ReadonlyArray<string>;
12
+ readonly toNot: ReadonlyArray<string>;
13
+ readonly externals: ReadonlySet<string>;
14
+ readonly dependencyKind: DependencyKind | null;
15
+ readonly probe: ImportProbe;
16
+ };
17
+ export declare const compileImportRule: (rule: ImportRule) => Result.Result<CompiledImportRule, PatternInvalid>;
18
+ export declare const compileImportRules: (rules: ReadonlyArray<ImportRule>) => Result.Result<ReadonlyArray<CompiledImportRule>, PatternInvalid>;
19
+ export type ImportEdge = {
20
+ readonly importer: string;
21
+ readonly specifier: string;
22
+ };
23
+ export type SelectedRule = readonly [CompiledImportRule, RegExpExecArray];
24
+ export declare const rulesSelecting: (rules: ReadonlyArray<CompiledImportRule>, importer: string) => ReadonlyArray<SelectedRule>;
25
+ export declare const evaluateSelectedEdge: (selected: ReadonlyArray<SelectedRule>, resolver: ModuleResolver, edge: ImportEdge) => Result.Result<ReadonlyArray<Violation>, ImportUnresolved>;
26
+ export declare const evaluateImportEdge: (rules: ReadonlyArray<CompiledImportRule>, resolver: ModuleResolver, edge: ImportEdge) => Result.Result<ReadonlyArray<Violation>, ImportUnresolved>;
27
+ export declare const probeTargetOf: (to: ImportProbeTarget) => ResolvedTarget;
28
+ export declare const rulesFailingTheirProbe: (rules: ReadonlyArray<CompiledImportRule>) => ReadonlyArray<CompiledImportRule>;
29
+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;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAK1E,eAAO,MAAM,cAAc,UAClB,aAAa,CAAC,kBAAkB,CAAC,YAC9B,MAAM,KACf,aAAa,CAAC,YAAY,CAO5B,CAAC;AAiBF,eAAO,MAAM,oBAAoB,aACrB,aAAa,CAAC,YAAY,CAAC,YAC3B,cAAc,QAClB,UAAU,KACf,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAqB1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACtB,aAAa,CAAC,kBAAkB,CAAC,YAC9B,cAAc,QAClB,UAAU,KACf,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,gBAAgB,CACiB,CAAC;AAI7E,eAAO,MAAM,aAAa,OAAQ,iBAAiB,KAAG,cAIrD,CAAC;AAKF,eAAO,MAAM,sBAAsB,UAC1B,aAAa,CAAC,kBAAkB,CAAC,KACvC,aAAa,CAAC,kBAAkB,CAK/B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import * as Result from "effect/Result";
2
+ import type { DeclarationKind, MemberProbe, MemberRule, MemberSubject } from "../domain/architecture-config.js";
3
+ import type { PatternInvalid } from "../domain/architecture-error.js";
4
+ import type { MemberSite } from "../domain/facts.js";
5
+ import type { Violation } from "../domain/violation.js";
6
+ import type { FactExtractor } from "../ports/fact-extractor.js";
7
+ export type { MemberSite } from "../domain/facts.js";
8
+ export type CompiledMemberRule = {
9
+ readonly name: string;
10
+ readonly message: string;
11
+ readonly from: ReadonlyArray<RegExp>;
12
+ readonly fromNot: ReadonlyArray<RegExp>;
13
+ readonly subject: MemberSubject;
14
+ readonly in: ReadonlyArray<RegExp>;
15
+ readonly declares: ReadonlyArray<DeclarationKind> | null;
16
+ readonly match: ReadonlyArray<RegExp>;
17
+ readonly matchNot: ReadonlyArray<RegExp>;
18
+ readonly allow: ReadonlyArray<RegExp>;
19
+ readonly probe: MemberProbe;
20
+ };
21
+ export declare const compileMemberRule: (rule: MemberRule) => Result.Result<CompiledMemberRule, PatternInvalid>;
22
+ export declare const compileMemberRules: (rules: ReadonlyArray<MemberRule>) => Result.Result<ReadonlyArray<CompiledMemberRule>, PatternInvalid>;
23
+ export declare const memberRulesSelecting: (rules: ReadonlyArray<CompiledMemberRule>, file: string) => ReadonlyArray<CompiledMemberRule>;
24
+ export declare const evaluateMemberSite: (selected: ReadonlyArray<CompiledMemberRule>, site: MemberSite) => ReadonlyArray<Violation>;
25
+ export declare const memberRulesFailingTheirProbe: (rules: ReadonlyArray<CompiledMemberRule>, extractor: FactExtractor) => ReadonlyArray<CompiledMemberRule>;
26
+ //# sourceMappingURL=members.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../../src/core/members.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EACX,UAAU,EACV,aAAa,EACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAEnC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,SACtB,UAAU,KACf,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,CAsClD,CAAC;AAEF,eAAO,MAAM,kBAAkB,UACtB,aAAa,CAAC,UAAU,CAAC,KAC/B,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAAE,cAAc,CAQjE,CAAC;AAKF,eAAO,MAAM,oBAAoB,UACxB,aAAa,CAAC,kBAAkB,CAAC,QAClC,MAAM,KACX,aAAa,CAAC,kBAAkB,CAAgE,CAAC;AAgBpG,eAAO,MAAM,kBAAkB,aACnB,aAAa,CAAC,kBAAkB,CAAC,QACrC,UAAU,KACf,aAAa,CAAC,SAAS,CAezB,CAAC;AAQF,eAAO,MAAM,4BAA4B,UAChC,aAAa,CAAC,kBAAkB,CAAC,aAC7B,aAAa,KACvB,aAAa,CAAC,kBAAkB,CAwB/B,CAAC"}
@@ -0,0 +1,17 @@
1
+ import * as Result from "effect/Result";
2
+ import { PatternInvalid } from "../domain/architecture-error.js";
3
+ export declare const compilePatterns: (ruleName: string, field: string, patterns: string | ReadonlyArray<string> | undefined) => Result.Result<ReadonlyArray<RegExp>, PatternInvalid>;
4
+ export declare const validateTargetPatterns: (ruleName: string, fields: ReadonlyArray<readonly [string, string | ReadonlyArray<string> | undefined]>) => Result.Result<void, PatternInvalid>;
5
+ export declare const sourcesOf: (patterns: string | ReadonlyArray<string> | undefined) => ReadonlyArray<string>;
6
+ export declare const matchesAny: (patterns: ReadonlyArray<string>, captures: RegExpExecArray, value: string) => boolean;
7
+ export type Selectable = {
8
+ readonly from: ReadonlyArray<RegExp>;
9
+ readonly fromNot: ReadonlyArray<RegExp>;
10
+ };
11
+ export declare const firstFromMatch: (rule: Selectable, importer: string) => RegExpExecArray | null;
12
+ export type Targeted = Selectable & {
13
+ readonly to: ReadonlyArray<string>;
14
+ readonly toNot: ReadonlyArray<string>;
15
+ };
16
+ export declare const targetAllowed: (rule: Targeted, captures: RegExpExecArray, targetPath: string) => boolean;
17
+ //# sourceMappingURL=patterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../../src/core/patterns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAoBjE,eAAO,MAAM,eAAe,aAChB,MAAM,SACT,MAAM,YACH,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,KACnD,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CASrD,CAAC;AAMF,eAAO,MAAM,sBAAsB,aACvB,MAAM,UACR,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC,KACnF,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAUpC,CAAC;AAEF,eAAO,MAAM,SAAS,aACV,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,KACnD,aAAa,CAAC,MAAM,CAA8D,CAAC;AAuBtF,eAAO,MAAM,UAAU,aACX,aAAa,CAAC,MAAM,CAAC,YACrB,eAAe,SAClB,MAAM,KACZ,OAAgG,CAAC;AAEpG,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,cAAc,SAAU,UAAU,YAAY,MAAM,KAAG,eAAe,GAAG,IAOrF,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG;IAClC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,aAAa,SAClB,QAAQ,YACJ,eAAe,cACb,MAAM,KACjB,OAIF,CAAC"}
@@ -0,0 +1,48 @@
1
+ import * as Result from "effect/Result";
2
+ import type { StructureConfig } from "../domain/architecture-config.js";
3
+ import type { PatternInvalid } from "../domain/architecture-error.js";
4
+ import type { Violation } from "../domain/violation.js";
5
+ import type { FileSystem } from "../ports/file-system.js";
6
+ export type CompiledStructureRoot = {
7
+ readonly name: string;
8
+ readonly message: string;
9
+ readonly path: ReadonlyArray<RegExp>;
10
+ readonly probe: string;
11
+ };
12
+ export type CompiledStructureFolder = {
13
+ readonly name: string;
14
+ readonly message: string;
15
+ readonly folder: ReadonlyArray<RegExp>;
16
+ readonly files: ReadonlyArray<RegExp>;
17
+ readonly probe: string;
18
+ };
19
+ export type CompiledStructureParity = {
20
+ readonly name: string;
21
+ readonly message: string;
22
+ readonly file: ReadonlyArray<RegExp>;
23
+ readonly fileNot: ReadonlyArray<RegExp>;
24
+ readonly requires: ReadonlyArray<string>;
25
+ readonly probe: string;
26
+ };
27
+ export type CompiledStructureNaming = {
28
+ readonly name: string;
29
+ readonly message: string;
30
+ readonly file: ReadonlyArray<RegExp>;
31
+ readonly fileNot: ReadonlyArray<RegExp>;
32
+ readonly subject: number;
33
+ readonly convention: RegExp | null;
34
+ readonly sameAs: number | null;
35
+ readonly probe: string;
36
+ };
37
+ export type CompiledStructure = {
38
+ readonly roots: ReadonlyArray<CompiledStructureRoot>;
39
+ readonly folders: ReadonlyArray<CompiledStructureFolder>;
40
+ readonly parity: ReadonlyArray<CompiledStructureParity>;
41
+ readonly naming: ReadonlyArray<CompiledStructureNaming>;
42
+ };
43
+ export declare const EMPTY_STRUCTURE: CompiledStructure;
44
+ export declare const compileStructure: (config: StructureConfig | undefined) => Result.Result<CompiledStructure, PatternInvalid>;
45
+ export declare const requiredSiblingsOf: (rule: CompiledStructureParity, file: string) => ReadonlyArray<string>;
46
+ export declare const evaluateStructure: (structure: CompiledStructure, fileSystem: FileSystem, file: string) => ReadonlyArray<Violation>;
47
+ export declare const structureRulesFailingTheirProbe: (structure: CompiledStructure) => ReadonlyArray<string>;
48
+ //# sourceMappingURL=structure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../../src/core/structure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,C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qB,CAAC,CAAC;IACrD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IACzD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;IACxD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,uBAAuB,CAAC,CAAC;CACzD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,iBAK7B,CAAC;AAgFF,eAAO,MAAM,gBAAgB,WACnB,eAAe,GAAG,SAAS,KAClC,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAkBjD,CAAC;AAgCF,eAAO,MAAM,kBAAkB,SACvB,uBAAuB,QACvB,MAAM,KACX,aAAa,CAAC,MAAM,CAMtB,CAAC;AAiCF,eAAO,MAAM,iBAAiB,cACjB,iBAAiB,cAChB,UAAU,QAChB,MAAM,KACX,aAAa,CAAC,SAAS,CAiEzB,CAAC;AAMF,eAAO,MAAM,+BAA+B,cAC/B,iBAAiB,KAC3B,aAAa,CAAC,MAAM,CAoCtB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import * as Result from "effect/Result";
2
+ import type { BindingKind, DeclarationKind, SurfaceProbe, SurfaceRule } from "../domain/architecture-config.js";
3
+ import type { PatternInvalid } from "../domain/architecture-error.js";
4
+ import type { ExportSite } from "../domain/facts.js";
5
+ import type { Violation } from "../domain/violation.js";
6
+ import type { FactExtractor } from "../ports/fact-extractor.js";
7
+ export type { ExportSite } from "../domain/facts.js";
8
+ export type Demand = {
9
+ readonly kind: "forbid";
10
+ } | {
11
+ readonly kind: "allow";
12
+ readonly allow: ReadonlyArray<RegExp>;
13
+ } | {
14
+ readonly kind: "convention";
15
+ readonly convention: RegExp;
16
+ } | {
17
+ readonly kind: "count";
18
+ readonly min: number;
19
+ readonly max: number;
20
+ };
21
+ export type CompiledSurfaceRule = {
22
+ readonly name: string;
23
+ readonly message: string;
24
+ readonly from: ReadonlyArray<RegExp>;
25
+ readonly fromNot: ReadonlyArray<RegExp>;
26
+ readonly kinds: ReadonlyArray<BindingKind> | null;
27
+ readonly declares: ReadonlyArray<DeclarationKind> | null;
28
+ readonly reexport: boolean | null;
29
+ readonly match: ReadonlyArray<RegExp>;
30
+ readonly matchNot: ReadonlyArray<RegExp>;
31
+ readonly demand: Demand;
32
+ readonly probe: SurfaceProbe;
33
+ };
34
+ export declare const compileSurfaceRule: (rule: SurfaceRule) => Result.Result<CompiledSurfaceRule, PatternInvalid>;
35
+ export declare const compileSurfaceRules: (rules: ReadonlyArray<SurfaceRule>) => Result.Result<ReadonlyArray<CompiledSurfaceRule>, PatternInvalid>;
36
+ export declare const surfaceRulesSelecting: (rules: ReadonlyArray<CompiledSurfaceRule>, file: string) => ReadonlyArray<CompiledSurfaceRule>;
37
+ export declare const evaluateSurface: (selected: ReadonlyArray<CompiledSurfaceRule>, file: string, sites: ReadonlyArray<ExportSite>) => ReadonlyArray<Violation>;
38
+ export declare const surfaceRulesFailingTheirProbe: (rules: ReadonlyArray<CompiledSurfaceRule>, extractor: FactExtractor) => ReadonlyArray<CompiledSurfaceRule>;
39
+ //# sourceMappingURL=surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../../../src/core/surface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,WAAW,EACZ,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAGhE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,MAAM,MAAM,MAAM,GACd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