air-dml 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +90 -90
- package/README.md +355 -346
- package/dist/parser/new/ast.d.ts +0 -2
- package/dist/parser/new/ast.d.ts.map +1 -1
- package/dist/parser/new/index.d.ts.map +1 -1
- package/dist/parser/new/index.js +0 -14
- package/dist/parser/new/index.js.map +1 -1
- package/dist/parser/new/parser.d.ts +0 -1
- package/dist/parser/new/parser.d.ts.map +1 -1
- package/dist/parser/new/parser.js +0 -33
- package/dist/parser/new/parser.js.map +1 -1
- package/dist/parser/new/tokens.d.ts +0 -1
- package/dist/parser/new/tokens.d.ts.map +1 -1
- package/dist/parser/new/tokens.js +0 -2
- package/dist/parser/new/tokens.js.map +1 -1
- package/dist/parser/new/transformer.js +0 -11
- package/dist/parser/new/transformer.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +62 -62
package/README.md
CHANGED
|
@@ -1,346 +1,355 @@
|
|
|
1
|
-
# AIR-DML
|
|
2
|
-
|
|
3
|
-
**AI-Ready Data Modeling Language**
|
|
4
|
-
|
|
5
|
-
*The Open Standard for AI-Ready Data Modeling*
|
|
6
|
-
|
|
7
|
-
AIR-DML is an extended DBML (Database Markup Language) parser designed for AI-driven development. It adds powerful features for modern data modeling while maintaining full backward compatibility with standard DBML.
|
|
8
|
-
|
|
9
|
-
[](https://www.npmjs.com/package/air-dml)
|
|
10
|
-
[](https://opensource.org/licenses/Apache-2.0)
|
|
11
|
-
|
|
12
|
-
## Used In Production
|
|
13
|
-
|
|
14
|
-
<a href="https://mode-ai.io">
|
|
15
|
-
<img src="https://mode-ai.io/favicon.svg" alt="Mode-ai" width="48" height="48" align="left" style="margin-right: 12px;" />
|
|
16
|
-
</a>
|
|
17
|
-
|
|
18
|
-
**[Mode-ai](https://mode-ai.io)** - AI-Powered Data Modeling Tool
|
|
19
|
-
|
|
20
|
-
Generate ER diagrams from natural language using AI. Mode-ai is the reference implementation of AIR-DML, showcasing the full potential of AI-ready data modeling.
|
|
21
|
-
|
|
22
|
-
- Natural language to ER diagram generation
|
|
23
|
-
- Interactive visual editor with drag & drop
|
|
24
|
-
- Export to SQL, DBML, and more
|
|
25
|
-
|
|
26
|
-
<br clear="left"/>
|
|
27
|
-
|
|
28
|
-
## Features
|
|
29
|
-
|
|
30
|
-
✨ **AI-Optimized**: Designed for AI language models to understand and generate database schemas
|
|
31
|
-
🏗️ **Domain-Driven Design**: Built-in support for bounded contexts via `Area`
|
|
32
|
-
🌍 **Multilingual**: Logical names (aliases) in any language
|
|
33
|
-
🎨 **Visual Design**: Coordinate and color information for diagram rendering
|
|
34
|
-
🔄 **Polyglot Persistence**: Different database types per area
|
|
35
|
-
📦 **Extends DBML**: Fully compatible with standard DBML
|
|
36
|
-
💬 **Comment Preservation**: Leading comments are preserved and associated with elements
|
|
37
|
-
|
|
38
|
-
## Installation
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npm install air-dml
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Quick Start
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import { parseAirDML, exportToAirDML } from 'air-dml';
|
|
48
|
-
|
|
49
|
-
// Parse AIR-DML text
|
|
50
|
-
const airDmlText = `
|
|
51
|
-
Project "My Project" {
|
|
52
|
-
database_type: 'PostgreSQL'
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ユーザー管理
|
|
56
|
-
Table users [alias: "ユーザー", pos_x: 100, pos_y: 100, color: "#1976D2"] {
|
|
57
|
-
id serial [pk, alias: "ユーザーID"]
|
|
58
|
-
username varchar(100) [not null, unique, alias: "ユーザー名"]
|
|
59
|
-
email varchar(255) [not null, unique, alias: "メールアドレス"]
|
|
60
|
-
created_at timestamp [not null, alias: "作成日時"]
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// プロフィール情報
|
|
64
|
-
Table profiles [alias: "プロフィール", pos_x: 500, pos_y: 100] {
|
|
65
|
-
id serial [pk, alias: "プロフィールID"]
|
|
66
|
-
user_id integer [fk, not null, unique, alias: "ユーザーID"]
|
|
67
|
-
full_name varchar(200) [alias: "氏名"]
|
|
68
|
-
bio text [alias: "自己紹介"]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
Ref: profiles.user_id - users.id
|
|
72
|
-
|
|
73
|
-
Area "User Management" [
|
|
74
|
-
pos_x: 50,
|
|
75
|
-
pos_y: 50,
|
|
76
|
-
width: 600,
|
|
77
|
-
height: 300,
|
|
78
|
-
color: "#1976D2"
|
|
79
|
-
] {
|
|
80
|
-
users
|
|
81
|
-
profiles
|
|
82
|
-
|
|
83
|
-
database_type: "PostgreSQL"
|
|
84
|
-
|
|
85
|
-
CommonColumns: [
|
|
86
|
-
created_at timestamp [not null, alias: "作成日時"]
|
|
87
|
-
updated_at timestamp [not null, alias: "更新日時"]
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
Note: "ユーザー管理領域"
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
|
-
const diagram = parseAirDML(airDmlText);
|
|
95
|
-
console.log(diagram);
|
|
96
|
-
|
|
97
|
-
// Export back to AIR-DML
|
|
98
|
-
const output = exportToAirDML(diagram);
|
|
99
|
-
console.log(output);
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## AIR-DML Syntax
|
|
103
|
-
|
|
104
|
-
### Table Definition
|
|
105
|
-
|
|
106
|
-
```dbml
|
|
107
|
-
Table table_name [alias: "論理名", pos_x: 100, pos_y: 200, color: "#1976D2"] {
|
|
108
|
-
column_name data_type [constraints, alias: "カラム論理名"]
|
|
109
|
-
|
|
110
|
-
Note: "テーブルの説明"
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
### Column Constraints
|
|
115
|
-
|
|
116
|
-
| Constraint | Description | Example |
|
|
117
|
-
|------------|-------------|---------|
|
|
118
|
-
| `pk` | Primary Key | `id serial [pk]` |
|
|
119
|
-
| `fk` | Foreign Key (use with Ref) | `user_id integer [fk]` |
|
|
120
|
-
| `unique` | Unique constraint | `email varchar [unique]` |
|
|
121
|
-
| `not null` | NOT NULL constraint | `name varchar [not null]` |
|
|
122
|
-
| `increment` | Auto increment | `id integer [pk, increment]` |
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Ref: table_a.column
|
|
131
|
-
Ref: table_a.column
|
|
132
|
-
Ref: table_a.column
|
|
133
|
-
Ref: table_a.column
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
**
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
Ref: subscriptions.
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
- `
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
| **
|
|
286
|
-
| **
|
|
287
|
-
| **
|
|
288
|
-
| **
|
|
289
|
-
| **
|
|
290
|
-
| **
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
-
|
|
307
|
-
- Added
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
-
|
|
312
|
-
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
##
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
1
|
+
# AIR-DML
|
|
2
|
+
|
|
3
|
+
**AI-Ready Data Modeling Language**
|
|
4
|
+
|
|
5
|
+
*The Open Standard for AI-Ready Data Modeling*
|
|
6
|
+
|
|
7
|
+
AIR-DML is an extended DBML (Database Markup Language) parser designed for AI-driven development. It adds powerful features for modern data modeling while maintaining full backward compatibility with standard DBML.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/air-dml)
|
|
10
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
11
|
+
|
|
12
|
+
## Used In Production
|
|
13
|
+
|
|
14
|
+
<a href="https://mode-ai.io">
|
|
15
|
+
<img src="https://mode-ai.io/favicon.svg" alt="Mode-ai" width="48" height="48" align="left" style="margin-right: 12px;" />
|
|
16
|
+
</a>
|
|
17
|
+
|
|
18
|
+
**[Mode-ai](https://mode-ai.io)** - AI-Powered Data Modeling Tool
|
|
19
|
+
|
|
20
|
+
Generate ER diagrams from natural language using AI. Mode-ai is the reference implementation of AIR-DML, showcasing the full potential of AI-ready data modeling.
|
|
21
|
+
|
|
22
|
+
- Natural language to ER diagram generation
|
|
23
|
+
- Interactive visual editor with drag & drop
|
|
24
|
+
- Export to SQL, DBML, and more
|
|
25
|
+
|
|
26
|
+
<br clear="left"/>
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
✨ **AI-Optimized**: Designed for AI language models to understand and generate database schemas
|
|
31
|
+
🏗️ **Domain-Driven Design**: Built-in support for bounded contexts via `Area`
|
|
32
|
+
🌍 **Multilingual**: Logical names (aliases) in any language
|
|
33
|
+
🎨 **Visual Design**: Coordinate and color information for diagram rendering
|
|
34
|
+
🔄 **Polyglot Persistence**: Different database types per area
|
|
35
|
+
📦 **Extends DBML**: Fully compatible with standard DBML syntax
|
|
36
|
+
💬 **Comment Preservation**: Leading comments are preserved and associated with elements
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install air-dml
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Quick Start
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { parseAirDML, exportToAirDML } from 'air-dml';
|
|
48
|
+
|
|
49
|
+
// Parse AIR-DML text
|
|
50
|
+
const airDmlText = `
|
|
51
|
+
Project "My Project" {
|
|
52
|
+
database_type: 'PostgreSQL'
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ユーザー管理
|
|
56
|
+
Table users [alias: "ユーザー", pos_x: 100, pos_y: 100, color: "#1976D2"] {
|
|
57
|
+
id serial [pk, alias: "ユーザーID"]
|
|
58
|
+
username varchar(100) [not null, unique, alias: "ユーザー名"]
|
|
59
|
+
email varchar(255) [not null, unique, alias: "メールアドレス"]
|
|
60
|
+
created_at timestamp [not null, alias: "作成日時"]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// プロフィール情報
|
|
64
|
+
Table profiles [alias: "プロフィール", pos_x: 500, pos_y: 100] {
|
|
65
|
+
id serial [pk, alias: "プロフィールID"]
|
|
66
|
+
user_id integer [fk, not null, unique, alias: "ユーザーID"]
|
|
67
|
+
full_name varchar(200) [alias: "氏名"]
|
|
68
|
+
bio text [alias: "自己紹介"]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Ref: profiles.user_id - users.id
|
|
72
|
+
|
|
73
|
+
Area "User Management" [
|
|
74
|
+
pos_x: 50,
|
|
75
|
+
pos_y: 50,
|
|
76
|
+
width: 600,
|
|
77
|
+
height: 300,
|
|
78
|
+
color: "#1976D2"
|
|
79
|
+
] {
|
|
80
|
+
users
|
|
81
|
+
profiles
|
|
82
|
+
|
|
83
|
+
database_type: "PostgreSQL"
|
|
84
|
+
|
|
85
|
+
CommonColumns: [
|
|
86
|
+
created_at timestamp [not null, alias: "作成日時"]
|
|
87
|
+
updated_at timestamp [not null, alias: "更新日時"]
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
Note: "ユーザー管理領域"
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
const diagram = parseAirDML(airDmlText);
|
|
95
|
+
console.log(diagram);
|
|
96
|
+
|
|
97
|
+
// Export back to AIR-DML
|
|
98
|
+
const output = exportToAirDML(diagram);
|
|
99
|
+
console.log(output);
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## AIR-DML Syntax
|
|
103
|
+
|
|
104
|
+
### Table Definition
|
|
105
|
+
|
|
106
|
+
```dbml
|
|
107
|
+
Table table_name [alias: "論理名", pos_x: 100, pos_y: 200, color: "#1976D2"] {
|
|
108
|
+
column_name data_type [constraints, alias: "カラム論理名"]
|
|
109
|
+
|
|
110
|
+
Note: "テーブルの説明"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Column Constraints
|
|
115
|
+
|
|
116
|
+
| Constraint | Description | Example |
|
|
117
|
+
|------------|-------------|---------|
|
|
118
|
+
| `pk` | Primary Key | `id serial [pk]` |
|
|
119
|
+
| `fk` | Foreign Key (use with Ref) | `user_id integer [fk]` |
|
|
120
|
+
| `unique` | Unique constraint | `email varchar [unique]` |
|
|
121
|
+
| `not null` | NOT NULL constraint | `name varchar [not null]` |
|
|
122
|
+
| `increment` | Auto increment | `id integer [pk, increment]` |
|
|
123
|
+
| `alias: "name"` | Logical name | `[alias: "ユーザーID"]` |
|
|
124
|
+
| `note: "desc"` | Column description | `[note: "説明"]` |
|
|
125
|
+
|
|
126
|
+
### Relationships
|
|
127
|
+
|
|
128
|
+
```dbml
|
|
129
|
+
Ref: table_a.column > table_b.column // Many-to-One (A → B)
|
|
130
|
+
Ref: table_a.column < table_b.column // One-to-Many (A ← B)
|
|
131
|
+
Ref: table_a.column - table_b.column // One-to-One
|
|
132
|
+
Ref: table_a.column >< table_b.column // Many-to-Many
|
|
133
|
+
Ref: table_a.column ~ table_b.column // AI-inferred (undetermined)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Area (Bounded Context)
|
|
137
|
+
|
|
138
|
+
```dbml
|
|
139
|
+
Area "Area Name" [
|
|
140
|
+
pos_x: 50,
|
|
141
|
+
pos_y: 50,
|
|
142
|
+
width: 600,
|
|
143
|
+
height: 300,
|
|
144
|
+
color: "#1976D2"
|
|
145
|
+
] {
|
|
146
|
+
table1
|
|
147
|
+
table2
|
|
148
|
+
|
|
149
|
+
database_type: "PostgreSQL"
|
|
150
|
+
|
|
151
|
+
CommonColumns: [
|
|
152
|
+
created_at timestamp [not null, alias: "作成日時"]
|
|
153
|
+
updated_at timestamp [not null, alias: "更新日時"]
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
Note: "Area description"
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## AI Generation Guidelines
|
|
161
|
+
|
|
162
|
+
When using AI to generate AIR-DML, follow these rules:
|
|
163
|
+
|
|
164
|
+
**Required:**
|
|
165
|
+
- Use **double quotes** for alias values: `alias: "論理名"` ✅
|
|
166
|
+
- Do NOT use single quotes: `alias: '論理名'` ❌
|
|
167
|
+
- Mark foreign key columns with `[fk]`
|
|
168
|
+
- Define relationships separately with `Ref:`
|
|
169
|
+
- Do NOT add inline comments after column definitions
|
|
170
|
+
|
|
171
|
+
**Example Output:**
|
|
172
|
+
|
|
173
|
+
```dbml
|
|
174
|
+
// 定期購入機能
|
|
175
|
+
Table subscriptions [alias: "定期購入"] {
|
|
176
|
+
id serial [pk, alias: "定期購入ID"]
|
|
177
|
+
user_id integer [fk, not null, alias: "ユーザーID"]
|
|
178
|
+
product_id integer [fk, not null, alias: "商品ID"]
|
|
179
|
+
status text [not null, alias: "ステータス"]
|
|
180
|
+
created_at timestamp [not null, alias: "作成日時"]
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
Ref: subscriptions.user_id > users.id
|
|
184
|
+
Ref: subscriptions.product_id > products.id
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
For complete AI generation guidelines, see [SPECIFICATION.md Section 5](./SPECIFICATION.md#5-ai生成時のガイドライン).
|
|
188
|
+
|
|
189
|
+
## API Reference
|
|
190
|
+
|
|
191
|
+
### `parseAirDML(airDmlText: string, diagramId?: string): Diagram`
|
|
192
|
+
|
|
193
|
+
Parse AIR-DML text into a Diagram object.
|
|
194
|
+
|
|
195
|
+
**Parameters:**
|
|
196
|
+
- `airDmlText` - AIR-DML formatted text
|
|
197
|
+
- `diagramId` - Optional diagram ID
|
|
198
|
+
|
|
199
|
+
**Returns:** `Diagram` object
|
|
200
|
+
|
|
201
|
+
### `exportToAirDML(diagram: Diagram): string`
|
|
202
|
+
|
|
203
|
+
Export a Diagram object to AIR-DML text.
|
|
204
|
+
|
|
205
|
+
**Parameters:**
|
|
206
|
+
- `diagram` - Diagram object
|
|
207
|
+
|
|
208
|
+
**Returns:** AIR-DML formatted text
|
|
209
|
+
|
|
210
|
+
## Type Definitions
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
interface Diagram {
|
|
214
|
+
id: string;
|
|
215
|
+
name: string;
|
|
216
|
+
project?: string;
|
|
217
|
+
database?: string;
|
|
218
|
+
tables: Table[];
|
|
219
|
+
references: Reference[];
|
|
220
|
+
areas?: Area[];
|
|
221
|
+
createdAt?: string;
|
|
222
|
+
updatedAt?: string;
|
|
223
|
+
note?: string;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
interface Table {
|
|
227
|
+
id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
logicalName?: string; // alias
|
|
230
|
+
columns: Column[];
|
|
231
|
+
color?: string;
|
|
232
|
+
pos?: Position;
|
|
233
|
+
areaIds?: string[];
|
|
234
|
+
note?: string;
|
|
235
|
+
leadingComments?: string[]; // v1.2.0+
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface Column {
|
|
239
|
+
name: string;
|
|
240
|
+
logicalName?: string; // alias
|
|
241
|
+
type: DataType;
|
|
242
|
+
typeParams?: string;
|
|
243
|
+
pk?: boolean;
|
|
244
|
+
fk?: boolean;
|
|
245
|
+
unique?: boolean;
|
|
246
|
+
notNull?: boolean;
|
|
247
|
+
increment?: boolean;
|
|
248
|
+
note?: string;
|
|
249
|
+
leadingComments?: string[]; // v1.2.0+
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface Reference {
|
|
253
|
+
id: string;
|
|
254
|
+
fromTable: string;
|
|
255
|
+
fromColumn: string;
|
|
256
|
+
toTable: string;
|
|
257
|
+
toColumn: string;
|
|
258
|
+
type: RelationshipType;
|
|
259
|
+
swapEdge?: boolean;
|
|
260
|
+
leadingComments?: string[]; // v1.2.0+
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
interface Area {
|
|
264
|
+
id: string;
|
|
265
|
+
name: string;
|
|
266
|
+
tables: string[];
|
|
267
|
+
color?: string;
|
|
268
|
+
pos?: Position;
|
|
269
|
+
width?: number;
|
|
270
|
+
height?: number;
|
|
271
|
+
labelHorizontal?: 'left' | 'center' | 'right';
|
|
272
|
+
labelVertical?: 'top' | 'center' | 'bottom';
|
|
273
|
+
databaseType?: string;
|
|
274
|
+
commonColumns?: Column[];
|
|
275
|
+
note?: string;
|
|
276
|
+
leadingComments?: string[]; // v1.2.0+
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Comparison: DBML vs AIR-DML
|
|
281
|
+
|
|
282
|
+
| Feature | DBML | AIR-DML |
|
|
283
|
+
|---------|------|---------|
|
|
284
|
+
| **Focus** | Database schema | AI-ready + Business context |
|
|
285
|
+
| **Logical names** | ❌ | ✅ `alias` attribute |
|
|
286
|
+
| **Area management** | TableGroup (basic) | Area (extended: CommonColumns, database_type) |
|
|
287
|
+
| **Visual info** | ❌ | ✅ Coordinates, colors, sizes |
|
|
288
|
+
| **Multi-DB** | Project-level | Area-level (polyglot persistence) |
|
|
289
|
+
| **AI optimization** | ❌ | ✅ LLM-friendly design |
|
|
290
|
+
| **Comment preservation** | ❌ | ✅ Leading comments (v1.2.0+) |
|
|
291
|
+
|
|
292
|
+
## Changelog
|
|
293
|
+
|
|
294
|
+
### v2.1.0 (2025-01)
|
|
295
|
+
- **Breaking**: Removed `default` column constraint from syntax
|
|
296
|
+
- Simplified parser by removing inconsistent quote handling for default values
|
|
297
|
+
|
|
298
|
+
### v2.0.0 (2025-01)
|
|
299
|
+
- **Major**: Replaced `@dbml/core` dependency with custom hand-written recursive descent parser
|
|
300
|
+
- Full AIR-DML syntax support without external dependencies
|
|
301
|
+
- Improved error messages in Japanese
|
|
302
|
+
- Better handling of Japanese identifiers and comments
|
|
303
|
+
|
|
304
|
+
### v1.2.3 (2025-01)
|
|
305
|
+
- Bug fixes for Area parsing with Japanese names
|
|
306
|
+
- Improved comment preservation
|
|
307
|
+
- Added AI generation guidelines to specification
|
|
308
|
+
|
|
309
|
+
### v1.2.0 (2025-01)
|
|
310
|
+
- Added leading comment preservation for Tables, References, and Areas
|
|
311
|
+
- Added `leadingComments` field to type definitions
|
|
312
|
+
- Export comments back to AIR-DML format
|
|
313
|
+
|
|
314
|
+
### v1.1.0 (2025-01)
|
|
315
|
+
- Added `labelHorizontal` and `labelVertical` attributes for Areas
|
|
316
|
+
- Added `swapEdge` attribute for References
|
|
317
|
+
- Improved Area attribute parsing
|
|
318
|
+
|
|
319
|
+
### v1.0.0 (2025-01)
|
|
320
|
+
- Initial release
|
|
321
|
+
- Core AIR-DML parsing and export
|
|
322
|
+
- Support for alias, pos_x, pos_y, color attributes
|
|
323
|
+
- Area with CommonColumns and database_type
|
|
324
|
+
|
|
325
|
+
## Specification
|
|
326
|
+
|
|
327
|
+
For the complete AIR-DML specification, see [SPECIFICATION.md](./SPECIFICATION.md).
|
|
328
|
+
|
|
329
|
+
## License
|
|
330
|
+
|
|
331
|
+
Apache-2.0 License - see [LICENSE](./LICENSE) file for details.
|
|
332
|
+
|
|
333
|
+
AIR-DML extends [DBML](https://github.com/holistics/dbml) (also Apache-2.0).
|
|
334
|
+
|
|
335
|
+
## Credits
|
|
336
|
+
|
|
337
|
+
- **Created by**: Data-mination Partners
|
|
338
|
+
- **Technical collaboration**: Claude Opus 4.5 (Anthropic)
|
|
339
|
+
- **Based on**: [@dbml/core](https://www.npmjs.com/package/@dbml/core) by Holistics
|
|
340
|
+
|
|
341
|
+
## Links
|
|
342
|
+
|
|
343
|
+
- [GitHub Repository](https://github.com/hiroaki-handa/air-dml)
|
|
344
|
+
- [npm Package](https://www.npmjs.com/package/air-dml)
|
|
345
|
+
- [AIR-DML Specification](./SPECIFICATION.md)
|
|
346
|
+
- [Mode-ai](https://mode-ai.io) - Reference implementation (AI-Powered Data Modeling Tool)
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Trademarks
|
|
351
|
+
|
|
352
|
+
**AIR-DML™** (AI-Ready Data Modeling Language) is a trademark of Datamination Partners Co., Ltd.
|
|
353
|
+
Trademark Application No. 2026-000274 (Japan)
|
|
354
|
+
|
|
355
|
+
*AIR-DML™ — The Open Standard for AI-Ready Data Modeling.*
|