payload 3.0.0-beta.130 → 3.0.0-beta.131

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.
Files changed (92) hide show
  1. package/dist/admin/elements/Cell.d.ts +16 -3
  2. package/dist/admin/elements/Cell.d.ts.map +1 -1
  3. package/dist/admin/elements/Cell.js.map +1 -1
  4. package/dist/admin/elements/Tab.d.ts +3 -3
  5. package/dist/admin/elements/Tab.d.ts.map +1 -1
  6. package/dist/admin/elements/Tab.js.map +1 -1
  7. package/dist/admin/fields/Hidden.d.ts +2 -5
  8. package/dist/admin/fields/Hidden.d.ts.map +1 -1
  9. package/dist/admin/fields/Hidden.js.map +1 -1
  10. package/dist/admin/forms/Field.d.ts +2 -2
  11. package/dist/admin/forms/Field.d.ts.map +1 -1
  12. package/dist/admin/forms/Field.js.map +1 -1
  13. package/dist/admin/forms/Form.d.ts +2 -2
  14. package/dist/admin/forms/Form.d.ts.map +1 -1
  15. package/dist/admin/forms/Form.js.map +1 -1
  16. package/dist/admin/types.d.ts +1 -1
  17. package/dist/admin/types.d.ts.map +1 -1
  18. package/dist/admin/types.js.map +1 -1
  19. package/dist/admin/views/types.d.ts +2 -2
  20. package/dist/admin/views/types.d.ts.map +1 -1
  21. package/dist/admin/views/types.js.map +1 -1
  22. package/dist/auth/getAccessResults.d.ts +2 -2
  23. package/dist/auth/getAccessResults.d.ts.map +1 -1
  24. package/dist/auth/getAccessResults.js +2 -1
  25. package/dist/auth/getAccessResults.js.map +1 -1
  26. package/dist/auth/operations/access.d.ts +2 -2
  27. package/dist/auth/operations/access.d.ts.map +1 -1
  28. package/dist/auth/operations/access.js.map +1 -1
  29. package/dist/auth/operations/auth.d.ts +2 -3
  30. package/dist/auth/operations/auth.d.ts.map +1 -1
  31. package/dist/auth/operations/auth.js.map +1 -1
  32. package/dist/auth/types.d.ts +66 -4
  33. package/dist/auth/types.d.ts.map +1 -1
  34. package/dist/auth/types.js.map +1 -1
  35. package/dist/collections/config/client.d.ts +1 -2
  36. package/dist/collections/config/client.d.ts.map +1 -1
  37. package/dist/collections/config/client.js +6 -4
  38. package/dist/collections/config/client.js.map +1 -1
  39. package/dist/collections/config/types.d.ts +2 -1
  40. package/dist/collections/config/types.d.ts.map +1 -1
  41. package/dist/collections/config/types.js.map +1 -1
  42. package/dist/config/client.d.ts +2 -1
  43. package/dist/config/client.d.ts.map +1 -1
  44. package/dist/config/client.js +4 -1
  45. package/dist/config/client.js.map +1 -1
  46. package/dist/config/types.d.ts +2 -2
  47. package/dist/config/types.d.ts.map +1 -1
  48. package/dist/config/types.js.map +1 -1
  49. package/dist/database/types.d.ts +29 -16
  50. package/dist/database/types.d.ts.map +1 -1
  51. package/dist/database/types.js.map +1 -1
  52. package/dist/fields/config/client.d.ts.map +1 -1
  53. package/dist/fields/config/client.js +14 -10
  54. package/dist/fields/config/client.js.map +1 -1
  55. package/dist/globals/config/client.js +1 -1
  56. package/dist/globals/config/client.js.map +1 -1
  57. package/dist/globals/config/types.d.ts +2 -1
  58. package/dist/globals/config/types.d.ts.map +1 -1
  59. package/dist/globals/config/types.js.map +1 -1
  60. package/dist/index.d.ts +8 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +1 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/preferences/preferencesCollection.d.ts.map +1 -1
  65. package/dist/preferences/preferencesCollection.js +5 -2
  66. package/dist/preferences/preferencesCollection.js.map +1 -1
  67. package/dist/utilities/deepCopyObject.d.ts +1 -1
  68. package/dist/utilities/deepCopyObject.d.ts.map +1 -1
  69. package/dist/utilities/deepCopyObject.js +6 -3
  70. package/dist/utilities/deepCopyObject.js.map +1 -1
  71. package/dist/utilities/deepMerge.d.ts +1 -1
  72. package/dist/utilities/deepMerge.d.ts.map +1 -1
  73. package/dist/utilities/deepMerge.js +3 -2
  74. package/dist/utilities/deepMerge.js.map +1 -1
  75. package/dist/utilities/getEntityPolicies.d.ts.map +1 -1
  76. package/dist/utilities/getEntityPolicies.js +5 -1
  77. package/dist/utilities/getEntityPolicies.js.map +1 -1
  78. package/dist/utilities/removeUndefined.d.ts +2 -0
  79. package/dist/utilities/removeUndefined.d.ts.map +1 -0
  80. package/dist/utilities/removeUndefined.js +5 -0
  81. package/dist/utilities/removeUndefined.js.map +1 -0
  82. package/dist/utilities/sanitizePermissions.d.ts +14 -0
  83. package/dist/utilities/sanitizePermissions.d.ts.map +1 -0
  84. package/dist/utilities/sanitizePermissions.js +153 -0
  85. package/dist/utilities/sanitizePermissions.js.map +1 -0
  86. package/dist/utilities/sanitizePermissions.spec.js +428 -0
  87. package/dist/utilities/sanitizePermissions.spec.js.map +1 -0
  88. package/dist/utilities/traverseFields.d.ts +3 -1
  89. package/dist/utilities/traverseFields.d.ts.map +1 -1
  90. package/dist/utilities/traverseFields.js +67 -27
  91. package/dist/utilities/traverseFields.js.map +1 -1
  92. 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'\n\nimport { spawn } from 'child_process'\nimport crypto from 'crypto'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\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 { ImportMap } from './bin/generateImportMap/index.js'\nimport type {\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n SelectFromCollectionSlug,\n TypeWithID,\n} from './collections/config/types.js'\nexport type { FieldState } from './admin/forms/Form.js'\nexport type * from './admin/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 { 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 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 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\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: {\n [slug: string]: Collection\n } = {}\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 await 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 (['array', 'blocks'].includes(field.type)) {\n next()\n return\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 = global._payload\n\nif (!cached) {\n cached = global._payload = { payload: null, promise: null }\n}\n\nexport const getPayload = async (options: InitOptions): Promise<BasePayload> => {\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 return cached.payload\n }\n\n if (!cached.promise) {\n cached.promise = new BasePayload().init(options)\n }\n\n try {\n cached.payload = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\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'\nexport type {\n AuthStrategyFunction,\n AuthStrategyFunctionArgs,\n CollectionPermission,\n DocumentPermissions,\n FieldPermissions,\n GlobalPermission,\n IncomingAuthType,\n Permission,\n Permissions,\n User,\n VerifyConfig,\n} from './auth/types.js'\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 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 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'\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 { 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","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","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","getPayload","e","default","executeAccess","executeAuthStrategies","getAccessResults","getFieldsToSign","accessOperation","forgotPasswordOperation","initOperation","loginOperation","logoutOperation","meOperation","refreshOperation","registerFirstUserOperation","resetPasswordOperation","unlockOperation","verifyEmailOperation","generateImportMap","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","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","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":"AAIA,SAASA,KAAK,QAAQ,gBAAe;AACrC,OAAOC,YAAY,SAAQ;AAC3B,SAASC,aAA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AwC;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'\n\nimport { spawn } from 'child_process'\nimport crypto from 'crypto'\nimport { fileURLToPath } from 'node:url'\nimport path from 'path'\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 { ImportMap } from './bin/generateImportMap/index.js'\nimport type {\n BulkOperationResult,\n Collection,\n DataFromCollectionSlug,\n SelectFromCollectionSlug,\n TypeWithID,\n} from './collections/config/types.js'\nexport type { FieldState } from './admin/forms/Form.js'\nexport type * from './admin/types.js'\nimport type { NonNever } from 'ts-essentials'\n\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 { 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 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: {\n [slug: CollectionSlug]: Collection\n } = {}\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 await 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 (['array', 'blocks'].includes(field.type)) {\n next()\n return\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 = global._payload\n\nif (!cached) {\n cached = global._payload = { payload: null, promise: null }\n}\n\nexport const getPayload = async (options: InitOptions): Promise<BasePayload> => {\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 return cached.payload\n }\n\n if (!cached.promise) {\n cached.promise = new BasePayload().init(options)\n }\n\n try {\n cached.payload = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\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 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 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'\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 { 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 { recursivelySanitizePermissions as sanitizePermissions } from './utilities/sanitizePermissions.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","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","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","getPayload","e","default","executeAccess","executeAuthStrategies","getAccessResults","getFieldsToSign","accessOperation","forgotPasswordOperation","initOperation","loginOperation","logoutOperation","meOperation","refreshOperation","registerFirstUserOperation","resetPasswordOperation","unlockOperation","verifyEmailOperation","generateImportMap","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","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","flattenTopLevelFields","formatErrors","formatLabels","formatNames","toWords","getCollectionIDFieldTypes","getObjectDotNotation","initTransaction","isEntityHidden","isolateObjectProperty","isPlainObject","isValidID","killTransaction","mapAsync","sanitizeFallbackLocale","recursivelySanitizePermissions","sanitizePermissions","buildVersionCollectionFields","buildVersionGlobalFields","versionDefaults","deleteCollectionVersions","enforceMaxVersions","getLatestCollectionVersion","getLatestGlobalVersion","saveVersion","deepMergeSimple"],"mappings":"AAIA,SAASA,KAAK,QAAQ,gBAAe;AACrC,OAAOC,YAAY,SAAQ;AAC3B,SAASC,aAAa,QAAQ,WAAU;AACxC,OAAOC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,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,"file":"preferencesCollection.d.ts","sourceRoot":"","sources":["../../src/preferences/preferencesCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAYxD,QAAA,MAAM,wBAAwB,WAAY,MAAM,KAAG,gBA4DjD,CAAA;AAEF,eAAe,wBAAwB,CAAA"}
1
+ {"version":3,"file":"preferencesCollection.d.ts","sourceRoot":"","sources":["../../src/preferences/preferencesCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAgBxD,QAAA,MAAM,wBAAwB,WAAY,MAAM,KAAG,gBA4DjD,CAAA;AAEF,eAAe,wBAAwB,CAAA"}
@@ -1,11 +1,14 @@
1
1
  import { deleteHandler } from './requestHandlers/delete.js';
2
2
  import { findByIDHandler } from './requestHandlers/findOne.js';
3
3
  import { updateHandler } from './requestHandlers/update.js';
4
- const preferenceAccess = ({ req })=>({
4
+ const preferenceAccess = ({ req })=>{
5
+ if (!req.user) return false;
6
+ return {
5
7
  'user.value': {
6
8
  equals: req?.user?.id
7
9
  }
8
- });
10
+ };
11
+ };
9
12
  const getPreferencesCollection = (config)=>({
10
13
  slug: 'payload-preferences',
11
14
  access: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/preferences/preferencesCollection.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Access, Config } from '../config/types.js'\n\nimport { deleteHandler } from './requestHandlers/delete.js'\nimport { findByIDHandler } from './requestHandlers/findOne.js'\nimport { updateHandler } from './requestHandlers/update.js'\n\nconst preferenceAccess: Access = ({ req }) => ({\n 'user.value': {\n equals: req?.user?.id,\n },\n})\n\nconst getPreferencesCollection = (config: Config): CollectionConfig => ({\n slug: 'payload-preferences',\n access: {\n delete: preferenceAccess,\n read: preferenceAccess,\n },\n admin: {\n hidden: true,\n },\n endpoints: [\n {\n handler: findByIDHandler,\n method: 'get',\n path: '/:key',\n },\n {\n handler: deleteHandler,\n method: 'delete',\n path: '/:key',\n },\n {\n handler: updateHandler,\n method: 'post',\n path: '/:key',\n },\n ],\n fields: [\n {\n name: 'user',\n type: 'relationship',\n hooks: {\n beforeValidate: [\n ({ req }) => {\n if (!req?.user) {\n return null\n }\n return {\n relationTo: req?.user.collection,\n value: req?.user.id,\n }\n },\n ],\n },\n index: true,\n relationTo: config.collections\n .filter((collectionConfig) => collectionConfig.auth)\n .map((collectionConfig) => collectionConfig.slug),\n required: true,\n },\n {\n name: 'key',\n type: 'text',\n index: true,\n },\n {\n name: 'value',\n type: 'json',\n },\n ],\n lockDocuments: false,\n})\n\nexport default getPreferencesCollection\n"],"names":["deleteHandler","findByIDHandler","updateHandler","preferenceAccess","req","equals","user","id","getPreferencesCollection","config","slug","access","delete","read","admin","hidden","endpoints","handler","method","path","fields","name","type","hooks","beforeValidate","relationTo","collection","value","index","collections","filter","collectionConfig","auth","map","required","lockDocuments"],"mappings":"AAGA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,aAAa,QAAQ,8BAA6B;AAE3D,MAAMC,mBAA2B,CAAC,EAAEC,GAAG,EAAE,GAAM,CAAA;QAC7C,cAAc;YACZC,QAAQD,KAAKE,MAAMC;QACrB;IACF,CAAA;AAEA,MAAMC,2BAA2B,CAACC,SAAsC,CAAA;QACtEC,MAAM;QACNC,QAAQ;YACNC,QAAQT;YACRU,MAAMV;QACR;QACAW,OAAO;YACLC,QAAQ;QACV;QACAC,WAAW;YACT;gBACEC,SAAShB;gBACTiB,QAAQ;gBACRC,MAAM;YACR;YACA;gBACEF,SAASjB;gBACTkB,QAAQ;gBACRC,MAAM;YACR;YACA;gBACEF,SAASf;gBACTgB,QAAQ;gBACRC,MAAM;YACR;SACD;QACDC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBACLC,gBAAgB;wBACd,CAAC,EAAEpB,GAAG,EAAE;4BACN,IAAI,CAACA,KAAKE,MAAM;gCACd,OAAO;4BACT;4BACA,OAAO;gCACLmB,YAAYrB,KAAKE,KAAKoB;gCACtBC,OAAOvB,KAAKE,KAAKC;4BACnB;wBACF;qBACD;gBACH;gBACAqB,OAAO;gBACPH,YAAYhB,OAAOoB,WAAW,CAC3BC,MAAM,CAAC,CAACC,mBAAqBA,iBAAiBC,IAAI,EAClDC,GAAG,CAAC,CAACF,mBAAqBA,iBAAiBrB,IAAI;gBAClDwB,UAAU;YACZ;YACA;gBACEb,MAAM;gBACNC,MAAM;gBACNM,OAAO;YACT;YACA;gBACEP,MAAM;gBACNC,MAAM;YACR;SACD;QACDa,eAAe;IACjB,CAAA;AAEA,eAAe3B,yBAAwB"}
1
+ {"version":3,"sources":["../../src/preferences/preferencesCollection.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Access, Config } from '../config/types.js'\n\nimport { deleteHandler } from './requestHandlers/delete.js'\nimport { findByIDHandler } from './requestHandlers/findOne.js'\nimport { updateHandler } from './requestHandlers/update.js'\n\nconst preferenceAccess: Access = ({ req }) => {\n if (!req.user) return false\n\n return {\n 'user.value': {\n equals: req?.user?.id,\n },\n }\n}\n\nconst getPreferencesCollection = (config: Config): CollectionConfig => ({\n slug: 'payload-preferences',\n access: {\n delete: preferenceAccess,\n read: preferenceAccess,\n },\n admin: {\n hidden: true,\n },\n endpoints: [\n {\n handler: findByIDHandler,\n method: 'get',\n path: '/:key',\n },\n {\n handler: deleteHandler,\n method: 'delete',\n path: '/:key',\n },\n {\n handler: updateHandler,\n method: 'post',\n path: '/:key',\n },\n ],\n fields: [\n {\n name: 'user',\n type: 'relationship',\n hooks: {\n beforeValidate: [\n ({ req }) => {\n if (!req?.user) {\n return null\n }\n return {\n relationTo: req?.user.collection,\n value: req?.user.id,\n }\n },\n ],\n },\n index: true,\n relationTo: config.collections\n .filter((collectionConfig) => collectionConfig.auth)\n .map((collectionConfig) => collectionConfig.slug),\n required: true,\n },\n {\n name: 'key',\n type: 'text',\n index: true,\n },\n {\n name: 'value',\n type: 'json',\n },\n ],\n lockDocuments: false,\n})\n\nexport default getPreferencesCollection\n"],"names":["deleteHandler","findByIDHandler","updateHandler","preferenceAccess","req","user","equals","id","getPreferencesCollection","config","slug","access","delete","read","admin","hidden","endpoints","handler","method","path","fields","name","type","hooks","beforeValidate","relationTo","collection","value","index","collections","filter","collectionConfig","auth","map","required","lockDocuments"],"mappings":"AAGA,SAASA,aAAa,QAAQ,8BAA6B;AAC3D,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,aAAa,QAAQ,8BAA6B;AAE3D,MAAMC,mBAA2B,CAAC,EAAEC,GAAG,EAAE;IACvC,IAAI,CAACA,IAAIC,IAAI,EAAE,OAAO;IAEtB,OAAO;QACL,cAAc;YACZC,QAAQF,KAAKC,MAAME;QACrB;IACF;AACF;AAEA,MAAMC,2BAA2B,CAACC,SAAsC,CAAA;QACtEC,MAAM;QACNC,QAAQ;YACNC,QAAQT;YACRU,MAAMV;QACR;QACAW,OAAO;YACLC,QAAQ;QACV;QACAC,WAAW;YACT;gBACEC,SAAShB;gBACTiB,QAAQ;gBACRC,MAAM;YACR;YACA;gBACEF,SAASjB;gBACTkB,QAAQ;gBACRC,MAAM;YACR;YACA;gBACEF,SAASf;gBACTgB,QAAQ;gBACRC,MAAM;YACR;SACD;QACDC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBACLC,gBAAgB;wBACd,CAAC,EAAEpB,GAAG,EAAE;4BACN,IAAI,CAACA,KAAKC,MAAM;gCACd,OAAO;4BACT;4BACA,OAAO;gCACLoB,YAAYrB,KAAKC,KAAKqB;gCACtBC,OAAOvB,KAAKC,KAAKE;4BACnB;wBACF;qBACD;gBACH;gBACAqB,OAAO;gBACPH,YAAYhB,OAAOoB,WAAW,CAC3BC,MAAM,CAAC,CAACC,mBAAqBA,iBAAiBC,IAAI,EAClDC,GAAG,CAAC,CAACF,mBAAqBA,iBAAiBrB,IAAI;gBAClDwB,UAAU;YACZ;YACA;gBACEb,MAAM;gBACNC,MAAM;gBACNM,OAAO;YACT;YACA;gBACEP,MAAM;gBACNC,MAAM;YACR;SACD;QACDa,eAAe;IACjB,CAAA;AAEA,eAAe3B,yBAAwB"}
@@ -10,7 +10,7 @@ export declare const deepCopyObject: <T>(o: T) => T;
10
10
  * `Set`, `Buffer`, ... are not allowed.
11
11
  * @returns The cloned JSON value.
12
12
  */
13
- export declare function deepCopyObjectSimple<T extends JsonValue>(value: T): T;
13
+ export declare function deepCopyObjectSimple<T extends JsonValue>(value: T, filterUndefined?: boolean): T;
14
14
  export declare function deepCopyObjectSimpleWithoutReactComponents<T extends JsonValue>(value: T): T;
15
15
  /**
16
16
  * A deepCopyObject implementation which is slower than deepCopyObject, but more correct.
@@ -1 +1 @@
1
- {"version":3,"file":"deepCopyObject.d.ts","sourceRoot":"","sources":["../../src/utilities/deepCopyObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAuDlD,eAAO,MAAM,cAAc,GAAI,CAAC,KAAK,CAAC,KAAG,CA2BxC,CAAA;AAQD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAkBrE;AAED,wBAAgB,0CAA0C,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CA4B3F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAiB,GAAG,CAAC,CAqE/F"}
1
+ {"version":3,"file":"deepCopyObject.d.ts","sourceRoot":"","sources":["../../src/utilities/deepCopyObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAuDlD,eAAO,MAAM,cAAc,GAAI,CAAC,KAAK,CAAC,KAAG,CA2BxC,CAAA;AAQD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,UAAQ,GAAG,CAAC,CAwB9F;AAED,wBAAgB,0CAA0C,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CA4B3F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAiB,GAAG,CAAC,CAqE/F"}
@@ -86,11 +86,11 @@ Benchmark: https://github.com/AlessioGr/fastest-deep-clone-json/blob/main/test/b
86
86
  * design. 2) It must contain JSON values only. Other values like `Date`, `Regexp`, `Map`,
87
87
  * `Set`, `Buffer`, ... are not allowed.
88
88
  * @returns The cloned JSON value.
89
- */ export function deepCopyObjectSimple(value) {
89
+ */ export function deepCopyObjectSimple(value, filterUndefined = false) {
90
90
  if (typeof value !== 'object' || value === null) {
91
91
  return value;
92
92
  } else if (Array.isArray(value)) {
93
- return value.map((e)=>typeof e !== 'object' || e === null ? e : deepCopyObjectSimple(e));
93
+ return value.map((e)=>typeof e !== 'object' || e === null ? e : deepCopyObjectSimple(e, filterUndefined));
94
94
  } else {
95
95
  if (value instanceof Date) {
96
96
  return new Date(value);
@@ -98,7 +98,10 @@ Benchmark: https://github.com/AlessioGr/fastest-deep-clone-json/blob/main/test/b
98
98
  const ret = {};
99
99
  for(const k in value){
100
100
  const v = value[k];
101
- ret[k] = typeof v !== 'object' || v === null ? v : deepCopyObjectSimple(v);
101
+ if (filterUndefined && v === undefined) {
102
+ continue;
103
+ }
104
+ ret[k] = typeof v !== 'object' || v === null ? v : deepCopyObjectSimple(v, filterUndefined);
102
105
  }
103
106
  return ret;
104
107
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/deepCopyObject.ts"],"sourcesContent":["import type { JsonValue } from '../types/index.js'\n\n/*\nMain deepCopyObject handling - from rfdc: https://github.com/davidmarkclements/rfdc/blob/master/index.js\n\nCopyright 2019 \"David Mark Clements <david.mark.clements@gmail.com>\"\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\nto permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\nCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n*/\n\nfunction copyBuffer(cur) {\n if (cur instanceof Buffer) {\n return Buffer.from(cur)\n }\n\n return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length)\n}\n\nconst constructorHandlers = new Map()\nconstructorHandlers.set(Date, (o) => new Date(o))\nconstructorHandlers.set(Map, (o, fn) => new Map(cloneArray<any>(Array.from(o), fn)))\nconstructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)))\nlet handler = null\n\nfunction cloneArray<T>(a: T, fn): T {\n const keys = Object.keys(a)\n const a2 = new Array(keys.length)\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]\n const cur = a[k]\n if (typeof cur !== 'object' || cur === null) {\n a2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n a2[k] = handler(cur, fn)\n } else if (ArrayBuffer.isView(cur)) {\n a2[k] = copyBuffer(cur)\n } else {\n a2[k] = fn(cur)\n }\n }\n return a2 as T\n}\n\nexport const deepCopyObject = <T>(o: T): T => {\n if (typeof o !== 'object' || o === null) {\n return o\n }\n if (Array.isArray(o)) {\n return cloneArray(o, deepCopyObject)\n }\n if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {\n return handler(o, deepCopyObject)\n }\n const o2 = {}\n for (const k in o) {\n if (Object.hasOwnProperty.call(o, k) === false) {\n continue\n }\n const cur = o[k]\n if (typeof cur !== 'object' || cur === null) {\n o2[k as string] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n o2[k as string] = handler(cur, deepCopyObject)\n } else if (ArrayBuffer.isView(cur)) {\n o2[k as string] = copyBuffer(cur)\n } else {\n o2[k as string] = deepCopyObject(cur)\n }\n }\n return o2 as T\n}\n\n/*\nFast deepCopyObjectSimple handling - from fast-json-clone: https://github.com/rhysd/fast-json-clone\n\nBenchmark: https://github.com/AlessioGr/fastest-deep-clone-json/blob/main/test/benchmark.js\n*/\n\n/**\n * A deepCopyObject implementation which only works for JSON objects and arrays, and is faster than\n * JSON.parse(JSON.stringify(obj))\n *\n * @param value The JSON value to be cloned. There are two invariants. 1) It must not contain circles\n * as JSON does not allow it. This function will cause infinite loop for such values by\n * design. 2) It must contain JSON values only. Other values like `Date`, `Regexp`, `Map`,\n * `Set`, `Buffer`, ... are not allowed.\n * @returns The cloned JSON value.\n */\nexport function deepCopyObjectSimple<T extends JsonValue>(value: T): T {\n if (typeof value !== 'object' || value === null) {\n return value\n } else if (Array.isArray(value)) {\n return value.map((e) =>\n typeof e !== 'object' || e === null ? e : deepCopyObjectSimple(e),\n ) as T\n } else {\n if (value instanceof Date) {\n return new Date(value) as unknown as T\n }\n const ret: { [key: string]: T } = {}\n for (const k in value) {\n const v = value[k]\n ret[k] = typeof v !== 'object' || v === null ? v : (deepCopyObjectSimple(v as T) as any)\n }\n return ret as unknown as T\n }\n}\n\nexport function deepCopyObjectSimpleWithoutReactComponents<T extends JsonValue>(value: T): T {\n if (\n typeof value === 'object' &&\n value !== null &&\n '$$typeof' in value &&\n typeof value.$$typeof === 'symbol'\n ) {\n return undefined\n } else if (typeof value !== 'object' || value === null) {\n return value\n } else if (Array.isArray(value)) {\n return value.map((e) =>\n typeof e !== 'object' || e === null ? e : deepCopyObjectSimpleWithoutReactComponents(e),\n ) as T\n } else {\n if (value instanceof Date) {\n return new Date(value) as unknown as T\n }\n const ret: { [key: string]: T } = {}\n for (const k in value) {\n const v = value[k]\n ret[k] =\n typeof v !== 'object' || v === null\n ? v\n : (deepCopyObjectSimpleWithoutReactComponents(v as T) as any)\n }\n return ret as unknown as T\n }\n}\n\n/**\n * A deepCopyObject implementation which is slower than deepCopyObject, but more correct.\n * Can be used if correctness is more important than speed. Supports circular dependencies\n */\nexport function deepCopyObjectComplex<T>(object: T, cache: WeakMap<any, any> = new WeakMap()): T {\n if (object === null) {\n return null\n }\n\n if (cache.has(object)) {\n return cache.get(object)\n }\n\n // Handle File\n if (object instanceof File) {\n return object as unknown as T\n }\n\n // Handle Date\n if (object instanceof Date) {\n return new Date(object.getTime()) as unknown as T\n }\n\n // Handle RegExp\n if (object instanceof RegExp) {\n return new RegExp(object.source, object.flags) as unknown as T\n }\n\n // Handle Map\n if (object instanceof Map) {\n const clonedMap = new Map()\n cache.set(object, clonedMap)\n for (const [key, value] of object.entries()) {\n clonedMap.set(key, deepCopyObjectComplex(value, cache))\n }\n return clonedMap as unknown as T\n }\n\n // Handle Set\n if (object instanceof Set) {\n const clonedSet = new Set()\n cache.set(object, clonedSet)\n for (const value of object.values()) {\n clonedSet.add(deepCopyObjectComplex(value, cache))\n }\n return clonedSet as unknown as T\n }\n\n // Handle Array and Object\n if (typeof object === 'object' && object !== null) {\n if ('$$typeof' in object && typeof object.$$typeof === 'symbol') {\n return object\n }\n\n const clonedObject: any = Array.isArray(object)\n ? []\n : Object.create(Object.getPrototypeOf(object))\n cache.set(object, clonedObject)\n\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) ||\n Object.getOwnPropertySymbols(object).includes(key as any)\n ) {\n clonedObject[key] = deepCopyObjectComplex(object[key], cache)\n }\n }\n\n return clonedObject as T\n }\n\n // Handle all other cases\n return object\n}\n"],"names":["copyBuffer","cur","Buffer","from","constructor","buffer","slice","byteOffset","length","constructorHandlers","Map","set","Date","o","fn","cloneArray","Array","Set","handler","a","keys","Object","a2","i","k","get","ArrayBuffer","isView","deepCopyObject","isArray","o2","hasOwnProperty","call","deepCopyObjectSimple","value","map","e","ret","v","deepCopyObjectSimpleWithoutReactComponents","$$typeof","undefined","deepCopyObjectComplex","object","cache","WeakMap","has","File","getTime","RegExp","source","flags","clonedMap","key","entries","clonedSet","values","add","clonedObject","create","getPrototypeOf","prototype","getOwnPropertySymbols","includes"],"mappings":"AAEA;;;;;;;;;;;;;;;;;;AAkBA,GAEA,SAASA,WAAWC,GAAG;IACrB,IAAIA,eAAeC,QAAQ;QACzB,OAAOA,OAAOC,IAAI,CAACF;IACrB;IAEA,OAAO,IAAIA,IAAIG,WAAW,CAACH,IAAII,MAAM,CAACC,KAAK,IAAIL,IAAIM,UAAU,EAAEN,IAAIO,MAAM;AAC3E;AAEA,MAAMC,sBAAsB,IAAIC;AAChCD,oBAAoBE,GAAG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C0C,KAAKX,sBAAsBR,OAAOU;QAClD;QACA,OAAOQ;IACT;IAEA,aAAa;IACb,IAAIT,kBAAkB1B,KAAK;QACzB,MAAMsC,YAAY,IAAItC;QACtB2B,MAAMjC,GAAG,CAACgC,QAAQY;QAClB,KAAK,MAAMrB,SAASS,OAAOa,MAAM,GAAI;YACnCD,UAAUE,GAAG,CAACf,sBAAsBR,OAAOU;QAC7C;QACA,OAAOW;IACT;IAEA,0BAA0B;IAC1B,IAAI,OAAOZ,WAAW,YAAYA,WAAW,MAAM;QACjD,IAAI,cAAcA,UAAU,OAAOA,OAAOH,QAAQ,KAAK,UAAU;YAC/D,OAAOG;QACT;QAEA,MAAMe,eAAoB1C,MAAMa,OAAO,CAACc,UACpC,EAAE,GACFtB,OAAOsC,MAAM,CAACtC,OAAOuC,cAAc,CAACjB;QACxCC,MAAMjC,GAAG,CAACgC,QAAQe;QAElB,IAAK,MAAML,OAAOV,OAAQ;YACxB,IACEtB,OAAOwC,SAAS,CAAC9B,cAAc,CAACC,IAAI,CAACW,QAAQU,QAC7ChC,OAAOyC,qBAAqB,CAACnB,QAAQoB,QAAQ,CAACV,MAC9C;gBACAK,YAAY,CAACL,IAAI,GAAGX,sBAAsBC,MAAM,CAACU,IAAI,EAAET;YACzD;QACF;QAEA,OAAOc;IACT;IAEA,yBAAyB;IACzB,OAAOf;AACT"}
1
+ {"version":3,"sources":["../../src/utilities/deepCopyObject.ts"],"sourcesContent":["import type { JsonValue } from '../types/index.js'\n\n/*\nMain deepCopyObject handling - from rfdc: https://github.com/davidmarkclements/rfdc/blob/master/index.js\n\nCopyright 2019 \"David Mark Clements <david.mark.clements@gmail.com>\"\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and\nto permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions\nof the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED\nTO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF\nCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n*/\n\nfunction copyBuffer(cur) {\n if (cur instanceof Buffer) {\n return Buffer.from(cur)\n }\n\n return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length)\n}\n\nconst constructorHandlers = new Map()\nconstructorHandlers.set(Date, (o) => new Date(o))\nconstructorHandlers.set(Map, (o, fn) => new Map(cloneArray<any>(Array.from(o), fn)))\nconstructorHandlers.set(Set, (o, fn) => new Set(cloneArray(Array.from(o), fn)))\nlet handler = null\n\nfunction cloneArray<T>(a: T, fn): T {\n const keys = Object.keys(a)\n const a2 = new Array(keys.length)\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]\n const cur = a[k]\n if (typeof cur !== 'object' || cur === null) {\n a2[k] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n a2[k] = handler(cur, fn)\n } else if (ArrayBuffer.isView(cur)) {\n a2[k] = copyBuffer(cur)\n } else {\n a2[k] = fn(cur)\n }\n }\n return a2 as T\n}\n\nexport const deepCopyObject = <T>(o: T): T => {\n if (typeof o !== 'object' || o === null) {\n return o\n }\n if (Array.isArray(o)) {\n return cloneArray(o, deepCopyObject)\n }\n if (o.constructor !== Object && (handler = constructorHandlers.get(o.constructor))) {\n return handler(o, deepCopyObject)\n }\n const o2 = {}\n for (const k in o) {\n if (Object.hasOwnProperty.call(o, k) === false) {\n continue\n }\n const cur = o[k]\n if (typeof cur !== 'object' || cur === null) {\n o2[k as string] = cur\n } else if (cur.constructor !== Object && (handler = constructorHandlers.get(cur.constructor))) {\n o2[k as string] = handler(cur, deepCopyObject)\n } else if (ArrayBuffer.isView(cur)) {\n o2[k as string] = copyBuffer(cur)\n } else {\n o2[k as string] = deepCopyObject(cur)\n }\n }\n return o2 as T\n}\n\n/*\nFast deepCopyObjectSimple handling - from fast-json-clone: https://github.com/rhysd/fast-json-clone\n\nBenchmark: https://github.com/AlessioGr/fastest-deep-clone-json/blob/main/test/benchmark.js\n*/\n\n/**\n * A deepCopyObject implementation which only works for JSON objects and arrays, and is faster than\n * JSON.parse(JSON.stringify(obj))\n *\n * @param value The JSON value to be cloned. There are two invariants. 1) It must not contain circles\n * as JSON does not allow it. This function will cause infinite loop for such values by\n * design. 2) It must contain JSON values only. Other values like `Date`, `Regexp`, `Map`,\n * `Set`, `Buffer`, ... are not allowed.\n * @returns The cloned JSON value.\n */\nexport function deepCopyObjectSimple<T extends JsonValue>(value: T, filterUndefined = false): T {\n if (typeof value !== 'object' || value === null) {\n return value\n } else if (Array.isArray(value)) {\n return value.map((e) =>\n typeof e !== 'object' || e === null ? e : deepCopyObjectSimple(e, filterUndefined),\n ) as T\n } else {\n if (value instanceof Date) {\n return new Date(value) as unknown as T\n }\n const ret: { [key: string]: T } = {}\n for (const k in value) {\n const v = value[k]\n if (filterUndefined && v === undefined) {\n continue\n }\n ret[k] =\n typeof v !== 'object' || v === null\n ? v\n : (deepCopyObjectSimple(v as T, filterUndefined) as any)\n }\n return ret as unknown as T\n }\n}\n\nexport function deepCopyObjectSimpleWithoutReactComponents<T extends JsonValue>(value: T): T {\n if (\n typeof value === 'object' &&\n value !== null &&\n '$$typeof' in value &&\n typeof value.$$typeof === 'symbol'\n ) {\n return undefined\n } else if (typeof value !== 'object' || value === null) {\n return value\n } else if (Array.isArray(value)) {\n return value.map((e) =>\n typeof e !== 'object' || e === null ? e : deepCopyObjectSimpleWithoutReactComponents(e),\n ) as T\n } else {\n if (value instanceof Date) {\n return new Date(value) as unknown as T\n }\n const ret: { [key: string]: T } = {}\n for (const k in value) {\n const v = value[k]\n ret[k] =\n typeof v !== 'object' || v === null\n ? v\n : (deepCopyObjectSimpleWithoutReactComponents(v as T) as any)\n }\n return ret as unknown as T\n }\n}\n\n/**\n * A deepCopyObject implementation which is slower than deepCopyObject, but more correct.\n * Can be used if correctness is more important than speed. Supports circular dependencies\n */\nexport function deepCopyObjectComplex<T>(object: T, cache: WeakMap<any, any> = new WeakMap()): T {\n if (object === null) {\n return null\n }\n\n if (cache.has(object)) {\n return cache.get(object)\n }\n\n // Handle File\n if (object instanceof File) {\n return object as unknown as T\n }\n\n // Handle Date\n if (object instanceof Date) {\n return new Date(object.getTime()) as unknown as T\n }\n\n // Handle RegExp\n if (object instanceof RegExp) {\n return new RegExp(object.source, object.flags) as unknown as T\n }\n\n // Handle Map\n if (object instanceof Map) {\n const clonedMap = new Map()\n cache.set(object, clonedMap)\n for (const [key, value] of object.entries()) {\n clonedMap.set(key, deepCopyObjectComplex(value, cache))\n }\n return clonedMap as unknown as T\n }\n\n // Handle Set\n if (object instanceof Set) {\n const clonedSet = new Set()\n cache.set(object, clonedSet)\n for (const value of object.values()) {\n clonedSet.add(deepCopyObjectComplex(value, cache))\n }\n return clonedSet as unknown as T\n }\n\n // Handle Array and Object\n if (typeof object === 'object' && object !== null) {\n if ('$$typeof' in object && typeof object.$$typeof === 'symbol') {\n return object\n }\n\n const clonedObject: any = Array.isArray(object)\n ? []\n : Object.create(Object.getPrototypeOf(object))\n cache.set(object, clonedObject)\n\n for (const key in object) {\n if (\n Object.prototype.hasOwnProperty.call(object, key) ||\n Object.getOwnPropertySymbols(object).includes(key as any)\n ) {\n clonedObject[key] = deepCopyObjectComplex(object[key], cache)\n }\n }\n\n return clonedObject as T\n }\n\n // Handle all other cases\n return object\n}\n"],"names":["copyBuffer","cur","Buffer","from","constructor","buffer","slice","byteOffset","length","constructorHandlers","Map","set","Date","o","fn","cloneArray","Array","Set","handler","a","keys","Object","a2","i","k","get","ArrayBuffer","isView","deepCopyObject","isArray","o2","hasOwnProperty","call","deepCopyObjectSimple","value","filterUndefined","map","e","ret","v","undefined","deepCopyObjectSimpleWithoutReactComponents","$$typeof","deepCopyObjectComplex","object","cache","WeakMap","has","File","getTime","RegExp","source","flags","clonedMap","key","entries","clonedSet","values","add","clonedObject","create","getPrototypeOf","prototype","getOwnPropertySymbols","includes"],"mappings":"AAEA;;;;;;;;;;;;;;;;;;AAkBA,GAEA,SAASA,WAAWC,GAAG;IACrB,IAAIA,eAAeC,QAAQ;QACzB,OAAOA,OAAOC,IAAI,CAACF;IACrB;IAEA,OAAO,IAAIA,IAAIG,WAAW,CAACH,IAAII,MAAM,CAACC,KAAK,IAAIL,IAAIM,UAAU,EAAEN,IAAIO,MAAM;AAC3E;AAEA,MAAMC,sBAAsB,IAAIC;AAChCD,oBAAoBE,GAAG,CAACC,MAAM,CAACC,IAAM,IAAID,KAAKC;AAC9CJ,oBAAoBE,GAAG,CAACD,KAAK,CAACG,GAAGC,KAAO,IAAIJ,IAAIK,WAAgBC,MAAMb,IAAI,CAACU,IAAIC;AAC/EL,oBAAoBE,GAAG,CAACM,KAAK,CAACJ,GAAGC,KAAO,IAAIG,IAAIF,WAAWC,MAAMb,IAAI,CAACU,IAAIC;AAC1E,IAAII,UAAU;AAEd,SAASH,WAAcI,CAAI,EAAEL,EAAE;IAC7B,MAAMM,OAAOC,OAAOD,IAAI,CAACD;IACzB,MAAMG,KAAK,IAAIN,MAAMI,KAAKZ,MAAM;IAChC,IAAK,IAAIe,IAAI,GAAGA,IAAIH,KAAKZ,MAAM,EAAEe,IAAK;QACpC,MAAMC,IAAIJ,IAAI,CAACG,EAAE;QACjB,MAAMtB,MAAMkB,CAAC,CAACK,EAAE;QAChB,IAAI,OAAOvB,QAAQ,YAAYA,QAAQ,MAAM;YAC3CqB,EAAE,CAACE,EAAE,GAAGvB;QACV,O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B,IAAK,MAAML,OAAOV,OAAQ;YACxB,IACEvB,OAAOyC,SAAS,CAAC/B,cAAc,CAACC,IAAI,CAACY,QAAQU,QAC7CjC,OAAO0C,qBAAqB,CAACnB,QAAQoB,QAAQ,CAACV,MAC9C;gBACAK,YAAY,CAACL,IAAI,GAAGX,sBAAsBC,MAAM,CAACU,IAAI,EAAET;YACzD;QACF;QAEA,OAAOc;IACT;IAEA,yBAAyB;IACzB,OAAOf;AACT"}
@@ -5,7 +5,7 @@ export { deepMerge };
5
5
  *
6
6
  * Array handling: Arrays in the target object are combined with the source object's arrays.
7
7
  */
8
- export declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object): T;
8
+ export declare function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object, options?: deepMerge.Options): T;
9
9
  /**
10
10
  * Fully-featured deepMerge.
11
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAIjC,OAAO,EAAE,SAAS,EAAE,CAAA;AACpB;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAiB3F;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAEzF;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAI5F"}
1
+ {"version":3,"file":"deepMerge.d.ts","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AAIjC,OAAO,EAAE,SAAS,EAAE,CAAA;AACpB;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,SAAS,MAAM,EAC1D,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,SAAS,CAAC,OAAY,GAC9B,CAAC,CAkBH;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAEzF;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAI5F"}
@@ -5,7 +5,7 @@ export { deepMerge };
5
5
  * Fully-featured deepMerge.
6
6
  *
7
7
  * Array handling: Arrays in the target object are combined with the source object's arrays.
8
- */ export function deepMergeWithCombinedArrays(obj1, obj2) {
8
+ */ export function deepMergeWithCombinedArrays(obj1, obj2, options = {}) {
9
9
  return deepMerge(obj1, obj2, {
10
10
  arrayMerge: (target, source, options)=>{
11
11
  const destination = target.slice();
@@ -19,7 +19,8 @@ export { deepMerge };
19
19
  }
20
20
  });
21
21
  return destination;
22
- }
22
+ },
23
+ ...options
23
24
  });
24
25
  }
25
26
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["import deepMerge from 'deepmerge'\n\nimport { isPlainObject } from './isPlainObject.js'\n\nexport { deepMerge }\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are combined with the source object's arrays.\n */\nexport function deepMergeWithCombinedArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n arrayMerge: (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options.isMergeableObject(item)) {\n destination[index] = deepMerge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n },\n })\n}\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are replaced by the source object's arrays.\n */\nexport function deepMergeWithSourceArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, { arrayMerge: (_, source) => source })\n}\n\n/**\n * Fully-featured deepMerge. Does not clone React components by default.\n */\nexport function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n isMergeableObject: isPlainObject,\n })\n}\n"],"names":["deepMerge","isPlainObject","deepMergeWithCombinedArrays","obj1","obj2","arrayMerge","target","source","options","destination","slice","forEach","item","index","cloneUnlessOtherwiseSpecified","isMergeableObject","indexOf","push","deepMergeWithSourceArrays","_","deepMergeWithReactComponents"],"mappings":"AAAA,OAAOA,eAAe,YAAW;AAEjC,SAASC,aAAa,QAAQ,qBAAoB;AAElD,SAASD,SAAS,GAAE;AACpB;;;;CAIC,GACD,OAAO,SAASE,4BAA8CC,IAAY,EAAEC,IAAY;IACtF,OAAOJ,UAAaG,MAAMC,MAAM;QAC9BC,YAAY,CAACC,QAAQC,QAAQC;YAC3B,MAAMC,cAAcH,OAAOI,KAAK;YAEhCH,OAAOI,OAAO,CAAC,CAACC,MAAMC;gBACpB,IAAI,OAAOJ,WAAW,CAACI,MAAM,KAAK,aAAa;oBAC7CJ,WAAW,CAACI,MAAM,GAAGL,QAAQM,6BAA6B,CAACF,MAAMJ;gBACnE,OAAO,IAAIA,QAAQO,iBAAiB,CAACH,OAAO;oBAC1CH,WAAW,CAACI,MAAM,GAAGb,UAAUM,MAAM,CAACO,MAAM,EAAED,MAAMJ;gBACtD,OAAO,IAAIF,OAAOU,OAAO,CAACJ,UAAU,CAAC,GAAG;oBACtCH,YAAYQ,IAAI,CAACL;gBACnB;YACF;YACA,OAAOH;QACT;IACF;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASS,0BAA4Cf,IAAY,EAAEC,IAAY;IACpF,OAAOJ,UAAaG,MAAMC,MAAM;QAAEC,YAAY,CAACc,GAAGZ,SAAWA;IAAO;AACtE;AAEA;;CAEC,GACD,OAAO,SAASa,6BAA+CjB,IAAY,EAAEC,IAAY;IACvF,OAAOJ,UAAaG,MAAMC,MAAM;QAC9BW,mBAAmBd;IACrB;AACF"}
1
+ {"version":3,"sources":["../../src/utilities/deepMerge.ts"],"sourcesContent":["import deepMerge from 'deepmerge'\n\nimport { isPlainObject } from './isPlainObject.js'\n\nexport { deepMerge }\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are combined with the source object's arrays.\n */\nexport function deepMergeWithCombinedArrays<T extends object>(\n obj1: object,\n obj2: object,\n options: deepMerge.Options = {},\n): T {\n return deepMerge<T>(obj1, obj2, {\n arrayMerge: (target, source, options) => {\n const destination = target.slice()\n\n source.forEach((item, index) => {\n if (typeof destination[index] === 'undefined') {\n destination[index] = options.cloneUnlessOtherwiseSpecified(item, options)\n } else if (options.isMergeableObject(item)) {\n destination[index] = deepMerge(target[index], item, options)\n } else if (target.indexOf(item) === -1) {\n destination.push(item)\n }\n })\n return destination\n },\n ...options,\n })\n}\n\n/**\n * Fully-featured deepMerge.\n *\n * Array handling: Arrays in the target object are replaced by the source object's arrays.\n */\nexport function deepMergeWithSourceArrays<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, { arrayMerge: (_, source) => source })\n}\n\n/**\n * Fully-featured deepMerge. Does not clone React components by default.\n */\nexport function deepMergeWithReactComponents<T extends object>(obj1: object, obj2: object): T {\n return deepMerge<T>(obj1, obj2, {\n isMergeableObject: isPlainObject,\n })\n}\n"],"names":["deepMerge","isPlainObject","deepMergeWithCombinedArrays","obj1","obj2","options","arrayMerge","target","source","destination","slice","forEach","item","index","cloneUnlessOtherwiseSpecified","isMergeableObject","indexOf","push","deepMergeWithSourceArrays","_","deepMergeWithReactComponents"],"mappings":"AAAA,OAAOA,eAAe,YAAW;AAEjC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AAQ,GACxD,gBAAgB,GAChB,oBAAoB,CAAA;AAYxB,wBAAsB,iBAAiB,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA6OvF"}
@@ -83,6 +83,10 @@ export async function getEntityPolicies(args) {
83
83
  };
84
84
  const executeFieldPolicies = async ({ entityPermission, fields, operation, policiesObj })=>{
85
85
  const mutablePolicies = policiesObj.fields;
86
+ // Fields don't have all operations of a collection
87
+ if (operation === 'delete' || operation === 'readVersions' || operation === 'unlock') {
88
+ return;
89
+ }
86
90
  await Promise.all(fields.map(async (field)=>{
87
91
  if ('name' in field && field.name) {
88
92
  if (!mutablePolicies[field.name]) {
@@ -112,7 +116,7 @@ export async function getEntityPolicies(args) {
112
116
  policiesObj: mutablePolicies[field.name]
113
117
  });
114
118
  }
115
- if ('blocks' in field && field?.blocks) {
119
+ if ('blocks' in field && field.blocks) {
116
120
  if (!mutablePolicies[field.name]?.blocks) {
117
121
  mutablePolicies[field.name].blocks = {};
118
122
  }