@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.
- package/dist/src/generated/content-entry.d.ts +1 -1
- package/dist/src/generated/content-entry.js +1 -1
- package/dist/src/generated/index.d.ts +1 -1
- package/dist/src/generated/index.js +1 -1
- package/dist/src/generated/schemas.d.ts +778 -2
- package/dist/src/generated/schemas.js +480 -1
- package/dist/src/generated/site.d.ts +248 -0
- package/dist/src/generated/site.js +258 -0
- package/dist/src/generated/validators.js +3393 -1156
- package/package.json +1 -1
- package/schemas/content-entry.schema.json +1 -1
- package/schemas/site.schema.json +408 -0
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"body": { "$ref": "#/$defs/Body" },
|
|
36
36
|
"fields": {
|
|
37
37
|
"type": "object",
|
|
38
|
-
"description": "Collection-specific values; any JSON.",
|
|
38
|
+
"description": "Collection-specific values, keyed by field. A collection with typed fields (RFC-0041, Site.collections.<key>.fields) checks each value against its definition on write; otherwise any JSON. An absent key means no value.",
|
|
39
39
|
"additionalProperties": true
|
|
40
40
|
},
|
|
41
41
|
"tags": {
|
package/schemas/site.schema.json
CHANGED
|
@@ -104,6 +104,15 @@
|
|
|
104
104
|
"type": "string",
|
|
105
105
|
"description": "RFC-0040: default order where none is given (Studio's list, entry queries without sort, MCP list_entries). Absent: newest.",
|
|
106
106
|
"enum": ["newest", "oldest", "title"]
|
|
107
|
+
},
|
|
108
|
+
"fields": {
|
|
109
|
+
"type": "array",
|
|
110
|
+
"description": "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).",
|
|
111
|
+
"minItems": 1,
|
|
112
|
+
"maxItems": 30,
|
|
113
|
+
"items": {
|
|
114
|
+
"$ref": "#/$defs/FieldDefinition"
|
|
115
|
+
}
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
118
|
},
|
|
@@ -117,6 +126,405 @@
|
|
|
117
126
|
"description": { "type": "string", "maxLength": 1000 }
|
|
118
127
|
}
|
|
119
128
|
},
|
|
129
|
+
"FieldDefinition": {
|
|
130
|
+
"description": "RFC-0041: one typed custom field of a collection, discriminated by `type`.",
|
|
131
|
+
"oneOf": [
|
|
132
|
+
{
|
|
133
|
+
"title": "TextField",
|
|
134
|
+
"type": "object",
|
|
135
|
+
"description": "Plain text: a string of at most maxLength characters.",
|
|
136
|
+
"additionalProperties": false,
|
|
137
|
+
"required": ["key", "type", "labels", "localized"],
|
|
138
|
+
"properties": {
|
|
139
|
+
"key": {
|
|
140
|
+
"$ref": "#/$defs/FieldKey"
|
|
141
|
+
},
|
|
142
|
+
"type": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"enum": ["text"]
|
|
145
|
+
},
|
|
146
|
+
"labels": {
|
|
147
|
+
"$ref": "#/$defs/FieldLabels"
|
|
148
|
+
},
|
|
149
|
+
"localized": {
|
|
150
|
+
"type": "boolean",
|
|
151
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
152
|
+
},
|
|
153
|
+
"requiredToPublish": {
|
|
154
|
+
"type": "boolean",
|
|
155
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
156
|
+
},
|
|
157
|
+
"migration": {
|
|
158
|
+
"$ref": "#/$defs/FieldMigration"
|
|
159
|
+
},
|
|
160
|
+
"maxLength": {
|
|
161
|
+
"type": "integer",
|
|
162
|
+
"description": "Absent: 5000.",
|
|
163
|
+
"minimum": 1,
|
|
164
|
+
"maximum": 5000
|
|
165
|
+
},
|
|
166
|
+
"multiline": {
|
|
167
|
+
"type": "boolean",
|
|
168
|
+
"description": "Line breaks allowed. Absent: false."
|
|
169
|
+
},
|
|
170
|
+
"searchable": {
|
|
171
|
+
"type": "boolean",
|
|
172
|
+
"description": "Its words go into site search. Absent: false."
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"title": "RichTextField",
|
|
178
|
+
"type": "object",
|
|
179
|
+
"description": "Cloudhal Markdown v1 (ADR-0028), at most 50 000 characters.",
|
|
180
|
+
"additionalProperties": false,
|
|
181
|
+
"required": ["key", "type", "labels", "localized"],
|
|
182
|
+
"properties": {
|
|
183
|
+
"key": {
|
|
184
|
+
"$ref": "#/$defs/FieldKey"
|
|
185
|
+
},
|
|
186
|
+
"type": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"enum": ["richText"]
|
|
189
|
+
},
|
|
190
|
+
"labels": {
|
|
191
|
+
"$ref": "#/$defs/FieldLabels"
|
|
192
|
+
},
|
|
193
|
+
"localized": {
|
|
194
|
+
"type": "boolean",
|
|
195
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
196
|
+
},
|
|
197
|
+
"requiredToPublish": {
|
|
198
|
+
"type": "boolean",
|
|
199
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
200
|
+
},
|
|
201
|
+
"migration": {
|
|
202
|
+
"$ref": "#/$defs/FieldMigration"
|
|
203
|
+
},
|
|
204
|
+
"searchable": {
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"description": "Its words go into site search. Absent: false."
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"title": "NumberField",
|
|
212
|
+
"type": "object",
|
|
213
|
+
"description": "A finite number.",
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"required": ["key", "type", "labels", "localized"],
|
|
216
|
+
"properties": {
|
|
217
|
+
"key": {
|
|
218
|
+
"$ref": "#/$defs/FieldKey"
|
|
219
|
+
},
|
|
220
|
+
"type": {
|
|
221
|
+
"type": "string",
|
|
222
|
+
"enum": ["number"]
|
|
223
|
+
},
|
|
224
|
+
"labels": {
|
|
225
|
+
"$ref": "#/$defs/FieldLabels"
|
|
226
|
+
},
|
|
227
|
+
"localized": {
|
|
228
|
+
"type": "boolean",
|
|
229
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
230
|
+
},
|
|
231
|
+
"requiredToPublish": {
|
|
232
|
+
"type": "boolean",
|
|
233
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
234
|
+
},
|
|
235
|
+
"migration": {
|
|
236
|
+
"$ref": "#/$defs/FieldMigration"
|
|
237
|
+
},
|
|
238
|
+
"integer": {
|
|
239
|
+
"type": "boolean",
|
|
240
|
+
"description": "Whole numbers only. Absent: false."
|
|
241
|
+
},
|
|
242
|
+
"minimum": {
|
|
243
|
+
"type": "number"
|
|
244
|
+
},
|
|
245
|
+
"maximum": {
|
|
246
|
+
"type": "number"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
"title": "BooleanField",
|
|
252
|
+
"type": "object",
|
|
253
|
+
"description": "true or false; absent reads as false, so it cannot be required to publish.",
|
|
254
|
+
"additionalProperties": false,
|
|
255
|
+
"required": ["key", "type", "labels", "localized"],
|
|
256
|
+
"properties": {
|
|
257
|
+
"key": {
|
|
258
|
+
"$ref": "#/$defs/FieldKey"
|
|
259
|
+
},
|
|
260
|
+
"type": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"enum": ["boolean"]
|
|
263
|
+
},
|
|
264
|
+
"labels": {
|
|
265
|
+
"$ref": "#/$defs/FieldLabels"
|
|
266
|
+
},
|
|
267
|
+
"localized": {
|
|
268
|
+
"type": "boolean",
|
|
269
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
270
|
+
},
|
|
271
|
+
"migration": {
|
|
272
|
+
"$ref": "#/$defs/FieldMigration"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"title": "DateField",
|
|
278
|
+
"type": "object",
|
|
279
|
+
"description": "A calendar day without a zone (YYYY-MM-DD).",
|
|
280
|
+
"additionalProperties": false,
|
|
281
|
+
"required": ["key", "type", "labels", "localized"],
|
|
282
|
+
"properties": {
|
|
283
|
+
"key": {
|
|
284
|
+
"$ref": "#/$defs/FieldKey"
|
|
285
|
+
},
|
|
286
|
+
"type": {
|
|
287
|
+
"type": "string",
|
|
288
|
+
"enum": ["date"]
|
|
289
|
+
},
|
|
290
|
+
"labels": {
|
|
291
|
+
"$ref": "#/$defs/FieldLabels"
|
|
292
|
+
},
|
|
293
|
+
"localized": {
|
|
294
|
+
"type": "boolean",
|
|
295
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
296
|
+
},
|
|
297
|
+
"requiredToPublish": {
|
|
298
|
+
"type": "boolean",
|
|
299
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
300
|
+
},
|
|
301
|
+
"migration": {
|
|
302
|
+
"$ref": "#/$defs/FieldMigration"
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"title": "DateTimeField",
|
|
308
|
+
"type": "object",
|
|
309
|
+
"description": "An instant with the zone it was entered in: {at, timeZone} (RFC-0008 §9.1).",
|
|
310
|
+
"additionalProperties": false,
|
|
311
|
+
"required": ["key", "type", "labels", "localized"],
|
|
312
|
+
"properties": {
|
|
313
|
+
"key": {
|
|
314
|
+
"$ref": "#/$defs/FieldKey"
|
|
315
|
+
},
|
|
316
|
+
"type": {
|
|
317
|
+
"type": "string",
|
|
318
|
+
"enum": ["datetime"]
|
|
319
|
+
},
|
|
320
|
+
"labels": {
|
|
321
|
+
"$ref": "#/$defs/FieldLabels"
|
|
322
|
+
},
|
|
323
|
+
"localized": {
|
|
324
|
+
"type": "boolean",
|
|
325
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
326
|
+
},
|
|
327
|
+
"requiredToPublish": {
|
|
328
|
+
"type": "boolean",
|
|
329
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
330
|
+
},
|
|
331
|
+
"migration": {
|
|
332
|
+
"$ref": "#/$defs/FieldMigration"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"title": "UrlField",
|
|
338
|
+
"type": "object",
|
|
339
|
+
"description": "A link: https, http, mailto, tel, a site-relative path or a #fragment; at most 2048 characters.",
|
|
340
|
+
"additionalProperties": false,
|
|
341
|
+
"required": ["key", "type", "labels", "localized"],
|
|
342
|
+
"properties": {
|
|
343
|
+
"key": {
|
|
344
|
+
"$ref": "#/$defs/FieldKey"
|
|
345
|
+
},
|
|
346
|
+
"type": {
|
|
347
|
+
"type": "string",
|
|
348
|
+
"enum": ["url"]
|
|
349
|
+
},
|
|
350
|
+
"labels": {
|
|
351
|
+
"$ref": "#/$defs/FieldLabels"
|
|
352
|
+
},
|
|
353
|
+
"localized": {
|
|
354
|
+
"type": "boolean",
|
|
355
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
356
|
+
},
|
|
357
|
+
"requiredToPublish": {
|
|
358
|
+
"type": "boolean",
|
|
359
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
360
|
+
},
|
|
361
|
+
"migration": {
|
|
362
|
+
"$ref": "#/$defs/FieldMigration"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"title": "ImageField",
|
|
368
|
+
"type": "object",
|
|
369
|
+
"description": "An image Asset of the same site, by id (asset_…).",
|
|
370
|
+
"additionalProperties": false,
|
|
371
|
+
"required": ["key", "type", "labels", "localized"],
|
|
372
|
+
"properties": {
|
|
373
|
+
"key": {
|
|
374
|
+
"$ref": "#/$defs/FieldKey"
|
|
375
|
+
},
|
|
376
|
+
"type": {
|
|
377
|
+
"type": "string",
|
|
378
|
+
"enum": ["image"]
|
|
379
|
+
},
|
|
380
|
+
"labels": {
|
|
381
|
+
"$ref": "#/$defs/FieldLabels"
|
|
382
|
+
},
|
|
383
|
+
"localized": {
|
|
384
|
+
"type": "boolean",
|
|
385
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
386
|
+
},
|
|
387
|
+
"requiredToPublish": {
|
|
388
|
+
"type": "boolean",
|
|
389
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
390
|
+
},
|
|
391
|
+
"migration": {
|
|
392
|
+
"$ref": "#/$defs/FieldMigration"
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"title": "SelectField",
|
|
398
|
+
"type": "object",
|
|
399
|
+
"description": "One of a closed list of options, or several when multiple.",
|
|
400
|
+
"additionalProperties": false,
|
|
401
|
+
"required": ["key", "type", "labels", "localized", "options"],
|
|
402
|
+
"properties": {
|
|
403
|
+
"key": {
|
|
404
|
+
"$ref": "#/$defs/FieldKey"
|
|
405
|
+
},
|
|
406
|
+
"type": {
|
|
407
|
+
"type": "string",
|
|
408
|
+
"enum": ["select"]
|
|
409
|
+
},
|
|
410
|
+
"labels": {
|
|
411
|
+
"$ref": "#/$defs/FieldLabels"
|
|
412
|
+
},
|
|
413
|
+
"localized": {
|
|
414
|
+
"type": "boolean",
|
|
415
|
+
"description": "true: each language version has its own value (missing reads the original's); false: only the translation group's original holds it."
|
|
416
|
+
},
|
|
417
|
+
"requiredToPublish": {
|
|
418
|
+
"type": "boolean",
|
|
419
|
+
"description": "An entry in review or published needs a value. Absent: false."
|
|
420
|
+
},
|
|
421
|
+
"migration": {
|
|
422
|
+
"$ref": "#/$defs/FieldMigration"
|
|
423
|
+
},
|
|
424
|
+
"options": {
|
|
425
|
+
"type": "array",
|
|
426
|
+
"minItems": 1,
|
|
427
|
+
"maxItems": 50,
|
|
428
|
+
"items": {
|
|
429
|
+
"$ref": "#/$defs/FieldOption"
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
"multiple": {
|
|
433
|
+
"type": "boolean",
|
|
434
|
+
"description": "The value is a list of option values. Absent: false."
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
"FieldKey": {
|
|
441
|
+
"type": "string",
|
|
442
|
+
"description": "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).",
|
|
443
|
+
"pattern": "^[a-z][A-Za-z0-9]{0,39}$"
|
|
444
|
+
},
|
|
445
|
+
"FieldLabels": {
|
|
446
|
+
"type": "object",
|
|
447
|
+
"description": "The field's label and help per locale. Missing a locale: the default locale's, then the key.",
|
|
448
|
+
"propertyNames": {
|
|
449
|
+
"$ref": "common.schema.json#/$defs/Locale"
|
|
450
|
+
},
|
|
451
|
+
"minProperties": 1,
|
|
452
|
+
"additionalProperties": {
|
|
453
|
+
"$ref": "#/$defs/FieldLabel"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"FieldLabel": {
|
|
457
|
+
"type": "object",
|
|
458
|
+
"additionalProperties": false,
|
|
459
|
+
"required": ["label"],
|
|
460
|
+
"properties": {
|
|
461
|
+
"label": {
|
|
462
|
+
"type": "string",
|
|
463
|
+
"minLength": 1,
|
|
464
|
+
"maxLength": 100
|
|
465
|
+
},
|
|
466
|
+
"help": {
|
|
467
|
+
"type": "string",
|
|
468
|
+
"maxLength": 300
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
"FieldOption": {
|
|
473
|
+
"type": "object",
|
|
474
|
+
"description": "One option of a select field. Values are unique in the field (checked in code).",
|
|
475
|
+
"additionalProperties": false,
|
|
476
|
+
"required": ["value", "labels"],
|
|
477
|
+
"properties": {
|
|
478
|
+
"value": {
|
|
479
|
+
"$ref": "common.schema.json#/$defs/Slug",
|
|
480
|
+
"description": "Stored in entries, never shown."
|
|
481
|
+
},
|
|
482
|
+
"labels": {
|
|
483
|
+
"type": "object",
|
|
484
|
+
"propertyNames": {
|
|
485
|
+
"$ref": "common.schema.json#/$defs/Locale"
|
|
486
|
+
},
|
|
487
|
+
"minProperties": 1,
|
|
488
|
+
"additionalProperties": {
|
|
489
|
+
"type": "string",
|
|
490
|
+
"minLength": 1,
|
|
491
|
+
"maxLength": 100
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
"FieldMigration": {
|
|
497
|
+
"type": "object",
|
|
498
|
+
"description": "RFC-0041 §6: present only while a field operation rewrites entries.",
|
|
499
|
+
"additionalProperties": false,
|
|
500
|
+
"required": ["id"],
|
|
501
|
+
"properties": {
|
|
502
|
+
"id": {
|
|
503
|
+
"$ref": "common.schema.json#/$defs/Id",
|
|
504
|
+
"description": "The operation's \"before\" snapshot."
|
|
505
|
+
},
|
|
506
|
+
"fromKey": {
|
|
507
|
+
"$ref": "#/$defs/FieldKey"
|
|
508
|
+
},
|
|
509
|
+
"fromType": {
|
|
510
|
+
"type": "string",
|
|
511
|
+
"enum": [
|
|
512
|
+
"text",
|
|
513
|
+
"richText",
|
|
514
|
+
"number",
|
|
515
|
+
"boolean",
|
|
516
|
+
"date",
|
|
517
|
+
"datetime",
|
|
518
|
+
"url",
|
|
519
|
+
"image",
|
|
520
|
+
"select"
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
"fromLocalized": {
|
|
524
|
+
"type": "boolean"
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
},
|
|
120
528
|
"Brand": {
|
|
121
529
|
"type": "object",
|
|
122
530
|
"description": "The site's logo and social links (RFC-0025 \u00a71), shared by the header, the footer and SEO.",
|