@abeedoo/radish-schemas 1.7.7 → 1.9.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 +1 -1
- package/package.json +1 -1
- package/prompts/radish-types-generation.md +28 -2
- package/schemas/types.schema.json +46 -2
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.
|
|
34
|
+
packageVersion: '1.9.0',
|
|
35
35
|
currentSpecVersion: 1,
|
|
36
36
|
supportedSpecVersions: [1],
|
|
37
37
|
minCliVersion: '0.1.0'
|
package/package.json
CHANGED
|
@@ -163,7 +163,12 @@ The following entities are already provided by the system. DO NOT recreate them
|
|
|
163
163
|
"engine": "typesense",
|
|
164
164
|
"indexName": "products",
|
|
165
165
|
"fields": {
|
|
166
|
-
"searchable": [
|
|
166
|
+
"searchable": [
|
|
167
|
+
{ "field": "name", "stem": true },
|
|
168
|
+
{ "field": "description", "stem": true },
|
|
169
|
+
"sku",
|
|
170
|
+
"brand"
|
|
171
|
+
],
|
|
167
172
|
"filterable": ["brand", "price", "categories"],
|
|
168
173
|
"sortable": ["price", "name", "createdAt"],
|
|
169
174
|
"facetable": ["brand", "categories"]
|
|
@@ -182,8 +187,29 @@ The following entities are already provided by the system. DO NOT recreate them
|
|
|
182
187
|
- **indexName**: Custom index name (defaults to entity plural)
|
|
183
188
|
- **sync**: `inline` (immediate) or `background` (via jobs)
|
|
184
189
|
- **vector**: Enable vector/embedding search with `sourceFields` to generate embeddings from
|
|
190
|
+
- **searchable**: Each entry is either a plain field name or `{ "field": "name", "stem": true }`. Stemming reduces terms to their word stems at index time (`computers` → `computer`), so a plural query matches singular text as an exact match rather than relying on typo correction. Set `stem: true` only on prose fields (name, description, summary, body). Never stem identifiers (`sku`, `slug`, `code`), brand or category values, anything listed under `filterable`/`facetable`, or non-string fields — stemming a facet value breaks the filter that reads it.
|
|
185
191
|
|
|
186
|
-
13. **
|
|
192
|
+
13. **Expiration / TTL** (optional): For entities whose records should be purged automatically (sessions, tokens, logs, temporary uploads), use the entity-level `ttl` shorthand:
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"Session": {
|
|
196
|
+
"plural": "sessions",
|
|
197
|
+
"ttl": { "field": "createdAt", "days": 90 },
|
|
198
|
+
"fields": { ... }
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
- **field**: date field the expiration is measured from
|
|
203
|
+
- **days**: whole days (minimum 1) after that field's value before a record expires
|
|
204
|
+
|
|
205
|
+
For precise control, set `expireAfterSeconds` on an index instead. Use `0` when the field already holds the exact expiration timestamp:
|
|
206
|
+
```json
|
|
207
|
+
"indexes": [
|
|
208
|
+
{ "fields": ["expiresAt"], "expireAfterSeconds": 0 }
|
|
209
|
+
]
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
14. **Automatic Fields** (DO NOT add these manually):
|
|
187
213
|
- When `"defaults": { "timestamps": true }` is set, `createdAt` and `updatedAt` are added automatically
|
|
188
214
|
- When `"defaults": { "owned": true }` is set, `ownerId` is added automatically
|
|
189
215
|
- Adding these fields manually causes duplication
|
|
@@ -114,8 +114,27 @@
|
|
|
114
114
|
"properties": {
|
|
115
115
|
"searchable": {
|
|
116
116
|
"type": "array",
|
|
117
|
-
"items": {
|
|
118
|
-
|
|
117
|
+
"items": {
|
|
118
|
+
"oneOf": [
|
|
119
|
+
{ "type": "string" },
|
|
120
|
+
{
|
|
121
|
+
"type": "object",
|
|
122
|
+
"required": ["field"],
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"properties": {
|
|
125
|
+
"field": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"description": "Field name"
|
|
128
|
+
},
|
|
129
|
+
"stem": {
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"description": "Reduce terms to their word stems at index time so plural queries match singular text. Prose fields only — never identifiers, facets, or non-string fields, since stemming a facet value breaks the filter that reads it."
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"description": "Fields included in full-text search queries. Either a field name, or an object with per-field options such as stemming."
|
|
119
138
|
},
|
|
120
139
|
"filterable": {
|
|
121
140
|
"type": "array",
|
|
@@ -208,6 +227,26 @@
|
|
|
208
227
|
}
|
|
209
228
|
}
|
|
210
229
|
},
|
|
230
|
+
"ttl": {
|
|
231
|
+
"type": "object",
|
|
232
|
+
"description": "Automatic document expiration. Generates a MongoDB TTL index on the given date field.",
|
|
233
|
+
"required": [
|
|
234
|
+
"field",
|
|
235
|
+
"days"
|
|
236
|
+
],
|
|
237
|
+
"additionalProperties": false,
|
|
238
|
+
"properties": {
|
|
239
|
+
"field": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"description": "Date field documents expire relative to (e.g., 'createdAt')"
|
|
242
|
+
},
|
|
243
|
+
"days": {
|
|
244
|
+
"type": "integer",
|
|
245
|
+
"minimum": 1,
|
|
246
|
+
"description": "Number of days after the field value before a document expires"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
211
250
|
"fields": {
|
|
212
251
|
"type": "object",
|
|
213
252
|
"minProperties": 1,
|
|
@@ -530,6 +569,11 @@
|
|
|
530
569
|
},
|
|
531
570
|
"name": {
|
|
532
571
|
"type": "string"
|
|
572
|
+
},
|
|
573
|
+
"expireAfterSeconds": {
|
|
574
|
+
"type": "integer",
|
|
575
|
+
"minimum": 0,
|
|
576
|
+
"description": "TTL index: seconds after the indexed date field before a document expires"
|
|
533
577
|
}
|
|
534
578
|
}
|
|
535
579
|
}
|