@bobbykim/manguito-cms-cli 0.9.0 → 0.9.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/dist/index.js +19 -9
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -17530,11 +17530,18 @@ function fieldToZodSchema(field, registry) {
|
|
|
17530
17530
|
return "z.unknown()";
|
|
17531
17531
|
}
|
|
17532
17532
|
}
|
|
17533
|
+
function acceptsNull(f) {
|
|
17534
|
+
if (relationCardinality(f) === "many") return false;
|
|
17535
|
+
return f.db_column ? f.db_column.nullable : f.nullable;
|
|
17536
|
+
}
|
|
17537
|
+
function fieldEntrySchema(f, registry) {
|
|
17538
|
+
let s = fieldToZodSchema(f, registry);
|
|
17539
|
+
if (acceptsNull(f)) s += ".nullable()";
|
|
17540
|
+
if (!f.required) s += ".optional()";
|
|
17541
|
+
return s;
|
|
17542
|
+
}
|
|
17533
17543
|
function generateParagraphObjectSchema(paragraph, registry) {
|
|
17534
|
-
const entries = paragraph.fields.map((f) => {
|
|
17535
|
-
const zodType = fieldToZodSchema(f, registry);
|
|
17536
|
-
return `${f.name}: ${f.required ? zodType : `${zodType}.optional()`}`;
|
|
17537
|
-
});
|
|
17544
|
+
const entries = paragraph.fields.map((f) => `${f.name}: ${fieldEntrySchema(f, registry)}`);
|
|
17538
17545
|
if (entries.length === 0) return "z.object({})";
|
|
17539
17546
|
return `z.object({ ${entries.join(", ")} })`;
|
|
17540
17547
|
}
|
|
@@ -17549,10 +17556,7 @@ function systemFieldEntries(schema) {
|
|
|
17549
17556
|
return entries;
|
|
17550
17557
|
}
|
|
17551
17558
|
function schemaFieldEntries(fields, registry) {
|
|
17552
|
-
return fields.map((f) => {
|
|
17553
|
-
const zodType = fieldToZodSchema(f, registry);
|
|
17554
|
-
return ` ${f.name}: ${f.required ? zodType : `${zodType}.optional()`}`;
|
|
17555
|
-
});
|
|
17559
|
+
return fields.map((f) => ` ${f.name}: ${fieldEntrySchema(f, registry)}`);
|
|
17556
17560
|
}
|
|
17557
17561
|
function generateContentSchema(schema, registry) {
|
|
17558
17562
|
const name = schemaVar(schema.name);
|
|
@@ -17615,6 +17619,10 @@ var ADMIN_LIST_QUERY = `z.object({
|
|
|
17615
17619
|
})`;
|
|
17616
17620
|
var SLUG_PARAMS = `z.object({ slug: z.string() })`;
|
|
17617
17621
|
var ID_PARAMS = `z.object({ id: z.string().uuid() })`;
|
|
17622
|
+
var ITEM_IN_USE_RESPONSE = `{
|
|
17623
|
+
content: { 'application/json': { schema: ErrorResponseSchema } },
|
|
17624
|
+
description: 'ITEM_IN_USE: a required reference elsewhere still points at this item',
|
|
17625
|
+
}`;
|
|
17618
17626
|
var INCLUDE_QUERY = `z.object({ include: z.string().optional().describe('Comma-separated relation field names to expand') })`;
|
|
17619
17627
|
function generateContentRoutes(contentType) {
|
|
17620
17628
|
const sVar = schemaVar(contentType.name);
|
|
@@ -17774,6 +17782,7 @@ function generateContentRoutes(contentType) {
|
|
|
17774
17782
|
content: { 'application/json': { schema: ErrorResponseSchema } },
|
|
17775
17783
|
description: '${label} not found',
|
|
17776
17784
|
},
|
|
17785
|
+
409: ${ITEM_IN_USE_RESPONSE},
|
|
17777
17786
|
},
|
|
17778
17787
|
})`
|
|
17779
17788
|
);
|
|
@@ -18035,6 +18044,7 @@ function generateTaxonomyRoutes(taxonomyType) {
|
|
|
18035
18044
|
content: { 'application/json': { schema: ErrorResponseSchema } },
|
|
18036
18045
|
description: '${label} not found',
|
|
18037
18046
|
},
|
|
18047
|
+
409: ${ITEM_IN_USE_RESPONSE},
|
|
18038
18048
|
},
|
|
18039
18049
|
})`
|
|
18040
18050
|
);
|
|
@@ -24594,7 +24604,7 @@ function registerUserRoutes(app, db, requirePermission, requireHierarchy) {
|
|
|
24594
24604
|
}
|
|
24595
24605
|
var API_VERSION = (() => {
|
|
24596
24606
|
try {
|
|
24597
|
-
return "0.8.
|
|
24607
|
+
return "0.8.3";
|
|
24598
24608
|
} catch {
|
|
24599
24609
|
return "0.0.0";
|
|
24600
24610
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobbykim/manguito-cms-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Bobby Kim <bobby.sihun.kim@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/bobbykim89/manguito-cms",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"typescript": "^6.0.3",
|
|
31
31
|
"vite": "^8.1.3",
|
|
32
32
|
"@bobbykim/manguito-cms-admin": "0.5.2",
|
|
33
|
-
"@bobbykim/manguito-cms-
|
|
34
|
-
"@bobbykim/manguito-cms-
|
|
35
|
-
"@bobbykim/manguito-cms-
|
|
33
|
+
"@bobbykim/manguito-cms-core": "0.8.0",
|
|
34
|
+
"@bobbykim/manguito-cms-api": "0.8.3",
|
|
35
|
+
"@bobbykim/manguito-cms-db": "0.1.8"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^25.9.5",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"build": "tsup",
|
|
44
44
|
"dev": "tsup --watch",
|
|
45
45
|
"test": "dotenv -e ../../.env.test -- vitest run",
|
|
46
|
-
"lint": "eslint src",
|
|
46
|
+
"lint": "eslint src tests",
|
|
47
47
|
"typecheck": "tsc --noEmit"
|
|
48
48
|
}
|
|
49
49
|
}
|