payload 3.0.0-beta.106 → 3.0.0-beta.107

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/fields/hooks/beforeDuplicate/promise.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { JsonObject, PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, FieldHookArgs, TabAsField } from '../../config/types.js'\n\nimport { fieldAffectsData, tabHasName } from '../../config/types.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { runBeforeDuplicateHooks } from './runHook.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n doc: T\n field: Field | TabAsField\n id?: number | string\n overrideAccess: boolean\n parentPath: (number | string)[]\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingDoc: JsonObject\n}\n\nexport const promise = async <T>({\n id,\n collection,\n context,\n doc,\n field,\n overrideAccess,\n parentPath,\n parentSchemaPath,\n req,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const { localization } = req.payload.config\n\n const { path: fieldPath, schemaPath: fieldSchemaPath } = getFieldPaths({\n field,\n parentPath,\n parentSchemaPath,\n })\n\n if (fieldAffectsData(field)) {\n let fieldData = siblingDoc?.[field.name]\n const fieldIsLocalized = field.localized && localization\n\n // Run field beforeDuplicate hooks\n if (Array.isArray(field.hooks?.beforeDuplicate)) {\n if (fieldIsLocalized) {\n const localeData = await localization.localeCodes.reduce(\n async (localizedValuesPromise: Promise<JsonObject>, locale) => {\n const localizedValues = await localizedValuesPromise\n\n const beforeDuplicateArgs: FieldHookArgs = {\n collection,\n context,\n data: doc,\n field,\n global: undefined,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name]?.[locale],\n req,\n schemaPath: parentSchemaPath,\n siblingData: siblingDoc,\n siblingDocWithLocales: siblingDoc,\n value: siblingDoc[field.name]?.[locale],\n }\n\n const hookResult = await runBeforeDuplicateHooks(beforeDuplicateArgs)\n\n if (typeof hookResult !== 'undefined') {\n return {\n ...localizedValues,\n [locale]: hookResult,\n }\n }\n\n return localizedValuesPromise\n },\n Promise.resolve({}),\n )\n\n siblingDoc[field.name] = localeData\n } else {\n const beforeDuplicateArgs: FieldHookArgs = {\n collection,\n context,\n data: doc,\n field,\n global: undefined,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData: siblingDoc,\n siblingDocWithLocales: siblingDoc,\n value: siblingDoc[field.name],\n }\n\n const hookResult = await runBeforeDuplicateHooks(beforeDuplicateArgs)\n if (typeof hookResult !== 'undefined') {\n siblingDoc[field.name] = hookResult\n }\n }\n }\n\n // First, for any localized fields, we will loop over locales\n // and if locale data is present, traverse the sub fields.\n // There are only a few different fields where this is possible.\n if (fieldIsLocalized) {\n if (typeof fieldData !== 'object' || fieldData === null) {\n siblingDoc[field.name] = {}\n fieldData = siblingDoc[field.name]\n }\n\n const promises = []\n\n localization.localeCodes.forEach((locale) => {\n if (fieldData[locale]) {\n switch (field.type) {\n case 'tab':\n case 'group': {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldSchemaPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: fieldData[locale],\n }),\n )\n\n break\n }\n\n case 'array': {\n const rows = fieldData[locale]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n })\n }\n break\n }\n\n case 'blocks': {\n const rows = fieldData[locale]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const blockTypeToMatch = row.blockType\n\n const block = field.blocks.find(\n (blockType) => blockType.slug === blockTypeToMatch,\n )\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: block.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n })\n }\n break\n }\n }\n }\n })\n\n await Promise.all(promises)\n } else {\n // If the field is not localized, but it affects data,\n // we need to further traverse its children\n // so the child fields can run beforeDuplicate hooks\n switch (field.type) {\n case 'tab':\n case 'group': {\n if (field.type === 'tab' && !tabHasName(field)) {\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc,\n })\n } else {\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n const groupDoc = siblingDoc[field.name] as Record<string, unknown>\n\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: groupDoc as JsonObject,\n })\n }\n\n break\n }\n\n case 'array': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n })\n await Promise.all(promises)\n }\n break\n }\n\n case 'blocks': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const blockTypeToMatch = row.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n ;(row as JsonObject).blockType = blockTypeToMatch\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: block.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n }\n })\n await Promise.all(promises)\n }\n\n break\n }\n }\n }\n } else {\n // Finally, we traverse fields which do not affect data here\n switch (field.type) {\n case 'row':\n case 'collapsible': {\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc,\n })\n\n break\n }\n\n default: {\n break\n }\n }\n }\n}\n"],"names":["fieldAffectsData","tabHasName","getFieldPaths","runBeforeDuplicateHooks","traverseFields","promise","id","collection","context","doc","field","overrideAccess","parentPath","parentSchemaPath","req","siblingDoc","localization","payload","config","path","fieldPath","schemaPath","fieldSchemaPath","fieldData","name","fieldIsLocalized","localized","Array","isArray","hooks","beforeDuplicate","localeData","localeCodes","reduce","localizedValuesPromise","locale","localizedValues","beforeDuplicateArgs","data","global","undefined","previousSiblingDoc","previousValue","siblingData","siblingDocWithLocales","value","hookResult","Promise","resolve","promises","forEach","type","push","fields","rows","row","i","blockTypeToMatch","blockType","block","blocks","find","slug","all","groupDoc","tabs","map","tab"],"mappings":"AAIA,SAASA,gBAAgB,EAAEC,UAAU,QAAQ,wBAAuB;AACpE,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,uBAAuB,QAAQ,eAAc;AACtD,SAASC,cAAc,QAAQ,sBAAqB;AAepD,OAAO,MAAMC,UAAU,OAAU,EAC/BC,EAAE,EACFC,UAAU,EACVC,OAAO,EACPC,GAAG,EACHC,KAAK,EACLC,cAAc,EACdC,UAAU,EACVC,gBAAgB,EAChBC,GAAG,EACHC,UAAU,EACF;IACR,MAAM,EAAEC,YAAY,EAAE,GAAGF,IAAIG,OAAO,CAACC,MAAM;IAE3C,MAAM,E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O,YAAYC;wBACZP;oBACF;oBAEA;gBACF;YAEA,KAAK;gBAAQ;oBACX,MAAMX,eAAe;wBACnBE;wBACAC;wBACAC;wBACAC;wBACA4C,QAAQ3C,MAAMuD,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;gCAAE,GAAGA,GAAG;gCAAEhB,MAAM;4BAAM,CAAA;wBACvDxC;wBACAQ,MAAMC;wBACNN;wBACAO,YAAYC;wBACZP;oBACF;oBAEA;gBACF;YAEA;gBAAS;oBACP;gBACF;QACF;IACF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/fields/hooks/beforeDuplicate/promise.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { JsonObject, PayloadRequest, RequestContext } from '../../../types/index.js'\nimport type { Field, FieldHookArgs, TabAsField } from '../../config/types.js'\n\nimport { fieldAffectsData, tabHasName } from '../../config/types.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { runBeforeDuplicateHooks } from './runHook.js'\nimport { traverseFields } from './traverseFields.js'\n\ntype Args<T> = {\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n doc: T\n field: Field | TabAsField\n id?: number | string\n overrideAccess: boolean\n parentPath: (number | string)[]\n parentSchemaPath: string[]\n req: PayloadRequest\n siblingDoc: JsonObject\n}\n\nexport const promise = async <T>({\n id,\n collection,\n context,\n doc,\n field,\n overrideAccess,\n parentPath,\n parentSchemaPath,\n req,\n siblingDoc,\n}: Args<T>): Promise<void> => {\n const { localization } = req.payload.config\n\n const { path: fieldPath, schemaPath: fieldSchemaPath } = getFieldPaths({\n field,\n parentPath,\n parentSchemaPath,\n })\n\n // Handle unnamed tabs\n if (field.type === 'tab' && !tabHasName(field)) {\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc,\n })\n\n return\n }\n\n if (fieldAffectsData(field)) {\n let fieldData = siblingDoc?.[field.name]\n const fieldIsLocalized = field.localized && localization\n\n // Run field beforeDuplicate hooks\n if (Array.isArray(field.hooks?.beforeDuplicate)) {\n if (fieldIsLocalized) {\n const localeData = await localization.localeCodes.reduce(\n async (localizedValuesPromise: Promise<JsonObject>, locale) => {\n const localizedValues = await localizedValuesPromise\n\n const beforeDuplicateArgs: FieldHookArgs = {\n collection,\n context,\n data: doc,\n field,\n global: undefined,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name]?.[locale],\n req,\n schemaPath: parentSchemaPath,\n siblingData: siblingDoc,\n siblingDocWithLocales: siblingDoc,\n value: siblingDoc[field.name]?.[locale],\n }\n\n const hookResult = await runBeforeDuplicateHooks(beforeDuplicateArgs)\n\n if (typeof hookResult !== 'undefined') {\n return {\n ...localizedValues,\n [locale]: hookResult,\n }\n }\n\n return localizedValuesPromise\n },\n Promise.resolve({}),\n )\n\n siblingDoc[field.name] = localeData\n } else {\n const beforeDuplicateArgs: FieldHookArgs = {\n collection,\n context,\n data: doc,\n field,\n global: undefined,\n path: fieldPath,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: parentSchemaPath,\n siblingData: siblingDoc,\n siblingDocWithLocales: siblingDoc,\n value: siblingDoc[field.name],\n }\n\n const hookResult = await runBeforeDuplicateHooks(beforeDuplicateArgs)\n if (typeof hookResult !== 'undefined') {\n siblingDoc[field.name] = hookResult\n }\n }\n }\n\n // First, for any localized fields, we will loop over locales\n // and if locale data is present, traverse the sub fields.\n // There are only a few different fields where this is possible.\n if (fieldIsLocalized) {\n if (typeof fieldData !== 'object' || fieldData === null) {\n siblingDoc[field.name] = {}\n fieldData = siblingDoc[field.name]\n }\n\n const promises = []\n\n localization.localeCodes.forEach((locale) => {\n if (fieldData[locale]) {\n switch (field.type) {\n case 'tab':\n case 'group': {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldSchemaPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: fieldData[locale],\n }),\n )\n\n break\n }\n\n case 'array': {\n const rows = fieldData[locale]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n })\n }\n break\n }\n\n case 'blocks': {\n const rows = fieldData[locale]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const blockTypeToMatch = row.blockType\n\n const block = field.blocks.find(\n (blockType) => blockType.slug === blockTypeToMatch,\n )\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: block.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n })\n }\n break\n }\n }\n }\n })\n\n await Promise.all(promises)\n } else {\n // If the field is not localized, but it affects data,\n // we need to further traverse its children\n // so the child fields can run beforeDuplicate hooks\n switch (field.type) {\n case 'tab':\n case 'group': {\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n const groupDoc = siblingDoc[field.name] as Record<string, unknown>\n\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: groupDoc as JsonObject,\n })\n\n break\n }\n\n case 'array': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n })\n await Promise.all(promises)\n }\n break\n }\n\n case 'blocks': {\n const rows = siblingDoc[field.name]\n\n if (Array.isArray(rows)) {\n const promises = []\n rows.forEach((row, i) => {\n const blockTypeToMatch = row.blockType\n const block = field.blocks.find((blockType) => blockType.slug === blockTypeToMatch)\n\n if (block) {\n ;(row as JsonObject).blockType = blockTypeToMatch\n\n promises.push(\n traverseFields({\n id,\n collection,\n context,\n doc,\n fields: block.fields,\n overrideAccess,\n path: [...fieldPath, i],\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc: row,\n }),\n )\n }\n })\n await Promise.all(promises)\n }\n\n break\n }\n }\n }\n } else {\n // Finally, we traverse fields which do not affect data here\n switch (field.type) {\n case 'row':\n case 'collapsible': {\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.fields,\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n collection,\n context,\n doc,\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n overrideAccess,\n path: fieldPath,\n req,\n schemaPath: fieldSchemaPath,\n siblingDoc,\n })\n\n break\n }\n\n default: {\n break\n }\n }\n }\n}\n"],"names":["fieldAffectsData","tabHasName","getFieldPaths","runBeforeDuplicateHooks","traverseFields","promise","id","collection","context","doc","field","overrideAccess","parentPath","parentSchemaPath","req","siblingDoc","localization","payload","config","path","fieldPath","schemaPath","fieldSchemaPath","type","fields","fieldData","name","fieldIsLocalized","localized","Array","isArray","hooks","beforeDuplicate","localeData","localeCodes","reduce","localizedValuesPromise","locale","localizedValues","beforeDuplicateArgs","data","global","undefined","previousSiblingDoc","previousValue","siblingData","siblingDocWithLocales","value","hookResult","Promise","resolve","promises","forEach","push","rows","row","i","blockTypeToMatch","blockType","block","blocks","find","slug","all","groupDoc","tabs","map","tab"],"mappings":"AAIA,SAASA,gBAAgB,EAAEC,UAAU,QAAQ,wBAAuB;AACpE,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,uBAAuB,QAAQ,eAAc;AACtD,SAASC,cAAc,QAAQ,sBAAqB;AAepD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;IACF,OAAO;QACL,4DAA4D;QAC5D,OAAQzC,MAAMa,IAAI;YAChB,KAAK;YACL,KAAK;gBAAe;oBAClB,MAAMnB,eAAe;wBACnBE;wBACAC;wBACAC;wBACAC;wBACAe,QAAQd,MAAMc,MAAM;wBACpBb;wBACAQ,MAAMC;wBACNN;wBACAO,YAAYC;wBACZP;oBACF;oBAEA;gBACF;YAEA,KAAK;gBAAQ;oBACX,MAAMX,eAAe;wBACnBE;wBACAC;wBACAC;wBACAC;wBACAe,QAAQd,MAAMuD,IAAI,CAACC,GAAG,CAAC,CAACC,MAAS,CAAA;gCAAE,GAAGA,GAAG;gCAAE5C,MAAM;4BAAM,CAAA;wBACvDZ;wBACAQ,MAAMC;wBACNN;wBACAO,YAAYC;wBACZP;oBACF;oBAEA;gBACF;YAEA;gBAAS;oBACP;gBACF;QACF;IACF;AACF,EAAC"}
package/dist/index.d.ts CHANGED
@@ -335,6 +335,7 @@ export { createLocalReq } from './utilities/createLocalReq.js';
335
335
  export { deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple, } from './utilities/deepCopyObject.js';
336
336
  export { deepMerge, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays, } from './utilities/deepMerge.js';
337
337
  export { getDependencies } from './utilities/dependencies/getDependencies.js';
338
+ export { findUp, findUpSync, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync, } from './utilities/findUp.js';
338
339
  export { default as flattenTopLevelFields } from './utilities/flattenTopLevelFields.js';
339
340
  export { formatLabels, formatNames, toWords } from './utilities/formatLabels.js';
340
341
  export { getCollectionIDFieldTypes } from './utilities/getCollectionIDFieldTypes.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7E,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,aA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A;AAE1D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA"}
package/dist/index.js CHANGED
@@ -410,6 +410,7 @@ export { createLocalReq } from './utilities/createLocalReq.js';
410
410
  export { deepCopyObject, deepCopyObjectComplex, deepCopyObjectSimple } from './utilities/deepCopyObject.js';
411
411
  export { deepMerge, deepMergeWithCombinedArrays, deepMergeWithReactComponents, deepMergeWithSourceArrays } from './utilities/deepMerge.js';
412
412
  export { getDependencies } from './utilities/dependencies/getDependencies.js';
413
+ export { findUp, findUpSync, pathExistsAndIsAccessible, pathExistsAndIsAccessibleSync } from './utilities/findUp.js';
413
414
  export { default as flattenTopLevelFields } from './utilities/flattenTopLevelFields.js';
414
415
  export { formatLabels, formatNames, toWords } from './utilities/formatLabels.js';
415
416
  export { getCollectionIDFieldTypes } from './utilities/getCollectionIDFieldTypes.js';
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 TypeWithID,\n} from './collections/config/types.js'\nimport type { Options as CountOptions } from './collections/operations/local/count.js'\nimport type { Options as CreateOptions } from './collections/operations/local/create.js'\nimport type {\n ByIDOptions as DeleteByIDOptions,\n ManyOptions as DeleteManyOptions,\n Options as DeleteOptions,\n} from './collections/operations/local/delete.js'\nimport type { Options as DuplicateOptions } from './collections/operations/local/duplicate.js'\nimport type { Options as FindOptions } from './collections/operations/local/find.js'\nimport type { Options as FindByIDOptions } from './collections/operations/local/findByID.js'\nimport type { Options as FindVersionByIDOptions } from './collections/operations/local/findVersionByID.js'\nimport type { Options as FindVersionsOptions } from './collections/operations/local/findVersions.js'\nimport type { Options as RestoreVersionOptions } from './collections/operations/local/restoreVersion.js'\nimport type {\n ByIDOptions as UpdateByIDOptions,\n ManyOptions as UpdateManyOptions,\n Options as UpdateOptions,\n} from './collections/operations/local/update.js'\nimport type { InitOptions, SanitizedConfig } from './config/types.js'\nimport type { BaseDatabaseAdapter, PaginatedDocs } from './database/types.js'\nimport type { InitializedEmailAdapter } from './email/types.js'\nimport type { DataFromGlobalSlug, Globals } 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 { JsonObject } from './types/index.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 { checkDependencies } from './utilities/dependencies/dependencyChecker.js'\nimport flattenFields from './utilities/flattenTopLevelFields.js'\nimport { getLogger } from './utilities/logger.js'\nimport { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.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 collectionsUntyped: {\n [slug: string]: JsonObject & TypeWithID\n }\n globalsUntyped: {\n [slug: string]: JsonObject\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// @ts-expect-error\ntype ResolveGlobalType<T> = 'globals' extends keyof T ? T['globals'] : T['globalsUntyped']\n\n// Applying helper types to GeneratedTypes\nexport type TypedCollection = ResolveCollectionType<GeneratedTypes>\nexport type TypedGlobal = ResolveGlobalType<GeneratedTypes>\n\n// Extract string keys from the type\ntype StringKeyOf<T> = Extract<keyof T, string>\n\n// Define the types for slugs using the appropriate collections and globals\nexport type CollectionSlug = StringKeyOf<TypedCollection>\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\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\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 create operation\n * @param options\n * @returns created document\n */\n create = async <TSlug extends CollectionSlug>(\n options: CreateOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { create } = localOperations\n return create<TSlug>(this, options)\n }\n\n db: DatabaseAdapter\n decrypt = decrypt\n\n duplicate = async <TSlug extends CollectionSlug>(\n options: DuplicateOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { duplicate } = localOperations\n return duplicate<TSlug>(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>(\n options: FindOptions<TSlug>,\n ): Promise<PaginatedDocs<DataFromCollectionSlug<TSlug>>> => {\n const { find } = localOperations\n return find<TSlug>(this, options)\n }\n\n /**\n * @description Find document by ID\n * @param options\n * @returns document with specified ID\n */\n findByID = async <TSlug extends CollectionSlug>(\n options: FindByIDOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { findByID } = localOperations\n return findByID<TSlug>(this, options)\n }\n\n findGlobal = async <TSlug extends GlobalSlug>(\n options: FindGlobalOptions<TSlug>,\n ): Promise<DataFromGlobalSlug<TSlug>> => {\n const { findOne } = localGlobalOperations\n return findOne<TSlug>(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 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>(\n options: UpdateGlobalOptions<TSlug>,\n ): Promise<DataFromGlobalSlug<TSlug>> => {\n const { update } = localGlobalOperations\n return update<TSlug>(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>(\n options: DeleteByIDOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>>\n\n delete<TSlug extends CollectionSlug>(\n options: DeleteManyOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug>>\n\n delete<TSlug extends CollectionSlug>(\n options: DeleteOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug> | DataFromCollectionSlug<TSlug>> {\n const { deleteLocal } = localOperations\n return deleteLocal<TSlug>(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 ) {\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 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') {\n customIDType = customID.type\n }\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>(\n options: UpdateManyOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug>>\n\n /**\n * @description Update one or more documents\n * @param options\n * @returns Updated document(s)\n */\n update<TSlug extends CollectionSlug>(\n options: UpdateByIDOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>>\n\n update<TSlug extends CollectionSlug>(\n options: UpdateOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug> | DataFromCollectionSlug<TSlug>> {\n const { update } = localOperations\n return update<TSlug>(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 type * from './admin/types.js'\nexport type { MappedView } from './admin/views/types.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 * 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'\n\nexport type { ImportMap } from './bin/generateImportMap/index.js'\nexport { genImportMapIterateFields } from './bin/generateImportMap/iterateFields.js'\nexport type { ClientCollectionConfig } from './collections/config/client.js'\nexport type {\n ServerOnlyCollectionAdminProperties,\n ServerOnlyCollectionProperties,\n ServerOnlyUploadProperties,\n} from './collections/config/client.js'\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 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 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 type { ClientConfig } from './config/client.js'\n\nexport { serverOnlyConfigProperties } from './config/client.js'\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 { 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 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} 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 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 { baseBlockFields } from './fields/baseFields/baseBlockFields.js'\nexport { baseIDField } from './fields/baseFields/baseIDField.js'\nexport type { ServerOnlyFieldProperties } from './fields/config/client.js'\nexport type { ServerOnlyFieldAdminProperties } 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 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 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 NumberFieldValidation,\n PasswordFieldValidation,\n PointFieldValidation,\n RadioFieldValidation,\n RelationshipFieldValidation,\n RichTextFieldValidation,\n SelectFieldValidation,\n TextareaFieldValidation,\n TextFieldValidation,\n UploadFieldValidation,\n UsernameFieldValidation,\n} from './fields/validations.js'\nexport type { ClientGlobalConfig } from './globals/config/client.js'\nexport type {\n ServerOnlyGlobalAdminProperties,\n ServerOnlyGlobalProperties,\n} 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 DataFromGlobalSlug,\n GlobalAdminOptions,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './globals/config/types.js'\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 { 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 { getDependencies } from './utilities/dependencies/getDependencies.js'\nexport { default as flattenTopLevelFields } from './utilities/flattenTopLevelFields.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 { mergeListSearchAndWhere } from './utilities/mergeListSearchAndWhere.js'\nexport { buildVersionCollectionFields } from './versions/buildCollectionFields.js'\nexport { buildVersionGlobalFields } from './versions/buildGlobalFields.js'\nexport { checkDependencies }\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'\nexport { saveVersion } from './versions/saveVersion.js'\nexport type { TypeWithVersion } from './versions/types.js'\n\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["spawn","crypto","fileURLToPath","path","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","checkPayloadDependencies","localOperations","consoleEmailAdapter","fieldAffectsData","localGlobalOperations","checkDependencies","flattenFields","getLogger","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","getAdminURL","serverURL","routes","admin","getAPIURL","api","globals","importMap","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","customID","fields","field","name","customIDType","type","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","createDataloaderCacheKey","getDataLoader","countOperation","createOperation","deleteOperation","deleteByIDOperation","docAccessOperation","duplicateOperation","findOperation","findByIDOperation","findVersionByIDOperation","findVersionsOperation","restoreVersionOperation","updateOperation","updateByIDOperation","buildConfig","serverOnlyConfigProperties","defaults","sanitizeConfig","combineQueries","createDatabaseAdapter","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","LockedAuth","MissingCollectionLabel","MissingEditorProp","MissingFieldInputOptions","MissingFieldType","MissingFile","NotFound","QueryError","ValidationError","ValidationErrorName","baseBlockFields","baseIDField","sanitizeFields","getDefaultValue","traverseFields","afterChangeTraverseFields","afterReadPromise","afterReadTraverseFields","beforeChangeTraverseFields","beforeValidateTraverseFields","sortableFieldTypes","docAccessOperationGlobal","findOneOperation","findVersionByIDOperationGlobal","findVersionsOperationGlobal","restoreVersionOperationGlobal","updateOperationGlobal","getLocalI18n","getFileByPath","commitTransaction","configToJSONSchema","entityToJSONSchema","fieldsToJSONSchema","withNullableJSONSchemaType","createArrayFromCommaDelineated","createLocalReq","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","getDependencies","flattenTopLevelFields","formatLabels","formatNames","toWords","getCollectionIDFieldTypes","getObjectDotNotation","initTransaction","isEntityHidden","isolateObjectProperty","isPlainObject","isValidID","killTransaction","mapAsync","mergeListSearchAndWhere","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,UAAU,OAAM;AAiDvB,SAASC,OAAO,EAAEC,OAAO,QAAQ,mBAAkB;AACnD,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SAASC,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,wBAAwB,QAAQ,gCAA+B;AACxE,OAAOC,qBAAqB,0CAAyC;AACrE,SAASC,mBAAmB,QAAQ,iCAAgC;AACpE,SAASC,gBAAgB,QAAQ,2BAA0B;AAC3D,OAAOC,2BAA2B,sCAAqC;AACvE,SAASC,iBAAiB,QAAQ,gDAA+C;AACjF,OAAOC,mBAAmB,uCAAsC;AAChE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,cAAcC,mBAAmB,QAAQ,6CAA4C;AAgE9F,MAAMC,WAAWhB,cAAc,YAAYiB,GAAG;AAC9C,MAAMC,UAAUjB,KAAKiB,OAAO,CAACF;AAE7B;;CAEC,GACD,OAAO,MAAMG;IACX;;;;GAIC,GACDC,OAAO,OAAOC;QACZ,MAAM,EAAED,IAAI,EAAE,GAAGb,gBAAgBa,IAAI;QACrC,OAAOA,KAAK,IAAI,EAAEC;IACpB,EAAC;IAEDC,eAA8B;IAE9BC,cAEI,CAAC,EAAC;IAENC,OAAuB;IACvB;;;;GAIC,GACDC,QAAQ,OACNJ;QAEA,MAAM,EAAEI,KAAK,EAAE,GAAGlB;QAClB,OAAOkB,MAAM,IAAI,EAAEJ;IACrB,EAAC;IAED;;;;GAIC,GACDK,SAAS,OACPL;QAEA,MAAM,EAAEK,MAAM,EAAE,GAAGnB;QACnB,OAAOmB,OAAc,IAAI,EAAEL;IAC7B,EAAC;IAEDM,G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Q,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAASvH,WAAWwH,qBAAqB,QAAQ,uCAAsC;AACvF,SAASC,aAAa,QAAQ,+BAA8B;AAC5D,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,QAAQ,QAAQ,0BAAyB;AAClD,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,4BAA4B,QAAQ,sCAAqC;AAClF,SAASC,wBAAwB,QAAQ,kCAAiC;AAC1E,SAASnP,iBAAiB,GAAE;AAC5B,SAASoP,eAAe,QAAQ,yBAAwB;AACxD,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,0BAA0B,QAAQ,2CAA0C;AACrF,SAASC,sBAAsB,QAAQ,uCAAsC;AAC7E,SAASC,WAAW,QAAQ,4BAA2B;AAGvD,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 TypeWithID,\n} from './collections/config/types.js'\nimport type { Options as CountOptions } from './collections/operations/local/count.js'\nimport type { Options as CreateOptions } from './collections/operations/local/create.js'\nimport type {\n ByIDOptions as DeleteByIDOptions,\n ManyOptions as DeleteManyOptions,\n Options as DeleteOptions,\n} from './collections/operations/local/delete.js'\nimport type { Options as DuplicateOptions } from './collections/operations/local/duplicate.js'\nimport type { Options as FindOptions } from './collections/operations/local/find.js'\nimport type { Options as FindByIDOptions } from './collections/operations/local/findByID.js'\nimport type { Options as FindVersionByIDOptions } from './collections/operations/local/findVersionByID.js'\nimport type { Options as FindVersionsOptions } from './collections/operations/local/findVersions.js'\nimport type { Options as RestoreVersionOptions } from './collections/operations/local/restoreVersion.js'\nimport type {\n ByIDOptions as UpdateByIDOptions,\n ManyOptions as UpdateManyOptions,\n Options as UpdateOptions,\n} from './collections/operations/local/update.js'\nimport type { InitOptions, SanitizedConfig } from './config/types.js'\nimport type { BaseDatabaseAdapter, PaginatedDocs } from './database/types.js'\nimport type { InitializedEmailAdapter } from './email/types.js'\nimport type { DataFromGlobalSlug, Globals } 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 { JsonObject } from './types/index.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 { checkDependencies } from './utilities/dependencies/dependencyChecker.js'\nimport flattenFields from './utilities/flattenTopLevelFields.js'\nimport { getLogger } from './utilities/logger.js'\nimport { serverInit as serverInitTelemetry } from './utilities/telemetry/events/serverInit.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 collectionsUntyped: {\n [slug: string]: JsonObject & TypeWithID\n }\n globalsUntyped: {\n [slug: string]: JsonObject\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// @ts-expect-error\ntype ResolveGlobalType<T> = 'globals' extends keyof T ? T['globals'] : T['globalsUntyped']\n\n// Applying helper types to GeneratedTypes\nexport type TypedCollection = ResolveCollectionType<GeneratedTypes>\nexport type TypedGlobal = ResolveGlobalType<GeneratedTypes>\n\n// Extract string keys from the type\ntype StringKeyOf<T> = Extract<keyof T, string>\n\n// Define the types for slugs using the appropriate collections and globals\nexport type CollectionSlug = StringKeyOf<TypedCollection>\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\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\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 create operation\n * @param options\n * @returns created document\n */\n create = async <TSlug extends CollectionSlug>(\n options: CreateOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { create } = localOperations\n return create<TSlug>(this, options)\n }\n\n db: DatabaseAdapter\n decrypt = decrypt\n\n duplicate = async <TSlug extends CollectionSlug>(\n options: DuplicateOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { duplicate } = localOperations\n return duplicate<TSlug>(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>(\n options: FindOptions<TSlug>,\n ): Promise<PaginatedDocs<DataFromCollectionSlug<TSlug>>> => {\n const { find } = localOperations\n return find<TSlug>(this, options)\n }\n\n /**\n * @description Find document by ID\n * @param options\n * @returns document with specified ID\n */\n findByID = async <TSlug extends CollectionSlug>(\n options: FindByIDOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>> => {\n const { findByID } = localOperations\n return findByID<TSlug>(this, options)\n }\n\n findGlobal = async <TSlug extends GlobalSlug>(\n options: FindGlobalOptions<TSlug>,\n ): Promise<DataFromGlobalSlug<TSlug>> => {\n const { findOne } = localGlobalOperations\n return findOne<TSlug>(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 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>(\n options: UpdateGlobalOptions<TSlug>,\n ): Promise<DataFromGlobalSlug<TSlug>> => {\n const { update } = localGlobalOperations\n return update<TSlug>(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>(\n options: DeleteByIDOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>>\n\n delete<TSlug extends CollectionSlug>(\n options: DeleteManyOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug>>\n\n delete<TSlug extends CollectionSlug>(\n options: DeleteOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug> | DataFromCollectionSlug<TSlug>> {\n const { deleteLocal } = localOperations\n return deleteLocal<TSlug>(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 ) {\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 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') {\n customIDType = customID.type\n }\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>(\n options: UpdateManyOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug>>\n\n /**\n * @description Update one or more documents\n * @param options\n * @returns Updated document(s)\n */\n update<TSlug extends CollectionSlug>(\n options: UpdateByIDOptions<TSlug>,\n ): Promise<DataFromCollectionSlug<TSlug>>\n\n update<TSlug extends CollectionSlug>(\n options: UpdateOptions<TSlug>,\n ): Promise<BulkOperationResult<TSlug> | DataFromCollectionSlug<TSlug>> {\n const { update } = localOperations\n return update<TSlug>(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 type * from './admin/types.js'\nexport type { MappedView } from './admin/views/types.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 * 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'\n\nexport type { ImportMap } from './bin/generateImportMap/index.js'\nexport { genImportMapIterateFields } from './bin/generateImportMap/iterateFields.js'\nexport type { ClientCollectionConfig } from './collections/config/client.js'\nexport type {\n ServerOnlyCollectionAdminProperties,\n ServerOnlyCollectionProperties,\n ServerOnlyUploadProperties,\n} from './collections/config/client.js'\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 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 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 type { ClientConfig } from './config/client.js'\n\nexport { serverOnlyConfigProperties } from './config/client.js'\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 { 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 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} 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 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 { baseBlockFields } from './fields/baseFields/baseBlockFields.js'\nexport { baseIDField } from './fields/baseFields/baseIDField.js'\nexport type { ServerOnlyFieldProperties } from './fields/config/client.js'\nexport type { ServerOnlyFieldAdminProperties } 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 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 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 NumberFieldValidation,\n PasswordFieldValidation,\n PointFieldValidation,\n RadioFieldValidation,\n RelationshipFieldValidation,\n RichTextFieldValidation,\n SelectFieldValidation,\n TextareaFieldValidation,\n TextFieldValidation,\n UploadFieldValidation,\n UsernameFieldValidation,\n} from './fields/validations.js'\nexport type { ClientGlobalConfig } from './globals/config/client.js'\nexport type {\n ServerOnlyGlobalAdminProperties,\n ServerOnlyGlobalProperties,\n} 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 DataFromGlobalSlug,\n GlobalAdminOptions,\n GlobalConfig,\n SanitizedGlobalConfig,\n} from './globals/config/types.js'\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 { 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 { 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 { 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 { mergeListSearchAndWhere } from './utilities/mergeListSearchAndWhere.js'\nexport { buildVersionCollectionFields } from './versions/buildCollectionFields.js'\nexport { buildVersionGlobalFields } from './versions/buildGlobalFields.js'\nexport { checkDependencies }\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'\nexport { saveVersion } from './versions/saveVersion.js'\nexport type { TypeWithVersion } from './versions/types.js'\n\nexport { deepMergeSimple } from '@payloadcms/translations/utilities'\n"],"names":["spawn","crypto","fileURLToPath","path","decrypt","encrypt","APIKeyAuthentication","JWTAuthentication","checkPayloadDependencies","localOperations","consoleEmailAdapter","fieldAffectsData","localGlobalOperations","checkDependencies","flattenFields","getLogger","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","getAdminURL","serverURL","routes","admin","getAPIURL","api","globals","importMap","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","customID","fields","field","name","customIDType","type","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","createDataloaderCacheKey","getDataLoader","countOperation","createOperation","deleteOperation","deleteByIDOperation","docAccessOperation","duplicateOperation","findOperation","findByIDOperation","findVersionByIDOperation","findVersionsOperation","restoreVersionOperation","updateOperation","updateByIDOperation","buildConfig","serverOnlyConfigProperties","defaults","sanitizeConfig","combineQueries","createDatabaseAdapter","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","LockedAuth","MissingCollectionLabel","MissingEditorProp","MissingFieldInputOptions","MissingFieldType","MissingFile","NotFound","QueryError","ValidationError","ValidationErrorName","baseBlockFields","baseIDField","sanitizeFields","getDefaultValue","traverseFields","afterChangeTraverseFields","afterReadPromise","afterReadTraverseFields","beforeChangeTraverseFields","beforeValidateTraverseFields","sortableFieldTypes","docAccessOperationGlobal","findOneOperation","findVersionByIDOperationGlobal","findVersionsOperationGlobal","restoreVersionOperationGlobal","updateOperationGlobal","getLocalI18n","getFileByPath","commitTransaction","configToJSONSchema","entityToJSONSchema","fieldsToJSONSchema","withNullableJSONSchemaType","createArrayFromCommaDelineated","createLocalReq","deepCopyObject","deepCopyObjectComplex","deepCopyObjectSimple","deepMerge","deepMergeWithCombinedArrays","deepMergeWithReactComponents","deepMergeWithSourceArrays","getDependencies","findUp","findUpSync","pathExistsAndIsAccessible","pathExistsAndIsAccessibleSync","flattenTopLevelFields","formatLabels","formatNames","toWords","getCollectionIDFieldTypes","getObjectDotNotation","initTransaction","isEntityHidden","isolateObjectProperty","isPlainObject","isValidID","killTransaction","mapAsync","mergeListSearchAndWhere","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,UAAU,OAAM;AAiDvB,SAASC,OAAO,EAAEC,OAAO,QAAQ,mBAAkB;AACnD,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SAASC,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,wBAAwB,QAAQ,gCAA+B;AACxE,OAAOC,qBAAqB,0CAAyC;AACrE,SAASC,mBAAmB,QAAQ,iCAAgC;AACpE,SAASC,gBAAgB,QAAQ,2BAA0B;AAC3D,OAAOC,2BAA2B,sCAAqC;AACvE,SAASC,iBAAiB,QAAQ,gDAA+C;AACjF,OAAOC,mBAAmB,uCAAsC;AAChE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,cAAcC,mBAAmB,QAAQ,6CAA4C;AAgE9F,MAAMC,WAAWhB,cAAc,YAAYiB,GAAG;AAC9C,MAAMC,UAAUjB,KAAKiB,OAAO,CAACF;AAE7B;;CAEC,GACD,OAAO,MAAMG;IACX;;;;GAIC,GACDC,OAAO,OAAOC;QACZ,MAAM,EAAED,IAAI,EAAE,GAAGb,gBAAgBa,IAAI;QACrC,OAAOA,KAAK,IAAI,EAAEC;IACpB,EAAC;IAEDC,eAA8B;IAE9BC,cAEI,CAAC,EAAC;IAENC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ACf,gCAA+B;AACtC,SACEC,SAAS,EACTC,2BAA2B,EAC3BC,4BAA4B,EAC5BC,yBAAyB,QACpB,2BAA0B;AACjC,SAASC,eAAe,QAAQ,8CAA6C;AAC7E,SACEC,MAAM,EACNC,UAAU,EACVC,yBAAyB,EACzBC,6BAA6B,QACxB,wBAAuB;AAC9B,SAASnH,WAAWoH,qBAAqB,QAAQ,uCAAsC;AACvF,SAASC,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,8BAA6B;AAChF,SAASC,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,cAAc,QAAQ,gCAA+B;AAC9D,SAAS3H,WAAW4H,qBAAqB,QAAQ,uCAAsC;AACvF,SAASC,aAAa,QAAQ,+BAA8B;AAC5D,SAASC,SAAS,QAAQ,2BAA0B;AACpD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,QAAQ,QAAQ,0BAAyB;AAClD,SAASC,uBAAuB,QAAQ,yCAAwC;AAChF,SAASC,4BAA4B,QAAQ,sCAAqC;AAClF,SAASC,wBAAwB,QAAQ,kCAAiC;AAC1E,SAASvP,iBAAiB,GAAE;AAC5B,SAASwP,eAAe,QAAQ,yBAAwB;AACxD,SAASC,wBAAwB,QAAQ,yCAAwC;AACjF,SAASC,kBAAkB,QAAQ,mCAAkC;AACrE,SAASC,0BAA0B,QAAQ,2CAA0C;AACrF,SAASC,sBAAsB,QAAQ,uCAAsC;AAC7E,SAASC,WAAW,QAAQ,4BAA2B;AAGvD,SAASC,eAAe,QAAQ,qCAAoC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getDependencies.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/getDependencies.ts"],"names":[],"mappings":"AA0BA,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,CAgEhC"}
1
+ {"version":3,"file":"getDependencies.d.ts","sourceRoot":"","sources":["../../../src/utilities/dependencies/getDependencies.ts"],"names":[],"mappings":"AAiCA,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,CA0DhC"}
@@ -12,13 +12,20 @@
12
12
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13
13
 
14
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';
15
+ */ import { promises as fs } from 'fs';
17
16
  import path from 'path';
18
17
  import { fileURLToPath } from 'url';
18
+ import { findUp } from '../findUp.js';
19
19
  import { resolveFrom } from './resolveFrom.js';
20
20
  const filename = fileURLToPath(import.meta.url);
21
21
  const dirname = path.dirname(filename);
22
+ const payloadPkgDirname = path.resolve(dirname, '../../../') // pkg dir (outside src)
23
+ ;
24
+ // if node_modules is in payloadPkgDirname, go to parent dir which contains node_modules
25
+ if (payloadPkgDirname.includes('node_modules')) {
26
+ payloadPkgDirname.split('node_modules').slice(0, -1);
27
+ }
28
+ const resolvedCwd = path.resolve(process.cwd());
22
29
  export async function getDependencies(baseDir, requiredPackages) {
23
30
  const resolutions = new Map();
24
31
  const missingPackages = [];
@@ -27,27 +34,21 @@ export async function getDependencies(baseDir, requiredPackages) {
27
34
  const pkgPath = await fs.realpath(resolveFrom(baseDir, pkg));
28
35
  const pkgDir = path.dirname(pkgPath);
29
36
  let packageJsonFilePath = null;
30
- const processCwd = process.cwd();
31
- const payloadPkgDirname = path.resolve(dirname, '../../../') // pkg dir (outside src)
32
- ;
33
- // if node_modules is in payloadPkgDirname, go to parent dir which contains node_modules
34
- if (payloadPkgDirname.includes('node_modules')) {
35
- payloadPkgDirname.split('node_modules').slice(0, -1);
36
- }
37
- await findUp('package.json', {
38
- type: 'file',
39
- cwd: pkgDir
40
- }).then((foundPath)=>{
41
- if (foundPath) {
42
- const resolvedFoundPath = path.resolve(foundPath);
43
- const resolvedCwd = path.resolve(processCwd);
44
- if (resolvedFoundPath.startsWith(resolvedCwd) || resolvedFoundPath.startsWith(payloadPkgDirname)) {
45
- // We don't want to match node modules outside the user's project. Checking for both process.cwd and dirname is a reliable way to do this.
46
- packageJsonFilePath = foundPath;
47
- }
48
- }
37
+ const foundPackageJsonDir = await findUp({
38
+ dir: pkgDir,
39
+ fileNames: [
40
+ 'package.json'
41
+ ]
49
42
  });
50
- if (packageJsonFilePath && existsSync(packageJsonFilePath)) {
43
+ if (foundPackageJsonDir) {
44
+ const resolvedFoundPath = path.resolve(foundPackageJsonDir);
45
+ if (resolvedFoundPath.startsWith(resolvedCwd) || resolvedFoundPath.startsWith(payloadPkgDirname)) {
46
+ // We don't want to match node modules outside the user's project. Checking for both process.cwd and dirname is a reliable way to do this.
47
+ packageJsonFilePath = resolvedFoundPath;
48
+ }
49
+ }
50
+ // No need to check if packageJsonFilePath exists - findUp checks that for us
51
+ if (packageJsonFilePath) {
51
52
  // parse version
52
53
  const packageJson = JSON.parse(await fs.readFile(packageJsonFilePath, 'utf8'));
53
54
  const version = packageJson.version;
@@ -1 +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 path from 'path'\nimport { fileURLToPath } from 'url'\n\nimport { resolveFrom } from './resolveFrom.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\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 = path.dirname(pkgPath)\n\n let packageJsonFilePath = null\n\n const processCwd = process.cwd()\n const payloadPkgDirname = path.resolve(dirname, '../../../') // pkg dir (outside src)\n\n // if node_modules is in payloadPkgDirname, go to parent dir which contains node_modules\n if (payloadPkgDirname.includes('node_modules')) {\n payloadPkgDirname.split('node_modules').slice(0, -1)\n }\n\n await findUp('package.json', { type: 'file', cwd: pkgDir }).then((foundPath) => {\n if (foundPath) {\n const resolvedFoundPath = path.resolve(foundPath)\n const resolvedCwd = path.resolve(processCwd)\n\n if (\n resolvedFoundPath.startsWith(resolvedCwd) ||\n resolvedFoundPath.startsWith(payloadPkgDirname)\n ) {\n // We don't want to match node modules outside the user's project. Checking for both process.cwd and dirname is a reliable way to do this.\n packageJsonFilePath = foundPath\n }\n }\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","path","fileURLToPath","resolveFrom","filename","url","dirname","getDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","pkg","pkgPath","realpath","pkgDir","packageJsonFilePath","processCwd","process","cwd","payloadPkgDirname","resolve","includes","split","slice","type","then","foundPath","resolvedFoundPath","resolvedCwd","startsW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WsB,sBAAsB;gBAC1D,gBAAgB;gBAChB,MAAMe,cAAcC,KAAKC,KAAK,CAAC,MAAMrC,GAAGsC,QAAQ,CAAClB,qBAAqB;gBACtE,MAAMmB,UAAUJ,YAAYI,OAAO;gBAEnC7B,YAAY8B,GAAG,CAACxB,KAAK;oBACnBf,MAAMmB;oBACNmB;gBACF;YACF,OAAO;gBACL,OAAO3B,gBAAgB6B,IAAI,CAACzB;YAC9B;QACF,EAAE,OAAO0B,GAAG;YACV,OAAO9B,gBAAgB6B,IAAI,CAACzB;QAC9B;IACF;IAGF,OAAO;QACL2B,SAAS/B;QACTgC,UAAUlC;IACZ;AACF"}
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 { promises as fs } from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\n\nimport { findUp } from '../findUp.js'\nimport { resolveFrom } from './resolveFrom.js'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\nconst payloadPkgDirname = path.resolve(dirname, '../../../') // pkg dir (outside src)\n// if node_modules is in payloadPkgDirname, go to parent dir which contains node_modules\nif (payloadPkgDirname.includes('node_modules')) {\n payloadPkgDirname.split('node_modules').slice(0, -1)\n}\nconst resolvedCwd = path.resolve(process.cwd())\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 const pkgDir = path.dirname(pkgPath)\n\n let packageJsonFilePath = null\n\n const foundPackageJsonDir = await findUp({\n dir: pkgDir,\n fileNames: ['package.json'],\n })\n\n if (foundPackageJsonDir) {\n const resolvedFoundPath = path.resolve(foundPackageJsonDir)\n\n if (\n resolvedFoundPath.startsWith(resolvedCwd) ||\n resolvedFoundPath.startsWith(payloadPkgDirname)\n ) {\n // We don't want to match node modules outside the user's project. Checking for both process.cwd and dirname is a reliable way to do this.\n packageJsonFilePath = resolvedFoundPath\n }\n }\n\n // No need to check if packageJsonFilePath exists - findUp checks that for us\n if (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":["promises","fs","path","fileURLToPath","findUp","resolveFrom","filename","url","dirname","payloadPkgDirname","resolve","includes","split","slice","resolvedCwd","process","cwd","getDependencies","baseDir","requiredPackages","resolutions","Map","missingPackages","Promise","all","map","pkg","pkgPath","realpath","pkgDir","packageJsonFilePath","foundPackageJsonDir","dir","fileNames","resolvedFoundPath","startsWith","packageJson","JSON","parse","readFile","version","set","push","_","missing","resolved"],"mappings":"AAAA;;;;;;;;;;;;;;AAcA,GAEA,SAASA,YAAYC,EAAE,QAAQ,KAAI;AACnC,OAAOC,UAAU,OAAM;AACvB,SAASC,aAAa,QAAQ,MAAK;AAEnC,SAASC,MAAM,QAAQ,eAAc;AACrC,SAASC,WAAW,QAAQ,mBAAkB;AAE9C,MAAMC,WAAWH,cAAc,YAAYI,GAAG;AAC9C,MAAMC,UAAUN,KAAKM,OAAO,CAACF;AAE7B,MAAMG,oBAAoBP,KAAKQ,OAAO,CAACF,SAAS,aAAa,wBAAwB;;AACrF,wFAAwF;AACxF,IAAIC,kBAAkBE,QAAQ,CAAC,iBAAiB;IAC9CF,kBAAkBG,KAAK,CAAC,gBAAgBC,KAAK,CAAC,GAAG,CAAC;AACpD;AACA,MAAMC,cAAcZ,KAAKQ,OAAO,CAACK,QAAQC,GAAG;AAa5C,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,MAAM1B,GAAG2B,QAAQ,CAACvB,YAAYa,SAASQ;YACvD,MAAMG,SAAS3B,KAAKM,OAAO,CAACmB;YAE5B,IAAIG,sBAAsB;YAE1B,MAAMC,sBAAsB,MAAM3B,OAAO;gBACvC4B,KAAKH;gBACLI,WAAW;oBAAC;iBAAe;YAC7B;YAEA,IAAIF,qBAAqB;gBACvB,MAAMG,oBAAoBhC,KAAKQ,OAAO,CAACqB;gBAEvC,IACEG,kBAAkBC,UAAU,CAACrB,gBAC7BoB,kBAAkBC,UAAU,CAAC1B,oBAC7B;oBACA,0IAA0I;oBAC1IqB,sBAAsBI;gBACxB;YACF;YAEA,6EAA6E;YAC7E,IAAIJ,qBAAqB;gBACvB,gBAAgB;gBAChB,MAAMM,cAAcC,KAAKC,KAAK,CAAC,MAAMrC,GAAGsC,QAAQ,CAACT,qBAAqB;gBACtE,MAAMU,UAAUJ,YAAYI,OAAO;gBAEnCpB,YAAYqB,GAAG,CAACf,KAAK;oBACnBxB,MAAM4B;oBACNU;gBACF;YACF,OAAO;gBACL,OAAOlB,gBAAgBoB,IAAI,CAAChB;YAC9B;QACF,EAAE,OAAOiB,GAAG;YACV,OAAOrB,gBAAgBoB,IAAI,CAAChB;QAC9B;IACF;IAGF,OAAO;QACLkB,SAAStB;QACTuB,UAAUzB;IACZ;AACF"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Synchronously walks up parent directories until a condition is met and/or one of the file names within the fileNames array is found.
3
+ */
4
+ export declare function findUpSync({ condition, dir, fileNames, }: {
5
+ condition?: (dir: string) => boolean | Promise<boolean | string> | string;
6
+ dir: string;
7
+ fileNames?: string[];
8
+ }): null | string;
9
+ /**
10
+ * Asynchronously walks up parent directories until a condition is met and/or one of the file names within the fileNames array is found.
11
+ */
12
+ export declare function findUp({ condition, dir, fileNames, }: {
13
+ condition?: (dir: string) => boolean | Promise<boolean | string> | string;
14
+ dir: string;
15
+ fileNames?: string[];
16
+ }): Promise<null | string>;
17
+ export declare function pathExistsAndIsAccessibleSync(path: string): boolean;
18
+ export declare function pathExistsAndIsAccessible(path: string): Promise<boolean>;
19
+ //# sourceMappingURL=findUp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findUp.d.ts","sourceRoot":"","sources":["../../src/utilities/findUp.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,GAAG,EACH,SAAS,GACV,EAAE;IACD,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB,GAAG,IAAI,GAAG,MAAM,CAkChB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,EAC3B,SAAS,EACT,GAAG,EACH,SAAS,GACV,EAAE;IACD,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,GAAG,MAAM,CAAA;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAkCzB;AAMD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,WAOzD;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,oBAO3D"}