@abeedoo/radish-schemas 1.7.7 → 1.8.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/index.js CHANGED
@@ -31,7 +31,7 @@ export {
31
31
  * @property {string} minCliVersion - Minimum radish-cli version compatible with this package
32
32
  */
33
33
  export const VERSIONING = {
34
- packageVersion: '1.7.7',
34
+ packageVersion: '1.8.0',
35
35
  currentSpecVersion: 1,
36
36
  supportedSpecVersions: [1],
37
37
  minCliVersion: '0.1.0'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abeedoo/radish-schemas",
3
- "version": "1.7.7",
3
+ "version": "1.8.0",
4
4
  "description": "Shared JSON schemas, validators, and prompts for Radish CLI ecosystem",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -183,7 +183,27 @@ The following entities are already provided by the system. DO NOT recreate them
183
183
  - **sync**: `inline` (immediate) or `background` (via jobs)
184
184
  - **vector**: Enable vector/embedding search with `sourceFields` to generate embeddings from
185
185
 
186
- 13. **Automatic Fields** (DO NOT add these manually):
186
+ 13. **Expiration / TTL** (optional): For entities whose records should be purged automatically (sessions, tokens, logs, temporary uploads), use the entity-level `ttl` shorthand:
187
+ ```json
188
+ {
189
+ "Session": {
190
+ "plural": "sessions",
191
+ "ttl": { "field": "createdAt", "days": 90 },
192
+ "fields": { ... }
193
+ }
194
+ }
195
+ ```
196
+ - **field**: date field the expiration is measured from
197
+ - **days**: whole days (minimum 1) after that field's value before a record expires
198
+
199
+ For precise control, set `expireAfterSeconds` on an index instead. Use `0` when the field already holds the exact expiration timestamp:
200
+ ```json
201
+ "indexes": [
202
+ { "fields": ["expiresAt"], "expireAfterSeconds": 0 }
203
+ ]
204
+ ```
205
+
206
+ 14. **Automatic Fields** (DO NOT add these manually):
187
207
  - When `"defaults": { "timestamps": true }` is set, `createdAt` and `updatedAt` are added automatically
188
208
  - When `"defaults": { "owned": true }` is set, `ownerId` is added automatically
189
209
  - Adding these fields manually causes duplication
@@ -208,6 +208,26 @@
208
208
  }
209
209
  }
210
210
  },
211
+ "ttl": {
212
+ "type": "object",
213
+ "description": "Automatic document expiration. Generates a MongoDB TTL index on the given date field.",
214
+ "required": [
215
+ "field",
216
+ "days"
217
+ ],
218
+ "additionalProperties": false,
219
+ "properties": {
220
+ "field": {
221
+ "type": "string",
222
+ "description": "Date field documents expire relative to (e.g., 'createdAt')"
223
+ },
224
+ "days": {
225
+ "type": "integer",
226
+ "minimum": 1,
227
+ "description": "Number of days after the field value before a document expires"
228
+ }
229
+ }
230
+ },
211
231
  "fields": {
212
232
  "type": "object",
213
233
  "minProperties": 1,
@@ -530,6 +550,11 @@
530
550
  },
531
551
  "name": {
532
552
  "type": "string"
553
+ },
554
+ "expireAfterSeconds": {
555
+ "type": "integer",
556
+ "minimum": 0,
557
+ "description": "TTL index: seconds after the indexed date field before a document expires"
533
558
  }
534
559
  }
535
560
  }