hekireki 0.9.0 → 0.9.2
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/README.md +0 -2
- package/dist/bin/ajv.js +1 -1
- package/dist/bin/arktype.js +1 -1
- package/dist/bin/dbml.js +1 -1
- package/dist/bin/docs.js +1 -1
- package/dist/bin/drizzle.js +1 -1
- package/dist/bin/ecto.js +1 -1
- package/dist/bin/effect.js +1 -1
- package/dist/bin/gorm.js +1 -1
- package/dist/bin/mermaid-er.js +1 -1
- package/dist/bin/sea-orm.js +1 -1
- package/dist/bin/sqlalchemy.js +1 -1
- package/dist/bin/typebox.js +1 -1
- package/dist/bin/valibot.js +1 -1
- package/dist/bin/zod.js +1 -1
- package/dist/{bin-Dh-MFTeu.js → bin-C68-JfzS.js} +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -707,7 +707,6 @@ impl ActiveModelBehavior for ActiveModel {}
|
|
|
707
707
|
Table User {
|
|
708
708
|
id String [pk, note: 'Primary key']
|
|
709
709
|
name String [not null, note: 'Display name']
|
|
710
|
-
posts Post [not null, note: 'One-to-many relation to Post']
|
|
711
710
|
}
|
|
712
711
|
|
|
713
712
|
Table Post {
|
|
@@ -715,7 +714,6 @@ Table Post {
|
|
|
715
714
|
title String [not null, note: 'Article title']
|
|
716
715
|
content String [not null, note: 'Body content (no length limit)']
|
|
717
716
|
userId String [not null, note: 'Foreign key referencing User.id']
|
|
718
|
-
user User [not null, note: 'Prisma relation definition']
|
|
719
717
|
}
|
|
720
718
|
|
|
721
719
|
Ref Post_userId_fk: Post.userId > User.id
|
package/dist/bin/ajv.js
CHANGED
package/dist/bin/arktype.js
CHANGED
package/dist/bin/dbml.js
CHANGED
package/dist/bin/docs.js
CHANGED
package/dist/bin/drizzle.js
CHANGED
package/dist/bin/ecto.js
CHANGED
package/dist/bin/effect.js
CHANGED
package/dist/bin/gorm.js
CHANGED
package/dist/bin/mermaid-er.js
CHANGED
package/dist/bin/sea-orm.js
CHANGED
package/dist/bin/sqlalchemy.js
CHANGED
package/dist/bin/typebox.js
CHANGED
package/dist/bin/valibot.js
CHANGED
package/dist/bin/zod.js
CHANGED
|
@@ -595,7 +595,7 @@ function toDBMLColumn(field, models, mapToDbSchema) {
|
|
|
595
595
|
function makeTables(models, mapToDbSchema = false) {
|
|
596
596
|
return models.map((model) => {
|
|
597
597
|
const modelName = mapToDbSchema && model.dbName ? model.dbName : model.name;
|
|
598
|
-
const columnLines = model.fields.map((field) => toDBMLColumn(field, models, mapToDbSchema)).map(makePrismaColumn).join("\n");
|
|
598
|
+
const columnLines = model.fields.filter((field) => !field.relationName).map((field) => toDBMLColumn(field, models, mapToDbSchema)).map(makePrismaColumn).join("\n");
|
|
599
599
|
const indexes = [...model.primaryKey?.fields && model.primaryKey.fields.length > 0 ? [{
|
|
600
600
|
columns: model.primaryKey.fields,
|
|
601
601
|
isPrimaryKey: true
|
|
@@ -2812,6 +2812,9 @@ const RELATIONSHIPS = {
|
|
|
2812
2812
|
"zero-many": "}o",
|
|
2813
2813
|
many: "}|"
|
|
2814
2814
|
};
|
|
2815
|
+
function escapeComment(comment) {
|
|
2816
|
+
return comment.replace(/\r?\n/g, " ").replace(/"/g, "#quot;");
|
|
2817
|
+
}
|
|
2815
2818
|
function erRelationLine(relation, resolveName = (model) => model) {
|
|
2816
2819
|
return ` ${resolveName(relation.from.model)} ${RELATIONSHIPS[relation.from.cardinality]}--${RELATIONSHIPS[relation.to.cardinality]} ${resolveName(relation.to.model)} : "(${relation.from.field}) - (${relation.to.field})"`;
|
|
2817
2820
|
}
|
|
@@ -2822,7 +2825,7 @@ function modelFields(model) {
|
|
|
2822
2825
|
const commentPart = stripAnnotations(field.documentation) ?? "";
|
|
2823
2826
|
const keyMarker = field.isId ? "PK" : fkFields.has(field.name) ? "FK" : "";
|
|
2824
2827
|
const keyPart = keyMarker ? ` ${keyMarker}` : "";
|
|
2825
|
-
return ` ${field.type.toLowerCase()} ${field.name}${keyPart}${commentPart ? ` "${commentPart}"` : ""}`;
|
|
2828
|
+
return ` ${field.type.toLowerCase()} ${field.name}${keyPart}${commentPart ? ` "${escapeComment(commentPart)}"` : ""}`;
|
|
2826
2829
|
}).filter((field) => field !== null);
|
|
2827
2830
|
}
|
|
2828
2831
|
function modelInfo(model) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hekireki",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Hekireki is a tool that generates validation schemas for Zod, Valibot, ArkType, and Effect Schema, as well as ER diagrams and DBML, from Prisma schemas annotated with comments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ajv",
|