fix(richtext-lexical): Blocks: generated output schema is not fully correct (#5259)

This commit is contained in:
Alessio Gravili
2024-03-07 15:08:30 -05:00
parent 75b993bc6b
commit c8322349a0
8 changed files with 346 additions and 40 deletions

View File

@@ -37,10 +37,14 @@ type RichTextAdapterBase<
schemaPath: string schemaPath: string
}) => Map<string, Field[]> }) => Map<string, Field[]>
outputSchema?: ({ outputSchema?: ({
collectionIDFieldTypes,
config,
field, field,
interfaceNameDefinitions, interfaceNameDefinitions,
isRequired, isRequired,
}: { }: {
collectionIDFieldTypes: { [key: string]: 'number' | 'string' }
config?: SanitizedConfig
field: RichTextField<Value, AdapterProps, ExtraFieldProperties> field: RichTextField<Value, AdapterProps, ExtraFieldProperties>
/** /**
* Allows you to define new top-level interfaces that can be re-used in the output schema. * Allows you to define new top-level interfaces that can be re-used in the output schema.

View File

@@ -24,19 +24,20 @@ export { fieldSchemaToJSON } from '../utilities/fieldSchemaToJSON.js'
export { default as flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js' export { default as flattenTopLevelFields } from '../utilities/flattenTopLevelFields.js'
export { formatLabels, formatNames, toWords } from '../utilities/formatLabels.js' export { formatLabels, formatNames, toWords } from '../utilities/formatLabels.js'
export { getIDType } from '../utilities/getIDType.js' export { getCollectionIDFieldTypes } from '../utilities/getCollectionIDFieldTypes.js'
export { getIDType } from '../utilities/getIDType.js'
export { getObjectDotNotation } from '../utilities/getObjectDotNotation.js' export { getObjectDotNotation } from '../utilities/getObjectDotNotation.js'
export { default as getUniqueListBy } from '../utilities/getUniqueListBy.js' export { default as getUniqueListBy } from '../utilities/getUniqueListBy.js'
export { isEntityHidden } from '../utilities/isEntityHidden.js' export { isEntityHidden } from '../utilities/isEntityHidden.js'
export { isNumber } from '../utilities/isNumber.js' export { isNumber } from '../utilities/isNumber.js'
export { isValidID } from '../utilities/isValidID.js' export { isValidID } from '../utilities/isValidID.js'
export { default as isolateObjectProperty } from '../utilities/isolateObjectProperty.js' export { default as isolateObjectProperty } from '../utilities/isolateObjectProperty.js'
export { setsAreEqual } from '../utilities/setsAreEqual.js' export { setsAreEqual } from '../utilities/setsAreEqual.js'
export { default as toKebabCase } from '../utilities/toKebabCase.js' export { default as toKebabCase } from '../utilities/toKebabCase.js'
export { default as wait } from '../utilities/wait.js'
export { default as wait } from '../utilities/wait.js'
export { default as wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js' export { default as wordBoundariesRegex } from '../utilities/wordBoundariesRegex.js'

View File

@@ -11,6 +11,7 @@ import type { SanitizedGlobalConfig } from '../globals/config/types.d.ts'
import { fieldAffectsData, tabHasName } from '../fields/config/types.js' import { fieldAffectsData, tabHasName } from '../fields/config/types.js'
import { deepCopyObject } from './deepCopyObject.js' import { deepCopyObject } from './deepCopyObject.js'
import { toWords } from './formatLabels.js' import { toWords } from './formatLabels.js'
import { getCollectionIDFieldTypes } from './getCollectionIDFieldTypes.js'
const fieldIsRequired = (field: Field) => { const fieldIsRequired = (field: Field) => {
const isConditional = Boolean(field?.admin && field?.admin?.condition) const isConditional = Boolean(field?.admin && field?.admin?.condition)
@@ -80,12 +81,18 @@ export function withNullableJSONSchemaType(
} }
export function fieldsToJSONSchema( export function fieldsToJSONSchema(
/**
* Used for relationship fields, to determine whether to use a string or number type for the ID.
* While there is a default ID field type set by the db adapter, they can differ on a collection-level
* if they have custom ID fields.
*/
collectionIDFieldTypes: { [key: string]: 'number' | 'string' }, collectionIDFieldTypes: { [key: string]: 'number' | 'string' },
fields: Field[], fields: Field[],
/** /**
* Allows you to define new top-level interfaces that can be re-used in the output schema. * Allows you to define new top-level interfaces that can be re-used in the output schema.
*/ */
interfaceNameDefinitions: Map<string, JSONSchema4>, interfaceNameDefinitions: Map<string, JSONSchema4>,
config?: SanitizedConfig,
): { ): {
properties: { properties: {
[k: string]: JSONSchema4 [k: string]: JSONSchema4
@@ -147,6 +154,8 @@ export function fieldsToJSONSchema(
case 'richText': { case 'richText': {
if (field.editor.outputSchema) { if (field.editor.outputSchema) {
fieldSchema = field.editor.outputSchema({ fieldSchema = field.editor.outputSchema({
collectionIDFieldTypes,
config,
field, field,
interfaceNameDefinitions, interfaceNameDefinitions,
isRequired, isRequired,
@@ -324,6 +333,7 @@ export function fieldsToJSONSchema(
collectionIDFieldTypes, collectionIDFieldTypes,
block.fields, block.fields,
interfaceNameDefinitions, interfaceNameDefinitions,
config,
) )
const blockSchema: JSONSchema4 = { const blockSchema: JSONSchema4 = {
@@ -363,6 +373,7 @@ export function fieldsToJSONSchema(
collectionIDFieldTypes, collectionIDFieldTypes,
field.fields, field.fields,
interfaceNameDefinitions, interfaceNameDefinitions,
config,
), ),
}, },
} }
@@ -383,6 +394,7 @@ export function fieldsToJSONSchema(
collectionIDFieldTypes, collectionIDFieldTypes,
field.fields, field.fields,
interfaceNameDefinitions, interfaceNameDefinitions,
config,
) )
Object.entries(childSchema.properties).forEach(([propName, propSchema]) => { Object.entries(childSchema.properties).forEach(([propName, propSchema]) => {
fieldSchemas.set(propName, propSchema) fieldSchemas.set(propName, propSchema)
@@ -399,6 +411,7 @@ export function fieldsToJSONSchema(
collectionIDFieldTypes, collectionIDFieldTypes,
tab.fields, tab.fields,
interfaceNameDefinitions, interfaceNameDefinitions,
config,
) )
if (tabHasName(tab)) { if (tabHasName(tab)) {
// could have interface // could have interface
@@ -424,7 +437,12 @@ export function fieldsToJSONSchema(
fieldSchema = { fieldSchema = {
type: 'object', type: 'object',
additionalProperties: false, additionalProperties: false,
...fieldsToJSONSchema(collectionIDFieldTypes, field.fields, interfaceNameDefinitions), ...fieldsToJSONSchema(
collectionIDFieldTypes,
field.fields,
interfaceNameDefinitions,
config,
),
} }
if (field.interfaceName) { if (field.interfaceName) {
@@ -496,29 +514,14 @@ export function entityToJSONSchema(
}) })
} }
// used for relationship fields, to determine whether to use a string or number type for the ID // Used for relationship fields, to determine whether to use a string or number type for the ID.
const collectionIDFieldTypes: { [key: string]: 'number' | 'string' } = config.collections.reduce( const collectionIDFieldTypes = getCollectionIDFieldTypes({ config, defaultIDType })
(acc, collection) => {
const customCollectionIdField = collection.fields.find(
(field) => 'name' in field && field.name === 'id',
)
acc[collection.slug] = defaultIDType === 'text' ? 'string' : 'number'
if (customCollectionIdField) {
acc[collection.slug] = customCollectionIdField.type === 'number' ? 'number' : 'string'
}
return acc
},
{},
)
return { return {
type: 'object', type: 'object',
additionalProperties: false, additionalProperties: false,
title, title,
...fieldsToJSONSchema(collectionIDFieldTypes, entity.fields, interfaceNameDefinitions), ...fieldsToJSONSchema(collectionIDFieldTypes, entity.fields, interfaceNameDefinitions, config),
} }
} }

View File

@@ -0,0 +1,28 @@
import type { SanitizedConfig } from '../config/types.js'
/**
* While the default ID is determined by the db adapter, it can still differ for a collection if they
* define a custom ID field. This builds a map of collection slugs to their ID field type.
* @param defaultIDType as defined by the database adapter
*/
export function getCollectionIDFieldTypes({
config,
defaultIDType,
}: {
config: SanitizedConfig
defaultIDType: 'number' | 'text'
}): { [key: string]: 'number' | 'string' } {
return config.collections.reduce((acc, collection) => {
const customCollectionIdField = collection.fields.find(
(field) => 'name' in field && field.name === 'id',
)
acc[collection.slug] = defaultIDType === 'text' ? 'string' : 'number'
if (customCollectionIdField) {
acc[collection.slug] = customCollectionIdField.type === 'number' ? 'number' : 'string'
}
return acc
}, {})
}

View File

@@ -6,6 +6,7 @@ import { fieldsToJSONSchema, formatLabels } from 'payload/utilities'
import type { FeatureProviderProviderServer } from '../types.js' import type { FeatureProviderProviderServer } from '../types.js'
import type { BlocksFeatureClientProps } from './feature.client.js' import type { BlocksFeatureClientProps } from './feature.client.js'
import { cloneDeep } from '../../lexical/utils/cloneDeep.js'
import { BlocksFeatureClientComponent } from './feature.client.js' import { BlocksFeatureClientComponent } from './feature.client.js'
import { BlockNode } from './nodes/BlocksNode.js' import { BlockNode } from './nodes/BlocksNode.js'
import { blockPopulationPromiseHOC } from './populationPromise.js' import { blockPopulationPromiseHOC } from './populationPromise.js'
@@ -23,10 +24,12 @@ export const BlocksFeature: FeatureProviderProviderServer<
if (props?.blocks?.length) { if (props?.blocks?.length) {
props.blocks = props.blocks.map((block) => { props.blocks = props.blocks.map((block) => {
const blockCopy = cloneDeep(block)
return { return {
...block, ...blockCopy,
fields: block.fields.concat(baseBlockFields), fields: blockCopy.fields.concat(baseBlockFields),
labels: !block.labels ? formatLabels(block.slug) : block.labels, labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels,
} }
}) })
// unSanitizedBlock.fields are sanitized in the React component and not here. // unSanitizedBlock.fields are sanitized in the React component and not here.
@@ -74,15 +77,45 @@ export const BlocksFeature: FeatureProviderProviderServer<
return schemaMap return schemaMap
}, },
generatedTypes: { generatedTypes: {
modifyOutputSchema: ({ currentSchema, field, interfaceNameDefinitions }) => { modifyOutputSchema: ({
collectionIDFieldTypes,
config,
currentSchema,
field,
interfaceNameDefinitions,
}) => {
if (!props?.blocks?.length) {
return currentSchema
}
// sanitize blocks
const validRelationships = config.collections.map((c) => c.slug) || []
const sanitizedBlocks = props.blocks.map((block) => {
const blockCopy = cloneDeep(block)
return {
...blockCopy,
fields: sanitizeFields({
config,
fields: blockCopy.fields,
validRelationships,
}),
}
})
const blocksField: BlockField = { const blocksField: BlockField = {
name: field?.name + '_lexical_blocks', name: field?.name + '_lexical_blocks',
type: 'blocks', type: 'blocks',
blocks: props.blocks, blocks: sanitizedBlocks,
} }
// This is only done so that interfaceNameDefinitions sets those block's interfaceNames. // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.
// we don't actually use the JSON Schema itself in the generated types yet. // we don't actually use the JSON Schema itself in the generated types yet.
fieldsToJSONSchema({}, [blocksField], interfaceNameDefinitions) fieldsToJSONSchema(
collectionIDFieldTypes,
[blocksField],
interfaceNameDefinitions,
config,
)
return currentSchema return currentSchema
}, },

View File

@@ -193,11 +193,15 @@ export type ServerFeature<ServerProps, ClientFeatureProps> = {
} }
generatedTypes?: { generatedTypes?: {
modifyOutputSchema: ({ modifyOutputSchema: ({
collectionIDFieldTypes,
config,
currentSchema, currentSchema,
field, field,
interfaceNameDefinitions, interfaceNameDefinitions,
isRequired, isRequired,
}: { }: {
collectionIDFieldTypes: { [key: string]: 'number' | 'string' }
config?: SanitizedConfig
/** /**
* Current schema which will be modified by this function. * Current schema which will be modified by this function.
*/ */
@@ -298,11 +302,15 @@ export type SanitizedServerFeatures = Required<
generatedTypes: { generatedTypes: {
modifyOutputSchemas: Array< modifyOutputSchemas: Array<
({ ({
collectionIDFieldTypes,
config,
currentSchema, currentSchema,
field, field,
interfaceNameDefinitions, interfaceNameDefinitions,
isRequired, isRequired,
}: { }: {
collectionIDFieldTypes: { [key: string]: 'number' | 'string' }
config?: SanitizedConfig
/** /**
* Current schema which will be modified by this function. * Current schema which will be modified by this function.
*/ */

View File

@@ -123,7 +123,13 @@ export function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapte
generateSchemaMap: getGenerateSchemaMap({ generateSchemaMap: getGenerateSchemaMap({
resolvedFeatureMap, resolvedFeatureMap,
}), }),
outputSchema: ({ field, interfaceNameDefinitions, isRequired }) => { outputSchema: ({
collectionIDFieldTypes,
config,
field,
interfaceNameDefinitions,
isRequired,
}) => {
let outputSchema: JSONSchema4 = { let outputSchema: JSONSchema4 = {
// This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors. // This schema matches the SerializedEditorState type so far, that it's possible to cast SerializedEditorState to this schema without any errors.
// In the future, we should // In the future, we should
@@ -183,6 +189,8 @@ export function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapte
for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes for (const modifyOutputSchema of finalSanitizedEditorConfig.features.generatedTypes
.modifyOutputSchemas) { .modifyOutputSchemas) {
outputSchema = modifyOutputSchema({ outputSchema = modifyOutputSchema({
collectionIDFieldTypes,
config,
currentSchema: outputSchema, currentSchema: outputSchema,
field, field,
interfaceNameDefinitions, interfaceNameDefinitions,

View File

@@ -6,6 +6,17 @@
* and re-run `payload generate:types` to regenerate this file. * and re-run `payload generate:types` to regenerate this file.
*/ */
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "BlockColumns".
*/
export type BlockColumns =
| {
text?: string | null
id?: string | null
}[]
| null
export interface Config { export interface Config {
collections: { collections: {
'lexical-fields': LexicalField 'lexical-fields': LexicalField
@@ -40,11 +51,16 @@ export interface Config {
tabsWithRichText: TabsWithRichText tabsWithRichText: TabsWithRichText
} }
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-fields".
*/
export interface LexicalField { export interface LexicalField {
id: string id: string
title: string title: string
lexicalSimple?: { lexicalSimple?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -53,13 +69,13 @@ export interface LexicalField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
} | null } | null
lexicalWithBlocks: { lexicalWithBlocks: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -68,7 +84,6 @@ export interface LexicalField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -76,11 +91,16 @@ export interface LexicalField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "lexical-migrate-fields".
*/
export interface LexicalMigrateField { export interface LexicalMigrateField {
id: string id: string
title: string title: string
lexicalWithLexicalPluginData?: { lexicalWithLexicalPluginData?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -89,13 +109,13 @@ export interface LexicalMigrateField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
} | null } | null
lexicalWithSlateData?: { lexicalWithSlateData?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -104,13 +124,13 @@ export interface LexicalMigrateField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
} | null } | null
lexicalSimple?: { lexicalSimple?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -119,7 +139,6 @@ export interface LexicalMigrateField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -128,6 +147,7 @@ export interface LexicalMigrateField {
groupWithLexicalField?: { groupWithLexicalField?: {
lexicalInGroupField?: { lexicalInGroupField?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -136,7 +156,6 @@ export interface LexicalMigrateField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -147,6 +166,7 @@ export interface LexicalMigrateField {
| { | {
lexicalInArrayField?: { lexicalInArrayField?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -155,7 +175,6 @@ export interface LexicalMigrateField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -167,6 +186,10 @@ export interface LexicalMigrateField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users".
*/
export interface User { export interface User {
id: string id: string
canViewConditionalField?: boolean | null canViewConditionalField?: boolean | null
@@ -181,11 +204,16 @@ export interface User {
lockUntil?: string | null lockUntil?: string | null
password: string | null password: string | null
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "array-fields".
*/
export interface ArrayField { export interface ArrayField {
id: string id: string
title?: string | null title?: string | null
items: { items: {
text: string text: string
localizedText?: string | null
subArray?: subArray?:
| { | {
text?: string | null text?: string | null
@@ -240,6 +268,10 @@ export interface ArrayField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "block-fields".
*/
export interface BlockField { export interface BlockField {
id: string id: string
blocks: ( blocks: (
@@ -289,6 +321,53 @@ export interface BlockField {
blockType: 'tabs' blockType: 'tabs'
} }
)[] )[]
duplicate: (
| {
text: string
richText?:
| {
[k: string]: unknown
}[]
| null
id?: string | null
blockName?: string | null
blockType: 'content'
}
| {
number: number
id?: string | null
blockName?: string | null
blockType: 'number'
}
| {
subBlocks?:
| (
| {
text: string
id?: string | null
blockName?: string | null
blockType: 'text'
}
| {
number: number
id?: string | null
blockName?: string | null
blockType: 'number'
}
)[]
| null
id?: string | null
blockName?: string | null
blockType: 'subBlocks'
}
| {
textInCollapsible?: string | null
textInRow?: string | null
id?: string | null
blockName?: string | null
blockType: 'tabs'
}
)[]
collapsedByDefaultBlocks: ( collapsedByDefaultBlocks: (
| { | {
text: string text: string
@@ -415,6 +494,37 @@ export interface BlockField {
blockName?: string | null blockName?: string | null
blockType: 'block-b' blockType: 'block-b'
} }
| {
group?: {
text?: string | null
}
id?: string | null
blockName?: string | null
blockType: 'group-block'
}
)[]
| null
blocksWithSimilarGroup?:
| (
| {
group?: {
text?: string | null
}
id?: string | null
blockName?: string | null
blockType: 'group-block'
}
| {
items?:
| {
title2: string
id?: string | null
}[]
| null
id?: string | null
blockName?: string | null
blockType: 'block-b'
}
)[] )[]
| null | null
blocksWithMinRows?: blocksWithMinRows?:
@@ -452,6 +562,10 @@ export interface BlockField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "text-fields".
*/
export interface TextField { export interface TextField {
id: string id: string
text: string text: string
@@ -473,12 +587,20 @@ export interface TextField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "checkbox-fields".
*/
export interface CheckboxField { export interface CheckboxField {
id: string id: string
checkbox: boolean checkbox: boolean
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "code-fields".
*/
export interface CodeField { export interface CodeField {
id: string id: string
javascript?: string | null javascript?: string | null
@@ -489,6 +611,10 @@ export interface CodeField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "collapsible-fields".
*/
export interface CollapsibleField { export interface CollapsibleField {
id: string id: string
text: string text: string
@@ -517,6 +643,10 @@ export interface CollapsibleField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "conditional-logic".
*/
export interface ConditionalLogic { export interface ConditionalLogic {
id: string id: string
text: string text: string
@@ -538,6 +668,10 @@ export interface ConditionalLogic {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "date-fields".
*/
export interface DateField { export interface DateField {
id: string id: string
default: string default: string
@@ -549,12 +683,20 @@ export interface DateField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "radio-fields".
*/
export interface RadioField { export interface RadioField {
id: string id: string
radio?: ('one' | 'two' | 'three') | null radio?: ('one' | 'two' | 'three') | null
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "group-fields".
*/
export interface GroupField { export interface GroupField {
id: string id: string
group: { group: {
@@ -571,6 +713,14 @@ export interface GroupField {
| null | null
} }
} }
arrayOfGroups?:
| {
groupItem?: {
text?: string | null
}
id?: string | null
}[]
| null
potentiallyEmptyGroup?: { potentiallyEmptyGroup?: {
text?: string | null text?: string | null
} }
@@ -601,6 +751,10 @@ export interface GroupField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "row-fields".
*/
export interface RowField { export interface RowField {
id: string id: string
title: string title: string
@@ -611,10 +765,15 @@ export interface RowField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "indexed-fields".
*/
export interface IndexedField { export interface IndexedField {
id: string id: string
text: string text: string
uniqueText?: string | null uniqueText?: string | null
uniqueRequiredText: string
/** /**
* @minItems 2 * @minItems 2
* @maxItems 2 * @maxItems 2
@@ -634,6 +793,10 @@ export interface IndexedField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "json-fields".
*/
export interface JsonField { export interface JsonField {
id: string id: string
json?: json?:
@@ -648,6 +811,10 @@ export interface JsonField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "number-fields".
*/
export interface NumberField { export interface NumberField {
id: string id: string
number?: number | null number?: number | null
@@ -665,6 +832,10 @@ export interface NumberField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "point-fields".
*/
export interface PointField { export interface PointField {
id: string id: string
/** /**
@@ -687,6 +858,10 @@ export interface PointField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relationship-fields".
*/
export interface RelationshipField { export interface RelationshipField {
id: string id: string
text?: string | null text?: string | null
@@ -736,11 +911,16 @@ export interface RelationshipField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "rich-text-fields".
*/
export interface RichTextField { export interface RichTextField {
id: string id: string
title: string title: string
lexicalCustomFields: { lexicalCustomFields: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -749,7 +929,6 @@ export interface RichTextField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -757,6 +936,7 @@ export interface RichTextField {
lexicalCustomFields_html?: string | null lexicalCustomFields_html?: string | null
lexical?: { lexical?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -765,7 +945,6 @@ export interface RichTextField {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -807,6 +986,10 @@ export interface RichTextField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "select-fields".
*/
export interface SelectField { export interface SelectField {
id: string id: string
select?: ('one' | 'two' | 'three') | null select?: ('one' | 'two' | 'three') | null
@@ -821,6 +1004,10 @@ export interface SelectField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "tabs-fields".
*/
export interface TabsField { export interface TabsField {
id: string id: string
sidebarField?: string | null sidebarField?: string | null
@@ -920,6 +1107,10 @@ export interface TabsField {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "uploads".
*/
export interface Upload { export interface Upload {
id: string id: string
text?: string | null text?: string | null
@@ -938,6 +1129,10 @@ export interface Upload {
width?: number | null width?: number | null
height?: number | null height?: number | null
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "uploads2".
*/
export interface Uploads2 { export interface Uploads2 {
id: string id: string
text?: string | null text?: string | null
@@ -951,6 +1146,10 @@ export interface Uploads2 {
width?: number | null width?: number | null
height?: number | null height?: number | null
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "uploads3".
*/
export interface Uploads3 { export interface Uploads3 {
id: string id: string
media?: string | Uploads3 | null media?: string | Uploads3 | null
@@ -968,6 +1167,10 @@ export interface Uploads3 {
width?: number | null width?: number | null
height?: number | null height?: number | null
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-preferences".
*/
export interface PayloadPreference { export interface PayloadPreference {
id: string id: string
user: { user: {
@@ -987,6 +1190,10 @@ export interface PayloadPreference {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-migrations".
*/
export interface PayloadMigration { export interface PayloadMigration {
id: string id: string
name?: string | null name?: string | null
@@ -994,11 +1201,16 @@ export interface PayloadMigration {
updatedAt: string updatedAt: string
createdAt: string createdAt: string
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "tabsWithRichText".
*/
export interface TabsWithRichText { export interface TabsWithRichText {
id: string id: string
tab1: { tab1: {
rt1?: { rt1?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -1007,7 +1219,6 @@ export interface TabsWithRichText {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -1016,6 +1227,7 @@ export interface TabsWithRichText {
tab2: { tab2: {
rt2?: { rt2?: {
root: { root: {
type: string
children: { children: {
type: string type: string
version: number version: number
@@ -1024,7 +1236,6 @@ export interface TabsWithRichText {
direction: ('ltr' | 'rtl') | null direction: ('ltr' | 'rtl') | null
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''
indent: number indent: number
type: string
version: number version: number
} }
[k: string]: unknown [k: string]: unknown
@@ -1033,6 +1244,16 @@ export interface TabsWithRichText {
updatedAt?: string | null updatedAt?: string | null
createdAt?: string | null createdAt?: string | null
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "LexicalBlocksRadioButtonsBlock".
*/
export interface LexicalBlocksRadioButtonsBlock {
radioButtons?: ('option1' | 'option2' | 'option3') | null
id?: string | null
blockName?: string | null
blockType: 'radioButtons'
}
declare module 'payload' { declare module 'payload' {
export interface GeneratedTypes extends Config {} export interface GeneratedTypes extends Config {}