payload 4.0.0-internal.5b1e7cd → 4.0.0-internal.5f0cd13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/RichText.d.ts +3 -16
- package/dist/admin/RichText.d.ts.map +1 -1
- package/dist/admin/RichText.js.map +1 -1
- package/dist/admin/adapters/cookies.d.ts +21 -0
- package/dist/admin/adapters/cookies.d.ts.map +1 -0
- package/dist/admin/adapters/cookies.js +3 -0
- package/dist/admin/adapters/cookies.js.map +1 -0
- package/dist/admin/adapters/index.d.ts +4 -0
- package/dist/admin/adapters/index.d.ts.map +1 -0
- package/dist/admin/adapters/index.js +3 -0
- package/dist/admin/adapters/index.js.map +1 -0
- package/dist/admin/adapters/router.d.ts +56 -0
- package/dist/admin/adapters/router.d.ts.map +1 -0
- package/dist/admin/adapters/router.js +3 -0
- package/dist/admin/adapters/router.js.map +1 -0
- package/dist/admin/adapters/server.d.ts +23 -0
- package/dist/admin/adapters/server.d.ts.map +1 -0
- package/dist/admin/adapters/server.js +6 -0
- package/dist/admin/adapters/server.js.map +1 -0
- 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/elements/Table.d.ts +1 -0
- package/dist/admin/elements/Table.d.ts.map +1 -1
- package/dist/admin/elements/Table.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 +10 -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 +47 -2
- package/dist/admin/views/list.d.ts.map +1 -1
- package/dist/admin/views/list.js.map +1 -1
- package/dist/auth/cookies.d.ts.map +1 -1
- package/dist/auth/defaultAccess.d.ts.map +1 -1
- package/dist/auth/ensureUsernameOrEmail.d.ts.map +1 -1
- package/dist/auth/executeAccess.d.ts.map +1 -1
- package/dist/auth/executeAuthStrategies.d.ts.map +1 -1
- package/dist/auth/extractAccessFromPermission.d.ts.map +1 -1
- package/dist/auth/extractJWT.d.ts.map +1 -1
- package/dist/auth/getAuthFields.d.ts.map +1 -1
- package/dist/auth/getFieldsToSign.d.ts.map +1 -1
- package/dist/auth/getLoginOptions.d.ts.map +1 -1
- package/dist/auth/isUserLocked.d.ts.map +1 -1
- package/dist/auth/jwt.d.ts.map +1 -1
- package/dist/auth/operations/access.d.ts.map +1 -1
- package/dist/auth/operations/auth.d.ts.map +1 -1
- package/dist/auth/operations/forgotPassword.d.ts.map +1 -1
- package/dist/auth/operations/init.d.ts.map +1 -1
- package/dist/auth/operations/local/auth.d.ts.map +1 -1
- package/dist/auth/operations/login.d.ts.map +1 -1
- package/dist/auth/operations/logout.d.ts.map +1 -1
- package/dist/auth/operations/me.d.ts.map +1 -1
- package/dist/auth/operations/refresh.d.ts.map +1 -1
- package/dist/auth/operations/registerFirstUser.d.ts.map +1 -1
- package/dist/auth/operations/resetPassword.d.ts.map +1 -1
- package/dist/auth/operations/unlock.d.ts.map +1 -1
- package/dist/auth/operations/verifyEmail.d.ts.map +1 -1
- package/dist/auth/sessions.d.ts.map +1 -1
- package/dist/auth/strategies/apiKey.d.ts.map +1 -1
- package/dist/auth/strategies/apiKey.js +6 -17
- package/dist/auth/strategies/apiKey.js.map +1 -1
- package/dist/auth/strategies/local/authenticate.d.ts.map +1 -1
- package/dist/auth/strategies/local/generatePasswordSaltHash.d.ts.map +1 -1
- package/dist/auth/strategies/local/incrementLoginAttempts.d.ts.map +1 -1
- package/dist/auth/strategies/local/register.d.ts.map +1 -1
- package/dist/auth/strategies/local/resetLoginAttempts.d.ts.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/iterateFields.d.ts.map +1 -1
- package/dist/bin/generateImportMap/iterateFields.js +4 -1
- package/dist/bin/generateImportMap/iterateFields.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/generateImportMap/utilities/getFromImportMap.d.ts.map +1 -1
- package/dist/bin/generateTypes.d.ts.map +1 -1
- package/dist/bin/generateTypes.js +7 -1
- package/dist/bin/generateTypes.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/bin/migrate.d.ts.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.d.ts.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 +10 -1
- package/dist/collections/config/sanitize.d.ts.map +1 -1
- package/dist/collections/config/sanitize.js +51 -10
- package/dist/collections/config/sanitize.js.map +1 -1
- package/dist/collections/config/sanitizeCompoundIndexes.d.ts.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/config/useAsTitle.d.ts.map +1 -1
- package/dist/collections/dataloader.d.ts.map +1 -1
- package/dist/collections/operations/count.d.ts.map +1 -1
- package/dist/collections/operations/countVersions.d.ts.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/duplicate.d.ts.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/findDistinct.d.ts.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/buildAfterOperation.d.ts.map +1 -1
- package/dist/collections/operations/utilities/sanitizeSortQuery.d.ts.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/build.d.ts.map +1 -1
- package/dist/config/build.js +8 -0
- package/dist/config/build.js.map +1 -1
- package/dist/config/client.d.ts +1 -1
- package/dist/config/client.d.ts.map +1 -1
- package/dist/config/client.js +2 -11
- 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 +6 -53
- package/dist/config/sanitize.js.map +1 -1
- package/dist/config/types.d.ts +188 -32
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js.map +1 -1
- package/dist/database/combineQueries.d.ts.map +1 -1
- package/dist/database/migrations/findMigrationDir.d.ts.map +1 -1
- package/dist/database/migrations/getPredefinedMigration.d.ts.map +1 -1
- package/dist/database/migrations/readMigrationFiles.d.ts.map +1 -1
- package/dist/database/migrations/templates/localizeStatus.d.ts.map +1 -1
- package/dist/database/migrations/writeMigrationIndex.d.ts.map +1 -1
- package/dist/database/sanitizeJoinQuery.d.ts.map +1 -1
- package/dist/database/sanitizeWhereQuery.d.ts.map +1 -1
- package/dist/duplicateDocument/index.d.ts.map +1 -1
- package/dist/email/getStringifiedToAddress.d.ts.map +1 -1
- package/dist/exports/shared.d.ts +6 -3
- package/dist/exports/shared.d.ts.map +1 -1
- package/dist/exports/shared.js +4 -2
- package/dist/exports/shared.js.map +1 -1
- package/dist/fields/baseFields/slug/countVersions.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/generateSlug.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/index.d.ts.map +1 -1
- package/dist/fields/baseFields/slug/index.js +7 -5
- package/dist/fields/baseFields/slug/index.js.map +1 -1
- package/dist/fields/config/client.d.ts +1 -1
- package/dist/fields/config/client.d.ts.map +1 -1
- package/dist/fields/config/client.js +4 -3
- 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 +13 -20
- 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 +44 -118
- package/dist/fields/config/types.d.ts.map +1 -1
- package/dist/fields/config/types.js +12 -2
- package/dist/fields/config/types.js.map +1 -1
- package/dist/fields/getDefaultValue.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/promise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/afterRead/virtualFieldPopulationPromise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/cloneDataFromOriginalDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/getExistingRowDoc.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeDuplicate/traverseFields.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/index.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/promise.d.ts.map +1 -1
- package/dist/fields/hooks/beforeValidate/traverseFields.d.ts.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/mergeBaseFields.d.ts.map +1 -1
- package/dist/fields/setDefaultBeforeDuplicate.d.ts.map +1 -1
- 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 +6 -1
- package/dist/globals/config/sanitize.d.ts.map +1 -1
- package/dist/globals/config/sanitize.js +6 -2
- 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/countGlobalVersions.d.ts.map +1 -1
- package/dist/globals/operations/docAccess.d.ts.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/restoreVersion.d.ts.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 +119 -0
- package/dist/hierarchy/sanitizeHierarchyCollection.js.map +1 -0
- package/dist/hierarchy/types.d.ts +162 -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 +1017 -672
- package/dist/index.d.ts +32 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/kv/adapters/DatabaseKVAdapter.d.ts.map +1 -1
- package/dist/locked-documents/config.d.ts.map +1 -1
- package/dist/preferences/config.d.ts.map +1 -1
- package/dist/preferences/deleteUserPreferences.d.ts.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/access.d.ts.map +1 -1
- package/dist/query-presets/config.d.ts.map +1 -1
- package/dist/query-presets/config.js +11 -7
- package/dist/query-presets/config.js.map +1 -1
- package/dist/query-presets/constraints.d.ts.map +1 -1
- package/dist/query-presets/constraints.js +1 -1
- package/dist/query-presets/constraints.js.map +1 -1
- package/dist/queues/config/generateJobsJSONSchemas.d.ts +1 -1
- package/dist/queues/config/generateJobsJSONSchemas.d.ts.map +1 -1
- package/dist/queues/config/generateJobsJSONSchemas.js +31 -10
- package/dist/queues/config/generateJobsJSONSchemas.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/endpoints/run.d.ts.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/getQueuesWithSchedules.d.ts.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/runJSONJob/index.d.ts.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/operations/runJobs/runJob/index.d.ts.map +1 -1
- package/dist/queues/utilities/getJobTaskStatus.d.ts.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/translations/getLocalI18n.d.ts.map +1 -1
- package/dist/types/index.d.ts +54 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/uploads/checkFileAccess.d.ts.map +1 -1
- package/dist/uploads/checkFileRestrictions.d.ts.map +1 -1
- package/dist/uploads/docWithFilenameExists.d.ts.map +1 -1
- package/dist/uploads/endpoints/getFileFromURL.d.ts.map +1 -1
- package/dist/uploads/endpoints/getFileFromURL.js +9 -5
- package/dist/uploads/endpoints/getFileFromURL.js.map +1 -1
- package/dist/uploads/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -1
- package/dist/uploads/fetchAPI-multipart/processNested.d.ts.map +1 -1
- package/dist/uploads/fetchAPI-multipart/utilities.d.ts.map +1 -1
- package/dist/uploads/fileExists.d.ts.map +1 -1
- package/dist/uploads/generateFileData.d.ts.map +1 -1
- package/dist/uploads/getBaseFields.d.ts.map +1 -1
- package/dist/uploads/getBaseFields.js +24 -70
- package/dist/uploads/getBaseFields.js.map +1 -1
- package/dist/uploads/getExternalFile.d.ts.map +1 -1
- package/dist/uploads/getFileByPath.d.ts.map +1 -1
- package/dist/uploads/getFileTypeFallback.d.ts.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/uploads/image-resizing/createImageSize.d.ts.map +1 -1
- package/dist/uploads/image-resizing/generateImageSizeFilename.d.ts.map +1 -1
- package/dist/uploads/image-resizing/getImageResizeAction.d.ts.map +1 -1
- package/dist/uploads/image-resizing/parseFilename.d.ts.map +1 -1
- package/dist/uploads/image-resizing/sanitizeResizeConfig.d.ts.map +1 -1
- package/dist/uploads/mimeTypeValidator.d.ts.map +1 -1
- package/dist/uploads/safeFetch.d.ts +1 -1
- package/dist/uploads/safeFetch.d.ts.map +1 -1
- package/dist/uploads/saveBufferToFile.d.ts.map +1 -1
- package/dist/uploads/tempFile.d.ts.map +1 -1
- package/dist/uploads/types.d.ts +12 -29
- package/dist/uploads/types.d.ts.map +1 -1
- package/dist/uploads/types.js.map +1 -1
- package/dist/uploads/uploadFiles.d.ts.map +1 -1
- package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
- package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.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/appendNonTrashedFilter.d.ts.map +1 -1
- 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/canAccessAdmin.d.ts.map +1 -1
- package/dist/utilities/checkDocumentLockStatus.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.d.ts +34 -16
- package/dist/utilities/configToJSONSchema.d.ts.map +1 -1
- package/dist/utilities/configToJSONSchema.js +127 -52
- package/dist/utilities/configToJSONSchema.js.map +1 -1
- package/dist/utilities/configToJSONSchema.spec.js +94 -65
- package/dist/utilities/configToJSONSchema.spec.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/deepCopyObject.d.ts.map +1 -1
- package/dist/utilities/dependencies/resolveFrom.d.ts.map +1 -1
- package/dist/utilities/escapeRegExp.d.ts.map +1 -1
- package/dist/utilities/extractID.d.ts.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/formatAdminURL.d.ts +13 -2
- package/dist/utilities/formatAdminURL.d.ts.map +1 -1
- package/dist/utilities/formatAdminURL.js +3 -15
- package/dist/utilities/formatAdminURL.js.map +1 -1
- package/dist/utilities/formatAdminURL.spec.js +1 -90
- package/dist/utilities/formatAdminURL.spec.js.map +1 -1
- package/dist/utilities/formatErrors.d.ts.map +1 -1
- package/dist/utilities/formatLabels.d.ts.map +1 -1
- package/dist/utilities/getBestFitFromSizes.d.ts.map +1 -1
- package/dist/utilities/getBlockSelect.d.ts.map +1 -1
- package/dist/utilities/getDataByPath.d.ts.map +1 -1
- package/dist/utilities/getEntityPermissions/populateFieldPermissions.d.ts.map +1 -1
- package/dist/utilities/getFieldByPath.d.ts.map +1 -1
- package/dist/utilities/getFieldPermissions.d.ts.map +1 -1
- package/dist/utilities/getObjectDotNotation.d.ts.map +1 -1
- package/dist/utilities/getRequestEntity.d.ts.map +1 -1
- package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
- package/dist/utilities/getRequestOrigin.d.ts.map +1 -1
- package/dist/utilities/getSafeRedirect.d.ts.map +1 -1
- package/dist/utilities/getSelectMode.d.ts.map +1 -1
- package/dist/utilities/getSiblingData.d.ts.map +1 -1
- package/dist/utilities/getTranslatedLabel.d.ts.map +1 -1
- package/dist/utilities/getVersionsConfig.d.ts.map +1 -1
- package/dist/utilities/handleEndpoints.d.ts.map +1 -1
- package/dist/utilities/handleEndpoints.js +2 -6
- package/dist/utilities/handleEndpoints.js.map +1 -1
- package/dist/utilities/headersWithCors.d.ts.map +1 -1
- package/dist/utilities/isEntityHidden.d.ts.map +1 -1
- package/dist/utilities/isURLAllowed.d.ts.map +1 -1
- package/dist/utilities/isValidID.d.ts.map +1 -1
- package/dist/utilities/logError.d.ts.map +1 -1
- package/dist/utilities/logger.d.ts.map +1 -1
- package/dist/utilities/mergeHeaders.d.ts.map +1 -1
- package/dist/utilities/mergeListSearchAndWhere.d.ts.map +1 -1
- package/dist/utilities/optionsAreEqual.d.ts.map +1 -1
- package/dist/utilities/parseBooleanString.d.ts.map +1 -1
- package/dist/utilities/parseCookies.d.ts.map +1 -1
- package/dist/utilities/parseParams/index.d.ts.map +1 -1
- package/dist/utilities/profiling.d.ts.map +1 -1
- package/dist/utilities/reduceFieldsToValues.d.ts.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/routeError.d.ts.map +1 -1
- package/dist/utilities/sanitizeFallbackLocale.d.ts.map +1 -1
- package/dist/utilities/sanitizeInternalFields.d.ts.map +1 -1
- package/dist/utilities/sanitizeJoinParams.d.ts.map +1 -1
- package/dist/utilities/sanitizePopulateParam.d.ts.map +1 -1
- 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/utilities/sanitizeSelectParam.d.ts.map +1 -1
- package/dist/utilities/sanitizeSortParams.d.ts.map +1 -1
- package/dist/utilities/setsAreEqual.d.ts.map +1 -1
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/stripUnselectedFields.d.ts.map +1 -1
- package/dist/utilities/telemetry/events/adminInit.d.ts.map +1 -1
- package/dist/utilities/telemetry/events/serverInit.d.ts.map +1 -1
- package/dist/utilities/telemetry/index.d.ts.map +1 -1
- package/dist/utilities/telemetry/oneWayHash.d.ts.map +1 -1
- package/dist/utilities/timestamp.d.ts.map +1 -1
- package/dist/utilities/toKebabCase.d.ts.map +1 -1
- package/dist/utilities/transformColumnPreferences.d.ts.map +1 -1
- package/dist/utilities/transformWhereQuery.d.ts.map +1 -1
- package/dist/utilities/traverseFields.d.ts.map +1 -1
- package/dist/utilities/traverseForLocalizedFields.d.ts.map +1 -1
- package/dist/utilities/unflatten.d.ts.map +1 -1
- package/dist/utilities/validateMimeType.d.ts.map +1 -1
- package/dist/utilities/validateTimezones.d.ts.map +1 -1
- package/dist/utilities/validateWhereQuery.d.ts.map +1 -1
- package/dist/utilities/wordBoundariesRegex.d.ts.map +1 -1
- package/dist/utilities/wrapInternalEndpoints.d.ts.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/buildVersionCompoundIndexes.d.ts.map +1 -1
- package/dist/versions/deleteCollectionVersions.d.ts.map +1 -1
- package/dist/versions/deleteScheduledPublishJobs.d.ts.map +1 -1
- package/dist/versions/drafts/appendVersionToQueryKey.d.ts.map +1 -1
- package/dist/versions/drafts/getQueryDraftsSelect.d.ts.map +1 -1
- package/dist/versions/drafts/getQueryDraftsSort.d.ts.map +1 -1
- package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts.map +1 -1
- package/dist/versions/enforceMaxVersions.d.ts.map +1 -1
- package/dist/versions/getLatestCollectionVersion.d.ts.map +1 -1
- package/dist/versions/getLatestGlobalVersion.d.ts.map +1 -1
- package/dist/versions/migrations/localizeStatus/shared.d.ts.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/dist/versions/saveSnapshot.d.ts.map +1 -1
- package/dist/versions/schedule/job.d.ts.map +1 -1
- package/package.json +20 -20
- 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,"sources":["../../../../src/queues/operations/runJobs/index.ts"],"sourcesContent":["import type { Job } from '../../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../../types/index.js'\nimport type { WorkflowJSON } from '../../config/types/workflowJSONTypes.js'\nimport type { WorkflowConfig, WorkflowHandler } from '../../config/types/workflowTypes.js'\nimport type { RunJobsSilent } from '../../localAPI.js'\nimport type { RunJobResult } from './runJob/index.js'\n\nimport { Forbidden } from '../../../errors/Forbidden.js'\nimport { isolateObjectProperty } from '../../../utilities/isolateObjectProperty.js'\nimport { jobsCollectionSlug } from '../../config/collection.js'\nimport { JobCancelledError } from '../../errors/index.js'\nimport { getCurrentDate } from '../../utilities/getCurrentDate.js'\nimport { updateJob, updateJobs } from '../../utilities/updateJob.js'\nimport { getUpdateJobFunction } from './runJob/getUpdateJobFunction.js'\nimport { importHandlerPath } from './runJob/importHandlerPath.js'\nimport { runJob } from './runJob/index.js'\nimport { runJSONJob } from './runJSONJob/index.js'\n\nexport type RunJobsArgs = {\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 * ID of the job to run\n */\n id?: number | string\n /**\n * The maximum number of jobs to run in this invocation\n *\n * @default 10\n */\n limit?: number\n overrideAccess?: boolean\n /**\n * Adjust the job processing order\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?: 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}\n\nexport type RunJobsResult = {\n jobStatus?: Record<string, RunJobResult>\n /**\n * If this is true, there for sure are no jobs remaining, regardless of the limit\n */\n noJobsRemaining?: boolean\n /**\n * Out of the jobs that were queried & processed (within the set limit), how many are remaining and retryable?\n */\n remainingJobsFromQueried: number\n}\n\nexport const runJobs = async (args: RunJobsArgs): Promise<RunJobsResult> => {\n const {\n id,\n allQueues = false,\n limit = 10,\n overrideAccess,\n processingOrder,\n queue = 'default',\n req,\n req: {\n payload,\n payload: {\n config: { jobs: jobsConfig },\n },\n },\n sequential,\n silent = false,\n where: whereFromProps,\n } = args\n\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.run will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = jobsConfig?.access?.run ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n const and: Where[] = [\n {\n completedAt: {\n exists: false,\n },\n },\n {\n hasError: {\n not_equals: true,\n },\n },\n {\n processing: {\n equals: false,\n },\n },\n {\n or: [\n {\n waitUntil: {\n exists: false,\n },\n },\n {\n waitUntil: {\n less_than: getCurrentDate().toISOString(),\n },\n },\n ],\n },\n ]\n\n if (allQueues !== true) {\n and.push({\n queue: {\n equals: queue ?? 'default',\n },\n })\n }\n\n if (whereFromProps) {\n and.push(whereFromProps)\n }\n\n // Only enforce concurrency controls if the feature is enabled\n if (jobsConfig.enableConcurrencyControl) {\n // Find currently running jobs with concurrency keys to enforce exclusive concurrency\n // Jobs with the same concurrencyKey should not run in parallel\n const runningJobsWithConcurrency = await payload.db.find({\n collection: jobsCollectionSlug,\n limit: 0,\n pagination: false,\n req: { transactionID: undefined },\n select: {\n concurrencyKey: true,\n },\n where: {\n and: [{ processing: { equals: true } }, { concurrencyKey: { exists: true } }],\n },\n })\n\n const runningConcurrencyKeys = new Set<string>()\n if (runningJobsWithConcurrency?.docs) {\n for (const doc of runningJobsWithConcurrency.docs) {\n const concurrencyKey = (doc as Job).concurrencyKey\n if (concurrencyKey) {\n runningConcurrencyKeys.add(concurrencyKey)\n }\n }\n }\n\n // Exclude jobs whose concurrencyKey is already running\n if (runningConcurrencyKeys.size > 0) {\n and.push({\n or: [\n // Jobs without a concurrency key can always run\n { concurrencyKey: { exists: false } },\n // Jobs with a concurrency key that is not currently running can run\n { concurrencyKey: { not_in: [...runningConcurrencyKeys] } },\n ],\n })\n }\n }\n\n // Find all jobs and ensure we set job to processing: true as early as possible to reduce the chance of\n // the same job being picked up by another worker\n let jobs: Job[] = []\n\n if (id) {\n // Only one job to run\n const job = await updateJob({\n id,\n data: {\n processing: true,\n },\n depth: jobsConfig.depth,\n disableTransaction: true,\n req,\n returning: true,\n })\n if (job) {\n jobs = [job]\n }\n } else {\n let defaultProcessingOrder: Sort =\n payload.collections[jobsCollectionSlug]?.config.defaultSort ?? 'createdAt'\n\n const processingOrderConfig = jobsConfig.processingOrder\n if (typeof processingOrderConfig === 'function') {\n defaultProcessingOrder = await processingOrderConfig(args)\n } else if (typeof processingOrderConfig === 'object' && !Array.isArray(processingOrderConfig)) {\n if (\n !allQueues &&\n queue &&\n processingOrderConfig.queues &&\n processingOrderConfig.queues[queue]\n ) {\n defaultProcessingOrder = processingOrderConfig.queues[queue]\n } else if (processingOrderConfig.default) {\n defaultProcessingOrder = processingOrderConfig.default\n }\n } else if (typeof processingOrderConfig === 'string') {\n defaultProcessingOrder = processingOrderConfig\n }\n const updatedDocs = await updateJobs({\n data: {\n processing: true,\n },\n depth: jobsConfig.depth,\n disableTransaction: true,\n limit,\n req,\n returning: true,\n sort: processingOrder ?? defaultProcessingOrder,\n where: { and },\n })\n\n if (updatedDocs) {\n jobs = updatedDocs\n }\n }\n\n if (!jobs.length) {\n return {\n noJobsRemaining: true,\n remainingJobsFromQueried: 0,\n }\n }\n\n // Only handle concurrency deduplication if the feature is enabled\n if (jobsConfig.enableConcurrencyControl) {\n // Handle the case where multiple jobs with the same concurrencyKey were picked up in the same batch\n // We should only run one job per concurrencyKey, release the others back to pending\n const seenConcurrencyKeys = new Set<string>()\n const jobsToRun: Job[] = []\n const jobsToRelease: Job[] = []\n\n for (const job of jobs) {\n if (job.concurrencyKey) {\n if (seenConcurrencyKeys.has(job.concurrencyKey)) {\n // This job has the same concurrencyKey as another job we're already running\n jobsToRelease.push(job)\n } else {\n seenConcurrencyKeys.add(job.concurrencyKey)\n jobsToRun.push(job)\n }\n } else {\n jobsToRun.push(job)\n }\n }\n\n // Release duplicate concurrencyKey jobs back to pending state\n if (jobsToRelease.length > 0) {\n const releaseIds = jobsToRelease.map((job) => job.id)\n await updateJobs({\n data: { processing: false },\n disableTransaction: true,\n req,\n returning: false,\n where: { id: { in: releaseIds } },\n })\n }\n\n // Use only the filtered jobs going forward\n jobs = jobsToRun\n }\n\n if (!jobs.length) {\n return {\n noJobsRemaining: false,\n remainingJobsFromQueried: 0,\n }\n }\n\n if (!silent || (typeof silent === 'object' && !silent.info)) {\n let newCount = 0\n let retryCount = 0\n\n for (const job of jobs) {\n if (job.totalTried > 0) {\n retryCount++\n } else {\n newCount++\n }\n }\n\n payload.logger.info({\n msg: `Running ${jobs.length} jobs.`,\n new: newCount,\n retrying: retryCount,\n })\n }\n\n const successfullyCompletedJobs: (number | string)[] = []\n\n const runSingleJob = async (\n job: Job,\n ): Promise<{\n id: number | string\n result: RunJobResult\n }> => {\n if (!job.workflowSlug && !job.taskSlug) {\n throw new Error('Job must have either a workflowSlug or a taskSlug')\n }\n const jobReq = isolateObjectProperty(req, 'transactionID')\n\n const workflowConfig: WorkflowConfig =\n job.workflowSlug && jobsConfig.workflows?.length\n ? jobsConfig.workflows.find(({ slug }) => slug === job.workflowSlug)!\n : {\n slug: 'singleTask',\n handler: async ({ job, tasks }) => {\n await tasks[job.taskSlug as string]!('1', {\n input: job.input,\n })\n },\n }\n\n if (!workflowConfig) {\n return {\n id: job.id,\n result: {\n status: 'error',\n },\n } // Skip jobs with no workflow configuration\n }\n\n try {\n const updateJob = getUpdateJobFunction(job, jobReq)\n\n // the runner will either be passed to the config\n // OR it will be a path, which we will need to import via eval to avoid\n // Next.js compiler dynamic import expression errors\n let workflowHandler: WorkflowHandler | WorkflowJSON\n if (\n typeof workflowConfig.handler === 'function' ||\n (typeof workflowConfig.handler === 'object' && Array.isArray(workflowConfig.handler))\n ) {\n workflowHandler = workflowConfig.handler\n } else {\n workflowHandler = await importHandlerPath<typeof workflowHandler>(workflowConfig.handler)\n\n if (!workflowHandler) {\n const jobLabel = job.workflowSlug || `Task: ${job.taskSlug}`\n const errorMessage = `Can't find runner while importing with the path ${workflowConfig.handler} in job type ${jobLabel}.`\n if (!silent || (typeof silent === 'object' && !silent.error)) {\n payload.logger.error(errorMessage)\n }\n\n await updateJob({\n error: {\n error: errorMessage,\n },\n hasError: true,\n processing: false,\n })\n\n return {\n id: job.id,\n result: {\n status: 'error-reached-max-retries',\n },\n }\n }\n }\n\n if (typeof workflowHandler === 'function') {\n const result = await runJob({\n job,\n req: jobReq,\n silent,\n updateJob,\n workflowConfig,\n workflowHandler,\n })\n\n if (result.status === 'success') {\n successfullyCompletedJobs.push(job.id)\n }\n\n return { id: job.id, result }\n } else {\n const result = await runJSONJob({\n job,\n req: jobReq,\n silent,\n updateJob,\n workflowConfig,\n workflowHandler,\n })\n\n if (result.status === 'success') {\n successfullyCompletedJobs.push(job.id)\n }\n\n return { id: job.id, result }\n }\n } catch (error) {\n if (error instanceof JobCancelledError) {\n if (\n !(job.error as Record<string, unknown> | undefined)?.cancelled ||\n !job.hasError ||\n job.processing ||\n job.completedAt ||\n job.waitUntil\n ) {\n // When using the local API to cancel jobs, the local API will update the job data for us to ensure the job is cancelled.\n // But when throwing a JobCancelledError within a task or workflow handler, we are responsible for updating the job data ourselves.\n await updateJob({\n id: job.id,\n data: {\n completedAt: null,\n error: {\n cancelled: true,\n message: error.message,\n },\n hasError: true,\n processing: false,\n waitUntil: null,\n },\n depth: 0,\n disableTransaction: true,\n req,\n returning: false,\n })\n }\n\n return {\n id: job.id,\n result: {\n status: 'error-reached-max-retries',\n },\n }\n }\n throw error\n }\n }\n\n let resultsArray: { id: number | string; result: RunJobResult }[] = []\n if (sequential) {\n for (const job of jobs) {\n const result = await runSingleJob(job)\n if (result) {\n resultsArray.push(result)\n }\n }\n } else {\n const jobPromises = jobs.map(runSingleJob)\n resultsArray = (await Promise.all(jobPromises)) as {\n id: number | string\n result: RunJobResult\n }[]\n }\n\n if (jobsConfig.deleteJobOnComplete && successfullyCompletedJobs.length) {\n try {\n if (jobsConfig.runHooks) {\n await payload.delete({\n collection: jobsCollectionSlug,\n depth: 0, // can be 0 since we're not returning anything\n disableTransaction: true,\n where: { id: { in: successfullyCompletedJobs } },\n })\n } else {\n await payload.db.deleteMany({\n collection: jobsCollectionSlug,\n where: { id: { in: successfullyCompletedJobs } },\n })\n }\n } catch (err) {\n if (!silent || (typeof silent === 'object' && !silent.error)) {\n payload.logger.error({\n err,\n msg: `Failed to delete jobs ${successfullyCompletedJobs.join(', ')} on complete`,\n })\n }\n }\n }\n\n const resultsObject: RunJobsResult['jobStatus'] = resultsArray.reduce(\n (acc, cur) => {\n if (cur !== null) {\n // Check if there's a valid result to include\n acc[cur.id] = cur.result\n }\n return acc\n },\n {} as Record<string, RunJobResult>,\n )\n\n let remainingJobsFromQueried = 0\n for (const jobID in resultsObject) {\n const jobResult = resultsObject[jobID]\n if (jobResult?.status === 'error') {\n remainingJobsFromQueried++ // Can be retried\n }\n }\n\n return {\n jobStatus: resultsObject,\n remainingJobsFromQueried,\n }\n}\n"],"names":["Forbidden","isolateObjectProperty","jobsCollectionSlug","JobCancelledError","getCurrentDate","updateJob","updateJobs","getUpdateJobFunction","importHandlerPath","runJob","runJSONJob","runJobs","args","id","allQueues","limit","overrideAccess","processingOrder","queue","req","payload","config","jobs","jobsConfig","sequential","silent","where","whereFromProps","accessFn","access","run","hasAccess","t","and","completedAt","exists","hasError","not_equals","processing","equals","or","waitUntil","less_than","toISOString","push","enableConcurrencyControl","runningJobsWithConcurrency","db","find","collection","pagination","transactionID","undefined","select","concurrencyKey","runningConcurrencyKeys","Set","docs","doc","add","size","not_in","job","data","depth","disableTransaction","returning","defaultProcessingOrder","collections","defaultSort","processingOrderConfig","Array","isArray","queues","default","updatedDocs","sort","length","noJobsRemaining","remainingJobsFromQueried","seenConcurrencyKeys","jobsToRun","jobsToRelease","has","releaseIds","map","in","info","newCount","retryCount","totalTried","logger","msg","new","retrying","successfullyCompletedJobs","runSingleJob","workflowSlug","taskSlug","Error","jobReq","workflowConfig","workflows","slug","handler","tasks","input","result","status","workflowHandler","jobLabel","errorMessage","error","cancelled","message","resultsArray","jobPromises","Promise","all","deleteJobOnComplete","runHooks","delete","deleteMany","err","join","resultsObject","reduce","acc","cur","jobID","jobResult","jobStatus"],"mappings":"AAOA,SAASA,SAAS,QAAQ,+BAA8B;AACxD,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,iBAAiB,QAAQ,wBAAuB;AACzD,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,SAAS,EAAEC,UAAU,QAAQ,+BAA8B;AACpE,SAASC,oBAAoB,QAAQ,mCAAkC;AACvE,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,MAAM,QAAQ,oBAAmB;AAC1C,SAASC,UAAU,QAAQ,wBAAuB;AAiElD,OAAO,MAAMC,UAAU,OAAOC;IAC5B,MAAM,EACJC,EAAE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AC;oBACnBxE,YAAY/C;oBACZ8D,OAAO;oBACPC,oBAAoB;oBACpBvC,OAAO;wBAAEb,IAAI;4BAAEyE,IAAIS;wBAA0B;oBAAE;gBACjD;YACF,OAAO;gBACL,MAAM3E,QAAQ2B,EAAE,CAAC2E,UAAU,CAAC;oBAC1BzE,YAAY/C;oBACZwB,OAAO;wBAAEb,IAAI;4BAAEyE,IAAIS;wBAA0B;oBAAE;gBACjD;YACF;QACF,EAAE,OAAO4B,KAAK;YACZ,IAAI,CAAClG,UAAW,OAAOA,WAAW,YAAY,CAACA,OAAOuF,KAAK,EAAG;gBAC5D5F,QAAQuE,MAAM,CAACqB,KAAK,CAAC;oBACnBW;oBACA/B,KAAK,CAAC,sBAAsB,EAAEG,0BAA0B6B,IAAI,CAAC,MAAM,YAAY,CAAC;gBAClF;YACF;QACF;IACF;IAEA,MAAMC,gBAA4CV,aAAaW,MAAM,CACnE,CAACC,KAAKC;QACJ,IAAIA,QAAQ,MAAM;YAChB,6CAA6C;YAC7CD,GAAG,CAACC,IAAInH,EAAE,CAAC,GAAGmH,IAAIrB,MAAM;QAC1B;QACA,OAAOoB;IACT,GACA,CAAC;IAGH,IAAIhD,2BAA2B;IAC/B,IAAK,MAAMkD,SAASJ,cAAe;QACjC,MAAMK,YAAYL,aAAa,CAACI,MAAM;QACtC,IAAIC,WAAWtB,WAAW,SAAS;YACjC7B,4BAA2B,iBAAiB;QAC9C;IACF;IAEA,OAAO;QACLoD,WAAWN;QACX9C;IACF;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/queues/operations/runJobs/index.ts"],"sourcesContent":["import type { Job } from '../../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../../types/index.js'\nimport type { WorkflowJSON } from '../../config/types/workflowJSONTypes.js'\nimport type { WorkflowConfig, WorkflowHandler } from '../../config/types/workflowTypes.js'\nimport type { RunJobsSilent } from '../../localAPI.js'\nimport type { RunJobResult } from './runJob/index.js'\n\nimport { Forbidden } from '../../../errors/Forbidden.js'\nimport { isolateObjectProperty } from '../../../utilities/isolateObjectProperty.js'\nimport { jobsCollectionSlug } from '../../config/collection.js'\nimport { JobCancelledError } from '../../errors/index.js'\nimport { getCurrentDate } from '../../utilities/getCurrentDate.js'\nimport { updateJob, updateJobs } from '../../utilities/updateJob.js'\nimport { getUpdateJobFunction } from './runJob/getUpdateJobFunction.js'\nimport { importHandlerPath } from './runJob/importHandlerPath.js'\nimport { runJob } from './runJob/index.js'\nimport { runJSONJob } from './runJSONJob/index.js'\n\nexport type RunJobsArgs = {\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 * ID of the job to run\n */\n id?: number | string\n /**\n * The maximum number of jobs to run in this invocation\n *\n * @default 10\n */\n limit?: number\n overrideAccess?: boolean\n /**\n * Adjust the job processing order\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?: 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}\n\nexport type RunJobsResult = {\n jobStatus?: Record<string, RunJobResult>\n /**\n * If this is true, there for sure are no jobs remaining, regardless of the limit\n */\n noJobsRemaining?: boolean\n /**\n * Out of the jobs that were queried & processed (within the set limit), how many are remaining and retryable?\n */\n remainingJobsFromQueried: number\n}\n\nexport const runJobs = async (args: RunJobsArgs): Promise<RunJobsResult> => {\n const {\n id,\n allQueues = false,\n limit = 10,\n overrideAccess,\n processingOrder,\n queue = 'default',\n req,\n req: {\n payload,\n payload: {\n config: { jobs: jobsConfig },\n },\n },\n sequential,\n silent = false,\n where: whereFromProps,\n } = args\n\n if (!overrideAccess) {\n /**\n * By default, jobsConfig.access.run will be `defaultAccess` which is a function that returns `true` if the user is logged in.\n */\n const accessFn = jobsConfig?.access?.run ?? (() => true)\n const hasAccess = await accessFn({ req })\n if (!hasAccess) {\n throw new Forbidden(req.t)\n }\n }\n const and: Where[] = [\n {\n completedAt: {\n exists: false,\n },\n },\n {\n hasError: {\n not_equals: true,\n },\n },\n {\n processing: {\n equals: false,\n },\n },\n {\n or: [\n {\n waitUntil: {\n exists: false,\n },\n },\n {\n waitUntil: {\n less_than: getCurrentDate().toISOString(),\n },\n },\n ],\n },\n ]\n\n if (allQueues !== true) {\n and.push({\n queue: {\n equals: queue ?? 'default',\n },\n })\n }\n\n if (whereFromProps) {\n and.push(whereFromProps)\n }\n\n // Only enforce concurrency controls if the feature is enabled\n if (jobsConfig.enableConcurrencyControl) {\n // Find currently running jobs with concurrency keys to enforce exclusive concurrency\n // Jobs with the same concurrencyKey should not run in parallel\n const runningJobsWithConcurrency = await payload.db.find({\n collection: jobsCollectionSlug,\n limit: 0,\n pagination: false,\n req: { transactionID: undefined },\n select: {\n concurrencyKey: true,\n },\n where: {\n and: [{ processing: { equals: true } }, { concurrencyKey: { exists: true } }],\n },\n })\n\n const runningConcurrencyKeys = new Set<string>()\n if (runningJobsWithConcurrency?.docs) {\n for (const doc of runningJobsWithConcurrency.docs) {\n const concurrencyKey = (doc as Job).concurrencyKey\n if (concurrencyKey) {\n runningConcurrencyKeys.add(concurrencyKey)\n }\n }\n }\n\n // Exclude jobs whose concurrencyKey is already running\n if (runningConcurrencyKeys.size > 0) {\n and.push({\n or: [\n // Jobs without a concurrency key can always run\n { concurrencyKey: { exists: false } },\n // Jobs with a concurrency key that is not currently running can run\n { concurrencyKey: { not_in: [...runningConcurrencyKeys] } },\n ],\n })\n }\n }\n\n // Find all jobs and ensure we set job to processing: true as early as possible to reduce the chance of\n // the same job being picked up by another worker\n let jobs: Job[] = []\n\n if (id) {\n // Only one job to run\n const job = await updateJob({\n id,\n data: {\n processing: true,\n },\n req,\n returning: true,\n })\n if (job) {\n jobs = [job]\n }\n } else {\n let defaultProcessingOrder: Sort =\n payload.collections[jobsCollectionSlug]?.config.defaultSort ?? 'createdAt'\n\n const processingOrderConfig = jobsConfig.processingOrder\n if (typeof processingOrderConfig === 'function') {\n defaultProcessingOrder = await processingOrderConfig(args)\n } else if (typeof processingOrderConfig === 'object' && !Array.isArray(processingOrderConfig)) {\n if (\n !allQueues &&\n queue &&\n processingOrderConfig.queues &&\n processingOrderConfig.queues[queue]\n ) {\n defaultProcessingOrder = processingOrderConfig.queues[queue]\n } else if (processingOrderConfig.default) {\n defaultProcessingOrder = processingOrderConfig.default\n }\n } else if (typeof processingOrderConfig === 'string') {\n defaultProcessingOrder = processingOrderConfig\n }\n const updatedDocs = await updateJobs({\n data: {\n processing: true,\n },\n limit,\n req,\n returning: true,\n sort: processingOrder ?? defaultProcessingOrder,\n where: { and },\n })\n\n if (updatedDocs) {\n jobs = updatedDocs\n }\n }\n\n if (!jobs.length) {\n return {\n noJobsRemaining: true,\n remainingJobsFromQueried: 0,\n }\n }\n\n // Only handle concurrency deduplication if the feature is enabled\n if (jobsConfig.enableConcurrencyControl) {\n // Handle the case where multiple jobs with the same concurrencyKey were picked up in the same batch\n // We should only run one job per concurrencyKey, release the others back to pending\n const seenConcurrencyKeys = new Set<string>()\n const jobsToRun: Job[] = []\n const jobsToRelease: Job[] = []\n\n for (const job of jobs) {\n if (job.concurrencyKey) {\n if (seenConcurrencyKeys.has(job.concurrencyKey)) {\n // This job has the same concurrencyKey as another job we're already running\n jobsToRelease.push(job)\n } else {\n seenConcurrencyKeys.add(job.concurrencyKey)\n jobsToRun.push(job)\n }\n } else {\n jobsToRun.push(job)\n }\n }\n\n // Release duplicate concurrencyKey jobs back to pending state\n if (jobsToRelease.length > 0) {\n const releaseIds = jobsToRelease.map((job) => job.id)\n await updateJobs({\n data: { processing: false },\n req,\n returning: false,\n where: { id: { in: releaseIds } },\n })\n }\n\n // Use only the filtered jobs going forward\n jobs = jobsToRun\n }\n\n if (!jobs.length) {\n return {\n noJobsRemaining: false,\n remainingJobsFromQueried: 0,\n }\n }\n\n if (!silent || (typeof silent === 'object' && !silent.info)) {\n let newCount = 0\n let retryCount = 0\n\n for (const job of jobs) {\n if (job.totalTried > 0) {\n retryCount++\n } else {\n newCount++\n }\n }\n\n payload.logger.info({\n msg: `Running ${jobs.length} jobs.`,\n new: newCount,\n retrying: retryCount,\n })\n }\n\n const successfullyCompletedJobs: (number | string)[] = []\n\n const runSingleJob = async (\n job: Job,\n ): Promise<{\n id: number | string\n result: RunJobResult\n }> => {\n if (!job.workflowSlug && !job.taskSlug) {\n throw new Error('Job must have either a workflowSlug or a taskSlug')\n }\n const jobReq = isolateObjectProperty(req, 'transactionID')\n\n let workflowConfig: undefined | WorkflowConfig = undefined\n\n if (job.workflowSlug && jobsConfig.workflows?.length) {\n workflowConfig = jobsConfig.workflows.find(({ slug }) => slug === job.workflowSlug)\n } else if (job.taskSlug && jobsConfig.tasks?.length) {\n const taskExists = jobsConfig.tasks.some(({ slug }) => slug === job.taskSlug)\n if (taskExists) {\n workflowConfig = {\n slug: 'singleTask',\n handler: async ({ job, tasks }) => {\n await tasks[job.taskSlug as string]!('1', {\n input: job.input,\n })\n },\n }\n }\n }\n\n if (!workflowConfig) {\n // Permanently fail jobs whose task/workflow slug is no longer registered in config — they can never complete.\n const errorMessage = `${job.taskSlug ? `Task '${job.taskSlug}'` : `Workflow '${job.workflowSlug}'`} is not registered in payload.config.jobs.`\n\n if (!silent || (typeof silent === 'object' && !silent.error)) {\n payload.logger.error({\n msg: `Error running job ${job.workflowSlug || `Task: ${job.taskSlug}`} id: ${job.id} - ${errorMessage}`,\n })\n }\n\n const updateJob = getUpdateJobFunction(job, jobReq)\n await updateJob({\n error: { message: errorMessage },\n hasError: true,\n processing: false,\n totalTried: (job.totalTried ?? 0) + 1,\n })\n\n return {\n id: job.id,\n result: {\n status: 'error-reached-max-retries',\n },\n }\n }\n\n try {\n const updateJob = getUpdateJobFunction(job, jobReq)\n\n // the runner will either be passed to the config\n // OR it will be a path, which we will need to import via eval to avoid\n // Next.js compiler dynamic import expression errors\n let workflowHandler: WorkflowHandler | WorkflowJSON\n if (\n typeof workflowConfig.handler === 'function' ||\n (typeof workflowConfig.handler === 'object' && Array.isArray(workflowConfig.handler))\n ) {\n workflowHandler = workflowConfig.handler\n } else {\n workflowHandler = await importHandlerPath<typeof workflowHandler>(workflowConfig.handler)\n\n if (!workflowHandler) {\n const jobLabel = job.workflowSlug || `Task: ${job.taskSlug}`\n const errorMessage = `Can't find runner while importing with the path ${workflowConfig.handler} in job type ${jobLabel}.`\n if (!silent || (typeof silent === 'object' && !silent.error)) {\n payload.logger.error(errorMessage)\n }\n\n await updateJob({\n error: {\n error: errorMessage,\n },\n hasError: true,\n processing: false,\n })\n\n return {\n id: job.id,\n result: {\n status: 'error-reached-max-retries',\n },\n }\n }\n }\n\n if (typeof workflowHandler === 'function') {\n const result = await runJob({\n job,\n req: jobReq,\n silent,\n updateJob,\n workflowConfig,\n workflowHandler,\n })\n\n if (result.status === 'success') {\n successfullyCompletedJobs.push(job.id)\n }\n\n return { id: job.id, result }\n } else {\n const result = await runJSONJob({\n job,\n req: jobReq,\n silent,\n updateJob,\n workflowConfig,\n workflowHandler,\n })\n\n if (result.status === 'success') {\n successfullyCompletedJobs.push(job.id)\n }\n\n return { id: job.id, result }\n }\n } catch (error) {\n if (error instanceof JobCancelledError) {\n if (\n !(job.error as Record<string, unknown> | undefined)?.cancelled ||\n !job.hasError ||\n job.processing ||\n job.completedAt ||\n job.waitUntil\n ) {\n // When using the local API to cancel jobs, the local API will update the job data for us to ensure the job is cancelled.\n // But when throwing a JobCancelledError within a task or workflow handler, we are responsible for updating the job data ourselves.\n await updateJob({\n id: job.id,\n data: {\n completedAt: null,\n error: {\n cancelled: true,\n message: error.message,\n },\n hasError: true,\n processing: false,\n waitUntil: null,\n },\n req,\n returning: false,\n })\n }\n\n return {\n id: job.id,\n result: {\n status: 'error-reached-max-retries',\n },\n }\n }\n throw error\n }\n }\n\n let resultsArray: { id: number | string; result: RunJobResult }[] = []\n if (sequential) {\n for (const job of jobs) {\n const result = await runSingleJob(job)\n if (result) {\n resultsArray.push(result)\n }\n }\n } else {\n const jobPromises = jobs.map(runSingleJob)\n resultsArray = (await Promise.all(jobPromises)) as {\n id: number | string\n result: RunJobResult\n }[]\n }\n\n if (jobsConfig.deleteJobOnComplete && successfullyCompletedJobs.length) {\n try {\n await payload.db.deleteMany({\n collection: jobsCollectionSlug,\n where: { id: { in: successfullyCompletedJobs } },\n })\n } catch (err) {\n if (!silent || (typeof silent === 'object' && !silent.error)) {\n payload.logger.error({\n err,\n msg: `Failed to delete jobs ${successfullyCompletedJobs.join(', ')} on complete`,\n })\n }\n }\n }\n\n const resultsObject: RunJobsResult['jobStatus'] = resultsArray.reduce(\n (acc, cur) => {\n if (cur !== null) {\n // Check if there's a valid result to include\n acc[cur.id] = cur.result\n }\n return acc\n },\n {} as Record<string, RunJobResult>,\n )\n\n let remainingJobsFromQueried = 0\n for (const jobID in resultsObject) {\n const jobResult = resultsObject[jobID]\n if (jobResult?.status === 'error') {\n remainingJobsFromQueried++ // Can be retried\n }\n }\n\n return {\n jobStatus: resultsObject,\n remainingJobsFromQueried,\n }\n}\n"],"names":["Forbidden","isolateObjectProperty","jobsCollectionSlug","JobCancelledError","getCurrentDate","updateJob","updateJobs","getUpdateJobFunction","importHandlerPath","runJob","runJSONJob","runJobs","args","id","allQueues","limit","overrideAccess","processingOrder","queue","req","payload","config","jobs","jobsConfig","sequential","silent","where","whereFromProps","accessFn","access","run","hasAccess","t","and","completedAt","exists","hasError","not_equals","processing","equals","or","waitUntil","less_than","toISOString","push","enableConcurrencyControl","runningJobsWithConcurrency","db","find","collection","pagination","transactionID","undefined","select","concurrencyKey","runningConcurrencyKeys","Set","docs","doc","add","size","not_in","job","data","returning","defaultProcessingOrder","collections","defaultSort","processingOrderConfig","Array","isArray","queues","default","updatedDocs","sort","length","noJobsRemaining","remainingJobsFromQueried","seenConcurrencyKeys","jobsToRun","jobsToRelease","has","releaseIds","map","in","info","newCount","retryCount","totalTried","logger","msg","new","retrying","successfullyCompletedJobs","runSingleJob","workflowSlug","taskSlug","Error","jobReq","workflowConfig","workflows","slug","tasks","taskExists","some","handler","input","errorMessage","error","message","result","status","workflowHandler","jobLabel","cancelled","resultsArray","jobPromises","Promise","all","deleteJobOnComplete","deleteMany","err","join","resultsObject","reduce","acc","cur","jobID","jobResult","jobStatus"],"mappings":"AAOA,SAASA,SAAS,QAAQ,+BAA8B;AACxD,SAASC,qBAAqB,QAAQ,8CAA6C;AACnF,SAASC,kBAAkB,QAAQ,6BAA4B;AAC/D,SAASC,iBAAiB,QAAQ,wBAAuB;AACzD,SAASC,cAAc,QAAQ,oCAAmC;AAClE,SAASC,SAAS,EAAEC,UAAU,QAAQ,+BAA8B;AACpE,SAASC,oBAAoB,QAAQ,mCAAkC;AACvE,SAASC,iBAAiB,QAAQ,gCAA+B;AACjE,SAASC,MAAM,QAAQ,oBAAmB;AAC1C,SAASC,UAAU,QAAQ,wBAAuB;AAiElD,OAAO,MAAMC,UAAU,OAAOC;IAC5B,MAAM,EACJC,EAAE,EACFC,YAAY,KAAK,EACjBC,QAAQ,EAAE,EACVC,cAAc,EACdC,eAAe,EACfC,QAAQ,SAAS,EACjBC,GAAG,EACHA,KAAK,EACHC,OAAO,EACPA,SAAS,EACPC,QAAQ,EAAEC,MAAMC,UAAU,EAAE,EAC7B,EACF,EACDC,UAAU,EACVC,SAAS,KAAK,EACdC,OAAOC,cAAc,EACtB,GAAGf;IAEJ,IAAI,CAACI,gBAAgB;QACnB;;KAEC,GACD,MAAMY,WAAWL,YAAYM,QAAQC,OAAQ,CAAA,IAAM,IAAG;QACtD,MAAMC,YAAY,MAAMH,SAAS;YAAET;QAAI;Q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E,IAAI3F,YAAY;QACd,KAAK,MAAMsC,OAAOxC,KAAM;YACtB,MAAMwF,SAAS,MAAMhB,aAAahC;YAClC,IAAIgD,QAAQ;gBACVK,aAAavE,IAAI,CAACkE;YACpB;QACF;IACF,OAAO;QACL,MAAMM,cAAc9F,KAAK6D,GAAG,CAACW;QAC7BqB,eAAgB,MAAME,QAAQC,GAAG,CAACF;IAIpC;IAEA,IAAI7F,WAAWgG,mBAAmB,IAAI1B,0BAA0BlB,MAAM,EAAE;QACtE,IAAI;YACF,MAAMvD,QAAQ2B,EAAE,CAACyE,UAAU,CAAC;gBAC1BvE,YAAY/C;gBACZwB,OAAO;oBAAEb,IAAI;wBAAEuE,IAAIS;oBAA0B;gBAAE;YACjD;QACF,EAAE,OAAO4B,KAAK;YACZ,IAAI,CAAChG,UAAW,OAAOA,WAAW,YAAY,CAACA,OAAOmF,KAAK,EAAG;gBAC5DxF,QAAQqE,MAAM,CAACmB,KAAK,CAAC;oBACnBa;oBACA/B,KAAK,CAAC,sBAAsB,EAAEG,0BAA0B6B,IAAI,CAAC,MAAM,YAAY,CAAC;gBAClF;YACF;QACF;IACF;IAEA,MAAMC,gBAA4CR,aAAaS,MAAM,CACnE,CAACC,KAAKC;QACJ,IAAIA,QAAQ,MAAM;YAChB,6CAA6C;YAC7CD,GAAG,CAACC,IAAIjH,EAAE,CAAC,GAAGiH,IAAIhB,MAAM;QAC1B;QACA,OAAOe;IACT,GACA,CAAC;IAGH,IAAIhD,2BAA2B;IAC/B,IAAK,MAAMkD,SAASJ,cAAe;QACjC,MAAMK,YAAYL,aAAa,CAACI,MAAM;QACtC,IAAIC,WAAWjB,WAAW,SAAS;YACjClC,4BAA2B,iBAAiB;QAC9C;IACF;IAEA,OAAO;QACLoD,WAAWN;QACX9C;IACF;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJSONJob/index.ts"],"names":[],"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AAE,MAAM,oBAAoB,CAAA;AAOtD,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,GAAG,CAAA;IACR,GAAG,EAAE,cAAc,CAAA;IACnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE,YAAY,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,UAAU,GAAU,mEAO9B,IAAI,KAAG,OAAO,CAAC,gBAAgB,CAwGjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRunTaskFunction.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getRunTaskFunction.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAEV,qBAAqB,EAErB,gBAAgB,EAKjB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAQlE,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAS,SAAS,OAAO,EAC1D,KAAK,GAAG,EACR,gBAAgB,cAAc,EAC9B,KAAK,cAAc,EACnB,UAAU,SAAS,EACnB,WAAW,iBAAiB,EAC5B,SAAS,UAAU,KAClB,SAAS,SAAS,IAAI,GAAG,qBAAqB,GAAG,gBA0KnD,CAAA"}
|
|
@@ -59,10 +59,9 @@ export const getRunTaskFunction = (job, workflowConfig, req, isInline, updateJob
|
|
|
59
59
|
workflowConfig
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
let
|
|
63
|
-
let output = {};
|
|
62
|
+
let output;
|
|
64
63
|
try {
|
|
65
|
-
|
|
64
|
+
output = (await runner({
|
|
66
65
|
inlineTask: getRunTaskFunction(job, workflowConfig, req, true, updateJob, {
|
|
67
66
|
taskID,
|
|
68
67
|
taskSlug
|
|
@@ -74,7 +73,7 @@ export const getRunTaskFunction = (job, workflowConfig, req, isInline, updateJob
|
|
|
74
73
|
taskID,
|
|
75
74
|
taskSlug
|
|
76
75
|
})
|
|
77
|
-
});
|
|
76
|
+
}))?.output;
|
|
78
77
|
} catch (err) {
|
|
79
78
|
if (err instanceof JobCancelledError) {
|
|
80
79
|
// Re-throw JobCancelledError to be handled by the top-level error handler
|
|
@@ -95,24 +94,6 @@ export const getRunTaskFunction = (job, workflowConfig, req, isInline, updateJob
|
|
|
95
94
|
workflowConfig
|
|
96
95
|
});
|
|
97
96
|
}
|
|
98
|
-
if (taskHandlerResult.state === 'failed') {
|
|
99
|
-
throw new TaskError({
|
|
100
|
-
executedAt,
|
|
101
|
-
input: input,
|
|
102
|
-
job,
|
|
103
|
-
message: taskHandlerResult.errorMessage ?? 'Task handler returned a failed state',
|
|
104
|
-
output,
|
|
105
|
-
parent,
|
|
106
|
-
retriesConfig: finalRetriesConfig,
|
|
107
|
-
taskConfig,
|
|
108
|
-
taskID,
|
|
109
|
-
taskSlug,
|
|
110
|
-
taskStatus,
|
|
111
|
-
workflowConfig
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
output = taskHandlerResult.output;
|
|
115
|
-
}
|
|
116
97
|
if (taskConfig?.onSuccess) {
|
|
117
98
|
await taskConfig.onSuccess({
|
|
118
99
|
input,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"sourcesContent":["import ObjectIdImport from 'bson-objectid'\n\nimport type { Job } from '../../../../index.js'\nimport type { JsonObject, PayloadRequest } from '../../../../types/index.js'\nimport type {\n RetryConfig,\n RunInlineTaskFunction,\n RunTaskFunction,\n RunTaskFunctions,\n TaskConfig,\n TaskHandler,\n TaskHandlerResult,\n TaskType,\n} from '../../../config/types/taskTypes.js'\nimport type {\n JobLog,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowTypes,\n} from '../../../config/types/workflowTypes.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { JobCancelledError, TaskError } from '../../../errors/index.js'\nimport { getCurrentDate } from '../../../utilities/getCurrentDate.js'\nimport { getTaskHandlerFromConfig } from './importHandlerPath.js'\n\nconst ObjectId = 'default' in ObjectIdImport ? ObjectIdImport.default : ObjectIdImport\n\nexport type TaskParent = {\n taskID: string\n taskSlug: string\n}\n\nexport const getRunTaskFunction = <TIsInline extends boolean>(\n job: Job,\n workflowConfig: WorkflowConfig,\n req: PayloadRequest,\n isInline: TIsInline,\n updateJob: UpdateJobFunction,\n parent?: TaskParent,\n): TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions => {\n const jobConfig = req.payload.config.jobs\n\n const runTask: <TTaskSlug extends string>(\n taskSlug: TTaskSlug,\n ) => TTaskSlug extends 'inline' ? RunInlineTaskFunction : RunTaskFunction<TTaskSlug> = (\n taskSlug,\n ) =>\n (async (\n taskID: Parameters<RunInlineTaskFunction>[0],\n {\n input,\n retries,\n // Only available for inline tasks:\n task,\n }: Parameters<RunInlineTaskFunction>[1] & Parameters<RunTaskFunction<string>>[1],\n ) => {\n const executedAt = getCurrentDate()\n\n let taskConfig: TaskConfig | undefined\n if (!isInline) {\n taskConfig = (jobConfig.tasks?.length &&\n jobConfig.tasks.find((t) => t.slug === taskSlug)) as TaskConfig<string>\n\n if (!taskConfig) {\n throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`)\n }\n }\n\n const retriesConfigFromPropsNormalized =\n retries == undefined || retries == null\n ? {}\n : typeof retries === 'number'\n ? { attempts: retries }\n : retries\n const retriesConfigFromTaskConfigNormalized = taskConfig\n ? typeof taskConfig.retries === 'number'\n ? { attempts: taskConfig.retries }\n : taskConfig.retries\n : {}\n\n const finalRetriesConfig: RetryConfig = {\n ...retriesConfigFromTaskConfigNormalized,\n ...retriesConfigFromPropsNormalized, // Retry config from props takes precedence\n }\n\n const taskStatus: null | SingleTaskStatus<string> = job?.taskStatus?.[taskSlug]\n ? job.taskStatus[taskSlug][taskID]!\n : null\n\n // Handle restoration of task if it succeeded in a previous run\n if (taskStatus && taskStatus.complete === true) {\n let shouldRestore = true\n if (finalRetriesConfig?.shouldRestore === false) {\n shouldRestore = false\n } else if (typeof finalRetriesConfig?.shouldRestore === 'function') {\n shouldRestore = await finalRetriesConfig.shouldRestore({\n input,\n job,\n req,\n taskStatus,\n })\n }\n if (shouldRestore) {\n return taskStatus.output\n }\n }\n\n const runner = isInline\n ? (task as TaskHandler<TaskType>)\n : await getTaskHandlerFromConfig(taskConfig)\n\n if (!runner || typeof runner !== 'function') {\n throw new TaskError({\n executedAt,\n input,\n job,\n message: isInline\n ? `Inline task with ID ${taskID} does not have a valid handler.`\n : `Task with slug ${taskSlug} in workflow ${job.workflowSlug} does not have a valid handler.`,\n parent,\n retriesConfig: finalRetriesConfig,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n workflowConfig,\n })\n }\n\n let taskHandlerResult: TaskHandlerResult<string>\n let output: JsonObject | undefined = {}\n\n try {\n taskHandlerResult = await runner({\n inlineTask: getRunTaskFunction(job, workflowConfig, req, true, updateJob, {\n taskID,\n taskSlug,\n }),\n input,\n job: job as unknown as Job<WorkflowTypes>,\n req,\n tasks: getRunTaskFunction(job, workflowConfig, req, false, updateJob, {\n taskID,\n taskSlug,\n }),\n })\n } catch (err: any) {\n if (err instanceof JobCancelledError) {\n // Re-throw JobCancelledError to be handled by the top-level error handler\n throw err\n }\n throw new TaskError({\n executedAt,\n input: input!,\n job,\n message: err.message || 'Task handler threw an error',\n output,\n parent,\n retriesConfig: finalRetriesConfig,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n workflowConfig,\n })\n }\n\n if (taskHandlerResult.state === 'failed') {\n throw new TaskError({\n executedAt,\n input: input!,\n job,\n message: taskHandlerResult.errorMessage ?? 'Task handler returned a failed state',\n output,\n parent,\n retriesConfig: finalRetriesConfig,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n workflowConfig,\n })\n } else {\n output = taskHandlerResult.output\n }\n\n if (taskConfig?.onSuccess) {\n await taskConfig.onSuccess({\n input,\n job,\n req,\n taskStatus,\n })\n }\n\n const newLogItem: JobLog = {\n id: new ObjectId().toHexString(),\n completedAt: getCurrentDate().toISOString(),\n executedAt: executedAt.toISOString(),\n input,\n output,\n parent: jobConfig.addParentToTaskLog ? parent : undefined,\n state: 'succeeded',\n taskID,\n taskSlug,\n }\n\n await updateJob({\n log: {\n $push: newLogItem,\n } as any,\n // Set to null to skip main row update on postgres. 2 => 1 db round trips\n updatedAt: null as any,\n })\n\n return output\n }) as any\n\n if (isInline) {\n return runTask('inline') as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n } else {\n const tasks: RunTaskFunctions = {}\n for (const task of jobConfig.tasks ?? []) {\n tasks[task.slug] = runTask(task.slug) as RunTaskFunction<string>\n }\n return tasks as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n }\n}\n"],"names":["ObjectIdImport","JobCancelledError","TaskError","getCurrentDate","getTaskHandlerFromConfig","ObjectId","default","getRunTaskFunction","job","workflowConfig","req","isInline","updateJob","parent","jobConfig","payload","config","jobs","runTask","taskSlug","taskID","input","retries","task","executedAt","taskConfig","tasks","length","find","t","slug","Error","workflowSlug","retriesConfigFromPropsNormalized","undefined","attempts","retriesConfigFromTaskConfigNormalized","finalRetriesConfig","taskStatus","complete","shouldRestore","output","runner","message","retriesConfig","taskHandlerResult","inlineTask","err","state","errorMessage","onSuccess","newLogItem","id","toHexString","completedAt","toISOString","addParentToTaskLog","log","$push","updatedAt"],"mappings":"AAAA,OAAOA,oBAAoB,gBAAe;AAsB1C,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,2BAA0B;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,yBAAwB;AAEjE,MAAMC,WAAW,aAAaL,iBAAiBA,eAAeM,OAAO,GAAGN;AAOxE,OAAO,MAAMO,qBAAqB,CAChCC,KACAC,gBACAC,KACAC,UACAC,WACAC;IAEA,MAAMC,YAAYJ,IAAIK,OAAO,CAACC,MAAM,CAACC,IAAI;IAEzC,MAAMC,UAEiF,CACrFC,WAEC,OACCC,QACA,EACEC,KAAK,EACLC,OAAO,EACP,mCAAmC;QACnCC,IAAI,EAC0E;YAEhF,MAAMC,aAAarB;YAEnB,IAAIsB;YACJ,IAAI,CAACd,UAAU;gBACbc,aAAcX,UAAUY,KAAK,EAAEC,UAC7Bb,UAAUY,KAAK,CAACE,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAKX;gBAEzC,IAAI,CAACM,YAAY;oBACf,MAAM,IAAIM,MAAM,CAAC,KAAK,EAAEZ,SAAS,uBAAuB,EAAEX,IAAIwB,YAAY,EAAE;gBAC9E;YACF;YAEA,MAAMC,mCACJX,WAAWY,aAAaZ,WAAW,OAC/B,CAAC,IACD,OAAOA,YAAY,WACjB;gBAAEa,UAAUb;YAAQ,IACpBA;YACR,MAAMc,wCAAwCX,aAC1C,OAAOA,WAAWH,OAAO,KAAK,WAC5B;gBAAEa,UAAUV,WAAWH,OAAO;YAAC,IAC/BG,WAAWH,OAAO,GACpB,CAAC;YAEL,MAAMe,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,0EAA0E;oBAC1E,MAAM8C;gBACR;gBACA,MAAM,IAAI7C,UAAU;oBAClBsB;oBACAH,OAAOA;oBACPb;oBACAmC,SAASI,IAAIJ,OAAO,IAAI;oBACxBF;oBACA5B;oBACA+B,eAAeP;oBACfZ;oBACAL;oBACAD;oBACAmB;oBACA7B;gBACF;YACF;YAEA,IAAIoC,kBAAkBG,KAAK,KAAK,UAAU;gBACxC,MAAM,IAAI9C,UAAU;oBAClBsB;oBACAH,OAAOA;oBACPb;oBACAmC,SAASE,kBAAkBI,YAAY,IAAI;oBAC3CR;oBACA5B;oBACA+B,eAAeP;oBACfZ;oBACAL;oBACAD;oBACAmB;oBACA7B;gBACF;YACF,OAAO;gBACLgC,SAASI,kBAAkBJ,MAAM;YACnC;YAEA,IAAIhB,YAAYyB,WAAW;gBACzB,MAAMzB,WAAWyB,SAAS,CAAC;oBACzB7B;oBACAb;oBACAE;oBACA4B;gBACF;YACF;YAEA,MAAMa,aAAqB;gBACzBC,IAAI,IAAI/C,WAAWgD,WAAW;gBAC9BC,aAAanD,iBAAiBoD,WAAW;gBACzC/B,YAAYA,WAAW+B,WAAW;gBAClClC;gBACAoB;gBACA5B,QAAQC,UAAU0C,kBAAkB,GAAG3C,SAASqB;gBAChDc,OAAO;gBACP5B;gBACAD;YACF;YAEA,MAAMP,UAAU;gBACd6C,KAAK;oBACHC,OAAOP;gBACT;gBACA,yEAAyE;gBACzEQ,WAAW;YACb;YAEA,OAAOlB;QACT;IAEF,IAAI9B,UAAU;QACZ,OAAOO,QAAQ;IACjB,OAAO;QACL,MAAMQ,QAA0B,CAAC;QACjC,KAAK,MAAMH,QAAQT,UAAUY,KAAK,IAAI,EAAE,CAAE;YACxCA,KAAK,CAACH,KAAKO,IAAI,CAAC,GAAGZ,QAAQK,KAAKO,IAAI;QACtC;QACA,OAAOJ;IACT;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/getRunTaskFunction.ts"],"sourcesContent":["import ObjectIdImport from 'bson-objectid'\n\nimport type { Job } from '../../../../index.js'\nimport type { PayloadRequest } from '../../../../types/index.js'\nimport type {\n RetryConfig,\n RunInlineTaskFunction,\n RunTaskFunction,\n RunTaskFunctions,\n TaskConfig,\n TaskHandler,\n TaskHandlerResult,\n TaskType,\n} from '../../../config/types/taskTypes.js'\nimport type {\n JobLog,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowTypes,\n} from '../../../config/types/workflowTypes.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { JobCancelledError, TaskError } from '../../../errors/index.js'\nimport { getCurrentDate } from '../../../utilities/getCurrentDate.js'\nimport { getTaskHandlerFromConfig } from './importHandlerPath.js'\n\nconst ObjectId = 'default' in ObjectIdImport ? ObjectIdImport.default : ObjectIdImport\n\nexport type TaskParent = {\n taskID: string\n taskSlug: string\n}\n\nexport const getRunTaskFunction = <TIsInline extends boolean>(\n job: Job,\n workflowConfig: WorkflowConfig,\n req: PayloadRequest,\n isInline: TIsInline,\n updateJob: UpdateJobFunction,\n parent?: TaskParent,\n): TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions => {\n const jobConfig = req.payload.config.jobs\n\n const runTask: <TTaskSlug extends string>(\n taskSlug: TTaskSlug,\n ) => TTaskSlug extends 'inline' ? RunInlineTaskFunction : RunTaskFunction<TTaskSlug> = (\n taskSlug,\n ) =>\n (async (\n taskID: Parameters<RunInlineTaskFunction>[0],\n {\n input,\n retries,\n // Only available for inline tasks:\n task,\n }: Parameters<RunInlineTaskFunction>[1] & Parameters<RunTaskFunction<string>>[1],\n ) => {\n const executedAt = getCurrentDate()\n\n let taskConfig: TaskConfig | undefined\n if (!isInline) {\n taskConfig = (jobConfig.tasks?.length &&\n jobConfig.tasks.find((t) => t.slug === taskSlug)) as TaskConfig<string>\n\n if (!taskConfig) {\n throw new Error(`Task ${taskSlug} not found in workflow ${job.workflowSlug}`)\n }\n }\n\n const retriesConfigFromPropsNormalized =\n retries == undefined || retries == null\n ? {}\n : typeof retries === 'number'\n ? { attempts: retries }\n : retries\n const retriesConfigFromTaskConfigNormalized = taskConfig\n ? typeof taskConfig.retries === 'number'\n ? { attempts: taskConfig.retries }\n : taskConfig.retries\n : {}\n\n const finalRetriesConfig: RetryConfig = {\n ...retriesConfigFromTaskConfigNormalized,\n ...retriesConfigFromPropsNormalized, // Retry config from props takes precedence\n }\n\n const taskStatus: null | SingleTaskStatus<string> = job?.taskStatus?.[taskSlug]\n ? job.taskStatus[taskSlug][taskID]!\n : null\n\n // Handle restoration of task if it succeeded in a previous run\n if (taskStatus && taskStatus.complete === true) {\n let shouldRestore = true\n if (finalRetriesConfig?.shouldRestore === false) {\n shouldRestore = false\n } else if (typeof finalRetriesConfig?.shouldRestore === 'function') {\n shouldRestore = await finalRetriesConfig.shouldRestore({\n input,\n job,\n req,\n taskStatus,\n })\n }\n if (shouldRestore) {\n return taskStatus.output\n }\n }\n\n const runner = isInline\n ? (task as TaskHandler<TaskType>)\n : await getTaskHandlerFromConfig(taskConfig)\n\n if (!runner || typeof runner !== 'function') {\n throw new TaskError({\n executedAt,\n input,\n job,\n message: isInline\n ? `Inline task with ID ${taskID} does not have a valid handler.`\n : `Task with slug ${taskSlug} in workflow ${job.workflowSlug} does not have a valid handler.`,\n parent,\n retriesConfig: finalRetriesConfig,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n workflowConfig,\n })\n }\n\n let output: TaskHandlerResult<string>['output']\n\n try {\n output = (\n await runner({\n inlineTask: getRunTaskFunction(job, workflowConfig, req, true, updateJob, {\n taskID,\n taskSlug,\n }),\n input,\n job: job as unknown as Job<WorkflowTypes>,\n req,\n tasks: getRunTaskFunction(job, workflowConfig, req, false, updateJob, {\n taskID,\n taskSlug,\n }),\n })\n )?.output\n } catch (err: any) {\n if (err instanceof JobCancelledError) {\n // Re-throw JobCancelledError to be handled by the top-level error handler\n throw err\n }\n throw new TaskError({\n executedAt,\n input: input!,\n job,\n message: err.message || 'Task handler threw an error',\n output,\n parent,\n retriesConfig: finalRetriesConfig,\n taskConfig,\n taskID,\n taskSlug,\n taskStatus,\n workflowConfig,\n })\n }\n\n if (taskConfig?.onSuccess) {\n await taskConfig.onSuccess({\n input,\n job,\n req,\n taskStatus,\n })\n }\n\n const newLogItem: JobLog = {\n id: new ObjectId().toHexString(),\n completedAt: getCurrentDate().toISOString(),\n executedAt: executedAt.toISOString(),\n input,\n output,\n parent: jobConfig.addParentToTaskLog ? parent : undefined,\n state: 'succeeded',\n taskID,\n taskSlug,\n }\n\n await updateJob({\n log: {\n $push: newLogItem,\n } as any,\n // Set to null to skip main row update on postgres. 2 => 1 db round trips\n updatedAt: null as any,\n })\n\n return output\n }) as any\n\n if (isInline) {\n return runTask('inline') as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n } else {\n const tasks: RunTaskFunctions = {}\n for (const task of jobConfig.tasks ?? []) {\n tasks[task.slug] = runTask(task.slug) as RunTaskFunction<string>\n }\n return tasks as TIsInline extends true ? RunInlineTaskFunction : RunTaskFunctions\n }\n}\n"],"names":["ObjectIdImport","JobCancelledError","TaskError","getCurrentDate","getTaskHandlerFromConfig","ObjectId","default","getRunTaskFunction","job","workflowConfig","req","isInline","updateJob","parent","jobConfig","payload","config","jobs","runTask","taskSlug","taskID","input","retries","task","executedAt","taskConfig","tasks","length","find","t","slug","Error","workflowSlug","retriesConfigFromPropsNormalized","undefined","attempts","retriesConfigFromTaskConfigNormalized","finalRetriesConfig","taskStatus","complete","shouldRestore","output","runner","message","retriesConfig","inlineTask","err","onSuccess","newLogItem","id","toHexString","completedAt","toISOString","addParentToTaskLog","state","log","$push","updatedAt"],"mappings":"AAAA,OAAOA,oBAAoB,gBAAe;AAsB1C,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,2BAA0B;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,yBAAwB;AAEjE,MAAMC,WAAW,aAAaL,iBAAiBA,eAAeM,OAAO,GAAGN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QAAQC,UAAUuC,kBAAkB,GAAGxC,SAASqB;gBAChDoB,OAAO;gBACPlC;gBACAD;YACF;YAEA,MAAMP,UAAU;gBACd2C,KAAK;oBACHC,OAAOR;gBACT;gBACA,yEAAyE;gBACzES,WAAW;YACb;YAEA,OAAOhB;QACT;IAEF,IAAI9B,UAAU;QACZ,OAAOO,QAAQ;IACjB,OAAO;QACL,MAAMQ,QAA0B,CAAC;QACjC,KAAK,MAAMH,QAAQT,UAAUY,KAAK,IAAI,EAAE,CAAE;YACxCA,KAAK,CAACH,KAAKO,IAAI,CAAC,GAAGZ,QAAQK,KAAKO,IAAI;QACtC;QACA,OAAOJ;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUpdateJobFunction.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/getUpdateJobFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAKhE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAEvE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,cAAc,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"getUpdateJobFunction.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/getUpdateJobFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAKhE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;AAEvE;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,cAAc,GAAG,iBAAiB,CAiCrF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/getUpdateJobFunction.ts"],"sourcesContent":["import type { Job } from '../../../../index.js'\nimport type { PayloadRequest } from '../../../../types/index.js'\n\nimport { JobCancelledError } from '../../../errors/index.js'\nimport { updateJob } from '../../../utilities/updateJob.js'\n\nexport type UpdateJobFunction = (jobData: Partial<Job>) => Promise<Job>\n\n/**\n * Helper for updating a job that does the following, additionally to updating the job:\n * - Merges incoming data from the updated job into the original job object\n * - Handles job cancellation by throwing a `JobCancelledError` if the job was cancelled.\n */\nexport function getUpdateJobFunction(job: Job, req: PayloadRequest): UpdateJobFunction {\n return async (jobData) => {\n const updatedJob = await updateJob({\n id: job.id,\n data: jobData,\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/queues/operations/runJobs/runJob/getUpdateJobFunction.ts"],"sourcesContent":["import type { Job } from '../../../../index.js'\nimport type { PayloadRequest } from '../../../../types/index.js'\n\nimport { JobCancelledError } from '../../../errors/index.js'\nimport { updateJob } from '../../../utilities/updateJob.js'\n\nexport type UpdateJobFunction = (jobData: Partial<Job>) => Promise<Job>\n\n/**\n * Helper for updating a job that does the following, additionally to updating the job:\n * - Merges incoming data from the updated job into the original job object\n * - Handles job cancellation by throwing a `JobCancelledError` if the job was cancelled.\n */\nexport function getUpdateJobFunction(job: Job, req: PayloadRequest): UpdateJobFunction {\n return async (jobData) => {\n const updatedJob = await updateJob({\n id: job.id,\n data: jobData,\n req,\n })\n\n if (!updatedJob) {\n return job\n }\n\n // Update job object like this to modify the original object - that way, incoming changes (e.g. taskStatus field that will be re-generated through the hook) will be reflected in the calling function\n for (const key in updatedJob) {\n if (key === 'log') {\n // Add all new log entries to the original job.log object. Do not delete any existing log entries.\n // Do not update existing log entries, as existing log entries should be immutable.\n for (const logEntry of updatedJob?.log ?? []) {\n if (!job.log || !job.log.some((entry) => entry.id === logEntry.id)) {\n ;(job.log ??= []).push(logEntry)\n }\n }\n } else {\n ;(job as any)[key] = updatedJob[key as keyof Job]\n }\n }\n\n if ((updatedJob?.error as Record<string, unknown>)?.cancelled) {\n throw new JobCancelledError(`Job ${job.id} was cancelled`)\n }\n\n return updatedJob\n }\n}\n"],"names":["JobCancelledError","updateJob","getUpdateJobFunction","job","req","jobData","updatedJob","id","data","key","logEntry","log","some","entry","push","error","cancelled"],"mappings":"AAGA,SAASA,iBAAiB,QAAQ,2BAA0B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAI3D;;;;CAIC,GACD,OAAO,SAASC,qBAAqBC,GAAQ,EAAEC,GAAmB;IAChE,OAAO,OAAOC;QACZ,MAAMC,aAAa,MAAML,UAAU;YACjCM,IAAIJ,IAAII,EAAE;YACVC,MAAMH;YACND;QACF;QAEA,IAAI,CAACE,YAAY;YACf,OAAOH;QACT;QAEA,sMAAsM;QACtM,IAAK,MAAMM,OAAOH,WAAY;YAC5B,IAAIG,QAAQ,OAAO;gBACjB,kGAAkG;gBAClG,mFAAmF;gBACnF,KAAK,MAAMC,YAAYJ,YAAYK,OAAO,EAAE,CAAE;oBAC5C,IAAI,CAACR,IAAIQ,GAAG,IAAI,CAACR,IAAIQ,GAAG,CAACC,IAAI,CAAC,CAACC,QAAUA,MAAMN,EAAE,KAAKG,SAASH,EAAE,GAAG;;wBAChEJ,CAAAA,IAAIQ,GAAG,KAAK,EAAE,AAAD,EAAGG,IAAI,CAACJ;oBACzB;gBACF;YACF,OAAO;;gBACHP,GAAW,CAACM,IAAI,GAAGH,UAAU,CAACG,IAAiB;YACnD;QACF;QAEA,IAAKH,YAAYS,OAAmCC,WAAW;YAC7D,MAAM,IAAIhB,kBAAkB,CAAC,IAAI,EAAEG,IAAII,EAAE,CAAC,cAAc,CAAC;QAC3D;QAEA,OAAOD;IACT;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAQlE,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,GAAG,CAAA;IACR,GAAG,EAAE,cAAc,CAAA;IACnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE,eAAe,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,2BAA2B,GAAG,SAAS,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/queues/operations/runJobs/runJob/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AAC7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAQlE,KAAK,IAAI,GAAG;IACV,GAAG,EAAE,GAAG,CAAA;IACR,GAAG,EAAE,cAAc,CAAA;IACnB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE,eAAe,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,2BAA2B,GAAG,SAAS,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,YAAY,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,MAAM,GAAU,mEAO1B,IAAI,KAAG,OAAO,CAAC,YAAY,CA6D7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getJobTaskStatus.d.ts","sourceRoot":"","sources":["../../../src/queues/utilities/getJobTaskStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAErE,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"getJobTaskStatus.d.ts","sourceRoot":"","sources":["../../../src/queues/utilities/getJobTaskStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAErE,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,IAAI,KAAG,aAsCnD,CAAA"}
|
|
@@ -2,8 +2,6 @@ import type { Job } from '../../index.js';
|
|
|
2
2
|
import type { PayloadRequest, Sort, Where } from '../../types/index.js';
|
|
3
3
|
type BaseArgs = {
|
|
4
4
|
data: Partial<Job>;
|
|
5
|
-
depth?: number;
|
|
6
|
-
disableTransaction?: boolean;
|
|
7
5
|
limit?: number;
|
|
8
6
|
req: PayloadRequest;
|
|
9
7
|
returning?: boolean;
|
|
@@ -30,6 +28,6 @@ export declare function updateJob(args: ArgsByID & BaseArgs): Promise<Job | unde
|
|
|
30
28
|
* Handles deciding whether it can used direct db methods or not, and if so,
|
|
31
29
|
* manually runs the afterRead hook that populates the `taskStatus` property.
|
|
32
30
|
*/
|
|
33
|
-
export declare function updateJobs({ id, data,
|
|
31
|
+
export declare function updateJobs({ id, data, limit: limitArg, req, returning, sort, where: whereArg, }: RunJobsArgs): Promise<Job[] | null>;
|
|
34
32
|
export {};
|
|
35
33
|
//# sourceMappingURL=updateJob.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateJob.d.ts","sourceRoot":"","sources":["../../../src/queues/utilities/updateJob.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateJob.d.ts","sourceRoot":"","sources":["../../../src/queues/utilities/updateJob.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAKvE,KAAK,QAAQ,GAAG;IACd,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,cAAc,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,KAAK,SAAS,GAAG;IACf,EAAE,CAAC,EAAE,KAAK,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED,KAAK,WAAW,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,QAAQ,CAAA;AAEpD;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,4BAKxD;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,EAC/B,EAAE,EACF,IAAI,EACJ,KAAK,EAAE,QAAQ,EACf,GAAG,EACH,SAAS,EACT,IAAI,EACJ,KAAK,EAAE,QAAQ,GAChB,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAgDrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jobAfterRead
|
|
1
|
+
import { jobAfterRead } from '../config/collection.js';
|
|
2
2
|
import { getCurrentDate } from './getCurrentDate.js';
|
|
3
3
|
/**
|
|
4
4
|
* Convenience method for updateJobs by id
|
|
@@ -12,29 +12,13 @@ import { getCurrentDate } from './getCurrentDate.js';
|
|
|
12
12
|
* Helper for updating jobs in the most performant way possible.
|
|
13
13
|
* Handles deciding whether it can used direct db methods or not, and if so,
|
|
14
14
|
* manually runs the afterRead hook that populates the `taskStatus` property.
|
|
15
|
-
*/ export async function updateJobs({ id, data,
|
|
15
|
+
*/ export async function updateJobs({ id, data, limit: limitArg, req, returning, sort, where: whereArg }) {
|
|
16
16
|
const limit = id ? 1 : limitArg;
|
|
17
17
|
const where = id ? {
|
|
18
18
|
id: {
|
|
19
19
|
equals: id
|
|
20
20
|
}
|
|
21
21
|
} : whereArg;
|
|
22
|
-
if (depth || req.payload.config?.jobs?.runHooks) {
|
|
23
|
-
const result = await req.payload.update({
|
|
24
|
-
id,
|
|
25
|
-
collection: jobsCollectionSlug,
|
|
26
|
-
data,
|
|
27
|
-
depth,
|
|
28
|
-
disableTransaction,
|
|
29
|
-
limit,
|
|
30
|
-
req,
|
|
31
|
-
where
|
|
32
|
-
});
|
|
33
|
-
if (returning === false || !result) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
return result.docs;
|
|
37
|
-
}
|
|
38
22
|
const jobReq = {
|
|
39
23
|
transactionID: req.payload.db.name !== 'mongoose' ? await req.payload.db.beginTransaction() : undefined
|
|
40
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queues/utilities/updateJob.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../../../src/queues/utilities/updateJob.ts"],"sourcesContent":["import type { UpdateJobsArgs } from '../../database/types.js'\nimport type { Job } from '../../index.js'\nimport type { PayloadRequest, Sort, Where } from '../../types/index.js'\n\nimport { jobAfterRead } from '../config/collection.js'\nimport { getCurrentDate } from './getCurrentDate.js'\n\ntype BaseArgs = {\n data: Partial<Job>\n limit?: number\n req: PayloadRequest\n returning?: boolean\n}\n\ntype ArgsByID = {\n id: number | string\n limit?: never\n sort?: never\n where?: never\n}\n\ntype ArgsWhere = {\n id?: never\n limit?: number\n sort?: Sort\n where: Where\n}\n\ntype RunJobsArgs = (ArgsByID | ArgsWhere) & BaseArgs\n\n/**\n * Convenience method for updateJobs by id\n */\nexport async function updateJob(args: ArgsByID & BaseArgs) {\n const result = await updateJobs(args)\n if (result) {\n return result[0]\n }\n}\n\n/**\n * Helper for updating jobs in the most performant way possible.\n * Handles deciding whether it can used direct db methods or not, and if so,\n * manually runs the afterRead hook that populates the `taskStatus` property.\n */\nexport async function updateJobs({\n id,\n data,\n limit: limitArg,\n req,\n returning,\n sort,\n where: whereArg,\n}: RunJobsArgs): Promise<Job[] | null> {\n const limit = id ? 1 : limitArg\n const where = id ? { id: { equals: id } } : whereArg\n\n const jobReq = {\n transactionID:\n req.payload.db.name !== 'mongoose'\n ? ((await req.payload.db.beginTransaction()) as string)\n : undefined,\n }\n\n if (typeof data.updatedAt === 'undefined') {\n // Ensure updatedAt date is always updated\n data.updatedAt = getCurrentDate().toISOString()\n }\n\n const args: UpdateJobsArgs = id\n ? {\n id,\n data,\n req: jobReq,\n returning,\n }\n : {\n data,\n limit,\n req: jobReq,\n returning,\n sort,\n where: where as Where,\n }\n\n const updatedJobs: Job[] | null = await req.payload.db.updateJobs(args)\n\n if (req.payload.db.name !== 'mongoose' && jobReq.transactionID) {\n await req.payload.db.commitTransaction(jobReq.transactionID)\n }\n\n if (returning === false || !updatedJobs?.length) {\n return null\n }\n\n return updatedJobs.map((updatedJob) => {\n return jobAfterRead({\n config: req.payload.config,\n doc: updatedJob,\n })\n })\n}\n"],"names":["jobAfterRead","getCurrentDate","updateJob","args","result","updateJobs","id","data","limit","limitArg","req","returning","sort","where","whereArg","equals","jobReq","transactionID","payload","db","name","beginTransaction","undefined","updatedAt","toISOString","updatedJobs","commitTransaction","length","map","updatedJob","config","doc"],"mappings":"AAIA,SAASA,YAAY,QAAQ,0BAAyB;AACtD,SAASC,cAAc,QAAQ,sBAAqB;AAyBpD;;CAEC,GACD,OAAO,eAAeC,UAAUC,IAAyB;IACvD,MAAMC,SAAS,MAAMC,WAAWF;IAChC,IAAIC,QAAQ;QACV,OAAOA,MAAM,CAAC,EAAE;IAClB;AACF;AAEA;;;;CAIC,GACD,OAAO,eAAeC,WAAW,EAC/BC,EAAE,EACFC,IAAI,EACJC,OAAOC,QAAQ,EACfC,GAAG,EACHC,SAAS,EACTC,IAAI,EACJC,OAAOC,QAAQ,EACH;IACZ,MAAMN,QAAQF,KAAK,IAAIG;IACvB,MAAMI,QAAQP,KAAK;QAAEA,IAAI;YAAES,QAAQT;QAAG;IAAE,IAAIQ;IAE5C,MAAME,SAAS;QACbC,eACEP,IAAIQ,OAAO,CAACC,EAAE,CAACC,IAAI,KAAK,aAClB,MAAMV,IAAIQ,OAAO,CAACC,EAAE,CAACE,gBAAgB,KACvCC;IACR;IAEA,IAAI,OAAOf,KAAKgB,SAAS,KAAK,aAAa;QACzC,0CAA0C;QAC1ChB,KAAKgB,SAAS,GAAGtB,iBAAiBuB,WAAW;IAC/C;IAEA,MAAMrB,OAAuBG,KACzB;QACEA;QACAC;QACAG,KAAKM;QACLL;IACF,IACA;QACEJ;QACAC;QACAE,KAAKM;QACLL;QACAC;QACAC,OAAOA;IACT;IAEJ,MAAMY,cAA4B,MAAMf,IAAIQ,OAAO,CAACC,EAAE,CAACd,UAAU,CAACF;IAElE,IAAIO,IAAIQ,OAAO,CAACC,EAAE,CAACC,IAAI,KAAK,cAAcJ,OAAOC,aAAa,EAAE;QAC9D,MAAMP,IAAIQ,OAAO,CAACC,EAAE,CAACO,iBAAiB,CAACV,OAAOC,aAAa;IAC7D;IAEA,IAAIN,cAAc,SAAS,CAACc,aAAaE,QAAQ;QAC/C,OAAO;IACT;IAEA,OAAOF,YAAYG,GAAG,CAAC,CAACC;QACtB,OAAO7B,aAAa;YAClB8B,QAAQpB,IAAIQ,OAAO,CAACY,MAAM;YAC1BC,KAAKF;QACP;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocalI18n.d.ts","sourceRoot":"","sources":["../../src/translations/getLocalI18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAIjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"getLocalI18n.d.ts","sourceRoot":"","sources":["../../src/translations/getLocalI18n.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAIjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEzD,eAAO,MAAM,YAAY,GAAU,uBAGhC;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,qDAKG,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,11 +2,13 @@ import type { I18n, TFunction } from '@payloadcms/translations';
|
|
|
2
2
|
import type DataLoader from 'dataloader';
|
|
3
3
|
import type { OptionalKeys, RequiredKeys } from 'ts-essentials';
|
|
4
4
|
import type { URL } from 'url';
|
|
5
|
+
import type { ServerAdapter } from '../admin/adapters/server.js';
|
|
5
6
|
import type { DataFromCollectionSlug, QueryDraftDataFromCollectionSlug, TypeWithID, TypeWithTimestamps } from '../collections/config/types.js';
|
|
6
7
|
import type payload from '../index.js';
|
|
7
8
|
import type { CollectionSlug, DataFromGlobalSlug, GlobalSlug, Payload, RequestContext, TypedCollectionJoins, TypedCollectionSelect, TypedFallbackLocale, TypedLocale, TypedUser } from '../index.js';
|
|
8
9
|
import type { File } from '../uploads/types.js';
|
|
9
10
|
import type { Operator } from './constants.js';
|
|
11
|
+
export type { TypeWithID } from '../collections/config/types.js';
|
|
10
12
|
export type { Payload } from '../index.js';
|
|
11
13
|
export type CustomPayloadRequestProperties = {
|
|
12
14
|
context: RequestContext;
|
|
@@ -54,6 +56,15 @@ export type CustomPayloadRequestProperties = {
|
|
|
54
56
|
* { collection: 'posts', id: '123' }
|
|
55
57
|
*/
|
|
56
58
|
routeParams?: Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Framework abstraction for server-only navigation, cookies, and headers APIs.
|
|
61
|
+
* Populated by the framework adapter (e.g. `@payloadcms/next`). Plugins that
|
|
62
|
+
* have access to `req` should call methods here (`req.server.unauthorized()`,
|
|
63
|
+
* `req.server.redirect(...)`) instead of importing from `next/navigation` or
|
|
64
|
+
* `next/headers` directly. Optional because non-framework contexts (jobs,
|
|
65
|
+
* scripts, tests) construct requests without a server adapter.
|
|
66
|
+
*/
|
|
67
|
+
server?: ServerAdapter;
|
|
57
68
|
/** Translate function - duplicate of i18n.t */
|
|
58
69
|
t: TFunction;
|
|
59
70
|
/**
|
|
@@ -61,11 +72,6 @@ export type CustomPayloadRequestProperties = {
|
|
|
61
72
|
* Can also be used to ensure consistency when multiple operations try to create a transaction concurrently on the same request.
|
|
62
73
|
*/
|
|
63
74
|
transactionID?: number | Promise<number | string> | string;
|
|
64
|
-
/**
|
|
65
|
-
* Used to ensure consistency when multiple operations try to create a transaction concurrently on the same request
|
|
66
|
-
* @deprecated This is not used anywhere, instead `transactionID` is used for the above. Will be removed in next major version.
|
|
67
|
-
*/
|
|
68
|
-
transactionIDPromise?: Promise<void>;
|
|
69
75
|
/** The signed-in user */
|
|
70
76
|
user: null | TypedUser;
|
|
71
77
|
} & Pick<URL, 'hash' | 'host' | 'href' | 'origin' | 'pathname' | 'port' | 'protocol' | 'search' | 'searchParams'>;
|
|
@@ -147,6 +153,49 @@ export type SelectExcludeType = {
|
|
|
147
153
|
};
|
|
148
154
|
export type SelectMode = 'exclude' | 'include';
|
|
149
155
|
export type SelectType = SelectExcludeType | SelectIncludeType;
|
|
156
|
+
/**
|
|
157
|
+
* Operations that invoke an entity-level `select` function.
|
|
158
|
+
*
|
|
159
|
+
* Narrower than `HookOperationType`: `select` runs only for read- and
|
|
160
|
+
* write-path operations that materialize a document (`create`, `delete`,
|
|
161
|
+
* `read`, `restoreVersion`, `update`). Operations like `autosave`, `count`,
|
|
162
|
+
* `countVersions`, `forgotPassword`, `login`, `readDistinct`, `refresh`, and
|
|
163
|
+
* `resetPassword` do not invoke `select` and are intentionally excluded.
|
|
164
|
+
*/
|
|
165
|
+
export type SelectFnOperation = 'create' | 'delete' | 'read' | 'restoreVersion' | 'update';
|
|
166
|
+
export type SelectFnArgs = {
|
|
167
|
+
operation: SelectFnOperation;
|
|
168
|
+
req: PayloadRequest;
|
|
169
|
+
/** The caller's `select` arg, or `undefined` if not provided. */
|
|
170
|
+
select?: SelectType;
|
|
171
|
+
};
|
|
172
|
+
export type SelectFn<TSelect extends SelectType = SelectType> = (args: SelectFnArgs) => TSelect | undefined;
|
|
173
|
+
/**
|
|
174
|
+
* Shared shape for the entity-level `select` config used by Collections and Globals.
|
|
175
|
+
* The JSDoc on the `select` property is the single source of truth — pick from this
|
|
176
|
+
* type when defining the config:
|
|
177
|
+
*
|
|
178
|
+
* & Pick<WithSelectFn<...>, 'select'>
|
|
179
|
+
*/
|
|
180
|
+
export type WithSelectFn<TSelect extends SelectType = SelectType> = {
|
|
181
|
+
/**
|
|
182
|
+
* Entity-level Select API configuration.
|
|
183
|
+
*
|
|
184
|
+
* A function that receives the current request context (`operation`, `req`,
|
|
185
|
+
* the caller's `select`) and returns the final `select` to apply, replacing
|
|
186
|
+
* the caller's. Return `undefined` to leave the caller's `select` unchanged.
|
|
187
|
+
*
|
|
188
|
+
* Useful to dynamically modify the caller's selection based on the request context:
|
|
189
|
+
* - Forcing a field to be populated for reference within hooks / access control.
|
|
190
|
+
* - Differentiating between API requests and admin panel requests, to optimize
|
|
191
|
+
* the amount of data being queried in each case.
|
|
192
|
+
*
|
|
193
|
+
* Note: per-document data is not available — this runs before the read.
|
|
194
|
+
*
|
|
195
|
+
* @see https://payloadcms.com/docs/queries/select
|
|
196
|
+
*/
|
|
197
|
+
select?: SelectFn<TSelect>;
|
|
198
|
+
};
|
|
150
199
|
export type ApplyDisableErrors<T, DisableErrors = false> = false extends DisableErrors ? T : null | T;
|
|
151
200
|
export type TransformDataWithSelect<Data extends Record<string, any>, Select extends SelectType> = Select extends never ? Data : string extends keyof Select ? Data : string extends keyof Omit<Data, 'id'> ? Select extends SelectIncludeType ? {
|
|
152
201
|
[K in Data extends TypeWithID ? 'id' | keyof Select : keyof Select]: K extends 'id' ? number | string : unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,KAAK,UAAU,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,E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MAAM,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAAE,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAA;AAEnE,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,OAAO,CAC9D,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CACrC,GACC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEtC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA"}
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type { I18n, TFunction } from '@payloadcms/translations'\nimport type DataLoader from 'dataloader'\nimport type { OptionalKeys, RequiredKeys } from 'ts-essentials'\nimport type { URL } from 'url'\n\nimport type {\n DataFromCollectionSlug,\n QueryDraftDataFromCollectionSlug,\n TypeWithID,\n TypeWithTimestamps,\n} from '../collections/config/types.js'\nimport type payload from '../index.js'\nimport type {\n CollectionSlug,\n DataFromGlobalSlug,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedCollectionJoins,\n TypedCollectionSelect,\n TypedFallbackLocale,\n TypedLocale,\n TypedUser,\n} from '../index.js'\nimport type { File } from '../uploads/types.js'\nimport type { Operator } from './constants.js'\nexport type { Payload } from '../index.js'\n\nexport type CustomPayloadRequestProperties = {\n context: RequestContext\n /** The locale that should be used for a field when it is not translated to the requested locale */\n fallbackLocale?: TypedFallbackLocale\n i18n: I18n\n /**\n * The requested locale if specified\n * Only available for localized collections\n *\n * Suppressing warning below as it is a valid use case - won't be an issue if generated types exist\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n locale?: 'all' | TypedLocale\n /**\n * The payload object\n */\n payload: typeof payload\n /**\n * The context in which the request is being made\n */\n payloadAPI: 'GraphQL' | 'local' | 'REST'\n /** Optimized document loader */\n payloadDataLoader: {\n /**\n * Wraps `payload.find` with a cache to deduplicate requests\n * @experimental This is may be replaced by a more robust cache strategy in future versions\n * By calling this method with the same arguments many times in one request, it will only be handled one time\n * const result = await req.payloadDataLoader.find({\n * collection,\n * req,\n * where: findWhere,\n * })\n */\n find: Payload['find']\n } & DataLoader<string, TypeWithID>\n /** Resized versions of the image that was uploaded during this request */\n payloadUploadSizes?: Record<string, Buffer>\n /** Query params on the request */\n query: Record<string, unknown>\n /** Any response headers that are required to be set when a response is sent */\n responseHeaders?: Headers\n /** The route parameters\n * @example\n * /:collection/:id -> /posts/123\n * { collection: 'posts', id: '123' }\n */\n routeParams?: Record<string, unknown>\n /** Translate function - duplicate of i18n.t */\n t: TFunction\n /**\n * Identifier for the database transaction for interactions in a single, all-or-nothing operation.\n * Can also be used to ensure consistency when multiple operations try to create a transaction concurrently on the same request.\n */\n transactionID?: number | Promise<number | string> | string\n /**\n * Used to ensure consistency when multiple operations try to create a transaction concurrently on the same request\n * @deprecated This is not used anywhere, instead `transactionID` is used for the above. Will be removed in next major version.\n */\n transactionIDPromise?: Promise<void>\n /** The signed-in user */\n user: null | TypedUser\n} & Pick<\n URL,\n 'hash' | 'host' | 'href' | 'origin' | 'pathname' | 'port' | 'protocol' | 'search' | 'searchParams'\n>\ntype PayloadRequestData = {\n /**\n * Data from the request body\n *\n * Within Payload operations, i.e. hooks, data will be there\n * BUT in custom endpoints it will not be, you will need to\n * use either:\n * 1. `const data = await req.json()`\n *\n * 2. import { addDataAndFileToRequest } from 'payload'\n * `await addDataAndFileToRequest(req)`\n *\n * You should not expect this object to be the document data. It is the request data.\n * */\n data?: JsonObject\n /** The file on the request, same rules apply as the `data` property */\n file?: {\n /**\n * Context of the file when it was uploaded via client side.\n */\n clientUploadContext?: unknown\n } & File\n /** All files from multipart form data, keyed by field name */\n files?: Record<string, File | File[]>\n}\nexport interface PayloadRequest\n extends CustomPayloadRequestProperties,\n Partial<Request>,\n PayloadRequestData {\n headers: Request['headers']\n}\n\nexport type { Operator }\n\n// Makes it so things like passing new Date() will error\nexport type JsonValue = JsonArray | JsonObject | unknown //Date | JsonArray | JsonObject | boolean | null | number | string // TODO: Evaluate proper, strong type for this\n\nexport type JsonArray = Array<JsonValue>\n\nexport interface JsonObject {\n [key: string]: any\n}\n\nexport type WhereField = {\n // any json-serializable value\n [key in Operator]?: JsonValue\n}\n\nexport type Where = {\n [key: string]: Where[] | WhereField\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n and?: Where[]\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n or?: Where[]\n}\n\nexport type Sort = Array<string> | string\n\ntype SerializableValue = boolean | number | object | string\nexport type DefaultValue =\n | ((args: {\n locale?: TypedLocale\n req: PayloadRequest\n user: PayloadRequest['user']\n }) => SerializableValue)\n | SerializableValue\n\n/**\n * Applies pagination for join fields for including collection relationships\n */\nexport type JoinQuery<TSlug extends CollectionSlug = string> =\n TypedCollectionJoins[TSlug] extends Record<string, string>\n ?\n | false\n | Partial<{\n [K in keyof TypedCollectionJoins[TSlug]]:\n | {\n count?: boolean\n limit?: number\n page?: number\n sort?: string\n where?: Where\n }\n | false\n }>\n : never\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Document = any\n\nexport type Operation = 'create' | 'delete' | 'read' | 'update'\nexport type VersionOperations = 'readVersions'\nexport type AuthOperations = 'unlock'\nexport type AllOperations = AuthOperations | Operation | VersionOperations\n\nexport function docHasTimestamps(doc: any): doc is TypeWithTimestamps {\n return doc?.createdAt && doc?.updatedAt\n}\n\nexport type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N // This is a commonly used trick to detect 'any'\nexport type IsAny<T> = IfAny<T, true, false>\nexport type ReplaceAny<T, DefaultType> = IsAny<T> extends true ? DefaultType : T\n\nexport type SelectIncludeType = {\n [k: string]: SelectIncludeType | true\n}\n\nexport type SelectExcludeType = {\n [k: string]: false | SelectExcludeType\n}\n\nexport type SelectMode = 'exclude' | 'include'\n\nexport type SelectType = SelectExcludeType | SelectIncludeType\n\nexport type ApplyDisableErrors<T, DisableErrors = false> = false extends DisableErrors\n ? T\n : null | T\n\nexport type TransformDataWithSelect<\n Data extends Record<string, any>,\n Select extends SelectType,\n> = Select extends never\n ? Data\n : string extends keyof Select\n ? Data\n : // START Handle types when they aren't generated\n // For example in any package in this repository outside of tests / plugins\n // This stil gives us autocomplete when using include select mode, i.e select: {title :true} returns type {title: any, id: string | number}\n string extends keyof Omit<Data, 'id'>\n ? Select extends SelectIncludeType\n ? {\n [K in Data extends TypeWithID ? 'id' | keyof Select : keyof Select]: K extends 'id'\n ? number | string\n : unknown\n }\n : Data\n : // END Handle types when they aren't generated\n // Handle include mode\n Select extends SelectIncludeType\n ? {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | true\n ? K\n : never\n : // select 'id' always\n K extends 'id'\n ? K\n : never]: Data[K]\n }\n : // Handle exclude mode\n {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | undefined\n ? K\n : never\n : K]: Data[K]\n }\n\nexport type TransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromCollectionSlug<TSlug>, TSelect>\n : DataFromCollectionSlug<TSlug>\n\nexport type DraftTransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<QueryDraftDataFromCollectionSlug<TSlug>, TSelect>\n : QueryDraftDataFromCollectionSlug<TSlug>\n\nexport type TransformGlobalWithSelect<\n TSlug extends GlobalSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromGlobalSlug<TSlug>, TSelect>\n : DataFromGlobalSlug<TSlug>\n\nexport type PopulateType = Partial<TypedCollectionSelect>\n\nexport type ResolvedFilterOptions = { [collection: string]: Where }\n\nexport type PickPreserveOptional<T, K extends keyof T> = Partial<\n Pick<T, Extract<K, OptionalKeys<T>>>\n> &\n Pick<T, Extract<K, RequiredKeys<T>>>\n\nexport type MaybePromise<T> = Promise<T> | T\n"],"names":["docHasTimestamps","doc","createdAt","updatedAt"],"mappings":"AA4LA,OAAO,SAASA,iBAAiBC,GAAQ;IACvC,OAAOA,KAAKC,aAAaD,KAAKE;AAChC"}
|
|
1
|
+
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["import type { I18n, TFunction } from '@payloadcms/translations'\nimport type DataLoader from 'dataloader'\nimport type { OptionalKeys, RequiredKeys } from 'ts-essentials'\nimport type { URL } from 'url'\n\nimport type { ServerAdapter } from '../admin/adapters/server.js'\nimport type {\n DataFromCollectionSlug,\n QueryDraftDataFromCollectionSlug,\n TypeWithID,\n TypeWithTimestamps,\n} from '../collections/config/types.js'\nimport type payload from '../index.js'\nimport type {\n CollectionSlug,\n DataFromGlobalSlug,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedCollectionJoins,\n TypedCollectionSelect,\n TypedFallbackLocale,\n TypedLocale,\n TypedUser,\n} from '../index.js'\nimport type { File } from '../uploads/types.js'\nimport type { Operator } from './constants.js'\nexport type { TypeWithID } from '../collections/config/types.js'\nexport type { Payload } from '../index.js'\n\nexport type CustomPayloadRequestProperties = {\n context: RequestContext\n /** The locale that should be used for a field when it is not translated to the requested locale */\n fallbackLocale?: TypedFallbackLocale\n i18n: I18n\n /**\n * The requested locale if specified\n * Only available for localized collections\n *\n * Suppressing warning below as it is a valid use case - won't be an issue if generated types exist\n */\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n locale?: 'all' | TypedLocale\n /**\n * The payload object\n */\n payload: typeof payload\n /**\n * The context in which the request is being made\n */\n payloadAPI: 'GraphQL' | 'local' | 'REST'\n /** Optimized document loader */\n payloadDataLoader: {\n /**\n * Wraps `payload.find` with a cache to deduplicate requests\n * @experimental This is may be replaced by a more robust cache strategy in future versions\n * By calling this method with the same arguments many times in one request, it will only be handled one time\n * const result = await req.payloadDataLoader.find({\n * collection,\n * req,\n * where: findWhere,\n * })\n */\n find: Payload['find']\n } & DataLoader<string, TypeWithID>\n /** Resized versions of the image that was uploaded during this request */\n payloadUploadSizes?: Record<string, Buffer>\n /** Query params on the request */\n query: Record<string, unknown>\n /** Any response headers that are required to be set when a response is sent */\n responseHeaders?: Headers\n /** The route parameters\n * @example\n * /:collection/:id -> /posts/123\n * { collection: 'posts', id: '123' }\n */\n routeParams?: Record<string, unknown>\n /**\n * Framework abstraction for server-only navigation, cookies, and headers APIs.\n * Populated by the framework adapter (e.g. `@payloadcms/next`). Plugins that\n * have access to `req` should call methods here (`req.server.unauthorized()`,\n * `req.server.redirect(...)`) instead of importing from `next/navigation` or\n * `next/headers` directly. Optional because non-framework contexts (jobs,\n * scripts, tests) construct requests without a server adapter.\n */\n server?: ServerAdapter\n /** Translate function - duplicate of i18n.t */\n t: TFunction\n /**\n * Identifier for the database transaction for interactions in a single, all-or-nothing operation.\n * Can also be used to ensure consistency when multiple operations try to create a transaction concurrently on the same request.\n */\n transactionID?: number | Promise<number | string> | string\n /** The signed-in user */\n user: null | TypedUser\n} & Pick<\n URL,\n 'hash' | 'host' | 'href' | 'origin' | 'pathname' | 'port' | 'protocol' | 'search' | 'searchParams'\n>\ntype PayloadRequestData = {\n /**\n * Data from the request body\n *\n * Within Payload operations, i.e. hooks, data will be there\n * BUT in custom endpoints it will not be, you will need to\n * use either:\n * 1. `const data = await req.json()`\n *\n * 2. import { addDataAndFileToRequest } from 'payload'\n * `await addDataAndFileToRequest(req)`\n *\n * You should not expect this object to be the document data. It is the request data.\n * */\n data?: JsonObject\n /** The file on the request, same rules apply as the `data` property */\n file?: {\n /**\n * Context of the file when it was uploaded via client side.\n */\n clientUploadContext?: unknown\n } & File\n /** All files from multipart form data, keyed by field name */\n files?: Record<string, File | File[]>\n}\nexport interface PayloadRequest\n extends CustomPayloadRequestProperties,\n Partial<Request>,\n PayloadRequestData {\n headers: Request['headers']\n}\n\nexport type { Operator }\n\n// Makes it so things like passing new Date() will error\nexport type JsonValue = JsonArray | JsonObject | unknown //Date | JsonArray | JsonObject | boolean | null | number | string // TODO: Evaluate proper, strong type for this\n\nexport type JsonArray = Array<JsonValue>\n\nexport interface JsonObject {\n [key: string]: any\n}\n\nexport type WhereField = {\n // any json-serializable value\n [key in Operator]?: JsonValue\n}\n\nexport type Where = {\n [key: string]: Where[] | WhereField\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n and?: Where[]\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n or?: Where[]\n}\n\nexport type Sort = Array<string> | string\n\ntype SerializableValue = boolean | number | object | string\nexport type DefaultValue =\n | ((args: {\n locale?: TypedLocale\n req: PayloadRequest\n user: PayloadRequest['user']\n }) => SerializableValue)\n | SerializableValue\n\n/**\n * Applies pagination for join fields for including collection relationships\n */\nexport type JoinQuery<TSlug extends CollectionSlug = string> =\n TypedCollectionJoins[TSlug] extends Record<string, string>\n ?\n | false\n | Partial<{\n [K in keyof TypedCollectionJoins[TSlug]]:\n | {\n count?: boolean\n limit?: number\n page?: number\n sort?: string\n where?: Where\n }\n | false\n }>\n : never\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Document = any\n\nexport type Operation = 'create' | 'delete' | 'read' | 'update'\nexport type VersionOperations = 'readVersions'\nexport type AuthOperations = 'unlock'\nexport type AllOperations = AuthOperations | Operation | VersionOperations\n\nexport function docHasTimestamps(doc: any): doc is TypeWithTimestamps {\n return doc?.createdAt && doc?.updatedAt\n}\n\nexport type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N // This is a commonly used trick to detect 'any'\nexport type IsAny<T> = IfAny<T, true, false>\nexport type ReplaceAny<T, DefaultType> = IsAny<T> extends true ? DefaultType : T\n\nexport type SelectIncludeType = {\n [k: string]: SelectIncludeType | true\n}\n\nexport type SelectExcludeType = {\n [k: string]: false | SelectExcludeType\n}\n\nexport type SelectMode = 'exclude' | 'include'\n\nexport type SelectType = SelectExcludeType | SelectIncludeType\n\n/**\n * Operations that invoke an entity-level `select` function.\n *\n * Narrower than `HookOperationType`: `select` runs only for read- and\n * write-path operations that materialize a document (`create`, `delete`,\n * `read`, `restoreVersion`, `update`). Operations like `autosave`, `count`,\n * `countVersions`, `forgotPassword`, `login`, `readDistinct`, `refresh`, and\n * `resetPassword` do not invoke `select` and are intentionally excluded.\n */\nexport type SelectFnOperation = 'create' | 'delete' | 'read' | 'restoreVersion' | 'update'\n\nexport type SelectFnArgs = {\n operation: SelectFnOperation\n req: PayloadRequest\n /** The caller's `select` arg, or `undefined` if not provided. */\n select?: SelectType\n}\n\nexport type SelectFn<TSelect extends SelectType = SelectType> = (\n args: SelectFnArgs,\n) => TSelect | undefined\n\n/**\n * Shared shape for the entity-level `select` config used by Collections and Globals.\n * The JSDoc on the `select` property is the single source of truth — pick from this\n * type when defining the config:\n *\n * & Pick<WithSelectFn<...>, 'select'>\n */\nexport type WithSelectFn<TSelect extends SelectType = SelectType> = {\n /**\n * Entity-level Select API configuration.\n *\n * A function that receives the current request context (`operation`, `req`,\n * the caller's `select`) and returns the final `select` to apply, replacing\n * the caller's. Return `undefined` to leave the caller's `select` unchanged.\n *\n * Useful to dynamically modify the caller's selection based on the request context:\n * - Forcing a field to be populated for reference within hooks / access control.\n * - Differentiating between API requests and admin panel requests, to optimize\n * the amount of data being queried in each case.\n *\n * Note: per-document data is not available — this runs before the read.\n *\n * @see https://payloadcms.com/docs/queries/select\n */\n select?: SelectFn<TSelect>\n}\n\nexport type ApplyDisableErrors<T, DisableErrors = false> = false extends DisableErrors\n ? T\n : null | T\n\nexport type TransformDataWithSelect<\n Data extends Record<string, any>,\n Select extends SelectType,\n> = Select extends never\n ? Data\n : string extends keyof Select\n ? Data\n : // START Handle types when they aren't generated\n // For example in any package in this repository outside of tests / plugins\n // This stil gives us autocomplete when using include select mode, i.e select: {title :true} returns type {title: any, id: string | number}\n string extends keyof Omit<Data, 'id'>\n ? Select extends SelectIncludeType\n ? {\n [K in Data extends TypeWithID ? 'id' | keyof Select : keyof Select]: K extends 'id'\n ? number | string\n : unknown\n }\n : Data\n : // END Handle types when they aren't generated\n // Handle include mode\n Select extends SelectIncludeType\n ? {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | true\n ? K\n : never\n : // select 'id' always\n K extends 'id'\n ? K\n : never]: Data[K]\n }\n : // Handle exclude mode\n {\n [K in keyof Data as K extends keyof Select\n ? Select[K] extends object | undefined\n ? K\n : never\n : K]: Data[K]\n }\n\nexport type TransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromCollectionSlug<TSlug>, TSelect>\n : DataFromCollectionSlug<TSlug>\n\nexport type DraftTransformCollectionWithSelect<\n TSlug extends CollectionSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<QueryDraftDataFromCollectionSlug<TSlug>, TSelect>\n : QueryDraftDataFromCollectionSlug<TSlug>\n\nexport type TransformGlobalWithSelect<\n TSlug extends GlobalSlug,\n TSelect extends SelectType,\n> = TSelect extends SelectType\n ? TransformDataWithSelect<DataFromGlobalSlug<TSlug>, TSelect>\n : DataFromGlobalSlug<TSlug>\n\nexport type PopulateType = Partial<TypedCollectionSelect>\n\nexport type ResolvedFilterOptions = { [collection: string]: Where }\n\nexport type PickPreserveOptional<T, K extends keyof T> = Partial<\n Pick<T, Extract<K, OptionalKeys<T>>>\n> &\n Pick<T, Extract<K, RequiredKeys<T>>>\n\nexport type MaybePromise<T> = Promise<T> | T\n"],"names":["docHasTimestamps","doc","createdAt","updatedAt"],"mappings":"AAkMA,OAAO,SAASA,iBAAiBC,GAAQ;IACvC,OAAOA,KAAKC,aAAaD,KAAKE;AAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFileAccess.d.ts","sourceRoot":"","sources":["../../src/uploads/checkFileAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,mBAAmB,CAAA;AAK9D,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"checkFileAccess.d.ts","sourceRoot":"","sources":["../../src/uploads/checkFileAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,mBAAmB,CAAA;AAK9D,eAAO,MAAM,eAAe,GAAU,wCAKnC;IACD,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,cAAc,CAAA;CACpB,KAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CA8CjC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFileRestrictions.d.ts","sourceRoot":"","sources":["../../src/uploads/checkFileRestrictions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAS5E;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAgC3C,CAAA;AAED,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"checkFileRestrictions.d.ts","sourceRoot":"","sources":["../../src/uploads/checkFileRestrictions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAS5E;;GAEG;AACH,eAAO,MAAM,6BAA6B,EAAE,aAgC3C,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAU,4BAIzC,2BAA2B,KAAG,OAAO,CAAC,IAAI,CAyJ5C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docWithFilenameExists.d.ts","sourceRoot":"","sources":["../../src/uploads/docWithFilenameExists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,mBAAmB,CAAA;AAE9D,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"docWithFilenameExists.d.ts","sourceRoot":"","sources":["../../src/uploads/docWithFilenameExists.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAS,MAAM,mBAAmB,CAAA;AAE9D,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,cAAc,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAU,4CAKzC,IAAI,KAAG,OAAO,CAAC,OAAO,CAkBxB,CAAA"}
|