@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
|
@@ -6,114 +6,120 @@ import { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest
|
|
|
6
6
|
import { createPayloadRequest } from '../../utilities/createPayloadRequest.js';
|
|
7
7
|
import { headersWithCors } from '../../utilities/headersWithCors.js';
|
|
8
8
|
import { mergeHeaders } from '../../utilities/mergeHeaders.js';
|
|
9
|
-
const handleError = async (payload, err, debug, afterErrorHook)=>{
|
|
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
|
-
|
|
9
|
+
const handleError = async (payload, err, debug, afterErrorHook) => {
|
|
10
|
+
const status = err.originalError.status || httpStatus.INTERNAL_SERVER_ERROR;
|
|
11
|
+
let errorMessage = err.message;
|
|
12
|
+
payload.logger.error(err.stack);
|
|
13
|
+
// Internal server errors can contain anything, including potentially sensitive data.
|
|
14
|
+
// Therefore, error details will be hidden from the response unless `config.debug` is `true`
|
|
15
|
+
if (!debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
|
|
16
|
+
errorMessage = 'Something went wrong.';
|
|
17
|
+
}
|
|
18
|
+
let response = {
|
|
19
|
+
extensions: {
|
|
20
|
+
name: err?.originalError?.name || undefined,
|
|
21
|
+
data: err && err.originalError && err.originalError.data || undefined,
|
|
22
|
+
stack: debug ? err.stack : undefined,
|
|
23
|
+
statusCode: status
|
|
24
|
+
},
|
|
25
|
+
locations: err.locations,
|
|
26
|
+
message: errorMessage,
|
|
27
|
+
path: err.path
|
|
28
|
+
};
|
|
29
|
+
if (afterErrorHook) {
|
|
30
|
+
({
|
|
31
|
+
response
|
|
32
|
+
} = afterErrorHook(err, response, null, null) || {
|
|
33
|
+
response
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return response;
|
|
35
37
|
};
|
|
36
38
|
let cached = global._payload_graphql;
|
|
37
39
|
if (!cached) {
|
|
40
|
+
cached = global._payload_graphql = {
|
|
41
|
+
graphql: null,
|
|
42
|
+
promise: null
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export const getGraphql = async config => {
|
|
46
|
+
if (process.env.NODE_ENV === 'development') {
|
|
38
47
|
cached = global._payload_graphql = {
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
graphql: null,
|
|
49
|
+
promise: null
|
|
41
50
|
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (process.env.NODE_ENV === 'development') {
|
|
45
|
-
cached = global._payload_graphql = {
|
|
46
|
-
graphql: null,
|
|
47
|
-
promise: null
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (cached.graphql) {
|
|
51
|
-
return cached.graphql;
|
|
52
|
-
}
|
|
53
|
-
if (!cached.promise) {
|
|
54
|
-
const resolvedConfig = await config;
|
|
55
|
-
cached.promise = new Promise((resolve)=>{
|
|
56
|
-
const schema = configToSchema(resolvedConfig);
|
|
57
|
-
resolve(cached.graphql || schema);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
try {
|
|
61
|
-
cached.graphql = await cached.promise;
|
|
62
|
-
} catch (e) {
|
|
63
|
-
cached.promise = null;
|
|
64
|
-
throw e;
|
|
65
|
-
}
|
|
51
|
+
}
|
|
52
|
+
if (cached.graphql) {
|
|
66
53
|
return cached.graphql;
|
|
54
|
+
}
|
|
55
|
+
if (!cached.promise) {
|
|
56
|
+
const resolvedConfig = await config;
|
|
57
|
+
cached.promise = new Promise(resolve => {
|
|
58
|
+
const schema = configToSchema(resolvedConfig);
|
|
59
|
+
resolve(cached.graphql || schema);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
cached.graphql = await cached.promise;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
cached.promise = null;
|
|
66
|
+
throw e;
|
|
67
|
+
}
|
|
68
|
+
return cached.graphql;
|
|
69
|
+
};
|
|
70
|
+
export const POST = config => async request => {
|
|
71
|
+
const originalRequest = request.clone();
|
|
72
|
+
const req = await createPayloadRequest({
|
|
73
|
+
config,
|
|
74
|
+
request
|
|
75
|
+
});
|
|
76
|
+
await addDataAndFileToRequest(req);
|
|
77
|
+
addLocalesToRequestFromData(req);
|
|
78
|
+
const {
|
|
79
|
+
schema,
|
|
80
|
+
validationRules
|
|
81
|
+
} = await getGraphql(config);
|
|
82
|
+
const {
|
|
83
|
+
payload
|
|
84
|
+
} = req;
|
|
85
|
+
const afterErrorHook = typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null;
|
|
86
|
+
const headers = {};
|
|
87
|
+
const apiResponse = await createHandler({
|
|
88
|
+
context: {
|
|
89
|
+
headers,
|
|
90
|
+
req
|
|
91
|
+
},
|
|
92
|
+
onOperation: async (request, args, result) => {
|
|
93
|
+
const response = typeof payload.extensions === 'function' ? await payload.extensions({
|
|
94
|
+
args,
|
|
95
|
+
req: request,
|
|
96
|
+
result
|
|
97
|
+
}) : result;
|
|
98
|
+
if (response.errors) {
|
|
99
|
+
const errors = await Promise.all(result.errors.map(error => {
|
|
100
|
+
return handleError(payload, error, payload.config.debug, afterErrorHook);
|
|
101
|
+
}));
|
|
102
|
+
// errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult
|
|
103
|
+
return {
|
|
104
|
+
...response,
|
|
105
|
+
errors
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
return response;
|
|
109
|
+
},
|
|
110
|
+
schema,
|
|
111
|
+
validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args))
|
|
112
|
+
})(originalRequest);
|
|
113
|
+
const resHeaders = headersWithCors({
|
|
114
|
+
headers: new Headers(apiResponse.headers),
|
|
115
|
+
req
|
|
116
|
+
});
|
|
117
|
+
for (const key in headers) {
|
|
118
|
+
resHeaders.append(key, headers[key]);
|
|
119
|
+
}
|
|
120
|
+
return new Response(apiResponse.body, {
|
|
121
|
+
headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,
|
|
122
|
+
status: apiResponse.status
|
|
123
|
+
});
|
|
67
124
|
};
|
|
68
|
-
export const POST = (config)=>async (request)=>{
|
|
69
|
-
const originalRequest = request.clone();
|
|
70
|
-
const req = await createPayloadRequest({
|
|
71
|
-
config,
|
|
72
|
-
request
|
|
73
|
-
});
|
|
74
|
-
await addDataAndFileToRequest(req);
|
|
75
|
-
addLocalesToRequestFromData(req);
|
|
76
|
-
const { schema, validationRules } = await getGraphql(config);
|
|
77
|
-
const { payload } = req;
|
|
78
|
-
const afterErrorHook = typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null;
|
|
79
|
-
const headers = {};
|
|
80
|
-
const apiResponse = await createHandler({
|
|
81
|
-
context: {
|
|
82
|
-
headers,
|
|
83
|
-
req
|
|
84
|
-
},
|
|
85
|
-
onOperation: async (request, args, result)=>{
|
|
86
|
-
const response = typeof payload.extensions === 'function' ? await payload.extensions({
|
|
87
|
-
args,
|
|
88
|
-
req: request,
|
|
89
|
-
result
|
|
90
|
-
}) : result;
|
|
91
|
-
if (response.errors) {
|
|
92
|
-
const errors = await Promise.all(result.errors.map((error)=>{
|
|
93
|
-
return handleError(payload, error, payload.config.debug, afterErrorHook);
|
|
94
|
-
}));
|
|
95
|
-
// errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult
|
|
96
|
-
return {
|
|
97
|
-
...response,
|
|
98
|
-
errors
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return response;
|
|
102
|
-
},
|
|
103
|
-
schema,
|
|
104
|
-
validationRules: (_, args, defaultRules)=>defaultRules.concat(validationRules(args))
|
|
105
|
-
})(originalRequest);
|
|
106
|
-
const resHeaders = headersWithCors({
|
|
107
|
-
headers: new Headers(apiResponse.headers),
|
|
108
|
-
req
|
|
109
|
-
});
|
|
110
|
-
for(const key in headers){
|
|
111
|
-
resHeaders.append(key, headers[key]);
|
|
112
|
-
}
|
|
113
|
-
return new Response(apiResponse.body, {
|
|
114
|
-
headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,
|
|
115
|
-
status: apiResponse.status
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
|
|
119
125
|
//# sourceMappingURL=handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { CollectionAfterErrorHook, Payload, SanitizedConfig } from 'payload'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport httpStatus from 'http-status'\n\nimport { addDataAndFileToRequest } from '../../utilities/addDataAndFileToRequest.js'\nimport { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest.js'\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { mergeHeaders } from '../../utilities/mergeHeaders.js'\n\nconst handleError = async (\n payload: Payload,\n err: any,\n debug: boolean,\n afterErrorHook: CollectionAfterErrorHook,\n // eslint-disable-next-line @typescript-eslint/require-await\n): Promise<GraphQLFormattedError> => {\n const status = err.originalError.status || httpStatus.INTERNAL_SERVER_ERROR\n let errorMessage = err.message\n payload.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 (!debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: GraphQLFormattedError = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && err.originalError.data) || undefined,\n stack: debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n if (afterErrorHook) {\n ;({ response } = afterErrorHook(err, response, null, null) || { response })\n }\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n cached = global._payload_graphql = { graphql: null, promise: null }\n}\n\nexport const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = global._payload_graphql = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\nexport const POST =\n (config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {\n const originalRequest = request.clone()\n const req = await createPayloadRequest({\n config,\n request,\n })\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = req\n\n const afterErrorHook =\n typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null\n\n const headers = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (request, args, result) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: request,\n result,\n })\n : result\n if (response.errors) {\n const errors = (await Promise.all(\n result.errors.map((error) => {\n return handleError(payload, error, payload.config.debug, afterErrorHook)\n }),\n )) as GraphQLError[]\n // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n }\n"],"
|
|
1
|
+
{"version":3,"file":"handler.js","names":["configToSchema","createHandler","httpStatus","addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","mergeHeaders","handleError","payload","err","debug","afterErrorHook","status","originalError","INTERNAL_SERVER_ERROR","errorMessage","message","logger","error","stack","response","extensions","name","undefined","data","statusCode","locations","path","cached","global","_payload_graphql","graphql","promise","getGraphql","config","process","env","NODE_ENV","resolvedConfig","Promise","resolve","schema","e","POST","request","originalRequest","clone","req","validationRules","hooks","afterError","headers","apiResponse","context","onOperation","args","result","errors","all","map","_","defaultRules","concat","resHeaders","Headers","key","append","Response","body","responseHeaders"],"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { CollectionAfterErrorHook, Payload, SanitizedConfig } from 'payload'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport httpStatus from 'http-status'\n\nimport { addDataAndFileToRequest } from '../../utilities/addDataAndFileToRequest.js'\nimport { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest.js'\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { mergeHeaders } from '../../utilities/mergeHeaders.js'\n\nconst handleError = async (\n payload: Payload,\n err: any,\n debug: boolean,\n afterErrorHook: CollectionAfterErrorHook,\n // eslint-disable-next-line @typescript-eslint/require-await\n): Promise<GraphQLFormattedError> => {\n const status = err.originalError.status || httpStatus.INTERNAL_SERVER_ERROR\n let errorMessage = err.message\n payload.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 (!debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: GraphQLFormattedError = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && err.originalError.data) || undefined,\n stack: debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n if (afterErrorHook) {\n ;({ response } = afterErrorHook(err, response, null, null) || { response })\n }\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n cached = global._payload_graphql = { graphql: null, promise: null }\n}\n\nexport const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = global._payload_graphql = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\nexport const POST =\n (config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {\n const originalRequest = request.clone()\n const req = await createPayloadRequest({\n config,\n request,\n })\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = req\n\n const afterErrorHook =\n typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null\n\n const headers = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (request, args, result) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: request,\n result,\n })\n : result\n if (response.errors) {\n const errors = (await Promise.all(\n result.errors.map((error) => {\n return handleError(payload, error, payload.config.debug, afterErrorHook)\n }),\n )) as GraphQLError[]\n // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n }\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/graphql/index.ts"],"sourcesContent":["export { POST as GRAPHQL_POST } from './handler.js'\n\nexport { GET as GRAPHQL_PLAYGROUND_GET } from './playground.js'\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["POST","GRAPHQL_POST","GET","GRAPHQL_PLAYGROUND_GET"],"sources":["../../../src/routes/graphql/index.ts"],"sourcesContent":["export { POST as GRAPHQL_POST } from './handler.js'\n\nexport { GET as GRAPHQL_PLAYGROUND_GET } from './playground.js'\n"],"mappings":"AAAA,SAASA,IAAA,IAAQC,YAAY,QAAQ;AAErC,SAASC,GAAA,IAAOC,sBAAsB,QAAQ","ignoreList":[]}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { renderPlaygroundPage } from 'graphql-playground-html';
|
|
2
2
|
import { createPayloadRequest } from '../../utilities/createPayloadRequest.js';
|
|
3
|
-
export const GET =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
3
|
+
export const GET = config => async request => {
|
|
4
|
+
const req = await createPayloadRequest({
|
|
5
|
+
config,
|
|
6
|
+
request
|
|
7
|
+
});
|
|
8
|
+
if (!req.payload.config.graphQL.disable && !req.payload.config.graphQL.disablePlaygroundInProduction && process.env.NODE_ENV === 'production' || process.env.NODE_ENV !== 'production') {
|
|
9
|
+
return new Response(renderPlaygroundPage({
|
|
10
|
+
endpoint: `${req.payload.config.routes.api}${req.payload.config.routes.graphQL}`,
|
|
11
|
+
settings: {
|
|
12
|
+
'request.credentials': 'include'
|
|
13
|
+
}
|
|
14
|
+
}), {
|
|
15
|
+
headers: {
|
|
16
|
+
'Content-Type': 'text/html'
|
|
17
|
+
},
|
|
18
|
+
status: 200
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
return new Response('Route Not Found', {
|
|
22
|
+
status: 404
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
27
26
|
//# sourceMappingURL=playground.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/routes/graphql/playground.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { renderPlaygroundPage } from 'graphql-playground-html'\n\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\n\nexport const GET = (config: Promise<SanitizedConfig>) => async (request: Request) => {\n const req = await createPayloadRequest({\n config,\n request,\n })\n\n if (\n (!req.payload.config.graphQL.disable &&\n !req.payload.config.graphQL.disablePlaygroundInProduction &&\n process.env.NODE_ENV === 'production') ||\n process.env.NODE_ENV !== 'production'\n ) {\n return new Response(\n renderPlaygroundPage({\n endpoint: `${req.payload.config.routes.api}${req.payload.config.routes.graphQL}`,\n settings: {\n 'request.credentials': 'include',\n },\n }),\n {\n headers: {\n 'Content-Type': 'text/html',\n },\n status: 200,\n },\n )\n } else {\n return new Response('Route Not Found', { status: 404 })\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"playground.js","names":["renderPlaygroundPage","createPayloadRequest","GET","config","request","req","payload","graphQL","disable","disablePlaygroundInProduction","process","env","NODE_ENV","Response","endpoint","routes","api","settings","headers","status"],"sources":["../../../src/routes/graphql/playground.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport { renderPlaygroundPage } from 'graphql-playground-html'\n\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\n\nexport const GET = (config: Promise<SanitizedConfig>) => async (request: Request) => {\n const req = await createPayloadRequest({\n config,\n request,\n })\n\n if (\n (!req.payload.config.graphQL.disable &&\n !req.payload.config.graphQL.disablePlaygroundInProduction &&\n process.env.NODE_ENV === 'production') ||\n process.env.NODE_ENV !== 'production'\n ) {\n return new Response(\n renderPlaygroundPage({\n endpoint: `${req.payload.config.routes.api}${req.payload.config.routes.graphQL}`,\n settings: {\n 'request.credentials': 'include',\n },\n }),\n {\n headers: {\n 'Content-Type': 'text/html',\n },\n status: 200,\n },\n )\n } else {\n return new Response('Route Not Found', { status: 404 })\n }\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ;AAErC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,GAAA,GAAOC,MAAA,IAAqC,MAAOC,OAAA;EAC9D,MAAMC,GAAA,GAAM,MAAMJ,oBAAA,CAAqB;IACrCE,MAAA;IACAC;EACF;EAEA,IACE,CAAEC,GAAA,CAAIC,OAAO,CAACH,MAAM,CAACI,OAAO,CAACC,OAAO,IAClC,CAACH,GAAA,CAAIC,OAAO,CAACH,MAAM,CAACI,OAAO,CAACE,6BAA6B,IACzDC,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,gBAC3BF,OAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,cACzB;IACA,OAAO,IAAIC,QAAA,CACTb,oBAAA,CAAqB;MACnBc,QAAA,EAAU,GAAGT,GAAA,CAAIC,OAAO,CAACH,MAAM,CAACY,MAAM,CAACC,GAAG,GAAGX,GAAA,CAAIC,OAAO,CAACH,MAAM,CAACY,MAAM,CAACR,OAAO,EAAE;MAChFU,QAAA,EAAU;QACR,uBAAuB;MACzB;IACF,IACA;MACEC,OAAA,EAAS;QACP,gBAAgB;MAClB;MACAC,MAAA,EAAQ;IACV;EAEJ,OAAO;IACL,OAAO,IAAIN,QAAA,CAAS,mBAAmB;MAAEM,MAAA,EAAQ;IAAI;EACvD;AACF","ignoreList":[]}
|
package/dist/routes/index.js
CHANGED
package/dist/routes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/routes/index.ts"],"sourcesContent":["export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from './graphql/index.js'\n\nexport {\n DELETE as REST_DELETE,\n GET as REST_GET,\n OPTIONS as REST_OPTIONS,\n PATCH as REST_PATCH,\n POST as REST_POST,\n} from './rest/index.js'\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["GRAPHQL_PLAYGROUND_GET","GRAPHQL_POST","DELETE","REST_DELETE","GET","REST_GET","OPTIONS","REST_OPTIONS","PATCH","REST_PATCH","POST","REST_POST"],"sources":["../../src/routes/index.ts"],"sourcesContent":["export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from './graphql/index.js'\n\nexport {\n DELETE as REST_DELETE,\n GET as REST_GET,\n OPTIONS as REST_OPTIONS,\n PATCH as REST_PATCH,\n POST as REST_POST,\n} from './rest/index.js'\n"],"mappings":"AAAA,SAASA,sBAAsB,EAAEC,YAAY,QAAQ;AAErD,SACEC,MAAA,IAAUC,WAAW,EACrBC,GAAA,IAAOC,QAAQ,EACfC,OAAA,IAAWC,YAAY,EACvBC,KAAA,IAASC,UAAU,EACnBC,IAAA,IAAQC,SAAS,QACZ","ignoreList":[]}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
2
|
import { accessOperation } from 'payload';
|
|
3
3
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const access = async ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export const access = async ({
|
|
5
|
+
req
|
|
6
|
+
}) => {
|
|
7
|
+
const headers = headersWithCors({
|
|
8
|
+
headers: new Headers(),
|
|
9
|
+
req
|
|
10
|
+
});
|
|
11
|
+
try {
|
|
12
|
+
const results = await accessOperation({
|
|
13
|
+
req
|
|
8
14
|
});
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
headers,
|
|
22
|
-
status: httpStatus.INTERNAL_SERVER_ERROR
|
|
23
|
-
});
|
|
24
|
-
}
|
|
15
|
+
return Response.json(results, {
|
|
16
|
+
headers,
|
|
17
|
+
status: httpStatus.OK
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return Response.json({
|
|
21
|
+
error: e
|
|
22
|
+
}, {
|
|
23
|
+
headers,
|
|
24
|
+
status: httpStatus.INTERNAL_SERVER_ERROR
|
|
25
|
+
});
|
|
26
|
+
}
|
|
25
27
|
};
|
|
26
|
-
|
|
27
28
|
//# sourceMappingURL=access.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/auth/access.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { accessOperation } from 'payload'\n\nimport type { BaseRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const access: BaseRouteHandler = async ({ req }) => {\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n try {\n const results = await accessOperation({\n req,\n })\n\n return Response.json(results, {\n headers,\n status: httpStatus.OK,\n })\n } catch (e: unknown) {\n return Response.json(\n {\n error: e,\n },\n {\n headers,\n status: httpStatus.INTERNAL_SERVER_ERROR,\n },\n )\n }\n}\n"],"
|
|
1
|
+
{"version":3,"file":"access.js","names":["httpStatus","accessOperation","headersWithCors","access","req","headers","Headers","results","Response","json","status","OK","e","error","INTERNAL_SERVER_ERROR"],"sources":["../../../../src/routes/rest/auth/access.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { accessOperation } from 'payload'\n\nimport type { BaseRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const access: BaseRouteHandler = async ({ req }) => {\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n try {\n const results = await accessOperation({\n req,\n })\n\n return Response.json(results, {\n headers,\n status: httpStatus.OK,\n })\n } catch (e: unknown) {\n return Response.json(\n {\n error: e,\n },\n {\n headers,\n status: httpStatus.INTERNAL_SERVER_ERROR,\n },\n )\n }\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAIhC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAA2B,MAAAA,CAAO;EAAEC;AAAG,CAAE;EACpD,MAAMC,OAAA,GAAUH,eAAA,CAAgB;IAC9BG,OAAA,EAAS,IAAIC,OAAA;IACbF;EACF;EAEA,IAAI;IACF,MAAMG,OAAA,GAAU,MAAMN,eAAA,CAAgB;MACpCG;IACF;IAEA,OAAOI,QAAA,CAASC,IAAI,CAACF,OAAA,EAAS;MAC5BF,OAAA;MACAK,MAAA,EAAQV,UAAA,CAAWW;IACrB;EACF,EAAE,OAAOC,CAAA,EAAY;IACnB,OAAOJ,QAAA,CAASC,IAAI,CAClB;MACEI,KAAA,EAAOD;IACT,GACA;MACEP,OAAA;MACAK,MAAA,EAAQV,UAAA,CAAWc;IACrB;EAEJ;AACF","ignoreList":[]}
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
2
|
import { forgotPasswordOperation } from 'payload';
|
|
3
3
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const forgotPassword = async ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
export const forgotPassword = async ({
|
|
5
|
+
collection,
|
|
6
|
+
req
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
t
|
|
10
|
+
} = req;
|
|
11
|
+
const authData = collection.config.auth?.loginWithUsername ? {
|
|
12
|
+
email: typeof req.data?.email === 'string' ? req.data.email : '',
|
|
13
|
+
username: typeof req.data?.username === 'string' ? req.data.username : ''
|
|
14
|
+
} : {
|
|
15
|
+
email: typeof req.data?.email === 'string' ? req.data.email : ''
|
|
16
|
+
};
|
|
17
|
+
await forgotPasswordOperation({
|
|
18
|
+
collection,
|
|
19
|
+
data: authData,
|
|
20
|
+
disableEmail: Boolean(req.data?.disableEmail),
|
|
21
|
+
expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,
|
|
22
|
+
req
|
|
23
|
+
});
|
|
24
|
+
return Response.json({
|
|
25
|
+
message: t('general:success')
|
|
26
|
+
}, {
|
|
27
|
+
headers: headersWithCors({
|
|
28
|
+
headers: new Headers(),
|
|
29
|
+
req
|
|
30
|
+
}),
|
|
31
|
+
status: httpStatus.OK
|
|
32
|
+
});
|
|
28
33
|
};
|
|
29
|
-
|
|
30
34
|
//# sourceMappingURL=forgotPassword.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { forgotPasswordOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const forgotPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n const authData = collection.config.auth?.loginWithUsername\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n }\n\n await forgotPasswordOperation({\n collection,\n data: authData,\n disableEmail: Boolean(req.data?.disableEmail),\n expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"forgotPassword.js","names":["httpStatus","forgotPasswordOperation","headersWithCors","forgotPassword","collection","req","t","authData","config","auth","loginWithUsername","email","data","username","disableEmail","Boolean","expiration","undefined","Response","json","message","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { forgotPasswordOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const forgotPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n const authData = collection.config.auth?.loginWithUsername\n ? {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n username: typeof req.data?.username === 'string' ? req.data.username : '',\n }\n : {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n }\n\n await forgotPasswordOperation({\n collection,\n data: authData,\n disableEmail: Boolean(req.data?.disableEmail),\n expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\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;AAIxC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,cAAA,GAAyC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC9E,MAAM;IAAEC;EAAC,CAAE,GAAGD,GAAA;EACd,MAAME,QAAA,GAAWH,UAAA,CAAWI,MAAM,CAACC,IAAI,EAAEC,iBAAA,GACrC;IACEC,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;IAC9DE,QAAA,EAAU,OAAOR,GAAA,CAAIO,IAAI,EAAEC,QAAA,KAAa,WAAWR,GAAA,CAAIO,IAAI,CAACC,QAAQ,GAAG;EACzE,IACA;IACEF,KAAA,EAAO,OAAON,GAAA,CAAIO,IAAI,EAAED,KAAA,KAAU,WAAWN,GAAA,CAAIO,IAAI,CAACD,KAAK,GAAG;EAChE;EAEJ,MAAMV,uBAAA,CAAwB;IAC5BG,UAAA;IACAQ,IAAA,EAAML,QAAA;IACNO,YAAA,EAAcC,OAAA,CAAQV,GAAA,CAAIO,IAAI,EAAEE,YAAA;IAChCE,UAAA,EAAY,OAAOX,GAAA,CAAIO,IAAI,CAACI,UAAU,KAAK,WAAWX,GAAA,CAAIO,IAAI,CAACI,UAAU,GAAGC,SAAA;IAC5EZ;EACF;EAEA,OAAOa,QAAA,CAASC,IAAI,CAClB;IACEC,OAAA,EAASd,CAAA,CAAE;EACb,GACA;IACEe,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { initOperation } from 'payload';
|
|
2
2
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
3
|
-
export const init = async ({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
export const init = async ({
|
|
4
|
+
collection,
|
|
5
|
+
req
|
|
6
|
+
}) => {
|
|
7
|
+
const initialized = await initOperation({
|
|
8
|
+
collection: collection.config.slug,
|
|
9
|
+
req
|
|
10
|
+
});
|
|
11
|
+
return Response.json({
|
|
12
|
+
initialized
|
|
13
|
+
}, {
|
|
14
|
+
headers: headersWithCors({
|
|
15
|
+
headers: new Headers(),
|
|
16
|
+
req
|
|
17
|
+
})
|
|
18
|
+
});
|
|
16
19
|
};
|
|
17
|
-
|
|
18
20
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/routes/rest/auth/init.ts"],"sourcesContent":["import { initOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const init: CollectionRouteHandler = async ({ collection, req }) => {\n const initialized = await initOperation({\n collection: collection.config.slug,\n req,\n })\n\n return Response.json(\n { initialized },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n },\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"init.js","names":["initOperation","headersWithCors","init","collection","req","initialized","config","slug","Response","json","headers","Headers"],"sources":["../../../../src/routes/rest/auth/init.ts"],"sourcesContent":["import { initOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const init: CollectionRouteHandler = async ({ collection, req }) => {\n const initialized = await initOperation({\n collection: collection.config.slug,\n req,\n })\n\n return Response.json(\n { initialized },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n },\n )\n}\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ;AAI9B,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAMC,WAAA,GAAc,MAAML,aAAA,CAAc;IACtCG,UAAA,EAAYA,UAAA,CAAWG,MAAM,CAACC,IAAI;IAClCH;EACF;EAEA,OAAOI,QAAA,CAASC,IAAI,CAClB;IAAEJ;EAAY,GACd;IACEK,OAAA,EAAST,eAAA,CAAgB;MACvBS,OAAA,EAAS,IAAIC,OAAA;MACbP;IACF;EACF;AAEJ","ignoreList":[]}
|