payload 4.0.0-internal.ea6e8f8 → 4.0.0-internal.ee5d8bd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/adapters/router.d.ts +1 -1
- package/dist/admin/adapters/router.d.ts.map +1 -1
- package/dist/admin/adapters/router.js.map +1 -1
- package/dist/admin/forms/Diff.d.ts +0 -4
- package/dist/admin/forms/Diff.d.ts.map +1 -1
- package/dist/admin/forms/Diff.js.map +1 -1
- package/dist/admin/forms/Form.d.ts +0 -2
- package/dist/admin/forms/Form.d.ts.map +1 -1
- package/dist/admin/forms/Form.js.map +1 -1
- package/dist/admin/initAdminContext.d.ts.map +1 -1
- package/dist/admin/initAdminContext.js +0 -10
- package/dist/admin/initAdminContext.js.map +1 -1
- package/dist/auth/createAuthToken.d.ts +26 -0
- package/dist/auth/createAuthToken.d.ts.map +1 -0
- package/dist/auth/createAuthToken.js +39 -0
- package/dist/auth/createAuthToken.js.map +1 -0
- package/dist/auth/endpoints/refresh.d.ts.map +1 -1
- package/dist/auth/endpoints/refresh.js +2 -1
- package/dist/auth/endpoints/refresh.js.map +1 -1
- package/dist/auth/getFieldsToSign.js.map +1 -1
- package/dist/auth/loginWithCookie.d.ts.map +1 -1
- package/dist/auth/loginWithCookie.js +1 -0
- package/dist/auth/loginWithCookie.js.map +1 -1
- package/dist/auth/operations/local/login.d.ts.map +1 -1
- package/dist/auth/operations/local/login.js +1 -0
- package/dist/auth/operations/local/login.js.map +1 -1
- package/dist/auth/operations/login.d.ts +2 -0
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/login.js +6 -19
- package/dist/auth/operations/login.js.map +1 -1
- package/dist/auth/operations/refresh.d.ts +8 -0
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/refresh.js +50 -19
- package/dist/auth/operations/refresh.js.map +1 -1
- package/dist/auth/operations/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/resetPassword.js +54 -20
- package/dist/auth/operations/resetPassword.js.map +1 -1
- package/dist/auth/refreshAuthToken.d.ts +32 -0
- package/dist/auth/refreshAuthToken.d.ts.map +1 -0
- package/dist/auth/refreshAuthToken.js +113 -0
- package/dist/auth/refreshAuthToken.js.map +1 -0
- package/dist/auth/serverFunctions/cookies.js.map +1 -1
- package/dist/auth/serverFunctions/login.js.map +1 -1
- package/dist/auth/sessions.d.ts +9 -2
- package/dist/auth/sessions.d.ts.map +1 -1
- package/dist/auth/sessions.js +6 -5
- package/dist/auth/sessions.js.map +1 -1
- package/dist/auth/types.d.ts +25 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/types.js.map +1 -1
- package/dist/cli/commands/data/utilities.d.ts +1 -1
- package/dist/cli/commands/data/utilities.d.ts.map +1 -1
- package/dist/cli/commands/data/utilities.js.map +1 -1
- package/dist/cli/defineCLICommand.js +1 -1
- package/dist/cli/defineCLICommand.js.map +1 -1
- package/dist/collections/config/client.d.ts +1 -1
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js +0 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/defaults.d.ts +2 -0
- package/dist/collections/config/defaults.d.ts.map +1 -1
- package/dist/collections/config/defaults.js +4 -0
- package/dist/collections/config/defaults.js.map +1 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +3 -0
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/sanitizeCompoundIndexes.d.ts.map +1 -1
- package/dist/collections/config/sanitizeCompoundIndexes.js +0 -9
- package/dist/collections/config/sanitizeCompoundIndexes.js.map +1 -1
- package/dist/collections/config/types.d.ts +4 -21
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/dataloader.d.ts +1 -10
- package/dist/collections/dataloader.d.ts.map +1 -1
- package/dist/collections/dataloader.js +6 -14
- package/dist/collections/dataloader.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +0 -13
- package/dist/collections/operations/create.js.map +1 -1
- package/dist/collections/operations/delete.d.ts.map +1 -1
- package/dist/collections/operations/delete.js +121 -638
- package/dist/collections/operations/delete.js.map +1 -1
- package/dist/collections/operations/deleteByID.d.ts.map +1 -1
- package/dist/collections/operations/deleteByID.js +32 -238
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +0 -6
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/findDistinct.js +6 -7
- package/dist/collections/operations/findDistinct.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js +7 -0
- package/dist/collections/operations/findVersionByID.js.map +1 -1
- package/dist/collections/operations/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/findVersions.js +5 -0
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/local/count.d.ts +4 -9
- package/dist/collections/operations/local/count.d.ts.map +1 -1
- package/dist/collections/operations/local/count.js.map +1 -1
- package/dist/collections/operations/local/countVersions.d.ts +0 -4
- package/dist/collections/operations/local/countVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/countVersions.js.map +1 -1
- package/dist/collections/operations/local/create.d.ts +4 -9
- package/dist/collections/operations/local/create.d.ts.map +1 -1
- package/dist/collections/operations/local/create.js.map +1 -1
- package/dist/collections/operations/local/delete.d.ts +4 -9
- package/dist/collections/operations/local/delete.d.ts.map +1 -1
- package/dist/collections/operations/local/delete.js.map +1 -1
- package/dist/collections/operations/local/duplicate.d.ts +0 -5
- package/dist/collections/operations/local/duplicate.d.ts.map +1 -1
- package/dist/collections/operations/local/duplicate.js.map +1 -1
- package/dist/collections/operations/local/find.d.ts +4 -9
- package/dist/collections/operations/local/find.d.ts.map +1 -1
- package/dist/collections/operations/local/find.js.map +1 -1
- package/dist/collections/operations/local/findByID.d.ts +4 -9
- package/dist/collections/operations/local/findByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findByID.js.map +1 -1
- package/dist/collections/operations/local/findDistinct.d.ts +0 -5
- package/dist/collections/operations/local/findDistinct.d.ts.map +1 -1
- package/dist/collections/operations/local/findDistinct.js.map +1 -1
- package/dist/collections/operations/local/findVersionByID.d.ts +0 -5
- package/dist/collections/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersionByID.js.map +1 -1
- package/dist/collections/operations/local/findVersions.d.ts +0 -5
- package/dist/collections/operations/local/findVersions.d.ts.map +1 -1
- package/dist/collections/operations/local/findVersions.js.map +1 -1
- package/dist/collections/operations/local/restoreVersion.d.ts +0 -5
- package/dist/collections/operations/local/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/local/restoreVersion.js.map +1 -1
- package/dist/collections/operations/local/update.d.ts +4 -9
- package/dist/collections/operations/local/update.d.ts.map +1 -1
- package/dist/collections/operations/local/update.js.map +1 -1
- package/dist/collections/operations/renameFile.js +1 -1
- package/dist/collections/operations/renameFile.js.map +1 -1
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +76 -157
- package/dist/collections/operations/restoreVersion.js.map +1 -1
- package/dist/collections/operations/update.d.ts.map +1 -1
- package/dist/collections/operations/update.js +171 -357
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts +0 -15
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +60 -265
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/collections/operations/utilities/buildBeforeOperation.d.ts.map +1 -1
- package/dist/collections/operations/utilities/buildBeforeOperation.js +0 -7
- package/dist/collections/operations/utilities/buildBeforeOperation.js.map +1 -1
- package/dist/collections/operations/utilities/update.d.ts +1 -14
- package/dist/collections/operations/utilities/update.d.ts.map +1 -1
- package/dist/collections/operations/utilities/update.js +20 -92
- package/dist/collections/operations/utilities/update.js.map +1 -1
- package/dist/collections/operations/validate.js +4 -4
- package/dist/collections/operations/validate.js.map +1 -1
- package/dist/config/client.d.ts +1 -3
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +1 -9
- package/dist/config/client.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +1 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/definePlugin.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +2 -40
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +13 -21
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/database/defaultCopy.d.ts.map +1 -1
- package/dist/database/defaultCopy.js +0 -1
- package/dist/database/defaultCopy.js.map +1 -1
- package/dist/database/types.d.ts +4 -75
- package/dist/database/types.d.ts.map +1 -1
- package/dist/database/types.js.map +1 -1
- package/dist/exports/build-config.d.ts +9 -0
- package/dist/exports/build-config.d.ts.map +1 -0
- package/dist/exports/build-config.js +38 -0
- package/dist/exports/build-config.js.map +1 -0
- package/dist/exports/shared.d.ts +0 -2
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +0 -2
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/authorship/index.d.ts +1 -2
- package/dist/fields/baseFields/authorship/index.d.ts.map +1 -1
- package/dist/fields/baseFields/authorship/index.js +0 -12
- package/dist/fields/baseFields/authorship/index.js.map +1 -1
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/reservedFieldNames.d.ts.map +1 -1
- package/dist/fields/config/reservedFieldNames.js.map +1 -1
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/hooks/afterChange/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/index.d.ts +0 -8
- package/dist/fields/hooks/afterRead/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/index.js +2 -6
- package/dist/fields/hooks/afterRead/index.js.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts +1 -3
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.js +17 -41
- package/dist/fields/hooks/afterRead/promise.js.map +1 -1
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js +0 -2
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.js.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts +1 -3
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.js +2 -4
- package/dist/fields/hooks/afterRead/traverseFields.js.map +1 -1
- package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.js +0 -3
- package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/flattenValidationData.d.ts +14 -0
- package/dist/fields/hooks/beforeChange/flattenValidationData.d.ts.map +1 -0
- package/dist/fields/hooks/beforeChange/flattenValidationData.js +36 -0
- package/dist/fields/hooks/beforeChange/flattenValidationData.js.map +1 -0
- package/dist/fields/hooks/beforeChange/promise.d.ts +2 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.js +96 -22
- package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js +2 -1
- package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.js +0 -8
- package/dist/fields/hooks/beforeValidate/promise.js.map +1 -1
- package/dist/fields/validations.d.ts.map +1 -1
- package/dist/fields/validations.js +4 -1
- package/dist/fields/validations.js.map +1 -1
- package/dist/globals/config/types.d.ts +2 -6
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/countGlobalVersions.d.ts.map +1 -1
- package/dist/globals/operations/countGlobalVersions.js +0 -7
- package/dist/globals/operations/countGlobalVersions.js.map +1 -1
- package/dist/globals/operations/findOne.d.ts.map +1 -1
- package/dist/globals/operations/findOne.js +0 -7
- package/dist/globals/operations/findOne.js.map +1 -1
- package/dist/globals/operations/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/findVersionByID.js +6 -6
- package/dist/globals/operations/findVersionByID.js.map +1 -1
- package/dist/globals/operations/findVersions.d.ts.map +1 -1
- package/dist/globals/operations/findVersions.js +4 -6
- package/dist/globals/operations/findVersions.js.map +1 -1
- package/dist/globals/operations/local/countVersions.d.ts +0 -5
- package/dist/globals/operations/local/countVersions.d.ts.map +1 -1
- package/dist/globals/operations/local/countVersions.js.map +1 -1
- package/dist/globals/operations/local/findOne.d.ts +0 -5
- package/dist/globals/operations/local/findOne.d.ts.map +1 -1
- package/dist/globals/operations/local/findOne.js.map +1 -1
- package/dist/globals/operations/local/findVersionByID.d.ts +0 -5
- package/dist/globals/operations/local/findVersionByID.d.ts.map +1 -1
- package/dist/globals/operations/local/findVersionByID.js.map +1 -1
- package/dist/globals/operations/local/findVersions.d.ts +0 -5
- package/dist/globals/operations/local/findVersions.d.ts.map +1 -1
- package/dist/globals/operations/local/findVersions.js.map +1 -1
- package/dist/globals/operations/local/restoreVersion.d.ts +0 -5
- package/dist/globals/operations/local/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/local/restoreVersion.js.map +1 -1
- package/dist/globals/operations/local/update.d.ts +0 -5
- package/dist/globals/operations/local/update.d.ts.map +1 -1
- package/dist/globals/operations/local/update.js +18 -61
- package/dist/globals/operations/local/update.js.map +1 -1
- package/dist/globals/operations/restoreVersion.d.ts +2 -3
- package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
- package/dist/globals/operations/restoreVersion.js +24 -61
- package/dist/globals/operations/restoreVersion.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +8 -86
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/globals/operations/validate.js +1 -1
- package/dist/globals/operations/validate.js.map +1 -1
- package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -1
- package/dist/hierarchy/addHierarchyToCollection.js +32 -21
- package/dist/hierarchy/addHierarchyToCollection.js.map +1 -1
- package/dist/hierarchy/createFolderField.js.map +1 -1
- package/dist/hierarchy/getInitialTreeData.d.ts +1 -3
- package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -1
- package/dist/hierarchy/getInitialTreeData.js +1 -4
- package/dist/hierarchy/getInitialTreeData.js.map +1 -1
- package/dist/hierarchy/resolveHierarchyCollections.js +9 -3
- package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -1
- package/dist/hierarchy/utils/computePaths.d.ts.map +1 -1
- package/dist/hierarchy/utils/computePaths.js.map +1 -1
- package/dist/index.bundled.d.ts +4336 -5501
- package/dist/index.d.ts +27 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -37
- package/dist/index.js.map +1 -1
- package/dist/llm-instructions/getInstructionsCollection.d.ts.map +1 -1
- package/dist/llm-instructions/getInstructionsCollection.js +2 -0
- package/dist/llm-instructions/getInstructionsCollection.js.map +1 -1
- package/dist/preferences/keys.d.ts +4 -11
- package/dist/preferences/keys.d.ts.map +1 -1
- package/dist/preferences/keys.js +3 -10
- package/dist/preferences/keys.js.map +1 -1
- package/dist/preferences/types.d.ts +0 -19
- package/dist/preferences/types.d.ts.map +1 -1
- package/dist/preferences/types.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/deleteAssociatedFiles.d.ts.map +1 -1
- package/dist/uploads/deleteAssociatedFiles.js +29 -108
- package/dist/uploads/deleteAssociatedFiles.js.map +1 -1
- package/dist/uploads/endpoints/getFile.d.ts.map +1 -1
- package/dist/uploads/endpoints/getFile.js +0 -5
- package/dist/uploads/endpoints/getFile.js.map +1 -1
- package/dist/uploads/fileExists.d.ts.map +1 -1
- package/dist/uploads/fileExists.js +2 -5
- package/dist/uploads/fileExists.js.map +1 -1
- package/dist/uploads/fileVersioning/archive.d.ts.map +1 -1
- package/dist/uploads/fileVersioning/archive.js +1 -15
- package/dist/uploads/fileVersioning/archive.js.map +1 -1
- package/dist/uploads/fileVersioning/cleanup.d.ts +0 -7
- package/dist/uploads/fileVersioning/cleanup.d.ts.map +1 -1
- package/dist/uploads/fileVersioning/cleanup.js +0 -12
- package/dist/uploads/fileVersioning/cleanup.js.map +1 -1
- package/dist/uploads/fileVersioning/cloudStorage.d.ts.map +1 -1
- package/dist/uploads/fileVersioning/cloudStorage.js +1 -16
- package/dist/uploads/fileVersioning/cloudStorage.js.map +1 -1
- package/dist/uploads/fileVersioning/resolveHistoricalFile.js.map +1 -1
- package/dist/uploads/formatFilesize.js +1 -1
- package/dist/uploads/formatFilesize.js.map +1 -1
- package/dist/uploads/generateFileData.d.ts +0 -5
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/generateFileData.js +2 -74
- package/dist/uploads/generateFileData.js.map +1 -1
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getBaseFields.js +29 -46
- package/dist/uploads/getBaseFields.js.map +1 -1
- package/dist/uploads/getFileContentRequirement.js.map +1 -1
- package/dist/uploads/getFileFromUploadInstructions.js.map +1 -1
- package/dist/uploads/getSafeFilename.d.ts.map +1 -1
- package/dist/uploads/getSafeFilename.js +3 -5
- package/dist/uploads/getSafeFilename.js.map +1 -1
- package/dist/uploads/safeFetch.js.map +1 -1
- package/dist/uploads/stagedUpload.js.map +1 -1
- package/dist/uploads/transformers/handleDynamicFileRequest.js +11 -2
- package/dist/uploads/transformers/handleDynamicFileRequest.js.map +1 -1
- package/dist/uploads/types.d.ts +0 -11
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/uploads/uploadFiles.d.ts +1 -4
- package/dist/uploads/uploadFiles.d.ts.map +1 -1
- package/dist/uploads/uploadFiles.js +5 -29
- package/dist/uploads/uploadFiles.js.map +1 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.js +0 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.js.map +1 -1
- package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -1
- package/dist/utilities/assertNoValidationWrite.d.ts.map +1 -1
- package/dist/utilities/assertNoValidationWrite.js +0 -4
- package/dist/utilities/assertNoValidationWrite.js.map +1 -1
- package/dist/utilities/checkDocumentLockStatus.d.ts +6 -15
- package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
- package/dist/utilities/checkDocumentLockStatus.js +11 -44
- package/dist/utilities/checkDocumentLockStatus.js.map +1 -1
- package/dist/utilities/cloneValidationRequest.js.map +1 -1
- package/dist/utilities/commitTransaction.d.ts +0 -4
- package/dist/utilities/commitTransaction.d.ts.map +1 -1
- package/dist/utilities/commitTransaction.js +1 -41
- package/dist/utilities/commitTransaction.js.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +2 -18
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts +0 -5
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/createPayloadRequest.js +3 -50
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/createPayloadRequestFromWebRequest.d.ts +12 -1
- package/dist/utilities/createPayloadRequestFromWebRequest.d.ts.map +1 -1
- package/dist/utilities/createPayloadRequestFromWebRequest.js +9 -5
- package/dist/utilities/createPayloadRequestFromWebRequest.js.map +1 -1
- package/dist/utilities/deepCopyObject.js.map +1 -1
- package/dist/utilities/documentMatchingWhereExists.js +1 -1
- package/dist/utilities/documentMatchingWhereExists.js.map +1 -1
- package/dist/utilities/entityInputSchema/validateEntityData.d.ts.map +1 -1
- package/dist/utilities/entityInputSchema/validateEntityData.js.map +1 -1
- package/dist/utilities/filterDataToSelectedLocales.js.map +1 -1
- package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js +1 -0
- package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
- package/dist/utilities/getVersionsConfig.d.ts +4 -0
- package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
- package/dist/utilities/getVersionsConfig.js +5 -0
- package/dist/utilities/getVersionsConfig.js.map +1 -1
- package/dist/utilities/handleEndpoints.d.ts.map +1 -1
- package/dist/utilities/handleEndpoints.js +10 -9
- package/dist/utilities/handleEndpoints.js.map +1 -1
- package/dist/utilities/httpStatus.d.ts +0 -2
- package/dist/utilities/httpStatus.d.ts.map +1 -1
- package/dist/utilities/httpStatus.js +1 -3
- package/dist/utilities/httpStatus.js.map +1 -1
- package/dist/utilities/initTransaction.d.ts.map +1 -1
- package/dist/utilities/initTransaction.js +7 -35
- package/dist/utilities/initTransaction.js.map +1 -1
- package/dist/utilities/killTransaction.d.ts.map +1 -1
- package/dist/utilities/killTransaction.js +0 -27
- package/dist/utilities/killTransaction.js.map +1 -1
- package/dist/utilities/parseParams/index.js.map +1 -1
- package/dist/utilities/parseValidationLocale.js.map +1 -1
- package/dist/utilities/sanitizePopulateParam.js.map +1 -1
- package/dist/utilities/telemetry/conf/index.d.ts +4 -1
- package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/conf/index.js.map +1 -1
- package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js.map +1 -1
- package/dist/versions/allLocalesPublicationStatus.js.map +1 -1
- package/dist/versions/buildCollectionFields.d.ts.map +1 -1
- package/dist/versions/buildCollectionFields.js +0 -23
- package/dist/versions/buildCollectionFields.js.map +1 -1
- package/dist/versions/buildGlobalFields.d.ts.map +1 -1
- package/dist/versions/buildGlobalFields.js +0 -14
- package/dist/versions/buildGlobalFields.js.map +1 -1
- package/dist/versions/buildVersionCompoundIndexes.d.ts.map +1 -1
- package/dist/versions/buildVersionCompoundIndexes.js +2 -8
- package/dist/versions/buildVersionCompoundIndexes.js.map +1 -1
- package/dist/versions/deleteCollectionVersions.d.ts +1 -2
- package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
- package/dist/versions/deleteCollectionVersions.js +8 -37
- package/dist/versions/deleteCollectionVersions.js.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.js +0 -4
- package/dist/versions/deleteScheduledPublishJobs.js.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.js +1 -9
- package/dist/versions/drafts/appendVersionToQueryKey.js.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.js +1 -8
- package/dist/versions/drafts/replaceWithDraftIfAvailable.js.map +1 -1
- package/dist/versions/enforceMaxVersions.d.ts +0 -1
- package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
- package/dist/versions/enforceMaxVersions.js +6 -22
- package/dist/versions/enforceMaxVersions.js.map +1 -1
- package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
- package/dist/versions/getLatestCollectionVersion.js +2 -10
- package/dist/versions/getLatestCollectionVersion.js.map +1 -1
- package/dist/versions/getLatestGlobalVersion.d.ts +2 -6
- package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
- package/dist/versions/getLatestGlobalVersion.js +21 -65
- package/dist/versions/getLatestGlobalVersion.js.map +1 -1
- package/dist/versions/isInheritedReadVersionsAccess.js.map +1 -1
- package/dist/versions/saveVersion.d.ts +0 -7
- package/dist/versions/saveVersion.d.ts.map +1 -1
- package/dist/versions/saveVersion.js +4 -27
- package/dist/versions/saveVersion.js.map +1 -1
- package/dist/versions/updateLatestVersion.d.ts +0 -1
- package/dist/versions/updateLatestVersion.d.ts.map +1 -1
- package/dist/versions/updateLatestVersion.js +7 -24
- package/dist/versions/updateLatestVersion.js.map +1 -1
- package/package.json +30 -28
- package/skills/payload/reference/ENDPOINTS.md +3 -9
- package/skills/payload/reference/PLUGIN-DEVELOPMENT.md +4 -4
- package/dist/admin/getAdminPreferences.d.ts +0 -10
- package/dist/admin/getAdminPreferences.d.ts.map +0 -1
- package/dist/admin/getAdminPreferences.js +0 -53
- package/dist/admin/getAdminPreferences.js.map +0 -1
- package/dist/admin/getRequestBranch.d.ts +0 -6
- package/dist/admin/getRequestBranch.d.ts.map +0 -1
- package/dist/admin/getRequestBranch.js +0 -17
- package/dist/admin/getRequestBranch.js.map +0 -1
- package/dist/branching/appendBranchFilter.d.ts +0 -30
- package/dist/branching/appendBranchFilter.d.ts.map +0 -1
- package/dist/branching/appendBranchFilter.js +0 -105
- package/dist/branching/appendBranchFilter.js.map +0 -1
- package/dist/branching/assertBranchAccess.d.ts +0 -10
- package/dist/branching/assertBranchAccess.d.ts.map +0 -1
- package/dist/branching/assertBranchAccess.js +0 -36
- package/dist/branching/assertBranchAccess.js.map +0 -1
- package/dist/branching/assertBranchActionAccess.d.ts +0 -10
- package/dist/branching/assertBranchActionAccess.d.ts.map +0 -1
- package/dist/branching/assertBranchActionAccess.js +0 -15
- package/dist/branching/assertBranchActionAccess.js.map +0 -1
- package/dist/branching/assertBranchCreatedDocumentsUnreferenced.d.ts +0 -53
- package/dist/branching/assertBranchCreatedDocumentsUnreferenced.d.ts.map +0 -1
- package/dist/branching/assertBranchCreatedDocumentsUnreferenced.js +0 -833
- package/dist/branching/assertBranchCreatedDocumentsUnreferenced.js.map +0 -1
- package/dist/branching/assertBranchReadable.d.ts +0 -36
- package/dist/branching/assertBranchReadable.d.ts.map +0 -1
- package/dist/branching/assertBranchReadable.js +0 -83
- package/dist/branching/assertBranchReadable.js.map +0 -1
- package/dist/branching/assertBranchUpdateAccess.d.ts +0 -8
- package/dist/branching/assertBranchUpdateAccess.d.ts.map +0 -1
- package/dist/branching/assertBranchUpdateAccess.js +0 -12
- package/dist/branching/assertBranchUpdateAccess.js.map +0 -1
- package/dist/branching/assertBranchWritable.d.ts +0 -18
- package/dist/branching/assertBranchWritable.d.ts.map +0 -1
- package/dist/branching/assertBranchWritable.js +0 -46
- package/dist/branching/assertBranchWritable.js.map +0 -1
- package/dist/branching/branchIDs.d.ts +0 -38
- package/dist/branching/branchIDs.d.ts.map +0 -1
- package/dist/branching/branchIDs.js +0 -113
- package/dist/branching/branchIDs.js.map +0 -1
- package/dist/branching/branchSelect.d.ts +0 -42
- package/dist/branching/branchSelect.d.ts.map +0 -1
- package/dist/branching/branchSelect.js +0 -97
- package/dist/branching/branchSelect.js.map +0 -1
- package/dist/branching/checkFieldAccess.d.ts +0 -21
- package/dist/branching/checkFieldAccess.d.ts.map +0 -1
- package/dist/branching/checkFieldAccess.js +0 -238
- package/dist/branching/checkFieldAccess.js.map +0 -1
- package/dist/branching/collections.d.ts +0 -14
- package/dist/branching/collections.d.ts.map +0 -1
- package/dist/branching/collections.js +0 -713
- package/dist/branching/collections.js.map +0 -1
- package/dist/branching/combineBranchAccess.d.ts +0 -6
- package/dist/branching/combineBranchAccess.d.ts.map +0 -1
- package/dist/branching/combineBranchAccess.js +0 -22
- package/dist/branching/combineBranchAccess.js.map +0 -1
- package/dist/branching/copyUploadFilesToBranch.d.ts +0 -9
- package/dist/branching/copyUploadFilesToBranch.d.ts.map +0 -1
- package/dist/branching/copyUploadFilesToBranch.js +0 -126
- package/dist/branching/copyUploadFilesToBranch.js.map +0 -1
- package/dist/branching/createShadowRow.d.ts +0 -70
- package/dist/branching/createShadowRow.d.ts.map +0 -1
- package/dist/branching/createShadowRow.js +0 -296
- package/dist/branching/createShadowRow.js.map +0 -1
- package/dist/branching/discard.d.ts +0 -52
- package/dist/branching/discard.d.ts.map +0 -1
- package/dist/branching/discard.js +0 -428
- package/dist/branching/discard.js.map +0 -1
- package/dist/branching/effectiveOperations.d.ts +0 -55
- package/dist/branching/effectiveOperations.d.ts.map +0 -1
- package/dist/branching/effectiveOperations.js +0 -472
- package/dist/branching/effectiveOperations.js.map +0 -1
- package/dist/branching/endpoints/discard.d.ts +0 -15
- package/dist/branching/endpoints/discard.d.ts.map +0 -1
- package/dist/branching/endpoints/discard.js +0 -55
- package/dist/branching/endpoints/discard.js.map +0 -1
- package/dist/branching/endpoints/merge.d.ts +0 -34
- package/dist/branching/endpoints/merge.d.ts.map +0 -1
- package/dist/branching/endpoints/merge.js +0 -119
- package/dist/branching/endpoints/merge.js.map +0 -1
- package/dist/branching/forkDocument.d.ts +0 -20
- package/dist/branching/forkDocument.d.ts.map +0 -1
- package/dist/branching/forkDocument.js +0 -169
- package/dist/branching/forkDocument.js.map +0 -1
- package/dist/branching/globalMergeWrites.d.ts +0 -21
- package/dist/branching/globalMergeWrites.d.ts.map +0 -1
- package/dist/branching/globalMergeWrites.js +0 -146
- package/dist/branching/globalMergeWrites.js.map +0 -1
- package/dist/branching/globals.d.ts +0 -49
- package/dist/branching/globals.d.ts.map +0 -1
- package/dist/branching/globals.js +0 -197
- package/dist/branching/globals.js.map +0 -1
- package/dist/branching/hooks.d.ts +0 -24
- package/dist/branching/hooks.d.ts.map +0 -1
- package/dist/branching/hooks.js +0 -92
- package/dist/branching/hooks.js.map +0 -1
- package/dist/branching/injectBranchFields.d.ts +0 -40
- package/dist/branching/injectBranchFields.d.ts.map +0 -1
- package/dist/branching/injectBranchFields.js +0 -229
- package/dist/branching/injectBranchFields.js.map +0 -1
- package/dist/branching/merge/applyMergeChange.d.ts +0 -27
- package/dist/branching/merge/applyMergeChange.d.ts.map +0 -1
- package/dist/branching/merge/applyMergeChange.js +0 -853
- package/dist/branching/merge/applyMergeChange.js.map +0 -1
- package/dist/branching/merge/branchMergeStatus.d.ts +0 -12
- package/dist/branching/merge/branchMergeStatus.d.ts.map +0 -1
- package/dist/branching/merge/branchMergeStatus.js +0 -74
- package/dist/branching/merge/branchMergeStatus.js.map +0 -1
- package/dist/branching/merge/executeMerge.d.ts +0 -22
- package/dist/branching/merge/executeMerge.d.ts.map +0 -1
- package/dist/branching/merge/executeMerge.js +0 -600
- package/dist/branching/merge/executeMerge.js.map +0 -1
- package/dist/branching/merge/finalizeMerge.d.ts +0 -40
- package/dist/branching/merge/finalizeMerge.d.ts.map +0 -1
- package/dist/branching/merge/finalizeMerge.js +0 -237
- package/dist/branching/merge/finalizeMerge.js.map +0 -1
- package/dist/branching/merge/mergeLedger.d.ts +0 -40
- package/dist/branching/merge/mergeLedger.d.ts.map +0 -1
- package/dist/branching/merge/mergeLedger.js +0 -130
- package/dist/branching/merge/mergeLedger.js.map +0 -1
- package/dist/branching/merge/prepareMerge.d.ts +0 -41
- package/dist/branching/merge/prepareMerge.d.ts.map +0 -1
- package/dist/branching/merge/prepareMerge.js +0 -234
- package/dist/branching/merge/prepareMerge.js.map +0 -1
- package/dist/branching/merge/recoverMerge.d.ts +0 -16
- package/dist/branching/merge/recoverMerge.d.ts.map +0 -1
- package/dist/branching/merge/recoverMerge.js +0 -199
- package/dist/branching/merge/recoverMerge.js.map +0 -1
- package/dist/branching/merge/retryFailedCleanups.d.ts +0 -36
- package/dist/branching/merge/retryFailedCleanups.d.ts.map +0 -1
- package/dist/branching/merge/retryFailedCleanups.js +0 -335
- package/dist/branching/merge/retryFailedCleanups.js.map +0 -1
- package/dist/branching/merge/utilities.d.ts +0 -35
- package/dist/branching/merge/utilities.d.ts.map +0 -1
- package/dist/branching/merge/utilities.js +0 -54
- package/dist/branching/merge/utilities.js.map +0 -1
- package/dist/branching/merge.d.ts +0 -88
- package/dist/branching/merge.d.ts.map +0 -1
- package/dist/branching/merge.js +0 -163
- package/dist/branching/merge.js.map +0 -1
- package/dist/branching/mergeWriteGuard.d.ts +0 -20
- package/dist/branching/mergeWriteGuard.d.ts.map +0 -1
- package/dist/branching/mergeWriteGuard.js +0 -27
- package/dist/branching/mergeWriteGuard.js.map +0 -1
- package/dist/branching/preflight.d.ts +0 -71
- package/dist/branching/preflight.d.ts.map +0 -1
- package/dist/branching/preflight.js +0 -757
- package/dist/branching/preflight.js.map +0 -1
- package/dist/branching/readLocalizedBranchWrite.d.ts +0 -14
- package/dist/branching/readLocalizedBranchWrite.d.ts.map +0 -1
- package/dist/branching/readLocalizedBranchWrite.js +0 -90
- package/dist/branching/readLocalizedBranchWrite.js.map +0 -1
- package/dist/branching/readMergeSnapshot.d.ts +0 -18
- package/dist/branching/readMergeSnapshot.d.ts.map +0 -1
- package/dist/branching/readMergeSnapshot.js +0 -99
- package/dist/branching/readMergeSnapshot.js.map +0 -1
- package/dist/branching/resolveBranch.d.ts +0 -153
- package/dist/branching/resolveBranch.d.ts.map +0 -1
- package/dist/branching/resolveBranch.js +0 -363
- package/dist/branching/resolveBranch.js.map +0 -1
- package/dist/branching/resolveBranchActionAccess.d.ts +0 -8
- package/dist/branching/resolveBranchActionAccess.d.ts.map +0 -1
- package/dist/branching/resolveBranchActionAccess.js +0 -9
- package/dist/branching/resolveBranchActionAccess.js.map +0 -1
- package/dist/branching/resolveBranchQuery.d.ts +0 -48
- package/dist/branching/resolveBranchQuery.d.ts.map +0 -1
- package/dist/branching/resolveBranchQuery.js +0 -115
- package/dist/branching/resolveBranchQuery.js.map +0 -1
- package/dist/branching/resolveBranchRowID.d.ts +0 -22
- package/dist/branching/resolveBranchRowID.d.ts.map +0 -1
- package/dist/branching/resolveBranchRowID.js +0 -70
- package/dist/branching/resolveBranchRowID.js.map +0 -1
- package/dist/branching/sanitizeBranchingConfig.d.ts +0 -31
- package/dist/branching/sanitizeBranchingConfig.d.ts.map +0 -1
- package/dist/branching/sanitizeBranchingConfig.js +0 -110
- package/dist/branching/sanitizeBranchingConfig.js.map +0 -1
- package/dist/branching/schedule/job.d.ts +0 -51
- package/dist/branching/schedule/job.d.ts.map +0 -1
- package/dist/branching/schedule/job.js +0 -151
- package/dist/branching/schedule/job.js.map +0 -1
- package/dist/branching/selectBranchChanges.d.ts +0 -8
- package/dist/branching/selectBranchChanges.d.ts.map +0 -1
- package/dist/branching/selectBranchChanges.js +0 -9
- package/dist/branching/selectBranchChanges.js.map +0 -1
- package/dist/branching/stripBranchMergeData.d.ts +0 -11
- package/dist/branching/stripBranchMergeData.d.ts.map +0 -1
- package/dist/branching/stripBranchMergeData.js +0 -20
- package/dist/branching/stripBranchMergeData.js.map +0 -1
- package/dist/branching/tombstone.d.ts +0 -91
- package/dist/branching/tombstone.d.ts.map +0 -1
- package/dist/branching/tombstone.js +0 -546
- package/dist/branching/tombstone.js.map +0 -1
- package/dist/branching/types.d.ts +0 -158
- package/dist/branching/types.d.ts.map +0 -1
- package/dist/branching/types.js +0 -54
- package/dist/branching/types.js.map +0 -1
- package/dist/branching/validation.d.ts +0 -47
- package/dist/branching/validation.d.ts.map +0 -1
- package/dist/branching/validation.js +0 -272
- package/dist/branching/validation.js.map +0 -1
- package/dist/branching/versions.d.ts +0 -131
- package/dist/branching/versions.d.ts.map +0 -1
- package/dist/branching/versions.js +0 -572
- package/dist/branching/versions.js.map +0 -1
- package/dist/collections/operations/utilities/createOperationRetryRequest.d.ts +0 -23
- package/dist/collections/operations/utilities/createOperationRetryRequest.d.ts.map +0 -1
- package/dist/collections/operations/utilities/createOperationRetryRequest.js +0 -683
- package/dist/collections/operations/utilities/createOperationRetryRequest.js.map +0 -1
- package/dist/fields/hooks/beforeValidate/throwOnAccessDenied.d.ts +0 -3
- package/dist/fields/hooks/beforeValidate/throwOnAccessDenied.d.ts.map +0 -1
- package/dist/fields/hooks/beforeValidate/throwOnAccessDenied.js +0 -3
- package/dist/fields/hooks/beforeValidate/throwOnAccessDenied.js.map +0 -1
- package/dist/uploads/appendBranchToFileURL.d.ts +0 -6
- package/dist/uploads/appendBranchToFileURL.d.ts.map +0 -1
- package/dist/uploads/appendBranchToFileURL.js +0 -24
- package/dist/uploads/appendBranchToFileURL.js.map +0 -1
- package/dist/uploads/deleteUploadFilesExclusiveToDocument.d.ts +0 -15
- package/dist/uploads/deleteUploadFilesExclusiveToDocument.d.ts.map +0 -1
- package/dist/uploads/deleteUploadFilesExclusiveToDocument.js +0 -62
- package/dist/uploads/deleteUploadFilesExclusiveToDocument.js.map +0 -1
- package/dist/uploads/fileIdentity.d.ts +0 -24
- package/dist/uploads/fileIdentity.d.ts.map +0 -1
- package/dist/uploads/fileIdentity.js +0 -36
- package/dist/uploads/fileIdentity.js.map +0 -1
- package/dist/uploads/fileQuarantine.d.ts +0 -17
- package/dist/uploads/fileQuarantine.d.ts.map +0 -1
- package/dist/uploads/fileQuarantine.js +0 -52
- package/dist/uploads/fileQuarantine.js.map +0 -1
- package/dist/uploads/linkFileWithoutOverwrite.d.ts +0 -13
- package/dist/uploads/linkFileWithoutOverwrite.d.ts.map +0 -1
- package/dist/uploads/linkFileWithoutOverwrite.js +0 -13
- package/dist/uploads/linkFileWithoutOverwrite.js.map +0 -1
- package/dist/uploads/uploadFileRollback.d.ts +0 -31
- package/dist/uploads/uploadFileRollback.d.ts.map +0 -1
- package/dist/uploads/uploadFileRollback.js +0 -269
- package/dist/uploads/uploadFileRollback.js.map +0 -1
- package/dist/utilities/extractRelationshipID.d.ts +0 -4
- package/dist/utilities/extractRelationshipID.d.ts.map +0 -1
- package/dist/utilities/extractRelationshipID.js +0 -14
- package/dist/utilities/extractRelationshipID.js.map +0 -1
- package/dist/utilities/transactionCallbacks.d.ts +0 -77
- package/dist/utilities/transactionCallbacks.d.ts.map +0 -1
- package/dist/utilities/transactionCallbacks.js +0 -299
- package/dist/utilities/transactionCallbacks.js.map +0 -1
- package/dist/utilities/transactionMutationTracker.d.ts +0 -21
- package/dist/utilities/transactionMutationTracker.d.ts.map +0 -1
- package/dist/utilities/transactionMutationTracker.js +0 -71
- package/dist/utilities/transactionMutationTracker.js.map +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { resolveBranch } from '../../../branching/resolveBranch.js';
|
|
2
1
|
import { createDataloaderCacheKey } from '../../../collections/dataloader.js';
|
|
3
2
|
export const virtualFieldPopulationPromise = async ({ name, draft, fallbackLocale, fields, hasMany, locale, overrideAccess, ref, req, segments, showHiddenFields, siblingDoc })=>{
|
|
4
3
|
const currentSegment = segments.shift();
|
|
@@ -77,7 +76,6 @@ export const virtualFieldPopulationPromise = async ({ name, draft, fallbackLocal
|
|
|
77
76
|
const collectionSlug = currentField.relationTo;
|
|
78
77
|
const populatedDocs = await Promise.all(docIDs.map((docID)=>{
|
|
79
78
|
return req.payloadDataLoader.load(createDataloaderCacheKey({
|
|
80
|
-
branch: resolveBranch(req),
|
|
81
79
|
collectionSlug,
|
|
82
80
|
currentDepth: 0,
|
|
83
81
|
depth: 0,
|
|
@@ -128,7 +126,6 @@ export const virtualFieldPopulationPromise = async ({ name, draft, fallbackLocal
|
|
|
128
126
|
return;
|
|
129
127
|
}
|
|
130
128
|
const populatedDoc = await req.payloadDataLoader.load(createDataloaderCacheKey({
|
|
131
|
-
branch: resolveBranch(req),
|
|
132
129
|
collectionSlug: currentField.relationTo,
|
|
133
130
|
currentDepth: 0,
|
|
134
131
|
depth: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/hooks/afterRead/virtualFieldPopulationPromise.ts"],"sourcesContent":["import type { TypedFallbackLocale } from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\nimport type { FlattenedField } from '../../config/types.js'\n\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/afterRead/virtualFieldPopulationPromise.ts"],"sourcesContent":["import type { TypedFallbackLocale } from '../../../index.js'\nimport type { PayloadRequest } from '../../../types/index.js'\nimport type { FlattenedField } from '../../config/types.js'\n\nimport { createDataloaderCacheKey } from '../../../collections/dataloader.js'\n\nexport const virtualFieldPopulationPromise = async ({\n name,\n draft,\n fallbackLocale,\n fields,\n hasMany,\n locale,\n overrideAccess,\n ref,\n req,\n segments,\n showHiddenFields,\n siblingDoc,\n}: {\n draft: boolean\n fallbackLocale: TypedFallbackLocale\n fields: FlattenedField[]\n hasMany?: boolean\n locale: string\n name: string\n overrideAccess: boolean\n ref: any\n req: PayloadRequest\n segments: string[]\n shift?: boolean\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n}): Promise<void> => {\n const currentSegment = segments.shift()\n\n if (!currentSegment) {\n return\n }\n\n const currentValue = ref[currentSegment]\n\n if (typeof currentValue === 'undefined') {\n return\n }\n\n // Final step\n if (segments.length === 0) {\n if (hasMany) {\n if (!Array.isArray(siblingDoc[name])) {\n siblingDoc[name] = []\n }\n ;(siblingDoc[name] as any[]).push(currentValue)\n } else {\n siblingDoc[name] = currentValue\n }\n return\n }\n\n const currentField = fields.find((each) => each.name === currentSegment)\n\n if (!currentField) {\n return\n }\n\n if (currentField.type === 'group' || currentField.type === 'tab') {\n if (!currentValue || typeof currentValue !== 'object') {\n return\n }\n\n return virtualFieldPopulationPromise({\n name,\n draft,\n fallbackLocale,\n fields: currentField.flattenedFields,\n locale,\n overrideAccess,\n ref: currentValue,\n req,\n segments,\n showHiddenFields,\n siblingDoc,\n })\n }\n\n if (\n (currentField.type === 'relationship' || currentField.type === 'upload') &&\n typeof currentField.relationTo === 'string'\n ) {\n const select = {}\n let currentSelectRef: any = select\n const currentFields = req.payload.collections[currentField.relationTo]?.config.flattenedFields\n\n for (let i = 0; i < segments.length; i++) {\n const field = currentFields?.find((each) => each.name === segments[i])\n\n const shouldBreak =\n i === segments.length - 1 || field?.type === 'relationship' || field?.type === 'upload'\n\n currentSelectRef[segments[i]!] = shouldBreak ? true : {}\n currentSelectRef = currentSelectRef[segments[i]!]\n\n if (shouldBreak) {\n break\n }\n }\n\n if (currentField.hasMany) {\n if (!Array.isArray(currentValue)) {\n return\n }\n\n const docIDs = currentValue\n .map((e) => {\n if (!e) {\n return null\n }\n if (typeof e === 'object') {\n return e.id\n }\n return e\n })\n .filter((e) => typeof e === 'string' || typeof e === 'number')\n\n if (segments[0] === 'id' && segments.length === 0) {\n siblingDoc[name] = docIDs\n return\n }\n\n const collectionSlug = currentField.relationTo\n\n const populatedDocs = await Promise.all(\n docIDs.map((docID) => {\n return req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug,\n currentDepth: 0,\n depth: 0,\n docID,\n draft,\n fallbackLocale,\n locale,\n overrideAccess,\n select,\n showHiddenFields,\n transactionID: req.transactionID as number,\n }),\n )\n }),\n )\n\n for (const doc of populatedDocs) {\n if (!doc) {\n continue\n }\n\n await virtualFieldPopulationPromise({\n name,\n draft,\n fallbackLocale,\n fields: req.payload.collections[currentField.relationTo]!.config.flattenedFields,\n hasMany: true,\n locale,\n overrideAccess,\n ref: doc,\n req,\n segments: [...segments],\n showHiddenFields,\n siblingDoc,\n })\n }\n\n return\n }\n\n let docID: number | string\n\n if (typeof currentValue === 'object' && currentValue) {\n docID = currentValue.id\n } else {\n docID = currentValue\n }\n\n if (segments[0] === 'id' && segments.length === 0) {\n siblingDoc[name] = docID\n return\n }\n\n if (typeof docID !== 'string' && typeof docID !== 'number') {\n return\n }\n\n const populatedDoc = await req.payloadDataLoader.load(\n createDataloaderCacheKey({\n collectionSlug: currentField.relationTo,\n currentDepth: 0,\n depth: 0,\n docID,\n draft,\n fallbackLocale,\n locale,\n overrideAccess,\n select,\n showHiddenFields,\n transactionID: req.transactionID as number,\n }),\n )\n\n if (!populatedDoc) {\n return\n }\n\n return virtualFieldPopulationPromise({\n name,\n draft,\n fallbackLocale,\n fields: req.payload.collections[currentField.relationTo]!.config.flattenedFields,\n hasMany,\n locale,\n overrideAccess,\n ref: populatedDoc,\n req,\n segments,\n showHiddenFields,\n siblingDoc,\n })\n }\n}\n"],"names":["createDataloaderCacheKey","virtualFieldPopulationPromise","name","draft","fallbackLocale","fields","hasMany","locale","overrideAccess","ref","req","segments","showHiddenFields","siblingDoc","currentSegment","shift","currentValue","length","Array","isArray","push","currentField","find","each","type","flattenedFields","relationTo","select","currentSelectRef","currentFields","payload","collections","config","i","field","shouldBreak","docIDs","map","e","id","filter","collectionSlug","populatedDocs","Promise","all","docID","payloadDataLoader","load","currentDepth","depth","transactionID","doc","populatedDoc"],"mappings":"AAIA,SAASA,wBAAwB,QAAQ,qCAAoC;AAE7E,OAAO,MAAMC,gCAAgC,OAAO,EAClDC,IAAI,EACJC,KAAK,EACLC,cAAc,EACdC,MAAM,EACNC,OAAO,EACPC,MAAM,EACNC,cAAc,EACdC,GAAG,EACHC,GAAG,EACHC,QAAQ,EACRC,gBAAgB,EAChBC,UAAU,EAeX;IACC,MAAMC,iBAAiBH,SAASI,KAAK;IAErC,IAAI,CAACD,gBAAgB;QACnB;IACF;IAEA,MAAME,eAAeP,GAAG,CAACK,eAAe;IAExC,IAAI,OAAOE,iBAAiB,aAAa;QACvC;IACF;IAEA,aAAa;IACb,IAAIL,SAASM,MAAM,KAAK,GAAG;QACzB,IAAIX,SAAS;YACX,IAAI,CAACY,MAAMC,OAAO,CAACN,UAAU,CAACX,KAAK,GAAG;gBACpCW,UAAU,CAACX,KAAK,GAAG,EAAE;YACvB;;YACEW,UAAU,CAACX,KAAK,CAAWkB,IAAI,CAACJ;QACpC,OAAO;YACLH,UAAU,CAACX,KAAK,GAAGc;QACrB;QACA;IACF;IAEA,MAAMK,eAAehB,OAAOiB,IAAI,CAAC,CAACC,OAASA,KAAKrB,IAAI,KAAKY;IAEzD,IAAI,CAACO,cAAc;QACjB;IACF;IAEA,IAAIA,aAAaG,IAA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C,eAAexC,IAAIwC,aAAa;QAClC;QAGF,IAAI,CAACE,cAAc;YACjB;QACF;QAEA,OAAOnD,8BAA8B;YACnCC;YACAC;YACAC;YACAC,QAAQK,IAAIoB,OAAO,CAACC,WAAW,CAACV,aAAaK,UAAU,CAAC,CAAEM,MAAM,CAACP,eAAe;YAChFnB;YACAC;YACAC;YACAC,KAAK2C;YACL1C;YACAC;YACAC;YACAC;QACF;IACF;AACF,EAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Payload } from '../../../index.js';
|
|
2
|
+
import type { JsonObject } from '../../../types/index.js';
|
|
3
|
+
import type { Field, TabAsField } from '../../config/types.js';
|
|
4
|
+
type Args = {
|
|
5
|
+
config: Payload['config'];
|
|
6
|
+
data: JsonObject;
|
|
7
|
+
fields: (Field | TabAsField)[];
|
|
8
|
+
locale: string;
|
|
9
|
+
parentIsLocalized?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** Projects validation context to one locale without running hooks or changing the write data. */
|
|
12
|
+
export declare function flattenValidationData({ config, data, fields, locale, parentIsLocalized, }: Args): JsonObject;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=flattenValidationData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flattenValidationData.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeChange/flattenValidationData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAM9D,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,MAAM,EAAE,CAAC,KAAK,GAAG,UAAU,CAAC,EAAE,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B,CAAA;AAED,kGAAkG;AAClG,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,IAAI,EACJ,MAAM,EACN,MAAM,EACN,iBAAyB,GAC1B,EAAE,IAAI,GAAG,UAAU,CAgCnB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { deepCopyObjectSimple } from '../../../utilities/deepCopyObject.js';
|
|
2
|
+
import { traverseFields } from '../../../utilities/traverseFields.js';
|
|
3
|
+
import { fieldAffectsData, fieldShouldBeLocalized } from '../../config/types.js';
|
|
4
|
+
/** Projects validation context to one locale without running hooks or changing the write data. */ export function flattenValidationData({ config, data, fields, locale, parentIsLocalized = false }) {
|
|
5
|
+
// Each locale needs its own projection. Merged contexts also retain source array references.
|
|
6
|
+
const result = deepCopyObjectSimple(data);
|
|
7
|
+
const localizedFields = [];
|
|
8
|
+
traverseFields({
|
|
9
|
+
callback: ({ field, parentIsLocalized, ref })=>{
|
|
10
|
+
if (fieldAffectsData(field) && field.name && fieldShouldBeLocalized({
|
|
11
|
+
field,
|
|
12
|
+
parentIsLocalized
|
|
13
|
+
})) {
|
|
14
|
+
localizedFields.push({
|
|
15
|
+
name: field.name,
|
|
16
|
+
ref: ref
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
config,
|
|
21
|
+
fields,
|
|
22
|
+
fillEmpty: false,
|
|
23
|
+
parentIsLocalized,
|
|
24
|
+
ref: result
|
|
25
|
+
});
|
|
26
|
+
// Keep locale maps intact while traversing, then project children before their containers.
|
|
27
|
+
for (const { name, ref } of localizedFields.reverse()){
|
|
28
|
+
const value = ref[name];
|
|
29
|
+
if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
|
|
30
|
+
ref[name] = value[locale];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=flattenValidationData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/flattenValidationData.ts"],"sourcesContent":["import type { Payload } from '../../../index.js'\nimport type { JsonObject } from '../../../types/index.js'\nimport type { Field, TabAsField } from '../../config/types.js'\n\nimport { deepCopyObjectSimple } from '../../../utilities/deepCopyObject.js'\nimport { traverseFields } from '../../../utilities/traverseFields.js'\nimport { fieldAffectsData, fieldShouldBeLocalized } from '../../config/types.js'\n\ntype Args = {\n config: Payload['config']\n data: JsonObject\n fields: (Field | TabAsField)[]\n locale: string\n parentIsLocalized?: boolean\n}\n\n/** Projects validation context to one locale without running hooks or changing the write data. */\nexport function flattenValidationData({\n config,\n data,\n fields,\n locale,\n parentIsLocalized = false,\n}: Args): JsonObject {\n // Each locale needs its own projection. Merged contexts also retain source array references.\n const result = deepCopyObjectSimple(data)\n const localizedFields: { name: string; ref: JsonObject }[] = []\n\n traverseFields({\n callback: ({ field, parentIsLocalized, ref }) => {\n if (\n fieldAffectsData(field) &&\n field.name &&\n fieldShouldBeLocalized({ field, parentIsLocalized })\n ) {\n localizedFields.push({ name: field.name, ref: ref as JsonObject })\n }\n },\n config,\n fields,\n fillEmpty: false,\n parentIsLocalized,\n ref: result,\n })\n\n // Keep locale maps intact while traversing, then project children before their containers.\n for (const { name, ref } of localizedFields.reverse()) {\n const value = ref[name]\n\n if (value !== null && typeof value === 'object' && !Array.isArray(value)) {\n ref[name] = value[locale]\n }\n }\n\n return result\n}\n"],"names":["deepCopyObjectSimple","traverseFields","fieldAffectsData","fieldShouldBeLocalized","flattenValidationData","config","data","fields","locale","parentIsLocalized","result","localizedFields","callback","field","ref","name","push","fillEmpty","reverse","value","Array","isArray"],"mappings":"AAIA,SAASA,oBAAoB,QAAQ,uCAAsC;AAC3E,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,wBAAuB;AAUhF,gGAAgG,GAChG,OAAO,SAASC,sBAAsB,EACpCC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,MAAM,EACNC,oBAAoB,KAAK,EACpB;IACL,6FAA6F;IAC7F,MAAMC,SAASV,qBAAqBM;IACpC,MAAMK,kBAAuD,EAAE;IAE/DV,eAAe;QACbW,UAAU,CAAC,EAAEC,KAAK,EAAEJ,iBAAiB,EAAEK,GAAG,EAAE;YAC1C,IACEZ,iBAAiBW,UACjBA,MAAME,IAAI,IACVZ,uBAAuB;gBAAEU;gBAAOJ;YAAkB,IAClD;gBACAE,gBAAgBK,IAAI,CAAC;oBAAED,MAAMF,MAAME,IAAI;oBAAED,KAAKA;gBAAkB;YAClE;QACF;QACAT;QACAE;QACAU,WAAW;QACXR;QACAK,KAAKJ;IACP;IAEA,2FAA2F;IAC3F,KAAK,MAAM,EAAEK,IAAI,EAAED,GAAG,EAAE,IAAIH,gBAAgBO,OAAO,GAAI;QACrD,MAAMC,QAAQL,GAAG,CAACC,KAAK;QAEvB,IAAII,UAAU,QAAQ,OAAOA,UAAU,YAAY,CAACC,MAAMC,OAAO,CAACF,QAAQ;YACxEL,GAAG,CAACC,KAAK,GAAGI,KAAK,CAACX,OAAO;QAC3B;IACF;IAEA,OAAOE;AACT"}
|
|
@@ -9,6 +9,7 @@ type Args = {
|
|
|
9
9
|
* Data of the nearest parent block. If no parent block exists, this will be the `undefined`
|
|
10
10
|
*/
|
|
11
11
|
blockData?: JsonObject;
|
|
12
|
+
blockFields?: Field[];
|
|
12
13
|
collection: null | SanitizedCollectionConfig;
|
|
13
14
|
context: RequestContext;
|
|
14
15
|
data: JsonObject;
|
|
@@ -42,6 +43,6 @@ type Args = {
|
|
|
42
43
|
skipValidation: boolean;
|
|
43
44
|
submittedTopLevelFieldNames?: ReadonlySet<string>;
|
|
44
45
|
};
|
|
45
|
-
export declare const promise: ({ id, blockData, collection, context, data, doc, docWithLocales, errors, field, fieldIndex, fieldLabelPath, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, siblingFields, skipHooks, skipValidation, submittedTopLevelFieldNames, }: Args) => Promise<void>;
|
|
46
|
+
export declare const promise: ({ id, blockData, blockFields, collection, context, data, doc, docWithLocales, errors, field, fieldIndex, fieldLabelPath, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, siblingFields, skipHooks, skipValidation, submittedTopLevelFieldNames, }: Args) => Promise<void>;
|
|
46
47
|
export {};
|
|
47
48
|
//# sourceMappingURL=promise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACzF,OAAO,KAAK,EAAS,KAAK,EAAE,UAAU,EAAY,MAAM,uBAAuB,CAAA;AAG/E,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,U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;IAClB,cAAc,EAAE,OAAO,CAAA;IACvB,2BAA2B,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAClD,CAAA;AAUD,eAAO,MAAM,OAAO,2YA8BjB,IAAI,KAAG,OAAO,CAAC,IAAI,CAmtBrB,CAAA"}
|
|
@@ -2,8 +2,10 @@ import { MissingEditorProp } from '../../../errors/index.js';
|
|
|
2
2
|
import { validateBlocksFilterOptions } from '../../../index.js';
|
|
3
3
|
import { deepMergeWithSourceArrays } from '../../../utilities/deepMerge.js';
|
|
4
4
|
import { getTranslatedLabel } from '../../../utilities/getTranslatedLabel.js';
|
|
5
|
+
import { isolateObjectProperty } from '../../../utilities/isolateObjectProperty.js';
|
|
5
6
|
import { fieldAffectsData, fieldShouldBeLocalized, tabHasName } from '../../config/types.js';
|
|
6
7
|
import { getFieldPaths } from '../../getFieldPaths.js';
|
|
8
|
+
import { flattenValidationData } from './flattenValidationData.js';
|
|
7
9
|
import { getExistingRowDoc } from './getExistingRowDoc.js';
|
|
8
10
|
import { traverseFields } from './traverseFields.js';
|
|
9
11
|
function buildFieldLabel(parentLabel, label) {
|
|
@@ -20,7 +22,7 @@ function buildFieldLabel(parentLabel, label) {
|
|
|
20
22
|
// - Transform data for storage
|
|
21
23
|
// - beforeDuplicate hooks (if duplicate)
|
|
22
24
|
// - Unflatten locales
|
|
23
|
-
export const promise = async ({ id, blockData, collection, context, data, doc, docWithLocales, errors, field, fieldIndex, fieldLabelPath, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, siblingFields, skipHooks, skipValidation, submittedTopLevelFieldNames })=>{
|
|
25
|
+
export const promise = async ({ id, blockData, blockFields, collection, context, data, doc, docWithLocales, errors, field, fieldIndex, fieldLabelPath, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, siblingFields, skipHooks, skipValidation, submittedTopLevelFieldNames })=>{
|
|
24
26
|
const { indexPath, path, schemaPath } = getFieldPaths({
|
|
25
27
|
field,
|
|
26
28
|
index: fieldIndex,
|
|
@@ -96,6 +98,26 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
96
98
|
// Validate
|
|
97
99
|
if (!skipValidationFromHere && 'validate' in field && field.validate) {
|
|
98
100
|
const valueToValidate = siblingData[field.name];
|
|
101
|
+
// With `locale: 'all'` a localized scalar is a locale-keyed object; validate each locale, not the
|
|
102
|
+
// wrapper. Containers (`group`/`array`/`blocks`) are excluded - per-locale child validation is a follow-up.
|
|
103
|
+
const isLocaleKeyedValue = operationLocale === 'all' && localization && fieldShouldBeLocalized({
|
|
104
|
+
field,
|
|
105
|
+
parentIsLocalized
|
|
106
|
+
}) && field.type !== 'group' && valueToValidate !== null && typeof valueToValidate === 'object' && !Array.isArray(valueToValidate);
|
|
107
|
+
const localizedValuesToValidate = isLocaleKeyedValue ? localization.localeCodes.filter((locale)=>locale in valueToValidate).map((locale)=>({
|
|
108
|
+
locale,
|
|
109
|
+
value: valueToValidate[locale]
|
|
110
|
+
})) : [
|
|
111
|
+
{
|
|
112
|
+
value: valueToValidate
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
// No recognized locales (e.g. `{}`): validate `undefined` once so required/optional still apply.
|
|
116
|
+
if (localizedValuesToValidate.length === 0) {
|
|
117
|
+
localizedValuesToValidate.push({
|
|
118
|
+
value: undefined
|
|
119
|
+
});
|
|
120
|
+
}
|
|
99
121
|
let jsonError;
|
|
100
122
|
if (field.type === 'json' && typeof siblingData[field.name] === 'string') {
|
|
101
123
|
try {
|
|
@@ -105,25 +127,66 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
105
127
|
}
|
|
106
128
|
}
|
|
107
129
|
const validateFn = field.validate;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
let validationResult = true;
|
|
131
|
+
let failedLocale;
|
|
132
|
+
const validationData = deepMergeWithSourceArrays(doc, data);
|
|
133
|
+
const validationSiblingData = deepMergeWithSourceArrays(siblingDoc, siblingData);
|
|
134
|
+
for (const { locale, value } of localizedValuesToValidate){
|
|
135
|
+
// Scope `req.locale` to the locale being validated without mutating the shared request.
|
|
136
|
+
const validationReq = locale ? isolateObjectProperty(req, 'locale') : req;
|
|
137
|
+
if (locale) {
|
|
138
|
+
validationReq.locale = locale;
|
|
139
|
+
}
|
|
140
|
+
const localeContext = locale ? {
|
|
141
|
+
blockData: blockData && blockFields ? flattenValidationData({
|
|
142
|
+
config: req.payload.config,
|
|
143
|
+
data: blockData,
|
|
144
|
+
fields: blockFields,
|
|
145
|
+
locale,
|
|
146
|
+
parentIsLocalized
|
|
147
|
+
}) : blockData,
|
|
148
|
+
data: flattenValidationData({
|
|
149
|
+
config: req.payload.config,
|
|
150
|
+
data: validationData,
|
|
151
|
+
fields: collection?.fields || global?.fields,
|
|
152
|
+
locale
|
|
153
|
+
}),
|
|
154
|
+
siblingData: flattenValidationData({
|
|
155
|
+
config: req.payload.config,
|
|
156
|
+
data: validationSiblingData,
|
|
157
|
+
fields: siblingFields,
|
|
158
|
+
locale,
|
|
159
|
+
parentIsLocalized
|
|
160
|
+
})
|
|
161
|
+
} : {
|
|
162
|
+
blockData,
|
|
163
|
+
data: validationData,
|
|
164
|
+
siblingData: validationSiblingData
|
|
165
|
+
};
|
|
166
|
+
validationResult = await validateFn(value, {
|
|
167
|
+
...field,
|
|
168
|
+
id,
|
|
169
|
+
blockData: localeContext.blockData,
|
|
170
|
+
collectionSlug: collection?.slug,
|
|
171
|
+
data: localeContext.data,
|
|
172
|
+
event: 'submit',
|
|
173
|
+
// @ts-expect-error generic validation options cannot infer JSON fields
|
|
174
|
+
jsonError,
|
|
175
|
+
operation,
|
|
176
|
+
overrideAccess,
|
|
177
|
+
path: pathSegments,
|
|
178
|
+
preferences: {
|
|
179
|
+
fields: {}
|
|
180
|
+
},
|
|
181
|
+
previousValue: locale ? siblingDoc[field.name]?.[locale] : siblingDoc[field.name],
|
|
182
|
+
req: validationReq,
|
|
183
|
+
siblingData: localeContext.siblingData
|
|
184
|
+
});
|
|
185
|
+
if (typeof validationResult === 'string') {
|
|
186
|
+
failedLocale = locale;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
127
190
|
if (typeof validationResult === 'string') {
|
|
128
191
|
let filterOptionsError = false;
|
|
129
192
|
if (field.type === 'blocks' && field.filterOptions) {
|
|
@@ -162,7 +225,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
162
225
|
// field itself => only push the error if the field is not a block field with validation failure due to filterOptions
|
|
163
226
|
const fieldLabel = buildFieldLabel(fieldLabelPath, getTranslatedLabel(field?.label || field?.name, req.i18n));
|
|
164
227
|
errors.push({
|
|
165
|
-
label: fieldLabel,
|
|
228
|
+
label: failedLocale ? `${fieldLabel} (${failedLocale})` : fieldLabel,
|
|
166
229
|
message: validationResult,
|
|
167
230
|
path
|
|
168
231
|
});
|
|
@@ -176,8 +239,13 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
176
239
|
})) {
|
|
177
240
|
mergeLocaleActions.push(()=>{
|
|
178
241
|
const localeData = {};
|
|
242
|
+
// With `locale: 'all'`, siblingData holds a locale-keyed object (`{ en, es }`) rather than a single
|
|
243
|
+
// locale's value - take each submitted locale, falling back to the existing doc for ones not sent.
|
|
244
|
+
const submittedValue = siblingData[field.name];
|
|
245
|
+
const isAllLocales = req.locale === 'all' && submittedValue !== null && typeof submittedValue === 'object' && !Array.isArray(submittedValue);
|
|
179
246
|
for (const locale of localization.localeCodes){
|
|
180
|
-
const
|
|
247
|
+
const existingValue = siblingDocWithLocales?.[field.name]?.[locale];
|
|
248
|
+
const fieldValue = isAllLocales ? locale in submittedValue ? submittedValue[locale] : existingValue : locale === req.locale ? submittedValue : existingValue;
|
|
181
249
|
// update locale value if it's not undefined
|
|
182
250
|
if (typeof fieldValue !== 'undefined') {
|
|
183
251
|
localeData[locale] = fieldValue;
|
|
@@ -200,6 +268,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
200
268
|
promises.push(traverseFields({
|
|
201
269
|
id,
|
|
202
270
|
blockData,
|
|
271
|
+
blockFields,
|
|
203
272
|
collection,
|
|
204
273
|
context,
|
|
205
274
|
data,
|
|
@@ -245,6 +314,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
245
314
|
promises.push(traverseFields({
|
|
246
315
|
id,
|
|
247
316
|
blockData: row,
|
|
317
|
+
blockFields: block.fields,
|
|
248
318
|
collection,
|
|
249
319
|
context,
|
|
250
320
|
data,
|
|
@@ -282,6 +352,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
282
352
|
await traverseFields({
|
|
283
353
|
id,
|
|
284
354
|
blockData,
|
|
355
|
+
blockFields,
|
|
285
356
|
collection,
|
|
286
357
|
context,
|
|
287
358
|
data,
|
|
@@ -342,6 +413,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
342
413
|
await traverseFields({
|
|
343
414
|
id,
|
|
344
415
|
blockData,
|
|
416
|
+
blockFields,
|
|
345
417
|
collection,
|
|
346
418
|
context,
|
|
347
419
|
data,
|
|
@@ -450,6 +522,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
450
522
|
await traverseFields({
|
|
451
523
|
id,
|
|
452
524
|
blockData,
|
|
525
|
+
blockFields,
|
|
453
526
|
collection,
|
|
454
527
|
context,
|
|
455
528
|
data,
|
|
@@ -482,6 +555,7 @@ export const promise = async ({ id, blockData, collection, context, data, doc, d
|
|
|
482
555
|
await traverseFields({
|
|
483
556
|
id,
|
|
484
557
|
blockData,
|
|
558
|
+
blockFields,
|
|
485
559
|
collection,
|
|
486
560
|
context,
|
|
487
561
|
data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { ValidationFieldError } from '../../../errors/index.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { FieldOperation, JsonObject, PayloadRequest } from '../../../types/index.js'\nimport type { Block, Field, TabAsField, Validate } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { type RequestContext, validateBlocksFilterOptions } from '../../../index.js'\nimport { deepMergeWithSourceArrays } from '../../../utilities/deepMerge.js'\nimport { getTranslatedLabel } from '../../../utilities/getTranslatedLabel.js'\nimport { fieldAffectsData, fieldShouldBeLocalized, tabHasName } from '../../config/types.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { getExistingRowDoc } from './getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\nfunction buildFieldLabel(parentLabel: string, label: string | undefined): string {\n if (!label) {\n return parentLabel\n }\n const capitalizedLabel = label.charAt(0).toUpperCase() + label.slice(1)\n return parentLabel && capitalizedLabel\n ? `${parentLabel} > ${capitalizedLabel}`\n : capitalizedLabel || parentLabel\n}\n\ntype Args = {\n /**\n * Data of the nearest parent block. If no parent block exists, this will be the `undefined`\n */\n blockData?: JsonObject\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n doc: JsonObject\n docWithLocales: JsonObject\n errors: ValidationFieldError[]\n field: Field | TabAsField\n fieldIndex: number\n /**\n * Built up labels of parent fields\n *\n * @example \"Group Field > Tab Field > Text Field\"\n */\n fieldLabelPath: string\n global: null | SanitizedGlobalConfig\n id?: number | string\n isValidationOperation: boolean\n mergeLocaleActions: (() => Promise<void> | void)[]\n operation: FieldOperation\n overrideAccess: boolean\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n siblingData: JsonObject\n siblingDoc: JsonObject\n siblingDocWithLocales?: JsonObject\n siblingFields?: (Field | TabAsField)[]\n skipHooks: boolean\n skipValidation: boolean\n submittedTopLevelFieldNames?: ReadonlySet<string>\n}\n\n// This function is responsible for the following actions, in order:\n// - Run condition\n// - Execute field hooks\n// - Validate data\n// - Transform data for storage\n// - beforeDuplicate hooks (if duplicate)\n// - Unflatten locales\n\nexport const promise = async ({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n field,\n fieldIndex,\n fieldLabelPath,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n siblingFields,\n skipHooks,\n skipValidation,\n submittedTopLevelFieldNames,\n}: Args): Promise<void> => {\n const { indexPath, path, schemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const { localization } = req.payload.config\n const defaultLocale = localization ? localization?.defaultLocale : 'en'\n const operationLocale = req.locale || defaultLocale\n\n const pathSegments = path ? path.split('.') : []\n const schemaPathSegments = schemaPath ? schemaPath.split('.') : []\n const indexPathSegments = indexPath ? indexPath.split('-').filter(Boolean)?.map(Number) : []\n\n const passesCondition = field.admin?.condition\n ? Boolean(\n field.admin.condition(data, siblingData, {\n blockData: blockData!,\n operation,\n path: pathSegments,\n user: req.user,\n }),\n )\n : true\n const isOutsideSubmittedFieldScope =\n submittedTopLevelFieldNames !== undefined &&\n fieldAffectsData(field) &&\n !submittedTopLevelFieldNames.has(pathSegments[0]!)\n let skipValidationFromHere = skipValidation || isOutsideSubmittedFieldScope || !passesCondition\n\n if (fieldAffectsData(field)) {\n const shouldSkipValidationForLocalizedFallback =\n !isValidationOperation &&\n operation !== 'validate' &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n operationLocale !== defaultLocale &&\n ['array', 'blocks'].includes(field.type) &&\n siblingData[field.name!] === null\n\n if (shouldSkipValidationForLocalizedFallback) {\n skipValidationFromHere = true\n }\n\n // Execute hooks\n if (!skipHooks && 'hooks' in field && field.hooks?.beforeChange) {\n for (const hook of field.hooks.beforeChange) {\n const hookedValue = await hook({\n blockData,\n collection,\n context,\n data,\n field,\n global,\n indexPath: indexPathSegments,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: pathSegments,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n siblingDocWithLocales,\n siblingFields: siblingFields!,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }\n }\n\n if (hasInvalidFieldValueShape({ field, value: siblingData[field.name!] })) {\n errors.push({\n label: buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.name, req.i18n),\n ),\n message: req.t('validation:invalidInput'),\n path,\n })\n return\n }\n\n // Validate\n if (!skipValidationFromHere && 'validate' in field && field.validate) {\n const valueToValidate = siblingData[field.name]\n let jsonError: object\n\n if (field.type === 'json' && typeof siblingData[field.name] === 'string') {\n try {\n JSON.parse(siblingData[field.name] as string)\n } catch (e) {\n jsonError = e as object\n }\n }\n\n const validateFn: Validate<object, object, object, object> = field.validate as Validate<\n object,\n object,\n object,\n object\n >\n\n const validationResult = await validateFn(valueToValidate as never, {\n ...field,\n id,\n blockData: blockData!,\n collectionSlug: collection?.slug,\n data: deepMergeWithSourceArrays(doc, data),\n event: 'submit',\n // @ts-expect-error\n jsonError,\n operation,\n overrideAccess,\n path: pathSegments,\n preferences: { fields: {} },\n previousValue: siblingDoc[field.name],\n req,\n siblingData: deepMergeWithSourceArrays(siblingDoc, siblingData),\n })\n\n if (typeof validationResult === 'string') {\n let filterOptionsError = false\n\n if (field.type === 'blocks' && field.filterOptions) {\n // Re-run filteroptions. If the validation error is due to filteroptions, we need to add error paths to all the blocks\n // that are no longer valid\n const validationResult = await validateBlocksFilterOptions({\n id,\n data,\n filterOptions: field.filterOptions,\n req,\n siblingData,\n value: siblingData[field.name],\n })\n if (validationResult?.invalidBlockSlugs?.length) {\n filterOptionsError = true\n let rowIndex = -1\n for (const block of siblingData[field.name] as JsonObject[]) {\n rowIndex++\n if (validationResult.invalidBlockSlugs.includes(block.blockType as string)) {\n const blockConfigOrSlug = field.blocks.find((blockFromField) =>\n typeof blockFromField === 'string'\n ? blockFromField === block.blockType\n : blockFromField.slug === block.blockType,\n )\n const blockConfig =\n typeof blockConfigOrSlug === 'string'\n ? req.payload.blocks[blockConfigOrSlug]\n : blockConfigOrSlug\n\n const blockLabelPath =\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n `${getTranslatedLabel(field?.label || field?.name, req.i18n)} > ${req.t('fields:block')} ${rowIndex + 1} (${getTranslatedLabel(blockConfig?.labels?.singular || block.blockType, req.i18n)})`,\n )\n\n errors.push({\n label: blockLabelPath,\n message: req.t('validation:invalidBlock', { block: block.blockType }),\n path: `${path}.${rowIndex}.id`,\n })\n }\n }\n }\n }\n\n if (!filterOptionsError) {\n // If the error is due to block filterOptions, we want to push the errors for each individual block, not the blocks\n // field itself => only push the error if the field is not a block field with validation failure due to filterOptions\n const fieldLabel = buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.name, req.i18n),\n )\n\n errors.push({\n label: fieldLabel,\n message: validationResult,\n path,\n })\n }\n }\n }\n\n // Push merge locale action if applicable\n if (localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n mergeLocaleActions.push(() => {\n const localeData: Record<string, unknown> = {}\n\n for (const locale of localization.localeCodes) {\n const fieldValue =\n locale === req.locale\n ? siblingData[field.name!]\n : siblingDocWithLocales?.[field.name!]?.[locale]\n\n // update locale value if it's not undefined\n if (typeof fieldValue !== 'undefined') {\n localeData[locale] = fieldValue\n }\n }\n\n // If there are locales with data, set the data\n if (Object.keys(localeData).length > 0) {\n siblingData[field.name!] = localeData\n }\n })\n }\n }\n\n switch (field.type) {\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n\n rows.forEach((row, rowIndex) => {\n promises.push(\n traverseFields({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n `${getTranslatedLabel(field?.label || field?.name, req.i18n)} ${rowIndex + 1}`,\n ),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath,\n req,\n siblingData: row as JsonObject,\n siblingDoc: getExistingRowDoc(row as JsonObject, siblingDoc[field.name]),\n siblingDocWithLocales: getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales?.[field.name],\n ),\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n }),\n )\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n\n rows.forEach((row, rowIndex) => {\n const rowSiblingDoc = getExistingRowDoc(row as JsonObject, siblingDoc[field.name])\n\n const rowSiblingDocWithLocales = getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales ? siblingDocWithLocales[field.name] : {},\n )\n\n const blockTypeToMatch = (row as JsonObject).blockType || rowSiblingDoc.blockType\n\n const block: Block | undefined =\n req.payload.blocks[blockTypeToMatch] ??\n (field.blocks.find(\n (curBlock) => typeof curBlock !== 'string' && curBlock.slug === blockTypeToMatch,\n ) as Block | undefined)\n\n const blockLabelPath =\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n `${getTranslatedLabel(field?.label || field?.name, req.i18n)} > ${req.t('fields:block')} ${rowIndex + 1} (${getTranslatedLabel(block?.labels?.singular || blockTypeToMatch, req.i18n)})`,\n )\n\n if (block) {\n promises.push(\n traverseFields({\n id,\n blockData: row,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath: blockLabelPath,\n\n fields: block.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath + '.' + block.slug,\n req,\n siblingData: row as JsonObject,\n siblingDoc: rowSiblingDoc,\n siblingDocWithLocales: rowSiblingDocWithLocales,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n }),\n )\n }\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'collapsible':\n case 'row': {\n await traverseFields({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field.type === 'row' || field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.type, req.i18n),\n ),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales: siblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n case 'group': {\n let groupSiblingData = siblingData\n let groupSiblingDoc = siblingDoc\n let groupSiblingDocWithLocales = siblingDocWithLocales\n\n const isNamedGroup = fieldAffectsData(field)\n\n if (isNamedGroup) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n if (typeof siblingDocWithLocales![field.name] !== 'object') {\n siblingDocWithLocales![field.name] = {}\n }\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n if (typeof siblingDocWithLocales![field.name] !== 'object') {\n siblingDocWithLocales![field.name] = {}\n }\n\n groupSiblingData = siblingData[field.name] as JsonObject\n groupSiblingDoc = siblingDoc[field.name] as JsonObject\n groupSiblingDocWithLocales = siblingDocWithLocales![field.name] as JsonObject\n }\n\n const fallbackLabel = field?.label || (isNamedGroup ? field.name : field?.type)\n\n await traverseFields({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(fieldLabelPath, getTranslatedLabel(fallbackLabel, req.i18n)),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: isNamedGroup ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: isNamedGroup ? path : parentPath,\n parentSchemaPath: schemaPath,\n req,\n siblingData: groupSiblingData,\n siblingDoc: groupSiblingDoc,\n siblingDocWithLocales: groupSiblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n case 'point': {\n // Transform point data for storage\n if (\n Array.isArray(siblingData[field.name]) &&\n siblingData[field.name][0] !== null &&\n siblingData[field.name][1] !== null\n ) {\n siblingData[field.name] = {\n type: 'Point',\n coordinates: [\n parseFloat(siblingData[field.name][0]),\n parseFloat(siblingData[field.name][1]),\n ],\n }\n }\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (!skipHooks && editor?.hooks?.beforeChange?.length) {\n for (const hook of editor.hooks.beforeChange) {\n const hookedValue = await hook({\n collection,\n context,\n data,\n docWithLocales,\n errors,\n field,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.name, req.i18n),\n ),\n global,\n indexPath: indexPathSegments,\n mergeLocaleActions,\n operation,\n originalDoc: doc,\n overrideAccess,\n parentIsLocalized,\n path: pathSegments,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n siblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }\n }\n\n break\n }\n\n case 'tab': {\n let tabSiblingData = siblingData\n let tabSiblingDoc = siblingDoc\n let tabSiblingDocWithLocales = siblingDocWithLocales\n\n const isNamedTab = tabHasName(field)\n\n if (isNamedTab) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n if (typeof siblingDocWithLocales![field.name] !== 'object') {\n siblingDocWithLocales![field.name] = {}\n }\n\n tabSiblingData = siblingData[field.name] as JsonObject\n tabSiblingDoc = siblingDoc[field.name] as JsonObject\n tabSiblingDocWithLocales = siblingDocWithLocales![field.name] as JsonObject\n }\n\n await traverseFields({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field.name, req.i18n),\n ),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: isNamedTab ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: isNamedTab ? path : parentPath,\n parentSchemaPath: schemaPath,\n req,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n siblingDocWithLocales: tabSiblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n blockData,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(fieldLabelPath, getTranslatedLabel(field?.label || '', req.i18n)),\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales: siblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n default: {\n break\n }\n }\n}\n\nfunction hasInvalidFieldValueShape({\n field,\n value,\n}: {\n field: Field | TabAsField\n value: unknown\n}): boolean {\n if (value === null || typeof value === 'undefined' || !fieldAffectsData(field)) {\n return false\n }\n\n if (field.type === 'array' || field.type === 'blocks') {\n // Form state may use a numeric row count, while submitted values use arrays.\n return !(Array.isArray(value) || typeof value === 'number')\n }\n\n if (field.type === 'number') {\n // Only hasMany number fields may receive arrays.\n return typeof value === 'object' && !(field.hasMany && Array.isArray(value))\n }\n\n if ((field.type === 'relationship' || field.type === 'upload') && field.hasMany) {\n // HasMany relationships/uploads may receive arrays or one valid polymorphic value.\n if (typeof value !== 'object' || Array.isArray(value)) {\n return false\n }\n\n const relationshipValue = value as Record<PropertyKey, unknown>\n const valuePrototype = Object.getPrototypeOf(value)\n const isSinglePolymorphicRelationshipValue =\n Array.isArray(field.relationTo) &&\n (valuePrototype === null || valuePrototype === Object.prototype) &&\n Object.hasOwn(relationshipValue, 'relationTo') &&\n Object.hasOwn(relationshipValue, 'value') &&\n Reflect.ownKeys(relationshipValue).length === 2 &&\n typeof relationshipValue.relationTo === 'string' &&\n field.relationTo.includes(relationshipValue.relationTo) &&\n (typeof relationshipValue.value === 'string' || typeof relationshipValue.value === 'number')\n\n return !isSinglePolymorphicRelationshipValue\n }\n\n return false\n}\n"],"names":["MissingEditorProp","validateBlocksFilterOptions","deepMergeWithSourceArrays","getTranslatedLabel","fieldAffectsData","fieldShouldBeLocalized","tabHasName","getFieldPaths","getExistingRowDoc","traverseFields","buildFieldLabel","parentLabel","label","capitalizedLabel","charAt","toUpperCase","slice","promise","id","blockData","collection","context","data","doc","docWithLocales","errors","field","fieldIndex","fieldLabelPath","global","isValidationOperation","mergeLocaleActions","operation","overrideAccess","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","siblingData","siblingDoc","siblingDocWithLocales","siblingFields","skipHooks","skipValidation","submittedTopLevelFieldNames","indexPath","path","schemaPath","index","localization","payload","config","defaultLocale","operationLocale","locale","pathSegments","split","schemaPathSegments","indexPathSegments","filter","Boolean","map","Number","passesCondition","admin","condition","user","isOutsideSubmittedFieldScope","undefined","has","skipValidationFromHere","shouldSkipValidationForLocalizedFallback","includes","type","name","hooks","beforeChange","hook","hookedValue","originalDoc","previousSiblingDoc","previousValue","value","hasInvalidFieldValueShape","push","i18n","message","t","validate","valueToValidate","jsonError","JSON","parse","e","validateFn","validationResult","collectionSlug","slug","event","preferences","fields","filterOptionsError","filterOptions","invalidBlockSlugs","length","rowIndex","block","blockType","blockConfigOrSlug","blocks","find","blockFromField","blockConfig","blockLabelPath","labels","singular","fieldLabel","localeData","localeCodes","fieldValue","Object","keys","rows","Array","isArray","promises","forEach","row","localized","Promise","all","rowSiblingDoc","rowSiblingDocWithLocales","blockTypeToMatch","curBlock","groupSiblingData","groupSiblingDoc","groupSiblingDocWithLocales","isNamedGroup","fallbackLabel","coordinates","parseFloat","editor","Error","tabSiblingData","tabSiblingDoc","tabSiblingDocWithLocales","isNamedTab","tabs","tab","hasMany","relationshipValue","valuePrototype","getPrototypeOf","isSinglePolymorphicRelationshipValue","relationTo","prototype","hasOwn","Reflect","ownKeys"],"mappings":"AAOA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAA8BC,2BAA2B,QAAQ,oBAAmB;AACpF,SAASC,yBAAyB,QAAQ,kCAAiC;AAC3E,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,gBAAgB,EAAEC,sBAAsB,EAAEC,UAAU,QAAQ,wBAAuB;AAC5F,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,SAASC,gBAAgBC,WAAmB,EAAEC,KAAyB;IACrE,IAAI,CAACA,OAAO;QACV,OAAOD;IACT;IACA,MAAME,mBAAmBD,MAAME,MAAM,CAAC,GAAGC,WAAW,KAAKH,MAAMI,KAAK,CAAC;IACrE,OAAOL,eAAeE,mBAClB,GAAGF,YAAY,GAAG,EAAEE,kBAAkB,GACtCA,oBAAoBF;AAC1B;AAyCA,oEAAoE;AACpE,kBAAkB;AAClB,wBAAwB;AACxB,kBAAkB;AAClB,+BAA+B;AAC/B,yCAAyC;AACzC,sBAAsB;AAEtB,OAAO,MAAMM,UAAU,OAAO,EAC5BC,EAAE,EACFC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,IAAI,EACJC,GAAG,EACHC,cAAc,EACdC,MAAM,EACNC,KAAK,EACLC,UAAU,EACVC,cAAc,EACdC,MAAM,EACNC,qBAAqB,EACrBC,kBAAkB,EAClBC,SAAS,EACTC,cAAc,EACdC,eAAe,EACfC,iBAAiB,EACjBC,UAAU,EACVC,gBAAgB,EAChBC,GAAG,EACHC,WAAW,EACXC,UAAU,EACVC,qBAAqB,EACrBC,aAAa,EACbC,SAAS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jCO,QAAQC,OAAO,CAACR,mBAAmB/C,MAAM,KAAK,KAC9C,OAAO+C,kBAAkBI,UAAU,KAAK,YACxClI,MAAMkI,UAAU,CAACnF,QAAQ,CAAC+E,kBAAkBI,UAAU,KACrD,CAAA,OAAOJ,kBAAkBrE,KAAK,KAAK,YAAY,OAAOqE,kBAAkBrE,KAAK,KAAK,QAAO;QAE5F,OAAO,CAACwE;IACV;IAEA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/fields/hooks/beforeChange/promise.ts"],"sourcesContent":["import type { RichTextAdapter } from '../../../admin/RichText.js'\nimport type { SanitizedCollectionConfig } from '../../../collections/config/types.js'\nimport type { ValidationFieldError } from '../../../errors/index.js'\nimport type { SanitizedGlobalConfig } from '../../../globals/config/types.js'\nimport type { FieldOperation, JsonObject, PayloadRequest } from '../../../types/index.js'\nimport type { Block, Field, TabAsField, Validate } from '../../config/types.js'\n\nimport { MissingEditorProp } from '../../../errors/index.js'\nimport { type RequestContext, validateBlocksFilterOptions } from '../../../index.js'\nimport { deepMergeWithSourceArrays } from '../../../utilities/deepMerge.js'\nimport { getTranslatedLabel } from '../../../utilities/getTranslatedLabel.js'\nimport { isolateObjectProperty } from '../../../utilities/isolateObjectProperty.js'\nimport { fieldAffectsData, fieldShouldBeLocalized, tabHasName } from '../../config/types.js'\nimport { getFieldPaths } from '../../getFieldPaths.js'\nimport { flattenValidationData } from './flattenValidationData.js'\nimport { getExistingRowDoc } from './getExistingRowDoc.js'\nimport { traverseFields } from './traverseFields.js'\n\nfunction buildFieldLabel(parentLabel: string, label: string | undefined): string {\n if (!label) {\n return parentLabel\n }\n const capitalizedLabel = label.charAt(0).toUpperCase() + label.slice(1)\n return parentLabel && capitalizedLabel\n ? `${parentLabel} > ${capitalizedLabel}`\n : capitalizedLabel || parentLabel\n}\n\ntype Args = {\n /**\n * Data of the nearest parent block. If no parent block exists, this will be the `undefined`\n */\n blockData?: JsonObject\n blockFields?: Field[]\n collection: null | SanitizedCollectionConfig\n context: RequestContext\n data: JsonObject\n doc: JsonObject\n docWithLocales: JsonObject\n errors: ValidationFieldError[]\n field: Field | TabAsField\n fieldIndex: number\n /**\n * Built up labels of parent fields\n *\n * @example \"Group Field > Tab Field > Text Field\"\n */\n fieldLabelPath: string\n global: null | SanitizedGlobalConfig\n id?: number | string\n isValidationOperation: boolean\n mergeLocaleActions: (() => Promise<void> | void)[]\n operation: FieldOperation\n overrideAccess: boolean\n parentIndexPath: string\n parentIsLocalized: boolean\n parentPath: string\n parentSchemaPath: string\n req: PayloadRequest\n siblingData: JsonObject\n siblingDoc: JsonObject\n siblingDocWithLocales?: JsonObject\n siblingFields?: (Field | TabAsField)[]\n skipHooks: boolean\n skipValidation: boolean\n submittedTopLevelFieldNames?: ReadonlySet<string>\n}\n\n// This function is responsible for the following actions, in order:\n// - Run condition\n// - Execute field hooks\n// - Validate data\n// - Transform data for storage\n// - beforeDuplicate hooks (if duplicate)\n// - Unflatten locales\n\nexport const promise = async ({\n id,\n blockData,\n blockFields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n field,\n fieldIndex,\n fieldLabelPath,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales,\n siblingFields,\n skipHooks,\n skipValidation,\n submittedTopLevelFieldNames,\n}: Args): Promise<void> => {\n const { indexPath, path, schemaPath } = getFieldPaths({\n field,\n index: fieldIndex,\n parentIndexPath,\n parentPath,\n parentSchemaPath,\n })\n\n const { localization } = req.payload.config\n const defaultLocale = localization ? localization?.defaultLocale : 'en'\n const operationLocale = req.locale || defaultLocale\n\n const pathSegments = path ? path.split('.') : []\n const schemaPathSegments = schemaPath ? schemaPath.split('.') : []\n const indexPathSegments = indexPath ? indexPath.split('-').filter(Boolean)?.map(Number) : []\n\n const passesCondition = field.admin?.condition\n ? Boolean(\n field.admin.condition(data, siblingData, {\n blockData: blockData!,\n operation,\n path: pathSegments,\n user: req.user,\n }),\n )\n : true\n const isOutsideSubmittedFieldScope =\n submittedTopLevelFieldNames !== undefined &&\n fieldAffectsData(field) &&\n !submittedTopLevelFieldNames.has(pathSegments[0]!)\n let skipValidationFromHere = skipValidation || isOutsideSubmittedFieldScope || !passesCondition\n\n if (fieldAffectsData(field)) {\n const shouldSkipValidationForLocalizedFallback =\n !isValidationOperation &&\n operation !== 'validate' &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n operationLocale !== defaultLocale &&\n ['array', 'blocks'].includes(field.type) &&\n siblingData[field.name!] === null\n\n if (shouldSkipValidationForLocalizedFallback) {\n skipValidationFromHere = true\n }\n\n // Execute hooks\n if (!skipHooks && 'hooks' in field && field.hooks?.beforeChange) {\n for (const hook of field.hooks.beforeChange) {\n const hookedValue = await hook({\n blockData,\n collection,\n context,\n data,\n field,\n global,\n indexPath: indexPathSegments,\n operation,\n originalDoc: doc,\n overrideAccess,\n path: pathSegments,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n siblingDocWithLocales,\n siblingFields: siblingFields!,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }\n }\n\n if (hasInvalidFieldValueShape({ field, value: siblingData[field.name!] })) {\n errors.push({\n label: buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.name, req.i18n),\n ),\n message: req.t('validation:invalidInput'),\n path,\n })\n return\n }\n\n // Validate\n if (!skipValidationFromHere && 'validate' in field && field.validate) {\n const valueToValidate = siblingData[field.name]\n\n // With `locale: 'all'` a localized scalar is a locale-keyed object; validate each locale, not the\n // wrapper. Containers (`group`/`array`/`blocks`) are excluded - per-locale child validation is a follow-up.\n const isLocaleKeyedValue =\n operationLocale === 'all' &&\n localization &&\n fieldShouldBeLocalized({ field, parentIsLocalized }) &&\n field.type !== 'group' &&\n valueToValidate !== null &&\n typeof valueToValidate === 'object' &&\n !Array.isArray(valueToValidate)\n\n const localizedValuesToValidate: { locale?: string; value: unknown }[] = isLocaleKeyedValue\n ? localization.localeCodes\n .filter((locale) => locale in (valueToValidate as JsonObject))\n .map((locale) => ({ locale, value: (valueToValidate as JsonObject)[locale] }))\n : [{ value: valueToValidate }]\n\n // No recognized locales (e.g. `{}`): validate `undefined` once so required/optional still apply.\n if (localizedValuesToValidate.length === 0) {\n localizedValuesToValidate.push({ value: undefined })\n }\n\n let jsonError: object\n\n if (field.type === 'json' && typeof siblingData[field.name] === 'string') {\n try {\n JSON.parse(siblingData[field.name] as string)\n } catch (e) {\n jsonError = e as object\n }\n }\n\n const validateFn: Validate<object, object, object, object> = field.validate as Validate<\n object,\n object,\n object,\n object\n >\n\n let validationResult: string | true = true\n let failedLocale: string | undefined\n\n const validationData = deepMergeWithSourceArrays<JsonObject>(doc, data)\n const validationSiblingData = deepMergeWithSourceArrays<JsonObject>(siblingDoc, siblingData)\n\n for (const { locale, value } of localizedValuesToValidate) {\n // Scope `req.locale` to the locale being validated without mutating the shared request.\n const validationReq = locale ? isolateObjectProperty(req, 'locale') : req\n if (locale) {\n validationReq.locale = locale\n }\n\n const localeContext = locale\n ? {\n blockData:\n blockData && blockFields\n ? flattenValidationData({\n config: req.payload.config,\n data: blockData,\n fields: blockFields,\n locale,\n parentIsLocalized,\n })\n : blockData,\n data: flattenValidationData({\n config: req.payload.config,\n data: validationData,\n fields: (collection?.fields || global?.fields)!,\n locale,\n }),\n siblingData: flattenValidationData({\n config: req.payload.config,\n data: validationSiblingData,\n fields: siblingFields!,\n locale,\n parentIsLocalized,\n }),\n }\n : { blockData, data: validationData, siblingData: validationSiblingData }\n\n validationResult = await validateFn(value as never, {\n ...field,\n id,\n blockData: localeContext.blockData!,\n collectionSlug: collection?.slug,\n data: localeContext.data,\n event: 'submit',\n // @ts-expect-error generic validation options cannot infer JSON fields\n jsonError,\n operation,\n overrideAccess,\n path: pathSegments,\n preferences: { fields: {} },\n previousValue: locale\n ? (siblingDoc[field.name] as JsonObject)?.[locale]\n : siblingDoc[field.name],\n req: validationReq,\n siblingData: localeContext.siblingData,\n })\n\n if (typeof validationResult === 'string') {\n failedLocale = locale\n break\n }\n }\n\n if (typeof validationResult === 'string') {\n let filterOptionsError = false\n\n if (field.type === 'blocks' && field.filterOptions) {\n // Re-run filteroptions. If the validation error is due to filteroptions, we need to add error paths to all the blocks\n // that are no longer valid\n const validationResult = await validateBlocksFilterOptions({\n id,\n data,\n filterOptions: field.filterOptions,\n req,\n siblingData,\n value: siblingData[field.name],\n })\n if (validationResult?.invalidBlockSlugs?.length) {\n filterOptionsError = true\n let rowIndex = -1\n for (const block of siblingData[field.name] as JsonObject[]) {\n rowIndex++\n if (validationResult.invalidBlockSlugs.includes(block.blockType as string)) {\n const blockConfigOrSlug = field.blocks.find((blockFromField) =>\n typeof blockFromField === 'string'\n ? blockFromField === block.blockType\n : blockFromField.slug === block.blockType,\n )\n const blockConfig =\n typeof blockConfigOrSlug === 'string'\n ? req.payload.blocks[blockConfigOrSlug]\n : blockConfigOrSlug\n\n const blockLabelPath =\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n `${getTranslatedLabel(field?.label || field?.name, req.i18n)} > ${req.t('fields:block')} ${rowIndex + 1} (${getTranslatedLabel(blockConfig?.labels?.singular || block.blockType, req.i18n)})`,\n )\n\n errors.push({\n label: blockLabelPath,\n message: req.t('validation:invalidBlock', { block: block.blockType }),\n path: `${path}.${rowIndex}.id`,\n })\n }\n }\n }\n }\n\n if (!filterOptionsError) {\n // If the error is due to block filterOptions, we want to push the errors for each individual block, not the blocks\n // field itself => only push the error if the field is not a block field with validation failure due to filterOptions\n const fieldLabel = buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.name, req.i18n),\n )\n\n errors.push({\n label: failedLocale ? `${fieldLabel} (${failedLocale})` : fieldLabel,\n message: validationResult,\n path,\n })\n }\n }\n }\n\n // Push merge locale action if applicable\n if (localization && fieldShouldBeLocalized({ field, parentIsLocalized })) {\n mergeLocaleActions.push(() => {\n const localeData: Record<string, unknown> = {}\n\n // With `locale: 'all'`, siblingData holds a locale-keyed object (`{ en, es }`) rather than a single\n // locale's value - take each submitted locale, falling back to the existing doc for ones not sent.\n const submittedValue = siblingData[field.name!]\n const isAllLocales =\n req.locale === 'all' &&\n submittedValue !== null &&\n typeof submittedValue === 'object' &&\n !Array.isArray(submittedValue)\n\n for (const locale of localization.localeCodes) {\n const existingValue = siblingDocWithLocales?.[field.name!]?.[locale]\n\n const fieldValue = isAllLocales\n ? locale in (submittedValue as Record<string, unknown>)\n ? (submittedValue as Record<string, unknown>)[locale]\n : existingValue\n : locale === req.locale\n ? submittedValue\n : existingValue\n\n // update locale value if it's not undefined\n if (typeof fieldValue !== 'undefined') {\n localeData[locale] = fieldValue\n }\n }\n\n // If there are locales with data, set the data\n if (Object.keys(localeData).length > 0) {\n siblingData[field.name!] = localeData\n }\n })\n }\n }\n\n switch (field.type) {\n case 'array': {\n const rows = siblingData[field.name]\n\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n\n rows.forEach((row, rowIndex) => {\n promises.push(\n traverseFields({\n id,\n blockData,\n blockFields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n `${getTranslatedLabel(field?.label || field?.name, req.i18n)} ${rowIndex + 1}`,\n ),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath,\n req,\n siblingData: row as JsonObject,\n siblingDoc: getExistingRowDoc(row as JsonObject, siblingDoc[field.name]),\n siblingDocWithLocales: getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales?.[field.name],\n ),\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n }),\n )\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'blocks': {\n const rows = siblingData[field.name]\n if (Array.isArray(rows)) {\n const promises: Promise<void>[] = []\n\n rows.forEach((row, rowIndex) => {\n const rowSiblingDoc = getExistingRowDoc(row as JsonObject, siblingDoc[field.name])\n\n const rowSiblingDocWithLocales = getExistingRowDoc(\n row as JsonObject,\n siblingDocWithLocales ? siblingDocWithLocales[field.name] : {},\n )\n\n const blockTypeToMatch = (row as JsonObject).blockType || rowSiblingDoc.blockType\n\n const block: Block | undefined =\n req.payload.blocks[blockTypeToMatch] ??\n (field.blocks.find(\n (curBlock) => typeof curBlock !== 'string' && curBlock.slug === blockTypeToMatch,\n ) as Block | undefined)\n\n const blockLabelPath =\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n `${getTranslatedLabel(field?.label || field?.name, req.i18n)} > ${req.t('fields:block')} ${rowIndex + 1} (${getTranslatedLabel(block?.labels?.singular || blockTypeToMatch, req.i18n)})`,\n )\n\n if (block) {\n promises.push(\n traverseFields({\n id,\n blockData: row,\n blockFields: block.fields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath: blockLabelPath,\n\n fields: block.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: '',\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: path + '.' + rowIndex,\n parentSchemaPath: schemaPath + '.' + block.slug,\n req,\n siblingData: row as JsonObject,\n siblingDoc: rowSiblingDoc,\n siblingDocWithLocales: rowSiblingDocWithLocales,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n }),\n )\n }\n })\n\n await Promise.all(promises)\n }\n\n break\n }\n\n case 'collapsible':\n case 'row': {\n await traverseFields({\n id,\n blockData,\n blockFields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field.type === 'row' || field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.type, req.i18n),\n ),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales: siblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n case 'group': {\n let groupSiblingData = siblingData\n let groupSiblingDoc = siblingDoc\n let groupSiblingDocWithLocales = siblingDocWithLocales\n\n const isNamedGroup = fieldAffectsData(field)\n\n if (isNamedGroup) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n if (typeof siblingDocWithLocales![field.name] !== 'object') {\n siblingDocWithLocales![field.name] = {}\n }\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n if (typeof siblingDocWithLocales![field.name] !== 'object') {\n siblingDocWithLocales![field.name] = {}\n }\n\n groupSiblingData = siblingData[field.name] as JsonObject\n groupSiblingDoc = siblingDoc[field.name] as JsonObject\n groupSiblingDocWithLocales = siblingDocWithLocales![field.name] as JsonObject\n }\n\n const fallbackLabel = field?.label || (isNamedGroup ? field.name : field?.type)\n\n await traverseFields({\n id,\n blockData,\n blockFields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(fieldLabelPath, getTranslatedLabel(fallbackLabel, req.i18n)),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: isNamedGroup ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: isNamedGroup ? path : parentPath,\n parentSchemaPath: schemaPath,\n req,\n siblingData: groupSiblingData,\n siblingDoc: groupSiblingDoc,\n siblingDocWithLocales: groupSiblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n case 'point': {\n // Transform point data for storage\n if (\n Array.isArray(siblingData[field.name]) &&\n siblingData[field.name][0] !== null &&\n siblingData[field.name][1] !== null\n ) {\n siblingData[field.name] = {\n type: 'Point',\n coordinates: [\n parseFloat(siblingData[field.name][0]),\n parseFloat(siblingData[field.name][1]),\n ],\n }\n }\n\n break\n }\n\n case 'richText': {\n if (!field?.editor) {\n throw new MissingEditorProp(field) // while we allow disabling editor functionality, you should not have any richText fields defined if you do not have an editor\n }\n\n if (typeof field?.editor === 'function') {\n throw new Error('Attempted to access unsanitized rich text editor.')\n }\n\n const editor: RichTextAdapter = field?.editor\n\n if (!skipHooks && editor?.hooks?.beforeChange?.length) {\n for (const hook of editor.hooks.beforeChange) {\n const hookedValue = await hook({\n collection,\n context,\n data,\n docWithLocales,\n errors,\n field,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field?.name, req.i18n),\n ),\n global,\n indexPath: indexPathSegments,\n mergeLocaleActions,\n operation,\n originalDoc: doc,\n overrideAccess,\n parentIsLocalized,\n path: pathSegments,\n previousSiblingDoc: siblingDoc,\n previousValue: siblingDoc[field.name],\n req,\n schemaPath: schemaPathSegments,\n siblingData,\n siblingDocWithLocales,\n skipValidation: skipValidationFromHere,\n value: siblingData[field.name],\n })\n\n if (hookedValue !== undefined) {\n siblingData[field.name] = hookedValue\n }\n }\n }\n\n break\n }\n\n case 'tab': {\n let tabSiblingData = siblingData\n let tabSiblingDoc = siblingDoc\n let tabSiblingDocWithLocales = siblingDocWithLocales\n\n const isNamedTab = tabHasName(field)\n\n if (isNamedTab) {\n if (typeof siblingData[field.name] !== 'object') {\n siblingData[field.name] = {}\n }\n\n if (typeof siblingDoc[field.name] !== 'object') {\n siblingDoc[field.name] = {}\n }\n\n if (typeof siblingDocWithLocales![field.name] !== 'object') {\n siblingDocWithLocales![field.name] = {}\n }\n\n tabSiblingData = siblingData[field.name] as JsonObject\n tabSiblingDoc = siblingDoc[field.name] as JsonObject\n tabSiblingDocWithLocales = siblingDocWithLocales![field.name] as JsonObject\n }\n\n await traverseFields({\n id,\n blockData,\n blockFields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(\n fieldLabelPath,\n getTranslatedLabel(field?.label || field.name, req.i18n),\n ),\n fields: field.fields,\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: isNamedTab ? '' : indexPath,\n parentIsLocalized: parentIsLocalized || field.localized,\n parentPath: isNamedTab ? path : parentPath,\n parentSchemaPath: schemaPath,\n req,\n siblingData: tabSiblingData,\n siblingDoc: tabSiblingDoc,\n siblingDocWithLocales: tabSiblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n case 'tabs': {\n await traverseFields({\n id,\n blockData,\n blockFields,\n collection,\n context,\n data,\n doc,\n docWithLocales,\n errors,\n fieldLabelPath:\n field?.label === false\n ? fieldLabelPath\n : buildFieldLabel(fieldLabelPath, getTranslatedLabel(field?.label || '', req.i18n)),\n fields: field.tabs.map((tab) => ({ ...tab, type: 'tab' })),\n global,\n isValidationOperation,\n mergeLocaleActions,\n operation,\n overrideAccess,\n parentIndexPath: indexPath,\n parentIsLocalized,\n parentPath: path,\n parentSchemaPath: schemaPath,\n req,\n siblingData,\n siblingDoc,\n siblingDocWithLocales: siblingDocWithLocales!,\n skipHooks,\n skipValidation: skipValidationFromHere,\n submittedTopLevelFieldNames,\n })\n\n break\n }\n\n default: {\n break\n }\n }\n}\n\nfunction hasInvalidFieldValueShape({\n field,\n value,\n}: {\n field: Field | TabAsField\n value: unknown\n}): boolean {\n if (value === null || typeof value === 'undefined' || !fieldAffectsData(field)) {\n return false\n }\n\n if (field.type === 'array' || field.type === 'blocks') {\n // Form state may use a numeric row count, while submitted values use arrays.\n return !(Array.isArray(value) || typeof value === 'number')\n }\n\n if (field.type === 'number') {\n // Only hasMany number fields may receive arrays.\n return typeof value === 'object' && !(field.hasMany && Array.isArray(value))\n }\n\n if ((field.type === 'relationship' || field.type === 'upload') && field.hasMany) {\n // HasMany relationships/uploads may receive arrays or one valid polymorphic value.\n if (typeof value !== 'object' || Array.isArray(value)) {\n return false\n }\n\n const relationshipValue = value as Record<PropertyKey, unknown>\n const valuePrototype = Object.getPrototypeOf(value)\n const isSinglePolymorphicRelationshipValue =\n Array.isArray(field.relationTo) &&\n (valuePrototype === null || valuePrototype === Object.prototype) &&\n Object.hasOwn(relationshipValue, 'relationTo') &&\n Object.hasOwn(relationshipValue, 'value') &&\n Reflect.ownKeys(relationshipValue).length === 2 &&\n typeof relationshipValue.relationTo === 'string' &&\n field.relationTo.includes(relationshipValue.relationTo) &&\n (typeof relationshipValue.value === 'string' || typeof relationshipValue.value === 'number')\n\n return !isSinglePolymorphicRelationshipValue\n }\n\n return false\n}\n"],"names":["MissingEditorProp","validateBlocksFilterOptions","deepMergeWithSourceArrays","getTranslatedLabel","isolateObjectProperty","fieldAffectsData","fieldShouldBeLocalized","tabHasName","getFieldPaths","flattenValidationData","getExistingRowDoc","traverseFields","buildFieldLabel","parentLabel","label","capitalizedLabel","charAt","toUpperCase","slice","promise","id","blockData","blockFields","collection","context","data","doc","docWithLocales","errors","field","fieldIndex","fieldLabelPath","global","isValidationOperation","mergeLocaleActions","operation","overrideAccess","parentIndexPath","parentIsLocalized","parentPath","parentSchemaPath","req","siblingData","siblingDoc","siblingDocWithLocales","siblingFields","skipHooks","skipValidation","submittedTopLevelFieldNames","indexPath","path","schemaPath","index","localization","payload","config","defaultLocale","operationLocale","locale","pathSegments","split","schemaPathSegments","indexPathSegments","filter","Boolean","map","Number","passesCondition","admin","condition","user","isOutsideSubmittedFieldScope","undefined","has","skipValidationFromHere","shouldSkipValidationForLocalizedFallback","includes","type","name","hooks","beforeChange","hook","hookedValue","originalDoc","previousSiblingDoc","previousValue","value","hasInvalidFieldValueShape","push","i18n","message","t","validate","valueToValidate","isLocaleKeyedValue","Array","isArray","localizedValuesToValidate","localeCodes","length","jsonError","JSON","parse","e","validateFn","validationResult","failedLocale","validationData","validationSiblingData","validationReq","localeContext","fields","collectionSlug","slug","event","preferences","filterOptionsError","filterOptions","invalidBlockSlugs","rowIndex","block","blockType","blockConfigOrSlug","blocks","find","blockFromField","blockConfig","blockLabelPath","labels","singular","fieldLabel","localeData","submittedValue","isAllLocales","existingValue","fieldValue","Object","keys","rows","promises","forEach","row","localized","Promise","all","rowSiblingDoc","rowSiblingDocWithLocales","blockTypeToMatch","curBlock","groupSiblingData","groupSiblingDoc","groupSiblingDocWithLocales","isNamedGroup","fallbackLabel","coordinates","parseFloat","editor","Error","tabSiblingData","tabSiblingDoc","tabSiblingDocWithLocales","isNamedTab","tabs","tab","hasMany","relationshipValue","valuePrototype","getPrototypeOf","isSinglePolymorphicRelationshipValue","relationTo","prototype","hasOwn","Reflect","ownKeys"],"mappings":"AAOA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAA8BC,2BAA2B,QAAQ,oBAAmB;AACpF,SAASC,yBAAyB,QAAQ,kCAAiC;AAC3E,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,gBAAgB,EAAEC,sBAAsB,EAAEC,UAAU,QAAQ,wBAAuB;AAC5F,SAASC,aAAa,QAAQ,yBAAwB;AACtD,SAASC,qBAAqB,QAAQ,6BAA4B;AAClE,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,cAAc,QAAQ,sBA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+B,cAAc,CAACjF;QAC7C,MAAMkF,uCACJzE,MAAMC,OAAO,CAACnE,MAAM4I,UAAU,KAC7BH,CAAAA,mBAAmB,QAAQA,mBAAmB9B,OAAOkC,SAAS,AAAD,KAC9DlC,OAAOmC,MAAM,CAACN,mBAAmB,iBACjC7B,OAAOmC,MAAM,CAACN,mBAAmB,YACjCO,QAAQC,OAAO,CAACR,mBAAmBlE,MAAM,KAAK,KAC9C,OAAOkE,kBAAkBI,UAAU,KAAK,YACxC5I,MAAM4I,UAAU,CAAC7F,QAAQ,CAACyF,kBAAkBI,UAAU,KACrD,CAAA,OAAOJ,kBAAkB/E,KAAK,KAAK,YAAY,OAAO+E,kBAAkB/E,KAAK,KAAK,QAAO;QAE5F,OAAO,CAACkF;IACV;IAEA,OAAO;AACT"}
|
|
@@ -9,6 +9,7 @@ type Args = {
|
|
|
9
9
|
* Data of the nearest parent block. If no parent block exists, this will be the `undefined`
|
|
10
10
|
*/
|
|
11
11
|
blockData?: JsonObject;
|
|
12
|
+
blockFields?: Field[];
|
|
12
13
|
collection: null | SanitizedCollectionConfig;
|
|
13
14
|
context: RequestContext;
|
|
14
15
|
data: JsonObject;
|
|
@@ -63,6 +64,6 @@ type Args = {
|
|
|
63
64
|
* - Transform data for storage
|
|
64
65
|
* - Unflatten locales. The input `data` is the normal document for one locale. The output result will become the document with locales.
|
|
65
66
|
*/
|
|
66
|
-
export declare const traverseFields: ({ id, blockData, collection, context, data, doc, docWithLocales, errors, fieldLabelPath, fields, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, skipHooks, skipValidation, submittedTopLevelFieldNames, }: Args) => Promise<void>;
|
|
67
|
+
export declare const traverseFields: ({ id, blockData, blockFields, collection, context, data, doc, docWithLocales, errors, fieldLabelPath, fields, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, skipHooks, skipValidation, submittedTopLevelFieldNames, }: Args) => Promise<void>;
|
|
67
68
|
export {};
|
|
68
69
|
//# sourceMappingURL=traverseFields.d.ts.map
|