payload 4.0.0-beta.2 → 4.0.0-beta.4

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.
Files changed (122) hide show
  1. package/dist/admin/adapters/router.d.ts +1 -1
  2. package/dist/admin/adapters/router.d.ts.map +1 -1
  3. package/dist/admin/adapters/router.js.map +1 -1
  4. package/dist/admin/initAdminContext.js.map +1 -1
  5. package/dist/auth/getFieldsToSign.js.map +1 -1
  6. package/dist/auth/loginWithCookie.js.map +1 -1
  7. package/dist/auth/serverFunctions/cookies.js.map +1 -1
  8. package/dist/auth/serverFunctions/login.js.map +1 -1
  9. package/dist/auth/types.d.ts.map +1 -1
  10. package/dist/auth/types.js.map +1 -1
  11. package/dist/cli/commands/data/utilities.d.ts +1 -1
  12. package/dist/cli/commands/data/utilities.d.ts.map +1 -1
  13. package/dist/cli/commands/data/utilities.js.map +1 -1
  14. package/dist/cli/defineCLICommand.js +1 -1
  15. package/dist/cli/defineCLICommand.js.map +1 -1
  16. package/dist/collections/config/client.js.map +1 -1
  17. package/dist/collections/config/types.d.ts.map +1 -1
  18. package/dist/collections/config/types.js.map +1 -1
  19. package/dist/collections/operations/findByID.js.map +1 -1
  20. package/dist/collections/operations/findVersionByID.js.map +1 -1
  21. package/dist/collections/operations/findVersions.js.map +1 -1
  22. package/dist/collections/operations/local/findDistinct.js.map +1 -1
  23. package/dist/collections/operations/renameFile.js +1 -1
  24. package/dist/collections/operations/renameFile.js.map +1 -1
  25. package/dist/collections/operations/utilities/update.js +1 -1
  26. package/dist/collections/operations/utilities/update.js.map +1 -1
  27. package/dist/collections/operations/validate.js +4 -4
  28. package/dist/collections/operations/validate.js.map +1 -1
  29. package/dist/config/definePlugin.js.map +1 -1
  30. package/dist/config/sanitize.js +2 -2
  31. package/dist/config/sanitize.js.map +1 -1
  32. package/dist/config/types.d.ts.map +1 -1
  33. package/dist/config/types.js.map +1 -1
  34. package/dist/database/types.d.ts +4 -0
  35. package/dist/database/types.d.ts.map +1 -1
  36. package/dist/database/types.js.map +1 -1
  37. package/dist/exports/build-config.d.ts +9 -0
  38. package/dist/exports/build-config.d.ts.map +1 -0
  39. package/dist/exports/build-config.js +38 -0
  40. package/dist/exports/build-config.js.map +1 -0
  41. package/dist/fields/config/client.js.map +1 -1
  42. package/dist/fields/config/reservedFieldNames.d.ts.map +1 -1
  43. package/dist/fields/config/reservedFieldNames.js.map +1 -1
  44. package/dist/fields/config/types.d.ts.map +1 -1
  45. package/dist/fields/config/types.js.map +1 -1
  46. package/dist/fields/hooks/afterChange/promise.js.map +1 -1
  47. package/dist/fields/hooks/afterRead/promise.js.map +1 -1
  48. package/dist/fields/hooks/beforeChange/flattenValidationData.d.ts +14 -0
  49. package/dist/fields/hooks/beforeChange/flattenValidationData.d.ts.map +1 -0
  50. package/dist/fields/hooks/beforeChange/flattenValidationData.js +36 -0
  51. package/dist/fields/hooks/beforeChange/flattenValidationData.js.map +1 -0
  52. package/dist/fields/hooks/beforeChange/promise.d.ts +2 -1
  53. package/dist/fields/hooks/beforeChange/promise.d.ts.map +1 -1
  54. package/dist/fields/hooks/beforeChange/promise.js +96 -22
  55. package/dist/fields/hooks/beforeChange/promise.js.map +1 -1
  56. package/dist/fields/hooks/beforeChange/traverseFields.d.ts +2 -1
  57. package/dist/fields/hooks/beforeChange/traverseFields.d.ts.map +1 -1
  58. package/dist/fields/hooks/beforeChange/traverseFields.js +2 -1
  59. package/dist/fields/hooks/beforeChange/traverseFields.js.map +1 -1
  60. package/dist/fields/validations.d.ts.map +1 -1
  61. package/dist/fields/validations.js +4 -1
  62. package/dist/fields/validations.js.map +1 -1
  63. package/dist/globals/config/types.d.ts.map +1 -1
  64. package/dist/globals/config/types.js.map +1 -1
  65. package/dist/globals/operations/local/findOne.js.map +1 -1
  66. package/dist/globals/operations/local/update.js.map +1 -1
  67. package/dist/globals/operations/restoreVersion.d.ts +2 -3
  68. package/dist/globals/operations/restoreVersion.d.ts.map +1 -1
  69. package/dist/globals/operations/restoreVersion.js +22 -15
  70. package/dist/globals/operations/restoreVersion.js.map +1 -1
  71. package/dist/globals/operations/validate.js +1 -1
  72. package/dist/globals/operations/validate.js.map +1 -1
  73. package/dist/hierarchy/createFolderField.js.map +1 -1
  74. package/dist/hierarchy/resolveHierarchyCollections.js +2 -2
  75. package/dist/hierarchy/resolveHierarchyCollections.js.map +1 -1
  76. package/dist/hierarchy/utils/computePaths.d.ts.map +1 -1
  77. package/dist/hierarchy/utils/computePaths.js.map +1 -1
  78. package/dist/index.bundled.d.ts +18 -4
  79. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js +1 -1
  80. package/dist/queues/operations/runJobs/runJob/getRunTaskFunction.js.map +1 -1
  81. package/dist/types/index.d.ts.map +1 -1
  82. package/dist/types/index.js.map +1 -1
  83. package/dist/uploads/fileVersioning/archive.js.map +1 -1
  84. package/dist/uploads/fileVersioning/cloudStorage.js.map +1 -1
  85. package/dist/uploads/fileVersioning/resolveHistoricalFile.js.map +1 -1
  86. package/dist/uploads/generateFileData.d.ts.map +1 -1
  87. package/dist/uploads/generateFileData.js.map +1 -1
  88. package/dist/uploads/getFileContentRequirement.js.map +1 -1
  89. package/dist/uploads/getFileFromUploadInstructions.js.map +1 -1
  90. package/dist/uploads/safeFetch.js.map +1 -1
  91. package/dist/uploads/stagedUpload.js.map +1 -1
  92. package/dist/uploads/transformers/handleDynamicFileRequest.js +11 -2
  93. package/dist/uploads/transformers/handleDynamicFileRequest.js.map +1 -1
  94. package/dist/utilities/addSelectGenericsToGeneretedTypes.d.ts.map +1 -1
  95. package/dist/utilities/addSelectGenericsToGeneretedTypes.js +0 -1
  96. package/dist/utilities/addSelectGenericsToGeneretedTypes.js.map +1 -1
  97. package/dist/utilities/appendDateTimezoneSelectFields.js.map +1 -1
  98. package/dist/utilities/cloneValidationRequest.js.map +1 -1
  99. package/dist/utilities/createPayloadRequest.js.map +1 -1
  100. package/dist/utilities/deepCopyObject.js.map +1 -1
  101. package/dist/utilities/documentMatchingWhereExists.js +1 -1
  102. package/dist/utilities/documentMatchingWhereExists.js.map +1 -1
  103. package/dist/utilities/entityInputSchema/validateEntityData.d.ts.map +1 -1
  104. package/dist/utilities/entityInputSchema/validateEntityData.js.map +1 -1
  105. package/dist/utilities/filterDataToSelectedLocales.js.map +1 -1
  106. package/dist/utilities/getEntityPermissions/getEntityPermissions.d.ts.map +1 -1
  107. package/dist/utilities/getEntityPermissions/getEntityPermissions.js +1 -0
  108. package/dist/utilities/getEntityPermissions/getEntityPermissions.js.map +1 -1
  109. package/dist/utilities/getEntityPermissions/populateFieldPermissions.js.map +1 -1
  110. package/dist/utilities/getVersionsConfig.js.map +1 -1
  111. package/dist/utilities/parseParams/index.js.map +1 -1
  112. package/dist/utilities/parseValidationLocale.js.map +1 -1
  113. package/dist/utilities/sanitizePopulateParam.js.map +1 -1
  114. package/dist/utilities/telemetry/conf/index.d.ts +4 -1
  115. package/dist/utilities/telemetry/conf/index.d.ts.map +1 -1
  116. package/dist/utilities/telemetry/conf/index.js.map +1 -1
  117. package/dist/utilities/telemetry/featureInfo/getFeatureInfo.js.map +1 -1
  118. package/dist/versions/allLocalesPublicationStatus.js.map +1 -1
  119. package/dist/versions/isInheritedReadVersionsAccess.js.map +1 -1
  120. package/package.json +29 -27
  121. package/skills/payload/reference/ENDPOINTS.md +3 -9
  122. package/skills/payload/reference/PLUGIN-DEVELOPMENT.md +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hierarchy/utils/computePaths.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { Document, PayloadRequest } from '../../types/index.js'\n\nimport { slugify as payloadSlugify } from '../../utilities/slugify.js'\nimport { HIERARCHY_SLUG_PATH_FIELD, HIERARCHY_TITLE_PATH_FIELD } from '../constants.js'\nimport { buildLocalizedHierarchyPaths } from './buildLocalizedHierarchyPaths.js'\nimport { findFieldByName, findUseAsTitleField } from './findUseAsTitle.js'\nimport { getLocalizedValue } from './getLocalizedValue.js'\n\ntype ComputePathsArgs = {\n collection: SanitizedCollectionConfig\n doc: Document\n draft?: boolean\n locale?: string\n parentFieldName: string\n req: PayloadRequest\n slugPathFieldName?: string\n titlePathFieldName?: string\n}\n\ntype ComputePathsResult = {\n slugPath: Record<string, string> | string\n titlePath: Record<string, string> | string\n}\n\n// Helper to get title value - returns string for single locale, object for 'all' locales\nconst getTitleValue = ({\n document,\n isTitleLocalized = false,\n locale,\n req,\n titleFieldName,\n}: {\n document: Document\n isTitleLocalized?: boolean\n locale?: string\n req: PayloadRequest\n titleFieldName: string\n}): Record<string, string> | string => {\n const titleValue = document[titleFieldName]\n\n if (!titleValue) {\n return document.id?.toString() || 'untitled'\n }\n\n // If field is localized and we want all locales, return the full object\n if (isTitleLocalized && locale === 'all' && typeof titleValue === 'object') {\n return titleValue\n }\n\n // Single locale - use getLocalizedValue to handle fallback\n if (isTitleLocalized && typeof titleValue === 'object') {\n const localizedValue = getLocalizedValue({\n fallbackLocale: req.fallbackLocale,\n fieldType: 'text',\n locale: locale || req.locale || 'en',\n value: titleValue,\n })\n return localizedValue || document.id?.toString() || 'untitled'\n }\n\n return titleValue\n}\n\n// Helper to get slug value from a dedicated slug field\nconst getSlugFieldValue = ({\n document,\n isSlugLocalized = false,\n locale,\n req,\n slugFieldName,\n}: {\n document: Document\n isSlugLocalized?: boolean\n locale?: string\n req: PayloadRequest\n slugFieldName: string\n}): Record<string, string> | string | undefined => {\n const slugValue = document[slugFieldName]\n\n if (!slugValue) {\n return undefined\n }\n\n // If field is localized and we want all locales, return the full object\n if (isSlugLocalized && locale === 'all' && typeof slugValue === 'object') {\n return slugValue\n }\n\n // Single locale - use getLocalizedValue to handle fallback\n if (isSlugLocalized && typeof slugValue === 'object') {\n const localizedValue = getLocalizedValue({\n fallbackLocale: req.fallbackLocale,\n fieldType: 'text',\n locale: locale || req.locale || 'en',\n value: slugValue,\n })\n return localizedValue || undefined\n }\n\n return slugValue\n}\n\n/**\n * Computes both slug and title breadcrumb paths for a document by walking up the parent chain.\n * More efficient than computing them separately since it only walks the chain once.\n *\n * Note: Ancestor fetches always use `overrideAccess: true` to ensure paths are complete.\n * If a user can read a document, they should see its full breadcrumb path even if they\n * cannot read all ancestor documents. This prevents broken breadcrumbs and provides\n * better UX at the cost of minimal information leakage (ancestor titles in paths).\n *\n * @param args - Configuration for path computation\n * @returns Object with slugPath and titlePath\n */\nexport async function computePaths(args: ComputePathsArgs): Promise<ComputePathsResult> {\n const {\n collection,\n doc,\n draft = false,\n locale,\n parentFieldName,\n req,\n slugPathFieldName = HIERARCHY_SLUG_PATH_FIELD,\n titlePathFieldName = HIERARCHY_TITLE_PATH_FIELD,\n } = args\n\n const slugify =\n (collection.hierarchy !== false && collection.hierarchy.slugify) ||\n ((text: string) => payloadSlugify(text) || '')\n const { localized: isTitleLocalized, titleFieldName } = findUseAsTitleField(collection)\n\n // Check for dedicated slug field\n const slugFieldName = collection.hierarchy !== false ? collection.hierarchy.slugField : undefined\n const slugFieldInfo = slugFieldName ? findFieldByName(collection, slugFieldName) : undefined\n const isSlugFieldLocalized = slugFieldInfo?.localized ?? false\n\n // Initialize cache if it doesn't exist\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const context = req.context as any\n if (!context.hierarchyAncestorCache) {\n context.hierarchyAncestorCache = {}\n }\n if (!context.hierarchyAncestorCache[collection.slug]) {\n context.hierarchyAncestorCache[collection.slug] = {}\n }\n\n // Initialize cache stats if debug is enabled\n if (req.payload.config.debug && !context.hierarchyCacheStats) {\n context.hierarchyCacheStats = {\n hits: 0,\n misses: 0,\n queries: 0,\n }\n }\n\n const parentValue = doc[parentFieldName]\n let parentID: number | string | undefined\n\n if (!parentValue) {\n // No parent - root document\n parentID = undefined\n } else {\n // Extract ID from parent value\n // Parent can be:\n // - Plain ID (string/number)\n // - Populated object with { id: ... }\n if (typeof parentValue === 'object' && 'id' in parentValue) {\n parentID = parentValue.id\n } else {\n parentID = parentValue as number | string\n }\n }\n\n if (parentID) {\n // Parent is always from the same collection (self-referential)\n const parentCollectionConfig = collection\n const parentHierarchyConfig = parentCollectionConfig.hierarchy\n\n // If parent collection doesn't have hierarchy, we can't compute paths through it\n if (!parentHierarchyConfig || !parentCollectionConfig) {\n const titleValue = getTitleValue({\n document: doc,\n isTitleLocalized,\n locale,\n req,\n titleFieldName,\n })\n\n const slugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n if (isTitleLocalized && locale === 'all') {\n return buildLocalizedHierarchyPaths({\n req,\n slugify,\n slugValue: slugValue as Record<string, string> | undefined,\n titleValue: titleValue as Record<string, string>,\n })\n }\n\n return {\n slugPath: slugValue !== undefined ? (slugValue as string) : slugify(titleValue as string),\n titlePath: titleValue as string,\n }\n }\n\n // Initialize cache for parent collection if needed\n if (!context.hierarchyAncestorCache[collection.slug]) {\n context.hierarchyAncestorCache[collection.slug] = {}\n }\n\n const cache = context.hierarchyAncestorCache[collection.slug]\n const cacheKey = `${parentID}_${locale || 'default'}`\n\n // Check cache first\n let parent = cache[cacheKey]\n\n if (parent) {\n // Cache hit\n if (context.hierarchyCacheStats) {\n context.hierarchyCacheStats.hits += 1\n }\n } else {\n // Cache miss - fetch parent\n if (context.hierarchyCacheStats) {\n context.hierarchyCacheStats.misses += 1\n context.hierarchyCacheStats.queries += 1\n }\n\n const parentTitleField = findUseAsTitleField(parentCollectionConfig).titleFieldName\n\n // parentID is guaranteed to be defined here (we're inside if (parentID))\n const validParentID = parentID\n\n // Create new context with computeHierarchyPaths enabled to trigger recursive path computation\n const parentReq = {\n ...req,\n context: {\n ...req.context,\n computeHierarchyPaths: true,\n },\n }\n\n // Fetch parent\n // When locale === 'all', we need special handling because Payload doesn't support\n // fetching all locales of a draft document (drafts are stored per-locale).\n // Strategy: Try published first, fallback to fetching each locale separately for drafts.\n const fetchParent = async () => {\n if (locale === 'all') {\n try {\n // First try to fetch published version with all locales\n return await req.payload.findByID({\n id: validParentID,\n collection: collection.slug,\n depth: 0,\n locale,\n overrideAccess: true,\n req: parentReq,\n select: {\n [parentHierarchyConfig.parentFieldName]: true,\n [parentHierarchyConfig.slugPathFieldName]: true,\n [parentHierarchyConfig.titlePathFieldName]: true,\n [parentTitleField]: true,\n ...(slugFieldName ? { [slugFieldName]: true } : {}),\n },\n user: req.user,\n })\n } catch (_error) {\n // Published version not found, must be a draft\n // Payload doesn't support fetching all locales of a draft with a single query\n // So we need to fetch each locale separately and combine the path data\n const locales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : []\n const parentPathsByLocale: Record<\n string,\n { slugPath?: string; title?: string; titlePath?: string }\n > = {}\n\n // Get parent collection's slugify function (may differ from child's)\n const parentSlugify =\n (parentCollectionConfig.hierarchy !== false &&\n parentCollectionConfig.hierarchy.slugify) ||\n ((text: string) => payloadSlugify(text) || '')\n\n // Fetch parent for each locale to get paths\n for (const loc of locales) {\n // Create a new request with this specific locale but keep computeHierarchyPaths flag\n const localeReq = {\n ...req,\n context: {\n ...req.context,\n computeHierarchyPaths: true,\n },\n locale: loc,\n }\n\n try {\n const parentForLocale = await req.payload.findByID({\n id: validParentID,\n collection: collection.slug,\n depth: 0,\n draft: true,\n locale: loc,\n overrideAccess: true,\n req: localeReq,\n user: req.user,\n })\n\n // Extract the path fields and title from the parent\n // If paths weren't computed (undefined), compute them manually for root documents\n let parentSlugPath = parentForLocale[parentHierarchyConfig.slugPathFieldName]\n let parentTitlePath = parentForLocale[parentHierarchyConfig.titlePathFieldName]\n const parentTitle = parentForLocale[parentTitleField]\n\n // If paths are undefined, this might be a root document - compute paths from title\n if (!parentSlugPath && parentTitle) {\n parentSlugPath = parentSlugify(parentTitle)\n }\n if (!parentTitlePath && parentTitle) {\n parentTitlePath = parentTitle\n }\n\n parentPathsByLocale[loc] = {\n slugPath: parentSlugPath,\n title: parentTitle,\n titlePath: parentTitlePath,\n }\n } catch (_localeError) {\n // This locale doesn't exist, skip it\n }\n }\n\n // Combine the path data from all locales into a single parent object\n const combinedSlugPaths: Record<string, string | undefined> = {}\n const combinedTitlePaths: Record<string, string | undefined> = {}\n const combinedTitles: Record<string, string | undefined> = {}\n\n for (const loc of locales) {\n if (parentPathsByLocale[loc]) {\n combinedSlugPaths[loc] = parentPathsByLocale[loc].slugPath\n combinedTitlePaths[loc] = parentPathsByLocale[loc].titlePath\n combinedTitles[loc] = parentPathsByLocale[loc].title\n }\n }\n\n // Return a parent object with only the hierarchy fields we need\n // (all properly formatted as multi-locale objects)\n return {\n id: validParentID,\n [parentHierarchyConfig.slugPathFieldName]: combinedSlugPaths,\n [parentHierarchyConfig.titlePathFieldName]: combinedTitlePaths,\n [parentTitleField]: combinedTitles,\n }\n }\n } else {\n // Normal case: single locale, can pass draft parameter\n return await req.payload.findByID({\n id: validParentID,\n collection: collection.slug,\n depth: 0,\n draft,\n locale,\n overrideAccess: true,\n req: parentReq,\n select: {\n [parentHierarchyConfig.parentFieldName]: true,\n [parentHierarchyConfig.slugPathFieldName]: true,\n [parentHierarchyConfig.titlePathFieldName]: true,\n [parentTitleField]: true,\n ...(slugFieldName ? { [slugFieldName]: true } : {}),\n },\n user: req.user,\n })\n }\n }\n\n try {\n parent = await fetchParent()\n\n // Store in cache\n cache[cacheKey] = parent\n } catch {\n // If we can't fetch the parent at all (even with fallbacks), treat this as a root document\n // This can happen with complex draft/locale combinations\n parentID = undefined\n }\n }\n\n // If parent fetch failed, treat as root document\n if (!parentID || !parent) {\n const titleValue = getTitleValue({\n document: doc,\n isTitleLocalized,\n locale,\n req,\n titleFieldName,\n })\n\n const slugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n if (isTitleLocalized && locale === 'all') {\n return buildLocalizedHierarchyPaths({\n req,\n slugify,\n slugValue: slugValue as Record<string, string> | undefined,\n titleValue: titleValue as Record<string, string>,\n })\n }\n\n return {\n slugPath: slugValue !== undefined ? (slugValue as string) : slugify(titleValue as string),\n titlePath: titleValue as string,\n }\n }\n\n const docTitle = getTitleValue({ document: doc, isTitleLocalized, locale, req, titleFieldName })\n\n // Cache the current document (in its own collection's cache)\n const currentDocCacheKey = `${doc.id}_${locale || 'default'}`\n if (!context.hierarchyAncestorCache[collection.slug]) {\n context.hierarchyAncestorCache[collection.slug] = {}\n }\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey] = {\n [parentFieldName]: parentID,\n [slugPathFieldName]: undefined, // Will be set below\n [titleFieldName]: docTitle,\n [titlePathFieldName]: undefined, // Will be set below\n }\n\n // Get parent's path field names from hierarchy config\n const parentSlugPathFieldName =\n parentCollectionConfig.hierarchy !== false\n ? parentCollectionConfig.hierarchy.slugPathFieldName\n : HIERARCHY_SLUG_PATH_FIELD\n const parentTitlePathFieldName =\n parentCollectionConfig.hierarchy !== false\n ? parentCollectionConfig.hierarchy.titlePathFieldName\n : HIERARCHY_TITLE_PATH_FIELD\n\n // Handle localized case (locale === 'all' with localized title field)\n if (isTitleLocalized && locale === 'all') {\n // Parent might have non-localized title field, resulting in string paths instead of objects\n // Convert parent paths to objects if they're strings (use same value for all locales)\n let parentSlugPathObj: Record<string, string> | undefined = parent[\n parentSlugPathFieldName\n ] as Record<string, string> | undefined\n let parentTitlePathObj: Record<string, string> | undefined = parent[\n parentTitlePathFieldName\n ] as Record<string, string> | undefined\n\n // If parent paths are strings (non-localized parent), convert to objects for all locales\n if (typeof parentSlugPathObj === 'string') {\n const locales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : []\n const slugValue = parentSlugPathObj\n parentSlugPathObj = {}\n for (const loc of locales) {\n parentSlugPathObj[loc] = slugValue\n }\n }\n\n if (typeof parentTitlePathObj === 'string') {\n const locales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : []\n const titleValue = parentTitlePathObj\n parentTitlePathObj = {}\n for (const loc of locales) {\n parentTitlePathObj[loc] = titleValue\n }\n }\n\n // Get slug value if slugField is configured\n const docSlugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n // If parent paths are undefined (parent fetch failed or paths not computed),\n // buildLocalizedHierarchyPaths will handle it by using just the child's title\n const result = buildLocalizedHierarchyPaths({\n parentSlugPath: parentSlugPathObj,\n parentTitlePath: parentTitlePathObj,\n req,\n slugify,\n slugValue: docSlugValue as Record<string, string> | undefined,\n titleValue: docTitle as Record<string, string>,\n })\n\n // Update cache with computed paths\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][slugPathFieldName] =\n result.slugPath\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][titlePathFieldName] =\n result.titlePath\n\n return result\n }\n\n // Single locale case - get slug value if slugField is configured\n const singleLocaleSlugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n const slugSegment =\n singleLocaleSlugValue !== undefined\n ? (singleLocaleSlugValue as string)\n : slugify(docTitle as string)\n\n const result = {\n slugPath: (parent[parentSlugPathFieldName] as string) + '/' + slugSegment,\n titlePath: (parent[parentTitlePathFieldName] as string) + '/' + (docTitle as string),\n }\n\n // Update cache with computed paths\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][slugPathFieldName] =\n result.slugPath\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][titlePathFieldName] =\n result.titlePath\n\n return result\n } else {\n // Root document (no parent)\n const titleValue = getTitleValue({\n document: doc,\n isTitleLocalized,\n locale,\n req,\n titleFieldName,\n })\n context.hierarchyAncestorCache[collection.slug][doc.id] = {\n [parentFieldName]: null,\n [titleFieldName]: titleValue,\n }\n\n const rootSlugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n // Handle localized case (locale === 'all' with localized title field)\n if (isTitleLocalized && locale === 'all') {\n return buildLocalizedHierarchyPaths({\n req,\n slugify,\n slugValue: rootSlugValue as Record<string, string> | undefined,\n titleValue: titleValue as Record<string, string>,\n })\n }\n\n // Single locale case\n return {\n slugPath:\n rootSlugValue !== undefined ? (rootSlugValue as string) : slugify(titleValue as string),\n titlePath: titleValue as string,\n }\n }\n}\n"],"names":["slugify","payloadSlugify","HIERARCHY_SLUG_PATH_FIELD","HIERARCHY_TITLE_PATH_FIELD","buildLocalizedHierarchyPaths","findFieldByName","findUseAsTitleField","getLocalizedValue","getTitleValue","document","isTitleLocalized","locale","req","titleFieldName","titleValue","id","toString","localizedValue","fallbackLocale","fieldType","value","getSlugFieldValue","isSlugLocalized","slugFieldName","slugValue","undefined","computePaths","args","collection","doc","draft","parentFieldName","slugPathFieldName","titlePathFieldName","hierarchy","text","localized","slugField","slugFieldInfo","isSlugFieldLocalized","context","hierarchyAncestorCache","slug","payload","config","debug","hierarchyCacheStats","hits","misses","queries","parentValue","parentID","parentCollectionConfig","parentHierarchyConfig","slugPath","titlePath","cache","cacheKey","parent","parentTitleField","validParentID","parentReq","computeHierarchyPaths","fetchParent","findByID","depth","overrideAccess","select","user","_error","locales","localization","localeCodes","parentPathsByLocale","parentSlugify","loc","localeReq","parentForLocale","parentSlugPath","parentTitlePath","parentTitle","title","_localeError","combinedSlugPaths","combinedTitlePaths","combinedTitles","docTitle","currentDocCacheKey","parentSlugPathFieldName","parentTitlePathFieldName","parentSlugPathObj","parentTitlePathObj","docSlugValue","result","singleLocaleSlugValue","slugSegment","rootSlugValue"],"mappings":"AAGA,SAASA,WAAWC,cAAc,QAAQ,6BAA4B;AACtE,SAASC,yBAAyB,EAAEC,0BAA0B,QAAQ,kBAAiB;AACvF,SAASC,4BAA4B,QAAQ,oCAAmC;AAChF,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,sBAAqB;AAC1E,SAASC,iBAAiB,QAAQ,yBAAwB;AAkB1D,yFAAyF;AACzF,MAAMC,gBAAgB,CAAC,EACrBC,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C6C,mBAAmB,CAACvD,kBAAkB,GACpF6D,OAAOvC,QAAQ;QACjBd,QAAQC,sBAAsB,CAACb,WAAWc,IAAI,CAAC,CAAC6C,mBAAmB,CAACtD,mBAAmB,GACrF4D,OAAOtC,SAAS;QAElB,OAAOsC;IACT,OAAO;QACL,4BAA4B;QAC5B,MAAM/E,aAAaN,cAAc;YAC/BC,UAAUoB;YACVnB;YACAC;YACAC;YACAC;QACF;QACA2B,QAAQC,sBAAsB,CAACb,WAAWc,IAAI,CAAC,CAACb,IAAId,EAAE,CAAC,GAAG;YACxD,CAACgB,gBAAgB,EAAE;YACnB,CAAClB,eAAe,EAAEC;QACpB;QAEA,MAAMkF,gBAAgBzE,gBAClBF,kBAAkB;YAChBZ,UAAUoB;YACVP,iBAAiBiB;YACjB5B;YACAC;YACAW;QACF,KACAE;QAEJ,sEAAsE;QACtE,IAAIf,oBAAoBC,WAAW,OAAO;YACxC,OAAOP,6BAA6B;gBAClCQ;gBACAZ;gBACAwB,WAAWwE;gBACXlF,YAAYA;YACd;QACF;QAEA,qBAAqB;QACrB,OAAO;YACLwC,UACE0C,kBAAkBvE,YAAauE,gBAA2BhG,QAAQc;YACpEyC,WAAWzC;QACb;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/hierarchy/utils/computePaths.ts"],"sourcesContent":["import type { SanitizedCollectionConfig } from '../../collections/config/types.js'\nimport type { Document, PayloadRequest } from '../../types/index.js'\n\nimport { slugify as payloadSlugify } from '../../utilities/slugify.js'\nimport { HIERARCHY_SLUG_PATH_FIELD, HIERARCHY_TITLE_PATH_FIELD } from '../constants.js'\nimport { buildLocalizedHierarchyPaths } from './buildLocalizedHierarchyPaths.js'\nimport { findFieldByName, findUseAsTitleField } from './findUseAsTitle.js'\nimport { getLocalizedValue } from './getLocalizedValue.js'\n\ntype ComputePathsArgs = {\n collection: SanitizedCollectionConfig\n doc: Document\n draft?: boolean\n locale?: string\n parentFieldName: string\n req: PayloadRequest\n slugPathFieldName?: string\n titlePathFieldName?: string\n}\n\ntype ComputePathsResult = {\n slugPath: Record<string, string> | string\n titlePath: Record<string, string> | string\n}\n\n// Helper to get title value - returns string for single locale, object for 'all' locales\nconst getTitleValue = ({\n document,\n isTitleLocalized = false,\n locale,\n req,\n titleFieldName,\n}: {\n document: Document\n isTitleLocalized?: boolean\n locale?: string\n req: PayloadRequest\n titleFieldName: string\n}): Record<string, string> | string => {\n const titleValue = document[titleFieldName]\n\n if (!titleValue) {\n return document.id?.toString() || 'untitled'\n }\n\n // If field is localized and we want all locales, return the full object\n if (isTitleLocalized && locale === 'all' && typeof titleValue === 'object') {\n return titleValue\n }\n\n // Single locale - use getLocalizedValue to handle fallback\n if (isTitleLocalized && typeof titleValue === 'object') {\n const localizedValue = getLocalizedValue({\n fallbackLocale: req.fallbackLocale,\n fieldType: 'text',\n locale: locale || req.locale || 'en',\n value: titleValue,\n })\n return localizedValue || document.id?.toString() || 'untitled'\n }\n\n return titleValue\n}\n\n// Helper to get slug value from a dedicated slug field\nconst getSlugFieldValue = ({\n document,\n isSlugLocalized = false,\n locale,\n req,\n slugFieldName,\n}: {\n document: Document\n isSlugLocalized?: boolean\n locale?: string\n req: PayloadRequest\n slugFieldName: string\n}): Record<string, string> | string | undefined => {\n const slugValue = document[slugFieldName]\n\n if (!slugValue) {\n return undefined\n }\n\n // If field is localized and we want all locales, return the full object\n if (isSlugLocalized && locale === 'all' && typeof slugValue === 'object') {\n return slugValue\n }\n\n // Single locale - use getLocalizedValue to handle fallback\n if (isSlugLocalized && typeof slugValue === 'object') {\n const localizedValue = getLocalizedValue({\n fallbackLocale: req.fallbackLocale,\n fieldType: 'text',\n locale: locale || req.locale || 'en',\n value: slugValue,\n })\n return localizedValue || undefined\n }\n\n return slugValue\n}\n\n/**\n * Computes both slug and title breadcrumb paths for a document by walking up the parent chain.\n * More efficient than computing them separately since it only walks the chain once.\n *\n * Note: Ancestor fetches always use `overrideAccess: true` to ensure paths are complete.\n * If a user can read a document, they should see its full breadcrumb path even if they\n * cannot read all ancestor documents. This prevents broken breadcrumbs and provides\n * better UX at the cost of minimal information leakage (ancestor titles in paths).\n *\n * @param args - Configuration for path computation\n * @returns Object with slugPath and titlePath\n */\nexport async function computePaths(args: ComputePathsArgs): Promise<ComputePathsResult> {\n const {\n collection,\n doc,\n draft = false,\n locale,\n parentFieldName,\n req,\n slugPathFieldName = HIERARCHY_SLUG_PATH_FIELD,\n titlePathFieldName = HIERARCHY_TITLE_PATH_FIELD,\n } = args\n\n const slugify =\n (collection.hierarchy !== false && collection.hierarchy.slugify) ||\n ((text: string) => payloadSlugify(text) || '')\n const { localized: isTitleLocalized, titleFieldName } = findUseAsTitleField(collection)\n\n // Check for dedicated slug field\n const slugFieldName = collection.hierarchy !== false ? collection.hierarchy.slugField : undefined\n const slugFieldInfo = slugFieldName ? findFieldByName(collection, slugFieldName) : undefined\n const isSlugFieldLocalized = slugFieldInfo?.localized ?? false\n\n // Initialize cache if it doesn't exist\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const context = req.context as any\n if (!context.hierarchyAncestorCache) {\n context.hierarchyAncestorCache = {}\n }\n if (!context.hierarchyAncestorCache[collection.slug]) {\n context.hierarchyAncestorCache[collection.slug] = {}\n }\n\n // Initialize cache stats if debug is enabled\n if (req.payload.config.debug && !context.hierarchyCacheStats) {\n context.hierarchyCacheStats = {\n hits: 0,\n misses: 0,\n queries: 0,\n }\n }\n\n const parentValue = doc[parentFieldName]\n let parentID: number | string | undefined\n\n if (!parentValue) {\n // No parent - root document\n parentID = undefined\n } else {\n // Extract ID from parent value\n // Parent can be:\n // - Plain ID (string/number)\n // - Populated object with { id: ... }\n if (typeof parentValue === 'object' && 'id' in parentValue) {\n parentID = parentValue.id\n } else {\n parentID = parentValue as number | string\n }\n }\n\n if (parentID) {\n // Parent is always from the same collection (self-referential)\n const parentCollectionConfig = collection\n const parentHierarchyConfig = parentCollectionConfig.hierarchy\n\n // If parent collection doesn't have hierarchy, we can't compute paths through it\n if (!parentHierarchyConfig || !parentCollectionConfig) {\n const titleValue = getTitleValue({\n document: doc,\n isTitleLocalized,\n locale,\n req,\n titleFieldName,\n })\n\n const slugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n if (isTitleLocalized && locale === 'all') {\n return buildLocalizedHierarchyPaths({\n req,\n slugify,\n slugValue: slugValue as Record<string, string> | undefined,\n titleValue: titleValue as Record<string, string>,\n })\n }\n\n return {\n slugPath: slugValue !== undefined ? slugValue : slugify(titleValue as string),\n titlePath: titleValue as string,\n }\n }\n\n // Initialize cache for parent collection if needed\n if (!context.hierarchyAncestorCache[collection.slug]) {\n context.hierarchyAncestorCache[collection.slug] = {}\n }\n\n const cache = context.hierarchyAncestorCache[collection.slug]\n const cacheKey = `${parentID}_${locale || 'default'}`\n\n // Check cache first\n let parent = cache[cacheKey]\n\n if (parent) {\n // Cache hit\n if (context.hierarchyCacheStats) {\n context.hierarchyCacheStats.hits += 1\n }\n } else {\n // Cache miss - fetch parent\n if (context.hierarchyCacheStats) {\n context.hierarchyCacheStats.misses += 1\n context.hierarchyCacheStats.queries += 1\n }\n\n const parentTitleField = findUseAsTitleField(parentCollectionConfig).titleFieldName\n\n // parentID is guaranteed to be defined here (we're inside if (parentID))\n const validParentID = parentID\n\n // Create new context with computeHierarchyPaths enabled to trigger recursive path computation\n const parentReq = {\n ...req,\n context: {\n ...req.context,\n computeHierarchyPaths: true,\n },\n }\n\n // Fetch parent\n // When locale === 'all', we need special handling because Payload doesn't support\n // fetching all locales of a draft document (drafts are stored per-locale).\n // Strategy: Try published first, fallback to fetching each locale separately for drafts.\n const fetchParent = async () => {\n if (locale === 'all') {\n try {\n // First try to fetch published version with all locales\n return await req.payload.findByID({\n id: validParentID,\n collection: collection.slug,\n depth: 0,\n locale,\n overrideAccess: true,\n req: parentReq,\n select: {\n [parentHierarchyConfig.parentFieldName]: true,\n [parentHierarchyConfig.slugPathFieldName]: true,\n [parentHierarchyConfig.titlePathFieldName]: true,\n [parentTitleField]: true,\n ...(slugFieldName ? { [slugFieldName]: true } : {}),\n },\n user: req.user,\n })\n } catch (_error) {\n // Published version not found, must be a draft\n // Payload doesn't support fetching all locales of a draft with a single query\n // So we need to fetch each locale separately and combine the path data\n const locales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : []\n const parentPathsByLocale: Record<\n string,\n { slugPath?: string; title?: string; titlePath?: string }\n > = {}\n\n // Get parent collection's slugify function (may differ from child's)\n const parentSlugify =\n (parentCollectionConfig.hierarchy !== false &&\n parentCollectionConfig.hierarchy.slugify) ||\n ((text: string) => payloadSlugify(text) || '')\n\n // Fetch parent for each locale to get paths\n for (const loc of locales) {\n // Create a new request with this specific locale but keep computeHierarchyPaths flag\n const localeReq = {\n ...req,\n context: {\n ...req.context,\n computeHierarchyPaths: true,\n },\n locale: loc,\n }\n\n try {\n const parentForLocale = await req.payload.findByID({\n id: validParentID,\n collection: collection.slug,\n depth: 0,\n draft: true,\n locale: loc,\n overrideAccess: true,\n req: localeReq,\n user: req.user,\n })\n\n // Extract the path fields and title from the parent\n // If paths weren't computed (undefined), compute them manually for root documents\n let parentSlugPath = parentForLocale[parentHierarchyConfig.slugPathFieldName]\n let parentTitlePath = parentForLocale[parentHierarchyConfig.titlePathFieldName]\n const parentTitle = parentForLocale[parentTitleField]\n\n // If paths are undefined, this might be a root document - compute paths from title\n if (!parentSlugPath && parentTitle) {\n parentSlugPath = parentSlugify(parentTitle)\n }\n if (!parentTitlePath && parentTitle) {\n parentTitlePath = parentTitle\n }\n\n parentPathsByLocale[loc] = {\n slugPath: parentSlugPath,\n title: parentTitle,\n titlePath: parentTitlePath,\n }\n } catch (_localeError) {\n // This locale doesn't exist, skip it\n }\n }\n\n // Combine the path data from all locales into a single parent object\n const combinedSlugPaths: Record<string, string | undefined> = {}\n const combinedTitlePaths: Record<string, string | undefined> = {}\n const combinedTitles: Record<string, string | undefined> = {}\n\n for (const loc of locales) {\n if (parentPathsByLocale[loc]) {\n combinedSlugPaths[loc] = parentPathsByLocale[loc].slugPath\n combinedTitlePaths[loc] = parentPathsByLocale[loc].titlePath\n combinedTitles[loc] = parentPathsByLocale[loc].title\n }\n }\n\n // Return a parent object with only the hierarchy fields we need\n // (all properly formatted as multi-locale objects)\n return {\n id: validParentID,\n [parentHierarchyConfig.slugPathFieldName]: combinedSlugPaths,\n [parentHierarchyConfig.titlePathFieldName]: combinedTitlePaths,\n [parentTitleField]: combinedTitles,\n }\n }\n } else {\n // Normal case: single locale, can pass draft parameter\n return await req.payload.findByID({\n id: validParentID,\n collection: collection.slug,\n depth: 0,\n draft,\n locale,\n overrideAccess: true,\n req: parentReq,\n select: {\n [parentHierarchyConfig.parentFieldName]: true,\n [parentHierarchyConfig.slugPathFieldName]: true,\n [parentHierarchyConfig.titlePathFieldName]: true,\n [parentTitleField]: true,\n ...(slugFieldName ? { [slugFieldName]: true } : {}),\n },\n user: req.user,\n })\n }\n }\n\n try {\n parent = await fetchParent()\n\n // Store in cache\n cache[cacheKey] = parent\n } catch {\n // If we can't fetch the parent at all (even with fallbacks), treat this as a root document\n // This can happen with complex draft/locale combinations\n parentID = undefined\n }\n }\n\n // If parent fetch failed, treat as root document\n if (!parentID || !parent) {\n const titleValue = getTitleValue({\n document: doc,\n isTitleLocalized,\n locale,\n req,\n titleFieldName,\n })\n\n const slugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n if (isTitleLocalized && locale === 'all') {\n return buildLocalizedHierarchyPaths({\n req,\n slugify,\n slugValue: slugValue as Record<string, string> | undefined,\n titleValue: titleValue as Record<string, string>,\n })\n }\n\n return {\n slugPath: slugValue !== undefined ? slugValue : slugify(titleValue as string),\n titlePath: titleValue as string,\n }\n }\n\n const docTitle = getTitleValue({ document: doc, isTitleLocalized, locale, req, titleFieldName })\n\n // Cache the current document (in its own collection's cache)\n const currentDocCacheKey = `${doc.id}_${locale || 'default'}`\n if (!context.hierarchyAncestorCache[collection.slug]) {\n context.hierarchyAncestorCache[collection.slug] = {}\n }\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey] = {\n [parentFieldName]: parentID,\n [slugPathFieldName]: undefined, // Will be set below\n [titleFieldName]: docTitle,\n [titlePathFieldName]: undefined, // Will be set below\n }\n\n // Get parent's path field names from hierarchy config\n const parentSlugPathFieldName =\n parentCollectionConfig.hierarchy !== false\n ? parentCollectionConfig.hierarchy.slugPathFieldName\n : HIERARCHY_SLUG_PATH_FIELD\n const parentTitlePathFieldName =\n parentCollectionConfig.hierarchy !== false\n ? parentCollectionConfig.hierarchy.titlePathFieldName\n : HIERARCHY_TITLE_PATH_FIELD\n\n // Handle localized case (locale === 'all' with localized title field)\n if (isTitleLocalized && locale === 'all') {\n // Parent might have non-localized title field, resulting in string paths instead of objects\n // Convert parent paths to objects if they're strings (use same value for all locales)\n let parentSlugPathObj: Record<string, string> | undefined = parent[\n parentSlugPathFieldName\n ] as Record<string, string> | undefined\n let parentTitlePathObj: Record<string, string> | undefined = parent[\n parentTitlePathFieldName\n ] as Record<string, string> | undefined\n\n // If parent paths are strings (non-localized parent), convert to objects for all locales\n if (typeof parentSlugPathObj === 'string') {\n const locales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : []\n const slugValue = parentSlugPathObj\n parentSlugPathObj = {}\n for (const loc of locales) {\n parentSlugPathObj[loc] = slugValue\n }\n }\n\n if (typeof parentTitlePathObj === 'string') {\n const locales = req.payload.config.localization\n ? req.payload.config.localization.localeCodes\n : []\n const titleValue = parentTitlePathObj\n parentTitlePathObj = {}\n for (const loc of locales) {\n parentTitlePathObj[loc] = titleValue\n }\n }\n\n // Get slug value if slugField is configured\n const docSlugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n // If parent paths are undefined (parent fetch failed or paths not computed),\n // buildLocalizedHierarchyPaths will handle it by using just the child's title\n const result = buildLocalizedHierarchyPaths({\n parentSlugPath: parentSlugPathObj,\n parentTitlePath: parentTitlePathObj,\n req,\n slugify,\n slugValue: docSlugValue as Record<string, string> | undefined,\n titleValue: docTitle as Record<string, string>,\n })\n\n // Update cache with computed paths\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][slugPathFieldName] =\n result.slugPath\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][titlePathFieldName] =\n result.titlePath\n\n return result\n }\n\n // Single locale case - get slug value if slugField is configured\n const singleLocaleSlugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n const slugSegment =\n singleLocaleSlugValue !== undefined\n ? (singleLocaleSlugValue as string)\n : slugify(docTitle as string)\n\n const result = {\n slugPath: (parent[parentSlugPathFieldName] as string) + '/' + slugSegment,\n titlePath: (parent[parentTitlePathFieldName] as string) + '/' + (docTitle as string),\n }\n\n // Update cache with computed paths\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][slugPathFieldName] =\n result.slugPath\n context.hierarchyAncestorCache[collection.slug][currentDocCacheKey][titlePathFieldName] =\n result.titlePath\n\n return result\n } else {\n // Root document (no parent)\n const titleValue = getTitleValue({\n document: doc,\n isTitleLocalized,\n locale,\n req,\n titleFieldName,\n })\n context.hierarchyAncestorCache[collection.slug][doc.id] = {\n [parentFieldName]: null,\n [titleFieldName]: titleValue,\n }\n\n const rootSlugValue = slugFieldName\n ? getSlugFieldValue({\n document: doc,\n isSlugLocalized: isSlugFieldLocalized,\n locale,\n req,\n slugFieldName,\n })\n : undefined\n\n // Handle localized case (locale === 'all' with localized title field)\n if (isTitleLocalized && locale === 'all') {\n return buildLocalizedHierarchyPaths({\n req,\n slugify,\n slugValue: rootSlugValue as Record<string, string> | undefined,\n titleValue: titleValue as Record<string, string>,\n })\n }\n\n // Single locale case\n return {\n slugPath: rootSlugValue !== undefined ? rootSlugValue : slugify(titleValue as string),\n titlePath: titleValue as string,\n }\n }\n}\n"],"names":["slugify","payloadSlugify","HIERARCHY_SLUG_PATH_FIELD","HIERARCHY_TITLE_PATH_FIELD","buildLocalizedHierarchyPaths","findFieldByName","findUseAsTitleField","getLocalizedValue","getTitleValue","document","isTitleLocalized","locale","req","titleFieldName","titleValue","id","toString","localizedValue","fallbackLocale","fieldType","value","getSlugFieldValue","isSlugLocalized","slugFieldName","slugValue","undefined","computePaths","args","collection","doc","draft","parentFieldName","slugPathFieldName","titlePathFieldName","hierarchy","text","localized","slugField","slugFieldInfo","isSlugFieldLocalized","context","hierarchyAncestorCache","slug","payload","config","debug","hierarchyCacheStats","hits","misses","queries","parentValue","parentID","parentCollectionConfig","parentHierarchyConfig","slugPath","titlePath","cache","cacheKey","parent","parentTitleField","validParentID","parentReq","computeHierarchyPaths","fetchParent","findByID","depth","overrideAccess","select","user","_error","locales","localization","localeCodes","parentPathsByLocale","parentSlugify","loc","localeReq","parentForLocale","parentSlugPath","parentTitlePath","parentTitle","title","_localeError","combinedSlugPaths","combinedTitlePaths","combinedTitles","docTitle","currentDocCacheKey","parentSlugPathFieldName","parentTitlePathFieldName","parentSlugPathObj","parentTitlePathObj","docSlugValue","result","singleLocaleSlugValue","slugSegment","rootSlugValue"],"mappings":"AAGA,SAASA,WAAWC,cAAc,QAAQ,6BAA4B;AACtE,SAASC,yBAAyB,EAAEC,0BAA0B,QAAQ,kBAAiB;AACvF,SAASC,4BAA4B,QAAQ,oCAAmC;AAChF,SAASC,eAAe,EAAEC,mBAAmB,QAAQ,sBAAqB;AAC1E,SAASC,iBAAiB,QAAQ,yBAAwB;AAkB1D,yFAAyF;AACzF,MAAMC,gBAAgB,CAAC,EACrBC,QAAQ,EACRC,mBAAmB,KAAK,EACxBC,MAAM,EACNC,GAAG,EACHC,cAAc,EAOf;IACC,MAAMC,aAAaL,QAAQ,CAACI,eAAe;IAE3C,IAAI,CAACC,YAAY;QACf,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OAAOtC,SAAS;QAElB,OAAOsC;IACT,OAAO;QACL,4BAA4B;QAC5B,MAAM/E,aAAaN,cAAc;YAC/BC,UAAUoB;YACVnB;YACAC;YACAC;YACAC;QACF;QACA2B,QAAQC,sBAAsB,CAACb,WAAWc,IAAI,CAAC,CAACb,IAAId,EAAE,CAAC,GAAG;YACxD,CAACgB,gBAAgB,EAAE;YACnB,CAAClB,eAAe,EAAEC;QACpB;QAEA,MAAMkF,gBAAgBzE,gBAClBF,kBAAkB;YAChBZ,UAAUoB;YACVP,iBAAiBiB;YACjB5B;YACAC;YACAW;QACF,KACAE;QAEJ,sEAAsE;QACtE,IAAIf,oBAAoBC,WAAW,OAAO;YACxC,OAAOP,6BAA6B;gBAClCQ;gBACAZ;gBACAwB,WAAWwE;gBACXlF,YAAYA;YACd;QACF;QAEA,qBAAqB;QACrB,OAAO;YACLwC,UAAU0C,kBAAkBvE,YAAYuE,gBAAgBhG,QAAQc;YAChEyC,WAAWzC;QACb;IACF;AACF"}
@@ -21,7 +21,7 @@ export { default as deepMerge } from 'deepmerge';
21
21
  import { PinoPretty } from 'pino-pretty';
22
22
  import { DatePickerProps } from 'react-datepicker';
23
23
 
24
- declare const clientTranslationKeys: ("error:autosaving" | "error:correctInvalidFields" | "error:deletingTitle" | "error:documentNotFound" | "error:emailOrPasswordIncorrect" | "error:failedToResetLayout" | "error:failedToSaveLayout" | "error:fileFetchFailed" | "error:insufficientClipboardPermissions" | "error:invalidClipboardData" | "error:invalidFileType" | "error:invalidRequestArgs" | "error:loadingDocument" | "error:logoutFailed" | "error:noFileFoundInClipboard" | "error:noMatchedField" | "error:notAllowedToAccessPage" | "error:notAllowedToPerformAction" | "error:previewing" | "error:problemUploadingFile" | "error:restoringTitle" | "error:revertingDocument" | "error:tokenNotProvided" | "error:unableToCopy" | "error:unableToDeleteCount" | "error:unableToReadClipboard" | "error:unableToReindexCollection" | "error:unableToUpdateCount" | "error:unauthorized" | "error:unauthorizedAdmin" | "error:unknown" | "error:unPublishingDocument" | "error:unspecific" | "error:unverifiedEmail" | "error:urlNotAllowed" | "error:userEmailAlreadyRegistered" | "error:usernameAlreadyRegistered" | "error:usernameOrPasswordIncorrect" | "error:followingFieldsInvalid" | "fields:blocks" | "fields:addLabel" | "fields:addLink" | "fields:addNew" | "fields:addNewLabel" | "fields:addRelationship" | "fields:addUpload" | "fields:block" | "fields:blockName" | "fields:blockType" | "fields:chooseBetweenCustomTextOrDocument" | "fields:chooseDocumentToLink" | "fields:chooseFromExisting" | "fields:collapseAll" | "fields:customURL" | "fields:editLink" | "fields:editRelationship" | "fields:enterURL" | "fields:hidePassword" | "fields:internalLink" | "fields:itemsAndMore" | "fields:labelRelationship" | "fields:latitude" | "fields:linkedTo" | "fields:linkType" | "fields:longitude" | "fields:openInNewTab" | "fields:passwordsDoNotMatch" | "fields:removeRelationship" | "fields:removeUpload" | "fields:saveChanges" | "fields:searchForBlock" | "fields:searchForLanguage" | "fields:selectFieldsToEdit" | "fields:showAll" | "fields:showPassword" | "fields:swapRelationship" | "fields:swapUpload" | "fields:textToDisplay" | "fields:toggleBlock" | "fields:uploadNewLabel" | "localization:cannotCopySameLocale" | "localization:copyFrom" | "localization:copyFromTo" | "localization:copyTo" | "localization:copyToLocale" | "localization:localeToPublish" | "localization:selectedLocales" | "localization:selectLocaleToCopy" | "localization:selectLocaleToDuplicate" | "upload:addFile" | "upload:addFiles" | "upload:bulkUpload" | "upload:copyLinkToFile" | "upload:copyURL" | "upload:crop" | "upload:cropBottom" | "upload:cropBottomLeft" | "upload:cropBottomRight" | "upload:cropLeft" | "upload:cropRight" | "upload:cropToolDescription" | "upload:cropTop" | "upload:cropTopLeft" | "upload:cropTopRight" | "upload:download" | "upload:dragAndDrop" | "upload:editImage" | "upload:fileName" | "upload:fileSize" | "upload:filesToUpload" | "upload:fileToUpload" | "upload:focalPoint" | "upload:focalPointDescription" | "upload:fromURL" | "upload:height" | "upload:linkToFile" | "upload:noFile" | "upload:pasteFromClipboard" | "upload:pasteURL" | "upload:previewSizes" | "upload:renameFile" | "upload:replaceFile" | "upload:selectCollectionToBrowse" | "upload:selectFile" | "upload:setCropArea" | "upload:setFocalPoint" | "upload:sizes" | "upload:sizesFor" | "upload:width" | "llmInstructions:additionalInstructions" | "llmInstructions:collectionDescription" | "llmInstructions:collectionSystemDescription" | "llmInstructions:editInstructions" | "llmInstructions:global" | "llmInstructions:globalDescription" | "llmInstructions:globalSystemDescription" | "llmInstructions:instructions" | "llmInstructions:systemInstructions" | "llmInstructions:title" | "authentication:forgotPassword" | "authentication:verify" | "authentication:account" | "authentication:accountOfCurrentUser" | "authentication:accountVerified" | "authentication:alreadyActivated" | "authentication:alreadyLoggedIn" | "authentication:apiKey" | "authentication:authenticated" | "authentication:backToLogin" | "authentication:beginCreateFirstUser" | "authentication:changePassword" | "authentication:checkYourEmailForPasswordReset" | "authentication:confirmGeneration" | "authentication:confirmPassword" | "authentication:createFirstUser" | "authentication:createUser" | "authentication:emailNotValid" | "authentication:emailOrUsername" | "authentication:emailSent" | "authentication:emailVerified" | "authentication:emailVerifiedRedirecting" | "authentication:enableAPIKey" | "authentication:failedToUnlock" | "authentication:forceUnlock" | "authentication:forgotPasswordEmailInstructions" | "authentication:forgotPasswordUsernameInstructions" | "authentication:usernameNotValid" | "authentication:forgotPasswordQuestion" | "authentication:generate" | "authentication:generateNewAPIKey" | "authentication:generatingNewAPIKeyWillInvalidate" | "authentication:logBackIn" | "authentication:loggedIn" | "authentication:loggedInChangePassword" | "authentication:loggedOutInactivity" | "authentication:loggedOutSuccessfully" | "authentication:loggingOut" | "authentication:login" | "authentication:logOut" | "authentication:logout" | "authentication:logoutSuccessful" | "authentication:logoutUser" | "authentication:newAPIKeyGenerated" | "authentication:newPassword" | "authentication:notRedirected" | "authentication:passed" | "authentication:passwordResetSuccessfully" | "authentication:resend" | "authentication:resetPassword" | "authentication:stayLoggedIn" | "authentication:successfullyRegisteredFirstUser" | "authentication:successfullyUnlocked" | "authentication:tokenRefreshSuccessful" | "authentication:unableToVerify" | "authentication:username" | "authentication:verified" | "authentication:verifiedSuccessfully" | "authentication:verifyUser" | "authentication:youAreInactive" | "commandPalette:title" | "commandPalette:createNew" | "commandPalette:hintClose" | "commandPalette:hintCreate" | "commandPalette:hintNavigate" | "commandPalette:hintSelect" | "commandPalette:noResults" | "commandPalette:placeholder" | "dashboard:addButton" | "dashboard:addWidget" | "dashboard:deleteWidget" | "dashboard:discardConfirmLabel" | "dashboard:discardMessage" | "dashboard:discardTitle" | "dashboard:editDashboard" | "dashboard:editingDashboard" | "dashboard:noItems" | "dashboard:resetLayout" | "dashboard:resizeWidget" | "dashboard:searchWidgets" | "dashboard:widgetAddPin" | "dashboard:widgetCollectionRequired" | "dashboard:widgetConfigurationError" | "dashboard:widgetDropFilesToUpload" | "dashboard:widgetInvalidCollection" | "dashboard:widgetInvalidFilterField" | "dashboard:widgetInvalidSortField" | "dashboard:widgetLimitLabel" | "dashboard:widgetNonSortableSortField" | "dashboard:widgetPageCount" | "dashboard:widgetPagination" | "dashboard:widgetPinned" | "dashboard:widgetPinnedEmpty" | "dashboard:widgetPinnedEmptyDescription" | "dashboard:widgetPinnedSaveError" | "dashboard:widgetQueryError" | "dashboard:widgetRecentlyViewedEmpty" | "dashboard:widgetRecentlyViewedEmptyDescription" | "dashboard:widgetRecentlyViewedFilterDescription" | "dashboard:widgetRecentlyViewedTitle" | "dashboard:widgetRecentsAndPinned" | "dashboard:widgetRemovePin" | "dashboard:widgetSelectCollectionFirst" | "dashboard:widgetSelectSortField" | "dashboard:widgetSortDirectionLabel" | "dashboard:widgetSortFieldLabel" | "dashboard:widgetTitleFallback" | "dashboard:widgetTitleLabel" | "dashboard:widgetUploadDropzoneDescription" | "dashboard:widgetUploadFiles" | "general:collections" | "general:globals" | "general:false" | "general:none" | "general:locale" | "general:select" | "general:user" | "general:createdAt" | "general:error" | "general:updatedAt" | "general:access" | "general:custom" | "general:name" | "general:depth" | "general:collection" | "general:email" | "general:items" | "general:of" | "general:dashboard" | "general:notFound" | "general:unauthorized" | "general:newLabel" | "general:saveChanges" | "general:username" | "general:createNew" | "general:noResults" | "general:aboutToDelete" | "general:aboutToPermanentlyDelete" | "general:aboutToPermanentlyDeleteTrash" | "general:aboutToRestore" | "general:aboutToRestoreAsDraft" | "general:aboutToRestoreAsDraftCount" | "general:aboutToRestoreCount" | "general:aboutToTrash" | "general:aboutToTrashCount" | "general:accepts" | "general:addBelow" | "general:addFilter" | "general:adminTheme" | "general:all" | "general:allCollections" | "general:allLocales" | "general:allowedTypes" | "general:and" | "general:anotherUser" | "general:anotherUserTakenOver" | "general:applyChanges" | "general:ascending" | "general:auto" | "general:automatic" | "general:backToDashboard" | "general:breadcrumb" | "general:by" | "general:cancel" | "general:changesNotSaved" | "general:checked" | "general:clear" | "general:clearAll" | "general:clearSearch" | "general:close" | "general:collapse" | "general:columns" | "general:columnToSort" | "general:confirm" | "general:confirmCopy" | "general:confirmDeletion" | "general:confirmDuplication" | "general:confirmMove" | "general:confirmReindex" | "general:confirmReindexAll" | "general:confirmReindexDescription" | "general:confirmReindexDescriptionAll" | "general:confirmRestoration" | "general:copied" | "general:copy" | "general:copyField" | "general:copying" | "general:copyRow" | "general:copyWarning" | "general:create" | "general:created" | "general:createdBy" | "general:createNewLabel" | "general:creating" | "general:creatingNewLabel" | "general:currentlyEditing" | "general:dark" | "general:decrement" | "general:delete" | "general:deleted" | "general:deletedAgo" | "general:deletedAt" | "general:deletedCountSuccessfully" | "general:deletedSuccessfully" | "general:deleteLabel" | "general:deletePermanently" | "general:deleting" | "general:descending" | "general:deselectAllRows" | "general:document" | "general:documentIsTrashed" | "general:documentLocked" | "general:documentModified" | "general:documentOutOfDate" | "general:documents" | "general:dragToReorder" | "general:duplicate" | "general:duplicateWithoutSaving" | "general:edit" | "general:editAll" | "general:editColumns" | "general:editedSince" | "general:editing" | "general:editingTakenOver" | "general:editLabel" | "general:emailAddress" | "general:emptyTrash" | "general:emptyTrashLabel" | "general:enhancedContrastMode" | "general:enterANumber" | "general:enterAValue" | "general:errors" | "general:exitLivePreview" | "general:expand" | "general:export" | "general:fallbackToDefaultLocale" | "general:field" | "general:filter" | "general:filters" | "general:filterWhere" | "general:goBack" | "general:goToPage" | "general:gridLayout" | "general:groupByLabel" | "general:hideSidebar" | "general:import" | "general:increment" | "general:isEditing" | "general:item" | "general:language" | "general:lastModified" | "general:layout" | "general:leaveAnyway" | "general:leaveWithoutSaving" | "general:light" | "general:livePreview" | "general:loading" | "general:loadMore" | "general:locales" | "general:lock" | "general:manageLabel" | "general:menu" | "general:moreOptions" | "general:move" | "general:moveConfirm" | "general:moveCount" | "general:moveDown" | "general:moveUp" | "general:moving" | "general:movingCount" | "general:next" | "general:nextPage" | "general:no" | "general:noDateSelected" | "general:noFiltersSet" | "general:noLabel" | "general:noMatchesFound" | "general:noOptions" | "general:noResultsDescription" | "general:noResultsFound" | "general:nothingFound" | "general:noTrashResults" | "general:notSelectedDocument" | "general:notShownInTable" | "general:noUpcomingEventsScheduled" | "general:noValue" | "general:only" | "general:open" | "general:openInNewWindow" | "general:or" | "general:order" | "general:original" | "general:overwriteExistingData" | "general:pageNotFound" | "general:pageNumberRange" | "general:password" | "general:pasteBelow" | "general:pasteField" | "general:pasteRow" | "general:payloadSettings" | "general:permanentlyDelete" | "general:permanentlyDeletedCountSuccessfully" | "general:perPage" | "general:perPageLabel" | "general:presets" | "general:previous" | "general:previousPage" | "general:reindex" | "general:reindexingAll" | "general:reloadDocument" | "general:remove" | "general:rename" | "general:replaceRow" | "general:requiredFields" | "general:reset" | "general:resetPreferences" | "general:resetPreferencesDescription" | "general:resettingPreferences" | "general:restore" | "general:restoreAsPublished" | "general:restoredCountSuccessfully" | "general:restoring" | "general:retry" | "general:row" | "general:rows" | "general:save" | "general:saving" | "general:schedulePublishFor" | "general:searchAutomatically" | "general:searchBy" | "general:searchCleared" | "general:searchColumns" | "general:searchGroups" | "general:searchResults" | "general:selectAll" | "general:selectAllRows" | "general:selectedCount" | "general:selectedDocument" | "general:selectLabel" | "general:selectValue" | "general:settings" | "general:showAllLabel" | "general:shownInTable" | "general:showSidebar" | "general:skipToContent" | "general:sorryNotFound" | "general:sort" | "general:sortByLabelDirection" | "general:sortByOrderToReorder" | "general:stayOnThisPage" | "general:submissionSuccessful" | "general:submit" | "general:submitting" | "general:success" | "general:successfullyCreated" | "general:successfullyDuplicated" | "general:successfullyReindexed" | "general:tableLayout" | "general:takeOver" | "general:theme" | "general:thisLanguage" | "general:time" | "general:timezone" | "general:titleDeleted" | "general:titleRestored" | "general:titleTrashed" | "general:toggle" | "general:trash" | "general:trashedCountSuccessfully" | "general:true" | "general:unchecked" | "general:unlock" | "general:unsavedChanges" | "general:unsavedChangesDuplicate" | "general:untitled" | "general:upcomingEvents" | "general:updatedAgo" | "general:updatedBy" | "general:updatedCountSuccessfully" | "general:updatedLabelSuccessfully" | "general:updatedSuccessfully" | "general:updateForEveryone" | "general:updating" | "general:uploading" | "general:uploadingBulk" | "general:users" | "general:value" | "general:viewing" | "general:viewReadOnly" | "general:welcome" | "general:where" | "general:yes" | "general:aboutToDeleteCount" | "general:editingLabel" | "hierarchy:noResults" | "hierarchy:searchResults" | "hierarchy:goTo" | "hierarchy:itemsMovedTo" | "hierarchy:itemsMovedToRoot" | "hierarchy:moveTo" | "hierarchy:moveToRoot" | "hierarchy:noParent" | "hierarchy:removeFrom" | "hierarchy:searchLabel" | "operators:contains" | "operators:equals" | "operators:exists" | "operators:intersects" | "operators:near" | "operators:within" | "operators:isGreaterThan" | "operators:isGreaterThanOrEqualTo" | "operators:isIn" | "operators:isLessThan" | "operators:isLessThanOrEqualTo" | "operators:isLike" | "operators:isNotEqualTo" | "operators:isNotIn" | "operators:isNotLike" | "validation:required" | "validation:username" | "validation:emailAddress" | "validation:enterNumber" | "validation:fieldHasNo" | "validation:greaterThanMax" | "validation:invalidBlock" | "validation:invalidBlocks" | "validation:invalidInput" | "validation:invalidSelection" | "validation:invalidSelections" | "validation:latitudeOutOfBounds" | "validation:lessThanMin" | "validation:limitReached" | "validation:longerThanMin" | "validation:longitudeOutOfBounds" | "validation:notValidDate" | "validation:requiresAtLeast" | "validation:requiresNoMoreThan" | "validation:requiresTwoNumbers" | "validation:shorterThanMax" | "validation:timezoneRequired" | "validation:trueOrFalse" | "validation:validUploadID" | "version:type" | "version:version" | "version:aboutToRestore" | "version:restoring" | "version:aboutToPublishSelection" | "version:aboutToRestoreGlobal" | "version:aboutToRevertToPublished" | "version:aboutToUnpublish" | "version:aboutToUnpublishIn" | "version:aboutToUnpublishSelection" | "version:autosave" | "version:autosavedSuccessfully" | "version:autosavedVersion" | "version:changed" | "version:compareVersions" | "version:comparingAgainst" | "version:confirmPublish" | "version:confirmRevertToSaved" | "version:confirmUnpublish" | "version:confirmVersionRestoration" | "version:currentDraft" | "version:currentlyPublished" | "version:currentlyViewing" | "version:currentPublishedVersion" | "version:draft" | "version:draftHasPublishedVersion" | "version:draftSavedSuccessfully" | "version:lastSavedAgo" | "version:modifiedOnly" | "version:moreVersions" | "version:noFurtherVersionsFound" | "version:noLabelGroup" | "version:noRowsFound" | "version:noRowsSelected" | "version:preview" | "version:previouslyDraft" | "version:previouslyPublished" | "version:previousVersion" | "version:problemRestoringVersion" | "version:publish" | "version:publishAllLocales" | "version:publishChanges" | "version:published" | "version:publishIn" | "version:publishing" | "version:restoreAsDraft" | "version:restoredSuccessfully" | "version:restoreThisVersion" | "version:reverting" | "version:revertToPublished" | "version:revertUnsuccessful" | "version:saveDraft" | "version:scheduledSuccessfully" | "version:schedulePublish" | "version:selectLocales" | "version:selectVersionToCompare" | "version:showLocales" | "version:specificVersion" | "version:status" | "version:unpublish" | "version:unpublished" | "version:unpublishedSuccessfully" | "version:unpublishIn" | "version:unpublishing" | "version:versionAgo" | "version:versionID" | "version:versions" | "version:viewingVersion" | "version:viewingVersionGlobal" | "version:viewingVersions" | "version:viewingVersionsGlobal" | "version:changedFieldsCount")[];
24
+ declare const clientTranslationKeys: ("error:autosaving" | "error:correctInvalidFields" | "error:deletingTitle" | "error:documentNotFound" | "error:emailOrPasswordIncorrect" | "error:failedToResetLayout" | "error:failedToSaveLayout" | "error:fileFetchFailed" | "error:insufficientClipboardPermissions" | "error:invalidClipboardData" | "error:invalidFileType" | "error:invalidRequestArgs" | "error:loadingDocument" | "error:logoutFailed" | "error:noFileFoundInClipboard" | "error:noMatchedField" | "error:notAllowedToAccessPage" | "error:notAllowedToPerformAction" | "error:previewing" | "error:problemUploadingFile" | "error:restoringTitle" | "error:revertingDocument" | "error:tokenNotProvided" | "error:unableToCopy" | "error:unableToDeleteCount" | "error:unableToReadClipboard" | "error:unableToReindexCollection" | "error:unableToUpdateCount" | "error:unauthorized" | "error:unauthorizedAdmin" | "error:unknown" | "error:unPublishingDocument" | "error:unspecific" | "error:unverifiedEmail" | "error:urlNotAllowed" | "error:userEmailAlreadyRegistered" | "error:usernameAlreadyRegistered" | "error:usernameOrPasswordIncorrect" | "error:followingFieldsInvalid" | "fields:blocks" | "fields:addLabel" | "fields:addLink" | "fields:addNew" | "fields:addNewLabel" | "fields:addRelationship" | "fields:addUpload" | "fields:block" | "fields:blockName" | "fields:blockType" | "fields:chooseBetweenCustomTextOrDocument" | "fields:chooseDocumentToLink" | "fields:chooseFromExisting" | "fields:collapseAll" | "fields:customURL" | "fields:editLink" | "fields:editRelationship" | "fields:enterURL" | "fields:hidePassword" | "fields:internalLink" | "fields:itemsAndMore" | "fields:labelRelationship" | "fields:latitude" | "fields:linkedTo" | "fields:linkType" | "fields:longitude" | "fields:openInNewTab" | "fields:passwordsDoNotMatch" | "fields:removeRelationship" | "fields:removeUpload" | "fields:saveChanges" | "fields:searchForBlock" | "fields:searchForLanguage" | "fields:selectFieldsToEdit" | "fields:showAll" | "fields:showPassword" | "fields:swapRelationship" | "fields:swapUpload" | "fields:textToDisplay" | "fields:toggleBlock" | "fields:uploadNewLabel" | "localization:cannotCopySameLocale" | "localization:copyFrom" | "localization:copyFromTo" | "localization:copyTo" | "localization:copyToLocale" | "localization:localeToPublish" | "localization:selectedLocales" | "localization:selectLocaleToCopy" | "localization:selectLocaleToDuplicate" | "upload:addFile" | "upload:addFiles" | "upload:bulkUpload" | "upload:copyLinkToFile" | "upload:copyURL" | "upload:crop" | "upload:cropBottom" | "upload:cropBottomLeft" | "upload:cropBottomRight" | "upload:cropLeft" | "upload:cropRight" | "upload:cropToolDescription" | "upload:cropTop" | "upload:cropTopLeft" | "upload:cropTopRight" | "upload:download" | "upload:dragAndDrop" | "upload:editImage" | "upload:fileName" | "upload:fileSize" | "upload:filesToUpload" | "upload:fileToUpload" | "upload:focalPoint" | "upload:focalPointDescription" | "upload:fromURL" | "upload:height" | "upload:linkToFile" | "upload:noFile" | "upload:pasteFromClipboard" | "upload:pasteURL" | "upload:previewSizes" | "upload:renameFile" | "upload:replaceFile" | "upload:selectCollectionToBrowse" | "upload:selectFile" | "upload:setCropArea" | "upload:setFocalPoint" | "upload:sizes" | "upload:sizesFor" | "upload:width" | "llmInstructions:additionalInstructions" | "llmInstructions:collectionDescription" | "llmInstructions:collectionSystemDescription" | "llmInstructions:editInstructions" | "llmInstructions:global" | "llmInstructions:globalDescription" | "llmInstructions:globalSystemDescription" | "llmInstructions:instructions" | "llmInstructions:systemInstructions" | "llmInstructions:title" | "authentication:forgotPassword" | "authentication:verify" | "authentication:account" | "authentication:accountOfCurrentUser" | "authentication:accountVerified" | "authentication:alreadyActivated" | "authentication:alreadyLoggedIn" | "authentication:apiKey" | "authentication:authenticated" | "authentication:backToLogin" | "authentication:beginCreateFirstUser" | "authentication:changePassword" | "authentication:checkYourEmailForPasswordReset" | "authentication:confirmGeneration" | "authentication:confirmPassword" | "authentication:createFirstUser" | "authentication:createUser" | "authentication:emailNotValid" | "authentication:emailOrUsername" | "authentication:emailSent" | "authentication:emailVerified" | "authentication:emailVerifiedRedirecting" | "authentication:enableAPIKey" | "authentication:failedToUnlock" | "authentication:forceUnlock" | "authentication:forgotPasswordEmailInstructions" | "authentication:forgotPasswordUsernameInstructions" | "authentication:usernameNotValid" | "authentication:forgotPasswordQuestion" | "authentication:generate" | "authentication:generateNewAPIKey" | "authentication:generatingNewAPIKeyWillInvalidate" | "authentication:logBackIn" | "authentication:loggedIn" | "authentication:loggedInChangePassword" | "authentication:loggedOutInactivity" | "authentication:loggedOutSuccessfully" | "authentication:loggingOut" | "authentication:login" | "authentication:logOut" | "authentication:logout" | "authentication:logoutSuccessful" | "authentication:logoutUser" | "authentication:newAPIKeyGenerated" | "authentication:newPassword" | "authentication:notRedirected" | "authentication:passed" | "authentication:passwordResetSuccessfully" | "authentication:resend" | "authentication:resetPassword" | "authentication:stayLoggedIn" | "authentication:successfullyRegisteredFirstUser" | "authentication:successfullyUnlocked" | "authentication:tokenRefreshSuccessful" | "authentication:unableToVerify" | "authentication:username" | "authentication:verified" | "authentication:verifiedSuccessfully" | "authentication:verifyUser" | "authentication:youAreInactive" | "commandPalette:title" | "commandPalette:createNew" | "commandPalette:hintClose" | "commandPalette:hintCreate" | "commandPalette:hintNavigate" | "commandPalette:hintSelect" | "commandPalette:noResults" | "commandPalette:placeholder" | "dashboard:addButton" | "dashboard:addWidget" | "dashboard:deleteWidget" | "dashboard:discardConfirmLabel" | "dashboard:discardMessage" | "dashboard:discardTitle" | "dashboard:editDashboard" | "dashboard:editingDashboard" | "dashboard:noItems" | "dashboard:resetLayout" | "dashboard:resizeWidget" | "dashboard:searchWidgets" | "dashboard:widgetAddPin" | "dashboard:widgetCollectionRequired" | "dashboard:widgetConfigurationError" | "dashboard:widgetDropFilesToUpload" | "dashboard:widgetInvalidCollection" | "dashboard:widgetInvalidFilterField" | "dashboard:widgetInvalidSortField" | "dashboard:widgetLimitLabel" | "dashboard:widgetNonSortableSortField" | "dashboard:widgetPageCount" | "dashboard:widgetPagination" | "dashboard:widgetPinned" | "dashboard:widgetPinnedEmpty" | "dashboard:widgetPinnedEmptyDescription" | "dashboard:widgetPinnedSaveError" | "dashboard:widgetQueryError" | "dashboard:widgetRecentlyViewedEmpty" | "dashboard:widgetRecentlyViewedEmptyDescription" | "dashboard:widgetRecentlyViewedFilterDescription" | "dashboard:widgetRecentlyViewedTitle" | "dashboard:widgetRecentsAndPinned" | "dashboard:widgetRemovePin" | "dashboard:widgetSelectCollectionFirst" | "dashboard:widgetSelectSortField" | "dashboard:widgetSortDirectionLabel" | "dashboard:widgetSortFieldLabel" | "dashboard:widgetTitleFallback" | "dashboard:widgetTitleLabel" | "dashboard:widgetUploadDropzoneDescription" | "dashboard:widgetUploadFiles" | "general:collections" | "general:globals" | "general:false" | "general:none" | "general:locale" | "general:select" | "general:user" | "general:createdAt" | "general:error" | "general:updatedAt" | "general:access" | "general:custom" | "general:name" | "general:depth" | "general:collection" | "general:email" | "general:items" | "general:of" | "general:dashboard" | "general:notFound" | "general:unauthorized" | "general:newLabel" | "general:saveChanges" | "general:username" | "general:createNew" | "general:noResults" | "general:aboutToDelete" | "general:aboutToPermanentlyDelete" | "general:aboutToPermanentlyDeleteTrash" | "general:aboutToRestore" | "general:aboutToRestoreAsDraft" | "general:aboutToRestoreAsDraftCount" | "general:aboutToRestoreCount" | "general:aboutToTrash" | "general:aboutToTrashCount" | "general:accepts" | "general:addBelow" | "general:addFilter" | "general:adminTheme" | "general:all" | "general:allCollections" | "general:allLocales" | "general:allowedTypes" | "general:and" | "general:anotherUser" | "general:anotherUserTakenOver" | "general:apiResponse" | "general:applyChanges" | "general:ascending" | "general:auto" | "general:automatic" | "general:backToDashboard" | "general:breadcrumb" | "general:by" | "general:cancel" | "general:changesNotSaved" | "general:checked" | "general:clear" | "general:clearAll" | "general:clearSearch" | "general:close" | "general:collapse" | "general:columns" | "general:columnToSort" | "general:confirm" | "general:confirmCopy" | "general:confirmDeletion" | "general:confirmDuplication" | "general:confirmMove" | "general:confirmReindex" | "general:confirmReindexAll" | "general:confirmReindexDescription" | "general:confirmReindexDescriptionAll" | "general:confirmRestoration" | "general:copied" | "general:copy" | "general:copyField" | "general:copying" | "general:copyRow" | "general:copyWarning" | "general:create" | "general:created" | "general:createdBy" | "general:createNewLabel" | "general:creating" | "general:creatingNewLabel" | "general:currentlyEditing" | "general:dark" | "general:decrement" | "general:delete" | "general:deleted" | "general:deletedAgo" | "general:deletedAt" | "general:deletedCountSuccessfully" | "general:deletedSuccessfully" | "general:deleteLabel" | "general:deletePermanently" | "general:deleting" | "general:descending" | "general:deselectAllRows" | "general:document" | "general:documentIsTrashed" | "general:documentLocked" | "general:documentModified" | "general:documentOutOfDate" | "general:documents" | "general:dragCancelled" | "general:dragDropped" | "general:dragInstructions" | "general:dragMoved" | "general:dragPickedUp" | "general:dragToMove" | "general:dragToReorder" | "general:duplicate" | "general:duplicateWithoutSaving" | "general:edit" | "general:editAll" | "general:editColumns" | "general:editedSince" | "general:editing" | "general:editingTakenOver" | "general:editLabel" | "general:emailAddress" | "general:emptyTrash" | "general:emptyTrashLabel" | "general:enhancedContrastMode" | "general:enterANumber" | "general:enterAValue" | "general:errors" | "general:exitLivePreview" | "general:expand" | "general:export" | "general:fallbackToDefaultLocale" | "general:field" | "general:filter" | "general:filters" | "general:filterWhere" | "general:goBack" | "general:goToPage" | "general:gridLayout" | "general:groupByLabel" | "general:hideSidebar" | "general:import" | "general:increment" | "general:isEditing" | "general:item" | "general:language" | "general:lastModified" | "general:layout" | "general:leaveAnyway" | "general:leaveWithoutSaving" | "general:light" | "general:livePreview" | "general:loading" | "general:loadMore" | "general:locales" | "general:lock" | "general:manageLabel" | "general:menu" | "general:moreOptions" | "general:move" | "general:moveConfirm" | "general:moveCount" | "general:moveDown" | "general:moveUp" | "general:moving" | "general:movingCount" | "general:next" | "general:nextPage" | "general:no" | "general:noDateSelected" | "general:noFiltersSet" | "general:noLabel" | "general:noMatchesFound" | "general:noOptions" | "general:noResultsDescription" | "general:noResultsFound" | "general:nothingFound" | "general:noTrashResults" | "general:notSelectedDocument" | "general:notShownInTable" | "general:noUpcomingEventsScheduled" | "general:noValue" | "general:only" | "general:open" | "general:openInNewWindow" | "general:or" | "general:order" | "general:original" | "general:overwriteExistingData" | "general:pageNotFound" | "general:pageNumberRange" | "general:password" | "general:pasteBelow" | "general:pasteField" | "general:pasteRow" | "general:payloadSettings" | "general:permanentlyDelete" | "general:permanentlyDeletedCountSuccessfully" | "general:perPage" | "general:perPageLabel" | "general:presets" | "general:previous" | "general:previousPage" | "general:reindex" | "general:reindexingAll" | "general:reloadDocument" | "general:remove" | "general:removeFilter" | "general:rename" | "general:replaceRow" | "general:requiredFields" | "general:reset" | "general:resetPreferences" | "general:resetPreferencesDescription" | "general:resettingPreferences" | "general:restore" | "general:restoreAsPublished" | "general:restoredCountSuccessfully" | "general:restoring" | "general:retry" | "general:row" | "general:rows" | "general:save" | "general:saving" | "general:schedulePublishFor" | "general:searchAutomatically" | "general:searchBy" | "general:searchCleared" | "general:searchColumns" | "general:searchGroups" | "general:searchResults" | "general:selectAll" | "general:selectAllRows" | "general:selectedCount" | "general:selectedDocument" | "general:selectLabel" | "general:selectValue" | "general:settings" | "general:showAllLabel" | "general:shownInTable" | "general:showSidebar" | "general:skipToContent" | "general:sorryNotFound" | "general:sort" | "general:sortByLabelDirection" | "general:sortByOrderToReorder" | "general:stayOnThisPage" | "general:submissionSuccessful" | "general:submit" | "general:submitting" | "general:success" | "general:successfullyCreated" | "general:successfullyDuplicated" | "general:successfullyReindexed" | "general:tableLayout" | "general:takeOver" | "general:theme" | "general:thisLanguage" | "general:time" | "general:timezone" | "general:titleDeleted" | "general:titleRestored" | "general:titleTrashed" | "general:toggle" | "general:trash" | "general:trashedCountSuccessfully" | "general:true" | "general:unchecked" | "general:unlock" | "general:unsavedChanges" | "general:unsavedChangesDuplicate" | "general:untitled" | "general:upcomingEvents" | "general:updatedAgo" | "general:updatedBy" | "general:updatedCountSuccessfully" | "general:updatedLabelSuccessfully" | "general:updatedSuccessfully" | "general:updateForEveryone" | "general:updating" | "general:uploading" | "general:uploadingBulk" | "general:users" | "general:value" | "general:viewing" | "general:viewReadOnly" | "general:welcome" | "general:where" | "general:yes" | "general:aboutToDeleteCount" | "general:editingLabel" | "hierarchy:noResults" | "hierarchy:searchResults" | "hierarchy:folderLocation" | "hierarchy:goTo" | "hierarchy:itemsMovedTo" | "hierarchy:itemsMovedToRoot" | "hierarchy:moveTo" | "hierarchy:moveToRoot" | "hierarchy:noParent" | "hierarchy:removeFrom" | "hierarchy:searchLabel" | "operators:contains" | "operators:equals" | "operators:exists" | "operators:intersects" | "operators:near" | "operators:within" | "operators:isGreaterThan" | "operators:isGreaterThanOrEqualTo" | "operators:isIn" | "operators:isLessThan" | "operators:isLessThanOrEqualTo" | "operators:isLike" | "operators:isNotEqualTo" | "operators:isNotIn" | "operators:isNotLike" | "validation:required" | "validation:username" | "validation:emailAddress" | "validation:enterNumber" | "validation:fieldHasNo" | "validation:greaterThanMax" | "validation:invalidBlock" | "validation:invalidBlocks" | "validation:invalidInput" | "validation:invalidSelection" | "validation:invalidSelections" | "validation:latitudeOutOfBounds" | "validation:lessThanMin" | "validation:limitReached" | "validation:longerThanMin" | "validation:longitudeOutOfBounds" | "validation:notValidDate" | "validation:requiresAtLeast" | "validation:requiresNoMoreThan" | "validation:requiresTwoNumbers" | "validation:shorterThanMax" | "validation:timezoneRequired" | "validation:trueOrFalse" | "validation:validUploadID" | "version:type" | "version:version" | "version:aboutToRestore" | "version:restoring" | "version:aboutToPublishSelection" | "version:aboutToRestoreGlobal" | "version:aboutToRevertToPublished" | "version:aboutToUnpublish" | "version:aboutToUnpublishIn" | "version:aboutToUnpublishSelection" | "version:autosave" | "version:autosavedSuccessfully" | "version:autosavedVersion" | "version:changed" | "version:compareVersions" | "version:comparingAgainst" | "version:confirmPublish" | "version:confirmRevertToSaved" | "version:confirmUnpublish" | "version:confirmVersionRestoration" | "version:currentDraft" | "version:currentlyPublished" | "version:currentlyViewing" | "version:currentPublishedVersion" | "version:draft" | "version:draftHasPublishedVersion" | "version:draftSavedSuccessfully" | "version:lastSavedAgo" | "version:modifiedOnly" | "version:moreVersions" | "version:noFurtherVersionsFound" | "version:noLabelGroup" | "version:noRowsFound" | "version:noRowsSelected" | "version:preview" | "version:previouslyDraft" | "version:previouslyPublished" | "version:previousVersion" | "version:problemRestoringVersion" | "version:publish" | "version:publishAllLocales" | "version:publishChanges" | "version:published" | "version:publishIn" | "version:publishing" | "version:restoreAsDraft" | "version:restoredSuccessfully" | "version:restoreThisVersion" | "version:reverting" | "version:revertToPublished" | "version:revertUnsuccessful" | "version:saveDraft" | "version:scheduledSuccessfully" | "version:schedulePublish" | "version:selectLocales" | "version:selectVersionToCompare" | "version:showLocales" | "version:specificVersion" | "version:status" | "version:unpublish" | "version:unpublished" | "version:unpublishedSuccessfully" | "version:unpublishIn" | "version:unpublishing" | "version:versionAgo" | "version:versionID" | "version:versions" | "version:viewingVersion" | "version:viewingVersionGlobal" | "version:viewingVersions" | "version:viewingVersionsGlobal" | "version:changedFieldsCount")[];
25
25
 
26
26
  declare const enTranslations: {
27
27
  authentication: {
@@ -292,6 +292,7 @@ declare const enTranslations: {
292
292
  and: string;
293
293
  anotherUser: string;
294
294
  anotherUserTakenOver: string;
295
+ apiResponse: string;
295
296
  applyChanges: string;
296
297
  ascending: string;
297
298
  auto: string;
@@ -358,6 +359,12 @@ declare const enTranslations: {
358
359
  documentModified: string;
359
360
  documentOutOfDate: string;
360
361
  documents: string;
362
+ dragCancelled: string;
363
+ dragDropped: string;
364
+ dragInstructions: string;
365
+ dragMoved: string;
366
+ dragPickedUp: string;
367
+ dragToMove: string;
361
368
  dragToReorder: string;
362
369
  duplicate: string;
363
370
  duplicateWithoutSaving: string;
@@ -469,6 +476,7 @@ declare const enTranslations: {
469
476
  reindexingAll: string;
470
477
  reloadDocument: string;
471
478
  remove: string;
479
+ removeFilter: string;
472
480
  rename: string;
473
481
  replaceRow: string;
474
482
  requiredFields: string;
@@ -558,6 +566,7 @@ declare const enTranslations: {
558
566
  yes: string;
559
567
  };
560
568
  hierarchy: {
569
+ folderLocation: string;
561
570
  goTo: string;
562
571
  itemsMovedTo: string;
563
572
  itemsMovedToRoot: string;
@@ -2285,6 +2294,10 @@ type MigrationTemplateArgs = {
2285
2294
  type GenerateSchemaArgs = {
2286
2295
  log?: boolean;
2287
2296
  outputFile?: string;
2297
+ /**
2298
+ * Format the generated schema with the project's oxfmt, falling back to Prettier.
2299
+ * @default true
2300
+ */
2288
2301
  prettify?: boolean;
2289
2302
  };
2290
2303
  type GenerateSchema = (args?: GenerateSchemaArgs) => Promise<{
@@ -12219,7 +12232,7 @@ type RouterAdapterRouter = {
12219
12232
  */
12220
12233
  replace: (path: string, options?: {
12221
12234
  scroll?: boolean;
12222
- }) => void;
12235
+ }) => Promise<void> | void;
12223
12236
  /**
12224
12237
  * Use this property to standardize behaviors across different router implementations.
12225
12238
  * Set it up to sync client state to the URL without triggering a second server load.
@@ -14746,6 +14759,7 @@ type Args$a = {
14746
14759
  * Data of the nearest parent block. If no parent block exists, this will be the `undefined`
14747
14760
  */
14748
14761
  blockData?: JsonObject;
14762
+ blockFields?: Field[];
14749
14763
  collection: null | SanitizedCollectionConfig;
14750
14764
  context: RequestContext;
14751
14765
  data: JsonObject;
@@ -14800,7 +14814,7 @@ type Args$a = {
14800
14814
  * - Transform data for storage
14801
14815
  * - Unflatten locales. The input `data` is the normal document for one locale. The output result will become the document with locales.
14802
14816
  */
14803
- declare const traverseFields$2: ({ id, blockData, collection, context, data, doc, docWithLocales, errors, fieldLabelPath, fields, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, skipHooks, skipValidation, submittedTopLevelFieldNames, }: Args$a) => Promise<void>;
14817
+ declare const traverseFields$2: ({ id, blockData, blockFields, collection, context, data, doc, docWithLocales, errors, fieldLabelPath, fields, global, isValidationOperation, mergeLocaleActions, operation, overrideAccess, parentIndexPath, parentIsLocalized, parentPath, parentSchemaPath, req, siblingData, siblingDoc, siblingDocWithLocales, skipHooks, skipValidation, submittedTopLevelFieldNames, }: Args$a) => Promise<void>;
14804
14818
 
14805
14819
  type Args$9<T> = {
14806
14820
  /**
@@ -15255,7 +15269,7 @@ type Arguments = {
15255
15269
  req?: PayloadRequest;
15256
15270
  showHiddenFields?: boolean;
15257
15271
  };
15258
- declare const restoreVersionOperation: <T extends TypeWithVersion<T> = any>(args: Arguments) => Promise<T>;
15272
+ declare const restoreVersionOperation: <T extends JsonObject = any>(args: Arguments) => Promise<T>;
15259
15273
 
15260
15274
  type Args$8<TSlug extends GlobalSlug> = {
15261
15275
  autosave?: boolean;
@@ -67,7 +67,7 @@ export const getRunTaskFunction = (job, workflowConfig, req, isInline, updateJob
67
67
  taskSlug
68
68
  }),
69
69
  input,
70
- job: job,
70
+ job,
71
71
  req,
72
72
  tasks: getRunTaskFunction(job, workflowConfig, req, false, updateJob, {
73
73
  taskID,
@@ -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 { PayloadRequest } from '../../../../types/index.js'\nimport type {\n RetryConfig,\n RunInlineTaskFunction,\n RunTaskFunction,\n RunTaskFunctions,\n TaskConfig,\n TaskHandler,\n TaskHandlerResult,\n TaskSlug,\n} from '../../../config/types/taskTypes.js'\nimport type {\n JobLog,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowSlug,\n} from '../../../config/types/workflowTypes.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { JobCancelledError, JobRunAbortedError, 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<TaskSlug>)\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<WorkflowSlug>,\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 || err instanceof JobRunAbortedError) {\n // Job run aborts are handled by the top-level runner.\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: input ?? {},\n output,\n parent,\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","JobRunAbortedError","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","state","log","$push","updatedAt"],"mappings":"AAAA,OAAOA,oBAAoB,gBAAe;AAsB1C,SAASC,iBAAiB,EAAEC,kBAAkB,EAAEC,SAAS,QAAQ,2BAA0B;AAC3F,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,yBAAwB;AAEjE,MAAMC,WAAW,aAAaN,iBAAiBA,eAAeO,OAAO,GAAGP;AAOxE,OAAO,MAAMQ,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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AAW;wBACpEQ;wBACAD;oBACF;gBACF,EAAC,GACAsB;YACL,EAAE,OAAOK,KAAU;gBACjB,IAAIA,eAAe9C,qBAAqB8C,eAAe7C,oBAAoB;oBACzE,sDAAsD;oBACtD,MAAM6C;gBACR;gBACA,MAAM,IAAI5C,UAAU;oBAClBsB;oBACAH,OAAOA;oBACPb;oBACAmC,SAASG,IAAIH,OAAO,IAAI;oBACxBF;oBACA5B;oBACA+B,eAAeP;oBACfZ;oBACAL;oBACAD;oBACAmB;oBACA7B;gBACF;YACF;YAEA,IAAIgB,YAAYsB,WAAW;gBACzB,MAAMtB,WAAWsB,SAAS,CAAC;oBACzB1B;oBACAb;oBACAE;oBACA4B;gBACF;YACF;YAEA,MAAMU,aAAqB;gBACzBC,IAAI,IAAI5C,WAAW6C,WAAW;gBAC9BC,aAAahD,iBAAiBiD,WAAW;gBACzC5B,YAAYA,WAAW4B,WAAW;gBAClC/B,OAAOA,SAAS,CAAC;gBACjBoB;gBACA5B;gBACAwC,OAAO;gBACPjC;gBACAD;YACF;YAEA,MAAMP,UAAU;gBACd0C,KAAK;oBACHC,OAAOP;gBACT;gBACA,yEAAyE;gBACzEQ,WAAW;YACb;YAEA,OAAOf;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 TaskSlug,\n} from '../../../config/types/taskTypes.js'\nimport type {\n JobLog,\n SingleTaskStatus,\n WorkflowConfig,\n WorkflowSlug,\n} from '../../../config/types/workflowTypes.js'\nimport type { UpdateJobFunction } from './getUpdateJobFunction.js'\n\nimport { JobCancelledError, JobRunAbortedError, 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<TaskSlug>)\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,\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 || err instanceof JobRunAbortedError) {\n // Job run aborts are handled by the top-level runner.\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: input ?? {},\n output,\n parent,\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","JobRunAbortedError","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","state","log","$push","updatedAt"],"mappings":"AAAA,OAAOA,oBAAoB,gBAAe;AAsB1C,SAASC,iBAAiB,EAAEC,kBAAkB,EAAEC,SAAS,QAAQ,2BAA0B;AAC3F,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,wBAAwB,QAAQ,yBAAwB;AAEjE,MAAMC,WAAW,aAAaN,iBAAiBA,eAAeO,OAAO,GAAGP;AAOxE,OAAO,MAAMQ,qBAAqB,CAChCC,KACAC,gBACAC,KACAC,UACAC,WACAC;IAEA,MAAMC,YAAYJ,IAAIK,OAAO,CAACC,MAAM,CAACC,IAAI;IAEzC,MAAMC,UAEiF,CACrFC,WAEC,OACC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AAA;AAEzD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAE5D,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"}
@@ -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 { 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 AuthenticatedUser,\n CollectionSlug,\n DataFromGlobalSlug,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedCollectionJoins,\n TypedCollectionSelect,\n TypedFallbackLocale,\n TypedLocale,\n} from '../index.js'\nimport type { File } from '../uploads/types.js'\nimport type { HasManyRelationshipOperator, Operator } from './constants.js'\nexport type { TypeWithID } from '../collections/config/types.js'\nexport type { Payload } from '../index.js'\n\nexport interface PayloadRequestAPI {\n GraphQL: true\n local: true\n REST: true\n}\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 /**\n * Set by Payload only while running a collection's `read` access function for a\n * dynamic file transformation request. Restored to its prior value immediately\n * after that access check completes; never set for ordinary reads.\n */\n fileTransform?: true\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: keyof PayloadRequestAPI\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: AuthenticatedUser | null\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 uploadReference?: 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 /** The active Payload operation. */\n operation?: Operation\n}\n\nexport type { HasManyRelationshipOperator, 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, including a nested query for supported relationship operators\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 }) => Promise<SerializableValue> | 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\n/**\n * Operations exposed to access control and request lifecycle functions.\n *\n * On-demand validation uses the first-class `validate` value rather than substituting `create`\n * or `update`.\n */\nexport type Operation = 'create' | 'delete' | 'read' | 'update' | 'validate'\nexport type FieldOperation = Exclude<Operation, 'delete'>\nexport type BeforeValidateOperation = Extract<FieldOperation, 'create' | 'update' | 'validate'>\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 { SharedLocalAPIOptions } from './operations.js'\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":"AAqNA,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 AuthenticatedUser,\n CollectionSlug,\n DataFromGlobalSlug,\n GlobalSlug,\n Payload,\n RequestContext,\n TypedCollectionJoins,\n TypedCollectionSelect,\n TypedFallbackLocale,\n TypedLocale,\n} from '../index.js'\nimport type { File } from '../uploads/types.js'\nimport type { HasManyRelationshipOperator, Operator } from './constants.js'\nexport type { TypeWithID } from '../collections/config/types.js'\nexport type { Payload } from '../index.js'\n\nexport interface PayloadRequestAPI {\n GraphQL: true\n local: true\n REST: true\n}\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 /**\n * Set by Payload only while running a collection's `read` access function for a\n * dynamic file transformation request. Restored to its prior value immediately\n * after that access check completes; never set for ordinary reads.\n */\n fileTransform?: true\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: keyof PayloadRequestAPI\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: AuthenticatedUser | null\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 uploadReference?: 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, Partial<Request>, PayloadRequestData {\n headers: Request['headers']\n /** The active Payload operation. */\n operation?: Operation\n}\n\nexport type { HasManyRelationshipOperator, 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, including a nested query for supported relationship operators\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 }) => Promise<SerializableValue> | 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\n/**\n * Operations exposed to access control and request lifecycle functions.\n *\n * On-demand validation uses the first-class `validate` value rather than substituting `create`\n * or `update`.\n */\nexport type Operation = 'create' | 'delete' | 'read' | 'update' | 'validate'\nexport type FieldOperation = Exclude<Operation, 'delete'>\nexport type BeforeValidateOperation = Extract<FieldOperation, 'create' | 'update' | 'validate'>\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 [\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\n ]: Data[K]\n }\n : // Handle exclude mode\n {\n [\n K in keyof Data as K extends keyof Select\n ? Select[K] extends object | undefined\n ? K\n : never\n : K\n ]: 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 { SharedLocalAPIOptions } from './operations.js'\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":"AAmNA,OAAO,SAASA,iBAAiBC,GAAQ;IACvC,OAAOA,KAAKC,aAAaD,KAAKE;AAChC"}