@cmssy/cli 11.8.0 → 12.0.0

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -3
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1196,8 +1196,9 @@ function scalarType(field) {
1196
1196
  case "boolean":
1197
1197
  return "boolean";
1198
1198
  case "media":
1199
+ return field.multiple ? "CmssyMedia[]" : "CmssyMedia | null";
1199
1200
  case "file":
1200
- return field.multiple ? "string[]" : "string";
1201
+ return field.multiple ? "CmssyFile[]" : "CmssyFile";
1201
1202
  case "select":
1202
1203
  case "radio":
1203
1204
  return field.options?.length ? stringUnion(field.options) : "string";
@@ -1234,7 +1235,9 @@ function docComment(field, pad) {
1234
1235
  if (field.label && field.label !== field.key) parts.push(field.label);
1235
1236
  if (field.description) parts.push(field.description);
1236
1237
  if (field.type === "relation" && field.relationTo) {
1237
- parts.push(`Record id(s) from \`${field.relationTo.replace(/^model:/, "")}\`.`);
1238
+ parts.push(
1239
+ `Record id(s) from \`${field.relationTo.replace(/^model:/, "")}\`.`
1240
+ );
1238
1241
  }
1239
1242
  if (!parts.length) return [];
1240
1243
  return [`${pad}/** ${parts.join(" - ")} */`];
@@ -1260,6 +1263,23 @@ function objectType(fields, depth) {
1260
1263
  var PREAMBLE = `/** A translatable field: one string, or one per enabled language. */
1261
1264
  export type CmssyLocalized = string | Record<string, string>;
1262
1265
 
1266
+ /**
1267
+ * What a media field reads back. Mirrors \`ResolvedMedia\` in @cmssy/types.
1268
+ * A single media field is \`CmssyMedia | null\`: a reference whose asset was
1269
+ * deleted resolves to nothing. A gallery drops such entries instead.
1270
+ */
1271
+ export interface CmssyMedia {
1272
+ id: string;
1273
+ url: string | null;
1274
+ visibility: "public" | "private";
1275
+ alt?: string;
1276
+ width?: number;
1277
+ height?: number;
1278
+ }
1279
+
1280
+ /** What a file field holds. Mirrors \`FileFieldValue\` in @cmssy/types. */
1281
+ export type CmssyFile = string;
1282
+
1263
1283
  /** A record as \`public.model.records\` returns it, with \`data\` typed. */
1264
1284
  export interface CmssyRecordOf<Data> {
1265
1285
  id: string;
@@ -1292,7 +1312,8 @@ function generateModelTypes(models, options) {
1292
1312
  const doc = [`/**`, ` * ${title}`];
1293
1313
  if (model.description) doc.push(` *`, ` * ${model.description}`);
1294
1314
  doc.push(` *`, ` * Model slug: \`${model.slug}\``);
1295
- if (model.displayField) doc.push(` * Display field: \`${model.displayField}\``);
1315
+ if (model.displayField)
1316
+ doc.push(` * Display field: \`${model.displayField}\``);
1296
1317
  doc.push(` */`);
1297
1318
  blocks.push(
1298
1319
  "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/cli",
3
- "version": "11.8.0",
3
+ "version": "12.0.0",
4
4
  "description": "The cmssy CLI: `cmssy init` wires cmssy into an existing Next.js, Astro or React Router app; `cmssy link` connects it to a workspace and verifies the editor wiring.",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -27,7 +27,7 @@
27
27
  "assets"
28
28
  ],
29
29
  "dependencies": {
30
- "@cmssy/core": "11.8.0"
30
+ "@cmssy/core": "12.0.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.0.0",