fix(db-postgres): localized relationships inside blocks (#13760)

Fixes https://github.com/payloadcms/payload/issues/12463 and
https://github.com/payloadcms/payload/issues/13747
This commit is contained in:
Sasha
2025-09-19 16:28:12 +03:00
committed by GitHub
parent b7f6e3c294
commit 22ae9fa9d0
4 changed files with 307 additions and 195 deletions

View File

@@ -374,21 +374,10 @@ export const traverseFields = <T extends Record<string, unknown>>({
return result return result
} }
if (field.type === 'relationship' || field.type === 'upload') {
if (typeof field.relationTo === 'string' && !('hasMany' in field && field.hasMany)) {
if ( if (
isLocalized && (field.type === 'relationship' || field.type === 'upload') &&
config.localization && (Array.isArray(field.relationTo) || field.hasMany)
config.localization.locales &&
Array.isArray(table?._locales)
) { ) {
table._locales.forEach((localeRow) => {
result[field.name] = { [localeRow._locale]: localeRow[fieldName] }
})
} else {
valuesToTransform.push({ ref: result, table })
}
} else {
const relationPathMatch = relationships[`${sanitizedPath}${field.name}`] const relationPathMatch = relationships[`${sanitizedPath}${field.name}`]
if (!relationPathMatch) { if (!relationPathMatch) {
@@ -436,7 +425,6 @@ export const traverseFields = <T extends Record<string, unknown>>({
} }
return result return result
} }
}
if (field.type === 'join') { if (field.type === 'join') {
const { count, limit = field.defaultLimit ?? 10 } = const { count, limit = field.defaultLimit ?? 10 } =

View File

@@ -60,9 +60,14 @@ export default buildConfigWithDefaults({
baseDir: path.resolve(dirname), baseDir: path.resolve(dirname),
}, },
}, },
localization: {
locales: ['en', 'es', 'fr'],
defaultLocale: 'en',
},
collections: [ collections: [
{ {
slug: relationSlug, slug: relationSlug,
versions: { drafts: { autosave: true } },
fields: [ fields: [
{ {
name: 'image', name: 'image',
@@ -79,6 +84,42 @@ export default buildConfigWithDefaults({
type: 'upload', type: 'upload',
relationTo: hideFileInputOnCreateSlug, relationTo: hideFileInputOnCreateSlug,
}, },
{
type: 'tabs',
tabs: [
{
label: 'a',
fields: [
{
name: 'blocks',
type: 'blocks',
blocks: [
{
slug: 'localizedMediaBlock',
fields: [
{
name: 'media',
type: 'upload',
relationTo: 'media',
localized: true,
required: true,
},
{
name: 'relatedMedia',
type: 'relationship',
relationTo: 'media',
localized: true,
hasMany: true,
maxRows: 5,
},
],
},
],
},
],
},
],
},
], ],
}, },
{ {
@@ -346,6 +387,11 @@ export default buildConfigWithDefaults({
type: 'text', type: 'text',
name: 'alt', name: 'alt',
}, },
{
type: 'text',
name: 'localized',
localized: true,
},
], ],
upload: { upload: {
staticDir: path.resolve(dirname, './media'), staticDir: path.resolve(dirname, './media'),

View File

@@ -603,6 +603,59 @@ describe('Collections - Uploads', () => {
expect(doc.docs[0].image).toBeFalsy() expect(doc.docs[0].image).toBeFalsy()
}) })
it('should allow a localized upload relationship in a block', async () => {
const filePath = path.resolve(dirname, './image.png')
const file = await getFileByPath(filePath)
const { id } = await payload.create({
collection: mediaSlug,
data: {},
file,
})
const { id: id_2 } = await payload.create({
collection: mediaSlug,
data: {},
file,
})
const res = await payload.create({
collection: 'relation',
depth: 0,
data: {
blocks: [
{
blockType: 'localizedMediaBlock',
media: id,
relatedMedia: [id],
},
],
},
})
expect(res.blocks[0]?.media).toBe(id)
expect(res.blocks[0]?.relatedMedia).toEqual([id])
const res_2 = await payload.update({
collection: 'relation',
id: res.id,
depth: 0,
data: {
blocks: [
{
id: res.blocks[0]?.id,
blockType: 'localizedMediaBlock',
media: id_2,
relatedMedia: [id_2],
},
],
},
})
expect(res_2.blocks[0]?.media).toBe(id_2)
expect(res_2.blocks[0]?.relatedMedia).toEqual([id_2])
})
}) })
describe('cookie filtering', () => { describe('cookie filtering', () => {

View File

@@ -190,11 +190,11 @@ export interface Config {
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>; 'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
}; };
db: { db: {
defaultIDType: string; defaultIDType: number;
}; };
globals: {}; globals: {};
globalsSelect: {}; globalsSelect: {};
locale: null; locale: 'en' | 'es' | 'fr';
user: User & { user: User & {
collection: 'users'; collection: 'users';
}; };
@@ -226,20 +226,31 @@ export interface UserAuthOperations {
* via the `definition` "relation". * via the `definition` "relation".
*/ */
export interface Relation { export interface Relation {
id: string; id: number;
image?: (string | null) | Media; image?: (number | null) | Media;
versionedImage?: (string | null) | Version; versionedImage?: (number | null) | Version;
hideFileInputOnCreate?: (string | null) | HideFileInputOnCreate; hideFileInputOnCreate?: (number | null) | HideFileInputOnCreate;
blocks?:
| {
media: number | Media;
relatedMedia?: (number | Media)[] | null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedMediaBlock';
}[]
| null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
_status?: ('draft' | 'published') | null;
} }
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "media". * via the `definition` "media".
*/ */
export interface Media { export interface Media {
id: string; id: number;
alt?: string | null; alt?: string | null;
localized?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -387,7 +398,7 @@ export interface Media {
* via the `definition` "versions". * via the `definition` "versions".
*/ */
export interface Version { export interface Version {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -407,7 +418,7 @@ export interface Version {
* via the `definition` "hide-file-input-on-create". * via the `definition` "hide-file-input-on-create".
*/ */
export interface HideFileInputOnCreate { export interface HideFileInputOnCreate {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -426,8 +437,8 @@ export interface HideFileInputOnCreate {
* via the `definition` "audio". * via the `definition` "audio".
*/ */
export interface Audio { export interface Audio {
id: string; id: number;
audio?: (string | null) | Media; audio?: (number | null) | Media;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
@@ -436,7 +447,7 @@ export interface Audio {
* via the `definition` "gif-resize". * via the `definition` "gif-resize".
*/ */
export interface GifResize { export interface GifResize {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -472,7 +483,7 @@ export interface GifResize {
* via the `definition` "filename-compound-index". * via the `definition` "filename-compound-index".
*/ */
export interface FilenameCompoundIndex { export interface FilenameCompoundIndex {
id: string; id: number;
/** /**
* Alt text to be used for compound index * Alt text to be used for compound index
*/ */
@@ -512,7 +523,7 @@ export interface FilenameCompoundIndex {
* via the `definition` "no-image-sizes". * via the `definition` "no-image-sizes".
*/ */
export interface NoImageSize { export interface NoImageSize {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -530,7 +541,7 @@ export interface NoImageSize {
* via the `definition` "object-fit". * via the `definition` "object-fit".
*/ */
export interface ObjectFit { export interface ObjectFit {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -582,7 +593,7 @@ export interface ObjectFit {
* via the `definition` "with-meta-data". * via the `definition` "with-meta-data".
*/ */
export interface WithMetaDatum { export interface WithMetaDatum {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -610,7 +621,7 @@ export interface WithMetaDatum {
* via the `definition` "without-meta-data". * via the `definition` "without-meta-data".
*/ */
export interface WithoutMetaDatum { export interface WithoutMetaDatum {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -638,7 +649,7 @@ export interface WithoutMetaDatum {
* via the `definition` "with-only-jpeg-meta-data". * via the `definition` "with-only-jpeg-meta-data".
*/ */
export interface WithOnlyJpegMetaDatum { export interface WithOnlyJpegMetaDatum {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -666,7 +677,7 @@ export interface WithOnlyJpegMetaDatum {
* via the `definition` "crop-only". * via the `definition` "crop-only".
*/ */
export interface CropOnly { export interface CropOnly {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -710,7 +721,7 @@ export interface CropOnly {
* via the `definition` "focal-only". * via the `definition` "focal-only".
*/ */
export interface FocalOnly { export interface FocalOnly {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -754,7 +765,7 @@ export interface FocalOnly {
* via the `definition` "image-sizes-only". * via the `definition` "image-sizes-only".
*/ */
export interface ImageSizesOnly { export interface ImageSizesOnly {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -790,7 +801,7 @@ export interface ImageSizesOnly {
* via the `definition` "focal-no-sizes". * via the `definition` "focal-no-sizes".
*/ */
export interface FocalNoSize { export interface FocalNoSize {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -808,7 +819,7 @@ export interface FocalNoSize {
* via the `definition` "allow-list-media". * via the `definition` "allow-list-media".
*/ */
export interface AllowListMedia { export interface AllowListMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -826,7 +837,7 @@ export interface AllowListMedia {
* via the `definition` "skip-safe-fetch-media". * via the `definition` "skip-safe-fetch-media".
*/ */
export interface SkipSafeFetchMedia { export interface SkipSafeFetchMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -844,7 +855,7 @@ export interface SkipSafeFetchMedia {
* via the `definition` "skip-safe-fetch-header-filter". * via the `definition` "skip-safe-fetch-header-filter".
*/ */
export interface SkipSafeFetchHeaderFilter { export interface SkipSafeFetchHeaderFilter {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -862,7 +873,7 @@ export interface SkipSafeFetchHeaderFilter {
* via the `definition` "skip-allow-list-safe-fetch-media". * via the `definition` "skip-allow-list-safe-fetch-media".
*/ */
export interface SkipAllowListSafeFetchMedia { export interface SkipAllowListSafeFetchMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -880,7 +891,7 @@ export interface SkipAllowListSafeFetchMedia {
* via the `definition` "restrict-file-types". * via the `definition` "restrict-file-types".
*/ */
export interface RestrictFileType { export interface RestrictFileType {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -898,7 +909,7 @@ export interface RestrictFileType {
* via the `definition` "no-restrict-file-types". * via the `definition` "no-restrict-file-types".
*/ */
export interface NoRestrictFileType { export interface NoRestrictFileType {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -916,7 +927,7 @@ export interface NoRestrictFileType {
* via the `definition` "no-restrict-file-mime-types". * via the `definition` "no-restrict-file-mime-types".
*/ */
export interface NoRestrictFileMimeType { export interface NoRestrictFileMimeType {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -934,7 +945,7 @@ export interface NoRestrictFileMimeType {
* via the `definition` "animated-type-media". * via the `definition` "animated-type-media".
*/ */
export interface AnimatedTypeMedia { export interface AnimatedTypeMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -986,7 +997,7 @@ export interface AnimatedTypeMedia {
* via the `definition` "enlarge". * via the `definition` "enlarge".
*/ */
export interface Enlarge { export interface Enlarge {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1054,7 +1065,7 @@ export interface Enlarge {
* via the `definition` "without-enlarge". * via the `definition` "without-enlarge".
*/ */
export interface WithoutEnlarge { export interface WithoutEnlarge {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1072,7 +1083,7 @@ export interface WithoutEnlarge {
* via the `definition` "reduce". * via the `definition` "reduce".
*/ */
export interface Reduce { export interface Reduce {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1124,7 +1135,7 @@ export interface Reduce {
* via the `definition` "media-trim". * via the `definition` "media-trim".
*/ */
export interface MediaTrim { export interface MediaTrim {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1168,7 +1179,7 @@ export interface MediaTrim {
* via the `definition` "custom-file-name-media". * via the `definition` "custom-file-name-media".
*/ */
export interface CustomFileNameMedia { export interface CustomFileNameMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1196,7 +1207,7 @@ export interface CustomFileNameMedia {
* via the `definition` "unstored-media". * via the `definition` "unstored-media".
*/ */
export interface UnstoredMedia { export interface UnstoredMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1214,7 +1225,7 @@ export interface UnstoredMedia {
* via the `definition` "externally-served-media". * via the `definition` "externally-served-media".
*/ */
export interface ExternallyServedMedia { export interface ExternallyServedMedia {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1232,11 +1243,11 @@ export interface ExternallyServedMedia {
* via the `definition` "uploads-1". * via the `definition` "uploads-1".
*/ */
export interface Uploads1 { export interface Uploads1 {
id: string; id: number;
hasManyUpload?: (string | Uploads2)[] | null; hasManyUpload?: (number | Uploads2)[] | null;
singleUpload?: (string | null) | Uploads2; singleUpload?: (number | null) | Uploads2;
hasManyThumbnailUpload?: (string | AdminThumbnailSize)[] | null; hasManyThumbnailUpload?: (number | AdminThumbnailSize)[] | null;
singleThumbnailUpload?: (string | null) | AdminThumbnailSize; singleThumbnailUpload?: (number | null) | AdminThumbnailSize;
richText?: { richText?: {
root: { root: {
type: string; type: string;
@@ -1269,7 +1280,7 @@ export interface Uploads1 {
* via the `definition` "uploads-2". * via the `definition` "uploads-2".
*/ */
export interface Uploads2 { export interface Uploads2 {
id: string; id: number;
prefix: string; prefix: string;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
@@ -1289,7 +1300,7 @@ export interface Uploads2 {
* via the `definition` "admin-thumbnail-size". * via the `definition` "admin-thumbnail-size".
*/ */
export interface AdminThumbnailSize { export interface AdminThumbnailSize {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1325,7 +1336,7 @@ export interface AdminThumbnailSize {
* via the `definition` "any-images". * via the `definition` "any-images".
*/ */
export interface AnyImage { export interface AnyImage {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1343,7 +1354,7 @@ export interface AnyImage {
* via the `definition` "admin-thumbnail-function". * via the `definition` "admin-thumbnail-function".
*/ */
export interface AdminThumbnailFunction { export interface AdminThumbnailFunction {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1361,7 +1372,7 @@ export interface AdminThumbnailFunction {
* via the `definition` "admin-thumbnail-with-search-queries". * via the `definition` "admin-thumbnail-with-search-queries".
*/ */
export interface AdminThumbnailWithSearchQuery { export interface AdminThumbnailWithSearchQuery {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1379,7 +1390,7 @@ export interface AdminThumbnailWithSearchQuery {
* via the `definition` "admin-upload-control". * via the `definition` "admin-upload-control".
*/ */
export interface AdminUploadControl { export interface AdminUploadControl {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1397,7 +1408,7 @@ export interface AdminUploadControl {
* via the `definition` "optional-file". * via the `definition` "optional-file".
*/ */
export interface OptionalFile { export interface OptionalFile {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1415,7 +1426,7 @@ export interface OptionalFile {
* via the `definition` "required-file". * via the `definition` "required-file".
*/ */
export interface RequiredFile { export interface RequiredFile {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1433,7 +1444,7 @@ export interface RequiredFile {
* via the `definition` "custom-upload-field". * via the `definition` "custom-upload-field".
*/ */
export interface CustomUploadField { export interface CustomUploadField {
id: string; id: number;
alt?: string | null; alt?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1452,7 +1463,7 @@ export interface CustomUploadField {
* via the `definition` "media-with-relation-preview". * via the `definition` "media-with-relation-preview".
*/ */
export interface MediaWithRelationPreview { export interface MediaWithRelationPreview {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1471,7 +1482,7 @@ export interface MediaWithRelationPreview {
* via the `definition` "media-without-cache-tags". * via the `definition` "media-without-cache-tags".
*/ */
export interface MediaWithoutCacheTag { export interface MediaWithoutCacheTag {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1490,7 +1501,7 @@ export interface MediaWithoutCacheTag {
* via the `definition` "media-without-relation-preview". * via the `definition` "media-without-relation-preview".
*/ */
export interface MediaWithoutRelationPreview { export interface MediaWithoutRelationPreview {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1509,13 +1520,13 @@ export interface MediaWithoutRelationPreview {
* via the `definition` "relation-preview". * via the `definition` "relation-preview".
*/ */
export interface RelationPreview { export interface RelationPreview {
id: string; id: number;
imageWithPreview1?: (string | null) | MediaWithRelationPreview; imageWithPreview1?: (number | null) | MediaWithRelationPreview;
imageWithPreview2?: (string | null) | MediaWithRelationPreview; imageWithPreview2?: (number | null) | MediaWithRelationPreview;
imageWithoutPreview1?: (string | null) | MediaWithRelationPreview; imageWithoutPreview1?: (number | null) | MediaWithRelationPreview;
imageWithoutPreview2?: (string | null) | MediaWithoutRelationPreview; imageWithoutPreview2?: (number | null) | MediaWithoutRelationPreview;
imageWithPreview3?: (string | null) | MediaWithoutRelationPreview; imageWithPreview3?: (number | null) | MediaWithoutRelationPreview;
imageWithoutPreview3?: (string | null) | MediaWithoutRelationPreview; imageWithoutPreview3?: (number | null) | MediaWithoutRelationPreview;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
@@ -1524,11 +1535,11 @@ export interface RelationPreview {
* via the `definition` "best-fit". * via the `definition` "best-fit".
*/ */
export interface BestFit { export interface BestFit {
id: string; id: number;
withAdminThumbnail?: (string | null) | AdminThumbnailFunction; withAdminThumbnail?: (number | null) | AdminThumbnailFunction;
withinRange?: (string | null) | Enlarge; withinRange?: (number | null) | Enlarge;
nextSmallestOutOfRange?: (string | null) | FocalOnly; nextSmallestOutOfRange?: (number | null) | FocalOnly;
original?: (string | null) | FocalOnly; original?: (number | null) | FocalOnly;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
@@ -1537,10 +1548,10 @@ export interface BestFit {
* via the `definition` "list-view-preview". * via the `definition` "list-view-preview".
*/ */
export interface ListViewPreview { export interface ListViewPreview {
id: string; id: number;
title?: string | null; title?: string | null;
imageUpload?: (string | null) | MediaWithRelationPreview; imageUpload?: (number | null) | MediaWithRelationPreview;
imageRelationship?: (string | null) | MediaWithRelationPreview; imageRelationship?: (number | null) | MediaWithRelationPreview;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
@@ -1549,7 +1560,7 @@ export interface ListViewPreview {
* via the `definition` "three-dimensional". * via the `definition` "three-dimensional".
*/ */
export interface ThreeDimensional { export interface ThreeDimensional {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1565,7 +1576,7 @@ export interface ThreeDimensional {
* via the `definition` "constructor-options". * via the `definition` "constructor-options".
*/ */
export interface ConstructorOption { export interface ConstructorOption {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1583,11 +1594,11 @@ export interface ConstructorOption {
* via the `definition` "bulk-uploads". * via the `definition` "bulk-uploads".
*/ */
export interface BulkUpload { export interface BulkUpload {
id: string; id: number;
title: string; title: string;
relationship?: { relationship?: {
relationTo: 'simple-relationship'; relationTo: 'simple-relationship';
value: string | SimpleRelationship; value: number | SimpleRelationship;
} | null; } | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1606,7 +1617,7 @@ export interface BulkUpload {
* via the `definition` "simple-relationship". * via the `definition` "simple-relationship".
*/ */
export interface SimpleRelationship { export interface SimpleRelationship {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1616,7 +1627,7 @@ export interface SimpleRelationship {
* via the `definition` "file-mime-type". * via the `definition` "file-mime-type".
*/ */
export interface FileMimeType { export interface FileMimeType {
id: string; id: number;
title?: string | null; title?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1635,7 +1646,7 @@ export interface FileMimeType {
* via the `definition` "svg-only". * via the `definition` "svg-only".
*/ */
export interface SvgOnly { export interface SvgOnly {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1653,7 +1664,7 @@ export interface SvgOnly {
* via the `definition` "media-without-delete-access". * via the `definition` "media-without-delete-access".
*/ */
export interface MediaWithoutDeleteAccess { export interface MediaWithoutDeleteAccess {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1671,7 +1682,7 @@ export interface MediaWithoutDeleteAccess {
* via the `definition` "media-with-image-size-admin-props". * via the `definition` "media-with-image-size-admin-props".
*/ */
export interface MediaWithImageSizeAdminProp { export interface MediaWithImageSizeAdminProp {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
url?: string | null; url?: string | null;
@@ -1723,7 +1734,7 @@ export interface MediaWithImageSizeAdminProp {
* via the `definition` "users". * via the `definition` "users".
*/ */
export interface User { export interface User {
id: string; id: number;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
email: string; email: string;
@@ -1747,236 +1758,236 @@ export interface User {
* via the `definition` "payload-locked-documents". * via the `definition` "payload-locked-documents".
*/ */
export interface PayloadLockedDocument { export interface PayloadLockedDocument {
id: string; id: number;
document?: document?:
| ({ | ({
relationTo: 'relation'; relationTo: 'relation';
value: string | Relation; value: number | Relation;
} | null) } | null)
| ({ | ({
relationTo: 'audio'; relationTo: 'audio';
value: string | Audio; value: number | Audio;
} | null) } | null)
| ({ | ({
relationTo: 'gif-resize'; relationTo: 'gif-resize';
value: string | GifResize; value: number | GifResize;
} | null) } | null)
| ({ | ({
relationTo: 'filename-compound-index'; relationTo: 'filename-compound-index';
value: string | FilenameCompoundIndex; value: number | FilenameCompoundIndex;
} | null) } | null)
| ({ | ({
relationTo: 'no-image-sizes'; relationTo: 'no-image-sizes';
value: string | NoImageSize; value: number | NoImageSize;
} | null) } | null)
| ({ | ({
relationTo: 'object-fit'; relationTo: 'object-fit';
value: string | ObjectFit; value: number | ObjectFit;
} | null) } | null)
| ({ | ({
relationTo: 'with-meta-data'; relationTo: 'with-meta-data';
value: string | WithMetaDatum; value: number | WithMetaDatum;
} | null) } | null)
| ({ | ({
relationTo: 'without-meta-data'; relationTo: 'without-meta-data';
value: string | WithoutMetaDatum; value: number | WithoutMetaDatum;
} | null) } | null)
| ({ | ({
relationTo: 'with-only-jpeg-meta-data'; relationTo: 'with-only-jpeg-meta-data';
value: string | WithOnlyJpegMetaDatum; value: number | WithOnlyJpegMetaDatum;
} | null) } | null)
| ({ | ({
relationTo: 'crop-only'; relationTo: 'crop-only';
value: string | CropOnly; value: number | CropOnly;
} | null) } | null)
| ({ | ({
relationTo: 'focal-only'; relationTo: 'focal-only';
value: string | FocalOnly; value: number | FocalOnly;
} | null) } | null)
| ({ | ({
relationTo: 'image-sizes-only'; relationTo: 'image-sizes-only';
value: string | ImageSizesOnly; value: number | ImageSizesOnly;
} | null) } | null)
| ({ | ({
relationTo: 'focal-no-sizes'; relationTo: 'focal-no-sizes';
value: string | FocalNoSize; value: number | FocalNoSize;
} | null) } | null)
| ({ | ({
relationTo: 'media'; relationTo: 'media';
value: string | Media; value: number | Media;
} | null) } | null)
| ({ | ({
relationTo: 'allow-list-media'; relationTo: 'allow-list-media';
value: string | AllowListMedia; value: number | AllowListMedia;
} | null) } | null)
| ({ | ({
relationTo: 'skip-safe-fetch-media'; relationTo: 'skip-safe-fetch-media';
value: string | SkipSafeFetchMedia; value: number | SkipSafeFetchMedia;
} | null) } | null)
| ({ | ({
relationTo: 'skip-safe-fetch-header-filter'; relationTo: 'skip-safe-fetch-header-filter';
value: string | SkipSafeFetchHeaderFilter; value: number | SkipSafeFetchHeaderFilter;
} | null) } | null)
| ({ | ({
relationTo: 'skip-allow-list-safe-fetch-media'; relationTo: 'skip-allow-list-safe-fetch-media';
value: string | SkipAllowListSafeFetchMedia; value: number | SkipAllowListSafeFetchMedia;
} | null) } | null)
| ({ | ({
relationTo: 'restrict-file-types'; relationTo: 'restrict-file-types';
value: string | RestrictFileType; value: number | RestrictFileType;
} | null) } | null)
| ({ | ({
relationTo: 'no-restrict-file-types'; relationTo: 'no-restrict-file-types';
value: string | NoRestrictFileType; value: number | NoRestrictFileType;
} | null) } | null)
| ({ | ({
relationTo: 'no-restrict-file-mime-types'; relationTo: 'no-restrict-file-mime-types';
value: string | NoRestrictFileMimeType; value: number | NoRestrictFileMimeType;
} | null) } | null)
| ({ | ({
relationTo: 'animated-type-media'; relationTo: 'animated-type-media';
value: string | AnimatedTypeMedia; value: number | AnimatedTypeMedia;
} | null) } | null)
| ({ | ({
relationTo: 'enlarge'; relationTo: 'enlarge';
value: string | Enlarge; value: number | Enlarge;
} | null) } | null)
| ({ | ({
relationTo: 'without-enlarge'; relationTo: 'without-enlarge';
value: string | WithoutEnlarge; value: number | WithoutEnlarge;
} | null) } | null)
| ({ | ({
relationTo: 'reduce'; relationTo: 'reduce';
value: string | Reduce; value: number | Reduce;
} | null) } | null)
| ({ | ({
relationTo: 'media-trim'; relationTo: 'media-trim';
value: string | MediaTrim; value: number | MediaTrim;
} | null) } | null)
| ({ | ({
relationTo: 'custom-file-name-media'; relationTo: 'custom-file-name-media';
value: string | CustomFileNameMedia; value: number | CustomFileNameMedia;
} | null) } | null)
| ({ | ({
relationTo: 'unstored-media'; relationTo: 'unstored-media';
value: string | UnstoredMedia; value: number | UnstoredMedia;
} | null) } | null)
| ({ | ({
relationTo: 'externally-served-media'; relationTo: 'externally-served-media';
value: string | ExternallyServedMedia; value: number | ExternallyServedMedia;
} | null) } | null)
| ({ | ({
relationTo: 'uploads-1'; relationTo: 'uploads-1';
value: string | Uploads1; value: number | Uploads1;
} | null) } | null)
| ({ | ({
relationTo: 'uploads-2'; relationTo: 'uploads-2';
value: string | Uploads2; value: number | Uploads2;
} | null) } | null)
| ({ | ({
relationTo: 'any-images'; relationTo: 'any-images';
value: string | AnyImage; value: number | AnyImage;
} | null) } | null)
| ({ | ({
relationTo: 'admin-thumbnail-function'; relationTo: 'admin-thumbnail-function';
value: string | AdminThumbnailFunction; value: number | AdminThumbnailFunction;
} | null) } | null)
| ({ | ({
relationTo: 'admin-thumbnail-with-search-queries'; relationTo: 'admin-thumbnail-with-search-queries';
value: string | AdminThumbnailWithSearchQuery; value: number | AdminThumbnailWithSearchQuery;
} | null) } | null)
| ({ | ({
relationTo: 'admin-thumbnail-size'; relationTo: 'admin-thumbnail-size';
value: string | AdminThumbnailSize; value: number | AdminThumbnailSize;
} | null) } | null)
| ({ | ({
relationTo: 'admin-upload-control'; relationTo: 'admin-upload-control';
value: string | AdminUploadControl; value: number | AdminUploadControl;
} | null) } | null)
| ({ | ({
relationTo: 'optional-file'; relationTo: 'optional-file';
value: string | OptionalFile; value: number | OptionalFile;
} | null) } | null)
| ({ | ({
relationTo: 'required-file'; relationTo: 'required-file';
value: string | RequiredFile; value: number | RequiredFile;
} | null) } | null)
| ({ | ({
relationTo: 'versions'; relationTo: 'versions';
value: string | Version; value: number | Version;
} | null) } | null)
| ({ | ({
relationTo: 'custom-upload-field'; relationTo: 'custom-upload-field';
value: string | CustomUploadField; value: number | CustomUploadField;
} | null) } | null)
| ({ | ({
relationTo: 'media-with-relation-preview'; relationTo: 'media-with-relation-preview';
value: string | MediaWithRelationPreview; value: number | MediaWithRelationPreview;
} | null) } | null)
| ({ | ({
relationTo: 'media-without-cache-tags'; relationTo: 'media-without-cache-tags';
value: string | MediaWithoutCacheTag; value: number | MediaWithoutCacheTag;
} | null) } | null)
| ({ | ({
relationTo: 'media-without-relation-preview'; relationTo: 'media-without-relation-preview';
value: string | MediaWithoutRelationPreview; value: number | MediaWithoutRelationPreview;
} | null) } | null)
| ({ | ({
relationTo: 'relation-preview'; relationTo: 'relation-preview';
value: string | RelationPreview; value: number | RelationPreview;
} | null) } | null)
| ({ | ({
relationTo: 'hide-file-input-on-create'; relationTo: 'hide-file-input-on-create';
value: string | HideFileInputOnCreate; value: number | HideFileInputOnCreate;
} | null) } | null)
| ({ | ({
relationTo: 'best-fit'; relationTo: 'best-fit';
value: string | BestFit; value: number | BestFit;
} | null) } | null)
| ({ | ({
relationTo: 'list-view-preview'; relationTo: 'list-view-preview';
value: string | ListViewPreview; value: number | ListViewPreview;
} | null) } | null)
| ({ | ({
relationTo: 'three-dimensional'; relationTo: 'three-dimensional';
value: string | ThreeDimensional; value: number | ThreeDimensional;
} | null) } | null)
| ({ | ({
relationTo: 'constructor-options'; relationTo: 'constructor-options';
value: string | ConstructorOption; value: number | ConstructorOption;
} | null) } | null)
| ({ | ({
relationTo: 'bulk-uploads'; relationTo: 'bulk-uploads';
value: string | BulkUpload; value: number | BulkUpload;
} | null) } | null)
| ({ | ({
relationTo: 'simple-relationship'; relationTo: 'simple-relationship';
value: string | SimpleRelationship; value: number | SimpleRelationship;
} | null) } | null)
| ({ | ({
relationTo: 'file-mime-type'; relationTo: 'file-mime-type';
value: string | FileMimeType; value: number | FileMimeType;
} | null) } | null)
| ({ | ({
relationTo: 'svg-only'; relationTo: 'svg-only';
value: string | SvgOnly; value: number | SvgOnly;
} | null) } | null)
| ({ | ({
relationTo: 'media-without-delete-access'; relationTo: 'media-without-delete-access';
value: string | MediaWithoutDeleteAccess; value: number | MediaWithoutDeleteAccess;
} | null) } | null)
| ({ | ({
relationTo: 'media-with-image-size-admin-props'; relationTo: 'media-with-image-size-admin-props';
value: string | MediaWithImageSizeAdminProp; value: number | MediaWithImageSizeAdminProp;
} | null) } | null)
| ({ | ({
relationTo: 'users'; relationTo: 'users';
value: string | User; value: number | User;
} | null); } | null);
globalSlug?: string | null; globalSlug?: string | null;
user: { user: {
relationTo: 'users'; relationTo: 'users';
value: string | User; value: number | User;
}; };
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -1986,10 +1997,10 @@ export interface PayloadLockedDocument {
* via the `definition` "payload-preferences". * via the `definition` "payload-preferences".
*/ */
export interface PayloadPreference { export interface PayloadPreference {
id: string; id: number;
user: { user: {
relationTo: 'users'; relationTo: 'users';
value: string | User; value: number | User;
}; };
key?: string | null; key?: string | null;
value?: value?:
@@ -2009,7 +2020,7 @@ export interface PayloadPreference {
* via the `definition` "payload-migrations". * via the `definition` "payload-migrations".
*/ */
export interface PayloadMigration { export interface PayloadMigration {
id: string; id: number;
name?: string | null; name?: string | null;
batch?: number | null; batch?: number | null;
updatedAt: string; updatedAt: string;
@@ -2023,8 +2034,21 @@ export interface RelationSelect<T extends boolean = true> {
image?: T; image?: T;
versionedImage?: T; versionedImage?: T;
hideFileInputOnCreate?: T; hideFileInputOnCreate?: T;
blocks?:
| T
| {
localizedMediaBlock?:
| T
| {
media?: T;
relatedMedia?: T;
id?: T;
blockName?: T;
};
};
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
_status?: T;
} }
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
@@ -2455,6 +2479,7 @@ export interface FocalNoSizesSelect<T extends boolean = true> {
*/ */
export interface MediaSelect<T extends boolean = true> { export interface MediaSelect<T extends boolean = true> {
alt?: T; alt?: T;
localized?: T;
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
url?: T; url?: T;