@relyio/sdk 0.2.0 → 0.3.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 +40 -0
- package/README.md +5 -310
- package/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-7W4MJXQ4.cjs → chunk-54WP2PWG.cjs} +215 -96
- package/dist/chunk-BBUB7C2Z.js +81 -0
- package/dist/{chunk-FJK7ZWKK.cjs → chunk-HMVGXUGR.cjs} +156 -221
- package/dist/chunk-LSRPMNPT.cjs +89 -0
- package/dist/{chunk-2QUK2ZGD.js → chunk-LYRYCIX5.js} +157 -219
- package/dist/{chunk-RJBIJ2ZK.js → chunk-QIZOBT5F.js} +215 -96
- package/dist/client/index.cjs +4 -3
- package/dist/client/index.d.cts +4 -3
- package/dist/client/index.d.ts +4 -3
- package/dist/client/index.js +2 -1
- package/dist/define-content-type-CBfnTWSS.d.cts +716 -0
- package/dist/define-content-type-CBfnTWSS.d.ts +716 -0
- package/dist/{define-schema-DHvUCKwj.d.cts → define-schema-BD6HSPnG.d.ts} +55 -722
- package/dist/{define-schema-DHvUCKwj.d.ts → define-schema-BfXeR6K8.d.cts} +55 -722
- package/dist/dev-handshake/index.cjs +37 -0
- package/dist/dev-handshake/index.d.cts +144 -0
- package/dist/dev-handshake/index.d.ts +144 -0
- package/dist/dev-handshake/index.js +4 -0
- package/dist/{index-DGWaawHt.d.cts → index-BDpar3FO.d.cts} +22 -6
- package/dist/{index-BsUqCAu8.d.cts → index-DuEhsGdE.d.ts} +516 -2155
- package/dist/{index-B-KiFHbx.d.ts → index-Dx01iwaf.d.ts} +22 -6
- package/dist/{index-BsUqCAu8.d.ts → index-ulOrcfPa.d.cts} +516 -2155
- package/dist/index.cjs +67 -70
- package/dist/index.d.cts +28 -13
- package/dist/index.d.ts +28 -13
- package/dist/index.js +3 -2
- package/dist/schema/index.cjs +35 -47
- package/dist/schema/index.d.cts +3 -2
- package/dist/schema/index.d.ts +3 -2
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +15 -17
|
@@ -1,704 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Field type definitions matching @relyio/schema package
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* AI configuration. A single prompt — `instructions` — describes what the
|
|
6
|
-
* element is and how AI should produce its value. Attaches to fields, content
|
|
7
|
-
* types, components, fieldsets, and (extended) asset types.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* fields.richText('body', {
|
|
12
|
-
* ai: {
|
|
13
|
-
* instructions: `
|
|
14
|
-
* Write in a conversational tone.
|
|
15
|
-
* Use short paragraphs (2-3 sentences).
|
|
16
|
-
* Target grade 8 reading level.
|
|
17
|
-
* `
|
|
18
|
-
* }
|
|
19
|
-
* })
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
interface AIConfig {
|
|
23
|
-
/**
|
|
24
|
-
* AI brief for this element: what it should contain and how to produce it.
|
|
25
|
-
*
|
|
26
|
-
* Used by the Studio authoring agent and — on asset types with
|
|
27
|
-
* `ai.autoGenerate` — by the automatic post-upload run.
|
|
28
|
-
*
|
|
29
|
-
* The fallback chain for AI guidance is:
|
|
30
|
-
* 1. ai.instructions (most specific)
|
|
31
|
-
* 2. ui.description (general field description)
|
|
32
|
-
* 3. Field displayName + type (inferred from semantics)
|
|
33
|
-
*/
|
|
34
|
-
instructions?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Field-level AI config. `inputs` names the fields this instruction reads.
|
|
38
|
-
* Unknown ids and cycles are refused when the schema is parsed.
|
|
39
|
-
*/
|
|
40
|
-
interface FieldAIConfig extends AIConfig {
|
|
41
|
-
/** Field ids this instruction reads. Never inferred from instruction text. */
|
|
42
|
-
inputs?: string[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Asset-type AI configuration. Extends {@link AIConfig} with `autoGenerate`,
|
|
46
|
-
* the single switch that turns on automatic field generation after upload.
|
|
47
|
-
*/
|
|
48
|
-
interface AssetAIConfig extends AIConfig {
|
|
49
|
-
/**
|
|
50
|
-
* Master switch for automatic, post-upload field generation. When `true`, the
|
|
51
|
-
* derived analysis agent fills every field that declares `ai.instructions`,
|
|
52
|
-
* applied as a review proposal. Only meaningful for image asset types in v1.
|
|
53
|
-
*/
|
|
54
|
-
autoGenerate?: boolean;
|
|
55
|
-
}
|
|
56
|
-
interface BaseFieldConfig {
|
|
57
|
-
/** Whether the field is required */
|
|
58
|
-
required?: boolean;
|
|
59
|
-
/** Whether the field value must be unique */
|
|
60
|
-
unique?: boolean;
|
|
61
|
-
/** Default value for the field */
|
|
62
|
-
defaultValue?: unknown;
|
|
63
|
-
}
|
|
64
|
-
interface FieldUIConfig {
|
|
65
|
-
/** Display name shown in the UI */
|
|
66
|
-
displayName: string;
|
|
67
|
-
/** Field description/help text */
|
|
68
|
-
description?: string;
|
|
69
|
-
/** Widget-specific options */
|
|
70
|
-
options?: Record<string, unknown>;
|
|
71
|
-
}
|
|
72
|
-
interface RuleCondition {
|
|
73
|
-
field: string;
|
|
74
|
-
operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'is_empty' | 'is_not_empty';
|
|
75
|
-
value?: unknown;
|
|
76
|
-
}
|
|
77
|
-
interface RuleConditions {
|
|
78
|
-
mode: 'all' | 'any' | 'none';
|
|
79
|
-
conditions: RuleCondition[];
|
|
80
|
-
}
|
|
81
|
-
interface VisibilityRule {
|
|
82
|
-
type: 'visibility';
|
|
83
|
-
action: 'show' | 'hide';
|
|
84
|
-
conditions: RuleConditions;
|
|
85
|
-
}
|
|
86
|
-
interface RequirementRule {
|
|
87
|
-
type: 'requirement';
|
|
88
|
-
action: 'require' | 'optional';
|
|
89
|
-
conditions: RuleConditions;
|
|
90
|
-
}
|
|
91
|
-
interface ValidationRule {
|
|
92
|
-
type: 'validation';
|
|
93
|
-
action: 'validate' | 'skip';
|
|
94
|
-
message?: string;
|
|
95
|
-
conditions: RuleConditions;
|
|
96
|
-
}
|
|
97
|
-
interface ReadOnlyRule {
|
|
98
|
-
type: 'readOnly';
|
|
99
|
-
action: 'enable' | 'disable';
|
|
100
|
-
conditions: RuleConditions;
|
|
101
|
-
}
|
|
102
|
-
type FieldRule = VisibilityRule | RequirementRule | ValidationRule | ReadOnlyRule;
|
|
103
|
-
type LocalizationConfig = boolean | string[] | {
|
|
104
|
-
enabled: boolean;
|
|
105
|
-
requiredLocales?: string[];
|
|
106
|
-
fallback?: boolean;
|
|
107
|
-
};
|
|
108
|
-
interface FieldDefinition<TId extends string = string, TType extends string = string, TConfig = unknown> {
|
|
109
|
-
/** Unique field identifier - preserves literal type for type inference */
|
|
110
|
-
readonly id: TId;
|
|
111
|
-
/** Field type */
|
|
112
|
-
readonly type: TType;
|
|
113
|
-
/** Type-specific configuration */
|
|
114
|
-
config?: TConfig;
|
|
115
|
-
/** UI display configuration */
|
|
116
|
-
ui?: FieldUIConfig;
|
|
117
|
-
/** AI configuration: generation/review guidance for this field */
|
|
118
|
-
ai?: FieldAIConfig;
|
|
119
|
-
/** Dynamic field rules */
|
|
120
|
-
rules?: FieldRule[];
|
|
121
|
-
/** Localization settings */
|
|
122
|
-
localization?: LocalizationConfig;
|
|
123
|
-
/** Fallback value when field is empty */
|
|
124
|
-
fallback?: unknown;
|
|
125
|
-
/** Whether this field is deprecated */
|
|
126
|
-
deprecated?: boolean;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Any field definition - used in arrays where we need to preserve specific field types
|
|
130
|
-
*/
|
|
131
|
-
type AnyFieldDefinition = FieldDefinition<string, string, unknown>;
|
|
132
|
-
interface ShortTextConfig extends BaseFieldConfig {
|
|
133
|
-
/** Maximum character length */
|
|
134
|
-
maxLength?: number;
|
|
135
|
-
/** Regex pattern for validation */
|
|
136
|
-
pattern?: string;
|
|
137
|
-
}
|
|
138
|
-
interface LongTextConfig extends BaseFieldConfig {
|
|
139
|
-
minLength?: number;
|
|
140
|
-
maxLength?: number;
|
|
141
|
-
}
|
|
142
|
-
interface RichTextConfig extends BaseFieldConfig {
|
|
143
|
-
/** Maximum character length for the rich text content */
|
|
144
|
-
maxLength?: number;
|
|
145
|
-
/** Allowed formatting options (e.g., bold, italic, underline) */
|
|
146
|
-
allowedFormats?: string[];
|
|
147
|
-
/** Allowed embed types (e.g., image, video, code) */
|
|
148
|
-
embedTypes?: string[];
|
|
149
|
-
}
|
|
150
|
-
interface SlugConfig extends BaseFieldConfig {
|
|
151
|
-
/** Source field to generate slug from */
|
|
152
|
-
sourceField?: string;
|
|
153
|
-
/** Maximum character length */
|
|
154
|
-
maxLength?: number;
|
|
155
|
-
}
|
|
156
|
-
interface UrlConfig extends BaseFieldConfig {
|
|
157
|
-
/** Allowed URL protocols */
|
|
158
|
-
allowedProtocols?: ('http' | 'https' | 'ftp' | 'ftps')[];
|
|
159
|
-
/** Maximum character length */
|
|
160
|
-
maxLength?: number;
|
|
161
|
-
}
|
|
162
|
-
interface EmailConfig extends BaseFieldConfig {
|
|
163
|
-
/** Maximum character length */
|
|
164
|
-
maxLength?: number;
|
|
165
|
-
/** Whitelist of allowed email domains */
|
|
166
|
-
domainWhitelist?: string[];
|
|
167
|
-
}
|
|
168
|
-
interface IntegerConfig extends BaseFieldConfig {
|
|
169
|
-
min?: number;
|
|
170
|
-
max?: number;
|
|
171
|
-
}
|
|
172
|
-
interface DecimalConfig extends BaseFieldConfig {
|
|
173
|
-
min?: number;
|
|
174
|
-
max?: number;
|
|
175
|
-
decimalPlaces?: number;
|
|
176
|
-
roundingMode?: 'HALF_UP' | 'FLOOR' | 'CEILING' | 'ROUND' | 'TRUNCATE';
|
|
177
|
-
}
|
|
178
|
-
interface BooleanConfig extends BaseFieldConfig {
|
|
179
|
-
trueLabel?: string;
|
|
180
|
-
falseLabel?: string;
|
|
181
|
-
}
|
|
182
|
-
interface EnumConfig extends BaseFieldConfig {
|
|
183
|
-
options: Array<{
|
|
184
|
-
value: string;
|
|
185
|
-
label?: string;
|
|
186
|
-
}>;
|
|
187
|
-
multi?: boolean;
|
|
188
|
-
}
|
|
189
|
-
interface DateConfig extends BaseFieldConfig {
|
|
190
|
-
minDate?: string;
|
|
191
|
-
maxDate?: string;
|
|
192
|
-
format?: string;
|
|
193
|
-
}
|
|
194
|
-
interface DateTimeConfig extends BaseFieldConfig {
|
|
195
|
-
minDateTime?: string;
|
|
196
|
-
maxDateTime?: string;
|
|
197
|
-
format?: string;
|
|
198
|
-
timezone?: boolean;
|
|
199
|
-
}
|
|
200
|
-
interface ReferenceConfig extends BaseFieldConfig {
|
|
201
|
-
/**
|
|
202
|
-
* Target entry type id(s) — content type or asset type ids. Pass a single id
|
|
203
|
-
* for one target or an array for several. All ids must belong to the same
|
|
204
|
-
* family (all content types or all asset types).
|
|
205
|
-
*/
|
|
206
|
-
to: string | string[];
|
|
207
|
-
/** Allow multiple references (the field value is a list). */
|
|
208
|
-
multi?: boolean;
|
|
209
|
-
/** Reference strength for publish/unpublish behavior. */
|
|
210
|
-
referenceStrength?: 'strong' | 'weak';
|
|
211
|
-
/** Behavior when a referenced entry is deleted. */
|
|
212
|
-
onTargetDelete?: 'block' | 'nullify';
|
|
213
|
-
}
|
|
214
|
-
interface TagsConfig extends BaseFieldConfig {
|
|
215
|
-
allowCustom?: boolean;
|
|
216
|
-
predefinedTags?: string[];
|
|
217
|
-
maxTags?: number;
|
|
218
|
-
}
|
|
219
|
-
interface ListConfig extends BaseFieldConfig {
|
|
220
|
-
dragAndDrop?: boolean;
|
|
221
|
-
minItems?: number;
|
|
222
|
-
maxItems?: number;
|
|
223
|
-
/** Subfields for list items */
|
|
224
|
-
subfields?: FieldDefinition[];
|
|
225
|
-
}
|
|
226
|
-
type FieldType = 'shortText' | 'longText' | 'richText' | 'slug' | 'url' | 'email' | 'integer' | 'decimal' | 'boolean' | 'enum' | 'date' | 'dateTime' | 'reference' | 'tags' | 'list';
|
|
227
|
-
type ComponentFieldType = `component(${string})`;
|
|
228
|
-
type AllFieldTypes = FieldType | ComponentFieldType;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Workflow definition for content approval pipelines
|
|
232
|
-
*
|
|
233
|
-
* Workflows define approval stages that content must pass through before
|
|
234
|
-
* publication. They can be configured globally and per content type.
|
|
235
|
-
*
|
|
236
|
-
* @example
|
|
237
|
-
* // Simple workflow with one approval stage
|
|
238
|
-
* const workflow = defineWorkflow({
|
|
239
|
-
* enabled: true,
|
|
240
|
-
* stages: [
|
|
241
|
-
* defineWorkflowStage('review', {
|
|
242
|
-
* displayName: 'Editorial Review',
|
|
243
|
-
* allowedRoles: ['editor', 'admin']
|
|
244
|
-
* })
|
|
245
|
-
* ]
|
|
246
|
-
* })
|
|
247
|
-
*
|
|
248
|
-
* @example
|
|
249
|
-
* // Multi-stage workflow
|
|
250
|
-
* const workflow = defineWorkflow({
|
|
251
|
-
* enabled: true,
|
|
252
|
-
* stages: [
|
|
253
|
-
* defineWorkflowStage('editorial-review', {
|
|
254
|
-
* displayName: 'Editorial Review',
|
|
255
|
-
* allowedRoles: ['editor']
|
|
256
|
-
* }),
|
|
257
|
-
* defineWorkflowStage('legal-approval', {
|
|
258
|
-
* displayName: 'Legal Approval',
|
|
259
|
-
* requiredApprovals: 1,
|
|
260
|
-
* allowedRoles: ['legal-reviewer']
|
|
261
|
-
* }),
|
|
262
|
-
* defineWorkflowStage('final-approval', {
|
|
263
|
-
* displayName: 'Final Approval',
|
|
264
|
-
* requiredApprovals: 2,
|
|
265
|
-
* allowedRoles: ['publisher', 'admin']
|
|
266
|
-
* })
|
|
267
|
-
* ]
|
|
268
|
-
* })
|
|
269
|
-
*/
|
|
270
|
-
/**
|
|
271
|
-
* Escalation configuration when a workflow stage times out
|
|
272
|
-
*/
|
|
273
|
-
interface WorkflowEscalation {
|
|
274
|
-
/** Roles to notify when stage times out */
|
|
275
|
-
notifyRoles?: string[];
|
|
276
|
-
/** Roles to escalate to if still pending after another timeout period */
|
|
277
|
-
escalateToRoles?: string[];
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Auto-assignment configuration for workflow stages
|
|
281
|
-
*/
|
|
282
|
-
interface WorkflowAutoAssign {
|
|
283
|
-
/** Roles whose users should be notified when content enters this stage */
|
|
284
|
-
roles: string[];
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Workflow stage configuration
|
|
288
|
-
*/
|
|
289
|
-
interface WorkflowStageConfig {
|
|
290
|
-
/** Human-readable name shown in Studio */
|
|
291
|
-
displayName: string;
|
|
292
|
-
/** Optional description for reviewers */
|
|
293
|
-
description?: string;
|
|
294
|
-
/** Number of approvals needed to pass this stage (default: 1) */
|
|
295
|
-
requiredApprovals?: number;
|
|
296
|
-
/** Roles that can approve this stage */
|
|
297
|
-
allowedRoles?: string[];
|
|
298
|
-
/** Auto-assignment configuration */
|
|
299
|
-
autoAssign?: WorkflowAutoAssign;
|
|
300
|
-
/** Days before escalation triggers (optional) */
|
|
301
|
-
timeoutDays?: number;
|
|
302
|
-
/** Escalation configuration when stage times out */
|
|
303
|
-
escalation?: WorkflowEscalation;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Complete workflow stage definition
|
|
307
|
-
*/
|
|
308
|
-
interface WorkflowStageDefinition {
|
|
309
|
-
readonly _tag: 'workflowStage';
|
|
310
|
-
readonly id: string;
|
|
311
|
-
readonly displayName: string;
|
|
312
|
-
readonly description?: string;
|
|
313
|
-
readonly requiredApprovals: number;
|
|
314
|
-
readonly allowedRoles?: string[];
|
|
315
|
-
readonly autoAssign?: WorkflowAutoAssign;
|
|
316
|
-
readonly timeoutDays?: number;
|
|
317
|
-
readonly escalation?: WorkflowEscalation;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Workflow configuration
|
|
321
|
-
*/
|
|
322
|
-
interface WorkflowConfig {
|
|
323
|
-
/** Enable/disable workflow for the branch (default: false) */
|
|
324
|
-
enabled?: boolean;
|
|
325
|
-
/** Array of approval stage definitions */
|
|
326
|
-
stages?: WorkflowStageDefinition[];
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Complete workflow definition
|
|
330
|
-
*/
|
|
331
|
-
interface WorkflowDefinition {
|
|
332
|
-
readonly _tag: 'workflow';
|
|
333
|
-
readonly enabled: boolean;
|
|
334
|
-
readonly stages: WorkflowStageDefinition[];
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* Per-content-type workflow configuration
|
|
338
|
-
*/
|
|
339
|
-
interface ContentTypeWorkflowConfig {
|
|
340
|
-
/** Enable workflow for this content type (inherits from global if not set) */
|
|
341
|
-
enabled?: boolean;
|
|
342
|
-
/** Which global stages apply to this content type (subset of global stages) */
|
|
343
|
-
stages?: string[];
|
|
344
|
-
/** Publish automatically after all stages are approved */
|
|
345
|
-
autoPublish?: boolean;
|
|
346
|
-
/** Require all locales to be approved before publishing */
|
|
347
|
-
requireAllLocales?: boolean;
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Define a workflow stage
|
|
351
|
-
*
|
|
352
|
-
* @param id - Unique identifier for the stage (kebab-case or camelCase)
|
|
353
|
-
* @param config - Stage configuration
|
|
354
|
-
*
|
|
355
|
-
* @example
|
|
356
|
-
* const editorialReview = defineWorkflowStage('editorial-review', {
|
|
357
|
-
* displayName: 'Editorial Review',
|
|
358
|
-
* description: 'Content quality and style check',
|
|
359
|
-
* requiredApprovals: 1,
|
|
360
|
-
* allowedRoles: ['editor', 'senior-editor']
|
|
361
|
-
* })
|
|
362
|
-
*
|
|
363
|
-
* @example
|
|
364
|
-
* // Stage with auto-assignment and timeout
|
|
365
|
-
* const legalApproval = defineWorkflowStage('legal-approval', {
|
|
366
|
-
* displayName: 'Legal Approval',
|
|
367
|
-
* allowedRoles: ['legal-reviewer'],
|
|
368
|
-
* autoAssign: { roles: ['legal-reviewer'] },
|
|
369
|
-
* timeoutDays: 3,
|
|
370
|
-
* escalation: {
|
|
371
|
-
* notifyRoles: ['legal-reviewer'],
|
|
372
|
-
* escalateToRoles: ['admin']
|
|
373
|
-
* }
|
|
374
|
-
* })
|
|
375
|
-
*/
|
|
376
|
-
declare function defineWorkflowStage(id: string, config: WorkflowStageConfig): WorkflowStageDefinition;
|
|
377
|
-
/**
|
|
378
|
-
* Define a workflow configuration
|
|
379
|
-
*
|
|
380
|
-
* @param config - Workflow configuration with enabled flag and stages
|
|
381
|
-
*
|
|
382
|
-
* @example
|
|
383
|
-
* // Simple workflow
|
|
384
|
-
* const workflow = defineWorkflow({
|
|
385
|
-
* enabled: true,
|
|
386
|
-
* stages: [
|
|
387
|
-
* defineWorkflowStage('review', {
|
|
388
|
-
* displayName: 'Review',
|
|
389
|
-
* allowedRoles: ['editor']
|
|
390
|
-
* })
|
|
391
|
-
* ]
|
|
392
|
-
* })
|
|
393
|
-
*
|
|
394
|
-
* @example
|
|
395
|
-
* // Disabled workflow (direct publish)
|
|
396
|
-
* const workflow = defineWorkflow({
|
|
397
|
-
* enabled: false
|
|
398
|
-
* })
|
|
399
|
-
*/
|
|
400
|
-
declare function defineWorkflow(config: WorkflowConfig): WorkflowDefinition;
|
|
401
|
-
/**
|
|
402
|
-
* Define content-type specific workflow configuration
|
|
403
|
-
*
|
|
404
|
-
* @param config - Content type workflow configuration
|
|
405
|
-
*
|
|
406
|
-
* @example
|
|
407
|
-
* // Use specific stages from global workflow
|
|
408
|
-
* const blogPostWorkflow = defineContentTypeWorkflow({
|
|
409
|
-
* enabled: true,
|
|
410
|
-
* stages: ['editorial-review', 'final-approval'], // Skip legal
|
|
411
|
-
* autoPublish: false
|
|
412
|
-
* })
|
|
413
|
-
*
|
|
414
|
-
* @example
|
|
415
|
-
* // Disable workflow for this content type
|
|
416
|
-
* const quickUpdateWorkflow = defineContentTypeWorkflow({
|
|
417
|
-
* enabled: false
|
|
418
|
-
* })
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
* // Require all locales to be approved
|
|
422
|
-
* const marketingPageWorkflow = defineContentTypeWorkflow({
|
|
423
|
-
* enabled: true,
|
|
424
|
-
* stages: ['translation-review', 'regional-approval'],
|
|
425
|
-
* requireAllLocales: true
|
|
426
|
-
* })
|
|
427
|
-
*/
|
|
428
|
-
declare function defineContentTypeWorkflow(config: ContentTypeWorkflowConfig): ContentTypeWorkflowConfig;
|
|
429
|
-
/**
|
|
430
|
-
* Check if a value is a workflow stage definition
|
|
431
|
-
*/
|
|
432
|
-
declare function isWorkflowStageDefinition(value: unknown): value is WorkflowStageDefinition;
|
|
433
|
-
/**
|
|
434
|
-
* Check if a value is a workflow definition
|
|
435
|
-
*/
|
|
436
|
-
declare function isWorkflowDefinition(value: unknown): value is WorkflowDefinition;
|
|
437
|
-
/**
|
|
438
|
-
* Get all stage IDs from a workflow definition
|
|
439
|
-
*/
|
|
440
|
-
declare function getWorkflowStageIds(workflow: WorkflowDefinition): string[];
|
|
441
|
-
/**
|
|
442
|
-
* Find a stage by ID in a workflow definition
|
|
443
|
-
*/
|
|
444
|
-
declare function findWorkflowStage(workflow: WorkflowDefinition, stageId: string): WorkflowStageDefinition | undefined;
|
|
445
|
-
/**
|
|
446
|
-
* Get the next stage after a given stage ID (null if last stage)
|
|
447
|
-
*/
|
|
448
|
-
declare function getNextWorkflowStage(workflow: WorkflowDefinition, currentStageId: string): WorkflowStageDefinition | null;
|
|
449
|
-
/**
|
|
450
|
-
* Get the first stage in the workflow (null if no stages)
|
|
451
|
-
*/
|
|
452
|
-
declare function getFirstWorkflowStage(workflow: WorkflowDefinition): WorkflowStageDefinition | null;
|
|
453
|
-
/**
|
|
454
|
-
* Check if a stage is the final stage in the workflow
|
|
455
|
-
*/
|
|
456
|
-
declare function isFinalWorkflowStage(workflow: WorkflowDefinition, stageId: string): boolean;
|
|
457
|
-
/**
|
|
458
|
-
* Convert a workflow definition to JSON-safe format (strips _tag)
|
|
459
|
-
*/
|
|
460
|
-
declare function workflowToJSON(workflow: WorkflowDefinition): {
|
|
461
|
-
enabled: boolean;
|
|
462
|
-
stages?: Array<Omit<WorkflowStageDefinition, '_tag'>>;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Content type definition matching @relyio/schema ContentTypeSchema
|
|
467
|
-
*
|
|
468
|
-
* Uses advanced TypeScript generics to preserve literal field IDs through
|
|
469
|
-
* the type system, enabling full autocomplete in SDK methods like where().
|
|
470
|
-
*/
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Fieldset for organizing related fields
|
|
474
|
-
* Generic over fields to preserve literal field IDs
|
|
475
|
-
*/
|
|
476
|
-
interface Fieldset<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
|
|
477
|
-
/** Unique fieldset identifier */
|
|
478
|
-
readonly id: string;
|
|
479
|
-
/** Display name shown in the UI */
|
|
480
|
-
readonly displayName: string;
|
|
481
|
-
/** Optional description */
|
|
482
|
-
readonly description?: string;
|
|
483
|
-
/** AI configuration for content generation and review */
|
|
484
|
-
readonly ai?: AIConfig;
|
|
485
|
-
/** Fields within this fieldset - preserves literal types */
|
|
486
|
-
readonly fields: TFields;
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* Type alias for a fieldset with any fields.
|
|
490
|
-
* Used in generic constraints where we need to accept any fieldset type.
|
|
491
|
-
*/
|
|
492
|
-
type AnyFieldset$2 = Fieldset<any>;
|
|
493
|
-
/**
|
|
494
|
-
* Create a fieldset for organizing fields
|
|
495
|
-
* Generic to preserve the specific field types for type inference
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* const seoFieldset = fieldset('seo', {
|
|
499
|
-
* displayName: 'SEO Settings',
|
|
500
|
-
* fields: [
|
|
501
|
-
* fields.shortText('metaTitle', { config: { maxLength: 60 } }),
|
|
502
|
-
* fields.longText('metaDescription', { config: { maxLength: 160 } }),
|
|
503
|
-
* ]
|
|
504
|
-
* })
|
|
505
|
-
*/
|
|
506
|
-
declare function fieldset<TFields extends readonly AnyFieldDefinition[]>(id: string, config: {
|
|
507
|
-
displayName: string;
|
|
508
|
-
description?: string;
|
|
509
|
-
ai?: AIConfig;
|
|
510
|
-
fields: TFields;
|
|
511
|
-
}): Fieldset<TFields>;
|
|
512
|
-
/**
|
|
513
|
-
* Content type configuration using direct fields
|
|
514
|
-
* Generic to preserve literal field IDs for type inference
|
|
515
|
-
*/
|
|
516
|
-
interface ContentTypeConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
|
|
517
|
-
/** Display name shown in the UI */
|
|
518
|
-
displayName: string;
|
|
519
|
-
/** Plural display name shown in the UI (e.g., "Products" for "Product") */
|
|
520
|
-
displayNamePlural?: string;
|
|
521
|
-
/** Description of the content type */
|
|
522
|
-
description?: string;
|
|
523
|
-
/** AI configuration: generation/review guidance */
|
|
524
|
-
ai?: AIConfig;
|
|
525
|
-
/**
|
|
526
|
-
* Field ID to use as entry display title in lists, references, and editor header.
|
|
527
|
-
* If not set, falls back to: title → name → slug → first shortText field → entryUid
|
|
528
|
-
*/
|
|
529
|
-
displayField?: string;
|
|
530
|
-
/** Whether this content type supports hierarchical (parent-child) relationships */
|
|
531
|
-
hierarchical?: boolean;
|
|
532
|
-
/** Access tags for role-based access control */
|
|
533
|
-
accessTags?: string[];
|
|
534
|
-
/** Workflow configuration for this content type */
|
|
535
|
-
workflow?: ContentTypeWorkflowConfig;
|
|
536
|
-
/** Direct field definitions - preserves literal types */
|
|
537
|
-
fields: TFields;
|
|
538
|
-
/** Cannot have fieldsets when using fields */
|
|
539
|
-
fieldsets?: never;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Content type configuration using fieldsets
|
|
543
|
-
* Generic to preserve fieldset field types
|
|
544
|
-
*/
|
|
545
|
-
interface ContentTypeConfigWithFieldsets<TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> {
|
|
546
|
-
/** Display name shown in the UI */
|
|
547
|
-
displayName: string;
|
|
548
|
-
/** Plural display name shown in the UI (e.g., "Products" for "Product") */
|
|
549
|
-
displayNamePlural?: string;
|
|
550
|
-
/** Description of the content type */
|
|
551
|
-
description?: string;
|
|
552
|
-
/** AI configuration: generation/review guidance */
|
|
553
|
-
ai?: AIConfig;
|
|
554
|
-
/**
|
|
555
|
-
* Field ID to use as entry display title in lists, references, and editor header.
|
|
556
|
-
* If not set, falls back to: title → name → slug → first shortText field → entryUid
|
|
557
|
-
*/
|
|
558
|
-
displayField?: string;
|
|
559
|
-
/** Access tags for role-based access control */
|
|
560
|
-
accessTags?: string[];
|
|
561
|
-
/** Whether this content type supports hierarchical (parent-child) relationships */
|
|
562
|
-
hierarchical?: boolean;
|
|
563
|
-
/** Workflow configuration for this content type */
|
|
564
|
-
workflow?: ContentTypeWorkflowConfig;
|
|
565
|
-
/** Field organization via fieldsets - preserves literal types */
|
|
566
|
-
fieldsets: TFieldsets;
|
|
567
|
-
/** Cannot have direct fields when using fieldsets */
|
|
568
|
-
fields?: never;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Content type configuration (either fields OR fieldsets, not both)
|
|
572
|
-
*/
|
|
573
|
-
type ContentTypeConfig<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> = ContentTypeConfigWithFields<TFields> | ContentTypeConfigWithFieldsets<TFieldsets>;
|
|
574
|
-
/**
|
|
575
|
-
* Content type definition - preserves field types for inference
|
|
576
|
-
*/
|
|
577
|
-
interface ContentTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> {
|
|
578
|
-
readonly _tag: 'contentType';
|
|
579
|
-
readonly name: string;
|
|
580
|
-
readonly displayName: string;
|
|
581
|
-
readonly displayNamePlural?: string;
|
|
582
|
-
readonly description?: string;
|
|
583
|
-
/** AI configuration: generation/review guidance */
|
|
584
|
-
readonly ai?: AIConfig;
|
|
585
|
-
/** Field ID to use as entry display title */
|
|
586
|
-
readonly displayField?: string;
|
|
587
|
-
readonly hierarchical: boolean;
|
|
588
|
-
readonly accessTags?: string[];
|
|
589
|
-
readonly workflow?: ContentTypeWorkflowConfig;
|
|
590
|
-
readonly fields?: TFields;
|
|
591
|
-
readonly fieldsets?: TFieldsets;
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Define a content type with type-safe fields
|
|
595
|
-
*
|
|
596
|
-
* The generic type parameters preserve the literal field IDs through the type
|
|
597
|
-
* system, enabling autocomplete in SDK methods like where(), select(), etc.
|
|
598
|
-
*
|
|
599
|
-
* @example
|
|
600
|
-
* // Using direct fields
|
|
601
|
-
* const product = defineContentType('product', {
|
|
602
|
-
* displayName: 'Product',
|
|
603
|
-
* fields: [
|
|
604
|
-
* fields.shortText('title', { config: { required: true } }),
|
|
605
|
-
* fields.currency('price', { config: { currencyCode: 'USD' } }),
|
|
606
|
-
* ]
|
|
607
|
-
* })
|
|
608
|
-
*
|
|
609
|
-
* @example
|
|
610
|
-
* // Using fieldsets for organization
|
|
611
|
-
* const product = defineContentType('product', {
|
|
612
|
-
* displayName: 'Product',
|
|
613
|
-
* fieldsets: [
|
|
614
|
-
* fieldset('basic', {
|
|
615
|
-
* displayName: 'Basic Info',
|
|
616
|
-
* fields: [
|
|
617
|
-
* fields.shortText('title', { config: { required: true } }),
|
|
618
|
-
* ]
|
|
619
|
-
* }),
|
|
620
|
-
* fieldset('pricing', {
|
|
621
|
-
* displayName: 'Pricing',
|
|
622
|
-
* fields: [
|
|
623
|
-
* fields.currency('price', { config: { currencyCode: 'USD' } }),
|
|
624
|
-
* ]
|
|
625
|
-
* }),
|
|
626
|
-
* ]
|
|
627
|
-
* })
|
|
628
|
-
*/
|
|
629
|
-
declare function defineContentType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFields<TFields>): ContentTypeDefinition<TFields, readonly []>;
|
|
630
|
-
declare function defineContentType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFieldsets<TFieldsets>): ContentTypeDefinition<readonly [], TFieldsets>;
|
|
631
|
-
/**
|
|
632
|
-
* Type alias for any content type definition.
|
|
633
|
-
*/
|
|
634
|
-
type AnyContentTypeDefinition = ContentTypeDefinition<any, any>;
|
|
635
|
-
/**
|
|
636
|
-
* Extract field IDs from a content type definition
|
|
637
|
-
* Works with both direct fields and fieldsets
|
|
638
|
-
*/
|
|
639
|
-
type ExtractFieldIds<T extends AnyContentTypeDefinition> = NonNullable<T['fields']> extends (infer F)[] ? F extends AnyFieldDefinition ? F['id'] : ExtractFromFieldsets<T> : ExtractFromFieldsets<T>;
|
|
640
|
-
type ExtractFromFieldsets<T extends AnyContentTypeDefinition> = NonNullable<T['fieldsets']> extends (infer FS)[] ? FS extends Fieldset<infer Fields> ? Fields extends AnyFieldDefinition[] ? Fields[number]['id'] : never : never : never;
|
|
641
|
-
/**
|
|
642
|
-
* Entry metadata that's present on all content entries
|
|
643
|
-
*/
|
|
644
|
-
interface EntryMetadata {
|
|
645
|
-
/** Unique entry identifier */
|
|
646
|
-
id: string;
|
|
647
|
-
/** Content type id (API field name is `type`) */
|
|
648
|
-
type: string;
|
|
649
|
-
/** Entry type (content, asset, singleton, settings) */
|
|
650
|
-
entryType: string;
|
|
651
|
-
/**
|
|
652
|
-
* Container lifecycle only (`active` | `archived` | `proposed`).
|
|
653
|
-
* Publication is `localeStatus` (`INV-LM-STATUS-IS-TWO-FIELDS`).
|
|
654
|
-
*/
|
|
655
|
-
status: 'active' | 'archived' | 'proposed';
|
|
656
|
-
/** Per-locale version number */
|
|
657
|
-
version: number;
|
|
658
|
-
/** Parent ID for hierarchical content */
|
|
659
|
-
parentId?: string | null;
|
|
660
|
-
/** Content locale this payload is reported in */
|
|
661
|
-
locale: string;
|
|
662
|
-
/** Publication state of `locale`; absent when that locale has no content of its own. */
|
|
663
|
-
localeStatus?: 'draft' | 'published' | 'archived';
|
|
664
|
-
/** Whether `locale` has unpublished changes of its own. */
|
|
665
|
-
localeHasDraft?: boolean;
|
|
666
|
-
/** Every locale with unpublished changes, including shared-field drafts. */
|
|
667
|
-
draftLocales?: string[];
|
|
668
|
-
/** Whether the shared (non-localized) fields have an unpublished overlay. */
|
|
669
|
-
hasDraft?: boolean;
|
|
670
|
-
/** Creation timestamp */
|
|
671
|
-
createdAt: Date;
|
|
672
|
-
/** Last update timestamp */
|
|
673
|
-
updatedAt: Date;
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Infer the TypeScript type from a content type definition
|
|
677
|
-
*
|
|
678
|
-
* This extracts all field IDs from the definition and creates a type
|
|
679
|
-
* with those fields as optional properties. Field names will autocomplete
|
|
680
|
-
* in SDK methods like where(), select(), etc.
|
|
681
|
-
*
|
|
682
|
-
* Note: Field values are typed as `unknown`. For full value type inference,
|
|
683
|
-
* use the codegen tool to generate proper types.
|
|
684
|
-
*
|
|
685
|
-
* @example
|
|
686
|
-
* const product = defineContentType('product', {
|
|
687
|
-
* displayName: 'Product',
|
|
688
|
-
* fields: [
|
|
689
|
-
* fields.shortText('title'),
|
|
690
|
-
* fields.currency('price'),
|
|
691
|
-
* ]
|
|
692
|
-
* })
|
|
693
|
-
*
|
|
694
|
-
* type Product = InferContentType<typeof product>
|
|
695
|
-
* // { title?: unknown; price?: unknown; _metadata: EntryMetadata }
|
|
696
|
-
*/
|
|
697
|
-
type InferContentType<T extends AnyContentTypeDefinition> = {
|
|
698
|
-
[K in ExtractFieldIds<T> & string]?: unknown;
|
|
699
|
-
} & {
|
|
700
|
-
_metadata: EntryMetadata;
|
|
701
|
-
};
|
|
1
|
+
import { l as AnyFieldDefinition, w as Fieldset, A as AIConfig, K as LocalePublicationFields, y as ContentTypeConfigWithFields, z as ContentTypeConfigWithFieldsets, c as FieldDefinition, m as AssetAIConfig, a5 as ContentTypeWorkflowConfig, L as LocalizationConfig, H as EntryMetadata, G as ContentTypeDefinition, a4 as WorkflowDefinition } from './define-content-type-CBfnTWSS.js';
|
|
702
2
|
|
|
703
3
|
/**
|
|
704
4
|
* Singleton content type definition matching @relyio/schema
|
|
@@ -754,9 +54,14 @@ declare function defineSingletonContentType<TFields extends readonly AnyFieldDef
|
|
|
754
54
|
declare function defineSingletonContentType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFieldsets<TFieldsets>): SingletonContentTypeDefinition<readonly [], TFieldsets>;
|
|
755
55
|
declare const defineSingleton: typeof defineSingletonContentType;
|
|
756
56
|
/**
|
|
757
|
-
* Singleton metadata
|
|
57
|
+
* Singleton metadata.
|
|
58
|
+
*
|
|
59
|
+
* The per-locale publication half is inherited from `LocalePublicationFields` rather than absent.
|
|
60
|
+
* `apps/services/api` reports `localeStatus` / `localeHasDraft` / `draftLocales` on singleton reads
|
|
61
|
+
* exactly as it does on entry reads (`INV-LM-PUBLICATION-IS-REPORTED-PER-LOCALE`); this type simply
|
|
62
|
+
* never said so, which told a customer that a singleton has no publication state to read.
|
|
758
63
|
*/
|
|
759
|
-
interface SingletonMetadata {
|
|
64
|
+
interface SingletonMetadata extends LocalePublicationFields {
|
|
760
65
|
/** Singleton key identifier */
|
|
761
66
|
key: string;
|
|
762
67
|
/** Singleton type identifier */
|
|
@@ -1215,6 +520,10 @@ type InferAssetType<T extends AnyAssetTypeDefinition> = {
|
|
|
1215
520
|
* Query definition matching @relyio/schema QueryDefinitionSchema
|
|
1216
521
|
*
|
|
1217
522
|
* Queries define predefined API endpoints with filtering, sorting, and caching.
|
|
523
|
+
*
|
|
524
|
+
* This is a hand-written mirror: `@relyio/sdk` is published standalone and does not depend on
|
|
525
|
+
* `@relyio/schema`, so a field added there has to be added here too. When the two drifted, `limit`
|
|
526
|
+
* was the casualty — the documentation writes `limit: '${limit?20}'` and this file said `number`.
|
|
1218
527
|
*/
|
|
1219
528
|
type WhereOperator = {
|
|
1220
529
|
gte?: string | number;
|
|
@@ -1257,6 +566,35 @@ type FilterOperator = {
|
|
|
1257
566
|
nin?: string;
|
|
1258
567
|
};
|
|
1259
568
|
type FilterDefinition = Record<string, string | FilterOperator>;
|
|
569
|
+
/** A value that is either a literal or a `${param}` / `${param?default}` expression. */
|
|
570
|
+
type Parameterizable<T> = T | string;
|
|
571
|
+
type QueryParameterType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
572
|
+
/**
|
|
573
|
+
* A declared query parameter.
|
|
574
|
+
*
|
|
575
|
+
* Every `${...}` in a query and every `{name}` segment of its endpoint already declares one; this
|
|
576
|
+
* block adds a type and constraints. Nothing is inferred from a parameter's name.
|
|
577
|
+
*/
|
|
578
|
+
interface QueryParameter {
|
|
579
|
+
/** The parameter, as it appears in `${...}` or in an endpoint segment */
|
|
580
|
+
name: string;
|
|
581
|
+
/** Coerces the caller's value; a value that will not coerce is a 400 */
|
|
582
|
+
type?: QueryParameterType;
|
|
583
|
+
/** Overrides what the query's own expressions say */
|
|
584
|
+
required?: boolean;
|
|
585
|
+
/** Used when the caller supplies nothing */
|
|
586
|
+
default?: string | number | boolean | (string | number | boolean)[];
|
|
587
|
+
minimum?: number;
|
|
588
|
+
maximum?: number;
|
|
589
|
+
/** String characters, or array items */
|
|
590
|
+
minLength?: number;
|
|
591
|
+
maxLength?: number;
|
|
592
|
+
/** A regular expression, applied to strings */
|
|
593
|
+
pattern?: string;
|
|
594
|
+
enum?: (string | number | boolean)[];
|
|
595
|
+
}
|
|
596
|
+
/** Whether the query answers with one record or a list. Independent of how many rows match. */
|
|
597
|
+
type QueryCardinality = 'one' | 'many';
|
|
1260
598
|
type CachePolicyObject = {
|
|
1261
599
|
policy: 'public' | 'private' | 'no-cache';
|
|
1262
600
|
ttl?: number;
|
|
@@ -1279,9 +617,9 @@ interface FetchBlock {
|
|
|
1279
617
|
/** Sort order */
|
|
1280
618
|
sort?: SortCondition;
|
|
1281
619
|
/** Maximum results */
|
|
1282
|
-
limit?: number
|
|
620
|
+
limit?: Parameterizable<number>;
|
|
1283
621
|
/** Results offset */
|
|
1284
|
-
offset?: number
|
|
622
|
+
offset?: Parameterizable<number>;
|
|
1285
623
|
}
|
|
1286
624
|
/**
|
|
1287
625
|
* Aggregate block - perform aggregations
|
|
@@ -1305,7 +643,7 @@ interface AggregateBlock {
|
|
|
1305
643
|
/** Sort order */
|
|
1306
644
|
sort?: SortCondition;
|
|
1307
645
|
/** Maximum results */
|
|
1308
|
-
limit?: number
|
|
646
|
+
limit?: Parameterizable<number>;
|
|
1309
647
|
}
|
|
1310
648
|
/**
|
|
1311
649
|
* Search block - full-text and semantic search
|
|
@@ -1339,9 +677,9 @@ interface SearchBlock {
|
|
|
1339
677
|
/** Sort order */
|
|
1340
678
|
sort?: SortCondition;
|
|
1341
679
|
/** Maximum results */
|
|
1342
|
-
limit?: number
|
|
680
|
+
limit?: Parameterizable<number>;
|
|
1343
681
|
/** Results offset */
|
|
1344
|
-
offset?: number
|
|
682
|
+
offset?: Parameterizable<number>;
|
|
1345
683
|
}
|
|
1346
684
|
/**
|
|
1347
685
|
* Similar block - find similar content via vector search
|
|
@@ -1358,7 +696,7 @@ interface SimilarBlock {
|
|
|
1358
696
|
/** Field mapping for results */
|
|
1359
697
|
fields?: SelectMapping;
|
|
1360
698
|
/** Maximum results */
|
|
1361
|
-
limit?: number
|
|
699
|
+
limit?: Parameterizable<number>;
|
|
1362
700
|
}
|
|
1363
701
|
/**
|
|
1364
702
|
* Include sub-queries for additional data
|
|
@@ -1367,7 +705,7 @@ interface IncludeSubQuery {
|
|
|
1367
705
|
source: string;
|
|
1368
706
|
where?: WhereCondition;
|
|
1369
707
|
sort?: SortCondition;
|
|
1370
|
-
limit?: number
|
|
708
|
+
limit?: Parameterizable<number>;
|
|
1371
709
|
select?: SelectMapping;
|
|
1372
710
|
}
|
|
1373
711
|
type IncludeSubQueries = Record<string, IncludeSubQuery>;
|
|
@@ -1395,6 +733,10 @@ interface QueryConfig {
|
|
|
1395
733
|
select?: SelectMapping;
|
|
1396
734
|
/** Cache policy */
|
|
1397
735
|
cache?: CachePolicy;
|
|
736
|
+
/** Types and constraints for the parameters the query already declares by using them */
|
|
737
|
+
parameters?: QueryParameter[];
|
|
738
|
+
/** Whether the response is the record itself or a list. Defaults to `many` */
|
|
739
|
+
cardinality?: QueryCardinality;
|
|
1398
740
|
}
|
|
1399
741
|
/**
|
|
1400
742
|
* Query definition
|
|
@@ -1412,6 +754,8 @@ interface QueryDefinition {
|
|
|
1412
754
|
readonly filters?: FilterDefinition;
|
|
1413
755
|
readonly select?: SelectMapping;
|
|
1414
756
|
readonly cache?: CachePolicy;
|
|
757
|
+
readonly parameters?: QueryParameter[];
|
|
758
|
+
readonly cardinality?: QueryCardinality;
|
|
1415
759
|
}
|
|
1416
760
|
/**
|
|
1417
761
|
* Define a predefined query
|
|
@@ -1945,10 +1289,6 @@ interface ViewDefinition extends ViewConfig {
|
|
|
1945
1289
|
readonly slug: string;
|
|
1946
1290
|
}
|
|
1947
1291
|
declare function defineView(id: string, config: ViewConfig): ViewDefinition;
|
|
1948
|
-
/**
|
|
1949
|
-
* Convert a view definition to JSON format for the schema
|
|
1950
|
-
*/
|
|
1951
|
-
declare function viewToJSON(view: ViewDefinition): object;
|
|
1952
1292
|
|
|
1953
1293
|
/**
|
|
1954
1294
|
* Schema definition matching @relyio/schema SchemaDefinitionSchema
|
|
@@ -2061,13 +1401,6 @@ interface TypedSchemaConfig<TContentTypes extends Record<string, ContentTypeDefi
|
|
|
2061
1401
|
* })
|
|
2062
1402
|
*/
|
|
2063
1403
|
declare function defineSchema<TContentTypes extends Record<string, ContentTypeDefinition>, TComponents extends Record<string, ComponentDefinition> = Record<string, never>, TSingletons extends Record<string, SingletonContentTypeDefinition> = Record<string, never>, TQueries extends Record<string, QueryDefinition> = Record<string, never>, TSettings extends Record<string, SettingsGroupDefinition> = Record<string, never>, TLocales extends readonly LocaleDefinition[] = readonly LocaleDefinition[], TRoles extends readonly RoleDefinition[] = readonly RoleDefinition[], TWorkflow extends WorkflowDefinition | undefined = WorkflowDefinition | undefined, TViews extends readonly ViewDefinition[] = readonly ViewDefinition[], TAssets extends Record<string, AssetTypeDefinition> = Record<string, never>>(config: TypedSchemaConfig<TContentTypes, TComponents, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets>): SchemaDefinition<TContentTypes, TComponents, TSingletons, TQueries, TSettings, TLocales, TRoles, TWorkflow, TViews, TAssets>;
|
|
2064
|
-
/**
|
|
2065
|
-
* Convert a schema definition to JSON format for the CLI
|
|
2066
|
-
*
|
|
2067
|
-
* This strips out the _tag properties and converts to the format
|
|
2068
|
-
* expected by the RelyIO backend.
|
|
2069
|
-
*/
|
|
2070
|
-
declare function schemaToJSON(schema: SchemaDefinition): object;
|
|
2071
1404
|
/**
|
|
2072
1405
|
* Type alias for any schema definition.
|
|
2073
1406
|
* Uses `any` intentionally for type inference utilities that need to accept any schema.
|
|
@@ -2098,4 +1431,4 @@ type SchemaAssetTypeNames<T extends AnySchemaDefinition> = T['assetTypes'] exten
|
|
|
2098
1431
|
*/
|
|
2099
1432
|
type SchemaLocaleCodes<T extends AnySchemaDefinition> = T['locales'] extends readonly LocaleDefinition[] ? T['locales'][number]['code'] : never;
|
|
2100
1433
|
|
|
2101
|
-
export {
|
|
1434
|
+
export { type VideoCaptionsConfig as $, type SettingsGroupConfig as A, type SettingsGroupDefinition as B, type ComponentConfig as C, type SettingsGroupMetadata as D, type InferSettingsGroup as E, defineAssetType as F, type AssetTypeConfig as G, type AssetTypeConfigWithFields as H, type InferSingletonContentType as I, type AssetTypeConfigWithFieldsets as J, type AssetTypeDefinition as K, type LocaleOptions as L, type InferAssetType as M, type ImageKindConfig as N, type FileKindConfig as O, type ImageTransform as P, type ImageFitMode as Q, type ImageOutputFormat as R, type SchemaConfig as S, type TextDirection as T, type ImageUploadConfig as U, type VideoKindConfig as V, type ImageSourceConfig as W, type ImageExifConfig as X, type VariantDefinition as Y, type VideoUploadConfig as Z, type VideoPosterConfig as _, type SchemaDefinition as a, type VideoDownloadConfig as a0, type VideoWatermarkConfig as a1, type FileUploadConfig as a2, type FileScanConfig as a3, defineRole as a4, isRoleDefinition as a5, isBuiltInRole as a6, getBuiltInRoleActions as a7, BUILT_IN_ROLES as a8, ROLE_ACTIONS as a9, type WhereCondition as aA, type WhereValue as aB, type WhereOperator as aC, type SortCondition as aD, type SortDirection as aE, type IncludeDefinition as aF, type SelectMapping as aG, type FilterDefinition as aH, type CachePolicy as aI, type CachePolicyObject as aJ, type IncludeSubQuery as aK, type IncludeSubQueries as aL, type Parameterizable as aM, type QueryParameter as aN, type QueryParameterType as aO, type QueryCardinality as aP, type InferQueryResponse as aQ, type InferQueryParams as aR, BUILT_IN_ROLE_ACTIONS as aa, type BuiltInRole as ab, type RoleAction as ac, type ResourcePermission as ad, type FieldVisibility as ae, type RoleConfig as af, type RoleDefinition as ag, defineView as ah, type ViewScopeConfig as ai, type ContentTypeScopeConfig as aj, type ContentTypesScopeConfig as ak, type EntryTypeScopeConfig as al, type AllScopeConfig as am, type ViewFilterOperator as an, type ViewFilterCondition as ao, type ViewFilterGroup as ap, type ViewFilter as aq, type ViewConfig as ar, type ViewDefinition as as, defineQuery as at, type QueryConfig as au, type QueryDefinition as av, type FetchBlock as aw, type AggregateBlock as ax, type SearchBlock as ay, type SimilarBlock as az, 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, defineLocale as i, isLocaleDefinition as j, getLocaleCodes as k, findDefaultLocale as l, getActiveLocales as m, buildFallbackChain as n, type LocaleDefinition as o, defineSingletonContentType as p, defineSingleton as q, type SingletonContentTypeDefinition as r, type SingletonMetadata as s, type InferSingleton as t, defineComponent as u, type ComponentDefinition as v, type ComponentMetadata as w, type ComponentReusabilityMetadata as x, type ComponentValidationMetadata as y, defineSettingsGroup as z };
|