@cmssy/cli 11.8.0 → 11.9.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 +13 -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";
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,12 @@ 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
+ /** What a media field holds. Mirrors \`MediaFieldValue\` in @cmssy/types. */
1267
+ export type CmssyMedia = string;
1268
+
1269
+ /** What a file field holds. Mirrors \`FileFieldValue\` in @cmssy/types. */
1270
+ export type CmssyFile = string;
1271
+
1263
1272
  /** A record as \`public.model.records\` returns it, with \`data\` typed. */
1264
1273
  export interface CmssyRecordOf<Data> {
1265
1274
  id: string;
@@ -1292,7 +1301,8 @@ function generateModelTypes(models, options) {
1292
1301
  const doc = [`/**`, ` * ${title}`];
1293
1302
  if (model.description) doc.push(` *`, ` * ${model.description}`);
1294
1303
  doc.push(` *`, ` * Model slug: \`${model.slug}\``);
1295
- if (model.displayField) doc.push(` * Display field: \`${model.displayField}\``);
1304
+ if (model.displayField)
1305
+ doc.push(` * Display field: \`${model.displayField}\``);
1296
1306
  doc.push(` */`);
1297
1307
  blocks.push(
1298
1308
  "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/cli",
3
- "version": "11.8.0",
3
+ "version": "11.9.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": "11.9.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.0.0",