@nielspeter/eess-mermaid 0.1.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.
Files changed (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/dist/bridge/from-diagram.d.ts +58 -0
  4. package/dist/bridge/from-diagram.d.ts.map +1 -0
  5. package/dist/bridge/from-diagram.js +112 -0
  6. package/dist/bridge/from-diagram.js.map +1 -0
  7. package/dist/builders/class-rule-builder.d.ts +45 -0
  8. package/dist/builders/class-rule-builder.d.ts.map +1 -0
  9. package/dist/builders/class-rule-builder.js +89 -0
  10. package/dist/builders/class-rule-builder.js.map +1 -0
  11. package/dist/cli/bin.d.ts +3 -0
  12. package/dist/cli/bin.d.ts.map +1 -0
  13. package/dist/cli/bin.js +4 -0
  14. package/dist/cli/bin.js.map +1 -0
  15. package/dist/cli/commands/check.d.ts +8 -0
  16. package/dist/cli/commands/check.d.ts.map +1 -0
  17. package/dist/cli/commands/check.js +44 -0
  18. package/dist/cli/commands/check.js.map +1 -0
  19. package/dist/cli/commands/explain.d.ts +6 -0
  20. package/dist/cli/commands/explain.d.ts.map +1 -0
  21. package/dist/cli/commands/explain.js +29 -0
  22. package/dist/cli/commands/explain.js.map +1 -0
  23. package/dist/cli/config.d.ts +8 -0
  24. package/dist/cli/config.d.ts.map +1 -0
  25. package/dist/cli/config.js +4 -0
  26. package/dist/cli/config.js.map +1 -0
  27. package/dist/cli/index.d.ts +2 -0
  28. package/dist/cli/index.d.ts.map +1 -0
  29. package/dist/cli/index.js +130 -0
  30. package/dist/cli/index.js.map +1 -0
  31. package/dist/cli/load-rules.d.ts +10 -0
  32. package/dist/cli/load-rules.d.ts.map +1 -0
  33. package/dist/cli/load-rules.js +62 -0
  34. package/dist/cli/load-rules.js.map +1 -0
  35. package/dist/cli/resolve-config.d.ts +3 -0
  36. package/dist/cli/resolve-config.d.ts.map +1 -0
  37. package/dist/cli/resolve-config.js +50 -0
  38. package/dist/cli/resolve-config.js.map +1 -0
  39. package/dist/cli/watch.d.ts +8 -0
  40. package/dist/cli/watch.d.ts.map +1 -0
  41. package/dist/cli/watch.js +114 -0
  42. package/dist/cli/watch.js.map +1 -0
  43. package/dist/conditions/class.d.ts +11 -0
  44. package/dist/conditions/class.d.ts.map +1 -0
  45. package/dist/conditions/class.js +163 -0
  46. package/dist/conditions/class.js.map +1 -0
  47. package/dist/core/diagram.d.ts +3 -0
  48. package/dist/core/diagram.d.ts.map +1 -0
  49. package/dist/core/diagram.js +18 -0
  50. package/dist/core/diagram.js.map +1 -0
  51. package/dist/core/index.d.ts +5 -0
  52. package/dist/core/index.d.ts.map +1 -0
  53. package/dist/core/index.js +3 -0
  54. package/dist/core/index.js.map +1 -0
  55. package/dist/core/project.d.ts +7 -0
  56. package/dist/core/project.d.ts.map +1 -0
  57. package/dist/core/project.js +2 -0
  58. package/dist/core/project.js.map +1 -0
  59. package/dist/core/violation.d.ts +15 -0
  60. package/dist/core/violation.d.ts.map +1 -0
  61. package/dist/core/violation.js +16 -0
  62. package/dist/core/violation.js.map +1 -0
  63. package/dist/index.d.ts +33 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +31 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/models/arch-class.d.ts +20 -0
  68. package/dist/models/arch-class.d.ts.map +1 -0
  69. package/dist/models/arch-class.js +33 -0
  70. package/dist/models/arch-class.js.map +1 -0
  71. package/dist/models/er-entity.d.ts +32 -0
  72. package/dist/models/er-entity.d.ts.map +1 -0
  73. package/dist/models/er-entity.js +37 -0
  74. package/dist/models/er-entity.js.map +1 -0
  75. package/dist/parser/generated/ast.d.ts +539 -0
  76. package/dist/parser/generated/ast.d.ts.map +1 -0
  77. package/dist/parser/generated/ast.js +443 -0
  78. package/dist/parser/generated/ast.js.map +1 -0
  79. package/dist/parser/generated/grammar.d.ts +8 -0
  80. package/dist/parser/generated/grammar.d.ts.map +1 -0
  81. package/dist/parser/generated/grammar.js +10 -0
  82. package/dist/parser/generated/grammar.js.map +1 -0
  83. package/dist/parser/generated/module.d.ts +21 -0
  84. package/dist/parser/generated/module.d.ts.map +1 -0
  85. package/dist/parser/generated/module.js +32 -0
  86. package/dist/parser/generated/module.js.map +1 -0
  87. package/dist/parser/parse-class-diagram.d.ts +7 -0
  88. package/dist/parser/parse-class-diagram.d.ts.map +1 -0
  89. package/dist/parser/parse-class-diagram.js +33 -0
  90. package/dist/parser/parse-class-diagram.js.map +1 -0
  91. package/dist/parser/parse-directives.d.ts +38 -0
  92. package/dist/parser/parse-directives.d.ts.map +1 -0
  93. package/dist/parser/parse-directives.js +96 -0
  94. package/dist/parser/parse-directives.js.map +1 -0
  95. package/dist/parser/parse-er-diagram.d.ts +4 -0
  96. package/dist/parser/parse-er-diagram.d.ts.map +1 -0
  97. package/dist/parser/parse-er-diagram.js +27 -0
  98. package/dist/parser/parse-er-diagram.js.map +1 -0
  99. package/dist/parser/validate-diagram.d.ts +11 -0
  100. package/dist/parser/validate-diagram.d.ts.map +1 -0
  101. package/dist/parser/validate-diagram.js +67 -0
  102. package/dist/parser/validate-diagram.js.map +1 -0
  103. package/dist/predicates/class.d.ts +13 -0
  104. package/dist/predicates/class.d.ts.map +1 -0
  105. package/dist/predicates/class.js +73 -0
  106. package/dist/predicates/class.js.map +1 -0
  107. package/package.json +50 -0
@@ -0,0 +1,5 @@
1
+ export type { Predicate, Condition, ConditionContext, CodeFrameOptions, FormatOptions, } from '@nielspeter/eess';
2
+ export { ArchRuleError, RuleBuilder, generateCodeFrame, formatViolations, formatViolationsPlain, definePredicate, defineCondition, } from '@nielspeter/eess';
3
+ export type { ArchViolation } from './violation.js';
4
+ export { createViolation } from './violation.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,GACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAA;AAGzB,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { ArchRuleError, RuleBuilder, generateCodeFrame, formatViolations, formatViolationsPlain, definePredicate, defineCondition, } from '@nielspeter/eess';
2
+ export { createViolation } from './violation.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { Diagram } from '../parser/generated/ast.js';
2
+ export interface ArchProject {
3
+ readonly source: string;
4
+ readonly filePath?: string;
5
+ readonly ast: Diagram;
6
+ }
7
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import { type ArchViolation } from '@nielspeter/eess';
2
+ export type { ArchViolation };
3
+ export declare function createViolation(fields: {
4
+ element: string;
5
+ file: string;
6
+ line: number;
7
+ sourceText?: string;
8
+ }, message: string, context: {
9
+ rule: string;
10
+ because?: string;
11
+ suggestion?: string;
12
+ ruleId?: string;
13
+ docs?: string;
14
+ }): ArchViolation;
15
+ //# sourceMappingURL=violation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"violation.d.ts","sourceRoot":"","sources":["../../src/core/violation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAKxE,YAAY,EAAE,aAAa,EAAE,CAAA;AAE7B,wBAAgB,eAAe,CAC7B,MAAM,EAAE;IACN,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,EACD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IACP,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GACA,aAAa,CAaf"}
@@ -0,0 +1,16 @@
1
+ import { generateCodeFrame } from '@nielspeter/eess';
2
+ export function createViolation(fields, message, context) {
3
+ return {
4
+ rule: context.rule,
5
+ ruleId: context.ruleId,
6
+ element: fields.element,
7
+ file: fields.file,
8
+ line: fields.line,
9
+ message,
10
+ because: context.because,
11
+ suggestion: context.suggestion,
12
+ docs: context.docs,
13
+ codeFrame: fields.sourceText ? generateCodeFrame(fields.sourceText, fields.line) : undefined,
14
+ };
15
+ }
16
+ //# sourceMappingURL=violation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"violation.js","sourceRoot":"","sources":["../../src/core/violation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAsB,MAAM,kBAAkB,CAAA;AAOxE,MAAM,UAAU,eAAe,CAC7B,MAKC,EACD,OAAe,EACf,OAMC;IAED,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO;QACP,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;KAC7F,CAAA;AACH,CAAC"}
@@ -0,0 +1,33 @@
1
+ export * from './core/index.js';
2
+ export type { CheckOptions, OutputFormat, BaselineFilter, DiffFilterLike } from '@nielspeter/eess';
3
+ export { formatViolationsJson } from '@nielspeter/eess';
4
+ export { formatViolationsGitHub } from '@nielspeter/eess';
5
+ export { detectFormat, isCI } from '@nielspeter/eess';
6
+ export { parseExclusionComments, isExcludedByComment } from '@nielspeter/eess';
7
+ export type { ExclusionComment, ExclusionWarning, ParseResult } from '@nielspeter/eess';
8
+ export { silent } from '@nielspeter/eess';
9
+ export type { SilentExclusion } from '@nielspeter/eess';
10
+ export { TerminalBuilder } from '@nielspeter/eess';
11
+ export type { RuleMetadata } from '@nielspeter/eess';
12
+ export type { RuleDescription } from '@nielspeter/eess';
13
+ export { not, and, or } from '@nielspeter/eess';
14
+ export type { ArchProject } from './core/project.js';
15
+ export { diagram } from './core/diagram.js';
16
+ export { parseClassDiagram, MermaidUnitParseError } from './parser/parse-class-diagram.js';
17
+ export { classes, ClassRuleBuilder } from './builders/class-rule-builder.js';
18
+ export type { ArchClass, ArchRelationship } from './models/arch-class.js';
19
+ export { collectClasses, collectRelationships } from './models/arch-class.js';
20
+ export { haveStereotype as predicateHaveStereotype, haveNameMatching, haveNameStartingWith, haveNameEndingWith, haveMemberNamed, haveMethodNamed, areAbstract, haveAtLeastOneMethod, haveNoMembers, extendName, } from './predicates/class.js';
21
+ export { notExtendStereotype, extendClass, notExist, haveStereotype as conditionHaveStereotype, notHaveStereotype, dependOn, notDependOn, notDependOnStereotype, } from './conditions/class.js';
22
+ export { parseDirectives, findDirective } from './parser/parse-directives.js';
23
+ export type { ParsedDirective, DirectiveSchema, DirectiveStereotype, DirectiveId, DirectiveUnknown, DirectiveDiagnostic, DirectiveParseResult, } from './parser/parse-directives.js';
24
+ export { validateReferences } from './parser/validate-diagram.js';
25
+ export type { ReferenceDiagnostic } from './parser/validate-diagram.js';
26
+ export { defineConfig } from './cli/config.js';
27
+ export type { CliConfig } from './cli/config.js';
28
+ export { fromDiagram } from './bridge/from-diagram.js';
29
+ export type { BridgeOptions, BridgeRule, BridgeRuleAllowedEdge, BridgeRuleForbiddenEdge, BridgeRuleInheritance, BridgeOutput, } from './bridge/from-diagram.js';
30
+ export { parseErDiagram } from './parser/parse-er-diagram.js';
31
+ export { collectEntities, collectErRelationships } from './models/er-entity.js';
32
+ export type { ErAttributeInfo, ErEntityInfo, ErRelationshipInfo } from './models/er-entity.js';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAA;AAC/B,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD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,EACR,WAAW,EACX,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAG9B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC7E,YAAY,EACV,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,8BAA8B,CAAA;AAGrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGhD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,YAAY,EACV,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,GACb,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC/E,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ // Core kernel
2
+ export * from './core/index.js';
3
+ export { formatViolationsJson } from '@nielspeter/eess';
4
+ export { formatViolationsGitHub } from '@nielspeter/eess';
5
+ export { detectFormat, isCI } from '@nielspeter/eess';
6
+ export { parseExclusionComments, isExcludedByComment } from '@nielspeter/eess';
7
+ export { silent } from '@nielspeter/eess';
8
+ export { TerminalBuilder } from '@nielspeter/eess';
9
+ export { not, and, or } from '@nielspeter/eess';
10
+ export { diagram } from './core/diagram.js';
11
+ // Parser
12
+ export { parseClassDiagram, MermaidUnitParseError } from './parser/parse-class-diagram.js';
13
+ // Class entry point
14
+ export { classes, ClassRuleBuilder } from './builders/class-rule-builder.js';
15
+ export { collectClasses, collectRelationships } from './models/arch-class.js';
16
+ // Predicates
17
+ export { haveStereotype as predicateHaveStereotype, haveNameMatching, haveNameStartingWith, haveNameEndingWith, haveMemberNamed, haveMethodNamed, areAbstract, haveAtLeastOneMethod, haveNoMembers, extendName, } from './predicates/class.js';
18
+ // Conditions
19
+ export { notExtendStereotype, extendClass, notExist, haveStereotype as conditionHaveStereotype, notHaveStereotype, dependOn, notDependOn, notDependOnStereotype, } from './conditions/class.js';
20
+ // Directive parsing
21
+ export { parseDirectives, findDirective } from './parser/parse-directives.js';
22
+ // Reference validation
23
+ export { validateReferences } from './parser/validate-diagram.js';
24
+ // CLI config (for eess-mermaid.config.ts authoring)
25
+ export { defineConfig } from './cli/config.js';
26
+ // Bridge to eess-ts
27
+ export { fromDiagram } from './bridge/from-diagram.js';
28
+ // ER diagrams (plan 0069 Phase 3)
29
+ export { parseErDiagram } from './parser/parse-er-diagram.js';
30
+ export { collectEntities, collectErRelationships } from './models/er-entity.js';
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,cAAc,iBAAiB,CAAA;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE9E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGlD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAI/C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,SAAS;AACT,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AAE1F,oBAAoB;AACpB,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAE5E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7E,aAAa;AACb,OAAO,EACL,cAAc,IAAI,uBAAuB,EACzC,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,UAAU,GACX,MAAM,uBAAuB,CAAA;AAE9B,aAAa;AACb,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,cAAc,IAAI,uBAAuB,EACzC,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,qBAAqB,GACtB,MAAM,uBAAuB,CAAA;AAE9B,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAW7E,uBAAuB;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAGjE,oDAAoD;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C,oBAAoB;AACpB,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAUtD,kCAAkC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,20 @@
1
+ import type { ClassDef as AstClassDef } from '../parser/generated/ast.js';
2
+ import type { ArchProject } from '../core/project.js';
3
+ export interface ArchClass {
4
+ readonly node: AstClassDef;
5
+ readonly name: string;
6
+ readonly stereotypes: readonly string[];
7
+ readonly memberNames: readonly string[];
8
+ readonly methodNames: readonly string[];
9
+ readonly project: ArchProject;
10
+ }
11
+ export interface ArchRelationship {
12
+ readonly source: string;
13
+ readonly target: string;
14
+ readonly arrow: string;
15
+ readonly label?: string;
16
+ }
17
+ export declare function collectClasses(project: ArchProject): ArchClass[];
18
+ export declare function collectRelationships(project: ArchProject): ArchRelationship[];
19
+ export declare function getClassLine(c: ArchClass): number;
20
+ //# sourceMappingURL=arch-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arch-class.d.ts","sourceRoot":"","sources":["../../src/models/arch-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,EAAE,CAqBhE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,gBAAgB,EAAE,CAO7E;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAEjD"}
@@ -0,0 +1,33 @@
1
+ export function collectClasses(project) {
2
+ const assignmentsByClass = new Map();
3
+ for (const a of project.ast.stereotypeAssignments) {
4
+ const target = a.classRef.$refText;
5
+ const list = assignmentsByClass.get(target) ?? [];
6
+ list.push(a.stereotype.name);
7
+ assignmentsByClass.set(target, list);
8
+ }
9
+ return project.ast.classes.map((c) => {
10
+ const inline = c.stereotypes.map((s) => s.name);
11
+ const external = assignmentsByClass.get(c.name) ?? [];
12
+ return {
13
+ node: c,
14
+ name: c.name,
15
+ stereotypes: [...inline, ...external],
16
+ memberNames: c.members.map((m) => m.name),
17
+ methodNames: c.members.filter((m) => m.method).map((m) => m.name),
18
+ project,
19
+ };
20
+ });
21
+ }
22
+ export function collectRelationships(project) {
23
+ return project.ast.relationships.map((r) => ({
24
+ source: r.lhs.$refText,
25
+ target: r.rhs.$refText,
26
+ arrow: r.arrow,
27
+ label: r.label,
28
+ }));
29
+ }
30
+ export function getClassLine(c) {
31
+ return c.node.$cstNode?.range.start.line ?? 0;
32
+ }
33
+ //# sourceMappingURL=arch-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arch-class.js","sourceRoot":"","sources":["../../src/models/arch-class.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,cAAc,CAAC,OAAoB;IACjD,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAoB,CAAA;IACtD,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAA;QAClC,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;QACjD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC5B,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,OAAO,CAAC,GAAG,CAA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@ -0,0 +1,32 @@
1
+ import type { ErDiagram } from '../parser/generated/ast.js';
2
+ /** An attribute of an ER entity, as the model layer exposes it. */
3
+ export interface ErAttributeInfo {
4
+ readonly type: string;
5
+ readonly name: string;
6
+ /** Key constraints (`PK` / `FK` / `UK`), in declaration order. */
7
+ readonly keys: readonly string[];
8
+ /** The trailing quoted comment, unquoted — `undefined` when absent. */
9
+ readonly comment?: string;
10
+ }
11
+ /** An ER entity: a declared block, an implicit relationship endpoint, or both. */
12
+ export interface ErEntityInfo {
13
+ readonly name: string;
14
+ readonly attributes: readonly ErAttributeInfo[];
15
+ /** `true` when the entity has a declared block (`Name { … }`). */
16
+ readonly declared: boolean;
17
+ }
18
+ /** A relationship between two entities. */
19
+ export interface ErRelationshipInfo {
20
+ readonly lhs: string;
21
+ readonly rhs: string;
22
+ readonly cardinality: string;
23
+ readonly label?: string;
24
+ }
25
+ /**
26
+ * Collect the diagram's entities — declared blocks unioned with implicit
27
+ * relationship endpoints (Mermaid allows both), keyed by name.
28
+ */
29
+ export declare function collectEntities(ast: ErDiagram): ErEntityInfo[];
30
+ /** Collect the diagram's relationships. */
31
+ export declare function collectErRelationships(ast: ErDiagram): ErRelationshipInfo[];
32
+ //# sourceMappingURL=er-entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"er-entity.d.ts","sourceRoot":"","sources":["../../src/models/er-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,mEAAmE;AACnE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC,uEAAuE;IACvE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,SAAS,eAAe,EAAE,CAAA;IAC/C,kEAAkE;IAClE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC3B;AAED,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,CAoB9D;AAED,2CAA2C;AAC3C,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,SAAS,GAAG,kBAAkB,EAAE,CAO3E"}
@@ -0,0 +1,37 @@
1
+ const unquote = (s) => s.replace(/^"|"$/g, '');
2
+ /**
3
+ * Collect the diagram's entities — declared blocks unioned with implicit
4
+ * relationship endpoints (Mermaid allows both), keyed by name.
5
+ */
6
+ export function collectEntities(ast) {
7
+ const byName = new Map();
8
+ for (const e of ast.entities) {
9
+ byName.set(e.name, {
10
+ name: e.name,
11
+ declared: true,
12
+ attributes: e.attributes.map((a) => ({
13
+ type: a.type,
14
+ name: a.name,
15
+ keys: [...a.keys],
16
+ ...(a.comment !== undefined && { comment: unquote(a.comment) }),
17
+ })),
18
+ });
19
+ }
20
+ for (const r of ast.relationships) {
21
+ for (const name of [r.lhs, r.rhs]) {
22
+ if (!byName.has(name))
23
+ byName.set(name, { name, declared: false, attributes: [] });
24
+ }
25
+ }
26
+ return [...byName.values()];
27
+ }
28
+ /** Collect the diagram's relationships. */
29
+ export function collectErRelationships(ast) {
30
+ return ast.relationships.map((r) => ({
31
+ lhs: r.lhs,
32
+ rhs: r.rhs,
33
+ cardinality: r.cardinality,
34
+ ...(r.label !== undefined && { label: unquote(r.label) }),
35
+ }));
36
+ }
37
+ //# sourceMappingURL=er-entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"er-entity.js","sourceRoot":"","sources":["../../src/models/er-entity.ts"],"names":[],"mappings":"AA4BA,MAAM,OAAO,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;AAE9D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAc;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC9C,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE;YACjB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACnC,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACjB,GAAG,CAAC,CAAC,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;aAChE,CAAC,CAAC;SACJ,CAAC,CAAA;IACJ,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;QAClC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU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