@payloadcms/next 3.15.1 → 3.15.2-canary.595a742
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/exports/utilities.d.ts +65 -5
- package/dist/exports/utilities.d.ts.map +1 -1
- package/dist/exports/utilities.js +49 -5
- package/dist/exports/utilities.js.map +1 -1
- package/dist/layouts/Root/index.d.ts.map +1 -1
- package/dist/layouts/Root/index.js +7 -2
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/routes/graphql/handler.d.ts.map +1 -1
- package/dist/routes/graphql/handler.js +1 -6
- package/dist/routes/graphql/handler.js.map +1 -1
- package/dist/routes/graphql/playground.d.ts +1 -1
- package/dist/routes/graphql/playground.d.ts.map +1 -1
- package/dist/routes/graphql/playground.js +1 -1
- package/dist/routes/graphql/playground.js.map +1 -1
- package/dist/routes/rest/index.d.ts +6 -26
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +25 -820
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/index.d.ts +2 -8
- package/dist/routes/rest/og/index.d.ts.map +1 -1
- package/dist/routes/rest/og/index.js +3 -6
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/utilities/getNextRequestI18n.d.ts +1 -1
- package/dist/utilities/getNextRequestI18n.d.ts.map +1 -1
- package/dist/utilities/getNextRequestI18n.js +1 -1
- package/dist/utilities/getNextRequestI18n.js.map +1 -1
- package/dist/utilities/getPayloadHMR.d.ts +8 -0
- package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
- package/dist/utilities/getPayloadHMR.js +8 -0
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getPreference.d.ts +3 -0
- package/dist/utilities/getPreference.d.ts.map +1 -0
- package/dist/utilities/getPreference.js +29 -0
- package/dist/utilities/getPreference.js.map +1 -0
- package/dist/utilities/getRequestLocale.d.ts +9 -0
- package/dist/utilities/getRequestLocale.d.ts.map +1 -0
- package/dist/utilities/getRequestLocale.js +13 -0
- package/dist/utilities/getRequestLocale.js.map +1 -0
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js +7 -38
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/initReq.d.ts.map +1 -1
- package/dist/utilities/initReq.js +1 -2
- package/dist/utilities/initReq.js.map +1 -1
- package/dist/views/List/handleServerFunction.d.ts +1 -2
- package/dist/views/List/handleServerFunction.d.ts.map +1 -1
- package/dist/views/List/handleServerFunction.js.map +1 -1
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/fetchAPI-multipart/fileFactory.d.ts +0 -16
- package/dist/fetchAPI-multipart/fileFactory.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/fileFactory.js +0 -44
- package/dist/fetchAPI-multipart/fileFactory.js.map +0 -1
- package/dist/fetchAPI-multipart/handlers.d.ts +0 -14
- package/dist/fetchAPI-multipart/handlers.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/handlers.js +0 -87
- package/dist/fetchAPI-multipart/handlers.js.map +0 -1
- package/dist/fetchAPI-multipart/index.d.ts +0 -32
- package/dist/fetchAPI-multipart/index.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/index.js +0 -43
- package/dist/fetchAPI-multipart/index.js.map +0 -1
- package/dist/fetchAPI-multipart/isEligibleRequest.d.ts +0 -2
- package/dist/fetchAPI-multipart/isEligibleRequest.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/isEligibleRequest.js +0 -18
- package/dist/fetchAPI-multipart/isEligibleRequest.js.map +0 -1
- package/dist/fetchAPI-multipart/processMultipart.d.ts +0 -9
- package/dist/fetchAPI-multipart/processMultipart.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/processMultipart.js +0 -178
- package/dist/fetchAPI-multipart/processMultipart.js.map +0 -1
- package/dist/fetchAPI-multipart/processNested.d.ts +0 -2
- package/dist/fetchAPI-multipart/processNested.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/processNested.js +0 -31
- package/dist/fetchAPI-multipart/processNested.js.map +0 -1
- package/dist/fetchAPI-multipart/uploadTimer.d.ts +0 -7
- package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/uploadTimer.js +0 -20
- package/dist/fetchAPI-multipart/uploadTimer.js.map +0 -1
- package/dist/fetchAPI-multipart/utilities.d.ts +0 -65
- package/dist/fetchAPI-multipart/utilities.d.ts.map +0 -1
- package/dist/fetchAPI-multipart/utilities.js +0 -227
- package/dist/fetchAPI-multipart/utilities.js.map +0 -1
- package/dist/fetchAPI-stream-file/index.d.ts +0 -5
- package/dist/fetchAPI-stream-file/index.d.ts.map +0 -1
- package/dist/fetchAPI-stream-file/index.js +0 -27
- package/dist/fetchAPI-stream-file/index.js.map +0 -1
- package/dist/routes/rest/auth/access.d.ts +0 -3
- package/dist/routes/rest/auth/access.d.ts.map +0 -1
- package/dist/routes/rest/auth/access.js +0 -28
- package/dist/routes/rest/auth/access.js.map +0 -1
- package/dist/routes/rest/auth/forgotPassword.d.ts +0 -3
- package/dist/routes/rest/auth/forgotPassword.d.ts.map +0 -1
- package/dist/routes/rest/auth/forgotPassword.js +0 -34
- package/dist/routes/rest/auth/forgotPassword.js.map +0 -1
- package/dist/routes/rest/auth/init.d.ts +0 -3
- package/dist/routes/rest/auth/init.d.ts.map +0 -1
- package/dist/routes/rest/auth/init.js +0 -20
- package/dist/routes/rest/auth/init.js.map +0 -1
- package/dist/routes/rest/auth/login.d.ts +0 -3
- package/dist/routes/rest/auth/login.d.ts.map +0 -1
- package/dist/routes/rest/auth/login.js +0 -49
- package/dist/routes/rest/auth/login.js.map +0 -1
- package/dist/routes/rest/auth/logout.d.ts +0 -3
- package/dist/routes/rest/auth/logout.d.ts.map +0 -1
- package/dist/routes/rest/auth/logout.js +0 -40
- package/dist/routes/rest/auth/logout.js.map +0 -1
- package/dist/routes/rest/auth/me.d.ts +0 -3
- package/dist/routes/rest/auth/me.d.ts.map +0 -1
- package/dist/routes/rest/auth/me.js +0 -28
- package/dist/routes/rest/auth/me.js.map +0 -1
- package/dist/routes/rest/auth/refresh.d.ts +0 -3
- package/dist/routes/rest/auth/refresh.d.ts.map +0 -1
- package/dist/routes/rest/auth/refresh.js +0 -38
- package/dist/routes/rest/auth/refresh.js.map +0 -1
- package/dist/routes/rest/auth/registerFirstUser.d.ts +0 -3
- package/dist/routes/rest/auth/registerFirstUser.d.ts.map +0 -1
- package/dist/routes/rest/auth/registerFirstUser.js +0 -48
- package/dist/routes/rest/auth/registerFirstUser.js.map +0 -1
- package/dist/routes/rest/auth/resetPassword.d.ts +0 -3
- package/dist/routes/rest/auth/resetPassword.d.ts.map +0 -1
- package/dist/routes/rest/auth/resetPassword.js +0 -43
- package/dist/routes/rest/auth/resetPassword.js.map +0 -1
- package/dist/routes/rest/auth/unlock.d.ts +0 -3
- package/dist/routes/rest/auth/unlock.d.ts.map +0 -1
- package/dist/routes/rest/auth/unlock.js +0 -32
- package/dist/routes/rest/auth/unlock.js.map +0 -1
- package/dist/routes/rest/auth/verifyEmail.d.ts +0 -3
- package/dist/routes/rest/auth/verifyEmail.d.ts.map +0 -1
- package/dist/routes/rest/auth/verifyEmail.js +0 -27
- package/dist/routes/rest/auth/verifyEmail.js.map +0 -1
- package/dist/routes/rest/checkEndpoints.d.ts +0 -5
- package/dist/routes/rest/checkEndpoints.d.ts.map +0 -1
- package/dist/routes/rest/checkEndpoints.js +0 -14
- package/dist/routes/rest/checkEndpoints.js.map +0 -1
- package/dist/routes/rest/collections/count.d.ts +0 -3
- package/dist/routes/rest/collections/count.d.ts.map +0 -1
- package/dist/routes/rest/collections/count.js +0 -19
- package/dist/routes/rest/collections/count.js.map +0 -1
- package/dist/routes/rest/collections/create.d.ts +0 -3
- package/dist/routes/rest/collections/create.d.ts.map +0 -1
- package/dist/routes/rest/collections/create.js +0 -39
- package/dist/routes/rest/collections/create.js.map +0 -1
- package/dist/routes/rest/collections/delete.d.ts +0 -3
- package/dist/routes/rest/collections/delete.d.ts.map +0 -1
- package/dist/routes/rest/collections/delete.js +0 -57
- package/dist/routes/rest/collections/delete.js.map +0 -1
- package/dist/routes/rest/collections/deleteByID.d.ts +0 -3
- package/dist/routes/rest/collections/deleteByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/deleteByID.js +0 -50
- package/dist/routes/rest/collections/deleteByID.js.map +0 -1
- package/dist/routes/rest/collections/docAccess.d.ts +0 -3
- package/dist/routes/rest/collections/docAccess.d.ts.map +0 -1
- package/dist/routes/rest/collections/docAccess.js +0 -22
- package/dist/routes/rest/collections/docAccess.js.map +0 -1
- package/dist/routes/rest/collections/duplicate.d.ts +0 -3
- package/dist/routes/rest/collections/duplicate.d.ts.map +0 -1
- package/dist/routes/rest/collections/duplicate.js +0 -47
- package/dist/routes/rest/collections/duplicate.js.map +0 -1
- package/dist/routes/rest/collections/find.d.ts +0 -3
- package/dist/routes/rest/collections/find.d.ts.map +0 -1
- package/dist/routes/rest/collections/find.js +0 -43
- package/dist/routes/rest/collections/find.js.map +0 -1
- package/dist/routes/rest/collections/findByID.d.ts +0 -3
- package/dist/routes/rest/collections/findByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/findByID.js +0 -38
- package/dist/routes/rest/collections/findByID.js.map +0 -1
- package/dist/routes/rest/collections/findVersionByID.d.ts +0 -3
- package/dist/routes/rest/collections/findVersionByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/findVersionByID.js +0 -36
- package/dist/routes/rest/collections/findVersionByID.js.map +0 -1
- package/dist/routes/rest/collections/findVersions.d.ts +0 -3
- package/dist/routes/rest/collections/findVersions.d.ts.map +0 -1
- package/dist/routes/rest/collections/findVersions.js +0 -39
- package/dist/routes/rest/collections/findVersions.js.map +0 -1
- package/dist/routes/rest/collections/preview.d.ts +0 -3
- package/dist/routes/rest/collections/preview.d.ts.map +0 -1
- package/dist/routes/rest/collections/preview.js +0 -49
- package/dist/routes/rest/collections/preview.js.map +0 -1
- package/dist/routes/rest/collections/restoreVersion.d.ts +0 -3
- package/dist/routes/rest/collections/restoreVersion.d.ts.map +0 -1
- package/dist/routes/rest/collections/restoreVersion.js +0 -40
- package/dist/routes/rest/collections/restoreVersion.js.map +0 -1
- package/dist/routes/rest/collections/update.d.ts +0 -3
- package/dist/routes/rest/collections/update.d.ts.map +0 -1
- package/dist/routes/rest/collections/update.js +0 -62
- package/dist/routes/rest/collections/update.js.map +0 -1
- package/dist/routes/rest/collections/updateByID.d.ts +0 -3
- package/dist/routes/rest/collections/updateByID.d.ts.map +0 -1
- package/dist/routes/rest/collections/updateByID.js +0 -55
- package/dist/routes/rest/collections/updateByID.js.map +0 -1
- package/dist/routes/rest/files/checkFileAccess.d.ts +0 -7
- package/dist/routes/rest/files/checkFileAccess.d.ts.map +0 -1
- package/dist/routes/rest/files/checkFileAccess.js +0 -57
- package/dist/routes/rest/files/checkFileAccess.js.map +0 -1
- package/dist/routes/rest/files/getFile.d.ts +0 -9
- package/dist/routes/rest/files/getFile.d.ts.map +0 -1
- package/dist/routes/rest/files/getFile.js +0 -70
- package/dist/routes/rest/files/getFile.js.map +0 -1
- package/dist/routes/rest/files/getFileTypeFallback.d.ts +0 -7
- package/dist/routes/rest/files/getFileTypeFallback.d.ts.map +0 -1
- package/dist/routes/rest/files/getFileTypeFallback.js +0 -20
- package/dist/routes/rest/files/getFileTypeFallback.js.map +0 -1
- package/dist/routes/rest/globals/docAccess.d.ts +0 -3
- package/dist/routes/rest/globals/docAccess.d.ts.map +0 -1
- package/dist/routes/rest/globals/docAccess.js +0 -20
- package/dist/routes/rest/globals/docAccess.js.map +0 -1
- package/dist/routes/rest/globals/findOne.d.ts +0 -3
- package/dist/routes/rest/globals/findOne.d.ts.map +0 -1
- package/dist/routes/rest/globals/findOne.js +0 -30
- package/dist/routes/rest/globals/findOne.js.map +0 -1
- package/dist/routes/rest/globals/findVersionByID.d.ts +0 -3
- package/dist/routes/rest/globals/findVersionByID.d.ts.map +0 -1
- package/dist/routes/rest/globals/findVersionByID.js +0 -30
- package/dist/routes/rest/globals/findVersionByID.js.map +0 -1
- package/dist/routes/rest/globals/findVersions.d.ts +0 -3
- package/dist/routes/rest/globals/findVersions.d.ts.map +0 -1
- package/dist/routes/rest/globals/findVersions.js +0 -39
- package/dist/routes/rest/globals/findVersions.js.map +0 -1
- package/dist/routes/rest/globals/preview.d.ts +0 -3
- package/dist/routes/rest/globals/preview.d.ts.map +0 -1
- package/dist/routes/rest/globals/preview.js +0 -47
- package/dist/routes/rest/globals/preview.js.map +0 -1
- package/dist/routes/rest/globals/restoreVersion.d.ts +0 -3
- package/dist/routes/rest/globals/restoreVersion.d.ts.map +0 -1
- package/dist/routes/rest/globals/restoreVersion.js +0 -34
- package/dist/routes/rest/globals/restoreVersion.js.map +0 -1
- package/dist/routes/rest/globals/update.d.ts +0 -3
- package/dist/routes/rest/globals/update.d.ts.map +0 -1
- package/dist/routes/rest/globals/update.js +0 -46
- package/dist/routes/rest/globals/update.js.map +0 -1
- package/dist/routes/rest/routeError.d.ts +0 -9
- package/dist/routes/rest/routeError.d.ts.map +0 -1
- package/dist/routes/rest/routeError.js +0 -83
- package/dist/routes/rest/routeError.js.map +0 -1
- package/dist/routes/rest/types.d.ts +0 -23
- package/dist/routes/rest/types.d.ts.map +0 -1
- package/dist/routes/rest/types.js +0 -2
- package/dist/routes/rest/types.js.map +0 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts +0 -9
- package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +0 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.js +0 -20
- package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +0 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts +0 -8
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +0 -1
- package/dist/utilities/addDataAndFileToRequest.js +0 -47
- package/dist/utilities/addDataAndFileToRequest.js.map +0 -1
- package/dist/utilities/addLocalesToRequest.d.ts +0 -17
- package/dist/utilities/addLocalesToRequest.d.ts.map +0 -1
- package/dist/utilities/addLocalesToRequest.js +0 -65
- package/dist/utilities/addLocalesToRequest.js.map +0 -1
- package/dist/utilities/createPayloadRequest.d.ts +0 -11
- package/dist/utilities/createPayloadRequest.d.ts.map +0 -1
- package/dist/utilities/createPayloadRequest.js +0 -103
- package/dist/utilities/createPayloadRequest.js.map +0 -1
- package/dist/utilities/getRequestLanguage.d.ts +0 -12
- package/dist/utilities/getRequestLanguage.d.ts.map +0 -1
- package/dist/utilities/getRequestLanguage.js +0 -19
- package/dist/utilities/getRequestLanguage.js.map +0 -1
- package/dist/utilities/getRequestLocales.d.ts +0 -12
- package/dist/utilities/getRequestLocales.d.ts.map +0 -1
- package/dist/utilities/getRequestLocales.js +0 -35
- package/dist/utilities/getRequestLocales.js.map +0 -1
- package/dist/utilities/headersWithCors.d.ts +0 -8
- package/dist/utilities/headersWithCors.d.ts.map +0 -1
- package/dist/utilities/headersWithCors.js +0 -24
- package/dist/utilities/headersWithCors.js.map +0 -1
- package/dist/utilities/mergeHeaders.d.ts +0 -2
- package/dist/utilities/mergeHeaders.d.ts.map +0 -1
- package/dist/utilities/mergeHeaders.js +0 -10
- package/dist/utilities/mergeHeaders.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkEndpoints.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/checkEndpoints.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,4BAG9B;IACD,SAAS,EAAE,KAAK,GAAG,OAAO,EAAE,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAC1B,aAWA,CAAA"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
export const endpointsAreDisabled = ({
|
|
3
|
-
endpoints,
|
|
4
|
-
request
|
|
5
|
-
}) => {
|
|
6
|
-
if (!endpoints) {
|
|
7
|
-
return Response.json({
|
|
8
|
-
message: `Cannot ${request.method.toUpperCase()} ${request.url}`
|
|
9
|
-
}, {
|
|
10
|
-
status: httpStatus.NOT_IMPLEMENTED
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=checkEndpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkEndpoints.js","names":["httpStatus","endpointsAreDisabled","endpoints","request","Response","json","message","method","toUpperCase","url","status","NOT_IMPLEMENTED"],"sources":["../../../src/routes/rest/checkEndpoints.ts"],"sourcesContent":["import httpStatus from 'http-status'\n\nexport const endpointsAreDisabled = ({\n endpoints,\n request,\n}: {\n endpoints: false | unknown[]\n request: Partial<Request>\n}) => {\n if (!endpoints) {\n return Response.json(\n {\n message: `Cannot ${request.method.toUpperCase()} ${request.url}`,\n },\n {\n status: httpStatus.NOT_IMPLEMENTED,\n },\n )\n }\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AAEvB,OAAO,MAAMC,oBAAA,GAAuBA,CAAC;EACnCC,SAAS;EACTC;AAAO,CAIR;EACC,IAAI,CAACD,SAAA,EAAW;IACd,OAAOE,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAAS,UAAUH,OAAA,CAAQI,MAAM,CAACC,WAAW,MAAML,OAAA,CAAQM,GAAG;IAChE,GACA;MACEC,MAAA,EAAQV,UAAA,CAAWW;IACrB;EAEJ;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/count.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,KAAK,EAAE,sBAcnB,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { countOperation } from 'payload';
|
|
3
|
-
export const count = async ({
|
|
4
|
-
collection,
|
|
5
|
-
req
|
|
6
|
-
}) => {
|
|
7
|
-
const {
|
|
8
|
-
where
|
|
9
|
-
} = req.query;
|
|
10
|
-
const result = await countOperation({
|
|
11
|
-
collection,
|
|
12
|
-
req,
|
|
13
|
-
where
|
|
14
|
-
});
|
|
15
|
-
return Response.json(result, {
|
|
16
|
-
status: httpStatus.OK
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=count.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"count.js","names":["httpStatus","countOperation","count","collection","req","where","query","result","Response","json","status","OK"],"sources":["../../../../src/routes/rest/collections/count.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { countOperation } from 'payload'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const count: CollectionRouteHandler = async ({ collection, req }) => {\n const { where } = req.query as {\n where?: Where\n }\n\n const result = await countOperation({\n collection,\n req,\n where,\n })\n\n return Response.json(result, {\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,cAAc,QAAQ;AAI/B,OAAO,MAAMC,KAAA,GAAgC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC;EAAK,CAAE,GAAGD,GAAA,CAAIE,KAAK;EAI3B,MAAMC,MAAA,GAAS,MAAMN,cAAA,CAAe;IAClCE,UAAA;IACAC,GAAA;IACAC;EACF;EAEA,OAAOG,QAAA,CAASC,IAAI,CAACF,MAAA,EAAQ;IAC3BG,MAAA,EAAQV,UAAA,CAAWW;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/create.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBAgCpB,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { getTranslation } from '@payloadcms/translations';
|
|
2
|
-
import httpStatus from 'http-status';
|
|
3
|
-
import { createOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
4
|
-
import { isNumber } from 'payload/shared';
|
|
5
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
6
|
-
export const create = async ({
|
|
7
|
-
collection,
|
|
8
|
-
req
|
|
9
|
-
}) => {
|
|
10
|
-
const {
|
|
11
|
-
searchParams
|
|
12
|
-
} = req;
|
|
13
|
-
const autosave = searchParams.get('autosave') === 'true';
|
|
14
|
-
const draft = searchParams.get('draft') === 'true';
|
|
15
|
-
const depth = searchParams.get('depth');
|
|
16
|
-
const doc = await createOperation({
|
|
17
|
-
autosave,
|
|
18
|
-
collection,
|
|
19
|
-
data: req.data,
|
|
20
|
-
depth: isNumber(depth) ? depth : undefined,
|
|
21
|
-
draft,
|
|
22
|
-
populate: sanitizePopulateParam(req.query.populate),
|
|
23
|
-
req,
|
|
24
|
-
select: sanitizeSelectParam(req.query.select)
|
|
25
|
-
});
|
|
26
|
-
return Response.json({
|
|
27
|
-
doc,
|
|
28
|
-
message: req.t('general:successfullyCreated', {
|
|
29
|
-
label: getTranslation(collection.config.labels.singular, req.i18n)
|
|
30
|
-
})
|
|
31
|
-
}, {
|
|
32
|
-
headers: headersWithCors({
|
|
33
|
-
headers: new Headers(),
|
|
34
|
-
req
|
|
35
|
-
}),
|
|
36
|
-
status: httpStatus.CREATED
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=create.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","names":["getTranslation","httpStatus","createOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","create","collection","req","searchParams","autosave","get","draft","depth","doc","data","undefined","populate","query","select","Response","json","message","t","label","config","labels","singular","i18n","headers","Headers","status","CREATED"],"sources":["../../../../src/routes/rest/collections/create.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { createOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const create: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams } = req\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const depth = searchParams.get('depth')\n\n const doc = await createOperation({\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? depth : undefined,\n draft,\n populate: sanitizePopulateParam(req.query.populate),\n req,\n select: sanitizeSelectParam(req.query.select),\n })\n\n return Response.json(\n {\n doc,\n message: req.t('general:successfullyCreated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n }),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.CREATED,\n },\n )\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAC5E,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,QAAA,GAAWD,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAME,KAAA,GAAQJ,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMG,GAAA,GAAM,MAAMb,eAAA,CAAgB;IAChCS,QAAA;IACAH,UAAA;IACAQ,IAAA,EAAMP,GAAA,CAAIO,IAAI;IACdF,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASA,KAAA,GAAQG,SAAA;IACjCJ,KAAA;IACAK,QAAA,EAAUf,qBAAA,CAAsBM,GAAA,CAAIU,KAAK,CAACD,QAAQ;IAClDT,GAAA;IACAW,MAAA,EAAQhB,mBAAA,CAAoBK,GAAA,CAAIU,KAAK,CAACC,MAAM;EAC9C;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEP,GAAA;IACAQ,OAAA,EAASd,GAAA,CAAIe,CAAC,CAAC,+BAA+B;MAC5CC,KAAA,EAAOzB,cAAA,CAAeQ,UAAA,CAAWkB,MAAM,CAACC,MAAM,CAACC,QAAQ,EAAEnB,GAAA,CAAIoB,IAAI;IACnE;EACF,GACA;IACEC,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbtB;IACF;IACAuB,MAAA,EAAQ/B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/delete.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,SAAS,EAAE,sBA+DvB,CAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { getTranslation } from '@payloadcms/translations';
|
|
2
|
-
import httpStatus from 'http-status';
|
|
3
|
-
import { deleteOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
4
|
-
import { isNumber } from 'payload/shared';
|
|
5
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
6
|
-
export const deleteDoc = async ({
|
|
7
|
-
collection,
|
|
8
|
-
req
|
|
9
|
-
}) => {
|
|
10
|
-
const {
|
|
11
|
-
depth,
|
|
12
|
-
overrideLock,
|
|
13
|
-
populate,
|
|
14
|
-
select,
|
|
15
|
-
where
|
|
16
|
-
} = req.query;
|
|
17
|
-
const result = await deleteOperation({
|
|
18
|
-
collection,
|
|
19
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
20
|
-
overrideLock: Boolean(overrideLock === 'true'),
|
|
21
|
-
populate: sanitizePopulateParam(populate),
|
|
22
|
-
req,
|
|
23
|
-
select: sanitizeSelectParam(select),
|
|
24
|
-
where
|
|
25
|
-
});
|
|
26
|
-
const headers = headersWithCors({
|
|
27
|
-
headers: new Headers(),
|
|
28
|
-
req
|
|
29
|
-
});
|
|
30
|
-
if (result.errors.length === 0) {
|
|
31
|
-
const message = req.t('general:deletedCountSuccessfully', {
|
|
32
|
-
count: result.docs.length,
|
|
33
|
-
label: getTranslation(collection.config.labels[result.docs.length === 1 ? 'singular' : 'plural'], req.i18n)
|
|
34
|
-
});
|
|
35
|
-
return Response.json({
|
|
36
|
-
...result,
|
|
37
|
-
message
|
|
38
|
-
}, {
|
|
39
|
-
headers,
|
|
40
|
-
status: httpStatus.OK
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
const total = result.docs.length + result.errors.length;
|
|
44
|
-
const message = req.t('error:unableToDeleteCount', {
|
|
45
|
-
count: result.errors.length,
|
|
46
|
-
label: getTranslation(collection.config.labels[total === 1 ? 'singular' : 'plural'], req.i18n),
|
|
47
|
-
total
|
|
48
|
-
});
|
|
49
|
-
return Response.json({
|
|
50
|
-
...result,
|
|
51
|
-
message
|
|
52
|
-
}, {
|
|
53
|
-
headers,
|
|
54
|
-
status: httpStatus.BAD_REQUEST
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=delete.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delete.js","names":["getTranslation","httpStatus","deleteOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","deleteDoc","collection","req","depth","overrideLock","populate","select","where","query","result","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/delete.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { deleteOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const deleteDoc: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, overrideLock, populate, select, where } = req.query as {\n depth?: string\n overrideLock?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n where?: Where\n }\n\n const result = await deleteOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n overrideLock: Boolean(overrideLock === 'true'),\n populate: sanitizePopulateParam(populate),\n req,\n select: sanitizeSelectParam(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:deletedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length === 1 ? 'singular' : 'plural'],\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\n const message = req.t('error:unableToDeleteCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total === 1 ? 'singular' : 'plural'], 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,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAC5E,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ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A,CAAOM,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAO5B,cAAA,CAAeQ,UAAA,CAAWqB,MAAM,CAACC,MAAM,CAACM,KAAA,KAAU,IAAI,aAAa,SAAS,EAAE3B,GAAA,CAAIsB,IAAI;IAC7FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGjB,MAAM;IACTQ;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQjC,UAAA,CAAWoC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/deleteByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,UAAU,EAAE,4BAoDxB,CAAA"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { deleteByIDOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
3
|
-
import { isNumber } from 'payload/shared';
|
|
4
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
-
export const deleteByID = async ({
|
|
7
|
-
id: incomingID,
|
|
8
|
-
collection,
|
|
9
|
-
req
|
|
10
|
-
}) => {
|
|
11
|
-
const {
|
|
12
|
-
searchParams
|
|
13
|
-
} = req;
|
|
14
|
-
const depth = searchParams.get('depth');
|
|
15
|
-
const overrideLock = searchParams.get('overrideLock');
|
|
16
|
-
const id = sanitizeCollectionID({
|
|
17
|
-
id: incomingID,
|
|
18
|
-
collectionSlug: collection.config.slug,
|
|
19
|
-
payload: req.payload
|
|
20
|
-
});
|
|
21
|
-
const doc = await deleteByIDOperation({
|
|
22
|
-
id,
|
|
23
|
-
collection,
|
|
24
|
-
depth: isNumber(depth) ? depth : undefined,
|
|
25
|
-
overrideLock: Boolean(overrideLock === 'true'),
|
|
26
|
-
populate: sanitizePopulateParam(req.query.populate),
|
|
27
|
-
req,
|
|
28
|
-
select: sanitizeSelectParam(req.query.select)
|
|
29
|
-
});
|
|
30
|
-
const headers = headersWithCors({
|
|
31
|
-
headers: new Headers(),
|
|
32
|
-
req
|
|
33
|
-
});
|
|
34
|
-
if (!doc) {
|
|
35
|
-
return Response.json({
|
|
36
|
-
message: req.t('general:notFound')
|
|
37
|
-
}, {
|
|
38
|
-
headers,
|
|
39
|
-
status: httpStatus.NOT_FOUND
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return Response.json({
|
|
43
|
-
doc,
|
|
44
|
-
message: req.t('general:deletedSuccessfully')
|
|
45
|
-
}, {
|
|
46
|
-
headers,
|
|
47
|
-
status: httpStatus.OK
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=deleteByID.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteByID.js","names":["httpStatus","deleteByIDOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","sanitizeCollectionID","deleteByID","id","incomingID","collection","req","searchParams","depth","get","overrideLock","collectionSlug","config","slug","payload","doc","undefined","Boolean","populate","query","select","headers","Headers","Response","json","message","t","status","NOT_FOUND","OK"],"sources":["../../../../src/routes/rest/collections/deleteByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { deleteByIDOperation, sanitizePopulateParam, sanitizeSelectParam } 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 deleteByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const overrideLock = searchParams.get('overrideLock')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await deleteByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? depth : undefined,\n overrideLock: Boolean(overrideLock === 'true'),\n populate: sanitizePopulateParam(req.query.populate),\n req,\n select: sanitizeSelectParam(req.query.select),\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (!doc) {\n return Response.json(\n {\n message: req.t('general:notFound'),\n },\n {\n headers,\n status: httpStatus.NOT_FOUND,\n },\n )\n }\n\n return Response.json(\n {\n doc,\n message: req.t('general:deletedSuccessfully'),\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAChF,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,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,YAAA,GAAeH,YAAA,CAAaE,GAAG,CAAC;EAEtC,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMnB,mBAAA,CAAoB;IACpCO,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASA,KAAA,GAAQQ,SAAA;IACjCN,YAAA,EAAcO,OAAA,CAAQP,YAAA,KAAiB;IACvCQ,QAAA,EAAUrB,qBAAA,CAAsBS,GAAA,CAAIa,KAAK,CAACD,QAAQ;IAClDZ,GAAA;IACAc,MAAA,EAAQtB,mBAAA,CAAoBQ,GAAA,CAAIa,KAAK,CAACC,MAAM;EAC9C;EAEA,MAAMC,OAAA,GAAUrB,eAAA,CAAgB;IAC9BqB,OAAA,EAAS,IAAIC,OAAA;IACbhB;EACF;EAEA,IAAI,CAACS,GAAA,EAAK;IACR,OAAOQ,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAASnB,GAAA,CAAIoB,CAAC,CAAC;IACjB,GACA;MACEL,OAAA;MACAM,MAAA,EAAQhC,UAAA,CAAWiC;IACrB;EAEJ;EAEA,OAAOL,QAAA,CAASC,IAAI,CAClB;IACET,GAAA;IACAU,OAAA,EAASnB,GAAA,CAAIoB,CAAC,CAAC;EACjB,GACA;IACEL,OAAA;IACAM,MAAA,EAAQhC,UAAA,CAAWkC;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docAccess.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/docAccess.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAI/D,eAAO,MAAM,SAAS,EAAE,4BAcvB,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { docAccessOperation } from 'payload';
|
|
3
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
4
|
-
export const docAccess = async ({
|
|
5
|
-
id,
|
|
6
|
-
collection,
|
|
7
|
-
req
|
|
8
|
-
}) => {
|
|
9
|
-
const result = await docAccessOperation({
|
|
10
|
-
id,
|
|
11
|
-
collection,
|
|
12
|
-
req
|
|
13
|
-
});
|
|
14
|
-
return Response.json(result, {
|
|
15
|
-
headers: headersWithCors({
|
|
16
|
-
headers: new Headers(),
|
|
17
|
-
req
|
|
18
|
-
}),
|
|
19
|
-
status: httpStatus.OK
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=docAccess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docAccess.js","names":["httpStatus","docAccessOperation","headersWithCors","docAccess","id","collection","req","result","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/docAccess.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { docAccessOperation } from 'payload'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const docAccess: CollectionRouteHandlerWithID = async ({ id, collection, req }) => {\n const result = await docAccessOperation({\n id,\n collection,\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,kBAAkB,QAAQ;AAInC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,SAAA,GAA0C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACnF,MAAMC,MAAA,GAAS,MAAMN,kBAAA,CAAmB;IACtCG,EAAA;IACAC,UAAA;IACAC;EACF;EAEA,OAAOE,QAAA,CAASC,IAAI,CAACF,MAAA,EAAQ;IAC3BG,OAAA,EAASR,eAAA,CAAgB;MACvBQ,OAAA,EAAS,IAAIC,OAAA;MACbL;IACF;IACAM,MAAA,EAAQZ,UAAA,CAAWa;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/duplicate.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,SAAS,EAAE,4BA4CvB,CAAA"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getTranslation } from '@payloadcms/translations';
|
|
2
|
-
import httpStatus from 'http-status';
|
|
3
|
-
import { duplicateOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
4
|
-
import { isNumber } from 'payload/shared';
|
|
5
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
6
|
-
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
7
|
-
export const duplicate = async ({
|
|
8
|
-
id: incomingID,
|
|
9
|
-
collection,
|
|
10
|
-
req
|
|
11
|
-
}) => {
|
|
12
|
-
const {
|
|
13
|
-
searchParams
|
|
14
|
-
} = req;
|
|
15
|
-
const depth = searchParams.get('depth');
|
|
16
|
-
// draft defaults to true, unless explicitly set requested as false to prevent the newly duplicated document from being published
|
|
17
|
-
const draft = searchParams.get('draft') !== 'false';
|
|
18
|
-
const id = sanitizeCollectionID({
|
|
19
|
-
id: incomingID,
|
|
20
|
-
collectionSlug: collection.config.slug,
|
|
21
|
-
payload: req.payload
|
|
22
|
-
});
|
|
23
|
-
const doc = await duplicateOperation({
|
|
24
|
-
id,
|
|
25
|
-
collection,
|
|
26
|
-
data: req.data,
|
|
27
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
28
|
-
draft,
|
|
29
|
-
populate: sanitizePopulateParam(req.query.populate),
|
|
30
|
-
req,
|
|
31
|
-
select: sanitizeSelectParam(req.query.select)
|
|
32
|
-
});
|
|
33
|
-
const message = req.t('general:successfullyDuplicated', {
|
|
34
|
-
label: getTranslation(collection.config.labels.singular, req.i18n)
|
|
35
|
-
});
|
|
36
|
-
return Response.json({
|
|
37
|
-
doc,
|
|
38
|
-
message
|
|
39
|
-
}, {
|
|
40
|
-
headers: headersWithCors({
|
|
41
|
-
headers: new Headers(),
|
|
42
|
-
req
|
|
43
|
-
}),
|
|
44
|
-
status: httpStatus.OK
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=duplicate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"duplicate.js","names":["getTranslation","httpStatus","duplicateOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","sanitizeCollectionID","duplicate","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","doc","data","Number","undefined","populate","query","select","message","t","label","labels","singular","i18n","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/duplicate.ts"],"sourcesContent":["import { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { duplicateOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const duplicate: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n // draft defaults to true, unless explicitly set requested as false to prevent the newly duplicated document from being published\n const draft = searchParams.get('draft') !== 'false'\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await duplicateOperation({\n id,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n populate: sanitizePopulateParam(req.query.populate),\n req,\n select: sanitizeSelectParam(req.query.select),\n })\n\n const message = req.t('general:successfullyDuplicated', {\n label: getTranslation(collection.config.labels.singular, req.i18n),\n })\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,kBAAkB,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAC/E,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ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":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/find.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGzD,eAAO,MAAM,IAAI,EAAE,sBAqClB,CAAA"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { findOperation, sanitizeJoinParams, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
3
|
-
import { isNumber } from 'payload/shared';
|
|
4
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
export const find = async ({
|
|
6
|
-
collection,
|
|
7
|
-
req
|
|
8
|
-
}) => {
|
|
9
|
-
const {
|
|
10
|
-
depth,
|
|
11
|
-
draft,
|
|
12
|
-
joins,
|
|
13
|
-
limit,
|
|
14
|
-
page,
|
|
15
|
-
pagination,
|
|
16
|
-
populate,
|
|
17
|
-
select,
|
|
18
|
-
sort,
|
|
19
|
-
where
|
|
20
|
-
} = req.query;
|
|
21
|
-
const result = await findOperation({
|
|
22
|
-
collection,
|
|
23
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
24
|
-
draft: draft === 'true',
|
|
25
|
-
joins: sanitizeJoinParams(joins),
|
|
26
|
-
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
27
|
-
page: isNumber(page) ? Number(page) : undefined,
|
|
28
|
-
pagination: pagination === 'false' ? false : undefined,
|
|
29
|
-
populate: sanitizePopulateParam(populate),
|
|
30
|
-
req,
|
|
31
|
-
select: sanitizeSelectParam(select),
|
|
32
|
-
sort: typeof sort === 'string' ? sort.split(',') : undefined,
|
|
33
|
-
where
|
|
34
|
-
});
|
|
35
|
-
return Response.json(result, {
|
|
36
|
-
headers: headersWithCors({
|
|
37
|
-
headers: new Headers(),
|
|
38
|
-
req
|
|
39
|
-
}),
|
|
40
|
-
status: httpStatus.OK
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=find.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","names":["httpStatus","findOperation","sanitizeJoinParams","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","find","collection","req","depth","draft","joins","limit","page","pagination","populate","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/find.ts"],"sourcesContent":["import type { JoinQuery, Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport {\n findOperation,\n sanitizeJoinParams,\n sanitizePopulateParam,\n sanitizeSelectParam,\n} from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, joins, limit, page, pagination, populate, select, sort, where } =\n req.query as {\n depth?: string\n draft?: string\n joins?: JoinQuery\n limit?: string\n page?: string\n pagination?: string\n populate?: Record<string, unknown>\n select?: Record<string, unknown>\n sort?: string\n where?: Where\n }\n\n const result = await findOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n joins: sanitizeJoinParams(joins),\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n pagination: pagination === 'false' ? false : undefined,\n populate: sanitizePopulateParam(populate),\n req,\n select: sanitizeSelectParam(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,SACEC,aAAa,EACbC,kBAAkB,EAClBC,qBAAqB,EACrBC,mBAAmB,QACd;AACP,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAA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|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { findByIDOperation, sanitizeJoinParams, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
3
|
-
import { isNumber } from 'payload/shared';
|
|
4
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
-
export const findByID = async ({
|
|
7
|
-
id: incomingID,
|
|
8
|
-
collection,
|
|
9
|
-
req
|
|
10
|
-
}) => {
|
|
11
|
-
const {
|
|
12
|
-
searchParams
|
|
13
|
-
} = req;
|
|
14
|
-
const depth = searchParams.get('depth');
|
|
15
|
-
const id = sanitizeCollectionID({
|
|
16
|
-
id: incomingID,
|
|
17
|
-
collectionSlug: collection.config.slug,
|
|
18
|
-
payload: req.payload
|
|
19
|
-
});
|
|
20
|
-
const result = await findByIDOperation({
|
|
21
|
-
id,
|
|
22
|
-
collection,
|
|
23
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
24
|
-
draft: searchParams.get('draft') === 'true',
|
|
25
|
-
joins: sanitizeJoinParams(req.query.joins),
|
|
26
|
-
populate: sanitizePopulateParam(req.query.populate),
|
|
27
|
-
req,
|
|
28
|
-
select: sanitizeSelectParam(req.query.select)
|
|
29
|
-
});
|
|
30
|
-
return Response.json(result, {
|
|
31
|
-
headers: headersWithCors({
|
|
32
|
-
headers: new Headers(),
|
|
33
|
-
req
|
|
34
|
-
}),
|
|
35
|
-
status: httpStatus.OK
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=findByID.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","sanitizeJoinParams","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","sanitizeCollectionID","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 {\n findByIDOperation,\n sanitizeJoinParams,\n sanitizePopulateParam,\n sanitizeSelectParam,\n} from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n joins: sanitizeJoinParams(req.query.joins as JoinQuery),\n populate: sanitizePopulateParam(req.query.populate),\n req,\n select: sanitizeSelectParam(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,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,qBAAqB,EACrBC,mBAAmB,QACd;AACP,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMnB,iBAAA,CAAkB;IACrCQ,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCS,KAAA,EAAOtB,kBAAA,CAAmBU,GAAA,CAAIa,KAAK,CAACD,KAAK;IACzCE,QAAA,EAAUvB,qBAAA,CAAsBS,GAAA,CAAIa,KAAK,CAACC,QAAQ;IAClDd,GAAA;IACAe,MAAA,EAAQvB,mBAAA,CAAoBQ,GAAA,CAAIa,KAAK,CAACE,MAAM;EAC9C;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACT,MAAA,EAAQ;IAC3BU,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQhC,UAAA,CAAWiC;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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;AAK/D,eAAO,MAAM,eAAe,EAAE,4BA8B7B,CAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { findVersionByIDOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
3
|
-
import { isNumber } from 'payload/shared';
|
|
4
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
|
|
6
|
-
export const findVersionByID = async ({
|
|
7
|
-
id: incomingID,
|
|
8
|
-
collection,
|
|
9
|
-
req
|
|
10
|
-
}) => {
|
|
11
|
-
const {
|
|
12
|
-
searchParams
|
|
13
|
-
} = req;
|
|
14
|
-
const depth = searchParams.get('depth');
|
|
15
|
-
const id = sanitizeCollectionID({
|
|
16
|
-
id: incomingID,
|
|
17
|
-
collectionSlug: collection.config.slug,
|
|
18
|
-
payload: req.payload
|
|
19
|
-
});
|
|
20
|
-
const result = await findVersionByIDOperation({
|
|
21
|
-
id,
|
|
22
|
-
collection,
|
|
23
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
24
|
-
populate: sanitizePopulateParam(req.query.populate),
|
|
25
|
-
req,
|
|
26
|
-
select: sanitizeSelectParam(req.query.select)
|
|
27
|
-
});
|
|
28
|
-
return Response.json(result, {
|
|
29
|
-
headers: headersWithCors({
|
|
30
|
-
headers: new Headers(),
|
|
31
|
-
req
|
|
32
|
-
}),
|
|
33
|
-
status: httpStatus.OK
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=findVersionByID.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","sanitizeCollectionID","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, sanitizePopulateParam, sanitizeSelectParam } 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 populate: sanitizePopulateParam(req.query.populate),\n req,\n select: sanitizeSelectParam(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,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AACrF,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,eAAA,GAAgD,MAAAA,CAAO;EAClEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMlB,wBAAA,CAAyB;IAC5CO,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,QAAA,EAAUpB,qBAAA,CAAsBS,GAAA,CAAIY,KAAK,CAACD,QAAQ;IAClDX,GAAA;IACAa,MAAA,EAAQrB,mBAAA,CAAoBQ,GAAA,CAAIY,KAAK,CAACC,MAAM;EAC9C;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAAStB,eAAA,CAAgB;MACvBsB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AACF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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;AAIzD,eAAO,MAAM,YAAY,EAAE,sBAgC1B,CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import httpStatus from 'http-status';
|
|
2
|
-
import { findVersionsOperation, sanitizePopulateParam, sanitizeSelectParam } from 'payload';
|
|
3
|
-
import { isNumber } from 'payload/shared';
|
|
4
|
-
import { headersWithCors } from '../../../utilities/headersWithCors.js';
|
|
5
|
-
export const findVersions = async ({
|
|
6
|
-
collection,
|
|
7
|
-
req
|
|
8
|
-
}) => {
|
|
9
|
-
const {
|
|
10
|
-
depth,
|
|
11
|
-
limit,
|
|
12
|
-
page,
|
|
13
|
-
pagination,
|
|
14
|
-
populate,
|
|
15
|
-
select,
|
|
16
|
-
sort,
|
|
17
|
-
where
|
|
18
|
-
} = req.query;
|
|
19
|
-
const result = await findVersionsOperation({
|
|
20
|
-
collection,
|
|
21
|
-
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
22
|
-
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
23
|
-
page: isNumber(page) ? Number(page) : undefined,
|
|
24
|
-
pagination: pagination === 'false' ? false : undefined,
|
|
25
|
-
populate: sanitizePopulateParam(populate),
|
|
26
|
-
req,
|
|
27
|
-
select: sanitizeSelectParam(select),
|
|
28
|
-
sort: typeof sort === 'string' ? sort.split(',') : undefined,
|
|
29
|
-
where
|
|
30
|
-
});
|
|
31
|
-
return Response.json(result, {
|
|
32
|
-
headers: headersWithCors({
|
|
33
|
-
headers: new Headers(),
|
|
34
|
-
req
|
|
35
|
-
}),
|
|
36
|
-
status: httpStatus.OK
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=findVersions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","findVersions","collection","req","depth","limit","page","pagination","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, sanitizePopulateParam, sanitizeSelectParam } 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, pagination, populate, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n pagination?: 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 pagination: pagination === 'false' ? false : undefined,\n populate: sanitizePopulateParam(populate),\n req,\n select: sanitizeSelectParam(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,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAClF,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAA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