@payloadcms/next 3.0.0-beta.90 → 3.0.0-beta.92
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/cjs/withPayload.js +111 -0
- package/dist/cjs/withPayload.js.map +1 -0
- 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 +100 -35
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +74 -63
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +31 -35
- package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +15 -12
- package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +86 -79
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +32 -13
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +60 -52
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.js +24 -23
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/EmailAndUsername/index.js +107 -75
- package/dist/elements/EmailAndUsername/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.js +150 -83
- package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +119 -101
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
- package/dist/elements/Logo/index.js +36 -21
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/NavHamburger/index.js +41 -13
- package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +48 -16
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/index.client.js +149 -76
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.js +56 -50
- package/dist/elements/Nav/index.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/templates.js +0 -1
- package/dist/exports/templates.js.map +1 -1
- package/dist/exports/utilities.js +0 -1
- 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/fetchAPI-multipart/fileFactory.js +35 -34
- package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
- package/dist/fetchAPI-multipart/handlers.js +77 -78
- package/dist/fetchAPI-multipart/handlers.js.map +1 -1
- package/dist/fetchAPI-multipart/index.js +33 -31
- package/dist/fetchAPI-multipart/index.js.map +1 -1
- package/dist/fetchAPI-multipart/isEligibleRequest.js +13 -21
- package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.js +158 -141
- package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
- package/dist/fetchAPI-multipart/processNested.js +23 -21
- package/dist/fetchAPI-multipart/processNested.js.map +1 -1
- package/dist/fetchAPI-multipart/uploadTimer.js +16 -17
- package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
- package/dist/fetchAPI-multipart/utilities.js +166 -166
- package/dist/fetchAPI-multipart/utilities.js.map +1 -1
- package/dist/fetchAPI-stream-file/index.js +19 -17
- package/dist/fetchAPI-stream-file/index.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layouts/Root/index.js +118 -115
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.js +109 -103
- 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/auth/access.js +22 -21
- package/dist/routes/rest/auth/access.js.map +1 -1
- package/dist/routes/rest/auth/forgotPassword.js +29 -25
- package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
- package/dist/routes/rest/auth/init.js +16 -14
- package/dist/routes/rest/auth/init.js.map +1 -1
- package/dist/routes/rest/auth/login.js +43 -38
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/logout.js +31 -27
- package/dist/routes/rest/auth/logout.js.map +1 -1
- package/dist/routes/rest/auth/me.js +23 -21
- package/dist/routes/rest/auth/me.js.map +1 -1
- package/dist/routes/rest/auth/refresh.js +31 -27
- package/dist/routes/rest/auth/refresh.js.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.js +43 -38
- package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
- package/dist/routes/rest/auth/resetPassword.js +38 -33
- package/dist/routes/rest/auth/resetPassword.js.map +1 -1
- package/dist/routes/rest/auth/unlock.js +27 -23
- package/dist/routes/rest/auth/unlock.js.map +1 -1
- package/dist/routes/rest/auth/verifyEmail.js +22 -17
- package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
- package/dist/routes/rest/buildFormState.js +38 -37
- package/dist/routes/rest/buildFormState.js.map +1 -1
- package/dist/routes/rest/checkEndpoints.js +11 -9
- package/dist/routes/rest/checkEndpoints.js.map +1 -1
- package/dist/routes/rest/collections/count.js +15 -11
- package/dist/routes/rest/collections/count.js.map +1 -1
- package/dist/routes/rest/collections/create.js +30 -26
- package/dist/routes/rest/collections/create.js.map +1 -1
- package/dist/routes/rest/collections/delete.js +40 -35
- package/dist/routes/rest/collections/delete.js.map +1 -1
- package/dist/routes/rest/collections/deleteByID.js +36 -31
- package/dist/routes/rest/collections/deleteByID.js.map +1 -1
- package/dist/routes/rest/collections/docAccess.js +17 -14
- package/dist/routes/rest/collections/docAccess.js.map +1 -1
- package/dist/routes/rest/collections/duplicate.js +36 -31
- package/dist/routes/rest/collections/duplicate.js.map +1 -1
- package/dist/routes/rest/collections/find.js +29 -20
- package/dist/routes/rest/collections/find.js.map +1 -1
- package/dist/routes/rest/collections/findByID.js +28 -23
- package/dist/routes/rest/collections/findByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersionByID.js +27 -22
- package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersions.js +27 -19
- package/dist/routes/rest/collections/findVersions.js.map +1 -1
- package/dist/routes/rest/collections/preview.js +39 -34
- package/dist/routes/rest/collections/preview.js.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.js +32 -27
- package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
- package/dist/routes/rest/collections/update.js +43 -37
- package/dist/routes/rest/collections/update.js.map +1 -1
- package/dist/routes/rest/collections/updateByID.js +38 -33
- package/dist/routes/rest/collections/updateByID.js.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.js +46 -44
- package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
- package/dist/routes/rest/files/getFile.js +52 -49
- package/dist/routes/rest/files/getFile.js.map +1 -1
- package/dist/routes/rest/files/getFileTypeFallback.js +16 -17
- package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -1
- package/dist/routes/rest/globals/docAccess.js +15 -13
- package/dist/routes/rest/globals/docAccess.js.map +1 -1
- package/dist/routes/rest/globals/findOne.js +22 -18
- package/dist/routes/rest/globals/findOne.js.map +1 -1
- package/dist/routes/rest/globals/findVersionByID.js +22 -17
- package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
- package/dist/routes/rest/globals/findVersions.js +27 -19
- package/dist/routes/rest/globals/findVersions.js.map +1 -1
- package/dist/routes/rest/globals/preview.js +38 -34
- package/dist/routes/rest/globals/preview.js.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.js +27 -22
- package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
- package/dist/routes/rest/globals/update.js +32 -28
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/routes/rest/index.js +651 -626
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.js +74 -76
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +60 -59
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/routeError.js +102 -95
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/routes/rest/types.js +1 -2
- package/dist/routes/rest/types.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.js +14 -11
- package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
- package/dist/scss/app.scss +4 -4
- package/dist/scss/type.scss +4 -4
- package/dist/templates/Default/NavHamburger/index.js +18 -6
- package/dist/templates/Default/NavHamburger/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +42 -13
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.js +54 -47
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Minimal/index.js +16 -16
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +40 -35
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.js +44 -36
- package/dist/utilities/addLocalesToRequest.js.map +1 -1
- package/dist/utilities/createPayloadRequest.js +85 -74
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +13 -11
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.d.ts +1 -1
- package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
- package/dist/utilities/getPayloadHMR.js +91 -94
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getRequestLanguage.js +16 -13
- package/dist/utilities/getRequestLanguage.js.map +1 -1
- package/dist/utilities/getRequestLocales.js +27 -24
- package/dist/utilities/getRequestLocales.js.map +1 -1
- package/dist/utilities/getRequestTheme.js +16 -16
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/headersWithCors.js +21 -30
- package/dist/utilities/headersWithCors.js.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.js +46 -42
- package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +45 -32
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/initPage/index.js +146 -120
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initPage/shared.js +26 -25
- package/dist/utilities/initPage/shared.js.map +1 -1
- package/dist/utilities/initPage/types.js +1 -2
- package/dist/utilities/initPage/types.js.map +1 -1
- package/dist/utilities/mergeHeaders.js +8 -9
- package/dist/utilities/mergeHeaders.js.map +1 -1
- package/dist/utilities/meta.js +66 -68
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/timestamp.js +4 -5
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +38 -11
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.js +124 -112
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/index.client.js +190 -202
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.js +2 -3
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/API/meta.js +22 -18
- package/dist/views/API/meta.js.map +1 -1
- package/dist/views/Account/Settings/LanguageSelector.js +45 -12
- package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
- package/dist/views/Account/Settings/index.js +21 -28
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +51 -30
- 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 +99 -68
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/Account/meta.js +12 -8
- package/dist/views/Account/meta.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +95 -57
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.js +42 -28
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/meta.js +12 -8
- package/dist/views/CreateFirstUser/meta.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +132 -115
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +61 -52
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Dashboard/meta.js +16 -12
- package/dist/views/Dashboard/meta.js.map +1 -1
- package/dist/views/Document/getCustomViewByKey.js +2 -3
- package/dist/views/Document/getCustomViewByKey.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/getDocumentData.js +34 -28
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +83 -74
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +113 -107
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js +309 -331
- package/dist/views/Document/getViewsFromConfig.js.map +1 -1
- package/dist/views/Document/index.d.ts.map +1 -1
- package/dist/views/Document/index.js +193 -159
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Document/meta.js +1 -2
- package/dist/views/Document/meta.js.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js +118 -132
- package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Default/Auth/index.js +293 -196
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.js +1 -2
- package/dist/views/Edit/Default/Auth/types.js.map +1 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js +121 -70
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/Default/SetDocumentTitle/index.js +74 -29
- package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +1 -1
- package/dist/views/Edit/Default/index.js +190 -187
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/Edit/Default/types.js +1 -2
- package/dist/views/Edit/Default/types.js.map +1 -1
- package/dist/views/Edit/index.client.js +45 -21
- package/dist/views/Edit/index.client.js.map +1 -1
- package/dist/views/Edit/index.js +2 -3
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/Edit/meta.js +43 -35
- package/dist/views/Edit/meta.js.map +1 -1
- package/dist/views/Edit/sanitizeEditViewProps.js +8 -9
- package/dist/views/Edit/sanitizeEditViewProps.js.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -94
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +59 -46
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/ForgotPassword/meta.js +12 -8
- package/dist/views/ForgotPassword/meta.js.map +1 -1
- package/dist/views/List/Default/index.js +348 -208
- package/dist/views/List/Default/index.js.map +1 -1
- package/dist/views/List/Default/types.js +1 -2
- package/dist/views/List/Default/types.js.map +1 -1
- package/dist/views/List/index.js +153 -137
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/List/meta.js +20 -17
- package/dist/views/List/meta.js.map +1 -1
- package/dist/views/LivePreview/Context/collisionDetection.js +24 -21
- package/dist/views/LivePreview/Context/collisionDetection.js.map +1 -1
- package/dist/views/LivePreview/Context/context.d.ts +2 -1
- package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
- package/dist/views/LivePreview/Context/context.js +39 -36
- package/dist/views/LivePreview/Context/context.js.map +1 -1
- package/dist/views/LivePreview/Context/index.js +134 -142
- package/dist/views/LivePreview/Context/index.js.map +1 -1
- package/dist/views/LivePreview/Context/sizeReducer.js +18 -19
- package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
- package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Device/index.js +78 -71
- package/dist/views/LivePreview/Device/index.js.map +1 -1
- package/dist/views/LivePreview/DeviceContainer/index.js +47 -23
- package/dist/views/LivePreview/DeviceContainer/index.js.map +1 -1
- package/dist/views/LivePreview/IFrame/index.js +21 -16
- package/dist/views/LivePreview/IFrame/index.js.map +1 -1
- package/dist/views/LivePreview/Preview/index.js +145 -92
- package/dist/views/LivePreview/Preview/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/Controls/index.js +136 -115
- package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/SizeInput/index.js +89 -51
- package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/index.js +82 -50
- package/dist/views/LivePreview/Toolbar/index.js.map +1 -1
- package/dist/views/LivePreview/ToolbarArea/index.js +32 -10
- package/dist/views/LivePreview/ToolbarArea/index.js.map +1 -1
- package/dist/views/LivePreview/index.client.js +316 -160
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/LivePreview/index.js +67 -55
- package/dist/views/LivePreview/index.js.map +1 -1
- package/dist/views/LivePreview/meta.js +14 -9
- package/dist/views/LivePreview/meta.js.map +1 -1
- package/dist/views/LivePreview/usePopupWindow.js +91 -94
- package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
- package/dist/views/Login/LoginField/index.js +83 -39
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.js +130 -66
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.js +77 -54
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Login/meta.js +12 -8
- package/dist/views/Login/meta.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +84 -39
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.js +29 -16
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Logout/meta.js +11 -7
- package/dist/views/Logout/meta.js.map +1 -1
- package/dist/views/NotFound/index.client.js +78 -40
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.js +47 -37
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/meta.js +9 -7
- package/dist/views/NotFound/meta.js.map +1 -1
- package/dist/views/ResetPassword/index.client.js +97 -59
- package/dist/views/ResetPassword/index.client.js.map +1 -1
- package/dist/views/ResetPassword/index.js +68 -53
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/meta.js +12 -8
- package/dist/views/ResetPassword/meta.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/getCustomViewByRoute.js +42 -31
- package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +162 -156
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.js +99 -82
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +18 -13
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Root/meta.js +141 -136
- package/dist/views/Root/meta.js.map +1 -1
- package/dist/views/Unauthorized/index.js +32 -22
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/meta.js +12 -8
- package/dist/views/Unauthorized/meta.js.map +1 -1
- package/dist/views/Verify/index.js +58 -43
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/meta.js +12 -8
- package/dist/views/Verify/meta.js.map +1 -1
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +147 -103
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.js +198 -114
- 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/Label/index.js +6 -5
- package/dist/views/Version/RenderFieldsToDiff/Label/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +65 -69
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +34 -31
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +108 -78
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +17 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +40 -38
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -32
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +17 -11
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +34 -31
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +4 -5
- package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +20 -21
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +23 -24
- package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +102 -97
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/types.js +1 -2
- package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
- package/dist/views/Version/Restore/index.js +107 -110
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/types.js +1 -2
- package/dist/views/Version/Restore/types.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +130 -138
- 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 +58 -30
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Version/SelectLocales/types.js +1 -2
- package/dist/views/Version/SelectLocales/types.js.map +1 -1
- package/dist/views/Version/index.js +126 -105
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Version/meta.js +49 -43
- package/dist/views/Version/meta.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +87 -82
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/AutosaveCell/index.js +69 -42
- package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +70 -17
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/cells/ID/index.js +17 -5
- package/dist/views/Versions/cells/ID/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +33 -29
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/dist/views/Versions/index.client.js +80 -77
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.js +148 -127
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/meta.js +43 -37
- package/dist/views/Versions/meta.js.map +1 -1
- package/dist/views/Versions/types.js +1 -2
- package/dist/views/Versions/types.js.map +1 -1
- package/dist/withPayload.js +83 -117
- package/dist/withPayload.js.map +1 -1
- package/package.json +20 -10
- package/dist/cjs/withPayload.cjs +0 -145
- package/dist/cjs/withPayload.cjs.map +0 -1
|
@@ -4,36 +4,41 @@ import { duplicateOperation } from 'payload';
|
|
|
4
4
|
import { isNumber } from 'payload/shared';
|
|
5
5
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
6
6
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
7
|
-
export const duplicate = async ({
|
|
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
|
-
|
|
7
|
+
export const duplicate = async ({
|
|
8
|
+
id: incomingID,
|
|
9
|
+
collection,
|
|
10
|
+
req
|
|
11
|
+
}) => {
|
|
12
|
+
const {
|
|
13
|
+
searchParams
|
|
14
|
+
} = req;
|
|
15
|
+
const depth = searchParams.get('depth');
|
|
16
|
+
// draft defaults to true, unless explicitly set requested as false to prevent the newly duplicated document from being published
|
|
17
|
+
const draft = searchParams.get('draft') !== 'false';
|
|
18
|
+
const id = sanitizeCollectionID({
|
|
19
|
+
id: incomingID,
|
|
20
|
+
collectionSlug: collection.config.slug,
|
|
21
|
+
payload: req.payload
|
|
22
|
+
});
|
|
23
|
+
const doc = await duplicateOperation({
|
|
24
|
+
id,
|
|
25
|
+
collection,
|
|
26
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
27
|
+
draft,
|
|
28
|
+
req
|
|
29
|
+
});
|
|
30
|
+
const message = req.t('general:successfullyDuplicated', {
|
|
31
|
+
label: getTranslation(collection.config.labels.singular, req.i18n)
|
|
32
|
+
});
|
|
33
|
+
return Response.json({
|
|
34
|
+
doc,
|
|
35
|
+
message
|
|
36
|
+
}, {
|
|
37
|
+
headers: headersWithCors({
|
|
38
|
+
headers: new Headers(),
|
|
39
|
+
req
|
|
40
|
+
}),
|
|
41
|
+
status: httpStatus.OK
|
|
42
|
+
});
|
|
37
43
|
};
|
|
38
|
-
|
|
39
44
|
//# sourceMappingURL=duplicate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/duplicate.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { duplicateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const duplicate: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n // draft defaults to true, unless explicitly set requested as false to prevent the newly duplicated document from being published\n const draft = searchParams.get('draft') !== 'false'\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await duplicateOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n req,\n })\n\n const message = req.t('general:successfullyDuplicated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n })\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"duplicate.js","names":["getTranslation","httpStatus","duplicateOperation","isNumber","headersWithCors","sanitizeCollectionID","duplicate","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","doc","Number","undefined","message","t","label","labels","singular","i18n","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/duplicate.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { duplicateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const duplicate: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n // draft defaults to true, unless explicitly set requested as false to prevent the newly duplicated document from being published\n const draft = searchParams.get('draft') !== 'false'\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await duplicateOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n req,\n })\n\n const message = req.t('general:successfullyDuplicated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n })\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,kBAAkB,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,SAAA,GAA0C,MAAAA,CAAO;EAC5DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B;EACA,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAE5C,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMjB,kBAAA,CAAmB;IACnCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA;IACAJ;EACF;EAEA,MAAMY,OAAA,GAAUZ,GAAA,CAAIa,CAAC,CAAC,kCAAkC;IACtDC,KAAA,EAAOxB,cAAA,CAAeS,UAAA,CAAWO,MAAM,CAACS,MAAM,CAACC,QAAQ,EAAEhB,GAAA,CAAIiB,IAAI;EACnE;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEV,GAAA;IACAG;EACF,GACA;IACEQ,OAAA,EAAS1B,eAAA,CAAgB;MACvB0B,OAAA,EAAS,IAAIC,OAAA;MACbrB;IACF;IACAsB,MAAA,EAAQ/B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -2,25 +2,34 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { findOperation } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
export const find = async ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
export const find = async ({
|
|
6
|
+
collection,
|
|
7
|
+
req
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
depth,
|
|
11
|
+
draft,
|
|
12
|
+
limit,
|
|
13
|
+
page,
|
|
14
|
+
sort,
|
|
15
|
+
where
|
|
16
|
+
} = req.query;
|
|
17
|
+
const result = await findOperation({
|
|
18
|
+
collection,
|
|
19
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
20
|
+
draft: draft === 'true',
|
|
21
|
+
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
22
|
+
page: isNumber(page) ? Number(page) : undefined,
|
|
23
|
+
req,
|
|
24
|
+
sort,
|
|
25
|
+
where
|
|
26
|
+
});
|
|
27
|
+
return Response.json(result, {
|
|
28
|
+
headers: headersWithCors({
|
|
29
|
+
headers: new Headers(),
|
|
30
|
+
req
|
|
31
|
+
}),
|
|
32
|
+
status: httpStatus.OK
|
|
33
|
+
});
|
|
24
34
|
};
|
|
25
|
-
|
|
26
35
|
//# sourceMappingURL=find.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/find.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, page, sort, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"
|
|
1
|
+
{"version":3,"file":"find.js","names":["httpStatus","findOperation","isNumber","headersWithCors","find","collection","req","depth","draft","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/find.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, page, sort, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGN,GAAA,CAAIO,KAAK;EAS5D,MAAMC,MAAA,GAAS,MAAMb,aAAA,CAAc;IACjCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMR,QAAA,CAASQ,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCV,GAAA;IACAK,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQrB,UAAA,CAAWsB;EACrB;AACF","ignoreList":[]}
|
|
@@ -3,28 +3,33 @@ import { findByIDOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
-
export const findByID = async ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
export const findByID = async ({
|
|
7
|
+
id: incomingID,
|
|
8
|
+
collection,
|
|
9
|
+
req
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
searchParams
|
|
13
|
+
} = req;
|
|
14
|
+
const depth = searchParams.get('depth');
|
|
15
|
+
const id = sanitizeCollectionID({
|
|
16
|
+
id: incomingID,
|
|
17
|
+
collectionSlug: collection.config.slug,
|
|
18
|
+
payload: req.payload
|
|
19
|
+
});
|
|
20
|
+
const result = await findByIDOperation({
|
|
21
|
+
id,
|
|
22
|
+
collection,
|
|
23
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
24
|
+
draft: searchParams.get('draft') === 'true',
|
|
25
|
+
req
|
|
26
|
+
});
|
|
27
|
+
return Response.json(result, {
|
|
28
|
+
headers: headersWithCors({
|
|
29
|
+
headers: new Headers(),
|
|
30
|
+
req
|
|
31
|
+
}),
|
|
32
|
+
status: httpStatus.OK
|
|
33
|
+
});
|
|
28
34
|
};
|
|
29
|
-
|
|
30
35
|
//# sourceMappingURL=findByID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"
|
|
1
|
+
{"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMhB,iBAAA,CAAkB;IACrCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCH;EACF;EAEA,OAAOY,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
|
|
@@ -3,27 +3,32 @@ import { findVersionByIDOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
-
export const findVersionByID = async ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
export const findVersionByID = async ({
|
|
7
|
+
id: incomingID,
|
|
8
|
+
collection,
|
|
9
|
+
req
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
searchParams
|
|
13
|
+
} = req;
|
|
14
|
+
const depth = searchParams.get('depth');
|
|
15
|
+
const id = sanitizeCollectionID({
|
|
16
|
+
id: incomingID,
|
|
17
|
+
collectionSlug: collection.config.slug,
|
|
18
|
+
payload: req.payload
|
|
19
|
+
});
|
|
20
|
+
const result = await findVersionByIDOperation({
|
|
21
|
+
id,
|
|
22
|
+
collection,
|
|
23
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
24
|
+
req
|
|
25
|
+
});
|
|
26
|
+
return Response.json(result, {
|
|
27
|
+
headers: headersWithCors({
|
|
28
|
+
headers: new Headers(),
|
|
29
|
+
req
|
|
30
|
+
}),
|
|
31
|
+
status: httpStatus.OK
|
|
32
|
+
});
|
|
27
33
|
};
|
|
28
|
-
|
|
29
34
|
//# sourceMappingURL=findVersionByID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"
|
|
1
|
+
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,eAAA,GAAgD,MAAAA,CAAO;EAClEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMhB,wBAAA,CAAyB;IAC5CK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCV;EACF;EAEA,OAAOW,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AACF","ignoreList":[]}
|
|
@@ -2,24 +2,32 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { findVersionsOperation } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
export const findVersions = async ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
export const findVersions = async ({
|
|
6
|
+
collection,
|
|
7
|
+
req
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
depth,
|
|
11
|
+
limit,
|
|
12
|
+
page,
|
|
13
|
+
sort,
|
|
14
|
+
where
|
|
15
|
+
} = req.query;
|
|
16
|
+
const result = await findVersionsOperation({
|
|
17
|
+
collection,
|
|
18
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
19
|
+
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
20
|
+
page: isNumber(page) ? Number(page) : undefined,
|
|
21
|
+
req,
|
|
22
|
+
sort,
|
|
23
|
+
where
|
|
24
|
+
});
|
|
25
|
+
return Response.json(result, {
|
|
26
|
+
headers: headersWithCors({
|
|
27
|
+
headers: new Headers(),
|
|
28
|
+
req
|
|
29
|
+
}),
|
|
30
|
+
status: httpStatus.OK
|
|
31
|
+
});
|
|
23
32
|
};
|
|
24
|
-
|
|
25
33
|
//# sourceMappingURL=findVersions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"
|
|
1
|
+
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","findVersions","collection","req","depth","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGL,GAAA,CAAIM,KAAK;EAQrD,MAAMC,MAAA,GAAS,MAAMZ,qBAAA,CAAsB;IACzCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,KAAA,EAAON,QAAA,CAASM,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMP,QAAA,CAASO,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCT,GAAA;IACAI,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASf,eAAA,CAAgB;MACvBe,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQpB,UAAA,CAAWqB;EACrB;AACF","ignoreList":[]}
|
|
@@ -3,42 +3,47 @@ import { extractJWT, findByIDOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { routeError } from '../routeError.js';
|
|
6
|
-
export const preview = async ({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export const preview = async ({
|
|
7
|
+
id,
|
|
8
|
+
collection,
|
|
9
|
+
req
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
searchParams
|
|
13
|
+
} = req;
|
|
14
|
+
const depth = searchParams.get('depth');
|
|
15
|
+
const result = await findByIDOperation({
|
|
16
|
+
id,
|
|
17
|
+
collection,
|
|
18
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
19
|
+
draft: searchParams.get('draft') === 'true',
|
|
20
|
+
req
|
|
21
|
+
});
|
|
22
|
+
let previewURL;
|
|
23
|
+
const generatePreviewURL = req.payload.config.collections.find(config => config.slug === collection.config.slug)?.admin?.preview;
|
|
24
|
+
const token = extractJWT(req);
|
|
25
|
+
if (typeof generatePreviewURL === 'function') {
|
|
26
|
+
try {
|
|
27
|
+
previewURL = await generatePreviewURL(result, {
|
|
28
|
+
locale: req.locale,
|
|
29
|
+
req,
|
|
30
|
+
token
|
|
31
|
+
});
|
|
32
|
+
} catch (err) {
|
|
33
|
+
return routeError({
|
|
11
34
|
collection,
|
|
12
|
-
|
|
13
|
-
|
|
35
|
+
config: req.payload.config,
|
|
36
|
+
err,
|
|
14
37
|
req
|
|
15
|
-
|
|
16
|
-
let previewURL;
|
|
17
|
-
const generatePreviewURL = req.payload.config.collections.find((config)=>config.slug === collection.config.slug)?.admin?.preview;
|
|
18
|
-
const token = extractJWT(req);
|
|
19
|
-
if (typeof generatePreviewURL === 'function') {
|
|
20
|
-
try {
|
|
21
|
-
previewURL = await generatePreviewURL(result, {
|
|
22
|
-
locale: req.locale,
|
|
23
|
-
req,
|
|
24
|
-
token
|
|
25
|
-
});
|
|
26
|
-
} catch (err) {
|
|
27
|
-
return routeError({
|
|
28
|
-
collection,
|
|
29
|
-
config: req.payload.config,
|
|
30
|
-
err,
|
|
31
|
-
req
|
|
32
|
-
});
|
|
33
|
-
}
|
|
38
|
+
});
|
|
34
39
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
}
|
|
41
|
+
return Response.json(previewURL, {
|
|
42
|
+
headers: headersWithCors({
|
|
43
|
+
headers: new Headers(),
|
|
44
|
+
req
|
|
45
|
+
}),
|
|
46
|
+
status: httpStatus.OK
|
|
47
|
+
});
|
|
42
48
|
};
|
|
43
|
-
|
|
44
49
|
//# sourceMappingURL=preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/preview.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT, findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { routeError } from '../routeError.js'\n\nexport const preview: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n req,\n })\n\n let previewURL: string\n\n const generatePreviewURL = req.payload.config.collections.find(\n (config) => config.slug === collection.config.slug,\n )?.admin?.preview\n\n const token = extractJWT(req)\n\n if (typeof generatePreviewURL === 'function') {\n try {\n previewURL = await generatePreviewURL(result, {\n locale: req.locale,\n req,\n token,\n })\n } catch (err) {\n return routeError({\n collection,\n config: req.payload.config,\n err,\n req,\n })\n }\n }\n\n return Response.json(previewURL, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"
|
|
1
|
+
{"version":3,"file":"preview.js","names":["httpStatus","extractJWT","findByIDOperation","isNumber","headersWithCors","routeError","preview","id","collection","req","searchParams","depth","get","result","Number","undefined","draft","previewURL","generatePreviewURL","payload","config","collections","find","slug","admin","token","locale","err","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/preview.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT, findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { routeError } from '../routeError.js'\n\nexport const preview: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n req,\n })\n\n let previewURL: string\n\n const generatePreviewURL = req.payload.config.collections.find(\n (config) => config.slug === collection.config.slug,\n )?.admin?.preview\n\n const token = extractJWT(req)\n\n if (typeof generatePreviewURL === 'function') {\n try {\n previewURL = await generatePreviewURL(result, {\n locale: req.locale,\n req,\n token,\n })\n } catch (err) {\n return routeError({\n collection,\n config: req.payload.config,\n err,\n req,\n })\n }\n }\n\n return Response.json(previewURL, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,UAAU,EAAEC,iBAAiB,QAAQ;AAC9C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMC,OAAA,GAAwC,MAAAA,CAAO;EAAEC,EAAE;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACjF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMX,iBAAA,CAAkB;IACrCK,EAAA;IACAC,UAAA;IACAG,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCC,KAAA,EAAON,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCH;EACF;EAEA,IAAIQ,UAAA;EAEJ,MAAMC,kBAAA,GAAqBT,GAAA,CAAIU,OAAO,CAACC,MAAM,CAACC,WAAW,CAACC,IAAI,CAC3DF,MAAA,IAAWA,MAAA,CAAOG,IAAI,KAAKf,UAAA,CAAWY,MAAM,CAACG,IAAI,GACjDC,KAAA,EAAOlB,OAAA;EAEV,MAAMmB,KAAA,GAAQxB,UAAA,CAAWQ,GAAA;EAEzB,IAAI,OAAOS,kBAAA,KAAuB,YAAY;IAC5C,IAAI;MACFD,UAAA,GAAa,MAAMC,kBAAA,CAAmBL,MAAA,EAAQ;QAC5Ca,MAAA,EAAQjB,GAAA,CAAIiB,MAAM;QAClBjB,GAAA;QACAgB;MACF;IACF,EAAE,OAAOE,GAAA,EAAK;MACZ,OAAOtB,UAAA,CAAW;QAChBG,UAAA;QACAY,MAAA,EAAQX,GAAA,CAAIU,OAAO,CAACC,MAAM;QAC1BO,GAAA;QACAlB;MACF;IACF;EACF;EAEA,OAAOmB,QAAA,CAASC,IAAI,CAACZ,UAAA,EAAY;IAC/Ba,OAAA,EAAS1B,eAAA,CAAgB;MACvB0B,OAAA,EAAS,IAAIC,OAAA;MACbtB;IACF;IACAuB,MAAA,EAAQhC,UAAA,CAAWiC;EACrB;AACF","ignoreList":[]}
|
|
@@ -3,32 +3,37 @@ import { restoreVersionOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
-
export const restoreVersion = async ({
|
|
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
|
-
|
|
6
|
+
export const restoreVersion = async ({
|
|
7
|
+
id: incomingID,
|
|
8
|
+
collection,
|
|
9
|
+
req
|
|
10
|
+
}) => {
|
|
11
|
+
const {
|
|
12
|
+
searchParams
|
|
13
|
+
} = req;
|
|
14
|
+
const depth = searchParams.get('depth');
|
|
15
|
+
const draft = searchParams.get('draft');
|
|
16
|
+
const id = sanitizeCollectionID({
|
|
17
|
+
id: incomingID,
|
|
18
|
+
collectionSlug: collection.config.slug,
|
|
19
|
+
payload: req.payload
|
|
20
|
+
});
|
|
21
|
+
const result = await restoreVersionOperation({
|
|
22
|
+
id,
|
|
23
|
+
collection,
|
|
24
|
+
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
25
|
+
draft: draft === 'true' ? true : undefined,
|
|
26
|
+
req
|
|
27
|
+
});
|
|
28
|
+
return Response.json({
|
|
29
|
+
...result,
|
|
30
|
+
message: req.t('version:restoredSuccessfully')
|
|
31
|
+
}, {
|
|
32
|
+
headers: headersWithCors({
|
|
33
|
+
headers: new Headers(),
|
|
34
|
+
req
|
|
35
|
+
}),
|
|
36
|
+
status: httpStatus.OK
|
|
37
|
+
});
|
|
32
38
|
};
|
|
33
|
-
|
|
34
39
|
//# sourceMappingURL=restoreVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const restoreVersion: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await restoreVersionOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n req,\n })\n\n return Response.json(\n {\n ...result,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperation","isNumber","headersWithCors","sanitizeCollectionID","restoreVersion","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const restoreVersion: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await restoreVersionOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n req,\n })\n\n return Response.json(\n {\n ...result,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,cAAA,GAA+C,MAAAA,CAAO;EACjEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMjB,uBAAA,CAAwB;IAC3CK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOO,SAAA;IACjCX;EACF;EAEA,OAAOY,QAAA,CAASC,IAAI,CAClB;IACE,GAAGJ,MAAM;IACTK,OAAA,EAASd,GAAA,CAAIe,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAAStB,eAAA,CAAgB;MACvBsB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ3B,UAAA,CAAW4B;EACrB;AAEJ","ignoreList":[]}
|