@cloudhal/core-contracts 0.4.0 → 0.5.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.
@@ -30,6 +30,20 @@ export type Slug = string;
30
30
  * via the `definition` "Locale".
31
31
  */
32
32
  export type Locale = string;
33
+ /**
34
+ * RFC-0041: one typed custom field of a collection, discriminated by `type`.
35
+ *
36
+ * This interface was referenced by `Site`'s JSON-Schema
37
+ * via the `definition` "FieldDefinition".
38
+ */
39
+ export type FieldDefinition = TextField | RichTextField | NumberField | BooleanField | DateField | DateTimeField | UrlField | ImageField | SelectField;
40
+ /**
41
+ * The field's key in ContentEntry.fields: lower camelCase, a JavaScript identifier. Unique in its collection; built-in entry property names are reserved (checked in code).
42
+ *
43
+ * This interface was referenced by `Site`'s JSON-Schema
44
+ * via the `definition` "FieldKey".
45
+ */
46
+ export type FieldKey = string;
33
47
  /**
34
48
  * RFC-0025 §2: one optional surface (kind `surface`) above the footer's columns, built and checked like any surface; the store refuses other section kinds.
35
49
  */
@@ -214,6 +228,13 @@ export interface CollectionSettings {
214
228
  * RFC-0040: default order where none is given (Studio's list, entry queries without sort, MCP list_entries). Absent: newest.
215
229
  */
216
230
  sort?: "newest" | "oldest" | "title";
231
+ /**
232
+ * RFC-0041: the collection's typed custom fields, in form order. Values live in ContentEntry.fields under each key. At most 200 per site and unique keys (checked in code).
233
+ *
234
+ * @minItems 1
235
+ * @maxItems 30
236
+ */
237
+ fields?: [FieldDefinition, ...FieldDefinition[]];
217
238
  }
218
239
  /**
219
240
  * This interface was referenced by `Site`'s JSON-Schema
@@ -224,6 +245,233 @@ export interface CollectionLabel {
224
245
  plural: string;
225
246
  description?: string;
226
247
  }
248
+ /**
249
+ * Plain text: a string of at most maxLength characters.
250
+ */
251
+ export interface TextField {
252
+ key: FieldKey;
253
+ type: "text";
254
+ labels: FieldLabels;
255
+ /**
256
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
257
+ */
258
+ localized: boolean;
259
+ /**
260
+ * An entry in review or published needs a value. Absent: false.
261
+ */
262
+ requiredToPublish?: boolean;
263
+ migration?: FieldMigration;
264
+ /**
265
+ * Absent: 5000.
266
+ */
267
+ maxLength?: number;
268
+ /**
269
+ * Line breaks allowed. Absent: false.
270
+ */
271
+ multiline?: boolean;
272
+ /**
273
+ * Its words go into site search. Absent: false.
274
+ */
275
+ searchable?: boolean;
276
+ }
277
+ /**
278
+ * The field's label and help per locale. Missing a locale: the default locale's, then the key.
279
+ *
280
+ * This interface was referenced by `Site`'s JSON-Schema
281
+ * via the `definition` "FieldLabels".
282
+ */
283
+ export interface FieldLabels {
284
+ [k: string]: FieldLabel | undefined;
285
+ }
286
+ /**
287
+ * This interface was referenced by `Site`'s JSON-Schema
288
+ * via the `definition` "FieldLabel".
289
+ */
290
+ export interface FieldLabel {
291
+ label: string;
292
+ help?: string;
293
+ }
294
+ /**
295
+ * RFC-0041 §6: present only while a field operation rewrites entries.
296
+ *
297
+ * This interface was referenced by `Site`'s JSON-Schema
298
+ * via the `definition` "FieldMigration".
299
+ */
300
+ export interface FieldMigration {
301
+ /**
302
+ * Prefixed, URL-safe identifier, e.g. site_01HZX8K3Q9. The prefix names the entity kind; agents and the MCP server pass these as opaque handles.
303
+ */
304
+ id: string;
305
+ fromKey?: FieldKey;
306
+ fromType?: "text" | "richText" | "number" | "boolean" | "date" | "datetime" | "url" | "image" | "select";
307
+ fromLocalized?: boolean;
308
+ }
309
+ /**
310
+ * Cloudhal Markdown v1 (ADR-0028), at most 50 000 characters.
311
+ */
312
+ export interface RichTextField {
313
+ key: FieldKey;
314
+ type: "richText";
315
+ labels: FieldLabels;
316
+ /**
317
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
318
+ */
319
+ localized: boolean;
320
+ /**
321
+ * An entry in review or published needs a value. Absent: false.
322
+ */
323
+ requiredToPublish?: boolean;
324
+ migration?: FieldMigration;
325
+ /**
326
+ * Its words go into site search. Absent: false.
327
+ */
328
+ searchable?: boolean;
329
+ }
330
+ /**
331
+ * A finite number.
332
+ */
333
+ export interface NumberField {
334
+ key: FieldKey;
335
+ type: "number";
336
+ labels: FieldLabels;
337
+ /**
338
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
339
+ */
340
+ localized: boolean;
341
+ /**
342
+ * An entry in review or published needs a value. Absent: false.
343
+ */
344
+ requiredToPublish?: boolean;
345
+ migration?: FieldMigration;
346
+ /**
347
+ * Whole numbers only. Absent: false.
348
+ */
349
+ integer?: boolean;
350
+ minimum?: number;
351
+ maximum?: number;
352
+ }
353
+ /**
354
+ * true or false; absent reads as false, so it cannot be required to publish.
355
+ */
356
+ export interface BooleanField {
357
+ key: FieldKey;
358
+ type: "boolean";
359
+ labels: FieldLabels;
360
+ /**
361
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
362
+ */
363
+ localized: boolean;
364
+ migration?: FieldMigration;
365
+ }
366
+ /**
367
+ * A calendar day without a zone (YYYY-MM-DD).
368
+ */
369
+ export interface DateField {
370
+ key: FieldKey;
371
+ type: "date";
372
+ labels: FieldLabels;
373
+ /**
374
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
375
+ */
376
+ localized: boolean;
377
+ /**
378
+ * An entry in review or published needs a value. Absent: false.
379
+ */
380
+ requiredToPublish?: boolean;
381
+ migration?: FieldMigration;
382
+ }
383
+ /**
384
+ * An instant with the zone it was entered in: {at, timeZone} (RFC-0008 §9.1).
385
+ */
386
+ export interface DateTimeField {
387
+ key: FieldKey;
388
+ type: "datetime";
389
+ labels: FieldLabels;
390
+ /**
391
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
392
+ */
393
+ localized: boolean;
394
+ /**
395
+ * An entry in review or published needs a value. Absent: false.
396
+ */
397
+ requiredToPublish?: boolean;
398
+ migration?: FieldMigration;
399
+ }
400
+ /**
401
+ * A link: https, http, mailto, tel, a site-relative path or a #fragment; at most 2048 characters.
402
+ */
403
+ export interface UrlField {
404
+ key: FieldKey;
405
+ type: "url";
406
+ labels: FieldLabels;
407
+ /**
408
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
409
+ */
410
+ localized: boolean;
411
+ /**
412
+ * An entry in review or published needs a value. Absent: false.
413
+ */
414
+ requiredToPublish?: boolean;
415
+ migration?: FieldMigration;
416
+ }
417
+ /**
418
+ * An image Asset of the same site, by id (asset_…).
419
+ */
420
+ export interface ImageField {
421
+ key: FieldKey;
422
+ type: "image";
423
+ labels: FieldLabels;
424
+ /**
425
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
426
+ */
427
+ localized: boolean;
428
+ /**
429
+ * An entry in review or published needs a value. Absent: false.
430
+ */
431
+ requiredToPublish?: boolean;
432
+ migration?: FieldMigration;
433
+ }
434
+ /**
435
+ * One of a closed list of options, or several when multiple.
436
+ */
437
+ export interface SelectField {
438
+ key: FieldKey;
439
+ type: "select";
440
+ labels: FieldLabels;
441
+ /**
442
+ * true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it.
443
+ */
444
+ localized: boolean;
445
+ /**
446
+ * An entry in review or published needs a value. Absent: false.
447
+ */
448
+ requiredToPublish?: boolean;
449
+ migration?: FieldMigration;
450
+ /**
451
+ * @minItems 1
452
+ * @maxItems 50
453
+ */
454
+ options: [FieldOption, ...FieldOption[]];
455
+ /**
456
+ * The value is a list of option values. Absent: false.
457
+ */
458
+ multiple?: boolean;
459
+ }
460
+ /**
461
+ * One option of a select field. Values are unique in the field (checked in code).
462
+ *
463
+ * This interface was referenced by `Site`'s JSON-Schema
464
+ * via the `definition` "FieldOption".
465
+ */
466
+ export interface FieldOption {
467
+ /**
468
+ * Lower-case URL segment.
469
+ */
470
+ value: string;
471
+ labels: {
472
+ [k: string]: string | undefined;
473
+ };
474
+ }
227
475
  /**
228
476
  * Theme (a.k.a. Experience) applied by the renderer. Config is theme-defined and validated by the theme's own schema, not here.
229
477
  *
@@ -33,6 +33,29 @@
33
33
  * via the `definition` "Locale".
34
34
  */
35
35
 
36
+ /**
37
+ * RFC-0041: one typed custom field of a collection, discriminated by `type`.
38
+ *
39
+ * This interface was referenced by `Site`'s JSON-Schema
40
+ * via the `definition` "FieldDefinition".
41
+ */
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+ /**
53
+ * The field's key in ContentEntry.fields: lower camelCase, a JavaScript identifier. Unique in its collection; built-in entry property names are reserved (checked in code).
54
+ *
55
+ * This interface was referenced by `Site`'s JSON-Schema
56
+ * via the `definition` "FieldKey".
57
+ */
58
+
36
59
  /**
37
60
  * RFC-0025 §2: one optional surface (kind `surface`) above the footer's columns, built and checked like any surface; the store refuses other section kinds.
38
61
  */
@@ -230,6 +253,13 @@
230
253
 
231
254
 
232
255
 
256
+
257
+
258
+
259
+
260
+
261
+
262
+
233
263
 
234
264
  /**
235
265
  * This interface was referenced by `Site`'s JSON-Schema
@@ -240,6 +270,234 @@
240
270
 
241
271
 
242
272
 
273
+ /**
274
+ * Plain text: a string of at most maxLength characters.
275
+ */
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ /**
303
+ * The field's label and help per locale. Missing a locale: the default locale's, then the key.
304
+ *
305
+ * This interface was referenced by `Site`'s JSON-Schema
306
+ * via the `definition` "FieldLabels".
307
+ */
308
+
309
+
310
+
311
+ /**
312
+ * This interface was referenced by `Site`'s JSON-Schema
313
+ * via the `definition` "FieldLabel".
314
+ */
315
+
316
+
317
+
318
+
319
+ /**
320
+ * RFC-0041 §6: present only while a field operation rewrites entries.
321
+ *
322
+ * This interface was referenced by `Site`'s JSON-Schema
323
+ * via the `definition` "FieldMigration".
324
+ */
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+ /**
336
+ * Cloudhal Markdown v1 (ADR-0028), at most 50 000 characters.
337
+ */
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+ /**
357
+ * A finite number.
358
+ */
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+ /**
380
+ * true or false; absent reads as false, so it cannot be required to publish.
381
+ */
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+
392
+ /**
393
+ * A calendar day without a zone (YYYY-MM-DD).
394
+ */
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+ /**
410
+ * An instant with the zone it was entered in: {at, timeZone} (RFC-0008 §9.1).
411
+ */
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+ /**
427
+ * A link: https, http, mailto, tel, a site-relative path or a #fragment; at most 2048 characters.
428
+ */
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+ /**
444
+ * An image Asset of the same site, by id (asset_…).
445
+ */
446
+
447
+
448
+
449
+
450
+
451
+
452
+
453
+
454
+
455
+
456
+
457
+
458
+
459
+
460
+ /**
461
+ * One of a closed list of options, or several when multiple.
462
+ */
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+ /**
487
+ * One option of a select field. Values are unique in the field (checked in code).
488
+ *
489
+ * This interface was referenced by `Site`'s JSON-Schema
490
+ * via the `definition` "FieldOption".
491
+ */
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
243
501
  /**
244
502
  * Theme (a.k.a. Experience) applied by the renderer. Config is theme-defined and validated by the theme's own schema, not here.
245
503
  *