Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
9.6 KiB
Plaintext
1 line
9.6 KiB
Plaintext
{"version":3,"sources":["../../../src/globals/config/types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { GraphQLNonNull, GraphQLObjectType } from 'graphql'\nimport type { DeepRequired, IsAny } from 'ts-essentials'\n\nimport type {\n CustomPreviewButton,\n CustomSaveButton,\n CustomSaveDraftButton,\n CustomStatus,\n PublishButtonClientProps,\n PublishButtonServerProps,\n UnpublishButtonClientProps,\n UnpublishButtonServerProps,\n} from '../../admin/types.js'\nimport type {\n Access,\n CustomComponent,\n EditConfig,\n Endpoint,\n EntityDescription,\n EntityDescriptionComponent,\n GeneratePreviewURL,\n LabelFunction,\n LivePreviewConfig,\n MetaConfig,\n PayloadComponent,\n StaticLabel,\n} from '../../config/types.js'\nimport type { DBIdentifierName } from '../../database/types.js'\nimport type { Field, FlattenedField } from '../../fields/config/types.js'\nimport type {\n GeneratedTypes,\n GlobalAdminCustom,\n GlobalCustom,\n GlobalSlug,\n RequestContext,\n TypedGlobal,\n TypedGlobalSelect,\n} from '../../index.js'\nimport type { PayloadRequest, SelectIncludeType, Where } from '../../types/index.js'\nimport type { IncomingGlobalVersions, SanitizedGlobalVersions } from '../../versions/types.js'\n\nexport type DataFromGlobalSlug<TSlug extends GlobalSlug> = TypedGlobal[TSlug]\n\nexport type SelectFromGlobalSlug<TSlug extends GlobalSlug> = TypedGlobalSelect[TSlug]\n\n/**\n * Global slugs that do not have drafts enabled.\n * Detects globals without drafts by checking for the absence of the `_status` field.\n */\nexport type GlobalsWithoutDrafts = {\n [TSlug in GlobalSlug]: DataFromGlobalSlug<TSlug> extends { _status?: any } ? never : TSlug\n}[GlobalSlug]\n\n/**\n * Conditionally allows or forbids the `draft` property based on global configuration.\n * When `strictDraftTypes` is enabled, the `draft` property is forbidden on globals without drafts.\n */\nexport type DraftFlagFromGlobalSlug<TSlug extends GlobalSlug> = GeneratedTypes extends {\n strictDraftTypes: true\n}\n ? TSlug extends GlobalsWithoutDrafts\n ? {\n /**\n * The `draft` property is not allowed because this global does not have `versions.drafts` enabled.\n */\n draft?: never\n }\n : {\n /**\n * Whether the global should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n }\n : {\n /**\n * Whether the global should be queried from the versions table/collection or not. [More](https://payloadcms.com/docs/versions/drafts#draft-api)\n */\n draft?: boolean\n }\n\nexport type BeforeValidateHook = (args: {\n context: RequestContext\n data?: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n originalDoc?: any\n /**\n * Whether access control is being overridden for this operation\n */\n overrideAccess?: boolean\n req: PayloadRequest\n}) => any\n\nexport type BeforeChangeHook = (args: {\n context: RequestContext\n data: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n originalDoc?: any\n /**\n * Whether access control is being overridden for this operation\n */\n overrideAccess?: boolean\n req: PayloadRequest\n}) => any\n\nexport type AfterChangeHook = (args: {\n context: RequestContext\n data: any\n doc: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n /**\n * Whether access control is being overridden for this operation\n */\n overrideAccess?: boolean\n previousDoc: any\n req: PayloadRequest\n}) => any\n\nexport type BeforeReadHook = (args: {\n context: RequestContext\n doc: any\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n /**\n * Whether access control is being overridden for this operation\n */\n overrideAccess?: boolean\n req: PayloadRequest\n}) => any\n\nexport type AfterReadHook = (args: {\n context: RequestContext\n doc: any\n findMany?: boolean\n /** The global which this hook is being run on */\n global: SanitizedGlobalConfig\n /**\n * Whether access control is being overridden for this operation\n */\n overrideAccess?: boolean\n query?: Where\n req: PayloadRequest\n}) => any\n\nexport type HookOperationType = 'countVersions' | 'read' | 'restoreVersion' | 'update'\n\nexport type BeforeOperationHook = (args: {\n args?: any\n context: RequestContext\n /**\n * The Global which this hook is being run on\n * */\n global: SanitizedGlobalConfig\n /**\n * Hook operation being performed\n */\n operation: HookOperationType\n /**\n * Whether access control is being overridden for this operation\n */\n overrideAccess?: boolean\n req: PayloadRequest\n}) => any\n\nexport type GlobalAdminOptions = {\n /**\n * Custom admin components\n */\n components?: {\n elements?: {\n /**\n * Inject custom components before the document controls\n */\n beforeDocumentControls?: CustomComponent[]\n Description?: EntityDescriptionComponent\n /**\n * Replaces the \"Preview\" button\n */\n PreviewButton?: CustomPreviewButton\n /**\n * Replaces the \"Publish\" button\n * + drafts must be enabled\n */\n PublishButton?: PayloadComponent<PublishButtonServerProps, PublishButtonClientProps>\n /**\n * Replaces the \"Save\" button\n * + drafts must be disabled\n */\n SaveButton?: CustomSaveButton\n /**\n * Replaces the \"Save Draft\" button\n * + drafts must be enabled\n * + autosave must be disabled\n */\n SaveDraftButton?: CustomSaveDraftButton\n /**\n * Replaces the \"Status\" section\n */\n Status?: CustomStatus\n /**\n * Replaces the \"Unpublish\" button\n * + drafts must be enabled\n */\n UnpublishButton?: PayloadComponent<UnpublishButtonServerProps, UnpublishButtonClientProps>\n }\n views?: {\n /**\n * Set to a React component to replace the entire Edit View, including all nested routes.\n * Set to an object to replace or modify individual nested routes, or to add new ones.\n */\n edit?: EditConfig\n }\n }\n /** Extension point to add your custom data. Available in server and client. */\n custom?: GlobalAdminCustom\n /**\n * Custom description for collection\n */\n description?: EntityDescription\n /**\n * Specify a navigational group for globals in the admin sidebar.\n * - Provide a string to place the entity in a custom group.\n * - Provide a record to define localized group names.\n * - Set to `false` to exclude the entity from the sidebar / dashboard without disabling its routes.\n */\n group?: false | Record<string, string> | string\n /**\n * Exclude the global from the admin nav and routes\n */\n hidden?: ((args: { user: PayloadRequest['user'] }) => boolean) | boolean\n /**\n * Hide the API URL within the Edit View\n */\n hideAPIURL?: boolean\n /**\n * Live preview options\n */\n livePreview?: LivePreviewConfig\n meta?: MetaConfig\n /**\n * Function to generate custom preview URL\n */\n preview?: GeneratePreviewURL\n}\n\nexport type GlobalConfig<TSlug extends GlobalSlug = any> = {\n /**\n * Do not set this property manually. This is set to true during sanitization, to avoid\n * sanitizing the same global multiple times.\n */\n _sanitized?: boolean\n access?: {\n read?: Access\n readVersions?: Access\n update?: Access\n }\n admin?: GlobalAdminOptions\n /** Extension point to add your custom data. Server only. */\n custom?: GlobalCustom\n /**\n * Customize the SQL table name\n */\n dbName?: DBIdentifierName\n endpoints?: false | Omit<Endpoint, 'root'>[]\n fields: Field[]\n /**\n * Specify which fields should be selected always, regardless of the `select` query which can be useful that the field exists for access control / hooks\n */\n forceSelect?: IsAny<SelectFromGlobalSlug<TSlug>> extends true\n ? SelectIncludeType\n : SelectFromGlobalSlug<TSlug>\n graphQL?:\n | {\n disableMutations?: true\n disableQueries?: true\n name?: string\n }\n | false\n hooks?: {\n afterChange?: AfterChangeHook[]\n afterRead?: AfterReadHook[]\n beforeChange?: BeforeChangeHook[]\n beforeOperation?: BeforeOperationHook[]\n beforeRead?: BeforeReadHook[]\n beforeValidate?: BeforeValidateHook[]\n }\n label?: LabelFunction | StaticLabel\n /**\n * Enables / Disables the ability to lock documents while editing\n * @default true\n */\n lockDocuments?:\n | {\n duration: number\n }\n | false\n slug: string\n /**\n * Options used in typescript generation\n */\n typescript?: {\n /**\n * Typescript generation name given to the interface type\n */\n interface?: string\n }\n versions?: boolean | IncomingGlobalVersions\n}\n\nexport interface SanitizedGlobalConfig\n extends Omit<DeepRequired<GlobalConfig>, 'endpoints' | 'fields' | 'slug' | 'versions'> {\n endpoints: Endpoint[] | false\n fields: Field[]\n /**\n * Fields in the database schema structure\n * Rows / collapsible / tabs w/o name `fields` merged to top, UIs are excluded\n */\n flattenedFields: FlattenedField[]\n slug: GlobalSlug\n versions?: SanitizedGlobalVersions\n}\n\nexport type Globals = {\n config: SanitizedGlobalConfig[]\n graphQL?:\n | {\n [slug: string]: {\n mutationInputType: GraphQLNonNull<any>\n type: GraphQLObjectType\n versionType?: GraphQLObjectType\n }\n }\n | false\n}\n"],"names":[],"mappings":"AAAA,qDAAqD,GAqUrD,WAWC"} |