diff --git a/packages/payload/src/bin/generateTypes.ts b/packages/payload/src/bin/generateTypes.ts index c6d1c1658..97bb9d2bc 100644 --- a/packages/payload/src/bin/generateTypes.ts +++ b/packages/payload/src/bin/generateTypes.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-floating-promises */ import fs from 'fs' import { compile } from 'json-schema-to-typescript' @@ -7,7 +6,7 @@ import type { SanitizedConfig } from '../config/types.js' import { configToJSONSchema } from '../utilities/configToJSONSchema.js' import Logger from '../utilities/logger.js' -export function generateTypes(config: SanitizedConfig): void { +export async function generateTypes(config: SanitizedConfig): Promise { const logger = Logger() const outputFile = process.env.PAYLOAD_TS_OUTPUT_PATH || config.typescript.outputFile @@ -16,8 +15,9 @@ export function generateTypes(config: SanitizedConfig): void { const jsonSchema = configToJSONSchema(config, config.db.defaultIDType) const declare = `declare module 'payload' {\n export interface GeneratedTypes extends Config {}\n}` + const declareWithTSIgnoreError = `declare module 'payload' {\n // @ts-ignore \n export interface GeneratedTypes extends Config {}\n}` - compile(jsonSchema, 'Config', { + let compiled = await compile(jsonSchema, 'Config', { bannerComment: '/* tslint:disable */\n/* eslint-disable */\n/**\n* This file was automatically generated by Payload.\n* DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config,\n* and re-run `payload generate:types` to regenerate this file.\n*/', style: { @@ -27,11 +27,15 @@ export function generateTypes(config: SanitizedConfig): void { // If a field defines an interfaceName, it should be included in the generated types // even if it's not used by another type. Reason: the user might want to use it in their own code. unreachableDefinitions: true, - }).then((compiled) => { - if (config.typescript.declare !== false) { + }) + + if (config.typescript.declare !== false) { + if (config.typescript.declare?.ignoreTSError) { + compiled += `\n\n${declareWithTSIgnoreError}` + } else { compiled += `\n\n${declare}` } - fs.writeFileSync(outputFile, compiled) - logger.info(`Types written to ${outputFile}`) - }) + } + fs.writeFileSync(outputFile, compiled) + logger.info(`Types written to ${outputFile}`) } diff --git a/packages/payload/src/config/schema.ts b/packages/payload/src/config/schema.ts index f8245e0b3..23eb9ac71 100644 --- a/packages/payload/src/config/schema.ts +++ b/packages/payload/src/config/schema.ts @@ -178,7 +178,7 @@ export default joi.object({ sharp: joi.any(), telemetry: joi.boolean(), typescript: joi.object({ - declare: joi.boolean(), + declare: joi.alternatives().try(joi.boolean(), joi.object({ ignoreTSError: joi.boolean() })), outputFile: joi.string(), }), upload: joi.object(), diff --git a/packages/payload/src/config/types.ts b/packages/payload/src/config/types.ts index 6a94f9557..1177a7c32 100644 --- a/packages/payload/src/config/types.ts +++ b/packages/payload/src/config/types.ts @@ -629,7 +629,18 @@ export type Config = { /** Control how typescript interfaces are generated from your collections. */ typescript?: { /** Disable declare block in generated types file */ - declare?: false + declare?: + | { + /** + * @internal internal use only to allow for multiple declarations within a monorepo and suppress the "Duplicate identifier GeneratedTypes" error + * + * Adds a @ts-ignore flag above the GeneratedTypes interface declaration + * + * @default false + */ + ignoreTSError?: boolean + } + | false /** Filename to write the generated types to */ outputFile?: string } diff --git a/test/_community/payload-types.ts b/test/_community/payload-types.ts index 7cf43254e..5d79028b7 100644 --- a/test/_community/payload-types.ts +++ b/test/_community/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,44 +8,124 @@ export interface Config { collections: { - posts: Post - media: Media - users: User - } + posts: Post; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - menu: Menu - } + menu: Menu; + }; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - text?: string - associatedMedia?: string | Media - updatedAt: string - createdAt: string -} -export interface Media { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + text?: string | null; + richText?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + richText2?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "menu". + */ export interface Menu { - id: string - globalText?: string + id: string; + globalText?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/_community/tsconfig.json b/test/_community/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/_community/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/access-control/payload-types.ts b/test/access-control/payload-types.ts index f4f3b367d..095aa1518 100644 --- a/test/access-control/payload-types.ts +++ b/test/access-control/payload-types.ts @@ -8,154 +8,292 @@ export interface Config { collections: { - users: User - posts: Post - unrestricted: Unrestricted - restricted: Restricted - 'read-only-collection': ReadOnlyCollection - 'user-restricted': UserRestricted - 'restricted-versions': RestrictedVersion - 'sibling-data': SiblingDatum - 'rely-on-request-headers': RelyOnRequestHeader - 'doc-level-access': DocLevelAccess - 'hidden-fields': HiddenField - 'hidden-access': HiddenAccess - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + users: User; + 'non-admin-user': NonAdminUser; + posts: Post; + unrestricted: Unrestricted; + restricted: Restricted; + 'read-only-collection': ReadOnlyCollection; + 'user-restricted': UserRestricted; + 'restricted-versions': RestrictedVersion; + 'sibling-data': SiblingDatum; + 'rely-on-request-headers': RelyOnRequestHeader; + 'doc-level-access': DocLevelAccess; + 'hidden-fields': HiddenField; + 'hidden-access': HiddenAccess; + 'hidden-access-count': HiddenAccessCount; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: { + settings: Setting; + test: Test; + 'read-only-global': ReadOnlyGlobal; + }; + locale: null; + user: + | (User & { + collection: 'users'; + }) + | (NonAdminUser & { + collection: 'non-admin-user'; + }); } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - roles?: ('admin' | 'user')[] | null - 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 + id: string; + roles?: ('admin' | 'user')[] | null; + 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` "non-admin-user". + */ +export interface NonAdminUser { + id: string; + 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` "posts". + */ export interface Post { - id: string - restrictedField?: string | null + id: string; + restrictedField?: string | null; group?: { - restrictedGroupText?: string | null - } - restrictedRowText?: string | null - restrictedCollapsibleText?: string | null - updatedAt: string - createdAt: string + restrictedGroupText?: string | null; + }; + restrictedRowText?: string | null; + restrictedCollapsibleText?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "unrestricted". + */ export interface Unrestricted { - id: string - name?: string | null - userRestrictedDocs?: (string | UserRestricted)[] | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + userRestrictedDocs?: (string | UserRestricted)[] | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "user-restricted". + */ export interface UserRestricted { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "restricted". + */ export interface Restricted { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "read-only-collection". + */ export interface ReadOnlyCollection { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "restricted-versions". + */ export interface RestrictedVersion { - id: string - name?: string | null - hidden?: boolean | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + hidden?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "sibling-data". + */ export interface SiblingDatum { - id: string + id: string; array?: | { - allowPublicReadability?: boolean | null - text?: string | null - id?: string | null + allowPublicReadability?: boolean | null; + text?: string | null; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "rely-on-request-headers". + */ export interface RelyOnRequestHeader { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "doc-level-access". + */ export interface DocLevelAccess { - id: string - approvedForRemoval?: boolean | null - approvedTitle?: string | null - lockTitle?: boolean | null - updatedAt: string - createdAt: string + id: string; + approvedForRemoval?: boolean | null; + approvedTitle?: string | null; + lockTitle?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hidden-fields". + */ export interface HiddenField { - id: string - title?: string | null + id: string; + title?: string | null; partiallyHiddenGroup?: { - name?: string | null - value?: string | null - } + name?: string | null; + value?: string | null; + }; partiallyHiddenArray?: | { - name?: string | null - value?: string | null - id?: string | null + name?: string | null; + value?: string | null; + id?: string | null; }[] - | null - hidden?: boolean | null - updatedAt: string - createdAt: string + | null; + hidden?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hidden-access". + */ export interface HiddenAccess { - id: string - title: string - hidden?: boolean | null - updatedAt: string - createdAt: string + id: string; + title: string; + hidden?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hidden-access-count". + */ +export interface HiddenAccessCount { + id: string; + title: string; + hidden?: boolean | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ export interface PayloadPreference { - id: string - user: { - relationTo: 'users' - value: string | User - } - key?: string | null + id: string; + user: + | { + relationTo: 'users'; + value: string | User; + } + | { + relationTo: 'non-admin-user'; + value: string | NonAdminUser; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "settings". + */ +export interface Setting { + id: string; + test?: boolean | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "test". + */ +export interface Test { + id: string; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "read-only-global". + */ +export interface ReadOnlyGlobal { + id: string; + name?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/access-control/tsconfig.json b/test/access-control/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/access-control/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/admin/payload-types.ts b/test/admin/payload-types.ts index 900a35e23..929c4708c 100644 --- a/test/admin/payload-types.ts +++ b/test/admin/payload-types.ts @@ -8,187 +8,336 @@ export interface Config { collections: { - posts: Post - users: User - 'hidden-collection': HiddenCollection - 'collection-no-api-view': CollectionNoApiView - 'custom-views-one': CustomViewsOne - 'custom-views-two': CustomViewsTwo - 'group-one-collection-ones': GroupOneCollectionOne - 'group-one-collection-twos': GroupOneCollectionTwo - 'group-two-collection-ones': GroupTwoCollectionOne - 'group-two-collection-twos': GroupTwoCollectionTwo - geo: Geo - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + uploads: Upload; + posts: Post; + users: User; + 'hidden-collection': HiddenCollection; + 'collection-no-api-view': CollectionNoApiView; + 'custom-views-one': CustomViewsOne; + 'custom-views-two': CustomViewsTwo; + 'group-one-collection-ones': GroupOneCollectionOne; + 'group-one-collection-twos': GroupOneCollectionTwo; + 'group-two-collection-ones': GroupTwoCollectionOne; + 'group-two-collection-twos': GroupTwoCollectionTwo; + geo: Geo; + customIdTab: CustomIdTab; + customIdRow: CustomIdRow; + 'disable-duplicate': DisableDuplicate; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - 'hidden-global': HiddenGlobal - 'global-no-api-view': GlobalNoApiView - global: Global - 'custom-global-views-one': CustomGlobalViewsOne - 'custom-global-views-two': CustomGlobalViewsTwo - 'group-globals-one': GroupGlobalsOne - 'group-globals-two': GroupGlobalsTwo - } + 'hidden-global': HiddenGlobal; + 'global-no-api-view': GlobalNoApiView; + global: Global; + 'custom-global-views-one': CustomGlobalViewsOne; + 'custom-global-views-two': CustomGlobalViewsTwo; + 'group-globals-one': GroupGlobalsOne; + 'group-globals-two': GroupGlobalsTwo; + }; + locale: 'es' | 'en'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "uploads". + */ +export interface Upload { + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - title?: string | null - description?: string | null - number?: number | null + id: string; + title?: string | null; + description?: string | null; + number?: number | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; group?: { - title?: string | null - } - relationship?: (string | null) | Post - sidebarField?: string | null - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + title?: string | null; + }; + relationship?: (string | null) | Post; + customCell?: string | null; + sidebarField?: string | null; + descriptionAsString?: string | null; + descriptionAsFunction?: string | null; + descriptionAsComponent?: string | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - textField?: string | null - sidebarField?: string | null - 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 + id: string; + textField?: string | null; + sidebarField?: string | null; + 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` "hidden-collection". + */ export interface HiddenCollection { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "collection-no-api-view". + */ export interface CollectionNoApiView { - id: string - updatedAt: string - createdAt: string + id: string; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-views-one". + */ export interface CustomViewsOne { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-views-two". + */ export interface CustomViewsTwo { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-one-collection-ones". + */ export interface GroupOneCollectionOne { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-one-collection-twos". + */ export interface GroupOneCollectionTwo { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-two-collection-ones". + */ export interface GroupTwoCollectionOne { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-two-collection-twos". + */ export interface GroupTwoCollectionTwo { - id: string - title?: string | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "geo". + */ export interface Geo { - id: string + id: string; /** * @minItems 2 * @maxItems 2 */ - point?: [number, number] | null - updatedAt: string - createdAt: string + point?: [number, number] | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "customIdTab". + */ +export interface CustomIdTab { + id: string | null; + title?: string | null; + description?: string | null; + number?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "customIdRow". + */ +export interface CustomIdRow { + id: string | null; + title?: string | null; + description?: string | null; + number?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "disable-duplicate". + */ +export interface DisableDuplicate { + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hidden-global". + */ export interface HiddenGlobal { - id: string - title?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global-no-api-view". + */ export interface GlobalNoApiView { - id: string - updatedAt?: string | null - createdAt?: string | null + id: string; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global". + */ export interface Global { - id: string - title?: string | null - sidebarField?: string | null - _status?: ('draft' | 'published') | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + sidebarField?: string | null; + _status?: ('draft' | 'published') | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-global-views-one". + */ export interface CustomGlobalViewsOne { - id: string - title?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-global-views-two". + */ export interface CustomGlobalViewsTwo { - id: string - title?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-globals-one". + */ export interface GroupGlobalsOne { - id: string - title?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "group-globals-two". + */ export interface GroupGlobalsTwo { - id: string - title?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/admin/tsconfig.json b/test/admin/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/admin/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/array-update/payload-types.ts b/test/array-update/payload-types.ts index 486f1c3fe..5d594ba6f 100644 --- a/test/array-update/payload-types.ts +++ b/test/array-update/payload-types.ts @@ -1,36 +1,101 @@ /* 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 {} +export interface Config { + collections: { + arrays: Array; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "arrays". */ export interface Array { - id: string - array: { - required: string - optional?: string - id?: string - }[] - createdAt: string - updatedAt: string + id: string; + arrayOfFields?: + | { + required: string; + optional?: string | null; + innerArrayOfFields?: + | { + required: string; + optional?: string | null; + id?: string | null; + }[] + | 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: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - createdAt: string - updatedAt: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/array-update/tsconfig.json b/test/array-update/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/array-update/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/auth/payload-types.ts b/test/auth/payload-types.ts index 17b24758d..c08f6404c 100644 --- a/test/auth/payload-types.ts +++ b/test/auth/payload-types.ts @@ -7,148 +7,155 @@ */ export interface Config { + collections: { + users: User; + 'api-keys': ApiKey; + 'public-users': PublicUser; + relationsCollection: RelationsCollection; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: | (User & { - collection: 'users' + collection: 'users'; }) | (ApiKey & { - collection: 'api-keys' + collection: 'api-keys'; }) | (PublicUser & { - collection: 'public-users' - }) - collections: { - users: User - 'api-keys': ApiKey - 'public-users': PublicUser - relationsCollection: RelationsCollection - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + collection: 'public-users'; + }); } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - adminOnlyField?: string | null - roles: ('admin' | 'editor' | 'moderator' | 'user' | 'viewer')[] - namedSaveToJWT?: string | null + id: string; + adminOnlyField?: string | null; + roles: ('admin' | 'editor' | 'moderator' | 'user' | 'viewer')[]; + namedSaveToJWT?: string | null; group?: { - liftedSaveToJWT?: string | null - } + liftedSaveToJWT?: string | null; + }; groupSaveToJWT?: { - saveToJWTString?: string | null - saveToJWTFalse?: string | null - } + saveToJWTString?: string | null; + saveToJWTFalse?: string | null; + }; saveToJWTTab: { - test?: string | null - } + test?: string | null; + }; tabSaveToJWTString: { - includedByDefault?: string | null - } - tabLiftedSaveToJWT?: string | null - unnamedTabSaveToJWTString?: string | null - unnamedTabSaveToJWTFalse?: string | null - custom?: string | null - updatedAt: string - createdAt: string - enableAPIKey?: boolean | null - apiKey?: string | null - apiKeyIndex?: string | null - email: string - resetPasswordToken?: string | null - resetPasswordExpiration?: string | null - salt?: string | null - hash?: string | null - loginAttempts?: number | null - lockUntil?: string | null - password?: string | null + includedByDefault?: string | null; + }; + tabLiftedSaveToJWT?: string | null; + unnamedTabSaveToJWTString?: string | null; + unnamedTabSaveToJWTFalse?: string | null; + custom?: string | null; + updatedAt: string; + createdAt: string; + enableAPIKey?: boolean | null; + apiKey?: string | null; + apiKeyIndex?: string | null; + 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` "api-keys". */ export interface ApiKey { - id: string - updatedAt: string - createdAt: string - enableAPIKey?: boolean | null - apiKey?: string | null - apiKeyIndex?: string | null + id: string; + updatedAt: string; + createdAt: string; + enableAPIKey?: boolean | null; + apiKey?: string | null; + apiKeyIndex?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "public-users". */ export interface PublicUser { - id: string - updatedAt: string - createdAt: string - email: string - resetPasswordToken?: string | null - resetPasswordExpiration?: string | null - salt?: string | null - hash?: string | null - _verified?: boolean | null - _verificationToken?: string | null - loginAttempts?: number | null - lockUntil?: string | null - password?: string | null + id: string; + updatedAt: string; + createdAt: string; + email: string; + resetPasswordToken?: string | null; + resetPasswordExpiration?: string | null; + salt?: string | null; + hash?: string | null; + _verified?: boolean | null; + _verificationToken?: string | null; + loginAttempts?: number | null; + lockUntil?: string | null; + password?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "relationsCollection". */ export interface RelationsCollection { - id: string - rel?: (string | null) | User - text?: string | null - updatedAt: string - createdAt: string + id: string; + rel?: (string | null) | User; + text?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-preferences". */ export interface PayloadPreference { - id: string + id: string; user: | { - relationTo: 'users' - value: string | User + relationTo: 'users'; + value: string | User; } | { - relationTo: 'api-keys' - value: string | ApiKey + relationTo: 'api-keys'; + value: string | ApiKey; } | { - relationTo: 'public-users' - value: string | PublicUser - } - key?: string | null + relationTo: 'public-users'; + value: string | PublicUser; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-migrations". */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/auth/tsconfig.json b/test/auth/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/auth/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/buildConfigWithDefaults.ts b/test/buildConfigWithDefaults.ts index 7ea0a7b22..53280eb31 100644 --- a/test/buildConfigWithDefaults.ts +++ b/test/buildConfigWithDefaults.ts @@ -161,7 +161,9 @@ export async function buildConfigWithDefaults( sharp, telemetry: false, typescript: { - declare: false, + declare: { + ignoreTSError: true, + }, }, ...testConfig, i18n: { diff --git a/test/collections-graphql/payload-types.ts b/test/collections-graphql/payload-types.ts index 14d6fd78e..2fc108ac0 100644 --- a/test/collections-graphql/payload-types.ts +++ b/test/collections-graphql/payload-types.ts @@ -8,227 +8,234 @@ export interface Config { collections: { - users: User - point: Point - posts: Post - 'custom-ids': CustomId - relation: Relation - dummy: Dummy - 'error-on-hooks': ErrorOnHook - 'payload-api-test-ones': PayloadApiTestOne - 'payload-api-test-twos': PayloadApiTestTwo - 'content-type': ContentType - 'cyclical-relationship': CyclicalRelationship - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' + users: User; + point: Point; + posts: Post; + 'custom-ids': CustomId; + relation: Relation; + dummy: Dummy; + 'error-on-hooks': ErrorOnHook; + 'payload-api-test-ones': PayloadApiTestOne; + 'payload-api-test-twos': PayloadApiTestTwo; + 'content-type': ContentType; + 'cyclical-relationship': CyclicalRelationship; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es'; user: User & { - collection: 'users' - } + collection: 'users'; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - 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 + id: string; + 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` "point". */ export interface Point { - id: string + id: string; /** * @minItems 2 * @maxItems 2 */ - point?: [number, number] | null - updatedAt: string - createdAt: string + point?: [number, number] | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - title?: string | null - description?: string | null - number?: number | null - min?: number | null - relationField?: (string | null) | Relation - relationToCustomID?: (number | null) | CustomId - relationHasManyField?: (string | Relation)[] | null + id: string; + title?: string | null; + description?: string | null; + number?: number | null; + min?: number | null; + relationField?: (string | null) | Relation; + relationToCustomID?: (number | null) | CustomId; + relationHasManyField?: (string | Relation)[] | null; relationMultiRelationTo?: | ({ - relationTo: 'relation' - value: string | Relation + relationTo: 'relation'; + value: string | Relation; } | null) | ({ - relationTo: 'dummy' - value: string | Dummy - } | null) + relationTo: 'dummy'; + value: string | Dummy; + } | null); relationMultiRelationToHasMany?: | ( | { - relationTo: 'relation' - value: string | Relation + relationTo: 'relation'; + value: string | Relation; } | { - relationTo: 'dummy' - value: string | Dummy + relationTo: 'dummy'; + value: string | Dummy; } )[] - | null + | null; A1?: { - A2?: string | null - } + A2?: string | null; + }; B1?: { - B2?: string | null - } + B2?: string | null; + }; C1?: { - C2Text?: string | null + C2Text?: string | null; C2?: { - C3?: string | null - } - } + C3?: string | null; + }; + }; D1: { D2?: { D3?: { - D4?: string | null - } - } - } - updatedAt: string - createdAt: string + D4?: string | null; + }; + }; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "relation". */ export interface Relation { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "custom-ids". */ export interface CustomId { - id: number - title?: string | null - updatedAt: string - createdAt: string + id: number; + title?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "dummy". */ export interface Dummy { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "error-on-hooks". */ export interface ErrorOnHook { - id: string - title?: string | null - errorBeforeChange?: boolean | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + errorBeforeChange?: boolean | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-api-test-ones". */ export interface PayloadApiTestOne { - id: string - payloadAPI?: string | null - updatedAt: string - createdAt: string + id: string; + payloadAPI?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-api-test-twos". */ export interface PayloadApiTestTwo { - id: string - payloadAPI?: string | null - relation?: (string | null) | PayloadApiTestOne - updatedAt: string - createdAt: string + id: string; + payloadAPI?: string | null; + relation?: (string | null) | PayloadApiTestOne; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "content-type". */ export interface ContentType { - id: string - contentType?: string | null - updatedAt: string - createdAt: string + id: string; + contentType?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "cyclical-relationship". */ export interface CyclicalRelationship { - id: string - title?: string | null - relationToSelf?: (string | null) | CyclicalRelationship - updatedAt: string - createdAt: string + id: string; + title?: string | null; + relationToSelf?: (string | null) | CyclicalRelationship; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-preferences". */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-migrations". */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/collections-graphql/tsconfig.json b/test/collections-graphql/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/collections-graphql/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/collections-rest/payload-types.ts b/test/collections-rest/payload-types.ts index e98760410..4027b3ca5 100644 --- a/test/collections-rest/payload-types.ts +++ b/test/collections-rest/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,117 +8,188 @@ export interface Config { collections: { - posts: Post - point: Point - relation: Relation - dummy: Dummy - 'custom-id': CustomId - 'custom-id-number': CustomIdNumber - 'error-on-hooks': ErrorOnHook - users: User - } - globals: {} + posts: Post; + point: Point; + relation: Relation; + dummy: Dummy; + 'custom-id': CustomId; + 'custom-id-number': CustomIdNumber; + 'error-on-hooks': ErrorOnHook; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - title?: string - description?: string - number?: number - fakeLocalization?: string - relationField?: string | Relation - relationHasManyField?: string[] | Relation[] + id: string; + title?: string | null; + description?: string | null; + number?: number | null; + fakeLocalization?: string | null; + relationField?: (string | null) | Relation; + relationHasManyField?: (string | Relation)[] | null; relationMultiRelationTo?: - | { - value: string | Relation - relationTo: 'relation' - } - | { - value: string | Dummy - relationTo: 'dummy' - } + | ({ + relationTo: 'relation'; + value: string | Relation; + } | null) + | ({ + relationTo: 'dummy'; + value: string | Dummy; + } | null); relationMultiRelationToHasMany?: | ( | { - value: string - relationTo: 'relation' + relationTo: 'relation'; + value: string | Relation; } | { - value: string - relationTo: 'dummy' + relationTo: 'dummy'; + value: string | Dummy; } )[] - | ( - | { - value: Relation - relationTo: 'relation' - } - | { - value: Dummy - relationTo: 'dummy' - } - )[] - restrictedField?: string + | null; + restrictedField?: string | null; D1: { D2?: { D3?: { - D4?: string - } - } - } - updatedAt: string - createdAt: string + D4?: string | null; + }; + }; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation". + */ export interface Relation { - id: string - name?: string - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "dummy". + */ export interface Dummy { - id: string - title?: string - name?: string - updatedAt: string - createdAt: string + id: string; + title?: string | null; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "point". + */ export interface Point { - id: string + id: string; /** * @minItems 2 * @maxItems 2 */ - point?: [number, number] - updatedAt: string - createdAt: string + point?: [number, number] | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-id". + */ export interface CustomId { - id: string - name?: string - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-id-number". + */ export interface CustomIdNumber { - id: number - name?: string - updatedAt: string - createdAt: string + id: number; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "error-on-hooks". + */ export interface ErrorOnHook { - id: string - text?: string - errorBeforeChange?: boolean - errorAfterDelete?: boolean - updatedAt: string - createdAt: string + id: string; + text?: string | null; + errorBeforeChange?: boolean | null; + errorAfterDelete?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/collections-rest/tsconfig.json b/test/collections-rest/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/collections-rest/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/config/payload-types.ts b/test/config/payload-types.ts index 152468abc..6088c42da 100644 --- a/test/config/payload-types.ts +++ b/test/config/payload-types.ts @@ -8,72 +8,102 @@ export interface Config { collections: { - pages: Page - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + pages: Page; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - 'my-global': MyGlobal - } + 'my-global': MyGlobal; + }; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "pages". + */ export interface Page { - id: string - title?: string | null + id: string; + title?: string | null; myBlocks?: | { - blockOneField?: string | null - blockTwoField?: string | null - id?: string | null - blockName?: string | null - blockType: 'blockOne' + blockOneField?: string | null; + blockTwoField?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'blockOne'; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "my-global". + */ export interface MyGlobal { - id: string - title?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/config/tsconfig.json b/test/config/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/config/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/create-payload-app/tsconfig.json b/test/create-payload-app/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/create-payload-app/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/custom-graphql/payload-types.ts b/test/custom-graphql/payload-types.ts index 203c39bc8..db7358484 100644 --- a/test/custom-graphql/payload-types.ts +++ b/test/custom-graphql/payload-types.ts @@ -8,48 +8,70 @@ export interface Config { collections: { - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/custom-graphql/tsconfig.json b/test/custom-graphql/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/custom-graphql/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/database/payload-types.ts b/test/database/payload-types.ts index 54eca4cd7..3e750da9b 100644 --- a/test/database/payload-types.ts +++ b/test/database/payload-types.ts @@ -8,79 +8,179 @@ export interface Config { collections: { - posts: Post - 'relation-a': RelationA - 'relation-b': RelationB - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + posts: Post; + 'relation-a': RelationA; + 'relation-b': RelationB; + 'custom-schema': CustomSchema; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: { + global: Global; + }; + locale: 'en' | 'es'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - title: string - updatedAt: string - createdAt: string + id: string; + title: string; + throwAfterChange?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-a". + */ export interface RelationA { - id: string - relationship?: (string | null) | RelationB - richText?: - | { - [k: string]: unknown - }[] - | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + relationship?: (string | null) | RelationB; + richText?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-b". + */ export interface RelationB { - id: string - relationship?: (string | null) | RelationA - richText?: + id: string; + title?: string | null; + relationship?: (string | null) | RelationA; + richText?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-schema". + */ +export interface CustomSchema { + id: string; + text?: string | null; + localizedText?: string | null; + relationship?: (string | RelationA)[] | null; + select?: ('a' | 'b' | 'c')[] | null; + radio?: ('a' | 'b' | 'c') | null; + array?: | { - [k: string]: unknown + text?: string | null; + localizedText?: string | null; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + blocks?: + | { + text?: string | null; + localizedText?: string | 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` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global". + */ +export interface Global { + id: string; + text?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/database/tsconfig.json b/test/database/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/database/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/dataloader/payload-types.ts b/test/dataloader/payload-types.ts index f4fc24153..314b46576 100644 --- a/test/dataloader/payload-types.ts +++ b/test/dataloader/payload-types.ts @@ -1,33 +1,121 @@ /* 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 {} +export interface Config { + collections: { + posts: Post; + 'relation-a': RelationA; + 'relation-b': RelationB; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - title: string - owner?: string | User - createdAt: string - updatedAt: string + id: string; + title: string; + owner?: (string | null) | User; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - createdAt: string - updatedAt: string + id: string; + 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` "relation-a". + */ +export interface RelationA { + id: string; + relationship?: (string | null) | RelationB; + richText?: + | { + [k: string]: unknown; + }[] + | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-b". + */ +export interface RelationB { + id: string; + relationship?: (string | null) | RelationA; + richText?: + | { + [k: string]: unknown; + }[] + | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/dataloader/tsconfig.json b/test/dataloader/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/dataloader/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/email-nodemailer/payload-types.ts b/test/email-nodemailer/payload-types.ts index 7cf43254e..db7358484 100644 --- a/test/email-nodemailer/payload-types.ts +++ b/test/email-nodemailer/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,44 +8,70 @@ export interface Config { collections: { - posts: Post - media: Media - users: User - } - globals: { - menu: Menu - } -} -export interface Post { - id: string - text?: string - associatedMedia?: string | Media - updatedAt: string - createdAt: string -} -export interface Media { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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; } -export interface Menu { - id: string - globalText?: string +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/email-nodemailer/tsconfig.json b/test/email-nodemailer/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/email-nodemailer/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/email-resend/payload-types.ts b/test/email-resend/payload-types.ts index 7cf43254e..db7358484 100644 --- a/test/email-resend/payload-types.ts +++ b/test/email-resend/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,44 +8,70 @@ export interface Config { collections: { - posts: Post - media: Media - users: User - } - globals: { - menu: Menu - } -} -export interface Post { - id: string - text?: string - associatedMedia?: string | Media - updatedAt: string - createdAt: string -} -export interface Media { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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; } -export interface Menu { - id: string - globalText?: string +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/email-resend/tsconfig.json b/test/email-resend/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/email-resend/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/email/payload-types.ts b/test/email/payload-types.ts index 7cf43254e..da7fc0d15 100644 --- a/test/email/payload-types.ts +++ b/test/email/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,44 +8,138 @@ export interface Config { collections: { - posts: Post - media: Media - users: User - } + posts: Post; + media: Media; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - menu: Menu - } + menu: Menu; + }; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - text?: string - associatedMedia?: string | Media - updatedAt: string - createdAt: string + id: string; + text?: string | null; + associatedMedia?: string | Media | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ export interface Media { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + thumbnail?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + medium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + large?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "menu". + */ export interface Menu { - id: string - globalText?: string + id: string; + globalText?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/email/tsconfig.json b/test/email/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/email/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/endpoints/payload-types.ts b/test/endpoints/payload-types.ts index f9630a67c..cc4c2d114 100644 --- a/test/endpoints/payload-types.ts +++ b/test/endpoints/payload-types.ts @@ -1,39 +1,121 @@ /* 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 {} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "global-endpoints". - */ -export interface GlobalEndpoint { - id: string +export interface Config { + collections: { + endpoints: Endpoint; + 'no-endpoints': NoEndpoint; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: { + 'global-endpoints': GlobalEndpoint; + 'global-no-endpoints': GlobalNoEndpoint; + }; + locale: null; + user: User & { + collection: 'users'; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "endpoints". */ export interface Endpoint { - id: string - title?: string - createdAt: string - updatedAt: string + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "no-endpoints". + */ +export interface NoEndpoint { + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - createdAt: string - updatedAt: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global-endpoints". + */ +export interface GlobalEndpoint { + id: string; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global-no-endpoints". + */ +export interface GlobalNoEndpoint { + id: string; + name?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/endpoints/tsconfig.json b/test/endpoints/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/endpoints/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/field-error-states/payload-types.ts b/test/field-error-states/payload-types.ts index 8332a3442..7874a6941 100644 --- a/test/field-error-states/payload-types.ts +++ b/test/field-error-states/payload-types.ts @@ -8,214 +8,291 @@ export interface Config { collections: { - 'error-fields': ErrorField - uploads: Upload - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + 'error-fields': ErrorField; + uploads: Upload; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "error-fields". + */ export interface ErrorField { - id: string + id: string; parentArray?: | { childArray: { - childArrayText: string - id?: string | null - }[] - id?: string | null + childArrayText: string; + id?: string | null; + }[]; + id?: string | null; }[] - | null + | null; home: { - tabText: string - text: string + tabText: string; + text: string; array?: | { - requiredArrayText: string - arrayText?: string | null + requiredArrayText: string; + arrayText?: string | null; group: { - text: string - number: number - date: string - checkbox: boolean - } - code: string + text: string; + number: number; + date: string; + checkbox: boolean; + }; + code: string; json: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - email: string + | null; + email: string; /** * @minItems 2 * @maxItems 2 */ - point: [number, number] - radio: 'mint' | 'dark_gray' - relationship: string | User + point: [number, number]; + radio: 'mint' | 'dark_gray'; + relationship: string | User; richtext: { - [k: string]: unknown - }[] - select: 'mint' | 'dark_gray' - upload: string | Upload - text: string - textarea: string - id?: string | null + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + select: 'mint' | 'dark_gray'; + upload: string | Upload; + text: string; + textarea: string; + id?: string | null; }[] - | null - } - tabText: string - text: string + | null; + }; + tabText: string; + text: string; array?: | { - requiredArrayText: string - arrayText?: string | null + requiredArrayText: string; + arrayText?: string | null; group: { - text: string - number: number - date: string - checkbox: boolean - } - code: string + text: string; + number: number; + date: string; + checkbox: boolean; + }; + code: string; json: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - email: string + | null; + email: string; /** * @minItems 2 * @maxItems 2 */ - point: [number, number] - radio: 'mint' | 'dark_gray' - relationship: string | User + point: [number, number]; + radio: 'mint' | 'dark_gray'; + relationship: string | User; richtext: { - [k: string]: unknown - }[] - select: 'mint' | 'dark_gray' - upload: string | Upload - text: string - textarea: string - id?: string | null + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + select: 'mint' | 'dark_gray'; + upload: string | Upload; + text: string; + textarea: string; + id?: string | null; }[] - | null + | null; layout?: | { - tabText: string - text: string + tabText: string; + text: string; array?: | { - requiredArrayText: string - arrayText?: string | null + requiredArrayText: string; + arrayText?: string | null; group: { - text: string - number: number - date: string - checkbox: boolean - } - code: string + text: string; + number: number; + date: string; + checkbox: boolean; + }; + code: string; json: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - email: string + | null; + email: string; /** * @minItems 2 * @maxItems 2 */ - point: [number, number] - radio: 'mint' | 'dark_gray' - relationship: string | User + point: [number, number]; + radio: 'mint' | 'dark_gray'; + relationship: string | User; richtext: { - [k: string]: unknown - }[] - select: 'mint' | 'dark_gray' - upload: string | Upload - text: string - textarea: string - id?: string | null + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + select: 'mint' | 'dark_gray'; + upload: string | Upload; + text: string; + textarea: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block1' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block1'; }[] - | null + | null; group: { - text: string - } - updatedAt: string - createdAt: string + text: string; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "uploads". + */ export interface Upload { - id: string - text?: string | null - media?: string | Upload | null - richText?: - | { - [k: string]: unknown - }[] - | null - updatedAt: string - createdAt: string - url?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null + id: string; + text?: string | null; + media?: string | Upload | null; + richText?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/field-error-states/tsconfig.json b/test/field-error-states/tsconfig.json index a5d1c4912..48610a17f 100644 --- a/test/field-error-states/tsconfig.json +++ b/test/field-error-states/tsconfig.json @@ -1,8 +1,3 @@ { "extends": "../tsconfig.json", - "compilerOptions": { - "paths": { - "payload/generated-types": ["./payload-types.ts"] - } - } } diff --git a/test/field-perf/payload-types.ts b/test/field-perf/payload-types.ts new file mode 100644 index 000000000..ce010c8b3 --- /dev/null +++ b/test/field-perf/payload-types.ts @@ -0,0 +1,118 @@ +/* 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 { + collections: { + 'blocks-collection': BlocksCollection; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "blocks-collection". + */ +export interface BlocksCollection { + id: string; + layout?: + | { + richText?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + field1?: string | null; + field2?: string | null; + field3?: string | null; + field4?: string | null; + field5?: string | null; + field6?: string | null; + field7?: string | null; + field8?: string | null; + field9?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; + }[] + | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/fields-relationship/payload-types.ts b/test/fields-relationship/payload-types.ts index 98eb0bda9..6c9bd0c70 100644 --- a/test/fields-relationship/payload-types.ts +++ b/test/fields-relationship/payload-types.ts @@ -8,160 +8,244 @@ export interface Config { collections: { - 'fields-relationship': FieldsRelationship - 'relation-one': RelationOne - 'relation-two': RelationTwo - 'relation-restricted': RelationRestricted - 'relation-with-title': RelationWithTitle - 'relation-updated-externally': RelationUpdatedExternally - 'collection-1': Collection1 - 'collection-2': Collection2 - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + 'fields-relationship': FieldsRelationship; + 'relation-filter-false': RelationFilterFalse; + 'relation-filter-true': RelationFilterTrue; + 'relation-one': RelationOne; + 'relation-two': RelationTwo; + 'relation-restricted': RelationRestricted; + 'relation-with-title': RelationWithTitle; + 'relation-updated-externally': RelationUpdatedExternally; + 'collection-1': Collection1; + 'collection-2': Collection2; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "fields-relationship". + */ export interface FieldsRelationship { - id: string - relationship?: (string | null) | RelationOne - relationshipHasMany?: (string | RelationOne)[] | null + id: string; + relationship?: (string | null) | RelationOne; + relationshipHasMany?: (string | RelationOne)[] | null; relationshipMultiple?: | ({ - relationTo: 'relation-one' - value: string | RelationOne + relationTo: 'relation-one'; + value: string | RelationOne; } | null) | ({ - relationTo: 'relation-two' - value: string | RelationTwo - } | null) + relationTo: 'relation-two'; + value: string | RelationTwo; + } | null); relationshipHasManyMultiple?: | ( | { - relationTo: 'relation-one' - value: string | RelationOne + relationTo: 'relation-one'; + value: string | RelationOne; } | { - relationTo: 'relation-two' - value: string | RelationTwo + relationTo: 'relation-two'; + value: string | RelationTwo; } )[] - | null - relationshipRestricted?: (string | null) | RelationRestricted - relationshipWithTitle?: (string | null) | RelationWithTitle - relationshipFiltered?: (string | null) | RelationOne - relationshipFilteredAsync?: (string | null) | RelationOne + | null; + relationshipRestricted?: (string | null) | RelationRestricted; + relationshipWithTitle?: (string | null) | RelationWithTitle; + relationshipFiltered?: (string | null) | RelationOne; + relationshipFilteredAsync?: (string | null) | RelationOne; relationshipManyFiltered?: | ( | { - relationTo: 'relation-with-title' - value: string | RelationWithTitle + relationTo: 'relation-with-title'; + value: string | RelationWithTitle; } | { - relationTo: 'relation-one' - value: string | RelationOne + relationTo: 'relation-filter-false'; + value: string | RelationFilterFalse; + } + | { + relationTo: 'relation-filter-true'; + value: string | RelationFilterTrue; + } + | { + relationTo: 'relation-one'; + value: string | RelationOne; } )[] - | null - filter?: string | null - relationshipReadOnly?: (string | null) | RelationOne - updatedAt: string - createdAt: string + | null; + filter?: string | null; + relationshipReadOnly?: (string | null) | RelationOne; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-one". + */ export interface RelationOne { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-two". + */ export interface RelationTwo { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-restricted". + */ export interface RelationRestricted { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-with-title". + */ export interface RelationWithTitle { - id: string - name?: string | null + id: string; + name?: string | null; meta?: { - title?: string | null - } - updatedAt: string - createdAt: string + title?: string | null; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-filter-false". + */ +export interface RelationFilterFalse { + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-filter-true". + */ +export interface RelationFilterTrue { + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation-updated-externally". + */ export interface RelationUpdatedExternally { - id: string - relationPrePopulate?: (string | null) | Collection1 - relationHasMany?: (string | Collection1)[] | null + id: string; + relationPrePopulate?: (string | null) | Collection1; + relationHasMany?: (string | Collection1)[] | null; relationToManyHasMany?: | ( | { - relationTo: 'collection-1' - value: string | Collection1 + relationTo: 'collection-1'; + value: string | Collection1; } | { - relationTo: 'collection-2' - value: string | Collection2 + relationTo: 'collection-2'; + value: string | Collection2; } )[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "collection-1". + */ export interface Collection1 { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "collection-2". + */ export interface Collection2 { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/fields-relationship/tsconfig.json b/test/fields-relationship/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/fields-relationship/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/fields/payload-types.ts b/test/fields/payload-types.ts index 1497ffb56..0a785a9b1 100644 --- a/test/fields/payload-types.ts +++ b/test/fields/payload-types.ts @@ -12,1273 +12,1405 @@ */ export type BlockColumns = | { - text?: string | null + text?: string | null; subArray?: | { - requiredText: string - id?: string | null + requiredText: string; + id?: string | null; }[] - | null - id?: string | null + | null; + id?: string | null; }[] - | null + | null; export interface Config { collections: { - 'lexical-fields': LexicalField - 'lexical-migrate-fields': LexicalMigrateField - users: User - 'array-fields': ArrayField - 'block-fields': BlockField - 'checkbox-fields': CheckboxField - 'code-fields': CodeField - 'collapsible-fields': CollapsibleField - 'conditional-logic': ConditionalLogic - 'date-fields': DateField - 'radio-fields': RadioField - 'group-fields': GroupField - 'row-fields': RowField - 'indexed-fields': IndexedField - 'json-fields': JsonField - 'number-fields': NumberField - 'point-fields': PointField - 'relationship-fields': RelationshipField - 'rich-text-fields': RichTextField - 'select-fields': SelectField - 'tabs-fields': TabsField - 'text-fields': TextField - uploads: Upload - uploads2: Uploads2 - uploads3: Uploads3 - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + 'lexical-fields': LexicalField; + 'lexical-migrate-fields': LexicalMigrateField; + 'lexical-localized-fields': LexicalLocalizedField; + users: User; + 'array-fields': ArrayField; + 'block-fields': BlockField; + 'checkbox-fields': CheckboxField; + 'code-fields': CodeField; + 'collapsible-fields': CollapsibleField; + 'conditional-logic': ConditionalLogic; + 'date-fields': DateField; + 'radio-fields': RadioField; + 'group-fields': GroupField; + 'row-fields': RowField; + 'indexed-fields': IndexedField; + 'json-fields': JsonField; + 'number-fields': NumberField; + 'point-fields': PointField; + 'relationship-fields': RelationshipField; + 'rich-text-fields': RichTextField; + 'select-fields': SelectField; + 'tabs-fields': TabsField; + 'text-fields': TextField; + uploads: Upload; + uploads2: Uploads2; + uploads3: Uploads3; + 'ui-fields': UiField; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - tabsWithRichText: TabsWithRichText - } + tabsWithRichText: TabsWithRichText; + }; + locale: 'en' | 'es'; + user: User & { + collection: 'users'; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "lexical-fields". */ export interface LexicalField { - id: string - title: string + id: string; + title: string; lexicalSimple?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; lexicalWithBlocks: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } - updatedAt: string - createdAt: string + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "lexical-migrate-fields". */ export interface LexicalMigrateField { - id: string - title: string + id: string; + title: string; lexicalWithLexicalPluginData?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; lexicalWithSlateData?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; lexicalSimple?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - lexicalSimple_html?: string | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + lexicalSimple_html?: string | null; groupWithLexicalField?: { lexicalInGroupField?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - lexicalInGroupField_html?: string | null - } + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + lexicalInGroupField_html?: string | null; + }; arrayWithLexicalField?: | { lexicalInArrayField?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - lexicalInArrayField_html?: string | null - id?: string | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + lexicalInArrayField_html?: string | null; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "lexical-localized-fields". + */ +export interface LexicalLocalizedField { + id: string; + title: string; + lexicalSimple?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + lexicalBlocksLocalized?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + lexicalBlocksSubLocalized?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - canViewConditionalField?: boolean | null - 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 + id: string; + canViewConditionalField?: boolean | null; + 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: string - title?: string | null + id: string; + title?: string | null; items: { - text: string - localizedText?: string | null + text: string; + localizedText?: string | null; subArray?: | { - text?: string | null - id?: string | null + text?: string | null; + id?: string | null; }[] - | null - id?: string | null - }[] + | null; + id?: string | null; + }[]; collapsedArray?: | { - text: string - id?: string | null + text: string; + id?: string | null; }[] - | null + | null; localized: { - text: string - id?: string | null - }[] + text: string; + id?: string | null; + }[]; readOnly?: | { - text?: string | null - id?: string | null + text?: string | null; + id?: string | null; }[] - | null + | null; potentiallyEmptyArray?: | { - text?: string | null + text?: string | null; groupInRow?: { - textInGroupInRow?: string | null - } - id?: string | null + textInGroupInRow?: string | null; + }; + id?: string | null; }[] - | null + | null; rowLabelAsComponent?: | { - title?: string | null - id?: string | null + title?: string | null; + id?: string | null; }[] - | null + | null; arrayWithMinRows?: | { - text?: string | null - id?: string | null + text?: string | null; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + disableSort?: + | { + text: string; + id?: string | null; + }[] + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "block-fields". */ export interface BlockField { - id: string + id: string; blocks: ( | { - text: string + text: string; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } | { subBlocks?: | ( | { - text: string - id?: string | null - blockName?: string | null - blockType: 'text' + text: string; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } )[] - | null - id?: string | null - blockName?: string | null - blockType: 'subBlocks' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'subBlocks'; } | { - textInCollapsible?: string | null - textInRow?: string | null - id?: string | null - blockName?: string | null - blockType: 'tabs' + textInCollapsible?: string | null; + textInRow?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'tabs'; } - )[] + )[]; duplicate: ( | { - text: string + text: string; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } | { subBlocks?: | ( | { - text: string - id?: string | null - blockName?: string | null - blockType: 'text' + text: string; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } )[] - | null - id?: string | null - blockName?: string | null - blockType: 'subBlocks' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'subBlocks'; } | { - textInCollapsible?: string | null - textInRow?: string | null - id?: string | null - blockName?: string | null - blockType: 'tabs' + textInCollapsible?: string | null; + textInRow?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'tabs'; } - )[] + )[]; collapsedByDefaultBlocks: ( | { - text: string + text: string; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'localizedContent' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'localizedContent'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'localizedNumber' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'localizedNumber'; } | { subBlocks?: | ( | { - text: string - id?: string | null - blockName?: string | null - blockType: 'text' + text: string; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } )[] - | null - id?: string | null - blockName?: string | null - blockType: 'localizedSubBlocks' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'localizedSubBlocks'; } | { - textInCollapsible?: string | null - textInRow?: string | null - id?: string | null - blockName?: string | null - blockType: 'localizedTabs' + 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 + text: string; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'localizedContent' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'localizedContent'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'localizedNumber' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'localizedNumber'; } | { subBlocks?: | ( | { - text: string - id?: string | null - blockName?: string | null - blockType: 'text' + text: string; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } )[] - | null - id?: string | null - blockName?: string | null - blockType: 'localizedSubBlocks' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'localizedSubBlocks'; } | { - textInCollapsible?: string | null - textInRow?: string | null - id?: string | null - blockName?: string | null - blockType: 'localizedTabs' + textInCollapsible?: string | null; + textInRow?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'localizedTabs'; } - )[] + )[]; i18nBlocks?: | { - text?: string | null - id?: string | null - blockName?: string | null - blockType: 'text' + text?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'text'; }[] - | null + | null; blocksWithSimilarConfigs?: | ( | { items?: | { - title: string - id?: string | null + title: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-a' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-a'; } | { items?: | { - title2: string - id?: string | null + title2: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-b' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-b'; } | { group?: { - text?: string | null - } - id?: string | null - blockName?: string | null - blockType: 'group-block' + text?: string | null; + }; + id?: string | null; + blockName?: string | null; + blockType: 'group-block'; } )[] - | null + | null; blocksWithSimilarGroup?: | ( | { group?: { - text?: string | null - } - id?: string | null - blockName?: string | null - blockType: 'group-block' + text?: string | null; + }; + id?: string | null; + blockName?: string | null; + blockType: 'group-block'; } | { items?: | { - title2: string - id?: string | null + title2: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-b' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-b'; } )[] - | null + | null; blocksWithMinRows?: | { - blockTitle?: string | null - id?: string | null - blockName?: string | null - blockType: 'block' + blockTitle?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block'; }[] - | null + | null; customBlocks?: | ( | { - block1Title?: string | null - id?: string | null - blockName?: string | null - blockType: 'block-1' + block1Title?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-1'; } | { - block2Title?: string | null - id?: string | null - blockName?: string | null - blockType: 'block-2' + block2Title?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-2'; } )[] - | null + | null; relationshipBlocks?: | { - relationship?: (string | null) | TextField - id?: string | null - blockName?: string | null - blockType: 'relationships' + relationship?: (string | null) | TextField; + id?: string | null; + blockName?: string | null; + blockType: 'relationships'; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "text-fields". */ export interface TextField { - id: string - text: string - localizedText?: string | null - i18nText?: string | null - defaultFunction?: string | null - defaultAsync?: string | null - overrideLength?: string | null - fieldWithDefaultValue?: string | null - dependentOnFieldWithDefaultValue?: string | null - customLabel?: string | null - customError?: string | null - beforeAndAfterInput?: string | null - hasMany?: string[] | null - validatesHasMany?: string[] | null - localizedHasMany?: string[] | null - withMinRows?: string[] | null - withMaxRows?: string[] | null - updatedAt: string - createdAt: string + id: string; + text: string; + localizedText?: string | null; + i18nText?: string | null; + defaultFunction?: string | null; + defaultAsync?: string | null; + overrideLength?: string | null; + fieldWithDefaultValue?: string | null; + dependentOnFieldWithDefaultValue?: string | null; + customLabel?: string | null; + customError?: string | null; + beforeAndAfterInput?: string | null; + hasMany?: string[] | null; + validatesHasMany?: string[] | null; + localizedHasMany?: string[] | null; + withMinRows?: string[] | null; + withMaxRows?: string[] | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "checkbox-fields". */ export interface CheckboxField { - id: string - checkbox: boolean - updatedAt: string - createdAt: string + id: string; + checkbox: boolean; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "code-fields". */ export interface CodeField { - id: string - javascript?: string | null - typescript?: string | null - json?: string | null - html?: string | null - css?: string | null - updatedAt: string - createdAt: string + id: string; + javascript?: string | null; + typescript?: string | null; + json?: string | null; + html?: string | null; + css?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "collapsible-fields". */ export interface CollapsibleField { - id: string - text: string + id: string; + text: string; group?: { - textWithinGroup?: string | null + textWithinGroup?: string | null; subGroup?: { - textWithinSubGroup?: string | null - } - } - someText?: string | null + textWithinSubGroup?: string | null; + }; + }; + someText?: string | null; group2?: { - textWithinGroup?: string | null + textWithinGroup?: string | null; subGroup?: { - textWithinSubGroup?: string | null - } - } - functionTitleField?: string | null - componentTitleField?: string | null - nestedTitle?: string | null + textWithinSubGroup?: string | null; + }; + }; + functionTitleField?: string | null; + componentTitleField?: string | null; + nestedTitle?: string | null; arrayWithCollapsibles?: | { - innerCollapsible?: string | null - id?: string | null + innerCollapsible?: string | null; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "conditional-logic". */ export interface ConditionalLogic { - id: string - text: string - toggleField?: boolean | null - fieldToToggle?: string | null - userConditional?: string | null + id: string; + text: string; + toggleField?: boolean | null; + fieldToToggle?: string | null; + userConditional?: string | null; parentGroup?: { - enableParentGroupFields?: boolean | null - siblingField?: string | null - } - reliesOnParentGroup?: string | null - groupSelection?: ('group1' | 'group2') | null + enableParentGroupFields?: boolean | null; + siblingField?: string | null; + }; + reliesOnParentGroup?: string | null; + groupSelection?: ('group1' | 'group2') | null; group1?: { - group1Field?: string | null - } + group1Field?: string | null; + }; group2?: { - group2Field?: string | null - } - updatedAt: string - createdAt: string + group2Field?: string | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "date-fields". */ export interface DateField { - id: string - default: string - timeOnly?: string | null - timeOnlyWithCustomFormat?: string | null - dayOnly?: string | null - dayAndTime?: string | null - monthOnly?: string | null - updatedAt: string - createdAt: string + id: string; + default: string; + timeOnly?: string | null; + timeOnlyWithCustomFormat?: string | null; + dayOnly?: string | null; + dayAndTime?: string | null; + monthOnly?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "radio-fields". */ export interface RadioField { - id: string - radio?: ('one' | 'two' | 'three') | null - updatedAt: string - createdAt: string + id: string; + radio?: ('one' | 'two' | 'three') | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "group-fields". */ export interface GroupField { - id: string + id: string; group: { - text: string - defaultParent?: string | null - defaultChild?: string | null + text: string; + defaultParent?: string | null; + defaultChild?: string | null; subGroup?: { - textWithinGroup?: string | null + textWithinGroup?: string | null; arrayWithinGroup?: | { - textWithinArray?: string | null - id?: string | null + textWithinArray?: string | null; + id?: string | null; }[] - | null - } - } + | null; + }; + }; arrayOfGroups?: | { groupItem?: { - text?: string | null - } - id?: string | null + text?: string | null; + }; + id?: string | null; }[] - | null + | null; potentiallyEmptyGroup?: { - text?: string | null - } + text?: string | null; + }; groupInRow?: { - field?: string | null - secondField?: string | null - thirdField?: string | null - } + field?: string | null; + secondField?: string | null; + thirdField?: string | null; + }; secondGroupInRow?: { - field?: string | null + field?: string | null; nestedGroup?: { - nestedField?: string | null - } - } + nestedField?: string | null; + }; + }; groups: { groupInRow?: { - field?: string | null - secondField?: string | null - thirdField?: string | null - } + field?: string | null; + secondField?: string | null; + thirdField?: string | null; + }; secondGroupInRow?: { - field?: string | null + field?: string | null; nestedGroup?: { - nestedField?: string | null - } - } - } - updatedAt: string - createdAt: string + nestedField?: string | null; + }; + }; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "row-fields". */ export interface RowField { - id: string - title: string - field_with_width_a?: string | null - field_with_width_b?: string | null - field_within_collapsible_a?: string | null - field_within_collapsible_b?: string | null - updatedAt: string - createdAt: string + id: string; + title: string; + field_with_width_a?: string | null; + field_with_width_b?: string | null; + field_within_collapsible_a?: string | null; + field_within_collapsible_b?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "indexed-fields". */ export interface IndexedField { - id: string - text: string - uniqueText?: string | null - uniqueRequiredText: string - localizedUniqueRequiredText: string + id: string; + text: string; + uniqueText?: string | null; + uniqueRequiredText: string; + localizedUniqueRequiredText: string; /** * @minItems 2 * @maxItems 2 */ - point?: [number, number] | null + point?: [number, number] | null; group?: { - localizedUnique?: string | null - unique?: string | null + localizedUnique?: string | null; + unique?: string | null; /** * @minItems 2 * @maxItems 2 */ - point?: [number, number] | null - } - collapsibleLocalizedUnique?: string | null - collapsibleTextUnique?: string | null - updatedAt: string - createdAt: string + point?: [number, number] | null; + }; + collapsibleLocalizedUnique?: string | null; + collapsibleTextUnique?: string | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "json-fields". */ export interface JsonField { - id: string + id: string; json?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "number-fields". */ export interface NumberField { - id: string - number?: number | null - min?: number | null - max?: number | null - positiveNumber?: number | null - negativeNumber?: number | null - decimalMin?: number | null - decimalMax?: number | null - defaultNumber?: number | null - hasMany?: number[] | null - validatesHasMany?: number[] | null - localizedHasMany?: number[] | null - withMinRows?: number[] | null - updatedAt: string - createdAt: string + id: string; + number?: number | null; + min?: number | null; + max?: number | null; + positiveNumber?: number | null; + negativeNumber?: number | null; + decimalMin?: number | null; + decimalMax?: number | null; + defaultNumber?: number | null; + hasMany?: number[] | null; + validatesHasMany?: number[] | null; + localizedHasMany?: number[] | null; + withMinRows?: number[] | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "point-fields". */ export interface PointField { - id: string + id: string; /** * @minItems 2 * @maxItems 2 */ - point: [number, number] + point: [number, number]; /** * @minItems 2 * @maxItems 2 */ - localized?: [number, number] | null + localized?: [number, number] | null; group?: { /** * @minItems 2 * @maxItems 2 */ - point?: [number, number] | null - } - updatedAt: string - createdAt: string + point?: [number, number] | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "relationship-fields". */ export interface RelationshipField { - id: string - text?: string | null + id: string; + text?: string | null; relationship: | { - relationTo: 'text-fields' - value: string | TextField + relationTo: 'text-fields'; + value: string | TextField; } | { - relationTo: 'array-fields' - value: string | ArrayField - } + relationTo: 'array-fields'; + value: string | ArrayField; + }; relationHasManyPolymorphic?: | ( | { - relationTo: 'text-fields' - value: string | TextField + relationTo: 'text-fields'; + value: string | TextField; } | { - relationTo: 'array-fields' - value: string | ArrayField + relationTo: 'array-fields'; + value: string | ArrayField; } )[] - | null - relationToSelf?: (string | null) | RelationshipField - relationToSelfSelectOnly?: (string | null) | RelationshipField - relationWithDynamicDefault?: (string | null) | User + | null; + relationToSelf?: (string | null) | RelationshipField; + relationToSelfSelectOnly?: (string | null) | RelationshipField; + relationWithDynamicDefault?: (string | null) | User; relationHasManyWithDynamicDefault?: { - relationTo: 'users' - value: string | User - } | null - relationshipWithMin?: (string | TextField)[] | null - relationshipWithMax?: (string | TextField)[] | null - relationshipHasMany?: (string | TextField)[] | null + relationTo: 'users'; + value: string | User; + } | null; + relationshipWithMin?: (string | TextField)[] | null; + relationshipWithMax?: (string | TextField)[] | null; + relationshipHasMany?: (string | TextField)[] | null; array?: | { - relationship?: (string | null) | TextField - id?: string | null + relationship?: (string | null) | TextField; + id?: string | null; }[] - | null + | null; relationshipWithMinRows?: | { - relationTo: 'text-fields' - value: string | TextField + relationTo: 'text-fields'; + value: string | TextField; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "rich-text-fields". */ export interface RichTextField { - id: string - title: string + id: string; + title: string; lexicalCustomFields: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } - lexicalCustomFields_html?: string | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + }; + lexicalCustomFields_html?: string | null; lexical?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[] | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[] | null; richText: { - [k: string]: unknown - }[] + [k: string]: unknown; + }[]; richTextCustomFields?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; richTextReadOnly?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; blocks?: | ( | { - text?: string | null - id?: string | null - blockName?: string | null - blockType: 'textBlock' + text?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'textBlock'; } | { text?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'richTextBlock' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'richTextBlock'; } )[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "select-fields". */ export interface SelectField { - id: string - select?: ('one' | 'two' | 'three') | null - selectReadOnly?: ('one' | 'two' | 'three') | null - selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[] | null - selectHasManyLocalized?: ('one' | 'two')[] | null - selectI18n?: ('one' | 'two' | 'three') | null - simple?: ('One' | 'Two' | 'Three') | null + id: string; + select?: ('one' | 'two' | 'three') | null; + selectReadOnly?: ('one' | 'two' | 'three') | null; + selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[] | null; + selectHasManyLocalized?: ('one' | 'two')[] | null; + selectI18n?: ('one' | 'two' | 'three') | null; + simple?: ('One' | 'Two' | 'Three') | null; settings?: { - category?: ('a' | 'b')[] | null - } - updatedAt: string - createdAt: string + category?: ('a' | 'b')[] | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "tabs-fields". */ export interface TabsField { - id: string - sidebarField?: string | null + id: string; + sidebarField?: string | null; array: { - text: string - id?: string | null - }[] + text: string; + id?: string | null; + }[]; blocks: ( | { - text: string + text: string; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } | { subBlocks?: | ( | { - text: string - id?: string | null - blockName?: string | null - blockType: 'text' + text: string; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - number: number - id?: string | null - blockName?: string | null - blockType: 'number' + number: number; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } )[] - | null - id?: string | null - blockName?: string | null - blockType: 'subBlocks' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'subBlocks'; } | { - textInCollapsible?: string | null - textInRow?: string | null - id?: string | null - blockName?: string | null - blockType: 'tabs' + textInCollapsible?: string | null; + textInRow?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'tabs'; } - )[] + )[]; group: { - number: number - } - textInRow: string - numberInRow: number + number: number; + }; + textInRow: string; + numberInRow: number; json?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null + | null; tab: { array: { - text: string - id?: string | null - }[] - text?: string | null - defaultValue?: string | null - arrayInRow?: { - text: string - id?: string | null - }[] - } + text: string; + id?: string | null; + }[]; + text?: string | null; + defaultValue?: string | null; + arrayInRow?: + | { + textInArrayInRow?: string | null; + id?: string | null; + }[] + | null; + }; namedTabWithDefaultValue: { - defaultValue?: string | null - } + defaultValue?: string | null; + }; localizedTab: { - text?: string | null - } + text?: string | null; + }; accessControlTab: { - text?: string | null - } + text?: string | null; + }; hooksTab: { - beforeValidate?: boolean | null - beforeChange?: boolean | null - afterChange?: boolean | null - afterRead?: boolean | null - } - textarea?: string | null - anotherText: string + beforeValidate?: boolean | null; + beforeChange?: boolean | null; + afterChange?: boolean | null; + afterRead?: boolean | null; + }; + textarea?: string | null; + anotherText: string; nestedTab: { - text?: string | null - } - updatedAt: string - createdAt: string + text?: string | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "uploads". */ export interface Upload { - id: string - text?: string | null - media?: string | Upload | null + id: string; + text?: string | null; + media?: string | Upload | null; richText?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - updatedAt: string - createdAt: string - url?: string | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "uploads2". */ export interface Uploads2 { - id: string - text?: string | null - media?: string | Uploads2 | null - updatedAt: string - createdAt: string - url?: string | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null + id: string; + text?: string | null; + media?: string | Uploads2 | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "uploads3". */ export interface Uploads3 { - id: string - media?: string | Uploads3 | null + id: string; + media?: string | Uploads3 | null; richText?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - updatedAt: string - createdAt: string - url?: string | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "ui-fields". + */ +export interface UiField { + id: string; + text: string; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-preferences". */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-migrations". */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "tabsWithRichText". */ export interface TabsWithRichText { - id: string + id: string; tab1: { rt1?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - } + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + }; tab2: { rt2?: { root: { - type: string + type: string; children: { - type: string - version: number - [k: string]: unknown - }[] - direction: ('ltr' | 'rtl') | null - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '' - indent: number - version: number - } - [k: string]: unknown - } | null - } - updatedAt?: string | null - createdAt?: string | null + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + }; + updatedAt?: 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' + radioButtons?: ('option1' | 'option2' | 'option3') | null; + id?: string | null; + blockName?: string | null; + blockType: 'radioButtons'; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/fields/tsconfig.json b/test/fields/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/fields/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/generateTypes.ts b/test/generateTypes.ts index b563976f4..81425a127 100644 --- a/test/generateTypes.ts +++ b/test/generateTypes.ts @@ -1,4 +1,5 @@ import fs from 'fs' +import { spawn } from 'node:child_process' import path from 'path' import { generateTypes } from 'payload/node' @@ -14,36 +15,59 @@ import { load } from './loader/load.js' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) -let testDir -if (testConfigDir) { - testDir = path.resolve(dirname, testConfigDir) +let testDir: string - console.log('Generating types for config:', path.resolve(testDir, 'config.ts')) +async function run() { + if (testConfigDir) { + testDir = path.resolve(dirname, testConfigDir) - const config: SanitizedConfig = (await load( - path.resolve(testDir, 'config.ts'), - )) as unknown as SanitizedConfig + const pathWithConfig = path.resolve(testDir, 'config.ts') + console.log('Generating types for config:', pathWithConfig) - setTestEnvPaths(testDir) - generateTypes(config) -} else { - // Generate types for entire directory - testDir = dirname + const config: SanitizedConfig = (await load(pathWithConfig)) as unknown as SanitizedConfig - console.log( - 'No testConfigDir passed. Generating types for config:', - path.resolve(testDir, 'config.ts'), - ) + setTestEnvPaths(testDir) + await generateTypes(config) + } else { + // Search through every folder in dirname, and if it has a config.ts file, generate types for it + const foundDirs: string[] = [] - const config: SanitizedConfig = (await load( - path.resolve(testDir, 'config.ts'), - )) as unknown as SanitizedConfig + fs.readdirSync(dirname, { withFileTypes: true }) + .filter((f) => f.isDirectory()) + .forEach((dir) => { + const suiteDir = path.resolve(dirname, dir.name) + const configFound = fs.existsSync(path.resolve(suiteDir, 'config.ts')) + if (configFound) { + foundDirs.push(dir.name) + } + }) - fs.readdirSync(dirname, { withFileTypes: true }) - .filter((f) => f.isDirectory()) - .forEach((dir) => { - const suiteDir = path.resolve(testDir, dir.name) - const configFound = setTestEnvPaths(suiteDir) - if (configFound) generateTypes(config) - }) + let i = 0 + for (const suiteDir of foundDirs) { + i++ + const pathWithConfig = path.resolve(suiteDir, 'config.ts') + console.log(`Generating types for config ${i} / ${foundDirs.length}:`, pathWithConfig) + + // start a new node process which runs test/generateTypes with pathWithConfig as argument. Can't run it in this process, as there could otherwise be + // breakage between tests, as node can cache things in between runs. + // Make sure to wait until the process is done before starting the next one. + const child = spawn('tsx', ['test/generateTypes.ts', suiteDir]) + + child.stdout.setEncoding('utf8') + child.stdout.on('data', function (data) { + console.log(suiteDir + ' stdout: ' + data) + }) + + child.stderr.setEncoding('utf8') + child.stderr.on('data', function (data) { + console.log(suiteDir + ' stderr: ' + data) + }) + + child.on('close', function (code) { + console.log(suiteDir + ' closing code: ' + code) + }) + } + } } + +void run() diff --git a/test/globals/payload-types.ts b/test/globals/payload-types.ts index 22e0d7862..ff825f161 100644 --- a/test/globals/payload-types.ts +++ b/test/globals/payload-types.ts @@ -1,41 +1,150 @@ /* 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 {} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "global". - */ -export interface Global { - id: string - title?: string -} -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "array". - */ -export interface Array { - id: string - array: { - text?: string - id?: string - }[] +export interface Config { + collections: { + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: { + global: Global; + array: Array; + 'default-value': DefaultValue; + 'access-control': AccessControl; + 'without-graphql': WithoutGraphql; + }; + locale: 'en' | 'es'; + user: User & { + collection: 'users'; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - createdAt: string - updatedAt: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global". + */ +export interface Global { + id: string; + json?: + | { + [k: string]: unknown; + } + | unknown[] + | string + | number + | boolean + | null; + title?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "array". + */ +export interface Array { + id: string; + 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` "default-value". + */ +export interface DefaultValue { + id: string; + text?: string | null; + group?: { + text?: string | null; + }; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "access-control". + */ +export interface AccessControl { + id: string; + title: string; + enabled?: boolean | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "without-graphql". + */ +export interface WithoutGraphql { + id: string; + updatedAt?: string | null; + createdAt?: string | null; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/globals/tsconfig.json b/test/globals/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/globals/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/graphql-schema-gen/payload-types.ts b/test/graphql-schema-gen/payload-types.ts index 4c27ee7ed..165418181 100644 --- a/test/graphql-schema-gen/payload-types.ts +++ b/test/graphql-schema-gen/payload-types.ts @@ -1,68 +1,158 @@ /* tslint:disable */ +/* eslint-disable */ /** - * This file was automatically generated by Payload CMS. + * 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 type SharedMetaArray = { - title?: string - description?: string - id?: string -}[] +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "SharedMetaArray". + */ +export type SharedMetaArray = + | { + title?: string | null; + description?: string | null; + id?: string | null; + }[] + | null; export interface Config { collections: { - collection1: Collection1 - collection2: Collection2 - users: User - } - globals: {} + collection1: Collection1; + collection2: Collection2; + 'no-graphql': NoGraphql; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "collection1". + */ export interface Collection1 { - id: string - testing: string - title: string - meta?: SharedMetaArray - blocks: (SharedMetaBlock | AnotherSharedBlock)[] - updatedAt: string - createdAt: string + id: string; + testing: string; + title: string; + meta?: SharedMetaArray; + blocks: (SharedMetaBlock | AnotherSharedBlock)[]; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "SharedMetaBlock". + */ export interface SharedMetaBlock { - b1title: string - b1description?: string - id?: string - blockName?: string - blockType: 'block1' + b1title: string; + b1description?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block1'; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "AnotherSharedBlock". + */ export interface AnotherSharedBlock { - b2title: string - b2description?: string - id?: string - blockName?: string - blockType: 'block2' + b2title: string; + b2description?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block2'; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "collection2". + */ export interface Collection2 { - id: string - meta?: SharedMeta + id: string; + metaArray?: SharedMetaArray; + metaGroup?: SharedMeta; nestedGroup?: { - meta?: SharedMeta - } - updatedAt: string - createdAt: string + meta?: SharedMeta; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "SharedMeta". + */ export interface SharedMeta { - title?: string - description?: string + title?: string | null; + description?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "no-graphql". + */ +export interface NoGraphql { + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/graphql-schema-gen/tsconfig.json b/test/graphql-schema-gen/tsconfig.json index ff2bf2ca4..48610a17f 100644 --- a/test/graphql-schema-gen/tsconfig.json +++ b/test/graphql-schema-gen/tsconfig.json @@ -1,9 +1,3 @@ { "extends": "../tsconfig.json", - "compilerOptions": { - "esModuleInterop": true, - "paths": { - "payload/generated-types": ["./payload-types.ts"] - } - } } diff --git a/test/hooks/payload-types.ts b/test/hooks/payload-types.ts index 6bb493975..2c66c0176 100644 --- a/test/hooks/payload-types.ts +++ b/test/hooks/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,90 +8,213 @@ export interface Config { collections: { - afterOperation: AfterOperation - transforms: Transform - hooks: Hook - 'nested-after-read-hooks': NestedAfterReadHook - 'chaining-hooks': ChainingHook - relations: Relation - 'hooks-users': HooksUser - } - globals: {} + afterOperation: AfterOperation; + 'context-hooks': ContextHook; + transforms: Transform; + hooks: Hook; + 'nested-after-read-hooks': NestedAfterReadHook; + 'chaining-hooks': ChainingHook; + relations: Relation; + 'hooks-users': HooksUser; + 'data-hooks': DataHook; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: { + 'data-hooks-global': DataHooksGlobal; + }; + locale: null; + user: HooksUser & { + collection: 'hooks-users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "afterOperation". + */ export interface AfterOperation { - id: string - title: string - updatedAt: string - createdAt: string + id: string; + title: string; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "context-hooks". + */ +export interface ContextHook { + id: string; + value?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "transforms". + */ export interface Transform { - id: string + id: string; /** * @minItems 2 * @maxItems 2 */ - transform?: [number, number] + transform?: [number, number] | null; /** * @minItems 2 * @maxItems 2 */ - localizedTransform?: [number, number] - updatedAt: string - createdAt: string + localizedTransform?: [number, number] | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hooks". + */ export interface Hook { - id: string - fieldBeforeValidate?: boolean - fieldBeforeChange?: boolean - fieldAfterChange?: boolean - fieldAfterRead?: boolean - collectionBeforeValidate?: boolean - collectionBeforeChange?: boolean - collectionAfterChange?: boolean - collectionBeforeRead?: boolean - collectionAfterRead?: boolean - updatedAt: string - createdAt: string + id: string; + fieldBeforeValidate?: boolean | null; + fieldBeforeChange?: boolean | null; + fieldAfterChange?: boolean | null; + fieldAfterRead?: boolean | null; + collectionBeforeValidate?: boolean | null; + collectionBeforeChange?: boolean | null; + collectionAfterChange?: boolean | null; + collectionBeforeRead?: boolean | null; + collectionAfterRead?: boolean | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "nested-after-read-hooks". + */ export interface NestedAfterReadHook { - id: string - text?: string + id: string; + text?: string | null; group?: { - array?: { - input?: string - afterRead?: string - shouldPopulate?: string | Relation - id?: string - }[] + array?: + | { + input?: string | null; + afterRead?: string | null; + shouldPopulate?: (string | null) | Relation; + id?: string | null; + }[] + | null; subGroup?: { - afterRead?: string - shouldPopulate?: string | Relation - } - } - updatedAt: string - createdAt: string + afterRead?: string | null; + shouldPopulate?: (string | null) | Relation; + }; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relations". + */ export interface Relation { - id: string - title: string - updatedAt: string - createdAt: string + id: string; + title: string; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "chaining-hooks". + */ export interface ChainingHook { - id: string - text?: string - updatedAt: string - createdAt: string + id: string; + text?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "hooks-users". + */ export interface HooksUser { - id: string - roles: ('admin' | 'user')[] - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + roles: ('admin' | 'user')[]; + afterLoginHook?: boolean | null; + 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` "data-hooks". + */ +export interface DataHook { + id: string; + field_collectionAndField?: string | null; + collection_beforeOperation_collection?: string | null; + collection_beforeChange_collection?: string | null; + collection_afterChange_collection?: string | null; + collection_beforeRead_collection?: string | null; + collection_afterRead_collection?: string | null; + collection_afterOperation_collection?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'hooks-users'; + value: string | HooksUser; + }; + 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "data-hooks-global". + */ +export interface DataHooksGlobal { + id: string; + field_globalAndField?: string | null; + global_beforeChange_global?: string | null; + global_afterChange_global?: string | null; + global_beforeRead_global?: string | null; + global_afterRead_global?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/hooks/tsconfig.json b/test/hooks/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/hooks/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/live-preview/payload-types.ts b/test/live-preview/payload-types.ts index 2656f69b4..c431beb25 100644 --- a/test/live-preview/payload-types.ts +++ b/test/live-preview/payload-types.ts @@ -417,7 +417,6 @@ export interface Category { /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "ssr". - */ export interface Ssr { id: string; slug: string; @@ -640,3 +639,9 @@ export interface Footer { updatedAt?: string | null; createdAt?: string | null; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/localization-rtl/config.ts b/test/localization-rtl/config.ts index c74941f5c..b496ed015 100644 --- a/test/localization-rtl/config.ts +++ b/test/localization-rtl/config.ts @@ -1,4 +1,3 @@ -import en from '../../packages/payload/src/translations/en.json' import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js' import { devUser } from '../credentials.js' import { ar } from './ar.js' @@ -8,13 +7,13 @@ import deepMerge from './deepMerge.js' export default buildConfigWithDefaults({ collections: [Users, Posts], - i18n: { + /*i18n: { fallbackLng: 'en', // default debug: false, // default resources: { ar: deepMerge(en, ar), }, - }, + },*/ localization: { locales: [ { diff --git a/test/localization-rtl/payload-types.ts b/test/localization-rtl/payload-types.ts new file mode 100644 index 000000000..d5b8b9e40 --- /dev/null +++ b/test/localization-rtl/payload-types.ts @@ -0,0 +1,104 @@ +/* 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 { + collections: { + users: User; + posts: Post; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'ar'; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "posts". + */ +export interface Post { + id: string; + title?: string | null; + description?: string | null; + content?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/localization-rtl/tsconfig.json b/test/localization-rtl/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/localization-rtl/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/localization/payload-types.ts b/test/localization/payload-types.ts index 6a0b2546d..46fe7a29d 100644 --- a/test/localization/payload-types.ts +++ b/test/localization/payload-types.ts @@ -8,175 +8,291 @@ export interface Config { collections: { - users: User - 'localized-posts': LocalizedPost - 'array-fields': ArrayField - 'localized-required': LocalizedRequired - 'with-localized-relationship': WithLocalizedRelationship - 'relationship-localized': RelationshipLocalized - dummy: Dummy - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + users: User; + 'localized-posts': LocalizedPost; + 'array-fields': ArrayField; + 'localized-required': LocalizedRequired; + 'with-localized-relationship': WithLocalizedRelationship; + 'relationship-localized': RelationshipLocalized; + dummy: Dummy; + nested: Nested; + 'localized-sort': LocalizedSort; + 'blocks-same-name': BlocksSameName; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - 'global-array': GlobalArray - } + 'global-array': GlobalArray; + }; + locale: 'en' | 'es' | 'pt' | 'ar'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - relation?: (string | 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 + id: string; + relation?: (string | 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` "localized-posts". + */ export interface LocalizedPost { - id: string - title?: string | null - description?: string | null - localizedCheckbox?: boolean | null - updatedAt: string - createdAt: string + id: string; + title?: string | null; + description?: string | null; + localizedCheckbox?: boolean | null; + children?: (string | LocalizedPost)[] | null; + group?: { + children?: string | null; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "array-fields". + */ export interface ArrayField { - id: string + id: string; items?: | { - text: string - id?: string | null + text: string; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "localized-required". + */ export interface LocalizedRequired { - id: string - title: string + id: string; + title: string; layout: ( | { - text?: string | null - id?: string | null - blockName?: string | null - blockType: 'text' + text?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - number?: number | null - id?: string | null - blockName?: string | null - blockType: 'number' + number?: number | null; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } - )[] - updatedAt: string - createdAt: string + )[]; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "with-localized-relationship". + */ export interface WithLocalizedRelationship { - id: string - localizedRelationship?: (string | null) | LocalizedPost - localizedRelationHasManyField?: (string | LocalizedPost)[] | null + id: string; + localizedRelationship?: (string | null) | LocalizedPost; + localizedRelationHasManyField?: (string | LocalizedPost)[] | null; localizedRelationMultiRelationTo?: | ({ - relationTo: 'localized-posts' - value: string | LocalizedPost + relationTo: 'localized-posts'; + value: string | LocalizedPost; } | null) | ({ - relationTo: 'dummy' - value: string | Dummy - } | null) + relationTo: 'dummy'; + value: string | Dummy; + } | null); localizedRelationMultiRelationToHasMany?: | ( | { - relationTo: 'localized-posts' - value: string | LocalizedPost + relationTo: 'localized-posts'; + value: string | LocalizedPost; } | { - relationTo: 'dummy' - value: string | Dummy + relationTo: 'dummy'; + value: string | Dummy; } )[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "dummy". + */ export interface Dummy { - id: string - name?: string | null - updatedAt: string - createdAt: string + id: string; + 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: string - relationship?: (string | null) | LocalizedPost - relationshipHasMany?: (string | LocalizedPost)[] | null + id: string; + relationship?: (string | null) | LocalizedPost; + relationshipHasMany?: (string | LocalizedPost)[] | null; relationMultiRelationTo?: | ({ - relationTo: 'localized-posts' - value: string | LocalizedPost + relationTo: 'localized-posts'; + value: string | LocalizedPost; } | null) | ({ - relationTo: 'dummy' - value: string | Dummy - } | null) + relationTo: 'dummy'; + value: string | Dummy; + } | null); relationMultiRelationToHasMany?: | ( | { - relationTo: 'localized-posts' - value: string | LocalizedPost + relationTo: 'localized-posts'; + value: string | LocalizedPost; } | { - relationTo: 'dummy' - value: string | Dummy + relationTo: 'dummy'; + value: string | Dummy; } )[] - | null + | null; arrayField?: | { - nestedRelation?: (string | null) | LocalizedPost - id?: string | null + nestedRelation?: (string | null) | LocalizedPost; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "nested". + */ +export interface Nested { + id: string; + 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` "localized-sort". + */ +export interface LocalizedSort { + id: string; + 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: string; + 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: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + 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: string + id: string; array?: | { - text?: string | null - id?: string | null + text?: string | null; + id?: string | null; }[] - | null - updatedAt?: string | null - createdAt?: string | null + | null; + updatedAt?: string | null; + createdAt?: string | null; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/localization/tsconfig.json b/test/localization/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/localization/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/migrations-cli/payload-types.ts b/test/migrations-cli/payload-types.ts index f20988d1b..db7358484 100644 --- a/test/migrations-cli/payload-types.ts +++ b/test/migrations-cli/payload-types.ts @@ -1,48 +1,77 @@ /* tslint:disable */ +/* eslint-disable */ /** - * This file was automatically generated by Payload CMS. + * 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 { collections: { - users: User - 'payload-preferences': PayloadPreference - } - globals: {} + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - custom?: string - checkbox?: boolean - updatedAt: string - createdAt: string - email: string - resetPasswordToken?: string - resetPasswordExpiration?: string - salt?: string - hash?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - value: string | User - relationTo: 'users' - } - key?: string + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ +export interface PayloadMigration { + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/migrations-cli/tsconfig.json b/test/migrations-cli/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/migrations-cli/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/nested-fields/payload-types.ts b/test/nested-fields/payload-types.ts new file mode 100644 index 000000000..51b84382c --- /dev/null +++ b/test/nested-fields/payload-types.ts @@ -0,0 +1,164 @@ +/* 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 { + collections: { + 'nested-fields': NestedField; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "nested-fields". + */ +export interface NestedField { + id: string; + array?: + | { + group?: { + namedTab: { + blocks?: + | { + text?: string | null; + blockArray?: + | { + arrayText?: string | null; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'blockWithFields'; + }[] + | null; + }; + }; + id?: string | null; + }[] + | null; + tab1: { + layout?: + | ( + | { + items?: + | { + title: string; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-1'; + } + | { + items?: + | { + title2: string; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-2'; + } + )[] + | null; + }; + blocksWithSimilarConfigs?: + | ( + | { + items?: + | { + title: string; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-1'; + } + | { + items?: + | { + title2: string; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-2'; + } + )[] + | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/nested-fields/tsconfig.json b/test/nested-fields/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/nested-fields/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-cloud-storage/payload-types.ts b/test/plugin-cloud-storage/payload-types.ts new file mode 100644 index 000000000..2f4f90160 --- /dev/null +++ b/test/plugin-cloud-storage/payload-types.ts @@ -0,0 +1,131 @@ +/* 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 { + collections: { + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ +export interface Media { + id: string; + alt?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + square?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + sixteenByNineMedium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media-with-prefix". + */ +export interface MediaWithPrefix { + id: string; + prefix?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-cloud-storage/tsconfig.json b/test/plugin-cloud-storage/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-cloud-storage/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-cloud/payload-types.ts b/test/plugin-cloud/payload-types.ts new file mode 100644 index 000000000..f3fab88f9 --- /dev/null +++ b/test/plugin-cloud/payload-types.ts @@ -0,0 +1,113 @@ +/* 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 { + collections: { + media: Media; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ +export interface Media { + id: string; + alt?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + square?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + sixteenByNineMedium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-cloud/tsconfig.json b/test/plugin-cloud/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-cloud/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-form-builder/payload-types.ts b/test/plugin-form-builder/payload-types.ts index 1a6ac44ab..5bccb9247 100644 --- a/test/plugin-form-builder/payload-types.ts +++ b/test/plugin-form-builder/payload-types.ts @@ -8,246 +8,280 @@ export interface Config { collections: { - pages: Page - users: User - forms: Form - 'form-submissions': FormSubmission - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + pages: Page; + users: User; + forms: Form; + 'form-submissions': FormSubmission; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "pages". + */ export interface Page { - id: string - title: string - slug: string - form?: (string | null) | Form - updatedAt: string - createdAt: string + id: string; + title: string; + slug: string; + form?: (string | null) | Form; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "forms". + */ export interface Form { - id: string - title: string + id: string; + title: string; fields?: | ( | { - name: string - label?: string | null - width?: number | null - required?: boolean | null - defaultValue?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'checkbox' + name: string; + label?: string | null; + width?: number | null; + required?: boolean | null; + defaultValue?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'checkbox'; } | { - name: string - label?: string | null - width?: number | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'country' + name: string; + label?: string | null; + width?: number | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'country'; } | { - name: string - label?: string | null - width?: number | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'email' + name: string; + label?: string | null; + width?: number | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'email'; } | { message?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'message' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'message'; } | { - name: string - label?: string | null - width?: number | null - defaultValue?: number | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'number' + name: string; + label?: string | null; + width?: number | null; + defaultValue?: number | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'number'; } | { - name: string - label?: string | null - width?: number | null - basePrice?: number | null + name: string; + label?: string | null; + width?: number | null; + basePrice?: number | null; priceConditions?: | { - fieldToUse?: string | null - condition?: ('hasValue' | 'equals' | 'notEquals') | null - valueForCondition?: string | null - operator?: ('add' | 'subtract' | 'multiply' | 'divide') | null - valueType?: ('static' | 'valueOfField') | null - valueForOperator?: string | null - id?: string | null + fieldToUse?: string | null; + condition?: ('hasValue' | 'equals' | 'notEquals') | null; + valueForCondition?: string | null; + operator?: ('add' | 'subtract' | 'multiply' | 'divide') | null; + valueType?: ('static' | 'valueOfField') | null; + valueForOperator?: string | null; + id?: string | null; }[] - | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'payment' + | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'payment'; } | { - name: string - label?: string | null - width?: number | null - defaultValue?: string | null + name: string; + label?: string | null; + width?: number | null; + defaultValue?: string | null; options?: | { - label: string - value: string - id?: string | null + label: string; + value: string; + id?: string | null; }[] - | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'select' + | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'select'; } | { - name: string - label?: string | null - width?: number | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'state' + name: string; + label?: string | null; + width?: number | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'state'; } | { - name: string - label?: string | null - width?: number | null - defaultValue?: string | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'text' + name: string; + label?: string | null; + width?: number | null; + defaultValue?: string | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'text'; } | { - name: string - label?: string | null - width?: number | null - defaultValue?: string | null - required?: boolean | null - id?: string | null - blockName?: string | null - blockType: 'textarea' + name: string; + label?: string | null; + width?: number | null; + defaultValue?: string | null; + required?: boolean | null; + id?: string | null; + blockName?: string | null; + blockType: 'textarea'; } | { - value?: string | null - id?: string | null - blockName?: string | null - blockType: 'color' + value?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'color'; } )[] - | null - submitButtonLabel?: string | null - confirmationType?: ('message' | 'redirect') | null + | null; + submitButtonLabel?: string | null; + confirmationType?: ('message' | 'redirect') | null; confirmationMessage?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; redirect?: { - type?: ('reference' | 'custom') | null + type?: ('reference' | 'custom') | null; reference?: { - relationTo: 'pages' - value: string | Page - } | null - url?: string | null - } + relationTo: 'pages'; + value: string | Page; + } | null; + url?: string | null; + }; emails?: | { - emailTo?: string | null - cc?: string | null - bcc?: string | null - replyTo?: string | null - emailFrom?: string | null - subject: string + emailTo?: string | null; + cc?: string | null; + bcc?: string | null; + replyTo?: string | null; + emailFrom?: string | null; + subject: string; message?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - id?: string | null + | null; + id?: string | null; }[] - | null - custom?: string | null - updatedAt: string - createdAt: string + | null; + custom?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "form-submissions". + */ export interface FormSubmission { - id: string - form: string | Form + id: string; + form: string | Form; submissionData?: | { - field: string - value: string - id?: string | null + field: string; + value: string; + id?: string | null; }[] - | null + | null; payment?: { - field?: string | null - status?: string | null - amount?: number | null - paymentProcessor?: string | null + field?: string | null; + status?: string | null; + amount?: number | null; + paymentProcessor?: string | null; creditCard?: { - token?: string | null - brand?: string | null - number?: string | null - } - } - updatedAt: string - createdAt: string + token?: string | null; + brand?: string | null; + number?: string | null; + }; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-form-builder/tsconfig.json b/test/plugin-form-builder/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-form-builder/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-nested-docs/payload-types.ts b/test/plugin-nested-docs/payload-types.ts index 68fdad6ce..e252f88a5 100644 --- a/test/plugin-nested-docs/payload-types.ts +++ b/test/plugin-nested-docs/payload-types.ts @@ -8,108 +8,114 @@ export interface Config { collections: { - pages: Page - categories: Category - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' | 'de' + pages: Page; + categories: Category; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; user: User & { - collection: 'users' - } + collection: 'users'; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pages". */ export interface Page { - id: string - title: string - slug: string - fullTitle?: string | null - parent?: (string | null) | Page + id: string; + title: string; + slug: string; + fullTitle?: string | null; + parent?: (string | null) | Page; breadcrumbs?: | { - doc?: (string | null) | Page - url?: string | null - label?: string | null - id?: string | null + doc?: (string | null) | Page; + url?: string | null; + label?: string | null; + id?: string | null; }[] - | null - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "categories". */ export interface Category { - id: string - name: string + id: string; + name: string; categorization?: | { - doc?: (string | null) | Category - url?: string | null - label?: string | null - test?: string | null - id?: string | null + doc?: (string | null) | Category; + url?: string | null; + label?: string | null; + test?: string | null; + id?: string | null; }[] - | null - owner?: (string | null) | Category - updatedAt: string - createdAt: string + | null; + owner?: (string | null) | Category; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users". */ export interface User { - id: string - 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 + id: string; + 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` "payload-preferences". */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-migrations". */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-nested-docs/tsconfig.json b/test/plugin-nested-docs/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-nested-docs/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-redirects/payload-types.ts b/test/plugin-redirects/payload-types.ts index b81b330ce..c9aa7ad98 100644 --- a/test/plugin-redirects/payload-types.ts +++ b/test/plugin-redirects/payload-types.ts @@ -8,72 +8,102 @@ export interface Config { collections: { - users: User - pages: Page - redirects: Redirect - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + users: User; + pages: Page; + redirects: Redirect; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "pages". + */ export interface Page { - id: string - title: string - excerpt?: string | null - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + id: string; + title: string; + excerpt?: string | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "redirects". + */ export interface Redirect { - id: string - from: string + id: string; + from: string; to?: { - type?: ('reference' | 'custom') | null + type?: ('reference' | 'custom') | null; reference?: { - relationTo: 'pages' - value: string | Page - } | null - url?: string | null - } - updatedAt: string - createdAt: string + relationTo: 'pages'; + value: string | Page; + } | null; + url?: string | null; + }; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-redirects/tsconfig.json b/test/plugin-redirects/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-redirects/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-search/payload-types.ts b/test/plugin-search/payload-types.ts new file mode 100644 index 000000000..29ec55532 --- /dev/null +++ b/test/plugin-search/payload-types.ts @@ -0,0 +1,125 @@ +/* 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 { + collections: { + users: User; + pages: Page; + posts: Post; + search: Search; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "pages". + */ +export interface Page { + id: string; + title: string; + excerpt?: string | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ +export interface Post { + id: string; + title: string; + excerpt?: string | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "search". + */ +export interface Search { + id: string; + title?: string | null; + priority?: number | null; + doc: + | { + relationTo: 'pages'; + value: string | Page; + } + | { + relationTo: 'posts'; + value: string | Post; + }; + excerpt?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-search/tsconfig.json b/test/plugin-search/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-search/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-sentry/payload-types.ts b/test/plugin-sentry/payload-types.ts index 871f679df..310b78746 100644 --- a/test/plugin-sentry/payload-types.ts +++ b/test/plugin-sentry/payload-types.ts @@ -8,55 +8,81 @@ export interface Config { collections: { - posts: Post - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + posts: Post; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - text?: string | null - updatedAt: string - createdAt: string + id: string; + text?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - 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 + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string | null + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string | null - batch?: number | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-sentry/tsconfig.json b/test/plugin-sentry/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-sentry/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-seo/payload-types.ts b/test/plugin-seo/payload-types.ts index 2aa451c11..3acefbf58 100644 --- a/test/plugin-seo/payload-types.ts +++ b/test/plugin-seo/payload-types.ts @@ -8,80 +8,123 @@ export interface Config { collections: { - users: User - pages: Page - media: Media - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + users: User; + pages: Page; + media: Media; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email: string - resetPasswordToken?: string - resetPasswordExpiration?: string - salt?: string - hash?: string - loginAttempts?: number - lockUntil?: string - password: string + id: string; + 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` "pages". + */ export interface Page { - id: string - title: string - excerpt?: string - slug: string - meta?: { - title?: string - description?: string - image?: string | Media - ogTitle?: string - } - updatedAt: string - createdAt: string - _status?: 'draft' | 'published' + id: string; + title: string; + excerpt?: string | null; + slug: string; + meta: { + title: string; + description?: string | null; + image?: string | Media | null; + ogTitle?: string | null; + }; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ export interface Media { - id: string - media?: string | Media + id: string; + media?: string | Media | null; richText?: { - [k: string]: unknown - }[] - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string - batch?: number - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-seo/tsconfig.json b/test/plugin-seo/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-seo/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugin-stripe/payload-types.ts b/test/plugin-stripe/payload-types.ts new file mode 100644 index 000000000..6f18eec83 --- /dev/null +++ b/test/plugin-stripe/payload-types.ts @@ -0,0 +1,139 @@ +/* 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 { + collections: { + users: User; + products: Product; + customers: Customer; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; + user: + | (User & { + collection: 'users'; + }) + | (Customer & { + collection: 'customers'; + }); +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + name?: string | null; + 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` "products". + */ +export interface Product { + id: string; + name?: string | null; + price?: { + stripePriceID?: string | null; + stripeJSON?: string | null; + }; + stripeID?: string | null; + skipSync?: boolean | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "customers". + */ +export interface Customer { + id: string; + name?: string | null; + subscriptions?: + | { + stripeSubscriptionID?: string | null; + stripeProductID?: string | null; + product?: (string | null) | Product; + status?: + | ('active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'trialing' | 'unpaid') + | null; + id?: string | null; + }[] + | null; + stripeID?: string | null; + skipSync?: boolean | null; + updatedAt: string; + createdAt: string; + enableAPIKey?: boolean | null; + apiKey?: string | null; + apiKeyIndex?: string | null; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: + | { + relationTo: 'users'; + value: string | User; + } + | { + relationTo: 'customers'; + value: string | Customer; + }; + 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugin-stripe/tsconfig.json b/test/plugin-stripe/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugin-stripe/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/plugins/payload-types.ts b/test/plugins/payload-types.ts new file mode 100644 index 000000000..e78bd8704 --- /dev/null +++ b/test/plugins/payload-types.ts @@ -0,0 +1,88 @@ +/* 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 { + collections: { + users: User; + pages: Page; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "pages". + */ +export interface Page { + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/plugins/tsconfig.json b/test/plugins/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/plugins/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/relationships/payload-types.ts b/test/relationships/payload-types.ts index ab6fabea8..4a6f6346c 100644 --- a/test/relationships/payload-types.ts +++ b/test/relationships/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,104 +8,235 @@ export interface Config { collections: { - posts: Post - postsLocalized: PostsLocalized - relation: Relation - 'strict-access': StrictAccess - 'chained-relation': ChainedRelation - 'custom-id-relation': CustomIdRelation - 'custom-id-number-relation': CustomIdNumberRelation - screenings: Screening - movies: Movie - directors: Director - users: User - } - globals: {} + posts: Post; + postsLocalized: PostsLocalized; + relation: Relation; + 'strict-access': StrictAccess; + chained: Chained; + 'custom-id': CustomId; + 'custom-id-number': CustomIdNumber; + screenings: Screening; + movies: Movie; + directors: Director; + movieReviews: MovieReview; + 'polymorphic-relationships': PolymorphicRelationship; + tree: Tree; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'de'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ export interface Post { - id: string - title?: string - description?: string - number?: number - relationField?: string | Relation - defaultAccessRelation?: string | StrictAccess - chainedRelation?: string | ChainedRelation - maxDepthRelation?: string | Relation - customIdRelation?: string | CustomIdRelation - customIdNumberRelation?: number | CustomIdNumberRelation - filteredRelation?: string | Relation - updatedAt: string - createdAt: string -} -export interface PostsLocalized { - id: string - title?: string | null - relationField?: (string | null) | Relation - updatedAt: string - createdAt: string + id: string; + title?: string | null; + description?: string | null; + number?: number | null; + relationField?: (string | null) | Relation; + defaultAccessRelation?: (string | null) | StrictAccess; + chainedRelation?: (string | null) | Chained; + maxDepthRelation?: (string | null) | Relation; + customIdRelation?: (string | null) | CustomId; + customIdNumberRelation?: (number | null) | CustomIdNumber; + filteredRelation?: (string | null) | Relation; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation". + */ export interface Relation { - id: string - name?: string - disableRelation: boolean - updatedAt: string - createdAt: string + id: string; + name?: string | null; + disableRelation: boolean; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "strict-access". + */ export interface StrictAccess { - id: string - name?: string - disableRelation: boolean - updatedAt: string - createdAt: string + id: string; + name?: string | null; + disableRelation: boolean; + updatedAt: string; + createdAt: string; } -export interface ChainedRelation { - id: string - name?: string - relation?: string | ChainedRelation - updatedAt: string - createdAt: string +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "chained". + */ +export interface Chained { + id: string; + name?: string | null; + relation?: (string | null) | Chained; + updatedAt: string; + createdAt: string; } -export interface CustomIdRelation { - id: string - name?: string - updatedAt: string - createdAt: string +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-id". + */ +export interface CustomId { + id: string; + name?: string | null; + updatedAt: string; + createdAt: string; } -export interface CustomIdNumberRelation { - id: number - name?: string - updatedAt: string - createdAt: string +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-id-number". + */ +export interface CustomIdNumber { + id: number; + name?: string | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "postsLocalized". + */ +export interface PostsLocalized { + id: string; + title?: string | null; + relationField?: (string | null) | Relation; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "screenings". + */ export interface Screening { - id: string - name?: string - movie?: string | Movie - updatedAt: string - createdAt: string + id: string; + name?: string | null; + movie?: (string | null) | Movie; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "movies". + */ export interface Movie { - id: string - name?: string - director?: string | Director - updatedAt: string - createdAt: string + id: string; + name?: string | null; + director?: (string | null) | Director; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "directors". + */ export interface Director { - id: string - name?: string - movies?: Array - updatedAt: string - createdAt: string + id: string; + name?: string | null; + movies?: (string | Movie)[] | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "movieReviews". + */ +export interface MovieReview { + id: string; + movieReviewer: string | User; + likes?: (string | User)[] | null; + visibility: 'followers' | 'public'; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - password?: string + id: string; + 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` "polymorphic-relationships". + */ +export interface PolymorphicRelationship { + id: string; + polymorphic?: { + relationTo: 'movies'; + value: string | Movie; + } | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "tree". + */ +export interface Tree { + id: string; + text?: string | null; + parent?: (string | null) | Tree; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/relationships/tsconfig.json b/test/relationships/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/relationships/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/storage-azure/payload-types.ts b/test/storage-azure/payload-types.ts new file mode 100644 index 000000000..2f4f90160 --- /dev/null +++ b/test/storage-azure/payload-types.ts @@ -0,0 +1,131 @@ +/* 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 { + collections: { + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ +export interface Media { + id: string; + alt?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + square?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + sixteenByNineMedium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media-with-prefix". + */ +export interface MediaWithPrefix { + id: string; + prefix?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/storage-azure/tsconfig.json b/test/storage-azure/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/storage-azure/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/storage-gcs/payload-types.ts b/test/storage-gcs/payload-types.ts new file mode 100644 index 000000000..2f4f90160 --- /dev/null +++ b/test/storage-gcs/payload-types.ts @@ -0,0 +1,131 @@ +/* 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 { + collections: { + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ +export interface Media { + id: string; + alt?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + square?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + sixteenByNineMedium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media-with-prefix". + */ +export interface MediaWithPrefix { + id: string; + prefix?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/storage-gcs/tsconfig.json b/test/storage-gcs/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/storage-gcs/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/storage-s3/payload-types.ts b/test/storage-s3/payload-types.ts new file mode 100644 index 000000000..2f4f90160 --- /dev/null +++ b/test/storage-s3/payload-types.ts @@ -0,0 +1,131 @@ +/* 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 { + collections: { + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ +export interface Media { + id: string; + alt?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + square?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + sixteenByNineMedium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media-with-prefix". + */ +export interface MediaWithPrefix { + id: string; + prefix?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ +export interface User { + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/storage-s3/tsconfig.json b/test/storage-s3/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/storage-s3/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/storage-uploadthing/tsconfig.json b/test/storage-uploadthing/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/storage-uploadthing/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/storage-vercel-blob/tsconfig.json b/test/storage-vercel-blob/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/storage-vercel-blob/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/uploads/payload-types.ts b/test/uploads/payload-types.ts index 0d0cc8f61..be6c1cafa 100644 --- a/test/uploads/payload-types.ts +++ b/test/uploads/payload-types.ts @@ -8,541 +8,764 @@ export interface Config { collections: { - relation: Relation - audio: Audio - 'gif-resize': GifResize - 'no-image-sizes': NoImageSize - 'crop-only': CropOnly - 'focal-only': FocalOnly - media: Media - enlarge: Enlarge - reduce: Reduce - 'media-trim': MediaTrim - 'unstored-media': UnstoredMedia - 'externally-served-media': ExternallyServedMedia - 'uploads-1': Uploads1 - 'uploads-2': Uploads2 - 'admin-thumbnail': AdminThumbnail - 'optional-file': OptionalFile - 'required-file': RequiredFile - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} + relation: Relation; + audio: Audio; + 'gif-resize': GifResize; + 'no-image-sizes': NoImageSize; + 'object-fit': ObjectFit; + 'crop-only': CropOnly; + 'focal-only': FocalOnly; + media: Media; + enlarge: Enlarge; + reduce: Reduce; + 'media-trim': MediaTrim; + 'unstored-media': UnstoredMedia; + 'externally-served-media': ExternallyServedMedia; + 'uploads-1': Uploads1; + 'uploads-2': Uploads2; + 'admin-thumbnail-function': AdminThumbnailFunction; + 'admin-thumbnail-size': AdminThumbnailSize; + 'optional-file': OptionalFile; + 'required-file': RequiredFile; + versions: Version; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "relation". + */ export interface Relation { - id: string - image?: string | Media - updatedAt: string - createdAt: string + id: string; + image?: string | Media | null; + versionedImage?: string | Version | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media". + */ export interface Media { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { maintainedAspectRatio?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; differentFormatFromMainImage?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; maintainedImageSize?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; maintainedImageSizeWithNewFormat?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; accidentalSameSize?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; tablet?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; mobile?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; icon?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest2?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest3?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest4?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest5?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest6?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest7?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "versions". + */ +export interface Version { + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "audio". + */ export interface Audio { - id: string - audio?: string | Media - updatedAt: string - createdAt: string + id: string; + audio?: string | Media | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "gif-resize". + */ export interface GifResize { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { small?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; large?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "no-image-sizes". + */ export interface NoImageSize { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "object-fit". + */ +export interface ObjectFit { + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + fitContain?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + fitInside?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + fitCover?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + fitOutside?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "crop-only". + */ export interface CropOnly { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { focalTest?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest2?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest3?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "focal-only". + */ export interface FocalOnly { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { focalTest?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest2?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest3?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "enlarge". + */ export interface Enlarge { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { accidentalSameSize?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; sameSizeWithNewFormat?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedLarger?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedSmaller?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; widthLowerHeightLarger?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "reduce". + */ export interface Reduce { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { accidentalSameSize?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; sameSizeWithNewFormat?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedLarger?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedSmaller?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "media-trim". + */ export interface MediaTrim { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; sizes?: { trimNumber?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; trimString?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; trimOptions?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "unstored-media". + */ export interface UnstoredMedia { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "externally-served-media". + */ export interface ExternallyServedMedia { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "uploads-1". + */ export interface Uploads1 { - id: string - media?: string | Uploads2 + id: string; + media?: string | Uploads2 | null; richText?: { - [k: string]: unknown - }[] - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "uploads-2". + */ export interface Uploads2 { - id: string - title?: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } -export interface AdminThumbnail { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "admin-thumbnail-function". + */ +export interface AdminThumbnailFunction { + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "admin-thumbnail-size". + */ +export interface AdminThumbnailSize { + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; + sizes?: { + small?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + medium?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + }; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "optional-file". + */ export interface OptionalFile { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "required-file". + */ export interface RequiredFile { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number + id: string; + updatedAt: string; + createdAt: string; + url?: string | null; + thumbnailURL?: string | null; + filename?: string | null; + mimeType?: string | null; + filesize?: number | null; + width?: number | null; + height?: number | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - updatedAt: string - createdAt: string - email: string - resetPasswordToken?: string - resetPasswordExpiration?: string - salt?: string - hash?: string - loginAttempts?: number - lockUntil?: string - password: string + id: string; + 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` "payload-preferences". + */ export interface PayloadPreference { - id: string + id: string; user: { - relationTo: 'users' - value: string | User - } - key?: string + relationTo: 'users'; + value: string | User; + }; + key?: string | null; value?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "payload-migrations". + */ export interface PayloadMigration { - id: string - name?: string - batch?: number - updatedAt: string - createdAt: string + id: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; } + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/uploads/tsconfig.json b/test/uploads/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/uploads/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +} diff --git a/test/versions/payload-types.ts b/test/versions/payload-types.ts index 2a7c29f38..7f3cdc23b 100644 --- a/test/versions/payload-types.ts +++ b/test/versions/payload-types.ts @@ -1,4 +1,5 @@ /* tslint:disable */ +/* eslint-disable */ /** * This file was automatically generated by Payload. * DO NOT MODIFY IT BY HAND. Instead, modify your source Payload config, @@ -7,59 +8,193 @@ export interface Config { collections: { - 'autosave-posts': AutosavePost - 'draft-posts': DraftPost - 'version-posts': VersionPost - users: User - } + 'disable-publish': DisablePublish; + posts: Post; + 'autosave-posts': AutosavePost; + 'draft-posts': DraftPost; + 'version-posts': VersionPost; + 'custom-ids': CustomId; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - 'autosave-global': AutosaveGlobal - 'draft-global': DraftGlobal - } + 'autosave-global': AutosaveGlobal; + 'draft-global': DraftGlobal; + 'disable-publish-global': DisablePublishGlobal; + }; + locale: 'en' | 'es'; + user: User & { + collection: 'users'; + }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "disable-publish". + */ +export interface DisablePublish { + id: string; + title: string; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "posts". + */ +export interface Post { + id: string; + relationToAutosaves?: (string | null) | AutosavePost; + relationToVersions?: (string | null) | VersionPost; + relationToDrafts?: (string | null) | DraftPost; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "autosave-posts". + */ export interface AutosavePost { - id: string - title: string - description: string - _status?: 'draft' | 'published' - createdAt: string - updatedAt: string -} -export interface DraftPost { - id: string - title: string - description: string - radio?: 'test' - select?: ('test1' | 'test2')[] - _status?: 'draft' | 'published' - createdAt: string - updatedAt: string + id: string; + title: string; + description: string; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "version-posts". + */ export interface VersionPost { - id: string - title: string - description: string - createdAt: string - updatedAt: string + id: string; + title: string; + description: string; + updatedAt: string; + createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "draft-posts". + */ +export interface DraftPost { + id: string; + title: string; + description: string; + radio?: 'test' | null; + select?: ('test1' | 'test2')[] | null; + blocksField?: + | { + text?: string | null; + localized?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block'; + }[] + | null; + relation?: (string | null) | DraftPost; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-ids". + */ +export interface CustomId { + id: string; + title?: string | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "users". + */ export interface User { - id: string - email?: string - resetPasswordToken?: string - resetPasswordExpiration?: string - loginAttempts?: number - lockUntil?: string - createdAt: string - updatedAt: string - password?: string + id: string; + 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` "payload-preferences". + */ +export interface PayloadPreference { + id: string; + user: { + relationTo: 'users'; + value: string | 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: string; + name?: string | null; + batch?: number | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "autosave-global". + */ export interface AutosaveGlobal { - id: string - title: string - _status?: 'draft' | 'published' + id: string; + title: string; + _status?: ('draft' | 'published') | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "draft-global". + */ export interface DraftGlobal { - id: string - title: string - _status?: 'draft' | 'published' + id: string; + title: string; + _status?: ('draft' | 'published') | null; + updatedAt?: string | null; + createdAt?: string | null; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "disable-publish-global". + */ +export interface DisablePublishGlobal { + id: string; + title?: string | null; + _status?: ('draft' | 'published') | null; + updatedAt?: string | null; + createdAt?: string | null; +} + + +declare module 'payload' { + // @ts-ignore + export interface GeneratedTypes extends Config {} +} \ No newline at end of file diff --git a/test/versions/tsconfig.json b/test/versions/tsconfig.json new file mode 100644 index 000000000..48610a17f --- /dev/null +++ b/test/versions/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.json", +}