@payloadcms/next 3.4.1-canary.b6681a9 → 3.5.1-canary.85da7f2
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/prod/styles.css +1 -1
- package/dist/routes/rest/collections/create.d.ts.map +1 -1
- package/dist/routes/rest/collections/create.js +3 -5
- 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 +3 -5
- 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 +3 -5
- 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 +3 -5
- 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 +3 -6
- 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 +3 -6
- 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 +3 -5
- 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 +3 -5
- package/dist/routes/rest/collections/findVersions.js.map +1 -1
- package/dist/routes/rest/collections/preview.d.ts.map +1 -1
- package/dist/routes/rest/collections/preview.js +2 -6
- package/dist/routes/rest/collections/preview.js.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -1
- package/dist/routes/rest/collections/restoreVersion.js +2 -3
- 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 +3 -5
- 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 +3 -5
- 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 +3 -5
- 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 +3 -5
- 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 +3 -5
- package/dist/routes/rest/globals/findVersions.js.map +1 -1
- package/dist/routes/rest/globals/preview.js +2 -2
- package/dist/routes/rest/globals/preview.js.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -1
- package/dist/routes/rest/globals/restoreVersion.js +2 -3
- 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 +3 -5
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/views/LivePreview/index.js +6 -5
- package/dist/views/LivePreview/index.js.map +1 -1
- package/package.json +9 -13
- package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +0 -13
- package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +0 -1
- package/dist/routes/rest/utilities/sanitizeJoinParams.js +0 -21
- package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +0 -1
- package/dist/routes/rest/utilities/sanitizePopulate.d.ts +0 -3
- package/dist/routes/rest/utilities/sanitizePopulate.d.ts.map +0 -1
- package/dist/routes/rest/utilities/sanitizePopulate.js +0 -11
- package/dist/routes/rest/utilities/sanitizePopulate.js.map +0 -1
- package/dist/routes/rest/utilities/sanitizeSelect.d.ts +0 -6
- package/dist/routes/rest/utilities/sanitizeSelect.d.ts.map +0 -1
- package/dist/routes/rest/utilities/sanitizeSelect.js +0 -17
- package/dist/routes/rest/utilities/sanitizeSelect.js.map +0 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
|
-
import { updateByIDOperation } from 'payload';
|
|
2
|
+
import { sanitizePopulateParam, sanitizeSelectParam, 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';
|
|
8
6
|
export const updateByID = async ({
|
|
9
7
|
id: incomingID,
|
|
10
8
|
collection,
|
|
@@ -31,10 +29,10 @@ export const updateByID = async ({
|
|
|
31
29
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
32
30
|
draft,
|
|
33
31
|
overrideLock: Boolean(overrideLock === 'true'),
|
|
34
|
-
populate:
|
|
32
|
+
populate: sanitizePopulateParam(req.query.populate),
|
|
35
33
|
publishSpecificLocale,
|
|
36
34
|
req,
|
|
37
|
-
select:
|
|
35
|
+
select: sanitizeSelectParam(req.query.select)
|
|
38
36
|
});
|
|
39
37
|
let message = req.t('general:updatedSuccessfully');
|
|
40
38
|
if (draft) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateByID.js","names":["httpStatus","
|
|
1
|
+
{"version":3,"file":"updateByID.js","names":["httpStatus","sanitizePopulateParam","sanitizeSelectParam","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","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 { sanitizePopulateParam, sanitizeSelectParam, 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 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: sanitizePopulateParam(req.query.populate),\n publishSpecificLocale,\n req,\n select: sanitizeSelectParam(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,qBAAqB,EAAEC,mBAAmB,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,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,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJW,cAAA,EAAgBV,UAAA,CAAWW,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASZ,GAAA,CAAIY;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMrB,mBAAA,CAAoB;IACpCK,EAAA;IACAO,QAAA;IACAL,UAAA;IACAe,IAAA,EAAMd,GAAA,CAAIc,IAAI;IACdZ,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASa,MAAA,CAAOb,KAAA,IAASc,SAAA;IACzCX,KAAA;IACAC,YAAA,EAAcW,OAAA,CAAQX,YAAA,KAAiB;IACvCY,QAAA,EAAU5B,qBAAA,CAAsBU,GAAA,CAAIQ,KAAK,CAACU,QAAQ;IAClDX,qBAAA;IACAP,GAAA;IACAmB,MAAA,EAAQ5B,mBAAA,CAAoBS,GAAA,CAAIQ,KAAK,CAACW,MAAM;EAC9C;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,EAAS9B,eAAA,CAAgB;MACvB8B,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;AAIrD,eAAO,MAAM,OAAO,EAAE,kBAqBrB,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
|
-
import { findOneOperation } from 'payload';
|
|
2
|
+
import { findOneOperation, sanitizePopulateParam, sanitizeSelectParam } 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';
|
|
7
5
|
export const findOne = async ({
|
|
8
6
|
globalConfig,
|
|
9
7
|
req
|
|
@@ -17,9 +15,9 @@ export const findOne = async ({
|
|
|
17
15
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
18
16
|
draft: searchParams.get('draft') === 'true',
|
|
19
17
|
globalConfig,
|
|
20
|
-
populate:
|
|
18
|
+
populate: sanitizePopulateParam(req.query.populate),
|
|
21
19
|
req,
|
|
22
|
-
select:
|
|
20
|
+
select: sanitizeSelectParam(req.query.select)
|
|
23
21
|
});
|
|
24
22
|
return Response.json(result, {
|
|
25
23
|
headers: headersWithCors({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","
|
|
1
|
+
{"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","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, sanitizePopulateParam, sanitizeSelectParam } 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 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,gBAAgB,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAC7E,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,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,EAAON,QAAA,CAASM,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCC,KAAA,EAAOP,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCJ,YAAA;IACAU,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,CAACT,MAAA,EAAQ;IAC3BU,OAAA,EAASjB,eAAA,CAAgB;MACvBiB,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;AAI3D,eAAO,MAAM,eAAe,EAAE,wBAoB7B,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
|
-
import { findVersionByIDOperationGlobal } from 'payload';
|
|
2
|
+
import { findVersionByIDOperationGlobal, sanitizePopulateParam, sanitizeSelectParam } 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';
|
|
7
5
|
export const findVersionByID = async ({
|
|
8
6
|
id,
|
|
9
7
|
globalConfig,
|
|
@@ -17,9 +15,9 @@ export const findVersionByID = async ({
|
|
|
17
15
|
id,
|
|
18
16
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
19
17
|
globalConfig,
|
|
20
|
-
populate:
|
|
18
|
+
populate: sanitizePopulateParam(req.query.populate),
|
|
21
19
|
req,
|
|
22
|
-
select:
|
|
20
|
+
select: sanitizeSelectParam(req.query.select)
|
|
23
21
|
});
|
|
24
22
|
return Response.json(result, {
|
|
25
23
|
headers: headersWithCors({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","
|
|
1
|
+
{"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","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, sanitizePopulateParam, sanitizeSelectParam } 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 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,8BAA8B,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AAC3F,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,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,EAAOP,QAAA,CAASO,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCP,YAAA;IACAQ,QAAA,EAAUd,qBAAA,CAAsBO,GAAA,CAAIQ,KAAK,CAACD,QAAQ;IAClDP,GAAA;IACAS,MAAA,EAAQf,mBAAA,CAAoBM,GAAA,CAAIQ,KAAK,CAACC,MAAM;EAC9C;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,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;AAIrD,eAAO,MAAM,YAAY,EAAE,kBA8B1B,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
|
-
import { findVersionsOperationGlobal } from 'payload';
|
|
2
|
+
import { findVersionsOperationGlobal, sanitizePopulateParam, sanitizeSelectParam } 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';
|
|
7
5
|
export const findVersions = async ({
|
|
8
6
|
globalConfig,
|
|
9
7
|
req
|
|
@@ -22,9 +20,9 @@ export const findVersions = async ({
|
|
|
22
20
|
globalConfig,
|
|
23
21
|
limit: isNumber(limit) ? Number(limit) : undefined,
|
|
24
22
|
page: isNumber(page) ? Number(page) : undefined,
|
|
25
|
-
populate:
|
|
23
|
+
populate: sanitizePopulateParam(populate),
|
|
26
24
|
req,
|
|
27
|
-
select:
|
|
25
|
+
select: sanitizeSelectParam(select),
|
|
28
26
|
sort: typeof sort === 'string' ? sort.split(',') : undefined,
|
|
29
27
|
where
|
|
30
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","
|
|
1
|
+
{"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","sanitizePopulateParam","sanitizeSelectParam","isNumber","headersWithCors","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, sanitizePopulateParam, sanitizeSelectParam } 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, 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: 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,2BAA2B,EAAEC,qBAAqB,EAAEC,mBAAmB,QAAQ;AACxF,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,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,EAAOL,QAAA,CAASK,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCZ,YAAA;IACAG,KAAA,EAAON,QAAA,CAASM,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,IAAA,EAAMP,QAAA,CAASO,IAAA,IAAQO,MAAA,CAAOP,IAAA,IAAQQ,SAAA;IACtCP,QAAA,EAAUV,qBAAA,CAAsBU,QAAA;IAChCJ,GAAA;IACAK,MAAA,EAAQV,mBAAA,CAAoBU,MAAA;IAC5BC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
|
|
@@ -11,7 +11,7 @@ export const preview = async ({
|
|
|
11
11
|
searchParams
|
|
12
12
|
} = req;
|
|
13
13
|
const depth = searchParams.get('depth');
|
|
14
|
-
const
|
|
14
|
+
const doc = await findOneOperation({
|
|
15
15
|
slug: globalConfig.slug,
|
|
16
16
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
17
17
|
draft: searchParams.get('draft') === 'true',
|
|
@@ -23,7 +23,7 @@ export const preview = async ({
|
|
|
23
23
|
const token = extractJWT(req);
|
|
24
24
|
if (typeof generatePreviewURL === 'function') {
|
|
25
25
|
try {
|
|
26
|
-
previewURL = await generatePreviewURL(
|
|
26
|
+
previewURL = await generatePreviewURL(doc, {
|
|
27
27
|
locale: req.locale,
|
|
28
28
|
req,
|
|
29
29
|
token
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","names":["httpStatus","extractJWT","findOneOperation","isNumber","headersWithCors","routeError","preview","globalConfig","req","searchParams","depth","get","
|
|
1
|
+
{"version":3,"file":"preview.js","names":["httpStatus","extractJWT","findOneOperation","isNumber","headersWithCors","routeError","preview","globalConfig","req","searchParams","depth","get","doc","slug","Number","undefined","draft","previewURL","generatePreviewURL","payload","config","globals","find","admin","token","locale","err","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/preview.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT, findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { routeError } from '../routeError.js'\n\nexport const preview: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const doc = 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 let previewURL: string\n\n const generatePreviewURL = req.payload.config.globals.find(\n (config) => config.slug === globalConfig.slug,\n )?.admin?.preview\n\n const token = extractJWT(req)\n\n if (typeof generatePreviewURL === 'function') {\n try {\n previewURL = await generatePreviewURL(doc, {\n locale: req.locale,\n req,\n token,\n })\n } catch (err) {\n return routeError({\n config: req.payload.config,\n err,\n req,\n })\n }\n }\n\n return Response.json(previewURL, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,UAAU,EAAEC,gBAAgB,QAAQ;AAC7C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAE3B,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,GAAA,GAAM,MAAMV,gBAAA,CAAiB;IACjCW,IAAA,EAAMN,YAAA,CAAaM,IAAI;IACvBH,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCC,KAAA,EAAOP,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCJ,YAAA;IACAC;EACF;EAEA,IAAIS,UAAA;EAEJ,MAAMC,kBAAA,GAAqBV,GAAA,CAAIW,OAAO,CAACC,MAAM,CAACC,OAAO,CAACC,IAAI,CACvDF,MAAA,IAAWA,MAAA,CAAOP,IAAI,KAAKN,YAAA,CAAaM,IAAI,GAC5CU,KAAA,EAAOjB,OAAA;EAEV,MAAMkB,KAAA,GAAQvB,UAAA,CAAWO,GAAA;EAEzB,IAAI,OAAOU,kBAAA,KAAuB,YAAY;IAC5C,IAAI;MACFD,UAAA,GAAa,MAAMC,kBAAA,CAAmBN,GAAA,EAAK;QACzCa,MAAA,EAAQjB,GAAA,CAAIiB,MAAM;QAClBjB,GAAA;QACAgB;MACF;IACF,EAAE,OAAOE,GAAA,EAAK;MACZ,OAAOrB,UAAA,CAAW;QAChBe,MAAA,EAAQZ,GAAA,CAAIW,OAAO,CAACC,MAAM;QAC1BM,GAAA;QACAlB;MACF;IACF;EACF;EAEA,OAAOmB,QAAA,CAASC,IAAI,CAACX,UAAA,EAAY;IAC/BY,OAAA,EAASzB,eAAA,CAAgB;MACvByB,OAAA,EAAS,IAAIC,OAAA;MACbtB;IACF;IACAuB,MAAA,EAAQ/B,UAAA,CAAWgC;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;AAI3D,eAAO,MAAM,cAAc,EAAE,wBA2B5B,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
|
-
import { restoreVersionOperationGlobal } from 'payload';
|
|
2
|
+
import { restoreVersionOperationGlobal, sanitizePopulateParam } 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
5
|
export const restoreVersion = async ({
|
|
7
6
|
id,
|
|
8
7
|
globalConfig,
|
|
@@ -18,7 +17,7 @@ export const restoreVersion = async ({
|
|
|
18
17
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
19
18
|
draft: draft === 'true' ? true : undefined,
|
|
20
19
|
globalConfig,
|
|
21
|
-
populate:
|
|
20
|
+
populate: sanitizePopulateParam(req.query.populate),
|
|
22
21
|
req
|
|
23
22
|
});
|
|
24
23
|
return Response.json({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperationGlobal","
|
|
1
|
+
{"version":3,"file":"restoreVersion.js","names":["httpStatus","restoreVersionOperationGlobal","sanitizePopulateParam","isNumber","headersWithCors","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, sanitizePopulateParam } 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 populate: sanitizePopulateParam(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,EAAEC,qBAAqB,QAAQ;AACrE,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,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,EAAOP,QAAA,CAASO,KAAA,IAASI,MAAA,CAAOJ,KAAA,IAASK,SAAA;IACzCH,KAAA,EAAOA,KAAA,KAAU,SAAS,OAAOG,SAAA;IACjCR,YAAA;IACAS,QAAA,EAAUd,qBAAA,CAAsBM,GAAA,CAAIS,KAAK,CAACD,QAAQ;IAClDR;EACF;EAEA,OAAOU,QAAA,CAASC,IAAI,CAClB;IACEN,GAAA;IACAO,OAAA,EAASZ,GAAA,CAAIa,CAAC,CAAC;EACjB,GACA;IACEC,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,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;AAIrD,eAAO,MAAM,MAAM,EAAE,kBA0CpB,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import httpStatus from 'http-status';
|
|
2
|
-
import { updateOperationGlobal } from 'payload';
|
|
2
|
+
import { sanitizePopulateParam, sanitizeSelectParam, 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';
|
|
7
5
|
export const update = async ({
|
|
8
6
|
globalConfig,
|
|
9
7
|
req
|
|
@@ -22,10 +20,10 @@ export const update = async ({
|
|
|
22
20
|
depth: isNumber(depth) ? Number(depth) : undefined,
|
|
23
21
|
draft,
|
|
24
22
|
globalConfig,
|
|
25
|
-
populate:
|
|
23
|
+
populate: sanitizePopulateParam(req.query.populate),
|
|
26
24
|
publishSpecificLocale,
|
|
27
25
|
req,
|
|
28
|
-
select:
|
|
26
|
+
select: sanitizeSelectParam(req.query.select)
|
|
29
27
|
});
|
|
30
28
|
let message = req.t('general:updatedSuccessfully');
|
|
31
29
|
if (draft) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","names":["httpStatus","
|
|
1
|
+
{"version":3,"file":"update.js","names":["httpStatus","sanitizePopulateParam","sanitizeSelectParam","updateOperationGlobal","isNumber","headersWithCors","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 { sanitizePopulateParam, sanitizeSelectParam, 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 populate: sanitizePopulateParam(req.query.populate),\n publishSpecificLocale,\n req,\n select: sanitizeSelectParam(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,EAAEC,mBAAmB,EAAEC,qBAAqB,QAAQ;AAClF,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,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,MAAMb,qBAAA,CAAsB;IACzCc,IAAA,EAAMV,YAAA,CAAaU,IAAI;IACvBJ,QAAA;IACAK,IAAA,EAAMV,GAAA,CAAIU,IAAI;IACdR,KAAA,EAAON,QAAA,CAASM,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCR,KAAA;IACAL,YAAA;IACAc,QAAA,EAAUpB,qBAAA,CAAsBO,GAAA,CAAIO,KAAK,CAACM,QAAQ;IAClDP,qBAAA;IACAN,GAAA;IACAc,MAAA,EAAQpB,mBAAA,CAAoBM,GAAA,CAAIO,KAAK,CAACO,MAAM;EAC9C;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,EAAStB,eAAA,CAAgB;MACvBsB,OAAA,EAAS,IAAIC,OAAA;MACbpB;IACF;IACAqB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
|
|
@@ -31,17 +31,18 @@ export const LivePreviewView = async props => {
|
|
|
31
31
|
label: 'Responsive',
|
|
32
32
|
width: '100%'
|
|
33
33
|
}];
|
|
34
|
-
|
|
34
|
+
const url = typeof livePreviewConfig?.url === 'function' ? await livePreviewConfig.url({
|
|
35
35
|
collectionConfig,
|
|
36
36
|
data: doc,
|
|
37
37
|
globalConfig,
|
|
38
38
|
locale,
|
|
39
|
+
req,
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
* Use `req.payload` instead. This will be removed in the next major version.
|
|
43
|
+
*/
|
|
39
44
|
payload: initPageResult.req.payload
|
|
40
45
|
}) : livePreviewConfig?.url;
|
|
41
|
-
// Support relative URLs by prepending the origin, if necessary
|
|
42
|
-
if (url && url.startsWith('/')) {
|
|
43
|
-
url = `${initPageResult.req.protocol}//${initPageResult.req.host}${url}`;
|
|
44
|
-
}
|
|
45
46
|
return /*#__PURE__*/_jsx(LivePreviewClient, {
|
|
46
47
|
breakpoints: breakpoints,
|
|
47
48
|
initialData: doc,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","LivePreviewClient","LivePreviewView","props","doc","initPageResult","collectionConfig","globalConfig","locale","req","livePreviewConfig","payload","config","admin","livePreview","breakpoints","name","height","label","width","url","data","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","LivePreviewClient","LivePreviewView","props","doc","initPageResult","collectionConfig","globalConfig","locale","req","livePreviewConfig","payload","config","admin","livePreview","breakpoints","name","height","label","width","url","data","_jsx","initialData"],"sources":["../../../src/views/LivePreview/index.tsx"],"sourcesContent":["import type { EditViewComponent, LivePreviewConfig, PayloadServerReactComponent } from 'payload'\n\nimport React from 'react'\n\nimport './index.scss'\nimport { LivePreviewClient } from './index.client.js'\n\nexport const LivePreviewView: PayloadServerReactComponent<EditViewComponent> = async (props) => {\n const { doc, initPageResult } = props\n\n const { collectionConfig, globalConfig, locale, req } = initPageResult\n\n let livePreviewConfig: LivePreviewConfig = req.payload.config?.admin?.livePreview\n\n if (collectionConfig) {\n livePreviewConfig = {\n ...(livePreviewConfig || {}),\n ...(collectionConfig.admin.livePreview || {}),\n }\n }\n\n if (globalConfig) {\n livePreviewConfig = {\n ...(livePreviewConfig || {}),\n ...(globalConfig.admin.livePreview || {}),\n }\n }\n\n const breakpoints: LivePreviewConfig['breakpoints'] = [\n ...(livePreviewConfig?.breakpoints || []),\n {\n name: 'responsive',\n height: '100%',\n label: 'Responsive',\n width: '100%',\n },\n ]\n\n const url =\n typeof livePreviewConfig?.url === 'function'\n ? await livePreviewConfig.url({\n collectionConfig,\n data: doc,\n globalConfig,\n locale,\n req,\n /**\n * @deprecated\n * Use `req.payload` instead. This will be removed in the next major version.\n */\n payload: initPageResult.req.payload,\n })\n : livePreviewConfig?.url\n\n return <LivePreviewClient breakpoints={breakpoints} initialData={doc} url={url} />\n}\n"],"mappings":";AAEA,OAAOA,KAAA,MAAW;AAGlB,SAASC,iBAAiB,QAAQ;AAElC,OAAO,MAAMC,eAAA,GAAkE,MAAOC,KAAA;EACpF,MAAM;IAAEC,GAAG;IAAEC;EAAc,CAAE,GAAGF,KAAA;EAEhC,MAAM;IAAEG,gBAAgB;IAAEC,YAAY;IAAEC,MAAM;IAAEC;EAAG,CAAE,GAAGJ,cAAA;EAExD,IAAIK,iBAAA,GAAuCD,GAAA,CAAIE,OAAO,CAACC,MAAM,EAAEC,KAAA,EAAOC,WAAA;EAEtE,IAAIR,gBAAA,EAAkB;IACpBI,iBAAA,GAAoB;MAClB,IAAIA,iBAAA,IAAqB,CAAC,CAAC;MAC3B,IAAIJ,gBAAA,CAAiBO,KAAK,CAACC,WAAW,IAAI,CAAC,CAAC;IAC9C;EACF;EAEA,IAAIP,YAAA,EAAc;IAChBG,iBAAA,GAAoB;MAClB,IAAIA,iBAAA,IAAqB,CAAC,CAAC;MAC3B,IAAIH,YAAA,CAAaM,KAAK,CAACC,WAAW,IAAI,CAAC,CAAC;IAC1C;EACF;EAEA,MAAMC,WAAA,GAAgD,C,IAChDL,iBAAA,EAAmBK,WAAA,IAAe,EAAE,GACxC;IACEC,IAAA,EAAM;IACNC,MAAA,EAAQ;IACRC,KAAA,EAAO;IACPC,KAAA,EAAO;EACT,EACD;EAED,MAAMC,GAAA,GACJ,OAAOV,iBAAA,EAAmBU,GAAA,KAAQ,aAC9B,MAAMV,iBAAA,CAAkBU,GAAG,CAAC;IAC1Bd,gBAAA;IACAe,IAAA,EAAMjB,GAAA;IACNG,YAAA;IACAC,MAAA;IACAC,GAAA;IACA;;;;IAIAE,OAAA,EAASN,cAAA,CAAeI,GAAG,CAACE;EAC9B,KACAD,iBAAA,EAAmBU,GAAA;EAEzB,oBAAOE,IAAA,CAACrB,iBAAA;IAAkBc,WAAA,EAAaA,WAAA;IAAaQ,WAAA,EAAanB,GAAA;IAAKgB,GAAA,EAAKA;;AAC7E","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.1-canary.85da7f2",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"sass": "1.77.4",
|
|
80
80
|
"sonner": "^1.7.0",
|
|
81
81
|
"uuid": "10.0.0",
|
|
82
|
-
"@payloadcms/graphql": "3.
|
|
83
|
-
"@payloadcms/
|
|
84
|
-
"@payloadcms/
|
|
82
|
+
"@payloadcms/graphql": "3.5.1-canary.85da7f2",
|
|
83
|
+
"@payloadcms/translations": "3.5.1-canary.85da7f2",
|
|
84
|
+
"@payloadcms/ui": "3.5.1-canary.85da7f2"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@babel/cli": "7.25.9",
|
|
@@ -89,10 +89,10 @@
|
|
|
89
89
|
"@babel/preset-env": "7.26.0",
|
|
90
90
|
"@babel/preset-react": "7.25.9",
|
|
91
91
|
"@babel/preset-typescript": "7.26.0",
|
|
92
|
-
"@next/eslint-plugin-next": "15.0.
|
|
92
|
+
"@next/eslint-plugin-next": "15.0.4",
|
|
93
93
|
"@types/busboy": "1.5.4",
|
|
94
|
-
"@types/react": "
|
|
95
|
-
"@types/react-dom": "
|
|
94
|
+
"@types/react": "19.0.1",
|
|
95
|
+
"@types/react-dom": "19.0.1",
|
|
96
96
|
"@types/uuid": "10.0.0",
|
|
97
97
|
"babel-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|
|
98
98
|
"esbuild": "0.24.0",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|
|
101
101
|
"swc-plugin-transform-remove-imports": "2.0.0",
|
|
102
102
|
"@payloadcms/eslint-config": "3.0.0",
|
|
103
|
-
"payload": "3.
|
|
103
|
+
"payload": "3.5.1-canary.85da7f2"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"graphql": "^16.8.1",
|
|
107
107
|
"next": "^15.0.0",
|
|
108
|
-
"payload": "3.
|
|
108
|
+
"payload": "3.5.1-canary.85da7f2"
|
|
109
109
|
},
|
|
110
110
|
"engines": {
|
|
111
111
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -113,10 +113,6 @@
|
|
|
113
113
|
"publishConfig": {
|
|
114
114
|
"registry": "https://registry.npmjs.org/"
|
|
115
115
|
},
|
|
116
|
-
"overrides": {
|
|
117
|
-
"@types/react": "npm:types-react@19.0.0-rc.1",
|
|
118
|
-
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
|
|
119
|
-
},
|
|
120
116
|
"scripts": {
|
|
121
117
|
"build": "pnpm build:reactcompiler",
|
|
122
118
|
"build:babel": "rm -rf dist_optimized && babel dist --out-dir dist_optimized --source-maps --extensions .ts,.js,.tsx,.jsx,.cjs,.mjs && rm -rf dist && mv dist_optimized dist",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { JoinQuery } from 'payload';
|
|
2
|
-
/**
|
|
3
|
-
* Convert request JoinQuery object from strings to numbers
|
|
4
|
-
* @param joins
|
|
5
|
-
*/
|
|
6
|
-
export declare const sanitizeJoinParams: (joins?: {
|
|
7
|
-
[schemaPath: string]: {
|
|
8
|
-
limit?: unknown;
|
|
9
|
-
sort?: string;
|
|
10
|
-
where?: unknown;
|
|
11
|
-
} | false;
|
|
12
|
-
} | false) => JoinQuery;
|
|
13
|
-
//# sourceMappingURL=sanitizeJoinParams.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeJoinParams.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/utilities/sanitizeJoinParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIxC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,WAEzB;IACE,CAAC,UAAU,EAAE,MAAM,GACf;QACE,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,GACD,KAAK,CAAA;CACV,GACD,KAAK,KACR,SAgBF,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { isNumber } from 'payload/shared';
|
|
2
|
-
/**
|
|
3
|
-
* Convert request JoinQuery object from strings to numbers
|
|
4
|
-
* @param joins
|
|
5
|
-
*/
|
|
6
|
-
export const sanitizeJoinParams = (joins = {}) => {
|
|
7
|
-
const joinQuery = {};
|
|
8
|
-
Object.keys(joins).forEach(schemaPath => {
|
|
9
|
-
if (joins[schemaPath] === 'false' || joins[schemaPath] === false) {
|
|
10
|
-
joinQuery[schemaPath] = false;
|
|
11
|
-
} else {
|
|
12
|
-
joinQuery[schemaPath] = {
|
|
13
|
-
limit: isNumber(joins[schemaPath]?.limit) ? Number(joins[schemaPath].limit) : undefined,
|
|
14
|
-
sort: joins[schemaPath]?.sort ? joins[schemaPath].sort : undefined,
|
|
15
|
-
where: joins[schemaPath]?.where ? joins[schemaPath].where : undefined
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
return joinQuery;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=sanitizeJoinParams.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeJoinParams.js","names":["isNumber","sanitizeJoinParams","joins","joinQuery","Object","keys","forEach","schemaPath","limit","Number","undefined","sort","where"],"sources":["../../../../src/routes/rest/utilities/sanitizeJoinParams.ts"],"sourcesContent":["import type { JoinQuery } from 'payload'\n\nimport { isNumber } from 'payload/shared'\n\n/**\n * Convert request JoinQuery object from strings to numbers\n * @param joins\n */\nexport const sanitizeJoinParams = (\n joins:\n | {\n [schemaPath: string]:\n | {\n limit?: unknown\n sort?: string\n where?: unknown\n }\n | false\n }\n | false = {},\n): JoinQuery => {\n const joinQuery = {}\n\n Object.keys(joins).forEach((schemaPath) => {\n if (joins[schemaPath] === 'false' || joins[schemaPath] === false) {\n joinQuery[schemaPath] = false\n } else {\n joinQuery[schemaPath] = {\n limit: isNumber(joins[schemaPath]?.limit) ? Number(joins[schemaPath].limit) : undefined,\n sort: joins[schemaPath]?.sort ? joins[schemaPath].sort : undefined,\n where: joins[schemaPath]?.where ? joins[schemaPath].where : undefined,\n }\n }\n })\n\n return joinQuery\n}\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AAEzB;;;;AAIA,OAAO,MAAMC,kBAAA,GAAqBA,CAChCC,KAAA,GAUY,CAAC,CAAC;EAEd,MAAMC,SAAA,GAAY,CAAC;EAEnBC,MAAA,CAAOC,IAAI,CAACH,KAAA,EAAOI,OAAO,CAAEC,UAAA;IAC1B,IAAIL,KAAK,CAACK,UAAA,CAAW,KAAK,WAAWL,KAAK,CAACK,UAAA,CAAW,KAAK,OAAO;MAChEJ,SAAS,CAACI,UAAA,CAAW,GAAG;IAC1B,OAAO;MACLJ,SAAS,CAACI,UAAA,CAAW,GAAG;QACtBC,KAAA,EAAOR,QAAA,CAASE,KAAK,CAACK,UAAA,CAAW,EAAEC,KAAA,IAASC,MAAA,CAAOP,KAAK,CAACK,UAAA,CAAW,CAACC,KAAK,IAAIE,SAAA;QAC9EC,IAAA,EAAMT,KAAK,CAACK,UAAA,CAAW,EAAEI,IAAA,GAAOT,KAAK,CAACK,UAAA,CAAW,CAACI,IAAI,GAAGD,SAAA;QACzDE,KAAA,EAAOV,KAAK,CAACK,UAAA,CAAW,EAAEK,KAAA,GAAQV,KAAK,CAACK,UAAA,CAAW,CAACK,KAAK,GAAGF;MAC9D;IACF;EACF;EAEA,OAAOP,SAAA;AACT","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizePopulate.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/utilities/sanitizePopulate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAI3C,eAAO,MAAM,gBAAgB,wBAAyB,OAAO,KAAG,YAAY,GAAG,SAU9E,CAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { sanitizeSelect } from './sanitizeSelect.js';
|
|
2
|
-
export const sanitizePopulate = unsanitizedPopulate => {
|
|
3
|
-
if (!unsanitizedPopulate || typeof unsanitizedPopulate !== 'object') {
|
|
4
|
-
return;
|
|
5
|
-
}
|
|
6
|
-
for (const k in unsanitizedPopulate) {
|
|
7
|
-
unsanitizedPopulate[k] = sanitizeSelect(unsanitizedPopulate[k]);
|
|
8
|
-
}
|
|
9
|
-
return unsanitizedPopulate;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=sanitizePopulate.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizePopulate.js","names":["sanitizeSelect","sanitizePopulate","unsanitizedPopulate","k"],"sources":["../../../../src/routes/rest/utilities/sanitizePopulate.ts"],"sourcesContent":["import type { PopulateType } from 'payload'\n\nimport { sanitizeSelect } from './sanitizeSelect.js'\n\nexport const sanitizePopulate = (unsanitizedPopulate: unknown): PopulateType | undefined => {\n if (!unsanitizedPopulate || typeof unsanitizedPopulate !== 'object') {\n return\n }\n\n for (const k in unsanitizedPopulate) {\n unsanitizedPopulate[k] = sanitizeSelect(unsanitizedPopulate[k])\n }\n\n return unsanitizedPopulate as PopulateType\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAE/B,OAAO,MAAMC,gBAAA,GAAoBC,mBAAA;EAC/B,IAAI,CAACA,mBAAA,IAAuB,OAAOA,mBAAA,KAAwB,UAAU;IACnE;EACF;EAEA,KAAK,MAAMC,CAAA,IAAKD,mBAAA,EAAqB;IACnCA,mBAAmB,CAACC,CAAA,CAAE,GAAGH,cAAA,CAAeE,mBAAmB,CAACC,CAAA,CAAE;EAChE;EAEA,OAAOD,mBAAA;AACT","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeSelect.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/utilities/sanitizeSelect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC;;GAEG;AACH,eAAO,MAAM,cAAc,sBAAuB,OAAO,KAAG,UAAU,GAAG,SAcxE,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sanitizes REST select query to SelectType
|
|
3
|
-
*/export const sanitizeSelect = unsanitizedSelect => {
|
|
4
|
-
if (unsanitizedSelect && typeof unsanitizedSelect === 'object') {
|
|
5
|
-
for (const k in unsanitizedSelect) {
|
|
6
|
-
if (unsanitizedSelect[k] === 'true') {
|
|
7
|
-
unsanitizedSelect[k] = true;
|
|
8
|
-
} else if (unsanitizedSelect[k] === 'false') {
|
|
9
|
-
unsanitizedSelect[k] = false;
|
|
10
|
-
} else if (typeof unsanitizedSelect[k] === 'object') {
|
|
11
|
-
sanitizeSelect(unsanitizedSelect[k]);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return unsanitizedSelect;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=sanitizeSelect.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeSelect.js","names":["sanitizeSelect","unsanitizedSelect","k"],"sources":["../../../../src/routes/rest/utilities/sanitizeSelect.ts"],"sourcesContent":["import type { SelectType } from 'payload'\n\n/**\n * Sanitizes REST select query to SelectType\n */\nexport const sanitizeSelect = (unsanitizedSelect: unknown): SelectType | undefined => {\n if (unsanitizedSelect && typeof unsanitizedSelect === 'object') {\n for (const k in unsanitizedSelect) {\n if (unsanitizedSelect[k] === 'true') {\n unsanitizedSelect[k] = true\n } else if (unsanitizedSelect[k] === 'false') {\n unsanitizedSelect[k] = false\n } else if (typeof unsanitizedSelect[k] === 'object') {\n sanitizeSelect(unsanitizedSelect[k])\n }\n }\n }\n\n return unsanitizedSelect as SelectType\n}\n"],"mappings":"AAEA;;GAGA,OAAO,MAAMA,cAAA,GAAkBC,iBAAA;EAC7B,IAAIA,iBAAA,IAAqB,OAAOA,iBAAA,KAAsB,UAAU;IAC9D,KAAK,MAAMC,CAAA,IAAKD,iBAAA,EAAmB;MACjC,IAAIA,iBAAiB,CAACC,CAAA,CAAE,KAAK,QAAQ;QACnCD,iBAAiB,CAACC,CAAA,CAAE,GAAG;MACzB,OAAO,IAAID,iBAAiB,CAACC,CAAA,CAAE,KAAK,SAAS;QAC3CD,iBAAiB,CAACC,CAAA,CAAE,GAAG;MACzB,OAAO,IAAI,OAAOD,iBAAiB,CAACC,CAAA,CAAE,KAAK,UAAU;QACnDF,cAAA,CAAeC,iBAAiB,CAACC,CAAA,CAAE;MACrC;IACF;EACF;EAEA,OAAOD,iBAAA;AACT","ignoreList":[]}
|