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,131 +0,0 @@
|
|
|
1
|
-
import type { Payload } from '../index.js';
|
|
2
|
-
import type { PayloadRequest, Where } from '../types/index.js';
|
|
3
|
-
type QueryArgs = {
|
|
4
|
-
branch?: false | string;
|
|
5
|
-
collectionSlug: string;
|
|
6
|
-
req?: Partial<PayloadRequest>;
|
|
7
|
-
where: undefined | Where;
|
|
8
|
-
};
|
|
9
|
-
export declare const findBranchVersionForkBoundary: ({ collectionSlug, docID, req, }: {
|
|
10
|
-
collectionSlug: string;
|
|
11
|
-
docID: number | string;
|
|
12
|
-
req: PayloadRequest;
|
|
13
|
-
}) => Promise<{
|
|
14
|
-
baseVersionID?: string;
|
|
15
|
-
baseVersionUpdatedAt?: string;
|
|
16
|
-
}>;
|
|
17
|
-
/**
|
|
18
|
-
* Branch predicate for version queries.
|
|
19
|
-
*
|
|
20
|
-
* Mirrors the collection predicate, but a version row's canonical identity is
|
|
21
|
-
* its `parent` on main and its `_branchParent` on a branch — so the exclusion of
|
|
22
|
-
* shadowed main versions compares `parent`, which for a main version row is
|
|
23
|
-
* already the canonical document ID.
|
|
24
|
-
*/
|
|
25
|
-
export declare const resolveBranchVersionQuery: ({ branch: branchOverride, collectionSlug, req, where, }: QueryArgs) => Promise<undefined | Where>;
|
|
26
|
-
/**
|
|
27
|
-
* Synchronous branch predicate for version joins.
|
|
28
|
-
*
|
|
29
|
-
* Join query builders run after the top-level read has loaded and memoized the branch manifest.
|
|
30
|
-
* This uses that state while sharing the exact query construction with
|
|
31
|
-
* {@link resolveBranchVersionQuery}.
|
|
32
|
-
*/
|
|
33
|
-
export declare const resolveBranchVersionQuerySync: ({ branch: branchOverride, collectionSlug, req, where, }: QueryArgs) => undefined | Where;
|
|
34
|
-
/**
|
|
35
|
-
* Branch predicate for reading version *history*, as opposed to listing drafts.
|
|
36
|
-
*
|
|
37
|
-
* A branch's history reads as a continuation of main's: main's versions up to the
|
|
38
|
-
* point the branch forked are the branch's ancestry, the branch's own versions sit
|
|
39
|
-
* on top, and no other branch is visible. Anything main recorded after the fork
|
|
40
|
-
* belongs to main alone — it is not this branch's past.
|
|
41
|
-
*
|
|
42
|
-
* Deliberately *not* {@link resolveBranchVersionQuery}. That one hides main's
|
|
43
|
-
* versions for any shadowed document, which is right when listing one row per
|
|
44
|
-
* document and exactly wrong here: those hidden rows are the ancestry.
|
|
45
|
-
*/
|
|
46
|
-
export declare const resolveBranchVersionHistoryQuery: ({ branch: branchOverride, collectionSlug, req, where, }: QueryArgs) => Promise<undefined | Where>;
|
|
47
|
-
/**
|
|
48
|
-
* Restores canonical document IDs on version rows read from a branch, whose
|
|
49
|
-
* `parent` is the shadow row rather than the document.
|
|
50
|
-
*/
|
|
51
|
-
export declare const projectBranchVersionParents: (docs: Record<string, any>[]) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Attaches a new version to the branch's own copy of the document.
|
|
54
|
-
*
|
|
55
|
-
* Without this a draft saved on a branch would append to main's version chain,
|
|
56
|
-
* which is both visible on main and destructive to its `latest` bookkeeping.
|
|
57
|
-
*/
|
|
58
|
-
export declare const resolveBranchVersionParent: ({ branch: branchOverride, collectionSlug, parent, req, versionData, }: {
|
|
59
|
-
branch?: false | string;
|
|
60
|
-
collectionSlug: string;
|
|
61
|
-
parent: number | string;
|
|
62
|
-
req?: Partial<PayloadRequest>;
|
|
63
|
-
versionData: Record<string, unknown>;
|
|
64
|
-
}) => Promise<{
|
|
65
|
-
parent: number | string;
|
|
66
|
-
versionData: Record<string, unknown>;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Restores canonical document IDs on rows returned by `queryDrafts`, which
|
|
70
|
-
* surfaces a version's `parent` as the document ID.
|
|
71
|
-
*/
|
|
72
|
-
export declare const projectBranchVersionParent: (row: Record<string, any>) => number | string;
|
|
73
|
-
/**
|
|
74
|
-
* The version rows this branch owns for one document.
|
|
75
|
-
*
|
|
76
|
-
* Every operation that reaches into an existing version chain needs this, not just
|
|
77
|
-
* deletes: a cascade after a delete, pruning to `maxPerDoc`, and rewriting the latest
|
|
78
|
-
* row on unpublish are all the same question — which rows belong to the branch doing
|
|
79
|
-
* the writing.
|
|
80
|
-
*
|
|
81
|
-
* Deleting a document cascades to its versions by `parent`. On a branch that is
|
|
82
|
-
* destructive: the delete becomes a tombstone rather than a real delete, but the
|
|
83
|
-
* cascade still names the canonical ID — which is main's `parent` — so main loses
|
|
84
|
-
* its version chain while its row survives. A published document then vanishes
|
|
85
|
-
* from main's own drafts list, and nothing about the branch says why.
|
|
86
|
-
*
|
|
87
|
-
* Adding `_branch` makes the cascade hit only the rows belonging to the branch in
|
|
88
|
-
* play. It also protects a branch's chain from a delete performed on main, whose
|
|
89
|
-
* versions share no `parent` with it but are cheap to exclude explicitly.
|
|
90
|
-
*/
|
|
91
|
-
export declare const resolveBranchOwnVersions: ({ id, branch: branchOverride, collectionSlug, req, }: {
|
|
92
|
-
branch?: false | string;
|
|
93
|
-
collectionSlug: string;
|
|
94
|
-
id: number | string;
|
|
95
|
-
req?: Partial<PayloadRequest>;
|
|
96
|
-
}) => Promise<Where>;
|
|
97
|
-
/**
|
|
98
|
-
* Drops a branch's version chain for one document.
|
|
99
|
-
*
|
|
100
|
-
* Every way a branch stops owning a document ends here: merged, discarded, or
|
|
101
|
-
* promoted to main. A branch's versions hang off its *shadow row's* primary key
|
|
102
|
-
* rather than the canonical ID, so they do not travel with the document and are not
|
|
103
|
-
* cascaded by anything that addresses it — they have to be deleted deliberately.
|
|
104
|
-
*
|
|
105
|
-
* Leaving them behind is not inert. The drafts list reads through versions, so an
|
|
106
|
-
* orphaned branch chain keeps answering for a document the branch no longer has a
|
|
107
|
-
* row for: the branch lists the document twice, once from its stale chain and once
|
|
108
|
-
* from main's, as two identical rows.
|
|
109
|
-
*
|
|
110
|
-
* Scoped by `_branch` as well as `parent`: main's chain shares no parent with this
|
|
111
|
-
* one, but saying so costs nothing and a wrong delete here would strip production
|
|
112
|
-
* history. `_branchParent` is required for the same reason — only rows that were
|
|
113
|
-
* written as branch versions are in scope.
|
|
114
|
-
*/
|
|
115
|
-
export declare const deleteBranchVersionChain: ({ branch, collectionSlug, payload, req, rowID, }: {
|
|
116
|
-
branch: string;
|
|
117
|
-
collectionSlug: string;
|
|
118
|
-
payload: Payload;
|
|
119
|
-
req: PayloadRequest;
|
|
120
|
-
/** Primary key the branch's versions hang off — the shadow row, not the document. */
|
|
121
|
-
rowID: number | string;
|
|
122
|
-
}) => Promise<void>;
|
|
123
|
-
/** Drops every version of one global owned by a branch that is being discarded or merged. */
|
|
124
|
-
export declare const deleteBranchGlobalVersionChain: ({ branch, globalSlug, payload, req, }: {
|
|
125
|
-
branch: string;
|
|
126
|
-
globalSlug: string;
|
|
127
|
-
payload: Payload;
|
|
128
|
-
req: PayloadRequest;
|
|
129
|
-
}) => Promise<void>;
|
|
130
|
-
export {};
|
|
131
|
-
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/branching/versions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAmB9D,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B,KAAK,EAAE,SAAS,GAAG,KAAK,CAAA;CACzB,CAAA;AAcD,eAAO,MAAM,6BAA6B,oCAIvC;IACD,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAAE,CA+BpE,CAAA;AAqDD;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,4DAKnC,SAAS,KAAG,OAAO,CAAC,SAAS,GAAG,KAAK,CAuBvC,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,4DAKvC,SAAS,KAAG,SAAS,GAAG,KAsB1B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gCAAgC,4DAK1C,SAAS,KAAG,OAAO,CAAC,SAAS,GAAG,KAAK,CAuFvC,CAAA;AAyCD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,SAAU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAG,IAQzE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,0EAMpC;IACD,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC,KAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CA2B5E,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,QAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,MAAM,GAAG,MACH,CAAA;AAE5E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,yDAKlC;IACD,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAC9B,KAAG,OAAO,CAAC,KAAK,CA0BhB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,wBAAwB,qDAMlC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;IACnB,qFAAqF;IACrF,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CACvB,KAAG,OAAO,CAAC,IAAI,CAkBf,CAAA;AAED,6FAA6F;AAC7F,eAAO,MAAM,8BAA8B,0CAKxC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,IAAI,CAYf,CAAA"}
|
|
@@ -1,572 +0,0 @@
|
|
|
1
|
-
import { extractRelationshipID } from '../utilities/extractRelationshipID.js';
|
|
2
|
-
import { rewriteBranchVersionParents } from './branchIDs.js';
|
|
3
|
-
import { loadBranchDeletions, loadBranchManifest, peekBranchDeletions, peekBranchManifest, resolveBranch } from './resolveBranch.js';
|
|
4
|
-
import { resolveBranchRowID } from './resolveBranchRowID.js';
|
|
5
|
-
import { branchChangesCollectionSlug, branchField, branchParentField, MAIN_BRANCH } from './types.js';
|
|
6
|
-
const bypassed = (branch, req)=>branch === false || !req?.payload || Boolean(req.context?._branchBypass);
|
|
7
|
-
export const findBranchVersionForkBoundary = async ({ collectionSlug, docID, req })=>{
|
|
8
|
-
if (!req.payload.collections[collectionSlug]?.config.versions) {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
const { docs } = await req.payload.db.findVersions({
|
|
12
|
-
branch: false,
|
|
13
|
-
collection: collectionSlug,
|
|
14
|
-
limit: 1,
|
|
15
|
-
pagination: false,
|
|
16
|
-
req,
|
|
17
|
-
sort: '-updatedAt',
|
|
18
|
-
where: {
|
|
19
|
-
and: [
|
|
20
|
-
{
|
|
21
|
-
[branchField]: {
|
|
22
|
-
equals: MAIN_BRANCH
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
parent: {
|
|
27
|
-
equals: docID
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const latestMainVersion = docs[0];
|
|
34
|
-
if (latestMainVersion?.id === undefined || !latestMainVersion.updatedAt) {
|
|
35
|
-
return {};
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
baseVersionID: String(latestMainVersion.id),
|
|
39
|
-
baseVersionUpdatedAt: latestMainVersion.updatedAt instanceof Date ? latestMainVersion.updatedAt.toISOString() : latestMainVersion.updatedAt
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
const buildBranchVersionQuery = ({ branch, deletedIDs, shadowedIDs, where })=>{
|
|
43
|
-
if (branch === MAIN_BRANCH) {
|
|
44
|
-
const mainBase = where && Object.keys(where).length ? [
|
|
45
|
-
where
|
|
46
|
-
] : [];
|
|
47
|
-
return {
|
|
48
|
-
and: [
|
|
49
|
-
...mainBase,
|
|
50
|
-
{
|
|
51
|
-
[branchField]: {
|
|
52
|
-
equals: MAIN_BRANCH
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
// `id` arrives here as `parent` (`appendVersionToQueryKey`), and on a branch a version
|
|
59
|
-
// row's `parent` is the shadow row while the caller means the canonical document. Same
|
|
60
|
-
// rewrite the history query does — without it, filtering a drafts read by document ID
|
|
61
|
-
// matched nothing on a branch while working on main, which is the admin panel's own
|
|
62
|
-
// read of a single draft.
|
|
63
|
-
const base = (()=>{
|
|
64
|
-
const rewritten = rewriteBranchVersionParents(where);
|
|
65
|
-
return rewritten && Object.keys(rewritten).length ? [
|
|
66
|
-
rewritten
|
|
67
|
-
] : [];
|
|
68
|
-
})();
|
|
69
|
-
const mainVersions = shadowedIDs.length ? {
|
|
70
|
-
and: [
|
|
71
|
-
{
|
|
72
|
-
[branchField]: {
|
|
73
|
-
equals: MAIN_BRANCH
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
parent: {
|
|
78
|
-
not_in: shadowedIDs
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
} : {
|
|
83
|
-
[branchField]: {
|
|
84
|
-
equals: MAIN_BRANCH
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
// A tombstone is a flag on the collection row, which version rows know nothing
|
|
88
|
-
// about — so a document deleted on this branch would keep its branch version
|
|
89
|
-
// chain and go on appearing in drafts reads, while every other read on the
|
|
90
|
-
// branch treats it as gone. `_branchParent` is a relationship field, so
|
|
91
|
-
// `not_in` is null-safe on relational adapters as well as Mongo.
|
|
92
|
-
const branchVersions = deletedIDs.length ? {
|
|
93
|
-
and: [
|
|
94
|
-
{
|
|
95
|
-
[branchField]: {
|
|
96
|
-
equals: branch
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
[branchParentField]: {
|
|
101
|
-
not_in: deletedIDs
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
} : {
|
|
106
|
-
[branchField]: {
|
|
107
|
-
equals: branch
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
return {
|
|
111
|
-
and: [
|
|
112
|
-
...base,
|
|
113
|
-
{
|
|
114
|
-
or: [
|
|
115
|
-
branchVersions,
|
|
116
|
-
mainVersions
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Branch predicate for version queries.
|
|
124
|
-
*
|
|
125
|
-
* Mirrors the collection predicate, but a version row's canonical identity is
|
|
126
|
-
* its `parent` on main and its `_branchParent` on a branch — so the exclusion of
|
|
127
|
-
* shadowed main versions compares `parent`, which for a main version row is
|
|
128
|
-
* already the canonical document ID.
|
|
129
|
-
*/ export const resolveBranchVersionQuery = async ({ branch: branchOverride, collectionSlug, req, where })=>{
|
|
130
|
-
if (bypassed(branchOverride, req)) {
|
|
131
|
-
return where;
|
|
132
|
-
}
|
|
133
|
-
const branching = req.payload.config?.branching;
|
|
134
|
-
if (!branching?.enabled || !branching.branchableCollections.has(collectionSlug)) {
|
|
135
|
-
return where;
|
|
136
|
-
}
|
|
137
|
-
const branch = typeof branchOverride === 'string' ? branchOverride : resolveBranch(req);
|
|
138
|
-
if (branch === MAIN_BRANCH) {
|
|
139
|
-
return buildBranchVersionQuery({
|
|
140
|
-
branch,
|
|
141
|
-
deletedIDs: [],
|
|
142
|
-
shadowedIDs: [],
|
|
143
|
-
where
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const manifest = await loadBranchManifest(req);
|
|
147
|
-
const shadowedIDs = manifest.get(collectionSlug) ?? [];
|
|
148
|
-
const deletedIDs = (await loadBranchDeletions(req)).get(collectionSlug) ?? [];
|
|
149
|
-
return buildBranchVersionQuery({
|
|
150
|
-
branch,
|
|
151
|
-
deletedIDs,
|
|
152
|
-
shadowedIDs,
|
|
153
|
-
where
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Synchronous branch predicate for version joins.
|
|
158
|
-
*
|
|
159
|
-
* Join query builders run after the top-level read has loaded and memoized the branch manifest.
|
|
160
|
-
* This uses that state while sharing the exact query construction with
|
|
161
|
-
* {@link resolveBranchVersionQuery}.
|
|
162
|
-
*/ export const resolveBranchVersionQuerySync = ({ branch: branchOverride, collectionSlug, req, where })=>{
|
|
163
|
-
if (bypassed(branchOverride, req)) {
|
|
164
|
-
return where;
|
|
165
|
-
}
|
|
166
|
-
const branching = req.payload.config?.branching;
|
|
167
|
-
if (!branching?.enabled || !branching.branchableCollections.has(collectionSlug)) {
|
|
168
|
-
return where;
|
|
169
|
-
}
|
|
170
|
-
const branch = typeof branchOverride === 'string' ? branchOverride : resolveBranch(req);
|
|
171
|
-
if (branch === MAIN_BRANCH) {
|
|
172
|
-
return buildBranchVersionQuery({
|
|
173
|
-
branch,
|
|
174
|
-
deletedIDs: [],
|
|
175
|
-
shadowedIDs: [],
|
|
176
|
-
where
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
const shadowedIDs = peekBranchManifest(req).get(collectionSlug) ?? [];
|
|
180
|
-
const deletedIDs = peekBranchDeletions(req).get(collectionSlug) ?? [];
|
|
181
|
-
return buildBranchVersionQuery({
|
|
182
|
-
branch,
|
|
183
|
-
deletedIDs,
|
|
184
|
-
shadowedIDs,
|
|
185
|
-
where
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Branch predicate for reading version *history*, as opposed to listing drafts.
|
|
190
|
-
*
|
|
191
|
-
* A branch's history reads as a continuation of main's: main's versions up to the
|
|
192
|
-
* point the branch forked are the branch's ancestry, the branch's own versions sit
|
|
193
|
-
* on top, and no other branch is visible. Anything main recorded after the fork
|
|
194
|
-
* belongs to main alone — it is not this branch's past.
|
|
195
|
-
*
|
|
196
|
-
* Deliberately *not* {@link resolveBranchVersionQuery}. That one hides main's
|
|
197
|
-
* versions for any shadowed document, which is right when listing one row per
|
|
198
|
-
* document and exactly wrong here: those hidden rows are the ancestry.
|
|
199
|
-
*/ export const resolveBranchVersionHistoryQuery = async ({ branch: branchOverride, collectionSlug, req, where })=>{
|
|
200
|
-
if (bypassed(branchOverride, req)) {
|
|
201
|
-
return where;
|
|
202
|
-
}
|
|
203
|
-
const branching = req.payload.config?.branching;
|
|
204
|
-
if (!branching?.enabled || !branching.branchableCollections.has(collectionSlug)) {
|
|
205
|
-
return where;
|
|
206
|
-
}
|
|
207
|
-
const branch = branchOverride ?? resolveBranch(req);
|
|
208
|
-
if (branch === MAIN_BRANCH) {
|
|
209
|
-
const base = where && Object.keys(where).length ? [
|
|
210
|
-
where
|
|
211
|
-
] : [];
|
|
212
|
-
return {
|
|
213
|
-
and: [
|
|
214
|
-
...base,
|
|
215
|
-
{
|
|
216
|
-
[branchField]: {
|
|
217
|
-
equals: MAIN_BRANCH
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
]
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
const rewritten = rewriteBranchVersionParents(where);
|
|
224
|
-
const base = rewritten && Object.keys(rewritten).length ? [
|
|
225
|
-
rewritten
|
|
226
|
-
] : [];
|
|
227
|
-
const requestedParentIDs = findVersionHistoryParentIDs({
|
|
228
|
-
where
|
|
229
|
-
});
|
|
230
|
-
const changeWhere = [
|
|
231
|
-
{
|
|
232
|
-
branch: {
|
|
233
|
-
equals: branch
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
collectionSlug: {
|
|
238
|
-
equals: collectionSlug
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
];
|
|
242
|
-
if (requestedParentIDs.length) {
|
|
243
|
-
changeWhere.push({
|
|
244
|
-
documentID: {
|
|
245
|
-
in: requestedParentIDs.map(String)
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
const changes = await req.payload.db.find({
|
|
250
|
-
branch: false,
|
|
251
|
-
collection: branchChangesCollectionSlug,
|
|
252
|
-
pagination: false,
|
|
253
|
-
req,
|
|
254
|
-
where: {
|
|
255
|
-
and: changeWhere
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
const branchChanges = changes.docs;
|
|
259
|
-
const changedDocumentIDs = branchChanges.flatMap((change)=>{
|
|
260
|
-
const documentID = extractRelationshipID({
|
|
261
|
-
relationship: change.doc
|
|
262
|
-
});
|
|
263
|
-
return documentID === undefined ? [] : [
|
|
264
|
-
documentID
|
|
265
|
-
];
|
|
266
|
-
});
|
|
267
|
-
const mainDocumentHistories = [];
|
|
268
|
-
if (changedDocumentIDs.length) {
|
|
269
|
-
mainDocumentHistories.push({
|
|
270
|
-
and: [
|
|
271
|
-
{
|
|
272
|
-
[branchField]: {
|
|
273
|
-
equals: MAIN_BRANCH
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
parent: {
|
|
278
|
-
not_in: changedDocumentIDs
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
});
|
|
283
|
-
} else {
|
|
284
|
-
mainDocumentHistories.push({
|
|
285
|
-
[branchField]: {
|
|
286
|
-
equals: MAIN_BRANCH
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
for (const change of branchChanges){
|
|
291
|
-
if (change.operation === 'create') {
|
|
292
|
-
continue;
|
|
293
|
-
}
|
|
294
|
-
const documentID = extractRelationshipID({
|
|
295
|
-
relationship: change.doc
|
|
296
|
-
});
|
|
297
|
-
if (documentID === undefined) {
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
const boundary = [];
|
|
301
|
-
if (change.baseVersionID) {
|
|
302
|
-
boundary.push({
|
|
303
|
-
id: {
|
|
304
|
-
equals: change.baseVersionID
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
if (change.baseVersionUpdatedAt) {
|
|
309
|
-
boundary.push({
|
|
310
|
-
updatedAt: {
|
|
311
|
-
less_than_equal: change.baseVersionUpdatedAt
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
mainDocumentHistories.push({
|
|
316
|
-
and: [
|
|
317
|
-
{
|
|
318
|
-
[branchField]: {
|
|
319
|
-
equals: MAIN_BRANCH
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
parent: {
|
|
324
|
-
equals: documentID
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
...boundary.length ? [
|
|
328
|
-
{
|
|
329
|
-
or: boundary
|
|
330
|
-
}
|
|
331
|
-
] : []
|
|
332
|
-
]
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
and: [
|
|
337
|
-
...base,
|
|
338
|
-
{
|
|
339
|
-
or: [
|
|
340
|
-
{
|
|
341
|
-
[branchField]: {
|
|
342
|
-
equals: branch
|
|
343
|
-
}
|
|
344
|
-
},
|
|
345
|
-
...mainDocumentHistories
|
|
346
|
-
]
|
|
347
|
-
}
|
|
348
|
-
]
|
|
349
|
-
};
|
|
350
|
-
};
|
|
351
|
-
const findVersionHistoryParentIDs = ({ where })=>{
|
|
352
|
-
if (!where || typeof where !== 'object') {
|
|
353
|
-
return [];
|
|
354
|
-
}
|
|
355
|
-
const parentIDs = [];
|
|
356
|
-
for (const [key, value] of Object.entries(where)){
|
|
357
|
-
if ((key === 'and' || key === 'or') && Array.isArray(value)) {
|
|
358
|
-
for (const clause of value){
|
|
359
|
-
parentIDs.push(...findVersionHistoryParentIDs({
|
|
360
|
-
where: clause
|
|
361
|
-
}));
|
|
362
|
-
}
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
|
-
if (key !== 'parent' || !value || typeof value !== 'object') {
|
|
366
|
-
continue;
|
|
367
|
-
}
|
|
368
|
-
const constraint = value;
|
|
369
|
-
const values = constraint.in ?? [
|
|
370
|
-
constraint.equals
|
|
371
|
-
];
|
|
372
|
-
for (const candidate of values){
|
|
373
|
-
const parentID = extractRelationshipID({
|
|
374
|
-
relationship: candidate
|
|
375
|
-
});
|
|
376
|
-
if (parentID !== undefined) {
|
|
377
|
-
parentIDs.push(parentID);
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
return [
|
|
382
|
-
...new Set(parentIDs)
|
|
383
|
-
];
|
|
384
|
-
};
|
|
385
|
-
/**
|
|
386
|
-
* Restores canonical document IDs on version rows read from a branch, whose
|
|
387
|
-
* `parent` is the shadow row rather than the document.
|
|
388
|
-
*/ export const projectBranchVersionParents = (docs)=>{
|
|
389
|
-
for (const doc of docs){
|
|
390
|
-
const canonical = doc?.[branchParentField];
|
|
391
|
-
if (canonical !== undefined && canonical !== null) {
|
|
392
|
-
doc.parent = extractRelationshipID({
|
|
393
|
-
relationship: canonical
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
/**
|
|
399
|
-
* Attaches a new version to the branch's own copy of the document.
|
|
400
|
-
*
|
|
401
|
-
* Without this a draft saved on a branch would append to main's version chain,
|
|
402
|
-
* which is both visible on main and destructive to its `latest` bookkeeping.
|
|
403
|
-
*/ export const resolveBranchVersionParent = async ({ branch: branchOverride, collectionSlug, parent, req, versionData })=>{
|
|
404
|
-
if (bypassed(branchOverride, req)) {
|
|
405
|
-
return {
|
|
406
|
-
parent,
|
|
407
|
-
versionData
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
const branching = req.payload.config?.branching;
|
|
411
|
-
if (!branching?.enabled || !branching.branchableCollections.has(collectionSlug)) {
|
|
412
|
-
return {
|
|
413
|
-
parent,
|
|
414
|
-
versionData
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
const branch = branchOverride ?? resolveBranch(req);
|
|
418
|
-
if (branch === MAIN_BRANCH) {
|
|
419
|
-
return {
|
|
420
|
-
parent,
|
|
421
|
-
versionData
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
const rowID = await resolveBranchRowID({
|
|
425
|
-
id: parent,
|
|
426
|
-
collectionSlug,
|
|
427
|
-
req
|
|
428
|
-
});
|
|
429
|
-
return {
|
|
430
|
-
parent: rowID,
|
|
431
|
-
versionData: {
|
|
432
|
-
...versionData,
|
|
433
|
-
[branchField]: branch,
|
|
434
|
-
[branchParentField]: parent
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
};
|
|
438
|
-
/**
|
|
439
|
-
* Restores canonical document IDs on rows returned by `queryDrafts`, which
|
|
440
|
-
* surfaces a version's `parent` as the document ID.
|
|
441
|
-
*/ export const projectBranchVersionParent = (row)=>row?.[branchParentField]?.value ?? row?.[branchParentField] ?? row?.parent;
|
|
442
|
-
/**
|
|
443
|
-
* The version rows this branch owns for one document.
|
|
444
|
-
*
|
|
445
|
-
* Every operation that reaches into an existing version chain needs this, not just
|
|
446
|
-
* deletes: a cascade after a delete, pruning to `maxPerDoc`, and rewriting the latest
|
|
447
|
-
* row on unpublish are all the same question — which rows belong to the branch doing
|
|
448
|
-
* the writing.
|
|
449
|
-
*
|
|
450
|
-
* Deleting a document cascades to its versions by `parent`. On a branch that is
|
|
451
|
-
* destructive: the delete becomes a tombstone rather than a real delete, but the
|
|
452
|
-
* cascade still names the canonical ID — which is main's `parent` — so main loses
|
|
453
|
-
* its version chain while its row survives. A published document then vanishes
|
|
454
|
-
* from main's own drafts list, and nothing about the branch says why.
|
|
455
|
-
*
|
|
456
|
-
* Adding `_branch` makes the cascade hit only the rows belonging to the branch in
|
|
457
|
-
* play. It also protects a branch's chain from a delete performed on main, whose
|
|
458
|
-
* versions share no `parent` with it but are cheap to exclude explicitly.
|
|
459
|
-
*/ export const resolveBranchOwnVersions = async ({ id, branch: branchOverride, collectionSlug, req })=>{
|
|
460
|
-
const unscoped = {
|
|
461
|
-
parent: {
|
|
462
|
-
equals: id
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
if (bypassed(branchOverride, req)) {
|
|
466
|
-
return unscoped;
|
|
467
|
-
}
|
|
468
|
-
const branching = req.payload.config?.branching;
|
|
469
|
-
if (!branching?.enabled || !branching.branchableCollections.has(collectionSlug)) {
|
|
470
|
-
return unscoped;
|
|
471
|
-
}
|
|
472
|
-
const branch = branchOverride ?? resolveBranch(req);
|
|
473
|
-
if (branch === MAIN_BRANCH) {
|
|
474
|
-
return {
|
|
475
|
-
and: [
|
|
476
|
-
unscoped,
|
|
477
|
-
{
|
|
478
|
-
[branchField]: {
|
|
479
|
-
equals: MAIN_BRANCH
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
]
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
// The branch's own versions hang off its shadow row, so the cascade has to
|
|
486
|
-
// address that row rather than the canonical ID. When the branch has no copy
|
|
487
|
-
// yet, `resolveBranchRowID` returns the canonical ID — and the `_branch`
|
|
488
|
-
// constraint is what then keeps the cascade off main's rows.
|
|
489
|
-
const rowID = await resolveBranchRowID({
|
|
490
|
-
id,
|
|
491
|
-
collectionSlug,
|
|
492
|
-
req
|
|
493
|
-
});
|
|
494
|
-
return {
|
|
495
|
-
and: [
|
|
496
|
-
{
|
|
497
|
-
parent: {
|
|
498
|
-
equals: rowID
|
|
499
|
-
}
|
|
500
|
-
},
|
|
501
|
-
{
|
|
502
|
-
[branchField]: {
|
|
503
|
-
equals: branch
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
]
|
|
507
|
-
};
|
|
508
|
-
};
|
|
509
|
-
/**
|
|
510
|
-
* Drops a branch's version chain for one document.
|
|
511
|
-
*
|
|
512
|
-
* Every way a branch stops owning a document ends here: merged, discarded, or
|
|
513
|
-
* promoted to main. A branch's versions hang off its *shadow row's* primary key
|
|
514
|
-
* rather than the canonical ID, so they do not travel with the document and are not
|
|
515
|
-
* cascaded by anything that addresses it — they have to be deleted deliberately.
|
|
516
|
-
*
|
|
517
|
-
* Leaving them behind is not inert. The drafts list reads through versions, so an
|
|
518
|
-
* orphaned branch chain keeps answering for a document the branch no longer has a
|
|
519
|
-
* row for: the branch lists the document twice, once from its stale chain and once
|
|
520
|
-
* from main's, as two identical rows.
|
|
521
|
-
*
|
|
522
|
-
* Scoped by `_branch` as well as `parent`: main's chain shares no parent with this
|
|
523
|
-
* one, but saying so costs nothing and a wrong delete here would strip production
|
|
524
|
-
* history. `_branchParent` is required for the same reason — only rows that were
|
|
525
|
-
* written as branch versions are in scope.
|
|
526
|
-
*/ export const deleteBranchVersionChain = async ({ branch, collectionSlug, payload, req, rowID })=>{
|
|
527
|
-
// Asking a collection without versions to delete versions throws, and a
|
|
528
|
-
// branchable collection need not be versioned.
|
|
529
|
-
if (!payload.collections[collectionSlug]?.config.versions) {
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
await payload.db.deleteVersions({
|
|
533
|
-
collection: collectionSlug,
|
|
534
|
-
req,
|
|
535
|
-
where: {
|
|
536
|
-
and: [
|
|
537
|
-
{
|
|
538
|
-
parent: {
|
|
539
|
-
equals: rowID
|
|
540
|
-
}
|
|
541
|
-
},
|
|
542
|
-
{
|
|
543
|
-
[branchField]: {
|
|
544
|
-
equals: branch
|
|
545
|
-
}
|
|
546
|
-
},
|
|
547
|
-
{
|
|
548
|
-
[branchParentField]: {
|
|
549
|
-
exists: true
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
]
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
};
|
|
556
|
-
/** Drops every version of one global owned by a branch that is being discarded or merged. */ export const deleteBranchGlobalVersionChain = async ({ branch, globalSlug, payload, req })=>{
|
|
557
|
-
const globalConfig = payload.globals.config.find(({ slug })=>slug === globalSlug);
|
|
558
|
-
if (!globalConfig?.versions) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
await payload.db.deleteVersions({
|
|
562
|
-
globalSlug,
|
|
563
|
-
req,
|
|
564
|
-
where: {
|
|
565
|
-
[branchField]: {
|
|
566
|
-
equals: branch
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
//# sourceMappingURL=versions.js.map
|