@payloadcms/next 3.0.0-beta.120 → 3.0.0-beta.122

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.
Files changed (73) hide show
  1. package/dist/prod/styles.css +1 -1
  2. package/dist/routes/rest/collections/create.d.ts.map +1 -1
  3. package/dist/routes/rest/collections/create.js +3 -1
  4. package/dist/routes/rest/collections/create.js.map +1 -1
  5. package/dist/routes/rest/collections/delete.d.ts.map +1 -1
  6. package/dist/routes/rest/collections/delete.js +3 -0
  7. package/dist/routes/rest/collections/delete.js.map +1 -1
  8. package/dist/routes/rest/collections/deleteByID.d.ts.map +1 -1
  9. package/dist/routes/rest/collections/deleteByID.js +3 -1
  10. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  11. package/dist/routes/rest/collections/duplicate.d.ts.map +1 -1
  12. package/dist/routes/rest/collections/duplicate.js +3 -1
  13. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  14. package/dist/routes/rest/collections/find.d.ts.map +1 -1
  15. package/dist/routes/rest/collections/find.js +3 -0
  16. package/dist/routes/rest/collections/find.js.map +1 -1
  17. package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
  18. package/dist/routes/rest/collections/findByID.js +3 -1
  19. package/dist/routes/rest/collections/findByID.js.map +1 -1
  20. package/dist/routes/rest/collections/findVersionByID.d.ts.map +1 -1
  21. package/dist/routes/rest/collections/findVersionByID.js +3 -1
  22. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  23. package/dist/routes/rest/collections/findVersions.d.ts.map +1 -1
  24. package/dist/routes/rest/collections/findVersions.js +3 -0
  25. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  26. package/dist/routes/rest/collections/update.d.ts.map +1 -1
  27. package/dist/routes/rest/collections/update.js +3 -0
  28. package/dist/routes/rest/collections/update.js.map +1 -1
  29. package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
  30. package/dist/routes/rest/collections/updateByID.js +3 -1
  31. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  32. package/dist/routes/rest/globals/findOne.d.ts.map +1 -1
  33. package/dist/routes/rest/globals/findOne.js +3 -1
  34. package/dist/routes/rest/globals/findOne.js.map +1 -1
  35. package/dist/routes/rest/globals/findVersionByID.d.ts.map +1 -1
  36. package/dist/routes/rest/globals/findVersionByID.js +3 -1
  37. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  38. package/dist/routes/rest/globals/findVersions.d.ts.map +1 -1
  39. package/dist/routes/rest/globals/findVersions.js +3 -0
  40. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  41. package/dist/routes/rest/globals/update.d.ts.map +1 -1
  42. package/dist/routes/rest/globals/update.js +3 -1
  43. package/dist/routes/rest/globals/update.js.map +1 -1
  44. package/dist/routes/rest/utilities/sanitizeSelect.d.ts +6 -0
  45. package/dist/routes/rest/utilities/sanitizeSelect.d.ts.map +1 -0
  46. package/dist/routes/rest/utilities/sanitizeSelect.js +17 -0
  47. package/dist/routes/rest/utilities/sanitizeSelect.js.map +1 -0
  48. package/dist/utilities/initPage/index.d.ts.map +1 -1
  49. package/dist/utilities/initPage/index.js +5 -0
  50. package/dist/utilities/initPage/index.js.map +1 -1
  51. package/dist/utilities/initPage/isCustomAdminView.d.ts +10 -0
  52. package/dist/utilities/initPage/isCustomAdminView.d.ts.map +1 -0
  53. package/dist/utilities/initPage/isCustomAdminView.js +31 -0
  54. package/dist/utilities/initPage/isCustomAdminView.js.map +1 -0
  55. package/dist/utilities/initPage/shared.d.ts.map +1 -1
  56. package/dist/utilities/initPage/shared.js +2 -1
  57. package/dist/utilities/initPage/shared.js.map +1 -1
  58. package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
  59. package/dist/views/Document/getViewsFromConfig.js +6 -0
  60. package/dist/views/Document/getViewsFromConfig.js.map +1 -1
  61. package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +1 -1
  62. package/dist/views/Edit/Default/Auth/APIKey.js +2 -8
  63. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  64. package/dist/views/Edit/Default/Auth/index.d.ts.map +1 -1
  65. package/dist/views/Edit/Default/Auth/index.js +37 -26
  66. package/dist/views/Edit/Default/Auth/index.js.map +1 -1
  67. package/dist/views/NotFound/index.d.ts.map +1 -1
  68. package/dist/views/NotFound/index.js +3 -0
  69. package/dist/views/NotFound/index.js.map +1 -1
  70. package/dist/views/Root/index.d.ts.map +1 -1
  71. package/dist/views/Root/index.js +14 -6
  72. package/dist/views/Root/index.js.map +1 -1
  73. package/package.json +7 -7
@@ -1 +1 @@
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,sBA8BpB,CAAA"}
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;AAKzD,eAAO,MAAM,MAAM,EAAE,sBA+BpB,CAAA"}
@@ -3,6 +3,7 @@ import httpStatus from 'http-status';
3
3
  import { createOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const create = async ({
7
8
  collection,
8
9
  req
@@ -19,7 +20,8 @@ export const create = async ({
19
20
  data: req.data,
20
21
  depth: isNumber(depth) ? depth : undefined,
21
22
  draft,
22
- req
23
+ req,
24
+ select: sanitizeSelect(req.query.select)
23
25
  });
24
26
  return Response.json({
25
27
  doc,
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","names":["getTranslation","httpStatus","createOperation","isNumber","headersWithCors","create","collection","req","searchParams","autosave","get","draft","depth","doc","data","undefined","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 } 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 req,\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,QAAQ;AAChC,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,MAAMX,eAAA,CAAgB;IAChCO,QAAA;IACAH,UAAA;IACAQ,IAAA,EAAMP,GAAA,CAAIO,IAAI;IACdF,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASA,KAAA,GAAQG,SAAA;IACjCJ,KAAA;IACAJ;EACF;EAEA,OAAOS,QAAA,CAASC,IAAI,CAClB;IACEJ,GAAA;IACAK,OAAA,EAASX,GAAA,CAAIY,CAAC,CAAC,+BAA+B;MAC5CC,KAAA,EAAOpB,cAAA,CAAeM,UAAA,CAAWe,MAAM,CAACC,MAAM,CAACC,QAAQ,EAAEhB,GAAA,CAAIiB,IAAI;IACnE;EACF,GACA;IACEC,OAAA,EAASrB,eAAA,CAAgB;MACvBqB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQ1B,UAAA,CAAW2B;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"create.js","names":["getTranslation","httpStatus","createOperation","isNumber","headersWithCors","sanitizeSelect","create","collection","req","searchParams","autosave","get","draft","depth","doc","data","undefined","select","query","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 } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.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 req,\n select: sanitizeSelect(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,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,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,MAAMZ,eAAA,CAAgB;IAChCQ,QAAA;IACAH,UAAA;IACAQ,IAAA,EAAMP,GAAA,CAAIO,IAAI;IACdF,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASA,KAAA,GAAQG,SAAA;IACjCJ,KAAA;IACAJ,GAAA;IACAS,MAAA,EAAQZ,cAAA,CAAeG,GAAA,CAAIU,KAAK,CAACD,MAAM;EACzC;EAEA,OAAOE,QAAA,CAASC,IAAI,CAClB;IACEN,GAAA;IACAO,OAAA,EAASb,GAAA,CAAIc,CAAC,CAAC,+BAA+B;MAC5CC,KAAA,EAAOvB,cAAA,CAAeO,UAAA,CAAWiB,MAAM,CAACC,MAAM,CAACC,QAAQ,EAAElB,GAAA,CAAImB,IAAI;IACnE;EACF,GACA;IACEC,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbrB;IACF;IACAsB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
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,sBA2DvB,CAAA"}
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;AAKzD,eAAO,MAAM,SAAS,EAAE,sBA6DvB,CAAA"}
@@ -3,6 +3,7 @@ import httpStatus from 'http-status';
3
3
  import { deleteOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const deleteDoc = async ({
7
8
  collection,
8
9
  req
@@ -10,6 +11,7 @@ export const deleteDoc = async ({
10
11
  const {
11
12
  depth,
12
13
  overrideLock,
14
+ select,
13
15
  where
14
16
  } = req.query;
15
17
  const result = await deleteOperation({
@@ -17,6 +19,7 @@ export const deleteDoc = async ({
17
19
  depth: isNumber(depth) ? Number(depth) : undefined,
18
20
  overrideLock: Boolean(overrideLock === 'true'),
19
21
  req,
22
+ select: sanitizeSelect(select),
20
23
  where
21
24
  });
22
25
  const headers = headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"delete.js","names":["getTranslation","httpStatus","deleteOperation","isNumber","headersWithCors","deleteDoc","collection","req","depth","overrideLock","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 } 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, where } = req.query as {\n depth?: string\n overrideLock?: string\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 req,\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:deletedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n\n const message = req.t('error:unableToDeleteCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,SAAA,GAAoC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACzE,MAAM;IAAEC,KAAK;IAAEC,YAAY;IAAEC;EAAK,CAAE,GAAGH,GAAA,CAAII,KAAK;EAMhD,MAAMC,MAAA,GAAS,MAAMV,eAAA,CAAgB;IACnCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASK,MAAA,CAAOL,KAAA,IAASM,SAAA;IACzCL,YAAA,EAAcM,OAAA,CAAQN,YAAA,KAAiB;IACvCF,GAAA;IACAG;EACF;EAEA,MAAMM,OAAA,GAAUZ,eAAA,CAAgB;IAC9BY,OAAA,EAAS,IAAIC,OAAA;IACbV;EACF;EAEA,IAAIK,MAAA,CAAOM,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOV,MAAA,CAAOW,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAOxB,cAAA,CACLM,UAAA,CAAWmB,MAAM,CAACC,MAAM,CAACd,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEZ,GAAA,CAAIoB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGjB,MAAM;MACTQ;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQ7B,UAAA,CAAW8B;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQpB,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAGP,MAAA,CAAOM,MAAM,CAACC,MAAM;EAEvD,MAAMC,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOV,MAAA,CAAOM,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAOxB,cAAA,CAAeM,UAAA,CAAWmB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAEzB,GAAA,CAAIoB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGjB,MAAM;IACTQ;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQ7B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"delete.js","names":["getTranslation","httpStatus","deleteOperation","isNumber","headersWithCors","sanitizeSelect","deleteDoc","collection","req","depth","overrideLock","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 } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const deleteDoc: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, overrideLock, select, where } = req.query as {\n depth?: string\n overrideLock?: string\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 req,\n select: sanitizeSelect(select),\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:deletedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n\n const message = req.t('error:unableToDeleteCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,SAAA,GAAoC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACzE,MAAM;IAAEC,KAAK;IAAEC,YAAY;IAAEC,MAAM;IAAEC;EAAK,CAAE,GAAGJ,GAAA,CAAIK,KAAK;EAOxD,MAAMC,MAAA,GAAS,MAAMZ,eAAA,CAAgB;IACnCK,UAAA;IACAE,KAAA,EAAON,QAAA,CAASM,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,YAAA,EAAcO,OAAA,CAAQP,YAAA,KAAiB;IACvCF,GAAA;IACAG,MAAA,EAAQN,cAAA,CAAeM,MAAA;IACvBC;EACF;EAEA,MAAMM,OAAA,GAAUd,eAAA,CAAgB;IAC9Bc,OAAA,EAAS,IAAIC,OAAA;IACbX;EACF;EAEA,IAAIM,MAAA,CAAOM,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOV,MAAA,CAAOW,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAO1B,cAAA,CACLO,UAAA,CAAWoB,MAAM,CAACC,MAAM,CAACd,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEb,GAAA,CAAIqB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGjB,MAAM;MACTQ;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQ/B,UAAA,CAAWgC;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQpB,MAAA,CAAOW,IAAI,CAACJ,MAAM,GAAGP,MAAA,CAAOM,MAAM,CAACC,MAAM;EAEvD,MAAMC,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOV,MAAA,CAAOM,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAO1B,cAAA,CAAeO,UAAA,CAAWoB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAE1B,GAAA,CAAIqB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGjB,MAAM;IACTQ;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQ/B,UAAA,CAAWkC;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
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,4BAkDxB,CAAA"}
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;AAM/D,eAAO,MAAM,UAAU,EAAE,4BAmDxB,CAAA"}
@@ -3,6 +3,7 @@ import { deleteByIDOperation } 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 { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const deleteByID = async ({
7
8
  id: incomingID,
8
9
  collection,
@@ -23,7 +24,8 @@ export const deleteByID = async ({
23
24
  collection,
24
25
  depth: isNumber(depth) ? depth : undefined,
25
26
  overrideLock: Boolean(overrideLock === 'true'),
26
- req
27
+ req,
28
+ select: sanitizeSelect(req.query.select)
27
29
  });
28
30
  const headers = headersWithCors({
29
31
  headers: new Headers(),
@@ -1 +1 @@
1
- {"version":3,"file":"deleteByID.js","names":["httpStatus","deleteByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","deleteByID","id","incomingID","collection","req","searchParams","depth","get","overrideLock","collectionSlug","config","slug","payload","doc","undefined","Boolean","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 } 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 req,\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,QAAQ;AACpC,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,MAAMjB,mBAAA,CAAoB;IACpCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASA,KAAA,GAAQQ,SAAA;IACjCN,YAAA,EAAcO,OAAA,CAAQP,YAAA,KAAiB;IACvCJ;EACF;EAEA,MAAMY,OAAA,GAAUlB,eAAA,CAAgB;IAC9BkB,OAAA,EAAS,IAAIC,OAAA;IACbb;EACF;EAEA,IAAI,CAACS,GAAA,EAAK;IACR,OAAOK,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAAShB,GAAA,CAAIiB,CAAC,CAAC;IACjB,GACA;MACEL,OAAA;MACAM,MAAA,EAAQ3B,UAAA,CAAW4B;IACrB;EAEJ;EAEA,OAAOL,QAAA,CAASC,IAAI,CAClB;IACEN,GAAA;IACAO,OAAA,EAAShB,GAAA,CAAIiB,CAAC,CAAC;EACjB,GACA;IACEL,OAAA;IACAM,MAAA,EAAQ3B,UAAA,CAAW6B;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"deleteByID.js","names":["httpStatus","deleteByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeSelect","deleteByID","id","incomingID","collection","req","searchParams","depth","get","overrideLock","collectionSlug","config","slug","payload","doc","undefined","Boolean","select","query","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 } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.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 req,\n select: sanitizeSelect(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,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,UAAA,GAA2C,MAAAA,CAAO;EAC7DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,YAAA,GAAeH,YAAA,CAAaE,GAAG,CAAC;EAEtC,MAAMN,EAAA,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMlB,mBAAA,CAAoB;IACpCM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASA,KAAA,GAAQQ,SAAA;IACjCN,YAAA,EAAcO,OAAA,CAAQP,YAAA,KAAiB;IACvCJ,GAAA;IACAY,MAAA,EAAQjB,cAAA,CAAeK,GAAA,CAAIa,KAAK,CAACD,MAAM;EACzC;EAEA,MAAME,OAAA,GAAUrB,eAAA,CAAgB;IAC9BqB,OAAA,EAAS,IAAIC,OAAA;IACbf;EACF;EAEA,IAAI,CAACS,GAAA,EAAK;IACR,OAAOO,QAAA,CAASC,IAAI,CAClB;MACEC,OAAA,EAASlB,GAAA,CAAImB,CAAC,CAAC;IACjB,GACA;MACEL,OAAA;MACAM,MAAA,EAAQ9B,UAAA,CAAW+B;IACrB;EAEJ;EAEA,OAAOL,QAAA,CAASC,IAAI,CAClB;IACER,GAAA;IACAS,OAAA,EAASlB,GAAA,CAAImB,CAAC,CAAC;EACjB,GACA;IACEL,OAAA;IACAM,MAAA,EAAQ9B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
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,4BAyCvB,CAAA"}
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;AAM/D,eAAO,MAAM,SAAS,EAAE,4BA0CvB,CAAA"}
@@ -4,6 +4,7 @@ import { duplicateOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
6
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
7
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
7
8
  export const duplicate = async ({
8
9
  id: incomingID,
9
10
  collection,
@@ -25,7 +26,8 @@ export const duplicate = async ({
25
26
  collection,
26
27
  depth: isNumber(depth) ? Number(depth) : undefined,
27
28
  draft,
28
- req
29
+ req,
30
+ select: sanitizeSelect(req.query.select)
29
31
  });
30
32
  const message = req.t('general:successfullyDuplicated', {
31
33
  label: getTranslation(collection.config.labels.singular, req.i18n)
@@ -1 +1 @@
1
- {"version":3,"file":"duplicate.js","names":["getTranslation","httpStatus","duplicateOperation","isNumber","headersWithCors","sanitizeCollectionID","duplicate","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","doc","Number","undefined","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 } 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 depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n req,\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,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,SAAA,GAA0C,MAAAA,CAAO;EAC5DC,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;EACA,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAE5C,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,MAAMjB,kBAAA,CAAmB;IACnCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA;IACAJ;EACF;EAEA,MAAMY,OAAA,GAAUZ,GAAA,CAAIa,CAAC,CAAC,kCAAkC;IACtDC,KAAA,EAAOxB,cAAA,CAAeS,UAAA,CAAWO,MAAM,CAACS,MAAM,CAACC,QAAQ,EAAEhB,GAAA,CAAIiB,IAAI;EACnE;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEV,GAAA;IACAG;EACF,GACA;IACEQ,OAAA,EAAS1B,eAAA,CAAgB;MACvB0B,OAAA,EAAS,IAAIC,OAAA;MACbrB;IACF;IACAsB,MAAA,EAAQ/B,UAAA,CAAWgC;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"duplicate.js","names":["getTranslation","httpStatus","duplicateOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeSelect","duplicate","id","incomingID","collection","req","searchParams","depth","get","draft","collectionSlug","config","slug","payload","doc","Number","undefined","select","query","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 } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.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 depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n req,\n select: sanitizeSelect(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,QAAQ;AACnC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,SAAA,GAA0C,MAAAA,CAAO;EAC5DC,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;EACA,MAAMC,KAAA,GAAQH,YAAA,CAAaE,GAAG,CAAC,aAAa;EAE5C,MAAMN,EAAA,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJO,cAAA,EAAgBN,UAAA,CAAWO,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASR,GAAA,CAAIQ;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMlB,kBAAA,CAAmB;IACnCM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCP,KAAA;IACAJ,GAAA;IACAY,MAAA,EAAQjB,cAAA,CAAeK,GAAA,CAAIa,KAAK,CAACD,MAAM;EACzC;EAEA,MAAME,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC,kCAAkC;IACtDC,KAAA,EAAO3B,cAAA,CAAeU,UAAA,CAAWO,MAAM,CAACW,MAAM,CAACC,QAAQ,EAAElB,GAAA,CAAImB,IAAI;EACnE;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEZ,GAAA;IACAK;EACF,GACA;IACEQ,OAAA,EAAS7B,eAAA,CAAgB;MACvB6B,OAAA,EAAS,IAAIC,OAAA;MACbvB;IACF;IACAwB,MAAA,EAAQlC,UAAA,CAAWmC;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/find.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAKzD,eAAO,MAAM,IAAI,EAAE,sBA8BlB,CAAA"}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/find.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAMzD,eAAO,MAAM,IAAI,EAAE,sBAgClB,CAAA"}
@@ -3,6 +3,7 @@ import { findOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const find = async ({
7
8
  collection,
8
9
  req
@@ -13,6 +14,7 @@ export const find = async ({
13
14
  joins,
14
15
  limit,
15
16
  page,
17
+ select,
16
18
  sort,
17
19
  where
18
20
  } = req.query;
@@ -24,6 +26,7 @@ export const find = async ({
24
26
  limit: isNumber(limit) ? Number(limit) : undefined,
25
27
  page: isNumber(page) ? Number(page) : undefined,
26
28
  req,
29
+ select: sanitizeSelect(select),
27
30
  sort: typeof sort === 'string' ? sort.split(',') : undefined,
28
31
  where
29
32
  });
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","names":["httpStatus","findOperation","isNumber","headersWithCors","sanitizeJoinParams","find","collection","req","depth","draft","joins","limit","page","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 { findOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, joins, limit, page, sort, where } = req.query as {\n depth?: string\n draft?: string\n joins?: JoinQuery\n limit?: string\n page?: string\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 req,\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,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AAEnC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGP,GAAA,CAAIQ,KAAK;EAUnE,MAAMC,MAAA,GAAS,MAAMf,aAAA,CAAc;IACjCK,UAAA;IACAE,KAAA,EAAON,QAAA,CAASM,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCT,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAON,kBAAA,CAAmBM,KAAA;IAC1BC,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMV,QAAA,CAASU,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCX,GAAA;IACAM,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"find.js","names":["httpStatus","findOperation","isNumber","headersWithCors","sanitizeJoinParams","sanitizeSelect","find","collection","req","depth","draft","joins","limit","page","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 { findOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, joins, limit, page, select, sort, where } = req.query as {\n depth?: string\n draft?: string\n joins?: JoinQuery\n limit?: string\n page?: string\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 req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGR,GAAA,CAAIS,KAAK;EAW3E,MAAMC,MAAA,GAAS,MAAMjB,aAAA,CAAc;IACjCM,UAAA;IACAE,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASU,MAAA,CAAOV,KAAA,IAASW,SAAA;IACzCV,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOP,kBAAA,CAAmBO,KAAA;IAC1BC,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,IAAA,EAAMX,QAAA,CAASW,IAAA,IAAQM,MAAA,CAAON,IAAA,IAAQO,SAAA;IACtCZ,GAAA;IACAM,MAAA,EAAQT,cAAA,CAAeS,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASrB,eAAA,CAAgB;MACvBqB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ1B,UAAA,CAAW2B;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findByID.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAM/D,eAAO,MAAM,QAAQ,EAAE,4BA8BtB,CAAA"}
1
+ {"version":3,"file":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findByID.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAO/D,eAAO,MAAM,QAAQ,EAAE,4BA+BtB,CAAA"}
@@ -4,6 +4,7 @@ import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
6
6
  import { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js';
7
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
7
8
  export const findByID = async ({
8
9
  id: incomingID,
9
10
  collection,
@@ -24,7 +25,8 @@ export const findByID = async ({
24
25
  depth: isNumber(depth) ? Number(depth) : undefined,
25
26
  draft: searchParams.get('draft') === 'true',
26
27
  joins: sanitizeJoinParams(req.query.joins),
27
- req
28
+ req,
29
+ select: sanitizeSelect(req.query.select)
28
30
  });
29
31
  return Response.json(result, {
30
32
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeJoinParams","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","joins","query","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import type { JoinQuery } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n joins: sanitizeJoinParams(req.query.joins as JoinQuery),\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;AAEnC,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,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMjB,iBAAA,CAAkB;IACrCM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCS,KAAA,EAAOjB,kBAAA,CAAmBK,GAAA,CAAIa,KAAK,CAACD,KAAK;IACzCZ;EACF;EAEA,OAAOc,QAAA,CAASC,IAAI,CAACP,MAAA,EAAQ;IAC3BQ,OAAA,EAASvB,eAAA,CAAgB;MACvBuB,OAAA,EAAS,IAAIC,OAAA;MACbjB;IACF;IACAkB,MAAA,EAAQ5B,UAAA,CAAW6B;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeJoinParams","sanitizeSelect","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","joins","query","select","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import type { JoinQuery } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n joins: sanitizeJoinParams(req.query.joins as JoinQuery),\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKJ,oBAAA,CAAqB;IAC9BI,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMlB,iBAAA,CAAkB;IACrCO,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOX,QAAA,CAASW,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCS,KAAA,EAAOlB,kBAAA,CAAmBM,GAAA,CAAIa,KAAK,CAACD,KAAK;IACzCZ,GAAA;IACAc,MAAA,EAAQnB,cAAA,CAAeK,GAAA,CAAIa,KAAK,CAACC,MAAM;EACzC;EAEA,OAAOC,QAAA,CAASC,IAAI,CAACR,MAAA,EAAQ;IAC3BS,OAAA,EAASzB,eAAA,CAAgB;MACvByB,OAAA,EAAS,IAAIC,OAAA;MACblB;IACF;IACAmB,MAAA,EAAQ9B,UAAA,CAAW+B;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,eAAe,EAAE,4BA4B7B,CAAA"}
1
+ {"version":3,"file":"findVersionByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAM/D,eAAO,MAAM,eAAe,EAAE,4BA6B7B,CAAA"}
@@ -3,6 +3,7 @@ import { findVersionByIDOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const findVersionByID = async ({
7
8
  id: incomingID,
8
9
  collection,
@@ -21,7 +22,8 @@ export const findVersionByID = async ({
21
22
  id,
22
23
  collection,
23
24
  depth: isNumber(depth) ? Number(depth) : undefined,
24
- req
25
+ req,
26
+ select: sanitizeSelect(req.query.select)
25
27
  });
26
28
  return Response.json(result, {
27
29
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;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,MAAMhB,wBAAA,CAAyB;IAC5CK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCV;EACF;EAEA,OAAOW,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASnB,eAAA,CAAgB;MACvBmB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQxB,UAAA,CAAWyB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeSelect","findVersionByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","select","query","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersionByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const result = await findVersionByIDOperation({\n id,\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,wBAAwB,QAAQ;AACzC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAAgD,MAAAA,CAAO;EAClEC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMjB,wBAAA,CAAyB;IAC5CM,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCV,GAAA;IACAW,MAAA,EAAQhB,cAAA,CAAeK,GAAA,CAAIY,KAAK,CAACD,MAAM;EACzC;EAEA,OAAOE,QAAA,CAASC,IAAI,CAACN,MAAA,EAAQ;IAC3BO,OAAA,EAAStB,eAAA,CAAgB;MACvBsB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQ3B,UAAA,CAAW4B;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,YAAY,EAAE,sBA0B1B,CAAA"}
1
+ {"version":3,"file":"findVersions.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findVersions.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAKzD,eAAO,MAAM,YAAY,EAAE,sBA4B1B,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { findVersionsOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
6
  export const findVersions = async ({
6
7
  collection,
7
8
  req
@@ -10,6 +11,7 @@ export const findVersions = async ({
10
11
  depth,
11
12
  limit,
12
13
  page,
14
+ select,
13
15
  sort,
14
16
  where
15
17
  } = req.query;
@@ -19,6 +21,7 @@ export const findVersions = async ({
19
21
  limit: isNumber(limit) ? Number(limit) : undefined,
20
22
  page: isNumber(page) ? Number(page) : undefined,
21
23
  req,
24
+ select: sanitizeSelect(select),
22
25
  sort: typeof sort === 'string' ? sort.split(',') : undefined,
23
26
  where
24
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","findVersions","collection","req","depth","limit","page","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperation({\n collection,\n depth: isNumber(depth) ? Number(depth) : undefined,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGL,GAAA,CAAIM,KAAK;EAQrD,MAAMC,MAAA,GAAS,MAAMZ,qBAAA,CAAsB;IACzCI,UAAA;IACAE,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,KAAA,EAAON,QAAA,CAASM,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMP,QAAA,CAASO,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCT,GAAA;IACAI,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQrB,UAAA,CAAWsB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperation","isNumber","headersWithCors","sanitizeSelect","findVersions","collection","req","depth","limit","page","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersions: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, limit, page, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\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 req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,YAAA,GAAuC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EAC5E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGN,GAAA,CAAIO,KAAK;EAS7D,MAAMC,MAAA,GAAS,MAAMd,qBAAA,CAAsB;IACzCK,UAAA;IACAE,KAAA,EAAON,QAAA,CAASM,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,IAAA,EAAMR,QAAA,CAASQ,IAAA,IAAQM,MAAA,CAAON,IAAA,IAAQO,SAAA;IACtCV,GAAA;IACAI,MAAA,EAAQP,cAAA,CAAeO,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBA+DpB,CAAA"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/update.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAKzD,eAAO,MAAM,MAAM,EAAE,sBAiEpB,CAAA"}
@@ -3,6 +3,7 @@ import httpStatus from 'http-status';
3
3
  import { updateOperation } from 'payload';
4
4
  import { isNumber } from 'payload/shared';
5
5
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const update = async ({
7
8
  collection,
8
9
  req
@@ -12,6 +13,7 @@ export const update = async ({
12
13
  draft,
13
14
  limit,
14
15
  overrideLock,
16
+ select,
15
17
  where
16
18
  } = req.query;
17
19
  const result = await updateOperation({
@@ -22,6 +24,7 @@ export const update = async ({
22
24
  limit: isNumber(limit) ? Number(limit) : undefined,
23
25
  overrideLock: Boolean(overrideLock === 'true'),
24
26
  req,
27
+ select: sanitizeSelect(select),
25
28
  where
26
29
  });
27
30
  const headers = headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","update","collection","req","depth","draft","limit","overrideLock","where","query","result","data","Number","undefined","Boolean","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, overrideLock, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n overrideLock?: string\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n overrideLock: Boolean(overrideLock === 'true'),\n req,\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,YAAY;IAAEC;EAAK,CAAE,GAAGL,GAAA,CAAIM,KAAK;EAQ9D,MAAMC,MAAA,GAAS,MAAMZ,eAAA,CAAgB;IACnCI,UAAA;IACAS,IAAA,EAAMR,GAAA,CAAIQ,IAAI;IACdP,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCR,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,YAAA,EAAcO,OAAA,CAAQP,YAAA,KAAiB;IACvCJ,GAAA;IACAK;EACF;EAEA,MAAMO,OAAA,GAAUf,eAAA,CAAgB;IAC9Be,OAAA,EAAS,IAAIC,OAAA;IACbb;EACF;EAEA,IAAIO,MAAA,CAAOO,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOX,MAAA,CAAOY,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAO3B,cAAA,CACLM,UAAA,CAAWsB,MAAM,CAACC,MAAM,CAACf,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEf,GAAA,CAAIuB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGlB,MAAM;MACTS;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQhC,UAAA,CAAWiC;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQrB,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAGR,MAAA,CAAOO,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOX,MAAA,CAAOO,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAO3B,cAAA,CAAeM,UAAA,CAAWsB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAE5B,GAAA,CAAIuB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGlB,MAAM;IACTS;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQhC,UAAA,CAAWmC;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"update.js","names":["getTranslation","httpStatus","updateOperation","isNumber","headersWithCors","sanitizeSelect","update","collection","req","depth","draft","limit","overrideLock","select","where","query","result","data","Number","undefined","Boolean","headers","Headers","errors","length","message","t","count","docs","label","config","labels","i18n","Response","json","status","OK","total","BAD_REQUEST"],"sources":["../../../../src/routes/rest/collections/update.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport httpStatus from 'http-status'\nimport { updateOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const update: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, overrideLock, select, where } = req.query as {\n depth?: string\n draft?: string\n limit?: string\n overrideLock?: string\n select?: Record<string, unknown>\n where?: Where\n }\n\n const result = await updateOperation({\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: draft === 'true',\n limit: isNumber(limit) ? Number(limit) : undefined,\n overrideLock: Boolean(overrideLock === 'true'),\n req,\n select: sanitizeSelect(select),\n where,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (result.errors.length === 0) {\n const message = req.t('general:updatedCountSuccessfully', {\n count: result.docs.length,\n label: getTranslation(\n collection.config.labels[result.docs.length > 1 ? 'plural' : 'singular'],\n req.i18n,\n ),\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n }\n\n const total = result.docs.length + result.errors.length\n const message = req.t('error:unableToUpdateCount', {\n count: result.errors.length,\n label: getTranslation(collection.config.labels[total > 1 ? 'plural' : 'singular'], req.i18n),\n total,\n })\n\n return Response.json(\n {\n ...result,\n message,\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n}\n"],"mappings":"AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,UAAA,MAAgB;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,MAAA,GAAiC,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACtE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,YAAY;IAAEC,MAAM;IAAEC;EAAK,CAAE,GAAGN,GAAA,CAAIO,KAAK;EAStE,MAAMC,MAAA,GAAS,MAAMd,eAAA,CAAgB;IACnCK,UAAA;IACAU,IAAA,EAAMT,GAAA,CAAIS,IAAI;IACdR,KAAA,EAAON,QAAA,CAASM,KAAA,IAASS,MAAA,CAAOT,KAAA,IAASU,SAAA;IACzCT,KAAA,EAAOA,KAAA,KAAU;IACjBC,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,YAAA,EAAcQ,OAAA,CAAQR,YAAA,KAAiB;IACvCJ,GAAA;IACAK,MAAA,EAAQR,cAAA,CAAeQ,MAAA;IACvBC;EACF;EAEA,MAAMO,OAAA,GAAUjB,eAAA,CAAgB;IAC9BiB,OAAA,EAAS,IAAIC,OAAA;IACbd;EACF;EAEA,IAAIQ,MAAA,CAAOO,MAAM,CAACC,MAAM,KAAK,GAAG;IAC9B,MAAMC,OAAA,GAAUjB,GAAA,CAAIkB,CAAC,CAAC,oCAAoC;MACxDC,KAAA,EAAOX,MAAA,CAAOY,IAAI,CAACJ,MAAM;MACzBK,KAAA,EAAO7B,cAAA,CACLO,UAAA,CAAWuB,MAAM,CAACC,MAAM,CAACf,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAG,IAAI,WAAW,WAAW,EACxEhB,GAAA,CAAIwB,IAAI;IAEZ;IAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;MACE,GAAGlB,MAAM;MACTS;IACF,GACA;MACEJ,OAAA;MACAc,MAAA,EAAQlC,UAAA,CAAWmC;IACrB;EAEJ;EAEA,MAAMC,KAAA,GAAQrB,MAAA,CAAOY,IAAI,CAACJ,MAAM,GAAGR,MAAA,CAAOO,MAAM,CAACC,MAAM;EACvD,MAAMC,OAAA,GAAUjB,GAAA,CAAIkB,CAAC,CAAC,6BAA6B;IACjDC,KAAA,EAAOX,MAAA,CAAOO,MAAM,CAACC,MAAM;IAC3BK,KAAA,EAAO7B,cAAA,CAAeO,UAAA,CAAWuB,MAAM,CAACC,MAAM,CAACM,KAAA,GAAQ,IAAI,WAAW,WAAW,EAAE7B,GAAA,CAAIwB,IAAI;IAC3FK;EACF;EAEA,OAAOJ,QAAA,CAASC,IAAI,CAClB;IACE,GAAGlB,MAAM;IACTS;EACF,GACA;IACEJ,OAAA;IACAc,MAAA,EAAQlC,UAAA,CAAWqC;EACrB;AAEJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/updateByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,UAAU,EAAE,4BAoDxB,CAAA"}
1
+ {"version":3,"file":"updateByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/updateByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAM/D,eAAO,MAAM,UAAU,EAAE,4BAqDxB,CAAA"}
@@ -3,6 +3,7 @@ import { updateByIDOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
5
  import { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js';
6
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
6
7
  export const updateByID = async ({
7
8
  id: incomingID,
8
9
  collection,
@@ -30,7 +31,8 @@ export const updateByID = async ({
30
31
  draft,
31
32
  overrideLock: Boolean(overrideLock === 'true'),
32
33
  publishSpecificLocale,
33
- req
34
+ req,
35
+ select: sanitizeSelect(req.query.select)
34
36
  });
35
37
  let message = req.t('general:updatedSuccessfully');
36
38
  if (draft) {
@@ -1 +1 @@
1
- {"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","overrideLock","publishSpecificLocale","query","collectionSlug","config","slug","payload","doc","data","Number","undefined","Boolean","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const 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 publishSpecificLocale,\n req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;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;IACvCC,qBAAA;IACAP;EACF;EAEA,IAAIkB,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC;EAEpB,IAAId,KAAA,EAAO;IACTa,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC;EAClB;EACA,IAAIf,QAAA,EAAU;IACZc,OAAA,GAAUlB,GAAA,CAAImB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACER,GAAA;IACAK;EACF,GACA;IACEI,OAAA,EAAS5B,eAAA,CAAgB;MACvB4B,OAAA,EAAS,IAAIC,OAAA;MACbvB;IACF;IACAwB,MAAA,EAAQjC,UAAA,CAAWkC;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","sanitizeSelect","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","overrideLock","publishSpecificLocale","query","collectionSlug","config","slug","payload","doc","data","Number","undefined","Boolean","select","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const overrideLock = searchParams.get('overrideLock')\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n overrideLock: Boolean(overrideLock === 'true'),\n publishSpecificLocale,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,UAAA,GAA2C,MAAAA,CAAO;EAC7DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAC/B,MAAMC,QAAA,GAAWH,YAAA,CAAaE,GAAG,CAAC,gBAAgB;EAClD,MAAME,KAAA,GAAQJ,YAAA,CAAaE,GAAG,CAAC,aAAa;EAC5C,MAAMG,YAAA,GAAeL,YAAA,CAAaE,GAAG,CAAC;EACtC,MAAMI,qBAAA,GAAwBP,GAAA,CAAIQ,KAAK,CAACD,qBAAqB;EAE7D,MAAMV,EAAA,GAAKH,oBAAA,CAAqB;IAC9BG,EAAA,EAAIC,UAAA;IACJW,cAAA,EAAgBV,UAAA,CAAWW,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASZ,GAAA,CAAIY;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMtB,mBAAA,CAAoB;IACpCM,EAAA;IACAO,QAAA;IACAL,UAAA;IACAe,IAAA,EAAMd,GAAA,CAAIc,IAAI;IACdZ,KAAA,EAAOV,QAAA,CAASU,KAAA,IAASa,MAAA,CAAOb,KAAA,IAASc,SAAA;IACzCX,KAAA;IACAC,YAAA,EAAcW,OAAA,CAAQX,YAAA,KAAiB;IACvCC,qBAAA;IACAP,GAAA;IACAkB,MAAA,EAAQvB,cAAA,CAAeK,GAAA,CAAIQ,KAAK,CAACU,MAAM;EACzC;EAEA,IAAIC,OAAA,GAAUnB,GAAA,CAAIoB,CAAC,CAAC;EAEpB,IAAIf,KAAA,EAAO;IACTc,OAAA,GAAUnB,GAAA,CAAIoB,CAAC,CAAC;EAClB;EACA,IAAIhB,QAAA,EAAU;IACZe,OAAA,GAAUnB,GAAA,CAAIoB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACET,GAAA;IACAM;EACF,GACA;IACEI,OAAA,EAAS9B,eAAA,CAAgB;MACvB8B,OAAA,EAAS,IAAIC,OAAA;MACbxB;IACF;IACAyB,MAAA,EAAQnC,UAAA,CAAWoC;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;AAIrD,eAAO,MAAM,OAAO,EAAE,kBAmBrB,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;AAKrD,eAAO,MAAM,OAAO,EAAE,kBAoBrB,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { findOneOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
6
  export const findOne = async ({
6
7
  globalConfig,
7
8
  req
@@ -15,7 +16,8 @@ export const findOne = async ({
15
16
  depth: isNumber(depth) ? Number(depth) : undefined,
16
17
  draft: searchParams.get('draft') === 'true',
17
18
  globalConfig,
18
- req
19
+ req,
20
+ select: sanitizeSelect(req.query.select)
19
21
  });
20
22
  return Response.json(result, {
21
23
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","isNumber","headersWithCors","findOne","globalConfig","req","searchParams","depth","get","result","slug","Number","undefined","draft","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findOne.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findOne: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findOneOperation({\n slug: globalConfig.slug,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n globalConfig,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;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,MAAMT,gBAAA,CAAiB;IACpCU,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;IACAC;EACF;EAEA,OAAOS,QAAA,CAASC,IAAI,CAACN,MAAA,EAAQ;IAC3BO,OAAA,EAASd,eAAA,CAAgB;MACvBc,OAAA,EAAS,IAAIC,OAAA;MACbZ;IACF;IACAa,MAAA,EAAQnB,UAAA,CAAWoB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findOne.js","names":["httpStatus","findOneOperation","isNumber","headersWithCors","sanitizeSelect","findOne","globalConfig","req","searchParams","depth","get","result","slug","Number","undefined","draft","select","query","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findOne.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findOneOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findOne: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findOneOperation({\n slug: globalConfig.slug,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft: searchParams.get('draft') === 'true',\n globalConfig,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,OAAA,GAA8B,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACrE,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMV,gBAAA,CAAiB;IACpCW,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,GAAA;IACAS,MAAA,EAAQZ,cAAA,CAAeG,GAAA,CAAIU,KAAK,CAACD,MAAM;EACzC;EAEA,OAAOE,QAAA,CAASC,IAAI,CAACR,MAAA,EAAQ;IAC3BS,OAAA,EAASjB,eAAA,CAAgB;MACvBiB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQtB,UAAA,CAAWuB;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;AAI3D,eAAO,MAAM,eAAe,EAAE,wBAkB7B,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;AAK3D,eAAO,MAAM,eAAe,EAAE,wBAmB7B,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { findVersionByIDOperationGlobal } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
6
  export const findVersionByID = async ({
6
7
  id,
7
8
  globalConfig,
@@ -15,7 +16,8 @@ export const findVersionByID = async ({
15
16
  id,
16
17
  depth: isNumber(depth) ? Number(depth) : undefined,
17
18
  globalConfig,
18
- req
19
+ req,
20
+ select: sanitizeSelect(req.query.select)
19
21
  });
20
22
  return Response.json(result, {
21
23
  headers: headersWithCors({
@@ -1 +1 @@
1
- {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","isNumber","headersWithCors","findVersionByID","id","globalConfig","req","searchParams","depth","get","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersionByID: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findVersionByIDOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n req,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;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,MAAMV,8BAAA,CAA+B;IAClDI,EAAA;IACAI,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCP,YAAA;IACAC;EACF;EAEA,OAAOO,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAASb,eAAA,CAAgB;MACvBa,OAAA,EAAS,IAAIC,OAAA;MACbV;IACF;IACAW,MAAA,EAAQlB,UAAA,CAAWmB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersionByID.js","names":["httpStatus","findVersionByIDOperationGlobal","isNumber","headersWithCors","sanitizeSelect","findVersionByID","id","globalConfig","req","searchParams","depth","get","result","Number","undefined","select","query","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersionByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { findVersionByIDOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersionByID: GlobalRouteHandlerWithID = async ({ id, globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await findVersionByIDOperationGlobal({\n id,\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n req,\n select: sanitizeSelect(req.query.select),\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,eAAA,GAA4C,MAAAA,CAAO;EAAEC,EAAE;EAAEC,YAAY;EAAEC;AAAG,CAAE;EACvF,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMC,MAAA,GAAS,MAAMX,8BAAA,CAA+B;IAClDK,EAAA;IACAI,KAAA,EAAOR,QAAA,CAASQ,KAAA,IAASG,MAAA,CAAOH,KAAA,IAASI,SAAA;IACzCP,YAAA;IACAC,GAAA;IACAO,MAAA,EAAQX,cAAA,CAAeI,GAAA,CAAIQ,KAAK,CAACD,MAAM;EACzC;EAEA,OAAOE,QAAA,CAASC,IAAI,CAACN,MAAA,EAAQ;IAC3BO,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbZ;IACF;IACAa,MAAA,EAAQrB,UAAA,CAAWsB;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;AAIrD,eAAO,MAAM,YAAY,EAAE,kBA0B1B,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;AAKrD,eAAO,MAAM,YAAY,EAAE,kBA4B1B,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { findVersionsOperationGlobal } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizeSelect } from '../utilities/sanitizeSelect.js';
5
6
  export const findVersions = async ({
6
7
  globalConfig,
7
8
  req
@@ -10,6 +11,7 @@ export const findVersions = async ({
10
11
  depth,
11
12
  limit,
12
13
  page,
14
+ select,
13
15
  sort,
14
16
  where
15
17
  } = req.query;
@@ -19,6 +21,7 @@ export const findVersions = async ({
19
21
  limit: isNumber(limit) ? Number(limit) : undefined,
20
22
  page: isNumber(page) ? Number(page) : undefined,
21
23
  req,
24
+ select: sanitizeSelect(select),
22
25
  sort: typeof sort === 'string' ? sort.split(',') : undefined,
23
26
  where
24
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","isNumber","headersWithCors","findVersions","globalConfig","req","depth","limit","page","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const findVersions: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { depth, limit, page, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\n sort?: string\n where?: Where\n }\n\n const result = await findVersionsOperationGlobal({\n depth: isNumber(depth) ? Number(depth) : undefined,\n globalConfig,\n limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,YAAA,GAAmC,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EAC1E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGL,GAAA,CAAIM,KAAK;EAQrD,MAAMC,MAAA,GAAS,MAAMZ,2BAAA,CAA4B;IAC/CM,KAAA,EAAOL,QAAA,CAASK,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCV,YAAA;IACAG,KAAA,EAAON,QAAA,CAASM,KAAA,IAASM,MAAA,CAAON,KAAA,IAASO,SAAA;IACzCN,IAAA,EAAMP,QAAA,CAASO,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCT,GAAA;IACAI,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQrB,UAAA,CAAWsB;EACrB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"findVersions.js","names":["httpStatus","findVersionsOperationGlobal","isNumber","headersWithCors","sanitizeSelect","findVersions","globalConfig","req","depth","limit","page","select","sort","where","query","result","Number","undefined","split","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/findVersions.ts"],"sourcesContent":["import type { Where } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { findVersionsOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeSelect } from '../utilities/sanitizeSelect.js'\n\nexport const findVersions: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { depth, limit, page, select, sort, where } = req.query as {\n depth?: string\n limit?: string\n page?: string\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 req,\n select: sanitizeSelect(select),\n sort: typeof sort === 'string' ? sort.split(',') : undefined,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,YAAA,GAAmC,MAAAA,CAAO;EAAEC,YAAY;EAAEC;AAAG,CAAE;EAC1E,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGN,GAAA,CAAIO,KAAK;EAS7D,MAAMC,MAAA,GAAS,MAAMd,2BAAA,CAA4B;IAC/CO,KAAA,EAAON,QAAA,CAASM,KAAA,IAASQ,MAAA,CAAOR,KAAA,IAASS,SAAA;IACzCX,YAAA;IACAG,KAAA,EAAOP,QAAA,CAASO,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCP,IAAA,EAAMR,QAAA,CAASQ,IAAA,IAAQM,MAAA,CAAON,IAAA,IAAQO,SAAA;IACtCV,GAAA;IACAI,MAAA,EAAQP,cAAA,CAAeO,MAAA;IACvBC,IAAA,EAAM,OAAOA,IAAA,KAAS,WAAWA,IAAA,CAAKM,KAAK,CAAC,OAAOD,SAAA;IACnDJ;EACF;EAEA,OAAOM,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AACF","ignoreList":[]}