payload 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/forgotPassword.js +1 -1
- package/dist/auth/operations/forgotPassword.js.map +1 -1
- package/dist/auth/types.d.ts +6 -0
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js +0 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/exports/shared.d.ts +1 -1
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +1 -1
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js +1 -8
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/types.d.ts +10 -0
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js +6 -0
- package/dist/fields/config/types.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utilities/fieldSchemaToJSON.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ExecutionResult, GraphQLSchema, ValidationRule } from 'graphql'\nimport type { Request as graphQLRequest, OperationArgs } from 'graphql-http'\nimport type { Logger } from 'pino'\nimport type { NonNever } from 'ts-essentials'\n\nimport { spawn } from 'child_process'\nimport crypto from 'crypto'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\nimport WebSocket from 'ws'\n\nimport type { AuthArgs } from './auth/operations/auth.js'\nimport type { Result as ForgotPasswordResult } from './auth/operations/forgotPassword.js'\nimport type { Options as ForgotPasswordOptions } from './auth/operations/local/forgotPassword.js'\nimport type { Options as LoginOptions } from './auth/operations/local/login.js'\nimport type { Options as ResetPasswordOptions } from './auth/operations/local/resetPassword.js'\nimport type { Options as UnlockOptions } from './auth/operations/local/unlock.js'\nimport type { Options as VerifyEmailOptions } from './auth/operations/local/verifyEmail.js'\nimport type { Result as LoginResult } from './auth/operations/login.js'\nimport type { Result as ResetPasswordResult } from './auth/operations/resetPassword.js'\nimport type { AuthStrategy, User } from './auth/types.js'\nimport type {\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n SelectFromCollectionSlug,\n TypeWithID,\n} from './collections/config/types.js'\nimport type { Options as CountOptions } from './collections/operations/local/count.js'\nimport type { Options as CreateOptions } from './collections/operations/local/create.js'\nimport type {\n ByIDOptions as DeleteByIDOptions,\n ManyOptions as DeleteManyOptions,\n Options as DeleteOptions,\n} from './collections/operations/local/delete.js'\nimport type { Options as DuplicateOptions } from './collections/operations/local/duplicate.js'\nimport type { Options as FindOptions } from './collections/operations/local/find.js'\nimport type { Options as FindByIDOptions } from './collections/operations/local/findByID.js'\nimport type { Options as FindVersionByIDOptions } from './collections/operations/local/findVersionByID.js'\nimport type { Options as FindVersionsOptions } from './collections/operations/local/findVersions.js'\nimport type { Options as RestoreVersionOptions } from './collections/operations/local/restoreVersion.js'\nimport type {\n ByIDOptions as UpdateByIDOptions,\n ManyOptions as UpdateManyOptions,\n Options as UpdateOptions,\n} from './collections/operations/local/update.js'\nimport type { InitOptions, SanitizedConfig } from './config/types.js'\nimport type { BaseDatabaseAdapter, PaginatedDocs } from './database/types.js'\nimport type { InitializedEmailAdapter } from './email/types.js'\nimport type { DataFromGlobalSlug, Globals, SelectFromGlobalSlug } from './globals/config/types.js'\nimport type { CountGlobalVersionsOptions } from './globals/operations/local/countGlobalVersions.js'\nimport type { Options as FindGlobalOptions } from './globals/operations/local/findOne.js'\nimport type { Options as FindGlobalVersionByIDOptions } from './globals/operations/local/findVersionByID.js'\nimport type { Options as FindGlobalVersionsOptions } from './globals/operations/local/findVersions.js'\nimport type { Options as RestoreGlobalVersionOptions } from './globals/operations/local/restoreVersion.js'\nimport type { Options as UpdateGlobalOptions } from './globals/operations/local/update.js'\nimport type {\n ApplyDisableErrors,\n JsonObject,\n SelectType,\n TransformCollectionWithSelect,\n TransformGlobalWithSelect,\n} from './types/index.js'\nimport type { TraverseFieldsCallback } from './utilities/traverseFields.js'\nimport type { TypeWithVersion } from './versions/types.js'\n\nimport { decrypt, encrypt } from './auth/crypto.js'\nimport { APIKeyAuthentication } from './auth/strategies/apiKey.js'\nimport { JWTAuthentication } from './auth/strategies/jwt.js'\nimport { generateImportMap, type ImportMap } from './bin/generateImportMap/index.js'\nimport { checkPayloadDependencies } from './checkPayloadDependencies.js'\nimport localOperations from './collections/operations/local/index.js'\nimport { consoleEmailAdapter } from './email/consoleEmailAdapter.js'\nimport { fieldAffectsData } from './fields/config/types.js'\nimport localGlobalOperations from './globals/operations/local/index.js'\nimport { getJobsLocalAPI } from './queues/localAPI.js'\nimport { getLogger } from './utilities/logger.js'\nimport { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js'\nimport { traverseFields } from './utilities/traverseFields.js'\n\nexport type { FieldState } from './admin/forms/Form.js'\nexport type * from './admin/types.js'\n\nexport interface GeneratedTypes {\n authUntyped: {\n [slug: string]: {\n forgotPassword: {\n email: string\n }\n login: {\n email: string\n password: string\n }\n registerFirstUser: {\n email: string\n password: string\n }\n unlock: {\n email: string\n }\n }\n }\n\n collectionsJoinsUntyped: {\n [slug: string]: {\n [schemaPath: string]: CollectionSlug\n }\n }\n collectionsSelectUntyped: {\n [slug: string]: SelectType\n }\n\n collectionsUntyped: {\n [slug: string]: JsonObject & TypeWithID\n }\n dbUntyped: {\n defaultIDType: number | string\n }\n globalsSelectUntyped: {\n [slug: string]: SelectType\n }\n\n globalsUntyped: {\n [slug: string]: JsonObject\n }\n jobsUntyped: {\n tasks: {\n [slug: string]: {\n input?: JsonObject\n output?: JsonObject\n }\n }\n workflows: {\n [slug: string]: {\n input: JsonObject\n }\n }\n }\n localeUntyped: null | string\n userUntyped: User\n}\n\n// Helper type to resolve the correct type using conditional types\ntype ResolveCollectionType<T> = 'collections' extends keyof T\n ? T['collections']\n : // @ts-expect-error\n T['collectionsUntyped']\n\ntype ResolveCollectionSelectType<T> = 'collectionsSelect' extends keyof T\n ? T['collectionsSelect']\n : // @ts-expect-error\n T['collectionsSelectUntyped']\n\ntype ResolveCollectionJoinsType<T> = 'collectionsJoins' extends keyof T\n ? T['collectionsJoins']\n : // @ts-expect-error\n T['collectionsJoinsUntyped']\n\ntype ResolveGlobalType<T> = 'globals' extends keyof T\n ? T['globals']\n : // @ts-expect-error\n T['globalsUntyped']\n\ntype ResolveGlobalSelectType<T> = 'globalsSelect' extends keyof T\n ? T['globalsSelect']\n : // @ts-expect-error\n T['globalsSelectUntyped']\n\n// Applying helper types to GeneratedTypes\nexport type TypedCollection = ResolveCollectionType<GeneratedTypes>\n\nexport type TypedUploadCollection = NonNever<{\n [K in keyof TypedCollection]:\n | 'filename'\n | 'filesize'\n | 'mimeType'\n | 'url' extends keyof TypedCollection[K]\n ? TypedCollection[K]\n : never\n}>\n\nexport type TypedCollectionSelect = ResolveCollectionSelectType<GeneratedTypes>\n\nexport type TypedCollectionJoins = ResolveCollectionJoinsType<GeneratedTypes>\n\nexport type TypedGlobal = ResolveGlobalType<GeneratedTypes>\n\nexport type TypedGlobalSelect = ResolveGlobalSelectType<GeneratedTypes>\n\n// Extract string keys from the type\nexport type StringKeyOf<T> = Extract<keyof T, string>\n\n// Define the types for slugs using the appropriate collections and globals\nexport type CollectionSlug = StringKeyOf<TypedCollection>\n\nexport type UploadCollectionSlug = StringKeyOf<TypedUploadCollection>\n\ntype ResolveDbType<T> = 'db' extends keyof T\n ? T['db']\n : // @ts-expect-error\n T['dbUntyped']\n\nexport type DefaultDocumentIDType = ResolveDbType<GeneratedTypes>['defaultIDType']\nexport type GlobalSlug = StringKeyOf<TypedGlobal>\n\n// now for locale and user\n\n// @ts-expect-error\ntype ResolveLocaleType<T> = 'locale' extends keyof T ? T['locale'] : T['localeUntyped']\n// @ts-expect-error\ntype ResolveUserType<T> = 'user' extends keyof T ? T['user'] : T['userUntyped']\n\nexport type TypedLocale = ResolveLocaleType<GeneratedTypes>\nexport type TypedUser = ResolveUserType<GeneratedTypes>\n\n// @ts-expect-error\ntype ResolveAuthOperationsType<T> = 'auth' extends keyof T ? T['auth'] : T['authUntyped']\nexport type TypedAuthOperations = ResolveAuthOperationsType<GeneratedTypes>\n\n// @ts-expect-error\ntype ResolveJobOperationsType<T> = 'jobs' extends keyof T ? T['jobs'] : T['jobsUntyped']\nexport type TypedJobs = ResolveJobOperationsType<GeneratedTypes>\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nlet checkedDependencies = false\n\n/**\n * @description Payload\n */\nexport class BasePayload {\n /**\n * @description Authorization and Authentication using headers and cookies to run auth user strategies\n * @returns permissions: Permissions\n * @returns user: User\n */\n auth = async (options: AuthArgs) => {\n const { auth } = localOperations.auth\n return auth(this, options)\n }\n\n authStrategies: AuthStrategy[]\n\n collections: Record<CollectionSlug, Collection> = {}\n\n config: SanitizedConfig\n /**\n * @description Performs count operation\n * @param options\n * @returns count of documents satisfying query\n */\n count = async <T extends CollectionSlug>(\n options: CountOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { count } = localOperations\n return count(this, options)\n }\n\n /**\n * @description Performs countGlobalVersions operation\n * @param options\n * @returns count of global document versions satisfying query\n */\n countGlobalVersions = async <T extends GlobalSlug>(\n options: CountGlobalVersionsOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { countGlobalVersions } = localGlobalOperations\n return countGlobalVersions(this, options)\n }\n\n /**\n * @description Performs countVersions operation\n * @param options\n * @returns count of document versions satisfying query\n */\n countVersions = async <T extends CollectionSlug>(\n options: CountOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { countVersions } = localOperations\n return countVersions(this, options)\n }\n\n /**\n * @description Performs create operation\n * @param options\n * @returns created document\n */\n create = async <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: CreateOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n const { create } = localOperations\n return create<TSlug, TSelect>(this, options)\n }\n\n db: DatabaseAdapter\n decrypt = decrypt\n\n duplicate = async <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DuplicateOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n const { duplicate } = localOperations\n return duplicate<TSlug, TSelect>(this, options)\n }\n\n email: InitializedEmailAdapter\n\n encrypt = encrypt\n\n // TODO: re-implement or remove?\n // errorHandler: ErrorHandler\n\n extensions: (args: {\n args: OperationArgs<any>\n req: graphQLRequest<unknown, unknown>\n result: ExecutionResult\n }) => Promise<any>\n\n /**\n * @description Find documents with criteria\n * @param options\n * @returns documents satisfying query\n */\n find = async <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: FindOptions<TSlug, TSelect>,\n ): Promise<PaginatedDocs<TransformCollectionWithSelect<TSlug, TSelect>>> => {\n const { find } = localOperations\n return find<TSlug, TSelect>(this, options)\n }\n\n /**\n * @description Find document by ID\n * @param options\n * @returns document with specified ID\n */\n findByID = async <\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n >(\n options: FindByIDOptions<TSlug, TDisableErrors, TSelect>,\n ): Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>> => {\n const { findByID } = localOperations\n return findByID<TSlug, TDisableErrors, TSelect>(this, options)\n }\n\n findGlobal = async <TSlug extends GlobalSlug, TSelect extends SelectFromGlobalSlug<TSlug>>(\n options: FindGlobalOptions<TSlug, TSelect>,\n ): Promise<TransformGlobalWithSelect<TSlug, TSelect>> => {\n const { findOne } = localGlobalOperations\n return findOne<TSlug, TSelect>(this, options)\n }\n\n /**\n * @description Find global version by ID\n * @param options\n * @returns global version with specified ID\n */\n findGlobalVersionByID = async <TSlug extends GlobalSlug>(\n options: FindGlobalVersionByIDOptions<TSlug>,\n ): Promise<TypeWithVersion<DataFromGlobalSlug<TSlug>>> => {\n const { findVersionByID } = localGlobalOperations\n return findVersionByID<TSlug>(this, options)\n }\n\n /**\n * @description Find global versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findGlobalVersions = async <TSlug extends GlobalSlug>(\n options: FindGlobalVersionsOptions<TSlug>,\n ): Promise<PaginatedDocs<TypeWithVersion<DataFromGlobalSlug<TSlug>>>> => {\n const { findVersions } = localGlobalOperations\n return findVersions<TSlug>(this, options)\n }\n\n /**\n * @description Find version by ID\n * @param options\n * @returns version with specified ID\n */\n findVersionByID = async <TSlug extends CollectionSlug>(\n options: FindVersionByIDOptions<TSlug>,\n ): Promise<TypeWithVersion<DataFromCollectionSlug<TSlug>>> => {\n const { findVersionByID } = localOperations\n return findVersionByID<TSlug>(this, options)\n }\n\n /**\n * @description Find versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findVersions = async <TSlug extends CollectionSlug>(\n options: FindVersionsOptions<TSlug>,\n ): Promise<PaginatedDocs<TypeWithVersion<DataFromCollectionSlug<TSlug>>>> => {\n const { findVersions } = localOperations\n return findVersions<TSlug>(this, options)\n }\n\n forgotPassword = async <TSlug extends CollectionSlug>(\n options: ForgotPasswordOptions<TSlug>,\n ): Promise<ForgotPasswordResult> => {\n const { forgotPassword } = localOperations.auth\n return forgotPassword<TSlug>(this, options)\n }\n\n getAdminURL = (): string => `${this.config.serverURL}${this.config.routes.admin}`\n\n getAPIURL = (): string => `${this.config.serverURL}${this.config.routes.api}`\n\n globals: Globals\n\n importMap: ImportMap\n\n jobs = getJobsLocalAPI(this)\n\n logger: Logger\n\n login = async <TSlug extends CollectionSlug>(\n options: LoginOptions<TSlug>,\n ): Promise<{ user: DataFromCollectionSlug<TSlug> } & LoginResult> => {\n const { login } = localOperations.auth\n return login<TSlug>(this, options)\n }\n\n resetPassword = async <TSlug extends CollectionSlug>(\n options: ResetPasswordOptions<TSlug>,\n ): Promise<ResetPasswordResult> => {\n const { resetPassword } = localOperations.auth\n return resetPassword<TSlug>(this, options)\n }\n\n /**\n * @description Restore global version by ID\n * @param options\n * @returns version with specified ID\n */\n restoreGlobalVersion = async <TSlug extends GlobalSlug>(\n options: RestoreGlobalVersionOptions<TSlug>,\n ): Promise<DataFromGlobalSlug<TSlug>> => {\n const { restoreVersion } = localGlobalOperations\n return restoreVersion<TSlug>(this, options)\n }\n\n /**\n * @description Restore version by ID\n * @param options\n * @returns version with specified ID\n */\n restoreVersion = async <TSlug extends CollectionSlug>(\n options: RestoreVersionOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { restoreVersion } = localOperations\n return restoreVersion<TSlug>(this, options)\n }\n\n schema: GraphQLSchema\n\n secret: string\n\n sendEmail: InitializedEmailAdapter['sendEmail']\n\n types: {\n arrayTypes: any\n blockInputTypes: any\n blockTypes: any\n fallbackLocaleInputType?: any\n groupTypes: any\n localeInputType?: any\n tabTypes: any\n }\n\n unlock = async <TSlug extends CollectionSlug>(\n options: UnlockOptions<TSlug>,\n ): Promise<boolean> => {\n const { unlock } = localOperations.auth\n return unlock<TSlug>(this, options)\n }\n\n updateGlobal = async <TSlug extends GlobalSlug, TSelect extends SelectFromGlobalSlug<TSlug>>(\n options: UpdateGlobalOptions<TSlug, TSelect>,\n ): Promise<TransformGlobalWithSelect<TSlug, TSelect>> => {\n const { update } = localGlobalOperations\n return update<TSlug, TSelect>(this, options)\n }\n\n validationRules: (args: OperationArgs<any>) => ValidationRule[]\n\n verifyEmail = async <TSlug extends CollectionSlug>(\n options: VerifyEmailOptions<TSlug>,\n ): Promise<boolean> => {\n const { verifyEmail } = localOperations.auth\n return verifyEmail(this, options)\n }\n\n versions: {\n [slug: string]: any // TODO: Type this\n } = {}\n\n async bin({\n args,\n cwd,\n log,\n }: {\n args: string[]\n cwd?: string\n log?: boolean\n }): Promise<{ code: number }> {\n return new Promise((resolve, reject) => {\n const spawned = spawn('node', [path.resolve(dirname, '../bin.js'), ...args], {\n cwd,\n stdio: log || log === undefined ? 'inherit' : 'ignore',\n })\n\n spawned.on('exit', (code) => {\n resolve({ code })\n })\n\n spawned.on('error', (error) => {\n reject(error)\n })\n })\n }\n\n /**\n * @description delete one or more documents\n * @param options\n * @returns Updated document(s)\n */\n delete<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DeleteByIDOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\n\n delete<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DeleteManyOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect>>\n\n delete<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DeleteOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const { deleteLocal } = localOperations\n return deleteLocal<TSlug, TSelect>(this, options)\n }\n\n /**\n * @description Initializes Payload\n * @param options\n */\n async init(options: InitOptions): Promise<Payload> {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n void checkPayloadDependencies()\n }\n\n this.importMap = options.importMap\n\n if (!options?.config) {\n throw new Error('Error: the payload config is required to initialize payload.')\n }\n\n this.config = await options.config\n this.logger = getLogger('payload', this.config.logger)\n\n if (!this.config.secret) {\n throw new Error('Error: missing secret key. A secret key is needed to secure Payload.')\n }\n\n this.secret = crypto.createHash('sha256').update(this.config.secret).digest('hex').slice(0, 32)\n\n this.globals = {\n config: this.config.globals,\n }\n\n this.config.collections.forEach((collection) => {\n let customIDType = undefined\n const findCustomID: TraverseFieldsCallback = ({ field, next }) => {\n if (\n ['array', 'blocks', 'group'].includes(field.type) ||\n (field.type === 'tab' && 'name' in field)\n ) {\n return true\n }\n\n if (!fieldAffectsData(field)) {\n return\n }\n if (field.name === 'id') {\n customIDType = field.type\n return true\n }\n }\n\n traverseFields({ callback: findCustomID, fields: collection.fields })\n\n this.collections[collection.slug] = {\n config: collection,\n customIDType,\n }\n })\n\n // Generate types on startup\n if (process.env.NODE_ENV !== 'production' && this.config.typescript.autoGenerate !== false) {\n // We cannot run it directly here, as generate-types imports json-schema-to-typescript, which breaks on turbopack.\n // see: https://github.com/vercel/next.js/issues/66723\n void this.bin({\n args: ['generate:types'],\n log: false,\n })\n }\n\n this.db = this.config.db.init({ payload: this })\n this.db.payload = this\n\n if (this.db?.init) {\n await this.db.init()\n }\n\n if (!options.disableDBConnect && this.db.connect) {\n await this.db.connect()\n }\n\n // Load email adapter\n if (this.config.email instanceof Promise) {\n const awaitedAdapter = await this.config.email\n this.email = awaitedAdapter({ payload: this })\n } else if (this.config.email) {\n this.email = this.config.email({ payload: this })\n } else {\n if (process.env.NEXT_PHASE !== 'phase-production-build') {\n this.logger.warn(\n `No email adapter provided. Email will be written to console. More info at https://payloadcms.com/docs/email/overview.`,\n )\n }\n\n this.email = consoleEmailAdapter({ payload: this })\n }\n\n // Warn if image resizing is enabled but sharp is not installed\n if (\n !this.config.sharp &&\n this.config.collections.some((c) => c.upload.imageSizes || c.upload.formatOptions)\n ) {\n this.logger.warn(\n `Image resizing is enabled for one or more collections, but sharp not installed. Please install 'sharp' and pass into the config.`,\n )\n }\n\n this.sendEmail = this.email['sendEmail']\n\n serverInitTelemetry(this)\n\n // 1. loop over collections, if collection has auth strategy, initialize and push to array\n let jwtStrategyEnabled = false\n this.authStrategies = this.config.collections.reduce((authStrategies, collection) => {\n if (collection?.auth) {\n if (collection.auth.strategies.length > 0) {\n authStrategies.push(...collection.auth.strategies)\n }\n\n // 2. if api key enabled, push api key strategy into the array\n if (collection.auth?.useAPIKey) {\n authStrategies.push({\n name: `${collection.slug}-api-key`,\n authenticate: APIKeyAuthentication(collection),\n })\n }\n\n // 3. if localStrategy flag is true\n if (!collection.auth.disableLocalStrategy && !jwtStrategyEnabled) {\n jwtStrategyEnabled = true\n }\n }\n\n return authStrategies\n }, [] as AuthStrategy[])\n\n // 4. if enabled, push jwt strategy into authStrategies last\n if (jwtStrategyEnabled) {\n this.authStrategies.push({\n name: 'local-jwt',\n authenticate: JWTAuthentication,\n })\n }\n\n if (!options.disableOnInit) {\n if (typeof options.onInit === 'function') {\n await options.onInit(this)\n }\n if (typeof this.config.onInit === 'function') {\n await this.config.onInit(this)\n }\n }\n\n return this\n }\n\n update<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: UpdateManyOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect>>\n\n /**\n * @description Update one or more documents\n * @param options\n * @returns Updated document(s)\n */\n update<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: UpdateByIDOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\n\n update<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: UpdateOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const { update } = localOperations\n return update<TSlug, TSelect>(this, options)\n }\n}\n\nconst initialized = new BasePayload()\n\nexport default initialized\n\nlet cached: {\n payload: null | Payload\n promise: null | Promise<Payload>\n reload: boolean | Promise<void>\n ws: null | WebSocket\n} = global._payload\n\nif (!cached) {\n cached = global._payload = { payload: null, promise: null, reload: false, ws: null }\n}\n\nexport const reload = async (\n config: SanitizedConfig,\n payload: Payload,\n skipImportMapGeneration?: boolean,\n): Promise<void> => {\n if (typeof payload.db.destroy === 'function') {\n await payload.db.destroy()\n }\n\n payload.config = config\n\n payload.collections = config.collections.reduce((collections, collection) => {\n collections[collection.slug] = {\n config: collection,\n customIDType: payload.collections[collection.slug]?.customIDType,\n }\n return collections\n }, {})\n\n payload.globals = {\n config: config.globals,\n }\n\n // TODO: support HMR for other props in the future (see payload/src/index init()) that may change on Payload singleton\n\n // Generate types\n if (config.typescript.autoGenerate !== false) {\n // We cannot run it directly here, as generate-types imports json-schema-to-typescript, which breaks on turbopack.\n // see: https://github.com/vercel/next.js/issues/66723\n void payload.bin({\n args: ['generate:types'],\n log: false,\n })\n }\n\n // Generate component map\n if (skipImportMapGeneration !== true && config.admin?.importMap?.autoGenerate !== false) {\n await generateImportMap(config, {\n log: true,\n })\n }\n\n await payload.db.init()\n if (payload.db.connect) {\n await payload.db.connect({ hotReload: true })\n }\n global._payload_clientConfig = null\n global._payload_schemaMap = null\n global._payload_clientSchemaMap = null\n global._payload_doNotCacheClientConfig = true // This will help refreshing the client config cache more reliably. If you remove this, please test HMR + client config refreshing (do new fields appear in the document?)\n global._payload_doNotCacheSchemaMap = true\n global._payload_doNotCacheClientSchemaMap = true\n}\n\nexport const getPayload = async (\n options: Pick<InitOptions, 'config' | 'importMap'>,\n): Promise<Payload> => {\n if (!options?.config) {\n throw new Error('Error: the payload config is required for getPayload to work.')\n }\n\n if (cached.payload) {\n if (cached.reload === true) {\n let resolve: () => void\n\n // getPayload is called multiple times, in parallel. However, we only want to run `await reload` once. By immediately setting cached.reload to a promise,\n // we can ensure that all subsequent calls will wait for the first reload to finish. So if we set it here, the 2nd call of getPayload\n // will reach `if (cached.reload instanceof Promise) {` which then waits for the first reload to finish.\n cached.reload = new Promise((res) => (resolve = res))\n const config = await options.config\n await reload(config, cached.payload)\n\n resolve()\n }\n\n if (cached.reload instanceof Promise) {\n await cached.reload\n }\n\n if (options?.importMap) {\n cached.payload.importMap = options.importMap\n }\n return cached.payload\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (!cached.promise) {\n // no need to await options.config here, as it's already awaited in the BasePayload.init\n cached.promise = new BasePayload().init(options)\n }\n\n try {\n cached.payload = await cached.promise\n\n if (\n !cached.ws &&\n process.env.NODE_ENV !== 'production' &&\n process.env.NODE_ENV !== 'test' &&\n process.env.DISABLE_PAYLOAD_HMR !== 'true'\n ) {\n try {\n const port = process.env.PORT || '3000'\n cached.ws = new WebSocket(\n `ws://localhost:${port}${process.env.NEXT_BASE_PATH ?? ''}/_next/webpack-hmr`,\n )\n\n cached.ws.onmessage = (event) => {\n if (typeof event.data === 'string') {\n const data = JSON.parse(event.data)\n\n if ('action' in data && data.action === 'serverComponentChanges') {\n cached.reload = true\n }\n }\n }\n\n cached.ws.onerror = (_) => {\n // swallow any websocket connection error\n }\n } catch (_) {\n // swallow e\n }\n }\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n if (options?.importMap) {\n cached.payload.importMap = options.importMap\n }\n\n return cached.payload\n}\n\ntype Payload = BasePayload\n\ninterface RequestContext {\n [key: string]: unknown\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DatabaseAdapter extends BaseDatabaseAdapter {}\nexport type { Payload, RequestContext }\nexport { default as executeAccess } from './auth/executeAccess.js'\nexport { executeAuthStrategies } from './auth/executeAuthStrategies.js'\nexport { getAccessResults } from './auth/getAccessResults.js'\nexport { getFieldsToSign } from './auth/getFieldsToSign.js'\nexport * from './auth/index.js'\nexport { accessOperation } from './auth/operations/access.js'\nexport { forgotPasswordOperation } from './auth/operations/forgotPassword.js'\nexport { initOperation } from './auth/operations/init.js'\nexport { loginOperation } from './auth/operations/login.js'\nexport { logoutOperation } from './auth/operations/logout.js'\nexport type { MeOperationResult } from './auth/operations/me.js'\nexport { meOperation } from './auth/operations/me.js'\nexport { refreshOperation } from './auth/operations/refresh.js'\nexport { registerFirstUserOperation } from './auth/operations/registerFirstUser.js'\nexport { resetPasswordOperation } from './auth/operations/resetPassword.js'\nexport { unlockOperation } from './auth/operations/unlock.js'\nexport { verifyEmailOperation } from './auth/operations/verifyEmail.js'\n\nexport type {\n AuthStrategyFunction,\n AuthStrategyFunctionArgs,\n CollectionPermission,\n DocumentPermissions,\n FieldPermissions,\n GlobalPermission,\n IncomingAuthType,\n Permission,\n Permissions,\n SanitizedCollectionPermission,\n SanitizedDocumentPermissions,\n SanitizedFieldPermissions,\n SanitizedGlobalPermission,\n SanitizedPermissions,\n User,\n VerifyConfig,\n} from './auth/types.js'\n\nexport { generateImportMap } from './bin/generateImportMap/index.js'\nexport type { ImportMap } from './bin/generateImportMap/index.js'\n\nexport { genImportMapIterateFields } from './bin/generateImportMap/iterateFields.js'\n\nexport {\n type ClientCollectionConfig,\n createClientCollectionConfig,\n createClientCollectionConfigs,\n type ServerOnlyCollectionAdminProperties,\n type ServerOnlyCollectionProperties,\n type ServerOnlyUploadProperties,\n} from './collections/config/client.js'\n\nexport type {\n AfterChangeHook as CollectionAfterChangeHook,\n AfterDeleteHook as CollectionAfterDeleteHook,\n AfterErrorHook as CollectionAfterErrorHook,\n AfterForgotPasswordHook as CollectionAfterForgotPasswordHook,\n AfterLoginHook as CollectionAfterLoginHook,\n AfterLogoutHook as CollectionAfterLogoutHook,\n AfterMeHook as CollectionAfterMeHook,\n AfterOperationHook as CollectionAfterOperationHook,\n AfterReadHook as CollectionAfterReadHook,\n AfterRefreshHook as CollectionAfterRefreshHook,\n AuthCollection,\n AuthOperationsFromCollectionSlug,\n BaseListFilter,\n BeforeChangeHook as CollectionBeforeChangeHook,\n BeforeDeleteHook as CollectionBeforeDeleteHook,\n BeforeLoginHook as CollectionBeforeLoginHook,\n BeforeOperationHook as CollectionBeforeOperationHook,\n BeforeReadHook as CollectionBeforeReadHook,\n BeforeValidateHook as CollectionBeforeValidateHook,\n BulkOperationResult,\n Collection,\n CollectionAdminOptions,\n CollectionConfig,\n DataFromCollectionSlug,\n HookOperationType,\n MeHook as CollectionMeHook,\n RefreshHook as CollectionRefreshHook,\n RequiredDataFromCollection,\n RequiredDataFromCollectionSlug,\n SanitizedCollectionConfig,\n SanitizedJoins,\n TypeWithID,\n TypeWithTimestamps,\n} from './collections/config/types.js'\nexport { createDataloaderCacheKey, getDataLoader } from './collections/dataloader.js'\nexport { countOperation } from './collections/operations/count.js'\nexport { createOperation } from './collections/operations/create.js'\nexport { deleteOperation } from './collections/operations/delete.js'\nexport { deleteByIDOperation } from './collections/operations/deleteByID.js'\nexport { docAccessOperation } from './collections/operations/docAccess.js'\nexport { duplicateOperation } from './collections/operations/duplicate.js'\nexport { findOperation } from './collections/operations/find.js'\nexport { findByIDOperation } from './collections/operations/findByID.js'\nexport { findVersionByIDOperation } from './collections/operations/findVersionByID.js'\nexport { findVersionsOperation } from './collections/operations/findVersions.js'\nexport { restoreVersionOperation } from './collections/operations/restoreVersion.js'\nexport { updateOperation } from './collections/operations/update.js'\nexport { updateByIDOperation } from './collections/operations/updateByID.js'\nexport { buildConfig } from './config/build.js'\nexport {\n type ClientConfig,\n createClientConfig,\n serverOnlyAdminConfigProperties,\n serverOnlyConfigProperties,\n} from './config/client.js'\n\nexport { defaults } from './config/defaults.js'\nexport { sanitizeConfig } from './config/sanitize.js'\nexport type * from './config/types.js'\nexport { combineQueries } from './database/combineQueries.js'\nexport { createDatabaseAdapter } from './database/createDatabaseAdapter.js'\nexport { defaultBeginTransaction } from './database/defaultBeginTransaction.js'\nexport { default as flattenWhereToOperators } from './database/flattenWhereToOperators.js'\nexport { getLocalizedPaths } from './database/getLocalizedPaths.js'\nexport { createMigration } from './database/migrations/createMigration.js'\nexport { getMigrations } from './database/migrations/getMigrations.js'\nexport { getPredefinedMigration } from './database/migrations/getPredefinedMigration.js'\nexport { migrate } from './database/migrations/migrate.js'\nexport { migrateDown } from './database/migrations/migrateDown.js'\nexport { migrateRefresh } from './database/migrations/migrateRefresh.js'\nexport { migrateReset } from './database/migrations/migrateReset.js'\nexport { migrateStatus } from './database/migrations/migrateStatus.js'\nexport { migrationsCollection } from './database/migrations/migrationsCollection.js'\nexport { migrationTemplate } from './database/migrations/migrationTemplate.js'\nexport { readMigrationFiles } from './database/migrations/readMigrationFiles.js'\nexport { writeMigrationIndex } from './database/migrations/writeMigrationIndex.js'\nexport type * from './database/queryValidation/types.js'\nexport type { EntityPolicies, PathToQuery } from './database/queryValidation/types.js'\nexport { validateQueryPaths } from './database/queryValidation/validateQueryPaths.js'\nexport { validateSearchParam } from './database/queryValidation/validateSearchParams.js'\nexport type {\n BaseDatabaseAdapter,\n BeginTransaction,\n CommitTransaction,\n Connect,\n Count,\n CountArgs,\n CountGlobalVersions,\n CountVersions,\n Create,\n CreateArgs,\n CreateGlobal,\n CreateGlobalArgs,\n CreateGlobalVersion,\n CreateGlobalVersionArgs,\n CreateMigration,\n CreateVersion,\n CreateVersionArgs,\n DatabaseAdapterResult as DatabaseAdapterObj,\n DBIdentifierName,\n DeleteMany,\n DeleteManyArgs,\n DeleteOne,\n DeleteOneArgs,\n DeleteVersions,\n DeleteVersionsArgs,\n Destroy,\n Find,\n FindArgs,\n FindGlobal,\n FindGlobalArgs,\n FindGlobalVersions,\n FindGlobalVersionsArgs,\n FindOne,\n FindOneArgs,\n FindVersions,\n FindVersionsArgs,\n Init,\n Migration,\n MigrationData,\n MigrationTemplateArgs,\n PaginatedDocs,\n QueryDrafts,\n QueryDraftsArgs,\n RollbackTransaction,\n Transaction,\n UpdateGlobal,\n UpdateGlobalArgs,\n UpdateGlobalVersion,\n UpdateGlobalVersionArgs,\n UpdateOne,\n UpdateOneArgs,\n UpdateVersion,\n UpdateVersionArgs,\n Upsert,\n} from './database/types.js'\nexport type { EmailAdapter as PayloadEmailAdapter, SendEmailOptions } from './email/types.js'\nexport {\n APIError,\n APIErrorName,\n AuthenticationError,\n DuplicateCollection,\n DuplicateFieldName,\n DuplicateGlobal,\n ErrorDeletingFile,\n FileRetrievalError,\n FileUploadError,\n Forbidden,\n InvalidConfiguration,\n InvalidFieldName,\n InvalidFieldRelationship,\n Locked,\n LockedAuth,\n MissingCollectionLabel,\n MissingEditorProp,\n MissingFieldInputOptions,\n MissingFieldType,\n MissingFile,\n NotFound,\n QueryError,\n ValidationError,\n ValidationErrorName,\n} from './errors/index.js'\nexport type { ValidationFieldError } from './errors/index.js'\n\nexport { baseBlockFields } from './fields/baseFields/baseBlockFields.js'\nexport { baseIDField } from './fields/baseFields/baseIDField.js'\nexport {\n createClientField,\n createClientFields,\n type ServerOnlyFieldAdminProperties,\n type ServerOnlyFieldProperties,\n} from './fields/config/client.js'\nexport { sanitizeFields } from './fields/config/sanitize.js'\nexport type {\n AdminClient,\n ArrayField,\n ArrayFieldClient,\n BaseValidateOptions,\n Block,\n BlockJSX,\n BlocksField,\n BlocksFieldClient,\n CheckboxField,\n CheckboxFieldClient,\n ClientBlock,\n ClientField,\n ClientFieldProps,\n CodeField,\n CodeFieldClient,\n CollapsibleField,\n CollapsibleFieldClient,\n Condition,\n DateField,\n DateFieldClient,\n EmailField,\n EmailFieldClient,\n Field,\n FieldAccess,\n FieldAffectingData,\n FieldAffectingDataClient,\n FieldBase,\n FieldBaseClient,\n FieldHook,\n FieldHookArgs,\n FieldPresentationalOnly,\n FieldPresentationalOnlyClient,\n FieldTypes,\n FieldWithMany,\n FieldWithManyClient,\n FieldWithMaxDepth,\n FieldWithMaxDepthClient,\n FieldWithPath,\n FieldWithPathClient,\n FieldWithSubFields,\n FieldWithSubFieldsClient,\n FilterOptions,\n FilterOptionsProps,\n FlattenedArrayField,\n FlattenedBlock,\n FlattenedBlocksField,\n FlattenedField,\n FlattenedGroupField,\n FlattenedTabAsField,\n GroupField,\n GroupFieldClient,\n HookName,\n JoinField,\n JoinFieldClient,\n JSONField,\n JSONFieldClient,\n Labels,\n LabelsClient,\n NamedTab,\n NonPresentationalField,\n NonPresentationalFieldClient,\n NumberField,\n NumberFieldClient,\n Option,\n OptionObject,\n PointField,\n PointFieldClient,\n PolymorphicRelationshipField,\n PolymorphicRelationshipFieldClient,\n RadioField,\n RadioFieldClient,\n RelationshipField,\n RelationshipFieldClient,\n RelationshipValue,\n RichTextField,\n RichTextFieldClient,\n RowField,\n RowFieldClient,\n SelectField,\n SelectFieldClient,\n SingleRelationshipField,\n SingleRelationshipFieldClient,\n Tab,\n TabAsField,\n TabAsFieldClient,\n TabsField,\n TabsFieldClient,\n TextareaField,\n TextareaFieldClient,\n TextField,\n TextFieldClient,\n UIField,\n UIFieldClient,\n UnnamedTab,\n UploadField,\n UploadFieldClient,\n Validate,\n ValidateOptions,\n ValueWithRelation,\n} from './fields/config/types.js'\n\nexport { getDefaultValue } from './fields/getDefaultValue.js'\nexport { traverseFields as afterChangeTraverseFields } from './fields/hooks/afterChange/traverseFields.js'\nexport { promise as afterReadPromise } from './fields/hooks/afterRead/promise.js'\nexport { traverseFields as afterReadTraverseFields } from './fields/hooks/afterRead/traverseFields.js'\nexport { traverseFields as beforeChangeTraverseFields } from './fields/hooks/beforeChange/traverseFields.js'\nexport { traverseFields as beforeValidateTraverseFields } from './fields/hooks/beforeValidate/traverseFields.js'\nexport { default as sortableFieldTypes } from './fields/sortableFieldTypes.js'\n\nexport { validations } from './fields/validations.js'\nexport type {\n ArrayFieldValidation,\n BlocksFieldValidation,\n CheckboxFieldValidation,\n CodeFieldValidation,\n ConfirmPasswordFieldValidation,\n DateFieldValidation,\n EmailFieldValidation,\n JSONFieldValidation,\n NumberFieldManyValidation,\n NumberFieldSingleValidation,\n NumberFieldValidation,\n PasswordFieldValidation,\n PointFieldValidation,\n RadioFieldValidation,\n RelationshipFieldManyValidation,\n RelationshipFieldSingleValidation,\n RelationshipFieldValidation,\n RichTextFieldValidation,\n SelectFieldManyValidation,\n SelectFieldSingleValidation,\n SelectFieldValidation,\n TextareaFieldValidation,\n TextFieldManyValidation,\n TextFieldSingleValidation,\n TextFieldValidation,\n UploadFieldManyValidation,\n UploadFieldSingleValidation,\n UploadFieldValidation,\n UsernameFieldValidation,\n} from './fields/validations.js'\n\nexport {\n type ClientGlobalConfig,\n createClientGlobalConfig,\n createClientGlobalConfigs,\n type ServerOnlyGlobalAdminProperties,\n type ServerOnlyGlobalProperties,\n} from './globals/config/client.js'\n\nexport type {\n AfterChangeHook as GlobalAfterChangeHook,\n AfterReadHook as GlobalAfterReadHook,\n BeforeChangeHook as GlobalBeforeChangeHook,\n BeforeReadHook as GlobalBeforeReadHook,\n BeforeValidateHook as GlobalBeforeValidateHook,\n DataFromGlobalSlug,\n GlobalAdminOptions,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './globals/config/types.js'\n\nexport { docAccessOperation as docAccessOperationGlobal } from './globals/operations/docAccess.js'\nexport { findOneOperation } from './globals/operations/findOne.js'\nexport { findVersionByIDOperation as findVersionByIDOperationGlobal } from './globals/operations/findVersionByID.js'\nexport { findVersionsOperation as findVersionsOperationGlobal } from './globals/operations/findVersions.js'\nexport { restoreVersionOperation as restoreVersionOperationGlobal } from './globals/operations/restoreVersion.js'\nexport { updateOperation as updateOperationGlobal } from './globals/operations/update.js'\nexport type {\n CollapsedPreferences,\n DocumentPreferences,\n FieldsPreferences,\n InsideFieldsPreferences,\n PreferenceRequest,\n PreferenceUpdateRequest,\n TabsPreferences,\n} from './preferences/types.js'\nexport type { JobsConfig, RunJobAccess, RunJobAccessArgs } from './queues/config/types/index.js'\nexport type {\n RunTaskFunction,\n TaskConfig,\n TaskHandler,\n TaskHandlerArgs,\n TaskHandlerResult,\n TaskHandlerResults,\n TaskInput,\n TaskOutput,\n TaskType,\n} from './queues/config/types/taskTypes.js'\nexport type {\n BaseJob,\n JobTaskStatus,\n RunningJob,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowHandler,\n WorkflowTypes,\n} from './queues/config/types/workflowTypes.js'\nexport { getLocalI18n } from './translations/getLocalI18n.js'\nexport * from './types/index.js'\nexport { getFileByPath } from './uploads/getFileByPath.js'\nexport type * from './uploads/types.js'\nexport { commitTransaction } from './utilities/commitTransaction.js'\nexport {\n configToJSONSchema,\n entityToJSONSchema,\n fieldsToJSONSchema,\n withNullableJSONSchemaType,\n} from './utilities/configToJSONSchema.js'\nexport { createArrayFromCommaDelineated } from './utilities/createArrayFromCommaDelineated.js'\nexport { createLocalReq } from './utilities/createLocalReq.js'\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n} from './utilities/deepCopyObject.js'\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from './utilities/deepMerge.js'\nexport {\n checkDependencies,\n type CustomVersionParser,\n} from './utilities/dependencies/dependencyChecker.js'\nexport { getDependencies } from './utilities/dependencies/getDependencies.js'\nexport {\n findUp,\n findUpSync,\n pathExistsAndIsAccessible,\n pathExistsAndIsAccessibleSync,\n} from './utilities/findUp.js'\nexport { flattenAllFields } from './utilities/flattenAllFields.js'\nexport { default as flattenTopLevelFields } from './utilities/flattenTopLevelFields.js'\nexport { formatErrors } from './utilities/formatErrors.js'\nexport { formatLabels, formatNames, toWords } from './utilities/formatLabels.js'\nexport { getCollectionIDFieldTypes } from './utilities/getCollectionIDFieldTypes.js'\nexport { getObjectDotNotation } from './utilities/getObjectDotNotation.js'\nexport { initTransaction } from './utilities/initTransaction.js'\nexport { isEntityHidden } from './utilities/isEntityHidden.js'\nexport { default as isolateObjectProperty } from './utilities/isolateObjectProperty.js'\nexport { isPlainObject } from './utilities/isPlainObject.js'\nexport { isValidID } from './utilities/isValidID.js'\nexport { killTransaction } from './utilities/killTransaction.js'\nexport { mapAsync } from './utilities/mapAsync.js'\nexport { sanitizeFallbackLocale } from './utilities/sanitizeFallbackLocale.js'\nexport { traverseFields } from './utilities/traverseFields.js'\nexport type { TraverseFieldsCallback } from './utilities/traverseFields.js'\nexport { buildVersionCollectionFields } from './versions/buildCollectionFields.js'\nexport { buildVersionGlobalFields } from './versions/buildGlobalFields.js'\nexport { versionDefaults } from './versions/defaults.js'\nexport { deleteCollectionVersions } from './versions/deleteCollectionVersions.js'\nexport { enforceMaxVersions } from './versions/enforceMaxVersions.js'\nexport { getLatestCollectionVersion } from './versions/getLatestCollectionVersion.js'\nexport { getLatestGlobalVersion } from './versions/getLatestGlobalVersion.js'\n\nexport { saveVersion } from './versions/saveVersion.js'\nexport type { TypeWithVersion } from './versions/types.js'\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["spawn","crypto","fileURLToPath","path","WebSocket","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","generateImportMap","checkPayloadDependencies","localOperations","consoleEmailAdapter","fieldAffectsData","localGlobalOperations","getJobsLocalAPI","getLogger","serverInit","serverInitTelemetry","traverseFields","filename","url","dirname","checkedDependencies","BasePayload","auth","options","authStrategies","collections","config","count","countGlobalVersions","countVersions","create","db","duplicate","email","extensions","find","findByID","findGlobal","findOne","findGlobalVersionByID","findVersionByID","findGlobalVersions","findVersions","forgotPassword","getAdminURL","serverURL","routes","admin","getAPIURL","api","globals","importMap","jobs","logger","login","resetPassword","restoreGlobalVersion","restoreVersion","schema","secret","sendEmail","types","unlock","updateGlobal","update","validationRules","verifyEmail","versions","bin","args","cwd","log","Promise","resolve","reject","spawned","stdio","undefined","on","code","error","delete","deleteLocal","init","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","Error","createHash","digest","slice","forEach","collection","customIDType","findCustomID","field","next","includes","type","name","callback","fields","slug","typescript","autoGenerate","payload","disableDBConnect","connect","awaitedAdapter","NEXT_PHASE","warn","sharp","some","c","upload","imageSizes","formatOptions","jwtStrategyEnabled","reduce","strategies","length","push","useAPIKey","authenticate","disableLocalStrategy","disableOnInit","onInit","initialized","cached","global","_payload","promise","reload","ws","skipImportMapGeneration","destroy","hotReload","_payload_clientConfig","_payload_schemaMap","_payload_clientSchemaMap","_payload_doNotCacheClientConfig","_payload_doNotCacheSchemaMap","_payload_doNotCacheClientSchemaMap","getPayload","res","DISABLE_PAYLOAD_HMR","port","PORT","NEXT_BASE_PATH","onmessage","event","data","JSON","parse","action","onerror","_","e","default","executeAccess","executeAuthStrategies","getAccessResults","getFieldsToSign","accessOperation","forgotPasswordOperation","initOperation","loginOperation","logoutOperation","meOperation","refreshOperation","registerFirstUserOperation","resetPasswordOperation","unlockOperation","verifyEmailOperation","genImportMapIterateFields","createClientCollectionConfig","createClientCollectionConfigs","createDataloaderCacheKey","getDataLoader","countOperation","createOperation","deleteOperation","deleteByIDOperation","docAccessOperation","duplicateOperation","findOperation","findByIDOperation","findVersionByIDOperation","findVersionsOperation","restoreVersionOperation","updateOperation","updateByIDOperation","buildConfig","createClientConfig","serverOnlyAdminConfigProperties","serverOnlyConfigProperties","defaults","sanitizeConfig","combineQueries","createDatabaseAdapter","defaultBeginTransaction","flattenWhereToOperators","getLocalizedPaths","createMigration","getMigrations","getPredefinedMigration","migrate","migrateDown","migrateRefresh","migrateReset","migrateStatus","migrationsCollection","migrationTemplate","readMigrationFiles","writeMigrationIndex","validateQueryPaths","validateSearchParam","APIError","APIErrorName","AuthenticationError","DuplicateCollection","DuplicateFieldName","DuplicateGlobal","ErrorDeletingFile","FileRetrievalError","FileUploadError","Forbidden","InvalidConfiguration","InvalidFieldName","InvalidFieldRelationship","Locked","LockedAuth","MissingCollectionLabel","MissingEditorProp","MissingFieldInputOptions","MissingFieldType","MissingFile","NotFound","QueryError","ValidationError","ValidationErrorName","baseBlockFields","baseIDField","createClientField","createClientFields","sanitizeFields","getDefaultValue","afterChangeTraverseFields","afterReadPromise","afterReadTraverseFields","beforeChangeTraverseFields","beforeValidateTraverseFields","sortableFieldTypes","validations","createClientGlobalConfig","createClientGlobalConfigs","docAccessOperationGlobal","findOneOperation","findVersionByIDOperationGlobal","findVersionsOperationGlobal","restoreVersionOperationGlobal","updateOperationGlobal","getLocalI18n","getFileByPath","commitTransaction","configToJSONSchema","entityToJSONSchema","fieldsToJSONSchema","withNullableJSONSchemaType","createArrayFromCommaDelineated","createLocalReq","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","checkDependencies","getDependencies","findUp","findUpSync","pathExistsAndIsAccessible","pathExistsAndIsAccessibleSync","flattenAllFields","flattenTopLevelFields","formatErrors","formatLabels","formatNames","toWords","getCollectionIDFieldTypes","getObjectDotNotation","initTransaction","isEntityHidden","isolateObjectProperty","isPlainObject","isValidID","killTransaction","mapAsync","sanitizeFallbackLocale","buildVersionCollectionFields","buildVersionGlobalFields","versionDefaults","deleteCollectionVersions","enforceMaxVersions","getLatestCollectionVersion","getLatestGlobalVersion","saveVersion","deepMergeSimple"],"mappings":"AAKA,SAASA,KAAK,QAAQ,gBAAe;AACrC,OAAOC,YAAY,SAAQ;AAC3B,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC,UAAU,OAAM;AACvB,OAAOC,eAAe,KAAI;AAyD1B,SAASC,OAAO,EAAEC,OAAO,QAAQ,mBAAkB;AACnD,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SAASC,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,iBAAiB,QAAwB,mCAAkC;AACpF,SAASC,wBAAwB,QAAQ,gCAA+B;AACxE,OAAOC,qBAAqB,0CAAyC;AACrE,SAASC,mBAAmB,QAAQ,iCAAgC;AACpE,SAASC,gBAAgB,QAAQ,2BAA0B;AAC3D,OAAOC,2BAA2B,sCAAqC;AACvE,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,cAAcC,mBAAmB,QAAQ,6CAA4C;AAC9F,SAASC,cAAc,QAAQ,gCAA+B;AAiJ9D,MAAMC,WAAWlB,cAAc,YAAYmB,GAAG;AAC9C,MAAMC,UAAUnB,KAAKmB,OAAO,CAACF;AAE7B,IAAIG,sBAAsB;AAE1B;;CAEC,GACD,OAAO,MAAMC;IACX;;;;GAIC,GACDC,OAAO,OAAOC;QACZ,MAAM,EAAED,IAAI,EAAE,GAAGd,gBAAgBc,IAAI;QACrC,OAAOA,KAAK,IAAI,EAAEC;IACpB,EAAC;IAEDC,eAA8B;IAE9BC,cAAkD,CAAC,EAAC;IAEpDC,OAAuB;IACvB;;;;GAIC,GACDC,QAAQ,OACNJ;QAEA,MAAM,EAAEI,KAAK,EAAE,GAAGnB;QAClB,OAAOmB,MAAM,IAAI,EAAEJ;IACrB,EA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C,eAAe,QAAQ,iCAAgC;AAChE,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASvI,WAAWwI,qBAAqB,QAAQ,uCAAsC;AACvF,SAASC,aAAa,QAAQ,+BAA8B;AAC5D,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,QAAQ,QAAQ,0BAAyB;AAClD,SAASC,sBAAsB,QAAQ,wCAAuC;AAC9E,SAAS5R,cAAc,QAAQ,gCAA+B;AAE9D,SAAS6R,4BAA4B,QAAQ,sCAAqC;AAClF,SAASC,wBAAwB,QAAQ,kCAAiC;AAC1E,SAASC,eAAe,QAAQ,yBAAwB;AACxD,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,0BAA0B,QAAQ,2CAA0C;AACrF,SAASC,sBAAsB,QAAQ,uCAAsC;AAE7E,SAASC,WAAW,QAAQ,4BAA2B;AAEvD,SAASC,eAAe,QAAQ,qCAAoC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ExecutionResult, GraphQLSchema, ValidationRule } from 'graphql'\nimport type { Request as graphQLRequest, OperationArgs } from 'graphql-http'\nimport type { Logger } from 'pino'\nimport type { NonNever } from 'ts-essentials'\n\nimport { spawn } from 'child_process'\nimport crypto from 'crypto'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\nimport WebSocket from 'ws'\n\nimport type { AuthArgs } from './auth/operations/auth.js'\nimport type { Result as ForgotPasswordResult } from './auth/operations/forgotPassword.js'\nimport type { Options as ForgotPasswordOptions } from './auth/operations/local/forgotPassword.js'\nimport type { Options as LoginOptions } from './auth/operations/local/login.js'\nimport type { Options as ResetPasswordOptions } from './auth/operations/local/resetPassword.js'\nimport type { Options as UnlockOptions } from './auth/operations/local/unlock.js'\nimport type { Options as VerifyEmailOptions } from './auth/operations/local/verifyEmail.js'\nimport type { Result as LoginResult } from './auth/operations/login.js'\nimport type { Result as ResetPasswordResult } from './auth/operations/resetPassword.js'\nimport type { AuthStrategy, User } from './auth/types.js'\nimport type {\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n SelectFromCollectionSlug,\n TypeWithID,\n} from './collections/config/types.js'\nimport type { Options as CountOptions } from './collections/operations/local/count.js'\nimport type { Options as CreateOptions } from './collections/operations/local/create.js'\nimport type {\n ByIDOptions as DeleteByIDOptions,\n ManyOptions as DeleteManyOptions,\n Options as DeleteOptions,\n} from './collections/operations/local/delete.js'\nimport type { Options as DuplicateOptions } from './collections/operations/local/duplicate.js'\nimport type { Options as FindOptions } from './collections/operations/local/find.js'\nimport type { Options as FindByIDOptions } from './collections/operations/local/findByID.js'\nimport type { Options as FindVersionByIDOptions } from './collections/operations/local/findVersionByID.js'\nimport type { Options as FindVersionsOptions } from './collections/operations/local/findVersions.js'\nimport type { Options as RestoreVersionOptions } from './collections/operations/local/restoreVersion.js'\nimport type {\n ByIDOptions as UpdateByIDOptions,\n ManyOptions as UpdateManyOptions,\n Options as UpdateOptions,\n} from './collections/operations/local/update.js'\nimport type { InitOptions, SanitizedConfig } from './config/types.js'\nimport type { BaseDatabaseAdapter, PaginatedDocs } from './database/types.js'\nimport type { InitializedEmailAdapter } from './email/types.js'\nimport type { DataFromGlobalSlug, Globals, SelectFromGlobalSlug } from './globals/config/types.js'\nimport type { CountGlobalVersionsOptions } from './globals/operations/local/countGlobalVersions.js'\nimport type { Options as FindGlobalOptions } from './globals/operations/local/findOne.js'\nimport type { Options as FindGlobalVersionByIDOptions } from './globals/operations/local/findVersionByID.js'\nimport type { Options as FindGlobalVersionsOptions } from './globals/operations/local/findVersions.js'\nimport type { Options as RestoreGlobalVersionOptions } from './globals/operations/local/restoreVersion.js'\nimport type { Options as UpdateGlobalOptions } from './globals/operations/local/update.js'\nimport type {\n ApplyDisableErrors,\n JsonObject,\n SelectType,\n TransformCollectionWithSelect,\n TransformGlobalWithSelect,\n} from './types/index.js'\nimport type { TraverseFieldsCallback } from './utilities/traverseFields.js'\nimport type { TypeWithVersion } from './versions/types.js'\n\nimport { decrypt, encrypt } from './auth/crypto.js'\nimport { APIKeyAuthentication } from './auth/strategies/apiKey.js'\nimport { JWTAuthentication } from './auth/strategies/jwt.js'\nimport { generateImportMap, type ImportMap } from './bin/generateImportMap/index.js'\nimport { checkPayloadDependencies } from './checkPayloadDependencies.js'\nimport localOperations from './collections/operations/local/index.js'\nimport { consoleEmailAdapter } from './email/consoleEmailAdapter.js'\nimport { fieldAffectsData } from './fields/config/types.js'\nimport localGlobalOperations from './globals/operations/local/index.js'\nimport { getJobsLocalAPI } from './queues/localAPI.js'\nimport { getLogger } from './utilities/logger.js'\nimport { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js'\nimport { traverseFields } from './utilities/traverseFields.js'\n\nexport type { FieldState } from './admin/forms/Form.js'\nexport type * from './admin/types.js'\n\nexport interface GeneratedTypes {\n authUntyped: {\n [slug: string]: {\n forgotPassword: {\n email: string\n }\n login: {\n email: string\n password: string\n }\n registerFirstUser: {\n email: string\n password: string\n }\n unlock: {\n email: string\n }\n }\n }\n\n collectionsJoinsUntyped: {\n [slug: string]: {\n [schemaPath: string]: CollectionSlug\n }\n }\n collectionsSelectUntyped: {\n [slug: string]: SelectType\n }\n\n collectionsUntyped: {\n [slug: string]: JsonObject & TypeWithID\n }\n dbUntyped: {\n defaultIDType: number | string\n }\n globalsSelectUntyped: {\n [slug: string]: SelectType\n }\n\n globalsUntyped: {\n [slug: string]: JsonObject\n }\n jobsUntyped: {\n tasks: {\n [slug: string]: {\n input?: JsonObject\n output?: JsonObject\n }\n }\n workflows: {\n [slug: string]: {\n input: JsonObject\n }\n }\n }\n localeUntyped: null | string\n userUntyped: User\n}\n\n// Helper type to resolve the correct type using conditional types\ntype ResolveCollectionType<T> = 'collections' extends keyof T\n ? T['collections']\n : // @ts-expect-error\n T['collectionsUntyped']\n\ntype ResolveCollectionSelectType<T> = 'collectionsSelect' extends keyof T\n ? T['collectionsSelect']\n : // @ts-expect-error\n T['collectionsSelectUntyped']\n\ntype ResolveCollectionJoinsType<T> = 'collectionsJoins' extends keyof T\n ? T['collectionsJoins']\n : // @ts-expect-error\n T['collectionsJoinsUntyped']\n\ntype ResolveGlobalType<T> = 'globals' extends keyof T\n ? T['globals']\n : // @ts-expect-error\n T['globalsUntyped']\n\ntype ResolveGlobalSelectType<T> = 'globalsSelect' extends keyof T\n ? T['globalsSelect']\n : // @ts-expect-error\n T['globalsSelectUntyped']\n\n// Applying helper types to GeneratedTypes\nexport type TypedCollection = ResolveCollectionType<GeneratedTypes>\n\nexport type TypedUploadCollection = NonNever<{\n [K in keyof TypedCollection]:\n | 'filename'\n | 'filesize'\n | 'mimeType'\n | 'url' extends keyof TypedCollection[K]\n ? TypedCollection[K]\n : never\n}>\n\nexport type TypedCollectionSelect = ResolveCollectionSelectType<GeneratedTypes>\n\nexport type TypedCollectionJoins = ResolveCollectionJoinsType<GeneratedTypes>\n\nexport type TypedGlobal = ResolveGlobalType<GeneratedTypes>\n\nexport type TypedGlobalSelect = ResolveGlobalSelectType<GeneratedTypes>\n\n// Extract string keys from the type\nexport type StringKeyOf<T> = Extract<keyof T, string>\n\n// Define the types for slugs using the appropriate collections and globals\nexport type CollectionSlug = StringKeyOf<TypedCollection>\n\nexport type UploadCollectionSlug = StringKeyOf<TypedUploadCollection>\n\ntype ResolveDbType<T> = 'db' extends keyof T\n ? T['db']\n : // @ts-expect-error\n T['dbUntyped']\n\nexport type DefaultDocumentIDType = ResolveDbType<GeneratedTypes>['defaultIDType']\nexport type GlobalSlug = StringKeyOf<TypedGlobal>\n\n// now for locale and user\n\n// @ts-expect-error\ntype ResolveLocaleType<T> = 'locale' extends keyof T ? T['locale'] : T['localeUntyped']\n// @ts-expect-error\ntype ResolveUserType<T> = 'user' extends keyof T ? T['user'] : T['userUntyped']\n\nexport type TypedLocale = ResolveLocaleType<GeneratedTypes>\nexport type TypedUser = ResolveUserType<GeneratedTypes>\n\n// @ts-expect-error\ntype ResolveAuthOperationsType<T> = 'auth' extends keyof T ? T['auth'] : T['authUntyped']\nexport type TypedAuthOperations = ResolveAuthOperationsType<GeneratedTypes>\n\n// @ts-expect-error\ntype ResolveJobOperationsType<T> = 'jobs' extends keyof T ? T['jobs'] : T['jobsUntyped']\nexport type TypedJobs = ResolveJobOperationsType<GeneratedTypes>\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nlet checkedDependencies = false\n\n/**\n * @description Payload\n */\nexport class BasePayload {\n /**\n * @description Authorization and Authentication using headers and cookies to run auth user strategies\n * @returns permissions: Permissions\n * @returns user: User\n */\n auth = async (options: AuthArgs) => {\n const { auth } = localOperations.auth\n return auth(this, options)\n }\n\n authStrategies: AuthStrategy[]\n\n collections: Record<CollectionSlug, Collection> = {}\n\n config: SanitizedConfig\n /**\n * @description Performs count operation\n * @param options\n * @returns count of documents satisfying query\n */\n count = async <T extends CollectionSlug>(\n options: CountOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { count } = localOperations\n return count(this, options)\n }\n\n /**\n * @description Performs countGlobalVersions operation\n * @param options\n * @returns count of global document versions satisfying query\n */\n countGlobalVersions = async <T extends GlobalSlug>(\n options: CountGlobalVersionsOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { countGlobalVersions } = localGlobalOperations\n return countGlobalVersions(this, options)\n }\n\n /**\n * @description Performs countVersions operation\n * @param options\n * @returns count of document versions satisfying query\n */\n countVersions = async <T extends CollectionSlug>(\n options: CountOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { countVersions } = localOperations\n return countVersions(this, options)\n }\n\n /**\n * @description Performs create operation\n * @param options\n * @returns created document\n */\n create = async <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: CreateOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n const { create } = localOperations\n return create<TSlug, TSelect>(this, options)\n }\n\n db: DatabaseAdapter\n decrypt = decrypt\n\n duplicate = async <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DuplicateOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>> => {\n const { duplicate } = localOperations\n return duplicate<TSlug, TSelect>(this, options)\n }\n\n email: InitializedEmailAdapter\n\n encrypt = encrypt\n\n // TODO: re-implement or remove?\n // errorHandler: ErrorHandler\n\n extensions: (args: {\n args: OperationArgs<any>\n req: graphQLRequest<unknown, unknown>\n result: ExecutionResult\n }) => Promise<any>\n\n /**\n * @description Find documents with criteria\n * @param options\n * @returns documents satisfying query\n */\n find = async <TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: FindOptions<TSlug, TSelect>,\n ): Promise<PaginatedDocs<TransformCollectionWithSelect<TSlug, TSelect>>> => {\n const { find } = localOperations\n return find<TSlug, TSelect>(this, options)\n }\n\n /**\n * @description Find document by ID\n * @param options\n * @returns document with specified ID\n */\n findByID = async <\n TSlug extends CollectionSlug,\n TDisableErrors extends boolean,\n TSelect extends SelectFromCollectionSlug<TSlug>,\n >(\n options: FindByIDOptions<TSlug, TDisableErrors, TSelect>,\n ): Promise<ApplyDisableErrors<TransformCollectionWithSelect<TSlug, TSelect>, TDisableErrors>> => {\n const { findByID } = localOperations\n return findByID<TSlug, TDisableErrors, TSelect>(this, options)\n }\n\n findGlobal = async <TSlug extends GlobalSlug, TSelect extends SelectFromGlobalSlug<TSlug>>(\n options: FindGlobalOptions<TSlug, TSelect>,\n ): Promise<TransformGlobalWithSelect<TSlug, TSelect>> => {\n const { findOne } = localGlobalOperations\n return findOne<TSlug, TSelect>(this, options)\n }\n\n /**\n * @description Find global version by ID\n * @param options\n * @returns global version with specified ID\n */\n findGlobalVersionByID = async <TSlug extends GlobalSlug>(\n options: FindGlobalVersionByIDOptions<TSlug>,\n ): Promise<TypeWithVersion<DataFromGlobalSlug<TSlug>>> => {\n const { findVersionByID } = localGlobalOperations\n return findVersionByID<TSlug>(this, options)\n }\n\n /**\n * @description Find global versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findGlobalVersions = async <TSlug extends GlobalSlug>(\n options: FindGlobalVersionsOptions<TSlug>,\n ): Promise<PaginatedDocs<TypeWithVersion<DataFromGlobalSlug<TSlug>>>> => {\n const { findVersions } = localGlobalOperations\n return findVersions<TSlug>(this, options)\n }\n\n /**\n * @description Find version by ID\n * @param options\n * @returns version with specified ID\n */\n findVersionByID = async <TSlug extends CollectionSlug>(\n options: FindVersionByIDOptions<TSlug>,\n ): Promise<TypeWithVersion<DataFromCollectionSlug<TSlug>>> => {\n const { findVersionByID } = localOperations\n return findVersionByID<TSlug>(this, options)\n }\n\n /**\n * @description Find versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findVersions = async <TSlug extends CollectionSlug>(\n options: FindVersionsOptions<TSlug>,\n ): Promise<PaginatedDocs<TypeWithVersion<DataFromCollectionSlug<TSlug>>>> => {\n const { findVersions } = localOperations\n return findVersions<TSlug>(this, options)\n }\n\n forgotPassword = async <TSlug extends CollectionSlug>(\n options: ForgotPasswordOptions<TSlug>,\n ): Promise<ForgotPasswordResult> => {\n const { forgotPassword } = localOperations.auth\n return forgotPassword<TSlug>(this, options)\n }\n\n getAdminURL = (): string => `${this.config.serverURL}${this.config.routes.admin}`\n\n getAPIURL = (): string => `${this.config.serverURL}${this.config.routes.api}`\n\n globals: Globals\n\n importMap: ImportMap\n\n jobs = getJobsLocalAPI(this)\n\n logger: Logger\n\n login = async <TSlug extends CollectionSlug>(\n options: LoginOptions<TSlug>,\n ): Promise<{ user: DataFromCollectionSlug<TSlug> } & LoginResult> => {\n const { login } = localOperations.auth\n return login<TSlug>(this, options)\n }\n\n resetPassword = async <TSlug extends CollectionSlug>(\n options: ResetPasswordOptions<TSlug>,\n ): Promise<ResetPasswordResult> => {\n const { resetPassword } = localOperations.auth\n return resetPassword<TSlug>(this, options)\n }\n\n /**\n * @description Restore global version by ID\n * @param options\n * @returns version with specified ID\n */\n restoreGlobalVersion = async <TSlug extends GlobalSlug>(\n options: RestoreGlobalVersionOptions<TSlug>,\n ): Promise<DataFromGlobalSlug<TSlug>> => {\n const { restoreVersion } = localGlobalOperations\n return restoreVersion<TSlug>(this, options)\n }\n\n /**\n * @description Restore version by ID\n * @param options\n * @returns version with specified ID\n */\n restoreVersion = async <TSlug extends CollectionSlug>(\n options: RestoreVersionOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { restoreVersion } = localOperations\n return restoreVersion<TSlug>(this, options)\n }\n\n schema: GraphQLSchema\n\n secret: string\n\n sendEmail: InitializedEmailAdapter['sendEmail']\n\n types: {\n arrayTypes: any\n blockInputTypes: any\n blockTypes: any\n fallbackLocaleInputType?: any\n groupTypes: any\n localeInputType?: any\n tabTypes: any\n }\n\n unlock = async <TSlug extends CollectionSlug>(\n options: UnlockOptions<TSlug>,\n ): Promise<boolean> => {\n const { unlock } = localOperations.auth\n return unlock<TSlug>(this, options)\n }\n\n updateGlobal = async <TSlug extends GlobalSlug, TSelect extends SelectFromGlobalSlug<TSlug>>(\n options: UpdateGlobalOptions<TSlug, TSelect>,\n ): Promise<TransformGlobalWithSelect<TSlug, TSelect>> => {\n const { update } = localGlobalOperations\n return update<TSlug, TSelect>(this, options)\n }\n\n validationRules: (args: OperationArgs<any>) => ValidationRule[]\n\n verifyEmail = async <TSlug extends CollectionSlug>(\n options: VerifyEmailOptions<TSlug>,\n ): Promise<boolean> => {\n const { verifyEmail } = localOperations.auth\n return verifyEmail(this, options)\n }\n\n versions: {\n [slug: string]: any // TODO: Type this\n } = {}\n\n async bin({\n args,\n cwd,\n log,\n }: {\n args: string[]\n cwd?: string\n log?: boolean\n }): Promise<{ code: number }> {\n return new Promise((resolve, reject) => {\n const spawned = spawn('node', [path.resolve(dirname, '../bin.js'), ...args], {\n cwd,\n stdio: log || log === undefined ? 'inherit' : 'ignore',\n })\n\n spawned.on('exit', (code) => {\n resolve({ code })\n })\n\n spawned.on('error', (error) => {\n reject(error)\n })\n })\n }\n\n /**\n * @description delete one or more documents\n * @param options\n * @returns Updated document(s)\n */\n delete<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DeleteByIDOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\n\n delete<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DeleteManyOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect>>\n\n delete<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: DeleteOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const { deleteLocal } = localOperations\n return deleteLocal<TSlug, TSelect>(this, options)\n }\n\n /**\n * @description Initializes Payload\n * @param options\n */\n async init(options: InitOptions): Promise<Payload> {\n if (\n process.env.NODE_ENV !== 'production' &&\n process.env.PAYLOAD_DISABLE_DEPENDENCY_CHECKER !== 'true' &&\n !checkedDependencies\n ) {\n checkedDependencies = true\n void checkPayloadDependencies()\n }\n\n this.importMap = options.importMap\n\n if (!options?.config) {\n throw new Error('Error: the payload config is required to initialize payload.')\n }\n\n this.config = await options.config\n this.logger = getLogger('payload', this.config.logger)\n\n if (!this.config.secret) {\n throw new Error('Error: missing secret key. A secret key is needed to secure Payload.')\n }\n\n this.secret = crypto.createHash('sha256').update(this.config.secret).digest('hex').slice(0, 32)\n\n this.globals = {\n config: this.config.globals,\n }\n\n this.config.collections.forEach((collection) => {\n let customIDType = undefined\n const findCustomID: TraverseFieldsCallback = ({ field, next }) => {\n if (\n ['array', 'blocks', 'group'].includes(field.type) ||\n (field.type === 'tab' && 'name' in field)\n ) {\n return true\n }\n\n if (!fieldAffectsData(field)) {\n return\n }\n\n if (field.name === 'id') {\n customIDType = field.type\n return true\n }\n }\n\n traverseFields({ callback: findCustomID, fields: collection.fields })\n\n this.collections[collection.slug] = {\n config: collection,\n customIDType,\n }\n })\n\n // Generate types on startup\n if (process.env.NODE_ENV !== 'production' && this.config.typescript.autoGenerate !== false) {\n // We cannot run it directly here, as generate-types imports json-schema-to-typescript, which breaks on turbopack.\n // see: https://github.com/vercel/next.js/issues/66723\n void this.bin({\n args: ['generate:types'],\n log: false,\n })\n }\n\n this.db = this.config.db.init({ payload: this })\n this.db.payload = this\n\n if (this.db?.init) {\n await this.db.init()\n }\n\n if (!options.disableDBConnect && this.db.connect) {\n await this.db.connect()\n }\n\n // Load email adapter\n if (this.config.email instanceof Promise) {\n const awaitedAdapter = await this.config.email\n this.email = awaitedAdapter({ payload: this })\n } else if (this.config.email) {\n this.email = this.config.email({ payload: this })\n } else {\n if (process.env.NEXT_PHASE !== 'phase-production-build') {\n this.logger.warn(\n `No email adapter provided. Email will be written to console. More info at https://payloadcms.com/docs/email/overview.`,\n )\n }\n\n this.email = consoleEmailAdapter({ payload: this })\n }\n\n // Warn if image resizing is enabled but sharp is not installed\n if (\n !this.config.sharp &&\n this.config.collections.some((c) => c.upload.imageSizes || c.upload.formatOptions)\n ) {\n this.logger.warn(\n `Image resizing is enabled for one or more collections, but sharp not installed. Please install 'sharp' and pass into the config.`,\n )\n }\n\n this.sendEmail = this.email['sendEmail']\n\n serverInitTelemetry(this)\n\n // 1. loop over collections, if collection has auth strategy, initialize and push to array\n let jwtStrategyEnabled = false\n this.authStrategies = this.config.collections.reduce((authStrategies, collection) => {\n if (collection?.auth) {\n if (collection.auth.strategies.length > 0) {\n authStrategies.push(...collection.auth.strategies)\n }\n\n // 2. if api key enabled, push api key strategy into the array\n if (collection.auth?.useAPIKey) {\n authStrategies.push({\n name: `${collection.slug}-api-key`,\n authenticate: APIKeyAuthentication(collection),\n })\n }\n\n // 3. if localStrategy flag is true\n if (!collection.auth.disableLocalStrategy && !jwtStrategyEnabled) {\n jwtStrategyEnabled = true\n }\n }\n\n return authStrategies\n }, [] as AuthStrategy[])\n\n // 4. if enabled, push jwt strategy into authStrategies last\n if (jwtStrategyEnabled) {\n this.authStrategies.push({\n name: 'local-jwt',\n authenticate: JWTAuthentication,\n })\n }\n\n if (!options.disableOnInit) {\n if (typeof options.onInit === 'function') {\n await options.onInit(this)\n }\n if (typeof this.config.onInit === 'function') {\n await this.config.onInit(this)\n }\n }\n\n return this\n }\n\n update<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: UpdateManyOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect>>\n\n /**\n * @description Update one or more documents\n * @param options\n * @returns Updated document(s)\n */\n update<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: UpdateByIDOptions<TSlug, TSelect>,\n ): Promise<TransformCollectionWithSelect<TSlug, TSelect>>\n\n update<TSlug extends CollectionSlug, TSelect extends SelectFromCollectionSlug<TSlug>>(\n options: UpdateOptions<TSlug, TSelect>,\n ): Promise<BulkOperationResult<TSlug, TSelect> | TransformCollectionWithSelect<TSlug, TSelect>> {\n const { update } = localOperations\n return update<TSlug, TSelect>(this, options)\n }\n}\n\nconst initialized = new BasePayload()\n\nexport default initialized\n\nlet cached: {\n payload: null | Payload\n promise: null | Promise<Payload>\n reload: boolean | Promise<void>\n ws: null | WebSocket\n} = global._payload\n\nif (!cached) {\n cached = global._payload = { payload: null, promise: null, reload: false, ws: null }\n}\n\nexport const reload = async (\n config: SanitizedConfig,\n payload: Payload,\n skipImportMapGeneration?: boolean,\n): Promise<void> => {\n if (typeof payload.db.destroy === 'function') {\n await payload.db.destroy()\n }\n\n payload.config = config\n\n payload.collections = config.collections.reduce((collections, collection) => {\n collections[collection.slug] = {\n config: collection,\n customIDType: payload.collections[collection.slug]?.customIDType,\n }\n return collections\n }, {})\n\n payload.globals = {\n config: config.globals,\n }\n\n // TODO: support HMR for other props in the future (see payload/src/index init()) that may change on Payload singleton\n\n // Generate types\n if (config.typescript.autoGenerate !== false) {\n // We cannot run it directly here, as generate-types imports json-schema-to-typescript, which breaks on turbopack.\n // see: https://github.com/vercel/next.js/issues/66723\n void payload.bin({\n args: ['generate:types'],\n log: false,\n })\n }\n\n // Generate component map\n if (skipImportMapGeneration !== true && config.admin?.importMap?.autoGenerate !== false) {\n await generateImportMap(config, {\n log: true,\n })\n }\n\n await payload.db.init()\n if (payload.db.connect) {\n await payload.db.connect({ hotReload: true })\n }\n global._payload_clientConfig = null\n global._payload_schemaMap = null\n global._payload_clientSchemaMap = null\n global._payload_doNotCacheClientConfig = true // This will help refreshing the client config cache more reliably. If you remove this, please test HMR + client config refreshing (do new fields appear in the document?)\n global._payload_doNotCacheSchemaMap = true\n global._payload_doNotCacheClientSchemaMap = true\n}\n\nexport const getPayload = async (\n options: Pick<InitOptions, 'config' | 'importMap'>,\n): Promise<Payload> => {\n if (!options?.config) {\n throw new Error('Error: the payload config is required for getPayload to work.')\n }\n\n if (cached.payload) {\n if (cached.reload === true) {\n let resolve: () => void\n\n // getPayload is called multiple times, in parallel. However, we only want to run `await reload` once. By immediately setting cached.reload to a promise,\n // we can ensure that all subsequent calls will wait for the first reload to finish. So if we set it here, the 2nd call of getPayload\n // will reach `if (cached.reload instanceof Promise) {` which then waits for the first reload to finish.\n cached.reload = new Promise((res) => (resolve = res))\n const config = await options.config\n await reload(config, cached.payload)\n\n resolve()\n }\n\n if (cached.reload instanceof Promise) {\n await cached.reload\n }\n\n if (options?.importMap) {\n cached.payload.importMap = options.importMap\n }\n return cached.payload\n }\n\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (!cached.promise) {\n // no need to await options.config here, as it's already awaited in the BasePayload.init\n cached.promise = new BasePayload().init(options)\n }\n\n try {\n cached.payload = await cached.promise\n\n if (\n !cached.ws &&\n process.env.NODE_ENV !== 'production' &&\n process.env.NODE_ENV !== 'test' &&\n process.env.DISABLE_PAYLOAD_HMR !== 'true'\n ) {\n try {\n const port = process.env.PORT || '3000'\n cached.ws = new WebSocket(\n `ws://localhost:${port}${process.env.NEXT_BASE_PATH ?? ''}/_next/webpack-hmr`,\n )\n\n cached.ws.onmessage = (event) => {\n if (typeof event.data === 'string') {\n const data = JSON.parse(event.data)\n\n if ('action' in data && data.action === 'serverComponentChanges') {\n cached.reload = true\n }\n }\n }\n\n cached.ws.onerror = (_) => {\n // swallow any websocket connection error\n }\n } catch (_) {\n // swallow e\n }\n }\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n if (options?.importMap) {\n cached.payload.importMap = options.importMap\n }\n\n return cached.payload\n}\n\ntype Payload = BasePayload\n\ninterface RequestContext {\n [key: string]: unknown\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DatabaseAdapter extends BaseDatabaseAdapter {}\nexport type { Payload, RequestContext }\nexport { default as executeAccess } from './auth/executeAccess.js'\nexport { executeAuthStrategies } from './auth/executeAuthStrategies.js'\nexport { getAccessResults } from './auth/getAccessResults.js'\nexport { getFieldsToSign } from './auth/getFieldsToSign.js'\nexport * from './auth/index.js'\nexport { accessOperation } from './auth/operations/access.js'\nexport { forgotPasswordOperation } from './auth/operations/forgotPassword.js'\nexport { initOperation } from './auth/operations/init.js'\nexport { loginOperation } from './auth/operations/login.js'\nexport { logoutOperation } from './auth/operations/logout.js'\nexport type { MeOperationResult } from './auth/operations/me.js'\nexport { meOperation } from './auth/operations/me.js'\nexport { refreshOperation } from './auth/operations/refresh.js'\nexport { registerFirstUserOperation } from './auth/operations/registerFirstUser.js'\nexport { resetPasswordOperation } from './auth/operations/resetPassword.js'\nexport { unlockOperation } from './auth/operations/unlock.js'\nexport { verifyEmailOperation } from './auth/operations/verifyEmail.js'\n\nexport type {\n AuthStrategyFunction,\n AuthStrategyFunctionArgs,\n CollectionPermission,\n DocumentPermissions,\n FieldPermissions,\n GlobalPermission,\n IncomingAuthType,\n Permission,\n Permissions,\n SanitizedCollectionPermission,\n SanitizedDocumentPermissions,\n SanitizedFieldPermissions,\n SanitizedGlobalPermission,\n SanitizedPermissions,\n User,\n VerifyConfig,\n} from './auth/types.js'\n\nexport { generateImportMap } from './bin/generateImportMap/index.js'\nexport type { ImportMap } from './bin/generateImportMap/index.js'\n\nexport { genImportMapIterateFields } from './bin/generateImportMap/iterateFields.js'\n\nexport {\n type ClientCollectionConfig,\n createClientCollectionConfig,\n createClientCollectionConfigs,\n type ServerOnlyCollectionAdminProperties,\n type ServerOnlyCollectionProperties,\n type ServerOnlyUploadProperties,\n} from './collections/config/client.js'\n\nexport type {\n AfterChangeHook as CollectionAfterChangeHook,\n AfterDeleteHook as CollectionAfterDeleteHook,\n AfterErrorHook as CollectionAfterErrorHook,\n AfterForgotPasswordHook as CollectionAfterForgotPasswordHook,\n AfterLoginHook as CollectionAfterLoginHook,\n AfterLogoutHook as CollectionAfterLogoutHook,\n AfterMeHook as CollectionAfterMeHook,\n AfterOperationHook as CollectionAfterOperationHook,\n AfterReadHook as CollectionAfterReadHook,\n AfterRefreshHook as CollectionAfterRefreshHook,\n AuthCollection,\n AuthOperationsFromCollectionSlug,\n BaseListFilter,\n BeforeChangeHook as CollectionBeforeChangeHook,\n BeforeDeleteHook as CollectionBeforeDeleteHook,\n BeforeLoginHook as CollectionBeforeLoginHook,\n BeforeOperationHook as CollectionBeforeOperationHook,\n BeforeReadHook as CollectionBeforeReadHook,\n BeforeValidateHook as CollectionBeforeValidateHook,\n BulkOperationResult,\n Collection,\n CollectionAdminOptions,\n CollectionConfig,\n DataFromCollectionSlug,\n HookOperationType,\n MeHook as CollectionMeHook,\n RefreshHook as CollectionRefreshHook,\n RequiredDataFromCollection,\n RequiredDataFromCollectionSlug,\n SanitizedCollectionConfig,\n SanitizedJoins,\n TypeWithID,\n TypeWithTimestamps,\n} from './collections/config/types.js'\nexport { createDataloaderCacheKey, getDataLoader } from './collections/dataloader.js'\nexport { countOperation } from './collections/operations/count.js'\nexport { createOperation } from './collections/operations/create.js'\nexport { deleteOperation } from './collections/operations/delete.js'\nexport { deleteByIDOperation } from './collections/operations/deleteByID.js'\nexport { docAccessOperation } from './collections/operations/docAccess.js'\nexport { duplicateOperation } from './collections/operations/duplicate.js'\nexport { findOperation } from './collections/operations/find.js'\nexport { findByIDOperation } from './collections/operations/findByID.js'\nexport { findVersionByIDOperation } from './collections/operations/findVersionByID.js'\nexport { findVersionsOperation } from './collections/operations/findVersions.js'\nexport { restoreVersionOperation } from './collections/operations/restoreVersion.js'\nexport { updateOperation } from './collections/operations/update.js'\nexport { updateByIDOperation } from './collections/operations/updateByID.js'\nexport { buildConfig } from './config/build.js'\nexport {\n type ClientConfig,\n createClientConfig,\n serverOnlyAdminConfigProperties,\n serverOnlyConfigProperties,\n} from './config/client.js'\n\nexport { defaults } from './config/defaults.js'\nexport { sanitizeConfig } from './config/sanitize.js'\nexport type * from './config/types.js'\nexport { combineQueries } from './database/combineQueries.js'\nexport { createDatabaseAdapter } from './database/createDatabaseAdapter.js'\nexport { defaultBeginTransaction } from './database/defaultBeginTransaction.js'\nexport { default as flattenWhereToOperators } from './database/flattenWhereToOperators.js'\nexport { getLocalizedPaths } from './database/getLocalizedPaths.js'\nexport { createMigration } from './database/migrations/createMigration.js'\nexport { getMigrations } from './database/migrations/getMigrations.js'\nexport { getPredefinedMigration } from './database/migrations/getPredefinedMigration.js'\nexport { migrate } from './database/migrations/migrate.js'\nexport { migrateDown } from './database/migrations/migrateDown.js'\nexport { migrateRefresh } from './database/migrations/migrateRefresh.js'\nexport { migrateReset } from './database/migrations/migrateReset.js'\nexport { migrateStatus } from './database/migrations/migrateStatus.js'\nexport { migrationsCollection } from './database/migrations/migrationsCollection.js'\nexport { migrationTemplate } from './database/migrations/migrationTemplate.js'\nexport { readMigrationFiles } from './database/migrations/readMigrationFiles.js'\nexport { writeMigrationIndex } from './database/migrations/writeMigrationIndex.js'\nexport type * from './database/queryValidation/types.js'\nexport type { EntityPolicies, PathToQuery } from './database/queryValidation/types.js'\nexport { validateQueryPaths } from './database/queryValidation/validateQueryPaths.js'\nexport { validateSearchParam } from './database/queryValidation/validateSearchParams.js'\nexport type {\n BaseDatabaseAdapter,\n BeginTransaction,\n CommitTransaction,\n Connect,\n Count,\n CountArgs,\n CountGlobalVersions,\n CountVersions,\n Create,\n CreateArgs,\n CreateGlobal,\n CreateGlobalArgs,\n CreateGlobalVersion,\n CreateGlobalVersionArgs,\n CreateMigration,\n CreateVersion,\n CreateVersionArgs,\n DatabaseAdapterResult as DatabaseAdapterObj,\n DBIdentifierName,\n DeleteMany,\n DeleteManyArgs,\n DeleteOne,\n DeleteOneArgs,\n DeleteVersions,\n DeleteVersionsArgs,\n Destroy,\n Find,\n FindArgs,\n FindGlobal,\n FindGlobalArgs,\n FindGlobalVersions,\n FindGlobalVersionsArgs,\n FindOne,\n FindOneArgs,\n FindVersions,\n FindVersionsArgs,\n Init,\n Migration,\n MigrationData,\n MigrationTemplateArgs,\n PaginatedDocs,\n QueryDrafts,\n QueryDraftsArgs,\n RollbackTransaction,\n Transaction,\n UpdateGlobal,\n UpdateGlobalArgs,\n UpdateGlobalVersion,\n UpdateGlobalVersionArgs,\n UpdateOne,\n UpdateOneArgs,\n UpdateVersion,\n UpdateVersionArgs,\n Upsert,\n} from './database/types.js'\nexport type { EmailAdapter as PayloadEmailAdapter, SendEmailOptions } from './email/types.js'\nexport {\n APIError,\n APIErrorName,\n AuthenticationError,\n DuplicateCollection,\n DuplicateFieldName,\n DuplicateGlobal,\n ErrorDeletingFile,\n FileRetrievalError,\n FileUploadError,\n Forbidden,\n InvalidConfiguration,\n InvalidFieldName,\n InvalidFieldRelationship,\n Locked,\n LockedAuth,\n MissingCollectionLabel,\n MissingEditorProp,\n MissingFieldInputOptions,\n MissingFieldType,\n MissingFile,\n NotFound,\n QueryError,\n ValidationError,\n ValidationErrorName,\n} from './errors/index.js'\nexport type { ValidationFieldError } from './errors/index.js'\n\nexport { baseBlockFields } from './fields/baseFields/baseBlockFields.js'\nexport { baseIDField } from './fields/baseFields/baseIDField.js'\nexport {\n createClientField,\n createClientFields,\n type ServerOnlyFieldAdminProperties,\n type ServerOnlyFieldProperties,\n} from './fields/config/client.js'\nexport { sanitizeFields } from './fields/config/sanitize.js'\nexport type {\n AdminClient,\n ArrayField,\n ArrayFieldClient,\n BaseValidateOptions,\n Block,\n BlockJSX,\n BlocksField,\n BlocksFieldClient,\n CheckboxField,\n CheckboxFieldClient,\n ClientBlock,\n ClientField,\n ClientFieldProps,\n CodeField,\n CodeFieldClient,\n CollapsibleField,\n CollapsibleFieldClient,\n Condition,\n DateField,\n DateFieldClient,\n EmailField,\n EmailFieldClient,\n Field,\n FieldAccess,\n FieldAffectingData,\n FieldAffectingDataClient,\n FieldBase,\n FieldBaseClient,\n FieldHook,\n FieldHookArgs,\n FieldPresentationalOnly,\n FieldPresentationalOnlyClient,\n FieldTypes,\n FieldWithMany,\n FieldWithManyClient,\n FieldWithMaxDepth,\n FieldWithMaxDepthClient,\n FieldWithPath,\n FieldWithPathClient,\n FieldWithSubFields,\n FieldWithSubFieldsClient,\n FilterOptions,\n FilterOptionsProps,\n FlattenedArrayField,\n FlattenedBlock,\n FlattenedBlocksField,\n FlattenedField,\n FlattenedGroupField,\n FlattenedTabAsField,\n GroupField,\n GroupFieldClient,\n HookName,\n JoinField,\n JoinFieldClient,\n JSONField,\n JSONFieldClient,\n Labels,\n LabelsClient,\n NamedTab,\n NonPresentationalField,\n NonPresentationalFieldClient,\n NumberField,\n NumberFieldClient,\n Option,\n OptionObject,\n PointField,\n PointFieldClient,\n PolymorphicRelationshipField,\n PolymorphicRelationshipFieldClient,\n RadioField,\n RadioFieldClient,\n RelationshipField,\n RelationshipFieldClient,\n RelationshipValue,\n RichTextField,\n RichTextFieldClient,\n RowField,\n RowFieldClient,\n SelectField,\n SelectFieldClient,\n SingleRelationshipField,\n SingleRelationshipFieldClient,\n Tab,\n TabAsField,\n TabAsFieldClient,\n TabsField,\n TabsFieldClient,\n TextareaField,\n TextareaFieldClient,\n TextField,\n TextFieldClient,\n UIField,\n UIFieldClient,\n UnnamedTab,\n UploadField,\n UploadFieldClient,\n Validate,\n ValidateOptions,\n ValueWithRelation,\n} from './fields/config/types.js'\n\nexport { getDefaultValue } from './fields/getDefaultValue.js'\nexport { traverseFields as afterChangeTraverseFields } from './fields/hooks/afterChange/traverseFields.js'\nexport { promise as afterReadPromise } from './fields/hooks/afterRead/promise.js'\nexport { traverseFields as afterReadTraverseFields } from './fields/hooks/afterRead/traverseFields.js'\nexport { traverseFields as beforeChangeTraverseFields } from './fields/hooks/beforeChange/traverseFields.js'\nexport { traverseFields as beforeValidateTraverseFields } from './fields/hooks/beforeValidate/traverseFields.js'\nexport { default as sortableFieldTypes } from './fields/sortableFieldTypes.js'\n\nexport { validations } from './fields/validations.js'\nexport type {\n ArrayFieldValidation,\n BlocksFieldValidation,\n CheckboxFieldValidation,\n CodeFieldValidation,\n ConfirmPasswordFieldValidation,\n DateFieldValidation,\n EmailFieldValidation,\n JSONFieldValidation,\n NumberFieldManyValidation,\n NumberFieldSingleValidation,\n NumberFieldValidation,\n PasswordFieldValidation,\n PointFieldValidation,\n RadioFieldValidation,\n RelationshipFieldManyValidation,\n RelationshipFieldSingleValidation,\n RelationshipFieldValidation,\n RichTextFieldValidation,\n SelectFieldManyValidation,\n SelectFieldSingleValidation,\n SelectFieldValidation,\n TextareaFieldValidation,\n TextFieldManyValidation,\n TextFieldSingleValidation,\n TextFieldValidation,\n UploadFieldManyValidation,\n UploadFieldSingleValidation,\n UploadFieldValidation,\n UsernameFieldValidation,\n} from './fields/validations.js'\n\nexport {\n type ClientGlobalConfig,\n createClientGlobalConfig,\n createClientGlobalConfigs,\n type ServerOnlyGlobalAdminProperties,\n type ServerOnlyGlobalProperties,\n} from './globals/config/client.js'\n\nexport type {\n AfterChangeHook as GlobalAfterChangeHook,\n AfterReadHook as GlobalAfterReadHook,\n BeforeChangeHook as GlobalBeforeChangeHook,\n BeforeReadHook as GlobalBeforeReadHook,\n BeforeValidateHook as GlobalBeforeValidateHook,\n DataFromGlobalSlug,\n GlobalAdminOptions,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './globals/config/types.js'\n\nexport { docAccessOperation as docAccessOperationGlobal } from './globals/operations/docAccess.js'\nexport { findOneOperation } from './globals/operations/findOne.js'\nexport { findVersionByIDOperation as findVersionByIDOperationGlobal } from './globals/operations/findVersionByID.js'\nexport { findVersionsOperation as findVersionsOperationGlobal } from './globals/operations/findVersions.js'\nexport { restoreVersionOperation as restoreVersionOperationGlobal } from './globals/operations/restoreVersion.js'\nexport { updateOperation as updateOperationGlobal } from './globals/operations/update.js'\nexport type {\n CollapsedPreferences,\n DocumentPreferences,\n FieldsPreferences,\n InsideFieldsPreferences,\n PreferenceRequest,\n PreferenceUpdateRequest,\n TabsPreferences,\n} from './preferences/types.js'\nexport type { JobsConfig, RunJobAccess, RunJobAccessArgs } from './queues/config/types/index.js'\nexport type {\n RunTaskFunction,\n TaskConfig,\n TaskHandler,\n TaskHandlerArgs,\n TaskHandlerResult,\n TaskHandlerResults,\n TaskInput,\n TaskOutput,\n TaskType,\n} from './queues/config/types/taskTypes.js'\nexport type {\n BaseJob,\n JobTaskStatus,\n RunningJob,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowHandler,\n WorkflowTypes,\n} from './queues/config/types/workflowTypes.js'\nexport { getLocalI18n } from './translations/getLocalI18n.js'\nexport * from './types/index.js'\nexport { getFileByPath } from './uploads/getFileByPath.js'\nexport type * from './uploads/types.js'\nexport { commitTransaction } from './utilities/commitTransaction.js'\nexport {\n configToJSONSchema,\n entityToJSONSchema,\n fieldsToJSONSchema,\n withNullableJSONSchemaType,\n} from './utilities/configToJSONSchema.js'\nexport { createArrayFromCommaDelineated } from './utilities/createArrayFromCommaDelineated.js'\nexport { createLocalReq } from './utilities/createLocalReq.js'\nexport {\n deepCopyObject,\n deepCopyObjectComplex,\n deepCopyObjectSimple,\n} from './utilities/deepCopyObject.js'\nexport {\n deepMerge,\n deepMergeWithCombinedArrays,\n deepMergeWithReactComponents,\n deepMergeWithSourceArrays,\n} from './utilities/deepMerge.js'\nexport {\n checkDependencies,\n type CustomVersionParser,\n} from './utilities/dependencies/dependencyChecker.js'\nexport { getDependencies } from './utilities/dependencies/getDependencies.js'\nexport {\n findUp,\n findUpSync,\n pathExistsAndIsAccessible,\n pathExistsAndIsAccessibleSync,\n} from './utilities/findUp.js'\nexport { flattenAllFields } from './utilities/flattenAllFields.js'\nexport { default as flattenTopLevelFields } from './utilities/flattenTopLevelFields.js'\nexport { formatErrors } from './utilities/formatErrors.js'\nexport { formatLabels, formatNames, toWords } from './utilities/formatLabels.js'\nexport { getCollectionIDFieldTypes } from './utilities/getCollectionIDFieldTypes.js'\nexport { getObjectDotNotation } from './utilities/getObjectDotNotation.js'\nexport { initTransaction } from './utilities/initTransaction.js'\nexport { isEntityHidden } from './utilities/isEntityHidden.js'\nexport { default as isolateObjectProperty } from './utilities/isolateObjectProperty.js'\nexport { isPlainObject } from './utilities/isPlainObject.js'\nexport { isValidID } from './utilities/isValidID.js'\nexport { killTransaction } from './utilities/killTransaction.js'\nexport { mapAsync } from './utilities/mapAsync.js'\nexport { sanitizeFallbackLocale } from './utilities/sanitizeFallbackLocale.js'\nexport { traverseFields } from './utilities/traverseFields.js'\nexport type { TraverseFieldsCallback } from './utilities/traverseFields.js'\nexport { buildVersionCollectionFields } from './versions/buildCollectionFields.js'\nexport { buildVersionGlobalFields } from './versions/buildGlobalFields.js'\nexport { versionDefaults } from './versions/defaults.js'\nexport { deleteCollectionVersions } from './versions/deleteCollectionVersions.js'\nexport { enforceMaxVersions } from './versions/enforceMaxVersions.js'\nexport { getLatestCollectionVersion } from './versions/getLatestCollectionVersion.js'\nexport { getLatestGlobalVersion } from './versions/getLatestGlobalVersion.js'\n\nexport { saveVersion } from './versions/saveVersion.js'\nexport type { TypeWithVersion } from './versions/types.js'\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["spawn","crypto","fileURLToPath","path","WebSocket","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","generateImportMap","checkPayloadDependencies","localOperations","consoleEmailAdapter","fieldAffectsData","localGlobalOperations","getJobsLocalAPI","getLogger","serverInit","serverInitTelemetry","traverseFields","filename","url","dirname","checkedDependencies","BasePayload","auth","options","authStrategies","collections","config","count","countGlobalVersions","countVersions","create","db","duplicate","email","extensions","find","findByID","findGlobal","findOne","findGlobalVersionByID","findVersionByID","findGlobalVersions","findVersions","forgotPassword","getAdminURL","serverURL","routes","admin","getAPIURL","api","globals","importMap","jobs","logger","login","resetPassword","restoreGlobalVersion","restoreVersion","schema","secret","sendEmail","types","unlock","updateGlobal","update","validationRules","verifyEmail","versions","bin","args","cwd","log","Promise","resolve","reject","spawned","stdio","undefined","on","code","error","delete","deleteLocal","init","process","env","NODE_ENV","PAYLOAD_DISABLE_DEPENDENCY_CHECKER","Error","createHash","digest","slice","forEach","collection","customIDType","findCustomID","field","next","includes","type","name","callback","fields","slug","typescript","autoGenerate","payload","disableDBConnect","connect","awaitedAdapter","NEXT_PHASE","warn","sharp","some","c","upload","imageSizes","formatOptions","jwtStrategyEnabled","reduce","strategies","length","push","useAPIKey","authenticate","disableLocalStrategy","disableOnInit","onInit","initialized","cached","global","_payload","promise","reload","ws","skipImportMapGeneration","destroy","hotReload","_payload_clientConfig","_payload_schemaMap","_payload_clientSchemaMap","_payload_doNotCacheClientConfig","_payload_doNotCacheSchemaMap","_payload_doNotCacheClientSchemaMap","getPayload","res","DISABLE_PAYLOAD_HMR","port","PORT","NEXT_BASE_PATH","onmessage","event","data","JSON","parse","action","onerror","_","e","default","executeAccess","executeAuthStrategies","getAccessResults","getFieldsToSign","accessOperation","forgotPasswordOperation","initOperation","loginOperation","logoutOperation","meOperation","refreshOperation","registerFirstUserOperation","resetPasswordOperation","unlockOperation","verifyEmailOperation","genImportMapIterateFields","createClientCollectionConfig","createClientCollectionConfigs","createDataloaderCacheKey","getDataLoader","countOperation","createOperation","deleteOperation","deleteByIDOperation","docAccessOperation","duplicateOperation","findOperation","findByIDOperation","findVersionByIDOperation","findVersionsOperation","restoreVersionOperation","updateOperation","updateByIDOperation","buildConfig","createClientConfig","serverOnlyAdminConfigProperties","serverOnlyConfigProperties","defaults","sanitizeConfig","combineQueries","createDatabaseAdapter","defaultBeginTransaction","flattenWhereToOperators","getLocalizedPaths","createMigration","getMigrations","getPredefinedMigration","migrate","migrateDown","migrateRefresh","migrateReset","migrateStatus","migrationsCollection","migrationTemplate","readMigrationFiles","writeMigrationIndex","validateQueryPaths","validateSearchParam","APIError","APIErrorName","AuthenticationError","DuplicateCollection","DuplicateFieldName","DuplicateGlobal","ErrorDeletingFile","FileRetrievalError","FileUploadError","Forbidden","InvalidConfiguration","InvalidFieldName","InvalidFieldRelationship","Locked","LockedAuth","MissingCollectionLabel","MissingEditorProp","MissingFieldInputOptions","MissingFieldType","MissingFile","NotFound","QueryError","ValidationError","ValidationErrorName","baseBlockFields","baseIDField","createClientField","createClientFields","sanitizeFields","getDefaultValue","afterChangeTraverseFields","afterReadPromise","afterReadTraverseFields","beforeChangeTraverseFields","beforeValidateTraverseFields","sortableFieldTypes","validations","createClientGlobalConfig","createClientGlobalConfigs","docAccessOperationGlobal","findOneOperation","findVersionByIDOperationGlobal","findVersionsOperationGlobal","restoreVersionOperationGlobal","updateOperationGlobal","getLocalI18n","getFileByPath","commitTransaction","configToJSONSchema","entityToJSONSchema","fieldsToJSONSchema","withNullableJSONSchemaType","createArrayFromCommaDelineated","createLocalReq","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","checkDependencies","getDependencies","findUp","findUpSync","pathExistsAndIsAccessible","pathExistsAndIsAccessibleSync","flattenAllFields","flattenTopLevelFields","formatErrors","formatLabels","formatNames","toWords","getCollectionIDFieldTypes","getObjectDotNotation","initTransaction","isEntityHidden","isolateObjectProperty","isPlainObject","isValidID","killTransaction","mapAsync","sanitizeFallbackLocale","buildVersionCollectionFields","buildVersionGlobalFields","versionDefaults","deleteCollectionVersions","enforceMaxVersions","getLatestCollectionVersion","getLatestGlobalVersion","saveVersion","deep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SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,QAAQ,QAAQ,0BAAyB;AAClD,SAASC,sBAAsB,QAAQ,wCAAuC;AAC9E,SAAS5R,cAAc,QAAQ,gCAA+B;AAE9D,SAAS6R,4BAA4B,QAAQ,sCAAqC;AAClF,SAASC,wBAAwB,QAAQ,kCAAiC;AAC1E,SAASC,eAAe,QAAQ,yBAAwB;AACxD,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,0BAA0B,QAAQ,2CAA0C;AACrF,SAASC,sBAAsB,QAAQ,uCAAsC;AAE7E,SAASC,WAAW,QAAQ,4BAA2B;AAEvD,SAASC,eAAe,QAAQ,qCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/fieldSchemaToJSON.ts"],"sourcesContent":["import type { ClientField } from '../fields/config/client.js'\nimport type { FieldTypes } from '../fields/config/types.js'\n\nexport type FieldSchemaJSON = {\n blocks?: FieldSchemaJSON // TODO: conditionally add based on `type`\n fields?: FieldSchemaJSON // TODO: conditionally add based on `type`\n hasMany?: boolean // TODO: conditionally add based on `type`\n name: string\n relationTo?: string // TODO: conditionally add based on `type`\n slug?: string // TODO: conditionally add based on `type`\n type: FieldTypes\n}[]\n\nexport const fieldSchemaToJSON = (fields: ClientField[]): FieldSchemaJSON => {\n return fields.reduce((acc, field) => {\n let result = acc\n\n switch (field.type) {\n case 'array':\n acc.push({\n name: field.name,\n type: field.type,\n fields: fieldSchemaToJSON([\n ...field.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n })\n\n break\n\n case 'blocks':\n acc.push({\n name: field.name,\n type: field.type,\n blocks: field.blocks.reduce((acc, block) => {\n acc[block.slug] = {\n fields: fieldSchemaToJSON([\n ...block.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n }\n\n return acc\n }, {}),\n })\n\n break\n\n case 'collapsible'
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/fieldSchemaToJSON.ts"],"sourcesContent":["import type { ClientField } from '../fields/config/client.js'\nimport type { FieldTypes } from '../fields/config/types.js'\n\nexport type FieldSchemaJSON = {\n blocks?: FieldSchemaJSON // TODO: conditionally add based on `type`\n fields?: FieldSchemaJSON // TODO: conditionally add based on `type`\n hasMany?: boolean // TODO: conditionally add based on `type`\n name: string\n relationTo?: string // TODO: conditionally add based on `type`\n slug?: string // TODO: conditionally add based on `type`\n type: FieldTypes\n}[]\n\nexport const fieldSchemaToJSON = (fields: ClientField[]): FieldSchemaJSON => {\n return fields.reduce((acc, field) => {\n let result = acc\n\n switch (field.type) {\n case 'array':\n acc.push({\n name: field.name,\n type: field.type,\n fields: fieldSchemaToJSON([\n ...field.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n })\n\n break\n\n case 'blocks':\n acc.push({\n name: field.name,\n type: field.type,\n blocks: field.blocks.reduce((acc, block) => {\n acc[block.slug] = {\n fields: fieldSchemaToJSON([\n ...block.fields,\n {\n name: 'id',\n type: 'text',\n },\n ]),\n }\n\n return acc\n }, {}),\n })\n\n break\n\n case 'collapsible': // eslint-disable no-fallthrough\n case 'row':\n result = result.concat(fieldSchemaToJSON(field.fields))\n break\n\n case 'group':\n acc.push({\n name: field.name,\n type: field.type,\n fields: fieldSchemaToJSON(field.fields),\n })\n\n break\n\n case 'relationship': // eslint-disable no-fallthrough\n case 'upload':\n acc.push({\n name: field.name,\n type: field.type,\n hasMany: 'hasMany' in field ? Boolean(field.hasMany) : false, // TODO: type this\n relationTo: field.relationTo,\n })\n\n break\n\n case 'tabs': {\n let tabFields = []\n\n field.tabs.forEach((tab) => {\n if ('name' in tab) {\n tabFields.push({\n name: tab.name,\n type: field.type,\n fields: fieldSchemaToJSON(tab.fields),\n })\n return\n }\n\n tabFields = tabFields.concat(fieldSchemaToJSON(tab.fields))\n })\n\n result = result.concat(tabFields)\n\n break\n }\n\n default:\n if ('name' in field) {\n acc.push({\n name: field.name,\n type: field.type,\n })\n }\n }\n\n return result\n }, [])\n}\n"],"names":["fieldSchemaToJSON","fields","reduce","acc","field","result","type","push","name","blocks","block","slug","concat","hasMany","Boolean","relationTo","tabFields","tabs","forEach","tab"],"mappings":"AAaA,OAAO,MAAMA,oBAAoB,CAACC;IAChC,OAAOA,OAAOC,MAAM,CAAC,CAACC,KAAKC;QACzB,IAAIC,SAASF;QAEb,OAAQC,MAAME,IAAI;YAChB,KAAK;gBACHH,IAAII,IAAI,CAAC;oBACPC,MAAMJ,MAAMI,IAAI;oBAChBF,MAAMF,MAAME,IAAI;oBAChBL,QAAQD,kBAAkB;2BACrBI,MAAMH,MAAM;wBACf;4BACEO,MAAM;4BACNF,MAAM;wBACR;qBACD;gBACH;gBAEA;YAEF,KAAK;gBACHH,IAAII,IAAI,CAAC;oBACPC,MAAMJ,MAAMI,IAAI;oBAChBF,MAAMF,MAAME,IAAI;oBAChBG,QAAQL,MAAMK,MAAM,CAACP,MAAM,CAAC,CAACC,KAAKO;wBAChCP,GAAG,CAACO,MAAMC,IAAI,CAAC,GAAG;4BAChBV,QAAQD,kBAAkB;mCACrBU,MAAMT,MAAM;gCACf;oCACEO,MAAM;oCACNF,MAAM;gCACR;6BACD;wBACH;wBAEA,OAAOH;oBACT,GAAG,CAAC;gBACN;gBAEA;YAEF,KAAK;YACL,KAAK;gBACHE,SAASA,OAAOO,MAAM,CAACZ,kBAAkBI,MAAMH,MAAM;gBACrD;YAEF,KAAK;gBACHE,IAAII,IAAI,CAAC;oBACPC,MAAMJ,MAAMI,IAAI;oBAChBF,MAAMF,MAAME,IAAI;oBAChBL,QAAQD,kBAAkBI,MAAMH,MAAM;gBACxC;gBAEA;YAEF,KAAK;YACL,KAAK;gBACHE,IAAII,IAAI,CAAC;oBACPC,MAAMJ,MAAMI,IAAI;oBAChBF,MAAMF,MAAME,IAAI;oBAChBO,SAAS,aAAaT,QAAQU,QAAQV,MAAMS,OAAO,IAAI;oBACvDE,YAAYX,MAAMW,UAAU;gBAC9B;gBAEA;YAEF,KAAK;gBAAQ;oBACX,IAAIC,YAAY,EAAE;oBAElBZ,MAAMa,IAAI,CAACC,OAAO,CAAC,CAACC;wBAClB,IAAI,UAAUA,KAAK;4BACjBH,UAAUT,IAAI,CAAC;gCACbC,MAAMW,IAAIX,IAAI;gCACdF,MAAMF,MAAME,IAAI;gCAChBL,QAAQD,kBAAkBmB,IAAIlB,MAAM;4BACtC;4BACA;wBACF;wBAEAe,YAAYA,UAAUJ,MAAM,CAACZ,kBAAkBmB,IAAIlB,MAAM;oBAC3D;oBAEAI,SAASA,OAAOO,MAAM,CAACI;oBAEvB;gBACF;YAEA;gBACE,IAAI,UAAUZ,OAAO;oBACnBD,IAAII,IAAI,CAAC;wBACPC,MAAMJ,MAAMI,IAAI;wBAChBF,MAAMF,MAAME,IAAI;oBAClB;gBACF;QACJ;QAEA,OAAOD;IACT,GAAG,EAAE;AACP,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"tsx": "4.19.2",
|
|
98
98
|
"uuid": "10.0.0",
|
|
99
99
|
"ws": "^8.16.0",
|
|
100
|
-
"@payloadcms/translations": "3.
|
|
100
|
+
"@payloadcms/translations": "3.4.0"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|