@relyio/sdk 0.11.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 +88 -0
- package/dist/chunk-3DRDHXLY.js +680 -0
- package/dist/{chunk-PO7CUR5U.cjs → chunk-3MSFWXQL.cjs} +37 -65
- package/dist/{chunk-4HTIU5YE.cjs → chunk-DXCVO6M5.cjs} +46 -59
- package/dist/chunk-FI5VIF4M.cjs +686 -0
- package/dist/{chunk-7GLDVHIH.js → chunk-FRJEUAAF.js} +46 -59
- package/dist/{chunk-2TIJLV2X.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-CVi8nwc7.d.ts → define-schema-DgctHlI2.d.cts} +35 -220
- package/dist/{define-schema-DqpipEHv.d.cts → define-schema-mrEZbY1h.d.ts} +35 -220
- package/dist/{define-content-type-ENAod5Ve.d.cts → include-paths-CL4gHv6I.d.cts} +1673 -734
- package/dist/{define-content-type-ENAod5Ve.d.ts → include-paths-CrJNTsMl.d.ts} +1673 -734
- package/dist/{index-C73cK2Tt.d.ts → index-B9RfZVF1.d.ts} +3 -2
- package/dist/{index-MLAFUuco.d.cts → index-BrvEg6-A.d.cts} +107 -46
- package/dist/{index-BKEAYvvz.d.ts → index-Pw0onkJe.d.ts} +107 -46
- package/dist/{index-BM42r4yg.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 +84 -37
- package/dist/schema/index.d.ts +84 -37
- 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,50 +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
118
|
* DateTime field: an instant, stored and read back in UTC whatever offset it is written in.
|
|
96
119
|
* `timeZoneHandling` says whether the editor shows it in UTC or in the author's local time.
|
|
97
120
|
* @example fields.dateTime('createdAt', { config: { timeZoneHandling: 'UTC' } })
|
|
98
121
|
*/
|
|
99
|
-
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>>;
|
|
100
123
|
/**
|
|
101
124
|
* Reference to other entries (content types or asset types)
|
|
102
125
|
* @example fields.reference('category', { config: { to: 'category' } })
|
|
103
126
|
* @example fields.reference('relatedItems', { config: { to: ['product', 'service'], multi: true } })
|
|
104
127
|
* @example fields.reference('heroImage', { config: { to: 'productPhoto' } })
|
|
105
128
|
*/
|
|
106
|
-
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>>;
|
|
107
130
|
/**
|
|
108
131
|
* Tags field (array of strings with autocomplete)
|
|
109
132
|
* @example fields.tags('keywords', { config: { predefinedTags: ['featured', 'sale'], maxTags: 10 } })
|
|
110
133
|
*/
|
|
111
|
-
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>>;
|
|
112
135
|
/**
|
|
113
|
-
* 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.
|
|
114
139
|
* @example fields.list('specifications', {
|
|
115
140
|
* config: {
|
|
116
141
|
* minItems: 1,
|
|
117
142
|
* maxItems: 20,
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
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
|
+
* },
|
|
123
152
|
* })
|
|
124
153
|
*/
|
|
125
|
-
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>>;
|
|
126
155
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
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
|
+
* })
|
|
130
173
|
*/
|
|
131
|
-
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>>;
|
|
132
177
|
|
|
133
178
|
/**
|
|
134
179
|
* Field builders for defining schema fields
|
|
@@ -145,13 +190,11 @@ declare function component<TId extends string, TComponentId extends string>(id:
|
|
|
145
190
|
*/
|
|
146
191
|
|
|
147
192
|
declare const fieldBuilders_AIConfig: typeof AIConfig;
|
|
148
|
-
declare const fieldBuilders_AllFieldTypes: typeof AllFieldTypes;
|
|
149
193
|
declare const fieldBuilders_AnyFieldDefinition: typeof AnyFieldDefinition;
|
|
150
194
|
declare const fieldBuilders_AssetAIConfig: typeof AssetAIConfig;
|
|
151
195
|
declare const fieldBuilders_BaseFieldConfig: typeof BaseFieldConfig;
|
|
152
196
|
declare const fieldBuilders_BooleanConfig: typeof BooleanConfig;
|
|
153
|
-
declare const
|
|
154
|
-
declare const fieldBuilders_ComponentFieldType: typeof ComponentFieldType;
|
|
197
|
+
declare const fieldBuilders_CodeConfig: typeof CodeConfig;
|
|
155
198
|
declare const fieldBuilders_DateConfig: typeof DateConfig;
|
|
156
199
|
declare const fieldBuilders_DateTimeConfig: typeof DateTimeConfig;
|
|
157
200
|
declare const fieldBuilders_DecimalConfig: typeof DecimalConfig;
|
|
@@ -166,6 +209,7 @@ declare const fieldBuilders_IntegerConfig: typeof IntegerConfig;
|
|
|
166
209
|
declare const fieldBuilders_ListConfig: typeof ListConfig;
|
|
167
210
|
declare const fieldBuilders_LocalizationConfig: typeof LocalizationConfig;
|
|
168
211
|
declare const fieldBuilders_LongTextConfig: typeof LongTextConfig;
|
|
212
|
+
declare const fieldBuilders_ObjectConfig: typeof ObjectConfig;
|
|
169
213
|
declare const fieldBuilders_ReadOnlyRule: typeof ReadOnlyRule;
|
|
170
214
|
declare const fieldBuilders_ReferenceConfig: typeof ReferenceConfig;
|
|
171
215
|
declare const fieldBuilders_RequirementRule: typeof RequirementRule;
|
|
@@ -174,12 +218,13 @@ declare const fieldBuilders_RuleCondition: typeof RuleCondition;
|
|
|
174
218
|
declare const fieldBuilders_RuleConditions: typeof RuleConditions;
|
|
175
219
|
declare const fieldBuilders_ShortTextConfig: typeof ShortTextConfig;
|
|
176
220
|
declare const fieldBuilders_SlugConfig: typeof SlugConfig;
|
|
221
|
+
declare const fieldBuilders_TableConfig: typeof TableConfig;
|
|
177
222
|
declare const fieldBuilders_TagsConfig: typeof TagsConfig;
|
|
178
223
|
declare const fieldBuilders_UrlConfig: typeof UrlConfig;
|
|
179
224
|
declare const fieldBuilders_ValidationRule: typeof ValidationRule;
|
|
180
225
|
declare const fieldBuilders_VisibilityRule: typeof VisibilityRule;
|
|
181
226
|
declare const fieldBuilders_boolean: typeof boolean;
|
|
182
|
-
declare const
|
|
227
|
+
declare const fieldBuilders_code: typeof code;
|
|
183
228
|
declare const fieldBuilders_date: typeof date;
|
|
184
229
|
declare const fieldBuilders_dateTime: typeof dateTime;
|
|
185
230
|
declare const fieldBuilders_decimal: typeof decimal;
|
|
@@ -187,14 +232,16 @@ declare const fieldBuilders_email: typeof email;
|
|
|
187
232
|
declare const fieldBuilders_integer: typeof integer;
|
|
188
233
|
declare const fieldBuilders_list: typeof list;
|
|
189
234
|
declare const fieldBuilders_longText: typeof longText;
|
|
235
|
+
declare const fieldBuilders_object: typeof object;
|
|
190
236
|
declare const fieldBuilders_reference: typeof reference;
|
|
191
237
|
declare const fieldBuilders_richText: typeof richText;
|
|
192
238
|
declare const fieldBuilders_shortText: typeof shortText;
|
|
193
239
|
declare const fieldBuilders_slug: typeof slug;
|
|
240
|
+
declare const fieldBuilders_table: typeof table;
|
|
194
241
|
declare const fieldBuilders_tags: typeof tags;
|
|
195
242
|
declare const fieldBuilders_url: typeof url;
|
|
196
243
|
declare namespace fieldBuilders {
|
|
197
|
-
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 };
|
|
198
245
|
}
|
|
199
246
|
|
|
200
247
|
/**
|
|
@@ -228,4 +275,4 @@ declare namespace fieldBuilders {
|
|
|
228
275
|
|
|
229
276
|
declare const fields: typeof fieldBuilders;
|
|
230
277
|
|
|
231
|
-
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,50 +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
118
|
* DateTime field: an instant, stored and read back in UTC whatever offset it is written in.
|
|
96
119
|
* `timeZoneHandling` says whether the editor shows it in UTC or in the author's local time.
|
|
97
120
|
* @example fields.dateTime('createdAt', { config: { timeZoneHandling: 'UTC' } })
|
|
98
121
|
*/
|
|
99
|
-
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>>;
|
|
100
123
|
/**
|
|
101
124
|
* Reference to other entries (content types or asset types)
|
|
102
125
|
* @example fields.reference('category', { config: { to: 'category' } })
|
|
103
126
|
* @example fields.reference('relatedItems', { config: { to: ['product', 'service'], multi: true } })
|
|
104
127
|
* @example fields.reference('heroImage', { config: { to: 'productPhoto' } })
|
|
105
128
|
*/
|
|
106
|
-
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>>;
|
|
107
130
|
/**
|
|
108
131
|
* Tags field (array of strings with autocomplete)
|
|
109
132
|
* @example fields.tags('keywords', { config: { predefinedTags: ['featured', 'sale'], maxTags: 10 } })
|
|
110
133
|
*/
|
|
111
|
-
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>>;
|
|
112
135
|
/**
|
|
113
|
-
* 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.
|
|
114
139
|
* @example fields.list('specifications', {
|
|
115
140
|
* config: {
|
|
116
141
|
* minItems: 1,
|
|
117
142
|
* maxItems: 20,
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
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
|
+
* },
|
|
123
152
|
* })
|
|
124
153
|
*/
|
|
125
|
-
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>>;
|
|
126
155
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
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
|
+
* })
|
|
130
173
|
*/
|
|
131
|
-
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>>;
|
|
132
177
|
|
|
133
178
|
/**
|
|
134
179
|
* Field builders for defining schema fields
|
|
@@ -145,13 +190,11 @@ declare function component<TId extends string, TComponentId extends string>(id:
|
|
|
145
190
|
*/
|
|
146
191
|
|
|
147
192
|
declare const fieldBuilders_AIConfig: typeof AIConfig;
|
|
148
|
-
declare const fieldBuilders_AllFieldTypes: typeof AllFieldTypes;
|
|
149
193
|
declare const fieldBuilders_AnyFieldDefinition: typeof AnyFieldDefinition;
|
|
150
194
|
declare const fieldBuilders_AssetAIConfig: typeof AssetAIConfig;
|
|
151
195
|
declare const fieldBuilders_BaseFieldConfig: typeof BaseFieldConfig;
|
|
152
196
|
declare const fieldBuilders_BooleanConfig: typeof BooleanConfig;
|
|
153
|
-
declare const
|
|
154
|
-
declare const fieldBuilders_ComponentFieldType: typeof ComponentFieldType;
|
|
197
|
+
declare const fieldBuilders_CodeConfig: typeof CodeConfig;
|
|
155
198
|
declare const fieldBuilders_DateConfig: typeof DateConfig;
|
|
156
199
|
declare const fieldBuilders_DateTimeConfig: typeof DateTimeConfig;
|
|
157
200
|
declare const fieldBuilders_DecimalConfig: typeof DecimalConfig;
|
|
@@ -166,6 +209,7 @@ declare const fieldBuilders_IntegerConfig: typeof IntegerConfig;
|
|
|
166
209
|
declare const fieldBuilders_ListConfig: typeof ListConfig;
|
|
167
210
|
declare const fieldBuilders_LocalizationConfig: typeof LocalizationConfig;
|
|
168
211
|
declare const fieldBuilders_LongTextConfig: typeof LongTextConfig;
|
|
212
|
+
declare const fieldBuilders_ObjectConfig: typeof ObjectConfig;
|
|
169
213
|
declare const fieldBuilders_ReadOnlyRule: typeof ReadOnlyRule;
|
|
170
214
|
declare const fieldBuilders_ReferenceConfig: typeof ReferenceConfig;
|
|
171
215
|
declare const fieldBuilders_RequirementRule: typeof RequirementRule;
|
|
@@ -174,12 +218,13 @@ declare const fieldBuilders_RuleCondition: typeof RuleCondition;
|
|
|
174
218
|
declare const fieldBuilders_RuleConditions: typeof RuleConditions;
|
|
175
219
|
declare const fieldBuilders_ShortTextConfig: typeof ShortTextConfig;
|
|
176
220
|
declare const fieldBuilders_SlugConfig: typeof SlugConfig;
|
|
221
|
+
declare const fieldBuilders_TableConfig: typeof TableConfig;
|
|
177
222
|
declare const fieldBuilders_TagsConfig: typeof TagsConfig;
|
|
178
223
|
declare const fieldBuilders_UrlConfig: typeof UrlConfig;
|
|
179
224
|
declare const fieldBuilders_ValidationRule: typeof ValidationRule;
|
|
180
225
|
declare const fieldBuilders_VisibilityRule: typeof VisibilityRule;
|
|
181
226
|
declare const fieldBuilders_boolean: typeof boolean;
|
|
182
|
-
declare const
|
|
227
|
+
declare const fieldBuilders_code: typeof code;
|
|
183
228
|
declare const fieldBuilders_date: typeof date;
|
|
184
229
|
declare const fieldBuilders_dateTime: typeof dateTime;
|
|
185
230
|
declare const fieldBuilders_decimal: typeof decimal;
|
|
@@ -187,14 +232,16 @@ declare const fieldBuilders_email: typeof email;
|
|
|
187
232
|
declare const fieldBuilders_integer: typeof integer;
|
|
188
233
|
declare const fieldBuilders_list: typeof list;
|
|
189
234
|
declare const fieldBuilders_longText: typeof longText;
|
|
235
|
+
declare const fieldBuilders_object: typeof object;
|
|
190
236
|
declare const fieldBuilders_reference: typeof reference;
|
|
191
237
|
declare const fieldBuilders_richText: typeof richText;
|
|
192
238
|
declare const fieldBuilders_shortText: typeof shortText;
|
|
193
239
|
declare const fieldBuilders_slug: typeof slug;
|
|
240
|
+
declare const fieldBuilders_table: typeof table;
|
|
194
241
|
declare const fieldBuilders_tags: typeof tags;
|
|
195
242
|
declare const fieldBuilders_url: typeof url;
|
|
196
243
|
declare namespace fieldBuilders {
|
|
197
|
-
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 };
|
|
198
245
|
}
|
|
199
246
|
|
|
200
247
|
/**
|
|
@@ -228,4 +275,4 @@ declare namespace fieldBuilders {
|
|
|
228
275
|
|
|
229
276
|
declare const fields: typeof fieldBuilders;
|
|
230
277
|
|
|
231
|
-
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';
|