perf: reduce generated types for select by respecting interfaceName (#9870)

This PR can significantly reduce your `payload-types.ts` file if you
have sharable fields / blocks that use the `interfaceName` property.
Previously we didn't respect it for select types.

Before:
```ts
export interface Collection1Select<T extends boolean = true> {
  testing?: T;
  title?: T;
  meta?:
    | T
    | {
        title?: T;
        description?: T;
        id?: T;
      };
  blocks?:
    | T
    | {
        block1?:
          | T
          | {
              b1title?: T;
              b1description?: T;
              id?: T;
              blockName?: T;
            };
        block2?:
          | T
          | {
              b2title?: T;
              b2description?: T;
              id?: T;
              blockName?: T;
            };
      };
  updatedAt?: T;
  createdAt?: T;
}
```
After:
```ts
export interface Collection1Select<T extends boolean = true> {
  testing?: T;
  title?: T;
  meta?: T | SharedMetaArraySelect<T>;
  blocks?:
    | T
    | {
        block1?: T | SharedMetaBlockSelect<T>;
        block2?: T | AnotherSharedBlockSelect<T>;
      };
  updatedAt?: T;
  createdAt?: T;
}

/**
 * This interface was referenced by `Config`'s JSON-Schema
 * via the `definition` "SharedMetaArray_select".
 */
export interface SharedMetaArraySelect<T extends boolean = true> {
  title?: T;
  description?: T;
  id?: T;
}
/**
 * This interface was referenced by `Config`'s JSON-Schema
 * via the `definition` "SharedMetaBlock_select".
 */
export interface SharedMetaBlockSelect<T extends boolean = true> {
  b1title?: T;
  b1description?: T;
  id?: T;
  blockName?: T;
}
/**
 * This interface was referenced by `Config`'s JSON-Schema
 * via the `definition` "AnotherSharedBlock_select".
 */
export interface AnotherSharedBlockSelect<T extends boolean = true> {
  b2title?: T;
  b2description?: T;
  id?: T;
  blockName?: T;
}
```

Regenerated all the types in `/test`. The diff is noticeable for
`fields` -
https://github.com/payloadcms/payload/pull/9870/files#diff-95beaac24c72c7bd60933e325cdcd94a4c3630a1ce22fabad624ec80cc74fc8c
This commit is contained in:
Sasha
2024-12-16 17:22:17 +02:00
committed by GitHub
parent 727fba7b1c
commit 26a10ed071
7 changed files with 409 additions and 652 deletions

View File

@@ -178,6 +178,7 @@ export interface PayloadMigration {
export interface PostsSelect { export interface PostsSelect {
text?: boolean; text?: boolean;
number?: boolean; number?: boolean;
sharedGroup?: boolean | SharedGroup;
group?: group?:
| boolean | boolean
| { | {
@@ -451,6 +452,7 @@ export interface PayloadMigration {
export interface PostsSelect<T extends boolean = true> { export interface PostsSelect<T extends boolean = true> {
text?: T; text?: T;
number?: T; number?: T;
sharedGroup?: T | SharedGroup<T>;
group?: group?:
| T | T
| { | {

View File

@@ -35,8 +35,14 @@ export const addSelectGenericsToGeneratedTypes = ({
// add generic to the interface // add generic to the interface
newLine = line.replace(/(export interface\s+\w+)(\s*\{)/g, '$1<T extends boolean = true>$2') newLine = line.replace(/(export interface\s+\w+)(\s*\{)/g, '$1<T extends boolean = true>$2')
} else { } else {
// replace booleans with T on the line newLine = line
newLine = line.replace(/(?<!\?)\bboolean\b/g, 'T') // replace booleans with T on the line
.replace(/(?<!\?)\bboolean\b/g, 'T')
// replace interface names like CtaBlock to CtaBlock<T>
.replace(
/\b(\w+)\s*\|\s*(\w+)\b/g,
(_match, left, right) => `${left} | ${right}<${left}>`,
)
if (line === '}') { if (line === '}') {
isSelectTypeToken = false isSelectTypeToken = false

View File

@@ -643,7 +643,13 @@ export function entityToJSONSchema(
} }
} }
export function fieldsToSelectJSONSchema({ fields }: { fields: FlattenedField[] }): JSONSchema4 { export function fieldsToSelectJSONSchema({
fields,
interfaceNameDefinitions,
}: {
fields: FlattenedField[]
interfaceNameDefinitions: Map<string, JSONSchema4>
}): JSONSchema4 {
const schema: JSONSchema4 = { const schema: JSONSchema4 = {
type: 'object', type: 'object',
additionalProperties: false, additionalProperties: false,
@@ -654,16 +660,32 @@ export function fieldsToSelectJSONSchema({ fields }: { fields: FlattenedField[]
switch (field.type) { switch (field.type) {
case 'array': case 'array':
case 'group': case 'group':
case 'tab': case 'tab': {
let fieldSchema: JSONSchema4 = fieldsToSelectJSONSchema({
fields: field.flattenedFields,
interfaceNameDefinitions,
})
if (field.interfaceName) {
const definition = `${field.interfaceName}_select`
interfaceNameDefinitions.set(definition, fieldSchema)
fieldSchema = {
$ref: `#/definitions/${definition}`,
}
}
schema.properties[field.name] = { schema.properties[field.name] = {
oneOf: [ oneOf: [
{ {
type: 'boolean', type: 'boolean',
}, },
fieldsToSelectJSONSchema({ fields: field.flattenedFields }), fieldSchema,
], ],
} }
break break
}
case 'blocks': { case 'blocks': {
const blocksSchema: JSONSchema4 = { const blocksSchema: JSONSchema4 = {
@@ -673,12 +695,25 @@ export function fieldsToSelectJSONSchema({ fields }: { fields: FlattenedField[]
} }
for (const block of field.blocks) { for (const block of field.blocks) {
let blockSchema = fieldsToSelectJSONSchema({
fields: block.flattenedFields,
interfaceNameDefinitions,
})
if (block.interfaceName) {
const definition = `${block.interfaceName}_select`
interfaceNameDefinitions.set(definition, blockSchema)
blockSchema = {
$ref: `#/definitions/${definition}`,
}
}
blocksSchema.properties[block.slug] = { blocksSchema.properties[block.slug] = {
oneOf: [ oneOf: [
{ {
type: 'boolean', type: 'boolean',
}, },
fieldsToSelectJSONSchema({ fields: block.flattenedFields }), blockSchema,
], ],
} }
} }
@@ -900,7 +935,10 @@ export function configToJSONSchema(
defaultIDType, defaultIDType,
collectionIDFieldTypes, collectionIDFieldTypes,
) )
const select = fieldsToSelectJSONSchema({ fields: entity.flattenedFields }) const select = fieldsToSelectJSONSchema({
fields: entity.flattenedFields,
interfaceNameDefinitions,
})
if (type === 'global') { if (type === 'global') {
select.properties.globalType = { select.properties.globalType = {

View File

@@ -35,7 +35,7 @@ export interface Config {
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>; 'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
}; };
db: { db: {
defaultIDType: number; defaultIDType: string;
}; };
globals: {}; globals: {};
globalsSelect: {}; globalsSelect: {};
@@ -135,7 +135,7 @@ export interface PublicUserAuthOperations {
* via the `definition` "users". * via the `definition` "users".
*/ */
export interface User { export interface User {
id: number; id: string;
adminOnlyField?: string | null; adminOnlyField?: string | null;
roles: ('admin' | 'editor' | 'moderator' | 'user' | 'viewer')[]; roles: ('admin' | 'editor' | 'moderator' | 'user' | 'viewer')[];
namedSaveToJWT?: string | null; namedSaveToJWT?: string | null;
@@ -175,7 +175,7 @@ export interface User {
* via the `definition` "partial-disable-locale-strategies". * via the `definition` "partial-disable-locale-strategies".
*/ */
export interface PartialDisableLocaleStrategy { export interface PartialDisableLocaleStrategy {
id: number; id: string;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
email: string; email: string;
@@ -192,7 +192,7 @@ export interface PartialDisableLocaleStrategy {
* via the `definition` "api-keys". * via the `definition` "api-keys".
*/ */
export interface ApiKey { export interface ApiKey {
id: number; id: string;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
enableAPIKey?: boolean | null; enableAPIKey?: boolean | null;
@@ -204,7 +204,7 @@ export interface ApiKey {
* via the `definition` "public-users". * via the `definition` "public-users".
*/ */
export interface PublicUser { export interface PublicUser {
id: number; id: string;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
email: string; email: string;
@@ -223,8 +223,8 @@ export interface PublicUser {
* via the `definition` "relationsCollection". * via the `definition` "relationsCollection".
*/ */
export interface RelationsCollection { export interface RelationsCollection {
id: number; id: string;
rel?: (number | null) | User; rel?: (string | null) | User;
text?: string | null; text?: string | null;
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -234,45 +234,45 @@ export interface RelationsCollection {
* via the `definition` "payload-locked-documents". * via the `definition` "payload-locked-documents".
*/ */
export interface PayloadLockedDocument { export interface PayloadLockedDocument {
id: number; id: string;
document?: document?:
| ({ | ({
relationTo: 'users'; relationTo: 'users';
value: number | User; value: string | User;
} | null) } | null)
| ({ | ({
relationTo: 'partial-disable-locale-strategies'; relationTo: 'partial-disable-locale-strategies';
value: number | PartialDisableLocaleStrategy; value: string | PartialDisableLocaleStrategy;
} | null) } | null)
| ({ | ({
relationTo: 'api-keys'; relationTo: 'api-keys';
value: number | ApiKey; value: string | ApiKey;
} | null) } | null)
| ({ | ({
relationTo: 'public-users'; relationTo: 'public-users';
value: number | PublicUser; value: string | PublicUser;
} | null) } | null)
| ({ | ({
relationTo: 'relationsCollection'; relationTo: 'relationsCollection';
value: number | RelationsCollection; value: string | RelationsCollection;
} | null); } | null);
globalSlug?: string | null; globalSlug?: string | null;
user: user:
| { | {
relationTo: 'users'; relationTo: 'users';
value: number | User; value: string | User;
} }
| { | {
relationTo: 'partial-disable-locale-strategies'; relationTo: 'partial-disable-locale-strategies';
value: number | PartialDisableLocaleStrategy; value: string | PartialDisableLocaleStrategy;
} }
| { | {
relationTo: 'api-keys'; relationTo: 'api-keys';
value: number | ApiKey; value: string | ApiKey;
} }
| { | {
relationTo: 'public-users'; relationTo: 'public-users';
value: number | PublicUser; value: string | PublicUser;
}; };
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
@@ -282,23 +282,23 @@ export interface PayloadLockedDocument {
* via the `definition` "payload-preferences". * via the `definition` "payload-preferences".
*/ */
export interface PayloadPreference { export interface PayloadPreference {
id: number; id: string;
user: user:
| { | {
relationTo: 'users'; relationTo: 'users';
value: number | User; value: string | User;
} }
| { | {
relationTo: 'partial-disable-locale-strategies'; relationTo: 'partial-disable-locale-strategies';
value: number | PartialDisableLocaleStrategy; value: string | PartialDisableLocaleStrategy;
} }
| { | {
relationTo: 'api-keys'; relationTo: 'api-keys';
value: number | ApiKey; value: string | ApiKey;
} }
| { | {
relationTo: 'public-users'; relationTo: 'public-users';
value: number | PublicUser; value: string | PublicUser;
}; };
key?: string | null; key?: string | null;
value?: value?:
@@ -318,7 +318,7 @@ export interface PayloadPreference {
* via the `definition` "payload-migrations". * via the `definition` "payload-migrations".
*/ */
export interface PayloadMigration { export interface PayloadMigration {
id: number; id: string;
name?: string | null; name?: string | null;
batch?: number | null; batch?: number | null;
updatedAt: string; updatedAt: string;

View File

@@ -11,6 +11,7 @@ export const getBlocksField = (prefix?: string): BlocksField => ({
blocks: [ blocks: [
{ {
slug: prefix ? `${prefix}Content` : 'content', slug: prefix ? `${prefix}Content` : 'content',
interfaceName: prefix ? `${prefix}ContentBlock` : 'ContentBlock',
fields: [ fields: [
{ {
name: 'text', name: 'text',
@@ -26,6 +27,7 @@ export const getBlocksField = (prefix?: string): BlocksField => ({
}, },
{ {
slug: prefix ? `${prefix}Number` : 'number', slug: prefix ? `${prefix}Number` : 'number',
interfaceName: prefix ? `${prefix}NumberBlock` : 'NumberBlock',
fields: [ fields: [
{ {
name: 'number', name: 'number',
@@ -36,6 +38,7 @@ export const getBlocksField = (prefix?: string): BlocksField => ({
}, },
{ {
slug: prefix ? `${prefix}SubBlocks` : 'subBlocks', slug: prefix ? `${prefix}SubBlocks` : 'subBlocks',
interfaceName: prefix ? `${prefix}SubBlocksBlock` : 'SubBlocksBlock',
fields: [ fields: [
{ {
type: 'collapsible', type: 'collapsible',
@@ -73,6 +76,7 @@ export const getBlocksField = (prefix?: string): BlocksField => ({
}, },
{ {
slug: prefix ? `${prefix}Tabs` : 'tabs', slug: prefix ? `${prefix}Tabs` : 'tabs',
interfaceName: prefix ? `${prefix}TabsBlock` : 'TabsBlock',
fields: [ fields: [
{ {
type: 'tabs', type: 'tabs',

View File

@@ -514,241 +514,16 @@ export interface ArrayField {
*/ */
export interface BlockField { export interface BlockField {
id: string; id: string;
blocks: ( blocks: (ContentBlock | NumberBlock | SubBlocksBlock | TabsBlock)[];
| { duplicate: (ContentBlock | NumberBlock | SubBlocksBlock | TabsBlock)[];
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';
}
)[];
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: (
| { | LocalizedContentBlock
text: string; | LocalizedNumberBlock
richText?: | LocalizedSubBlocksBlock
| { | LocalizedTabsBlock
[k: string]: unknown;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedContent';
}
| {
number: number;
id?: string | null;
blockName?: string | null;
blockType: 'localizedNumber';
}
| {
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: 'localizedSubBlocks';
}
| {
textInCollapsible?: string | null;
textInRow?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedTabs';
}
)[];
disableSort: (
| {
text: string;
richText?:
| {
[k: string]: unknown;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedContent';
}
| {
number: number;
id?: string | null;
blockName?: string | null;
blockType: 'localizedNumber';
}
| {
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: 'localizedSubBlocks';
}
| {
textInCollapsible?: string | null;
textInRow?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedTabs';
}
)[];
localizedBlocks: (
| {
text: string;
richText?:
| {
[k: string]: unknown;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedContent';
}
| {
number: number;
id?: string | null;
blockName?: string | null;
blockType: 'localizedNumber';
}
| {
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: 'localizedSubBlocks';
}
| {
textInCollapsible?: string | null;
textInRow?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedTabs';
}
)[]; )[];
disableSort: (LocalizedContentBlock | LocalizedNumberBlock | LocalizedSubBlocksBlock | LocalizedTabsBlock)[];
localizedBlocks: (LocalizedContentBlock | LocalizedNumberBlock | LocalizedSubBlocksBlock | LocalizedTabsBlock)[];
i18nBlocks?: i18nBlocks?:
| { | {
text?: string | null; text?: string | null;
@@ -862,6 +637,128 @@ export interface BlockField {
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "ContentBlock".
*/
export interface ContentBlock {
text: string;
richText?:
| {
[k: string]: unknown;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'content';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "NumberBlock".
*/
export interface NumberBlock {
number: number;
id?: string | null;
blockName?: string | null;
blockType: 'number';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SubBlocksBlock".
*/
export interface SubBlocksBlock {
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';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "TabsBlock".
*/
export interface TabsBlock {
textInCollapsible?: string | null;
textInRow?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'tabs';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedContentBlock".
*/
export interface LocalizedContentBlock {
text: string;
richText?:
| {
[k: string]: unknown;
}[]
| null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedContent';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedNumberBlock".
*/
export interface LocalizedNumberBlock {
number: number;
id?: string | null;
blockName?: string | null;
blockType: 'localizedNumber';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedSubBlocksBlock".
*/
export interface LocalizedSubBlocksBlock {
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: 'localizedSubBlocks';
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedTabsBlock".
*/
export interface LocalizedTabsBlock {
textInCollapsible?: string | null;
textInRow?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'localizedTabs';
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "text-fields". * via the `definition` "text-fields".
@@ -1563,53 +1460,7 @@ export interface TabsField {
text: string; text: string;
id?: string | null; id?: string | null;
}[]; }[];
blocks: ( blocks: (ContentBlock | NumberBlock | SubBlocksBlock | TabsBlock)[];
| {
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';
}
)[];
group: { group: {
number: number; number: number;
}; };
@@ -2200,257 +2051,42 @@ export interface BlockFieldsSelect<T extends boolean = true> {
blocks?: blocks?:
| T | T
| { | {
content?: content?: T | ContentBlockSelect<T>;
| T number?: T | NumberBlockSelect<T>;
| { subBlocks?: T | SubBlocksBlockSelect<T>;
text?: T; tabs?: T | TabsBlockSelect<T>;
richText?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
subBlocks?:
| T
| {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
};
tabs?:
| T
| {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
};
}; };
duplicate?: duplicate?:
| T | T
| { | {
content?: content?: T | ContentBlockSelect<T>;
| T number?: T | NumberBlockSelect<T>;
| { subBlocks?: T | SubBlocksBlockSelect<T>;
text?: T; tabs?: T | TabsBlockSelect<T>;
richText?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
subBlocks?:
| T
| {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
};
tabs?:
| T
| {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
};
}; };
collapsedByDefaultBlocks?: collapsedByDefaultBlocks?:
| T | T
| { | {
localizedContent?: localizedContent?: T | LocalizedContentBlockSelect<T>;
| T localizedNumber?: T | LocalizedNumberBlockSelect<T>;
| { localizedSubBlocks?: T | LocalizedSubBlocksBlockSelect<T>;
text?: T; localizedTabs?: T | LocalizedTabsBlockSelect<T>;
richText?: T;
id?: T;
blockName?: T;
};
localizedNumber?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
localizedSubBlocks?:
| T
| {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
};
localizedTabs?:
| T
| {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
};
}; };
disableSort?: disableSort?:
| T | T
| { | {
localizedContent?: localizedContent?: T | LocalizedContentBlockSelect<T>;
| T localizedNumber?: T | LocalizedNumberBlockSelect<T>;
| { localizedSubBlocks?: T | LocalizedSubBlocksBlockSelect<T>;
text?: T; localizedTabs?: T | LocalizedTabsBlockSelect<T>;
richText?: T;
id?: T;
blockName?: T;
};
localizedNumber?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
localizedSubBlocks?:
| T
| {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
};
localizedTabs?:
| T
| {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
};
}; };
localizedBlocks?: localizedBlocks?:
| T | T
| { | {
localizedContent?: localizedContent?: T | LocalizedContentBlockSelect<T>;
| T localizedNumber?: T | LocalizedNumberBlockSelect<T>;
| { localizedSubBlocks?: T | LocalizedSubBlocksBlockSelect<T>;
text?: T; localizedTabs?: T | LocalizedTabsBlockSelect<T>;
richText?: T;
id?: T;
blockName?: T;
};
localizedNumber?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
localizedSubBlocks?:
| T
| {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
};
localizedTabs?:
| T
| {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
};
}; };
i18nBlocks?: i18nBlocks?:
| T | T
@@ -2588,6 +2224,116 @@ export interface BlockFieldsSelect<T extends boolean = true> {
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "ContentBlock_select".
*/
export interface ContentBlockSelect<T extends boolean = true> {
text?: T;
richText?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "NumberBlock_select".
*/
export interface NumberBlockSelect<T extends boolean = true> {
number?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SubBlocksBlock_select".
*/
export interface SubBlocksBlockSelect<T extends boolean = true> {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "TabsBlock_select".
*/
export interface TabsBlockSelect<T extends boolean = true> {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedContentBlock_select".
*/
export interface LocalizedContentBlockSelect<T extends boolean = true> {
text?: T;
richText?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedNumberBlock_select".
*/
export interface LocalizedNumberBlockSelect<T extends boolean = true> {
number?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedSubBlocksBlock_select".
*/
export interface LocalizedSubBlocksBlockSelect<T extends boolean = true> {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "localizedTabsBlock_select".
*/
export interface LocalizedTabsBlockSelect<T extends boolean = true> {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "checkbox-fields_select". * via the `definition` "checkbox-fields_select".
@@ -3145,53 +2891,10 @@ export interface TabsFieldsSelect<T extends boolean = true> {
blocks?: blocks?:
| T | T
| { | {
content?: content?: T | ContentBlockSelect<T>;
| T number?: T | NumberBlockSelect<T>;
| { subBlocks?: T | SubBlocksBlockSelect<T>;
text?: T; tabs?: T | TabsBlockSelect<T>;
richText?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
subBlocks?:
| T
| {
subBlocks?:
| T
| {
text?:
| T
| {
text?: T;
id?: T;
blockName?: T;
};
number?:
| T
| {
number?: T;
id?: T;
blockName?: T;
};
};
id?: T;
blockName?: T;
};
tabs?:
| T
| {
textInCollapsible?: T;
textInRow?: T;
id?: T;
blockName?: T;
};
}; };
group?: group?:
| T | T
@@ -3201,24 +2904,7 @@ export interface TabsFieldsSelect<T extends boolean = true> {
textInRow?: T; textInRow?: T;
numberInRow?: T; numberInRow?: T;
json?: T; json?: T;
tab?: tab?: T | TabWithNameSelect<T>;
| T
| {
array?:
| T
| {
text?: T;
id?: T;
};
text?: T;
defaultValue?: T;
arrayInRow?:
| T
| {
textInArrayInRow?: T;
id?: T;
};
};
namedTabWithDefaultValue?: namedTabWithDefaultValue?:
| T | T
| { | {
@@ -3268,6 +2954,26 @@ export interface TabsFieldsSelect<T extends boolean = true> {
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "TabWithName_select".
*/
export interface TabWithNameSelect<T extends boolean = true> {
array?:
| T
| {
text?: T;
id?: T;
};
text?: T;
defaultValue?: T;
arrayInRow?:
| T
| {
textInArrayInRow?: T;
id?: T;
};
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "text-fields_select". * via the `definition` "text-fields_select".

View File

@@ -229,67 +229,68 @@ export interface PayloadMigration {
export interface Collection1Select<T extends boolean = true> { export interface Collection1Select<T extends boolean = true> {
testing?: T; testing?: T;
title?: T; title?: T;
meta?: meta?: T | SharedMetaArraySelect<T>;
| T
| {
title?: T;
description?: T;
id?: T;
};
blocks?: blocks?:
| T | T
| { | {
block1?: block1?: T | SharedMetaBlockSelect<T>;
| T block2?: T | AnotherSharedBlockSelect<T>;
| {
b1title?: T;
b1description?: T;
id?: T;
blockName?: T;
};
block2?:
| T
| {
b2title?: T;
b2description?: T;
id?: T;
blockName?: T;
};
}; };
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SharedMetaArray_select".
*/
export interface SharedMetaArraySelect<T extends boolean = true> {
title?: T;
description?: T;
id?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SharedMetaBlock_select".
*/
export interface SharedMetaBlockSelect<T extends boolean = true> {
b1title?: T;
b1description?: T;
id?: T;
blockName?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "AnotherSharedBlock_select".
*/
export interface AnotherSharedBlockSelect<T extends boolean = true> {
b2title?: T;
b2description?: T;
id?: T;
blockName?: T;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "collection2_select". * via the `definition` "collection2_select".
*/ */
export interface Collection2Select<T extends boolean = true> { export interface Collection2Select<T extends boolean = true> {
metaArray?: metaArray?: T | SharedMetaArraySelect<T>;
| T metaGroup?: T | SharedMetaSelect<T>;
| {
title?: T;
description?: T;
id?: T;
};
metaGroup?:
| T
| {
title?: T;
description?: T;
};
nestedGroup?: nestedGroup?:
| T | T
| { | {
meta?: meta?: T | SharedMetaSelect<T>;
| T
| {
title?: T;
description?: T;
};
}; };
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "SharedMeta_select".
*/
export interface SharedMetaSelect<T extends boolean = true> {
title?: T;
description?: T;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "no-graphql_select". * via the `definition` "no-graphql_select".