@cloudhal/core-contracts 0.5.0 → 0.6.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.
@@ -559,6 +559,34 @@ export const SiteSchema = {
559
559
  }
560
560
  }
561
561
  },
562
+ "CollectionExpiry": {
563
+ "type": "object",
564
+ "description": "RFC-0042: a time gate every entry derives from one of its date or datetime fields, checked at render time like Availability.until. A date ends at the start of the next day in the site's time zone.",
565
+ "additionalProperties": false,
566
+ "required": [
567
+ "field",
568
+ "action"
569
+ ],
570
+ "properties": {
571
+ "field": {
572
+ "$ref": "#/$defs/FieldKey"
573
+ },
574
+ "action": {
575
+ "type": "string",
576
+ "description": "unlist: the page stays, the entry leaves listings, feeds, the sitemap and search. hide: every public route answers 404.",
577
+ "enum": [
578
+ "unlist",
579
+ "hide"
580
+ ]
581
+ },
582
+ "afterMinutes": {
583
+ "type": "integer",
584
+ "description": "Grace after the field's instant. Absent: 0.",
585
+ "minimum": 0,
586
+ "maximum": 10080
587
+ }
588
+ }
589
+ },
562
590
  "CollectionLabel": {
563
591
  "type": "object",
564
592
  "additionalProperties": false,
@@ -634,6 +662,22 @@ export const SiteSchema = {
634
662
  "items": {
635
663
  "$ref": "#/$defs/FieldDefinition"
636
664
  }
665
+ },
666
+ "listFields": {
667
+ "type": "array",
668
+ "description": "RFC-0042: fields that listings, queries, Studio columns and MCP may filter and sort by, in column order. Keys of this collection's fields (checked in code).",
669
+ "minItems": 1,
670
+ "maxItems": 4,
671
+ "uniqueItems": true,
672
+ "items": {
673
+ "$ref": "#/$defs/FieldKey"
674
+ }
675
+ },
676
+ "expiry": {
677
+ "$ref": "#/$defs/CollectionExpiry"
678
+ },
679
+ "structuredData": {
680
+ "$ref": "#/$defs/StructuredDataPreset"
637
681
  }
638
682
  }
639
683
  },
@@ -690,6 +734,65 @@ export const SiteSchema = {
690
734
  }
691
735
  }
692
736
  },
737
+ "EntryValueProperty": {
738
+ "type": "string",
739
+ "description": "RFC-0042: entry properties a structured-data property may read.",
740
+ "enum": [
741
+ "title",
742
+ "summary",
743
+ "body",
744
+ "coverImage",
745
+ "url",
746
+ "publishedAt",
747
+ "updatedAt"
748
+ ]
749
+ },
750
+ "FieldCondition": {
751
+ "type": "object",
752
+ "description": "RFC-0042: one condition on a typed field of the listed collection. `value` is read by the field's type: a number, YYYY-MM-DD, an RFC 3339 instant, true/false, an option value, or `now`. `values` only with `in`.",
753
+ "additionalProperties": false,
754
+ "required": [
755
+ "field",
756
+ "op"
757
+ ],
758
+ "properties": {
759
+ "field": {
760
+ "type": "string",
761
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
762
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
763
+ },
764
+ "op": {
765
+ "type": "string",
766
+ "enum": [
767
+ "eq",
768
+ "ne",
769
+ "lt",
770
+ "lte",
771
+ "gt",
772
+ "gte",
773
+ "in",
774
+ "set",
775
+ "unset"
776
+ ]
777
+ },
778
+ "value": {
779
+ "type": "string",
780
+ "minLength": 1,
781
+ "maxLength": 100
782
+ },
783
+ "values": {
784
+ "type": "array",
785
+ "minItems": 1,
786
+ "maxItems": 20,
787
+ "uniqueItems": true,
788
+ "items": {
789
+ "type": "string",
790
+ "minLength": 1,
791
+ "maxLength": 100
792
+ }
793
+ }
794
+ }
795
+ },
693
796
  "FieldDefinition": {
694
797
  "description": "RFC-0041: one typed custom field of a collection, discriminated by `type`.",
695
798
  "oneOf": [
@@ -1160,6 +1263,29 @@ export const SiteSchema = {
1160
1263
  }
1161
1264
  }
1162
1265
  },
1266
+ "FieldOrder": {
1267
+ "type": "object",
1268
+ "description": "RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last.",
1269
+ "additionalProperties": false,
1270
+ "required": [
1271
+ "field",
1272
+ "direction"
1273
+ ],
1274
+ "properties": {
1275
+ "field": {
1276
+ "type": "string",
1277
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
1278
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
1279
+ },
1280
+ "direction": {
1281
+ "type": "string",
1282
+ "enum": [
1283
+ "asc",
1284
+ "desc"
1285
+ ]
1286
+ }
1287
+ }
1288
+ },
1163
1289
  "FooterColumn": {
1164
1290
  "type": "object",
1165
1291
  "additionalProperties": false,
@@ -1516,6 +1642,18 @@ export const SiteSchema = {
1516
1642
  "description": "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'.",
1517
1643
  "minLength": 1,
1518
1644
  "maxLength": 512
1645
+ },
1646
+ "where": {
1647
+ "type": "array",
1648
+ "description": "RFC-0042: conditions on the collection's list fields, ANDed.",
1649
+ "minItems": 1,
1650
+ "maxItems": 4,
1651
+ "items": {
1652
+ "$ref": "#/$defs/FieldCondition"
1653
+ }
1654
+ },
1655
+ "orderBy": {
1656
+ "$ref": "#/$defs/FieldOrder"
1519
1657
  }
1520
1658
  }
1521
1659
  },
@@ -1594,6 +1732,15 @@ export const SiteSchema = {
1594
1732
  }
1595
1733
  ]
1596
1734
  },
1735
+ "SiteValueProperty": {
1736
+ "type": "string",
1737
+ "description": "RFC-0042: site properties a structured-data property may read.",
1738
+ "enum": [
1739
+ "name",
1740
+ "url",
1741
+ "logo"
1742
+ ]
1743
+ },
1597
1744
  "Slug": {
1598
1745
  "type": "string",
1599
1746
  "description": "Lower-case URL segment.",
@@ -1633,6 +1780,131 @@ export const SiteSchema = {
1633
1780
  }
1634
1781
  }
1635
1782
  },
1783
+ "StructuredDataPreset": {
1784
+ "type": "object",
1785
+ "description": "RFC-0042: the JSON-LD type an entry page emits in place of BlogPosting, with its properties mapped to value sources. Paths, fitting field types and required properties are a closed table in code (@cloudhal/core-ts/structured-data).",
1786
+ "additionalProperties": false,
1787
+ "required": [
1788
+ "type",
1789
+ "properties"
1790
+ ],
1791
+ "properties": {
1792
+ "type": {
1793
+ "type": "string",
1794
+ "enum": [
1795
+ "Event",
1796
+ "JobPosting",
1797
+ "Product",
1798
+ "Recipe"
1799
+ ]
1800
+ },
1801
+ "properties": {
1802
+ "type": "object",
1803
+ "description": "Keyed by property path, e.g. startDate or location.address.addressLocality.",
1804
+ "propertyNames": {
1805
+ "type": "string",
1806
+ "pattern": "^[a-z][A-Za-z]{0,39}(\\.[a-z][A-Za-z]{0,39}){0,2}$"
1807
+ },
1808
+ "minProperties": 1,
1809
+ "maxProperties": 40,
1810
+ "additionalProperties": {
1811
+ "$ref": "#/$defs/StructuredDataSource"
1812
+ }
1813
+ }
1814
+ }
1815
+ },
1816
+ "StructuredDataSource": {
1817
+ "description": "RFC-0042: where one JSON-LD property's value comes from, discriminated by `kind`.",
1818
+ "oneOf": [
1819
+ {
1820
+ "title": "FieldValueSource",
1821
+ "type": "object",
1822
+ "description": "A typed field of this collection, converted by its type.",
1823
+ "additionalProperties": false,
1824
+ "required": [
1825
+ "kind",
1826
+ "field"
1827
+ ],
1828
+ "properties": {
1829
+ "kind": {
1830
+ "type": "string",
1831
+ "enum": [
1832
+ "field"
1833
+ ]
1834
+ },
1835
+ "field": {
1836
+ "$ref": "#/$defs/FieldKey"
1837
+ }
1838
+ }
1839
+ },
1840
+ {
1841
+ "title": "EntryValueSource",
1842
+ "type": "object",
1843
+ "description": "A built-in property of the entry.",
1844
+ "additionalProperties": false,
1845
+ "required": [
1846
+ "kind",
1847
+ "property"
1848
+ ],
1849
+ "properties": {
1850
+ "kind": {
1851
+ "type": "string",
1852
+ "enum": [
1853
+ "entry"
1854
+ ]
1855
+ },
1856
+ "property": {
1857
+ "$ref": "#/$defs/EntryValueProperty"
1858
+ }
1859
+ }
1860
+ },
1861
+ {
1862
+ "title": "SiteValueSource",
1863
+ "type": "object",
1864
+ "description": "A property of the site.",
1865
+ "additionalProperties": false,
1866
+ "required": [
1867
+ "kind",
1868
+ "property"
1869
+ ],
1870
+ "properties": {
1871
+ "kind": {
1872
+ "type": "string",
1873
+ "enum": [
1874
+ "site"
1875
+ ]
1876
+ },
1877
+ "property": {
1878
+ "$ref": "#/$defs/SiteValueProperty"
1879
+ }
1880
+ }
1881
+ },
1882
+ {
1883
+ "title": "ConstantValueSource",
1884
+ "type": "object",
1885
+ "description": "A plain-text constant: no control characters, no markup meaning; vocabulary-checked on enum paths (in code).",
1886
+ "additionalProperties": false,
1887
+ "required": [
1888
+ "kind",
1889
+ "value"
1890
+ ],
1891
+ "properties": {
1892
+ "kind": {
1893
+ "type": "string",
1894
+ "enum": [
1895
+ "constant"
1896
+ ]
1897
+ },
1898
+ "value": {
1899
+ "type": "string",
1900
+ "minLength": 1,
1901
+ "maxLength": 200,
1902
+ "pattern": "^[^\\x00-\\x1F\\x7F]+$"
1903
+ }
1904
+ }
1905
+ }
1906
+ ]
1907
+ },
1636
1908
  "SurfaceComponent": {
1637
1909
  "type": "object",
1638
1910
  "description": "One element of a generative UI surface (RFC-0020 §1), in a flat list: `component` names a catalog entry (a PascalCase built-in primitive such as `Stack`, or a registry block type such as `callout`), `children` refer to other ids of the same surface, and `props` follow the entry's schema, which the store checks. Field names follow A2UI v0.9.",
@@ -1913,6 +2185,75 @@ export const PageSchema = {
1913
2185
  ],
1914
2186
  "description": "The markdown dialect a body follows (RFC-0014 §1): 1 = Cloudhal Markdown v1 (CommonMark + GFM + `asset:` + directives; raw HTML escaped). Set by the store on markdown bodies."
1915
2187
  },
2188
+ "FieldCondition": {
2189
+ "type": "object",
2190
+ "description": "RFC-0042: one condition on a typed field of the listed collection. `value` is read by the field's type: a number, YYYY-MM-DD, an RFC 3339 instant, true/false, an option value, or `now`. `values` only with `in`.",
2191
+ "additionalProperties": false,
2192
+ "required": [
2193
+ "field",
2194
+ "op"
2195
+ ],
2196
+ "properties": {
2197
+ "field": {
2198
+ "type": "string",
2199
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
2200
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
2201
+ },
2202
+ "op": {
2203
+ "type": "string",
2204
+ "enum": [
2205
+ "eq",
2206
+ "ne",
2207
+ "lt",
2208
+ "lte",
2209
+ "gt",
2210
+ "gte",
2211
+ "in",
2212
+ "set",
2213
+ "unset"
2214
+ ]
2215
+ },
2216
+ "value": {
2217
+ "type": "string",
2218
+ "minLength": 1,
2219
+ "maxLength": 100
2220
+ },
2221
+ "values": {
2222
+ "type": "array",
2223
+ "minItems": 1,
2224
+ "maxItems": 20,
2225
+ "uniqueItems": true,
2226
+ "items": {
2227
+ "type": "string",
2228
+ "minLength": 1,
2229
+ "maxLength": 100
2230
+ }
2231
+ }
2232
+ }
2233
+ },
2234
+ "FieldOrder": {
2235
+ "type": "object",
2236
+ "description": "RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last.",
2237
+ "additionalProperties": false,
2238
+ "required": [
2239
+ "field",
2240
+ "direction"
2241
+ ],
2242
+ "properties": {
2243
+ "field": {
2244
+ "type": "string",
2245
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
2246
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
2247
+ },
2248
+ "direction": {
2249
+ "type": "string",
2250
+ "enum": [
2251
+ "asc",
2252
+ "desc"
2253
+ ]
2254
+ }
2255
+ }
2256
+ },
1916
2257
  "Id": {
1917
2258
  "type": "string",
1918
2259
  "description": "Prefixed, URL-safe identifier, e.g. site_01HZX8K3Q9. The prefix names the entity kind; agents and the MCP server pass these as opaque handles.",
@@ -2169,6 +2510,18 @@ export const PageSchema = {
2169
2510
  "description": "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'.",
2170
2511
  "minLength": 1,
2171
2512
  "maxLength": 512
2513
+ },
2514
+ "where": {
2515
+ "type": "array",
2516
+ "description": "RFC-0042: conditions on the collection's list fields, ANDed.",
2517
+ "minItems": 1,
2518
+ "maxItems": 4,
2519
+ "items": {
2520
+ "$ref": "#/$defs/FieldCondition"
2521
+ }
2522
+ },
2523
+ "orderBy": {
2524
+ "$ref": "#/$defs/FieldOrder"
2172
2525
  }
2173
2526
  }
2174
2527
  },
@@ -2604,6 +2957,18 @@ export const SectionSchema = {
2604
2957
  "description": "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'.",
2605
2958
  "minLength": 1,
2606
2959
  "maxLength": 512
2960
+ },
2961
+ "where": {
2962
+ "type": "array",
2963
+ "description": "RFC-0042: conditions on the collection's list fields, ANDed.",
2964
+ "minItems": 1,
2965
+ "maxItems": 4,
2966
+ "items": {
2967
+ "$ref": "#/$defs/FieldCondition"
2968
+ }
2969
+ },
2970
+ "orderBy": {
2971
+ "$ref": "#/$defs/FieldOrder"
2607
2972
  }
2608
2973
  }
2609
2974
  },
@@ -2765,6 +3130,75 @@ export const SectionSchema = {
2765
3130
  ],
2766
3131
  "description": "The markdown dialect a body follows (RFC-0014 §1): 1 = Cloudhal Markdown v1 (CommonMark + GFM + `asset:` + directives; raw HTML escaped). Set by the store on markdown bodies."
2767
3132
  },
3133
+ "FieldCondition": {
3134
+ "type": "object",
3135
+ "description": "RFC-0042: one condition on a typed field of the listed collection. `value` is read by the field's type: a number, YYYY-MM-DD, an RFC 3339 instant, true/false, an option value, or `now`. `values` only with `in`.",
3136
+ "additionalProperties": false,
3137
+ "required": [
3138
+ "field",
3139
+ "op"
3140
+ ],
3141
+ "properties": {
3142
+ "field": {
3143
+ "type": "string",
3144
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
3145
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
3146
+ },
3147
+ "op": {
3148
+ "type": "string",
3149
+ "enum": [
3150
+ "eq",
3151
+ "ne",
3152
+ "lt",
3153
+ "lte",
3154
+ "gt",
3155
+ "gte",
3156
+ "in",
3157
+ "set",
3158
+ "unset"
3159
+ ]
3160
+ },
3161
+ "value": {
3162
+ "type": "string",
3163
+ "minLength": 1,
3164
+ "maxLength": 100
3165
+ },
3166
+ "values": {
3167
+ "type": "array",
3168
+ "minItems": 1,
3169
+ "maxItems": 20,
3170
+ "uniqueItems": true,
3171
+ "items": {
3172
+ "type": "string",
3173
+ "minLength": 1,
3174
+ "maxLength": 100
3175
+ }
3176
+ }
3177
+ }
3178
+ },
3179
+ "FieldOrder": {
3180
+ "type": "object",
3181
+ "description": "RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last.",
3182
+ "additionalProperties": false,
3183
+ "required": [
3184
+ "field",
3185
+ "direction"
3186
+ ],
3187
+ "properties": {
3188
+ "field": {
3189
+ "type": "string",
3190
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
3191
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
3192
+ },
3193
+ "direction": {
3194
+ "type": "string",
3195
+ "enum": [
3196
+ "asc",
3197
+ "desc"
3198
+ ]
3199
+ }
3200
+ }
3201
+ },
2768
3202
  "Id": {
2769
3203
  "type": "string",
2770
3204
  "description": "Prefixed, URL-safe identifier, e.g. site_01HZX8K3Q9. The prefix names the entity kind; agents and the MCP server pass these as opaque handles.",
@@ -113,6 +113,193 @@ export interface ContentListSection {
113
113
  * Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'.
114
114
  */
115
115
  filter?: string;
116
+ /**
117
+ * RFC-0042: conditions on the collection's list fields, ANDed.
118
+ *
119
+ * @minItems 1
120
+ * @maxItems 4
121
+ */
122
+ where?: [FieldCondition] | [FieldCondition, FieldCondition] | [FieldCondition, FieldCondition, FieldCondition] | [FieldCondition, FieldCondition, FieldCondition, FieldCondition];
123
+ orderBy?: FieldOrder;
124
+ }
125
+ /**
126
+ * RFC-0042: one condition on a typed field of the listed collection. `value` is read by the field's type: a number, YYYY-MM-DD, an RFC 3339 instant, true/false, an option value, or `now`. `values` only with `in`.
127
+ */
128
+ export interface FieldCondition {
129
+ /**
130
+ * A field key (site.schema.json FieldKey's pattern, repeated).
131
+ */
132
+ field: string;
133
+ op: "eq" | "ne" | "lt" | "lte" | "gt" | "gte" | "in" | "set" | "unset";
134
+ value?: string;
135
+ /**
136
+ * @minItems 1
137
+ * @maxItems 20
138
+ */
139
+ values?: [string] | [string, string] | [string, string, string] | [string, string, string, string] | [string, string, string, string, string] | [string, string, string, string, string, string] | [string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string, string] | [string, string, string, string, string, string, string, string, string, string, string] | [
140
+ string,
141
+ string,
142
+ string,
143
+ string,
144
+ string,
145
+ string,
146
+ string,
147
+ string,
148
+ string,
149
+ string,
150
+ string,
151
+ string
152
+ ] | [
153
+ string,
154
+ string,
155
+ string,
156
+ string,
157
+ string,
158
+ string,
159
+ string,
160
+ string,
161
+ string,
162
+ string,
163
+ string,
164
+ string,
165
+ string
166
+ ] | [
167
+ string,
168
+ string,
169
+ string,
170
+ string,
171
+ string,
172
+ string,
173
+ string,
174
+ string,
175
+ string,
176
+ string,
177
+ string,
178
+ string,
179
+ string,
180
+ string
181
+ ] | [
182
+ string,
183
+ string,
184
+ string,
185
+ string,
186
+ string,
187
+ string,
188
+ string,
189
+ string,
190
+ string,
191
+ string,
192
+ string,
193
+ string,
194
+ string,
195
+ string,
196
+ string
197
+ ] | [
198
+ string,
199
+ string,
200
+ string,
201
+ string,
202
+ string,
203
+ string,
204
+ string,
205
+ string,
206
+ string,
207
+ string,
208
+ string,
209
+ string,
210
+ string,
211
+ string,
212
+ string,
213
+ string
214
+ ] | [
215
+ string,
216
+ string,
217
+ string,
218
+ string,
219
+ string,
220
+ string,
221
+ string,
222
+ string,
223
+ string,
224
+ string,
225
+ string,
226
+ string,
227
+ string,
228
+ string,
229
+ string,
230
+ string,
231
+ string
232
+ ] | [
233
+ string,
234
+ string,
235
+ string,
236
+ string,
237
+ string,
238
+ string,
239
+ string,
240
+ string,
241
+ string,
242
+ string,
243
+ string,
244
+ string,
245
+ string,
246
+ string,
247
+ string,
248
+ string,
249
+ string,
250
+ string
251
+ ] | [
252
+ string,
253
+ string,
254
+ string,
255
+ string,
256
+ string,
257
+ string,
258
+ string,
259
+ string,
260
+ string,
261
+ string,
262
+ string,
263
+ string,
264
+ string,
265
+ string,
266
+ string,
267
+ string,
268
+ string,
269
+ string,
270
+ string
271
+ ] | [
272
+ string,
273
+ string,
274
+ string,
275
+ string,
276
+ string,
277
+ string,
278
+ string,
279
+ string,
280
+ string,
281
+ string,
282
+ string,
283
+ string,
284
+ string,
285
+ string,
286
+ string,
287
+ string,
288
+ string,
289
+ string,
290
+ string,
291
+ string
292
+ ];
293
+ }
294
+ /**
295
+ * RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last.
296
+ */
297
+ export interface FieldOrder {
298
+ /**
299
+ * A field key (site.schema.json FieldKey's pattern, repeated).
300
+ */
301
+ field: string;
302
+ direction: "asc" | "desc";
116
303
  }
117
304
  /**
118
305
  * A typed block from the block registry (RFC-0015): `type` names a registered block type (one global namespace of English names), `props` follow that type's props schema, which the store validates.