hekireki 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,5 @@
1
1
  # Hekireki
2
2
 
3
- ![img](https://raw.githubusercontent.com/nakita628/hekireki/refs/heads/main/assets/img/hekireki.png)
4
-
5
3
  **[Hekireki](https://www.npmjs.com/package/hekireki)** is a tool that generates validation schemas for Zod and Valibot, as well as ER diagrams, from [Prisma](https://www.prisma.io/) schemas annotated with comments.
6
4
 
7
5
  ## Features
@@ -26,14 +26,14 @@ export function buildValibotRelations(model, relProps, options) {
26
26
  return null;
27
27
  const base = `...${model.name}Schema.entries`;
28
28
  const rels = relProps
29
- .map((r) => `${r.key}: ${r.isMany ? `v.array(${r.targetModel}Schema)` : `${r.targetModel}Schema`}`)
30
- .join(', ');
29
+ .map((r) => `${r.key}:${r.isMany ? `v.array(${r.targetModel}Schema)` : `${r.targetModel}Schema`}`)
30
+ .join(',');
31
31
  const modelAnno = extractAnno(model.documentation ?? '', '@v.');
32
32
  const objectDef = modelAnno === 'strictObject'
33
- ? `v.strictObject({ ${base}, ${rels} })`
33
+ ? `v.strictObject({${base},${rels}})`
34
34
  : modelAnno === 'looseObject'
35
- ? `v.looseObject({ ${base}, ${rels} })`
36
- : `v.object({ ${base}, ${rels} })`;
35
+ ? `v.looseObject({${base},${rels}})`
36
+ : `v.object({${base},${rels}})`;
37
37
  const typeLine = options?.includeType
38
38
  ? `\n\nexport type ${model.name}Relations = v.InferInput<typeof ${model.name}RelationsSchema>`
39
39
  : '';
@@ -17,9 +17,9 @@ export function buildZodRelations(model, relProps, options) {
17
17
  return null;
18
18
  const base = `...${model.name}Schema.shape`;
19
19
  const rels = relProps
20
- .map((r) => `${r.key}: ${r.isMany ? `z.array(${r.targetModel}Schema)` : `${r.targetModel}Schema`}`)
21
- .join(', ');
22
- const objectDef = buildZodObject(`${base}, ${rels}`, model.documentation);
20
+ .map((r) => `${r.key}:${r.isMany ? `z.array(${r.targetModel}Schema)` : `${r.targetModel}Schema`}`)
21
+ .join(',');
22
+ const objectDef = buildZodObject(`${base},${rels}`, model.documentation);
23
23
  const typeLine = options?.includeType
24
24
  ? `\n\nexport type ${model.name}Relations = z.infer<typeof ${model.name}RelationsSchema>`
25
25
  : '';
@@ -68,8 +68,8 @@ export const wrapCardinality = (expr, field) => {
68
68
  export const buildZodObject = (inner, documentation) => {
69
69
  const anno = extractAnno(documentation ?? '', '@z.');
70
70
  return anno === 'strictObject'
71
- ? `z.strictObject({\n${inner}\n})`
71
+ ? `z.strictObject({${inner}})`
72
72
  : anno === 'looseObject'
73
- ? `z.looseObject({\n${inner}\n})`
74
- : `z.object({\n${inner}\n})`;
73
+ ? `z.looseObject({${inner}})`
74
+ : `z.object({${inner}})`;
75
75
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hekireki",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.4.2",
5
5
  "license": "MIT",
6
6
  "description": "Hekireki is a tool that generates validation schemas for Zod and Valibot, as well as ER diagrams, from Prisma schemas annotated with comments.",
7
7
  "keywords": [