Files
payload/test/localization/payload-types.ts
James Mikrut 18b0806b5b fix(db-postgres, db-sqlite): hasMany text, number, poly relationship, blocks, arrays within localized fields (#7900)
## Description

In Postgres, localized blocks or arrays that contain other array / block
/ relationship fields were not properly storing locales in the database.

Now they are! Need to check a few things yet:

- Ensure test coverage is sufficient
- Test localized array, with non-localized array inside of it
- Test localized block with relationship field within it
- Ensure `_rels` table gets the `locale` column added if a single
non-localized relationship exists within a localized array / block

Fixes step 6 as identified in #7805
2024-08-28 17:43:12 +00:00

477 lines
10 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
* This file was automatically generated by Payload.
* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,
* and re-run `payload generate:types` to regenerate this file.
*/
export interface Config {
auth: {
users: UserAuthOperations;
};
collections: {
'blocks-fields': BlocksField;
'nested-arrays': NestedArray;
'nested-fields': NestedField;
users: User;
'localized-posts': LocalizedPost;
'array-fields': ArrayField;
'localized-required': LocalizedRequired;
'with-localized-relationship': WithLocalizedRelationship;
'relationship-localized': RelationshipLocalized;
dummy: Dummy;
nested: Nested;
groups: Group;
tabs: Tab;
'localized-sort': LocalizedSort;
'blocks-same-name': BlocksSameName;
'payload-preferences': PayloadPreference;
'payload-migrations': PayloadMigration;
};
db: {
defaultIDType: number;
};
globals: {
'global-array': GlobalArray;
};
locale: 'en' | 'es' | 'pt' | 'ar' | 'hu';
user: User & {
collection: 'users';
};
}
export interface UserAuthOperations {
forgotPassword: {
email: string;
password: string;
};
login: {
email: string;
password: string;
};
registerFirstUser: {
email: string;
password: string;
};
unlock: {
email: string;
password: string;
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "blocks-fields".
*/
export interface BlocksField {
id: number;
content?:
| {
content?:
| {
text?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'textBlock';
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'blockInsideBlock';
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "nested-arrays".
*/
export interface NestedArray {
id: number;
arrayWithBlocks?:
| {
blocksWithinArray?:
| {
relationWithinBlock?: (number | null) | LocalizedPost;
id?: string | null;
blockName?: string | null;
blockType: 'someBlock';
}[]
| null;
id?: string | null;
}[]
| null;
arrayWithLocalizedRelation?:
| {
localizedRelation?: (number | null) | LocalizedPost;
id?: string | null;
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localized-posts".
*/
export interface LocalizedPost {
id: number;
title?: string | null;
description?: string | null;
localizedDescription?: string | null;
localizedCheckbox?: boolean | null;
children?: (number | LocalizedPost)[] | null;
group?: {
children?: string | null;
};
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "nested-fields".
*/
export interface NestedField {
id: number;
array?:
| {
relation?: {
relationTo: 'localized-posts';
value: number | LocalizedPost;
} | null;
hasManyRelation?: (number | LocalizedPost)[] | null;
hasManyPolyRelation?:
| {
relationTo: 'localized-posts';
value: number | LocalizedPost;
}[]
| null;
select?: ('one' | 'two' | 'three')[] | null;
number?: number[] | null;
text?: string[] | null;
id?: string | null;
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users".
*/
export interface User {
id: number;
relation?: (number | null) | LocalizedPost;
updatedAt: string;
createdAt: string;
email: string;
resetPasswordToken?: string | null;
resetPasswordExpiration?: string | null;
salt?: string | null;
hash?: string | null;
loginAttempts?: number | null;
lockUntil?: string | null;
password?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "array-fields".
*/
export interface ArrayField {
id: number;
items?:
| {
text: string;
id?: string | null;
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localized-required".
*/
export interface LocalizedRequired {
id: number;
title: string;
layout: (
| {
text?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'text';
}
| {
number?: number | null;
id?: string | null;
blockName?: string | null;
blockType: 'number';
}
)[];
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "with-localized-relationship".
*/
export interface WithLocalizedRelationship {
id: number;
localizedRelationship?: (number | null) | LocalizedPost;
localizedRelationHasManyField?: (number | LocalizedPost)[] | null;
localizedRelationMultiRelationTo?:
| ({
relationTo: 'localized-posts';
value: number | LocalizedPost;
} | null)
| ({
relationTo: 'dummy';
value: number | Dummy;
} | null);
localizedRelationMultiRelationToHasMany?:
| (
| {
relationTo: 'localized-posts';
value: number | LocalizedPost;
}
| {
relationTo: 'dummy';
value: number | Dummy;
}
)[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "dummy".
*/
export interface Dummy {
id: number;
name?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "relationship-localized".
*/
export interface RelationshipLocalized {
id: number;
relationship?: (number | null) | LocalizedPost;
relationshipHasMany?: (number | LocalizedPost)[] | null;
relationMultiRelationTo?:
| ({
relationTo: 'localized-posts';
value: number | LocalizedPost;
} | null)
| ({
relationTo: 'dummy';
value: number | Dummy;
} | null);
relationMultiRelationToHasMany?:
| (
| {
relationTo: 'localized-posts';
value: number | LocalizedPost;
}
| {
relationTo: 'dummy';
value: number | Dummy;
}
)[]
| null;
arrayField?:
| {
nestedRelation?: (number | null) | LocalizedPost;
id?: string | null;
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "nested".
*/
export interface Nested {
id: number;
blocks?:
| {
array?:
| {
text?: string | null;
textNotLocalized?: string | null;
id?: string | null;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'block';
}[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "groups".
*/
export interface Group {
id: number;
groupLocalized?: {
title?: string | null;
};
group?: {
title?: string | null;
};
deep?: {
array?:
| {
title?: string | null;
id?: string | null;
}[]
| null;
blocks?:
| {
title?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'first';
}[]
| null;
};
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "tabs".
*/
export interface Tab {
id: number;
tabLocalized?: {
title?: string | null;
};
tab?: {
title?: string | null;
};
deep?: {
array?:
| {
title?: string | null;
id?: string | null;
}[]
| null;
blocks?:
| {
title?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'first';
}[]
| null;
};
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localized-sort".
*/
export interface LocalizedSort {
id: number;
title?: string | null;
date?: string | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "blocks-same-name".
*/
export interface BlocksSameName {
id: number;
blocks?:
| (
| {
title?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'block_first';
}
| {
title?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'block_second';
}
)[]
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-preferences".
*/
export interface PayloadPreference {
id: number;
user: {
relationTo: 'users';
value: number | User;
};
key?: string | null;
value?:
| {
[k: string]: unknown;
}
| unknown[]
| string
| number
| boolean
| null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-migrations".
*/
export interface PayloadMigration {
id: number;
name?: string | null;
batch?: number | null;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "global-array".
*/
export interface GlobalArray {
id: number;
array?:
| {
text?: string | null;
id?: string | null;
}[]
| null;
updatedAt?: string | null;
createdAt?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "auth".
*/
export interface Auth {
[k: string]: unknown;
}
declare module 'payload' {
// @ts-ignore
export interface GeneratedTypes extends Config {}
}