@payloadcms/next 3.0.0-canary.4de9e42 → 3.0.0-canary.518fabe
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.d.ts +3 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +75 -51
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +7 -5
- 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.d.ts +2 -2
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +95 -72
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.scss +0 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +34 -17
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts +2 -0
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.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.d.ts +2 -2
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js +24 -23
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.scss +5 -4
- package/dist/elements/EmailAndUsername/index.d.ts +14 -0
- package/dist/elements/EmailAndUsername/index.d.ts.map +1 -0
- package/dist/elements/EmailAndUsername/index.js +121 -0
- package/dist/elements/EmailAndUsername/index.js.map +1 -0
- package/dist/elements/LeaveWithoutSaving/index.d.ts.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.js +150 -74
- package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.scss +4 -3
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts +2 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +121 -99
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
- package/dist/elements/Logo/index.d.ts.map +1 -1
- package/dist/elements/Logo/index.js +37 -19
- 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.d.ts.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +48 -14
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.scss +4 -1
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +151 -75
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +57 -57
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/elements/Nav/index.scss +21 -15
- package/dist/exports/layouts.d.ts +1 -1
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -2
- 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.d.ts +1 -1
- package/dist/exports/views.d.ts.map +1 -1
- package/dist/exports/views.js +1 -2
- package/dist/exports/views.js.map +1 -1
- package/dist/fetchAPI-multipart/fileFactory.d.ts +2 -1
- package/dist/fetchAPI-multipart/fileFactory.d.ts.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.d.ts +1 -1
- package/dist/fetchAPI-multipart/handlers.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/handlers.js +79 -78
- package/dist/fetchAPI-multipart/handlers.js.map +1 -1
- package/dist/fetchAPI-multipart/index.d.ts +1 -101
- package/dist/fetchAPI-multipart/index.d.ts.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.d.ts +2 -1
- package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.js +159 -141
- package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
- package/dist/fetchAPI-multipart/processNested.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/processNested.js +26 -20
- package/dist/fetchAPI-multipart/processNested.js.map +1 -1
- package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/uploadTimer.js +18 -17
- package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
- package/dist/fetchAPI-multipart/utilities.d.ts +1 -1
- package/dist/fetchAPI-multipart/utilities.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/utilities.js +185 -165
- 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.d.ts +5 -4
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +121 -95
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/routes/graphql/handler.d.ts.map +1 -1
- package/dist/routes/graphql/handler.js +109 -106
- 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.d.ts.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.d.ts.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.d.ts.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.js +32 -25
- 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.d.ts.map +1 -1
- package/dist/routes/rest/collections/updateByID.js +42 -33
- package/dist/routes/rest/collections/updateByID.js.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.js +52 -45
- package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
- package/dist/routes/rest/files/getFile.d.ts.map +1 -1
- package/dist/routes/rest/files/getFile.js +56 -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.d.ts.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.js +27 -20
- package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
- package/dist/routes/rest/globals/update.d.ts.map +1 -1
- package/dist/routes/rest/globals/update.js +36 -28
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +679 -601
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.d.ts +2 -1
- package/dist/routes/rest/og/image.d.ts.map +1 -1
- package/dist/routes/rest/og/image.js +75 -73
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js +61 -56
- 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.d.ts.map +1 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.js +18 -11
- package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
- package/dist/scss/app.scss +13 -18
- package/dist/scss/toastify.scss +59 -0
- package/dist/scss/toasts.scss +73 -42
- package/dist/scss/type.scss +19 -27
- package/dist/scss/vars.scss +26 -47
- 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.d.ts.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +42 -11
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.scss +36 -5
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +59 -57
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/templates/Default/index.scss +1 -1
- package/dist/templates/Minimal/index.js +16 -16
- package/dist/templates/Minimal/index.js.map +1 -1
- package/dist/templates/Minimal/index.scss +2 -2
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js +40 -35
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
- package/dist/utilities/addLocalesToRequest.js +48 -36
- package/dist/utilities/addLocalesToRequest.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/createPayloadRequest.js +90 -73
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.d.ts.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +13 -11
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.d.ts +2 -2
- package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
- package/dist/utilities/getPayloadHMR.js +92 -82
- 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.d.ts.map +1 -1
- package/dist/utilities/getRequestTheme.js +16 -16
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/headersWithCors.d.ts.map +1 -1
- package/dist/utilities/headersWithCors.js +21 -30
- package/dist/utilities/headersWithCors.js.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.js +48 -33
- package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +47 -24
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/initPage/index.d.ts +1 -1
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js +148 -119
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initPage/shared.d.ts +14 -2
- package/dist/utilities/initPage/shared.d.ts.map +1 -1
- package/dist/utilities/initPage/shared.js +27 -16
- package/dist/utilities/initPage/shared.js.map +1 -1
- package/dist/utilities/initPage/types.d.ts +2 -1
- package/dist/utilities/initPage/types.d.ts.map +1 -1
- package/dist/utilities/initPage/types.js +1 -2
- package/dist/utilities/initPage/types.js.map +1 -1
- package/dist/utilities/mergeHeaders.d.ts +1 -1
- package/dist/utilities/mergeHeaders.d.ts.map +1 -1
- package/dist/utilities/mergeHeaders.js +9 -36
- package/dist/utilities/mergeHeaders.js.map +1 -1
- package/dist/utilities/meta.d.ts.map +1 -1
- package/dist/utilities/meta.js +66 -67
- package/dist/utilities/meta.js.map +1 -1
- package/dist/utilities/timestamp.d.ts.map +1 -1
- package/dist/utilities/timestamp.js +6 -5
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/LocaleSelector/index.d.ts +2 -2
- package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
- package/dist/views/API/LocaleSelector/index.js +37 -8
- package/dist/views/API/LocaleSelector/index.js.map +1 -1
- package/dist/views/API/RenderJSON/index.d.ts +1 -1
- package/dist/views/API/RenderJSON/index.d.ts.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.d.ts.map +1 -1
- package/dist/views/API/index.client.js +191 -197
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/API/index.d.ts +2 -2
- package/dist/views/API/index.d.ts.map +1 -1
- package/dist/views/API/index.js +2 -3
- package/dist/views/API/index.js.map +1 -1
- package/dist/views/API/index.scss +1 -2
- package/dist/views/API/meta.d.ts.map +1 -1
- package/dist/views/API/meta.js +22 -14
- 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.d.ts +3 -3
- package/dist/views/Account/Settings/index.d.ts.map +1 -1
- package/dist/views/Account/Settings/index.js +21 -27
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/ToggleTheme/index.d.ts.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +50 -27
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.client.d.ts +3 -0
- package/dist/views/Account/index.client.d.ts.map +1 -0
- package/dist/views/Account/index.client.js +37 -0
- package/dist/views/Account/index.client.js.map +1 -0
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +102 -69
- 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.d.ts +2 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +96 -56
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.js +42 -46
- package/dist/views/CreateFirstUser/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.scss +14 -0
- package/dist/views/CreateFirstUser/meta.js +12 -8
- package/dist/views/CreateFirstUser/meta.js.map +1 -1
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +134 -123
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.scss +11 -7
- package/dist/views/Dashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/index.js +62 -57
- 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.d.ts.map +1 -1
- package/dist/views/Document/getCustomViewByKey.js +2 -4
- package/dist/views/Document/getCustomViewByKey.js.map +1 -1
- package/dist/views/Document/getCustomViewByRoute.d.ts +4 -1
- package/dist/views/Document/getCustomViewByRoute.d.ts.map +1 -1
- package/dist/views/Document/getCustomViewByRoute.js +30 -17
- package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Document/getDocumentData.d.ts +1 -0
- package/dist/views/Document/getDocumentData.d.ts.map +1 -1
- package/dist/views/Document/getDocumentData.js +34 -27
- 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.d.ts +4 -3
- package/dist/views/Document/getMetaBySegment.d.ts.map +1 -1
- package/dist/views/Document/getMetaBySegment.js +114 -63
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.d.ts +18 -7
- package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js +308 -239
- 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 +195 -163
- 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.d.ts +2 -2
- package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js +120 -105
- package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Default/Auth/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/index.js +296 -150
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.d.ts +4 -1
- package/dist/views/Edit/Default/Auth/types.d.ts.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.d.ts.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.d.ts.map +1 -1
- package/dist/views/Edit/Default/index.js +209 -176
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/Edit/Default/index.scss +2 -2
- 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.d.ts.map +1 -1
- package/dist/views/Edit/index.client.js +47 -18
- package/dist/views/Edit/index.client.js.map +1 -1
- package/dist/views/Edit/index.d.ts +2 -2
- package/dist/views/Edit/index.d.ts.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.d.ts.map +1 -1
- package/dist/views/Edit/meta.js +43 -24
- 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.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +151 -90
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +59 -45
- 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.d.ts.map +1 -1
- package/dist/views/List/Default/index.js +370 -187
- package/dist/views/List/Default/index.js.map +1 -1
- package/dist/views/List/Default/index.scss +9 -27
- package/dist/views/List/Default/types.js +1 -2
- package/dist/views/List/Default/types.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +159 -123
- 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 +3 -2
- 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.d.ts +3 -3
- package/dist/views/LivePreview/Context/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Context/index.js +136 -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 +82 -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 +137 -116
- package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/SizeInput/index.d.ts.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.d.ts +3 -3
- package/dist/views/LivePreview/index.client.d.ts.map +1 -1
- package/dist/views/LivePreview/index.client.js +320 -173
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/LivePreview/index.d.ts +2 -2
- package/dist/views/LivePreview/index.d.ts.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.d.ts.map +1 -1
- package/dist/views/LivePreview/meta.js +14 -8
- package/dist/views/LivePreview/meta.js.map +1 -1
- package/dist/views/LivePreview/usePopupWindow.d.ts +2 -1
- package/dist/views/LivePreview/usePopupWindow.d.ts.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.d.ts +4 -1
- package/dist/views/Login/LoginField/index.d.ts.map +1 -1
- package/dist/views/Login/LoginField/index.js +84 -92
- package/dist/views/Login/LoginField/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +147 -82
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.d.ts.map +1 -1
- package/dist/views/Login/index.js +78 -61
- 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.d.ts +1 -0
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +86 -38
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.d.ts.map +1 -1
- package/dist/views/Logout/index.js +29 -16
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/Logout/index.scss +12 -9
- package/dist/views/Logout/meta.js +11 -7
- package/dist/views/Logout/meta.js.map +1 -1
- package/dist/views/NotFound/index.client.d.ts.map +1 -1
- package/dist/views/NotFound/index.client.js +81 -39
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/NotFound/index.d.ts +4 -3
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +49 -47
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/index.scss +18 -0
- package/dist/views/NotFound/meta.js +9 -7
- package/dist/views/NotFound/meta.js.map +1 -1
- package/dist/views/ResetPassword/index.client.d.ts +1 -1
- package/dist/views/ResetPassword/index.client.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.client.js +102 -74
- package/dist/views/ResetPassword/index.client.js.map +1 -1
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +65 -56
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/index.scss +28 -2
- package/dist/views/ResetPassword/meta.js +12 -8
- package/dist/views/ResetPassword/meta.js.map +1 -1
- package/dist/views/Root/generateCustomViewMetadata.d.ts +11 -0
- package/dist/views/Root/generateCustomViewMetadata.d.ts.map +1 -0
- package/dist/views/Root/generateCustomViewMetadata.js +25 -0
- package/dist/views/Root/generateCustomViewMetadata.js.map +1 -0
- package/dist/views/Root/getCustomViewByRoute.d.ts +7 -2
- package/dist/views/Root/getCustomViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomViewByRoute.js +45 -16
- package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.d.ts +10 -4
- package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +164 -141
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.d.ts +6 -5
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +100 -75
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +22 -13
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Root/meta.d.ts.map +1 -1
- package/dist/views/Root/meta.js +143 -121
- package/dist/views/Root/meta.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts +2 -2
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +32 -21
- 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.d.ts.map +1 -1
- package/dist/views/Verify/index.js +59 -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 +8 -9
- package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
- package/dist/views/Version/Default/SetStepNav.js +148 -104
- package/dist/views/Version/Default/SetStepNav.js.map +1 -1
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js +199 -118
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/Default/types.d.ts +7 -7
- package/dist/views/Version/Default/types.d.ts.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 +2 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +68 -70
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts +2 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +35 -32
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts +3 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +113 -63
- 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 +3 -6
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +42 -38
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts +3 -5
- 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 +3 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +39 -30
- 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.d.ts +21 -28
- package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -22
- 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.d.ts +15 -16
- package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.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.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +107 -94
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/types.d.ts +9 -10
- package/dist/views/Version/RenderFieldsToDiff/types.d.ts.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.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +117 -85
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/index.scss +57 -10
- package/dist/views/Version/Restore/types.d.ts +1 -0
- package/dist/views/Version/Restore/types.d.ts.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.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +133 -139
- 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.d.ts.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.d.ts +2 -2
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +127 -79
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Version/meta.d.ts.map +1 -1
- package/dist/views/Version/meta.js +50 -39
- package/dist/views/Version/meta.js.map +1 -1
- package/dist/views/Versions/buildColumns.d.ts.map +1 -1
- package/dist/views/Versions/buildColumns.js +87 -58
- 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.d.ts.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.d.ts +13 -4
- package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +35 -26
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/dist/views/Versions/index.client.d.ts +4 -4
- package/dist/views/Versions/index.client.d.ts.map +1 -1
- package/dist/views/Versions/index.client.js +81 -75
- package/dist/views/Versions/index.client.js.map +1 -1
- package/dist/views/Versions/index.d.ts +2 -2
- package/dist/views/Versions/index.d.ts.map +1 -1
- package/dist/views/Versions/index.js +148 -107
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/meta.d.ts.map +1 -1
- package/dist/views/Versions/meta.js +44 -33
- 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.d.ts.map +1 -1
- package/dist/withPayload.js +83 -110
- package/dist/withPayload.js.map +1 -1
- package/package.json +27 -17
- package/dist/cjs/withPayload.cjs +0 -138
- package/dist/cjs/withPayload.cjs.map +0 -1
|
@@ -2,106 +2,113 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { APIError, APIErrorName, ValidationErrorName } from 'payload';
|
|
3
3
|
import { getPayloadHMR } from '../../utilities/getPayloadHMR.js';
|
|
4
4
|
import { headersWithCors } from '../../utilities/headersWithCors.js';
|
|
5
|
-
const formatErrors =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
]
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
// Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError
|
|
23
|
-
if (proto.constructor.name === ValidationErrorName && 'errors' in incoming && incoming.errors) {
|
|
24
|
-
return {
|
|
25
|
-
errors: Object.keys(incoming.errors).reduce((acc, key)=>{
|
|
26
|
-
acc.push({
|
|
27
|
-
field: incoming.errors[key].path,
|
|
28
|
-
message: incoming.errors[key].message
|
|
29
|
-
});
|
|
30
|
-
return acc;
|
|
31
|
-
}, [])
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(incoming.message)) {
|
|
35
|
-
return {
|
|
36
|
-
errors: incoming.message
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
if (incoming.name) {
|
|
40
|
-
return {
|
|
41
|
-
errors: [
|
|
42
|
-
{
|
|
43
|
-
message: incoming.message
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
};
|
|
47
|
-
}
|
|
5
|
+
const formatErrors = incoming => {
|
|
6
|
+
if (incoming) {
|
|
7
|
+
// Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965
|
|
8
|
+
// Instead, get the prototype of the incoming error and check its constructor name
|
|
9
|
+
const proto = Object.getPrototypeOf(incoming);
|
|
10
|
+
// Payload 'ValidationError' and 'APIError'
|
|
11
|
+
if ((proto.constructor.name === ValidationErrorName || proto.constructor.name === APIErrorName) && incoming.data) {
|
|
12
|
+
return {
|
|
13
|
+
errors: [{
|
|
14
|
+
name: incoming.name,
|
|
15
|
+
data: incoming.data,
|
|
16
|
+
message: incoming.message
|
|
17
|
+
}]
|
|
18
|
+
};
|
|
48
19
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
payload = await getPayloadHMR({
|
|
62
|
-
config: configArg
|
|
63
|
-
});
|
|
64
|
-
} catch (e) {
|
|
65
|
-
return Response.json({
|
|
66
|
-
message: 'There was an error initializing Payload'
|
|
67
|
-
}, {
|
|
68
|
-
status: httpStatus.INTERNAL_SERVER_ERROR
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
req.payload = payload;
|
|
73
|
-
const headers = headersWithCors({
|
|
74
|
-
headers: new Headers(),
|
|
75
|
-
req
|
|
76
|
-
});
|
|
77
|
-
const { config, logger } = payload;
|
|
78
|
-
let response = formatErrors(err);
|
|
79
|
-
let status = err.status || httpStatus.INTERNAL_SERVER_ERROR;
|
|
80
|
-
logger.error(err.stack);
|
|
81
|
-
// Internal server errors can contain anything, including potentially sensitive data.
|
|
82
|
-
// Therefore, error details will be hidden from the response unless `config.debug` is `true`
|
|
83
|
-
if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
|
|
84
|
-
response = formatErrors(new APIError('Something went wrong.'));
|
|
20
|
+
// Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError
|
|
21
|
+
if (proto.constructor.name === ValidationErrorName && 'errors' in incoming && incoming.errors) {
|
|
22
|
+
return {
|
|
23
|
+
errors: Object.keys(incoming.errors).reduce((acc, key) => {
|
|
24
|
+
acc.push({
|
|
25
|
+
field: incoming.errors[key].path,
|
|
26
|
+
message: incoming.errors[key].message
|
|
27
|
+
});
|
|
28
|
+
return acc;
|
|
29
|
+
}, [])
|
|
30
|
+
};
|
|
85
31
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
32
|
+
if (Array.isArray(incoming.message)) {
|
|
33
|
+
return {
|
|
34
|
+
errors: incoming.message
|
|
35
|
+
};
|
|
88
36
|
}
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
37
|
+
if (incoming.name) {
|
|
38
|
+
return {
|
|
39
|
+
errors: [{
|
|
40
|
+
message: incoming.message
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
94
43
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
errors: [{
|
|
47
|
+
message: 'An unknown error occurred.'
|
|
48
|
+
}]
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export const routeError = async ({
|
|
52
|
+
collection,
|
|
53
|
+
config: configArg,
|
|
54
|
+
err,
|
|
55
|
+
req
|
|
56
|
+
}) => {
|
|
57
|
+
let payload = req?.payload;
|
|
58
|
+
if (!payload) {
|
|
59
|
+
try {
|
|
60
|
+
payload = await getPayloadHMR({
|
|
61
|
+
config: configArg
|
|
62
|
+
});
|
|
63
|
+
} catch (e) {
|
|
64
|
+
return Response.json({
|
|
65
|
+
message: 'There was an error initializing Payload'
|
|
66
|
+
}, {
|
|
67
|
+
status: httpStatus.INTERNAL_SERVER_ERROR
|
|
68
|
+
});
|
|
100
69
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
70
|
+
}
|
|
71
|
+
req.payload = payload;
|
|
72
|
+
const headers = headersWithCors({
|
|
73
|
+
headers: new Headers(),
|
|
74
|
+
req
|
|
75
|
+
});
|
|
76
|
+
const {
|
|
77
|
+
config,
|
|
78
|
+
logger
|
|
79
|
+
} = payload;
|
|
80
|
+
let response = formatErrors(err);
|
|
81
|
+
let status = err.status || httpStatus.INTERNAL_SERVER_ERROR;
|
|
82
|
+
logger.error(err.stack);
|
|
83
|
+
// Internal server errors can contain anything, including potentially sensitive data.
|
|
84
|
+
// Therefore, error details will be hidden from the response unless `config.debug` is `true`
|
|
85
|
+
if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
|
|
86
|
+
response = formatErrors(new APIError('Something went wrong.'));
|
|
87
|
+
}
|
|
88
|
+
if (config.debug && config.debug === true) {
|
|
89
|
+
response.stack = err.stack;
|
|
90
|
+
}
|
|
91
|
+
if (collection && typeof collection.config.hooks.afterError === 'function') {
|
|
92
|
+
({
|
|
93
|
+
response,
|
|
94
|
+
status
|
|
95
|
+
} = collection.config.hooks.afterError(err, response, req?.context, collection.config) || {
|
|
96
|
+
response,
|
|
97
|
+
status
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (typeof config.hooks.afterError === 'function') {
|
|
101
|
+
({
|
|
102
|
+
response,
|
|
103
|
+
status
|
|
104
|
+
} = config.hooks.afterError(err, response, req?.context, collection?.config) || {
|
|
105
|
+
response,
|
|
106
|
+
status
|
|
104
107
|
});
|
|
108
|
+
}
|
|
109
|
+
return Response.json(response, {
|
|
110
|
+
headers,
|
|
111
|
+
status
|
|
112
|
+
});
|
|
105
113
|
};
|
|
106
|
-
|
|
107
114
|
//# sourceMappingURL=routeError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { APIError, APIErrorName, ValidationErrorName } from 'payload'\n\nimport { getPayloadHMR } from '../../utilities/getPayloadHMR.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\n\nexport type ErrorResponse = { data?: any; errors: unknown[]; stack?: string }\n\nconst formatErrors = (incoming: { [key: string]: unknown } | APIError): ErrorResponse => {\n if (incoming) {\n // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965\n // Instead, get the prototype of the incoming error and check its constructor name\n const proto = Object.getPrototypeOf(incoming)\n\n // Payload 'ValidationError' and 'APIError'\n if (\n (proto.constructor.name === ValidationErrorName || proto.constructor.name === APIErrorName) &&\n incoming.data\n ) {\n return {\n errors: [\n {\n name: incoming.name,\n data: incoming.data,\n message: incoming.message,\n },\n ],\n }\n }\n\n // Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError\n if (proto.constructor.name === ValidationErrorName && 'errors' in incoming && incoming.errors) {\n return {\n errors: Object.keys(incoming.errors).reduce((acc, key) => {\n acc.push({\n field: incoming.errors[key].path,\n message: incoming.errors[key].message,\n })\n return acc\n }, []),\n }\n }\n\n if (Array.isArray(incoming.message)) {\n return {\n errors: incoming.message,\n }\n }\n\n if (incoming.name) {\n return {\n errors: [\n {\n message: incoming.message,\n },\n ],\n }\n }\n }\n\n return {\n errors: [\n {\n message: 'An unknown error occurred.',\n },\n ],\n }\n}\n\nexport const routeError = async ({\n collection,\n config: configArg,\n err,\n req,\n}: {\n collection?: Collection\n config: Promise<SanitizedConfig> | SanitizedConfig\n err: APIError\n req: Partial<PayloadRequest>\n}) => {\n let payload = req?.payload\n\n if (!payload) {\n try {\n payload = await getPayloadHMR({ config: configArg })\n } catch (e) {\n return Response.json(\n {\n message: 'There was an error initializing Payload',\n },\n { status: httpStatus.INTERNAL_SERVER_ERROR },\n )\n }\n }\n\n req.payload = payload\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { config, logger } = payload\n\n let response = formatErrors(err)\n\n let status = err.status || httpStatus.INTERNAL_SERVER_ERROR\n\n logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n response = formatErrors(new APIError('Something went wrong.'))\n }\n\n if (config.debug && config.debug === true) {\n response.stack = err.stack\n }\n\n if (collection && typeof collection.config.hooks.afterError === 'function') {\n ;({ response, status } = collection.config.hooks.afterError(\n err,\n response,\n req?.context,\n collection.config,\n ) || { response, status })\n }\n\n if (typeof config.hooks.afterError === 'function') {\n ;({ response, status } = config.hooks.afterError(\n err,\n response,\n req?.context,\n collection?.config,\n ) || {\n response,\n status,\n })\n }\n\n return Response.json(response, { headers, status })\n}\n"],"
|
|
1
|
+
{"version":3,"file":"routeError.js","names":["httpStatus","APIError","APIErrorName","ValidationErrorName","getPayloadHMR","headersWithCors","formatErrors","incoming","proto","Object","getPrototypeOf","constructor","name","data","errors","message","keys","reduce","acc","key","push","field","path","Array","isArray","routeError","collection","config","configArg","err","req","payload","e","Response","json","status","INTERNAL_SERVER_ERROR","headers","Headers","logger","response","error","stack","debug","hooks","afterError","context"],"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { APIError, APIErrorName, ValidationErrorName } from 'payload'\n\nimport { getPayloadHMR } from '../../utilities/getPayloadHMR.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\n\nexport type ErrorResponse = { data?: any; errors: unknown[]; stack?: string }\n\nconst formatErrors = (incoming: { [key: string]: unknown } | APIError): ErrorResponse => {\n if (incoming) {\n // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965\n // Instead, get the prototype of the incoming error and check its constructor name\n const proto = Object.getPrototypeOf(incoming)\n\n // Payload 'ValidationError' and 'APIError'\n if (\n (proto.constructor.name === ValidationErrorName || proto.constructor.name === APIErrorName) &&\n incoming.data\n ) {\n return {\n errors: [\n {\n name: incoming.name,\n data: incoming.data,\n message: incoming.message,\n },\n ],\n }\n }\n\n // Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError\n if (proto.constructor.name === ValidationErrorName && 'errors' in incoming && incoming.errors) {\n return {\n errors: Object.keys(incoming.errors).reduce((acc, key) => {\n acc.push({\n field: incoming.errors[key].path,\n message: incoming.errors[key].message,\n })\n return acc\n }, []),\n }\n }\n\n if (Array.isArray(incoming.message)) {\n return {\n errors: incoming.message,\n }\n }\n\n if (incoming.name) {\n return {\n errors: [\n {\n message: incoming.message,\n },\n ],\n }\n }\n }\n\n return {\n errors: [\n {\n message: 'An unknown error occurred.',\n },\n ],\n }\n}\n\nexport const routeError = async ({\n collection,\n config: configArg,\n err,\n req,\n}: {\n collection?: Collection\n config: Promise<SanitizedConfig> | SanitizedConfig\n err: APIError\n req: Partial<PayloadRequest>\n}) => {\n let payload = req?.payload\n\n if (!payload) {\n try {\n payload = await getPayloadHMR({ config: configArg })\n } catch (e) {\n return Response.json(\n {\n message: 'There was an error initializing Payload',\n },\n { status: httpStatus.INTERNAL_SERVER_ERROR },\n )\n }\n }\n\n req.payload = payload\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { config, logger } = payload\n\n let response = formatErrors(err)\n\n let status = err.status || httpStatus.INTERNAL_SERVER_ERROR\n\n logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n response = formatErrors(new APIError('Something went wrong.'))\n }\n\n if (config.debug && config.debug === true) {\n response.stack = err.stack\n }\n\n if (collection && typeof collection.config.hooks.afterError === 'function') {\n ;({ response, status } = collection.config.hooks.afterError(\n err,\n response,\n req?.context,\n collection.config,\n ) || { response, status })\n }\n\n if (typeof config.hooks.afterError === 'function') {\n ;({ response, status } = config.hooks.afterError(\n err,\n response,\n req?.context,\n collection?.config,\n ) || {\n response,\n status,\n })\n }\n\n return Response.json(response, { headers, status })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,QAAQ,EAAEC,YAAY,EAAEC,mBAAmB,QAAQ;AAE5D,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAIhC,MAAMC,YAAA,GAAgBC,QAAA;EACpB,IAAIA,QAAA,EAAU;IACZ;IACA;IACA,MAAMC,KAAA,GAAQC,MAAA,CAAOC,cAAc,CAACH,QAAA;IAEpC;IACA,IACE,CAACC,KAAA,CAAMG,WAAW,CAACC,IAAI,KAAKT,mBAAA,IAAuBK,KAAA,CAAMG,WAAW,CAACC,IAAI,KAAKV,YAAW,KACzFK,QAAA,CAASM,IAAI,EACb;MACA,OAAO;QACLC,MAAA,EAAQ,CACN;UACEF,IAAA,EAAML,QAAA,CAASK,IAAI;UACnBC,IAAA,EAAMN,QAAA,CAASM,IAAI;UACnBE,OAAA,EAASR,QAAA,CAASQ;QACpB;MAEJ;IACF;IAEA;IACA,IAAIP,KAAA,CAAMG,WAAW,CAACC,IAAI,KAAKT,mBAAA,IAAuB,YAAYI,QAAA,IAAYA,QAAA,CAASO,MAAM,EAAE;MAC7F,OAAO;QACLA,MAAA,EAAQL,MAAA,CAAOO,IAAI,CAACT,QAAA,CAASO,MAAM,EAAEG,MAAM,CAAC,CAACC,GAAA,EAAKC,GAAA;UAChDD,GAAA,CAAIE,IAAI,CAAC;YACPC,KAAA,EAAOd,QAAA,CAASO,MAAM,CAACK,GAAA,CAAI,CAACG,IAAI;YAChCP,OAAA,EAASR,QAAA,CAASO,MAAM,CAACK,GAAA,CAAI,CAACJ;UAChC;UACA,OAAOG,GAAA;QACT,GAAG,EAAE;MACP;IACF;IAEA,IAAIK,KAAA,CAAMC,OAAO,CAACjB,QAAA,CAASQ,OAAO,GAAG;MACnC,OAAO;QACLD,MAAA,EAAQP,QAAA,CAASQ;MACnB;IACF;IAEA,IAAIR,QAAA,CAASK,IAAI,EAAE;MACjB,OAAO;QACLE,MAAA,EAAQ,CACN;UACEC,OAAA,EAASR,QAAA,CAASQ;QACpB;MAEJ;IACF;EACF;EAEA,OAAO;IACLD,MAAA,EAAQ,CACN;MACEC,OAAA,EAAS;IACX;EAEJ;AACF;AAEA,OAAO,MAAMU,UAAA,GAAa,MAAAA,CAAO;EAC/BC,UAAU;EACVC,MAAA,EAAQC,SAAS;EACjBC,GAAG;EACHC;AAAG,CAMJ;EACC,IAAIC,OAAA,GAAUD,GAAA,EAAKC,OAAA;EAEnB,IAAI,CAACA,OAAA,EAAS;IACZ,IAAI;MACFA,OAAA,GAAU,MAAM3B,aAAA,CAAc;QAAEuB,MAAA,EAAQC;MAAU;IACpD,EAAE,OAAOI,CAAA,EAAG;MACV,OAAOC,QAAA,CAASC,IAAI,CAClB;QACEnB,OAAA,EAAS;MACX,GACA;QAAEoB,MAAA,EAAQnC,UAAA,CAAWoC;MAAsB;IAE/C;EACF;EAEAN,GAAA,CAAIC,OAAO,GAAGA,OAAA;EACd,MAAMM,OAAA,GAAUhC,eAAA,CAAgB;IAC9BgC,OAAA,EAAS,IAAIC,OAAA;IACbR;EACF;EAEA,MAAM;IAAEH,MAAM;IAAEY;EAAM,CAAE,GAAGR,OAAA;EAE3B,IAAIS,QAAA,GAAWlC,YAAA,CAAauB,GAAA;EAE5B,IAAIM,MAAA,GAASN,GAAA,CAAIM,MAAM,IAAInC,UAAA,CAAWoC,qBAAqB;EAE3DG,MAAA,CAAOE,KAAK,CAACZ,GAAA,CAAIa,KAAK;EAEtB;EACA;EACA,IAAI,CAACf,MAAA,CAAOgB,KAAK,IAAIR,MAAA,KAAWnC,UAAA,CAAWoC,qBAAqB,EAAE;IAChEI,QAAA,GAAWlC,YAAA,CAAa,IAAIL,QAAA,CAAS;EACvC;EAEA,IAAI0B,MAAA,CAAOgB,KAAK,IAAIhB,MAAA,CAAOgB,KAAK,KAAK,MAAM;IACzCH,QAAA,CAASE,KAAK,GAAGb,GAAA,CAAIa,KAAK;EAC5B;EAEA,IAAIhB,UAAA,IAAc,OAAOA,UAAA,CAAWC,MAAM,CAACiB,KAAK,CAACC,UAAU,KAAK,YAAY;IACxE;MAAEL,QAAQ;MAAEL;IAAM,CAAE,GAAGT,UAAA,CAAWC,MAAM,CAACiB,KAAK,CAACC,UAAU,CACzDhB,GAAA,EACAW,QAAA,EACAV,GAAA,EAAKgB,OAAA,EACLpB,UAAA,CAAWC,MAAM,KACd;MAAEa,QAAA;MAAUL;IAAO;EAC1B;EAEA,IAAI,OAAOR,MAAA,CAAOiB,KAAK,CAACC,UAAU,KAAK,YAAY;IAC/C;MAAEL,QAAQ;MAAEL;IAAM,CAAE,GAAGR,MAAA,CAAOiB,KAAK,CAACC,UAAU,CAC9ChB,GAAA,EACAW,QAAA,EACAV,GAAA,EAAKgB,OAAA,EACLpB,UAAA,EAAYC,MAAA,KACT;MACHa,QAAA;MACAL;IACF;EACF;EAEA,OAAOF,QAAA,CAASC,IAAI,CAACM,QAAA,EAAU;IAAEH,OAAA;IAASF;EAAO;AACnD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/rest/types.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedGlobalConfig } from 'payload'\n\nexport type BaseRouteHandler = ({ req }: { req: PayloadRequest }) => Promise<Response> | Response\n\nexport type CollectionRouteHandler = ({\n collection,\n req,\n}: {\n collection: Collection\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type CollectionRouteHandlerWithID = ({\n id,\n collection,\n req,\n}: {\n collection: Collection\n id: string\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type GlobalRouteHandler = ({\n globalConfig,\n req,\n}: {\n globalConfig: SanitizedGlobalConfig\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type GlobalRouteHandlerWithID = ({\n id,\n globalConfig,\n req,\n}: {\n globalConfig: SanitizedGlobalConfig\n id: string\n req: PayloadRequest\n}) => Promise<Response> | Response\n"],"
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/routes/rest/types.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedGlobalConfig } from 'payload'\n\nexport type BaseRouteHandler = ({ req }: { req: PayloadRequest }) => Promise<Response> | Response\n\nexport type CollectionRouteHandler = ({\n collection,\n req,\n}: {\n collection: Collection\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type CollectionRouteHandlerWithID = ({\n id,\n collection,\n req,\n}: {\n collection: Collection\n id: string\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type GlobalRouteHandler = ({\n globalConfig,\n req,\n}: {\n globalConfig: SanitizedGlobalConfig\n req: PayloadRequest\n}) => Promise<Response> | Response\n\nexport type GlobalRouteHandlerWithID = ({\n id,\n globalConfig,\n req,\n}: {\n globalConfig: SanitizedGlobalConfig\n id: string\n req: PayloadRequest\n}) => Promise<Response> | Response\n"],"mappings":"AA8BA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeCollectionID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/utilities/sanitizeCollectionID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,oBAAoB,oCAAqC,IAAI,KAAG,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"sanitizeCollectionID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/utilities/sanitizeCollectionID.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,KAAK,IAAI,GAAG;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,oBAAoB,oCAAqC,IAAI,KAAG,MAAM,GAAG,MAkBrF,CAAA"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
export const sanitizeCollectionID = ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
export const sanitizeCollectionID = ({
|
|
2
|
+
id,
|
|
3
|
+
collectionSlug,
|
|
4
|
+
payload
|
|
5
|
+
}) => {
|
|
6
|
+
let sanitizedID = id;
|
|
7
|
+
const collection = payload.collections[collectionSlug];
|
|
8
|
+
// If default db ID type is a number, we should sanitize
|
|
9
|
+
let shouldSanitize = Boolean(payload.db.defaultIDType === 'number');
|
|
10
|
+
// UNLESS the customIDType for this collection is text.... then we leave it
|
|
11
|
+
if (shouldSanitize && collection.customIDType === 'text') {
|
|
12
|
+
shouldSanitize = false;
|
|
13
|
+
}
|
|
14
|
+
// If we still should sanitize, parse float
|
|
15
|
+
if (shouldSanitize) {
|
|
16
|
+
sanitizedID = parseFloat(sanitizedID);
|
|
17
|
+
}
|
|
18
|
+
return sanitizedID;
|
|
11
19
|
};
|
|
12
|
-
|
|
13
20
|
//# sourceMappingURL=sanitizeCollectionID.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/utilities/sanitizeCollectionID.ts"],"sourcesContent":["import type { Payload } from 'payload'\n\ntype Args = {\n collectionSlug: string\n id: string\n payload: Payload\n}\n\nexport const sanitizeCollectionID = ({ id, collectionSlug, payload }: Args): number | string => {\n let sanitizedID: number | string = id\n const collection = payload.collections[collectionSlug]\n\n // If default db ID type is a number, we should sanitize\n let shouldSanitize = Boolean(payload.db.defaultIDType === 'number')\n\n // UNLESS the customIDType for this collection is text.... then we leave it\n if (shouldSanitize && collection.customIDType === 'text') shouldSanitize = false\n\n // If we still should sanitize, parse float\n if (shouldSanitize) sanitizedID = parseFloat(sanitizedID)\n\n return sanitizedID\n}\n"],"
|
|
1
|
+
{"version":3,"file":"sanitizeCollectionID.js","names":["sanitizeCollectionID","id","collectionSlug","payload","sanitizedID","collection","collections","shouldSanitize","Boolean","db","defaultIDType","customIDType","parseFloat"],"sources":["../../../../src/routes/rest/utilities/sanitizeCollectionID.ts"],"sourcesContent":["import type { Payload } from 'payload'\n\ntype Args = {\n collectionSlug: string\n id: string\n payload: Payload\n}\n\nexport const sanitizeCollectionID = ({ id, collectionSlug, payload }: Args): number | string => {\n let sanitizedID: number | string = id\n const collection = payload.collections[collectionSlug]\n\n // If default db ID type is a number, we should sanitize\n let shouldSanitize = Boolean(payload.db.defaultIDType === 'number')\n\n // UNLESS the customIDType for this collection is text.... then we leave it\n if (shouldSanitize && collection.customIDType === 'text') {\n shouldSanitize = false\n }\n\n // If we still should sanitize, parse float\n if (shouldSanitize) {\n sanitizedID = parseFloat(sanitizedID)\n }\n\n return sanitizedID\n}\n"],"mappings":"AAQA,OAAO,MAAMA,oBAAA,GAAuBA,CAAC;EAAEC,EAAE;EAAEC,cAAc;EAAEC;AAAO,CAAQ;EACxE,IAAIC,WAAA,GAA+BH,EAAA;EACnC,MAAMI,UAAA,GAAaF,OAAA,CAAQG,WAAW,CAACJ,cAAA,CAAe;EAEtD;EACA,IAAIK,cAAA,GAAiBC,OAAA,CAAQL,OAAA,CAAQM,EAAE,CAACC,aAAa,KAAK;EAE1D;EACA,IAAIH,cAAA,IAAkBF,UAAA,CAAWM,YAAY,KAAK,QAAQ;IACxDJ,cAAA,GAAiB;EACnB;EAEA;EACA,IAAIA,cAAA,EAAgB;IAClBH,WAAA,GAAcQ,UAAA,CAAWR,WAAA;EAC3B;EAEA,OAAOA,WAAA;AACT","ignoreList":[]}
|
package/dist/scss/app.scss
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
@import '
|
|
1
|
+
@import 'styles';
|
|
2
2
|
@import './toasts.scss';
|
|
3
3
|
@import './colors.scss';
|
|
4
4
|
|
|
5
5
|
:root {
|
|
6
|
-
--base-px:
|
|
6
|
+
--base-px: 20;
|
|
7
7
|
--base-body-size: 13;
|
|
8
8
|
--base: calc((var(--base-px) / var(--base-body-size)) * 1rem);
|
|
9
9
|
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
--theme-baseline-body-size: #{$baseline-body-size};
|
|
22
22
|
--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
23
23
|
sans-serif;
|
|
24
|
-
--font-
|
|
24
|
+
--font-serif: 'Georgia', 'Bitstream Charter', 'Charis SIL', Utopia, 'URW Bookman L', serif;
|
|
25
|
+
--font-mono: 'SF Mono', Menlo, Consolas, Monaco, monospace;
|
|
25
26
|
|
|
26
27
|
--style-radius-s: #{$style-radius-s};
|
|
27
28
|
--style-radius-m: #{$style-radius-m};
|
|
@@ -37,19 +38,19 @@
|
|
|
37
38
|
|
|
38
39
|
--gutter-h: #{base(3)};
|
|
39
40
|
--spacing-view-bottom: var(--gutter-h);
|
|
40
|
-
--
|
|
41
|
-
--
|
|
41
|
+
--doc-controls-height: calc(var(--base) * 2.8);
|
|
42
|
+
--app-header-height: calc(var(--base) * 2.8);
|
|
42
43
|
--nav-width: 275px;
|
|
43
44
|
--nav-trans-time: 150ms;
|
|
44
45
|
|
|
45
46
|
@include mid-break {
|
|
46
47
|
--gutter-h: #{base(2)};
|
|
47
|
-
--app-header-height: calc(var(--base) * 2);
|
|
48
|
-
--doc-controls-height: calc(var(--base) * 2.
|
|
48
|
+
--app-header-height: calc(var(--base) * 2.4);
|
|
49
|
+
--doc-controls-height: calc(var(--base) * 2.4);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
@include small-break {
|
|
52
|
-
--gutter-h: #{base(0.
|
|
53
|
+
--gutter-h: #{base(0.8)};
|
|
53
54
|
--spacing-view-bottom: calc(var(--base) * 2);
|
|
54
55
|
--nav-width: 100vw;
|
|
55
56
|
}
|
|
@@ -67,12 +68,6 @@ html {
|
|
|
67
68
|
@extend %body;
|
|
68
69
|
background: var(--theme-bg);
|
|
69
70
|
-webkit-font-smoothing: antialiased;
|
|
70
|
-
opacity: 0;
|
|
71
|
-
|
|
72
|
-
&[data-theme='dark'],
|
|
73
|
-
&[data-theme='light'] {
|
|
74
|
-
opacity: initial;
|
|
75
|
-
}
|
|
76
71
|
|
|
77
72
|
&[data-theme='dark'] {
|
|
78
73
|
--theme-bg: var(--theme-elevation-0);
|
|
@@ -111,12 +106,12 @@ body {
|
|
|
111
106
|
}
|
|
112
107
|
|
|
113
108
|
::selection {
|
|
114
|
-
background: var(--
|
|
109
|
+
background: var(--color-success-250);
|
|
115
110
|
color: var(--theme-base-800);
|
|
116
111
|
}
|
|
117
112
|
|
|
118
113
|
::-moz-selection {
|
|
119
|
-
background: var(--
|
|
114
|
+
background: var(--color-success-250);
|
|
120
115
|
color: var(--theme-base-800);
|
|
121
116
|
}
|
|
122
117
|
|
|
@@ -151,13 +146,13 @@ h6 {
|
|
|
151
146
|
}
|
|
152
147
|
|
|
153
148
|
p {
|
|
154
|
-
margin: 0
|
|
149
|
+
margin: 0;
|
|
155
150
|
}
|
|
156
151
|
|
|
157
152
|
ul,
|
|
158
153
|
ol {
|
|
159
154
|
padding-left: $baseline;
|
|
160
|
-
margin: 0
|
|
155
|
+
margin: 0;
|
|
161
156
|
}
|
|
162
157
|
|
|
163
158
|
:focus-visible {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
@import 'vars';
|
|
2
|
+
@import 'queries';
|
|
3
|
+
|
|
4
|
+
.Toastify {
|
|
5
|
+
.Toastify__toast-container {
|
|
6
|
+
left: base(5);
|
|
7
|
+
transform: none;
|
|
8
|
+
right: base(5);
|
|
9
|
+
width: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.Toastify__toast {
|
|
13
|
+
padding: base(0.5);
|
|
14
|
+
border-radius: $style-radius-m;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.Toastify__close-button {
|
|
19
|
+
align-self: center;
|
|
20
|
+
opacity: 0.7;
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
opacity: 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.Toastify__toast--success {
|
|
28
|
+
color: var(--color-success-900);
|
|
29
|
+
background: var(--color-success-500);
|
|
30
|
+
|
|
31
|
+
.Toastify__progress-bar {
|
|
32
|
+
background-color: var(--color-success-900);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.Toastify__close-button--success {
|
|
37
|
+
color: var(--color-success-900);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.Toastify__toast--error {
|
|
41
|
+
background: var(--theme-error-500);
|
|
42
|
+
color: #fff;
|
|
43
|
+
|
|
44
|
+
.Toastify__progress-bar {
|
|
45
|
+
background-color: #fff;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.Toastify__close-button--light {
|
|
50
|
+
color: inherit;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@include mid-break {
|
|
54
|
+
.Toastify__toast-container {
|
|
55
|
+
left: $baseline;
|
|
56
|
+
right: $baseline;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/scss/toasts.scss
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
|
+
@import './styles.scss';
|
|
2
|
+
|
|
1
3
|
.payload-toast-container {
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
|
|
2
7
|
.payload-toast-close-button {
|
|
8
|
+
position: absolute;
|
|
9
|
+
order: 3;
|
|
3
10
|
left: unset;
|
|
4
|
-
|
|
5
|
-
top:
|
|
6
|
-
|
|
11
|
+
inset-inline-end: base(0.8);
|
|
12
|
+
top: 50%;
|
|
13
|
+
transform: translateY(-50%);
|
|
14
|
+
color: var(--theme-elevation-600);
|
|
7
15
|
background: unset;
|
|
8
16
|
border: none;
|
|
9
|
-
display: flex;
|
|
10
|
-
width: 1.25rem;
|
|
11
|
-
height: 1.25rem;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
svg {
|
|
19
|
+
width: base(0.8);
|
|
20
|
+
height: base(0.8);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
&:hover {
|
|
24
|
+
color: var(--theme-elevation-250);
|
|
25
|
+
background: none;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
[dir='RTL'] & {
|
|
@@ -27,16 +31,21 @@
|
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
33
|
|
|
34
|
+
.toast-title {
|
|
35
|
+
line-height: base(1);
|
|
36
|
+
margin-right: base(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
.payload-toast-item {
|
|
31
|
-
padding:
|
|
32
|
-
color: var(--theme-
|
|
40
|
+
padding: base(0.8);
|
|
41
|
+
color: var(--theme-elevation-800);
|
|
33
42
|
font-style: normal;
|
|
34
43
|
font-weight: 600;
|
|
35
44
|
display: flex;
|
|
36
45
|
gap: 1rem;
|
|
37
46
|
align-items: center;
|
|
38
47
|
width: 100%;
|
|
39
|
-
border-radius:
|
|
48
|
+
border-radius: 4px;
|
|
40
49
|
border: 1px solid var(--theme-border-color);
|
|
41
50
|
background: var(--theme-input-bg);
|
|
42
51
|
box-shadow:
|
|
@@ -45,6 +54,7 @@
|
|
|
45
54
|
|
|
46
55
|
.toast-content {
|
|
47
56
|
transition: opacity 100ms cubic-bezier(0.55, 0.055, 0.675, 0.19);
|
|
57
|
+
width: 100%;
|
|
48
58
|
}
|
|
49
59
|
|
|
50
60
|
&[data-front='false'] {
|
|
@@ -60,51 +70,72 @@
|
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
.toast-icon {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
width: base(0.8);
|
|
74
|
+
height: base(0.8);
|
|
75
|
+
margin: 0;
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
|
|
80
|
+
& > * {
|
|
81
|
+
width: base(1.2);
|
|
82
|
+
height: base(1.2);
|
|
66
83
|
}
|
|
67
84
|
}
|
|
68
85
|
|
|
69
86
|
&.toast-warning {
|
|
70
|
-
|
|
87
|
+
color: var(--theme-warning-800);
|
|
88
|
+
border-color: var(--theme-warning-250);
|
|
71
89
|
background-color: var(--theme-warning-100);
|
|
90
|
+
|
|
91
|
+
.payload-toast-close-button {
|
|
92
|
+
color: var(--theme-warning-600);
|
|
93
|
+
|
|
94
|
+
&:hover {
|
|
95
|
+
color: var(--theme-warning-250);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
72
98
|
}
|
|
73
99
|
|
|
74
100
|
&.toast-error {
|
|
75
|
-
|
|
76
|
-
|
|
101
|
+
color: var(--theme-error-800);
|
|
102
|
+
border-color: var(--theme-error-250);
|
|
103
|
+
background-color: var(--theme-error-100);
|
|
104
|
+
|
|
105
|
+
.payload-toast-close-button {
|
|
106
|
+
color: var(--theme-error-600);
|
|
107
|
+
|
|
108
|
+
&:hover {
|
|
109
|
+
color: var(--theme-error-250);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
77
112
|
}
|
|
78
113
|
|
|
79
114
|
&.toast-success {
|
|
80
|
-
|
|
115
|
+
color: var(--theme-success-800);
|
|
116
|
+
border-color: var(--theme-success-250);
|
|
81
117
|
background-color: var(--theme-success-100);
|
|
118
|
+
|
|
119
|
+
.payload-toast-close-button {
|
|
120
|
+
color: var(--theme-success-600);
|
|
121
|
+
|
|
122
|
+
&:hover {
|
|
123
|
+
color: var(--theme-success-250);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
82
126
|
}
|
|
83
127
|
|
|
84
128
|
&.toast-info {
|
|
129
|
+
color: var(--theme-elevation-800);
|
|
85
130
|
border-color: var(--theme-elevation-250);
|
|
86
131
|
background-color: var(--theme-elevation-100);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
[data-theme='light'] & {
|
|
90
|
-
&.toast-warning {
|
|
91
|
-
border-color: var(--theme-warning-550);
|
|
92
|
-
background-color: var(--theme-warning-100);
|
|
93
|
-
}
|
|
94
132
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
background-color: var(--theme-error-50);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
&.toast-success {
|
|
101
|
-
border-color: var(--theme-success-550);
|
|
102
|
-
background-color: var(--theme-success-50);
|
|
103
|
-
}
|
|
133
|
+
.payload-toast-close-button {
|
|
134
|
+
color: var(--theme-elevation-600);
|
|
104
135
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
136
|
+
&:hover {
|
|
137
|
+
color: var(--theme-elevation-250);
|
|
138
|
+
}
|
|
108
139
|
}
|
|
109
140
|
}
|
|
110
141
|
}
|