@payloadcms/ui 4.0.0-canary.33 → 4.0.0-canary.34

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 (160) hide show
  1. package/dist/elements/APIKeyInput/index.d.ts +2 -0
  2. package/dist/elements/APIKeyInput/index.d.ts.map +1 -1
  3. package/dist/elements/APIKeyInput/index.js +27 -29
  4. package/dist/elements/APIKeyInput/index.js.map +1 -1
  5. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts +1 -1
  6. package/dist/elements/BulkUpload/FormsManager/createFormData.d.ts.map +1 -1
  7. package/dist/elements/BulkUpload/FormsManager/createFormData.js +7 -3
  8. package/dist/elements/BulkUpload/FormsManager/createFormData.js.map +1 -1
  9. package/dist/elements/BulkUpload/FormsManager/index.d.ts.map +1 -1
  10. package/dist/elements/BulkUpload/FormsManager/index.js +4 -2
  11. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  12. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +1 -0
  13. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
  14. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +3 -2
  15. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  16. package/dist/elements/DocumentHeader/Tabs/index.d.ts +1 -0
  17. package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
  18. package/dist/elements/DocumentHeader/Tabs/index.js +5 -3
  19. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  20. package/dist/elements/DocumentHeader/index.d.ts +1 -0
  21. package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
  22. package/dist/elements/DocumentHeader/index.js +4 -2
  23. package/dist/elements/DocumentHeader/index.js.map +1 -1
  24. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +3 -2
  25. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +1 -1
  26. package/dist/elements/QueryPresets/QueryPresetBar/index.d.ts.map +1 -1
  27. package/dist/elements/QueryPresets/QueryPresetBar/index.js +14 -1
  28. package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
  29. package/dist/forms/Form/context.d.ts +3 -1
  30. package/dist/forms/Form/context.d.ts.map +1 -1
  31. package/dist/forms/Form/context.js +3 -1
  32. package/dist/forms/Form/context.js.map +1 -1
  33. package/dist/forms/Form/index.d.ts.map +1 -1
  34. package/dist/forms/Form/index.js +13 -4
  35. package/dist/forms/Form/index.js.map +1 -1
  36. package/dist/forms/fieldSchemasToFormState/renderField.d.ts.map +1 -1
  37. package/dist/forms/fieldSchemasToFormState/renderField.js +3 -2
  38. package/dist/forms/fieldSchemasToFormState/renderField.js.map +1 -1
  39. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts +12 -0
  40. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.d.ts.map +1 -0
  41. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js +42 -0
  42. package/dist/forms/fieldSchemasToFormState/serverFunctions/mergeAllowedFieldOverrides.js.map +1 -0
  43. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts +8 -6
  44. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.d.ts.map +1 -1
  45. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js +22 -9
  46. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.js.map +1 -1
  47. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js +150 -0
  48. package/dist/forms/fieldSchemasToFormState/serverFunctions/renderFieldServerFn.spec.js.map +1 -0
  49. package/dist/forms/fieldSchemasToFormState/types.d.ts +1 -0
  50. package/dist/forms/fieldSchemasToFormState/types.d.ts.map +1 -1
  51. package/dist/forms/fieldSchemasToFormState/types.js.map +1 -1
  52. package/dist/layouts/Root/index.js +6 -5
  53. package/dist/layouts/Root/index.js.map +1 -1
  54. package/dist/providers/LivePreview/index.d.ts.map +1 -1
  55. package/dist/providers/LivePreview/index.js +13 -6
  56. package/dist/providers/LivePreview/index.js.map +1 -1
  57. package/dist/styles.css +1 -1
  58. package/dist/utilities/buildFormState.d.ts.map +1 -1
  59. package/dist/utilities/buildFormState.js +6 -2
  60. package/dist/utilities/buildFormState.js.map +1 -1
  61. package/dist/utilities/formatAbsoluteURL.d.ts +1 -1
  62. package/dist/utilities/formatAbsoluteURL.d.ts.map +1 -1
  63. package/dist/utilities/formatAbsoluteURL.js +18 -8
  64. package/dist/utilities/formatAbsoluteURL.js.map +1 -1
  65. package/dist/utilities/formatAbsoluteURL.spec.js +27 -0
  66. package/dist/utilities/formatAbsoluteURL.spec.js.map +1 -0
  67. package/dist/utilities/handleServerFunctions.d.ts.map +1 -1
  68. package/dist/utilities/handleServerFunctions.js +4 -2
  69. package/dist/utilities/handleServerFunctions.js.map +1 -1
  70. package/dist/utilities/initReq.d.ts.map +1 -1
  71. package/dist/utilities/initReq.js +40 -5
  72. package/dist/utilities/initReq.js.map +1 -1
  73. package/dist/utilities/initReq.spec.js +226 -0
  74. package/dist/utilities/initReq.spec.js.map +1 -0
  75. package/dist/utilities/isAbsoluteURL.d.ts +3 -0
  76. package/dist/utilities/isAbsoluteURL.d.ts.map +1 -0
  77. package/dist/utilities/isAbsoluteURL.js +15 -0
  78. package/dist/utilities/isAbsoluteURL.js.map +1 -0
  79. package/dist/utilities/isAbsoluteURL.spec.js +11 -0
  80. package/dist/utilities/isAbsoluteURL.spec.js.map +1 -0
  81. package/dist/utilities/isHttpURL.d.ts +3 -0
  82. package/dist/utilities/isHttpURL.d.ts.map +1 -0
  83. package/dist/utilities/isHttpURL.js +12 -0
  84. package/dist/utilities/isHttpURL.js.map +1 -0
  85. package/dist/utilities/isHttpURL.spec.js +25 -0
  86. package/dist/utilities/isHttpURL.spec.js.map +1 -0
  87. package/dist/utilities/isPublicAdminRoute.d.ts.map +1 -1
  88. package/dist/utilities/isPublicAdminRoute.js +9 -6
  89. package/dist/utilities/isPublicAdminRoute.js.map +1 -1
  90. package/dist/utilities/isPublicAdminRoute.spec.js +34 -0
  91. package/dist/utilities/isPublicAdminRoute.spec.js.map +1 -0
  92. package/dist/utilities/schedulePublishHandler.d.ts.map +1 -1
  93. package/dist/utilities/schedulePublishHandler.js +4 -1
  94. package/dist/utilities/schedulePublishHandler.js.map +1 -1
  95. package/dist/views/Account/index.d.ts +1 -1
  96. package/dist/views/Account/index.d.ts.map +1 -1
  97. package/dist/views/Account/index.js +8 -5
  98. package/dist/views/Account/index.js.map +1 -1
  99. package/dist/views/Dashboard/Default/ModularDashboard/index.d.ts.map +1 -1
  100. package/dist/views/Dashboard/Default/ModularDashboard/index.js +1 -0
  101. package/dist/views/Dashboard/Default/ModularDashboard/index.js.map +1 -1
  102. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.d.ts.map +1 -1
  103. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js +3 -1
  104. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/getDefaultLayoutServerFn.js.map +1 -1
  105. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.d.ts.map +1 -1
  106. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js +2 -0
  107. package/dist/views/Dashboard/Default/ModularDashboard/renderWidget/renderWidgetServerFn.js.map +1 -1
  108. package/dist/views/Dashboard/index.d.ts.map +1 -1
  109. package/dist/views/Dashboard/index.js +2 -3
  110. package/dist/views/Dashboard/index.js.map +1 -1
  111. package/dist/views/Document/handleServerFunction.d.ts.map +1 -1
  112. package/dist/views/Document/handleServerFunction.js +2 -0
  113. package/dist/views/Document/handleServerFunction.js.map +1 -1
  114. package/dist/views/Document/index.d.ts +1 -1
  115. package/dist/views/Document/index.d.ts.map +1 -1
  116. package/dist/views/Document/index.js +9 -4
  117. package/dist/views/Document/index.js.map +1 -1
  118. package/dist/views/Document/renderDocumentSlots.d.ts +1 -0
  119. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
  120. package/dist/views/Document/renderDocumentSlots.js +7 -4
  121. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  122. package/dist/views/Edit/Auth/APIKey.d.ts +1 -1
  123. package/dist/views/Edit/Auth/APIKey.d.ts.map +1 -1
  124. package/dist/views/Edit/Auth/APIKey.js +233 -59
  125. package/dist/views/Edit/Auth/APIKey.js.map +1 -1
  126. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts +12 -0
  127. package/dist/views/Edit/Auth/APIKeyGenerationModal.d.ts.map +1 -0
  128. package/dist/views/Edit/Auth/APIKeyGenerationModal.js +117 -0
  129. package/dist/views/Edit/Auth/APIKeyGenerationModal.js.map +1 -0
  130. package/dist/views/Edit/Auth/index.css +91 -0
  131. package/dist/views/Edit/Auth/index.d.ts.map +1 -1
  132. package/dist/views/Edit/Auth/index.js +10 -28
  133. package/dist/views/Edit/Auth/index.js.map +1 -1
  134. package/dist/views/Edit/Auth/types.d.ts +3 -1
  135. package/dist/views/Edit/Auth/types.d.ts.map +1 -1
  136. package/dist/views/Edit/Auth/types.js.map +1 -1
  137. package/dist/views/ForgotPassword/ForgotPasswordForm/index.css +14 -0
  138. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  139. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +209 -161
  140. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  141. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  142. package/dist/views/ForgotPassword/index.js +2 -11
  143. package/dist/views/ForgotPassword/index.js.map +1 -1
  144. package/dist/views/List/handleServerFunction.d.ts.map +1 -1
  145. package/dist/views/List/handleServerFunction.js +3 -1
  146. package/dist/views/List/handleServerFunction.js.map +1 -1
  147. package/dist/views/List/index.d.ts.map +1 -1
  148. package/dist/views/List/index.js +2 -1
  149. package/dist/views/List/index.js.map +1 -1
  150. package/dist/views/NotFound/page.d.ts.map +1 -1
  151. package/dist/views/NotFound/page.js +4 -3
  152. package/dist/views/NotFound/page.js.map +1 -1
  153. package/dist/views/Root/index.d.ts.map +1 -1
  154. package/dist/views/Root/index.js +5 -3
  155. package/dist/views/Root/index.js.map +1 -1
  156. package/dist/views/Verify/index.d.ts +1 -1
  157. package/dist/views/Verify/index.d.ts.map +1 -1
  158. package/dist/views/Verify/index.js +4 -4
  159. package/dist/views/Verify/index.js.map +1 -1
  160. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DefaultDashboard","React","Fragment","RenderServerComponent","HydrateAuthProvider","SetStepNav","getGlobalData","getNavGroups","DashboardView","props","locale","permissions","req","i18n","payload","config","user","visibleEntities","initPageResult","globalData","navGroups","_jsxs","_jsx","nav","clientProps","Component","admin","components","views","dashboard","Fallback","importMap","serverProps","server"],"sources":["../../../src/views/Dashboard/index.tsx"],"sourcesContent":["export { DefaultDashboard } from './Default/index.js'\nexport type {\n DashboardViewClientProps,\n DashboardViewServerProps,\n DashboardViewServerPropsOnly,\n} from './Default/index.js'\n\nimport type { AdminViewServerProps } from 'payload'\n\nimport React, { Fragment } from 'react'\n\nimport type { DashboardViewClientProps, DashboardViewServerPropsOnly } from './Default/index.js'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport { HydrateAuthProvider, SetStepNav } from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { getGlobalData } from '../../utilities/getGlobalData.js'\nimport { getNavGroups } from '../../utilities/getNavGroups.js'\nimport { DefaultDashboard } from './Default/index.js'\n\nexport async function DashboardView(props: AdminViewServerProps) {\n const {\n locale,\n permissions,\n req: {\n i18n,\n payload: { config },\n payload,\n user,\n },\n req,\n visibleEntities,\n } = props.initPageResult\n\n const globalData = await getGlobalData(req)\n const navGroups = getNavGroups(permissions, visibleEntities, config, i18n)\n\n return (\n <Fragment>\n <HydrateAuthProvider permissions={permissions} />\n <SetStepNav nav={[]} />\n {RenderServerComponent({\n clientProps: {\n locale,\n } satisfies DashboardViewClientProps,\n Component: config.admin?.components?.views?.dashboard?.Component,\n Fallback: DefaultDashboard,\n importMap: payload.importMap,\n serverProps: {\n ...props,\n globalData,\n i18n,\n locale,\n navGroups,\n payload,\n permissions,\n server: req.server,\n user,\n visibleEntities,\n } satisfies DashboardViewServerPropsOnly,\n })}\n </Fragment>\n )\n}\n"],"mappings":";AAAA,SAASA,gBAAgB,QAAQ;AASjC,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,mBAAmB,EAAEC,UAAU,QAAQ;AAChD;AACA,SAASC,aAAa,QAAQ;AAC9B,SAASC,YAAY,QAAQ;AAC7B,SAASP,gBAAgB,QAAQ;AAEjC,OAAO,eAAeQ,cAAcC,KAA2B;EAC7D,MAAM;IACJC,MAAM;IACNC,WAAW;IACXC,GAAA,EAAK;MACHC,IAAI;MACJC,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBD,OAAO;MACPE;IAAI,CACL;IACDJ,GAAG;IACHK;EAAe,CAChB,GAAGR,KAAA,CAAMS,cAAc;EAExB,MAAMC,UAAA,GAAa,MAAMb,aAAA,CAAcM,GAAA;EACvC,MAAMQ,SAAA,GAAYb,YAAA,CAAaI,WAAA,EAAaM,eAAA,EAAiBF,MAAA,EAAQF,IAAA;EAErE,oBACEQ,KAAA,CAACnB,QAAA;4BACCoB,IAAA,CAAClB,mBAAA;MAAoBO,WAAA,EAAaA;qBAClCW,IAAA,CAACjB,UAAA;MAAWkB,GAAA,EAAK;QAChBpB,qBAAA,CAAsB;MACrBqB,WAAA,EAAa;QACXd;MACF;MACAe,SAAA,EAAWV,MAAA,CAAOW,KAAK,EAAEC,UAAA,EAAYC,KAAA,EAAOC,SAAA,EAAWJ,SAAA;MACvDK,QAAA,EAAU9B,gBAAA;MACV+B,SAAA,EAAWjB,OAAA,CAAQiB,SAAS;MAC5BC,WAAA,EAAa;QACX,GAAGvB,KAAK;QACRU,UAAA;QACAN,IAAA;QACAH,MAAA;QACAU,SAAA;QACAN,OAAA;QACAH,WAAA;QACAsB,MAAA,EAAQrB,GAAA,CAAIqB,MAAM;QAClBjB,IAAA;QACAC;MACF;IACF;;AAGN","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["DefaultDashboard","React","Fragment","RenderServerComponent","HydrateAuthProvider","SetStepNav","getGlobalData","getNavGroups","DashboardView","props","locale","permissions","req","i18n","payload","config","visibleEntities","initPageResult","globalData","navGroups","_jsxs","_jsx","nav","clientProps","Component","admin","components","views","dashboard","Fallback","importMap","serverProps","server","user"],"sources":["../../../src/views/Dashboard/index.tsx"],"sourcesContent":["export { DefaultDashboard } from './Default/index.js'\nexport type {\n DashboardViewClientProps,\n DashboardViewServerProps,\n DashboardViewServerPropsOnly,\n} from './Default/index.js'\n\nimport type { AdminViewServerProps } from 'payload'\n\nimport React, { Fragment } from 'react'\n\nimport type { DashboardViewClientProps, DashboardViewServerPropsOnly } from './Default/index.js'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport { HydrateAuthProvider, SetStepNav } from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { getGlobalData } from '../../utilities/getGlobalData.js'\nimport { getNavGroups } from '../../utilities/getNavGroups.js'\nimport { DefaultDashboard } from './Default/index.js'\n\nexport async function DashboardView(props: AdminViewServerProps) {\n const {\n locale,\n permissions,\n req: {\n i18n,\n payload: { config },\n payload,\n },\n req,\n visibleEntities,\n } = props.initPageResult\n\n const globalData = await getGlobalData(req)\n const navGroups = getNavGroups(permissions, visibleEntities, config, i18n)\n\n return (\n <Fragment>\n <HydrateAuthProvider permissions={permissions} />\n <SetStepNav nav={[]} />\n {RenderServerComponent({\n clientProps: {\n locale,\n } satisfies DashboardViewClientProps,\n Component: config.admin?.components?.views?.dashboard?.Component,\n Fallback: DefaultDashboard,\n importMap: payload.importMap,\n serverProps: {\n ...props,\n globalData,\n i18n,\n locale,\n navGroups,\n payload,\n permissions,\n server: req.server,\n user: props.user,\n visibleEntities,\n } satisfies DashboardViewServerPropsOnly,\n })}\n </Fragment>\n )\n}\n"],"mappings":";AAAA,SAASA,gBAAgB,QAAQ;AASjC,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAIhC,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,mBAAmB,EAAEC,UAAU,QAAQ;AAChD;AACA,SAASC,aAAa,QAAQ;AAC9B,SAASC,YAAY,QAAQ;AAC7B,SAASP,gBAAgB,QAAQ;AAEjC,OAAO,eAAeQ,cAAcC,KAA2B;EAC7D,MAAM;IACJC,MAAM;IACNC,WAAW;IACXC,GAAA,EAAK;MACHC,IAAI;MACJC,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBD;IAAO,CACR;IACDF,GAAG;IACHI;EAAe,CAChB,GAAGP,KAAA,CAAMQ,cAAc;EAExB,MAAMC,UAAA,GAAa,MAAMZ,aAAA,CAAcM,GAAA;EACvC,MAAMO,SAAA,GAAYZ,YAAA,CAAaI,WAAA,EAAaK,eAAA,EAAiBD,MAAA,EAAQF,IAAA;EAErE,oBACEO,KAAA,CAAClB,QAAA;4BACCmB,IAAA,CAACjB,mBAAA;MAAoBO,WAAA,EAAaA;qBAClCU,IAAA,CAAChB,UAAA;MAAWiB,GAAA,EAAK;QAChBnB,qBAAA,CAAsB;MACrBoB,WAAA,EAAa;QACXb;MACF;MACAc,SAAA,EAAWT,MAAA,CAAOU,KAAK,EAAEC,UAAA,EAAYC,KAAA,EAAOC,SAAA,EAAWJ,SAAA;MACvDK,QAAA,EAAU7B,gBAAA;MACV8B,SAAA,EAAWhB,OAAA,CAAQgB,SAAS;MAC5BC,WAAA,EAAa;QACX,GAAGtB,KAAK;QACRS,UAAA;QACAL,IAAA;QACAH,MAAA;QACAS,SAAA;QACAL,OAAA;QACAH,WAAA;QACAqB,MAAA,EAAQpB,GAAA,CAAIoB,MAAM;QAClBC,IAAA,EAAMxB,KAAA,CAAMwB,IAAI;QAChBjB;MACF;IACF;;AAGN","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/Document/handleServerFunction.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAA;AAK5F,eAAO,MAAM,qBAAqB,EAAE,4BAuHnC,CAAA"}
1
+ {"version":3,"file":"handleServerFunction.d.ts","sourceRoot":"","sources":["../../../src/views/Document/handleServerFunction.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAA;AAK5F,eAAO,MAAM,qBAAqB,EAAE,4BAyHnC,CAAA"}
@@ -27,6 +27,7 @@ export const renderDocumentHandler = async args => {
27
27
  user
28
28
  },
29
29
  searchParams = {},
30
+ user: userWithReadAccess,
30
31
  versions
31
32
  } = args;
32
33
  await canAccessAdmin({
@@ -122,6 +123,7 @@ export const renderDocumentHandler = async args => {
122
123
  redirectAfterDuplicate,
123
124
  searchParams,
124
125
  server: req.server,
126
+ user: userWithReadAccess,
125
127
  versions,
126
128
  viewType: 'document'
127
129
  });
@@ -1 +1 @@
1
- {"version":3,"file":"handleServerFunction.js","names":["canAccessAdmin","isEntityHidden","applyLocaleFiltering","getClientConfig","renderDocument","renderDocumentHandler","args","collectionSlug","cookies","disableActions","docID","drawerSlug","initialData","locale","overrideEntityVisibility","paramsOverride","permissions","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","req","i18n","payload","config","user","searchParams","versions","clientConfig","importMap","preferences","preferencesKey","find","collection","depth","limit","where","and","key","equals","id","then","res","docs","value","visibleEntities","collections","map","slug","admin","hidden","filter","Boolean","globals","data","Document","documentSubViewType","initPageResult","collectionConfig","globalConfig","global","languageOptions","undefined","translations","params","segments","String","server","viewType"],"sources":["../../../src/views/Document/handleServerFunction.tsx"],"sourcesContent":["import type { DocumentPreferences, VisibleEntities } from 'payload'\n\nimport { canAccessAdmin, isEntityHidden } from 'payload'\nimport { applyLocaleFiltering } from 'payload/shared'\n\nimport type { RenderDocumentServerFunction } from '../../providers/ServerFunctions/index.js'\n\nimport { getClientConfig } from '../../utilities/getClientConfig.js'\nimport { renderDocument } from './index.js'\n\nexport const renderDocumentHandler: RenderDocumentServerFunction = async (args) => {\n const {\n collectionSlug,\n cookies,\n disableActions,\n docID,\n drawerSlug,\n initialData,\n locale,\n overrideEntityVisibility,\n paramsOverride,\n permissions,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n searchParams = {},\n versions,\n } = args\n\n await canAccessAdmin({ req })\n\n const clientConfig = getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user,\n })\n await applyLocaleFiltering({ clientConfig, config, req })\n\n let preferences: DocumentPreferences\n\n if (docID) {\n const preferencesKey = `${collectionSlug}-edit-${docID}`\n\n preferences = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n where: {\n and: [\n {\n key: {\n equals: preferencesKey,\n },\n },\n {\n 'user.relationTo': {\n equals: user.collection,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n ],\n },\n })\n .then((res) => res.docs[0]?.value as DocumentPreferences)\n }\n\n const visibleEntities: VisibleEntities = {\n collections: payload.config.collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: payload.config.globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n const { data, Document } = await renderDocument({\n clientConfig,\n disableActions,\n documentSubViewType: 'default',\n drawerSlug,\n i18n,\n importMap: payload.importMap,\n initialData,\n initPageResult: {\n collectionConfig: payload?.collections?.[collectionSlug]?.config,\n cookies,\n docID,\n globalConfig: payload.config.globals.find((global) => global.slug === collectionSlug),\n languageOptions: undefined, // TODO\n locale,\n permissions,\n req,\n translations: undefined, // TODO\n visibleEntities,\n },\n locale,\n overrideEntityVisibility,\n params: paramsOverride ?? {\n segments: ['collections', collectionSlug, String(docID)],\n },\n payload,\n permissions,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n searchParams,\n server: req.server,\n versions,\n viewType: 'document',\n })\n\n return {\n data,\n Document,\n preferences,\n }\n}\n"],"mappings":"AAEA,SAASA,cAAc,EAAEC,cAAc,QAAQ;AAC/C,SAASC,oBAAoB,QAAQ;AAIrC,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,qBAAA,GAAsD,MAAOC,IAAA;EACxE,MAAM;IACJC,cAAc;IACdC,OAAO;IACPC,cAAc;IACdC,KAAK;IACLC,UAAU;IACVC,WAAW;IACXC,MAAM;IACNC,wBAAwB;IACxBC,cAAc;IACdC,WAAW;IACXC,mBAAmB;IACnBC,mBAAmB;IACnBC,sBAAsB;IACtBC,GAAG;IACHA,GAAA,EAAK;MACHC,IAAI;MACJC,OAAO;MACPA,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI,CACL;IACDC,YAAA,GAAe,CAAC,CAAC;IACjBC;EAAQ,CACT,GAAGpB,IAAA;EAEJ,MAAMN,cAAA,CAAe;IAAEoB;EAAI;EAE3B,MAAMO,YAAA,GAAexB,eAAA,CAAgB;IACnCoB,MAAA;IACAF,IAAA;IACAO,SAAA,EAAWR,GAAA,CAAIE,OAAO,CAACM,SAAS;IAChCJ;EACF;EACA,MAAMtB,oBAAA,CAAqB;IAAEyB,YAAA;IAAcJ,MAAA;IAAQH;EAAI;EAEvD,IAAIS,WAAA;EAEJ,IA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,EAAkBnC,OAAA,EAASuB,WAAA,GAActC,cAAA,CAAe,EAAEgB,MAAA;MAC1Df,OAAA;MACAE,KAAA;MACAgD,YAAA,EAAcpC,OAAA,CAAQC,MAAM,CAAC6B,OAAO,CAACrB,IAAI,CAAE4B,MAAA,IAAWA,MAAA,CAAOZ,IAAI,KAAKxC,cAAA;MACtEqD,eAAA,EAAiBC,SAAA;MACjBhD,MAAA;MACAG,WAAA;MACAI,GAAA;MACA0C,YAAA,EAAcD,SAAA;MACdjB;IACF;IACA/B,MAAA;IACAC,wBAAA;IACAiD,MAAA,EAAQhD,cAAA,IAAkB;MACxBiD,QAAA,EAAU,CAAC,eAAezD,cAAA,EAAgB0D,MAAA,CAAOvD,KAAA;IACnD;IACAY,OAAA;IACAN,WAAA;IACAC,mBAAA;IACAC,mBAAA;IACAC,sBAAA;IACAM,YAAA;IACAyC,MAAA,EAAQ9C,GAAA,CAAI8C,MAAM;IAClBxC,QAAA;IACAyC,QAAA,EAAU;EACZ;EAEA,OAAO;IACLd,IAAA;IACAC,QAAA;IACAzB;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"handleServerFunction.js","names":["canAccessAdmin","isEntityHidden","applyLocaleFiltering","getClientConfig","renderDocument","renderDocumentHandler","args","collectionSlug","cookies","disableActions","docID","drawerSlug","initialData","locale","overrideEntityVisibility","paramsOverride","permissions","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","req","i18n","payload","config","user","searchParams","userWithReadAccess","versions","clientConfig","importMap","preferences","preferencesKey","find","collection","depth","limit","where","and","key","equals","id","then","res","docs","value","visibleEntities","collections","map","slug","admin","hidden","filter","Boolean","globals","data","Document","documentSubViewType","initPageResult","collectionConfig","globalConfig","global","languageOptions","undefined","translations","params","segments","String","server","viewType"],"sources":["../../../src/views/Document/handleServerFunction.tsx"],"sourcesContent":["import type { DocumentPreferences, VisibleEntities } from 'payload'\n\nimport { canAccessAdmin, isEntityHidden } from 'payload'\nimport { applyLocaleFiltering } from 'payload/shared'\n\nimport type { RenderDocumentServerFunction } from '../../providers/ServerFunctions/index.js'\n\nimport { getClientConfig } from '../../utilities/getClientConfig.js'\nimport { renderDocument } from './index.js'\n\nexport const renderDocumentHandler: RenderDocumentServerFunction = async (args) => {\n const {\n collectionSlug,\n cookies,\n disableActions,\n docID,\n drawerSlug,\n initialData,\n locale,\n overrideEntityVisibility,\n paramsOverride,\n permissions,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n req,\n req: {\n i18n,\n payload,\n payload: { config },\n user,\n },\n searchParams = {},\n user: userWithReadAccess,\n versions,\n } = args\n\n await canAccessAdmin({ req })\n\n const clientConfig = getClientConfig({\n config,\n i18n,\n importMap: req.payload.importMap,\n user,\n })\n await applyLocaleFiltering({ clientConfig, config, req })\n\n let preferences: DocumentPreferences\n\n if (docID) {\n const preferencesKey = `${collectionSlug}-edit-${docID}`\n\n preferences = await payload\n .find({\n collection: 'payload-preferences',\n depth: 0,\n limit: 1,\n where: {\n and: [\n {\n key: {\n equals: preferencesKey,\n },\n },\n {\n 'user.relationTo': {\n equals: user.collection,\n },\n },\n {\n 'user.value': {\n equals: user.id,\n },\n },\n ],\n },\n })\n .then((res) => res.docs[0]?.value as DocumentPreferences)\n }\n\n const visibleEntities: VisibleEntities = {\n collections: payload.config.collections\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n globals: payload.config.globals\n .map(({ slug, admin: { hidden } }) => (!isEntityHidden({ hidden, user }) ? slug : null))\n .filter(Boolean),\n }\n\n const { data, Document } = await renderDocument({\n clientConfig,\n disableActions,\n documentSubViewType: 'default',\n drawerSlug,\n i18n,\n importMap: payload.importMap,\n initialData,\n initPageResult: {\n collectionConfig: payload?.collections?.[collectionSlug]?.config,\n cookies,\n docID,\n globalConfig: payload.config.globals.find((global) => global.slug === collectionSlug),\n languageOptions: undefined, // TODO\n locale,\n permissions,\n req,\n translations: undefined, // TODO\n visibleEntities,\n },\n locale,\n overrideEntityVisibility,\n params: paramsOverride ?? {\n segments: ['collections', collectionSlug, String(docID)],\n },\n payload,\n permissions,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n searchParams,\n server: req.server,\n user: userWithReadAccess,\n versions,\n viewType: 'document',\n })\n\n return {\n data,\n Document,\n preferences,\n }\n}\n"],"mappings":"AAEA,SAASA,cAAc,EAAEC,cAAc,QAAQ;AAC/C,SAASC,oBAAoB,QAAQ;AAIrC,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,qBAAA,GAAsD,MAAOC,IAAA;EACxE,MAAM;IACJC,cAAc;IACdC,OAAO;IACPC,cAAc;IACdC,KAAK;IACLC,UAAU;IACVC,WAAW;IACXC,MAAM;IACNC,wBAAwB;IACxBC,cAAc;IACdC,WAAW;IACXC,mBAAmB;IACnBC,mBAAmB;IACnBC,sBAAsB;IACtBC,GAAG;IACHA,GAAA,EAAK;MACHC,IAAI;MACJC,OAAO;MACPA,OAAA,EAAS;QAAEC;MAAM,CAAE;MACnBC;IAAI,CACL;IACDC,YAAA,GAAe,CAAC,CAAC;IACjBD,IAAA,EAAME,kBAAkB;IACxBC;EAAQ,CACT,GAAGrB,IAAA;EAEJ,MAAMN,cAAA,CAAe;IAAEoB;EAAI;EAE3B,MAAMQ,YAAA,GAAezB,eAAA,CAAgB;IACnCoB,MAAA;IACAF,IAAA;IACAQ,SAAA,EAAWT,GAAA,CAAIE,OAAO,CAACO,SAAS;IAChCL;EACF;EACA,MAAMtB,oBAAA,CAAqB;IAAE0B,YAAA;IAAcL,MAAA;IAAQH;EAAI;EAEvD,IAAIU,WAAA;EAEJ,IAAIpB,KAAA,EAAO;IACT,MAAMqB,cAAA,GAAiB,GAAGxB,cAAA,SAAuBG,KAAA,EAAO;IAExDoB,WAAA,GAAc,MAAMR,OAAA,CACjBU,IAAI,CAAC;MACJC,UAAA,EAAY;MACZC,KAAA,EAAO;MACPC,KAAA,EAA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WA,MAAA,CAAOZ,IAAI,KAAKzC,cAAA;MACtEsD,eAAA,EAAiBC,SAAA;MACjBjD,MAAA;MACAG,WAAA;MACAI,GAAA;MACA2C,YAAA,EAAcD,SAAA;MACdjB;IACF;IACAhC,MAAA;IACAC,wBAAA;IACAkD,MAAA,EAAQjD,cAAA,IAAkB;MACxBkD,QAAA,EAAU,CAAC,eAAe1D,cAAA,EAAgB2D,MAAA,CAAOxD,KAAA;IACnD;IACAY,OAAA;IACAN,WAAA;IACAC,mBAAA;IACAC,mBAAA;IACAC,sBAAA;IACAM,YAAA;IACA0C,MAAA,EAAQ/C,GAAA,CAAI+C,MAAM;IAClB3C,IAAA,EAAME,kBAAA;IACNC,QAAA;IACAyC,QAAA,EAAU;EACZ;EAEA,OAAO;IACLd,IAAA;IACAC,QAAA;IACAzB;EACF;AACF","ignoreList":[]}
@@ -8,7 +8,7 @@ export type ViewToRender = EditViewComponent | PayloadComponent<DocumentViewServ
8
8
  * - default document edit views
9
9
  * - on-demand edit views within drawers
10
10
  */
11
- export declare const renderDocument: ({ disableActions, documentSubViewType, drawerSlug, importMap, initialData, initPageResult, overrideEntityVisibility, params, redirectAfterCreate, redirectAfterDelete, redirectAfterDuplicate, redirectAfterRestore, searchParams, versions, viewType, }: {
11
+ export declare const renderDocument: ({ disableActions, documentSubViewType, drawerSlug, importMap, initialData, initPageResult, overrideEntityVisibility, params, redirectAfterCreate, redirectAfterDelete, redirectAfterDuplicate, redirectAfterRestore, searchParams, user: userWithReadAccess, versions, viewType, }: {
12
12
  drawerSlug?: string;
13
13
  overrideEntityVisibility?: boolean;
14
14
  readonly redirectAfterCreate?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/Document/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EAEpB,IAAI,EACJ,uBAAuB,EACvB,uBAAuB,EAEvB,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EACjC,M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AAC,EAAE,CAAC,uBAAuB,CAAC,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,uRAiBxB;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IACtC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,OAAO,CAAA;IACzC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,EAAE,gCAAgC,CAAA;CAC5C,GAAG,oBAAoB,KAAG,OAAO,CAAC;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAyZA,CAAA;AAED,wBAAsB,YAAY,CAAC,KAAK,EAAE,oBAAoB,+QAuB7D"}
@@ -44,6 +44,7 @@ export const renderDocument = async ({
44
44
  redirectAfterDuplicate,
45
45
  redirectAfterRestore,
46
46
  searchParams,
47
+ user: userWithReadAccess,
47
48
  versions,
48
49
  viewType
49
50
  }) => {
@@ -198,7 +199,8 @@ export const renderDocument = async ({
198
199
  renderAllFields: true,
199
200
  req,
200
201
  schemaPath: collectionSlug || globalSlug,
201
- skipValidation: true
202
+ skipValidation: true,
203
+ user: userWithReadAccess
202
204
  }), getHasScheduledPublish({
203
205
  id: idFromArgs,
204
206
  collectionConfig,
@@ -219,7 +221,7 @@ export const renderDocument = async ({
219
221
  routeSegments: segments,
220
222
  searchParams,
221
223
  server: req.server,
222
- user,
224
+ user: userWithReadAccess,
223
225
  versions
224
226
  };
225
227
  if (!overrideEntityVisibility && (collectionSlug && !visibleEntities?.collections?.find(visibleSlug => visibleSlug === collectionSlug) || globalSlug && !visibleEntities?.globals?.find(visibleSlug => visibleSlug === globalSlug))) {
@@ -276,6 +278,7 @@ export const renderDocument = async ({
276
278
  draft: true,
277
279
  fallbackLocale: false,
278
280
  locale: locale?.code,
281
+ overrideAccess: false,
279
282
  req,
280
283
  user
281
284
  });
@@ -305,7 +308,8 @@ export const renderDocument = async ({
305
308
  hasSavePermission,
306
309
  locale,
307
310
  permissions,
308
- req
311
+ req,
312
+ user: userWithReadAccess
309
313
  });
310
314
  // Extract Description from documentSlots to pass to DocumentHeader
311
315
  const {
@@ -382,7 +386,8 @@ export const renderDocument = async ({
382
386
  collectionConfig: collectionConfig,
383
387
  globalConfig: globalConfig,
384
388
  permissions: permissions,
385
- req: req
389
+ req: req,
390
+ user: userWithReadAccess
386
391
  }), /*#__PURE__*/_jsx(HydrateAuthProvider, {
387
392
  permissions: permissions
388
393
  }), /*#__PURE__*/_jsx(EditDepthProvider, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","RenderServerComponent","DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","buildFormState","getDocPreferences","getDocumentData","getDocumentPermissions","getHasScheduledPublish","getIsLocked","getVersions","handleLivePreview","handlePreview","isEditing","getIsEditing","getPreferences","NotFoundView","UnauthorizedViewWithGutter","getDocumentView","recordRecentlyViewed","renderDocumentSlots","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","user","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","server","redirect","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasDeletePermission","hasPublishPermission","hasSavePermission","hasTrashPermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","recentlyViewedPromise","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","hasScheduledPublish","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","openByDefault","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","startsWith","err","notFound"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { buildFormState } from '../../utilities/buildFormState.js'\nimport { getDocPreferences } from '../../utilities/getDocPreferences.js'\nimport { getDocumentData } from '../../utilities/getDocumentData.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\nimport { getHasScheduledPublish } from '../../utilities/getHasScheduledPublish.js'\nimport { getIsLocked } from '../../utilities/getIsLocked.js'\nimport { getVersions } from '../../utilities/getVersions.js'\nimport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nimport { handlePreview } from '../../utilities/handlePreview.js'\nimport { isEditing as getIsEditing } from '../../utilities/isEditing.js'\nimport { getPreferences } from '../../utilities/upsertPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { UnauthorizedViewWithGutter } from '../Unauthorized/index.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { recordRecentlyViewed } from './recordRecentlyViewed.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport { getDocumentView } from './getDocumentView.js'\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n })\n req.server.redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n {\n docPermissions,\n hasDeletePermission,\n hasPublishPermission,\n hasSavePermission,\n hasTrashPermission,\n },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n // Record the document as recently viewed (collections only, never on the create route or for\n // trashed docs). Runs concurrently with the work below and never throws.\n const recentlyViewedPromise =\n collectionSlug && idFromArgs && doc && !isTrashedDoc\n ? recordRecentlyViewed({ id: idFromArgs, collectionSlug, req })\n : undefined\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n hasScheduledPublish,\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n }),\n getHasScheduledPublish({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n hasPublishPermission,\n payload,\n }),\n ])\n\n await recentlyViewedPromise\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n server: req.server,\n user,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = formatAdminURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\n })\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n\n if (View === UnauthorizedViewWithGutter) {\n showHeader = false\n }\n }\n\n if (!View) {\n View = NotFoundView as React.FC<AdminViewServerProps>\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n })\n\n req.server.redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n doc: doc as Record<string, unknown>,\n globalConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n const { isPreviewEnabled, previewURL } = await handlePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasDeletePermission={hasDeletePermission}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n hasScheduledPublish={hasScheduledPublish}\n hasTrashPermission={hasTrashPermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n (entityPreferences?.value?.editViewType === undefined\n ? livePreviewConfig?.openByDefault\n : entityPreferences.value.editViewType === 'live-preview') && livePreviewURL,\n )}\n isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n // The TanStack adapter's `req.server.redirect()` throws `redirect:<url>` as a\n // control-flow signal — the target is already recorded on `req.server` and\n // honored upstream in `loadAdminPage`. It isn't a real error, so swallow it\n // without logging, mirroring the `NEXT_REDIRECT` guard above.\n if (error?.message?.startsWith('redirect:')) {\n return\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n props.initPageResult.req.server.notFound()\n }\n }\n}\n"],"mappings":";AAYA,SAASA,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ;AACtC;AACA,SACEC,oBAAoB,EACpB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AA;EACT,EAAE,OAAOC,KAAA,EAAO;IACd,IAAIA,KAAA,EAAOC,OAAA,KAAY,iBAAiB;MACtC,MAAMD,KAAA;IACR;IAEA;IACA;IACA;IACA;IACA,IAAIA,KAAA,EAAOC,OAAA,EAASC,UAAA,CAAW,cAAc;MAC3C;IACF;IAEArK,QAAA,CAAS;MAAEsK,GAAA,EAAKH,KAAA;MAAO/G,OAAA,EAAS6G,KAAA,CAAM/H,cAAc,CAACgB,GAAG,CAACE;IAAQ;IAEjE,IAAI+G,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCH,KAAA,CAAM/H,cAAc,CAACgB,GAAG,CAACuB,MAAM,CAAC8F,QAAQ;IAC1C;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isolateObjectProperty","logError","formatAdminURL","hasAutosaveEnabled","hasDraftsEnabled","React","DocumentHeader","RenderServerComponent","DocumentInfoProvider","EditDepthProvider","HydrateAuthProvider","LivePreviewProvider","buildFormState","getDocPreferences","getDocumentData","getDocumentPermissions","getHasScheduledPublish","getIsLocked","getVersions","handleLivePreview","handlePreview","isEditing","getIsEditing","getPreferences","NotFoundView","UnauthorizedViewWithGutter","getDocumentView","recordRecentlyViewed","renderDocumentSlots","renderDocument","disableActions","documentSubViewType","drawerSlug","importMap","initialData","initPageResult","overrideEntityVisibility","params","redirectAfterCreate","redirectAfterDelete","redirectAfterDuplicate","redirectAfterRestore","searchParams","user","userWithReadAccess","versions","viewType","collectionConfig","docID","idFromArgs","globalConfig","locale","permissions","req","i18n","payload","config","routes","admin","adminRoute","api","apiRoute","visibleEntities","segments","Array","isArray","collectionSlug","slug","undefined","globalSlug","id","doc","redirectURL","path","encodeURIComponent","server","redirect","Error","isTrashedDoc","Boolean","deletedAt","reqForPermissions","transactionID","reqForLockCheck","docPreferences","docPermissions","hasDeletePermission","hasPublishPermission","hasSavePermission","hasTrashPermission","currentEditor","isLocked","lastUpdateTime","entityPreferences","Promise","all","data","collection","operation","recentlyViewedPromise","hasPublishedDoc","mostRecentVersionIsAutosaved","unpublishedVersionCount","versionCount","state","formState","hasScheduledPublish","code","fallbackLocale","readOnly","renderAllFields","schemaPath","skipValidation","documentViewServerProps","routeSegments","collections","find","visibleSlug","globals","formattedParams","URLSearchParams","append","apiQueryParams","toString","apiURL","View","showHeader","RootViewOverride","components","views","edit","root","Component","shouldAutosave","validateDraftData","drafts","validate","create","depth","draft","overrideAccess","documentSlots","Description","clientProps","isLivePreviewEnabled","livePreviewConfig","livePreviewURL","isPreviewEnabled","previewURL","Document","_jsx","initialState","isTrashed","_jsxs","breakpoints","isLivePreviewing","value","editViewType","openByDefault","typeofLivePreviewURL","url","AfterHeader","serverProps","DocumentView","props","RenderedDocument","error","message","startsWith","err","notFound"],"sources":["../../../src/views/Document/index.tsx"],"sourcesContent":["import type {\n AdminViewServerProps,\n CollectionPreferences,\n Data,\n DocumentViewClientProps,\n DocumentViewServerProps,\n DocumentViewServerPropsOnly,\n EditViewComponent,\n PayloadComponent,\n RenderDocumentVersionsProperties,\n} from 'payload'\n\nimport { isolateObjectProperty, logError } from 'payload'\nimport { formatAdminURL, hasAutosaveEnabled, hasDraftsEnabled } from 'payload/shared'\nimport React from 'react'\n\nimport { DocumentHeader } from '../../elements/DocumentHeader/index.js'\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n/* eslint-disable payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds */\nimport {\n DocumentInfoProvider,\n EditDepthProvider,\n HydrateAuthProvider,\n LivePreviewProvider,\n} from '../../exports/client/index.js'\n/* eslint-enable payload/no-imports-from-exports-dir */\nimport { buildFormState } from '../../utilities/buildFormState.js'\nimport { getDocPreferences } from '../../utilities/getDocPreferences.js'\nimport { getDocumentData } from '../../utilities/getDocumentData.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\nimport { getHasScheduledPublish } from '../../utilities/getHasScheduledPublish.js'\nimport { getIsLocked } from '../../utilities/getIsLocked.js'\nimport { getVersions } from '../../utilities/getVersions.js'\nimport { handleLivePreview } from '../../utilities/handleLivePreview.js'\nimport { handlePreview } from '../../utilities/handlePreview.js'\nimport { isEditing as getIsEditing } from '../../utilities/isEditing.js'\nimport { getPreferences } from '../../utilities/upsertPreferences.js'\nimport { NotFoundView } from '../NotFound/index.js'\nimport { UnauthorizedViewWithGutter } from '../Unauthorized/index.js'\nimport { getDocumentView } from './getDocumentView.js'\nimport { recordRecentlyViewed } from './recordRecentlyViewed.js'\nimport { renderDocumentSlots } from './renderDocumentSlots.js'\n\nexport { getDocumentView } from './getDocumentView.js'\n\nexport type ViewToRender =\n | EditViewComponent\n | PayloadComponent<DocumentViewServerProps>\n | React.FC\n | React.FC<DocumentViewClientProps>\n\n/**\n * This function is responsible for rendering\n * an Edit Document view on the server for both:\n * - default document edit views\n * - on-demand edit views within drawers\n */\nexport const renderDocument = async ({\n disableActions,\n documentSubViewType,\n drawerSlug,\n importMap,\n initialData,\n initPageResult,\n overrideEntityVisibility,\n params,\n redirectAfterCreate,\n redirectAfterDelete,\n redirectAfterDuplicate,\n redirectAfterRestore,\n searchParams,\n user: userWithReadAccess,\n versions,\n viewType,\n}: {\n drawerSlug?: string\n overrideEntityVisibility?: boolean\n readonly redirectAfterCreate?: boolean\n readonly redirectAfterDelete?: boolean\n readonly redirectAfterDuplicate?: boolean\n readonly redirectAfterRestore?: boolean\n versions?: RenderDocumentVersionsProperties\n} & AdminViewServerProps): Promise<{\n data: Data\n Document: React.ReactNode\n}> => {\n const {\n collectionConfig,\n docID: idFromArgs,\n globalConfig,\n locale,\n permissions,\n req,\n req: {\n i18n,\n payload,\n payload: {\n config,\n config: {\n routes: { admin: adminRoute, api: apiRoute },\n },\n },\n user,\n },\n visibleEntities,\n } = initPageResult\n\n const segments = Array.isArray(params?.segments) ? params.segments : []\n const collectionSlug = collectionConfig?.slug || undefined\n const globalSlug = globalConfig?.slug || undefined\n let isEditing = getIsEditing({ id: idFromArgs, collectionSlug, globalSlug })\n\n // Fetch the doc required for the view\n let doc =\n !idFromArgs && !globalSlug\n ? initialData || null\n : await getDocumentData({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n locale,\n payload,\n req,\n segments,\n user,\n })\n\n if (isEditing && !doc) {\n // If it's a collection document that doesn't exist, redirect to collection list\n if (collectionSlug) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}?notFound=${encodeURIComponent(idFromArgs)}`,\n })\n req.server.redirect(redirectURL)\n } else {\n // For globals or other cases, keep the 404 behavior\n throw new Error('not-found')\n }\n }\n\n const isTrashedDoc = Boolean(doc && 'deletedAt' in doc && typeof doc?.deletedAt === 'string')\n\n // CRITICAL FIX FOR TRANSACTION RACE CONDITION:\n // When running parallel operations with Promise.all, if they share the same req object\n // and one operation calls initTransaction() which MUTATES req.transactionID, that mutation\n // is visible to all parallel operations. This causes:\n // 1. Operation A (e.g., getDocumentPermissions → docAccessOperation) calls initTransaction()\n // which sets req.transactionID = Promise, then resolves it to a UUID\n // 2. Operation B (e.g., getIsLocked) running in parallel receives the SAME req with the mutated transactionID\n // 3. Operation A (does not even know that Operation B even exists and is stil using the transactionID) commits/ends its transaction\n // 4. Operation B tries to use the now-expired session → MongoExpiredSessionError!\n //\n // Solution: Use isolateObjectProperty to create a Proxy that isolates the 'transactionID' property.\n // This allows each operation to have its own transactionID without affecting the parent req.\n // If parent req already has a transaction, preserve it (don't isolate), since this\n // issue only arises when one of the operations calls initTransaction() themselves -\n // because then, that operation will also try to commit/end the transaction itself.\n\n // If the transactionID is already set, the parallel operations will not try to\n // commit/end the transaction themselves, so we don't need to isolate the\n // transactionID property.\n const reqForPermissions = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n const reqForLockCheck = req.transactionID ? req : isolateObjectProperty(req, 'transactionID')\n\n const [\n docPreferences,\n {\n docPermissions,\n hasDeletePermission,\n hasPublishPermission,\n hasSavePermission,\n hasTrashPermission,\n },\n { currentEditor, isLocked, lastUpdateTime },\n entityPreferences,\n ] = await Promise.all([\n // Get document preferences\n getDocPreferences({\n id: idFromArgs,\n collectionSlug,\n globalSlug,\n payload,\n user,\n }),\n\n // Get permissions - isolated transactionID prevents cross-contamination\n getDocumentPermissions({\n id: idFromArgs,\n collectionConfig,\n data: doc,\n globalConfig,\n req: reqForPermissions,\n }),\n\n // Fetch document lock state - isolated transactionID prevents cross-contamination\n getIsLocked({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n isEditing,\n req: reqForLockCheck,\n }),\n\n // get entity preferences\n getPreferences<CollectionPreferences>(\n collectionSlug ? `collection-${collectionSlug}` : `global-${globalSlug}`,\n payload,\n req.user.id,\n req.user.collection,\n ),\n ])\n\n const operation = (collectionSlug && idFromArgs) || globalSlug ? 'update' : 'create'\n\n // Record the document as recently viewed (collections only, never on the create route or for\n // trashed docs). Runs concurrently with the work below and never throws.\n const recentlyViewedPromise =\n collectionSlug && idFromArgs && doc && !isTrashedDoc\n ? recordRecentlyViewed({ id: idFromArgs, collectionSlug, req })\n : undefined\n\n const [\n { hasPublishedDoc, mostRecentVersionIsAutosaved, unpublishedVersionCount, versionCount },\n { state: formState },\n hasScheduledPublish,\n ] = await Promise.all([\n getVersions({\n id: idFromArgs,\n collectionConfig,\n doc,\n docPermissions,\n globalConfig,\n locale: locale?.code,\n payload,\n user,\n }),\n buildFormState({\n id: idFromArgs,\n collectionSlug,\n data: doc,\n docPermissions,\n docPreferences,\n fallbackLocale: false,\n globalSlug,\n locale: locale?.code,\n operation,\n readOnly: isTrashedDoc || isLocked,\n renderAllFields: true,\n req,\n schemaPath: collectionSlug || globalSlug,\n skipValidation: true,\n user: userWithReadAccess,\n }),\n getHasScheduledPublish({\n id: idFromArgs,\n collectionConfig,\n globalConfig,\n hasPublishPermission,\n payload,\n }),\n ])\n\n await recentlyViewedPromise\n\n const documentViewServerProps: DocumentViewServerPropsOnly = {\n doc,\n hasPublishedDoc,\n i18n,\n initPageResult,\n locale,\n params,\n payload,\n permissions,\n routeSegments: segments,\n searchParams,\n server: req.server,\n user: userWithReadAccess,\n versions,\n }\n\n if (\n !overrideEntityVisibility &&\n ((collectionSlug &&\n !visibleEntities?.collections?.find((visibleSlug) => visibleSlug === collectionSlug)) ||\n (globalSlug && !visibleEntities?.globals?.find((visibleSlug) => visibleSlug === globalSlug)))\n ) {\n throw new Error('not-found')\n }\n\n const formattedParams = new URLSearchParams()\n\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n formattedParams.append('draft', 'true')\n }\n\n if (locale?.code) {\n formattedParams.append('locale', locale.code)\n }\n\n const apiQueryParams = `?${formattedParams.toString()}`\n\n const apiURL = formatAdminURL({\n apiRoute,\n path: collectionSlug\n ? `/${collectionSlug}/${idFromArgs}${apiQueryParams}`\n : globalSlug\n ? `/${globalSlug}${apiQueryParams}`\n : '',\n })\n\n let View: ViewToRender = null\n\n let showHeader = true\n\n const RootViewOverride =\n collectionConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in collectionConfig.admin.components.views.edit.root\n ? collectionConfig?.admin?.components?.views?.edit?.root?.Component\n : globalConfig?.admin?.components?.views?.edit?.root &&\n 'Component' in globalConfig.admin.components.views.edit.root\n ? globalConfig?.admin?.components?.views?.edit?.root?.Component\n : null\n\n if (RootViewOverride) {\n View = RootViewOverride\n showHeader = false\n } else {\n ;({ View } = getDocumentView({\n collectionConfig,\n config,\n docPermissions,\n globalConfig,\n routeSegments: segments,\n }))\n\n if (View === UnauthorizedViewWithGutter) {\n showHeader = false\n }\n }\n\n if (!View) {\n View = NotFoundView as React.FC<AdminViewServerProps>\n }\n\n /**\n * Handle case where autoSave is enabled and the document is being created\n * => create document and redirect\n */\n const shouldAutosave = hasSavePermission && hasAutosaveEnabled(collectionConfig || globalConfig)\n\n const validateDraftData =\n collectionConfig?.versions?.drafts && collectionConfig?.versions?.drafts?.validate\n\n let id = idFromArgs\n\n if (shouldAutosave && !validateDraftData && !idFromArgs && collectionSlug) {\n doc = await payload.create({\n collection: collectionSlug,\n data: initialData || {},\n depth: 0,\n draft: true,\n fallbackLocale: false,\n locale: locale?.code,\n overrideAccess: false,\n req,\n user,\n })\n\n if (doc?.id) {\n id = doc.id\n isEditing = getIsEditing({ id: doc.id, collectionSlug, globalSlug })\n\n if (!drawerSlug && redirectAfterCreate !== false) {\n const redirectURL = formatAdminURL({\n adminRoute,\n path: `/collections/${collectionSlug}/${doc.id}`,\n })\n\n req.server.redirect(redirectURL)\n }\n } else {\n throw new Error('not-found')\n }\n }\n\n const documentSlots = renderDocumentSlots({\n id,\n collectionConfig,\n doc: doc as Record<string, unknown>,\n globalConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n user: userWithReadAccess,\n })\n\n // Extract Description from documentSlots to pass to DocumentHeader\n const { Description } = documentSlots\n\n const clientProps: DocumentViewClientProps = {\n formState,\n ...documentSlots,\n documentSubViewType,\n viewType,\n }\n\n const { isLivePreviewEnabled, livePreviewConfig, livePreviewURL } = await handleLivePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n const { isPreviewEnabled, previewURL } = await handlePreview({\n collectionSlug,\n config,\n data: doc,\n globalSlug,\n operation,\n req,\n })\n\n return {\n data: doc,\n Document: (\n <DocumentInfoProvider\n apiURL={apiURL}\n collectionSlug={collectionConfig?.slug}\n currentEditor={currentEditor}\n disableActions={disableActions ?? false}\n docPermissions={docPermissions}\n globalSlug={globalConfig?.slug}\n hasDeletePermission={hasDeletePermission}\n hasPublishedDoc={hasPublishedDoc}\n hasPublishPermission={hasPublishPermission}\n hasSavePermission={hasSavePermission}\n hasScheduledPublish={hasScheduledPublish}\n hasTrashPermission={hasTrashPermission}\n id={id}\n initialData={doc}\n initialState={formState}\n isEditing={isEditing}\n isLocked={isLocked}\n isTrashed={isTrashedDoc}\n key={locale?.code}\n lastUpdateTime={lastUpdateTime}\n mostRecentVersionIsAutosaved={mostRecentVersionIsAutosaved}\n redirectAfterCreate={redirectAfterCreate}\n redirectAfterDelete={redirectAfterDelete}\n redirectAfterDuplicate={redirectAfterDuplicate}\n redirectAfterRestore={redirectAfterRestore}\n unpublishedVersionCount={unpublishedVersionCount}\n versionCount={versionCount}\n >\n <LivePreviewProvider\n breakpoints={livePreviewConfig?.breakpoints}\n isLivePreviewEnabled={isLivePreviewEnabled && operation !== 'create'}\n isLivePreviewing={Boolean(\n (entityPreferences?.value?.editViewType === undefined\n ? livePreviewConfig?.openByDefault\n : entityPreferences.value.editViewType === 'live-preview') && livePreviewURL,\n )}\n isPreviewEnabled={Boolean(isPreviewEnabled)}\n previewURL={previewURL}\n typeofLivePreviewURL={typeof livePreviewConfig?.url as 'function' | 'string' | undefined}\n url={livePreviewURL}\n >\n {showHeader && !drawerSlug && (\n <DocumentHeader\n AfterHeader={Description}\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n permissions={permissions}\n req={req}\n user={userWithReadAccess}\n />\n )}\n <HydrateAuthProvider permissions={permissions} />\n <EditDepthProvider>\n {RenderServerComponent({\n clientProps,\n Component: View,\n importMap,\n serverProps: documentViewServerProps,\n })}\n </EditDepthProvider>\n </LivePreviewProvider>\n </DocumentInfoProvider>\n ),\n }\n}\n\nexport async function DocumentView(props: AdminViewServerProps) {\n try {\n const { Document: RenderedDocument } = await renderDocument(props)\n return RenderedDocument\n } catch (error) {\n if (error?.message === 'NEXT_REDIRECT') {\n throw error\n }\n\n // The TanStack adapter's `req.server.redirect()` throws `redirect:<url>` as a\n // control-flow signal — the target is already recorded on `req.server` and\n // honored upstream in `loadAdminPage`. It isn't a real error, so swallow it\n // without logging, mirroring the `NEXT_REDIRECT` guard above.\n if (error?.message?.startsWith('redirect:')) {\n return\n }\n\n logError({ err: error, payload: props.initPageResult.req.payload })\n\n if (error.message === 'not-found') {\n props.initPageResult.req.server.notFound()\n }\n }\n}\n"],"mappings":";AAYA,SAASA,qBAAqB,EAAEC,QAAQ,QAAQ;AAChD,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,gBAAgB,QAAQ;AACrE,OAAOC,KAAA,MAAW;AAElB,SAAS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,SAAA;YACAiI,WAAA,EAAajD;UACf;;;OAxCC9D,MAAA,EAAQwD,IAAA;EA6CnB;AACF;AAEA,OAAO,eAAewD,aAAaC,KAA2B;EAC5D,IAAI;IACF,MAAM;MAAEf,QAAA,EAAUgB;IAAgB,CAAE,GAAG,MAAMxI,cAAA,CAAeuI,KAAA;IAC5D,OAAOC,gBAAA;EACT,EAAE,OAAOC,KAAA,EAAO;IACd,IAAIA,KAAA,EAAOC,OAAA,KAAY,iBAAiB;MACtC,MAAMD,KAAA;IACR;IAEA;IACA;IACA;IACA;IACA,IAAIA,KAAA,EAAOC,OAAA,EAASC,UAAA,CAAW,cAAc;MAC3C;IACF;IAEAvK,QAAA,CAAS;MAAEwK,GAAA,EAAKH,KAAA;MAAO/G,OAAA,EAAS6G,KAAA,CAAMjI,cAAc,CAACkB,GAAG,CAACE;IAAQ;IAEjE,IAAI+G,KAAA,CAAMC,OAAO,KAAK,aAAa;MACjCH,KAAA,CAAMjI,cAAc,CAACkB,GAAG,CAACsB,MAAM,CAAC+F,QAAQ;IAC1C;EACF;AACF","ignoreList":[]}
@@ -8,6 +8,7 @@ export declare const renderDocumentSlots: (args: {
8
8
  locale: Locale;
9
9
  permissions: SanitizedPermissions;
10
10
  req: PayloadRequest;
11
+ user?: PayloadRequest['user'];
11
12
  }) => DocumentSlots;
12
13
  export declare const renderDocumentSlotsHandler: ServerFunction<{
13
14
  collectionSlug: string;
@@ -1 +1 @@
1
- {"version":3,"file":"renderDocumentSlots.d.ts","sourceRoot":"","sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,aAAa,EAEb,MAAM,EAEN,cAAc,EAGd,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EAGpB,cAAc,EAOf,MAAM,SAAS,CAAA;AAShB,eAAO,MAAM,mBAAmB,EAAE,CAAC,IAAI,EAAE;IACvC,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,GAAG,CAAC,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CACrB,CA8CA,CAAA"}
@@ -12,7 +12,8 @@ export const renderDocumentSlots = args => {
12
12
  hasSavePermission,
13
13
  locale,
14
14
  permissions,
15
- req
15
+ req,
16
+ user
16
17
  } = args;
17
18
  const components = {};
18
19
  const unsavedDraftWithValidations = undefined;
@@ -24,7 +25,7 @@ export const renderDocumentSlots = args => {
24
25
  payload: req.payload,
25
26
  permissions,
26
27
  server: req.server,
27
- user: req.user
28
+ user
28
29
  };
29
30
  const BeforeDocumentControls = collectionConfig?.admin?.components?.edit?.beforeDocumentControls || globalConfig?.admin?.components?.edit?.beforeDocumentControls;
30
31
  if (BeforeDocumentControls) {
@@ -179,7 +180,8 @@ export const renderDocumentSlotsHandler = async args => {
179
180
  collectionSlug,
180
181
  locale,
181
182
  permissions,
182
- req
183
+ req,
184
+ user
183
185
  } = args;
184
186
  const collectionConfig = req.payload.collections[collectionSlug]?.config;
185
187
  if (!collectionConfig) {
@@ -219,7 +221,8 @@ export const renderDocumentSlotsHandler = async args => {
219
221
  hasSavePermission,
220
222
  locale,
221
223
  permissions,
222
- req
224
+ req,
225
+ user
223
226
  });
224
227
  };
225
228
  //# sourceMappingURL=renderDocumentSlots.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderDocumentSlots.js","names":["hasDraftsEnabled","matchMimeType","RenderServerComponent","ViewDescription","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","doc","globalConfig","hasSavePermission","locale","permissions","req","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","server","user","BeforeDocumentControls","edit","beforeDocumentControls","Component","importMap","BeforeDocumentMeta","EditMenuItems","editMenuItems","CustomPreviewButton","PreviewButton","LivePreview","views","livePreview","descriptionFromConfig","description","staticDescription","t","CustomDescription","Description","hasDescription","clientProps","collectionSlug","slug","Fallback","versions","drafts","CustomStatus","Status","CustomPublishButton","PublishButton","CustomUnpublishButton","UnpublishButton","CustomSaveDraftButton","SaveDraftButton","draftsEnabled","CustomSaveButton","SaveButton","upload","Upload","controls","UploadControls","filePreviewConfig","filePreview","mimeType","filePreviewComponent","UploadFilePreview","filename","filesize","fileSrc","url","height","width","renderDocumentSlotsHandler","collections","config","Error","data","result","findByID","collection","depth","overrideAccess","select"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n Locale,\n PayloadComponent,\n PayloadRequest,\n PreviewButtonServerPropsOnly,\n PublishButtonServerPropsOnly,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n SanitizedPermissions,\n SaveButtonServerPropsOnly,\n SaveDraftButtonServerPropsOnly,\n ServerFunction,\n ServerProps,\n StaticDescription,\n UnpublishButtonServerPropsOnly,\n UploadFilePreviewClientProps,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { hasDraftsEnabled, matchMimeType } from 'payload/shared'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds\nimport { ViewDescription } from '../../exports/client/index.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\n\nexport const renderDocumentSlots: (args: {\n collectionConfig?: SanitizedCollectionConfig\n doc?: Record<string, unknown>\n globalConfig?: SanitizedGlobalConfig\n hasSavePermission: boolean\n id?: number | string\n locale: Locale\n permissions: SanitizedPermissions\n req: PayloadRequest\n}) => DocumentSlots = (args) => {\n const { id, collectionConfig, doc, globalConfig, hasSavePermission, locale, permissions, req } =\n args\n\n const components: DocumentSlots = {} as DocumentSlots\n\n const unsavedDraftWithValidations = undefined\n\n const isPreviewEnabled = collectionConfig?.admin?.preview || globalConfig?.admin?.preview\n\n const serverProps: ServerProps = {\n id,\n i18n: req.i18n,\n locale,\n payload: req.payload,\n permissions,\n server: req.server,\n user: req.user,\n // TODO: Add remaining serverProps\n }\n\n const BeforeDocumentControls =\n collectionConfig?.admin?.components?.edit?.beforeDocumentControls ||\n globalConfig?.admin?.components?.edit?.beforeDocumentControls\n\n if (BeforeDocumentControls) {\n components.BeforeDocumentControls = RenderServerComponent({\n Component: BeforeDocumentControls,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies BeforeDocumentControlsServerPropsOnly,\n })\n }\n\n const BeforeDocumentMeta =\n collectionConfig?.admin?.components?.edit?.BeforeDocumentMeta ||\n globalConfig?.admin?.components?.edit?.BeforeDocumentMeta\n\n if (BeforeDocumentMeta) {\n components.BeforeDocumentMeta = RenderServerComponent({\n Component: BeforeDocumentMeta,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const EditMenuItems = collectionConfig?.admin?.components?.edit?.editMenuItems\n\n if (EditMenuItems) {\n components.EditMenuItems = RenderServerComponent({\n Component: EditMenuItems,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies EditMenuItemsServerPropsOnly,\n })\n }\n\n const CustomPreviewButton =\n collectionConfig?.admin?.components?.edit?.PreviewButton ||\n globalConfig?.admin?.components?.edit?.PreviewButton\n\n if (isPreviewEnabled && CustomPreviewButton) {\n components.PreviewButton = RenderServerComponent({\n Component: CustomPreviewButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PreviewButtonServerPropsOnly,\n })\n }\n\n const LivePreview =\n collectionConfig?.admin?.components?.views?.edit?.livePreview ||\n globalConfig?.admin?.components?.views?.edit?.livePreview\n\n if (LivePreview?.Component) {\n components.LivePreview = RenderServerComponent({\n Component: LivePreview.Component,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const descriptionFromConfig =\n collectionConfig?.admin?.description || globalConfig?.admin?.description\n\n const staticDescription: StaticDescription =\n typeof descriptionFromConfig === 'function'\n ? descriptionFromConfig({ t: req.i18n.t })\n : descriptionFromConfig\n\n const CustomDescription =\n collectionConfig?.admin?.components?.Description || globalConfig?.admin?.components?.Description\n\n const hasDescription = CustomDescription || staticDescription\n\n if (hasDescription) {\n components.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig?.slug,\n description: staticDescription,\n } satisfies ViewDescriptionClientProps,\n Component: CustomDescription,\n Fallback: ViewDescription,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n const CustomStatus =\n collectionConfig?.admin?.components?.edit?.Status ||\n globalConfig?.admin?.components?.edit?.Status\n\n if (CustomStatus) {\n components.Status = RenderServerComponent({\n Component: CustomStatus,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n }\n\n if (hasSavePermission) {\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n const CustomPublishButton =\n collectionConfig?.admin?.components?.edit?.PublishButton ||\n globalConfig?.admin?.components?.edit?.PublishButton\n\n if (CustomPublishButton) {\n components.PublishButton = RenderServerComponent({\n Component: CustomPublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PublishButtonServerPropsOnly,\n })\n }\n\n const CustomUnpublishButton =\n collectionConfig?.admin?.components?.edit?.UnpublishButton ||\n globalConfig?.admin?.components?.edit?.UnpublishButton\n\n if (CustomUnpublishButton) {\n components.UnpublishButton = RenderServerComponent({\n Component: CustomUnpublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies UnpublishButtonServerPropsOnly,\n })\n }\n\n const CustomSaveDraftButton =\n collectionConfig?.admin?.components?.edit?.SaveDraftButton ||\n globalConfig?.admin?.components?.edit?.SaveDraftButton\n\n const draftsEnabled = hasDraftsEnabled(collectionConfig || globalConfig)\n\n if ((draftsEnabled || unsavedDraftWithValidations) && CustomSaveDraftButton) {\n components.SaveDraftButton = RenderServerComponent({\n Component: CustomSaveDraftButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveDraftButtonServerPropsOnly,\n })\n }\n } else {\n const CustomSaveButton =\n collectionConfig?.admin?.components?.edit?.SaveButton ||\n globalConfig?.admin?.components?.edit?.SaveButton\n\n if (CustomSaveButton) {\n components.SaveButton = RenderServerComponent({\n Component: CustomSaveButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveButtonServerPropsOnly,\n })\n }\n }\n }\n\n if (collectionConfig?.upload && collectionConfig?.admin?.components?.edit?.Upload) {\n components.Upload = RenderServerComponent({\n Component: collectionConfig.admin.components.edit.Upload,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n if (collectionConfig?.upload && collectionConfig.upload.admin?.components?.controls) {\n components.UploadControls = RenderServerComponent({\n Component: collectionConfig.upload.admin.components.controls,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const filePreviewConfig = collectionConfig?.upload?.admin?.components?.filePreview\n if (collectionConfig?.upload && filePreviewConfig) {\n const mimeType = (doc?.mimeType as string) ?? ''\n let filePreviewComponent: PayloadComponent | undefined\n\n if (\n typeof filePreviewConfig === 'string' ||\n (typeof filePreviewConfig === 'object' && 'path' in filePreviewConfig)\n ) {\n filePreviewComponent = filePreviewConfig as PayloadComponent\n } else {\n filePreviewComponent = matchMimeType(\n filePreviewConfig as Record<string, PayloadComponent>,\n mimeType,\n )\n }\n\n if (filePreviewComponent) {\n components.UploadFilePreview = RenderServerComponent({\n clientProps: {\n filename: doc?.filename,\n filesize: doc?.filesize,\n fileSrc: doc?.url,\n height: doc?.height,\n mimeType,\n width: doc?.width,\n } as UploadFilePreviewClientProps,\n Component: filePreviewComponent,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n }\n\n return components\n}\n\nexport const renderDocumentSlotsHandler: ServerFunction<{\n collectionSlug: string\n id?: number | string\n}> = async (args) => {\n const { id, collectionSlug, locale, permissions, req } = args\n\n const collectionConfig = req.payload.collections[collectionSlug]?.config\n\n if (!collectionConfig) {\n throw new Error(req.t('error:incorrectCollection'))\n }\n\n const { hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data: {},\n req,\n })\n\n let doc: Record<string, unknown> | undefined\n if (id && collectionConfig.upload) {\n const result = await req.payload.findByID({\n id,\n collection: collectionSlug,\n depth: 0,\n overrideAccess: false,\n req,\n select: {\n filename: true,\n filesize: true,\n height: true,\n mimeType: true,\n url: true,\n width: true,\n },\n })\n doc = result as Record<string, unknown>\n }\n\n return renderDocumentSlots({\n id,\n collectionConfig,\n doc,\n hasSavePermission,\n locale,\n permissions,\n req,\n })\n}\n"],"mappings":"AAuBA,SAASA,gBAAgB,EAAEC,aAAa,QAAQ;AAEhD,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,mBAAA,GASUC,IAAA;EACrB,MAAM;IAAEC,EAAE;IAAEC,gBAAgB;IAAEC,GAAG;IAAEC,YAAY;IAAEC,iBAAiB;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAG,CAAE,GAC5FR,IAAA;EAEF,MAAMS,UAAA,GAA4B,CAAC;EAEnC,MAAMC,2BAAA,GAA8BC,SAAA;EAEpC,MAAMC,gBAAA,GAAmBV,gBAAA,EAAkBW,KAAA,EAAOC,OAAA,IAAWV,YAAA,EAAcS,KAAA,EAAOC,OAAA;EAElF,MAAMC,WAAA,GAA2B;IAC/Bd,EAAA;IACAe,IAAA,EAAMR,GAAA,CAAIQ,IAAI;IACdV,MAAA;IACAW,OAAA,EAAST,GAAA,CAAIS,OAAO;IACpBV,WAAA;IACAW,MAAA,EAAQV,GAAA,CAAIU,MAAM;IAClBC,IAAA,EAAMX,GAAA,CAAIW;EAEZ;EAEA,MAAMC,sBAAA,GACJlB,gBAAA,EAAkBW,KAAA,EAAOJ,UAAA,EAAYY,IAAA,EAAMC,sBAAA,IAC3ClB,YAAA,EAAcS,KAAA,EAAOJ,UAAA,EAAYY,IAAA,EAAMC,sBAAA;EAEzC,IAAIF,sBAAA,EAAwB;IAC1BX,UAAA,CAAWW,sBAAsB,GAAGxB,qBAAA,CAAsB;MACxD2B,SAAA,EAAWH,sBAAA;MACXI,S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A,MAAM;IAAE/B;EAAiB,CAAE,GAAG,MAAMP,sBAAA,CAAuB;IACzDG,EAAA;IACAC,gBAAA;IACA0E,IAAA,EAAM,CAAC;IACPpE;EACF;EAEA,IAAIL,GAAA;EACJ,IAAIF,EAAA,IAAMC,gBAAA,CAAiBuD,MAAM,EAAE;IACjC,MAAMoB,MAAA,GAAS,MAAMrE,GAAA,CAAIS,OAAO,CAAC6D,QAAQ,CAAC;MACxC7E,EAAA;MACA8E,UAAA,EAAYtC,cAAA;MACZuC,KAAA,EAAO;MACPC,cAAA,EAAgB;MAChBzE,GAAA;MACA0E,MAAA,EAAQ;QACNhB,QAAA,EAAU;QACVC,QAAA,EAAU;QACVG,MAAA,EAAQ;QACRP,QAAA,EAAU;QACVM,GAAA,EAAK;QACLE,KAAA,EAAO;MACT;IACF;IACApE,GAAA,GAAM0E,MAAA;EACR;EAEA,OAAO9E,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAC,GAAA;IACAE,iBAAA;IACAC,MAAA;IACAC,WAAA;IACAC;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"renderDocumentSlots.js","names":["hasDraftsEnabled","matchMimeType","RenderServerComponent","ViewDescription","getDocumentPermissions","renderDocumentSlots","args","id","collectionConfig","doc","globalConfig","hasSavePermission","locale","permissions","req","user","components","unsavedDraftWithValidations","undefined","isPreviewEnabled","admin","preview","serverProps","i18n","payload","server","BeforeDocumentControls","edit","beforeDocumentControls","Component","importMap","BeforeDocumentMeta","EditMenuItems","editMenuItems","CustomPreviewButton","PreviewButton","LivePreview","views","livePreview","descriptionFromConfig","description","staticDescription","t","CustomDescription","Description","hasDescription","clientProps","collectionSlug","slug","Fallback","versions","drafts","CustomStatus","Status","CustomPublishButton","PublishButton","CustomUnpublishButton","UnpublishButton","CustomSaveDraftButton","SaveDraftButton","draftsEnabled","CustomSaveButton","SaveButton","upload","Upload","controls","UploadControls","filePreviewConfig","filePreview","mimeType","filePreviewComponent","UploadFilePreview","filename","filesize","fileSrc","url","height","width","renderDocumentSlotsHandler","collections","config","Error","data","result","findByID","collection","depth","overrideAccess","select"],"sources":["../../../src/views/Document/renderDocumentSlots.tsx"],"sourcesContent":["import type {\n BeforeDocumentControlsServerPropsOnly,\n DocumentSlots,\n EditMenuItemsServerPropsOnly,\n Locale,\n PayloadComponent,\n PayloadRequest,\n PreviewButtonServerPropsOnly,\n PublishButtonServerPropsOnly,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n SanitizedPermissions,\n SaveButtonServerPropsOnly,\n SaveDraftButtonServerPropsOnly,\n ServerFunction,\n ServerProps,\n StaticDescription,\n UnpublishButtonServerPropsOnly,\n UploadFilePreviewClientProps,\n ViewDescriptionClientProps,\n ViewDescriptionServerPropsOnly,\n} from 'payload'\n\nimport { hasDraftsEnabled, matchMimeType } from 'payload/shared'\n\nimport { RenderServerComponent } from '../../elements/RenderServerComponent/index.js'\n// eslint-disable-next-line payload/no-imports-from-exports-dir -- Server component must reference exports/client bundle for proper client boundary in prod builds\nimport { ViewDescription } from '../../exports/client/index.js'\nimport { getDocumentPermissions } from '../../utilities/getDocumentPermissions.js'\n\nexport const renderDocumentSlots: (args: {\n collectionConfig?: SanitizedCollectionConfig\n doc?: Record<string, unknown>\n globalConfig?: SanitizedGlobalConfig\n hasSavePermission: boolean\n id?: number | string\n locale: Locale\n permissions: SanitizedPermissions\n req: PayloadRequest\n user?: PayloadRequest['user']\n}) => DocumentSlots = (args) => {\n const {\n id,\n collectionConfig,\n doc,\n globalConfig,\n hasSavePermission,\n locale,\n permissions,\n req,\n user,\n } = args\n\n const components: DocumentSlots = {} as DocumentSlots\n\n const unsavedDraftWithValidations = undefined\n\n const isPreviewEnabled = collectionConfig?.admin?.preview || globalConfig?.admin?.preview\n\n const serverProps: ServerProps = {\n id,\n i18n: req.i18n,\n locale,\n payload: req.payload,\n permissions,\n server: req.server,\n user,\n // TODO: Add remaining serverProps\n }\n\n const BeforeDocumentControls =\n collectionConfig?.admin?.components?.edit?.beforeDocumentControls ||\n globalConfig?.admin?.components?.edit?.beforeDocumentControls\n\n if (BeforeDocumentControls) {\n components.BeforeDocumentControls = RenderServerComponent({\n Component: BeforeDocumentControls,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies BeforeDocumentControlsServerPropsOnly,\n })\n }\n\n const BeforeDocumentMeta =\n collectionConfig?.admin?.components?.edit?.BeforeDocumentMeta ||\n globalConfig?.admin?.components?.edit?.BeforeDocumentMeta\n\n if (BeforeDocumentMeta) {\n components.BeforeDocumentMeta = RenderServerComponent({\n Component: BeforeDocumentMeta,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const EditMenuItems = collectionConfig?.admin?.components?.edit?.editMenuItems\n\n if (EditMenuItems) {\n components.EditMenuItems = RenderServerComponent({\n Component: EditMenuItems,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies EditMenuItemsServerPropsOnly,\n })\n }\n\n const CustomPreviewButton =\n collectionConfig?.admin?.components?.edit?.PreviewButton ||\n globalConfig?.admin?.components?.edit?.PreviewButton\n\n if (isPreviewEnabled && CustomPreviewButton) {\n components.PreviewButton = RenderServerComponent({\n Component: CustomPreviewButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PreviewButtonServerPropsOnly,\n })\n }\n\n const LivePreview =\n collectionConfig?.admin?.components?.views?.edit?.livePreview ||\n globalConfig?.admin?.components?.views?.edit?.livePreview\n\n if (LivePreview?.Component) {\n components.LivePreview = RenderServerComponent({\n Component: LivePreview.Component,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const descriptionFromConfig =\n collectionConfig?.admin?.description || globalConfig?.admin?.description\n\n const staticDescription: StaticDescription =\n typeof descriptionFromConfig === 'function'\n ? descriptionFromConfig({ t: req.i18n.t })\n : descriptionFromConfig\n\n const CustomDescription =\n collectionConfig?.admin?.components?.Description || globalConfig?.admin?.components?.Description\n\n const hasDescription = CustomDescription || staticDescription\n\n if (hasDescription) {\n components.Description = RenderServerComponent({\n clientProps: {\n collectionSlug: collectionConfig?.slug,\n description: staticDescription,\n } satisfies ViewDescriptionClientProps,\n Component: CustomDescription,\n Fallback: ViewDescription,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies ViewDescriptionServerPropsOnly,\n })\n }\n\n if (collectionConfig?.versions?.drafts || globalConfig?.versions?.drafts) {\n const CustomStatus =\n collectionConfig?.admin?.components?.edit?.Status ||\n globalConfig?.admin?.components?.edit?.Status\n\n if (CustomStatus) {\n components.Status = RenderServerComponent({\n Component: CustomStatus,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n }\n\n if (hasSavePermission) {\n if (hasDraftsEnabled(collectionConfig || globalConfig)) {\n const CustomPublishButton =\n collectionConfig?.admin?.components?.edit?.PublishButton ||\n globalConfig?.admin?.components?.edit?.PublishButton\n\n if (CustomPublishButton) {\n components.PublishButton = RenderServerComponent({\n Component: CustomPublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies PublishButtonServerPropsOnly,\n })\n }\n\n const CustomUnpublishButton =\n collectionConfig?.admin?.components?.edit?.UnpublishButton ||\n globalConfig?.admin?.components?.edit?.UnpublishButton\n\n if (CustomUnpublishButton) {\n components.UnpublishButton = RenderServerComponent({\n Component: CustomUnpublishButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies UnpublishButtonServerPropsOnly,\n })\n }\n\n const CustomSaveDraftButton =\n collectionConfig?.admin?.components?.edit?.SaveDraftButton ||\n globalConfig?.admin?.components?.edit?.SaveDraftButton\n\n const draftsEnabled = hasDraftsEnabled(collectionConfig || globalConfig)\n\n if ((draftsEnabled || unsavedDraftWithValidations) && CustomSaveDraftButton) {\n components.SaveDraftButton = RenderServerComponent({\n Component: CustomSaveDraftButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveDraftButtonServerPropsOnly,\n })\n }\n } else {\n const CustomSaveButton =\n collectionConfig?.admin?.components?.edit?.SaveButton ||\n globalConfig?.admin?.components?.edit?.SaveButton\n\n if (CustomSaveButton) {\n components.SaveButton = RenderServerComponent({\n Component: CustomSaveButton,\n importMap: req.payload.importMap,\n serverProps: serverProps satisfies SaveButtonServerPropsOnly,\n })\n }\n }\n }\n\n if (collectionConfig?.upload && collectionConfig?.admin?.components?.edit?.Upload) {\n components.Upload = RenderServerComponent({\n Component: collectionConfig.admin.components.edit.Upload,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n if (collectionConfig?.upload && collectionConfig.upload.admin?.components?.controls) {\n components.UploadControls = RenderServerComponent({\n Component: collectionConfig.upload.admin.components.controls,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n\n const filePreviewConfig = collectionConfig?.upload?.admin?.components?.filePreview\n if (collectionConfig?.upload && filePreviewConfig) {\n const mimeType = (doc?.mimeType as string) ?? ''\n let filePreviewComponent: PayloadComponent | undefined\n\n if (\n typeof filePreviewConfig === 'string' ||\n (typeof filePreviewConfig === 'object' && 'path' in filePreviewConfig)\n ) {\n filePreviewComponent = filePreviewConfig as PayloadComponent\n } else {\n filePreviewComponent = matchMimeType(\n filePreviewConfig as Record<string, PayloadComponent>,\n mimeType,\n )\n }\n\n if (filePreviewComponent) {\n components.UploadFilePreview = RenderServerComponent({\n clientProps: {\n filename: doc?.filename,\n filesize: doc?.filesize,\n fileSrc: doc?.url,\n height: doc?.height,\n mimeType,\n width: doc?.width,\n } as UploadFilePreviewClientProps,\n Component: filePreviewComponent,\n importMap: req.payload.importMap,\n serverProps,\n })\n }\n }\n\n return components\n}\n\nexport const renderDocumentSlotsHandler: ServerFunction<{\n collectionSlug: string\n id?: number | string\n}> = async (args) => {\n const { id, collectionSlug, locale, permissions, req, user } = args\n\n const collectionConfig = req.payload.collections[collectionSlug]?.config\n\n if (!collectionConfig) {\n throw new Error(req.t('error:incorrectCollection'))\n }\n\n const { hasSavePermission } = await getDocumentPermissions({\n id,\n collectionConfig,\n data: {},\n req,\n })\n\n let doc: Record<string, unknown> | undefined\n if (id && collectionConfig.upload) {\n const result = await req.payload.findByID({\n id,\n collection: collectionSlug,\n depth: 0,\n overrideAccess: false,\n req,\n select: {\n filename: true,\n filesize: true,\n height: true,\n mimeType: true,\n url: true,\n width: true,\n },\n })\n doc = result as Record<string, unknown>\n }\n\n return renderDocumentSlots({\n id,\n collectionConfig,\n doc,\n hasSavePermission,\n locale,\n permissions,\n req,\n user,\n })\n}\n"],"mappings":"AAuBA,SAASA,gBAAgB,EAAEC,aAAa,QAAQ;AAEhD,SAASC,qBAAqB,QAAQ;AACtC;AACA,SAASC,eAAe,QAAQ;AAChC,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,mBAAA,GAUUC,IAAA;EACrB,MAAM;IACJC,EAAE;IACFC,gBAAgB;IAChBC,GAAG;IACHC,YAAY;IACZC,iBAAiB;IACjBC,MAAM;IACNC,WAAW;IACXC,GAAG;IACHC;EAAI,CACL,GAAGT,IAAA;EAEJ,MAAMU,UAAA,GAA4B,CAAC;EAEnC,MAAMC,2BAAA,GAA8BC,SAAA;EAEpC,MAAMC,gBAAA,GAAmBX,gBAAA,EAAkBY,KAAA,EAAOC,OAAA,IAAWX,YAAA,EAAcU,KAAA,EAAOC,OAAA;EAElF,MAAMC,WAAA,GAA2B;IAC/Bf,EAAA;IACAgB,IAAA,EAAMT,GAAA,CAAIS,IAAI;IACdX,MAAA;IACAY,OAAA,EAASV,GAAA,CAAIU,OAAO;IACpBX,WAAA;IACAY,MAAA,EAAQX,GAAA,CAAIW,MAAM;IAClBV;EAEF;EAEA,MAAMW,sBAAA,GACJlB,gBAAA,EAAkBY,KAAA,EAAOJ,UAAA,EAAYW,IAAA,EAAMC,sBAAA,IAC3ClB,YAAA,EAAcU,KAAA,EAAOJ,UAAA,EAAYW,IAAA,EAAMC,sBAAA;EAEzC,IAAIF,sBAAA,EAAwB;IAC1BV,UAAA,CAAWU,sBAAsB,GAAGxB,qBAAA,CAAsB;MACxD2B,SAAA,EAAWH,sBAAA;MACXI,SAAA,EAAWhB,GAAA,CAAIU,OAAO,CAACM,SAAS;MAChCR,W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A,CAAuB;IACzDG,EAAA;IACAC,gBAAA;IACA0E,IAAA,EAAM,CAAC;IACPpE;EACF;EAEA,IAAIL,GAAA;EACJ,IAAIF,EAAA,IAAMC,gBAAA,CAAiBuD,MAAM,EAAE;IACjC,MAAMoB,MAAA,GAAS,MAAMrE,GAAA,CAAIU,OAAO,CAAC4D,QAAQ,CAAC;MACxC7E,EAAA;MACA8E,UAAA,EAAYtC,cAAA;MACZuC,KAAA,EAAO;MACPC,cAAA,EAAgB;MAChBzE,GAAA;MACA0E,MAAA,EAAQ;QACNhB,QAAA,EAAU;QACVC,QAAA,EAAU;QACVG,MAAA,EAAQ;QACRP,QAAA,EAAU;QACVM,GAAA,EAAK;QACLE,KAAA,EAAO;MACT;IACF;IACApE,GAAA,GAAM0E,MAAA;EACR;EAEA,OAAO9E,mBAAA,CAAoB;IACzBE,EAAA;IACAC,gBAAA;IACAC,GAAA;IACAE,iBAAA;IACAC,MAAA;IACAC,WAAA;IACAC,GAAA;IACAC;EACF;AACF","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export declare const APIKey: React.FC<{
3
- readonly enabled: boolean;
4
3
  readonly readOnly?: boolean;
4
+ readonly reveal?: boolean;
5
5
  }>;
6
6
  //# sourceMappingURL=APIKey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"APIKey.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/Auth/APIKey.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAe3D,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CA8GvF,CAAA"}
1
+ {"version":3,"file":"APIKey.d.ts","sourceRoot":"","sources":["../../../../src/views/Edit/Auth/APIKey.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAyB3D,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAuRvF,CAAA"}