@payloadcms/next 3.4.1-canary.417e3d2 → 3.5.0
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/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/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/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,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":[]}
|
|
@@ -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":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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/translations": "3.
|
|
84
|
-
"@payloadcms/ui": "3.
|
|
82
|
+
"@payloadcms/graphql": "3.5.0",
|
|
83
|
+
"@payloadcms/translations": "3.5.0",
|
|
84
|
+
"@payloadcms/ui": "3.5.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|
|
87
87
|
"@babel/cli": "7.25.9",
|
|
@@ -89,23 +89,23 @@
|
|
|
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",
|
|
99
99
|
"esbuild-sass-plugin": "3.3.1",
|
|
100
100
|
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
|
|
101
101
|
"swc-plugin-transform-remove-imports": "2.0.0",
|
|
102
|
-
"payload": "3.
|
|
102
|
+
"payload": "3.5.0",
|
|
103
103
|
"@payloadcms/eslint-config": "3.0.0"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"graphql": "^16.8.1",
|
|
107
107
|
"next": "^15.0.0",
|
|
108
|
-
"payload": "3.
|
|
108
|
+
"payload": "3.5.0"
|
|
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":[]}
|