drizzle-docs-generator 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mermaid.d.ts","sourceRoot":"","sources":["../../src/formatter/mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,YAAW,eAAe;IAC/D,OAAO,CAAC,OAAO,CAAoC;IAEnD;;;;OAIG;gBACS,OAAO,GAAE,uBAA4B;IAIjD;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IA4B1C;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAiDpE;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAgBhC;;OAEG;IACH,OAAO,CAAC,WAAW;IAiBnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAmCpB;;;;OAIG;IACH,OAAO,CAAC,YAAY;
|
|
1
|
+
{"version":3,"file":"mermaid.d.ts","sourceRoot":"","sources":["../../src/formatter/mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,gBAAgB;IAC/D;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAYD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,YAAW,eAAe;IAC/D,OAAO,CAAC,OAAO,CAAoC;IAEnD;;;;OAIG;gBACS,OAAO,GAAE,uBAA4B;IAIjD;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IA4B1C;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAiDpE;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAgBhC;;OAEG;IACH,OAAO,CAAC,WAAW;IAiBnB;;OAEG;IACH,OAAO,CAAC,YAAY;IAmCpB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAiDpB;;;;;;;;OAQG;IACH,OAAO,CAAC,cAAc;IAStB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAazB;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAUlB;;OAEG;IACH,OAAO,CAAC,YAAY;CAGrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const u = {
|
|
2
2
|
includeComments: !0,
|
|
3
3
|
includeIndexes: !0,
|
|
4
4
|
includeConstraints: !0,
|
|
@@ -12,7 +12,7 @@ class f {
|
|
|
12
12
|
* @param options - Formatter options
|
|
13
13
|
*/
|
|
14
14
|
constructor(e = {}) {
|
|
15
|
-
this.options = { ...
|
|
15
|
+
this.options = { ...u, ...e };
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Format the intermediate schema into a Mermaid ER diagram
|
|
@@ -21,15 +21,15 @@ class f {
|
|
|
21
21
|
* @returns Mermaid ER diagram string
|
|
22
22
|
*/
|
|
23
23
|
format(e) {
|
|
24
|
-
const t = ["erDiagram"],
|
|
25
|
-
for (const
|
|
26
|
-
const
|
|
27
|
-
|
|
24
|
+
const t = ["erDiagram"], n = this.collectForeignKeyColumns(e.relations);
|
|
25
|
+
for (const o of e.relations) {
|
|
26
|
+
const i = this.formatRelation(o);
|
|
27
|
+
i && t.push(` ${i}`);
|
|
28
28
|
}
|
|
29
29
|
e.relations.length > 0 && e.tables.length > 0 && t.push("");
|
|
30
|
-
for (const
|
|
31
|
-
const
|
|
32
|
-
t.push(...
|
|
30
|
+
for (const o of e.tables) {
|
|
31
|
+
const i = this.formatTable(o, n);
|
|
32
|
+
t.push(...i);
|
|
33
33
|
}
|
|
34
34
|
return t.join(`
|
|
35
35
|
`);
|
|
@@ -42,22 +42,22 @@ class f {
|
|
|
42
42
|
* @returns Mermaid ER diagram string showing only the focused table and its relations
|
|
43
43
|
*/
|
|
44
44
|
formatFocused(e, t) {
|
|
45
|
-
if (!e.tables.find((
|
|
45
|
+
if (!e.tables.find((s) => s.name === t))
|
|
46
46
|
return "erDiagram";
|
|
47
|
-
const
|
|
48
|
-
for (const
|
|
49
|
-
(
|
|
50
|
-
const
|
|
51
|
-
for (const
|
|
52
|
-
const l = this.formatRelation(
|
|
53
|
-
l &&
|
|
47
|
+
const o = /* @__PURE__ */ new Set([t]), i = [];
|
|
48
|
+
for (const s of e.relations)
|
|
49
|
+
(s.fromTable === t || s.toTable === t) && (o.add(s.fromTable), o.add(s.toTable), i.push(s));
|
|
50
|
+
const a = e.tables.filter((s) => o.has(s.name)), m = this.collectForeignKeyColumns(i), r = ["erDiagram"];
|
|
51
|
+
for (const s of i) {
|
|
52
|
+
const l = this.formatRelation(s);
|
|
53
|
+
l && r.push(` ${l}`);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
for (const
|
|
57
|
-
const l = this.formatTable(
|
|
58
|
-
|
|
55
|
+
i.length > 0 && a.length > 0 && r.push("");
|
|
56
|
+
for (const s of a) {
|
|
57
|
+
const l = this.formatTable(s, m);
|
|
58
|
+
r.push(...l);
|
|
59
59
|
}
|
|
60
|
-
return
|
|
60
|
+
return r.join(`
|
|
61
61
|
`);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -65,10 +65,10 @@ class f {
|
|
|
65
65
|
*/
|
|
66
66
|
collectForeignKeyColumns(e) {
|
|
67
67
|
const t = /* @__PURE__ */ new Map();
|
|
68
|
-
for (const
|
|
69
|
-
t.has(
|
|
70
|
-
for (const
|
|
71
|
-
t.get(
|
|
68
|
+
for (const n of e) {
|
|
69
|
+
t.has(n.fromTable) || t.set(n.fromTable, /* @__PURE__ */ new Set());
|
|
70
|
+
for (const o of n.fromColumns)
|
|
71
|
+
t.get(n.fromTable).add(o);
|
|
72
72
|
}
|
|
73
73
|
return t;
|
|
74
74
|
}
|
|
@@ -76,22 +76,22 @@ class f {
|
|
|
76
76
|
* Format a table definition to Mermaid syntax
|
|
77
77
|
*/
|
|
78
78
|
formatTable(e, t) {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
for (const
|
|
82
|
-
const m = this.formatColumn(
|
|
83
|
-
|
|
79
|
+
const n = [], o = this.escapeName(e.name), i = t.get(e.name) || /* @__PURE__ */ new Set();
|
|
80
|
+
n.push(` ${o} {`);
|
|
81
|
+
for (const a of e.columns) {
|
|
82
|
+
const m = this.formatColumn(a, i);
|
|
83
|
+
n.push(` ${m}`);
|
|
84
84
|
}
|
|
85
|
-
return
|
|
85
|
+
return n.push(" }"), n;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Format a column definition to Mermaid syntax
|
|
89
89
|
*/
|
|
90
90
|
formatColumn(e, t) {
|
|
91
|
-
const o = [];
|
|
92
|
-
this.options.includeColumnTypes && o.push(this.simplifyType(e.type)), o.push(this.escapeName(e.name));
|
|
93
91
|
const n = [];
|
|
94
|
-
|
|
92
|
+
this.options.includeColumnTypes && n.push(this.simplifyType(e.type)), n.push(this.escapeName(e.name));
|
|
93
|
+
const o = [];
|
|
94
|
+
return e.primaryKey && o.push("PK"), t.has(e.name) && o.push("FK"), e.unique && !e.primaryKey && o.push("UK"), o.length > 0 && n.push(o.join(",")), this.options.includeComments && e.comment && n.push(`"${this.escapeString(e.comment)}"`), n.join(" ");
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* Simplify SQL type for Mermaid display
|
|
@@ -112,18 +112,33 @@ class f {
|
|
|
112
112
|
boolean: "boolean",
|
|
113
113
|
timestamp: "timestamp",
|
|
114
114
|
timestamptz: "timestamptz",
|
|
115
|
+
"timestamp with time zone": "timestamptz",
|
|
116
|
+
"time with time zone": "timetz",
|
|
115
117
|
date: "date",
|
|
116
118
|
time: "time",
|
|
119
|
+
timetz: "timetz",
|
|
117
120
|
json: "json",
|
|
118
121
|
jsonb: "jsonb",
|
|
119
122
|
uuid: "uuid",
|
|
120
123
|
real: "real",
|
|
121
124
|
float: "float",
|
|
122
125
|
double: "double",
|
|
126
|
+
"double precision": "double",
|
|
123
127
|
decimal: "decimal",
|
|
124
128
|
numeric: "numeric",
|
|
125
129
|
blob: "blob",
|
|
126
|
-
bytea: "bytea"
|
|
130
|
+
bytea: "bytea",
|
|
131
|
+
// MySQL types
|
|
132
|
+
tinyint: "tinyint",
|
|
133
|
+
mediumint: "mediumint",
|
|
134
|
+
// MySQL unsigned types (u-prefix for distinction)
|
|
135
|
+
"tinyint unsigned": "utinyint",
|
|
136
|
+
"smallint unsigned": "usmallint",
|
|
137
|
+
"mediumint unsigned": "umediumint",
|
|
138
|
+
"int unsigned": "uint",
|
|
139
|
+
"bigint unsigned": "ubigint",
|
|
140
|
+
"float unsigned": "ufloat",
|
|
141
|
+
"double unsigned": "udouble"
|
|
127
142
|
}[t] || t;
|
|
128
143
|
}
|
|
129
144
|
/**
|
|
@@ -136,8 +151,8 @@ class f {
|
|
|
136
151
|
* - }o--o{ : many-to-many
|
|
137
152
|
*/
|
|
138
153
|
formatRelation(e) {
|
|
139
|
-
const t = this.escapeName(e.fromTable),
|
|
140
|
-
return `${t} ${
|
|
154
|
+
const t = this.escapeName(e.fromTable), n = this.escapeName(e.toTable), o = this.getRelationSymbol(e.type), i = e.fromColumns.join(", ");
|
|
155
|
+
return `${t} ${o} ${n} : "${i}"`;
|
|
141
156
|
}
|
|
142
157
|
/**
|
|
143
158
|
* Convert IntermediateRelationType to Mermaid relation symbol
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mermaid.js","sources":["../../src/formatter/mermaid.ts"],"sourcesContent":["import type {\n IntermediateSchema,\n TableDefinition,\n ColumnDefinition,\n RelationDefinition,\n} from \"../types\";\nimport type { OutputFormatter, FormatterOptions } from \"./types\";\n\n/**\n * Options for MermaidErDiagramFormatter\n */\nexport interface MermaidFormatterOptions extends FormatterOptions {\n /**\n * Whether to include column types in the diagram\n * @default true\n */\n includeColumnTypes?: boolean;\n}\n\n/**\n * Default formatter options\n */\nconst DEFAULT_OPTIONS: Required<MermaidFormatterOptions> = {\n includeComments: true,\n includeIndexes: true,\n includeConstraints: true,\n includeColumnTypes: true,\n};\n\n/**\n * MermaidErDiagramFormatter generates Mermaid ER diagram syntax from IntermediateSchema\n *\n * This formatter creates Mermaid-compatible ER diagrams that can be rendered\n * in GitHub, GitLab, or any Mermaid-supporting platform.\n *\n * @example\n * ```typescript\n * const formatter = new MermaidErDiagramFormatter();\n * const mermaid = formatter.format(schema);\n * // Output:\n * // erDiagram\n * // users ||--o{ posts : \"author_id\"\n * // users {\n * // int id PK\n * // varchar username\n * // }\n * ```\n *\n * @see https://mermaid.js.org/syntax/entityRelationshipDiagram.html\n */\nexport class MermaidErDiagramFormatter implements OutputFormatter {\n private options: Required<MermaidFormatterOptions>;\n\n /**\n * Create a new MermaidErDiagramFormatter\n *\n * @param options - Formatter options\n */\n constructor(options: MermaidFormatterOptions = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n /**\n * Format the intermediate schema into a Mermaid ER diagram\n *\n * @param schema - The intermediate schema to format\n * @returns Mermaid ER diagram string\n */\n format(schema: IntermediateSchema): string {\n const lines: string[] = [\"erDiagram\"];\n\n // Collect foreign key columns for FK markers\n const fkColumns = this.collectForeignKeyColumns(schema.relations);\n\n // Generate relations first (at the top of the diagram)\n for (const relation of schema.relations) {\n const relationLine = this.formatRelation(relation);\n if (relationLine) {\n lines.push(` ${relationLine}`);\n }\n }\n\n // Add blank line between relations and tables if there are both\n if (schema.relations.length > 0 && schema.tables.length > 0) {\n lines.push(\"\");\n }\n\n // Generate tables\n for (const table of schema.tables) {\n const tableLines = this.formatTable(table, fkColumns);\n lines.push(...tableLines);\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Format a focused ER diagram showing only a specific table and its related tables\n *\n * @param schema - The intermediate schema\n * @param tableName - The name of the table to focus on\n * @returns Mermaid ER diagram string showing only the focused table and its relations\n */\n formatFocused(schema: IntermediateSchema, tableName: string): string {\n // Find the target table\n const targetTable = schema.tables.find((t) => t.name === tableName);\n if (!targetTable) {\n return \"erDiagram\";\n }\n\n // Find related tables through relations\n const relatedTableNames = new Set<string>([tableName]);\n const relevantRelations: RelationDefinition[] = [];\n\n for (const relation of schema.relations) {\n if (relation.fromTable === tableName || relation.toTable === tableName) {\n relatedTableNames.add(relation.fromTable);\n relatedTableNames.add(relation.toTable);\n relevantRelations.push(relation);\n }\n }\n\n // Filter tables to only include related ones\n const relevantTables = schema.tables.filter((t) => relatedTableNames.has(t.name));\n\n // Collect foreign key columns for FK markers\n const fkColumns = this.collectForeignKeyColumns(relevantRelations);\n\n const lines: string[] = [\"erDiagram\"];\n\n // Generate relations\n for (const relation of relevantRelations) {\n const relationLine = this.formatRelation(relation);\n if (relationLine) {\n lines.push(` ${relationLine}`);\n }\n }\n\n // Add blank line between relations and tables if there are both\n if (relevantRelations.length > 0 && relevantTables.length > 0) {\n lines.push(\"\");\n }\n\n // Generate tables\n for (const table of relevantTables) {\n const tableLines = this.formatTable(table, fkColumns);\n lines.push(...tableLines);\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Collect foreign key columns from relations for FK marker assignment\n */\n private collectForeignKeyColumns(relations: RelationDefinition[]): Map<string, Set<string>> {\n const fkColumns = new Map<string, Set<string>>();\n\n for (const relation of relations) {\n // The \"from\" side of the relation has the FK column\n if (!fkColumns.has(relation.fromTable)) {\n fkColumns.set(relation.fromTable, new Set());\n }\n for (const col of relation.fromColumns) {\n fkColumns.get(relation.fromTable)!.add(col);\n }\n }\n\n return fkColumns;\n }\n\n /**\n * Format a table definition to Mermaid syntax\n */\n private formatTable(table: TableDefinition, fkColumns: Map<string, Set<string>>): string[] {\n const lines: string[] = [];\n const tableName = this.escapeName(table.name);\n const tableFkColumns = fkColumns.get(table.name) || new Set();\n\n lines.push(` ${tableName} {`);\n\n for (const column of table.columns) {\n const columnLine = this.formatColumn(column, tableFkColumns);\n lines.push(` ${columnLine}`);\n }\n\n lines.push(\" }\");\n\n return lines;\n }\n\n /**\n * Format a column definition to Mermaid syntax\n */\n private formatColumn(column: ColumnDefinition, fkColumns: Set<string>): string {\n const parts: string[] = [];\n\n // Column type (simplified for Mermaid)\n if (this.options.includeColumnTypes) {\n parts.push(this.simplifyType(column.type));\n }\n\n // Column name\n parts.push(this.escapeName(column.name));\n\n // PK/FK markers\n const markers: string[] = [];\n if (column.primaryKey) {\n markers.push(\"PK\");\n }\n if (fkColumns.has(column.name)) {\n markers.push(\"FK\");\n }\n if (column.unique && !column.primaryKey) {\n markers.push(\"UK\");\n }\n\n if (markers.length > 0) {\n parts.push(markers.join(\",\"));\n }\n\n // Add comment as Mermaid comment (quoted string after markers)\n if (this.options.includeComments && column.comment) {\n parts.push(`\"${this.escapeString(column.comment)}\"`);\n }\n\n return parts.join(\" \");\n }\n\n /**\n * Simplify SQL type for Mermaid display\n *\n * Mermaid ER diagrams work best with simple type names\n */\n private simplifyType(type: string): string {\n // Remove parentheses content for cleaner display (e.g., varchar(255) -> varchar)\n const simplified = type.replace(/\\([^)]*\\)/g, \"\").toLowerCase();\n\n // Map common types to shorter versions\n const typeMap: Record<string, string> = {\n integer: \"int\",\n bigint: \"bigint\",\n smallint: \"smallint\",\n serial: \"serial\",\n bigserial: \"bigserial\",\n text: \"text\",\n varchar: \"varchar\",\n char: \"char\",\n boolean: \"boolean\",\n timestamp: \"timestamp\",\n timestamptz: \"timestamptz\",\n date: \"date\",\n time: \"time\",\n json: \"json\",\n jsonb: \"jsonb\",\n uuid: \"uuid\",\n real: \"real\",\n float: \"float\",\n double: \"double\",\n decimal: \"decimal\",\n numeric: \"numeric\",\n blob: \"blob\",\n bytea: \"bytea\",\n };\n\n return typeMap[simplified] || simplified;\n }\n\n /**\n * Format a relation definition to Mermaid syntax\n *\n * Mermaid ER diagram relation syntax:\n * - ||--|| : one-to-one\n * - ||--o{ : one-to-many\n * - }o--|| : many-to-one\n * - }o--o{ : many-to-many\n */\n private formatRelation(relation: RelationDefinition): string {\n const fromTable = this.escapeName(relation.fromTable);\n const toTable = this.escapeName(relation.toTable);\n const symbol = this.getRelationSymbol(relation.type);\n const label = relation.fromColumns.join(\", \");\n\n return `${fromTable} ${symbol} ${toTable} : \"${label}\"`;\n }\n\n /**\n * Convert IntermediateRelationType to Mermaid relation symbol\n *\n * @see https://mermaid.js.org/syntax/entityRelationshipDiagram.html#relationship-syntax\n */\n private getRelationSymbol(type: RelationDefinition[\"type\"]): string {\n switch (type) {\n case \"one-to-one\":\n return \"||--||\";\n case \"one-to-many\":\n return \"||--o{\";\n case \"many-to-one\":\n return \"}o--||\";\n case \"many-to-many\":\n return \"}o--o{\";\n }\n }\n\n /**\n * Escape a name for Mermaid if it contains special characters\n *\n * Mermaid entity names should be alphanumeric with underscores\n */\n private escapeName(name: string): string {\n // Mermaid accepts alphanumeric and underscores\n // For names with special characters, we need to quote them\n if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) {\n return name;\n }\n // Replace special characters with underscores for Mermaid compatibility\n return name.replace(/[^a-zA-Z0-9_]/g, \"_\");\n }\n\n /**\n * Escape a string for use in Mermaid quoted strings\n */\n private escapeString(str: string): string {\n return str.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"').replace(/\\n/g, \" \");\n }\n}\n"],"names":["DEFAULT_OPTIONS","MermaidErDiagramFormatter","options","schema","lines","fkColumns","relation","relationLine","table","tableLines","tableName","t","relatedTableNames","relevantRelations","relevantTables","relations","col","tableFkColumns","column","columnLine","parts","markers","type","simplified","fromTable","toTable","symbol","label","name","str"],"mappings":"AAsBA,MAAMA,IAAqD;AAAA,EACzD,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,oBAAoB;AACtB;AAuBO,MAAMC,EAAqD;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAYC,IAAmC,IAAI;AACjD,SAAK,UAAU,EAAE,GAAGF,GAAiB,GAAGE,EAAA;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAOC,GAAoC;AACzC,UAAMC,IAAkB,CAAC,WAAW,GAG9BC,IAAY,KAAK,yBAAyBF,EAAO,SAAS;AAGhE,eAAWG,KAAYH,EAAO,WAAW;AACvC,YAAMI,IAAe,KAAK,eAAeD,CAAQ;AACjD,MAAIC,KACFH,EAAM,KAAK,OAAOG,CAAY,EAAE;AAAA,IAEpC;AAGA,IAAIJ,EAAO,UAAU,SAAS,KAAKA,EAAO,OAAO,SAAS,KACxDC,EAAM,KAAK,EAAE;AAIf,eAAWI,KAASL,EAAO,QAAQ;AACjC,YAAMM,IAAa,KAAK,YAAYD,GAAOH,CAAS;AACpD,MAAAD,EAAM,KAAK,GAAGK,CAAU;AAAA,IAC1B;AAEA,WAAOL,EAAM,KAAK;AAAA,CAAI;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAcD,GAA4BO,GAA2B;AAGnE,QAAI,CADgBP,EAAO,OAAO,KAAK,CAACQ,MAAMA,EAAE,SAASD,CAAS;AAEhE,aAAO;AAIT,UAAME,IAAoB,oBAAI,IAAY,CAACF,CAAS,CAAC,GAC/CG,IAA0C,CAAA;AAEhD,eAAWP,KAAYH,EAAO;AAC5B,OAAIG,EAAS,cAAcI,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,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IAAA,EAGMC,CAAU,KAAKA;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWQ,eAAejB,GAAsC;AAC3D,UAAMkB,IAAY,KAAK,WAAWlB,EAAS,SAAS,GAC9CmB,IAAU,KAAK,WAAWnB,EAAS,OAAO,GAC1CoB,IAAS,KAAK,kBAAkBpB,EAAS,IAAI,GAC7CqB,IAAQrB,EAAS,YAAY,KAAK,IAAI;AAE5C,WAAO,GAAGkB,CAAS,IAAIE,CAAM,IAAID,CAAO,OAAOE,CAAK;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,kBAAkBL,GAA0C;AAClE,YAAQA,GAAA;AAAA,MACN,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,IAAA;AAAA,EAEb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOQ,WAAWM,GAAsB;AAGvC,WAAI,2BAA2B,KAAKA,CAAI,IAC/BA,IAGFA,EAAK,QAAQ,kBAAkB,GAAG;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA,EAKQ,aAAaC,GAAqB;AACxC,WAAOA,EAAI,QAAQ,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAK,EAAE,QAAQ,OAAO,GAAG;AAAA,EAC3E;AACF;"}
|
|
1
|
+
{"version":3,"file":"mermaid.js","sources":["../../src/formatter/mermaid.ts"],"sourcesContent":["import type {\n IntermediateSchema,\n TableDefinition,\n ColumnDefinition,\n RelationDefinition,\n} from \"../types\";\nimport type { OutputFormatter, FormatterOptions } from \"./types\";\n\n/**\n * Options for MermaidErDiagramFormatter\n */\nexport interface MermaidFormatterOptions extends FormatterOptions {\n /**\n * Whether to include column types in the diagram\n * @default true\n */\n includeColumnTypes?: boolean;\n}\n\n/**\n * Default formatter options\n */\nconst DEFAULT_OPTIONS: Required<MermaidFormatterOptions> = {\n includeComments: true,\n includeIndexes: true,\n includeConstraints: true,\n includeColumnTypes: true,\n};\n\n/**\n * MermaidErDiagramFormatter generates Mermaid ER diagram syntax from IntermediateSchema\n *\n * This formatter creates Mermaid-compatible ER diagrams that can be rendered\n * in GitHub, GitLab, or any Mermaid-supporting platform.\n *\n * @example\n * ```typescript\n * const formatter = new MermaidErDiagramFormatter();\n * const mermaid = formatter.format(schema);\n * // Output:\n * // erDiagram\n * // users ||--o{ posts : \"author_id\"\n * // users {\n * // int id PK\n * // varchar username\n * // }\n * ```\n *\n * @see https://mermaid.js.org/syntax/entityRelationshipDiagram.html\n */\nexport class MermaidErDiagramFormatter implements OutputFormatter {\n private options: Required<MermaidFormatterOptions>;\n\n /**\n * Create a new MermaidErDiagramFormatter\n *\n * @param options - Formatter options\n */\n constructor(options: MermaidFormatterOptions = {}) {\n this.options = { ...DEFAULT_OPTIONS, ...options };\n }\n\n /**\n * Format the intermediate schema into a Mermaid ER diagram\n *\n * @param schema - The intermediate schema to format\n * @returns Mermaid ER diagram string\n */\n format(schema: IntermediateSchema): string {\n const lines: string[] = [\"erDiagram\"];\n\n // Collect foreign key columns for FK markers\n const fkColumns = this.collectForeignKeyColumns(schema.relations);\n\n // Generate relations first (at the top of the diagram)\n for (const relation of schema.relations) {\n const relationLine = this.formatRelation(relation);\n if (relationLine) {\n lines.push(` ${relationLine}`);\n }\n }\n\n // Add blank line between relations and tables if there are both\n if (schema.relations.length > 0 && schema.tables.length > 0) {\n lines.push(\"\");\n }\n\n // Generate tables\n for (const table of schema.tables) {\n const tableLines = this.formatTable(table, fkColumns);\n lines.push(...tableLines);\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Format a focused ER diagram showing only a specific table and its related tables\n *\n * @param schema - The intermediate schema\n * @param tableName - The name of the table to focus on\n * @returns Mermaid ER diagram string showing only the focused table and its relations\n */\n formatFocused(schema: IntermediateSchema, tableName: string): string {\n // Find the target table\n const targetTable = schema.tables.find((t) => t.name === tableName);\n if (!targetTable) {\n return \"erDiagram\";\n }\n\n // Find related tables through relations\n const relatedTableNames = new Set<string>([tableName]);\n const relevantRelations: RelationDefinition[] = [];\n\n for (const relation of schema.relations) {\n if (relation.fromTable === tableName || relation.toTable === tableName) {\n relatedTableNames.add(relation.fromTable);\n relatedTableNames.add(relation.toTable);\n relevantRelations.push(relation);\n }\n }\n\n // Filter tables to only include related ones\n const relevantTables = schema.tables.filter((t) => relatedTableNames.has(t.name));\n\n // Collect foreign key columns for FK markers\n const fkColumns = this.collectForeignKeyColumns(relevantRelations);\n\n const lines: string[] = [\"erDiagram\"];\n\n // Generate relations\n for (const relation of relevantRelations) {\n const relationLine = this.formatRelation(relation);\n if (relationLine) {\n lines.push(` ${relationLine}`);\n }\n }\n\n // Add blank line between relations and tables if there are both\n if (relevantRelations.length > 0 && relevantTables.length > 0) {\n lines.push(\"\");\n }\n\n // Generate tables\n for (const table of relevantTables) {\n const tableLines = this.formatTable(table, fkColumns);\n lines.push(...tableLines);\n }\n\n return lines.join(\"\\n\");\n }\n\n /**\n * Collect foreign key columns from relations for FK marker assignment\n */\n private collectForeignKeyColumns(relations: RelationDefinition[]): Map<string, Set<string>> {\n const fkColumns = new Map<string, Set<string>>();\n\n for (const relation of relations) {\n // The \"from\" side of the relation has the FK column\n if (!fkColumns.has(relation.fromTable)) {\n fkColumns.set(relation.fromTable, new Set());\n }\n for (const col of relation.fromColumns) {\n fkColumns.get(relation.fromTable)!.add(col);\n }\n }\n\n return fkColumns;\n }\n\n /**\n * Format a table definition to Mermaid syntax\n */\n private formatTable(table: TableDefinition, fkColumns: Map<string, Set<string>>): string[] {\n const lines: string[] = [];\n const tableName = this.escapeName(table.name);\n const tableFkColumns = fkColumns.get(table.name) || new Set();\n\n lines.push(` ${tableName} {`);\n\n for (const column of table.columns) {\n const columnLine = this.formatColumn(column, tableFkColumns);\n lines.push(` ${columnLine}`);\n }\n\n lines.push(\" }\");\n\n return lines;\n }\n\n /**\n * Format a column definition to Mermaid syntax\n */\n private formatColumn(column: ColumnDefinition, fkColumns: Set<string>): string {\n const parts: string[] = [];\n\n // Column type (simplified for Mermaid)\n if (this.options.includeColumnTypes) {\n parts.push(this.simplifyType(column.type));\n }\n\n // Column name\n parts.push(this.escapeName(column.name));\n\n // PK/FK markers\n const markers: string[] = [];\n if (column.primaryKey) {\n markers.push(\"PK\");\n }\n if (fkColumns.has(column.name)) {\n markers.push(\"FK\");\n }\n if (column.unique && !column.primaryKey) {\n markers.push(\"UK\");\n }\n\n if (markers.length > 0) {\n parts.push(markers.join(\",\"));\n }\n\n // Add comment as Mermaid comment (quoted string after markers)\n if (this.options.includeComments && column.comment) {\n parts.push(`\"${this.escapeString(column.comment)}\"`);\n }\n\n return parts.join(\" \");\n }\n\n /**\n * Simplify SQL type for Mermaid display\n *\n * Mermaid ER diagrams work best with simple type names\n */\n private simplifyType(type: string): string {\n // Remove parentheses content for cleaner display (e.g., varchar(255) -> varchar)\n const simplified = type.replace(/\\([^)]*\\)/g, \"\").toLowerCase();\n\n // Map common types to shorter versions\n const typeMap: Record<string, string> = {\n integer: \"int\",\n bigint: \"bigint\",\n smallint: \"smallint\",\n serial: \"serial\",\n bigserial: \"bigserial\",\n text: \"text\",\n varchar: \"varchar\",\n char: \"char\",\n boolean: \"boolean\",\n timestamp: \"timestamp\",\n timestamptz: \"timestamptz\",\n \"timestamp with time zone\": \"timestamptz\",\n \"time with time zone\": \"timetz\",\n date: \"date\",\n time: \"time\",\n timetz: \"timetz\",\n json: \"json\",\n jsonb: \"jsonb\",\n uuid: \"uuid\",\n real: \"real\",\n float: \"float\",\n double: \"double\",\n \"double precision\": \"double\",\n decimal: \"decimal\",\n numeric: \"numeric\",\n blob: \"blob\",\n bytea: \"bytea\",\n // MySQL types\n tinyint: \"tinyint\",\n mediumint: \"mediumint\",\n // MySQL unsigned types (u-prefix for distinction)\n \"tinyint unsigned\": \"utinyint\",\n \"smallint unsigned\": \"usmallint\",\n \"mediumint unsigned\": \"umediumint\",\n \"int unsigned\": \"uint\",\n \"bigint unsigned\": \"ubigint\",\n \"float unsigned\": \"ufloat\",\n \"double unsigned\": \"udouble\",\n };\n\n return typeMap[simplified] || simplified;\n }\n\n /**\n * Format a relation definition to Mermaid syntax\n *\n * Mermaid ER diagram relation syntax:\n * - ||--|| : one-to-one\n * - ||--o{ : one-to-many\n * - }o--|| : many-to-one\n * - }o--o{ : many-to-many\n */\n private formatRelation(relation: RelationDefinition): string {\n const fromTable = this.escapeName(relation.fromTable);\n const toTable = this.escapeName(relation.toTable);\n const symbol = this.getRelationSymbol(relation.type);\n const label = relation.fromColumns.join(\", \");\n\n return `${fromTable} ${symbol} ${toTable} : \"${label}\"`;\n }\n\n /**\n * Convert IntermediateRelationType to Mermaid relation symbol\n *\n * @see https://mermaid.js.org/syntax/entityRelationshipDiagram.html#relationship-syntax\n */\n private getRelationSymbol(type: RelationDefinition[\"type\"]): string {\n switch (type) {\n case \"one-to-one\":\n return \"||--||\";\n case \"one-to-many\":\n return \"||--o{\";\n case \"many-to-one\":\n return \"}o--||\";\n case \"many-to-many\":\n return \"}o--o{\";\n }\n }\n\n /**\n * Escape a name for Mermaid if it contains special characters\n *\n * Mermaid entity names should be alphanumeric with underscores\n */\n private escapeName(name: string): string {\n // Mermaid accepts alphanumeric and underscores\n // For names with special characters, we need to quote them\n if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) {\n return name;\n }\n // Replace special characters with underscores for Mermaid compatibility\n return name.replace(/[^a-zA-Z0-9_]/g, \"_\");\n }\n\n /**\n * Escape a string for use in Mermaid quoted strings\n */\n private escapeString(str: string): string {\n return str.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"').replace(/\\n/g, \" \");\n }\n}\n"],"names":["DEFAULT_OPTIONS","MermaidErDiagramFormatter","options","schema","lines","fkColumns","relation","relationLine","table","tableLines","tableName","t","relatedTableNames","relevantRelations","relevantTables","relations","col","tableFkColumns","column","columnLine","parts","markers","type","simplified","fromTable","toTable","symbol","label","name","str"],"mappings":"AAsBA,MAAMA,IAAqD;AAAA,EACzD,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,oBAAoB;AACtB;AAuBO,MAAMC,EAAqD;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOR,YAAYC,IAAmC,IAAI;AACjD,SAAK,UAAU,EAAE,GAAGF,GAAiB,GAAGE,EAAA;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,OAAOC,GAAoC;AACzC,UAAMC,IAAkB,CAAC,WAAW,GAG9BC,IAAY,KAAK,yBAAyBF,EAAO,SAAS;AAGhE,eAAWG,KAAYH,EAAO,WAAW;AACvC,YAAMI,IAAe,KAAK,eAAeD,CAAQ;AACjD,MAAIC,KACFH,EAAM,KAAK,OAAOG,CAAY,EAAE;AAAA,IAEpC;AAGA,IAAIJ,EAAO,UAAU,SAAS,KAAKA,EAAO,OAAO,SAAS,KACxDC,EAAM,KAAK,EAAE;AAIf,eAAWI,KAASL,EAAO,QAAQ;AACjC,YAAMM,IAAa,KAAK,YAAYD,GAAOH,CAAS;AACpD,MAAAD,EAAM,KAAK,GAAGK,CAAU;AAAA,IAC1B;AAEA,WAAOL,EAAM,KAAK;AAAA,CAAI;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,cAAcD,GAA4BO,GAA2B;AAGnE,QAAI,CADgBP,EAAO,OAAO,KAAK,CAACQ,MAAMA,EAAE,SAASD,CAAS;AAEhE,aAAO;AAIT,UAAME,IAAoB,oBAAI,IAAY,CAACF,CAAS,CAAC,GAC/CG,IAA0C,CAAA;AAEhD,eAAWP,KAAYH,EAAO;AAC5B,OAAIG,EAAS,cAAcI,KAAaJ,EAAS,YAAYI,OAC3DE,EAAkB,IAAIN,EAAS,SAAS,GACxCM,EA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