@relyio/sdk 0.10.0 → 0.12.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 +135 -0
- package/dist/chunk-3DRDHXLY.js +680 -0
- package/dist/{chunk-2HP566NI.cjs → chunk-3MSFWXQL.cjs} +37 -65
- package/dist/{chunk-DC4QLAI3.cjs → chunk-DXCVO6M5.cjs} +46 -59
- package/dist/chunk-FI5VIF4M.cjs +686 -0
- package/dist/{chunk-2L5JUW7O.js → chunk-FRJEUAAF.js} +46 -59
- package/dist/{chunk-IGHYC2WM.js → chunk-POEEDYFM.js} +38 -65
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +5 -4
- package/dist/client/index.d.ts +5 -4
- package/dist/client/index.js +1 -1
- package/dist/{define-schema-rbTrXxNN.d.ts → define-schema-DgctHlI2.d.cts} +50 -229
- package/dist/{define-schema-W-0u1Jg1.d.cts → define-schema-mrEZbY1h.d.ts} +50 -229
- package/dist/{define-content-type-DfnTu26S.d.cts → include-paths-CL4gHv6I.d.cts} +1691 -739
- package/dist/{define-content-type-DfnTu26S.d.ts → include-paths-CrJNTsMl.d.ts} +1691 -739
- package/dist/{index-B9hDmCho.d.ts → index-B9RfZVF1.d.ts} +3 -2
- package/dist/{index-KuYgc7eG.d.cts → index-BrvEg6-A.d.cts} +110 -49
- package/dist/{index-rLEBSFvK.d.ts → index-Pw0onkJe.d.ts} +110 -49
- package/dist/{index-NnLCwSqF.d.cts → index-b-AkfTUv.d.cts} +3 -2
- package/dist/index.cjs +102 -85
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +4 -3
- package/dist/rich-text/index.cjs +29 -0
- package/dist/rich-text/index.d.cts +148 -0
- package/dist/rich-text/index.d.ts +148 -0
- package/dist/rich-text/index.js +4 -0
- package/dist/rich-text.d-rKmpgdGd.d.cts +200 -0
- package/dist/rich-text.d-rKmpgdGd.d.ts +200 -0
- package/dist/schema/index.cjs +34 -38
- package/dist/schema/index.d.cts +86 -38
- package/dist/schema/index.d.ts +86 -38
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/package.json +8 -2
- package/dist/.tsbuildinfo +0 -1
package/dist/schema/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { F as FieldUIConfig, a as FieldAIConfig, b as FieldRule, L as LocalizationConfig, S as ShortTextConfig, c as FieldDefinition, d as LongTextConfig, R as RichTextConfig, e as SlugConfig, U as UrlConfig, E as EmailConfig, I as IntegerConfig, D as DecimalConfig, B as BooleanConfig, f as EnumConfig, g as DateConfig, h as DateTimeConfig, i as ReferenceConfig,
|
|
3
|
-
export {
|
|
1
|
+
export { _ as AggregateBlock, H as AllScopeConfig, B as BUILT_IN_ROLES, v as BUILT_IN_ROLE_ACTIONS, w as BuiltInRole, ab as CachePolicy, ac as CachePolicyObject, D as ContentTypeScopeConfig, E as ContentTypesScopeConfig, G as EntryTypeScopeConfig, Z as FetchBlock, F as FieldVisibility, aa as FilterDefinition, Y as FullTextSearch, a3 as HavingOperator, a7 as IncludeDefinition, a8 as IncludeRelationship, ae as IncludeSubQueries, ad as IncludeSubQuery, ak as InferQueryParams, aj as InferQueryResponse, q as LocaleDefinition, L as LocaleOptions, af as Parameterizable, ai as QueryCardinality, U as QueryConfig, W as QueryDefinition, ag as QueryParameter, ah as QueryParameterType, a4 as QueryScalar, X as QueryType, R as ROLE_ACTIONS, y as ResourcePermission, x as RoleAction, z as RoleConfig, A as RoleDefinition, h as SchemaAssetTypeNames, S as SchemaConfig, b as SchemaContentTypeNames, a as SchemaDefinition, i as SchemaEntry, j as SchemaEntryOf, f as SchemaLocaleCodes, e as SchemaQueryNames, g as SchemaSettingsGroupNames, c as SchemaSingletonNames, $ as SearchBlock, a9 as SelectMapping, a5 as SortCondition, a6 as SortDirection, T as TextDirection, O as ViewConfig, P as ViewDefinition, N as ViewFilter, M as ViewFilterCondition, I as ViewFilterOperator, K as ViewFilterRelativeDate, J as ViewFilterValue, V as ViewScopeConfig, a0 as WhereCondition, a2 as WhereOperator, a1 as WhereValue, p as buildFallbackChain, k as defineLocale, Q as defineQuery, r as defineRole, d as defineSchema, C as defineView, n as findDefaultLocale, o as getActiveLocales, u as getBuiltInRoleActions, m as getLocaleCodes, t as isBuiltInRole, l as isLocaleDefinition, s as isRoleDefinition } from '../define-schema-DgctHlI2.cjs';
|
|
2
|
+
import { F as FieldUIConfig, a as FieldAIConfig, b as FieldRule, L as LocalizationConfig, S as ShortTextConfig, c as FieldDefinition, d as LongTextConfig, R as RichTextConfig, T as TableConfig, C as CodeConfig, e as SlugConfig, U as UrlConfig, E as EmailConfig, I as IntegerConfig, D as DecimalConfig, B as BooleanConfig, f as EnumConfig, g as DateConfig, h as DateTimeConfig, i as ReferenceConfig, j as TagsConfig, A as AnyFieldset, k as ListConfig, O as ObjectConfig, l as AIConfig, m as AnyFieldDefinition, n as AssetAIConfig, o as BaseFieldConfig, p as FieldType, q as ReadOnlyRule, r as RequirementRule, s as RuleCondition, t as RuleConditions, V as ValidationRule, u as VisibilityRule } from '../include-paths-CL4gHv6I.cjs';
|
|
3
|
+
export { J as AssetReading, al as AssetTypeConfig, am as AssetTypeDefinition, G as BlockOf, N as CheckInclude, M as CheckedIncludes, P as ContentReading, a3 as ContentTypeConfig, a4 as ContentTypeDefinition, aV as ContentTypeWorkflowConfig, y as DeclaredFields, a5 as EntryMetadata, a2 as FieldMember, v as FieldSchemaContext, w as FieldValue, x as FieldValues, a1 as Fieldset, aq as FileKindConfig, aE as FileScanConfig, aD as FileUploadConfig, aw as ImageExifConfig, as as ImageFitMode, ao as ImageKindConfig, at as ImageOutputFormat, av as ImageSourceConfig, ar as ImageTransform, au as ImageUploadConfig, Q as IncludablePaths, an as InferAssetType, a6 as InferContentType, aj as InferSettingsGroup, ae as InferSingleton, ad as InferSingletonContentType, K as Keyed, a7 as LocalePublicationFields, X as ReadWith, W as Reading, ag as SettingsGroupConfig, ah as SettingsGroupDefinition, ai as SettingsGroupMetadata, Y as SettingsReading, H as ShapeValue, aa as SingletonConfig, ab as SingletonContentTypeDefinition, ac as SingletonMetadata, Z as SingletonReading, z as UnresolvedEntry, _ as UntypedReading, ax as VariantDefinition, aA as VideoCaptionsConfig, aB as VideoDownloadConfig, ap as VideoKindConfig, az as VideoPosterConfig, ay as VideoUploadConfig, aC as VideoWatermarkConfig, aQ as WorkflowAutoAssign, aT as WorkflowConfig, aU as WorkflowDefinition, aP as WorkflowEscalation, aR as WorkflowStageConfig, aS as WorkflowStageDefinition, ak as defineAssetType, $ as defineContentType, aH as defineContentTypeWorkflow, af as defineSettingsGroup, a9 as defineSingleton, a8 as defineSingletonContentType, aF as defineWorkflow, aG as defineWorkflowStage, a0 as fieldset, aL as findWorkflowStage, aN as getFirstWorkflowStage, aM as getNextWorkflowStage, aK as getWorkflowStageIds, aO as isFinalWorkflowStage, aI as isWorkflowDefinition, aJ as isWorkflowStageDefinition } from '../include-paths-CL4gHv6I.cjs';
|
|
4
|
+
import '../rich-text.d-rKmpgdGd.cjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Field builders for defining schema fields
|
|
@@ -8,7 +9,7 @@ export { a5 as AssetTypeConfig, a6 as AssetTypeConfigWithFields, a7 as AssetType
|
|
|
8
9
|
*
|
|
9
10
|
* All builders are generic over the ID to preserve literal types for type inference. `enum`,
|
|
10
11
|
* `reference` and `list` are generic over the parts of their config a read's type depends on too —
|
|
11
|
-
* the option values, the targets, `multi` and the
|
|
12
|
+
* the option values, the targets, `multi` and the list's shape — each through a type parameter with a
|
|
12
13
|
* primitive or field constraint, which is what keeps a literal from widening without a `const`
|
|
13
14
|
* type parameter (the package supports TypeScript 4.9, which has none).
|
|
14
15
|
*/
|
|
@@ -29,51 +30,73 @@ interface FieldOptions<TConfig> {
|
|
|
29
30
|
/** Whether this field is deprecated */
|
|
30
31
|
deprecated?: boolean;
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* `required`, kept as the literal it was written as, so a read's type knows which fields are always
|
|
35
|
+
* present (`schema/infer-fields.ts`, REL-1795) — through a type parameter with a primitive
|
|
36
|
+
* constraint, as `multi` is, so `true` does not widen to `boolean`.
|
|
37
|
+
*/
|
|
38
|
+
type RequiredAs<TRequired extends boolean> = {
|
|
39
|
+
required?: TRequired;
|
|
40
|
+
};
|
|
32
41
|
/**
|
|
33
42
|
* Short text field (single line)
|
|
34
43
|
* @example fields.shortText('title', { config: { required: true, maxLength: 200 } })
|
|
35
44
|
*/
|
|
36
|
-
declare function shortText<TId extends string>(id: TId, options?: FieldOptions<ShortTextConfig
|
|
45
|
+
declare function shortText<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<ShortTextConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'shortText', ShortTextConfig & RequiredAs<TRequired>>;
|
|
37
46
|
/**
|
|
38
47
|
* Long text field (multi-line textarea)
|
|
39
48
|
* @example fields.longText('description', { config: { maxLength: 5000 } })
|
|
40
49
|
*/
|
|
41
|
-
declare function longText<TId extends string>(id: TId, options?: FieldOptions<LongTextConfig
|
|
50
|
+
declare function longText<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<LongTextConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'longText', LongTextConfig & RequiredAs<TRequired>>;
|
|
51
|
+
/**
|
|
52
|
+
* Rich text: the docs set of built-ins, narrowed by `structure`, `marks` and `multiline`
|
|
53
|
+
* @example fields.richText('content', { config: { structure: ['heading', 'bulletList'], marks: ['bold', 'italic', 'link'] } })
|
|
54
|
+
*/
|
|
55
|
+
declare function richText<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<RichTextConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'richText', RichTextConfig & RequiredAs<TRequired>>;
|
|
56
|
+
/**
|
|
57
|
+
* A table: exactly a rich-text table block's value — rows of formatted cells, an optional header row
|
|
58
|
+
* and per-cell alignment — so a comparison table on a page and a table in a doc are one thing
|
|
59
|
+
* (REL-1806). Read as `RichTextTable`; `<RichText>` and `richTextToHtml` render it.
|
|
60
|
+
* @example fields.table('comparison', { config: { required: true } })
|
|
61
|
+
*/
|
|
62
|
+
declare function table<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<TableConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'table', TableConfig & RequiredAs<TRequired>>;
|
|
42
63
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
64
|
+
* Code with tabs: exactly a rich-text code group's value — one tab or more, each with its label,
|
|
65
|
+
* language, filename and line range (REL-1806). Read as `RichTextCodeGroup`; `<RichText>` and
|
|
66
|
+
* `richTextToHtml` render it.
|
|
67
|
+
* @example fields.code('snippet', { config: { languages: ['typescript', 'bash'], maxTabs: 4 } })
|
|
45
68
|
*/
|
|
46
|
-
declare function
|
|
69
|
+
declare function code<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<CodeConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'code', CodeConfig & RequiredAs<TRequired>>;
|
|
47
70
|
/**
|
|
48
71
|
* Slug field (URL-friendly identifier)
|
|
49
72
|
* @example fields.slug('slug', { config: { sourceField: 'title' } })
|
|
50
73
|
*/
|
|
51
|
-
declare function slug<TId extends string>(id: TId, options?: FieldOptions<SlugConfig
|
|
74
|
+
declare function slug<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<SlugConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'slug', SlugConfig & RequiredAs<TRequired>>;
|
|
52
75
|
/**
|
|
53
76
|
* URL field with validation
|
|
54
77
|
* @example fields.url('website', { config: { allowedProtocols: ['https'] } })
|
|
55
78
|
*/
|
|
56
|
-
declare function url<TId extends string>(id: TId, options?: FieldOptions<UrlConfig
|
|
79
|
+
declare function url<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<UrlConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'url', UrlConfig & RequiredAs<TRequired>>;
|
|
57
80
|
/**
|
|
58
81
|
* Email field with validation
|
|
59
82
|
* @example fields.email('contactEmail', { config: { required: true } })
|
|
60
83
|
*/
|
|
61
|
-
declare function email<TId extends string>(id: TId, options?: FieldOptions<EmailConfig
|
|
84
|
+
declare function email<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<EmailConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'email', EmailConfig & RequiredAs<TRequired>>;
|
|
62
85
|
/**
|
|
63
86
|
* Integer field
|
|
64
87
|
* @example fields.integer('quantity', { config: { min: 0, max: 100 } })
|
|
65
88
|
*/
|
|
66
|
-
declare function integer<TId extends string>(id: TId, options?: FieldOptions<IntegerConfig
|
|
89
|
+
declare function integer<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<IntegerConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'integer', IntegerConfig & RequiredAs<TRequired>>;
|
|
67
90
|
/**
|
|
68
91
|
* Decimal field with precision
|
|
69
92
|
* @example fields.decimal('weight', { config: { decimalPlaces: 2, min: 0 } })
|
|
70
93
|
*/
|
|
71
|
-
declare function decimal<TId extends string>(id: TId, options?: FieldOptions<DecimalConfig
|
|
94
|
+
declare function decimal<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<DecimalConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'decimal', DecimalConfig & RequiredAs<TRequired>>;
|
|
72
95
|
/**
|
|
73
96
|
* Boolean field (true/false toggle)
|
|
74
97
|
* @example fields.boolean('isActive', { config: { defaultValue: false } })
|
|
75
98
|
*/
|
|
76
|
-
declare function boolean<TId extends string>(id: TId, options?: FieldOptions<BooleanConfig
|
|
99
|
+
declare function boolean<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<BooleanConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'boolean', BooleanConfig & RequiredAs<TRequired>>;
|
|
77
100
|
/**
|
|
78
101
|
* Enum field with predefined options
|
|
79
102
|
* @example fields.enum('status', {
|
|
@@ -85,49 +108,72 @@ declare function boolean<TId extends string>(id: TId, options?: FieldOptions<Boo
|
|
|
85
108
|
* }
|
|
86
109
|
* })
|
|
87
110
|
*/
|
|
88
|
-
declare function enumField<TId extends string, TValue extends string = string, TMulti extends boolean = false>(id: TId, options?: FieldOptions<EnumConfig<TValue, TMulti>>): FieldDefinition<TId, 'enum', EnumConfig<TValue, TMulti>>;
|
|
111
|
+
declare function enumField<TId extends string, TValue extends string = string, TMulti extends boolean = false, TRequired extends boolean = false>(id: TId, options?: FieldOptions<EnumConfig<TValue, TMulti> & RequiredAs<TRequired>>): FieldDefinition<TId, 'enum', EnumConfig<TValue, TMulti> & RequiredAs<TRequired>>;
|
|
89
112
|
/**
|
|
90
113
|
* Date field (no time)
|
|
91
114
|
* @example fields.date('publishDate', { config: { minDate: '2024-01-01' } })
|
|
92
115
|
*/
|
|
93
|
-
declare function date<TId extends string>(id: TId, options?: FieldOptions<DateConfig
|
|
116
|
+
declare function date<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<DateConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'date', DateConfig & RequiredAs<TRequired>>;
|
|
94
117
|
/**
|
|
95
|
-
* DateTime field, stored in UTC
|
|
118
|
+
* DateTime field: an instant, stored and read back in UTC whatever offset it is written in.
|
|
119
|
+
* `timeZoneHandling` says whether the editor shows it in UTC or in the author's local time.
|
|
96
120
|
* @example fields.dateTime('createdAt', { config: { timeZoneHandling: 'UTC' } })
|
|
97
121
|
*/
|
|
98
|
-
declare function dateTime<TId extends string>(id: TId, options?: FieldOptions<DateTimeConfig
|
|
122
|
+
declare function dateTime<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<DateTimeConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'dateTime', DateTimeConfig & RequiredAs<TRequired>>;
|
|
99
123
|
/**
|
|
100
124
|
* Reference to other entries (content types or asset types)
|
|
101
125
|
* @example fields.reference('category', { config: { to: 'category' } })
|
|
102
126
|
* @example fields.reference('relatedItems', { config: { to: ['product', 'service'], multi: true } })
|
|
103
127
|
* @example fields.reference('heroImage', { config: { to: 'productPhoto' } })
|
|
104
128
|
*/
|
|
105
|
-
declare function reference<TId extends string, TTo extends string = string, TMulti extends boolean = false>(id: TId, options?: FieldOptions<ReferenceConfig<TTo, TMulti>>): FieldDefinition<TId, 'reference', ReferenceConfig<TTo, TMulti>>;
|
|
129
|
+
declare function reference<TId extends string, TTo extends string = string, TMulti extends boolean = false, TRequired extends boolean = false>(id: TId, options?: FieldOptions<ReferenceConfig<TTo, TMulti> & RequiredAs<TRequired>>): FieldDefinition<TId, 'reference', ReferenceConfig<TTo, TMulti> & RequiredAs<TRequired>>;
|
|
106
130
|
/**
|
|
107
131
|
* Tags field (array of strings with autocomplete)
|
|
108
132
|
* @example fields.tags('keywords', { config: { predefinedTags: ['featured', 'sale'], maxTags: 10 } })
|
|
109
133
|
*/
|
|
110
|
-
declare function tags<TId extends string>(id: TId, options?: FieldOptions<TagsConfig
|
|
134
|
+
declare function tags<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<TagsConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'tags', TagsConfig & RequiredAs<TRequired>>;
|
|
111
135
|
/**
|
|
112
|
-
* List field
|
|
136
|
+
* List field: a repeatable group of one shape. Each item holds the fields of the fieldset `of`
|
|
137
|
+
* names — usually a `fieldset()` value, declared once and passed wherever it is wanted — plus
|
|
138
|
+
* `_type` (that fieldset's id) and `_key` (its item key). Without `of`, a list of strings.
|
|
113
139
|
* @example fields.list('specifications', {
|
|
114
140
|
* config: {
|
|
115
141
|
* minItems: 1,
|
|
116
142
|
* maxItems: 20,
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
143
|
+
* of: {
|
|
144
|
+
* id: 'spec',
|
|
145
|
+
* displayName: 'Specification',
|
|
146
|
+
* fields: [
|
|
147
|
+
* fields.shortText('name', { config: { required: true } }),
|
|
148
|
+
* fields.shortText('value', { config: { required: true } }),
|
|
149
|
+
* ],
|
|
150
|
+
* },
|
|
151
|
+
* },
|
|
122
152
|
* })
|
|
123
153
|
*/
|
|
124
|
-
declare function list<TId extends string,
|
|
154
|
+
declare function list<TId extends string, TShape extends AnyFieldset = never, TRequired extends boolean = false>(id: TId, options?: FieldOptions<ListConfig<TShape> & RequiredAs<TRequired>>): FieldDefinition<TId, 'list', ListConfig<TShape> & RequiredAs<TRequired>>;
|
|
125
155
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
156
|
+
* Object field: one value of a shape. It holds the fields of the fieldset `of` names — usually a
|
|
157
|
+
* `fieldset()` value, declared once and passed wherever it is wanted — plus `_type` (that
|
|
158
|
+
* fieldset's id) and `_key`. Or of one of several shapes, `_type` saying which (REL-1799).
|
|
159
|
+
* @example fields.object('seo', {
|
|
160
|
+
* config: {
|
|
161
|
+
* of: { id: 'seo', displayName: 'SEO', fields: [fields.shortText('metaTitle')] },
|
|
162
|
+
* },
|
|
163
|
+
* })
|
|
164
|
+
* @example fields.object('media', {
|
|
165
|
+
* config: {
|
|
166
|
+
* required: true,
|
|
167
|
+
* of: [
|
|
168
|
+
* { id: 'screenshot', displayName: 'Screenshot', fields: [fields.reference('image', { config: { to: 'image' } })] },
|
|
169
|
+
* { id: 'video', displayName: 'Video', fields: [fields.url('src', { config: { required: true } })] },
|
|
170
|
+
* ],
|
|
171
|
+
* },
|
|
172
|
+
* })
|
|
129
173
|
*/
|
|
130
|
-
declare function
|
|
174
|
+
declare function object<TId extends string, TShape extends AnyFieldset, TRequired extends boolean = false>(id: TId, options: Omit<FieldOptions<ObjectConfig<TShape> & RequiredAs<TRequired>>, 'config'> & {
|
|
175
|
+
config: ObjectConfig<TShape> & RequiredAs<TRequired>;
|
|
176
|
+
}): FieldDefinition<TId, 'object', ObjectConfig<TShape> & RequiredAs<TRequired>>;
|
|
131
177
|
|
|
132
178
|
/**
|
|
133
179
|
* Field builders for defining schema fields
|
|
@@ -144,13 +190,11 @@ declare function component<TId extends string, TComponentId extends string>(id:
|
|
|
144
190
|
*/
|
|
145
191
|
|
|
146
192
|
declare const fieldBuilders_AIConfig: typeof AIConfig;
|
|
147
|
-
declare const fieldBuilders_AllFieldTypes: typeof AllFieldTypes;
|
|
148
193
|
declare const fieldBuilders_AnyFieldDefinition: typeof AnyFieldDefinition;
|
|
149
194
|
declare const fieldBuilders_AssetAIConfig: typeof AssetAIConfig;
|
|
150
195
|
declare const fieldBuilders_BaseFieldConfig: typeof BaseFieldConfig;
|
|
151
196
|
declare const fieldBuilders_BooleanConfig: typeof BooleanConfig;
|
|
152
|
-
declare const
|
|
153
|
-
declare const fieldBuilders_ComponentFieldType: typeof ComponentFieldType;
|
|
197
|
+
declare const fieldBuilders_CodeConfig: typeof CodeConfig;
|
|
154
198
|
declare const fieldBuilders_DateConfig: typeof DateConfig;
|
|
155
199
|
declare const fieldBuilders_DateTimeConfig: typeof DateTimeConfig;
|
|
156
200
|
declare const fieldBuilders_DecimalConfig: typeof DecimalConfig;
|
|
@@ -165,6 +209,7 @@ declare const fieldBuilders_IntegerConfig: typeof IntegerConfig;
|
|
|
165
209
|
declare const fieldBuilders_ListConfig: typeof ListConfig;
|
|
166
210
|
declare const fieldBuilders_LocalizationConfig: typeof LocalizationConfig;
|
|
167
211
|
declare const fieldBuilders_LongTextConfig: typeof LongTextConfig;
|
|
212
|
+
declare const fieldBuilders_ObjectConfig: typeof ObjectConfig;
|
|
168
213
|
declare const fieldBuilders_ReadOnlyRule: typeof ReadOnlyRule;
|
|
169
214
|
declare const fieldBuilders_ReferenceConfig: typeof ReferenceConfig;
|
|
170
215
|
declare const fieldBuilders_RequirementRule: typeof RequirementRule;
|
|
@@ -173,12 +218,13 @@ declare const fieldBuilders_RuleCondition: typeof RuleCondition;
|
|
|
173
218
|
declare const fieldBuilders_RuleConditions: typeof RuleConditions;
|
|
174
219
|
declare const fieldBuilders_ShortTextConfig: typeof ShortTextConfig;
|
|
175
220
|
declare const fieldBuilders_SlugConfig: typeof SlugConfig;
|
|
221
|
+
declare const fieldBuilders_TableConfig: typeof TableConfig;
|
|
176
222
|
declare const fieldBuilders_TagsConfig: typeof TagsConfig;
|
|
177
223
|
declare const fieldBuilders_UrlConfig: typeof UrlConfig;
|
|
178
224
|
declare const fieldBuilders_ValidationRule: typeof ValidationRule;
|
|
179
225
|
declare const fieldBuilders_VisibilityRule: typeof VisibilityRule;
|
|
180
226
|
declare const fieldBuilders_boolean: typeof boolean;
|
|
181
|
-
declare const
|
|
227
|
+
declare const fieldBuilders_code: typeof code;
|
|
182
228
|
declare const fieldBuilders_date: typeof date;
|
|
183
229
|
declare const fieldBuilders_dateTime: typeof dateTime;
|
|
184
230
|
declare const fieldBuilders_decimal: typeof decimal;
|
|
@@ -186,14 +232,16 @@ declare const fieldBuilders_email: typeof email;
|
|
|
186
232
|
declare const fieldBuilders_integer: typeof integer;
|
|
187
233
|
declare const fieldBuilders_list: typeof list;
|
|
188
234
|
declare const fieldBuilders_longText: typeof longText;
|
|
235
|
+
declare const fieldBuilders_object: typeof object;
|
|
189
236
|
declare const fieldBuilders_reference: typeof reference;
|
|
190
237
|
declare const fieldBuilders_richText: typeof richText;
|
|
191
238
|
declare const fieldBuilders_shortText: typeof shortText;
|
|
192
239
|
declare const fieldBuilders_slug: typeof slug;
|
|
240
|
+
declare const fieldBuilders_table: typeof table;
|
|
193
241
|
declare const fieldBuilders_tags: typeof tags;
|
|
194
242
|
declare const fieldBuilders_url: typeof url;
|
|
195
243
|
declare namespace fieldBuilders {
|
|
196
|
-
export { fieldBuilders_AIConfig as AIConfig,
|
|
244
|
+
export { fieldBuilders_AIConfig as AIConfig, fieldBuilders_AnyFieldDefinition as AnyFieldDefinition, fieldBuilders_AssetAIConfig as AssetAIConfig, fieldBuilders_BaseFieldConfig as BaseFieldConfig, fieldBuilders_BooleanConfig as BooleanConfig, fieldBuilders_CodeConfig as CodeConfig, fieldBuilders_DateConfig as DateConfig, fieldBuilders_DateTimeConfig as DateTimeConfig, fieldBuilders_DecimalConfig as DecimalConfig, fieldBuilders_EmailConfig as EmailConfig, fieldBuilders_EnumConfig as EnumConfig, fieldBuilders_FieldAIConfig as FieldAIConfig, fieldBuilders_FieldDefinition as FieldDefinition, fieldBuilders_FieldRule as FieldRule, fieldBuilders_FieldType as FieldType, fieldBuilders_FieldUIConfig as FieldUIConfig, fieldBuilders_IntegerConfig as IntegerConfig, fieldBuilders_ListConfig as ListConfig, fieldBuilders_LocalizationConfig as LocalizationConfig, fieldBuilders_LongTextConfig as LongTextConfig, fieldBuilders_ObjectConfig as ObjectConfig, fieldBuilders_ReadOnlyRule as ReadOnlyRule, fieldBuilders_ReferenceConfig as ReferenceConfig, fieldBuilders_RequirementRule as RequirementRule, fieldBuilders_RichTextConfig as RichTextConfig, fieldBuilders_RuleCondition as RuleCondition, fieldBuilders_RuleConditions as RuleConditions, fieldBuilders_ShortTextConfig as ShortTextConfig, fieldBuilders_SlugConfig as SlugConfig, fieldBuilders_TableConfig as TableConfig, fieldBuilders_TagsConfig as TagsConfig, fieldBuilders_UrlConfig as UrlConfig, fieldBuilders_ValidationRule as ValidationRule, fieldBuilders_VisibilityRule as VisibilityRule, fieldBuilders_boolean as boolean, fieldBuilders_code as code, fieldBuilders_date as date, fieldBuilders_dateTime as dateTime, fieldBuilders_decimal as decimal, fieldBuilders_email as email, enumField as enum, fieldBuilders_integer as integer, fieldBuilders_list as list, fieldBuilders_longText as longText, fieldBuilders_object as object, fieldBuilders_reference as reference, fieldBuilders_richText as richText, fieldBuilders_shortText as shortText, fieldBuilders_slug as slug, fieldBuilders_table as table, fieldBuilders_tags as tags, fieldBuilders_url as url };
|
|
197
245
|
}
|
|
198
246
|
|
|
199
247
|
/**
|
|
@@ -227,4 +275,4 @@ declare namespace fieldBuilders {
|
|
|
227
275
|
|
|
228
276
|
declare const fields: typeof fieldBuilders;
|
|
229
277
|
|
|
230
|
-
export { AIConfig,
|
|
278
|
+
export { AIConfig, AssetAIConfig, BaseFieldConfig, BooleanConfig, CodeConfig, DateConfig, DateTimeConfig, DecimalConfig, EmailConfig, EnumConfig, FieldAIConfig, FieldDefinition, FieldRule, FieldType, FieldUIConfig, IntegerConfig, ListConfig, LocalizationConfig, LongTextConfig, ObjectConfig, ReadOnlyRule, ReferenceConfig, RequirementRule, RichTextConfig, RuleCondition, RuleConditions, ShortTextConfig, SlugConfig, TableConfig, TagsConfig, UrlConfig, ValidationRule, VisibilityRule, fields };
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import { F as FieldUIConfig, a as FieldAIConfig, b as FieldRule, L as LocalizationConfig, S as ShortTextConfig, c as FieldDefinition, d as LongTextConfig, R as RichTextConfig, e as SlugConfig, U as UrlConfig, E as EmailConfig, I as IntegerConfig, D as DecimalConfig, B as BooleanConfig, f as EnumConfig, g as DateConfig, h as DateTimeConfig, i as ReferenceConfig,
|
|
3
|
-
export {
|
|
1
|
+
export { _ as AggregateBlock, H as AllScopeConfig, B as BUILT_IN_ROLES, v as BUILT_IN_ROLE_ACTIONS, w as BuiltInRole, ab as CachePolicy, ac as CachePolicyObject, D as ContentTypeScopeConfig, E as ContentTypesScopeConfig, G as EntryTypeScopeConfig, Z as FetchBlock, F as FieldVisibility, aa as FilterDefinition, Y as FullTextSearch, a3 as HavingOperator, a7 as IncludeDefinition, a8 as IncludeRelationship, ae as IncludeSubQueries, ad as IncludeSubQuery, ak as InferQueryParams, aj as InferQueryResponse, q as LocaleDefinition, L as LocaleOptions, af as Parameterizable, ai as QueryCardinality, U as QueryConfig, W as QueryDefinition, ag as QueryParameter, ah as QueryParameterType, a4 as QueryScalar, X as QueryType, R as ROLE_ACTIONS, y as ResourcePermission, x as RoleAction, z as RoleConfig, A as RoleDefinition, h as SchemaAssetTypeNames, S as SchemaConfig, b as SchemaContentTypeNames, a as SchemaDefinition, i as SchemaEntry, j as SchemaEntryOf, f as SchemaLocaleCodes, e as SchemaQueryNames, g as SchemaSettingsGroupNames, c as SchemaSingletonNames, $ as SearchBlock, a9 as SelectMapping, a5 as SortCondition, a6 as SortDirection, T as TextDirection, O as ViewConfig, P as ViewDefinition, N as ViewFilter, M as ViewFilterCondition, I as ViewFilterOperator, K as ViewFilterRelativeDate, J as ViewFilterValue, V as ViewScopeConfig, a0 as WhereCondition, a2 as WhereOperator, a1 as WhereValue, p as buildFallbackChain, k as defineLocale, Q as defineQuery, r as defineRole, d as defineSchema, C as defineView, n as findDefaultLocale, o as getActiveLocales, u as getBuiltInRoleActions, m as getLocaleCodes, t as isBuiltInRole, l as isLocaleDefinition, s as isRoleDefinition } from '../define-schema-mrEZbY1h.js';
|
|
2
|
+
import { F as FieldUIConfig, a as FieldAIConfig, b as FieldRule, L as LocalizationConfig, S as ShortTextConfig, c as FieldDefinition, d as LongTextConfig, R as RichTextConfig, T as TableConfig, C as CodeConfig, e as SlugConfig, U as UrlConfig, E as EmailConfig, I as IntegerConfig, D as DecimalConfig, B as BooleanConfig, f as EnumConfig, g as DateConfig, h as DateTimeConfig, i as ReferenceConfig, j as TagsConfig, A as AnyFieldset, k as ListConfig, O as ObjectConfig, l as AIConfig, m as AnyFieldDefinition, n as AssetAIConfig, o as BaseFieldConfig, p as FieldType, q as ReadOnlyRule, r as RequirementRule, s as RuleCondition, t as RuleConditions, V as ValidationRule, u as VisibilityRule } from '../include-paths-CrJNTsMl.js';
|
|
3
|
+
export { J as AssetReading, al as AssetTypeConfig, am as AssetTypeDefinition, G as BlockOf, N as CheckInclude, M as CheckedIncludes, P as ContentReading, a3 as ContentTypeConfig, a4 as ContentTypeDefinition, aV as ContentTypeWorkflowConfig, y as DeclaredFields, a5 as EntryMetadata, a2 as FieldMember, v as FieldSchemaContext, w as FieldValue, x as FieldValues, a1 as Fieldset, aq as FileKindConfig, aE as FileScanConfig, aD as FileUploadConfig, aw as ImageExifConfig, as as ImageFitMode, ao as ImageKindConfig, at as ImageOutputFormat, av as ImageSourceConfig, ar as ImageTransform, au as ImageUploadConfig, Q as IncludablePaths, an as InferAssetType, a6 as InferContentType, aj as InferSettingsGroup, ae as InferSingleton, ad as InferSingletonContentType, K as Keyed, a7 as LocalePublicationFields, X as ReadWith, W as Reading, ag as SettingsGroupConfig, ah as SettingsGroupDefinition, ai as SettingsGroupMetadata, Y as SettingsReading, H as ShapeValue, aa as SingletonConfig, ab as SingletonContentTypeDefinition, ac as SingletonMetadata, Z as SingletonReading, z as UnresolvedEntry, _ as UntypedReading, ax as VariantDefinition, aA as VideoCaptionsConfig, aB as VideoDownloadConfig, ap as VideoKindConfig, az as VideoPosterConfig, ay as VideoUploadConfig, aC as VideoWatermarkConfig, aQ as WorkflowAutoAssign, aT as WorkflowConfig, aU as WorkflowDefinition, aP as WorkflowEscalation, aR as WorkflowStageConfig, aS as WorkflowStageDefinition, ak as defineAssetType, $ as defineContentType, aH as defineContentTypeWorkflow, af as defineSettingsGroup, a9 as defineSingleton, a8 as defineSingletonContentType, aF as defineWorkflow, aG as defineWorkflowStage, a0 as fieldset, aL as findWorkflowStage, aN as getFirstWorkflowStage, aM as getNextWorkflowStage, aK as getWorkflowStageIds, aO as isFinalWorkflowStage, aI as isWorkflowDefinition, aJ as isWorkflowStageDefinition } from '../include-paths-CrJNTsMl.js';
|
|
4
|
+
import '../rich-text.d-rKmpgdGd.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Field builders for defining schema fields
|
|
@@ -8,7 +9,7 @@ export { a5 as AssetTypeConfig, a6 as AssetTypeConfigWithFields, a7 as AssetType
|
|
|
8
9
|
*
|
|
9
10
|
* All builders are generic over the ID to preserve literal types for type inference. `enum`,
|
|
10
11
|
* `reference` and `list` are generic over the parts of their config a read's type depends on too —
|
|
11
|
-
* the option values, the targets, `multi` and the
|
|
12
|
+
* the option values, the targets, `multi` and the list's shape — each through a type parameter with a
|
|
12
13
|
* primitive or field constraint, which is what keeps a literal from widening without a `const`
|
|
13
14
|
* type parameter (the package supports TypeScript 4.9, which has none).
|
|
14
15
|
*/
|
|
@@ -29,51 +30,73 @@ interface FieldOptions<TConfig> {
|
|
|
29
30
|
/** Whether this field is deprecated */
|
|
30
31
|
deprecated?: boolean;
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* `required`, kept as the literal it was written as, so a read's type knows which fields are always
|
|
35
|
+
* present (`schema/infer-fields.ts`, REL-1795) — through a type parameter with a primitive
|
|
36
|
+
* constraint, as `multi` is, so `true` does not widen to `boolean`.
|
|
37
|
+
*/
|
|
38
|
+
type RequiredAs<TRequired extends boolean> = {
|
|
39
|
+
required?: TRequired;
|
|
40
|
+
};
|
|
32
41
|
/**
|
|
33
42
|
* Short text field (single line)
|
|
34
43
|
* @example fields.shortText('title', { config: { required: true, maxLength: 200 } })
|
|
35
44
|
*/
|
|
36
|
-
declare function shortText<TId extends string>(id: TId, options?: FieldOptions<ShortTextConfig
|
|
45
|
+
declare function shortText<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<ShortTextConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'shortText', ShortTextConfig & RequiredAs<TRequired>>;
|
|
37
46
|
/**
|
|
38
47
|
* Long text field (multi-line textarea)
|
|
39
48
|
* @example fields.longText('description', { config: { maxLength: 5000 } })
|
|
40
49
|
*/
|
|
41
|
-
declare function longText<TId extends string>(id: TId, options?: FieldOptions<LongTextConfig
|
|
50
|
+
declare function longText<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<LongTextConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'longText', LongTextConfig & RequiredAs<TRequired>>;
|
|
51
|
+
/**
|
|
52
|
+
* Rich text: the docs set of built-ins, narrowed by `structure`, `marks` and `multiline`
|
|
53
|
+
* @example fields.richText('content', { config: { structure: ['heading', 'bulletList'], marks: ['bold', 'italic', 'link'] } })
|
|
54
|
+
*/
|
|
55
|
+
declare function richText<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<RichTextConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'richText', RichTextConfig & RequiredAs<TRequired>>;
|
|
56
|
+
/**
|
|
57
|
+
* A table: exactly a rich-text table block's value — rows of formatted cells, an optional header row
|
|
58
|
+
* and per-cell alignment — so a comparison table on a page and a table in a doc are one thing
|
|
59
|
+
* (REL-1806). Read as `RichTextTable`; `<RichText>` and `richTextToHtml` render it.
|
|
60
|
+
* @example fields.table('comparison', { config: { required: true } })
|
|
61
|
+
*/
|
|
62
|
+
declare function table<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<TableConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'table', TableConfig & RequiredAs<TRequired>>;
|
|
42
63
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
64
|
+
* Code with tabs: exactly a rich-text code group's value — one tab or more, each with its label,
|
|
65
|
+
* language, filename and line range (REL-1806). Read as `RichTextCodeGroup`; `<RichText>` and
|
|
66
|
+
* `richTextToHtml` render it.
|
|
67
|
+
* @example fields.code('snippet', { config: { languages: ['typescript', 'bash'], maxTabs: 4 } })
|
|
45
68
|
*/
|
|
46
|
-
declare function
|
|
69
|
+
declare function code<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<CodeConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'code', CodeConfig & RequiredAs<TRequired>>;
|
|
47
70
|
/**
|
|
48
71
|
* Slug field (URL-friendly identifier)
|
|
49
72
|
* @example fields.slug('slug', { config: { sourceField: 'title' } })
|
|
50
73
|
*/
|
|
51
|
-
declare function slug<TId extends string>(id: TId, options?: FieldOptions<SlugConfig
|
|
74
|
+
declare function slug<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<SlugConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'slug', SlugConfig & RequiredAs<TRequired>>;
|
|
52
75
|
/**
|
|
53
76
|
* URL field with validation
|
|
54
77
|
* @example fields.url('website', { config: { allowedProtocols: ['https'] } })
|
|
55
78
|
*/
|
|
56
|
-
declare function url<TId extends string>(id: TId, options?: FieldOptions<UrlConfig
|
|
79
|
+
declare function url<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<UrlConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'url', UrlConfig & RequiredAs<TRequired>>;
|
|
57
80
|
/**
|
|
58
81
|
* Email field with validation
|
|
59
82
|
* @example fields.email('contactEmail', { config: { required: true } })
|
|
60
83
|
*/
|
|
61
|
-
declare function email<TId extends string>(id: TId, options?: FieldOptions<EmailConfig
|
|
84
|
+
declare function email<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<EmailConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'email', EmailConfig & RequiredAs<TRequired>>;
|
|
62
85
|
/**
|
|
63
86
|
* Integer field
|
|
64
87
|
* @example fields.integer('quantity', { config: { min: 0, max: 100 } })
|
|
65
88
|
*/
|
|
66
|
-
declare function integer<TId extends string>(id: TId, options?: FieldOptions<IntegerConfig
|
|
89
|
+
declare function integer<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<IntegerConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'integer', IntegerConfig & RequiredAs<TRequired>>;
|
|
67
90
|
/**
|
|
68
91
|
* Decimal field with precision
|
|
69
92
|
* @example fields.decimal('weight', { config: { decimalPlaces: 2, min: 0 } })
|
|
70
93
|
*/
|
|
71
|
-
declare function decimal<TId extends string>(id: TId, options?: FieldOptions<DecimalConfig
|
|
94
|
+
declare function decimal<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<DecimalConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'decimal', DecimalConfig & RequiredAs<TRequired>>;
|
|
72
95
|
/**
|
|
73
96
|
* Boolean field (true/false toggle)
|
|
74
97
|
* @example fields.boolean('isActive', { config: { defaultValue: false } })
|
|
75
98
|
*/
|
|
76
|
-
declare function boolean<TId extends string>(id: TId, options?: FieldOptions<BooleanConfig
|
|
99
|
+
declare function boolean<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<BooleanConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'boolean', BooleanConfig & RequiredAs<TRequired>>;
|
|
77
100
|
/**
|
|
78
101
|
* Enum field with predefined options
|
|
79
102
|
* @example fields.enum('status', {
|
|
@@ -85,49 +108,72 @@ declare function boolean<TId extends string>(id: TId, options?: FieldOptions<Boo
|
|
|
85
108
|
* }
|
|
86
109
|
* })
|
|
87
110
|
*/
|
|
88
|
-
declare function enumField<TId extends string, TValue extends string = string, TMulti extends boolean = false>(id: TId, options?: FieldOptions<EnumConfig<TValue, TMulti>>): FieldDefinition<TId, 'enum', EnumConfig<TValue, TMulti>>;
|
|
111
|
+
declare function enumField<TId extends string, TValue extends string = string, TMulti extends boolean = false, TRequired extends boolean = false>(id: TId, options?: FieldOptions<EnumConfig<TValue, TMulti> & RequiredAs<TRequired>>): FieldDefinition<TId, 'enum', EnumConfig<TValue, TMulti> & RequiredAs<TRequired>>;
|
|
89
112
|
/**
|
|
90
113
|
* Date field (no time)
|
|
91
114
|
* @example fields.date('publishDate', { config: { minDate: '2024-01-01' } })
|
|
92
115
|
*/
|
|
93
|
-
declare function date<TId extends string>(id: TId, options?: FieldOptions<DateConfig
|
|
116
|
+
declare function date<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<DateConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'date', DateConfig & RequiredAs<TRequired>>;
|
|
94
117
|
/**
|
|
95
|
-
* DateTime field, stored in UTC
|
|
118
|
+
* DateTime field: an instant, stored and read back in UTC whatever offset it is written in.
|
|
119
|
+
* `timeZoneHandling` says whether the editor shows it in UTC or in the author's local time.
|
|
96
120
|
* @example fields.dateTime('createdAt', { config: { timeZoneHandling: 'UTC' } })
|
|
97
121
|
*/
|
|
98
|
-
declare function dateTime<TId extends string>(id: TId, options?: FieldOptions<DateTimeConfig
|
|
122
|
+
declare function dateTime<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<DateTimeConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'dateTime', DateTimeConfig & RequiredAs<TRequired>>;
|
|
99
123
|
/**
|
|
100
124
|
* Reference to other entries (content types or asset types)
|
|
101
125
|
* @example fields.reference('category', { config: { to: 'category' } })
|
|
102
126
|
* @example fields.reference('relatedItems', { config: { to: ['product', 'service'], multi: true } })
|
|
103
127
|
* @example fields.reference('heroImage', { config: { to: 'productPhoto' } })
|
|
104
128
|
*/
|
|
105
|
-
declare function reference<TId extends string, TTo extends string = string, TMulti extends boolean = false>(id: TId, options?: FieldOptions<ReferenceConfig<TTo, TMulti>>): FieldDefinition<TId, 'reference', ReferenceConfig<TTo, TMulti>>;
|
|
129
|
+
declare function reference<TId extends string, TTo extends string = string, TMulti extends boolean = false, TRequired extends boolean = false>(id: TId, options?: FieldOptions<ReferenceConfig<TTo, TMulti> & RequiredAs<TRequired>>): FieldDefinition<TId, 'reference', ReferenceConfig<TTo, TMulti> & RequiredAs<TRequired>>;
|
|
106
130
|
/**
|
|
107
131
|
* Tags field (array of strings with autocomplete)
|
|
108
132
|
* @example fields.tags('keywords', { config: { predefinedTags: ['featured', 'sale'], maxTags: 10 } })
|
|
109
133
|
*/
|
|
110
|
-
declare function tags<TId extends string>(id: TId, options?: FieldOptions<TagsConfig
|
|
134
|
+
declare function tags<TId extends string, TRequired extends boolean = false>(id: TId, options?: FieldOptions<TagsConfig & RequiredAs<TRequired>>): FieldDefinition<TId, 'tags', TagsConfig & RequiredAs<TRequired>>;
|
|
111
135
|
/**
|
|
112
|
-
* List field
|
|
136
|
+
* List field: a repeatable group of one shape. Each item holds the fields of the fieldset `of`
|
|
137
|
+
* names — usually a `fieldset()` value, declared once and passed wherever it is wanted — plus
|
|
138
|
+
* `_type` (that fieldset's id) and `_key` (its item key). Without `of`, a list of strings.
|
|
113
139
|
* @example fields.list('specifications', {
|
|
114
140
|
* config: {
|
|
115
141
|
* minItems: 1,
|
|
116
142
|
* maxItems: 20,
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
143
|
+
* of: {
|
|
144
|
+
* id: 'spec',
|
|
145
|
+
* displayName: 'Specification',
|
|
146
|
+
* fields: [
|
|
147
|
+
* fields.shortText('name', { config: { required: true } }),
|
|
148
|
+
* fields.shortText('value', { config: { required: true } }),
|
|
149
|
+
* ],
|
|
150
|
+
* },
|
|
151
|
+
* },
|
|
122
152
|
* })
|
|
123
153
|
*/
|
|
124
|
-
declare function list<TId extends string,
|
|
154
|
+
declare function list<TId extends string, TShape extends AnyFieldset = never, TRequired extends boolean = false>(id: TId, options?: FieldOptions<ListConfig<TShape> & RequiredAs<TRequired>>): FieldDefinition<TId, 'list', ListConfig<TShape> & RequiredAs<TRequired>>;
|
|
125
155
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
156
|
+
* Object field: one value of a shape. It holds the fields of the fieldset `of` names — usually a
|
|
157
|
+
* `fieldset()` value, declared once and passed wherever it is wanted — plus `_type` (that
|
|
158
|
+
* fieldset's id) and `_key`. Or of one of several shapes, `_type` saying which (REL-1799).
|
|
159
|
+
* @example fields.object('seo', {
|
|
160
|
+
* config: {
|
|
161
|
+
* of: { id: 'seo', displayName: 'SEO', fields: [fields.shortText('metaTitle')] },
|
|
162
|
+
* },
|
|
163
|
+
* })
|
|
164
|
+
* @example fields.object('media', {
|
|
165
|
+
* config: {
|
|
166
|
+
* required: true,
|
|
167
|
+
* of: [
|
|
168
|
+
* { id: 'screenshot', displayName: 'Screenshot', fields: [fields.reference('image', { config: { to: 'image' } })] },
|
|
169
|
+
* { id: 'video', displayName: 'Video', fields: [fields.url('src', { config: { required: true } })] },
|
|
170
|
+
* ],
|
|
171
|
+
* },
|
|
172
|
+
* })
|
|
129
173
|
*/
|
|
130
|
-
declare function
|
|
174
|
+
declare function object<TId extends string, TShape extends AnyFieldset, TRequired extends boolean = false>(id: TId, options: Omit<FieldOptions<ObjectConfig<TShape> & RequiredAs<TRequired>>, 'config'> & {
|
|
175
|
+
config: ObjectConfig<TShape> & RequiredAs<TRequired>;
|
|
176
|
+
}): FieldDefinition<TId, 'object', ObjectConfig<TShape> & RequiredAs<TRequired>>;
|
|
131
177
|
|
|
132
178
|
/**
|
|
133
179
|
* Field builders for defining schema fields
|
|
@@ -144,13 +190,11 @@ declare function component<TId extends string, TComponentId extends string>(id:
|
|
|
144
190
|
*/
|
|
145
191
|
|
|
146
192
|
declare const fieldBuilders_AIConfig: typeof AIConfig;
|
|
147
|
-
declare const fieldBuilders_AllFieldTypes: typeof AllFieldTypes;
|
|
148
193
|
declare const fieldBuilders_AnyFieldDefinition: typeof AnyFieldDefinition;
|
|
149
194
|
declare const fieldBuilders_AssetAIConfig: typeof AssetAIConfig;
|
|
150
195
|
declare const fieldBuilders_BaseFieldConfig: typeof BaseFieldConfig;
|
|
151
196
|
declare const fieldBuilders_BooleanConfig: typeof BooleanConfig;
|
|
152
|
-
declare const
|
|
153
|
-
declare const fieldBuilders_ComponentFieldType: typeof ComponentFieldType;
|
|
197
|
+
declare const fieldBuilders_CodeConfig: typeof CodeConfig;
|
|
154
198
|
declare const fieldBuilders_DateConfig: typeof DateConfig;
|
|
155
199
|
declare const fieldBuilders_DateTimeConfig: typeof DateTimeConfig;
|
|
156
200
|
declare const fieldBuilders_DecimalConfig: typeof DecimalConfig;
|
|
@@ -165,6 +209,7 @@ declare const fieldBuilders_IntegerConfig: typeof IntegerConfig;
|
|
|
165
209
|
declare const fieldBuilders_ListConfig: typeof ListConfig;
|
|
166
210
|
declare const fieldBuilders_LocalizationConfig: typeof LocalizationConfig;
|
|
167
211
|
declare const fieldBuilders_LongTextConfig: typeof LongTextConfig;
|
|
212
|
+
declare const fieldBuilders_ObjectConfig: typeof ObjectConfig;
|
|
168
213
|
declare const fieldBuilders_ReadOnlyRule: typeof ReadOnlyRule;
|
|
169
214
|
declare const fieldBuilders_ReferenceConfig: typeof ReferenceConfig;
|
|
170
215
|
declare const fieldBuilders_RequirementRule: typeof RequirementRule;
|
|
@@ -173,12 +218,13 @@ declare const fieldBuilders_RuleCondition: typeof RuleCondition;
|
|
|
173
218
|
declare const fieldBuilders_RuleConditions: typeof RuleConditions;
|
|
174
219
|
declare const fieldBuilders_ShortTextConfig: typeof ShortTextConfig;
|
|
175
220
|
declare const fieldBuilders_SlugConfig: typeof SlugConfig;
|
|
221
|
+
declare const fieldBuilders_TableConfig: typeof TableConfig;
|
|
176
222
|
declare const fieldBuilders_TagsConfig: typeof TagsConfig;
|
|
177
223
|
declare const fieldBuilders_UrlConfig: typeof UrlConfig;
|
|
178
224
|
declare const fieldBuilders_ValidationRule: typeof ValidationRule;
|
|
179
225
|
declare const fieldBuilders_VisibilityRule: typeof VisibilityRule;
|
|
180
226
|
declare const fieldBuilders_boolean: typeof boolean;
|
|
181
|
-
declare const
|
|
227
|
+
declare const fieldBuilders_code: typeof code;
|
|
182
228
|
declare const fieldBuilders_date: typeof date;
|
|
183
229
|
declare const fieldBuilders_dateTime: typeof dateTime;
|
|
184
230
|
declare const fieldBuilders_decimal: typeof decimal;
|
|
@@ -186,14 +232,16 @@ declare const fieldBuilders_email: typeof email;
|
|
|
186
232
|
declare const fieldBuilders_integer: typeof integer;
|
|
187
233
|
declare const fieldBuilders_list: typeof list;
|
|
188
234
|
declare const fieldBuilders_longText: typeof longText;
|
|
235
|
+
declare const fieldBuilders_object: typeof object;
|
|
189
236
|
declare const fieldBuilders_reference: typeof reference;
|
|
190
237
|
declare const fieldBuilders_richText: typeof richText;
|
|
191
238
|
declare const fieldBuilders_shortText: typeof shortText;
|
|
192
239
|
declare const fieldBuilders_slug: typeof slug;
|
|
240
|
+
declare const fieldBuilders_table: typeof table;
|
|
193
241
|
declare const fieldBuilders_tags: typeof tags;
|
|
194
242
|
declare const fieldBuilders_url: typeof url;
|
|
195
243
|
declare namespace fieldBuilders {
|
|
196
|
-
export { fieldBuilders_AIConfig as AIConfig,
|
|
244
|
+
export { fieldBuilders_AIConfig as AIConfig, fieldBuilders_AnyFieldDefinition as AnyFieldDefinition, fieldBuilders_AssetAIConfig as AssetAIConfig, fieldBuilders_BaseFieldConfig as BaseFieldConfig, fieldBuilders_BooleanConfig as BooleanConfig, fieldBuilders_CodeConfig as CodeConfig, fieldBuilders_DateConfig as DateConfig, fieldBuilders_DateTimeConfig as DateTimeConfig, fieldBuilders_DecimalConfig as DecimalConfig, fieldBuilders_EmailConfig as EmailConfig, fieldBuilders_EnumConfig as EnumConfig, fieldBuilders_FieldAIConfig as FieldAIConfig, fieldBuilders_FieldDefinition as FieldDefinition, fieldBuilders_FieldRule as FieldRule, fieldBuilders_FieldType as FieldType, fieldBuilders_FieldUIConfig as FieldUIConfig, fieldBuilders_IntegerConfig as IntegerConfig, fieldBuilders_ListConfig as ListConfig, fieldBuilders_LocalizationConfig as LocalizationConfig, fieldBuilders_LongTextConfig as LongTextConfig, fieldBuilders_ObjectConfig as ObjectConfig, fieldBuilders_ReadOnlyRule as ReadOnlyRule, fieldBuilders_ReferenceConfig as ReferenceConfig, fieldBuilders_RequirementRule as RequirementRule, fieldBuilders_RichTextConfig as RichTextConfig, fieldBuilders_RuleCondition as RuleCondition, fieldBuilders_RuleConditions as RuleConditions, fieldBuilders_ShortTextConfig as ShortTextConfig, fieldBuilders_SlugConfig as SlugConfig, fieldBuilders_TableConfig as TableConfig, fieldBuilders_TagsConfig as TagsConfig, fieldBuilders_UrlConfig as UrlConfig, fieldBuilders_ValidationRule as ValidationRule, fieldBuilders_VisibilityRule as VisibilityRule, fieldBuilders_boolean as boolean, fieldBuilders_code as code, fieldBuilders_date as date, fieldBuilders_dateTime as dateTime, fieldBuilders_decimal as decimal, fieldBuilders_email as email, enumField as enum, fieldBuilders_integer as integer, fieldBuilders_list as list, fieldBuilders_longText as longText, fieldBuilders_object as object, fieldBuilders_reference as reference, fieldBuilders_richText as richText, fieldBuilders_shortText as shortText, fieldBuilders_slug as slug, fieldBuilders_table as table, fieldBuilders_tags as tags, fieldBuilders_url as url };
|
|
197
245
|
}
|
|
198
246
|
|
|
199
247
|
/**
|
|
@@ -227,4 +275,4 @@ declare namespace fieldBuilders {
|
|
|
227
275
|
|
|
228
276
|
declare const fields: typeof fieldBuilders;
|
|
229
277
|
|
|
230
|
-
export { AIConfig,
|
|
278
|
+
export { AIConfig, AssetAIConfig, BaseFieldConfig, BooleanConfig, CodeConfig, DateConfig, DateTimeConfig, DecimalConfig, EmailConfig, EnumConfig, FieldAIConfig, FieldDefinition, FieldRule, FieldType, FieldUIConfig, IntegerConfig, ListConfig, LocalizationConfig, LongTextConfig, ObjectConfig, ReadOnlyRule, ReferenceConfig, RequirementRule, RichTextConfig, RuleCondition, RuleConditions, ShortTextConfig, SlugConfig, TableConfig, TagsConfig, UrlConfig, ValidationRule, VisibilityRule, fields };
|
package/dist/schema/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BUILT_IN_ROLES, BUILT_IN_ROLE_ACTIONS, ROLE_ACTIONS, buildFallbackChain, defineAssetType,
|
|
1
|
+
export { BUILT_IN_ROLES, BUILT_IN_ROLE_ACTIONS, ROLE_ACTIONS, buildFallbackChain, defineAssetType, defineContentType, defineContentTypeWorkflow, defineLocale, defineQuery, defineRole, defineSchema, defineSettingsGroup, defineSingleton, defineSingletonContentType, defineView, defineWorkflow, defineWorkflowStage, fields, fieldset, findDefaultLocale, findWorkflowStage, getActiveLocales, getBuiltInRoleActions, getFirstWorkflowStage, getLocaleCodes, getNextWorkflowStage, getWorkflowStageIds, isBuiltInRole, isFinalWorkflowStage, isLocaleDefinition, isRoleDefinition, isWorkflowDefinition, isWorkflowStageDefinition } from '../chunk-POEEDYFM.js';
|
|
2
2
|
import '../chunk-XQ4QHWZE.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { w as ApiResponse, B as BaseContent, t as CacheConfig, y as CacheStrategy, k as ContentQueryResult, o as ContentTypeSchema, C as CreateInput, n as CustomQuery, D as DebugConfig, E as Environment, O as FieldDefinition, p as FieldOptions, F as FieldTypeName, z as LogLevel, P as PerformanceMetrics, Q as QueryOptions, u as RealtimeConfig, r as RealtimeEvent, q as RealtimeEventType, R as RelyIOConfig, v as RequestConfig, x as RetryConfig, l as SingletonContent, j as SortOptions, s as SubscriptionOptions, U as UpdateInput, V as ValidationRule, G as ValidationViolation, h as WhereClause, g as WhereFieldCondition, i as WhereOperator, f as WhereScalar } from '../index-
|
|
2
|
-
|
|
1
|
+
export { w as ApiResponse, B as BaseContent, t as CacheConfig, y as CacheStrategy, k as ContentQueryResult, o as ContentTypeSchema, C as CreateInput, n as CustomQuery, D as DebugConfig, E as Environment, O as FieldDefinition, p as FieldOptions, F as FieldTypeName, z as LogLevel, P as PerformanceMetrics, Q as QueryOptions, u as RealtimeConfig, r as RealtimeEvent, q as RealtimeEventType, R as RelyIOConfig, v as RequestConfig, x as RetryConfig, l as SingletonContent, j as SortOptions, s as SubscriptionOptions, U as UpdateInput, V as ValidationRule, G as ValidationViolation, h as WhereClause, g as WhereFieldCondition, i as WhereOperator, f as WhereScalar } from '../index-b-AkfTUv.cjs';
|
|
2
|
+
export { R as RichTextBlock, a as RichTextCellAlignment, b as RichTextCodeBlock, c as RichTextCodeGroup, d as RichTextCodeLines, e as RichTextDivider, f as RichTextHeading, g as RichTextInline, h as RichTextLineBreak, i as RichTextLinkMark, j as RichTextList, k as RichTextListItem, l as RichTextListStyle, m as RichTextMark, n as RichTextMarkType, o as RichTextNode, p as RichTextParagraph, q as RichTextQuote, r as RichTextSpan, s as RichTextStructure, t as RichTextTable, u as RichTextTableCell, v as RichTextTableRow, w as RichTextValue } from '../rich-text.d-rKmpgdGd.cjs';
|
|
3
|
+
import '../include-paths-CL4gHv6I.cjs';
|