payload 3.84.1 → 4.0.0-internal.d28e9fb
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/README.md +5 -5
- package/dist/admin/elements/Nav.d.ts +13 -0
- package/dist/admin/elements/Nav.d.ts.map +1 -1
- package/dist/admin/elements/Nav.js.map +1 -1
- package/dist/admin/functions/index.d.ts +1 -38
- package/dist/admin/functions/index.d.ts.map +1 -1
- package/dist/admin/functions/index.js.map +1 -1
- package/dist/admin/types.d.ts +5 -4
- package/dist/admin/types.d.ts.map +1 -1
- package/dist/admin/types.js.map +1 -1
- package/dist/admin/views/hierarchyList.d.ts +9 -0
- package/dist/admin/views/hierarchyList.d.ts.map +1 -0
- package/dist/admin/views/hierarchyList.js +3 -0
- package/dist/admin/views/hierarchyList.js.map +1 -0
- package/dist/admin/views/index.d.ts +1 -3
- package/dist/admin/views/index.d.ts.map +1 -1
- package/dist/admin/views/index.js.map +1 -1
- package/dist/admin/views/list.d.ts +43 -2
- package/dist/admin/views/list.d.ts.map +1 -1
- package/dist/admin/views/list.js.map +1 -1
- package/dist/bin/generateImportMap/iterateCollections.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateCollections.js +1 -0
- package/dist/bin/generateImportMap/iterateCollections.js.map +1 -1
- package/dist/bin/generateImportMap/iterateConfig.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateConfig.js +7 -0
- package/dist/bin/generateImportMap/iterateConfig.js.map +1 -1
- package/dist/bin/generateImportMap/iterateGlobals.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateGlobals.js +20 -8
- package/dist/bin/generateImportMap/iterateGlobals.js.map +1 -1
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +1 -3
- package/dist/bin/index.js.map +1 -1
- package/dist/collections/config/client.d.ts +4 -2
- package/dist/collections/config/client.d.ts.map +1 -1
- package/dist/collections/config/client.js +13 -1
- package/dist/collections/config/client.js.map +1 -1
- package/dist/collections/config/defaults.js +1 -1
- 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 +231 -184
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/types.d.ts +76 -91
- package/dist/collections/config/types.d.ts.map +1 -1
- package/dist/collections/config/types.js.map +1 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +24 -19
- 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 +7 -2
- 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 +7 -2
- package/dist/collections/operations/deleteByID.js.map +1 -1
- package/dist/collections/operations/find.d.ts.map +1 -1
- package/dist/collections/operations/find.js +7 -2
- package/dist/collections/operations/find.js.map +1 -1
- package/dist/collections/operations/findByID.d.ts.map +1 -1
- package/dist/collections/operations/findByID.js +10 -5
- package/dist/collections/operations/findByID.js.map +1 -1
- package/dist/collections/operations/findVersionByID.d.ts.map +1 -1
- package/dist/collections/operations/findVersionByID.js +6 -4
- 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 +6 -4
- package/dist/collections/operations/findVersions.js.map +1 -1
- package/dist/collections/operations/restoreVersion.d.ts.map +1 -1
- package/dist/collections/operations/restoreVersion.js +7 -2
- 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 +7 -2
- package/dist/collections/operations/update.js.map +1 -1
- package/dist/collections/operations/updateByID.d.ts.map +1 -1
- package/dist/collections/operations/updateByID.js +7 -2
- package/dist/collections/operations/updateByID.js.map +1 -1
- package/dist/collections/operations/utilities/update.d.ts.map +1 -1
- package/dist/collections/operations/utilities/update.js +5 -4
- package/dist/collections/operations/utilities/update.js.map +1 -1
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +0 -10
- package/dist/config/client.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +0 -15
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/orderable/index.d.ts.map +1 -1
- package/dist/config/orderable/index.js +0 -4
- package/dist/config/orderable/index.js.map +1 -1
- package/dist/config/sanitize.d.ts.map +1 -1
- package/dist/config/sanitize.js +252 -266
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +120 -13
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/exports/internal.d.ts +1 -0
- package/dist/exports/internal.d.ts.map +1 -1
- package/dist/exports/internal.js +1 -0
- package/dist/exports/internal.js.map +1 -1
- package/dist/exports/shared.d.ts +5 -3
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +3 -2
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/slug/index.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/index.js +6 -4
- package/dist/fields/baseFields/slug/index.js.map +1 -1
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js +3 -2
- package/dist/fields/config/client.js.map +1 -1
- package/dist/fields/config/sanitize.d.ts.map +1 -1
- package/dist/fields/config/sanitize.js +335 -322
- package/dist/fields/config/sanitize.js.map +1 -1
- package/dist/fields/config/sanitizeJoinField.d.ts.map +1 -1
- package/dist/fields/config/sanitizeJoinField.js +3 -0
- package/dist/fields/config/sanitizeJoinField.js.map +1 -1
- package/dist/fields/config/types.d.ts +17 -73
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js +11 -1
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/isFieldDisabled.d.ts +12 -0
- package/dist/fields/isFieldDisabled.d.ts.map +1 -0
- package/dist/fields/isFieldDisabled.js +15 -0
- package/dist/fields/isFieldDisabled.js.map +1 -0
- package/dist/fields/isFieldDisabled.spec.js +134 -0
- package/dist/fields/isFieldDisabled.spec.js.map +1 -0
- package/dist/fields/validations.js +1 -1
- package/dist/fields/validations.js.map +1 -1
- package/dist/globals/config/client.d.ts +1 -1
- package/dist/globals/config/client.d.ts.map +1 -1
- package/dist/globals/config/client.js +2 -1
- package/dist/globals/config/client.js.map +1 -1
- package/dist/globals/config/sanitize.d.ts.map +1 -1
- package/dist/globals/config/sanitize.js +132 -122
- package/dist/globals/config/sanitize.js.map +1 -1
- package/dist/globals/config/types.d.ts +4 -57
- package/dist/globals/config/types.d.ts.map +1 -1
- package/dist/globals/config/types.js.map +1 -1
- package/dist/globals/operations/findOne.d.ts.map +1 -1
- package/dist/globals/operations/findOne.js +7 -2
- 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 -4
- 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 +6 -4
- package/dist/globals/operations/findVersions.js.map +1 -1
- package/dist/globals/operations/update.d.ts.map +1 -1
- package/dist/globals/operations/update.js +7 -2
- package/dist/globals/operations/update.js.map +1 -1
- package/dist/hierarchy/addHierarchyToCollection.d.ts +9 -0
- package/dist/hierarchy/addHierarchyToCollection.d.ts.map +1 -0
- package/dist/hierarchy/addHierarchyToCollection.js +76 -0
- package/dist/hierarchy/addHierarchyToCollection.js.map +1 -0
- package/dist/hierarchy/buildParentField.d.ts +11 -0
- package/dist/hierarchy/buildParentField.d.ts.map +1 -0
- package/dist/hierarchy/buildParentField.js +42 -0
- package/dist/hierarchy/buildParentField.js.map +1 -0
- package/dist/hierarchy/constants.d.ts +15 -0
- package/dist/hierarchy/constants.d.ts.map +1 -0
- package/dist/hierarchy/constants.js +11 -0
- package/dist/hierarchy/constants.js.map +1 -0
- package/dist/hierarchy/createFolderField.d.ts +39 -0
- package/dist/hierarchy/createFolderField.d.ts.map +1 -0
- package/dist/hierarchy/createFolderField.js +54 -0
- package/dist/hierarchy/createFolderField.js.map +1 -0
- package/dist/hierarchy/createTagField.d.ts +44 -0
- package/dist/hierarchy/createTagField.d.ts.map +1 -0
- package/dist/hierarchy/createTagField.js +48 -0
- package/dist/hierarchy/createTagField.js.map +1 -0
- package/dist/hierarchy/getInitialTreeData.d.ts +27 -0
- package/dist/hierarchy/getInitialTreeData.d.ts.map +1 -0
- package/dist/hierarchy/getInitialTreeData.js +125 -0
- package/dist/hierarchy/getInitialTreeData.js.map +1 -0
- package/dist/hierarchy/hooks/collectionAfterDelete.d.ts +14 -0
- package/dist/hierarchy/hooks/collectionAfterDelete.d.ts.map +1 -0
- package/dist/hierarchy/hooks/collectionAfterDelete.js +21 -0
- package/dist/hierarchy/hooks/collectionAfterDelete.js.map +1 -0
- package/dist/hierarchy/hooks/collectionAfterRead.d.ts +27 -0
- package/dist/hierarchy/hooks/collectionAfterRead.d.ts.map +1 -0
- package/dist/hierarchy/hooks/collectionAfterRead.js +72 -0
- package/dist/hierarchy/hooks/collectionAfterRead.js.map +1 -0
- package/dist/hierarchy/hooks/collectionBeforeChange.d.ts +19 -0
- package/dist/hierarchy/hooks/collectionBeforeChange.d.ts.map +1 -0
- package/dist/hierarchy/hooks/collectionBeforeChange.js +90 -0
- package/dist/hierarchy/hooks/collectionBeforeChange.js.map +1 -0
- package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts +15 -0
- package/dist/hierarchy/hooks/collectionBeforeDelete.d.ts.map +1 -0
- package/dist/hierarchy/hooks/collectionBeforeDelete.js +20 -0
- package/dist/hierarchy/hooks/collectionBeforeDelete.js.map +1 -0
- package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts +33 -0
- package/dist/hierarchy/hooks/collectionBeforeOperation.d.ts.map +1 -0
- package/dist/hierarchy/hooks/collectionBeforeOperation.js +66 -0
- package/dist/hierarchy/hooks/collectionBeforeOperation.js.map +1 -0
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts +8 -0
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.d.ts.map +1 -0
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js +108 -0
- package/dist/hierarchy/hooks/ensureSafeCollectionsChange.js.map +1 -0
- package/dist/hierarchy/injectHierarchyButton.d.ts +14 -0
- package/dist/hierarchy/injectHierarchyButton.d.ts.map +1 -0
- package/dist/hierarchy/injectHierarchyButton.js +37 -0
- package/dist/hierarchy/injectHierarchyButton.js.map +1 -0
- package/dist/hierarchy/presets.d.ts +13 -0
- package/dist/hierarchy/presets.d.ts.map +1 -0
- package/dist/hierarchy/presets.js +52 -0
- package/dist/hierarchy/presets.js.map +1 -0
- package/dist/hierarchy/resolveHierarchyCollections.d.ts +23 -0
- package/dist/hierarchy/resolveHierarchyCollections.d.ts.map +1 -0
- package/dist/hierarchy/resolveHierarchyCollections.js +321 -0
- package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -0
- package/dist/hierarchy/sanitizeHierarchyCollection.d.ts +14 -0
- package/dist/hierarchy/sanitizeHierarchyCollection.d.ts.map +1 -0
- package/dist/hierarchy/sanitizeHierarchyCollection.js +117 -0
- package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -0
- package/dist/hierarchy/types.d.ts +155 -0
- package/dist/hierarchy/types.d.ts.map +1 -0
- package/dist/hierarchy/types.js +6 -0
- package/dist/hierarchy/types.js.map +1 -0
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts +77 -0
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.d.ts.map +1 -0
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js +77 -0
- package/dist/hierarchy/utils/buildLocalizedHierarchyPaths.js.map +1 -0
- package/dist/hierarchy/utils/computePaths.d.ts +31 -0
- package/dist/hierarchy/utils/computePaths.d.ts.map +1 -0
- package/dist/hierarchy/utils/computePaths.js +445 -0
- package/dist/hierarchy/utils/computePaths.js.map +1 -0
- package/dist/hierarchy/utils/findUseAsTitle.d.ts +14 -0
- package/dist/hierarchy/utils/findUseAsTitle.d.ts.map +1 -0
- package/dist/hierarchy/utils/findUseAsTitle.js +89 -0
- package/dist/hierarchy/utils/findUseAsTitle.js.map +1 -0
- package/dist/hierarchy/utils/getAncestors.d.ts +34 -0
- package/dist/hierarchy/utils/getAncestors.d.ts.map +1 -0
- package/dist/hierarchy/utils/getAncestors.js +94 -0
- package/dist/hierarchy/utils/getAncestors.js.map +1 -0
- package/dist/hierarchy/utils/getLocalizedValue.d.ts +30 -0
- package/dist/hierarchy/utils/getLocalizedValue.d.ts.map +1 -0
- package/dist/hierarchy/utils/getLocalizedValue.js +46 -0
- package/dist/hierarchy/utils/getLocalizedValue.js.map +1 -0
- package/dist/hierarchy/utils/getLocalizedValue.spec.js +250 -0
- package/dist/hierarchy/utils/getLocalizedValue.spec.js.map +1 -0
- package/dist/index.bundled.d.ts +709 -530
- package/dist/index.d.ts +28 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -8
- package/dist/index.js.map +1 -1
- package/dist/preferences/keys.d.ts +8 -4
- package/dist/preferences/keys.d.ts.map +1 -1
- package/dist/preferences/keys.js +7 -4
- package/dist/preferences/keys.js.map +1 -1
- package/dist/preferences/types.d.ts +1 -1
- package/dist/preferences/types.d.ts.map +1 -1
- package/dist/preferences/types.js.map +1 -1
- package/dist/query-presets/config.d.ts.map +1 -1
- package/dist/query-presets/config.js +5 -1
- package/dist/query-presets/config.js.map +1 -1
- package/dist/queues/config/types/index.d.ts +0 -21
- package/dist/queues/config/types/index.d.ts.map +1 -1
- package/dist/queues/config/types/index.js.map +1 -1
- package/dist/queues/config/types/taskTypes.d.ts +0 -20
- package/dist/queues/config/types/taskTypes.d.ts.map +1 -1
- package/dist/queues/config/types/taskTypes.js.map +1 -1
- package/dist/queues/errors/handleWorkflowError.d.ts.map +1 -1
- package/dist/queues/errors/handleWorkflowError.js +9 -1
- package/dist/queues/errors/handleWorkflowError.js.map +1 -1
- package/dist/queues/localAPI.d.ts.map +1 -1
- package/dist/queues/localAPI.js +26 -67
- package/dist/queues/localAPI.js.map +1 -1
- package/dist/queues/operations/handleSchedules/index.d.ts.map +1 -1
- package/dist/queues/operations/handleSchedules/index.js +1 -4
- package/dist/queues/operations/handleSchedules/index.js.map +1 -1
- package/dist/queues/operations/runJobs/index.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/index.js +40 -37
- package/dist/queues/operations/runJobs/index.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +3 -22
- package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.d.ts.map +1 -1
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js +0 -2
- package/dist/queues/operations/runJobs/runJob/getUpdateJobFunction.js.map +1 -1
- package/dist/queues/utilities/updateJob.d.ts +1 -3
- package/dist/queues/utilities/updateJob.d.ts.map +1 -1
- package/dist/queues/utilities/updateJob.js +2 -18
- package/dist/queues/utilities/updateJob.js.map +1 -1
- package/dist/types/index.d.ts +44 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getBaseFields.js +35 -69
- package/dist/uploads/getBaseFields.js.map +1 -1
- package/dist/uploads/getSafeFilename.d.ts +9 -4
- package/dist/uploads/getSafeFilename.d.ts.map +1 -1
- package/dist/uploads/getSafeFilename.js +5 -5
- package/dist/uploads/getSafeFilename.js.map +1 -1
- package/dist/utilities/appendDateTimezoneSelectFields.d.ts +13 -0
- package/dist/utilities/appendDateTimezoneSelectFields.d.ts.map +1 -0
- package/dist/utilities/appendDateTimezoneSelectFields.js +47 -0
- package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -0
- package/dist/utilities/appendUploadSelectFields.d.ts.map +1 -1
- package/dist/utilities/appendUploadSelectFields.js +3 -0
- package/dist/utilities/appendUploadSelectFields.js.map +1 -1
- package/dist/utilities/extractID.js +1 -1
- package/dist/utilities/extractID.js.map +1 -1
- package/dist/utilities/flattenAllFields.d.ts.map +1 -1
- package/dist/utilities/flattenAllFields.js +102 -93
- package/dist/utilities/flattenAllFields.js.map +1 -1
- package/dist/utilities/formatAdminURL.d.ts +13 -2
- package/dist/utilities/formatAdminURL.d.ts.map +1 -1
- package/dist/utilities/formatAdminURL.js.map +1 -1
- package/dist/utilities/handleEndpoints.d.ts.map +1 -1
- package/dist/utilities/handleEndpoints.js +0 -1
- package/dist/utilities/handleEndpoints.js.map +1 -1
- package/dist/utilities/resolveSelect.d.ts +16 -0
- package/dist/utilities/resolveSelect.d.ts.map +1 -0
- package/dist/utilities/resolveSelect.js +19 -0
- package/dist/utilities/resolveSelect.js.map +1 -0
- package/dist/utilities/sanitizeProfiler.d.ts +38 -0
- package/dist/utilities/sanitizeProfiler.d.ts.map +1 -0
- package/dist/utilities/sanitizeProfiler.js +101 -0
- package/dist/utilities/sanitizeProfiler.js.map +1 -0
- package/dist/utilities/sanitizeSelect.d.ts +1 -2
- package/dist/utilities/sanitizeSelect.d.ts.map +1 -1
- package/dist/utilities/sanitizeSelect.js +19 -25
- package/dist/utilities/sanitizeSelect.js.map +1 -1
- package/dist/versions/baseFields.d.ts.map +1 -1
- package/dist/versions/baseFields.js +3 -2
- package/dist/versions/baseFields.js.map +1 -1
- package/dist/versions/buildCollectionFields.d.ts.map +1 -1
- package/dist/versions/buildCollectionFields.js +0 -1
- package/dist/versions/buildCollectionFields.js.map +1 -1
- package/dist/versions/buildGlobalFields.d.ts.map +1 -1
- package/dist/versions/buildGlobalFields.js +0 -1
- package/dist/versions/buildGlobalFields.js.map +1 -1
- package/dist/versions/payloadPackageList.d.ts.map +1 -1
- package/dist/versions/payloadPackageList.js +0 -1
- package/dist/versions/payloadPackageList.js.map +1 -1
- package/package.json +4 -4
- package/dist/admin/views/folderList.d.ts +0 -56
- package/dist/admin/views/folderList.d.ts.map +0 -1
- package/dist/admin/views/folderList.js +0 -3
- package/dist/admin/views/folderList.js.map +0 -1
- package/dist/folders/addFolderCollection.d.ts +0 -10
- package/dist/folders/addFolderCollection.d.ts.map +0 -1
- package/dist/folders/addFolderCollection.js +0 -26
- package/dist/folders/addFolderCollection.js.map +0 -1
- package/dist/folders/addFolderFieldToCollection.d.ts +0 -8
- package/dist/folders/addFolderFieldToCollection.d.ts.map +0 -1
- package/dist/folders/addFolderFieldToCollection.js +0 -20
- package/dist/folders/addFolderFieldToCollection.js.map +0 -1
- package/dist/folders/buildFolderField.d.ts +0 -8
- package/dist/folders/buildFolderField.d.ts.map +0 -1
- package/dist/folders/buildFolderField.js +0 -87
- package/dist/folders/buildFolderField.js.map +0 -1
- package/dist/folders/constants.d.ts +0 -3
- package/dist/folders/constants.d.ts.map +0 -1
- package/dist/folders/constants.js +0 -4
- package/dist/folders/constants.js.map +0 -1
- package/dist/folders/createFolderCollection.d.ts +0 -11
- package/dist/folders/createFolderCollection.d.ts.map +0 -1
- package/dist/folders/createFolderCollection.js +0 -115
- package/dist/folders/createFolderCollection.js.map +0 -1
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts +0 -8
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.d.ts.map +0 -1
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.js +0 -15
- package/dist/folders/hooks/deleteSubfoldersAfterDelete.js.map +0 -1
- package/dist/folders/hooks/dissasociateAfterDelete.d.ts +0 -8
- package/dist/folders/hooks/dissasociateAfterDelete.d.ts.map +0 -1
- package/dist/folders/hooks/dissasociateAfterDelete.js +0 -20
- package/dist/folders/hooks/dissasociateAfterDelete.js.map +0 -1
- package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts +0 -5
- package/dist/folders/hooks/ensureSafeCollectionsChange.d.ts.map +0 -1
- package/dist/folders/hooks/ensureSafeCollectionsChange.js +0 -107
- package/dist/folders/hooks/ensureSafeCollectionsChange.js.map +0 -1
- package/dist/folders/hooks/reparentChildFolder.d.ts +0 -24
- package/dist/folders/hooks/reparentChildFolder.d.ts.map +0 -1
- package/dist/folders/hooks/reparentChildFolder.js +0 -72
- package/dist/folders/hooks/reparentChildFolder.js.map +0 -1
- package/dist/folders/types.d.ts +0 -118
- package/dist/folders/types.d.ts.map +0 -1
- package/dist/folders/types.js +0 -3
- package/dist/folders/types.js.map +0 -1
- package/dist/folders/utils/buildFolderWhereConstraints.d.ts +0 -13
- package/dist/folders/utils/buildFolderWhereConstraints.d.ts.map +0 -1
- package/dist/folders/utils/buildFolderWhereConstraints.js +0 -45
- package/dist/folders/utils/buildFolderWhereConstraints.js.map +0 -1
- package/dist/folders/utils/formatFolderOrDocumentItem.d.ts +0 -12
- package/dist/folders/utils/formatFolderOrDocumentItem.d.ts.map +0 -1
- package/dist/folders/utils/formatFolderOrDocumentItem.js +0 -30
- package/dist/folders/utils/formatFolderOrDocumentItem.js.map +0 -1
- package/dist/folders/utils/getFolderBreadcrumbs.d.ts +0 -14
- package/dist/folders/utils/getFolderBreadcrumbs.d.ts.map +0 -1
- package/dist/folders/utils/getFolderBreadcrumbs.js +0 -45
- package/dist/folders/utils/getFolderBreadcrumbs.js.map +0 -1
- package/dist/folders/utils/getFolderData.d.ts +0 -33
- package/dist/folders/utils/getFolderData.d.ts.map +0 -1
- package/dist/folders/utils/getFolderData.js +0 -88
- package/dist/folders/utils/getFolderData.js.map +0 -1
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts +0 -24
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.d.ts.map +0 -1
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js +0 -66
- package/dist/folders/utils/getFoldersAndDocumentsFromJoin.js.map +0 -1
- package/dist/folders/utils/getOrphanedDocs.d.ts +0 -15
- package/dist/folders/utils/getOrphanedDocs.d.ts.map +0 -1
- package/dist/folders/utils/getOrphanedDocs.js +0 -40
- package/dist/folders/utils/getOrphanedDocs.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/query-presets/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAShD,eAAO,MAAM,0BAA0B,0BAA0B,CAAA;AAEjE,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/query-presets/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAShD,eAAO,MAAM,0BAA0B,0BAA0B,CAAA;AAEjE,eAAO,MAAM,qBAAqB,WAAY,MAAM,KAAG,gBA6KrD,CAAA"}
|
|
@@ -164,7 +164,11 @@ export const getQueryPresetsConfig = (config)=>({
|
|
|
164
164
|
singular: 'Preset',
|
|
165
165
|
...config.queryPresets?.labels || {}
|
|
166
166
|
},
|
|
167
|
-
lockDocuments: false
|
|
167
|
+
lockDocuments: false,
|
|
168
|
+
select: ({ select })=>select ? {
|
|
169
|
+
...select,
|
|
170
|
+
relatedCollection: true
|
|
171
|
+
} : undefined
|
|
168
172
|
});
|
|
169
173
|
|
|
170
174
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/query-presets/config.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Config } from '../config/types.js'\nimport type { Option } from '../fields/config/types.js'\n\nimport { transformWhereQuery } from '../utilities/transformWhereQuery.js'\nimport { validateWhereQuery } from '../utilities/validateWhereQuery.js'\nimport { getAccess } from './access.js'\nimport { getConstraints } from './constraints.js'\nimport { operations, type QueryPreset } from './types.js'\n\nexport const queryPresetsCollectionSlug = 'payload-query-presets'\n\nexport const getQueryPresetsConfig = (config: Config): CollectionConfig => ({\n slug: queryPresetsCollectionSlug,\n access: getAccess(config),\n admin: {\n defaultColumns: ['title', 'isShared', 'access', 'where', 'columns', 'groupBy'],\n hidden: true,\n useAsTitle: 'title',\n },\n fields: [\n {\n name: 'title',\n type: 'text',\n required: true,\n },\n {\n name: 'isShared',\n type: 'checkbox',\n defaultValue: false,\n validate: (isShared, { data }) => {\n const typedData = data as QueryPreset\n\n // ensure the `isShared` is only true if all constraints are 'onlyMe'\n if (typedData?.access) {\n const someOperationsAreShared = Object.values(typedData.access).some(\n (operation) => operation.constraint !== 'onlyMe',\n )\n\n if (!isShared && someOperationsAreShared) {\n return 'If any constraint is not \"onlyMe\", the preset must be shared'\n }\n }\n\n return true\n },\n },\n getConstraints(config),\n {\n name: 'where',\n type: 'json',\n admin: {\n components: {\n Cell: '@payloadcms/next/client#QueryPresetsWhereCell',\n Field: '@payloadcms/next/client#QueryPresetsWhereField',\n },\n },\n hooks: {\n beforeValidate: [\n ({ data }) => {\n // transform the \"where\" query here so that the client-side doesn't have to\n if (data?.where) {\n if (validateWhereQuery(data.where)) {\n return data.where\n } else {\n return transformWhereQuery(data.where)\n }\n }\n\n return data?.where\n },\n ],\n },\n label: 'Filters',\n },\n {\n name: 'columns',\n type: 'json',\n admin: {\n components: {\n Cell: '@payloadcms/next/client#QueryPresetsColumnsCell',\n Field: '@payloadcms/next/client#QueryPresetsColumnField',\n },\n },\n validate: (value) => {\n if (value) {\n try {\n JSON.parse(JSON.stringify(value))\n } catch {\n return 'Invalid JSON'\n }\n }\n\n return true\n },\n },\n {\n name: 'groupBy',\n type: 'text',\n admin: {\n components: {\n Cell: '@payloadcms/next/client#QueryPresetsGroupByCell',\n Field: '@payloadcms/next/client#QueryPresetsGroupByField',\n },\n },\n label: 'Group By',\n },\n {\n name: 'relatedCollection',\n type: 'select',\n admin: {\n hidden: true,\n },\n options: config.collections\n ? config.collections.reduce((acc, collection) => {\n if (collection.enableQueryPresets) {\n acc.push({\n label: collection.labels?.plural || collection.slug,\n value: collection.slug,\n })\n }\n return acc\n }, [] as Option[])\n : [],\n required: true,\n },\n {\n name: 'isTemp',\n type: 'checkbox',\n admin: {\n description:\n \"This is a temporary field used to determine if updating the preset would remove the user's access to it. When `true`, this record will be deleted after running the preset's `validate` function.\",\n disabled: true,\n hidden: true,\n },\n },\n ],\n hooks: {\n beforeValidate: [\n ({ data, operation }) => {\n // TODO: type this\n const typedData = data as any\n\n if (operation === 'create' || operation === 'update') {\n // Ensure all operations have a constraint\n operations.forEach((operation) => {\n if (!typedData.access) {\n typedData.access = {}\n }\n\n if (!typedData.access?.[operation]) {\n typedData[operation] = {}\n }\n\n // Ensure all operations have a constraint\n if (!typedData.access[operation]?.constraint) {\n typedData.access[operation] = {\n ...typedData.access[operation],\n constraint: 'onlyMe',\n }\n }\n })\n\n // If at least one constraint is not `onlyMe` then `isShared` must be true\n if (typedData?.access) {\n const someOperationsAreShared = Object.values(typedData.access).some(\n // TODO: remove the `any` here\n (operation: any) => operation.constraint !== 'onlyMe',\n )\n\n typedData.isShared = someOperationsAreShared\n }\n }\n\n return typedData\n },\n ],\n },\n labels: {\n plural: 'Presets',\n singular: 'Preset',\n ...(config.queryPresets?.labels || {}),\n },\n lockDocuments: false,\n})\n"],"names":["transformWhereQuery","validateWhereQuery","getAccess","getConstraints","operations","queryPresetsCollectionSlug","getQueryPresetsConfig","config","slug","access","admin","defaultColumns","hidden","useAsTitle","fields","name","type","required","defaultValue","validate","isShared","data","typedData","someOperationsAreShared","Object","values","some","operation","constraint","components","Cell","Field","hooks","beforeValidate","where","label","value","JSON","parse","stringify","options","collections","reduce","acc","collection","enableQueryPresets","push","labels","plural","description","disabled","forEach","singular","queryPresets","lockDocuments"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,SAAS,QAAQ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C5CN,UAAUb,MAAM,CAACkB,UAAU,GAAG;oCAC5B,GAAGL,UAAUb,MAAM,CAACkB,UAAU;oCAC9BC,YAAY;gCACd;4BACF;wBACF;wBAEA,0EAA0E;wBAC1E,IAAIN,WAAWb,QAAQ;4BACrB,MAAMc,0BAA0BC,OAAOC,MAAM,CAACH,UAAUb,MAAM,EAAEiB,IAAI,CAClE,8BAA8B;4BAC9B,CAACC,YAAmBA,UAAUC,UAAU,KAAK;4BAG/CN,UAAUF,QAAQ,GAAGG;wBACvB;oBACF;oBAEA,OAAOD;gBACT;aACD;QACH;QACAyB,QAAQ;YACNC,QAAQ;YACRI,UAAU;YACV,GAAI7C,OAAO8C,YAAY,EAAEN,UAAU,CAAC,CAAC;QACvC;QACAO,eAAe;
|
|
1
|
+
{"version":3,"sources":["../../src/query-presets/config.ts"],"sourcesContent":["import type { CollectionConfig } from '../collections/config/types.js'\nimport type { Config } from '../config/types.js'\nimport type { Option } from '../fields/config/types.js'\n\nimport { transformWhereQuery } from '../utilities/transformWhereQuery.js'\nimport { validateWhereQuery } from '../utilities/validateWhereQuery.js'\nimport { getAccess } from './access.js'\nimport { getConstraints } from './constraints.js'\nimport { operations, type QueryPreset } from './types.js'\n\nexport const queryPresetsCollectionSlug = 'payload-query-presets'\n\nexport const getQueryPresetsConfig = (config: Config): CollectionConfig => ({\n slug: queryPresetsCollectionSlug,\n access: getAccess(config),\n admin: {\n defaultColumns: ['title', 'isShared', 'access', 'where', 'columns', 'groupBy'],\n hidden: true,\n useAsTitle: 'title',\n },\n fields: [\n {\n name: 'title',\n type: 'text',\n required: true,\n },\n {\n name: 'isShared',\n type: 'checkbox',\n defaultValue: false,\n validate: (isShared, { data }) => {\n const typedData = data as QueryPreset\n\n // ensure the `isShared` is only true if all constraints are 'onlyMe'\n if (typedData?.access) {\n const someOperationsAreShared = Object.values(typedData.access).some(\n (operation) => operation.constraint !== 'onlyMe',\n )\n\n if (!isShared && someOperationsAreShared) {\n return 'If any constraint is not \"onlyMe\", the preset must be shared'\n }\n }\n\n return true\n },\n },\n getConstraints(config),\n {\n name: 'where',\n type: 'json',\n admin: {\n components: {\n Cell: '@payloadcms/next/client#QueryPresetsWhereCell',\n Field: '@payloadcms/next/client#QueryPresetsWhereField',\n },\n },\n hooks: {\n beforeValidate: [\n ({ data }) => {\n // transform the \"where\" query here so that the client-side doesn't have to\n if (data?.where) {\n if (validateWhereQuery(data.where)) {\n return data.where\n } else {\n return transformWhereQuery(data.where)\n }\n }\n\n return data?.where\n },\n ],\n },\n label: 'Filters',\n },\n {\n name: 'columns',\n type: 'json',\n admin: {\n components: {\n Cell: '@payloadcms/next/client#QueryPresetsColumnsCell',\n Field: '@payloadcms/next/client#QueryPresetsColumnField',\n },\n },\n validate: (value) => {\n if (value) {\n try {\n JSON.parse(JSON.stringify(value))\n } catch {\n return 'Invalid JSON'\n }\n }\n\n return true\n },\n },\n {\n name: 'groupBy',\n type: 'text',\n admin: {\n components: {\n Cell: '@payloadcms/next/client#QueryPresetsGroupByCell',\n Field: '@payloadcms/next/client#QueryPresetsGroupByField',\n },\n },\n label: 'Group By',\n },\n {\n name: 'relatedCollection',\n type: 'select',\n admin: {\n hidden: true,\n },\n options: config.collections\n ? config.collections.reduce((acc, collection) => {\n if (collection.enableQueryPresets) {\n acc.push({\n label: collection.labels?.plural || collection.slug,\n value: collection.slug,\n })\n }\n return acc\n }, [] as Option[])\n : [],\n required: true,\n },\n {\n name: 'isTemp',\n type: 'checkbox',\n admin: {\n description:\n \"This is a temporary field used to determine if updating the preset would remove the user's access to it. When `true`, this record will be deleted after running the preset's `validate` function.\",\n disabled: true,\n hidden: true,\n },\n },\n ],\n hooks: {\n beforeValidate: [\n ({ data, operation }) => {\n // TODO: type this\n const typedData = data as any\n\n if (operation === 'create' || operation === 'update') {\n // Ensure all operations have a constraint\n operations.forEach((operation) => {\n if (!typedData.access) {\n typedData.access = {}\n }\n\n if (!typedData.access?.[operation]) {\n typedData[operation] = {}\n }\n\n // Ensure all operations have a constraint\n if (!typedData.access[operation]?.constraint) {\n typedData.access[operation] = {\n ...typedData.access[operation],\n constraint: 'onlyMe',\n }\n }\n })\n\n // If at least one constraint is not `onlyMe` then `isShared` must be true\n if (typedData?.access) {\n const someOperationsAreShared = Object.values(typedData.access).some(\n // TODO: remove the `any` here\n (operation: any) => operation.constraint !== 'onlyMe',\n )\n\n typedData.isShared = someOperationsAreShared\n }\n }\n\n return typedData\n },\n ],\n },\n labels: {\n plural: 'Presets',\n singular: 'Preset',\n ...(config.queryPresets?.labels || {}),\n },\n lockDocuments: false,\n select: ({ select }) => (select ? { ...select, relatedCollection: true } : undefined),\n})\n"],"names":["transformWhereQuery","validateWhereQuery","getAccess","getConstraints","operations","queryPresetsCollectionSlug","getQueryPresetsConfig","config","slug","access","admin","defaultColumns","hidden","useAsTitle","fields","name","type","required","defaultValue","validate","isShared","data","typedData","someOperationsAreShared","Object","values","some","operation","constraint","components","Cell","Field","hooks","beforeValidate","where","label","value","JSON","parse","stringify","options","collections","reduce","acc","collection","enableQueryPresets","push","labels","plural","description","disabled","forEach","singular","queryPresets","lockDocuments","select","relatedCollection","undefined"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,sCAAqC;AACzE,SAASC,kBAAkB,QAAQ,qCAAoC;AACvE,SAASC,SAAS,QAAQ,cAAa;AACvC,SAASC,cAAc,QAAQ,mBAAkB;AACjD,SAASC,UAAU,QAA0B,aAAY;AAEzD,OAAO,MAAMC,6BAA6B,wBAAuB;AAEjE,OAAO,MAAMC,wBAAwB,CAACC,SAAsC,CAAA;QAC1EC,MAAMH;QACNI,QAAQP,UAAUK;QAClBG,OAAO;YACLC,gBAAgB;gBAAC;gBAAS;gBAAY;gBAAU;gBAAS;gBAAW;aAAU;YAC9EC,QAAQ;YACRC,YAAY;QACd;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;gBACNC,UAAU;YACZ;YACA;gBACEF,MAAM;gBACNC,MAAM;gBACNE,cAAc;gBACdC,UAAU,CAACC,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AEN,UAAU,CAAC,CAAC;QACvC;QACAO,eAAe;QACfC,QAAQ,CAAC,EAAEA,MAAM,EAAE,GAAMA,SAAS;gBAAE,GAAGA,MAAM;gBAAEC,mBAAmB;YAAK,IAAIC;IAC7E,CAAA,EAAE"}
|
|
@@ -129,17 +129,6 @@ export type JobsConfig = {
|
|
|
129
129
|
* Determine whether or not to delete a job after it has successfully completed.
|
|
130
130
|
*/
|
|
131
131
|
deleteJobOnComplete?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Specify depth for retrieving jobs from the queue.
|
|
134
|
-
* This should be as low as possible in order for job retrieval
|
|
135
|
-
* to be as efficient as possible. Setting it to anything higher than
|
|
136
|
-
* 0 will drastically affect performance, as less efficient database
|
|
137
|
-
* queries will be used.
|
|
138
|
-
*
|
|
139
|
-
* @default 0
|
|
140
|
-
* @deprecated - this will be removed in 4.0
|
|
141
|
-
*/
|
|
142
|
-
depth?: number;
|
|
143
132
|
/**
|
|
144
133
|
* Enable concurrency controls for workflows and tasks.
|
|
145
134
|
* When enabled, adds a `concurrencyKey` field to the jobs collection schema.
|
|
@@ -172,16 +161,6 @@ export type JobsConfig = {
|
|
|
172
161
|
[queue: string]: Sort;
|
|
173
162
|
};
|
|
174
163
|
} | Sort;
|
|
175
|
-
/**
|
|
176
|
-
* By default, the job system uses direct database calls for optimal performance.
|
|
177
|
-
* If you added custom hooks to your jobs collection, you can set this to true to
|
|
178
|
-
* use the standard Payload API for all job operations. This is discouraged, as it will
|
|
179
|
-
* drastically affect performance.
|
|
180
|
-
*
|
|
181
|
-
* @default false
|
|
182
|
-
* @deprecated - this will be removed in 4.0
|
|
183
|
-
*/
|
|
184
|
-
runHooks?: boolean;
|
|
185
164
|
/**
|
|
186
165
|
* A function that will be executed before Payload picks up jobs which are configured by the `jobs.autorun` function.
|
|
187
166
|
* If this function returns true, jobs will be queried and picked up. If it returns false, jobs will not be run.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","source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A;IACD;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queues/config/types/index.ts"],"sourcesContent":["import type { CollectionConfig, Job } from '../../../index.js'\nimport type { MaybePromise, Payload, PayloadRequest, Sort } from '../../../types/index.js'\nimport type { RunJobsSilent } from '../../localAPI.js'\nimport type { RunJobsArgs } from '../../operations/runJobs/index.js'\nimport type { JobStats } from '../global.js'\nimport type { TaskConfig } from './taskTypes.js'\nimport type { WorkflowConfig } from './workflowTypes.js'\n\nexport type AutorunCronConfig = {\n /**\n * If you want to autoRUn jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n /**\n * The cron schedule for the job.\n * @default '* * * * *' (every minute).\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron?: string\n /**\n * By default, the autorun will attempt to schedule jobs for tasks and workflows that have a `schedule` property, given\n * the queue name is the same.\n *\n * Set this to `true` to disable the scheduling of jobs automatically.\n *\n * @default false\n */\n disableScheduling?: boolean\n /**\n * The limit for the job. This can be overridden by the user. Defaults to 10.\n */\n limit?: number\n /**\n * The queue name for the job.\n *\n * @default 'default'\n */\n queue?: string\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n}\n\nexport type RunJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type RunJobAccess = (args: RunJobAccessArgs) => MaybePromise<boolean>\n\nexport type QueueJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type CancelJobAccessArgs = {\n req: PayloadRequest\n}\nexport type CancelJobAccess = (args: CancelJobAccessArgs) => MaybePromise<boolean>\nexport type QueueJobAccess = (args: QueueJobAccessArgs) => MaybePromise<boolean>\n\nexport type SanitizedJobsConfig = {\n /**\n * If set to `true`, the job system is enabled and a payload-jobs collection exists.\n * This property is automatically set during sanitization.\n */\n enabled?: boolean\n /**\n * If set to `true`, at least one task or workflow has scheduling enabled.\n * This property is automatically set during sanitization.\n */\n scheduling?: boolean\n /**\n * If set to `true`, a payload-job-stats global exists.\n * This property is automatically set during sanitization.\n */\n stats?: boolean\n} & JobsConfig\nexport type JobsConfig = {\n /**\n * Specify access control to determine who can interact with jobs.\n */\n access?: {\n /**\n * By default, all logged-in users can cancel jobs.\n */\n cancel?: CancelJobAccess\n /**\n * By default, all logged-in users can queue jobs.\n */\n queue?: QueueJobAccess\n /**\n * By default, all logged-in users can run jobs.\n */\n run?: RunJobAccess\n }\n /** Adds information about the parent job to the task log. This is useful for debugging and tracking the flow of tasks.\n *\n * In 4.0, this will default to `true`.\n *\n * @default false\n */\n addParentToTaskLog?: boolean\n /**\n * Allows you to configure cron jobs that automatically run queued jobs\n * at specified intervals. Note that this does not _queue_ new jobs - only\n * _runs_ jobs that are already in the specified queue.\n *\n * @remark this property should not be used on serverless platforms like Vercel\n */\n autoRun?: ((payload: Payload) => MaybePromise<AutorunCronConfig[]>) | AutorunCronConfig[]\n /**\n * Determine whether or not to delete a job after it has successfully completed.\n */\n deleteJobOnComplete?: boolean\n /**\n * Specify depth for retrieving jobs from the queue.\n * This should be as low as possible in order for job retrieval\n * to be as efficient as possible. Setting it to anything higher than\n * 0 will drastically affect performance, as less efficient database\n * queries will be used.\n *\n * @default 0\n * @deprecated - this will be removed in 4.0\n */\n depth?: number\n /**\n * Enable concurrency controls for workflows and tasks.\n * When enabled, adds a `concurrencyKey` field to the jobs collection schema.\n * This allows workflows and tasks to use the `concurrency` option to prevent race conditions.\n *\n * **Important:** Enabling this may require a database migration depending on your database adapter,\n * as it adds a new indexed field to the jobs collection schema.\n *\n * @default false\n * @todo In 4.0, this will default to `true`.\n */\n enableConcurrencyControl?: boolean\n /**\n * Override any settings on the default Jobs collection. Accepts the default collection and allows you to return\n * a new collection.\n */\n jobsCollectionOverrides?: (args: { defaultJobsCollection: CollectionConfig }) => CollectionConfig\n /**\n * Adjust the job processing order using a Payload sort string. This can be set globally or per queue.\n *\n * FIFO would equal `createdAt` and LIFO would equal `-createdAt`.\n *\n * @default all jobs for all queues will be executed in FIFO order.\n */\n processingOrder?:\n | ((args: RunJobsArgs) => Promise<Sort> | Sort)\n | {\n default?: Sort\n queues: {\n [queue: string]: Sort\n }\n }\n | Sort\n /**\n * By default, the job system uses direct database calls for optimal performance.\n * If you added custom hooks to your jobs collection, you can set this to true to\n * use the standard Payload API for all job operations. This is discouraged, as it will\n * drastically affect performance.\n *\n * @default false\n * @deprecated - this will be removed in 4.0\n */\n runHooks?: boolean\n /**\n * A function that will be executed before Payload picks up jobs which are configured by the `jobs.autorun` function.\n * If this function returns true, jobs will be queried and picked up. If it returns false, jobs will not be run.\n * @default undefined - if this function is not defined, jobs will be run - as if () => true was passed.\n * @param payload\n * @returns boolean\n */\n shouldAutoRun?: (payload: Payload) => MaybePromise<boolean>\n /**\n * Define all possible tasks here\n */\n tasks?: TaskConfig<any>[]\n /**\n * Define all the workflows here. Workflows orchestrate the flow of multiple tasks.\n */\n workflows?: WorkflowConfig<any>[]\n}\n\nexport type Queueable = {\n scheduleConfig: ScheduleConfig\n taskConfig?: TaskConfig\n // If not set, queue it immediately\n waitUntil?: Date\n workflowConfig?: WorkflowConfig\n}\n\nexport type BeforeScheduleFn = (args: {\n defaultBeforeSchedule: BeforeScheduleFn\n /**\n * payload-job-stats global data\n */\n jobStats: JobStats\n queueable: Queueable\n req: PayloadRequest\n}) => MaybePromise<{\n input?: object\n shouldSchedule: boolean\n waitUntil?: Date\n}>\n\nexport type AfterScheduleFn = (\n args: {\n defaultAfterSchedule: AfterScheduleFn\n /**\n * payload-job-stats global data. If the global does not exist, it will be null.\n */\n jobStats: JobStats | null\n queueable: Queueable\n req: PayloadRequest\n } & (\n | {\n error: Error\n job?: never\n status: 'error'\n }\n | {\n error?: never\n job: Job\n status: 'success'\n }\n | {\n error?: never\n job?: never\n /**\n * If the beforeSchedule hook returned `shouldSchedule: false`, this will be called with status `skipped`.\n */\n status: 'skipped'\n }\n ),\n) => MaybePromise<void>\n\nexport type ScheduleConfig = {\n /**\n * The cron for scheduling the job.\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron: string\n hooks?: {\n /**\n * Functions that will be executed after the job has been successfully scheduled.\n *\n * @default By default, global update?? Unless global update should happen before\n */\n afterSchedule?: AfterScheduleFn\n /**\n * Functions that will be executed before the job is scheduled.\n * You can use this to control whether or not the job should be scheduled, or what input\n * data should be passed to the job.\n *\n * @default By default, this has one function that returns { shouldSchedule: true } if the following conditions are met:\n * - There currently is no job of the same type in the specified queue that is currently running\n * - There currently is no job of the same type in the specified queue that is scheduled to run in the future\n * - There currently is no job of the same type in the specified queue that failed previously but can be retried\n */\n beforeSchedule?: BeforeScheduleFn\n }\n /**\n * Queue to which the scheduled job will be added.\n */\n queue: string\n}\n"],"names":[],"mappings":"AAsQA,WA4CC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/queues/config/types/index.ts"],"sourcesContent":["import type { CollectionConfig, Job } from '../../../index.js'\nimport type { MaybePromise, Payload, PayloadRequest, Sort } from '../../../types/index.js'\nimport type { RunJobsSilent } from '../../localAPI.js'\nimport type { RunJobsArgs } from '../../operations/runJobs/index.js'\nimport type { JobStats } from '../global.js'\nimport type { TaskConfig } from './taskTypes.js'\nimport type { WorkflowConfig } from './workflowTypes.js'\n\nexport type AutorunCronConfig = {\n /**\n * If you want to autoRUn jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n /**\n * The cron schedule for the job.\n * @default '* * * * *' (every minute).\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron?: string\n /**\n * By default, the autorun will attempt to schedule jobs for tasks and workflows that have a `schedule` property, given\n * the queue name is the same.\n *\n * Set this to `true` to disable the scheduling of jobs automatically.\n *\n * @default false\n */\n disableScheduling?: boolean\n /**\n * The limit for the job. This can be overridden by the user. Defaults to 10.\n */\n limit?: number\n /**\n * The queue name for the job.\n *\n * @default 'default'\n */\n queue?: string\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n}\n\nexport type RunJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type RunJobAccess = (args: RunJobAccessArgs) => MaybePromise<boolean>\n\nexport type QueueJobAccessArgs = {\n req: PayloadRequest\n}\n\nexport type CancelJobAccessArgs = {\n req: PayloadRequest\n}\nexport type CancelJobAccess = (args: CancelJobAccessArgs) => MaybePromise<boolean>\nexport type QueueJobAccess = (args: QueueJobAccessArgs) => MaybePromise<boolean>\n\nexport type SanitizedJobsConfig = {\n /**\n * If set to `true`, the job system is enabled and a payload-jobs collection exists.\n * This property is automatically set during sanitization.\n */\n enabled?: boolean\n /**\n * If set to `true`, at least one task or workflow has scheduling enabled.\n * This property is automatically set during sanitization.\n */\n scheduling?: boolean\n /**\n * If set to `true`, a payload-job-stats global exists.\n * This property is automatically set during sanitization.\n */\n stats?: boolean\n} & JobsConfig\nexport type JobsConfig = {\n /**\n * Specify access control to determine who can interact with jobs.\n */\n access?: {\n /**\n * By default, all logged-in users can cancel jobs.\n */\n cancel?: CancelJobAccess\n /**\n * By default, all logged-in users can queue jobs.\n */\n queue?: QueueJobAccess\n /**\n * By default, all logged-in users can run jobs.\n */\n run?: RunJobAccess\n }\n /** Adds information about the parent job to the task log. This is useful for debugging and tracking the flow of tasks.\n *\n * In 4.0, this will default to `true`.\n *\n * @default false\n */\n addParentToTaskLog?: boolean\n /**\n * Allows you to configure cron jobs that automatically run queued jobs\n * at specified intervals. Note that this does not _queue_ new jobs - only\n * _runs_ jobs that are already in the specified queue.\n *\n * @remark this property should not be used on serverless platforms like Vercel\n */\n autoRun?: ((payload: Payload) => MaybePromise<AutorunCronConfig[]>) | AutorunCronConfig[]\n /**\n * Determine whether or not to delete a job after it has successfully completed.\n */\n deleteJobOnComplete?: boolean\n /**\n * Enable concurrency controls for workflows and tasks.\n * When enabled, adds a `concurrencyKey` field to the jobs collection schema.\n * This allows workflows and tasks to use the `concurrency` option to prevent race conditions.\n *\n * **Important:** Enabling this may require a database migration depending on your database adapter,\n * as it adds a new indexed field to the jobs collection schema.\n *\n * @default false\n * @todo In 4.0, this will default to `true`.\n */\n enableConcurrencyControl?: boolean\n /**\n * Override any settings on the default Jobs collection. Accepts the default collection and allows you to return\n * a new collection.\n */\n jobsCollectionOverrides?: (args: { defaultJobsCollection: CollectionConfig }) => CollectionConfig\n /**\n * Adjust the job processing order using a Payload sort string. This can be set globally or per queue.\n *\n * FIFO would equal `createdAt` and LIFO would equal `-createdAt`.\n *\n * @default all jobs for all queues will be executed in FIFO order.\n */\n processingOrder?:\n | ((args: RunJobsArgs) => Promise<Sort> | Sort)\n | {\n default?: Sort\n queues: {\n [queue: string]: Sort\n }\n }\n | Sort\n /**\n * A function that will be executed before Payload picks up jobs which are configured by the `jobs.autorun` function.\n * If this function returns true, jobs will be queried and picked up. If it returns false, jobs will not be run.\n * @default undefined - if this function is not defined, jobs will be run - as if () => true was passed.\n * @param payload\n * @returns boolean\n */\n shouldAutoRun?: (payload: Payload) => MaybePromise<boolean>\n /**\n * Define all possible tasks here\n */\n tasks?: TaskConfig<any>[]\n /**\n * Define all the workflows here. Workflows orchestrate the flow of multiple tasks.\n */\n workflows?: WorkflowConfig<any>[]\n}\n\nexport type Queueable = {\n scheduleConfig: ScheduleConfig\n taskConfig?: TaskConfig\n // If not set, queue it immediately\n waitUntil?: Date\n workflowConfig?: WorkflowConfig\n}\n\nexport type BeforeScheduleFn = (args: {\n defaultBeforeSchedule: BeforeScheduleFn\n /**\n * payload-job-stats global data\n */\n jobStats: JobStats\n queueable: Queueable\n req: PayloadRequest\n}) => MaybePromise<{\n input?: object\n shouldSchedule: boolean\n waitUntil?: Date\n}>\n\nexport type AfterScheduleFn = (\n args: {\n defaultAfterSchedule: AfterScheduleFn\n /**\n * payload-job-stats global data. If the global does not exist, it will be null.\n */\n jobStats: JobStats | null\n queueable: Queueable\n req: PayloadRequest\n } & (\n | {\n error: Error\n job?: never\n status: 'error'\n }\n | {\n error?: never\n job: Job\n status: 'success'\n }\n | {\n error?: never\n job?: never\n /**\n * If the beforeSchedule hook returned `shouldSchedule: false`, this will be called with status `skipped`.\n */\n status: 'skipped'\n }\n ),\n) => MaybePromise<void>\n\nexport type ScheduleConfig = {\n /**\n * The cron for scheduling the job.\n *\n * @example\n * ┌───────────── (optional) second (0 - 59)\n * │ ┌───────────── minute (0 - 59)\n * │ │ ┌───────────── hour (0 - 23)\n * │ │ │ ┌───────────── day of the month (1 - 31)\n * │ │ │ │ ┌───────────── month (1 - 12)\n * │ │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday)\n * │ │ │ │ │ │\n * │ │ │ │ │ │\n * - '* 0 * * * *' every hour at minute 0\n * - '* 0 0 * * *' daily at midnight\n * - '* 0 0 * * 0' weekly at midnight on Sundays\n * - '* 0 0 1 * *' monthly at midnight on the 1st day of the month\n * - '* 0/5 * * * *' every 5 minutes\n * - '* * * * * *' every second\n */\n cron: string\n hooks?: {\n /**\n * Functions that will be executed after the job has been successfully scheduled.\n *\n * @default By default, global update?? Unless global update should happen before\n */\n afterSchedule?: AfterScheduleFn\n /**\n * Functions that will be executed before the job is scheduled.\n * You can use this to control whether or not the job should be scheduled, or what input\n * data should be passed to the job.\n *\n * @default By default, this has one function that returns { shouldSchedule: true } if the following conditions are met:\n * - There currently is no job of the same type in the specified queue that is currently running\n * - There currently is no job of the same type in the specified queue that is scheduled to run in the future\n * - There currently is no job of the same type in the specified queue that failed previously but can be retried\n */\n beforeSchedule?: BeforeScheduleFn\n }\n /**\n * Queue to which the scheduled job will be added.\n */\n queue: string\n}\n"],"names":[],"mappings":"AAiPA,WA4CC"}
|
|
@@ -6,17 +6,7 @@ export type TaskInputOutput = {
|
|
|
6
6
|
output: object;
|
|
7
7
|
};
|
|
8
8
|
export type TaskHandlerResult<TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput> = {
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.
|
|
11
|
-
*/
|
|
12
|
-
errorMessage?: string;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.
|
|
15
|
-
*/
|
|
16
|
-
state: 'failed';
|
|
17
|
-
} | {
|
|
18
9
|
output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output'] : TTaskSlugOrInputOutput extends TaskInputOutput ? TTaskSlugOrInputOutput['output'] : never;
|
|
19
|
-
state?: 'succeeded';
|
|
20
10
|
};
|
|
21
11
|
export type TaskHandlerArgs<TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput, TWorkflowSlug extends keyof TypedJobs['workflows'] = string> = {
|
|
22
12
|
/**
|
|
@@ -79,17 +69,7 @@ export type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput exte
|
|
|
79
69
|
req: PayloadRequest;
|
|
80
70
|
tasks: RunTaskFunctions;
|
|
81
71
|
}) => MaybePromise<{
|
|
82
|
-
/**
|
|
83
|
-
* @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.
|
|
84
|
-
*/
|
|
85
|
-
errorMessage?: string;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.
|
|
88
|
-
*/
|
|
89
|
-
state: 'failed';
|
|
90
|
-
} | {
|
|
91
72
|
output: TTaskOutput;
|
|
92
|
-
state?: 'succeeded';
|
|
93
73
|
}>;
|
|
94
74
|
}) => Promise<TTaskOutput>;
|
|
95
75
|
export type TaskCallbackArgs = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskTypes.d.ts","sourceRoot":"","sources":["../../../../src/queues/config/types/taskTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,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AAS,eAAe,GAC5C,sBAAsB,CAAC,OAAO,CAAC,GAC/B,MAAM,CACb,CAAA;IACD;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAA;IACrD;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,EAAE,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAA;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,EAAE,CAAA;IAC3B;;OAEG;IACH,IAAI,EAAE,sBAAsB,SAAS,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,sBAAsB,GAAG,MAAM,CAAA;CAChG,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queues/config/types/taskTypes.ts"],"sourcesContent":["import type {\n Field,\n Job,\n MaybePromise,\n PayloadRequest,\n StringKeyOf,\n TypedJobs,\n} from '../../../index.js'\nimport type { ScheduleConfig } from './index.js'\nimport type { ConcurrencyConfig, SingleTaskStatus } from './workflowTypes.js'\n\nexport type TaskInputOutput = {\n input: object\n output: object\n}\nexport type TaskHandlerResult<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n> =\n | {\n /**\n * @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.\n */\n errorMessage?: string\n /**\n * @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.\n */\n state: 'failed'\n }\n | {\n output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['output']\n : never\n state?: 'succeeded'\n }\n\nexport type TaskHandlerArgs<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = {\n /**\n * Use this function to run a sub-task from within another task.\n */\n inlineTask: RunInlineTaskFunction\n input: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['input']\n : never\n job: Job<TWorkflowSlug>\n req: PayloadRequest\n tasks: RunTaskFunctions\n}\n\n/**\n * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus\n */\nexport type TaskHandlerArgsNoInput<TWorkflowInput extends false | object = false> = {\n job: Job<TWorkflowInput>\n req: PayloadRequest\n}\n\nexport type TaskHandler<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = (\n args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>,\n) => MaybePromise<TaskHandlerResult<TTaskSlugOrInputOutput>>\n\n/**\n * @todo rename to TaskSlug in 4.0, similar to CollectionSlug\n */\nexport type TaskType = StringKeyOf<TypedJobs['tasks']>\n\n// Extracts the type of `input` corresponding to each task\nexport type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input']\n\nexport type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output']\n\nexport type TaskHandlerResults = {\n [TTaskSlug in keyof TypedJobs['tasks']]: {\n [id: string]: TaskHandlerResult<TTaskSlug>\n }\n}\n\n// Helper type to create correct argument type for the function corresponding to each task.\nexport type RunTaskFunctionArgs<TTaskSlug extends keyof TypedJobs['tasks']> = {\n input?: TaskInput<TTaskSlug>\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n}\n\nexport type RunTaskFunction<TTaskSlug extends keyof TypedJobs['tasks']> = (\n taskID: string,\n taskArgs?: RunTaskFunctionArgs<TTaskSlug>,\n) => Promise<TaskOutput<TTaskSlug>>\n\nexport type RunTaskFunctions = {\n [TTaskSlug in keyof TypedJobs['tasks']]: RunTaskFunction<TTaskSlug>\n}\n\nexport type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput extends object>(\n taskID: string,\n taskArgs: {\n input?: TTaskInput\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n // This is the same as TaskHandler, but typed out explicitly in order to improve type inference\n task: (args: {\n inlineTask: RunInlineTaskFunction\n input: TTaskInput\n job: Job<any>\n req: PayloadRequest\n tasks: RunTaskFunctions\n }) => MaybePromise<\n | {\n /**\n * @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.\n */\n errorMessage?: string\n /**\n * @deprecated Returning `state: 'failed'` is deprecated. Throw an error instead.\n */\n state: 'failed'\n }\n | {\n output: TTaskOutput\n state?: 'succeeded'\n }\n >\n },\n) => Promise<TTaskOutput>\n\nexport type TaskCallbackArgs = {\n /**\n * Input data passed to the task\n */\n input?: object\n job: Job\n req: PayloadRequest\n taskStatus: null | SingleTaskStatus<string>\n}\n\nexport type ShouldRestoreFn = (\n args: { taskStatus: SingleTaskStatus<string> } & Omit<TaskCallbackArgs, 'taskStatus'>,\n) => MaybePromise<boolean>\nexport type TaskCallbackFn = (args: TaskCallbackArgs) => MaybePromise<void>\n\nexport type RetryConfig = {\n /**\n * This controls how many times the task should be retried if it fails.\n *\n * @default undefined - attempts are either inherited from the workflow retry config or set to 0.\n */\n attempts?: number\n /**\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n *\n * If this is set on a single task, the longest backoff time of a task will determine the time until the entire workflow is retried.\n */\n backoff?: {\n /**\n * Base delay between running jobs in ms\n */\n delay?: number\n /**\n * @default fixed\n *\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n * If fixed (default) is used, the delay will be the same between each retry.\n *\n * If exponential is used, the delay will increase exponentially with each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'fixed'\n *\n * The task will be retried 3 times with a delay of 1000ms between each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'exponential'\n *\n * The task will be retried 3 times with a delay of 1000ms, 2000ms, and 4000ms between each retry.\n */\n type: 'exponential' | 'fixed'\n }\n /**\n * This controls whether the task output should be restored if the task previously succeeded and the workflow is being retried.\n *\n * If this is set to false, the task will be re-run even if it previously succeeded, ignoring the maximum number of retries.\n *\n * If this is set to true, the task will only be re-run if it previously failed.\n *\n * If this is a function, the return value of the function will determine whether the task should be re-run. This can be used for more complex restore logic,\n * e.g you may want to re-run a task up until a certain point and then restore it, or only re-run a task if the input has changed.\n *\n * @default true - the task output will be restored if the task previously succeeded.\n */\n shouldRestore?: boolean | ShouldRestoreFn\n}\n\nexport type TaskConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType,\n> = {\n /**\n * Job concurrency controls for preventing race conditions.\n *\n * Can be an object with full options, or a shorthand function that just returns the key\n * (in which case exclusive defaults to true).\n */\n concurrency?: ConcurrencyConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput\n ? TTaskSlugOrInputOutput['input']\n : object\n >\n /**\n * The function that should be responsible for running the job.\n * You can either pass a string-based path to the job function file, or the job function itself.\n *\n * If you are using large dependencies within your job, you might prefer to pass the string path\n * because that will avoid bundling large dependencies in your Next.js app. Passing a string path is an advanced feature\n * that may require a sophisticated build pipeline in order to work.\n */\n handler: string | TaskHandler<TTaskSlugOrInputOutput>\n /**\n * Define the input field schema - payload will generate a type for this schema.\n */\n inputSchema?: Field[]\n /**\n * You can use interfaceName to change the name of the interface that is generated for this task. By default, this is \"Task\" + the capitalized task slug.\n */\n interfaceName?: string\n /**\n * Define a human-friendly label for this task.\n */\n label?: string\n /**\n * Function to be executed if the task fails.\n */\n onFail?: TaskCallbackFn\n /**\n * Function to be executed if the task succeeds.\n */\n onSuccess?: TaskCallbackFn\n /**\n * Define the output field schema - payload will generate a type for this schema.\n */\n outputSchema?: Field[]\n /**\n * Specify the number of times that this step should be retried if it fails.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n /**\n * Allows automatically scheduling this task to run regularly at a specified interval.\n */\n schedule?: ScheduleConfig[]\n /**\n * Define a slug-based name for this job. This slug needs to be unique among both tasks and workflows.\n */\n slug: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TTaskSlugOrInputOutput : string\n}\n"],"names":[],"mappings":"AAyNA,WAiEC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/queues/config/types/taskTypes.ts"],"sourcesContent":["import type {\n Field,\n Job,\n MaybePromise,\n PayloadRequest,\n StringKeyOf,\n TypedJobs,\n} from '../../../index.js'\nimport type { ScheduleConfig } from './index.js'\nimport type { ConcurrencyConfig, SingleTaskStatus } from './workflowTypes.js'\n\nexport type TaskInputOutput = {\n input: object\n output: object\n}\nexport type TaskHandlerResult<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n> = {\n output: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['output']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['output']\n : never\n}\n\nexport type TaskHandlerArgs<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = {\n /**\n * Use this function to run a sub-task from within another task.\n */\n inlineTask: RunInlineTaskFunction\n input: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput // Check if it's actually TaskInputOutput type\n ? TTaskSlugOrInputOutput['input']\n : never\n job: Job<TWorkflowSlug>\n req: PayloadRequest\n tasks: RunTaskFunctions\n}\n\n/**\n * Inline tasks in JSON workflows have no input, as they can just get the input from job.taskStatus\n */\nexport type TaskHandlerArgsNoInput<TWorkflowInput extends false | object = false> = {\n job: Job<TWorkflowInput>\n req: PayloadRequest\n}\n\nexport type TaskHandler<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput,\n TWorkflowSlug extends keyof TypedJobs['workflows'] = string,\n> = (\n args: TaskHandlerArgs<TTaskSlugOrInputOutput, TWorkflowSlug>,\n) => MaybePromise<TaskHandlerResult<TTaskSlugOrInputOutput>>\n\n/**\n * @todo rename to TaskSlug in 4.0, similar to CollectionSlug\n */\nexport type TaskType = StringKeyOf<TypedJobs['tasks']>\n\n// Extracts the type of `input` corresponding to each task\nexport type TaskInput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['input']\n\nexport type TaskOutput<T extends keyof TypedJobs['tasks']> = TypedJobs['tasks'][T]['output']\n\nexport type TaskHandlerResults = {\n [TTaskSlug in keyof TypedJobs['tasks']]: {\n [id: string]: TaskHandlerResult<TTaskSlug>\n }\n}\n\n// Helper type to create correct argument type for the function corresponding to each task.\nexport type RunTaskFunctionArgs<TTaskSlug extends keyof TypedJobs['tasks']> = {\n input?: TaskInput<TTaskSlug>\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n}\n\nexport type RunTaskFunction<TTaskSlug extends keyof TypedJobs['tasks']> = (\n taskID: string,\n taskArgs?: RunTaskFunctionArgs<TTaskSlug>,\n) => Promise<TaskOutput<TTaskSlug>>\n\nexport type RunTaskFunctions = {\n [TTaskSlug in keyof TypedJobs['tasks']]: RunTaskFunction<TTaskSlug>\n}\n\nexport type RunInlineTaskFunction = <TTaskInput extends object, TTaskOutput extends object>(\n taskID: string,\n taskArgs: {\n input?: TTaskInput\n /**\n * Specify the number of times that this task should be retried if it fails for any reason.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n // This is the same as TaskHandler, but typed out explicitly in order to improve type inference\n task: (args: {\n inlineTask: RunInlineTaskFunction\n input: TTaskInput\n job: Job<any>\n req: PayloadRequest\n tasks: RunTaskFunctions\n }) => MaybePromise<{\n output: TTaskOutput\n }>\n },\n) => Promise<TTaskOutput>\n\nexport type TaskCallbackArgs = {\n /**\n * Input data passed to the task\n */\n input?: object\n job: Job\n req: PayloadRequest\n taskStatus: null | SingleTaskStatus<string>\n}\n\nexport type ShouldRestoreFn = (\n args: { taskStatus: SingleTaskStatus<string> } & Omit<TaskCallbackArgs, 'taskStatus'>,\n) => MaybePromise<boolean>\nexport type TaskCallbackFn = (args: TaskCallbackArgs) => MaybePromise<void>\n\nexport type RetryConfig = {\n /**\n * This controls how many times the task should be retried if it fails.\n *\n * @default undefined - attempts are either inherited from the workflow retry config or set to 0.\n */\n attempts?: number\n /**\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n *\n * If this is set on a single task, the longest backoff time of a task will determine the time until the entire workflow is retried.\n */\n backoff?: {\n /**\n * Base delay between running jobs in ms\n */\n delay?: number\n /**\n * @default fixed\n *\n * The backoff strategy to use when retrying the task. This determines how long to wait before retrying the task.\n * If fixed (default) is used, the delay will be the same between each retry.\n *\n * If exponential is used, the delay will increase exponentially with each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'fixed'\n *\n * The task will be retried 3 times with a delay of 1000ms between each retry.\n *\n * @example\n * delay = 1000\n * attempts = 3\n * type = 'exponential'\n *\n * The task will be retried 3 times with a delay of 1000ms, 2000ms, and 4000ms between each retry.\n */\n type: 'exponential' | 'fixed'\n }\n /**\n * This controls whether the task output should be restored if the task previously succeeded and the workflow is being retried.\n *\n * If this is set to false, the task will be re-run even if it previously succeeded, ignoring the maximum number of retries.\n *\n * If this is set to true, the task will only be re-run if it previously failed.\n *\n * If this is a function, the return value of the function will determine whether the task should be re-run. This can be used for more complex restore logic,\n * e.g you may want to re-run a task up until a certain point and then restore it, or only re-run a task if the input has changed.\n *\n * @default true - the task output will be restored if the task previously succeeded.\n */\n shouldRestore?: boolean | ShouldRestoreFn\n}\n\nexport type TaskConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] | TaskInputOutput = TaskType,\n> = {\n /**\n * Job concurrency controls for preventing race conditions.\n *\n * Can be an object with full options, or a shorthand function that just returns the key\n * (in which case exclusive defaults to true).\n */\n concurrency?: ConcurrencyConfig<\n TTaskSlugOrInputOutput extends keyof TypedJobs['tasks']\n ? TypedJobs['tasks'][TTaskSlugOrInputOutput]['input']\n : TTaskSlugOrInputOutput extends TaskInputOutput\n ? TTaskSlugOrInputOutput['input']\n : object\n >\n /**\n * The function that should be responsible for running the job.\n * You can either pass a string-based path to the job function file, or the job function itself.\n *\n * If you are using large dependencies within your job, you might prefer to pass the string path\n * because that will avoid bundling large dependencies in your Next.js app. Passing a string path is an advanced feature\n * that may require a sophisticated build pipeline in order to work.\n */\n handler: string | TaskHandler<TTaskSlugOrInputOutput>\n /**\n * Define the input field schema - payload will generate a type for this schema.\n */\n inputSchema?: Field[]\n /**\n * You can use interfaceName to change the name of the interface that is generated for this task. By default, this is \"Task\" + the capitalized task slug.\n */\n interfaceName?: string\n /**\n * Define a human-friendly label for this task.\n */\n label?: string\n /**\n * Function to be executed if the task fails.\n */\n onFail?: TaskCallbackFn\n /**\n * Function to be executed if the task succeeds.\n */\n onSuccess?: TaskCallbackFn\n /**\n * Define the output field schema - payload will generate a type for this schema.\n */\n outputSchema?: Field[]\n /**\n * Specify the number of times that this step should be retried if it fails.\n * If this is undefined, the task will either inherit the retries from the workflow or have no retries.\n * If this is 0, the task will not be retried.\n *\n * @default By default, tasks are not retried and `retries` is `undefined`.\n */\n retries?: number | RetryConfig | undefined\n /**\n * Allows automatically scheduling this task to run regularly at a specified interval.\n */\n schedule?: ScheduleConfig[]\n /**\n * Define a slug-based name for this job. This slug needs to be unique among both tasks and workflows.\n */\n slug: TTaskSlugOrInputOutput extends keyof TypedJobs['tasks'] ? TTaskSlugOrInputOutput : string\n}\n"],"names":[],"mappings":"AAgMA,WAiEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleWorkflowError.d.ts","sourceRoot":"","sources":["../../../src/queues/errors/handleWorkflowError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAK/C;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,KAAK,EACL,GAAG,EACH,MAAc,EACd,SAAS,GACV,EAAE;IACD,KAAK,EAAE,aAAa,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;IACnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,SAAS,EAAE,iBAAiB,CAAA;CAC7B,GAAG,OAAO,CAAC;IACV,aAAa,EAAE,OAAO,CAAA;CACvB,CAAC,
|
|
1
|
+
{"version":3,"file":"handleWorkflowError.d.ts","sourceRoot":"","sources":["../../../src/queues/errors/handleWorkflowError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAK/C;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,EACxC,KAAK,EACL,GAAG,EACH,MAAc,EACd,SAAS,GACV,EAAE;IACD,KAAK,EAAE,aAAa,CAAA;IACpB,GAAG,EAAE,cAAc,CAAA;IACnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,SAAS,EAAE,iBAAiB,CAAA;CAC7B,GAAG,OAAO,CAAC;IACV,aAAa,EAAE,OAAO,CAAA;CACvB,CAAC,CA6DD"}
|
|
@@ -15,7 +15,15 @@ import { getWorkflowRetryBehavior } from './getWorkflowRetryBehavior.js';
|
|
|
15
15
|
message: error.message,
|
|
16
16
|
stack: error.stack
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
// No retries configured => permanently fail. Errors reaching this handler are
|
|
19
|
+
// workflow-level (task errors are routed to handleTaskError first), so there's
|
|
20
|
+
// nothing else to bound them.
|
|
21
|
+
const hasNoRetriesConfigured = workflowConfig.retries === undefined || workflowConfig.retries === null;
|
|
22
|
+
const { hasFinalError, maxWorkflowRetries, waitUntil } = hasNoRetriesConfigured ? {
|
|
23
|
+
hasFinalError: true,
|
|
24
|
+
maxWorkflowRetries: undefined,
|
|
25
|
+
waitUntil: undefined
|
|
26
|
+
} : getWorkflowRetryBehavior({
|
|
19
27
|
job,
|
|
20
28
|
retriesConfig: workflowConfig.retries
|
|
21
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queues/errors/handleWorkflowError.ts"],"sourcesContent":["import type { PayloadRequest } from '../../index.js'\nimport type { RunJobsSilent } from '../localAPI.js'\nimport type { UpdateJobFunction } from '../operations/runJobs/runJob/getUpdateJobFunction.js'\nimport type { WorkflowError } from './index.js'\n\nimport { getCurrentDate } from '../utilities/getCurrentDate.js'\nimport { getWorkflowRetryBehavior } from './getWorkflowRetryBehavior.js'\n\n/**\n * This is called if a workflow catches an error. It determines if it's a final error\n * or not and handles logging.\n * A Workflow error = error that happens anywhere in between running tasks.\n *\n * This function assumes that the error is not a TaskError, but a WorkflowError. If a task errors,\n * only a TaskError should be thrown, not a WorkflowError.\n */\nexport async function handleWorkflowError({\n error,\n req,\n silent = false,\n updateJob,\n}: {\n error: WorkflowError\n req: PayloadRequest\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n updateJob: UpdateJobFunction\n}): Promise<{\n hasFinalError: boolean\n}> {\n const { job, workflowConfig } = error.args\n\n const errorJSON = {\n name: error.name,\n cancelled: Boolean('cancelled' in error && error.cancelled),\n message: error.message,\n stack: error.stack,\n }\n\n const { hasFinalError, maxWorkflowRetries, waitUntil } = getWorkflowRetryBehavior({\n
|
|
1
|
+
{"version":3,"sources":["../../../src/queues/errors/handleWorkflowError.ts"],"sourcesContent":["import type { PayloadRequest } from '../../index.js'\nimport type { RunJobsSilent } from '../localAPI.js'\nimport type { UpdateJobFunction } from '../operations/runJobs/runJob/getUpdateJobFunction.js'\nimport type { WorkflowError } from './index.js'\n\nimport { getCurrentDate } from '../utilities/getCurrentDate.js'\nimport { getWorkflowRetryBehavior } from './getWorkflowRetryBehavior.js'\n\n/**\n * This is called if a workflow catches an error. It determines if it's a final error\n * or not and handles logging.\n * A Workflow error = error that happens anywhere in between running tasks.\n *\n * This function assumes that the error is not a TaskError, but a WorkflowError. If a task errors,\n * only a TaskError should be thrown, not a WorkflowError.\n */\nexport async function handleWorkflowError({\n error,\n req,\n silent = false,\n updateJob,\n}: {\n error: WorkflowError\n req: PayloadRequest\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n updateJob: UpdateJobFunction\n}): Promise<{\n hasFinalError: boolean\n}> {\n const { job, workflowConfig } = error.args\n\n const errorJSON = {\n name: error.name,\n cancelled: Boolean('cancelled' in error && error.cancelled),\n message: error.message,\n stack: error.stack,\n }\n\n // No retries configured => permanently fail. Errors reaching this handler are\n // workflow-level (task errors are routed to handleTaskError first), so there's\n // nothing else to bound them.\n const hasNoRetriesConfigured =\n workflowConfig.retries === undefined || workflowConfig.retries === null\n\n const { hasFinalError, maxWorkflowRetries, waitUntil } = hasNoRetriesConfigured\n ? { hasFinalError: true, maxWorkflowRetries: undefined, waitUntil: undefined }\n : getWorkflowRetryBehavior({\n job,\n retriesConfig: workflowConfig.retries,\n })\n\n if (!hasFinalError) {\n if (job.waitUntil) {\n // Check if waitUntil is in the past\n const waitUntil = new Date(job.waitUntil)\n if (waitUntil < getCurrentDate()) {\n // Outdated waitUntil, remove it\n delete job.waitUntil\n }\n }\n\n // Update job's waitUntil only if this waitUntil is later than the current one\n if (waitUntil && (!job.waitUntil || waitUntil > new Date(job.waitUntil))) {\n job.waitUntil = waitUntil.toISOString()\n }\n }\n\n const jobLabel = job.workflowSlug || `Task: ${job.taskSlug}`\n\n if (!silent || (typeof silent === 'object' && !silent.error)) {\n req.payload.logger.error({\n err: error,\n msg: `Error running job ${jobLabel} id: ${job.id} attempt ${job.totalTried + 1}${maxWorkflowRetries !== undefined ? '/' + (maxWorkflowRetries + 1) : ''}`,\n })\n }\n\n // Tasks update the job if they error - but in case there is an unhandled error (e.g. in the workflow itself, not in a task)\n // we need to ensure the job is updated to reflect the error\n await updateJob({\n error: errorJSON,\n hasError: hasFinalError, // If reached max retries => final error. If hasError is true this job will not be retried\n processing: false,\n totalTried: (job.totalTried ?? 0) + 1,\n waitUntil: job.waitUntil,\n })\n\n return {\n hasFinalError,\n }\n}\n"],"names":["getCurrentDate","getWorkflowRetryBehavior","handleWorkflowError","error","req","silent","updateJob","job","workflowConfig","args","errorJSON","name","cancelled","Boolean","message","stack","hasNoRetriesConfigured","retries","undefined","hasFinalError","maxWorkflowRetries","waitUntil","retriesConfig","Date","toISOString","jobLabel","workflowSlug","taskSlug","payload","logger","err","msg","id","totalTried","hasError","processing"],"mappings":"AAKA,SAASA,cAAc,QAAQ,iCAAgC;AAC/D,SAASC,wBAAwB,QAAQ,gCAA+B;AAExE;;;;;;;CAOC,GACD,OAAO,eAAeC,oBAAoB,EACxCC,KAAK,EACLC,GAAG,EACHC,SAAS,KAAK,EACdC,SAAS,EAcV;IAGC,MAAM,EAAEC,GAAG,EAAEC,cAAc,EAAE,GAAGL,MAAMM,IAAI;IAE1C,MAAMC,YAAY;QAChBC,MAAMR,MAAMQ,IAAI;QAChBC,WAAWC,QAAQ,eAAeV,SAASA,MAAMS,SAAS;QAC1DE,SAASX,MAAMW,OAAO;QACtBC,OAAOZ,MAAMY,KAAK;IACpB;IAEA,8EAA8E;IAC9E,+EAA+E;IAC/E,8BAA8B;IAC9B,MAAMC,yBACJR,eAAeS,OAAO,KAAKC,aAAaV,eAAeS,OAAO,KAAK;IAErE,MAAM,EAAEE,aAAa,EAAEC,kBAAkB,EAAEC,SAAS,EAAE,GAAGL,yBACrD;QAAEG,eAAe;QAAMC,oBAAoBF;QAAWG,WAAWH;IAAU,IAC3EjB,yBAAyB;QACvBM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AK,CAAC,EAAE,MAAM,CAAA;QACd;;;;;;;WAOG;QACH,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB;;;;WAIG;QACH,eAAe,CAAC,EAAE,IAAI,CAAA;QACtB;;;;WAIG;QACH,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,GAAG,CAAC,EAAE,cAAc,CAAA;QACpB;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAA;QACpB;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,aAAa,CAAA;QACtB,KAAK,CAAC,EAAE,KAAK,CAAA;KACd,KAAG,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;oBAgBjB;QACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;QACnB;;;;;;;WAOG;QACH,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,GAAG,CAAC,EAAE,cAAc,CAAA;QACpB;;;;;;;WAOG;QACH,MAAM,CAAC,EAAE,aAAa,CAAA;KACvB,KAAG,OAAO,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;mBAWlB;QACnB;;;;;;;WAOG;QACH,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,GAAG,CAAC,EAAE,cAAc,CAAA;QACpB,KAAK,EAAE,KAAK,CAAA;KACb,KAAG,OAAO,CAAC,IAAI,CAAC;uBAqDQ;QACvB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;QACnB;;;;;;;WAOG;QACH,cAAc,CAAC,EAAE,OAAO,CAAA;QACxB,GAAG,CAAC,EAAE,cAAc,CAAA;KACrB,KAAG,OAAO,CAAC,IAAI,CAAC;CA8BjB,CAAA"}
|
package/dist/queues/localAPI.js
CHANGED
|
@@ -100,78 +100,41 @@ export const getJobsLocalAPI = (payload)=>({
|
|
|
100
100
|
data.concurrencyKey = concurrencyKey;
|
|
101
101
|
// If supersedes is enabled, delete older pending jobs with the same key
|
|
102
102
|
if (supersedes) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
concurrencyKey: {
|
|
112
|
-
equals: concurrencyKey
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
processing: {
|
|
117
|
-
equals: false
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
completedAt: {
|
|
122
|
-
exists: false
|
|
123
|
-
}
|
|
103
|
+
await payload.db.deleteMany({
|
|
104
|
+
collection: jobsCollectionSlug,
|
|
105
|
+
req,
|
|
106
|
+
where: {
|
|
107
|
+
and: [
|
|
108
|
+
{
|
|
109
|
+
concurrencyKey: {
|
|
110
|
+
equals: concurrencyKey
|
|
124
111
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
await payload.db.deleteMany({
|
|
130
|
-
collection: jobsCollectionSlug,
|
|
131
|
-
req,
|
|
132
|
-
where: {
|
|
133
|
-
and: [
|
|
134
|
-
{
|
|
135
|
-
concurrencyKey: {
|
|
136
|
-
equals: concurrencyKey
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
processing: {
|
|
141
|
-
equals: false
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
completedAt: {
|
|
146
|
-
exists: false
|
|
147
|
-
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
processing: {
|
|
115
|
+
equals: false
|
|
148
116
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
completedAt: {
|
|
120
|
+
exists: false
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
});
|
|
153
126
|
}
|
|
154
127
|
}
|
|
155
128
|
}
|
|
156
129
|
// Type assertion is still needed here
|
|
157
|
-
|
|
158
|
-
|
|
130
|
+
return jobAfterRead({
|
|
131
|
+
config: payload.config,
|
|
132
|
+
doc: await payload.db.create({
|
|
159
133
|
collection: jobsCollectionSlug,
|
|
160
134
|
data,
|
|
161
|
-
depth: payload.config.jobs.depth ?? 0,
|
|
162
|
-
overrideAccess,
|
|
163
135
|
req
|
|
164
|
-
})
|
|
165
|
-
}
|
|
166
|
-
return jobAfterRead({
|
|
167
|
-
config: payload.config,
|
|
168
|
-
doc: await payload.db.create({
|
|
169
|
-
collection: jobsCollectionSlug,
|
|
170
|
-
data,
|
|
171
|
-
req
|
|
172
|
-
})
|
|
173
|
-
});
|
|
174
|
-
}
|
|
136
|
+
})
|
|
137
|
+
});
|
|
175
138
|
},
|
|
176
139
|
run: async (args)=>{
|
|
177
140
|
const newReq = args?.req ?? await createLocalReq({}, payload);
|
|
@@ -240,8 +203,6 @@ export const getJobsLocalAPI = (payload)=>({
|
|
|
240
203
|
processing: false,
|
|
241
204
|
waitUntil: null
|
|
242
205
|
},
|
|
243
|
-
depth: 0,
|
|
244
|
-
disableTransaction: true,
|
|
245
206
|
req,
|
|
246
207
|
returning: false,
|
|
247
208
|
where: {
|
|
@@ -274,8 +235,6 @@ export const getJobsLocalAPI = (payload)=>({
|
|
|
274
235
|
processing: false,
|
|
275
236
|
waitUntil: null
|
|
276
237
|
},
|
|
277
|
-
depth: 0,
|
|
278
|
-
disableTransaction: true,
|
|
279
238
|
req,
|
|
280
239
|
returning: false
|
|
281
240
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/queues/localAPI.ts"],"sourcesContent":["import type { BaseJob, RunningJobFromTask } from './config/types/workflowTypes.js'\n\nimport {\n createLocalReq,\n Forbidden,\n type Job,\n type Payload,\n type PayloadRequest,\n type Sort,\n type TypedJobs,\n type Where,\n} from '../index.js'\nimport { jobAfterRead, jobsCollectionSlug } from './config/collection.js'\nimport { handleSchedules, type HandleSchedulesResult } from './operations/handleSchedules/index.js'\nimport { runJobs } from './operations/runJobs/index.js'\nimport { updateJob, updateJobs } from './utilities/updateJob.js'\n\nexport type RunJobsSilent =\n | {\n error?: boolean\n info?: boolean\n }\n | boolean\nexport const getJobsLocalAPI = (payload: Payload) => ({\n handleSchedules: async (args?: {\n /**\n * If you want to schedule jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n // By default, schedule all queues - only scheduling jobs scheduled to be added to the `default` queue would not make sense\n // here, as you'd usually specify a different queue than `default` here, especially if this is used in combination with autorun.\n // The `queue` property for setting up schedules is required, and not optional.\n /**\n * If you want to only schedule jobs that are set to schedule in a specific queue, set this to the queue name.\n *\n * @default jobs from the `default` queue will be executed.\n */\n queue?: string\n req?: PayloadRequest\n }): Promise<HandleSchedulesResult> => {\n const newReq: PayloadRequest = args?.req ?? (await createLocalReq({}, payload))\n\n return await handleSchedules({\n allQueues: args?.allQueues,\n queue: args?.queue,\n req: newReq,\n })\n },\n queue: async <\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n TTaskOrWorkflowSlug extends keyof TypedJobs['tasks'] | keyof TypedJobs['workflows'],\n >(\n args:\n | {\n input: TypedJobs['tasks'][TTaskOrWorkflowSlug]['input']\n meta?: BaseJob['meta']\n /**\n * If set to false, access control as defined in jobsConfig.access.queue will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.queue defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n /**\n * The queue to add the job to.\n * If not specified, the job will be added to the default queue.\n *\n * @default 'default'\n */\n queue?: string\n req?: PayloadRequest\n task: TTaskOrWorkflowSlug extends keyof TypedJobs['tasks'] ? TTaskOrWorkflowSlug : never\n waitUntil?: Date\n workflow?: never\n }\n | {\n input: TypedJobs['workflows'][TTaskOrWorkflowSlug]['input']\n meta?: BaseJob['meta']\n /**\n * If set to false, access control as defined in jobsConfig.access.queue will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.queue defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n /**\n * The queue to add the job to.\n * If not specified, the job will be added to the default queue.\n *\n * @default 'default'\n */\n queue?: string\n req?: PayloadRequest\n task?: never\n waitUntil?: Date\n workflow: TTaskOrWorkflowSlug extends keyof TypedJobs['workflows']\n ? TTaskOrWorkflowSlug\n : never\n },\n ): Promise<\n TTaskOrWorkflowSlug extends keyof TypedJobs['workflows']\n ? Job<TTaskOrWorkflowSlug>\n : RunningJobFromTask<TTaskOrWorkflowSlug>\n > => {\n const overrideAccess = args?.overrideAccess !== false\n const req: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.queue will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = payload.config.jobs?.access?.queue ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n let queue: string | undefined = undefined\n\n // If user specifies queue, use that\n if (args.queue) {\n queue = args.queue\n } else if (args.workflow) {\n // Otherwise, if there is a workflow specified, and it has a default queue to use,\n // use that\n const workflow = payload.config.jobs?.workflows?.find(({ slug }) => slug === args.workflow)\n if (workflow?.queue) {\n queue = workflow.queue\n }\n }\n\n const data: Partial<Job> = {\n input: args.input,\n }\n\n if (queue) {\n data.queue = queue\n }\n if (args.waitUntil) {\n data.waitUntil = args.waitUntil?.toISOString()\n }\n if (args.workflow) {\n data.workflowSlug = args.workflow as string\n }\n if (args.task) {\n data.taskSlug = args.task as string\n }\n\n if (args.meta) {\n data.meta = args.meta\n }\n\n // Compute concurrency key from workflow or task config (only if feature is enabled)\n if (payload.config.jobs?.enableConcurrencyControl) {\n let concurrencyKey: null | string = null\n let supersedes = false\n const queueName = queue || 'default'\n\n if (args.workflow) {\n const workflow = payload.config.jobs?.workflows?.find(({ slug }) => slug === args.workflow)\n if (workflow?.concurrency) {\n const concurrencyConfig = workflow.concurrency\n if (typeof concurrencyConfig === 'function') {\n concurrencyKey = concurrencyConfig({ input: args.input, queue: queueName })\n } else {\n concurrencyKey = concurrencyConfig.key({ input: args.input, queue: queueName })\n supersedes = concurrencyConfig.supersedes ?? false\n }\n }\n } else if (args.task) {\n const task = payload.config.jobs?.tasks?.find(({ slug }) => slug === args.task)\n if (task?.concurrency) {\n const concurrencyConfig = task.concurrency\n if (typeof concurrencyConfig === 'function') {\n concurrencyKey = concurrencyConfig({ input: args.input, queue: queueName })\n } else {\n concurrencyKey = concurrencyConfig.key({ input: args.input, queue: queueName })\n supersedes = concurrencyConfig.supersedes ?? false\n }\n }\n }\n\n if (concurrencyKey) {\n data.concurrencyKey = concurrencyKey\n\n // If supersedes is enabled, delete older pending jobs with the same key\n if (supersedes) {\n if (payload.config.jobs.runHooks) {\n await payload.delete({\n collection: jobsCollectionSlug,\n depth: 0,\n disableTransaction: true,\n where: {\n and: [\n { concurrencyKey: { equals: concurrencyKey } },\n { processing: { equals: false } },\n { completedAt: { exists: false } },\n ],\n },\n })\n } else {\n await payload.db.deleteMany({\n collection: jobsCollectionSlug,\n req,\n where: {\n and: [\n { concurrencyKey: { equals: concurrencyKey } },\n { processing: { equals: false } },\n { completedAt: { exists: false } },\n ],\n },\n })\n }\n }\n }\n }\n\n type ReturnType = TTaskOrWorkflowSlug extends keyof TypedJobs['workflows']\n ? Job<TTaskOrWorkflowSlug>\n : RunningJobFromTask<TTaskOrWorkflowSlug> // Type assertion is still needed here\n\n if (payload?.config?.jobs?.depth || payload?.config?.jobs?.runHooks) {\n return (await payload.create({\n collection: jobsCollectionSlug,\n data,\n depth: payload.config.jobs.depth ?? 0,\n overrideAccess,\n req,\n })) as ReturnType\n } else {\n return jobAfterRead({\n config: payload.config,\n doc: await payload.db.create({\n collection: jobsCollectionSlug,\n data,\n req,\n }),\n }) as unknown as ReturnType\n }\n },\n\n run: async (args?: {\n /**\n * If you want to run jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n /**\n * The maximum number of jobs to run in this invocation\n *\n * @default 10\n */\n limit?: number\n /**\n * If set to false, access control as defined in jobsConfig.access.run will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.run defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Adjust the job processing order using a Payload sort string.\n *\n * FIFO would equal `createdAt` and LIFO would equal `-createdAt`.\n */\n processingOrder?: Sort\n /**\n * If you want to run jobs from a specific queue, set this to the queue name.\n *\n * @default jobs from the `default` queue will be executed.\n */\n queue?: string\n req?: PayloadRequest\n /**\n * By default, jobs are run in parallel.\n * If you want to run them in sequence, set this to true.\n */\n sequential?: boolean\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n where?: Where\n }): Promise<ReturnType<typeof runJobs>> => {\n const newReq: PayloadRequest = args?.req ?? (await createLocalReq({}, payload))\n\n return await runJobs({\n allQueues: args?.allQueues,\n limit: args?.limit,\n overrideAccess: args?.overrideAccess !== false,\n processingOrder: args?.processingOrder,\n queue: args?.queue,\n req: newReq,\n sequential: args?.sequential,\n silent: args?.silent,\n where: args?.where,\n })\n },\n\n runByID: async (args: {\n id: number | string\n /**\n * If set to false, access control as defined in jobsConfig.access.run will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.run defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n req?: PayloadRequest\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n }): Promise<ReturnType<typeof runJobs>> => {\n const newReq: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n return await runJobs({\n id: args.id,\n overrideAccess: args.overrideAccess !== false,\n req: newReq,\n silent: args.silent,\n })\n },\n\n cancel: async (args: {\n /**\n * If set to false, access control as defined in jobsConfig.access.cancel will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.cancel defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n queue?: string\n req?: PayloadRequest\n where: Where\n }): Promise<void> => {\n const req: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n const overrideAccess = args.overrideAccess !== false\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.cancel will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = payload.config.jobs?.access?.cancel ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n const and: Where[] = [\n args.where,\n {\n completedAt: {\n exists: false,\n },\n },\n {\n hasError: {\n not_equals: true,\n },\n },\n ]\n\n if (args.queue) {\n and.push({\n queue: {\n equals: args.queue,\n },\n })\n }\n\n await updateJobs({\n data: {\n completedAt: null,\n error: {\n cancelled: true,\n },\n hasError: true,\n processing: false,\n waitUntil: null,\n },\n depth: 0, // No depth, since we're not returning\n disableTransaction: true,\n req,\n returning: false,\n where: { and },\n })\n },\n\n cancelByID: async (args: {\n id: number | string\n /**\n * If set to false, access control as defined in jobsConfig.access.cancel will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.cancel defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n req?: PayloadRequest\n }): Promise<void> => {\n const req: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n const overrideAccess = args.overrideAccess !== false\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.cancel will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = payload.config.jobs?.access?.cancel ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n await updateJob({\n id: args.id,\n data: {\n completedAt: null,\n error: {\n cancelled: true,\n },\n hasError: true,\n processing: false,\n waitUntil: null,\n },\n depth: 0, // No depth, since we're not returning\n disableTransaction: true,\n req,\n returning: false,\n })\n },\n})\n"],"names":["createLocalReq","Forbidden","jobAfterRead","jobsCollectionSlug","handleSchedules","runJobs","updateJob","updateJobs","getJobsLocalAPI","payload","args","newReq","req","allQueues","queue","overrideAccess","accessFn","config","jobs","access","hasAccess","t","undefined","workflow","workflows","find","slug","data","input","waitUntil","toISOString","workflowSlug","task","taskSlug","meta","enableConcurrencyControl","concurrencyKey","supersedes","queueName","concurrency","concurrencyConfig","key","tasks","runHooks","delete","collection","depth","disableTransaction","where","and","equals","processing","completedAt","exists","db","deleteMany","create","doc","run","limit","processingOrder","sequential","silent","runByID","id","cancel","hasError","not_equals","push","error","cancelled","returning","cancelByID"],"mappings":"AAEA,SACEA,cAAc,EACdC,SAAS,QAOJ,cAAa;AACpB,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,yBAAwB;AACzE,SAASC,eAAe,QAAoC,wCAAuC;AACnG,SAASC,OAAO,QAAQ,gCAA+B;AACvD,SAASC,SAAS,EAAEC,UAAU,QAAQ,2BAA0B;AAQhE,OAAO,MAAMC,kBAAkB,CAACC,UAAsB,CAAA;QACpDL,iBAAiB,OAAOM;YAmBtB,MAAMC,SAAyBD,MAAME,OAAQ,MAAMZ,eAAe,CAAC,GAAGS;YAEtE,OAAO,MAAML,gBAAgB;gBAC3BS,WAAWH,MAAMG;gBACjBC,OAAOJ,MAAMI;gBACbF,KAAKD;YACP;QACF;QACAG,OAAO,OAILJ;YAwDA,MAAMK,iBAAiBL,MAAMK,mBAAmB;YA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AAO;oBAAEC;gBAAI;YACf;QACF;QAEAuB,YAAY,OAAO9D;YAajB,MAAME,MAAsBF,KAAKE,GAAG,IAAK,MAAMZ,eAAe,CAAC,GAAGS;YAElE,MAAMM,iBAAiBL,KAAKK,cAAc,KAAK;YAC/C,IAAI,CAACA,gBAAgB;gBACnB;;OAEC,GACD,MAAMC,WAAWP,QAAQQ,MAAM,CAACC,IAAI,EAAEC,QAAQ8C,UAAW,CAAA,IAAM,IAAG;gBAClE,MAAM7C,YAAY,MAAMJ,SAAS;oBAAEJ;gBAAI;gBACvC,IAAI,CAACQ,WAAW;oBACd,MAAM,IAAInB,UAAUW,IAAIS,CAAC;gBAC3B;YACF;YAEA,MAAMf,UAAU;gBACd0D,IAAItD,KAAKsD,EAAE;gBACXrC,MAAM;oBACJyB,aAAa;oBACbiB,OAAO;wBACLC,WAAW;oBACb;oBACAJ,UAAU;oBACVf,YAAY;oBACZtB,WAAW;gBACb;gBACAiB,OAAO;gBACPC,oBAAoB;gBACpBnC;gBACA2D,WAAW;YACb;QACF;IACF,CAAA,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/queues/localAPI.ts"],"sourcesContent":["import type { BaseJob, RunningJobFromTask } from './config/types/workflowTypes.js'\n\nimport {\n createLocalReq,\n Forbidden,\n type Job,\n type Payload,\n type PayloadRequest,\n type Sort,\n type TypedJobs,\n type Where,\n} from '../index.js'\nimport { jobAfterRead, jobsCollectionSlug } from './config/collection.js'\nimport { handleSchedules, type HandleSchedulesResult } from './operations/handleSchedules/index.js'\nimport { runJobs } from './operations/runJobs/index.js'\nimport { updateJob, updateJobs } from './utilities/updateJob.js'\n\nexport type RunJobsSilent =\n | {\n error?: boolean\n info?: boolean\n }\n | boolean\nexport const getJobsLocalAPI = (payload: Payload) => ({\n handleSchedules: async (args?: {\n /**\n * If you want to schedule jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n // By default, schedule all queues - only scheduling jobs scheduled to be added to the `default` queue would not make sense\n // here, as you'd usually specify a different queue than `default` here, especially if this is used in combination with autorun.\n // The `queue` property for setting up schedules is required, and not optional.\n /**\n * If you want to only schedule jobs that are set to schedule in a specific queue, set this to the queue name.\n *\n * @default jobs from the `default` queue will be executed.\n */\n queue?: string\n req?: PayloadRequest\n }): Promise<HandleSchedulesResult> => {\n const newReq: PayloadRequest = args?.req ?? (await createLocalReq({}, payload))\n\n return await handleSchedules({\n allQueues: args?.allQueues,\n queue: args?.queue,\n req: newReq,\n })\n },\n queue: async <\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n TTaskOrWorkflowSlug extends keyof TypedJobs['tasks'] | keyof TypedJobs['workflows'],\n >(\n args:\n | {\n input: TypedJobs['tasks'][TTaskOrWorkflowSlug]['input']\n meta?: BaseJob['meta']\n /**\n * If set to false, access control as defined in jobsConfig.access.queue will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.queue defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n /**\n * The queue to add the job to.\n * If not specified, the job will be added to the default queue.\n *\n * @default 'default'\n */\n queue?: string\n req?: PayloadRequest\n task: TTaskOrWorkflowSlug extends keyof TypedJobs['tasks'] ? TTaskOrWorkflowSlug : never\n waitUntil?: Date\n workflow?: never\n }\n | {\n input: TypedJobs['workflows'][TTaskOrWorkflowSlug]['input']\n meta?: BaseJob['meta']\n /**\n * If set to false, access control as defined in jobsConfig.access.queue will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.queue defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n /**\n * The queue to add the job to.\n * If not specified, the job will be added to the default queue.\n *\n * @default 'default'\n */\n queue?: string\n req?: PayloadRequest\n task?: never\n waitUntil?: Date\n workflow: TTaskOrWorkflowSlug extends keyof TypedJobs['workflows']\n ? TTaskOrWorkflowSlug\n : never\n },\n ): Promise<\n TTaskOrWorkflowSlug extends keyof TypedJobs['workflows']\n ? Job<TTaskOrWorkflowSlug>\n : RunningJobFromTask<TTaskOrWorkflowSlug>\n > => {\n const overrideAccess = args?.overrideAccess !== false\n const req: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.queue will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = payload.config.jobs?.access?.queue ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n let queue: string | undefined = undefined\n\n // If user specifies queue, use that\n if (args.queue) {\n queue = args.queue\n } else if (args.workflow) {\n // Otherwise, if there is a workflow specified, and it has a default queue to use,\n // use that\n const workflow = payload.config.jobs?.workflows?.find(({ slug }) => slug === args.workflow)\n if (workflow?.queue) {\n queue = workflow.queue\n }\n }\n\n const data: Partial<Job> = {\n input: args.input,\n }\n\n if (queue) {\n data.queue = queue\n }\n if (args.waitUntil) {\n data.waitUntil = args.waitUntil?.toISOString()\n }\n if (args.workflow) {\n data.workflowSlug = args.workflow as string\n }\n if (args.task) {\n data.taskSlug = args.task as string\n }\n\n if (args.meta) {\n data.meta = args.meta\n }\n\n // Compute concurrency key from workflow or task config (only if feature is enabled)\n if (payload.config.jobs?.enableConcurrencyControl) {\n let concurrencyKey: null | string = null\n let supersedes = false\n const queueName = queue || 'default'\n\n if (args.workflow) {\n const workflow = payload.config.jobs?.workflows?.find(({ slug }) => slug === args.workflow)\n if (workflow?.concurrency) {\n const concurrencyConfig = workflow.concurrency\n if (typeof concurrencyConfig === 'function') {\n concurrencyKey = concurrencyConfig({ input: args.input, queue: queueName })\n } else {\n concurrencyKey = concurrencyConfig.key({ input: args.input, queue: queueName })\n supersedes = concurrencyConfig.supersedes ?? false\n }\n }\n } else if (args.task) {\n const task = payload.config.jobs?.tasks?.find(({ slug }) => slug === args.task)\n if (task?.concurrency) {\n const concurrencyConfig = task.concurrency\n if (typeof concurrencyConfig === 'function') {\n concurrencyKey = concurrencyConfig({ input: args.input, queue: queueName })\n } else {\n concurrencyKey = concurrencyConfig.key({ input: args.input, queue: queueName })\n supersedes = concurrencyConfig.supersedes ?? false\n }\n }\n }\n\n if (concurrencyKey) {\n data.concurrencyKey = concurrencyKey\n\n // If supersedes is enabled, delete older pending jobs with the same key\n if (supersedes) {\n await payload.db.deleteMany({\n collection: jobsCollectionSlug,\n req,\n where: {\n and: [\n { concurrencyKey: { equals: concurrencyKey } },\n { processing: { equals: false } },\n { completedAt: { exists: false } },\n ],\n },\n })\n }\n }\n }\n\n type ReturnType = TTaskOrWorkflowSlug extends keyof TypedJobs['workflows']\n ? Job<TTaskOrWorkflowSlug>\n : RunningJobFromTask<TTaskOrWorkflowSlug> // Type assertion is still needed here\n\n return jobAfterRead({\n config: payload.config,\n doc: await payload.db.create({\n collection: jobsCollectionSlug,\n data,\n req,\n }),\n }) as unknown as ReturnType\n },\n\n run: async (args?: {\n /**\n * If you want to run jobs from all queues, set this to true.\n * If you set this to true, the `queue` property will be ignored.\n *\n * @default false\n */\n allQueues?: boolean\n /**\n * The maximum number of jobs to run in this invocation\n *\n * @default 10\n */\n limit?: number\n /**\n * If set to false, access control as defined in jobsConfig.access.run will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.run defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n /**\n * Adjust the job processing order using a Payload sort string.\n *\n * FIFO would equal `createdAt` and LIFO would equal `-createdAt`.\n */\n processingOrder?: Sort\n /**\n * If you want to run jobs from a specific queue, set this to the queue name.\n *\n * @default jobs from the `default` queue will be executed.\n */\n queue?: string\n req?: PayloadRequest\n /**\n * By default, jobs are run in parallel.\n * If you want to run them in sequence, set this to true.\n */\n sequential?: boolean\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n where?: Where\n }): Promise<ReturnType<typeof runJobs>> => {\n const newReq: PayloadRequest = args?.req ?? (await createLocalReq({}, payload))\n\n return await runJobs({\n allQueues: args?.allQueues,\n limit: args?.limit,\n overrideAccess: args?.overrideAccess !== false,\n processingOrder: args?.processingOrder,\n queue: args?.queue,\n req: newReq,\n sequential: args?.sequential,\n silent: args?.silent,\n where: args?.where,\n })\n },\n\n runByID: async (args: {\n id: number | string\n /**\n * If set to false, access control as defined in jobsConfig.access.run will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.run defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n req?: PayloadRequest\n /**\n * If set to true, the job system will not log any output to the console (for both info and error logs).\n * Can be an option for more granular control over logging.\n *\n * This will not automatically affect user-configured logs (e.g. if you call `console.log` or `payload.logger.info` in your job code).\n *\n * @default false\n */\n silent?: RunJobsSilent\n }): Promise<ReturnType<typeof runJobs>> => {\n const newReq: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n return await runJobs({\n id: args.id,\n overrideAccess: args.overrideAccess !== false,\n req: newReq,\n silent: args.silent,\n })\n },\n\n cancel: async (args: {\n /**\n * If set to false, access control as defined in jobsConfig.access.cancel will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.cancel defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n queue?: string\n req?: PayloadRequest\n where: Where\n }): Promise<void> => {\n const req: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n const overrideAccess = args.overrideAccess !== false\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.cancel will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = payload.config.jobs?.access?.cancel ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n const and: Where[] = [\n args.where,\n {\n completedAt: {\n exists: false,\n },\n },\n {\n hasError: {\n not_equals: true,\n },\n },\n ]\n\n if (args.queue) {\n and.push({\n queue: {\n equals: args.queue,\n },\n })\n }\n\n await updateJobs({\n data: {\n completedAt: null,\n error: {\n cancelled: true,\n },\n hasError: true,\n processing: false,\n waitUntil: null,\n },\n req,\n returning: false,\n where: { and },\n })\n },\n\n cancelByID: async (args: {\n id: number | string\n /**\n * If set to false, access control as defined in jobsConfig.access.cancel will be run.\n * By default, this is true and no access control will be run.\n * If you set this to false and do not have jobsConfig.access.cancel defined, the default access control will be\n * run (which is a function that returns `true` if the user is logged in).\n *\n * @default true\n */\n overrideAccess?: boolean\n req?: PayloadRequest\n }): Promise<void> => {\n const req: PayloadRequest = args.req ?? (await createLocalReq({}, payload))\n\n const overrideAccess = args.overrideAccess !== false\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.cancel will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = payload.config.jobs?.access?.cancel ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n\n await updateJob({\n id: args.id,\n data: {\n completedAt: null,\n error: {\n cancelled: true,\n },\n hasError: true,\n processing: false,\n waitUntil: null,\n },\n req,\n returning: false,\n })\n },\n})\n"],"names":["createLocalReq","Forbidden","jobAfterRead","jobsCollectionSlug","handleSchedules","runJobs","updateJob","updateJobs","getJobsLocalAPI","payload","args","newReq","req","allQueues","queue","overrideAccess","accessFn","config","jobs","access","hasAccess","t","undefined","workflow","workflows","find","slug","data","input","waitUntil","toISOString","workflowSlug","task","taskSlug","meta","enableConcurrencyControl","concurrencyKey","supersedes","queueName","concurrency","concurrencyConfig","key","tasks","db","deleteMany","collection","where","and","equals","processing","completedAt","exists","doc","create","run","limit","processingOrder","sequential","silent","runByID","id","cancel","hasError","not_equals","push","error","cancelled","returning","c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