@relyio/sdk 0.6.0 → 0.7.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/CHANGELOG.md +370 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-DY2XT7OF.cjs → chunk-72UK5U7T.cjs} +70 -60
- package/dist/{chunk-7ABNXVWL.js → chunk-GYHAVYND.js} +777 -399
- package/dist/{chunk-I3ESNANB.js → chunk-H6IBQSMM.js} +2 -2
- package/dist/{chunk-HT6NFRM2.cjs → chunk-TZL374LS.cjs} +2 -2
- package/dist/{chunk-GCMQUM6N.cjs → chunk-VH2DE7HZ.cjs} +776 -402
- package/dist/{chunk-XJVY2CLY.js → chunk-YEJUMW4X.js} +70 -60
- package/dist/client/index.cjs +4 -3
- package/dist/client/index.d.cts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +2 -1
- package/dist/{index-d1Kz1e19.d.cts → define-content-type-DiVpbwNs.d.cts} +1615 -684
- package/dist/{index-yPbhZc6q.d.ts → define-content-type-DiVpbwNs.d.ts} +1615 -684
- package/dist/{define-schema-1kr2HIzN.d.cts → define-schema-C-5an28C.d.ts} +189 -85
- package/dist/{define-schema-ChvAzY8H.d.ts → define-schema-D7MButVt.d.cts} +189 -85
- package/dist/{index-XqoGUaAY.d.ts → index-1G97sNA8.d.ts} +489 -267
- package/dist/index-BOQIHnsh.d.ts +818 -0
- package/dist/index-DbsTUw3Q.d.cts +818 -0
- package/dist/{index-Df1VsfJR.d.cts → index-M0X45k7J.d.cts} +489 -267
- package/dist/index.cjs +98 -114
- package/dist/index.d.cts +31 -31
- package/dist/index.d.ts +31 -31
- package/dist/index.js +8 -8
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +13 -11
- package/dist/schema/index.d.ts +13 -11
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.cjs +19 -19
- package/dist/utils/index.d.cts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +1 -1
- package/package.json +4 -3
- package/dist/define-content-type-CDB3kyeA.d.cts +0 -1173
- package/dist/define-content-type-CDB3kyeA.d.ts +0 -1173
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AnyFieldDefinition, c as FieldDefinition, k as AIConfig,
|
|
1
|
+
import { A as AnyFieldDefinition, c as FieldDefinition, k as AIConfig, v as FieldSchemaContext, x as FieldValues, y as DeclaredFields, aK as components, P as ContentTypeDefinition, a0 as SingletonContentTypeDefinition, aH as WorkflowDefinition, a9 as AssetTypeDefinition, W as InferContentType } from './define-content-type-DiVpbwNs.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Component definition matching @relyio/schema ComponentSchema
|
|
@@ -54,7 +54,7 @@ interface ComponentDefinition<TFields extends readonly AnyFieldDefinition[] = Fi
|
|
|
54
54
|
readonly description?: string;
|
|
55
55
|
/** AI configuration for content generation and review */
|
|
56
56
|
readonly ai?: AIConfig;
|
|
57
|
-
readonly deprecated
|
|
57
|
+
readonly deprecated?: boolean;
|
|
58
58
|
readonly fields: TFields;
|
|
59
59
|
readonly metadata?: ComponentMetadata;
|
|
60
60
|
}
|
|
@@ -74,7 +74,9 @@ interface ComponentDefinition<TFields extends readonly AnyFieldDefinition[] = Fi
|
|
|
74
74
|
* config: { maxLength: 160 },
|
|
75
75
|
* ui: { displayName: 'Meta Description' }
|
|
76
76
|
* }),
|
|
77
|
-
*
|
|
77
|
+
* // An image is an entry of an asset type, which a reference points at
|
|
78
|
+
* fields.reference('ogImage', {
|
|
79
|
+
* config: { to: 'productPhoto' },
|
|
78
80
|
* ui: { displayName: 'Open Graph Image' }
|
|
79
81
|
* }),
|
|
80
82
|
* ]
|
|
@@ -160,20 +162,15 @@ declare function defineSettingsGroup<TFields extends readonly AnyFieldDefinition
|
|
|
160
162
|
*/
|
|
161
163
|
type AnySettingsGroupDefinition = SettingsGroupDefinition<any>;
|
|
162
164
|
/**
|
|
163
|
-
*
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/** Creation timestamp */
|
|
173
|
-
createdAt: Date;
|
|
174
|
-
/** Last update timestamp */
|
|
175
|
-
updatedAt: Date;
|
|
176
|
-
}
|
|
165
|
+
* What a read reports about a settings group beside its fields: the committed document's
|
|
166
|
+
* `SettingsGroupMetadata`, read through `http/api-schema.ts` rather than declared again here.
|
|
167
|
+
*
|
|
168
|
+
* It names the group by `id` and `groupId`, carries the per-locale facts and the version history
|
|
169
|
+
* of `locale`, and says when the group was last written — there is no `createdAt`. The hand-written
|
|
170
|
+
* type this replaces declared a `key`, a `groupType` and a `createdAt` the wire does not carry, and
|
|
171
|
+
* `Date` timestamps where it sends ISO 8601 strings.
|
|
172
|
+
*/
|
|
173
|
+
type SettingsGroupMetadata = components['schemas']['SettingsGroupMetadata'];
|
|
177
174
|
/**
|
|
178
175
|
* Infer the TypeScript type from a settings group definition: every field typed as a read returns it
|
|
179
176
|
* (`schema/infer-fields.ts`), plus `_metadata`. `S` is the schema, as for `InferContentType`.
|
|
@@ -189,19 +186,68 @@ type InferSettingsGroup<T extends AnySettingsGroupDefinition, S extends FieldSch
|
|
|
189
186
|
*
|
|
190
187
|
* This is a hand-written mirror: `@relyio/sdk` is published standalone and does not depend on
|
|
191
188
|
* `@relyio/schema`, so a field added there has to be added here too. When the two drifted, `limit`
|
|
192
|
-
* was the casualty — the documentation writes `limit: '${limit?20}'` and this file said `number
|
|
189
|
+
* was the casualty — the documentation writes `limit: '${limit?20}'` and this file said `number` —
|
|
190
|
+
* and so were `fullText` and `type`, which a query pulled by `relyio generate-types` carried and
|
|
191
|
+
* this refused. `@relyio/codegen-typescript`'s `src/__tests__/sdk-definition-config.types.ts` now
|
|
192
|
+
* fails to compile when a key, whether it is required, or the values it accepts differs from the
|
|
193
|
+
* schema's, block by block (REL-1457).
|
|
194
|
+
*/
|
|
195
|
+
/** One value a query clause compares with. */
|
|
196
|
+
type QueryScalar = string | number | boolean;
|
|
197
|
+
/**
|
|
198
|
+
* The operators `where` and `filters` compare a field with — `{ price: { gte: 10 } }`.
|
|
199
|
+
*
|
|
200
|
+
* The service's one vocabulary for `where`, `filters` and `having`, which deploy refuses any other
|
|
201
|
+
* key against (REL-1479). There were four copies, and this one's `where` had no `eq` while `filters`
|
|
202
|
+
* took six operators, each a `${…}` string. A value may be a parameter expression: a list operator
|
|
203
|
+
* takes a list or a parameter that supplies one, a flag a boolean or a parameter.
|
|
204
|
+
* `@relyio/codegen-typescript`'s `sdk-definition-config.types.ts` fails to compile when an operator,
|
|
205
|
+
* or what it takes, differs from the schema's.
|
|
193
206
|
*/
|
|
194
207
|
type WhereOperator = {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
/** Equal to */
|
|
209
|
+
eq?: QueryScalar;
|
|
210
|
+
/** Not equal to */
|
|
211
|
+
ne?: QueryScalar;
|
|
212
|
+
/** Greater than */
|
|
213
|
+
gt?: QueryScalar;
|
|
214
|
+
/** Greater than or equal to */
|
|
215
|
+
gte?: QueryScalar;
|
|
216
|
+
/** Less than */
|
|
217
|
+
lt?: QueryScalar;
|
|
218
|
+
/** Less than or equal to */
|
|
219
|
+
lte?: QueryScalar;
|
|
220
|
+
/** One of the values given */
|
|
221
|
+
in?: QueryScalar[] | string;
|
|
222
|
+
/** None of the values given */
|
|
223
|
+
nin?: QueryScalar[] | string;
|
|
224
|
+
/** Contains the text, ignoring case */
|
|
225
|
+
contains?: QueryScalar;
|
|
226
|
+
/** Starts with the text, ignoring case */
|
|
227
|
+
startsWith?: QueryScalar;
|
|
228
|
+
/** Ends with the text, ignoring case */
|
|
229
|
+
endsWith?: QueryScalar;
|
|
230
|
+
/** The field holds a value (true) or does not (false) */
|
|
231
|
+
exists?: boolean | string;
|
|
232
|
+
/** The field holds no value (true) or does (false) */
|
|
233
|
+
notExists?: boolean | string;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* The operators `having` compares a metric with: the same as `where`'s, each with a literal, since
|
|
237
|
+
* `having` reads the values the aggregate computed and substitutes no parameter.
|
|
238
|
+
*/
|
|
239
|
+
type HavingOperator = {
|
|
240
|
+
eq?: QueryScalar;
|
|
241
|
+
ne?: QueryScalar;
|
|
242
|
+
gt?: QueryScalar;
|
|
243
|
+
gte?: QueryScalar;
|
|
244
|
+
lt?: QueryScalar;
|
|
245
|
+
lte?: QueryScalar;
|
|
246
|
+
in?: QueryScalar[];
|
|
247
|
+
nin?: QueryScalar[];
|
|
248
|
+
contains?: QueryScalar;
|
|
249
|
+
startsWith?: QueryScalar;
|
|
250
|
+
endsWith?: QueryScalar;
|
|
205
251
|
exists?: boolean;
|
|
206
252
|
notExists?: boolean;
|
|
207
253
|
};
|
|
@@ -209,28 +255,40 @@ type WhereValue = string | number | boolean | (string | number | boolean)[] | Wh
|
|
|
209
255
|
type WhereCondition = Record<string, WhereValue>;
|
|
210
256
|
type SortDirection = 'asc' | 'desc';
|
|
211
257
|
type SortCondition = Record<string, SortDirection> | Record<string, SortDirection>[];
|
|
258
|
+
/** `products(status=active).count as productCount`: a relationship, filtered and counted. */
|
|
212
259
|
type IncludeRelationship = {
|
|
213
260
|
relationship: string;
|
|
214
261
|
where?: WhereCondition;
|
|
215
|
-
|
|
262
|
+
/**
|
|
263
|
+
* What the include answers instead of the entries it joins. `count` is the one modifier: `sum`,
|
|
264
|
+
* `avg`, `min` and `max` name no field to reduce — select one, like `products.price.sum` — and
|
|
265
|
+
* the service refuses them (REL-1479).
|
|
266
|
+
*/
|
|
267
|
+
aggregate?: 'count';
|
|
268
|
+
/** The name the include answers under; the relationship's name when absent */
|
|
216
269
|
alias?: string;
|
|
217
270
|
};
|
|
218
|
-
|
|
271
|
+
/**
|
|
272
|
+
* A path, the fields to return from it, the references to expand beneath it and which entries to
|
|
273
|
+
* join — `{ path: 'items.product', fields: ['title'], include: ['brand'] }`. The one object form of a
|
|
274
|
+
* path: `IncludePath`, `{ path, include: string[], where }`, described a subset of this one and is
|
|
275
|
+
* gone. One level beneath, as the schema declares it: a deeper `include` inside a nested path is
|
|
276
|
+
* refused at deploy.
|
|
277
|
+
*/
|
|
278
|
+
type IncludeSelection = {
|
|
219
279
|
path: string;
|
|
220
280
|
fields?: string[];
|
|
221
|
-
include?: (string |
|
|
281
|
+
include?: (string | {
|
|
282
|
+
path: string;
|
|
283
|
+
fields?: string[];
|
|
284
|
+
where?: WhereCondition;
|
|
285
|
+
})[];
|
|
222
286
|
where?: WhereCondition;
|
|
223
287
|
};
|
|
224
|
-
type IncludeDefinition = string | string[] | (string | IncludeRelationship |
|
|
288
|
+
type IncludeDefinition = string | string[] | (string | IncludeRelationship | IncludeSelection)[];
|
|
225
289
|
type SelectMapping = Record<string, string>;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
lte?: string;
|
|
229
|
-
gt?: string;
|
|
230
|
-
lt?: string;
|
|
231
|
-
in?: string;
|
|
232
|
-
nin?: string;
|
|
233
|
-
};
|
|
290
|
+
/** `filters` are `where` conditions bound at call time: the same operators, written the same way. */
|
|
291
|
+
type FilterOperator = WhereOperator;
|
|
234
292
|
type FilterDefinition = Record<string, string | FilterOperator>;
|
|
235
293
|
/** A value that is either a literal or a `${param}` / `${param?default}` expression. */
|
|
236
294
|
type Parameterizable<T> = T | string;
|
|
@@ -262,12 +320,22 @@ interface QueryParameter {
|
|
|
262
320
|
/** Whether the query answers with one record or a list. Independent of how many rows match. */
|
|
263
321
|
type QueryCardinality = 'one' | 'many';
|
|
264
322
|
type CachePolicyObject = {
|
|
265
|
-
|
|
323
|
+
/** Defaults to `public` */
|
|
324
|
+
policy?: 'public' | 'private' | 'no-cache';
|
|
266
325
|
ttl?: number;
|
|
267
326
|
staleWhileRevalidate?: number;
|
|
268
327
|
tags?: string[];
|
|
269
328
|
};
|
|
270
329
|
type CachePolicy = string | CachePolicyObject;
|
|
330
|
+
/** A text search over `fields` the query runs beside its operation block. */
|
|
331
|
+
type FullTextSearch = {
|
|
332
|
+
/** The fields searched; at least one */
|
|
333
|
+
fields: string[];
|
|
334
|
+
/** The search text, usually a parameter expression such as `${q}` */
|
|
335
|
+
query: string;
|
|
336
|
+
highlight?: boolean;
|
|
337
|
+
ranking?: 'simple' | 'complex';
|
|
338
|
+
};
|
|
271
339
|
/**
|
|
272
340
|
* Fetch block - retrieve content entries
|
|
273
341
|
*/
|
|
@@ -300,12 +368,15 @@ interface AggregateBlock {
|
|
|
300
368
|
expression: string;
|
|
301
369
|
as?: string;
|
|
302
370
|
})[];
|
|
303
|
-
/**
|
|
304
|
-
|
|
305
|
-
|
|
371
|
+
/**
|
|
372
|
+
* What to compute per group, keyed by the name each answers under: `<field>.<fn>`, where `fn` is
|
|
373
|
+
* `count`, `sum`, `avg`, `min`, `max`, `first` or `last` — `{ total: 'amount.sum' }`. Deploy
|
|
374
|
+
* requires it. The one spelling: `aggregations`, which this type called the main one, was a
|
|
375
|
+
* second name deploy refused (REL-1470).
|
|
376
|
+
*/
|
|
306
377
|
metrics?: Record<string, string>;
|
|
307
378
|
/** Having clause for filtering aggregations */
|
|
308
|
-
having?: Record<string,
|
|
379
|
+
having?: Record<string, QueryScalar | HavingOperator>;
|
|
309
380
|
/** Sort order */
|
|
310
381
|
sort?: SortCondition;
|
|
311
382
|
/** Maximum results */
|
|
@@ -347,23 +418,6 @@ interface SearchBlock {
|
|
|
347
418
|
/** Results offset */
|
|
348
419
|
offset?: Parameterizable<number>;
|
|
349
420
|
}
|
|
350
|
-
/**
|
|
351
|
-
* Similar block - find similar content via vector search
|
|
352
|
-
*/
|
|
353
|
-
interface SimilarBlock {
|
|
354
|
-
/** Single content type */
|
|
355
|
-
contentType?: string;
|
|
356
|
-
/** Multiple content types or "*" for all */
|
|
357
|
-
contentTypes?: string | string[] | '*';
|
|
358
|
-
/** Source entry UID to find similar content for */
|
|
359
|
-
source: string;
|
|
360
|
-
/** Filter conditions */
|
|
361
|
-
where?: WhereCondition;
|
|
362
|
-
/** Field mapping for results */
|
|
363
|
-
fields?: SelectMapping;
|
|
364
|
-
/** Maximum results */
|
|
365
|
-
limit?: Parameterizable<number>;
|
|
366
|
-
}
|
|
367
421
|
/**
|
|
368
422
|
* Include sub-queries for additional data
|
|
369
423
|
*/
|
|
@@ -375,10 +429,19 @@ interface IncludeSubQuery {
|
|
|
375
429
|
select?: SelectMapping;
|
|
376
430
|
}
|
|
377
431
|
type IncludeSubQueries = Record<string, IncludeSubQuery>;
|
|
432
|
+
/**
|
|
433
|
+
* Which operation block a query runs. Inferred from the block it declares when absent.
|
|
434
|
+
*
|
|
435
|
+
* `similar` is not one: deploy refused a query built on it alone and nothing ran it. Similar
|
|
436
|
+
* content is `relyio.similar(uid)` (REL-1470).
|
|
437
|
+
*/
|
|
438
|
+
type QueryType = 'fetch' | 'aggregate' | 'search';
|
|
378
439
|
/**
|
|
379
440
|
* Query definition configuration
|
|
380
441
|
*/
|
|
381
442
|
interface QueryConfig {
|
|
443
|
+
/** Which operation block the query runs; inferred when absent */
|
|
444
|
+
type?: QueryType;
|
|
382
445
|
/** API endpoint path (required, e.g., /api/featured-products) */
|
|
383
446
|
endpoint: string;
|
|
384
447
|
/** Query description */
|
|
@@ -389,12 +452,12 @@ interface QueryConfig {
|
|
|
389
452
|
aggregate?: AggregateBlock;
|
|
390
453
|
/** Search block for full-text/semantic search */
|
|
391
454
|
search?: SearchBlock;
|
|
392
|
-
/** Similar block for vector similarity search */
|
|
393
|
-
similar?: SimilarBlock;
|
|
394
455
|
/** Include sub-queries */
|
|
395
456
|
include?: IncludeSubQueries;
|
|
396
457
|
/** Dynamic filter definitions */
|
|
397
458
|
filters?: FilterDefinition;
|
|
459
|
+
/** Full-text search over the fields it names */
|
|
460
|
+
fullText?: FullTextSearch;
|
|
398
461
|
/** Field selection/mapping */
|
|
399
462
|
select?: SelectMapping;
|
|
400
463
|
/** Cache policy */
|
|
@@ -410,14 +473,15 @@ interface QueryConfig {
|
|
|
410
473
|
interface QueryDefinition {
|
|
411
474
|
readonly _tag: 'query';
|
|
412
475
|
readonly name: string;
|
|
476
|
+
readonly type?: QueryType;
|
|
413
477
|
readonly endpoint: string;
|
|
414
478
|
readonly description?: string;
|
|
415
479
|
readonly fetch?: FetchBlock;
|
|
416
480
|
readonly aggregate?: AggregateBlock;
|
|
417
481
|
readonly search?: SearchBlock;
|
|
418
|
-
readonly similar?: SimilarBlock;
|
|
419
482
|
readonly include?: IncludeSubQueries;
|
|
420
483
|
readonly filters?: FilterDefinition;
|
|
484
|
+
readonly fullText?: FullTextSearch;
|
|
421
485
|
readonly select?: SelectMapping;
|
|
422
486
|
readonly cache?: CachePolicy;
|
|
423
487
|
readonly parameters?: QueryParameter[];
|
|
@@ -473,7 +537,7 @@ interface QueryDefinition {
|
|
|
473
537
|
* source: 'product',
|
|
474
538
|
* where: { status: 'active' },
|
|
475
539
|
* by: ['category'],
|
|
476
|
-
*
|
|
540
|
+
* metrics: {
|
|
477
541
|
* totalProducts: 'id.count',
|
|
478
542
|
* avgPrice: 'price.base.avg',
|
|
479
543
|
* minPrice: 'price.base.min',
|
|
@@ -837,16 +901,28 @@ interface AllScopeConfig {
|
|
|
837
901
|
*/
|
|
838
902
|
type ViewScopeConfig = ContentTypeScopeConfig | ContentTypesScopeConfig | EntryTypeScopeConfig | AllScopeConfig;
|
|
839
903
|
/**
|
|
840
|
-
*
|
|
904
|
+
* The operators a view filter may name: the schema's `FILTER_OPERATORS`, which deploy parses a view
|
|
905
|
+
* with and the read core compiles every one of.
|
|
841
906
|
*
|
|
842
|
-
*
|
|
843
|
-
* `
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
|
|
849
|
-
|
|
907
|
+
* This list used to be its own: ten of its names — `doesNotContain`, `isNotEmpty`, `isOnOrBefore`,
|
|
908
|
+
* `isOnOrAfter`, `tomorrow`, `lastWeek`, `lastMonth`, `includesAll`, `includesAny`, `excludes` —
|
|
909
|
+
* are none the schema declares, so a view naming one was refused at deploy, and six the schema does
|
|
910
|
+
* declare — `notContains`, `notIncludes`, `isOn`, `isBetween`, `thisYear`, `hasValue` — could not be
|
|
911
|
+
* written here, so a view pulled by `relyio generate-types` that named one did not compile.
|
|
912
|
+
* `@relyio/codegen-typescript`'s `src/__tests__/sdk-definition-config.types.ts` holds the two to each
|
|
913
|
+
* other (REL-1457).
|
|
914
|
+
*/
|
|
915
|
+
type ViewFilterOperator = 'is' | 'isNot' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'isAnyOf' | 'isNoneOf' | 'includes' | 'notIncludes' | 'isTrue' | 'isFalse' | 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'between' | 'isOn' | 'isBefore' | 'isAfter' | 'isBetween' | 'inTheLast' | 'inTheNext' | 'today' | 'yesterday' | 'thisWeek' | 'thisMonth' | 'thisYear' | 'isEmpty' | 'hasValue';
|
|
916
|
+
/** A span of time back or forward from now, for `inTheLast` and `inTheNext`. */
|
|
917
|
+
interface ViewFilterRelativeDate {
|
|
918
|
+
amount: number;
|
|
919
|
+
unit: 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'years';
|
|
920
|
+
}
|
|
921
|
+
/** What a filter compares against: the schema's `FilterValueSchema`. */
|
|
922
|
+
type ViewFilterValue = string | number | boolean | null | (string | number)[] | {
|
|
923
|
+
from: string | number | Date;
|
|
924
|
+
to: string | number | Date;
|
|
925
|
+
} | ViewFilterRelativeDate | Date;
|
|
850
926
|
/**
|
|
851
927
|
* Simple filter condition
|
|
852
928
|
*/
|
|
@@ -862,7 +938,7 @@ interface ViewFilterCondition {
|
|
|
862
938
|
/**
|
|
863
939
|
* Filter value (optional for some operators like isEmpty)
|
|
864
940
|
*/
|
|
865
|
-
value?:
|
|
941
|
+
value?: ViewFilterValue;
|
|
866
942
|
}
|
|
867
943
|
/**
|
|
868
944
|
* Grouped filter conditions with AND/OR logic
|
|
@@ -890,8 +966,8 @@ interface ViewConfig {
|
|
|
890
966
|
*/
|
|
891
967
|
name: string;
|
|
892
968
|
/**
|
|
893
|
-
* URL-friendly slug for the view
|
|
894
|
-
*
|
|
969
|
+
* URL-friendly slug for the view, used in Studio URLs like /studio/views/:slug. Absent, the
|
|
970
|
+
* platform derives one from the id when it reads the schema.
|
|
895
971
|
*/
|
|
896
972
|
slug?: string;
|
|
897
973
|
/**
|
|
@@ -948,12 +1024,40 @@ interface ViewDefinition extends ViewConfig {
|
|
|
948
1024
|
* Unique view ID (must start with a letter)
|
|
949
1025
|
*/
|
|
950
1026
|
readonly id: string;
|
|
951
|
-
/**
|
|
952
|
-
* URL-friendly slug for the view
|
|
953
|
-
* Auto-generated from id if not provided in config
|
|
954
|
-
*/
|
|
955
|
-
readonly slug: string;
|
|
956
1027
|
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Define a schema view
|
|
1030
|
+
*
|
|
1031
|
+
* Views are pre-configured entry list displays with filters,
|
|
1032
|
+
* columns, and metadata settings.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* const publishedPosts = defineView('publishedPosts', {
|
|
1036
|
+
* name: 'Published Posts',
|
|
1037
|
+
* description: 'All published blog posts',
|
|
1038
|
+
* icon: '📝',
|
|
1039
|
+
* scope: { type: 'contentType', contentType: 'post' },
|
|
1040
|
+
* filters: [
|
|
1041
|
+
* { field: 'status', operator: 'is', value: 'published' }
|
|
1042
|
+
* ],
|
|
1043
|
+
* columns: ['title', 'author', 'publishedAt'],
|
|
1044
|
+
* metadataFields: ['category', 'views'],
|
|
1045
|
+
* sort: { field: 'publishedAt', direction: 'desc' }
|
|
1046
|
+
* })
|
|
1047
|
+
*
|
|
1048
|
+
* @example
|
|
1049
|
+
* const draftContent = defineView('draftContent', {
|
|
1050
|
+
* name: 'Drafts',
|
|
1051
|
+
* scope: { type: 'all' },
|
|
1052
|
+
* filters: [
|
|
1053
|
+
* { field: 'status', operator: 'is', value: 'draft' }
|
|
1054
|
+
* ]
|
|
1055
|
+
* })
|
|
1056
|
+
*
|
|
1057
|
+
* @param id - Unique view ID (must start with a letter)
|
|
1058
|
+
* @param config - View configuration
|
|
1059
|
+
* @returns View definition object
|
|
1060
|
+
*/
|
|
957
1061
|
declare function defineView(id: string, config: ViewConfig): ViewDefinition;
|
|
958
1062
|
|
|
959
1063
|
/**
|
|
@@ -1055,7 +1159,7 @@ interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefi
|
|
|
1055
1159
|
* displayName: 'Product',
|
|
1056
1160
|
* fields: [
|
|
1057
1161
|
* fields.shortText('title', { config: { required: true }, localization: true }),
|
|
1058
|
-
* fields.
|
|
1162
|
+
* fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
|
|
1059
1163
|
* fields.component('seo', 'seo'),
|
|
1060
1164
|
* ]
|
|
1061
1165
|
* })
|
|
@@ -1113,4 +1217,4 @@ type SchemaAssetTypeNames<T extends AnySchemaDefinition> = NonNullable<T['assetT
|
|
|
1113
1217
|
*/
|
|
1114
1218
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = NonNullable<T['locales']> extends readonly LocaleDefinition[] ? NonNullable<T['locales']>[number]['code'] : never;
|
|
1115
1219
|
|
|
1116
|
-
export { type
|
|
1220
|
+
export { type ViewFilterCondition as $, defineRole as A, isRoleDefinition as B, type ComponentConfig as C, isBuiltInRole as D, getBuiltInRoleActions as E, BUILT_IN_ROLES as F, BUILT_IN_ROLE_ACTIONS as G, type BuiltInRole as H, type InferSettingsGroup as I, type RoleAction as J, type ResourcePermission as K, type LocaleOptions as L, type FieldVisibility as M, type RoleConfig as N, type RoleDefinition as O, defineView as P, type ContentTypeScopeConfig as Q, ROLE_ACTIONS as R, type SchemaConfig as S, type TextDirection as T, type ContentTypesScopeConfig as U, type ViewScopeConfig as V, type EntryTypeScopeConfig as W, type AllScopeConfig as X, type ViewFilterOperator as Y, type ViewFilterValue as Z, type ViewFilterRelativeDate as _, type SchemaDefinition as a, type ViewFilterGroup as a0, type ViewFilter as a1, type ViewConfig as a2, type ViewDefinition as a3, defineQuery as a4, type QueryConfig as a5, type QueryDefinition as a6, type QueryType as a7, type FullTextSearch as a8, type FetchBlock as a9, type AggregateBlock as aa, type SearchBlock as ab, type WhereCondition as ac, type WhereValue as ad, type WhereOperator as ae, type HavingOperator as af, type QueryScalar as ag, type SortCondition as ah, type SortDirection as ai, type IncludeDefinition as aj, type IncludeRelationship as ak, type IncludeSelection as al, type SelectMapping as am, type FilterDefinition as an, type CachePolicy as ao, type CachePolicyObject as ap, type IncludeSubQuery as aq, type IncludeSubQueries as ar, type Parameterizable as as, type QueryParameter as at, type QueryParameterType as au, type QueryCardinality as av, type InferQueryResponse as aw, type InferQueryParams as ax, type FilterOperator as ay, type SchemaContentTypeNames as b, type SchemaSingletonNames as c, defineSchema as d, type SchemaQueryNames as e, type SchemaLocaleCodes as f, type SchemaSettingsGroupNames as g, type SchemaAssetTypeNames as h, type SchemaEntry as i, type SchemaEntryOf as j, defineLocale as k, isLocaleDefinition as l, getLocaleCodes as m, findDefaultLocale as n, getActiveLocales as o, buildFallbackChain as p, type LocaleDefinition as q, defineComponent as r, type ComponentDefinition as s, type ComponentMetadata as t, type ComponentReusabilityMetadata as u, type ComponentValidationMetadata as v, defineSettingsGroup as w, type SettingsGroupConfig as x, type SettingsGroupDefinition as y, type SettingsGroupMetadata as z };
|