@payloadcms/next 3.0.0-canary.a5aaf21 → 3.0.0-canary.a6e7305
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.cjs +156 -0
- package/dist/cjs/withPayload.cjs.map +1 -0
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +1 -0
- package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +70 -68
- package/dist/elements/DocumentHeader/Tabs/index.scss +41 -39
- package/dist/elements/DocumentHeader/index.scss +44 -42
- package/dist/elements/DocumentLocked/index.d.ts +1 -1
- package/dist/elements/DocumentLocked/index.d.ts.map +1 -1
- package/dist/elements/DocumentLocked/index.js +24 -14
- package/dist/elements/DocumentLocked/index.js.map +1 -1
- package/dist/elements/DocumentLocked/index.scss +29 -26
- package/dist/elements/DocumentTakeOver/index.scss +28 -26
- package/dist/elements/FormHeader/index.d.ts +9 -0
- package/dist/elements/FormHeader/index.d.ts.map +1 -0
- package/dist/elements/FormHeader/index.js +20 -0
- package/dist/elements/FormHeader/index.js.map +1 -0
- package/dist/elements/FormHeader/index.scss +8 -0
- package/dist/elements/LeaveWithoutSaving/index.scss +28 -26
- package/dist/elements/Nav/NavWrapper/index.scss +20 -18
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +1 -0
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.scss +127 -125
- package/dist/exports/routes.d.ts +1 -1
- package/dist/exports/routes.d.ts.map +1 -1
- package/dist/exports/routes.js +1 -1
- package/dist/exports/routes.js.map +1 -1
- package/dist/exports/utilities.d.ts +1 -0
- package/dist/exports/utilities.d.ts.map +1 -1
- package/dist/exports/utilities.js +1 -0
- package/dist/exports/utilities.js.map +1 -1
- package/dist/layouts/Root/index.js +6 -6
- 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 +23 -11
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/rest/auth/login.js +2 -2
- package/dist/routes/rest/auth/login.js.map +1 -1
- package/dist/routes/rest/auth/logout.d.ts.map +1 -1
- package/dist/routes/rest/auth/logout.js +3 -2
- package/dist/routes/rest/auth/logout.js.map +1 -1
- package/dist/routes/rest/auth/refresh.js +2 -2
- package/dist/routes/rest/auth/refresh.js.map +1 -1
- package/dist/routes/rest/auth/registerFirstUser.js +2 -2
- package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
- package/dist/routes/rest/auth/resetPassword.js +2 -2
- package/dist/routes/rest/auth/resetPassword.js.map +1 -1
- package/dist/routes/rest/collections/create.d.ts.map +1 -1
- package/dist/routes/rest/collections/create.js +5 -1
- package/dist/routes/rest/collections/create.js.map +1 -1
- package/dist/routes/rest/collections/delete.d.ts.map +1 -1
- package/dist/routes/rest/collections/delete.js +8 -0
- package/dist/routes/rest/collections/delete.js.map +1 -1
- package/dist/routes/rest/collections/deleteByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/deleteByID.js +7 -1
- package/dist/routes/rest/collections/deleteByID.js.map +1 -1
- package/dist/routes/rest/collections/duplicate.d.ts.map +1 -1
- package/dist/routes/rest/collections/duplicate.js +5 -1
- package/dist/routes/rest/collections/duplicate.js.map +1 -1
- package/dist/routes/rest/collections/find.d.ts.map +1 -1
- package/dist/routes/rest/collections/find.js +7 -1
- package/dist/routes/rest/collections/find.js.map +1 -1
- package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/findByID.js +5 -1
- package/dist/routes/rest/collections/findByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersionByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/findVersionByID.js +5 -1
- package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
- package/dist/routes/rest/collections/findVersions.d.ts.map +1 -1
- package/dist/routes/rest/collections/findVersions.js +7 -1
- package/dist/routes/rest/collections/findVersions.js.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.js +2 -0
- package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
- package/dist/routes/rest/collections/update.d.ts.map +1 -1
- package/dist/routes/rest/collections/update.js +10 -0
- 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 +7 -1
- package/dist/routes/rest/collections/updateByID.js.map +1 -1
- package/dist/routes/rest/globals/findOne.d.ts.map +1 -1
- package/dist/routes/rest/globals/findOne.js +5 -1
- package/dist/routes/rest/globals/findOne.js.map +1 -1
- package/dist/routes/rest/globals/findVersionByID.d.ts.map +1 -1
- package/dist/routes/rest/globals/findVersionByID.js +5 -1
- package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
- package/dist/routes/rest/globals/findVersions.d.ts.map +1 -1
- package/dist/routes/rest/globals/findVersions.js +7 -1
- package/dist/routes/rest/globals/findVersions.js.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.js +2 -0
- 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 +5 -1
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/routes/rest/index.d.ts +17 -12
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +90 -15
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/index.js +2 -4
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/routeError.d.ts +2 -7
- package/dist/routes/rest/routeError.d.ts.map +1 -1
- package/dist/routes/rest/routeError.js +33 -19
- package/dist/routes/rest/routeError.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +1 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +1 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.js +9 -5
- package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizePopulate.d.ts +3 -0
- package/dist/routes/rest/utilities/sanitizePopulate.d.ts.map +1 -0
- package/dist/routes/rest/utilities/sanitizePopulate.js +11 -0
- package/dist/routes/rest/utilities/sanitizePopulate.js.map +1 -0
- package/dist/routes/rest/utilities/sanitizeSelect.d.ts +6 -0
- package/dist/routes/rest/utilities/sanitizeSelect.d.ts.map +1 -0
- package/dist/routes/rest/utilities/sanitizeSelect.js +17 -0
- package/dist/routes/rest/utilities/sanitizeSelect.js.map +1 -0
- package/dist/scss/app.scss +166 -162
- package/dist/scss/colors.scss +256 -254
- package/dist/scss/resets.scss +9 -7
- package/dist/scss/toastify.scss +42 -40
- package/dist/scss/toasts.scss +105 -103
- package/dist/scss/type.scss +80 -79
- package/dist/templates/Default/Wrapper/index.scss +38 -36
- package/dist/templates/Default/index.scss +60 -58
- package/dist/templates/Minimal/index.scss +22 -20
- package/dist/utilities/getNextRequestI18n.js +2 -2
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getRequestTheme.d.ts.map +1 -1
- package/dist/utilities/getRequestTheme.js +3 -0
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.d.ts +12 -11
- package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAdminPage.js +9 -21
- package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.d.ts +6 -3
- package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +23 -36
- 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 +27 -10
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initPage/isCustomAdminView.d.ts +10 -0
- package/dist/utilities/initPage/isCustomAdminView.d.ts.map +1 -0
- package/dist/utilities/initPage/isCustomAdminView.js +31 -0
- package/dist/utilities/initPage/isCustomAdminView.js.map +1 -0
- package/dist/utilities/initPage/shared.d.ts +2 -2
- package/dist/utilities/initPage/shared.d.ts.map +1 -1
- package/dist/utilities/initPage/shared.js +19 -13
- package/dist/utilities/initPage/shared.js.map +1 -1
- package/dist/utilities/initReq.js +1 -1
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/views/API/RenderJSON/index.scss +68 -66
- package/dist/views/API/index.scss +98 -96
- package/dist/views/Account/Settings/index.d.ts +2 -1
- package/dist/views/Account/Settings/index.d.ts.map +1 -1
- package/dist/views/Account/Settings/index.js +3 -2
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/Settings/index.scss +37 -35
- package/dist/views/Account/ToggleTheme/index.d.ts.map +1 -1
- package/dist/views/Account/ToggleTheme/index.js +1 -0
- package/dist/views/Account/ToggleTheme/index.js.map +1 -1
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +4 -2
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js +31 -15
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/CreateFirstUser/index.scss +13 -11
- package/dist/views/Dashboard/Default/index.d.ts +3 -1
- package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/index.js +12 -3
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/Default/index.scss +51 -49
- package/dist/views/Dashboard/index.d.ts.map +1 -1
- package/dist/views/Dashboard/index.js +31 -13
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/getDocumentData.js +4 -2
- package/dist/views/Document/getDocumentData.js.map +1 -1
- package/dist/views/Document/getDocumentPermissions.d.ts.map +1 -1
- package/dist/views/Document/getDocumentPermissions.js +6 -5
- package/dist/views/Document/getDocumentPermissions.js.map +1 -1
- package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
- package/dist/views/Document/getViewsFromConfig.js +6 -0
- package/dist/views/Document/getViewsFromConfig.js.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js +2 -8
- 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 +37 -26
- package/dist/views/Edit/Default/Auth/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/index.scss +56 -54
- package/dist/views/Edit/Default/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/index.js +45 -73
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/Edit/Default/index.scss +15 -13
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +9 -11
- package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.d.ts.map +1 -1
- package/dist/views/ForgotPassword/index.js +10 -8
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/Default/index.scss +136 -134
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +1 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/LivePreview/IFrame/index.scss +8 -6
- package/dist/views/LivePreview/Preview/index.scss +32 -30
- package/dist/views/LivePreview/Toolbar/Controls/index.scss +49 -47
- package/dist/views/LivePreview/Toolbar/SizeInput/index.scss +11 -9
- package/dist/views/LivePreview/Toolbar/index.scss +33 -31
- package/dist/views/LivePreview/ToolbarArea/index.scss +5 -3
- package/dist/views/LivePreview/index.client.d.ts.map +1 -1
- package/dist/views/LivePreview/index.client.js +221 -203
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/LivePreview/index.scss +48 -46
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js +2 -1
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/LoginForm/index.scss +8 -6
- package/dist/views/Login/index.scss +8 -6
- package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
- package/dist/views/Logout/LogoutClient.js +77 -55
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.scss +17 -15
- package/dist/views/NotFound/index.d.ts +5 -5
- package/dist/views/NotFound/index.d.ts.map +1 -1
- package/dist/views/NotFound/index.js +7 -2
- package/dist/views/NotFound/index.js.map +1 -1
- package/dist/views/NotFound/index.scss +38 -36
- package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts +7 -0
- package/dist/views/ResetPassword/ResetPasswordForm/index.d.ts.map +1 -0
- package/dist/views/ResetPassword/{index.client.js → ResetPasswordForm/index.js} +16 -19
- package/dist/views/ResetPassword/ResetPasswordForm/index.js.map +1 -0
- package/dist/views/ResetPassword/index.d.ts.map +1 -1
- package/dist/views/ResetPassword/index.js +19 -10
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/ResetPassword/index.scss +6 -26
- package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +1 -7
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.d.ts +5 -5
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +23 -10
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/meta.d.ts +5 -5
- package/dist/views/Root/meta.d.ts.map +1 -1
- package/dist/views/Root/meta.js +3 -2
- package/dist/views/Root/meta.js.map +1 -1
- package/dist/views/Unauthorized/index.d.ts.map +1 -1
- package/dist/views/Unauthorized/index.js +14 -7
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Unauthorized/index.scss +4 -31
- package/dist/views/Verify/index.client.d.ts +7 -0
- package/dist/views/Verify/index.client.d.ts.map +1 -0
- package/dist/views/Verify/index.client.js +46 -0
- package/dist/views/Verify/index.client.js.map +1 -0
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +12 -11
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Verify/index.scss +13 -11
- package/dist/views/Version/Default/index.scss +52 -50
- package/dist/views/Version/RenderFieldsToDiff/Label/index.scss +5 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.scss +29 -27
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.scss +11 -9
- package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.scss +12 -10
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.scss +12 -10
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.scss +12 -10
- package/dist/views/Version/RenderFieldsToDiff/index.scss +12 -10
- package/dist/views/Version/Restore/index.d.ts.map +1 -1
- package/dist/views/Version/Restore/index.js +8 -14
- package/dist/views/Version/Restore/index.js.map +1 -1
- package/dist/views/Version/Restore/index.scss +57 -55
- package/dist/views/Version/SelectComparison/index.scss +12 -10
- package/dist/views/Version/SelectLocales/index.scss +6 -4
- package/dist/views/Version/index.d.ts.map +1 -1
- package/dist/views/Version/index.js +2 -0
- package/dist/views/Version/index.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js +1 -0
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/getLatestVersion.d.ts +1 -0
- package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
- package/dist/views/Versions/getLatestVersion.js +15 -4
- package/dist/views/Versions/getLatestVersion.js.map +1 -1
- package/dist/views/Versions/index.d.ts.map +1 -1
- package/dist/views/Versions/index.js +4 -4
- package/dist/views/Versions/index.js.map +1 -1
- package/dist/views/Versions/index.scss +78 -76
- package/dist/withPayload.d.ts.map +1 -1
- package/dist/withPayload.js +9 -1
- package/dist/withPayload.js.map +1 -1
- package/package.json +10 -10
- package/dist/cjs/withPayload.js +0 -111
- package/dist/cjs/withPayload.js.map +0 -1
- package/dist/views/ResetPassword/index.client.d.ts +0 -7
- package/dist/views/ResetPassword/index.client.d.ts.map +0 -1
- package/dist/views/ResetPassword/index.client.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeJoinParams","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","joins","query","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import type { JoinQuery } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n joins: sanitizeJoinParams(req.query.joins as JoinQuery),\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;
|
|
1
|
+
{"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeJoinParams","sanitizePopulate","sanitizeSelect","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","joins","query","populate","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import type { JoinQuery } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n joins: sanitizeJoinParams(req.query.joins as JoinQuery),\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKL,oBAAA,CAAqB;IAC9BK,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMnB,iBAAA,CAAkB;IACrCQ,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOZ,QAAA,CAASY,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCS,KAAA,EAAOnB,kBAAA,CAAmBO,GAAA,CAAIa,KAAK,CAACD,KAAK;IACzCE,QAAA,EAAUpB,gBAAA,CAAiBM,GAAA,CAAIa,KAAK,CAACC,QAAQ;IAC7Cd,GAAA;IACAe,MAAA,EAAQpB,cAAA,CAAeK,GAAA,CAAIa,KAAK,CAACE,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACT,MAAA,EAAQ;IAC3BU,OAAA,EAAS3B,eAAA,CAAgB;MACvB2B,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQhC,UAAA,CAAWiC;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAO/D,eAAO,MAAM,eAAe,EAAE,4BA8B7B,CAAA"}
|
|
@@ -3,6 +3,8 @@ import { findVersionByIDOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
7
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
6
8
|
export const findVersionByID = async ({
|
|
7
9
|
id: incomingID,
|
|
8
10
|
collection,
|
|
@@ -21,7 +23,9 @@ export const findVersionByID = async ({
|
|
|
21
23
|
id,
|
|
22
24
|
collection,
|
|
23
25
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
24
|
-
req
|
|
26
|
+
populate: sanitizePopulate(req.query.populate),
|
|
27
|
+
req,
|
|
28
|
+
select: sanitizeSelect(req.query.select)
|
|
25
29
|
});
|
|
26
30
|
return Response.json(result, {
|
|
27
31
|
headers: headersWithCors({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;
|
|
1
|
+
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizePopulate","sanitizeSelect","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","populate","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAAgD,MAAAA,CAAO;EAClEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKJ,oBAAA,CAAqB;IAC9BI,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMlB,wBAAA,CAAyB;IAC5CO,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOX,QAAA,CAASW,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,QAAA,EAAUjB,gBAAA,CAAiBM,GAAA,CAAIY,KAAK,CAACD,QAAQ;IAC7CX,GAAA;IACAa,MAAA,EAAQlB,cAAA,CAAeK,GAAA,CAAIY,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAMzD,eAAO,MAAM,YAAY,EAAE,sBA8B1B,CAAA"}
|
|
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { findVersionsOperation } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
6
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
5
7
|
export const findVersions = async ({
|
|
6
8
|
collection,
|
|
7
9
|
req
|
|
@@ -10,6 +12,8 @@ export const findVersions = async ({
|
|
|
10
12
|
depth,
|
|
11
13
|
limit,
|
|
12
14
|
page,
|
|
15
|
+
populate,
|
|
16
|
+
select,
|
|
13
17
|
sort,
|
|
14
18
|
where
|
|
15
19
|
} = req.query;
|
|
@@ -18,8 +22,10 @@ export const findVersions = async ({
|
|
|
18
22
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
19
23
|
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
20
24
|
page: isNumber(page) ? Number(page) : undefined,
|
|
25
|
+
populate: sanitizePopulate(populate),
|
|
21
26
|
req,
|
|
22
|
-
|
|
27
|
+
select: sanitizeSelect(select),
|
|
28
|
+
sort: typeof sort === 'string' ? sort.split(',') : undefined,
|
|
23
29
|
where
|
|
24
30
|
});
|
|
25
31
|
return Response.json(result, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","findVersions","collection","req","depth","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findVersions","collection","req","depth","limit","page","populate","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, populate, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n populate: sanitizePopulate(populate),\n req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUvE,MAAMC,MAAA,GAAS,MAAMhB,qBAAA,CAAsB;IACzCM,UAAA;IACAE,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCT,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,IAAA,EAAMT,QAAA,CAASS,IAAA,IAAQO,MAAA,CAAOP,IAAA,IAAQQ,SAAA;IACtCP,QAAA,EAAUR,gBAAA,CAAiBQ,QAAA;IAC3BJ,GAAA;IACAK,MAAA,EAAQR,cAAA,CAAeQ,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAM/D,eAAO,MAAM,cAAc,EAAE,4BAqC5B,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { restoreVersionOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
6
7
|
export const restoreVersion = async ({
|
|
7
8
|
id: incomingID,
|
|
8
9
|
collection,
|
|
@@ -23,6 +24,7 @@ export const restoreVersion = async ({
|
|
|
23
24
|
collection,
|
|
24
25
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
25
26
|
draft: draft === 'true' ? true : undefined,
|
|
27
|
+
populate: sanitizePopulate(req.query.populate),
|
|
26
28
|
req
|
|
27
29
|
});
|
|
28
30
|
return Response.json({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperation","isNumber","headersWithCors","sanitizeCollectionID","restoreVersion","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const restoreVersion: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await restoreVersionOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n req,\n })\n\n return Response.json(\n {\n ...result,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;
|
|
1
|
+
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizePopulate","restoreVersion","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","result","Number","undefined","populate","query","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\n\nexport const restoreVersion: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await restoreVersionOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n populate: sanitizePopulate(req.query.populate),\n req,\n })\n\n return Response.json(\n {\n ...result,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,QAAQ;AAEjC,OAAO,MAAMC,cAAA,GAA+C,MAAAA,CAAO;EACjEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMlB,uBAAA,CAAwB;IAC3CM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOO,SAAA;IACjCC,QAAA,EAAUjB,gBAAA,CAAiBK,GAAA,CAAIa,KAAK,CAACD,QAAQ;IAC7CZ;EACF;EAEA,OAAOc,QAAA,CAASC,IAAI,CAClB;IACE,GAAGN,MAAM;IACTO,OAAA,EAAShB,GAAA,CAAIiB,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAASzB,eAAA,CAAgB;MACvByB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQ9B,UAAA,CAAW+B;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAMzD,eAAO,MAAM,MAAM,EAAE,sBAmEpB,CAAA"}
|
|
@@ -3,6 +3,8 @@ import httpStatus from 'http-status';
|
|
|
3
3
|
import { updateOperation } from 'payload';
|
|
4
4
|
import { isNumber } from 'payload/shared';
|
|
5
5
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
6
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
7
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
6
8
|
export const update = async ({
|
|
7
9
|
collection,
|
|
8
10
|
req
|
|
@@ -10,6 +12,10 @@ export const update = async ({
|
|
|
10
12
|
const {
|
|
11
13
|
depth,
|
|
12
14
|
draft,
|
|
15
|
+
limit,
|
|
16
|
+
overrideLock,
|
|
17
|
+
populate,
|
|
18
|
+
select,
|
|
13
19
|
where
|
|
14
20
|
} = req.query;
|
|
15
21
|
const result = await updateOperation({
|
|
@@ -17,7 +23,11 @@ export const update = async ({
|
|
|
17
23
|
data: req.data,
|
|
18
24
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
19
25
|
draft: draft === 'true',
|
|
26
|
+
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
27
|
+
overrideLock: Boolean(overrideLock === 'true'),
|
|
28
|
+
populate: sanitizePopulate(populate),
|
|
20
29
|
req,
|
|
30
|
+
select: sanitizeSelect(select),
|
|
21
31
|
where
|
|
22
32
|
});
|
|
23
33
|
const headers = headersWithCors({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","update","collection","req","depth","draft","where","query","result","data","Number","undefined","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, where } = req.query as {\n depth?: string\n draft?: string\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n req,\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","update","collection","req","depth","draft","limit","overrideLock","populate","select","where","query","result","data","Number","undefined","Boolean","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, overrideLock, populate, select, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n overrideLock?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n overrideLock: Boolean(overrideLock === 'true'),\n populate: sanitizePopulate(populate),\n req,\n select: sanitizeSelect(select),\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,YAAY;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUhF,MAAMC,MAAA,GAAS,MAAMhB,eAAA,CAAgB;IACnCM,UAAA;IACAW,IAAA,EAAMV,GAAA,CAAIU,IAAI;IACdT,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASU,MAAA,CAAOV,KAAA,IAASW,SAAA;IACzCV,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,YAAA,EAAcS,OAAA,CAAQT,YAAA,KAAiB;IACvCC,QAAA,EAAUT,gBAAA,CAAiBS,QAAA;IAC3BL,GAAA;IACAM,MAAA,EAAQT,cAAA,CAAeS,MAAA;IACvBC;EACF;EAEA,MAAMO,OAAA,GAAUnB,eAAA,CAAgB;IAC9BmB,OAAA,EAAS,IAAIC,OAAA;IACbf;EACF;EAEA,IAAIS,MAAA,CAAOO,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOX,MAAA,CAAOY,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAO/B,cAAA,CACLQ,UAAA,CAAWwB,MAAM,CAACC,MAAM,CAACf,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEjB,GAAA,CAAIyB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGlB,MAAM;MACTS;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQpC,UAAA,CAAWqC;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQrB,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAGR,MAAA,CAAOO,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOX,MAAA,CAAOO,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAO/B,cAAA,CAAeQ,UAAA,CAAWwB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAE9B,GAAA,CAAIyB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGlB,MAAM;IACTS;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQpC,UAAA,CAAWuC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/updateByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/updateByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAO/D,eAAO,MAAM,UAAU,EAAE,4BAsDxB,CAAA"}
|
|
@@ -3,6 +3,8 @@ import { updateByIDOperation } from 'payload';
|
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
5
|
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
7
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
6
8
|
export const updateByID = async ({
|
|
7
9
|
id: incomingID,
|
|
8
10
|
collection,
|
|
@@ -14,6 +16,7 @@ export const updateByID = async ({
|
|
|
14
16
|
const depth = searchParams.get('depth');
|
|
15
17
|
const autosave = searchParams.get('autosave') === 'true';
|
|
16
18
|
const draft = searchParams.get('draft') === 'true';
|
|
19
|
+
const overrideLock = searchParams.get('overrideLock');
|
|
17
20
|
const publishSpecificLocale = req.query.publishSpecificLocale;
|
|
18
21
|
const id = sanitizeCollectionID({
|
|
19
22
|
id: incomingID,
|
|
@@ -27,8 +30,11 @@ export const updateByID = async ({
|
|
|
27
30
|
data: req.data,
|
|
28
31
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
29
32
|
draft,
|
|
33
|
+
overrideLock: Boolean(overrideLock === 'true'),
|
|
34
|
+
populate: sanitizePopulate(req.query.populate),
|
|
30
35
|
publishSpecificLocale,
|
|
31
|
-
req
|
|
36
|
+
req,
|
|
37
|
+
select: sanitizeSelect(req.query.select)
|
|
32
38
|
});
|
|
33
39
|
let message = req.t('general:updatedSuccessfully');
|
|
34
40
|
if (draft) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","publishSpecificLocale","query","collectionSlug","config","slug","payload","doc","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n publishSpecificLocale,\n req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;
|
|
1
|
+
{"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizePopulate","sanitizeSelect","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","overrideLock","publishSpecificLocale","query","collectionSlug","config","slug","payload","doc","data","Number","undefined","Boolean","populate","select","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const overrideLock = searchParams.get('overrideLock')\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n overrideLock: Boolean(overrideLock === 'true'),\n populate: sanitizePopulate(req.query.populate),\n publishSpecificLocale,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,UAAA,GAA2C,MAAAA,CAAO;EAC7DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,QAAA,GAAWH,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAME,KAAA,GAAQJ,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAMG,YAAA,GAAeL,YAAA,CAAaE,GAAG,CAAC;EACtC,MAAMI,qBAAA,GAAwBP,GAAA,CAAIQ,KAAK,CAACD,qBAAqB;EAE7D,MAAMV,EAAA,GAAKJ,oBAAA,CAAqB;IAC9BI,EAAA,EAAIC,UAAA;IACJW,cAAA,EAAgBV,UAAA,CAAWW,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASZ,GAAA,CAAIY;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMvB,mBAAA,CAAoB;IACpCO,EAAA;IACAO,QAAA;IACAL,UAAA;IACAe,IAAA,EAAMd,GAAA,CAAIc,IAAI;IACdZ,KAAA,EAAOX,QAAA,CAASW,KAAA,IAASa,MAAA,CAAOb,KAAA,IAASc,SAAA;IACzCX,KAAA;IACAC,YAAA,EAAcW,OAAA,CAAQX,YAAA,KAAiB;IACvCY,QAAA,EAAUxB,gBAAA,CAAiBM,GAAA,CAAIQ,KAAK,CAACU,QAAQ;IAC7CX,qBAAA;IACAP,GAAA;IACAmB,MAAA,EAAQxB,cAAA,CAAeK,GAAA,CAAIQ,KAAK,CAACW,MAAM;EACzC;EAEA,IAAIC,OAAA,GAAUpB,GAAA,CAAIqB,CAAC,CAAC;EAEpB,IAAIhB,KAAA,EAAO;IACTe,OAAA,GAAUpB,GAAA,CAAIqB,CAAC,CAAC;EAClB;EACA,IAAIjB,QAAA,EAAU;IACZgB,OAAA,GAAUpB,GAAA,CAAIqB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEV,GAAA;IACAO;EACF,GACA;IACEI,OAAA,EAAShC,eAAA,CAAgB;MACvBgC,OAAA,EAAS,IAAIC,OAAA;MACbzB;IACF;IACA0B,MAAA,EAAQrC,UAAA,CAAWsC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findOne.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"findOne.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findOne.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAMrD,eAAO,MAAM,OAAO,EAAE,kBAqBrB,CAAA"}
|
|
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { findOneOperation } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
6
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
5
7
|
export const findOne = async ({
|
|
6
8
|
globalConfig,
|
|
7
9
|
req
|
|
@@ -15,7 +17,9 @@ export const findOne = async ({
|
|
|
15
17
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
16
18
|
draft: searchParams.get('draft') === 'true',
|
|
17
19
|
globalConfig,
|
|
18
|
-
req
|
|
20
|
+
populate: sanitizePopulate(req.query.populate),
|
|
21
|
+
req,
|
|
22
|
+
select: sanitizeSelect(req.query.select)
|
|
19
23
|
});
|
|
20
24
|
return Response.json(result, {
|
|
21
25
|
headers: headersWithCors({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","isNumber","headersWithCors","findOne","globalConfig","req","searchParams","depth","get","result","slug","Number","undefined","draft","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findOne.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findOne: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findOneOperation({\n slug: globalConfig.slug,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n globalConfig,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findOne","globalConfig","req","searchParams","depth","get","result","slug","Number","undefined","draft","populate","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findOne.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findOne: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findOneOperation({\n slug: globalConfig.slug,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,OAAA,GAA8B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMX,gBAAA,CAAiB;IACpCY,IAAA,EAAMN,YAAA,CAAaM,IAAI;IACvBH,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCC,KAAA,EAAOP,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCJ,YAAA;IACAU,QAAA,EAAUb,gBAAA,CAAiBI,GAAA,CAAIU,KAAK,CAACD,QAAQ;IAC7CT,GAAA;IACAW,MAAA,EAAQd,cAAA,CAAeG,GAAA,CAAIU,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACT,MAAA,EAAQ;IAC3BU,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAM3D,eAAO,MAAM,eAAe,EAAE,wBAoB7B,CAAA"}
|
|
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { findVersionByIDOperationGlobal } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
6
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
5
7
|
export const findVersionByID = async ({
|
|
6
8
|
id,
|
|
7
9
|
globalConfig,
|
|
@@ -15,7 +17,9 @@ export const findVersionByID = async ({
|
|
|
15
17
|
id,
|
|
16
18
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
17
19
|
globalConfig,
|
|
18
|
-
req
|
|
20
|
+
populate: sanitizePopulate(req.query.populate),
|
|
21
|
+
req,
|
|
22
|
+
select: sanitizeSelect(req.query.select)
|
|
19
23
|
});
|
|
20
24
|
return Response.json(result, {
|
|
21
25
|
headers: headersWithCors({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","isNumber","headersWithCors","findVersionByID","id","globalConfig","req","searchParams","depth","get","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersionByID: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findVersionByIDOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findVersionByID","id","globalConfig","req","searchParams","depth","get","result","Number","undefined","populate","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersionByID: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findVersionByIDOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAA4C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACvF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMZ,8BAAA,CAA+B;IAClDM,EAAA;IACAI,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCP,YAAA;IACAQ,QAAA,EAAUZ,gBAAA,CAAiBK,GAAA,CAAIQ,KAAK,CAACD,QAAQ;IAC7CP,GAAA;IACAS,MAAA,EAAQb,cAAA,CAAeI,GAAA,CAAIQ,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbb;IACF;IACAc,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAMrD,eAAO,MAAM,YAAY,EAAE,kBA8B1B,CAAA"}
|
|
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { findVersionsOperationGlobal } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
6
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
5
7
|
export const findVersions = async ({
|
|
6
8
|
globalConfig,
|
|
7
9
|
req
|
|
@@ -10,6 +12,8 @@ export const findVersions = async ({
|
|
|
10
12
|
depth,
|
|
11
13
|
limit,
|
|
12
14
|
page,
|
|
15
|
+
populate,
|
|
16
|
+
select,
|
|
13
17
|
sort,
|
|
14
18
|
where
|
|
15
19
|
} = req.query;
|
|
@@ -18,8 +22,10 @@ export const findVersions = async ({
|
|
|
18
22
|
globalConfig,
|
|
19
23
|
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
20
24
|
page: isNumber(page) ? Number(page) : undefined,
|
|
25
|
+
populate: sanitizePopulate(populate),
|
|
21
26
|
req,
|
|
22
|
-
|
|
27
|
+
select: sanitizeSelect(select),
|
|
28
|
+
sort: typeof sort === 'string' ? sort.split(',') : undefined,
|
|
23
29
|
where
|
|
24
30
|
});
|
|
25
31
|
return Response.json(result, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","isNumber","headersWithCors","findVersions","globalConfig","req","depth","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperationGlobal({\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","findVersions","globalConfig","req","depth","limit","page","populate","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersions: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { depth, limit, page, populate, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperationGlobal({\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n populate: sanitizePopulate(populate),\n req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,YAAA,GAAmC,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EAC1E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUvE,MAAMC,MAAA,GAAS,MAAMhB,2BAAA,CAA4B;IAC/CQ,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCZ,YAAA;IACAG,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,IAAA,EAAMT,QAAA,CAASS,IAAA,IAAQO,MAAA,CAAOP,IAAA,IAAQQ,SAAA;IACtCP,QAAA,EAAUR,gBAAA,CAAiBQ,QAAA;IAC3BJ,GAAA;IACAK,MAAA,EAAQR,cAAA,CAAeQ,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"restoreVersion.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAK3D,eAAO,MAAM,cAAc,EAAE,wBA2B5B,CAAA"}
|
|
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { restoreVersionOperationGlobal } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
5
6
|
export const restoreVersion = async ({
|
|
6
7
|
id,
|
|
7
8
|
globalConfig,
|
|
@@ -17,6 +18,7 @@ export const restoreVersion = async ({
|
|
|
17
18
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
18
19
|
draft: draft === 'true' ? true : undefined,
|
|
19
20
|
globalConfig,
|
|
21
|
+
populate: sanitizePopulate(req.query.populate),
|
|
20
22
|
req
|
|
21
23
|
});
|
|
22
24
|
return Response.json({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperationGlobal","isNumber","headersWithCors","restoreVersion","id","globalConfig","req","searchParams","depth","get","draft","doc","Number","undefined","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const restoreVersion: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const doc = await restoreVersionOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n globalConfig,\n req,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperationGlobal","isNumber","headersWithCors","sanitizePopulate","restoreVersion","id","globalConfig","req","searchParams","depth","get","draft","doc","Number","undefined","populate","query","Response","json","message","t","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/restoreVersion.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { restoreVersionOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\n\nexport const restoreVersion: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft')\n\n const doc = await restoreVersionOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true' ? true : undefined,\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n req,\n })\n\n return Response.json(\n {\n doc,\n message: req.t('version:restoredSuccessfully'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AAEjC,OAAO,MAAMC,cAAA,GAA2C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACtF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAME,GAAA,GAAM,MAAMZ,6BAAA,CAA8B;IAC9CK,EAAA;IACAI,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCH,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOG,SAAA;IACjCR,YAAA;IACAS,QAAA,EAAUZ,gBAAA,CAAiBI,GAAA,CAAIS,KAAK,CAACD,QAAQ;IAC7CR;EACF;EAEA,OAAOU,QAAA,CAASC,IAAI,CAClB;IACEN,GAAA;IACAO,OAAA,EAASZ,GAAA,CAAIa,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/update.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/globals/update.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAMrD,eAAO,MAAM,MAAM,EAAE,kBA0CpB,CAAA"}
|
|
@@ -2,6 +2,8 @@ import httpStatus from 'http-status';
|
|
|
2
2
|
import { updateOperationGlobal } from 'payload';
|
|
3
3
|
import { isNumber } from 'payload/shared';
|
|
4
4
|
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
+
import { sanitizePopulate } from '../utilities/sanitizePopulate.js';
|
|
6
|
+
import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
|
|
5
7
|
export const update = async ({
|
|
6
8
|
globalConfig,
|
|
7
9
|
req
|
|
@@ -20,8 +22,10 @@ export const update = async ({
|
|
|
20
22
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
21
23
|
draft,
|
|
22
24
|
globalConfig,
|
|
25
|
+
populate: sanitizePopulate(req.query.populate),
|
|
23
26
|
publishSpecificLocale,
|
|
24
|
-
req
|
|
27
|
+
req,
|
|
28
|
+
select: sanitizeSelect(req.query.select)
|
|
25
29
|
});
|
|
26
30
|
let message = req.t('general:updatedSuccessfully');
|
|
27
31
|
if (draft) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","names":["httpStatus","updateOperationGlobal","isNumber","headersWithCors","update","globalConfig","req","searchParams","depth","get","draft","autosave","publishSpecificLocale","query","result","slug","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/update.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft') === 'true'\n const autosave = searchParams.get('autosave') === 'true'\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const result = await updateOperationGlobal({\n slug: globalConfig.slug,\n autosave,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n globalConfig,\n publishSpecificLocale,\n req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n message,\n result,\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,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"file":"update.js","names":["httpStatus","updateOperationGlobal","isNumber","headersWithCors","sanitizePopulate","sanitizeSelect","update","globalConfig","req","searchParams","depth","get","draft","autosave","publishSpecificLocale","query","result","slug","data","Number","undefined","populate","select","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/update.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizePopulate } from '../utilities/sanitizePopulate.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const update: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft') === 'true'\n const autosave = searchParams.get('autosave') === 'true'\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const result = await updateOperationGlobal({\n slug: globalConfig.slug,\n autosave,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n globalConfig,\n populate: sanitizePopulate(req.query.populate),\n publishSpecificLocale,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n message,\n result,\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,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,MAAA,GAA6B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAME,QAAA,GAAWJ,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAMG,qBAAA,GAAwBN,GAAA,CAAIO,KAAK,CAACD,qBAAqB;EAE7D,MAAME,MAAA,GAAS,MAAMf,qBAAA,CAAsB;IACzCgB,IAAA,EAAMV,YAAA,CAAaU,IAAI;IACvBJ,QAAA;IACAK,IAAA,EAAMV,GAAA,CAAIU,IAAI;IACdR,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCR,KAAA;IACAL,YAAA;IACAc,QAAA,EAAUjB,gBAAA,CAAiBI,GAAA,CAAIO,KAAK,CAACM,QAAQ;IAC7CP,qBAAA;IACAN,GAAA;IACAc,MAAA,EAAQjB,cAAA,CAAeG,GAAA,CAAIO,KAAK,CAACO,MAAM;EACzC;EAEA,IAAIC,OAAA,GAAUf,GAAA,CAAIgB,CAAC,CAAC;EAEpB,IAAIZ,KAAA,EAAO;IACTW,OAAA,GAAUf,GAAA,CAAIgB,CAAC,CAAC;EAClB;EACA,IAAIX,QAAA,EAAU;IACZU,OAAA,GAAUf,GAAA,CAAIgB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEH,OAAA;IACAP;EACF,GACA;IACEW,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbpB;IACF;IACAqB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import type { SanitizedConfig } from 'payload';
|
|
2
2
|
export declare const OPTIONS: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request) => Promise<Response>;
|
|
3
|
-
export declare const GET: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params:
|
|
4
|
-
params: {
|
|
3
|
+
export declare const GET: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params: paramsPromise }: {
|
|
4
|
+
params: Promise<{
|
|
5
5
|
slug: string[];
|
|
6
|
-
}
|
|
6
|
+
}>;
|
|
7
7
|
}) => Promise<Response>;
|
|
8
|
-
export declare const POST: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params:
|
|
9
|
-
params: {
|
|
8
|
+
export declare const POST: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params: paramsPromise }: {
|
|
9
|
+
params: Promise<{
|
|
10
10
|
slug: string[];
|
|
11
|
-
}
|
|
11
|
+
}>;
|
|
12
12
|
}) => Promise<Response>;
|
|
13
|
-
export declare const DELETE: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params:
|
|
14
|
-
params: {
|
|
13
|
+
export declare const DELETE: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params: paramsPromise }: {
|
|
14
|
+
params: Promise<{
|
|
15
15
|
slug: string[];
|
|
16
|
-
}
|
|
16
|
+
}>;
|
|
17
17
|
}) => Promise<Response>;
|
|
18
|
-
export declare const PATCH: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params:
|
|
19
|
-
params: {
|
|
18
|
+
export declare const PATCH: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params: paramsPromise }: {
|
|
19
|
+
params: Promise<{
|
|
20
20
|
slug: string[];
|
|
21
|
-
}
|
|
21
|
+
}>;
|
|
22
|
+
}) => Promise<Response>;
|
|
23
|
+
export declare const PUT: (config: Promise<SanitizedConfig> | SanitizedConfig) => (request: Request, { params: paramsPromise }: {
|
|
24
|
+
params: Promise<{
|
|
25
|
+
slug: string[];
|
|
26
|
+
}>;
|
|
22
27
|
}) => Promise<Response>;
|
|
23
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsD,eAAe,EAAE,MAAM,SAAS,CAAA;AAwMlG,eAAO,MAAM,OAAO,WACT,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBA0B9E,CAAA;AAEH,eAAO,MAAM,GAAG,WACL,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsD,eAAe,EAAE,MAAM,SAAS,CAAA;AAwMlG,eAAO,MAAM,OAAO,WACT,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBA0B9E,CAAA;AAEH,eAAO,MAAM,GAAG,WACL,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,6BAA6B;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,sBAqM1F,CAAA;AAEH,eAAO,MAAM,IAAI,WACN,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,6BAA6B;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,sBA2L1F,CAAA;AAEH,eAAO,MAAM,MAAM,WACR,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,6BAA6B;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,sBAiG1F,CAAA;AAEH,eAAO,MAAM,KAAK,WACP,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,6BAA6B;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,sBAkG1F,CAAA;AAEH,eAAO,MAAM,GAAG,WACL,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eACnC,OAAO,6BAA6B;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAA;CAAE,sBAgF1F,CAAA"}
|