@payloadcms/next 3.0.0-beta.107 → 3.0.0-beta.109

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 (126) hide show
  1. package/dist/cjs/withPayload.js +4 -4
  2. package/dist/cjs/withPayload.js.map +1 -1
  3. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
  4. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +28 -24
  5. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  6. package/dist/elements/DocumentLocked/index.d.ts +12 -0
  7. package/dist/elements/DocumentLocked/index.d.ts.map +1 -0
  8. package/dist/elements/DocumentLocked/index.js +142 -0
  9. package/dist/elements/DocumentLocked/index.js.map +1 -0
  10. package/dist/elements/DocumentLocked/index.scss +37 -0
  11. package/dist/elements/DocumentTakeOver/index.d.ts +8 -0
  12. package/dist/elements/DocumentTakeOver/index.d.ts.map +1 -0
  13. package/dist/elements/DocumentTakeOver/index.js +98 -0
  14. package/dist/elements/DocumentTakeOver/index.js.map +1 -0
  15. package/dist/elements/DocumentTakeOver/index.scss +37 -0
  16. package/dist/elements/Nav/NavWrapper/index.scss +5 -0
  17. package/dist/elements/Nav/index.scss +5 -1
  18. package/dist/layouts/Root/index.d.ts.map +1 -1
  19. package/dist/layouts/Root/index.js +52 -20
  20. package/dist/layouts/Root/index.js.map +1 -1
  21. package/dist/prod/styles.css +1 -1
  22. package/dist/routes/graphql/handler.d.ts.map +1 -1
  23. package/dist/routes/graphql/handler.js +23 -11
  24. package/dist/routes/graphql/handler.js.map +1 -1
  25. package/dist/routes/rest/collections/find.d.ts.map +1 -1
  26. package/dist/routes/rest/collections/find.js +3 -0
  27. package/dist/routes/rest/collections/find.js.map +1 -1
  28. package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
  29. package/dist/routes/rest/collections/findByID.js +2 -0
  30. package/dist/routes/rest/collections/findByID.js.map +1 -1
  31. package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
  32. package/dist/routes/rest/collections/updateByID.js +2 -0
  33. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  34. package/dist/routes/rest/globals/update.d.ts.map +1 -1
  35. package/dist/routes/rest/globals/update.js +2 -0
  36. package/dist/routes/rest/globals/update.js.map +1 -1
  37. package/dist/routes/rest/routeError.d.ts +2 -7
  38. package/dist/routes/rest/routeError.d.ts.map +1 -1
  39. package/dist/routes/rest/routeError.js +33 -19
  40. package/dist/routes/rest/routeError.js.map +1 -1
  41. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +13 -0
  42. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +1 -0
  43. package/dist/routes/rest/utilities/sanitizeJoinParams.js +17 -0
  44. package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +1 -0
  45. package/dist/templates/Default/index.d.ts.map +1 -1
  46. package/dist/templates/Default/index.js +7 -3
  47. package/dist/templates/Default/index.js.map +1 -1
  48. package/dist/templates/Default/index.scss +6 -1
  49. package/dist/utilities/getRequestTheme.d.ts.map +1 -1
  50. package/dist/utilities/getRequestTheme.js +3 -0
  51. package/dist/utilities/getRequestTheme.js.map +1 -1
  52. package/dist/utilities/initPage/index.d.ts.map +1 -1
  53. package/dist/utilities/initPage/index.js +22 -32
  54. package/dist/utilities/initPage/index.js.map +1 -1
  55. package/dist/utilities/initReq.d.ts +11 -0
  56. package/dist/utilities/initReq.d.ts.map +1 -0
  57. package/dist/utilities/initReq.js +46 -0
  58. package/dist/utilities/initReq.js.map +1 -0
  59. package/dist/views/Account/Settings/index.d.ts +2 -1
  60. package/dist/views/Account/Settings/index.d.ts.map +1 -1
  61. package/dist/views/Account/Settings/index.js +3 -2
  62. package/dist/views/Account/Settings/index.js.map +1 -1
  63. package/dist/views/Account/index.d.ts.map +1 -1
  64. package/dist/views/Account/index.js +3 -1
  65. package/dist/views/Account/index.js.map +1 -1
  66. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  67. package/dist/views/CreateFirstUser/index.client.js +35 -16
  68. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  69. package/dist/views/Dashboard/Default/index.d.ts +8 -1
  70. package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
  71. package/dist/views/Dashboard/Default/index.js +14 -2
  72. package/dist/views/Dashboard/Default/index.js.map +1 -1
  73. package/dist/views/Dashboard/Default/index.scss +5 -0
  74. package/dist/views/Dashboard/index.d.ts.map +1 -1
  75. package/dist/views/Dashboard/index.js +16 -1
  76. package/dist/views/Dashboard/index.js.map +1 -1
  77. package/dist/views/Document/getDocumentData.d.ts +5 -2
  78. package/dist/views/Document/getDocumentData.d.ts.map +1 -1
  79. package/dist/views/Document/getDocumentData.js +13 -2
  80. package/dist/views/Document/getDocumentData.js.map +1 -1
  81. package/dist/views/Edit/Default/index.d.ts.map +1 -1
  82. package/dist/views/Edit/Default/index.js +127 -14
  83. package/dist/views/Edit/Default/index.js.map +1 -1
  84. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +3 -0
  85. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  86. package/dist/views/ForgotPassword/index.js +2 -2
  87. package/dist/views/ForgotPassword/index.js.map +1 -1
  88. package/dist/views/List/Default/index.d.ts.map +1 -1
  89. package/dist/views/List/Default/index.js +62 -58
  90. package/dist/views/List/Default/index.js.map +1 -1
  91. package/dist/views/List/Default/index.scss +1 -1
  92. package/dist/views/List/index.d.ts.map +1 -1
  93. package/dist/views/List/index.js +1 -0
  94. package/dist/views/List/index.js.map +1 -1
  95. package/dist/views/LivePreview/index.client.d.ts.map +1 -1
  96. package/dist/views/LivePreview/index.client.js +214 -200
  97. package/dist/views/LivePreview/index.client.js.map +1 -1
  98. package/dist/views/LivePreview/usePopupWindow.js +119 -74
  99. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  100. package/dist/views/Login/LoginForm/index.js +2 -2
  101. package/dist/views/Login/LoginForm/index.js.map +1 -1
  102. package/dist/views/Version/Default/index.d.ts.map +1 -1
  103. package/dist/views/Version/Default/index.js +2 -0
  104. package/dist/views/Version/Default/index.js.map +1 -1
  105. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  106. package/dist/views/Version/Restore/index.js +8 -14
  107. package/dist/views/Version/Restore/index.js.map +1 -1
  108. package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
  109. package/dist/views/Version/SelectComparison/index.js +24 -3
  110. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  111. package/dist/views/Version/SelectComparison/types.d.ts +1 -0
  112. package/dist/views/Version/SelectComparison/types.d.ts.map +1 -1
  113. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  114. package/dist/views/Versions/buildColumns.d.ts.map +1 -1
  115. package/dist/views/Versions/buildColumns.js +63 -48
  116. package/dist/views/Versions/buildColumns.js.map +1 -1
  117. package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
  118. package/dist/views/Versions/cells/AutosaveCell/index.js +48 -20
  119. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  120. package/dist/views/Versions/index.d.ts.map +1 -1
  121. package/dist/views/Versions/index.js +23 -6
  122. package/dist/views/Versions/index.js.map +1 -1
  123. package/dist/withPayload.d.ts.map +1 -1
  124. package/dist/withPayload.js +4 -4
  125. package/dist/withPayload.js.map +1 -1
  126. package/package.json +23 -15
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/routes/graphql/handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,SAAS,CAAA;AAsDjF,eAAO,MAAM,UAAU,WAAkB,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,iBAyBlF,CAAA;AAED,eAAO,MAAM,IAAI,WACN,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBAyD9E,CAAA"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/routes/graphql/handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,SAAS,CAAA;AAmEjF,eAAO,MAAM,UAAU,WAAkB,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,iBAyBlF,CAAA;AAED,eAAO,MAAM,IAAI,WACN,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBAsD9E,CAAA"}
@@ -6,33 +6,42 @@ import { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest
6
6
  import { createPayloadRequest } from '../../utilities/createPayloadRequest.js';
7
7
  import { headersWithCors } from '../../utilities/headersWithCors.js';
8
8
  import { mergeHeaders } from '../../utilities/mergeHeaders.js';
9
- const handleError = async (payload, err, debug, afterErrorHook) => {
9
+ const handleError = async ({
10
+ err,
11
+ payload,
12
+ req
13
+ }) => {
10
14
  const status = err.originalError.status || httpStatus.INTERNAL_SERVER_ERROR;
11
15
  let errorMessage = err.message;
12
16
  payload.logger.error(err.stack);
13
17
  // Internal server errors can contain anything, including potentially sensitive data.
14
18
  // Therefore, error details will be hidden from the response unless `config.debug` is `true`
15
- if (!debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
19
+ if (!payload.config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {
16
20
  errorMessage = 'Something went wrong.';
17
21
  }
18
22
  let response = {
19
23
  extensions: {
20
24
  name: err?.originalError?.name || undefined,
21
25
  data: err && err.originalError && err.originalError.data || undefined,
22
- stack: debug ? err.stack : undefined,
26
+ stack: payload.config.debug ? err.stack : undefined,
23
27
  statusCode: status
24
28
  },
25
29
  locations: err.locations,
26
30
  message: errorMessage,
27
31
  path: err.path
28
32
  };
29
- if (afterErrorHook) {
30
- ({
31
- response
32
- } = afterErrorHook(err, response, null, null) || {
33
- response
33
+ await payload.config.hooks.afterError?.reduce(async (promise, hook) => {
34
+ await promise;
35
+ const result = await hook({
36
+ context: req.context,
37
+ error: err,
38
+ graphqlResult: response,
39
+ req
34
40
  });
35
- }
41
+ if (result) {
42
+ response = result.graphqlResult || response;
43
+ }
44
+ }, Promise.resolve());
36
45
  return response;
37
46
  };
38
47
  let cached = global._payload_graphql;
@@ -82,7 +91,6 @@ export const POST = config => async request => {
82
91
  const {
83
92
  payload
84
93
  } = req;
85
- const afterErrorHook = typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null;
86
94
  const headers = {};
87
95
  const apiResponse = await createHandler({
88
96
  context: {
@@ -97,7 +105,11 @@ export const POST = config => async request => {
97
105
  }) : result;
98
106
  if (response.errors) {
99
107
  const errors = await Promise.all(result.errors.map(error => {
100
- return handleError(payload, error, payload.config.debug, afterErrorHook);
108
+ return handleError({
109
+ err: error,
110
+ payload,
111
+ req
112
+ });
101
113
  }));
102
114
  // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult
103
115
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"handler.js","names":["configToSchema","createHandler","httpStatus","addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","mergeHeaders","handleError","payload","err","debug","afterErrorHook","status","originalError","INTERNAL_SERVER_ERROR","errorMessage","message","logger","error","stack","response","extensions","name","undefined","data","statusCode","locations","path","cached","global","_payload_graphql","graphql","promise","getGraphql","config","process","env","NODE_ENV","resolvedConfig","Promise","resolve","schema","e","POST","request","originalRequest","clone","req","validationRules","hooks","afterError","headers","apiResponse","context","onOperation","args","result","errors","all","map","_","defaultRules","concat","resHeaders","Headers","key","append","Response","body","responseHeaders"],"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { CollectionAfterErrorHook, Payload, SanitizedConfig } from 'payload'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport httpStatus from 'http-status'\n\nimport { addDataAndFileToRequest } from '../../utilities/addDataAndFileToRequest.js'\nimport { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest.js'\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { mergeHeaders } from '../../utilities/mergeHeaders.js'\n\nconst handleError = async (\n payload: Payload,\n err: any,\n debug: boolean,\n afterErrorHook: CollectionAfterErrorHook,\n // eslint-disable-next-line @typescript-eslint/require-await\n): Promise<GraphQLFormattedError> => {\n const status = err.originalError.status || httpStatus.INTERNAL_SERVER_ERROR\n let errorMessage = err.message\n payload.logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: GraphQLFormattedError = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && err.originalError.data) || undefined,\n stack: debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n if (afterErrorHook) {\n ;({ response } = afterErrorHook(err, response, null, null) || { response })\n }\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n cached = global._payload_graphql = { graphql: null, promise: null }\n}\n\nexport const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = global._payload_graphql = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\nexport const POST =\n (config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {\n const originalRequest = request.clone()\n const req = await createPayloadRequest({\n config,\n request,\n })\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = req\n\n const afterErrorHook =\n typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null\n\n const headers = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (request, args, result) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: request,\n result,\n })\n : result\n if (response.errors) {\n const errors = (await Promise.all(\n result.errors.map((error) => {\n return handleError(payload, error, payload.config.debug, afterErrorHook)\n }),\n )) as GraphQLError[]\n // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n }\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAOC,UAAA,MAAgB;AAEvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAE7B,MAAMC,WAAA,GAAc,MAAAA,CAClBC,OAAA,EACAC,GAAA,EACAC,KAAA,EACAC,cAAA;EAGA,MAAMC,MAAA,GAASH,GAAA,CAAII,aAAa,CAACD,MAAM,IAAIX,UAAA,CAAWa,qBAAqB;EAC3E,IAAIC,YAAA,GAAeN,GAAA,CAAIO,OAAO;EAC9BR,OAAA,CAAQS,MAAM,CAACC,KAAK,CAACT,GAAA,CAAIU,KAAK;EAE9B;EACA;EACA,IAAI,CAACT,KAAA,IAASE,MAAA,KA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A,MAAA,GAAU,MAAMlB,OAAA,CAAQmB,GAAG,CAC/BF,MAAA,CAAOC,MAAM,CAACE,GAAG,CAAEzC,KAAA;UACjB,OAAOX,WAAA,CAAYC,OAAA,EAASU,KAAA,EAAOV,OAAA,CAAQ0B,MAAM,CAACxB,KAAK,EAAEC,cAAA;QAC3D;QAEF;QACA,OAAO;UAAE,GAAGS,QAAQ;UAAEqC;QAAO;MAC/B;MACA,OAAOrC,QAAA;IACT;IACAqB,MAAA;IACAO,eAAA,EAAiBA,CAACY,CAAA,EAAGL,IAAA,EAAMM,YAAA,KAAiBA,YAAA,CAAaC,MAAM,CAACd,eAAA,CAAgBO,IAAA;EAClF,GAAGV,eAAA;EAEH,MAAMkB,UAAA,GAAa1D,eAAA,CAAgB;IACjC8C,OAAA,EAAS,IAAIa,OAAA,CAAQZ,WAAA,CAAYD,OAAO;IACxCJ;EACF;EAEA,KAAK,MAAMkB,GAAA,IAAOd,OAAA,EAAS;IACzBY,UAAA,CAAWG,MAAM,CAACD,GAAA,EAAKd,OAAO,CAACc,GAAA,CAAI;EACrC;EAEA,OAAO,IAAIE,QAAA,CAASf,WAAA,CAAYgB,IAAI,EAAE;IACpCjB,OAAA,EAASJ,GAAA,CAAIsB,eAAe,GAAG/D,YAAA,CAAayC,GAAA,CAAIsB,eAAe,EAAEN,UAAA,IAAcA,UAAA;IAC/EnD,MAAA,EAAQwC,WAAA,CAAYxC;EACtB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"handler.js","names":["configToSchema","createHandler","httpStatus","addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","mergeHeaders","handleError","err","payload","req","status","originalError","INTERNAL_SERVER_ERROR","errorMessage","message","logger","error","stack","config","debug","response","extensions","name","undefined","data","statusCode","locations","path","hooks","afterError","reduce","promise","hook","result","context","graphqlResult","Promise","resolve","cached","global","_payload_graphql","graphql","getGraphql","process","env","NODE_ENV","resolvedConfig","schema","e","POST","request","originalRequest","clone","validationRules","headers","apiResponse","onOperation","args","errors","all","map","_","defaultRules","concat","resHeaders","Headers","key","append","Response","body","responseHeaders"],"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { APIError, Payload, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport httpStatus from 'http-status'\n\nimport { addDataAndFileToRequest } from '../../utilities/addDataAndFileToRequest.js'\nimport { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest.js'\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { mergeHeaders } from '../../utilities/mergeHeaders.js'\n\nconst handleError = async ({\n err,\n payload,\n req,\n}: {\n err: GraphQLError\n payload: Payload\n req: PayloadRequest\n}): Promise<GraphQLFormattedError> => {\n const status = (err.originalError as APIError).status || httpStatus.INTERNAL_SERVER_ERROR\n let errorMessage = err.message\n payload.logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!payload.config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n errorMessage = 'Something went wrong.'\n }\n\n let response: GraphQLFormattedError = {\n extensions: {\n name: err?.originalError?.name || undefined,\n data: (err && err.originalError && (err.originalError as APIError).data) || undefined,\n stack: payload.config.debug ? err.stack : undefined,\n statusCode: status,\n },\n locations: err.locations,\n message: errorMessage,\n path: err.path,\n }\n\n await payload.config.hooks.afterError?.reduce(async (promise, hook) => {\n await promise\n\n const result = await hook({\n context: req.context,\n error: err,\n graphqlResult: response,\n req,\n })\n\n if (result) {\n response = result.graphqlResult || response\n }\n }, Promise.resolve())\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n cached = global._payload_graphql = { graphql: null, promise: null }\n}\n\nexport const getGraphql = async (config: Promise<SanitizedConfig> | SanitizedConfig) => {\n if (process.env.NODE_ENV === 'development') {\n cached = global._payload_graphql = { graphql: null, promise: null }\n }\n\n if (cached.graphql) {\n return cached.graphql\n }\n\n if (!cached.promise) {\n const resolvedConfig = await config\n cached.promise = new Promise((resolve) => {\n const schema = configToSchema(resolvedConfig)\n resolve(cached.graphql || schema)\n })\n }\n\n try {\n cached.graphql = await cached.promise\n } catch (e) {\n cached.promise = null\n throw e\n }\n\n return cached.graphql\n}\n\nexport const POST =\n (config: Promise<SanitizedConfig> | SanitizedConfig) => async (request: Request) => {\n const originalRequest = request.clone()\n const req = await createPayloadRequest({\n config,\n request,\n })\n\n await addDataAndFileToRequest(req)\n addLocalesToRequestFromData(req)\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = req\n\n const headers = {}\n const apiResponse = await createHandler({\n context: { headers, req },\n onOperation: async (request, args, result) => {\n const response =\n typeof payload.extensions === 'function'\n ? await payload.extensions({\n args,\n req: request,\n result,\n })\n : result\n if (response.errors) {\n const errors = (await Promise.all(\n result.errors.map((error) => {\n return handleError({ err: error, payload, req })\n }),\n )) as GraphQLError[]\n // errors type should be FormattedGraphQLError[] but onOperation has a return type of ExecutionResult instead of FormattedExecutionResult\n return { ...response, errors }\n }\n return response\n },\n schema,\n validationRules: (_, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, resHeaders) : resHeaders,\n status: apiResponse.status,\n })\n }\n"],"mappings":"AAGA,SAASA,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAOC,UAAA,MAAgB;AAEvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,eAAe,QAAQ;AAChC,SAASC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,OAAA,EAAS7C,GAAA,CAAI6D,eAAe,GAAGjE,YAAA,CAAaI,GAAA,CAAI6D,eAAe,EAAEN,UAAA,IAAcA,UAAA;IAC/EtD,MAAA,EAAQ6C,WAAA,CAAY7C;EACtB;AACF","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;AAIzD,eAAO,MAAM,IAAI,EAAE,sBA4BlB,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;AAKzD,eAAO,MAAM,IAAI,EAAE,sBA8BlB,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { findOperation } from 'payload';
3
3
  import { isNumber } from 'payload/shared';
4
4
  import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
+ import { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js';
5
6
  export const find = async ({
6
7
  collection,
7
8
  req
@@ -9,6 +10,7 @@ export const find = async ({
9
10
  const {
10
11
  depth,
11
12
  draft,
13
+ joins,
12
14
  limit,
13
15
  page,
14
16
  sort,
@@ -18,6 +20,7 @@ export const find = async ({
18
20
  collection,
19
21
  depth: isNumber(depth) ? Number(depth) : undefined,
20
22
  draft: draft === 'true',
23
+ joins: sanitizeJoinParams(joins),
21
24
  limit: isNumber(limit) ? Number(limit) : undefined,
22
25
  page: isNumber(page) ? Number(page) : undefined,
23
26
  req,
@@ -1 +1 @@
1
- {"version":3,"file":"find.js","names":["httpStatus","findOperation","isNumber","headersWithCors","find","collection","req","depth","draft","limit","page","sort","where","query","result","Number","undefined","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/find.ts"],"sourcesContent":["import type { 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'\n\nexport const find: CollectionRouteHandler = async ({ collection, req }) => {\n const { depth, draft, limit, page, sort, where } = req.query as {\n depth?: string\n draft?: string\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 limit: isNumber(limit) ? Number(limit) : undefined,\n page: isNumber(page) ? Number(page) : undefined,\n req,\n sort,\n where,\n })\n\n return Response.json(result, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,aAAa,QAAQ;AAC9B,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,IAAA,GAA+B,MAAAA,CAAO;EAAEC,UAAU;EAAEC;AAAG,CAAE;EACpE,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,KAAK;IAAEC,IAAI;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGN,GAAA,CAAIO,KAAK;EAS5D,MAAMC,MAAA,GAAS,MAAMb,aAAA,CAAc;IACjCI,UAAA;IACAE,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,IAAA,EAAMR,QAAA,CAASQ,IAAA,IAAQK,MAAA,CAAOL,IAAA,IAAQM,SAAA;IACtCV,GAAA;IACAK,IAAA;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,OAAA,EAAShB,eAAA,CAAgB;MACvBgB,OAAA,EAAS,IAAIC,OAAA;MACbd;IACF;IACAe,MAAA,EAAQrB,UAAA,CAAWsB;EACrB;AACF","ignoreList":[]}
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","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,\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;IACAC;EACF;EAEA,OAAOK,QAAA,CAASC,IAAI,CAACJ,MAAA,EAAQ;IAC3BK,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":"findByID.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/collections/findByID.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAK/D,eAAO,MAAM,QAAQ,EAAE,4BA6BtB,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;AAM/D,eAAO,MAAM,QAAQ,EAAE,4BA8BtB,CAAA"}
@@ -3,6 +3,7 @@ import { findByIDOperation } 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 { sanitizeJoinParams } from '../utilities/sanitizeJoinParams.js';
6
7
  export const findByID = async ({
7
8
  id: incomingID,
8
9
  collection,
@@ -22,6 +23,7 @@ export const findByID = async ({
22
23
  collection,
23
24
  depth: isNumber(depth) ? Number(depth) : undefined,
24
25
  draft: searchParams.get('draft') === 'true',
26
+ joins: sanitizeJoinParams(req.query.joins),
25
27
  req
26
28
  });
27
29
  return Response.json(result, {
@@ -1 +1 @@
1
- {"version":3,"file":"findByID.js","names":["httpStatus","findByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","findByID","id","incomingID","collection","req","searchParams","depth","get","collectionSlug","config","slug","payload","result","Number","undefined","draft","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/findByID.ts"],"sourcesContent":["import 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'\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 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,iBAAiB,QAAQ;AAClC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AAErC,OAAO,MAAMC,QAAA,GAAyC,MAAAA,CAAO;EAC3DC,EAAA,EAAIC,UAAU;EACdC,UAAU;EACVC;AAAG,CACJ;EACC,MAAM;IAAEC;EAAY,CAAE,GAAGD,GAAA;EACzB,MAAME,KAAA,GAAQD,YAAA,CAAaE,GAAG,CAAC;EAE/B,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJM,cAAA,EAAgBL,UAAA,CAAWM,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASP,GAAA,CAAIO;EACf;EAEA,MAAMC,MAAA,GAAS,MAAMhB,iBAAA,CAAkB;IACrCK,EAAA;IACAE,UAAA;IACAG,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCC,KAAA,EAAOV,YAAA,CAAaE,GAAG,CAAC,aAAa;IACrCH;EACF;EAEA,OAAOY,QAAA,CAASC,IAAI,CAACL,MAAA,EAAQ;IAC3BM,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACbf;IACF;IACAgB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AACF","ignoreList":[]}
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 +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,4BAgDxB,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;AAK/D,eAAO,MAAM,UAAU,EAAE,4BAkDxB,CAAA"}
@@ -14,6 +14,7 @@ export const updateByID = async ({
14
14
  const depth = searchParams.get('depth');
15
15
  const autosave = searchParams.get('autosave') === 'true';
16
16
  const draft = searchParams.get('draft') === 'true';
17
+ const publishSpecificLocale = req.query.publishSpecificLocale;
17
18
  const id = sanitizeCollectionID({
18
19
  id: incomingID,
19
20
  collectionSlug: collection.config.slug,
@@ -26,6 +27,7 @@ export const updateByID = async ({
26
27
  data: req.data,
27
28
  depth: isNumber(depth) ? Number(depth) : undefined,
28
29
  draft,
30
+ publishSpecificLocale,
29
31
  req
30
32
  });
31
33
  let message = req.t('general:updatedSuccessfully');
@@ -1 +1 @@
1
- {"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","collectionSlug","config","slug","payload","doc","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n\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 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;EAE5C,MAAMN,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJQ,cAAA,EAAgBP,UAAA,CAAWQ,MAAM,CAACC,IAAI;IACtCC,OAAA,EAAST,GAAA,CAAIS;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMlB,mBAAA,CAAoB;IACpCK,EAAA;IACAO,QAAA;IACAL,UAAA;IACAY,IAAA,EAAMX,GAAA,CAAIW,IAAI;IACdT,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASU,MAAA,CAAOV,KAAA,IAASW,SAAA;IACzCR,KAAA;IACAL;EACF;EAEA,IAAIc,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC;EAEpB,IAAIV,KAAA,EAAO;IACTS,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC;EAClB;EACA,IAAIX,QAAA,EAAU;IACZU,OAAA,GAAUd,GAAA,CAAIe,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEP,GAAA;IACAI;EACF,GACA;IACEI,OAAA,EAASxB,eAAA,CAAgB;MACvBwB,OAAA,EAAS,IAAIC,OAAA;MACbnB;IACF;IACAoB,MAAA,EAAQ7B,UAAA,CAAW8B;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"updateByID.js","names":["httpStatus","updateByIDOperation","isNumber","headersWithCors","sanitizeCollectionID","updateByID","id","incomingID","collection","req","searchParams","depth","get","autosave","draft","publishSpecificLocale","query","collectionSlug","config","slug","payload","doc","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/collections/updateByID.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateByIDOperation } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { CollectionRouteHandlerWithID } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\nimport { sanitizeCollectionID } from '../utilities/sanitizeCollectionID.js'\n\nexport const updateByID: CollectionRouteHandlerWithID = async ({\n id: incomingID,\n collection,\n req,\n}) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const autosave = searchParams.get('autosave') === 'true'\n const draft = searchParams.get('draft') === 'true'\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const id = sanitizeCollectionID({\n id: incomingID,\n collectionSlug: collection.config.slug,\n payload: req.payload,\n })\n\n const doc = await updateByIDOperation({\n id,\n autosave,\n collection,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n publishSpecificLocale,\n req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n doc,\n message,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;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,qBAAA,GAAwBN,GAAA,CAAIO,KAAK,CAACD,qBAAqB;EAE7D,MAAMT,EAAA,GAAKF,oBAAA,CAAqB;IAC9BE,EAAA,EAAIC,UAAA;IACJU,cAAA,EAAgBT,UAAA,CAAWU,MAAM,CAACC,IAAI;IACtCC,OAAA,EAASX,GAAA,CAAIW;EACf;EAEA,MAAMC,GAAA,GAAM,MAAMpB,mBAAA,CAAoB;IACpCK,EAAA;IACAO,QAAA;IACAL,UAAA;IACAc,IAAA,EAAMb,GAAA,CAAIa,IAAI;IACdX,KAAA,EAAOT,QAAA,CAASS,KAAA,IAASY,MAAA,CAAOZ,KAAA,IAASa,SAAA;IACzCV,KAAA;IACAC,qBAAA;IACAN;EACF;EAEA,IAAIgB,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC;EAEpB,IAAIZ,KAAA,EAAO;IACTW,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC;EAClB;EACA,IAAIb,QAAA,EAAU;IACZY,OAAA,GAAUhB,GAAA,CAAIiB,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEP,GAAA;IACAI;EACF,GACA;IACEI,OAAA,EAAS1B,eAAA,CAAgB;MACvB0B,OAAA,EAAS,IAAIC,OAAA;MACbrB;IACF;IACAsB,MAAA,EAAQ/B,UAAA,CAAWgC;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;AAIrD,eAAO,MAAM,MAAM,EAAE,kBAsCpB,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,kBAwCpB,CAAA"}
@@ -12,6 +12,7 @@ export const update = async ({
12
12
  const depth = searchParams.get('depth');
13
13
  const draft = searchParams.get('draft') === 'true';
14
14
  const autosave = searchParams.get('autosave') === 'true';
15
+ const publishSpecificLocale = req.query.publishSpecificLocale;
15
16
  const result = await updateOperationGlobal({
16
17
  slug: globalConfig.slug,
17
18
  autosave,
@@ -19,6 +20,7 @@ export const update = async ({
19
20
  depth: isNumber(depth) ? Number(depth) : undefined,
20
21
  draft,
21
22
  globalConfig,
23
+ publishSpecificLocale,
22
24
  req
23
25
  });
24
26
  let message = req.t('general:updatedSuccessfully');
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","names":["httpStatus","updateOperationGlobal","isNumber","headersWithCors","update","globalConfig","req","searchParams","depth","get","draft","autosave","result","slug","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/update.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft') === 'true'\n const autosave = searchParams.get('autosave') === 'true'\n\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 req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n message,\n result,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;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;EAElD,MAAMG,MAAA,GAAS,MAAMX,qBAAA,CAAsB;IACzCY,IAAA,EAAMR,YAAA,CAAaQ,IAAI;IACvBF,QAAA;IACAG,IAAA,EAAMR,GAAA,CAAIQ,IAAI;IACdN,KAAA,EAAON,QAAA,CAASM,KAAA,IAASO,MAAA,CAAOP,KAAA,IAASQ,SAAA;IACzCN,KAAA;IACAL,YAAA;IACAC;EACF;EAEA,IAAIW,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC;EAEpB,IAAIR,KAAA,EAAO;IACTO,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC;EAClB;EACA,IAAIP,QAAA,EAAU;IACZM,OAAA,GAAUX,GAAA,CAAIY,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEH,OAAA;IACAL;EACF,GACA;IACES,OAAA,EAASlB,eAAA,CAAgB;MACvBkB,OAAA,EAAS,IAAIC,OAAA;MACbhB;IACF;IACAiB,MAAA,EAAQvB,UAAA,CAAWwB;EACrB;AAEJ","ignoreList":[]}
1
+ {"version":3,"file":"update.js","names":["httpStatus","updateOperationGlobal","isNumber","headersWithCors","update","globalConfig","req","searchParams","depth","get","draft","autosave","publishSpecificLocale","query","result","slug","data","Number","undefined","message","t","Response","json","headers","Headers","status","OK"],"sources":["../../../../src/routes/rest/globals/update.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { updateOperationGlobal } from 'payload'\nimport { isNumber } from 'payload/shared'\n\nimport type { GlobalRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const update: GlobalRouteHandler = async ({ globalConfig, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n const draft = searchParams.get('draft') === 'true'\n const autosave = searchParams.get('autosave') === 'true'\n const publishSpecificLocale = req.query.publishSpecificLocale as string | undefined\n\n const result = await updateOperationGlobal({\n slug: globalConfig.slug,\n autosave,\n data: req.data,\n depth: isNumber(depth) ? Number(depth) : undefined,\n draft,\n globalConfig,\n publishSpecificLocale,\n req,\n })\n\n let message = req.t('general:updatedSuccessfully')\n\n if (draft) {\n message = req.t('version:draftSavedSuccessfully')\n }\n if (autosave) {\n message = req.t('version:autosavedSuccessfully')\n }\n\n return Response.json(\n {\n message,\n result,\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"mappings":"AAAA,OAAOA,UAAA,MAAgB;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,QAAQ,QAAQ;AAIzB,SAASC,eAAe,QAAQ;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;IACAO,qBAAA;IACAN;EACF;EAEA,IAAIa,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC;EAEpB,IAAIV,KAAA,EAAO;IACTS,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC;EAClB;EACA,IAAIT,QAAA,EAAU;IACZQ,OAAA,GAAUb,GAAA,CAAIc,CAAC,CAAC;EAClB;EAEA,OAAOC,QAAA,CAASC,IAAI,CAClB;IACEH,OAAA;IACAL;EACF,GACA;IACES,OAAA,EAASpB,eAAA,CAAgB;MACvBoB,OAAA,EAAS,IAAIC,OAAA;MACblB;IACF;IACAmB,MAAA,EAAQzB,UAAA,CAAW0B;EACrB;AAEJ","ignoreList":[]}
@@ -1,14 +1,9 @@
1
1
  import type { Collection, PayloadRequest, SanitizedConfig } from 'payload';
2
2
  import { APIError } from 'payload';
3
- export type ErrorResponse = {
4
- data?: any;
5
- errors: unknown[];
6
- stack?: string;
7
- };
8
- export declare const routeError: ({ collection, config: configArg, err, req, }: {
3
+ export declare const routeError: ({ collection, config: configArg, err, req: incomingReq, }: {
9
4
  collection?: Collection;
10
5
  config: Promise<SanitizedConfig> | SanitizedConfig;
11
6
  err: APIError;
12
- req: Partial<PayloadRequest>;
7
+ req: PayloadRequest | Request;
13
8
  }) => Promise<Response>;
14
9
  //# sourceMappingURL=routeError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"routeError.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/routeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG1E,OAAO,EAAE,QAAQ,EAAqC,MAAM,SAAS,CAAA;AAKrE,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AA+D7E,eAAO,MAAM,UAAU,iDAKpB;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,GAAG,EAAE,QAAQ,CAAA;IACb,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;CAC7B,sBA8DA,CAAA"}
1
+ {"version":3,"file":"routeError.d.ts","sourceRoot":"","sources":["../../../src/routes/rest/routeError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAe,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGvF,OAAO,EAAE,QAAQ,EAAqC,MAAM,SAAS,CAAA;AAmErE,eAAO,MAAM,UAAU,8DAKpB;IACD,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAAA;IAClD,GAAG,EAAE,QAAQ,CAAA;IACb,GAAG,EAAE,cAAc,GAAG,OAAO,CAAA;CAC9B,sBAkFA,CAAA"}
@@ -2,6 +2,7 @@ import httpStatus from 'http-status';
2
2
  import { APIError, APIErrorName, ValidationErrorName } from 'payload';
3
3
  import { getPayloadHMR } from '../../utilities/getPayloadHMR.js';
4
4
  import { headersWithCors } from '../../utilities/headersWithCors.js';
5
+ import { mergeHeaders } from '../../utilities/mergeHeaders.js';
5
6
  const formatErrors = incoming => {
6
7
  if (incoming) {
7
8
  // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965
@@ -52,9 +53,9 @@ export const routeError = async ({
52
53
  collection,
53
54
  config: configArg,
54
55
  err,
55
- req
56
+ req: incomingReq
56
57
  }) => {
57
- let payload = req?.payload;
58
+ let payload = 'payload' in incomingReq && incomingReq?.payload;
58
59
  if (!payload) {
59
60
  try {
60
61
  payload = await getPayloadHMR({
@@ -68,6 +69,7 @@ export const routeError = async ({
68
69
  });
69
70
  }
70
71
  }
72
+ const req = incomingReq;
71
73
  req.payload = payload;
72
74
  const headers = headersWithCors({
73
75
  headers: new Headers(),
@@ -88,26 +90,38 @@ export const routeError = async ({
88
90
  if (config.debug && config.debug === true) {
89
91
  response.stack = err.stack;
90
92
  }
91
- if (collection && typeof collection.config.hooks.afterError === 'function') {
92
- ({
93
- response,
94
- status
95
- } = collection.config.hooks.afterError(err, response, req?.context, collection.config) || {
96
- response,
97
- status
98
- });
93
+ if (collection) {
94
+ await collection.config.hooks.afterError?.reduce(async (promise, hook) => {
95
+ await promise;
96
+ const result = await hook({
97
+ collection: collection.config,
98
+ context: req.context,
99
+ error: err,
100
+ req,
101
+ result: response
102
+ });
103
+ if (result) {
104
+ response = result.response || response;
105
+ status = result.status || status;
106
+ }
107
+ }, Promise.resolve());
99
108
  }
100
- if (typeof config.hooks.afterError === 'function') {
101
- ({
102
- response,
103
- status
104
- } = config.hooks.afterError(err, response, req?.context, collection?.config) || {
105
- response,
106
- status
109
+ await config.hooks.afterError?.reduce(async (promise, hook) => {
110
+ await promise;
111
+ const result = await hook({
112
+ collection: collection?.config,
113
+ context: req.context,
114
+ error: err,
115
+ req,
116
+ result: response
107
117
  });
108
- }
118
+ if (result) {
119
+ response = result.response || response;
120
+ status = result.status || status;
121
+ }
122
+ }, Promise.resolve());
109
123
  return Response.json(response, {
110
- headers,
124
+ headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, headers) : headers,
111
125
  status
112
126
  });
113
127
  };
@@ -1 +1 @@
1
- {"version":3,"file":"routeError.js","names":["httpStatus","APIError","APIErrorName","ValidationErrorName","getPayloadHMR","headersWithCors","formatErrors","incoming","proto","Object","getPrototypeOf","constructor","name","data","errors","message","keys","reduce","acc","key","push","field","path","Array","isArray","routeError","collection","config","configArg","err","req","payload","e","Response","json","status","INTERNAL_SERVER_ERROR","headers","Headers","logger","response","error","stack","debug","hooks","afterError","context"],"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { APIError, APIErrorName, ValidationErrorName } from 'payload'\n\nimport { getPayloadHMR } from '../../utilities/getPayloadHMR.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\n\nexport type ErrorResponse = { data?: any; errors: unknown[]; stack?: string }\n\nconst formatErrors = (incoming: { [key: string]: unknown } | APIError): ErrorResponse => {\n if (incoming) {\n // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965\n // Instead, get the prototype of the incoming error and check its constructor name\n const proto = Object.getPrototypeOf(incoming)\n\n // Payload 'ValidationError' and 'APIError'\n if (\n (proto.constructor.name === ValidationErrorName || proto.constructor.name === APIErrorName) &&\n incoming.data\n ) {\n return {\n errors: [\n {\n name: incoming.name,\n data: incoming.data,\n message: incoming.message,\n },\n ],\n }\n }\n\n // Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError\n if (proto.constructor.name === ValidationErrorName && 'errors' in incoming && incoming.errors) {\n return {\n errors: Object.keys(incoming.errors).reduce((acc, key) => {\n acc.push({\n field: incoming.errors[key].path,\n message: incoming.errors[key].message,\n })\n return acc\n }, []),\n }\n }\n\n if (Array.isArray(incoming.message)) {\n return {\n errors: incoming.message,\n }\n }\n\n if (incoming.name) {\n return {\n errors: [\n {\n message: incoming.message,\n },\n ],\n }\n }\n }\n\n return {\n errors: [\n {\n message: 'An unknown error occurred.',\n },\n ],\n }\n}\n\nexport const routeError = async ({\n collection,\n config: configArg,\n err,\n req,\n}: {\n collection?: Collection\n config: Promise<SanitizedConfig> | SanitizedConfig\n err: APIError\n req: Partial<PayloadRequest>\n}) => {\n let payload = req?.payload\n\n if (!payload) {\n try {\n payload = await getPayloadHMR({ config: configArg })\n } catch (e) {\n return Response.json(\n {\n message: 'There was an error initializing Payload',\n },\n { status: httpStatus.INTERNAL_SERVER_ERROR },\n )\n }\n }\n\n req.payload = payload\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { config, logger } = payload\n\n let response = formatErrors(err)\n\n let status = err.status || httpStatus.INTERNAL_SERVER_ERROR\n\n logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n response = formatErrors(new APIError('Something went wrong.'))\n }\n\n if (config.debug && config.debug === true) {\n response.stack = err.stack\n }\n\n if (collection && typeof collection.config.hooks.afterError === 'function') {\n ;({ response, status } = collection.config.hooks.afterError(\n err,\n response,\n req?.context,\n collection.config,\n ) || { response, status })\n }\n\n if (typeof config.hooks.afterError === 'function') {\n ;({ response, status } = config.hooks.afterError(\n err,\n response,\n req?.context,\n collection?.config,\n ) || {\n response,\n status,\n })\n }\n\n return Response.json(response, { headers, status })\n}\n"],"mappings":"AAE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AAM,CAACiB,KAAK,CAACC,UAAU,KAAK,YAAY;IACxE;MAAEL,QAAQ;MAAEL;IAAM,CAAE,GAAGT,UAAA,CAAWC,MAAM,CAACiB,KAAK,CAACC,UAAU,CACzDhB,GAAA,EACAW,QAAA,EACAV,GAAA,EAAKgB,OAAA,EACLpB,UAAA,CAAWC,MAAM,KACd;MAAEa,QAAA;MAAUL;IAAO;EAC1B;EAEA,IAAI,OAAOR,MAAA,CAAOiB,KAAK,CAACC,UAAU,KAAK,YAAY;IAC/C;MAAEL,QAAQ;MAAEL;IAAM,CAAE,GAAGR,MAAA,CAAOiB,KAAK,CAACC,UAAU,CAC9ChB,GAAA,EACAW,QAAA,EACAV,GAAA,EAAKgB,OAAA,EACLpB,UAAA,EAAYC,MAAA,KACT;MACHa,QAAA;MACAL;IACF;EACF;EAEA,OAAOF,QAAA,CAASC,IAAI,CAACM,QAAA,EAAU;IAAEH,OAAA;IAASF;EAAO;AACnD","ignoreList":[]}
1
+ {"version":3,"file":"routeError.js","names":["httpStatus","APIError","APIErrorName","ValidationErrorName","getPayloadHMR","headersWithCors","mergeHeaders","formatErrors","incoming","proto","Object","getPrototypeOf","constructor","name","data","errors","message","keys","reduce","acc","key","push","field","path","Array","isArray","routeError","collection","config","configArg","err","req","incomingReq","payload","e","Response","json","status","INTERNAL_SERVER_ERROR","headers","Headers","logger","response","error","stack","debug","hooks","afterError","promise","hook","result","context","Promise","resolve","responseHeaders"],"sources":["../../../src/routes/rest/routeError.ts"],"sourcesContent":["import type { Collection, ErrorResult, PayloadRequest, SanitizedConfig } from 'payload'\n\nimport httpStatus from 'http-status'\nimport { APIError, APIErrorName, ValidationErrorName } from 'payload'\n\nimport { getPayloadHMR } from '../../utilities/getPayloadHMR.js'\nimport { headersWithCors } from '../../utilities/headersWithCors.js'\nimport { mergeHeaders } from '../../utilities/mergeHeaders.js'\n\nconst formatErrors = (incoming: { [key: string]: unknown } | APIError): ErrorResult => {\n if (incoming) {\n // Cannot use `instanceof` to check error type: https://github.com/microsoft/TypeScript/issues/13965\n // Instead, get the prototype of the incoming error and check its constructor name\n const proto = Object.getPrototypeOf(incoming)\n\n // Payload 'ValidationError' and 'APIError'\n if (\n (proto.constructor.name === ValidationErrorName || proto.constructor.name === APIErrorName) &&\n incoming.data\n ) {\n return {\n errors: [\n {\n name: incoming.name,\n data: incoming.data,\n message: incoming.message,\n },\n ],\n }\n }\n\n // Mongoose 'ValidationError': https://mongoosejs.com/docs/api/error.html#Error.ValidationError\n if (proto.constructor.name === ValidationErrorName && 'errors' in incoming && incoming.errors) {\n return {\n errors: Object.keys(incoming.errors).reduce((acc, key) => {\n acc.push({\n field: incoming.errors[key].path,\n message: incoming.errors[key].message,\n })\n return acc\n }, []),\n }\n }\n\n if (Array.isArray(incoming.message)) {\n return {\n errors: incoming.message,\n }\n }\n\n if (incoming.name) {\n return {\n errors: [\n {\n message: incoming.message,\n },\n ],\n }\n }\n }\n\n return {\n errors: [\n {\n message: 'An unknown error occurred.',\n },\n ],\n }\n}\n\nexport const routeError = async ({\n collection,\n config: configArg,\n err,\n req: incomingReq,\n}: {\n collection?: Collection\n config: Promise<SanitizedConfig> | SanitizedConfig\n err: APIError\n req: PayloadRequest | Request\n}) => {\n let payload = 'payload' in incomingReq && incomingReq?.payload\n\n if (!payload) {\n try {\n payload = await getPayloadHMR({ config: configArg })\n } catch (e) {\n return Response.json(\n {\n message: 'There was an error initializing Payload',\n },\n { status: httpStatus.INTERNAL_SERVER_ERROR },\n )\n }\n }\n\n const req = incomingReq as PayloadRequest\n\n req.payload = payload\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n const { config, logger } = payload\n\n let response = formatErrors(err)\n\n let status = err.status || httpStatus.INTERNAL_SERVER_ERROR\n\n logger.error(err.stack)\n\n // Internal server errors can contain anything, including potentially sensitive data.\n // Therefore, error details will be hidden from the response unless `config.debug` is `true`\n if (!config.debug && status === httpStatus.INTERNAL_SERVER_ERROR) {\n response = formatErrors(new APIError('Something went wrong.'))\n }\n\n if (config.debug && config.debug === true) {\n response.stack = err.stack\n }\n\n if (collection) {\n await collection.config.hooks.afterError?.reduce(async (promise, hook) => {\n await promise\n\n const result = await hook({\n collection: collection.config,\n context: req.context,\n error: err,\n req,\n result: response,\n })\n\n if (result) {\n response = (result.response as ErrorResult) || response\n status = result.status || status\n }\n }, Promise.resolve())\n }\n\n await config.hooks.afterError?.reduce(async (promise, hook) => {\n await promise\n\n const result = await hook({\n collection: collection?.config,\n context: req.context,\n error: err,\n req,\n result: response,\n })\n\n if (result) {\n response = (result.response as ErrorResult) || response\n status = result.status || status\n }\n }, Promise.resolve())\n\n return Response.json(response, {\n headers: req.responseHeaders ? mergeHeaders(req.responseHeaders, headers) : headers,\n status,\n })\n}\n"],"mappings":"AAEA,OAAOA,UAAA,MAAgB;AACvB,SAASC,QAAQ,EAAEC,YAAY,EAAEC,mBAAmB,QAAQ;AAE5D,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,YAAY,QAAQ;AAE7B,MAAMC,YAAA,GAAgBC,QAAA;EACpB,IAAIA,QAAA,EAAU;IACZ;IACA;IACA,MAAMC,KAAA,GAAQC,MAAA,CAAOC,cAAc,CAACH,QAAA;IAEpC;IACA,IACE,CAACC,KAAA,CAAMG,WAAW,CAACC,IAAI,KAAKV,mBAAA,IAAuBM,KAAA,CAAMG,WAAW,CAACC,IAAI,KAAKX,YAAW,KACzFM,QAAA,CAASM,IAAI,EACb;MACA,OAAO;QACLC,MAAA,EAAQ,CACN;UACEF,IAAA,EAAML,QAAA,CAASK,IAAI;UACnBC,IAAA,EAAMN,QAAA,CAASM,IAAI;UACnBE,OAAA,EAASR,QAAA,CAASQ;QACpB;MAEJ;IACF;IAEA;IACA,IAAIP,KAAA,CAAMG,WAAW,CAACC,IAAI,KAAKV,mBAAA,IAAuB,YAAYK,QAAA,IAAYA,QAAA,CAASO,MAAM,EAAE;MAC7F,OAAO;QACLA,MAAA,EAAQL,MAAA,CAAOO,IAA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A;MACxBuB,OAAA,EAASpB,GAAA,CAAIoB,OAAO;MACpBR,KAAA,EAAOb,GAAA;MACPC,GAAA;MACAmB,MAAA,EAAQR;IACV;IAEA,IAAIQ,MAAA,EAAQ;MACVR,QAAA,GAAWQ,MAAC,CAAOR,QAAQ,IAAoBA,QAAA;MAC/CL,MAAA,GAASa,MAAA,CAAOb,MAAM,IAAIA,MAAA;IAC5B;EACF,GAAGe,OAAA,CAAQC,OAAO;EAElB,OAAOlB,QAAA,CAASC,IAAI,CAACM,QAAA,EAAU;IAC7BH,OAAA,EAASR,GAAA,CAAIuB,eAAe,GAAGhD,YAAA,CAAayB,GAAA,CAAIuB,eAAe,EAAEf,OAAA,IAAWA,OAAA;IAC5EF;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,13 @@
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
+ };
12
+ } | false) => JoinQuery;
13
+ //# sourceMappingURL=sanitizeJoinParams.d.ts.map
@@ -0,0 +1 @@
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,GAAG;QACpB,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,OAAO,CAAA;KAChB,CAAA;CACF,GACD,KAAK,KACR,SAYF,CAAA"}
@@ -0,0 +1,17 @@
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
+ joinQuery[schemaPath] = {
10
+ limit: isNumber(joins[schemaPath]?.limit) ? Number(joins[schemaPath].limit) : undefined,
11
+ sort: joins[schemaPath]?.sort ? joins[schemaPath].sort : undefined,
12
+ where: joins[schemaPath]?.where ? joins[schemaPath].where : undefined
13
+ };
14
+ });
15
+ return joinQuery;
16
+ };
17
+ //# sourceMappingURL=sanitizeJoinParams.js.map
@@ -0,0 +1 @@
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 limit?: unknown\n sort?: string\n where?: unknown\n }\n }\n | false = {},\n): JoinQuery => {\n const joinQuery = {}\n\n Object.keys(joins).forEach((schemaPath) => {\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 return joinQuery\n}\n"],"mappings":"AAEA,SAASA,QAAQ,QAAQ;AAEzB;;;;AAIA,OAAO,MAAMC,kBAAA,GAAqBA,CAChCC,KAAA,GAQY,CAAC,CAAC;EAEd,MAAMC,SAAA,GAAY,CAAC;EAEnBC,MAAA,CAAOC,IAAI,CAACH,KAAA,EAAOI,OAAO,CAAEC,UAAA;IAC1BJ,SAAS,CAACI,UAAA,CAAW,GAAG;MACtBC,KAAA,EAAOR,QAAA,CAASE,KAAK,CAACK,UAAA,CAAW,EAAEC,KAAA,IAASC,MAAA,CAAOP,KAAK,CAACK,UAAA,CAAW,CAACC,KAAK,IAAIE,SAAA;MAC9EC,IAAA,EAAMT,KAAK,CAACK,UAAA,CAAW,EAAEI,IAAA,GAAOT,KAAK,CAACK,UAAA,CAAW,CAACI,IAAI,GAAGD,SAAA;MACzDE,KAAA,EAAOV,KAAK,CAACK,UAAA,CAAW,EAAEK,KAAA,GAAQV,KAAK,CAACK,UAAA,CAAW,CAACK,KAAK,GAAGF;IAC9D;EACF;EAEA,OAAOP,SAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI5E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAMrB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,eAAe,CAAA;CACjC,GAAG,WAAW,CAAA;AAEf,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsE1D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/Default/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI5E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,cAAc,CAAA;AAMrB,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,eAAe,CAAA;CACjC,GAAG,WAAW,CAAA;AAEf,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwE1D,CAAA"}
@@ -55,9 +55,13 @@ export const DefaultTemplate = ({
55
55
  children: [/*#__PURE__*/_jsx("div", {
56
56
  className: `${baseClass}__nav-toggler-wrapper`,
57
57
  id: "nav-toggler",
58
- children: /*#__PURE__*/_jsx(NavToggler, {
59
- className: `${baseClass}__nav-toggler`,
60
- children: /*#__PURE__*/_jsx(NavHamburger, {})
58
+ children: /*#__PURE__*/_jsx("div", {
59
+ className: `${baseClass}__nav-toggler-container`,
60
+ id: "nav-toggler",
61
+ children: /*#__PURE__*/_jsx(NavToggler, {
62
+ className: `${baseClass}__nav-toggler`,
63
+ children: /*#__PURE__*/_jsx(NavHamburger, {})
64
+ })
61
65
  })
62
66
  }), /*#__PURE__*/_jsxs(Wrapper, {
63
67
  baseClass: baseClass,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["AppHeader","BulkUploadProvider","EntityVisibilityProvider","NavToggler","getCreateMappedComponent","RenderComponent","React","DefaultNav","NavHamburger","Wrapper","baseClass","DefaultTemplate","children","className","i18n","locale","params","payload","permissions","searchParams","user","visibleEntities","admin","components","header","CustomHeader","Nav","CustomNav","undefined","config","createMappedComponent","importMap","serverProps","MappedDefaultNav","MappedCustomHeader","_jsx","_jsxs","mappedComponent","style","position","id"],"sources":["../../../src/templates/Default/index.tsx"],"sourcesContent":["import type { MappedComponent, ServerProps, VisibleEntities } from 'payload'\n\nimport { AppHeader, BulkUploadProvider, EntityVisibilityProvider, NavToggler } from '@payloadcms/ui'\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport { DefaultNav } from '../../elements/Nav/index.js'\nimport './index.scss'\nimport { NavHamburger } from './NavHamburger/index.js'\nimport { Wrapper } from './Wrapper/index.js'\n\nconst baseClass = 'template-default'\n\nexport type DefaultTemplateProps = {\n children?: React.ReactNode\n className?: string\n visibleEntities: VisibleEntities\n} & ServerProps\n\nexport const DefaultTemplate: React.FC<DefaultTemplateProps> = ({\n children,\n className,\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n visibleEntities,\n}) => {\n const {\n admin: {\n components: { header: CustomHeader, Nav: CustomNav } = {\n header: undefined,\n Nav: undefined,\n },\n } = {},\n } = payload.config || {}\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const MappedDefaultNav: MappedComponent = createMappedComponent(\n CustomNav,\n undefined,\n DefaultNav,\n 'CustomNav',\n )\n\n const MappedCustomHeader = createMappedComponent(\n CustomHeader,\n undefined,\n undefined,\n 'CustomHeader',\n )\n\n return (\n <EntityVisibilityProvider visibleEntities={visibleEntities}>\n <BulkUploadProvider>\n <RenderComponent mappedComponent={MappedCustomHeader} />\n <div style={{ position: 'relative' }}>\n <div className={`${baseClass}__nav-toggler-wrapper`} id=\"nav-toggler\">\n <NavToggler className={`${baseClass}__nav-toggler`}>\n <NavHamburger />\n </NavToggler>\n </div>\n <Wrapper baseClass={baseClass} className={className}>\n <RenderComponent mappedComponent={MappedDefaultNav} />\n\n <div className={`${baseClass}__wrap`}>\n <AppHeader />\n {children}\n </div>\n </Wrapper>\n </div>\n </BulkUploadProvider>\n </EntityVisibilityProvider>\n )\n}\n"],"mappings":";AAEA,SAASA,SAAS,EAAEC,kBAAkB,EAAEC,wBAAwB,EAAEC,UAAU,QAAQ;AACpF,SAASC,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAE3B,SAASC,YAAY,QAAQ;AAC7B,SAASC,OAAO,QAAQ;AAExB,MAAMC,SAAA,GAAY;AAQlB,OAAO,MAAMC,eAAA,GAAkDA,CAAC;EAC9DC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,OAAO;EACPC,WAAW;EACXC,YAAY;EACZ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B,IAAA,CAACnC,SAAA,OACAY,QAAA;;;;;;AAOf","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["AppHeader","BulkUploadProvider","EntityVisibilityProvider","NavToggler","getCreateMappedComponent","RenderComponent","React","DefaultNav","NavHamburger","Wrapper","baseClass","DefaultTemplate","children","className","i18n","locale","params","payload","permissions","searchParams","user","visibleEntities","admin","components","header","CustomHeader","Nav","CustomNav","undefined","config","createMappedComponent","importMap","serverProps","MappedDefaultNav","MappedCustomHeader","_jsx","_jsxs","mappedComponent","style","position","id"],"sources":["../../../src/templates/Default/index.tsx"],"sourcesContent":["import type { MappedComponent, ServerProps, VisibleEntities } from 'payload'\n\nimport { AppHeader, BulkUploadProvider, EntityVisibilityProvider, NavToggler } from '@payloadcms/ui'\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport { DefaultNav } from '../../elements/Nav/index.js'\nimport './index.scss'\nimport { NavHamburger } from './NavHamburger/index.js'\nimport { Wrapper } from './Wrapper/index.js'\n\nconst baseClass = 'template-default'\n\nexport type DefaultTemplateProps = {\n children?: React.ReactNode\n className?: string\n visibleEntities: VisibleEntities\n} & ServerProps\n\nexport const DefaultTemplate: React.FC<DefaultTemplateProps> = ({\n children,\n className,\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n visibleEntities,\n}) => {\n const {\n admin: {\n components: { header: CustomHeader, Nav: CustomNav } = {\n header: undefined,\n Nav: undefined,\n },\n } = {},\n } = payload.config || {}\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const MappedDefaultNav: MappedComponent = createMappedComponent(\n CustomNav,\n undefined,\n DefaultNav,\n 'CustomNav',\n )\n\n const MappedCustomHeader = createMappedComponent(\n CustomHeader,\n undefined,\n undefined,\n 'CustomHeader',\n )\n\n return (\n <EntityVisibilityProvider visibleEntities={visibleEntities}>\n <BulkUploadProvider>\n <RenderComponent mappedComponent={MappedCustomHeader} />\n <div style={{ position: 'relative' }}>\n <div className={`${baseClass}__nav-toggler-wrapper`} id=\"nav-toggler\">\n <div className={`${baseClass}__nav-toggler-container`} id=\"nav-toggler\">\n <NavToggler className={`${baseClass}__nav-toggler`}>\n <NavHamburger />\n </NavToggler>\n </div>\n </div>\n <Wrapper baseClass={baseClass} className={className}>\n <RenderComponent mappedComponent={MappedDefaultNav} />\n\n <div className={`${baseClass}__wrap`}>\n <AppHeader />\n {children}\n </div>\n </Wrapper>\n </div>\n </BulkUploadProvider>\n </EntityVisibilityProvider>\n )\n}\n"],"mappings":";AAEA,SAASA,SAAS,EAAEC,kBAAkB,EAAEC,wBAAwB,EAAEC,UAAU,QAAQ;AACpF,SAASC,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,OAAOC,KAAA,MAAW;AAElB,SAASC,UAAU,QAAQ;AAE3B,SAASC,YAAY,QAAQ;AAC7B,SAASC,OAAO,QAAQ;AAExB,MAAMC,SAAA,GAAY;AAQlB,OAAO,MAAMC,eAAA,GAAkDA,CAAC;EAC9DC,QAAQ;EACRC,SAAS;EACTC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,OAAO;EACPC,WAAW;EACXC,YAAY;EACZC,IAAI;EACJC;AAAe,CAChB;EACC,MAAM;IACJC,KAAA,EAAO;MACLC,UAAA,EAAY;QAAEC,MAAA,EAAQC,YAAY;QAAEC,GAAA,EAAKC;MAAS,CAAE,GAAG;QACrDH,MAAA,EAAQI,SAAA;QACRF,GAAA,EAAKE;MACP;IAAC,CACF,GAAG,CAAC;EAAC,CACP,GAAGX,OAAA,CAAQY,MAAM,IAAI,CAAC;EAEvB,MAAMC,qBAAA,GAAwB1B,wBAAA,CAAyB;IACrD2B,SAAA,EAAWd,OAAA,CAAQc,SAAS;IAC5BC,WAAA,EAAa;MACXlB,IAAA;MACAC,MAAA;MACAC,MAAA;MACAC,OAAA;MACAC,WAAA;MACAC,YAAA;MACAC;IACF;EACF;EAEA,MAAMa,gBAAA,GAAoCH,qBAAA,CACxCH,SAAA,EACAC,SAAA,EACArB,UAAA,EACA;EAGF,MAAM2B,kBAAA,GAAqBJ,qBAAA,CACzBL,YAAA,EACAG,SAAA,EACAA,SAAA,EACA;EAGF,oBACEO,IAAA,CAACjC,wBAAA;IAAyBmB,eAAA,EAAiBA,eAAA;cACzC,aAAAe,KAAA,CAACnC,kBAAA;8BACCkC,IAAA,CAAC9B,eAAA;QAAgBgC,eAAA,EAAiBH;uBAClCE,KAAA,CAAC;QAAIE,KAAA,EAAO;UAAEC,QAAA,EAAU;QAAW;gCACjCJ,IAAA,CAAC;UAAItB,SAAA,EAAW,GAAGH,SAAA,uBAAgC;UAAE8B,EAAA,EAAG;oBACtD,aAAAL,IAAA,CAAC;YAAItB,SAAA,EAAW,GAAGH,SAAA,yBAAkC;YAAE8B,EAAA,EAAG;sBACxD,aAAAL,IAAA,CAAChC,UAAA;cAAWU,SAAA,EAAW,GAAGH,SAAA,eAAwB;wBAChD,aAAAyB,IAAA,CAAC3B,YAAA;;;yBAIP4B,KAAA,CAAC3B,OAAA;UAAQC,SAAA,EAAWA,SAAA;UAAWG,SAAA,EAAWA,SAAA;kCACxCsB,IAAA,CAAC9B,eAAA;YAAgBgC,eAAA,EAAiBJ;2BAElCG,KAAA,CAAC;YAAIvB,SAAA,EAAW,GAAGH,SAAA,QAAiB;oCAClCyB,IAAA,CAACnC,SAAA,OACAY,QAAA;;;;;;AAOf","ignoreList":[]}
@@ -20,12 +20,17 @@
20
20
  justify-content: center;
21
21
  }
22
22
 
23
- &__nav-toggler {
23
+ &__nav-toggler-container {
24
24
  height: var(--app-header-height);
25
25
  display: flex;
26
26
  align-items: center;
27
27
  }
28
28
 
29
+ &__nav-toggler {
30
+ display: flex;
31
+ align-items: center;
32
+ }
33
+
29
34
  &__wrap {
30
35
  min-width: 0;
31
36
  width: 100%;
@@ -1 +1 @@
1
- {"version":3,"file":"getRequestTheme.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iEAAiE,CAAA;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEzD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,sBAAsB,CAAA;IACrD,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;CAC5B,CAAA;AAID,eAAO,MAAM,eAAe,iCAAkC,sBAAsB,KAAG,KAkBtF,CAAA"}
1
+ {"version":3,"file":"getRequestTheme.d.ts","sourceRoot":"","sources":["../../src/utilities/getRequestTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iEAAiE,CAAA;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEzD,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,sBAAsB,CAAA;IACrD,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;CAC5B,CAAA;AAID,eAAO,MAAM,eAAe,iCAAkC,sBAAsB,KAAG,KAsBtF,CAAA"}
@@ -5,6 +5,9 @@ export const getRequestTheme = ({
5
5
  cookies,
6
6
  headers
7
7
  }) => {
8
+ if (config.admin.theme !== 'all' && acceptedThemes.includes(config.admin.theme)) {
9
+ return config.admin.theme;
10
+ }
8
11
  const themeCookie = cookies.get(`${config.cookiePrefix || 'payload'}-theme`);
9
12
  const themeFromCookie = typeof themeCookie === 'string' ? themeCookie : themeCookie?.value;
10
13
  if (themeFromCookie && acceptedThemes.includes(themeFromCookie)) {