@cloudhal/core-contracts 0.5.0 → 0.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudhal/core-contracts",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Cloudhal domain contracts: JSON Schema source of truth plus generated TypeScript types",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://cloudhal.dev",
@@ -177,6 +177,56 @@
177
177
  }
178
178
  }
179
179
  },
180
+ "FieldCondition": {
181
+ "type": "object",
182
+ "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`.",
183
+ "additionalProperties": false,
184
+ "required": ["field", "op"],
185
+ "properties": {
186
+ "field": {
187
+ "type": "string",
188
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
189
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
190
+ },
191
+ "op": {
192
+ "type": "string",
193
+ "enum": ["eq", "ne", "lt", "lte", "gt", "gte", "in", "set", "unset"]
194
+ },
195
+ "value": {
196
+ "type": "string",
197
+ "minLength": 1,
198
+ "maxLength": 100
199
+ },
200
+ "values": {
201
+ "type": "array",
202
+ "minItems": 1,
203
+ "maxItems": 20,
204
+ "uniqueItems": true,
205
+ "items": {
206
+ "type": "string",
207
+ "minLength": 1,
208
+ "maxLength": 100
209
+ }
210
+ }
211
+ }
212
+ },
213
+ "FieldOrder": {
214
+ "type": "object",
215
+ "description": "RFC-0042: order a listing by a number, date or datetime field. Entries without a value sort last.",
216
+ "additionalProperties": false,
217
+ "required": ["field", "direction"],
218
+ "properties": {
219
+ "field": {
220
+ "type": "string",
221
+ "description": "A field key (site.schema.json FieldKey's pattern, repeated).",
222
+ "pattern": "^[a-z][A-Za-z0-9]{0,39}$"
223
+ },
224
+ "direction": {
225
+ "type": "string",
226
+ "enum": ["asc", "desc"]
227
+ }
228
+ }
229
+ },
180
230
  "TimeZone": {
181
231
  "type": "string",
182
232
  "description": "IANA time zone name from the tz database (RFC-0008), e.g. Europe/Istanbul, America/Argentina/Buenos_Aires, Etc/GMT+3 or UTC. Wall-clock times a person enters are kept with their zone, so the instant is recomputed when governments change the rules. The pattern bounds the shape only; writers also check the name against the runtime's Intl zone list.",
@@ -61,7 +61,15 @@
61
61
  "description": "Filter expression over term assignments (RFC-0002), e.g. 'category:news+tag:ai' or 'category:news>*'.",
62
62
  "minLength": 1,
63
63
  "maxLength": 512
64
- }
64
+ },
65
+ "where": {
66
+ "type": "array",
67
+ "description": "RFC-0042: conditions on the collection's list fields, ANDed.",
68
+ "minItems": 1,
69
+ "maxItems": 4,
70
+ "items": { "$ref": "common.schema.json#/$defs/FieldCondition" }
71
+ },
72
+ "orderBy": { "$ref": "common.schema.json#/$defs/FieldOrder" }
65
73
  }
66
74
  },
67
75
  {
@@ -113,9 +113,154 @@
113
113
  "items": {
114
114
  "$ref": "#/$defs/FieldDefinition"
115
115
  }
116
+ },
117
+ "listFields": {
118
+ "type": "array",
119
+ "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).",
120
+ "minItems": 1,
121
+ "maxItems": 4,
122
+ "uniqueItems": true,
123
+ "items": {
124
+ "$ref": "#/$defs/FieldKey"
125
+ }
126
+ },
127
+ "expiry": {
128
+ "$ref": "#/$defs/CollectionExpiry"
129
+ },
130
+ "structuredData": {
131
+ "$ref": "#/$defs/StructuredDataPreset"
132
+ }
133
+ }
134
+ },
135
+ "CollectionExpiry": {
136
+ "type": "object",
137
+ "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.",
138
+ "additionalProperties": false,
139
+ "required": ["field", "action"],
140
+ "properties": {
141
+ "field": {
142
+ "$ref": "#/$defs/FieldKey"
143
+ },
144
+ "action": {
145
+ "type": "string",
146
+ "description": "unlist: the page stays, the entry leaves listings, feeds, the sitemap and search. hide: every public route answers 404.",
147
+ "enum": ["unlist", "hide"]
148
+ },
149
+ "afterMinutes": {
150
+ "type": "integer",
151
+ "description": "Grace after the field's instant. Absent: 0.",
152
+ "minimum": 0,
153
+ "maximum": 10080
116
154
  }
117
155
  }
118
156
  },
157
+ "StructuredDataPreset": {
158
+ "type": "object",
159
+ "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).",
160
+ "additionalProperties": false,
161
+ "required": ["type", "properties"],
162
+ "properties": {
163
+ "type": {
164
+ "type": "string",
165
+ "enum": ["Event", "JobPosting", "Product", "Recipe"]
166
+ },
167
+ "properties": {
168
+ "type": "object",
169
+ "description": "Keyed by property path, e.g. startDate or location.address.addressLocality.",
170
+ "propertyNames": {
171
+ "type": "string",
172
+ "pattern": "^[a-z][A-Za-z]{0,39}(\\.[a-z][A-Za-z]{0,39}){0,2}$"
173
+ },
174
+ "minProperties": 1,
175
+ "maxProperties": 40,
176
+ "additionalProperties": {
177
+ "$ref": "#/$defs/StructuredDataSource"
178
+ }
179
+ }
180
+ }
181
+ },
182
+ "StructuredDataSource": {
183
+ "description": "RFC-0042: where one JSON-LD property's value comes from, discriminated by `kind`.",
184
+ "oneOf": [
185
+ {
186
+ "title": "FieldValueSource",
187
+ "type": "object",
188
+ "description": "A typed field of this collection, converted by its type.",
189
+ "additionalProperties": false,
190
+ "required": ["kind", "field"],
191
+ "properties": {
192
+ "kind": {
193
+ "type": "string",
194
+ "enum": ["field"]
195
+ },
196
+ "field": {
197
+ "$ref": "#/$defs/FieldKey"
198
+ }
199
+ }
200
+ },
201
+ {
202
+ "title": "EntryValueSource",
203
+ "type": "object",
204
+ "description": "A built-in property of the entry.",
205
+ "additionalProperties": false,
206
+ "required": ["kind", "property"],
207
+ "properties": {
208
+ "kind": {
209
+ "type": "string",
210
+ "enum": ["entry"]
211
+ },
212
+ "property": {
213
+ "$ref": "#/$defs/EntryValueProperty"
214
+ }
215
+ }
216
+ },
217
+ {
218
+ "title": "SiteValueSource",
219
+ "type": "object",
220
+ "description": "A property of the site.",
221
+ "additionalProperties": false,
222
+ "required": ["kind", "property"],
223
+ "properties": {
224
+ "kind": {
225
+ "type": "string",
226
+ "enum": ["site"]
227
+ },
228
+ "property": {
229
+ "$ref": "#/$defs/SiteValueProperty"
230
+ }
231
+ }
232
+ },
233
+ {
234
+ "title": "ConstantValueSource",
235
+ "type": "object",
236
+ "description": "A plain-text constant: no control characters, no markup meaning; vocabulary-checked on enum paths (in code).",
237
+ "additionalProperties": false,
238
+ "required": ["kind", "value"],
239
+ "properties": {
240
+ "kind": {
241
+ "type": "string",
242
+ "enum": ["constant"]
243
+ },
244
+ "value": {
245
+ "type": "string",
246
+ "minLength": 1,
247
+ "maxLength": 200,
248
+ "pattern": "^[^\\x00-\\x1F\\x7F]+$"
249
+ }
250
+ }
251
+ }
252
+ ]
253
+ },
254
+ "EntryValueProperty": {
255
+ "type": "string",
256
+ "description": "RFC-0042: entry properties a structured-data property may read.",
257
+ "enum": ["title", "summary", "body", "coverImage", "url", "publishedAt", "updatedAt"]
258
+ },
259
+ "SiteValueProperty": {
260
+ "type": "string",
261
+ "description": "RFC-0042: site properties a structured-data property may read.",
262
+ "enum": ["name", "url", "logo"]
263
+ },
119
264
  "CollectionLabel": {
120
265
  "type": "object",
121
266
  "additionalProperties": false,