From e5d5126d14da584168e42e4b3e3019b7806e65a0 Mon Sep 17 00:00:00 2001 From: Alessio Gravili Date: Thu, 11 Jul 2024 15:59:38 -0400 Subject: [PATCH] chore: regenerate all types in test dir, and add to eslint & prettier ignores --- test/.prettierignore | 1 + test/_community/payload-types.ts | 188 ++- test/access-control/payload-types.ts | 385 +++-- test/admin/payload-types.ts | 371 +++-- test/array-update/payload-types.ts | 118 +- test/auth/payload-types.ts | 226 +-- test/collections-graphql/payload-types.ts | 288 ++-- test/collections-rest/payload-types.ts | 210 +-- test/config/payload-types.ts | 126 +- test/custom-graphql/payload-types.ts | 94 +- test/database/payload-types.ts | 266 ++-- test/dataloader/payload-types.ts | 169 +- test/email-nodemailer/payload-types.ts | 94 +- test/email-resend/payload-types.ts | 94 +- test/email/payload-types.ts | 188 ++- test/endpoints/payload-types.ts | 132 +- test/eslint.config.js | 5 +- test/field-error-states/payload-types.ts | 435 +++--- test/field-perf/payload-types.ts | 152 +- test/fields-relationship/payload-types.ts | 300 ++-- test/globals/payload-types.ts | 156 +- test/graphql-schema-gen/payload-types.ts | 168 +- test/helpers/initPayloadInt.ts | 2 +- test/hooks/payload-types.ts | 244 +-- test/i18n/payload-types.ts | 112 +- test/live-preview/payload-types.ts | 944 ++++++------ test/localization-rtl/payload-types.ts | 130 +- test/localization/payload-types.ts | 314 ++-- test/migrations-cli/payload-types.ts | 94 +- test/nested-fields/payload-types.ts | 180 ++- test/plugin-cloud-storage/payload-types.ts | 180 ++- test/plugin-cloud/payload-types.ts | 152 +- test/plugin-form-builder/payload-types.ts | 380 ++--- test/plugin-nested-docs/payload-types.ts | 146 +- test/plugin-redirects/payload-types.ts | 131 +- .../payload-types.ts | 174 ++- test/plugin-search/payload-types.ts | 146 +- test/plugin-sentry/payload-types.ts | 104 +- test/plugin-seo/payload-types.ts | 200 +-- test/plugin-stripe/payload-types.ts | 194 ++- test/plugins/payload-types.ts | 104 +- test/relationships/payload-types.ts | 266 ++-- test/storage-azure/payload-types.ts | 180 ++- test/storage-gcs/payload-types.ts | 180 ++- test/storage-s3/payload-types.ts | 180 ++- test/uploads/payload-types.ts | 1354 +++++++++-------- test/versions/payload-types.ts | 268 ++-- 47 files changed, 5872 insertions(+), 4653 deletions(-) diff --git a/test/.prettierignore b/test/.prettierignore index 247f3f12de..6ffb8d3435 100644 --- a/test/.prettierignore +++ b/test/.prettierignore @@ -8,3 +8,4 @@ **/dist/** **/node_modules **/temp +**/payload-types.ts diff --git a/test/_community/payload-types.ts b/test/_community/payload-types.ts index 9262f07234..a36155c548 100644 --- a/test/_community/payload-types.ts +++ b/test/_community/payload-types.ts @@ -8,147 +8,171 @@ export interface Config { auth: { - users: UserAuthOperations - } + users: UserAuthOperations; + }; collections: { - posts: Post - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + posts: Post; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - menu: Menu - 'custom-ts': CustomT - } - locale: null + menu: Menu; + 'custom-ts': CustomT; + }; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; } export interface UserAuthOperations { forgotPassword: { - email: string - } + email: string; + }; login: { - password: string - email: string - } + password: string; + email: string; + }; registerFirstUser: { - email: string - password: string - } + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - text?: string | null + id: string; + text?: string | 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 + 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 + 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 + 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 | 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` "menu". */ export interface Menu { - id: string - globalText?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + globalText?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-ts". + */ +export interface CustomT { + id: string; + custom?: 'hello' | 'world'; + withDefinitionsUsage?: ObjectWithNumber[]; + json: { + id: string; + name: string; + age?: number; + }[]; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "objectWithNumber". + */ +export interface ObjectWithNumber { + id?: number; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "auth". */ export interface Auth { - [k: string]: unknown + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/access-control/payload-types.ts b/test/access-control/payload-types.ts index 3721957017..374996b14c 100644 --- a/test/access-control/payload-types.ts +++ b/test/access-control/payload-types.ts @@ -7,326 +7,387 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + 'non-admin-user': NonAdminUserAuthOperations; + }; collections: { - users: User - 'non-admin-user': NonAdminUser - posts: Post - unrestricted: Unrestricted - 'fully-restricted': FullyRestricted - 'read-only-collection': ReadOnlyCollection - 'user-restricted-collection': UserRestrictedCollection - 'create-not-update-collection': CreateNotUpdateCollection - '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 - } + users: User; + 'non-admin-user': NonAdminUser; + posts: Post; + unrestricted: Unrestricted; + 'fully-restricted': FullyRestricted; + 'read-only-collection': ReadOnlyCollection; + 'user-restricted-collection': UserRestrictedCollection; + 'create-not-update-collection': CreateNotUpdateCollection; + '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; + disabled: Disabled; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - settings: Setting - test: Test - 'read-only-global': ReadOnlyGlobal - 'user-restricted-global': UserRestrictedGlobal - 'read-not-update-global': ReadNotUpdateGlobal - } - locale: null + settings: Setting; + test: Test; + 'read-only-global': ReadOnlyGlobal; + 'user-restricted-global': UserRestrictedGlobal; + 'read-not-update-global': ReadNotUpdateGlobal; + }; + locale: null; user: | (User & { - collection: 'users' + collection: 'users'; }) | (NonAdminUser & { - collection: 'non-admin-user' - }) + collection: 'non-admin-user'; + }); +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; +} +export interface NonAdminUserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 + 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 | UserRestrictedCollection)[] | null - createNotUpdateDocs?: (string | CreateNotUpdateCollection)[] | null - updatedAt: string - createdAt: string + id: string; + name?: string | null; + userRestrictedDocs?: (string | UserRestrictedCollection)[] | null; + createNotUpdateDocs?: (string | CreateNotUpdateCollection)[] | null; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "user-restricted-collection". */ export interface UserRestrictedCollection { - 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` "create-not-update-collection". */ export interface CreateNotUpdateCollection { - 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` "fully-restricted". */ export interface FullyRestricted { - 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 + id: string; + title: string; + hidden?: boolean | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "disabled". + */ +export interface Disabled { + id: string; + group?: { + text?: string | null; + }; + namedTab?: { + text?: string | null; + }; + unnamedTab?: string | null; + array?: + | { + text?: string | null; + id?: string | null; + }[] + | 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: 'non-admin-user' - value: string | NonAdminUser - } - key?: string | null + 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 + 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 + 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 + id: string; + name?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "user-restricted-global". */ export interface UserRestrictedGlobal { - id: string - name?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + name?: string | null; + updatedAt?: string | null; + createdAt?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "read-not-update-global". */ export interface ReadNotUpdateGlobal { - id: string - name?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + name?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/admin/payload-types.ts b/test/admin/payload-types.ts index 429da3a71f..d846d1db67 100644 --- a/test/admin/payload-types.ts +++ b/test/admin/payload-types.ts @@ -7,338 +7,373 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 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 - } + uploads: Upload; + posts: Post; + users: User; + 'hidden-collection': HiddenCollection; + 'collection-no-api-view': CollectionNoApiView; + 'custom-views-one': CustomViewsOne; + 'custom-views-two': CustomViewsTwo; + 'custom-fields': CustomField; + '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 - } - locale: 'es' | 'en' + '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' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 - customCell?: string | null - sidebarField?: string | null - descriptionAsString?: string | null - descriptionAsFunction?: string | null - descriptionAsComponent?: 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` "custom-fields". + */ +export interface CustomField { + id: string; + customSelectField?: 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 + 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 + 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 + 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/array-update/payload-types.ts b/test/array-update/payload-types.ts index aa36c09848..1462daa025 100644 --- a/test/array-update/payload-types.ts +++ b/test/array-update/payload-types.ts @@ -7,94 +7,118 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - arrays: Array - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + arrays: Array; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "arrays". */ export interface Array { - id: string + id: string; arrayOfFields?: | { - required: string - optional?: string | null + required: string; + optional?: string | null; innerArrayOfFields?: | { - required: string - optional?: string | null - id?: string | null + required: string; + optional?: string | null; + id?: string | null; }[] - | null - id?: string | null + | 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` "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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/auth/payload-types.ts b/test/auth/payload-types.ts index 18981b6909..8d88b4a421 100644 --- a/test/auth/payload-types.ts +++ b/test/auth/payload-types.ts @@ -7,154 +7,206 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + 'api-keys': ApiKeyAuthOperations; + 'public-users': PublicUserAuthOperations; + }; collections: { - users: User - 'api-keys': ApiKey - 'public-users': PublicUser - relationsCollection: RelationsCollection - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + 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' - }) + collection: 'public-users'; + }); +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; +} +export interface ApiKeyAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; +} +export interface PublicUserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/collections-graphql/payload-types.ts b/test/collections-graphql/payload-types.ts index 8c28e4f48c..367d13e34a 100644 --- a/test/collections-graphql/payload-types.ts +++ b/test/collections-graphql/payload-types.ts @@ -7,255 +7,279 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; 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 - media: Media - '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; + media: Media; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "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 - media?: string | Media | null - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + id: string; + title?: string | null; + relationToSelf?: (string | null) | CyclicalRelationship; + media?: 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 - 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/collections-rest/payload-types.ts b/test/collections-rest/payload-types.ts index d4204b6b99..a01d916cbf 100644 --- a/test/collections-rest/payload-types.ts +++ b/test/collections-rest/payload-types.ts @@ -7,188 +7,212 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 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 + 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' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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 - fakeLocalization?: string | null - relationField?: (string | null) | Relation - relationHasManyField?: (string | Relation)[] | null + id: string; + title?: string | null; + description?: string | null; + number?: number | null; + fakeLocalization?: string | null; + relationField?: (string | null) | Relation; + 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 - restrictedField?: string | null + | null; + restrictedField?: 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` "dummy". */ export interface Dummy { - id: string - title?: string | null - name?: string | null - 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] | 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` "custom-id". */ export interface CustomId { - 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-id-number". */ export interface CustomIdNumber { - id: number - name?: string | null - 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 | null - errorBeforeChange?: boolean | null - errorAfterDelete?: boolean | null - 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 | 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/config/payload-types.ts b/test/config/payload-types.ts index 30badc8868..ef8747ebcf 100644 --- a/test/config/payload-types.ts +++ b/test/config/payload-types.ts @@ -7,102 +7,126 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; 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 - } - locale: null + 'my-global': MyGlobal; + }; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/custom-graphql/payload-types.ts b/test/custom-graphql/payload-types.ts index 8862edb5bc..342be88cd5 100644 --- a/test/custom-graphql/payload-types.ts +++ b/test/custom-graphql/payload-types.ts @@ -7,70 +7,94 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/database/payload-types.ts b/test/database/payload-types.ts index 63e1356ced..1efc7be53f 100644 --- a/test/database/payload-types.ts +++ b/test/database/payload-types.ts @@ -7,215 +7,239 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - posts: Post - 'relation-a': RelationA - 'relation-b': RelationB - 'pg-migrations': PgMigration - 'custom-schema': CustomSchema - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + posts: Post; + 'relation-a': RelationA; + 'relation-b': RelationB; + 'pg-migrations': PgMigration; + 'custom-schema': CustomSchema; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - global: Global - } - locale: 'en' | 'es' + global: Global; + }; + locale: 'en' | 'es'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - title: string - throwAfterChange?: boolean | null - 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 - title?: string | null - relationship?: (string | null) | RelationB + id: string; + title?: string | null; + relationship?: (string | null) | RelationB; 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 + 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 - title?: string | null - relationship?: (string | null) | RelationA + id: string; + title?: string | null; + relationship?: (string | null) | RelationA; 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 + 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` "pg-migrations". */ export interface PgMigration { - id: string - relation1?: (string | null) | RelationA + id: string; + relation1?: (string | null) | RelationA; myArray?: | { - relation2?: (string | null) | RelationB + relation2?: (string | null) | RelationB; mySubArray?: | { - relation3?: (string | null) | RelationB - id?: string | null + relation3?: (string | null) | RelationB; + id?: string | null; }[] - | null - id?: string | null + | null; + id?: string | null; }[] - | null + | null; myGroup?: { - relation4?: (string | null) | RelationB - } + relation4?: (string | null) | RelationB; + }; myBlocks?: | { - relation5?: (string | null) | RelationA - relation6?: (string | null) | RelationB - id?: string | null - blockName?: string | null - blockType: 'myBlock' + relation5?: (string | null) | RelationA; + relation6?: (string | null) | RelationB; + id?: string | null; + blockName?: string | null; + blockType: 'myBlock'; }[] - | null - updatedAt: string - createdAt: string + | 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 + id: string; + text?: string | null; + localizedText?: string | null; + relationship?: (string | RelationA)[] | null; + select?: ('a' | 'b' | 'c')[] | null; + radio?: ('a' | 'b' | 'c') | null; array?: | { - text?: string | null - localizedText?: string | null - id?: string | null + text?: string | null; + localizedText?: string | null; + id?: string | null; }[] - | null + | null; blocks?: | { - text?: string | null - localizedText?: string | null - id?: string | null - blockName?: string | null - blockType: 'block' + text?: string | null; + localizedText?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block'; }[] - | 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` "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 + id: string; + text?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/dataloader/payload-types.ts b/test/dataloader/payload-types.ts index 0389753e47..1b7ba3199c 100644 --- a/test/dataloader/payload-types.ts +++ b/test/dataloader/payload-types.ts @@ -7,114 +7,173 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - posts: Post - 'relation-a': RelationA - 'relation-b': RelationB - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + posts: Post; + 'relation-a': RelationA; + 'relation-b': RelationB; + shops: Shop; + items: Item; + itemTags: ItemTag; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - title: string - owner?: (string | null) | User - updatedAt: string - createdAt: 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 - 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` "relation-a". */ export interface RelationA { - id: string - relationship?: (string | null) | RelationB + id: string; + relationship?: (string | null) | RelationB; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - updatedAt: string - createdAt: string + | 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 + id: string; + relationship?: (string | null) | RelationA; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - updatedAt: string - createdAt: string + | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "shops". + */ +export interface Shop { + id: string; + name?: string | null; + items?: (string | Item)[] | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "items". + */ +export interface Item { + id: string; + name?: string | null; + itemTags?: (string | ItemTag)[] | null; + updatedAt: string; + createdAt: string; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "itemTags". + */ +export interface ItemTag { + id: string; + name?: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/email-nodemailer/payload-types.ts b/test/email-nodemailer/payload-types.ts index 8862edb5bc..342be88cd5 100644 --- a/test/email-nodemailer/payload-types.ts +++ b/test/email-nodemailer/payload-types.ts @@ -7,70 +7,94 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/email-resend/payload-types.ts b/test/email-resend/payload-types.ts index 8862edb5bc..342be88cd5 100644 --- a/test/email-resend/payload-types.ts +++ b/test/email-resend/payload-types.ts @@ -7,70 +7,94 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/email/payload-types.ts b/test/email/payload-types.ts index 1f68c24506..1bcc87f495 100644 --- a/test/email/payload-types.ts +++ b/test/email/payload-types.ts @@ -7,140 +7,164 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - posts: Post - media: Media - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + posts: Post; + media: Media; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - menu: Menu - } - locale: null + menu: Menu; + }; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - text?: string | null - associatedMedia?: string | Media | null - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { thumbnail?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } + 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 - } - } + 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 + 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` "menu". */ export interface Menu { - id: string - globalText?: string | null - updatedAt?: string | null - createdAt?: string | null + id: string; + globalText?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/endpoints/payload-types.ts b/test/endpoints/payload-types.ts index 66b7cc3bf0..2e45bce09d 100644 --- a/test/endpoints/payload-types.ts +++ b/test/endpoints/payload-types.ts @@ -7,114 +7,138 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - endpoints: Endpoint - 'no-endpoints': NoEndpoint - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + endpoints: Endpoint; + 'no-endpoints': NoEndpoint; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - 'global-endpoints': GlobalEndpoint - 'global-no-endpoints': GlobalNoEndpoint - } - locale: null + 'global-endpoints': GlobalEndpoint; + 'global-no-endpoints': GlobalNoEndpoint; + }; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "endpoints". */ export interface Endpoint { - 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` "no-endpoints". */ export interface NoEndpoint { - 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; } /** * 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 + 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 + id: string; + name?: string | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/eslint.config.js b/test/eslint.config.js index 2e903f6c19..11879f4d15 100644 --- a/test/eslint.config.js +++ b/test/eslint.config.js @@ -1,4 +1,4 @@ -import { rootEslintConfig, rootParserOptions } from '../eslint.config.js' +import { defaultESLintIgnores, rootEslintConfig, rootParserOptions } from '../eslint.config.js' import payloadPlugin from '@payloadcms/eslint-plugin' import playwright from 'eslint-plugin-playwright' @@ -8,6 +8,9 @@ let FlatConfig /** @type {FlatConfig[]} */ export const testEslintConfig = [ ...rootEslintConfig, + { + ignores: [...defaultESLintIgnores, '**/payload-types.ts'], + }, { languageOptions: { parserOptions: { diff --git a/test/field-error-states/payload-types.ts b/test/field-error-states/payload-types.ts index d1c941b59c..f28635dd99 100644 --- a/test/field-error-states/payload-types.ts +++ b/test/field-error-states/payload-types.ts @@ -7,329 +7,368 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 'error-fields': ErrorField - uploads: Upload - 'validate-drafts-on': ValidateDraftsOn - 'validate-drafts-off': ValidateDraftsOff - 'validate-drafts-on-autosave': ValidateDraftsOnAutosave - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + 'error-fields': ErrorField; + uploads: Upload; + 'validate-drafts-on': ValidateDraftsOn; + 'validate-drafts-off': ValidateDraftsOff; + 'validate-drafts-on-autosave': ValidateDraftsOnAutosave; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: { + 'global-validate-drafts-on': GlobalValidateDraftsOn; + }; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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: { 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 - } - select: 'mint' | 'dark_gray' - upload: string | Upload - text: string - textarea: string - 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; + }; + 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: { 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 - } - select: 'mint' | 'dark_gray' - upload: string | Upload - text: string - textarea: string - 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; + }; + 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: { 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 - } - select: 'mint' | 'dark_gray' - upload: string | Upload - text: string - textarea: string - 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; + }; + 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 + 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 - focalX?: number | null - focalY?: 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "validate-drafts-on". */ export interface ValidateDraftsOn { - id: string - title: string - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + id: string; + title: string; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "validate-drafts-off". */ export interface ValidateDraftsOff { - id: string - title: string - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + id: string; + title: string; + updatedAt: string; + createdAt: string; + _status?: ('draft' | 'published') | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "validate-drafts-on-autosave". */ export interface ValidateDraftsOnAutosave { - id: string - title: string - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + id: string; + title: string; + 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "global-validate-drafts-on". + */ +export interface GlobalValidateDraftsOn { + id: string; + group: { + title: string; + }; + _status?: ('draft' | 'published') | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/field-perf/payload-types.ts b/test/field-perf/payload-types.ts index 69308d9beb..a3754023df 100644 --- a/test/field-perf/payload-types.ts +++ b/test/field-perf/payload-types.ts @@ -7,111 +7,135 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 'blocks-collection': BlocksCollection - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + 'blocks-collection': BlocksCollection; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "blocks-collection". */ export interface BlocksCollection { - id: string + id: string; layout?: | { 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 - 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' + 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 + | 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @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 76e40d5446..36f974b234 100644 --- a/test/fields-relationship/payload-types.ts +++ b/test/fields-relationship/payload-types.ts @@ -7,288 +7,312 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - '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 - videos: Video - podcasts: Podcast - 'mixed-media': MixedMedia - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + '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; + videos: Video; + podcasts: Podcast; + 'mixed-media': MixedMedia; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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-filter-false' - value: string | RelationFilterFalse + relationTo: 'relation-filter-false'; + value: string | RelationFilterFalse; } | { - relationTo: 'relation-filter-true' - value: string | RelationFilterTrue + relationTo: 'relation-filter-true'; + value: string | RelationFilterTrue; } | { - relationTo: 'relation-one' - value: string | RelationOne + 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 + 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 + 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` "videos". */ export interface Video { - 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` "podcasts". */ export interface Podcast { - 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` "mixed-media". */ export interface MixedMedia { - id: string + id: string; relatedMedia?: | ( | { - relationTo: 'videos' - value: number | Video + relationTo: 'videos'; + value: number | Video; } | { - relationTo: 'podcasts' - value: number | Podcast + relationTo: 'podcasts'; + value: number | Podcast; } )[] - | 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/globals/payload-types.ts b/test/globals/payload-types.ts index f2bdd9954f..0283c6b19b 100644 --- a/test/globals/payload-types.ts +++ b/test/globals/payload-types.ts @@ -7,143 +7,167 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + 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' + global: Global; + array: Array; + 'default-value': DefaultValue; + 'access-control': AccessControl; + 'without-graphql': WithoutGraphql; + }; + locale: 'en' | 'es'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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 + id: string; json?: | { - [k: string]: unknown + [k: string]: unknown; } | unknown[] | string | number | boolean - | null - title?: string | null - updatedAt?: string | null - createdAt?: string | null + | 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 + 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; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "default-value". */ export interface DefaultValue { - id: string - text?: string | null + id: string; + text?: string | null; group?: { - text?: string | null - } - updatedAt?: string | null - createdAt?: string | null + 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 + 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 + id: string; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/graphql-schema-gen/payload-types.ts b/test/graphql-schema-gen/payload-types.ts index 200e98ffe4..1a6d687801 100644 --- a/test/graphql-schema-gen/payload-types.ts +++ b/test/graphql-schema-gen/payload-types.ts @@ -12,147 +12,171 @@ */ export type SharedMetaArray = | { - title?: string | null - description?: string | null - id?: string | null + title?: string | null; + description?: string | null; + id?: string | null; }[] - | null + | null; export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - collection1: Collection1 - collection2: Collection2 - 'no-graphql': NoGraphql - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + collection1: Collection1; + collection2: Collection2; + 'no-graphql': NoGraphql; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 | null - id?: string | null - blockName?: string | null - 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 | null - id?: string | null - blockName?: string | null - 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 - metaArray?: SharedMetaArray - metaGroup?: 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 | null - description?: string | null + 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 + 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/helpers/initPayloadInt.ts b/test/helpers/initPayloadInt.ts index 91528ed19c..696c5039c6 100644 --- a/test/helpers/initPayloadInt.ts +++ b/test/helpers/initPayloadInt.ts @@ -1,4 +1,4 @@ -import type { type Payload, SanitizedConfig } from 'payload' +import type { Payload, SanitizedConfig } from 'payload' import { getPayloadHMR } from '@payloadcms/next/utilities' diff --git a/test/hooks/payload-types.ts b/test/hooks/payload-types.ts index c819c8d47e..993a5880f3 100644 --- a/test/hooks/payload-types.ts +++ b/test/hooks/payload-types.ts @@ -7,213 +7,237 @@ */ export interface Config { + auth: { + 'hooks-users': HooksUserAuthOperations; + }; collections: { - 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 - } + 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 + 'data-hooks-global': DataHooksGlobal; + }; + locale: null; user: HooksUser & { - collection: 'hooks-users' - } + collection: 'hooks-users'; + }; +} +export interface HooksUserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 + 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] | null + transform?: [number, number] | null; /** * @minItems 2 * @maxItems 2 */ - localizedTransform?: [number, number] | null - 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 | 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 + 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 | null + id: string; + text?: string | null; group?: { array?: | { - input?: string | null - afterRead?: string | null - shouldPopulate?: (string | null) | Relation - id?: string | null + input?: string | null; + afterRead?: string | null; + shouldPopulate?: (string | null) | Relation; + id?: string | null; }[] - | null + | null; subGroup?: { - afterRead?: string | null - shouldPopulate?: (string | null) | 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 | 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` "hooks-users". */ export interface HooksUser { - 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 + 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 + 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 + id: string; user: { - relationTo: 'hooks-users' - value: string | HooksUser - } - key?: string | null + relationTo: 'hooks-users'; + value: string | HooksUser; + }; + 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` "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 + 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/i18n/payload-types.ts b/test/i18n/payload-types.ts index 5f9417d7f1..26a1b11d31 100644 --- a/test/i18n/payload-types.ts +++ b/test/i18n/payload-types.ts @@ -7,85 +7,109 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - collection1: Collection1 - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + collection1: Collection1; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "collection1". */ export interface Collection1 { - id: string - fieldDefaultI18nValid?: string | null - fieldDefaultI18nInvalid?: string | null - fieldCustomI18nValidDefault?: string | null - fieldCustomI18nValidCustom?: string | null - fieldCustomI18nInvalid?: string | null - updatedAt: string - createdAt: string + id: string; + fieldDefaultI18nValid?: string | null; + fieldDefaultI18nInvalid?: string | null; + fieldCustomI18nValidDefault?: string | null; + fieldCustomI18nValidCustom?: string | null; + fieldCustomI18nInvalid?: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/live-preview/payload-types.ts b/test/live-preview/payload-types.ts index ddbc266567..2816a31307 100644 --- a/test/live-preview/payload-types.ts +++ b/test/live-preview/payload-types.ts @@ -7,775 +7,799 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - pages: Page - posts: Post - ssr: Ssr - 'ssr-autosave': SsrAutosave - tenants: Tenant - categories: Category - media: Media - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + users: User; + pages: Page; + posts: Post; + ssr: Ssr; + 'ssr-autosave': SsrAutosave; + tenants: Tenant; + categories: Category; + media: Media; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - header: Header - footer: Footer - } - locale: null + header: Header; + footer: Footer; + }; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "pages". */ export interface Page { - id: string - slug: string - tenant?: (string | null) | Tenant - title: string + id: string; + slug: string; + tenant?: (string | null) | Tenant; + title: string; hero: { - type: 'none' | 'highImpact' | 'lowImpact' + type: 'none' | 'highImpact' | 'lowImpact'; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - media?: string | Media | null - } + | null; + media?: string | Media | null; + }; layout?: | ( | { - invertBackground?: boolean | null + invertBackground?: boolean | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; links?: | { link: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'cta' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'cta'; } | { - invertBackground?: boolean | null + invertBackground?: boolean | null; columns?: | { - size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null + size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - enableLink?: boolean | null + | null; + enableLink?: boolean | null; link?: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('default' | 'primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('default' | 'primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - invertBackground?: boolean | null - position?: ('default' | 'fullscreen') | null - media: string | Media - id?: string | null - blockName?: string | null - blockType: 'mediaBlock' + invertBackground?: boolean | null; + position?: ('default' | 'fullscreen') | null; + media: string | Media; + id?: string | null; + blockName?: string | null; + blockType: 'mediaBlock'; } | { introContent?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - populateBy?: ('collection' | 'selection') | null - relationTo?: 'posts' | null - categories?: (string | Category)[] | null - limit?: number | null + | null; + populateBy?: ('collection' | 'selection') | null; + relationTo?: 'posts' | null; + categories?: (string | Category)[] | null; + limit?: number | null; selectedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null + | null; populatedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null - populatedDocsTotal?: number | null - id?: string | null - blockName?: string | null - blockType: 'archive' + | null; + populatedDocsTotal?: number | null; + id?: string | null; + blockName?: string | null; + blockType: 'archive'; } )[] - | null + | null; richTextSlate?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; richTextLexical?: { 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 - relationshipAsUpload?: string | Media | null - relationshipMonoHasOne?: (string | null) | Post - relationshipMonoHasMany?: (string | Post)[] | 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; + relationshipAsUpload?: string | Media | null; + relationshipMonoHasOne?: (string | null) | Post; + relationshipMonoHasMany?: (string | Post)[] | null; relationshipPolyHasOne?: { - relationTo: 'posts' - value: string | Post - } | null + relationTo: 'posts'; + value: string | Post; + } | null; relationshipPolyHasMany?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null + | null; arrayOfRelationships?: | { - uploadInArray?: string | Media | null + uploadInArray?: string | Media | null; richTextInArray?: { 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 - relationshipInArrayMonoHasOne?: (string | null) | Post - relationshipInArrayMonoHasMany?: (string | Post)[] | 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; + relationshipInArrayMonoHasOne?: (string | null) | Post; + relationshipInArrayMonoHasMany?: (string | Post)[] | null; relationshipInArrayPolyHasOne?: { - relationTo: 'posts' - value: string | Post - } | null + relationTo: 'posts'; + value: string | Post; + } | null; relationshipInArrayPolyHasMany?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null - id?: string | null + | null; + id?: string | null; }[] - | null + | null; tab?: { - relationshipInTab?: (string | null) | Post - } + relationshipInTab?: (string | null) | Post; + }; meta?: { - title?: string | null - description?: string | null - image?: string | Media | null - } - updatedAt: string - createdAt: string + title?: string | null; + description?: string | null; + image?: string | Media | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "tenants". */ export interface Tenant { - id: string - title: string - clientURL: string - updatedAt: string - createdAt: string + id: string; + title: string; + clientURL: string; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "media". */ export interface Media { - id: string - alt: 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 - focalX?: number | null - focalY?: number | null + id: string; + alt: 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "posts". */ export interface Post { - id: string - slug: string - tenant?: (string | null) | Tenant - title: string + id: string; + slug: string; + tenant?: (string | null) | Tenant; + title: string; hero: { - type: 'none' | 'highImpact' | 'lowImpact' + type: 'none' | 'highImpact' | 'lowImpact'; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - media?: string | Media | null - } + | null; + media?: string | Media | null; + }; layout?: | ( | { - invertBackground?: boolean | null + invertBackground?: boolean | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; links?: | { link: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'cta' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'cta'; } | { - invertBackground?: boolean | null + invertBackground?: boolean | null; columns?: | { - size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null + size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - enableLink?: boolean | null + | null; + enableLink?: boolean | null; link?: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('default' | 'primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('default' | 'primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - invertBackground?: boolean | null - position?: ('default' | 'fullscreen') | null - media: string | Media - id?: string | null - blockName?: string | null - blockType: 'mediaBlock' + invertBackground?: boolean | null; + position?: ('default' | 'fullscreen') | null; + media: string | Media; + id?: string | null; + blockName?: string | null; + blockType: 'mediaBlock'; } | { introContent?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - populateBy?: ('collection' | 'selection') | null - relationTo?: 'posts' | null - categories?: (string | Category)[] | null - limit?: number | null + | null; + populateBy?: ('collection' | 'selection') | null; + relationTo?: 'posts' | null; + categories?: (string | Category)[] | null; + limit?: number | null; selectedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null + | null; populatedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null - populatedDocsTotal?: number | null - id?: string | null - blockName?: string | null - blockType: 'archive' + | null; + populatedDocsTotal?: number | null; + id?: string | null; + blockName?: string | null; + blockType: 'archive'; } )[] - | null - relatedPosts?: (string | Post)[] | null + | null; + relatedPosts?: (string | Post)[] | null; meta?: { - title?: string | null - description?: string | null - image?: string | Media | null - } - updatedAt: string - createdAt: string + title?: string | null; + description?: string | null; + image?: string | Media | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "categories". */ export interface Category { - 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` "ssr". */ export interface Ssr { - id: string - slug: string - tenant?: (string | null) | Tenant - title: string + id: string; + slug: string; + tenant?: (string | null) | Tenant; + title: string; hero: { - type: 'none' | 'highImpact' | 'lowImpact' + type: 'none' | 'highImpact' | 'lowImpact'; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - media?: string | Media | null - } + | null; + media?: string | Media | null; + }; layout?: | ( | { - invertBackground?: boolean | null + invertBackground?: boolean | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; links?: | { link: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'cta' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'cta'; } | { - invertBackground?: boolean | null + invertBackground?: boolean | null; columns?: | { - size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null + size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - enableLink?: boolean | null + | null; + enableLink?: boolean | null; link?: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('default' | 'primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('default' | 'primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - invertBackground?: boolean | null - position?: ('default' | 'fullscreen') | null - media: string | Media - id?: string | null - blockName?: string | null - blockType: 'mediaBlock' + invertBackground?: boolean | null; + position?: ('default' | 'fullscreen') | null; + media: string | Media; + id?: string | null; + blockName?: string | null; + blockType: 'mediaBlock'; } | { introContent?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - populateBy?: ('collection' | 'selection') | null - relationTo?: 'posts' | null - categories?: (string | Category)[] | null - limit?: number | null + | null; + populateBy?: ('collection' | 'selection') | null; + relationTo?: 'posts' | null; + categories?: (string | Category)[] | null; + limit?: number | null; selectedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null + | null; populatedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null - populatedDocsTotal?: number | null - id?: string | null - blockName?: string | null - blockType: 'archive' + | null; + populatedDocsTotal?: number | null; + id?: string | null; + blockName?: string | null; + blockType: 'archive'; } )[] - | null + | null; meta?: { - title?: string | null - description?: string | null - image?: string | Media | null - } - updatedAt: string - createdAt: string + title?: string | null; + description?: string | null; + image?: string | Media | null; + }; + updatedAt: string; + createdAt: string; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "ssr-autosave". */ export interface SsrAutosave { - id: string - slug: string - tenant?: (string | null) | Tenant - title: string + id: string; + slug: string; + tenant?: (string | null) | Tenant; + title: string; hero: { - type: 'none' | 'highImpact' | 'lowImpact' + type: 'none' | 'highImpact' | 'lowImpact'; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - media?: string | Media | null - } + | null; + media?: string | Media | null; + }; layout?: | ( | { - invertBackground?: boolean | null + invertBackground?: boolean | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null + | null; links?: | { link: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'cta' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'cta'; } | { - invertBackground?: boolean | null + invertBackground?: boolean | null; columns?: | { - size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null + size?: ('oneThird' | 'half' | 'twoThirds' | 'full') | null; richText?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - enableLink?: boolean | null + | null; + enableLink?: boolean | null; link?: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('default' | 'primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('default' | 'primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'content' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'content'; } | { - invertBackground?: boolean | null - position?: ('default' | 'fullscreen') | null - media: string | Media - id?: string | null - blockName?: string | null - blockType: 'mediaBlock' + invertBackground?: boolean | null; + position?: ('default' | 'fullscreen') | null; + media: string | Media; + id?: string | null; + blockName?: string | null; + blockType: 'mediaBlock'; } | { introContent?: | { - [k: string]: unknown + [k: string]: unknown; }[] - | null - populateBy?: ('collection' | 'selection') | null - relationTo?: 'posts' | null - categories?: (string | Category)[] | null - limit?: number | null + | null; + populateBy?: ('collection' | 'selection') | null; + relationTo?: 'posts' | null; + categories?: (string | Category)[] | null; + limit?: number | null; selectedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null + | null; populatedDocs?: | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; }[] - | null - populatedDocsTotal?: number | null - id?: string | null - blockName?: string | null - blockType: 'archive' + | null; + populatedDocsTotal?: number | null; + id?: string | null; + blockName?: string | null; + blockType: 'archive'; } )[] - | null + | null; meta?: { - title?: string | null - description?: string | null - image?: string | Media | null - } - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + title?: string | null; + description?: string | null; + image?: string | Media | null; + }; + 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; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "header". */ export interface Header { - id: string + id: string; navItems?: | { link: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('default' | 'primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('default' | 'primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - updatedAt?: string | null - createdAt?: string | null + | null; + updatedAt?: string | null; + createdAt?: string | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "footer". */ export interface Footer { - id: string + id: string; navItems?: | { link: { - type?: ('reference' | 'custom') | null - newTab?: boolean | null + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; reference?: | ({ - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } | null) | ({ - relationTo: 'pages' - value: string | Page - } | null) - url?: string | null - label: string - appearance?: ('default' | 'primary' | 'secondary') | null - } - id?: string | null + relationTo: 'pages'; + value: string | Page; + } | null); + url?: string | null; + label: string; + appearance?: ('default' | 'primary' | 'secondary') | null; + }; + id?: string | null; }[] - | null - updatedAt?: string | null - createdAt?: string | null + | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/localization-rtl/payload-types.ts b/test/localization-rtl/payload-types.ts index becd642fbc..605ab86c44 100644 --- a/test/localization-rtl/payload-types.ts +++ b/test/localization-rtl/payload-types.ts @@ -7,97 +7,121 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - posts: Post - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'ar' + users: User; + posts: Post; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'ar'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "posts". */ export interface Post { - id: string - title?: string | null - description?: string | null + id: string; + title?: string | null; + description?: string | null; content?: { 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 + 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/localization/payload-types.ts b/test/localization/payload-types.ts index 6706bfe58e..75d92a55fa 100644 --- a/test/localization/payload-types.ts +++ b/test/localization/payload-types.ts @@ -7,291 +7,315 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 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 - } + 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 - } - locale: 'en' | 'es' | 'pt' | 'ar' + 'global-array': GlobalArray; + }; + locale: 'en' | 'es' | 'pt' | 'ar'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - children?: (string | LocalizedPost)[] | null + id: string; + title?: string | null; + description?: string | null; + localizedCheckbox?: boolean | null; + children?: (string | LocalizedPost)[] | null; group?: { - children?: string | null - } - updatedAt: string - createdAt: string + 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 + id: string; blocks?: | { array?: | { - text?: string | null - textNotLocalized?: string | null - id?: string | null + text?: string | null; + textNotLocalized?: string | null; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block'; }[] - | null - updatedAt: string - createdAt: string + | 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 + 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 + 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_first'; } | { - title?: string | null - id?: string | null - blockName?: string | null - blockType: 'block_second' + title?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block_second'; } )[] - | null - updatedAt: string - createdAt: 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` "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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/migrations-cli/payload-types.ts b/test/migrations-cli/payload-types.ts index 8862edb5bc..342be88cd5 100644 --- a/test/migrations-cli/payload-types.ts +++ b/test/migrations-cli/payload-types.ts @@ -7,70 +7,94 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/nested-fields/payload-types.ts b/test/nested-fields/payload-types.ts index 459e0619f7..41b4e8a901 100644 --- a/test/nested-fields/payload-types.ts +++ b/test/nested-fields/payload-types.ts @@ -7,157 +7,181 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 'nested-fields': NestedField - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + 'nested-fields': NestedField; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "nested-fields". */ export interface NestedField { - id: string + id: string; array?: | { group?: { namedTab?: { blocks?: | { - text?: string | null + text?: string | null; blockArray?: | { - arrayText?: string | null - id?: string | null + arrayText?: string | null; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'blockWithFields' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'blockWithFields'; }[] - | null - } - } - id?: string | null + | null; + }; + }; + id?: string | null; }[] - | null + | null; tab1?: { layout?: | ( | { items?: | { - title: string - id?: string | null + title: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-1' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-1'; } | { items?: | { - title2: string - id?: string | null + title2: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-2' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-2'; } )[] - | null - } + | null; + }; blocksWithSimilarConfigs?: | ( | { items?: | { - title: string - id?: string | null + title: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-1' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-1'; } | { items?: | { - title2: string - id?: string | null + title2: string; + id?: string | null; }[] - | null - id?: string | null - blockName?: string | null - blockType: 'block-2' + | null; + id?: string | null; + blockName?: string | null; + blockType: 'block-2'; } )[] - | 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-cloud-storage/payload-types.ts b/test/plugin-cloud-storage/payload-types.ts index 37f31838c7..464ab32005 100644 --- a/test/plugin-cloud-storage/payload-types.ts +++ b/test/plugin-cloud-storage/payload-types.ts @@ -7,128 +7,152 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - media: Media - 'media-with-prefix': MediaWithPrefix - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { square?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-cloud/payload-types.ts b/test/plugin-cloud/payload-types.ts index 1791adef32..1b0a3a9012 100644 --- a/test/plugin-cloud/payload-types.ts +++ b/test/plugin-cloud/payload-types.ts @@ -7,108 +7,132 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - media: Media - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + media: Media; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { square?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-form-builder/payload-types.ts b/test/plugin-form-builder/payload-types.ts index 2338dc6ffd..9e976d94d2 100644 --- a/test/plugin-form-builder/payload-types.ts +++ b/test/plugin-form-builder/payload-types.ts @@ -7,281 +7,305 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - pages: Page - users: User - forms: Form - 'form-submissions': FormSubmission - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' | 'de' + pages: Page; + users: User; + forms: Form; + 'form-submissions': FormSubmission; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - custom?: string | null + | null; + custom?: string | 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-nested-docs/payload-types.ts b/test/plugin-nested-docs/payload-types.ts index db194a3b3d..ebaf945db7 100644 --- a/test/plugin-nested-docs/payload-types.ts +++ b/test/plugin-nested-docs/payload-types.ts @@ -7,114 +7,138 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; 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'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-redirects/payload-types.ts b/test/plugin-redirects/payload-types.ts index f3d1d68119..17062e094f 100644 --- a/test/plugin-redirects/payload-types.ts +++ b/test/plugin-redirects/payload-types.ts @@ -7,102 +7,127 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - pages: Page - redirects: Redirect - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' | 'de' + users: User; + pages: Page; + redirects: Redirect; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "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; + }; + customField?: 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-relationship-object-ids/payload-types.ts b/test/plugin-relationship-object-ids/payload-types.ts index a07d6b0fc3..a78a9846fe 100644 --- a/test/plugin-relationship-object-ids/payload-types.ts +++ b/test/plugin-relationship-object-ids/payload-types.ts @@ -7,145 +7,169 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - uploads: Upload - pages: Page - posts: Post - relations: Relation - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + uploads: Upload; + pages: Page; + posts: Post; + relations: Relation; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "uploads". */ export interface Upload { - 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pages". */ export interface Page { - 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` "posts". */ export interface Post { - 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` "relations". */ export interface Relation { - id: string - hasOne?: (string | null) | Post + id: string; + hasOne?: (string | null) | Post; hasOnePoly?: | ({ - relationTo: 'pages' - value: string | Page + relationTo: 'pages'; + value: string | Page; } | null) | ({ - relationTo: 'posts' - value: string | Post - } | null) - hasMany?: (string | Post)[] | null + relationTo: 'posts'; + value: string | Post; + } | null); + hasMany?: (string | Post)[] | null; hasManyPoly?: | ( | { - relationTo: 'pages' - value: string | Page + relationTo: 'pages'; + value: string | Page; } | { - relationTo: 'posts' - value: string | Post + relationTo: 'posts'; + value: string | Post; } )[] - | null - upload?: string | Upload | null - updatedAt: string - createdAt: string + | null; + upload?: string | Upload | 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-search/payload-types.ts b/test/plugin-search/payload-types.ts index 1b4103effe..ac50a50f2e 100644 --- a/test/plugin-search/payload-types.ts +++ b/test/plugin-search/payload-types.ts @@ -7,118 +7,142 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - pages: Page - posts: Post - search: Search - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' | 'de' + users: User; + pages: Page; + posts: Post; + search: Search; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "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` "posts". */ export interface Post { - 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` "search". */ export interface Search { - id: string - title?: string | null - priority?: number | null + id: string; + title?: string | null; + priority?: number | null; doc: | { - relationTo: 'pages' - value: string | Page + relationTo: 'pages'; + value: string | Page; } | { - relationTo: 'posts' - value: string | Post - } - excerpt?: string | null - updatedAt: string - createdAt: string + 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-sentry/payload-types.ts b/test/plugin-sentry/payload-types.ts index 40d6ee9516..e332f8fd04 100644 --- a/test/plugin-sentry/payload-types.ts +++ b/test/plugin-sentry/payload-types.ts @@ -7,81 +7,105 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - posts: Post - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + posts: Post; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-seo/payload-types.ts b/test/plugin-seo/payload-types.ts index 1f4e9d8776..8ee16f98c7 100644 --- a/test/plugin-seo/payload-types.ts +++ b/test/plugin-seo/payload-types.ts @@ -7,148 +7,172 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - pages: Page - media: Media - pagesWithImportedFields: PagesWithImportedField - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' | 'de' + users: User; + pages: Page; + media: Media; + pagesWithImportedFields: PagesWithImportedField; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "pages". */ export interface Page { - id: string - title: string - excerpt?: string | null - slug: string + 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 + 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 | null + id: string; + media?: string | Media | 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 - focalX?: number | null - focalY?: 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pagesWithImportedFields". */ export interface PagesWithImportedField { - id: string - title: string - excerpt?: string | null - slug: string + id: string; + title: string; + excerpt?: string | null; + slug: string; metaAndSEO?: { - title?: string | null + title?: string | null; innerMeta?: { - description?: string | null - } + description?: string | null; + }; innerMedia?: { - image?: string | Media | null - } - } - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + image?: string | Media | null; + }; + }; + 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; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugin-stripe/payload-types.ts b/test/plugin-stripe/payload-types.ts index ba9e488924..34909904e0 100644 --- a/test/plugin-stripe/payload-types.ts +++ b/test/plugin-stripe/payload-types.ts @@ -7,140 +7,170 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + customers: CustomerAuthOperations; + }; collections: { - users: User - products: Product - customers: Customer - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: 'en' | 'es' | 'de' + users: User; + products: Product; + customers: Customer; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: 'en' | 'es' | 'de'; user: | (User & { - collection: 'users' + collection: 'users'; }) | (Customer & { - collection: 'customers' - }) + collection: 'customers'; + }); +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; +} +export interface CustomerAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 + 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 + id: string; + name?: string | null; price?: { - stripePriceID?: string | null - stripeJSON?: string | null - } - stripeID?: string | null - skipSync?: boolean | null - updatedAt: string - createdAt: string + 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 + id: string; + name?: string | null; subscriptions?: | { - stripeSubscriptionID?: string | null - stripeProductID?: string | null - product?: (string | null) | Product + stripeSubscriptionID?: string | null; + stripeProductID?: string | null; + product?: (string | null) | Product; status?: - | ( - | 'active' - | 'canceled' - | 'incomplete' - | 'incomplete_expired' - | 'past_due' - | 'trialing' - | 'unpaid' - ) - | null - id?: string | null + | ('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 + | 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 + id: string; user: | { - relationTo: 'users' - value: string | User + relationTo: 'users'; + value: string | User; } | { - relationTo: 'customers' - value: string | Customer - } - key?: string | null + relationTo: 'customers'; + value: string | Customer; + }; + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/plugins/payload-types.ts b/test/plugins/payload-types.ts index b1c58d7c1f..88d276bc7d 100644 --- a/test/plugins/payload-types.ts +++ b/test/plugins/payload-types.ts @@ -7,81 +7,105 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - users: User - pages: Page - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + users: User; + pages: Page; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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` "pages". */ export interface Page { - 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` "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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/relationships/payload-types.ts b/test/relationships/payload-types.ts index b9395a7c33..d6ec5c5945 100644 --- a/test/relationships/payload-types.ts +++ b/test/relationships/payload-types.ts @@ -7,235 +7,259 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 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' + 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' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: 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 - 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 + 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 | null - 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 | null - 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` "chained". */ export interface Chained { - id: string - name?: string | null - relation?: (string | null) | Chained - updatedAt: string - createdAt: string + id: string; + name?: string | null; + relation?: (string | null) | Chained; + 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 + 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 | null - 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` "postsLocalized". */ export interface PostsLocalized { - id: string - title?: string | null - relationField?: (string | null) | Relation - updatedAt: string - createdAt: string + 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 | null - movie?: (string | null) | 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 | null - director?: (string | null) | 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 | null - movies?: (string | Movie)[] | null - 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 + 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 | 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` "polymorphic-relationships". */ export interface PolymorphicRelationship { - id: string + id: string; polymorphic?: { - relationTo: 'movies' - value: string | Movie - } | null - updatedAt: string - createdAt: string + 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 + 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/storage-azure/payload-types.ts b/test/storage-azure/payload-types.ts index 37f31838c7..464ab32005 100644 --- a/test/storage-azure/payload-types.ts +++ b/test/storage-azure/payload-types.ts @@ -7,128 +7,152 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - media: Media - 'media-with-prefix': MediaWithPrefix - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { square?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/storage-gcs/payload-types.ts b/test/storage-gcs/payload-types.ts index 37f31838c7..464ab32005 100644 --- a/test/storage-gcs/payload-types.ts +++ b/test/storage-gcs/payload-types.ts @@ -7,128 +7,152 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - media: Media - 'media-with-prefix': MediaWithPrefix - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { square?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/storage-s3/payload-types.ts b/test/storage-s3/payload-types.ts index 37f31838c7..464ab32005 100644 --- a/test/storage-s3/payload-types.ts +++ b/test/storage-s3/payload-types.ts @@ -7,128 +7,152 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - media: Media - 'media-with-prefix': MediaWithPrefix - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } - globals: {} - locale: null + media: Media; + 'media-with-prefix': MediaWithPrefix; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { square?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/uploads/payload-types.ts b/test/uploads/payload-types.ts index fdbbee6253..d7f5a9f434 100644 --- a/test/uploads/payload-types.ts +++ b/test/uploads/payload-types.ts @@ -7,866 +7,916 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - relation: Relation - audio: Audio - 'gif-resize': GifResize - 'no-image-sizes': NoImageSize - 'object-fit': ObjectFit - 'crop-only': CropOnly - 'focal-only': FocalOnly - 'focal-no-sizes': FocalNoSize - 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 + relation: Relation; + audio: Audio; + 'gif-resize': GifResize; + 'no-image-sizes': NoImageSize; + 'object-fit': ObjectFit; + 'crop-only': CropOnly; + 'focal-only': FocalOnly; + 'focal-no-sizes': FocalNoSize; + media: Media; + 'animated-type-media': AnimatedTypeMedia; + 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; + 'custom-upload-field': CustomUploadField; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; + globals: {}; + locale: null; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "relation". */ export interface Relation { - id: string - image?: string | Media | null - versionedImage?: string | Version | null - 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { maintainedAspectRatio?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; differentFormatFromMainImage?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; maintainedImageSize?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; maintainedImageSizeWithNewFormat?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; accidentalSameSize?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; tablet?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; mobile?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; icon?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest2?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest3?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest4?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest5?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest6?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest7?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } - } -} -export interface AnimatedTypeMedia { - id: string - updatedAt: string - createdAt: string - url?: string - filename?: string - mimeType?: string - filesize?: number - width?: number - height?: number - focalX?: number - focalY?: number - sizes?: { - squareSmall?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - undefinedHeight?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - undefinedWidth?: { - url?: string - width?: number - height?: number - mimeType?: string - filesize?: number - filename?: string - } - undefinedAll?: { - 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "audio". */ export interface Audio { - id: string - audio?: string | Media | null - 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { small?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { fitContain?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } + 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 - } + 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 - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { focalTest?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest2?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest3?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { focalTest?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest2?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; focalTest3?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } - } + 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-no-sizes". */ export interface FocalNoSize { - 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "animated-type-media". + */ +export interface AnimatedTypeMedia { + 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; + focalX?: number | null; + focalY?: number | null; + sizes?: { + squareSmall?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + undefinedHeight?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + undefinedWidth?: { + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; + undefinedAll?: { + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { accidentalSameSize?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; sameSizeWithNewFormat?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedLarger?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedSmaller?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; widthLowerHeightLarger?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { accidentalSameSize?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; sameSizeWithNewFormat?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedLarger?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; resizedSmaller?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { trimNumber?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; trimString?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + url?: string | null; + width?: number | null; + height?: number | null; + mimeType?: string | null; + filesize?: number | null; + filename?: string | null; + }; trimOptions?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "uploads-1". */ export interface Uploads1 { - id: string - media?: string | Uploads2 | null + id: string; + media?: string | Uploads2 | 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 - focalX?: number | null - focalY?: 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; + focalX?: number | null; + focalY?: number | null; } /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "uploads-2". */ export interface Uploads2 { - 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; } /** * 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; sizes?: { small?: { - url?: string | null - width?: number | null - height?: number | null - mimeType?: string | null - filesize?: number | null - filename?: string | null - } + 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 - } - } + 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: 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 | null - thumbnailURL?: string | null - filename?: string | null - mimeType?: string | null - filesize?: number | null - width?: number | null - height?: number | null - focalX?: number | null - focalY?: number | null + 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; + focalX?: number | null; + focalY?: number | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "custom-upload-field". + */ +export interface CustomUploadField { + 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; + focalX?: number | null; + focalY?: 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 + 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` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file diff --git a/test/versions/payload-types.ts b/test/versions/payload-types.ts index 6e24e09b54..0f0262c78f 100644 --- a/test/versions/payload-types.ts +++ b/test/versions/payload-types.ts @@ -7,230 +7,254 @@ */ export interface Config { + auth: { + users: UserAuthOperations; + }; collections: { - 'disable-publish': DisablePublish - posts: Post - 'autosave-posts': AutosavePost - 'draft-posts': DraftPost - 'draft-with-max-posts': DraftWithMaxPost - 'version-posts': VersionPost - 'custom-ids': CustomId - users: User - 'payload-preferences': PayloadPreference - 'payload-migrations': PayloadMigration - } + 'disable-publish': DisablePublish; + posts: Post; + 'autosave-posts': AutosavePost; + 'draft-posts': DraftPost; + 'draft-with-max-posts': DraftWithMaxPost; + 'version-posts': VersionPost; + 'custom-ids': CustomId; + users: User; + 'payload-preferences': PayloadPreference; + 'payload-migrations': PayloadMigration; + }; globals: { - 'autosave-global': AutosaveGlobal - 'draft-global': DraftGlobal - 'draft-with-max-global': DraftWithMaxGlobal - 'disable-publish-global': DisablePublishGlobal - } - locale: 'en' | 'es' + 'autosave-global': AutosaveGlobal; + 'draft-global': DraftGlobal; + 'draft-with-max-global': DraftWithMaxGlobal; + 'disable-publish-global': DisablePublishGlobal; + }; + locale: 'en' | 'es'; user: User & { - collection: 'users' - } + collection: 'users'; + }; +} +export interface UserAuthOperations { + forgotPassword: { + email: string; + }; + login: { + password: string; + email: string; + }; + registerFirstUser: { + email: string; + password: string; + }; } /** * 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 + 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 + 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 - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + 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 - updatedAt: string - createdAt: 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 + 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' + 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 + | 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` "draft-with-max-posts". */ export interface DraftWithMaxPost { - id: string - title: string - description: string - radio?: 'test' | null - select?: ('test1' | 'test2')[] | null + 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' + text?: string | null; + localized?: string | null; + id?: string | null; + blockName?: string | null; + blockType: 'block'; }[] - | null - relation?: (string | null) | DraftWithMaxPost - updatedAt: string - createdAt: string - _status?: ('draft' | 'published') | null + | null; + relation?: (string | null) | DraftWithMaxPost; + 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 + 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 - 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` "autosave-global". */ export interface AutosaveGlobal { - id: string - title: string - _status?: ('draft' | 'published') | null - updatedAt?: string | null - createdAt?: string | null + 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') | null - updatedAt?: string | null - createdAt?: string | null + 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-with-max-global". */ export interface DraftWithMaxGlobal { - id: string - title: string - _status?: ('draft' | 'published') | null - updatedAt?: string | null - createdAt?: string | null + 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 + id: string; + title?: string | null; + _status?: ('draft' | 'published') | null; + updatedAt?: string | null; + createdAt?: string | null; +} +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "auth". + */ +export interface Auth { + [k: string]: unknown; } + declare module 'payload' { - // @ts-ignore + // @ts-ignore export interface GeneratedTypes extends Config {} -} +} \ No newline at end of file