@payloadcms/next 3.68.0-internal-debug.654e4ad → 3.68.0-internal.10bf491
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/login.js +58 -52
- package/dist/auth/login.js.map +1 -1
- package/dist/auth/logout.js +44 -39
- package/dist/auth/logout.js.map +1 -1
- package/dist/auth/refresh.js +47 -45
- package/dist/auth/refresh.js.map +1 -1
- package/dist/cjs/withPayload.cjs +41 -65
- package/dist/cjs/withPayload.cjs.map +1 -1
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
- package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +71 -40
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +59 -65
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +70 -80
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +23 -16
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +69 -61
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.js +28 -48
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/FormHeader/index.js +16 -30
- package/dist/elements/FormHeader/index.js.map +1 -1
- package/dist/elements/Logo/index.js +34 -19
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +44 -23
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +54 -28
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/SettingsMenuButton/index.js +39 -33
- package/dist/elements/Nav/SettingsMenuButton/index.js.map +1 -1
- package/dist/elements/Nav/getNavPrefs.js +22 -27
- package/dist/elements/Nav/getNavPrefs.js.map +1 -1
- package/dist/elements/Nav/index.client.js +118 -97
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.js +127 -148
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/exports/auth.js +0 -1
- package/dist/exports/auth.js.map +1 -1
- package/dist/exports/client.js +1 -1
- package/dist/exports/client.js.map +1 -1
- package/dist/exports/layouts.js +0 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/routes.js +0 -1
- package/dist/exports/routes.js.map +1 -1
- package/dist/exports/rsc.js +0 -1
- package/dist/exports/rsc.js.map +1 -1
- package/dist/exports/templates.js +0 -1
- package/dist/exports/templates.js.map +1 -1
- package/dist/exports/utilities.js +12 -7
- package/dist/exports/utilities.js.map +1 -1
- package/dist/exports/views.js +0 -1
- package/dist/exports/views.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/NestProviders.js +20 -21
- package/dist/layouts/Root/NestProviders.js.map +1 -1
- package/dist/layouts/Root/checkDependencies.js +41 -49
- package/dist/layouts/Root/checkDependencies.js.map +1 -1
- package/dist/layouts/Root/index.js +103 -128
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -5
- package/dist/routes/graphql/handler.js +122 -114
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/index.js +0 -1
- package/dist/routes/graphql/index.js.map +1 -1
- package/dist/routes/graphql/playground.js +23 -24
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/index.js +0 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/rest/index.js +19 -20
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.js +79 -103
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +54 -59
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/templates/Default/NavHamburger/index.js +20 -12
- package/dist/templates/Default/NavHamburger/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +44 -20
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.js +133 -183
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Minimal/index.js +17 -26
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/utilities/getExistingAuthToken.js +2 -3
- package/dist/utilities/getExistingAuthToken.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +13 -12
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.js +5 -5
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getPreferences.js +22 -27
- package/dist/utilities/getPreferences.js.map +1 -1
- package/dist/utilities/getRequestLocale.js +14 -13
- package/dist/utilities/getRequestLocale.js.map +1 -1
- package/dist/utilities/getRequestTheme.js +19 -19
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/getRouteWithoutAdmin.js +5 -3
- package/dist/utilities/getRouteWithoutAdmin.js.map +1 -1
- package/dist/utilities/getVisibleEntities.js +23 -12
- package/dist/utilities/getVisibleEntities.js.map +1 -1
- package/dist/utilities/handleAuthRedirect.js +36 -22
- package/dist/utilities/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/handleServerFunctions.js +39 -32
- package/dist/utilities/handleServerFunctions.js.map +1 -1
- package/dist/utilities/initReq.js +96 -78
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/utilities/isCustomAdminView.js +26 -22
- package/dist/utilities/isCustomAdminView.js.map +1 -1
- package/dist/utilities/isPublicAdminRoute.js +20 -26
- package/dist/utilities/isPublicAdminRoute.js.map +1 -1
- package/dist/utilities/meta.js +63 -68
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/selectiveCache.js +26 -25
- package/dist/utilities/selectiveCache.js.map +1 -1
- package/dist/utilities/setPayloadAuthCookie.js +22 -19
- package/dist/utilities/setPayloadAuthCookie.js.map +1 -1
- package/dist/utilities/slugify.js +33 -24
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/utilities/timestamp.js +6 -7
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +39 -17
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.js +126 -171
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/index.client.js +195 -287
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.js +2 -7
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/API/metadata.js +23 -18
- package/dist/views/API/metadata.js.map +1 -1
- package/dist/views/Account/ResetPreferences/index.js +91 -74
- package/dist/views/Account/ResetPreferences/index.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +47 -18
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/Settings/index.js +28 -62
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +55 -38
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.client.js +32 -16
- package/dist/views/Account/index.client.js.map +1 -1
- package/dist/views/Account/index.js +155 -144
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Account/metadata.js +12 -8
- package/dist/views/Account/metadata.js.map +1 -1
- package/dist/views/BrowseByFolder/buildView.js +158 -139
- package/dist/views/BrowseByFolder/buildView.js.map +1 -1
- package/dist/views/BrowseByFolder/index.js +16 -16
- package/dist/views/BrowseByFolder/index.js.map +1 -1
- package/dist/views/BrowseByFolder/metadata.js +15 -13
- package/dist/views/BrowseByFolder/metadata.js.map +1 -1
- package/dist/views/CollectionFolders/buildView.js +143 -123
- package/dist/views/CollectionFolders/buildView.js.map +1 -1
- package/dist/views/CollectionFolders/index.js +16 -16
- package/dist/views/CollectionFolders/index.js.map +1 -1
- package/dist/views/CollectionFolders/metadata.js +21 -18
- package/dist/views/CollectionFolders/metadata.js.map +1 -1
- package/dist/views/CollectionFolders/renderFolderViewSlots.js +61 -58
- package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -1
- package/dist/views/CollectionTrash/index.js +17 -17
- package/dist/views/CollectionTrash/index.js.map +1 -1
- package/dist/views/CollectionTrash/metadata.js +21 -18
- package/dist/views/CollectionTrash/metadata.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +101 -114
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.js +81 -87
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/metadata.js +12 -8
- package/dist/views/CreateFirstUser/metadata.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +152 -176
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +90 -97
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Dashboard/metadata.js +14 -10
- package/dist/views/Dashboard/metadata.js.map +1 -1
- package/dist/views/Document/getCustomDocumentViewByKey.js +2 -3
- package/dist/views/Document/getCustomDocumentViewByKey.js.map +1 -1
- package/dist/views/Document/getCustomViewByRoute.js +30 -27
- package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Document/getDocPreferences.js +41 -40
- package/dist/views/Document/getDocPreferences.js.map +1 -1
- package/dist/views/Document/getDocumentData.js +55 -44
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +80 -77
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getDocumentView.js +283 -313
- package/dist/views/Document/getDocumentView.js.map +1 -1
- package/dist/views/Document/getIsLocked.js +66 -66
- package/dist/views/Document/getIsLocked.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +136 -130
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getVersions.js +194 -204
- package/dist/views/Document/getVersions.js.map +1 -1
- package/dist/views/Document/handleServerFunction.js +128 -103
- package/dist/views/Document/handleServerFunction.js.map +1 -1
- package/dist/views/Document/index.js +354 -315
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/metadata.js +1 -2
- package/dist/views/Document/metadata.js.map +1 -1
- package/dist/views/Document/renderDocumentSlots.js +132 -121
- package/dist/views/Document/renderDocumentSlots.js.map +1 -1
- package/dist/views/Edit/index.js +6 -10
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/Edit/metadata.js +46 -36
- package/dist/views/Edit/metadata.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +164 -130
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +62 -79
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/ForgotPassword/metadata.js +12 -8
- package/dist/views/ForgotPassword/metadata.js.map +1 -1
- package/dist/views/List/createSerializableValue.js +11 -12
- package/dist/views/List/createSerializableValue.js.map +1 -1
- package/dist/views/List/enrichDocsWithVersionStatus.js +86 -86
- package/dist/views/List/enrichDocsWithVersionStatus.js.map +1 -1
- package/dist/views/List/extractRelationshipDisplayValue.js +14 -15
- package/dist/views/List/extractRelationshipDisplayValue.js.map +1 -1
- package/dist/views/List/extractValueOrRelationshipID.js +15 -16
- package/dist/views/List/extractValueOrRelationshipID.js.map +1 -1
- package/dist/views/List/handleGroupBy.js +150 -133
- package/dist/views/List/handleGroupBy.js.map +1 -1
- package/dist/views/List/handleServerFunction.js +119 -96
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.js +323 -305
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/metadata.js +20 -17
- package/dist/views/List/metadata.js.map +1 -1
- package/dist/views/List/renderListViewSlots.js +75 -82
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/List/resolveAllFilterOptions.js +45 -43
- package/dist/views/List/resolveAllFilterOptions.js.map +1 -1
- package/dist/views/List/transformColumnsToSelect.js +8 -9
- package/dist/views/List/transformColumnsToSelect.js.map +1 -1
- package/dist/views/Login/LoginField/index.js +89 -57
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.js +157 -104
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.js +85 -82
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Login/metadata.js +12 -8
- package/dist/views/Login/metadata.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +119 -83
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +29 -29
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Logout/metadata.js +11 -7
- package/dist/views/Logout/metadata.js.map +1 -1
- package/dist/views/NotFound/index.client.js +82 -71
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.js +72 -71
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/metadata.js +9 -7
- package/dist/views/NotFound/metadata.js.map +1 -1
- package/dist/views/ResetPassword/ResetPasswordForm/index.js +107 -94
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -1
- package/dist/views/ResetPassword/index.js +73 -93
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/metadata.js +12 -8
- package/dist/views/ResetPassword/metadata.js.map +1 -1
- package/dist/views/Root/attachViewActions.js +23 -18
- package/dist/views/Root/attachViewActions.js.map +1 -1
- package/dist/views/Root/generateCustomViewMetadata.js +21 -19
- package/dist/views/Root/generateCustomViewMetadata.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js +14 -12
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Root/getCustomViewByRoute.js +42 -31
- package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Root/getDocumentViewInfo.js +23 -24
- package/dist/views/Root/getDocumentViewInfo.js.map +1 -1
- package/dist/views/Root/getRouteData.js +325 -333
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Root/index.js +269 -247
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +26 -21
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Root/metadata.js +181 -176
- package/dist/views/Root/metadata.js.map +1 -1
- package/dist/views/Unauthorized/index.js +46 -54
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/metadata.js +12 -8
- package/dist/views/Unauthorized/metadata.js.map +1 -1
- package/dist/views/Verify/index.client.js +43 -25
- package/dist/views/Verify/index.client.js.map +1 -1
- package/dist/views/Verify/index.js +62 -68
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/metadata.js +12 -8
- package/dist/views/Verify/metadata.js.map +1 -1
- package/dist/views/Version/Default/SelectedLocalesContext.js +4 -4
- package/dist/views/Version/Default/SelectedLocalesContext.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +127 -86
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.js +236 -380
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/types.js +1 -2
- package/dist/views/Version/Default/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js +119 -102
- package/dist/views/Version/RenderFieldsToDiff/DiffCollapser/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js +73 -78
- package/dist/views/Version/RenderFieldsToDiff/RenderVersionFieldsToDiff.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js +408 -363
- package/dist/views/Version/RenderFieldsToDiff/buildVersionFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js +51 -40
- package/dist/views/Version/RenderFieldsToDiff/fields/Collapsible/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js +67 -35
- package/dist/views/Version/RenderFieldsToDiff/fields/Date/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js +56 -59
- package/dist/views/Version/RenderFieldsToDiff/fields/Group/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +117 -139
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js +41 -36
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/generateLabelFromValue.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +178 -192
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js +11 -17
- package/dist/views/Version/RenderFieldsToDiff/fields/Row/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +73 -48
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +143 -132
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +81 -56
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js +210 -251
- package/dist/views/Version/RenderFieldsToDiff/fields/Upload/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -23
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +9 -12
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js +228 -213
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js +826 -1005
- package/dist/views/Version/RenderFieldsToDiff/utilities/countChangedFields.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js +43 -44
- package/dist/views/Version/RenderFieldsToDiff/utilities/fieldHasChanges.spec.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js +22 -25
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldPathsModified.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js +36 -32
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js +129 -145
- package/dist/views/Version/RenderFieldsToDiff/utilities/getFieldsForRowComparison.spec.js.map +1 -1
- package/dist/views/Version/Restore/index.js +91 -116
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js +50 -33
- package/dist/views/Version/SelectComparison/VersionDrawer/CreatedAtCell.js.map +1 -1
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js +226 -170
- package/dist/views/Version/SelectComparison/VersionDrawer/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +50 -73
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/types.js +1 -2
- package/dist/views/Version/SelectComparison/types.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.js +32 -34
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js +95 -104
- package/dist/views/Version/VersionPillLabel/VersionPillLabel.js.map +1 -1
- package/dist/views/Version/VersionPillLabel/getVersionLabel.js +27 -23
- package/dist/views/Version/VersionPillLabel/getVersionLabel.js.map +1 -1
- package/dist/views/Version/fetchVersions.js +138 -113
- package/dist/views/Version/fetchVersions.js.map +1 -1
- package/dist/views/Version/index.js +323 -325
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Version/metadata.js +50 -43
- package/dist/views/Version/metadata.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +79 -95
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +38 -34
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +53 -32
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +8 -10
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/index.client.js +83 -106
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.js +140 -140
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/metadata.js +44 -37
- package/dist/views/Versions/metadata.js.map +1 -1
- package/dist/views/Versions/types.js +1 -2
- package/dist/views/Versions/types.js.map +1 -1
- package/dist/withPayload.d.ts +8 -2
- package/dist/withPayload.d.ts.map +1 -1
- package/dist/withPayload.js +145 -219
- package/dist/withPayload.js.map +1 -1
- package/dist/withPayload.utils.d.ts +58 -0
- package/dist/withPayload.utils.d.ts.map +1 -0
- package/dist/withPayload.utils.js +101 -0
- package/dist/withPayload.utils.js.map +1 -0
- package/dist/withPayloadLegacy.d.ts +6 -0
- package/dist/withPayloadLegacy.d.ts.map +1 -0
- package/dist/withPayloadLegacy.js +44 -0
- package/dist/withPayloadLegacy.js.map +1 -0
- package/package.json +15 -17
- package/dist/esbuildEntry.d.ts +0 -5
- package/dist/esbuildEntry.d.ts.map +0 -1
- package/dist/esbuildEntry.js +0 -6
- package/dist/esbuildEntry.js.map +0 -1
package/dist/auth/login.js
CHANGED
|
@@ -1,61 +1,67 @@
|
|
|
1
1
|
'use server';
|
|
2
|
+
|
|
2
3
|
import { getPayload } from 'payload';
|
|
3
4
|
import { setPayloadAuthCookie } from '../utilities/setPayloadAuthCookie.js';
|
|
4
|
-
export async function login({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
export async function login({
|
|
6
|
+
collection,
|
|
7
|
+
config,
|
|
8
|
+
email,
|
|
9
|
+
password,
|
|
10
|
+
username
|
|
11
|
+
}) {
|
|
12
|
+
const payload = await getPayload({
|
|
13
|
+
config,
|
|
14
|
+
cron: true
|
|
15
|
+
});
|
|
16
|
+
const authConfig = payload.collections[collection]?.config.auth;
|
|
17
|
+
if (!authConfig) {
|
|
18
|
+
throw new Error(`No auth config found for collection: ${collection}`);
|
|
19
|
+
}
|
|
20
|
+
const loginWithUsername = authConfig?.loginWithUsername ?? false;
|
|
21
|
+
if (loginWithUsername) {
|
|
22
|
+
if (loginWithUsername.allowEmailLogin) {
|
|
23
|
+
if (!email && !username) {
|
|
24
|
+
throw new Error('Email or username is required.');
|
|
25
|
+
}
|
|
24
26
|
} else {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
if (!username) {
|
|
28
|
+
throw new Error('Username is required.');
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
password,
|
|
33
|
-
username
|
|
34
|
-
} : {
|
|
35
|
-
email,
|
|
36
|
-
password
|
|
37
|
-
};
|
|
38
|
-
} else {
|
|
39
|
-
loginData = {
|
|
40
|
-
email,
|
|
41
|
-
password
|
|
42
|
-
};
|
|
31
|
+
} else {
|
|
32
|
+
if (!email) {
|
|
33
|
+
throw new Error('Email is required.');
|
|
43
34
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
}
|
|
36
|
+
let loginData;
|
|
37
|
+
if (loginWithUsername) {
|
|
38
|
+
loginData = username ? {
|
|
39
|
+
password,
|
|
40
|
+
username
|
|
41
|
+
} : {
|
|
42
|
+
email,
|
|
43
|
+
password
|
|
44
|
+
};
|
|
45
|
+
} else {
|
|
46
|
+
loginData = {
|
|
47
|
+
email,
|
|
48
|
+
password
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const result = await payload.login({
|
|
52
|
+
collection,
|
|
53
|
+
data: loginData
|
|
54
|
+
});
|
|
55
|
+
if (result.token) {
|
|
56
|
+
await setPayloadAuthCookie({
|
|
57
|
+
authConfig,
|
|
58
|
+
cookiePrefix: payload.config.cookiePrefix,
|
|
59
|
+
token: result.token
|
|
47
60
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
if ('removeTokenFromResponses' in config && config.removeTokenFromResponses) {
|
|
56
|
-
delete result.token;
|
|
57
|
-
}
|
|
58
|
-
return result;
|
|
61
|
+
}
|
|
62
|
+
if ('removeTokenFromResponses' in config && config.removeTokenFromResponses) {
|
|
63
|
+
delete result.token;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
59
66
|
}
|
|
60
|
-
|
|
61
67
|
//# sourceMappingURL=login.js.map
|
package/dist/auth/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/login.ts"],"sourcesContent":["'use server'\n\nimport type { CollectionSlug } from 'payload'\n\nimport { getPayload } from 'payload'\n\nimport { setPayloadAuthCookie } from '../utilities/setPayloadAuthCookie.js'\n\ntype LoginWithEmail = {\n collection: CollectionSlug\n config: any\n email: string\n password: string\n username?: never\n}\n\ntype LoginWithUsername = {\n collection: CollectionSlug\n config: any\n email?: never\n password: string\n username: string\n}\ntype LoginArgs = LoginWithEmail | LoginWithUsername\n\nexport async function login({ collection, config, email, password, username }: LoginArgs): Promise<{\n token?: string\n user: any\n}> {\n const payload = await getPayload({ config, cron: true })\n\n const authConfig = payload.collections[collection]?.config.auth\n\n if (!authConfig) {\n throw new Error(`No auth config found for collection: ${collection}`)\n }\n\n const loginWithUsername = authConfig?.loginWithUsername ?? false\n\n if (loginWithUsername) {\n if (loginWithUsername.allowEmailLogin) {\n if (!email && !username) {\n throw new Error('Email or username is required.')\n }\n } else {\n if (!username) {\n throw new Error('Username is required.')\n }\n }\n } else {\n if (!email) {\n throw new Error('Email is required.')\n }\n }\n\n let loginData\n\n if (loginWithUsername) {\n loginData = username ? { password, username } : { email, password }\n } else {\n loginData = { email, password }\n }\n\n const result = await payload.login({\n collection,\n data: loginData,\n })\n\n if (result.token) {\n await setPayloadAuthCookie({\n authConfig,\n cookiePrefix: payload.config.cookiePrefix,\n token: result.token,\n })\n }\n\n if ('removeTokenFromResponses' in config && config.removeTokenFromResponses) {\n delete result.token\n }\n\n return result\n}\n"],"
|
|
1
|
+
{"version":3,"file":"login.js","names":["getPayload","setPayloadAuthCookie","login","collection","config","email","password","username","payload","cron","authConfig","collections","auth","Error","loginWithUsername","allowEmailLogin","loginData","result","data","token","cookiePrefix","removeTokenFromResponses"],"sources":["../../src/auth/login.ts"],"sourcesContent":["'use server'\n\nimport type { CollectionSlug } from 'payload'\n\nimport { getPayload } from 'payload'\n\nimport { setPayloadAuthCookie } from '../utilities/setPayloadAuthCookie.js'\n\ntype LoginWithEmail = {\n collection: CollectionSlug\n config: any\n email: string\n password: string\n username?: never\n}\n\ntype LoginWithUsername = {\n collection: CollectionSlug\n config: any\n email?: never\n password: string\n username: string\n}\ntype LoginArgs = LoginWithEmail | LoginWithUsername\n\nexport async function login({ collection, config, email, password, username }: LoginArgs): Promise<{\n token?: string\n user: any\n}> {\n const payload = await getPayload({ config, cron: true })\n\n const authConfig = payload.collections[collection]?.config.auth\n\n if (!authConfig) {\n throw new Error(`No auth config found for collection: ${collection}`)\n }\n\n const loginWithUsername = authConfig?.loginWithUsername ?? false\n\n if (loginWithUsername) {\n if (loginWithUsername.allowEmailLogin) {\n if (!email && !username) {\n throw new Error('Email or username is required.')\n }\n } else {\n if (!username) {\n throw new Error('Username is required.')\n }\n }\n } else {\n if (!email) {\n throw new Error('Email is required.')\n }\n }\n\n let loginData\n\n if (loginWithUsername) {\n loginData = username ? { password, username } : { email, password }\n } else {\n loginData = { email, password }\n }\n\n const result = await payload.login({\n collection,\n data: loginData,\n })\n\n if (result.token) {\n await setPayloadAuthCookie({\n authConfig,\n cookiePrefix: payload.config.cookiePrefix,\n token: result.token,\n })\n }\n\n if ('removeTokenFromResponses' in config && config.removeTokenFromResponses) {\n delete result.token\n }\n\n return result\n}\n"],"mappings":"AAAA;;AAIA,SAASA,UAAU,QAAQ;AAE3B,SAASC,oBAAoB,QAAQ;AAmBrC,OAAO,eAAeC,MAAM;EAAEC,UAAU;EAAEC,MAAM;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAQ,CAAa;EAItF,MAAMC,OAAA,GAAU,MAAMR,UAAA,CAAW;IAAEI,MAAA;IAAQK,IAAA,EAAM;EAAK;EAEtD,MAAMC,UAAA,GAAaF,OAAA,CAAQG,WAAW,CAACR,UAAA,CAAW,EAAEC,MAAA,CAAOQ,IAAA;EAE3D,IAAI,CAACF,UAAA,EAAY;IACf,MAAM,IAAIG,KAAA,CAAM,wCAAwCV,UAAA,EAAY;EACtE;EAEA,MAAMW,iBAAA,GAAoBJ,UAAA,EAAYI,iBAAA,IAAqB;EAE3D,IAAIA,iBAAA,EAAmB;IACrB,IAAIA,iBAAA,CAAkBC,eAAe,EAAE;MACrC,IAAI,CAACV,KAAA,IAAS,CAACE,QAAA,EAAU;QACvB,MAAM,IAAIM,KAAA,CAAM;MAClB;IACF,OAAO;MACL,IAAI,CAACN,QAAA,EAAU;QACb,MAAM,IAAIM,KAAA,CAAM;MAClB;IACF;EACF,OAAO;IACL,IAAI,CAACR,KAAA,EAAO;MACV,MAAM,IAAIQ,KAAA,CAAM;IAClB;EACF;EAEA,IAAIG,SAAA;EAEJ,IAAIF,iBAAA,EAAmB;IACrBE,SAAA,GAAYT,QAAA,GAAW;MAAED,QAAA;MAAUC;IAAS,IAAI;MAAEF,KAAA;MAAOC;IAAS;EACpE,OAAO;IACLU,SAAA,GAAY;MAAEX,KAAA;MAAOC;IAAS;EAChC;EAEA,MAAMW,MAAA,GAAS,MAAMT,OAAA,CAAQN,KAAK,CAAC;IACjCC,UAAA;IACAe,IAAA,EAAMF;EACR;EAEA,IAAIC,MAAA,CAAOE,KAAK,EAAE;IAChB,MAAMlB,oBAAA,CAAqB;MACzBS,UAAA;MACAU,YAAA,EAAcZ,OAAA,CAAQJ,MAAM,CAACgB,YAAY;MACzCD,KAAA,EAAOF,MAAA,CAAOE;IAChB;EACF;EAEA,IAAI,8BAA8Bf,MAAA,IAAUA,MAAA,CAAOiB,wBAAwB,EAAE;IAC3E,OAAOJ,MAAA,CAAOE,KAAK;EACrB;EAEA,OAAOF,MAAA;AACT","ignoreList":[]}
|
package/dist/auth/logout.js
CHANGED
|
@@ -1,47 +1,52 @@
|
|
|
1
1
|
'use server';
|
|
2
|
+
|
|
2
3
|
import { cookies as getCookies, headers as nextHeaders } from 'next/headers.js';
|
|
3
4
|
import { createLocalReq, getPayload, logoutOperation } from 'payload';
|
|
4
5
|
import { getExistingAuthToken } from '../utilities/getExistingAuthToken.js';
|
|
5
|
-
export async function logout({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix);
|
|
37
|
-
if (existingCookie) {
|
|
38
|
-
const cookies = await getCookies();
|
|
39
|
-
cookies.delete(existingCookie.name);
|
|
40
|
-
}
|
|
6
|
+
export async function logout({
|
|
7
|
+
allSessions = false,
|
|
8
|
+
config
|
|
9
|
+
}) {
|
|
10
|
+
const payload = await getPayload({
|
|
11
|
+
config,
|
|
12
|
+
cron: true
|
|
13
|
+
});
|
|
14
|
+
const headers = await nextHeaders();
|
|
15
|
+
const authResult = await payload.auth({
|
|
16
|
+
headers
|
|
17
|
+
});
|
|
18
|
+
if (!authResult.user) {
|
|
19
|
+
return {
|
|
20
|
+
message: 'User already logged out',
|
|
21
|
+
success: true
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const {
|
|
25
|
+
user
|
|
26
|
+
} = authResult;
|
|
27
|
+
const req = await createLocalReq({
|
|
28
|
+
user
|
|
29
|
+
}, payload);
|
|
30
|
+
const collection = payload.collections[user.collection];
|
|
31
|
+
const logoutResult = await logoutOperation({
|
|
32
|
+
allSessions,
|
|
33
|
+
collection,
|
|
34
|
+
req
|
|
35
|
+
});
|
|
36
|
+
if (!logoutResult) {
|
|
41
37
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
message: 'Logout failed',
|
|
39
|
+
success: false
|
|
44
40
|
};
|
|
41
|
+
}
|
|
42
|
+
const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix);
|
|
43
|
+
if (existingCookie) {
|
|
44
|
+
const cookies = await getCookies();
|
|
45
|
+
cookies.delete(existingCookie.name);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
message: 'User logged out successfully',
|
|
49
|
+
success: true
|
|
50
|
+
};
|
|
45
51
|
}
|
|
46
|
-
|
|
47
52
|
//# sourceMappingURL=logout.js.map
|
package/dist/auth/logout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/logout.ts"],"sourcesContent":["'use server'\n\nimport type { SanitizedConfig } from 'payload'\n\nimport { cookies as getCookies, headers as nextHeaders } from 'next/headers.js'\nimport { createLocalReq, getPayload, logoutOperation } from 'payload'\n\nimport { getExistingAuthToken } from '../utilities/getExistingAuthToken.js'\n\nexport async function logout({\n allSessions = false,\n config,\n}: {\n allSessions?: boolean\n config: Promise<SanitizedConfig> | SanitizedConfig\n}) {\n const payload = await getPayload({ config, cron: true })\n const headers = await nextHeaders()\n const authResult = await payload.auth({ headers })\n\n if (!authResult.user) {\n return { message: 'User already logged out', success: true }\n }\n\n const { user } = authResult\n const req = await createLocalReq({ user }, payload)\n const collection = payload.collections[user.collection]\n\n const logoutResult = await logoutOperation({\n allSessions,\n collection,\n req,\n })\n\n if (!logoutResult) {\n return { message: 'Logout failed', success: false }\n }\n\n const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix)\n if (existingCookie) {\n const cookies = await getCookies()\n cookies.delete(existingCookie.name)\n }\n\n return { message: 'User logged out successfully', success: true }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"logout.js","names":["cookies","getCookies","headers","nextHeaders","createLocalReq","getPayload","logoutOperation","getExistingAuthToken","logout","allSessions","config","payload","cron","authResult","auth","user","message","success","req","collection","collections","logoutResult","existingCookie","cookiePrefix","delete","name"],"sources":["../../src/auth/logout.ts"],"sourcesContent":["'use server'\n\nimport type { SanitizedConfig } from 'payload'\n\nimport { cookies as getCookies, headers as nextHeaders } from 'next/headers.js'\nimport { createLocalReq, getPayload, logoutOperation } from 'payload'\n\nimport { getExistingAuthToken } from '../utilities/getExistingAuthToken.js'\n\nexport async function logout({\n allSessions = false,\n config,\n}: {\n allSessions?: boolean\n config: Promise<SanitizedConfig> | SanitizedConfig\n}) {\n const payload = await getPayload({ config, cron: true })\n const headers = await nextHeaders()\n const authResult = await payload.auth({ headers })\n\n if (!authResult.user) {\n return { message: 'User already logged out', success: true }\n }\n\n const { user } = authResult\n const req = await createLocalReq({ user }, payload)\n const collection = payload.collections[user.collection]\n\n const logoutResult = await logoutOperation({\n allSessions,\n collection,\n req,\n })\n\n if (!logoutResult) {\n return { message: 'Logout failed', success: false }\n }\n\n const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix)\n if (existingCookie) {\n const cookies = await getCookies()\n cookies.delete(existingCookie.name)\n }\n\n return { message: 'User logged out successfully', success: true }\n}\n"],"mappings":"AAAA;;AAIA,SAASA,OAAA,IAAWC,UAAU,EAAEC,OAAA,IAAWC,WAAW,QAAQ;AAC9D,SAASC,cAAc,EAAEC,UAAU,EAAEC,eAAe,QAAQ;AAE5D,SAASC,oBAAoB,QAAQ;AAErC,OAAO,eAAeC,OAAO;EAC3BC,WAAA,GAAc,KAAK;EACnBC;AAAM,CAIP;EACC,MAAMC,OAAA,GAAU,MAAMN,UAAA,CAAW;IAAEK,MAAA;IAAQE,IAAA,EAAM;EAAK;EACtD,MAAMV,OAAA,GAAU,MAAMC,WAAA;EACtB,MAAMU,UAAA,GAAa,MAAMF,OAAA,CAAQG,IAAI,CAAC;IAAEZ;EAAQ;EAEhD,IAAI,CAACW,UAAA,CAAWE,IAAI,EAAE;IACpB,OAAO;MAAEC,OAAA,EAAS;MAA2BC,OAAA,EAAS;IAAK;EAC7D;EAEA,MAAM;IAAEF;EAAI,CAAE,GAAGF,UAAA;EACjB,MAAMK,GAAA,GAAM,MAAMd,cAAA,CAAe;IAAEW;EAAK,GAAGJ,OAAA;EAC3C,MAAMQ,UAAA,GAAaR,OAAA,CAAQS,WAAW,CAACL,IAAA,CAAKI,UAAU,CAAC;EAEvD,MAAME,YAAA,GAAe,MAAMf,eAAA,CAAgB;IACzCG,WAAA;IACAU,UAAA;IACAD;EACF;EAEA,IAAI,CAACG,YAAA,EAAc;IACjB,OAAO;MAAEL,OAAA,EAAS;MAAiBC,OAAA,EAAS;IAAM;EACpD;EAEA,MAAMK,cAAA,GAAiB,MAAMf,oBAAA,CAAqBI,OAAA,CAAQD,MAAM,CAACa,YAAY;EAC7E,IAAID,cAAA,EAAgB;IAClB,MAAMtB,OAAA,GAAU,MAAMC,UAAA;IACtBD,OAAA,CAAQwB,MAAM,CAACF,cAAA,CAAeG,IAAI;EACpC;EAEA,OAAO;IAAET,OAAA,EAAS;IAAgCC,OAAA,EAAS;EAAK;AAClE","ignoreList":[]}
|
package/dist/auth/refresh.js
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
1
|
'use server';
|
|
2
|
+
|
|
2
3
|
import { headers as nextHeaders } from 'next/headers.js';
|
|
3
4
|
import { createLocalReq, getPayload, refreshOperation } from 'payload';
|
|
4
5
|
import { getExistingAuthToken } from '../utilities/getExistingAuthToken.js';
|
|
5
6
|
import { setPayloadAuthCookie } from '../utilities/setPayloadAuthCookie.js';
|
|
6
|
-
export async function refresh({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
success: false
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
await setPayloadAuthCookie({
|
|
44
|
-
authConfig: collectionConfig.config.auth,
|
|
45
|
-
cookiePrefix: payload.config.cookiePrefix,
|
|
46
|
-
token: refreshResult.refreshedToken
|
|
47
|
-
});
|
|
7
|
+
export async function refresh({
|
|
8
|
+
config
|
|
9
|
+
}) {
|
|
10
|
+
const payload = await getPayload({
|
|
11
|
+
config,
|
|
12
|
+
cron: true
|
|
13
|
+
});
|
|
14
|
+
const headers = await nextHeaders();
|
|
15
|
+
const result = await payload.auth({
|
|
16
|
+
headers
|
|
17
|
+
});
|
|
18
|
+
if (!result.user) {
|
|
19
|
+
throw new Error('Cannot refresh token: user not authenticated');
|
|
20
|
+
}
|
|
21
|
+
const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix);
|
|
22
|
+
if (!existingCookie) {
|
|
23
|
+
return {
|
|
24
|
+
message: 'No valid token found to refresh',
|
|
25
|
+
success: false
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const collection = result.user.collection;
|
|
29
|
+
const collectionConfig = payload.collections[collection];
|
|
30
|
+
if (!collectionConfig?.config.auth) {
|
|
31
|
+
throw new Error(`No auth config found for collection: ${collection}`);
|
|
32
|
+
}
|
|
33
|
+
const req = await createLocalReq({
|
|
34
|
+
user: result.user
|
|
35
|
+
}, payload);
|
|
36
|
+
const refreshResult = await refreshOperation({
|
|
37
|
+
collection: collectionConfig,
|
|
38
|
+
req
|
|
39
|
+
});
|
|
40
|
+
if (!refreshResult) {
|
|
48
41
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
message: 'Token refresh failed',
|
|
43
|
+
success: false
|
|
51
44
|
};
|
|
45
|
+
}
|
|
46
|
+
await setPayloadAuthCookie({
|
|
47
|
+
authConfig: collectionConfig.config.auth,
|
|
48
|
+
cookiePrefix: payload.config.cookiePrefix,
|
|
49
|
+
token: refreshResult.refreshedToken
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
message: 'Token refreshed successfully',
|
|
53
|
+
success: true
|
|
54
|
+
};
|
|
52
55
|
}
|
|
53
|
-
|
|
54
56
|
//# sourceMappingURL=refresh.js.map
|
package/dist/auth/refresh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/auth/refresh.ts"],"sourcesContent":["'use server'\n\nimport type { CollectionSlug } from 'payload'\n\nimport { headers as nextHeaders } from 'next/headers.js'\nimport { createLocalReq, getPayload, refreshOperation } from 'payload'\n\nimport { getExistingAuthToken } from '../utilities/getExistingAuthToken.js'\nimport { setPayloadAuthCookie } from '../utilities/setPayloadAuthCookie.js'\n\nexport async function refresh({ config }: { config: any }) {\n const payload = await getPayload({ config, cron: true })\n const headers = await nextHeaders()\n const result = await payload.auth({ headers })\n\n if (!result.user) {\n throw new Error('Cannot refresh token: user not authenticated')\n }\n\n const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix)\n if (!existingCookie) {\n return { message: 'No valid token found to refresh', success: false }\n }\n\n const collection: CollectionSlug | undefined = result.user.collection\n const collectionConfig = payload.collections[collection]\n\n if (!collectionConfig?.config.auth) {\n throw new Error(`No auth config found for collection: ${collection}`)\n }\n\n const req = await createLocalReq({ user: result.user }, payload)\n\n const refreshResult = await refreshOperation({\n collection: collectionConfig,\n req,\n })\n\n if (!refreshResult) {\n return { message: 'Token refresh failed', success: false }\n }\n\n await setPayloadAuthCookie({\n authConfig: collectionConfig.config.auth,\n cookiePrefix: payload.config.cookiePrefix,\n token: refreshResult.refreshedToken,\n })\n\n return { message: 'Token refreshed successfully', success: true }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"refresh.js","names":["headers","nextHeaders","createLocalReq","getPayload","refreshOperation","getExistingAuthToken","setPayloadAuthCookie","refresh","config","payload","cron","result","auth","user","Error","existingCookie","cookiePrefix","message","success","collection","collectionConfig","collections","req","refreshResult","authConfig","token","refreshedToken"],"sources":["../../src/auth/refresh.ts"],"sourcesContent":["'use server'\n\nimport type { CollectionSlug } from 'payload'\n\nimport { headers as nextHeaders } from 'next/headers.js'\nimport { createLocalReq, getPayload, refreshOperation } from 'payload'\n\nimport { getExistingAuthToken } from '../utilities/getExistingAuthToken.js'\nimport { setPayloadAuthCookie } from '../utilities/setPayloadAuthCookie.js'\n\nexport async function refresh({ config }: { config: any }) {\n const payload = await getPayload({ config, cron: true })\n const headers = await nextHeaders()\n const result = await payload.auth({ headers })\n\n if (!result.user) {\n throw new Error('Cannot refresh token: user not authenticated')\n }\n\n const existingCookie = await getExistingAuthToken(payload.config.cookiePrefix)\n if (!existingCookie) {\n return { message: 'No valid token found to refresh', success: false }\n }\n\n const collection: CollectionSlug | undefined = result.user.collection\n const collectionConfig = payload.collections[collection]\n\n if (!collectionConfig?.config.auth) {\n throw new Error(`No auth config found for collection: ${collection}`)\n }\n\n const req = await createLocalReq({ user: result.user }, payload)\n\n const refreshResult = await refreshOperation({\n collection: collectionConfig,\n req,\n })\n\n if (!refreshResult) {\n return { message: 'Token refresh failed', success: false }\n }\n\n await setPayloadAuthCookie({\n authConfig: collectionConfig.config.auth,\n cookiePrefix: payload.config.cookiePrefix,\n token: refreshResult.refreshedToken,\n })\n\n return { message: 'Token refreshed successfully', success: true }\n}\n"],"mappings":"AAAA;;AAIA,SAASA,OAAA,IAAWC,WAAW,QAAQ;AACvC,SAASC,cAAc,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ;AAE7D,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,eAAeC,QAAQ;EAAEC;AAAM,CAAmB;EACvD,MAAMC,OAAA,GAAU,MAAMN,UAAA,CAAW;IAAEK,MAAA;IAAQE,IAAA,EAAM;EAAK;EACtD,MAAMV,OAAA,GAAU,MAAMC,WAAA;EACtB,MAAMU,MAAA,GAAS,MAAMF,OAAA,CAAQG,IAAI,CAAC;IAAEZ;EAAQ;EAE5C,IAAI,CAACW,MAAA,CAAOE,IAAI,EAAE;IAChB,MAAM,IAAIC,KAAA,CAAM;EAClB;EAEA,MAAMC,cAAA,GAAiB,MAAMV,oBAAA,CAAqBI,OAAA,CAAQD,MAAM,CAACQ,YAAY;EAC7E,IAAI,CAACD,cAAA,EAAgB;IACnB,OAAO;MAAEE,OAAA,EAAS;MAAmCC,OAAA,EAAS;IAAM;EACtE;EAEA,MAAMC,UAAA,GAAyCR,MAAA,CAAOE,IAAI,CAACM,UAAU;EACrE,MAAMC,gBAAA,GAAmBX,OAAA,CAAQY,WAAW,CAACF,UAAA,CAAW;EAExD,IAAI,CAACC,gBAAA,EAAkBZ,MAAA,CAAOI,IAAA,EAAM;IAClC,MAAM,IAAIE,KAAA,CAAM,wCAAwCK,UAAA,EAAY;EACtE;EAEA,MAAMG,GAAA,GAAM,MAAMpB,cAAA,CAAe;IAAEW,IAAA,EAAMF,MAAA,CAAOE;EAAK,GAAGJ,OAAA;EAExD,MAAMc,aAAA,GAAgB,MAAMnB,gBAAA,CAAiB;IAC3Ce,UAAA,EAAYC,gBAAA;IACZE;EACF;EAEA,IAAI,CAACC,aAAA,EAAe;IAClB,OAAO;MAAEN,OAAA,EAAS;MAAwBC,OAAA,EAAS;IAAM;EAC3D;EAEA,MAAMZ,oBAAA,CAAqB;IACzBkB,UAAA,EAAYJ,gBAAA,CAAiBZ,MAAM,CAACI,IAAI;IACxCI,YAAA,EAAcP,OAAA,CAAQD,MAAM,CAACQ,YAAY;IACzCS,KAAA,EAAOF,aAAA,CAAcG;EACvB;EAEA,OAAO;IAAET,OAAA,EAAS;IAAgCC,OAAA,EAAS;EAAK;AAClE","ignoreList":[]}
|
package/dist/cjs/withPayload.cjs
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @param {import('next').NextConfig} nextConfig
|
|
3
|
-
* @param {Object} [options] - Optional configuration options
|
|
4
|
-
* @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false
|
|
5
|
-
*
|
|
6
|
-
* @returns {import('next').NextConfig}
|
|
7
|
-
* */ "use strict";
|
|
1
|
+
/* eslint-disable no-console */ /* eslint-disable no-restricted-exports */ "use strict";
|
|
8
2
|
Object.defineProperty(exports, "__esModule", {
|
|
9
3
|
value: true
|
|
10
4
|
});
|
|
@@ -22,53 +16,23 @@ _export(exports, {
|
|
|
22
16
|
return withPayload;
|
|
23
17
|
}
|
|
24
18
|
});
|
|
19
|
+
const _withPayloadutils = require("./withPayload.utils.js");
|
|
20
|
+
const _withPayloadLegacy = require("./withPayloadLegacy.js");
|
|
21
|
+
const poweredByHeader = {
|
|
22
|
+
key: 'X-Powered-By',
|
|
23
|
+
value: 'Next.js, Payload'
|
|
24
|
+
};
|
|
25
25
|
const withPayload = (nextConfig = {}, options = {})=>{
|
|
26
|
+
const nextjsVersion = (0, _withPayloadutils.getNextjsVersion)();
|
|
27
|
+
const supportsTurbopackBuild = (0, _withPayloadutils.supportsTurbopackExternalizeTransitiveDependencies)(nextjsVersion);
|
|
26
28
|
const env = nextConfig.env || {};
|
|
27
29
|
if (nextConfig.experimental?.staleTimes?.dynamic) {
|
|
28
30
|
console.warn('Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.');
|
|
29
31
|
env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true';
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
// TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.
|
|
33
|
-
// We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991
|
|
34
|
-
const turbopackWarningText = 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\nTry to install it into the project directory by running';
|
|
35
|
-
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
|
|
36
|
-
const turbopackConfigWarningText = "Unrecognized key(s) in object: 'turbopack'";
|
|
37
|
-
const consoleWarn = console.warn;
|
|
38
|
-
console.warn = (...args)=>{
|
|
39
|
-
// Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805
|
|
40
|
-
if (typeof args[1] === 'string' && args[1].includes(turbopackWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackWarningText)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
// Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.
|
|
44
|
-
// TODO 4.0: Remove this once we drop support for Next.js 15.2.x
|
|
45
|
-
const hasTurbopackConfigWarning = typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText) || typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText);
|
|
46
|
-
if (hasTurbopackConfigWarning) {
|
|
47
|
-
consoleWarn(...args);
|
|
48
|
-
consoleWarn('Payload: You can safely ignore the "Invalid next.config" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.');
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
consoleWarn(...args);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
const isBuild = process.env.NODE_ENV === 'production';
|
|
55
|
-
const isTurbopackNextjs15 = process.env.TURBOPACK === '1';
|
|
56
|
-
const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto';
|
|
57
|
-
if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {
|
|
58
|
-
throw new Error('Payload does not support using Turbopack for production builds. If you are using Next.js 16, please use `next build --webpack` instead.');
|
|
59
|
-
}
|
|
60
|
-
const poweredByHeader = {
|
|
61
|
-
key: 'X-Powered-By',
|
|
62
|
-
value: 'Next.js, Payload'
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* @type {import('next').NextConfig}
|
|
66
|
-
*/ const toReturn = {
|
|
33
|
+
const baseConfig = {
|
|
67
34
|
...nextConfig,
|
|
68
35
|
env,
|
|
69
|
-
turbopack: {
|
|
70
|
-
...nextConfig.turbopack || {}
|
|
71
|
-
},
|
|
72
36
|
outputFileTracingExcludes: {
|
|
73
37
|
...nextConfig.outputFileTracingExcludes || {},
|
|
74
38
|
'**/*': [
|
|
@@ -84,6 +48,9 @@ const withPayload = (nextConfig = {}, options = {})=>{
|
|
|
84
48
|
'@libsql/client'
|
|
85
49
|
]
|
|
86
50
|
},
|
|
51
|
+
turbopack: {
|
|
52
|
+
...nextConfig.turbopack || {}
|
|
53
|
+
},
|
|
87
54
|
// We disable the poweredByHeader here because we add it manually in the headers function below
|
|
88
55
|
...nextConfig.poweredByHeader !== false ? {
|
|
89
56
|
poweredByHeader: false
|
|
@@ -93,7 +60,6 @@ const withPayload = (nextConfig = {}, options = {})=>{
|
|
|
93
60
|
return [
|
|
94
61
|
...headersFromConfig || [],
|
|
95
62
|
{
|
|
96
|
-
source: '/:path*',
|
|
97
63
|
headers: [
|
|
98
64
|
{
|
|
99
65
|
key: 'Accept-CH',
|
|
@@ -110,21 +76,15 @@ const withPayload = (nextConfig = {}, options = {})=>{
|
|
|
110
76
|
...nextConfig.poweredByHeader !== false ? [
|
|
111
77
|
poweredByHeader
|
|
112
78
|
] : []
|
|
113
|
-
]
|
|
79
|
+
],
|
|
80
|
+
source: '/:path*'
|
|
114
81
|
}
|
|
115
82
|
];
|
|
116
83
|
},
|
|
117
84
|
serverExternalPackages: [
|
|
118
|
-
// serverExternalPackages = webpack.externals, but with turbopack support and an additional check
|
|
119
|
-
// for whether the package is resolvable from the project root
|
|
120
|
-
...nextConfig.serverExternalPackages || [],
|
|
121
|
-
// Can be externalized, because we require users to install graphql themselves - we only rely on it as a peer dependency => resolvable from the project root.
|
|
122
|
-
//
|
|
123
85
|
// WHY: without externalizing graphql, a graphql version error will be thrown
|
|
124
86
|
// during runtime ("Ensure that there is only one instance of \"graphql\" in the node_modules\ndirectory.")
|
|
125
87
|
'graphql',
|
|
126
|
-
// External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.
|
|
127
|
-
'@sentry/nextjs',
|
|
128
88
|
...process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true ? /**
|
|
129
89
|
* Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we
|
|
130
90
|
* do not bundle server-only packages during dev for two reasons:
|
|
@@ -188,6 +148,13 @@ const withPayload = (nextConfig = {}, options = {})=>{
|
|
|
188
148
|
'libsql',
|
|
189
149
|
'require-in-the-middle'
|
|
190
150
|
],
|
|
151
|
+
plugins: [
|
|
152
|
+
...incomingWebpackConfig?.plugins || [],
|
|
153
|
+
// Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
|
|
154
|
+
new webpackOptions.webpack.IgnorePlugin({
|
|
155
|
+
resourceRegExp: /^pg-native$|^cloudflare:sockets$/
|
|
156
|
+
})
|
|
157
|
+
],
|
|
191
158
|
resolve: {
|
|
192
159
|
...incomingWebpackConfig?.resolve || {},
|
|
193
160
|
alias: {
|
|
@@ -215,21 +182,30 @@ const withPayload = (nextConfig = {}, options = {})=>{
|
|
|
215
182
|
*
|
|
216
183
|
**/ aws4: false
|
|
217
184
|
}
|
|
218
|
-
}
|
|
219
|
-
plugins: [
|
|
220
|
-
...incomingWebpackConfig?.plugins || [],
|
|
221
|
-
// Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177
|
|
222
|
-
new webpackOptions.webpack.IgnorePlugin({
|
|
223
|
-
resourceRegExp: /^pg-native$|^cloudflare:sockets$/
|
|
224
|
-
})
|
|
225
|
-
]
|
|
185
|
+
}
|
|
226
186
|
};
|
|
227
187
|
}
|
|
228
188
|
};
|
|
229
189
|
if (nextConfig.basePath) {
|
|
230
|
-
|
|
190
|
+
baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath;
|
|
191
|
+
}
|
|
192
|
+
if (!supportsTurbopackBuild) {
|
|
193
|
+
return (0, _withPayloadLegacy.withPayloadLegacy)(baseConfig);
|
|
194
|
+
} else {
|
|
195
|
+
return {
|
|
196
|
+
...baseConfig,
|
|
197
|
+
serverExternalPackages: [
|
|
198
|
+
...baseConfig.serverExternalPackages || [],
|
|
199
|
+
'drizzle-kit',
|
|
200
|
+
'drizzle-kit/api',
|
|
201
|
+
'sharp',
|
|
202
|
+
'libsql',
|
|
203
|
+
'require-in-the-middle',
|
|
204
|
+
// Prevents turbopack build errors by the thread-stream package which is installed by pino
|
|
205
|
+
'pino'
|
|
206
|
+
]
|
|
207
|
+
};
|
|
231
208
|
}
|
|
232
|
-
return toReturn;
|
|
233
209
|
};
|
|
234
210
|
const _default = withPayload;
|
|
235
211
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/withPayload.js"],"names":["withPayload","nextConfig","options","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","process","PAYLOAD_PATCH_TURBOPACK_WARNINGS","turbopackWarningText","turbopackConfigWarningText","consoleWarn","args","includes","hasTurbopackConfigWarning","isBuild","NODE_ENV","isTurbopackNextjs15","TURBOPACK","isTurbopackNextjs16","Error","poweredByHeader","key","value","toReturn","turbopack","outputFileTracingExcludes","outputFileTracingIncludes","headers","headersFromConfig","source","serverExternalPackages","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","resolve","alias","fallback","aws4","plugins","IgnorePlugin","resourceRegExp","basePath","NEXT_BASE_PATH"],"mappings":"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","file":"withPayload.cjs","sourcesContent":["/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n *\n * @returns {import('next').NextConfig}\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (process.env.PAYLOAD_PATCH_TURBOPACK_WARNINGS !== 'false') {\n // TODO: This warning is thrown because we cannot externalize the entry-point package for client-s3, so we patch the warning to not show it.\n // We can remove this once Next.js implements https://github.com/vercel/next.js/discussions/76991\n const turbopackWarningText =\n 'Packages that should be external need to be installed in the project directory, so they can be resolved from the output files.\\nTry to install it into the project directory by running'\n\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const turbopackConfigWarningText = \"Unrecognized key(s) in object: 'turbopack'\"\n\n const consoleWarn = console.warn\n console.warn = (...args) => {\n // Force to disable serverExternalPackages warnings: https://github.com/vercel/next.js/issues/68805\n if (\n (typeof args[1] === 'string' && args[1].includes(turbopackWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackWarningText))\n ) {\n return\n }\n\n // Add Payload-specific message after turbopack config warning in Next.js 15.2.x or lower.\n // TODO 4.0: Remove this once we drop support for Next.js 15.2.x\n const hasTurbopackConfigWarning =\n (typeof args[1] === 'string' && args[1].includes(turbopackConfigWarningText)) ||\n (typeof args[0] === 'string' && args[0].includes(turbopackConfigWarningText))\n\n if (hasTurbopackConfigWarning) {\n consoleWarn(...args)\n consoleWarn(\n 'Payload: You can safely ignore the \"Invalid next.config\" warning above. This only occurs on Next.js 15.2.x or lower. We recommend upgrading to Next.js 15.4.7 to resolve this warning.',\n )\n return\n }\n\n consoleWarn(...args)\n }\n }\n\n const isBuild = process.env.NODE_ENV === 'production'\n const isTurbopackNextjs15 = process.env.TURBOPACK === '1'\n const isTurbopackNextjs16 = process.env.TURBOPACK === 'auto'\n\n if (isBuild && (isTurbopackNextjs15 || isTurbopackNextjs16)) {\n throw new Error(\n 'Payload does not support using Turbopack for production builds. If you are using Next.js 16, please use `next build --webpack` instead.',\n )\n }\n\n const poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n }\n\n /**\n * @type {import('next').NextConfig}\n */\n const toReturn = {\n ...nextConfig,\n env,\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n source: '/:path*',\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n },\n ]\n },\n serverExternalPackages: [\n // serverExternalPackages = webpack.externals, but with turbopack support and an additional check\n // for whether the package is resolvable from the project root\n ...(nextConfig.serverExternalPackages || []),\n // Can be externalized, because we require users to install graphql themselves - we only rely on it as a peer dependency => resolvable from the project root.\n //\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n // External, because it installs import-in-the-middle and require-in-the-middle - both in the default serverExternalPackages list.\n '@sentry/nextjs',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n }\n },\n }\n\n if (nextConfig.basePath) {\n toReturn.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n return toReturn\n}\n\nexport default withPayload\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/withPayload.ts"],"names":["withPayload","poweredByHeader","key","value","nextConfig","options","nextjsVersion","getNextjsVersion","supportsTurbopackBuild","supportsTurbopackExternalizeTransitiveDependencies","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","baseConfig","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH","withPayloadLegacy"],"mappings":"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","file":"withPayload.cjs","sourcesContent":["/* eslint-disable no-console */\n/* eslint-disable no-restricted-exports */\nimport type { NextConfig } from 'next'\n\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (\n nextConfig: NextConfig = {},\n options: { devBundleServerPackages?: boolean } = {},\n): NextConfig => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const baseConfig: NextConfig = {\n ...nextConfig,\n env,\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"]}
|
package/dist/config.js
CHANGED