payload 3.0.0-beta.51 → 3.0.0-beta.53

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 (32) hide show
  1. package/dist/collections/config/client.d.ts +29 -29
  2. package/dist/collections/config/defaults.d.ts +5 -5
  3. package/dist/fields/config/client.d.ts +190 -190
  4. package/dist/fields/config/schema.js +4 -4
  5. package/dist/fields/config/schema.js.map +1 -1
  6. package/dist/fields/validations.d.ts +4 -4
  7. package/dist/index.d.ts +121 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +148 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/utilities/dependencies/getDependencies.d.ts +9 -0
  12. package/dist/utilities/dependencies/getDependencies.d.ts.map +1 -0
  13. package/dist/utilities/dependencies/getDependencies.js +54 -0
  14. package/dist/utilities/dependencies/getDependencies.js.map +1 -0
  15. package/dist/utilities/dependencies/isError.d.ts +5 -0
  16. package/dist/utilities/dependencies/isError.d.ts.map +1 -0
  17. package/dist/utilities/dependencies/isError.js +19 -0
  18. package/dist/utilities/dependencies/isError.js.map +1 -0
  19. package/dist/utilities/dependencies/realPath.d.ts +4 -0
  20. package/dist/utilities/dependencies/realPath.d.ts.map +1 -0
  21. package/dist/utilities/dependencies/realPath.js +23 -0
  22. package/dist/utilities/dependencies/realPath.js.map +1 -0
  23. package/dist/utilities/dependencies/resolveFrom.d.ts +2 -0
  24. package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -0
  25. package/dist/utilities/dependencies/resolveFrom.js +58 -0
  26. package/dist/utilities/dependencies/resolveFrom.js.map +1 -0
  27. package/package.json +14 -19
  28. package/bundle.js +0 -75
  29. package/dist/exports/index.d.ts +0 -122
  30. package/dist/exports/index.d.ts.map +0 -1
  31. package/dist/exports/index.js +0 -103
  32. package/dist/exports/index.js.map +0 -1
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 { OperationArgs, Request as graphQLRequest } from 'graphql-http'\nimport type pino 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 { BulkOperationResult, Collection, TypeWithID } from './collections/config/types.js'\nimport type { Options as CountOptions } from './collections/operations/local/count.js'\nimport type { Options as CreateOptions } from './collections/operations/local/create.js'\nimport type {\n ByIDOptions as DeleteByIDOptions,\n ManyOptions as DeleteManyOptions,\n Options as DeleteOptions,\n} from './collections/operations/local/delete.js'\nimport type { Options as DuplicateOptions } from './collections/operations/local/duplicate.js'\nimport type { Options as FindOptions } from './collections/operations/local/find.js'\nimport type { Options as FindByIDOptions } from './collections/operations/local/findByID.js'\nimport type { Options as FindVersionByIDOptions } from './collections/operations/local/findVersionByID.js'\nimport type { Options as FindVersionsOptions } from './collections/operations/local/findVersions.js'\nimport type { Options as RestoreVersionOptions } from './collections/operations/local/restoreVersion.js'\nimport type {\n ByIDOptions as UpdateByIDOptions,\n ManyOptions as UpdateManyOptions,\n Options as UpdateOptions,\n} from './collections/operations/local/update.js'\nimport type { InitOptions, SanitizedConfig } from './config/types.js'\nimport type { BaseDatabaseAdapter, PaginatedDocs } from './database/types.js'\nimport type { InitializedEmailAdapter } from './email/types.js'\nimport type { TypeWithID as GlobalTypeWithID, Globals } from './globals/config/types.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 { 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 localOperations from './collections/operations/local/index.js'\nimport { validateSchema } from './config/validate.js'\nimport { consoleEmailAdapter } from './email/consoleEmailAdapter.js'\nimport { fieldAffectsData } from './fields/config/types.js'\nimport localGlobalOperations from './globals/operations/local/index.js'\nimport flattenFields from './utilities/flattenTopLevelFields.js'\nimport Logger from './utilities/logger.js'\nimport { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\n/**\n * @description Payload\n */\nexport class BasePayload<TGeneratedTypes extends GeneratedTypes> {\n /**\n * @description Authorization and Authentication using headers and cookies to run auth user strategies\n * @returns cookies: Map<string, string>\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: number | string | symbol]: Collection\n } = {}\n\n config: SanitizedConfig\n\n /**\n * @description Performs count operation\n * @param options\n * @returns count of documents satisfying query\n */\n count = async <T extends keyof TGeneratedTypes['collections']>(\n options: CountOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { count } = localOperations\n return count(this, options)\n }\n\n /**\n * @description Performs create operation\n * @param options\n * @returns created document\n */\n create = async <T extends keyof TGeneratedTypes['collections']>(\n options: CreateOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { create } = localOperations\n return create<T>(this, options)\n }\n db: DatabaseAdapter\n\n decrypt = decrypt\n\n duplicate = async <T extends keyof TGeneratedTypes['collections']>(\n options: DuplicateOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { duplicate } = localOperations\n return duplicate<T>(this, options)\n }\n\n email: InitializedEmailAdapter\n\n // TODO: re-implement or remove?\n // errorHandler: ErrorHandler\n\n encrypt = encrypt\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 <T extends keyof TGeneratedTypes['collections']>(\n options: FindOptions<T>,\n ): Promise<PaginatedDocs<TGeneratedTypes['collections'][T]>> => {\n const { find } = localOperations\n return find<T>(this, options)\n }\n\n /**\n * @description Find document by ID\n * @param options\n * @returns document with specified ID\n */\n findByID = async <T extends keyof TGeneratedTypes['collections']>(\n options: FindByIDOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { findByID } = localOperations\n return findByID<T>(this, options)\n }\n\n findGlobal = async <T extends keyof TGeneratedTypes['globals']>(\n options: FindGlobalOptions<T>,\n ): Promise<TGeneratedTypes['globals'][T]> => {\n const { findOne } = localGlobalOperations\n return findOne<T>(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 <T extends keyof TGeneratedTypes['globals']>(\n options: FindGlobalVersionByIDOptions<T>,\n ): Promise<TypeWithVersion<TGeneratedTypes['globals'][T]>> => {\n const { findVersionByID } = localGlobalOperations\n return findVersionByID<T>(this, options)\n }\n\n /**\n * @description Find global versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findGlobalVersions = async <T extends keyof TGeneratedTypes['globals']>(\n options: FindGlobalVersionsOptions<T>,\n ): Promise<PaginatedDocs<TypeWithVersion<TGeneratedTypes['globals'][T]>>> => {\n const { findVersions } = localGlobalOperations\n return findVersions<T>(this, options)\n }\n\n /**\n * @description Find version by ID\n * @param options\n * @returns version with specified ID\n */\n findVersionByID = async <T extends keyof TGeneratedTypes['collections']>(\n options: FindVersionByIDOptions<T>,\n ): Promise<TypeWithVersion<TGeneratedTypes['collections'][T]>> => {\n const { findVersionByID } = localOperations\n return findVersionByID<T>(this, options)\n }\n\n /**\n * @description Find versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findVersions = async <T extends keyof TGeneratedTypes['collections']>(\n options: FindVersionsOptions<T>,\n ): Promise<PaginatedDocs<TypeWithVersion<TGeneratedTypes['collections'][T]>>> => {\n const { findVersions } = localOperations\n return findVersions<T>(this, options)\n }\n\n forgotPassword = async <T extends keyof TGeneratedTypes['collections']>(\n options: ForgotPasswordOptions<T>,\n ): Promise<ForgotPasswordResult> => {\n const { forgotPassword } = localOperations.auth\n return forgotPassword<T>(this, options)\n }\n\n getAPIURL = (): string => `${this.config.serverURL}${this.config.routes.api}`\n\n getAdminURL = (): string => `${this.config.serverURL}${this.config.routes.admin}`\n\n globals: Globals\n\n logger: pino.Logger\n\n login = async <T extends keyof TGeneratedTypes['collections']>(\n options: LoginOptions<T>,\n ): Promise<LoginResult & { user: TGeneratedTypes['collections'][T] }> => {\n const { login } = localOperations.auth\n return login<T>(this, options)\n }\n\n resetPassword = async <T extends keyof TGeneratedTypes['collections']>(\n options: ResetPasswordOptions<T>,\n ): Promise<ResetPasswordResult> => {\n const { resetPassword } = localOperations.auth\n return resetPassword<T>(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 <T extends keyof TGeneratedTypes['globals']>(\n options: RestoreGlobalVersionOptions<T>,\n ): Promise<TGeneratedTypes['globals'][T]> => {\n const { restoreVersion } = localGlobalOperations\n return restoreVersion<T>(this, options)\n }\n\n /**\n * @description Restore version by ID\n * @param options\n * @returns version with specified ID\n */\n restoreVersion = async <T extends keyof TGeneratedTypes['collections']>(\n options: RestoreVersionOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { restoreVersion } = localOperations\n return restoreVersion<T>(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 <T extends keyof TGeneratedTypes['collections']>(\n options: UnlockOptions<T>,\n ): Promise<boolean> => {\n const { unlock } = localOperations.auth\n return unlock(this, options)\n }\n\n updateGlobal = async <T extends keyof TGeneratedTypes['globals']>(\n options: UpdateGlobalOptions<T>,\n ): Promise<TGeneratedTypes['globals'][T]> => {\n const { update } = localGlobalOperations\n return update<T>(this, options)\n }\n\n validationRules: (args: OperationArgs<any>) => ValidationRule[]\n\n verifyEmail = async <T extends keyof TGeneratedTypes['collections']>(\n options: VerifyEmailOptions<T>,\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<T extends keyof TGeneratedTypes['collections']>(\n options: DeleteByIDOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]>\n\n delete<T extends keyof TGeneratedTypes['collections']>(\n options: DeleteManyOptions<T>,\n ): Promise<BulkOperationResult<T>>\n\n delete<T extends keyof TGeneratedTypes['collections']>(\n options: DeleteOptions<T>,\n ): Promise<BulkOperationResult<T> | TGeneratedTypes['collections'][T]> {\n const { deleteLocal } = localOperations\n return deleteLocal<T>(this, options)\n }\n\n /**\n * @description Initializes Payload\n * @param options\n */\n async init(options: InitOptions): Promise<Payload> {\n if (!options?.config) {\n throw new Error('Error: the payload config is required to initialize payload.')\n }\n\n this.logger = Logger('payload', options.loggerOptions, options.loggerDestination)\n\n this.config = await options.config\n\n if (process.env.NODE_ENV !== 'production') {\n validateSchema(this.config, this.logger)\n }\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 const customID = flattenFields(collection.fields).find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n\n let customIDType\n\n if (customID?.type === 'number' || customID?.type === 'text') customIDType = customID.type\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 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 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') await options.onInit(this)\n if (typeof this.config.onInit === 'function') await this.config.onInit(this)\n }\n\n return this\n }\n\n update<T extends keyof TGeneratedTypes['collections']>(\n options: UpdateManyOptions<T>,\n ): Promise<BulkOperationResult<T>>\n\n /**\n * @description Update one or more documents\n * @param options\n * @returns Updated document(s)\n */\n update<T extends keyof TGeneratedTypes['collections']>(\n options: UpdateByIDOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]>\n\n update<T extends keyof TGeneratedTypes['collections']>(\n options: UpdateOptions<T>,\n ): Promise<BulkOperationResult<T> | TGeneratedTypes['collections'][T]> {\n const { update } = localOperations\n return update<T>(this, options)\n }\n}\n\nconst initialized = new BasePayload()\n\nexport default initialized\n\nlet cached = global._payload\n\nif (!cached) {\n // eslint-disable-next-line no-multi-assign\n cached = global._payload = { payload: null, promise: null }\n}\n\nexport const getPayload = async (options: InitOptions): Promise<BasePayload<GeneratedTypes>> => {\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<GeneratedTypes>().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 GeneratedTypes = {\n collections: {\n [slug: number | string | symbol]: TypeWithID & Record<string, unknown>\n }\n globals: {\n [slug: number | string | symbol]: GlobalTypeWithID & Record<string, unknown>\n }\n locale: null | string\n user: User\n}\n\ntype Payload = BasePayload<GeneratedTypes>\n\ninterface RequestContext {\n [key: string]: unknown\n}\n\ntype DatabaseAdapter = BaseDatabaseAdapter\n\nexport type { DatabaseAdapter, GeneratedTypes, Payload, RequestContext }\n"],"names":["spawn","crypto","fileURLToPath","path","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","localOperations","validateSchema","consoleEmailAdapter","fieldAffectsData","localGlobalOperations","flattenFields","Logger","serverInit","serverInitTelemetry","filename","url","dirname","BasePayload","auth","options","authStrategies","collections","config","count","create","db","duplicate","email","extensions","find","findByID","findGlobal","findOne","findGlobalVersionByID","findVersionByID","findGlobalVersions","findVersions","forgotPassword","getAPIURL","serverURL","routes","api","getAdminURL","admin","globals","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","Error","loggerOptions","loggerDestination","process","env","NODE_ENV","createHash","digest","slice","forEach","collection","customID","fields","field","name","customIDType","type","slug","typescript","autoGenerate","payload","disableDBConnect","connect","awaitedAdapter","warn","sharp","some","c","upload","imageSizes","formatOptions","jwtStrategyEnabled","reduce","strategies","length","push","useAPIKey","authenticate","disableLocalStrategy","disableOnInit","onInit","initialized","cached","global","_payload","promise","getPayload","e"],"rangeMapp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AIxG,cAA8B0D,IAAI,CAACxD;IAC1D;IAEA,IAAI;QACFmG,OAAOtB,OAAO,GAAG,MAAMsB,OAAOG,OAAO;IACvC,EAAE,OAAOE,GAAG;QACVL,OAAOG,OAAO,GAAG;QACjB,MAAME;IACR;IAEA,OAAOL,OAAOtB,OAAO;AACvB,EAAC"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { ExecutionResult, GraphQLSchema, ValidationRule } from 'graphql'\nimport type { OperationArgs, Request as graphQLRequest } from 'graphql-http'\nimport type pino 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 { BulkOperationResult, Collection, TypeWithID } from './collections/config/types.js'\nimport type { Options as CountOptions } from './collections/operations/local/count.js'\nimport type { Options as CreateOptions } from './collections/operations/local/create.js'\nimport type {\n ByIDOptions as DeleteByIDOptions,\n ManyOptions as DeleteManyOptions,\n Options as DeleteOptions,\n} from './collections/operations/local/delete.js'\nimport type { Options as DuplicateOptions } from './collections/operations/local/duplicate.js'\nimport type { Options as FindOptions } from './collections/operations/local/find.js'\nimport type { Options as FindByIDOptions } from './collections/operations/local/findByID.js'\nimport type { Options as FindVersionByIDOptions } from './collections/operations/local/findVersionByID.js'\nimport type { Options as FindVersionsOptions } from './collections/operations/local/findVersions.js'\nimport type { Options as RestoreVersionOptions } from './collections/operations/local/restoreVersion.js'\nimport type {\n ByIDOptions as UpdateByIDOptions,\n ManyOptions as UpdateManyOptions,\n Options as UpdateOptions,\n} from './collections/operations/local/update.js'\nimport type { InitOptions, SanitizedConfig } from './config/types.js'\nimport type { BaseDatabaseAdapter, PaginatedDocs } from './database/types.js'\nimport type { InitializedEmailAdapter } from './email/types.js'\nimport type { TypeWithID as GlobalTypeWithID, Globals } from './globals/config/types.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 { 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 localOperations from './collections/operations/local/index.js'\nimport { validateSchema } from './config/validate.js'\nimport { consoleEmailAdapter } from './email/consoleEmailAdapter.js'\nimport { fieldAffectsData } from './fields/config/types.js'\nimport localGlobalOperations from './globals/operations/local/index.js'\nimport { getDependencies } from './utilities/dependencies/getDependencies.js'\nimport flattenFields from './utilities/flattenTopLevelFields.js'\nimport Logger from './utilities/logger.js'\nimport { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\n/**\n * @description Payload\n */\nexport class BasePayload<TGeneratedTypes extends GeneratedTypes> {\n /**\n * @description Authorization and Authentication using headers and cookies to run auth user strategies\n * @returns cookies: Map<string, string>\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: number | string | symbol]: Collection\n } = {}\n\n config: SanitizedConfig\n\n /**\n * @description Performs count operation\n * @param options\n * @returns count of documents satisfying query\n */\n count = async <T extends keyof TGeneratedTypes['collections']>(\n options: CountOptions<T>,\n ): Promise<{ totalDocs: number }> => {\n const { count } = localOperations\n return count(this, options)\n }\n\n /**\n * @description Performs create operation\n * @param options\n * @returns created document\n */\n create = async <T extends keyof TGeneratedTypes['collections']>(\n options: CreateOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { create } = localOperations\n return create<T>(this, options)\n }\n db: DatabaseAdapter\n\n decrypt = decrypt\n\n duplicate = async <T extends keyof TGeneratedTypes['collections']>(\n options: DuplicateOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { duplicate } = localOperations\n return duplicate<T>(this, options)\n }\n\n email: InitializedEmailAdapter\n\n // TODO: re-implement or remove?\n // errorHandler: ErrorHandler\n\n encrypt = encrypt\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 <T extends keyof TGeneratedTypes['collections']>(\n options: FindOptions<T>,\n ): Promise<PaginatedDocs<TGeneratedTypes['collections'][T]>> => {\n const { find } = localOperations\n return find<T>(this, options)\n }\n\n /**\n * @description Find document by ID\n * @param options\n * @returns document with specified ID\n */\n findByID = async <T extends keyof TGeneratedTypes['collections']>(\n options: FindByIDOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { findByID } = localOperations\n return findByID<T>(this, options)\n }\n\n findGlobal = async <T extends keyof TGeneratedTypes['globals']>(\n options: FindGlobalOptions<T>,\n ): Promise<TGeneratedTypes['globals'][T]> => {\n const { findOne } = localGlobalOperations\n return findOne<T>(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 <T extends keyof TGeneratedTypes['globals']>(\n options: FindGlobalVersionByIDOptions<T>,\n ): Promise<TypeWithVersion<TGeneratedTypes['globals'][T]>> => {\n const { findVersionByID } = localGlobalOperations\n return findVersionByID<T>(this, options)\n }\n\n /**\n * @description Find global versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findGlobalVersions = async <T extends keyof TGeneratedTypes['globals']>(\n options: FindGlobalVersionsOptions<T>,\n ): Promise<PaginatedDocs<TypeWithVersion<TGeneratedTypes['globals'][T]>>> => {\n const { findVersions } = localGlobalOperations\n return findVersions<T>(this, options)\n }\n\n /**\n * @description Find version by ID\n * @param options\n * @returns version with specified ID\n */\n findVersionByID = async <T extends keyof TGeneratedTypes['collections']>(\n options: FindVersionByIDOptions<T>,\n ): Promise<TypeWithVersion<TGeneratedTypes['collections'][T]>> => {\n const { findVersionByID } = localOperations\n return findVersionByID<T>(this, options)\n }\n\n /**\n * @description Find versions with criteria\n * @param options\n * @returns versions satisfying query\n */\n findVersions = async <T extends keyof TGeneratedTypes['collections']>(\n options: FindVersionsOptions<T>,\n ): Promise<PaginatedDocs<TypeWithVersion<TGeneratedTypes['collections'][T]>>> => {\n const { findVersions } = localOperations\n return findVersions<T>(this, options)\n }\n\n forgotPassword = async <T extends keyof TGeneratedTypes['collections']>(\n options: ForgotPasswordOptions<T>,\n ): Promise<ForgotPasswordResult> => {\n const { forgotPassword } = localOperations.auth\n return forgotPassword<T>(this, options)\n }\n\n getAPIURL = (): string => `${this.config.serverURL}${this.config.routes.api}`\n\n getAdminURL = (): string => `${this.config.serverURL}${this.config.routes.admin}`\n\n globals: Globals\n\n logger: pino.Logger\n\n login = async <T extends keyof TGeneratedTypes['collections']>(\n options: LoginOptions<T>,\n ): Promise<LoginResult & { user: TGeneratedTypes['collections'][T] }> => {\n const { login } = localOperations.auth\n return login<T>(this, options)\n }\n\n resetPassword = async <T extends keyof TGeneratedTypes['collections']>(\n options: ResetPasswordOptions<T>,\n ): Promise<ResetPasswordResult> => {\n const { resetPassword } = localOperations.auth\n return resetPassword<T>(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 <T extends keyof TGeneratedTypes['globals']>(\n options: RestoreGlobalVersionOptions<T>,\n ): Promise<TGeneratedTypes['globals'][T]> => {\n const { restoreVersion } = localGlobalOperations\n return restoreVersion<T>(this, options)\n }\n\n /**\n * @description Restore version by ID\n * @param options\n * @returns version with specified ID\n */\n restoreVersion = async <T extends keyof TGeneratedTypes['collections']>(\n options: RestoreVersionOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]> => {\n const { restoreVersion } = localOperations\n return restoreVersion<T>(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 <T extends keyof TGeneratedTypes['collections']>(\n options: UnlockOptions<T>,\n ): Promise<boolean> => {\n const { unlock } = localOperations.auth\n return unlock(this, options)\n }\n\n updateGlobal = async <T extends keyof TGeneratedTypes['globals']>(\n options: UpdateGlobalOptions<T>,\n ): Promise<TGeneratedTypes['globals'][T]> => {\n const { update } = localGlobalOperations\n return update<T>(this, options)\n }\n\n validationRules: (args: OperationArgs<any>) => ValidationRule[]\n\n verifyEmail = async <T extends keyof TGeneratedTypes['collections']>(\n options: VerifyEmailOptions<T>,\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<T extends keyof TGeneratedTypes['collections']>(\n options: DeleteByIDOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]>\n\n delete<T extends keyof TGeneratedTypes['collections']>(\n options: DeleteManyOptions<T>,\n ): Promise<BulkOperationResult<T>>\n\n delete<T extends keyof TGeneratedTypes['collections']>(\n options: DeleteOptions<T>,\n ): Promise<BulkOperationResult<T> | TGeneratedTypes['collections'][T]> {\n const { deleteLocal } = localOperations\n return deleteLocal<T>(this, options)\n }\n\n /**\n * @description Initializes Payload\n * @param options\n */\n async init(options: InitOptions): Promise<Payload> {\n if (process.env.NODE_ENV !== 'production') {\n // First load. First check if there are mismatching dependency versions of payload packages\n const resolvedDependencies = await getDependencies(dirname, [\n '@payloadcms/ui/shared',\n 'payload',\n '@payloadcms/next/utilities',\n '@payloadcms/richtext-lexical',\n '@payloadcms/richtext-slate',\n '@payloadcms/graphql',\n '@payloadcms/plugin-cloud',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/plugin-form-builder',\n '@payloadcms/plugin-nested-docs',\n '@payloadcms/plugin-seo',\n '@payloadcms/plugin-search',\n '@payloadcms/plugin-cloud-storage',\n '@payloadcms/plugin-stripe',\n '@payloadcms/plugin-zapier',\n '@payloadcms/plugin-redirects',\n '@payloadcms/plugin-sentry',\n '@payloadcms/bundler-webpack',\n '@payloadcms/bundler-vite',\n '@payloadcms/live-preview',\n '@payloadcms/live-preview-react',\n '@payloadcms/translations',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/storage-azure',\n '@payloadcms/storage-s3',\n '@payloadcms/storage-gcs',\n '@payloadcms/storage-vercel-blob',\n '@payloadcms/storage-uploadthing',\n ])\n\n // Go through each resolved dependency. If any dependency has a mismatching version, throw an error\n const foundVersions: {\n [version: string]: string\n } = {}\n for (const [_pkg, { version }] of resolvedDependencies.resolved) {\n if (!Object.keys(foundVersions).includes(version)) {\n foundVersions[version] = _pkg\n }\n }\n if (Object.keys(foundVersions).length !== 1) {\n const formattedVersionsWithPackageNameString = Object.entries(foundVersions)\n .map(([version, pkg]) => `${pkg}@${version}`)\n .join(', ')\n\n throw new Error(\n `Mismatching payload dependency versions found: ${formattedVersionsWithPackageNameString}. All payload and @payloadcms/* packages must have the same version.`,\n )\n }\n }\n\n if (!options?.config) {\n throw new Error('Error: the payload config is required to initialize payload.')\n }\n\n this.logger = Logger('payload', options.loggerOptions, options.loggerDestination)\n\n this.config = await options.config\n\n if (process.env.NODE_ENV !== 'production') {\n validateSchema(this.config, this.logger)\n }\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 const customID = flattenFields(collection.fields).find(\n (field) => fieldAffectsData(field) && field.name === 'id',\n )\n\n let customIDType\n\n if (customID?.type === 'number' || customID?.type === 'text') customIDType = customID.type\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 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 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') await options.onInit(this)\n if (typeof this.config.onInit === 'function') await this.config.onInit(this)\n }\n\n return this\n }\n\n update<T extends keyof TGeneratedTypes['collections']>(\n options: UpdateManyOptions<T>,\n ): Promise<BulkOperationResult<T>>\n\n /**\n * @description Update one or more documents\n * @param options\n * @returns Updated document(s)\n */\n update<T extends keyof TGeneratedTypes['collections']>(\n options: UpdateByIDOptions<T>,\n ): Promise<TGeneratedTypes['collections'][T]>\n\n update<T extends keyof TGeneratedTypes['collections']>(\n options: UpdateOptions<T>,\n ): Promise<BulkOperationResult<T> | TGeneratedTypes['collections'][T]> {\n const { update } = localOperations\n return update<T>(this, options)\n }\n}\n\nconst initialized = new BasePayload()\n\nexport default initialized\n\nlet cached = global._payload\n\nif (!cached) {\n // eslint-disable-next-line no-multi-assign\n cached = global._payload = { payload: null, promise: null }\n}\n\nexport const getPayload = async (options: InitOptions): Promise<BasePayload<GeneratedTypes>> => {\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<GeneratedTypes>().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 GeneratedTypes = {\n collections: {\n [slug: number | string | symbol]: TypeWithID & Record<string, unknown>\n }\n globals: {\n [slug: number | string | symbol]: GlobalTypeWithID & Record<string, unknown>\n }\n locale: null | string\n user: User\n}\n\ntype Payload = BasePayload<GeneratedTypes>\n\ninterface RequestContext {\n [key: string]: unknown\n}\n\ntype DatabaseAdapter = BaseDatabaseAdapter\n\nexport type { DatabaseAdapter, GeneratedTypes, Payload, RequestContext }\n\nexport * from './types/index.js'\nexport type * from './admin/types.js'\nexport type * from './uploads/types.js'\n\nexport type { MeOperationResult } from './auth/operations/me.js'\n\nexport type { ClientCollectionConfig } 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 AfterOperationHook as CollectionAfterOperationHook,\n AfterReadHook as CollectionAfterReadHook,\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 Collection,\n CollectionConfig,\n SanitizedCollectionConfig,\n TypeWithID,\n TypeWithTimestamps,\n} from './collections/config/types.js'\n\nexport { createDataloaderCacheKey, getDataLoader } from './collections/dataloader.js'\n\nexport { buildConfig } from './config/build.js'\nexport type { ClientConfig } from './config/client.js'\nexport type {\n Access,\n AccessArgs,\n EditViewComponent,\n EntityDescription,\n EntityDescriptionComponent,\n EntityDescriptionFunction,\n SanitizedConfig,\n} from './config/types.js'\n\nexport type { EmailAdapter as PayloadEmailAdapter, SendEmailOptions } from './email/types.js'\n\nexport {\n APIError,\n AuthenticationError,\n DuplicateCollection,\n DuplicateFieldName,\n DuplicateGlobal,\n ErrorDeletingFile,\n FileRetrievalError,\n FileUploadError,\n Forbidden,\n InvalidConfiguration,\n InvalidFieldName,\n InvalidFieldRelationship,\n LockedAuth,\n MissingCollectionLabel,\n MissingEditorProp,\n MissingFieldInputOptions,\n MissingFieldType,\n MissingFile,\n NotFound,\n QueryError,\n ValidationError,\n} from './errors/index.js'\n\nexport type { ClientFieldConfig } from './fields/config/client.js'\n\nexport type {\n ArrayField,\n Block,\n BlockField,\n CheckboxField,\n ClientValidate,\n CodeField,\n CollapsibleField,\n Condition,\n DateField,\n EmailField,\n Field,\n FieldAccess,\n FieldAffectingData,\n FieldBase,\n FieldHook,\n FieldHookArgs,\n FieldPresentationalOnly,\n FieldWithMany,\n FieldWithMaxDepth,\n FieldWithPath,\n FieldWithSubFields,\n FilterOptions,\n FilterOptionsProps,\n GroupField,\n HookName,\n JSONField,\n Labels,\n NamedTab,\n NonPresentationalField,\n NumberField,\n Option,\n OptionObject,\n PointField,\n PolymorphicRelationshipField,\n RadioField,\n RelationshipField,\n RelationshipValue,\n RichTextField,\n RowAdmin,\n RowField,\n SelectField,\n SingleRelationshipField,\n Tab,\n TabAsField,\n TabsAdmin,\n TabsField,\n TextField,\n TextareaField,\n UIField,\n UnnamedTab,\n UploadField,\n Validate,\n ValidateOptions,\n ValueWithRelation,\n} from './fields/config/types.js'\nexport { traverseFields as afterChangeTraverseFields } from './fields/hooks/afterChange/traverseFields.js'\n\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'\n\nexport type { ClientGlobalConfig } from './globals/config/client.js'\nexport type {\n AfterChangeHook as GlobalAfterChangeHook,\n AfterReadHook as GlobalAfterReadHook,\n BeforeChangeHook as GlobalBeforeChangeHook,\n BeforeReadHook as GlobalBeforeReadHook,\n BeforeValidateHook as GlobalBeforeValidateHook,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './globals/config/types.js'\n\nexport type {\n CollapsedPreferences,\n DocumentPreferences,\n FieldsPreferences,\n InsideFieldsPreferences,\n PreferenceRequest,\n PreferenceUpdateRequest,\n TabsPreferences,\n} from './preferences/types.js'\nexport { getLocalI18n } from './translations/getLocalI18n.js'\n\nexport { combineMerge } from './utilities/combineMerge.js'\n\nexport {\n configToJSONSchema,\n entityToJSONSchema,\n fieldsToJSONSchema,\n withNullableJSONSchemaType,\n} from './utilities/configToJSONSchema.js'\n\nexport { createArrayFromCommaDelineated } from './utilities/createArrayFromCommaDelineated.js'\nexport { createLocalReq } from './utilities/createLocalReq.js'\n\nexport { default as flattenTopLevelFields } from './utilities/flattenTopLevelFields.js'\n\nexport { formatLabels, formatNames, toWords } from './utilities/formatLabels.js'\n\nexport { getCollectionIDFieldTypes } from './utilities/getCollectionIDFieldTypes.js'\nexport { getObjectDotNotation } from './utilities/getObjectDotNotation.js'\nexport { isEntityHidden } from './utilities/isEntityHidden.js'\nexport { isPlainObject } from './utilities/isPlainObject.js'\nexport { isValidID } from './utilities/isValidID.js'\nexport { default as isolateObjectProperty } from './utilities/isolateObjectProperty.js'\nexport { mapAsync } from './utilities/mapAsync.js'\n\nexport { mergeListSearchAndWhere } from './utilities/mergeListSearchAndWhere.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 * from './config/types.js'\n\nexport type { FieldTypes } from './admin/forms/FieldTypes.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 { createClientCollectionConfig } from './collections/config/client.js'\nexport { createClientConfig } from './config/client.js'\n\nexport { defaults } from './config/defaults.js'\nexport type {\n BaseDatabaseAdapter,\n BeginTransaction,\n CommitTransaction,\n Connect,\n Count,\n CountArgs,\n Create,\n CreateArgs,\n CreateGlobal,\n CreateGlobalArgs,\n CreateGlobalVersion,\n CreateGlobalVersionArgs,\n CreateMigration,\n CreateVersion,\n CreateVersionArgs,\n DBIdentifierName,\n DatabaseAdapterResult as DatabaseAdapterObj,\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} from './database/types.js'\nexport { baseBlockFields } from './fields/baseFields/baseBlockFields.js'\nexport { baseIDField } from './fields/baseFields/baseIDField.js'\nexport { createClientFieldConfig } from './fields/config/client.js'\nexport { sanitizeFields } from './fields/config/sanitize.js'\n\nexport { createClientGlobalConfig } from './globals/config/client.js'\n\nexport type * from './database/queryValidation/types.js'\n\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'\n\nexport { logoutOperation } from './auth/operations/logout.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 { 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'\n\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 { sanitizeConfig } from './config/sanitize.js'\nexport type { EntityPolicies, PathToQuery } from './database/queryValidation/types.js'\nexport { default as getDefaultValue } from './fields/getDefaultValue.js'\nexport { default as sortableFieldTypes } from './fields/sortableFieldTypes.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'\n\nexport * from './auth/index.js'\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 { combineQueries } from './database/combineQueries.js'\n\nexport { createDatabaseAdapter } from './database/createDatabaseAdapter.js'\n\nexport { default as flattenWhereToOperators } from './database/flattenWhereToOperators.js'\n\nexport { getLocalizedPaths } from './database/getLocalizedPaths.js'\n\nexport { createMigration } from './database/migrations/createMigration.js'\n\nexport { getMigrations } from './database/migrations/getMigrations.js'\n\nexport { getPredefinedMigration } from './database/migrations/getPredefinedMigration.js'\n\nexport { migrate } from './database/migrations/migrate.js'\n\nexport { migrateDown } from './database/migrations/migrateDown.js'\n\nexport { migrateRefresh } from './database/migrations/migrateRefresh.js'\n\nexport { migrateReset } from './database/migrations/migrateReset.js'\n\nexport { migrateStatus } from './database/migrations/migrateStatus.js'\n\nexport { migrationTemplate } from './database/migrations/migrationTemplate.js'\n\nexport { migrationsCollection } from './database/migrations/migrationsCollection.js'\n\nexport { readMigrationFiles } from './database/migrations/readMigrationFiles.js'\n\nexport { validateQueryPaths } from './database/queryValidation/validateQueryPaths.js'\n\nexport { validateSearchParam } from './database/queryValidation/validateSearchParams.js'\n\nexport { getFileByPath } from './uploads/getFileByPath.js'\n\nexport { commitTransaction } from './utilities/commitTransaction.js'\n\nexport { getDependencies }\n\nexport { initTransaction } from './utilities/initTransaction.js'\n\nexport { killTransaction } from './utilities/killTransaction.js'\n"],"names":["spawn","crypto","fileURLToPath","path","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","localOperations","validateSchema","consoleEmailAdapter","fieldAffectsData","localGlobalOperations","getDependencies","flattenFields","Logger","serverInit","serverInitTelemetry","filename","url","dirname","BasePayload","auth","options","authStrategies","collections","config","count","create","db","duplicate","email","extensions","find","findByID","findGlobal","findOne","findGlobalVersionByID","findVersionByID","findGlobalVersions","findVersions","forgotPassword","getAPIURL","serverURL","routes","api","getAdminURL","admin","globals","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","resolvedDependencies","foundVersions","_pkg","version","resolved","Object","keys","includes","length","formattedVersionsWithPackageNameString","entries","map","pkg","join","Error","loggerOptions","loggerDestination","createHash","digest","slice","forEach","collection","customID","fields","field","name","customIDType","type","slug","typescript","autoGenerate","payload","disableDBConnect","connect","awaitedAdapter","warn","sharp","some","c","upload","imageSizes","formatOptions","jwtStrategyEnabled","reduce","strategies","push","useAPIKey","authenticate","disableLocalStrategy","disableOnInit","onInit","initialized","cached","global","_payload","promise","getPayload","e","createDataloaderCacheKey","getDataLoader","buildConfig","APIError","AuthenticationError","DuplicateCollection","DuplicateFieldName","DuplicateGlobal","ErrorDeletingFile","FileRetrievalError","FileUploadError","Forbidden","InvalidConfiguration","InvalidFieldName","InvalidFieldRelationship","LockedAuth","MissingCollectionLabel","MissingEditorProp","MissingFieldInputOptions","MissingFieldType","MissingFile","NotFound","QueryError","ValidationError","traverseFields","afterChangeTraverseFields","afterReadPromise","afterReadTraverseFields","beforeChangeTraverseFields","beforeValidateTraverseFields","getLocalI18n","combineMerge","configToJSONSchema","entityToJSONSchema","fieldsToJSONSchema","withNullableJSONSchemaType","createArrayFromCommaDelineated","createLocalReq","default","flattenTopLevelFields","formatLabels","formatNames","toWords","getCollectionIDFieldTypes","getObjectDotNotation","isEntityHidden","isPlainObject","isValidID","isolateObjectProperty","mapAsync","mergeListSearchAndWhere","buildVersionCollectionFields","buildVersionGlobalFields","versionDefaults","deleteCollectionVersions","enforceMaxVersions","getLatestCollectionVersion","getLatestGlobalVersion","saveVersion","createClientCollectionConfig","createClientConfig","defaults","baseBlockFields","baseIDField","createClientFieldConfig","sanitizeFields","createClientGlobalConfig","accessOperation","forgotPasswordOperation","initOperation","loginOperation","logoutOperation","meOperation","refreshOperation","registerFirstUserOperation","resetPasswordOperation","unlockOperation","verifyEmailOperation","countOperation","createOperation","deleteOperation","deleteByIDOperation","docAccessOperation","duplicateOperation","findOperation","findByIDOperation","findVersionByIDOperation","findVersionsOperation","restoreVersionOperation","updateOperation","updateByIDOperation","sanitizeConfig","getDefaultValue","sortableFieldTypes","docAccessOperationGlobal","findOneOperation","findVersionByIDOperationGlobal","findVersionsOperationGlobal","restoreVersionOperationGlobal","updateOperationGlobal","executeAccess","executeAuthStrategies","getAccessResults","getFieldsToSign","combineQueries","createDatabaseAdapter","flattenWhereToOperators","getLocalizedPaths","createMigration","getMigrations","getPredefinedMigration","migrate","migrateDown","migrateRefresh","migrateReset","migrateStatus","migrationTemplate","migrationsCollection","readMigrationFiles","validateQueryPaths","validateSearchParam","getFileByPath","commitTransaction","initTransaction","killTransaction"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
@@ -0,0 +1,9 @@
1
+ export type NecessaryDependencies = {
2
+ missing: string[];
3
+ resolved: Map<string, {
4
+ path: string;
5
+ version: string;
6
+ }>;
7
+ };
8
+ export declare function getDependencies(baseDir: string, requiredPackages: string[]): Promise<NecessaryDependencies>;
9
+ //# sourceMappingURL=getDependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDependencies.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/getDependencies.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,GAAG,CACX,MAAM,EACN;QACE,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;KAChB,CACF,CAAA;CACF,CAAA;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,EAAE,GACzB,OAAO,CAAC,qBAAqB,CAAC,CA6ChC"}
@@ -0,0 +1,54 @@
1
+ /*
2
+ This source code has been taken and modified from https://github.com/vercel/next.js/blob/41a80533f900467e1b788bd2673abe2dca20be6a/packages/next/src/lib/has-necessary-dependencies.ts
3
+
4
+ License:
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2024 Vercel, Inc.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ */ import { findUp } from 'find-up';
16
+ import { existsSync, promises as fs } from 'fs';
17
+ import { dirname } from 'path';
18
+ import { resolveFrom } from './resolveFrom.js';
19
+ export async function getDependencies(baseDir, requiredPackages) {
20
+ const resolutions = new Map();
21
+ const missingPackages = [];
22
+ await Promise.all(requiredPackages.map(async (pkg)=>{
23
+ try {
24
+ const pkgPath = await fs.realpath(resolveFrom(baseDir, pkg));
25
+ const pkgDir = dirname(pkgPath);
26
+ let packageJsonFilePath = null;
27
+ await findUp('package.json', {
28
+ type: 'file',
29
+ cwd: pkgDir
30
+ }).then((path)=>{
31
+ packageJsonFilePath = path;
32
+ });
33
+ if (packageJsonFilePath && existsSync(packageJsonFilePath)) {
34
+ // parse version
35
+ const packageJson = JSON.parse(await fs.readFile(packageJsonFilePath, 'utf8'));
36
+ const version = packageJson.version;
37
+ resolutions.set(pkg, {
38
+ path: packageJsonFilePath,
39
+ version
40
+ });
41
+ } else {
42
+ return missingPackages.push(pkg);
43
+ }
44
+ } catch (_) {
45
+ return missingPackages.push(pkg);
46
+ }
47
+ }));
48
+ return {
49
+ missing: missingPackages,
50
+ resolved: resolutions
51
+ };
52
+ }
53
+
54
+ //# sourceMappingURL=getDependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utilities/dependencies/getDependencies.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/41a80533f900467e1b788bd2673abe2dca20be6a/packages/next/src/lib/has-necessary-dependencies.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nimport { findUp } from 'find-up'\nimport { existsSync, promises as fs } from 'fs'\nimport { dirname } from 'path'\n\nimport { resolveFrom } from './resolveFrom.js'\n\nexport type NecessaryDependencies = {\n missing: string[]\n resolved: Map<\n string,\n {\n path: string\n version: string\n }\n >\n}\n\nexport async function getDependencies(\n baseDir: string,\n requiredPackages: string[],\n): Promise<NecessaryDependencies> {\n const resolutions = new Map<\n string,\n {\n path: string\n version: string\n }\n >()\n const missingPackages: string[] = []\n\n await Promise.all(\n requiredPackages.map(async (pkg) => {\n try {\n const pkgPath = await fs.realpath(resolveFrom(baseDir, pkg))\n\n const pkgDir = dirname(pkgPath)\n\n let packageJsonFilePath = null\n\n await findUp('package.json', { type: 'file', cwd: pkgDir }).then((path) => {\n packageJsonFilePath = path\n })\n\n if (packageJsonFilePath && existsSync(packageJsonFilePath)) {\n // parse version\n const packageJson = JSON.parse(await fs.readFile(packageJsonFilePath, 'utf8'))\n const version = packageJson.version\n\n resolutions.set(pkg, {\n path: packageJsonFilePath,\n version,\n })\n } else {\n return missingPackages.push(pkg)\n }\n } catch (_) {\n return missingPackages.push(pkg)\n }\n }),\n )\n\n return {\n missing: missingPackages,\n resolved: resolutions,\n }\n}\n"],"names":["findUp","existsSync","promises","fs","dirname","resolveFrom","getDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","pkg","pkgPath","realpath","pkgDir","packageJsonFilePath","type","cwd","then","path","packageJson","JSON","parse","readFile","version","set","push","_","missing","resolved"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAEA,SAASA,MAAM,QAAQ,UAAS;AAChC,SAASC,UAAU,EAAEC,YAAYC,EAAE,QAAQ,KAAI;AAC/C,SAASC,OAAO,QAAQ,OAAM;AAE9B,SAASC,WAAW,QAAQ,mBAAkB;AAa9C,OAAO,eAAeC,gBACpBC,OAAe,EACfC,gBAA0B;IAE1B,MAAMC,cAAc,IAAIC;IAOxB,MAAMC,kBAA4B,EAAE;IAEpC,MAAMC,QAAQC,GAAG,CACfL,iBAAiBM,GAAG,CAAC,OAAOC;QAC1B,IAAI;YACF,MAAMC,UAAU,MAAMb,GAAGc,QAAQ,CAACZ,YAAYE,SAASQ;YAEvD,MAAMG,SAASd,QAAQY;YAEvB,IAAIG,sBAAsB;YAE1B,MAAMnB,OAAO,gBAAgB;gBAAEoB,MAAM;gBAAQC,KAAKH;YAAO,GAAGI,IAAI,CAAC,CAACC;gBAChEJ,sBAAsBI;YACxB;YAEA,IAAIJ,uBAAuBlB,WAAWkB,sBAAsB;gBAC1D,gBAAgB;gBAChB,MAAMK,cAAcC,KAAKC,KAAK,CAAC,MAAMvB,GAAGwB,QAAQ,CAACR,qBAAqB;gBACtE,MAAMS,UAAUJ,YAAYI,OAAO;gBAEnCnB,YAAYoB,GAAG,CAACd,KAAK;oBACnBQ,MAAMJ;oBACNS;gBACF;YACF,OAAO;gBACL,OAAOjB,gBAAgBmB,IAAI,CAACf;YAC9B;QACF,EAAE,OAAOgB,GAAG;YACV,OAAOpB,gBAAgBmB,IAAI,CAACf;QAC9B;IACF;IAGF,OAAO;QACLiB,SAASrB;QACTsB,UAAUxB;IACZ;AACF"}
@@ -0,0 +1,5 @@
1
+ export interface ErrorWithCode extends Error {
2
+ code?: number | string;
3
+ }
4
+ export declare function isError(err: unknown): err is ErrorWithCode;
5
+ //# sourceMappingURL=isError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isError.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/isError.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,aAAa,CAE1D"}
@@ -0,0 +1,19 @@
1
+ /*
2
+ This source code has been taken and modified from https://github.com/vercel/next.js/blob/be87132327ea28acd4bf7af09a401bac2374cb64/packages/next/src/lib/is-error.ts
3
+
4
+ License:
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2024 Vercel, Inc.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ */ export function isError(err) {
16
+ return typeof err === 'object' && err !== null && 'name' in err && 'message' in err;
17
+ }
18
+
19
+ //# sourceMappingURL=isError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utilities/dependencies/isError.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/be87132327ea28acd4bf7af09a401bac2374cb64/packages/next/src/lib/is-error.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport interface ErrorWithCode extends Error {\n code?: number | string\n}\n\nexport function isError(err: unknown): err is ErrorWithCode {\n return typeof err === 'object' && err !== null && 'name' in err && 'message' in err\n}\n"],"names":["isError","err"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAMA,OAAO,SAASA,QAAQC,GAAY;IAClC,OAAO,OAAOA,QAAQ,YAAYA,QAAQ,QAAQ,UAAUA,OAAO,aAAaA;AAClF"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import fs from 'fs';
3
+ export declare const realpathSync: typeof fs.realpathSync.native;
4
+ //# sourceMappingURL=realPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realPath.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/realPath.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,MAAM,IAAI,CAAA;AAQnB,eAAO,MAAM,YAAY,+BAAuD,CAAA"}
@@ -0,0 +1,23 @@
1
+ /*
2
+ This source code has been taken from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/realpath.ts
3
+
4
+ License:
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2024 Vercel, Inc.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ */ import fs from 'fs';
16
+ const isWindows = process.platform === 'win32';
17
+ // Interesting learning from this, that fs.realpathSync is 70x slower than fs.realpathSync.native:
18
+ // https://sun0day.github.io/blog/vite/why-vite4_3-is-faster.html#fs-realpathsync-issue
19
+ // https://github.com/nodejs/node/issues/2680
20
+ // However, we can't use fs.realpathSync.native on Windows due to behavior differences.
21
+ export const realpathSync = isWindows ? fs.realpathSync : fs.realpathSync.native;
22
+
23
+ //# sourceMappingURL=realPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utilities/dependencies/realPath.ts"],"sourcesContent":["/*\n This source code has been taken from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/realpath.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\nimport fs from 'fs'\n\nconst isWindows = process.platform === 'win32'\n\n// Interesting learning from this, that fs.realpathSync is 70x slower than fs.realpathSync.native:\n// https://sun0day.github.io/blog/vite/why-vite4_3-is-faster.html#fs-realpathsync-issue\n// https://github.com/nodejs/node/issues/2680\n// However, we can't use fs.realpathSync.native on Windows due to behavior differences.\nexport const realpathSync = isWindows ? fs.realpathSync : fs.realpathSync.native\n"],"names":["fs","isWindows","process","platform","realpathSync","native"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;AAcA,GACA,OAAOA,QAAQ,KAAI;AAEnB,MAAMC,YAAYC,QAAQC,QAAQ,KAAK;AAEvC,kGAAkG;AAClG,uFAAuF;AACvF,6CAA6C;AAC7C,uFAAuF;AACvF,OAAO,MAAMC,eAAeH,YAAYD,GAAGI,YAAY,GAAGJ,GAAGI,YAAY,CAACC,MAAM,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const resolveFrom: (fromDirectory: string, moduleId: string, silent?: boolean) => any;
2
+ //# sourceMappingURL=resolveFrom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveFrom.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/resolveFrom.ts"],"names":[],"mappings":"AAuBA,eAAO,MAAM,WAAW,kBAAmB,MAAM,YAAY,MAAM,WAAW,OAAO,QAgDpF,CAAA"}
@@ -0,0 +1,58 @@
1
+ /*
2
+ This source code has been taken and modified from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/resolve-from.ts
3
+
4
+ License:
5
+
6
+ The MIT License (MIT)
7
+
8
+ Copyright (c) 2024 Vercel, Inc.
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ */ // source: https://github.com/sindresorhus/resolve-from
16
+ import { createRequire } from 'module';
17
+ import path from 'path';
18
+ import { isError } from './isError.js';
19
+ import { realpathSync } from './realPath.js';
20
+ export const resolveFrom = (fromDirectory, moduleId, silent)=>{
21
+ if (typeof fromDirectory !== 'string') {
22
+ throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
23
+ }
24
+ if (typeof moduleId !== 'string') {
25
+ throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
26
+ }
27
+ try {
28
+ fromDirectory = realpathSync(fromDirectory);
29
+ } catch (error) {
30
+ if (isError(error) && error.code === 'ENOENT') {
31
+ fromDirectory = path.resolve(fromDirectory);
32
+ } else if (silent) {
33
+ return;
34
+ } else {
35
+ throw error;
36
+ }
37
+ }
38
+ const fromFile = path.join(fromDirectory, 'noop.js');
39
+ const require = createRequire(import.meta.url);
40
+ const Module = require('module');
41
+ const resolveFileName = ()=>{
42
+ return Module._resolveFilename(moduleId, {
43
+ id: fromFile,
44
+ filename: fromFile,
45
+ paths: Module._nodeModulePaths(fromDirectory)
46
+ });
47
+ };
48
+ if (silent) {
49
+ try {
50
+ return resolveFileName();
51
+ } catch (error) {
52
+ return;
53
+ }
54
+ }
55
+ return resolveFileName();
56
+ };
57
+
58
+ //# sourceMappingURL=resolveFrom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utilities/dependencies/resolveFrom.ts"],"sourcesContent":["/*\n This source code has been taken and modified from https://github.com/vercel/next.js/blob/39498d604c3b25d92a483153fe648a7ee456fbda/packages/next/src/lib/resolve-from.ts\n\n License:\n\n The MIT License (MIT)\n\n Copyright (c) 2024 Vercel, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n*/\n\n// source: https://github.com/sindresorhus/resolve-from\nimport { createRequire } from 'module'\nimport path from 'path'\n\nimport { isError } from './isError.js'\nimport { realpathSync } from './realPath.js'\n\nexport const resolveFrom = (fromDirectory: string, moduleId: string, silent?: boolean) => {\n if (typeof fromDirectory !== 'string') {\n throw new TypeError(\n `Expected \\`fromDir\\` to be of type \\`string\\`, got \\`${typeof fromDirectory}\\``,\n )\n }\n\n if (typeof moduleId !== 'string') {\n throw new TypeError(\n `Expected \\`moduleId\\` to be of type \\`string\\`, got \\`${typeof moduleId}\\``,\n )\n }\n\n try {\n fromDirectory = realpathSync(fromDirectory)\n } catch (error: unknown) {\n if (isError(error) && error.code === 'ENOENT') {\n fromDirectory = path.resolve(fromDirectory)\n } else if (silent) {\n return\n } else {\n throw error\n }\n }\n\n const fromFile = path.join(fromDirectory, 'noop.js')\n\n const require = createRequire(import.meta.url)\n\n const Module = require('module')\n\n const resolveFileName = () => {\n return Module._resolveFilename(moduleId, {\n id: fromFile,\n filename: fromFile,\n paths: Module._nodeModulePaths(fromDirectory),\n })\n }\n\n if (silent) {\n try {\n return resolveFileName()\n } catch (error) {\n return\n }\n }\n\n return resolveFileName()\n}\n"],"names":["createRequire","path","isError","realpathSync","resolveFrom","fromDirectory","moduleId","silent","TypeError","error","code","resolve","fromFile","join","require","url","Module","resolveFileName","_resolveFilename","id","filename","paths","_nodeModulePaths"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAEA,uDAAuD;AACvD,SAASA,aAAa,QAAQ,SAAQ;AACtC,OAAOC,UAAU,OAAM;AAEvB,SAASC,OAAO,QAAQ,eAAc;AACtC,SAASC,YAAY,QAAQ,gBAAe;AAE5C,OAAO,MAAMC,cAAc,CAACC,eAAuBC,UAAkBC;IACnE,IAAI,OAAOF,kBAAkB,UAAU;QACrC,MAAM,IAAIG,UACR,CAAC,qDAAqD,EAAE,OAAOH,cAAc,EAAE,CAAC;IAEpF;IAEA,IAAI,OAAOC,aAAa,UAAU;QAChC,MAAM,IAAIE,UACR,CAAC,sDAAsD,EAAE,OAAOF,SAAS,EAAE,CAAC;IAEhF;IAEA,IAAI;QACFD,gBAAgBF,aAAaE;IAC/B,EAAE,OAAOI,OAAgB;QACvB,IAAIP,QAAQO,UAAUA,MAAMC,IAAI,KAAK,UAAU;YAC7CL,gBAAgBJ,KAAKU,OAAO,CAACN;QAC/B,OAAO,IAAIE,QAAQ;YACjB;QACF,OAAO;YACL,MAAME;QACR;IACF;IAEA,MAAMG,WAAWX,KAAKY,IAAI,CAACR,eAAe;IAE1C,MAAMS,UAAUd,cAAc,YAAYe,GAAG;IAE7C,MAAMC,SAASF,QAAQ;IAEvB,MAAMG,kBAAkB;QACtB,OAAOD,OAAOE,gBAAgB,CAACZ,UAAU;YACvCa,IAAIP;YACJQ,UAAUR;YACVS,OAAOL,OAAOM,gBAAgB,CAACjB;QACjC;IACF;IAEA,IAAIE,QAAQ;QACV,IAAI;YACF,OAAOU;QACT,EAAE,OAAOR,OAAO;YACd;QACF;IACF;IAEA,OAAOQ;AACT,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "3.0.0-beta.51",
3
+ "version": "3.0.0-beta.53",
4
4
  "description": "Node, React, Headless CMS and Application Framework built on Next.js",
5
5
  "keywords": [
6
6
  "admin panel",
@@ -41,39 +41,34 @@
41
41
  "type": "module",
42
42
  "exports": {
43
43
  ".": {
44
- "import": "./dist/exports/index.js",
45
- "require": "./dist/exports/index.js",
46
- "types": "./dist/exports/index.d.ts"
44
+ "import": "./dist/index.js",
45
+ "types": "./dist/index.d.ts",
46
+ "default": "./dist/index.js"
47
47
  },
48
48
  "./node": {
49
49
  "import": "./dist/exports/node.js",
50
- "require": "./dist/exports/node.js",
51
- "types": "./dist/exports/node.d.ts"
50
+ "types": "./dist/exports/node.d.ts",
51
+ "default": "./dist/exports/node.js"
52
52
  },
53
53
  "./shared": {
54
54
  "import": "./dist/exports/shared.js",
55
- "require": "./dist/exports/shared.js",
56
- "types": "./dist/exports/shared.d.ts"
55
+ "types": "./dist/exports/shared.d.ts",
56
+ "default": "./dist/exports/shared.js"
57
57
  },
58
58
  "./i18n/*": {
59
59
  "import": "./dist/exports/i18n/*.js",
60
- "require": "./dist/exports/i18n/*.js",
61
- "types": "./dist/exports/i18n/*.d.ts"
60
+ "types": "./dist/exports/i18n/*.d.ts",
61
+ "default": "./dist/exports/i18n/*.js"
62
62
  }
63
63
  },
64
- "main": "./dist/exports/index.js",
65
- "types": "./dist/exports/index.d.ts",
64
+ "main": "./dist/index.js",
65
+ "types": "./dist/index.d.ts",
66
66
  "bin": {
67
67
  "payload": "bin.js"
68
68
  },
69
69
  "files": [
70
- "bin.js",
71
70
  "dist",
72
- "docs",
73
- "*.js",
74
- "*.d.ts",
75
- "!jest.config.js",
76
- "!jest.components.config.js"
71
+ "bin.js"
77
72
  ],
78
73
  "dependencies": {
79
74
  "@next/env": "^15.0.0-rc.0",
@@ -104,7 +99,7 @@
104
99
  "scmp": "2.1.0",
105
100
  "ts-essentials": "7.0.3",
106
101
  "uuid": "10.0.0",
107
- "@payloadcms/translations": "3.0.0-beta.51"
102
+ "@payloadcms/translations": "3.0.0-beta.53"
108
103
  },
109
104
  "devDependencies": {
110
105
  "@hyrious/esbuild-plugin-commonjs": "^0.2.4",
package/bundle.js DELETED
@@ -1,75 +0,0 @@
1
- import * as esbuild from 'esbuild'
2
- import fs from 'fs'
3
- import path from 'path'
4
- import { fileURLToPath } from 'url'
5
- const filename = fileURLToPath(import.meta.url)
6
- const dirname = path.dirname(filename)
7
- import { commonjs } from '@hyrious/esbuild-plugin-commonjs'
8
-
9
- const resultIndex = await esbuild
10
- .build({
11
- entryPoints: ['src/exports/index.ts'],
12
- bundle: true,
13
- platform: 'node',
14
- format: 'esm',
15
- outfile: 'dist/exports/index.js',
16
- splitting: false,
17
- external: [
18
- 'lodash',
19
- //'joi',
20
- '*.scss',
21
- '*.css',
22
- '@payloadcms/translations',
23
- 'memoizee',
24
- 'pino-pretty',
25
- 'pino',
26
- //'ajv',
27
- //'conf',
28
- //'image-size',
29
- ],
30
- minify: true,
31
- metafile: true,
32
- tsconfig: path.resolve(dirname, './tsconfig.json'),
33
- // plugins: [commonjs()],
34
- sourcemap: true,
35
- })
36
- .then((res, err) => {
37
- console.log('payload server bundled successfully')
38
- return res
39
- })
40
- .catch(() => process.exit(1))
41
-
42
- const resultShared = await esbuild
43
- .build({
44
- entryPoints: ['src/exports/shared.ts'],
45
- bundle: true,
46
- platform: 'node',
47
- format: 'esm',
48
- outfile: 'dist/exports/shared.js',
49
- splitting: false,
50
- external: [
51
- 'lodash',
52
- '*.scss',
53
- '*.css',
54
- '@payloadcms/translations',
55
- 'memoizee',
56
- 'pino-pretty',
57
- 'pino',
58
- //'ajv',
59
- //'conf',
60
- //'image-size',
61
- ],
62
- minify: true,
63
- metafile: true,
64
- tsconfig: path.resolve(dirname, './tsconfig.json'),
65
- // plugins: [commonjs()],
66
- sourcemap: true,
67
- })
68
- .then((res, err) => {
69
- console.log('payload shared bundled successfully')
70
- return res
71
- })
72
- .catch(() => process.exit(1))
73
-
74
- fs.writeFileSync('meta_index.json', JSON.stringify(resultIndex.metafile))
75
- fs.writeFileSync('meta_shared.json', JSON.stringify(resultShared.metafile))