@payloadcms/next 3.0.0-beta.3 → 3.0.0-beta.31

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 (429) hide show
  1. package/dist/cjs/withPayload.cjs +2 -1
  2. package/dist/cjs/withPayload.cjs.map +1 -1
  3. package/dist/exports/routes.d.ts +1 -1
  4. package/dist/exports/routes.d.ts.map +1 -1
  5. package/dist/exports/routes.js +1 -1
  6. package/dist/exports/routes.js.map +1 -1
  7. package/dist/exports/utilities.d.ts +7 -1
  8. package/dist/exports/utilities.d.ts.map +1 -1
  9. package/dist/exports/utilities.js +7 -1
  10. package/dist/exports/utilities.js.map +1 -1
  11. package/dist/{next-fileupload → fetchAPI-multipart}/fileFactory.d.ts +2 -2
  12. package/dist/fetchAPI-multipart/fileFactory.d.ts.map +1 -0
  13. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -0
  14. package/dist/{next-fileupload → fetchAPI-multipart}/handlers.d.ts +2 -2
  15. package/dist/fetchAPI-multipart/handlers.d.ts.map +1 -0
  16. package/dist/fetchAPI-multipart/handlers.js.map +1 -0
  17. package/dist/{next-fileupload → fetchAPI-multipart}/index.d.ts +8 -8
  18. package/dist/fetchAPI-multipart/index.d.ts.map +1 -0
  19. package/dist/{next-fileupload → fetchAPI-multipart}/index.js +1 -1
  20. package/dist/fetchAPI-multipart/index.js.map +1 -0
  21. package/dist/fetchAPI-multipart/isEligibleRequest.d.ts.map +1 -0
  22. package/dist/{next-fileupload → fetchAPI-multipart}/isEligibleRequest.js +1 -1
  23. package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -0
  24. package/dist/fetchAPI-multipart/processMultipart.d.ts +8 -0
  25. package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -0
  26. package/dist/{next-fileupload → fetchAPI-multipart}/processMultipart.js +29 -6
  27. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -0
  28. package/dist/fetchAPI-multipart/processNested.d.ts.map +1 -0
  29. package/dist/{next-fileupload → fetchAPI-multipart}/processNested.js +2 -1
  30. package/dist/fetchAPI-multipart/processNested.js.map +1 -0
  31. package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +1 -0
  32. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -0
  33. package/dist/{next-fileupload → fetchAPI-multipart}/utilities.d.ts +4 -4
  34. package/dist/fetchAPI-multipart/utilities.d.ts.map +1 -0
  35. package/dist/{next-fileupload → fetchAPI-multipart}/utilities.js +4 -4
  36. package/dist/fetchAPI-multipart/utilities.js.map +1 -0
  37. package/dist/fetchAPI-stream-file/index.d.ts.map +1 -0
  38. package/dist/fetchAPI-stream-file/index.js.map +1 -0
  39. package/dist/layouts/Root/index.d.ts.map +1 -1
  40. package/dist/layouts/Root/index.js +23 -1
  41. package/dist/layouts/Root/index.js.map +1 -1
  42. package/dist/prod/payload/payload-favicon-dark.png +0 -0
  43. package/dist/prod/payload/payload-favicon-light.png +0 -0
  44. package/dist/prod/styles.css +1 -1
  45. package/dist/routes/graphql/handler.d.ts.map +1 -1
  46. package/dist/routes/graphql/handler.js +22 -10
  47. package/dist/routes/graphql/handler.js.map +1 -1
  48. package/dist/routes/index.d.ts +1 -1
  49. package/dist/routes/index.d.ts.map +1 -1
  50. package/dist/routes/index.js +1 -1
  51. package/dist/routes/index.js.map +1 -1
  52. package/dist/routes/rest/auth/access.d.ts.map +1 -1
  53. package/dist/routes/rest/auth/access.js +5 -0
  54. package/dist/routes/rest/auth/access.js.map +1 -1
  55. package/dist/routes/rest/auth/forgotPassword.d.ts.map +1 -1
  56. package/dist/routes/rest/auth/forgotPassword.js +7 -2
  57. package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
  58. package/dist/routes/rest/auth/init.d.ts.map +1 -1
  59. package/dist/routes/rest/auth/init.js +6 -0
  60. package/dist/routes/rest/auth/init.js.map +1 -1
  61. package/dist/routes/rest/auth/login.d.ts.map +1 -1
  62. package/dist/routes/rest/auth/login.js +8 -5
  63. package/dist/routes/rest/auth/login.js.map +1 -1
  64. package/dist/routes/rest/auth/logout.d.ts.map +1 -1
  65. package/dist/routes/rest/auth/logout.js +12 -7
  66. package/dist/routes/rest/auth/logout.js.map +1 -1
  67. package/dist/routes/rest/auth/me.d.ts.map +1 -1
  68. package/dist/routes/rest/auth/me.js +5 -0
  69. package/dist/routes/rest/auth/me.js.map +1 -1
  70. package/dist/routes/rest/auth/refresh.d.ts.map +1 -1
  71. package/dist/routes/rest/auth/refresh.js +11 -7
  72. package/dist/routes/rest/auth/refresh.js.map +1 -1
  73. package/dist/routes/rest/auth/registerFirstUser.d.ts.map +1 -1
  74. package/dist/routes/rest/auth/registerFirstUser.js +8 -5
  75. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  76. package/dist/routes/rest/auth/resetPassword.d.ts.map +1 -1
  77. package/dist/routes/rest/auth/resetPassword.js +8 -5
  78. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  79. package/dist/routes/rest/auth/unlock.d.ts.map +1 -1
  80. package/dist/routes/rest/auth/unlock.js +7 -2
  81. package/dist/routes/rest/auth/unlock.js.map +1 -1
  82. package/dist/routes/rest/auth/verifyEmail.d.ts.map +1 -1
  83. package/dist/routes/rest/auth/verifyEmail.js +7 -2
  84. package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
  85. package/dist/routes/rest/buildFormState.d.ts +3 -3
  86. package/dist/routes/rest/buildFormState.d.ts.map +1 -1
  87. package/dist/routes/rest/buildFormState.js +42 -7
  88. package/dist/routes/rest/buildFormState.js.map +1 -1
  89. package/dist/routes/rest/collections/count.d.ts +3 -0
  90. package/dist/routes/rest/collections/count.d.ts.map +1 -0
  91. package/dist/routes/rest/collections/count.js +15 -0
  92. package/dist/routes/rest/collections/count.js.map +1 -0
  93. package/dist/routes/rest/collections/create.d.ts.map +1 -1
  94. package/dist/routes/rest/collections/create.js +5 -0
  95. package/dist/routes/rest/collections/create.js.map +1 -1
  96. package/dist/routes/rest/collections/delete.d.ts.map +1 -1
  97. package/dist/routes/rest/collections/delete.js +7 -0
  98. package/dist/routes/rest/collections/delete.js.map +1 -1
  99. package/dist/routes/rest/collections/deleteByID.d.ts.map +1 -1
  100. package/dist/routes/rest/collections/deleteByID.js +14 -1
  101. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  102. package/dist/routes/rest/collections/docAccess.d.ts.map +1 -1
  103. package/dist/routes/rest/collections/docAccess.js +5 -0
  104. package/dist/routes/rest/collections/docAccess.js.map +1 -1
  105. package/dist/routes/rest/collections/duplicate.d.ts.map +1 -1
  106. package/dist/routes/rest/collections/duplicate.js +12 -1
  107. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  108. package/dist/routes/rest/collections/find.d.ts.map +1 -1
  109. package/dist/routes/rest/collections/find.js +5 -0
  110. package/dist/routes/rest/collections/find.js.map +1 -1
  111. package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
  112. package/dist/routes/rest/collections/findByID.js +12 -1
  113. package/dist/routes/rest/collections/findByID.js.map +1 -1
  114. package/dist/routes/rest/collections/findVersionByID.d.ts.map +1 -1
  115. package/dist/routes/rest/collections/findVersionByID.js +12 -1
  116. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  117. package/dist/routes/rest/collections/findVersions.d.ts.map +1 -1
  118. package/dist/routes/rest/collections/findVersions.js +5 -0
  119. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  120. package/dist/routes/rest/collections/preview.d.ts.map +1 -1
  121. package/dist/routes/rest/collections/preview.js +11 -2
  122. package/dist/routes/rest/collections/preview.js.map +1 -1
  123. package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -1
  124. package/dist/routes/rest/collections/restoreVersion.js +12 -1
  125. package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
  126. package/dist/routes/rest/collections/update.d.ts.map +1 -1
  127. package/dist/routes/rest/collections/update.js +7 -0
  128. package/dist/routes/rest/collections/update.js.map +1 -1
  129. package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
  130. package/dist/routes/rest/collections/updateByID.js +12 -1
  131. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  132. package/dist/routes/rest/files/checkFileAccess.d.ts +3 -3
  133. package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
  134. package/dist/routes/rest/files/checkFileAccess.js +1 -0
  135. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  136. package/dist/routes/rest/files/getFile.d.ts +2 -2
  137. package/dist/routes/rest/files/getFile.d.ts.map +1 -1
  138. package/dist/routes/rest/files/getFile.js +19 -10
  139. package/dist/routes/rest/files/getFile.js.map +1 -1
  140. package/dist/routes/rest/files/getFileTypeFallback.d.ts +7 -0
  141. package/dist/routes/rest/files/getFileTypeFallback.d.ts.map +1 -0
  142. package/dist/routes/rest/files/getFileTypeFallback.js +21 -0
  143. package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -0
  144. package/dist/routes/rest/globals/docAccess.d.ts.map +1 -1
  145. package/dist/routes/rest/globals/docAccess.js +5 -0
  146. package/dist/routes/rest/globals/docAccess.js.map +1 -1
  147. package/dist/routes/rest/globals/findOne.d.ts.map +1 -1
  148. package/dist/routes/rest/globals/findOne.js +5 -0
  149. package/dist/routes/rest/globals/findOne.js.map +1 -1
  150. package/dist/routes/rest/globals/findVersionByID.d.ts.map +1 -1
  151. package/dist/routes/rest/globals/findVersionByID.js +5 -0
  152. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  153. package/dist/routes/rest/globals/findVersions.d.ts.map +1 -1
  154. package/dist/routes/rest/globals/findVersions.js +5 -0
  155. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  156. package/dist/routes/rest/globals/preview.d.ts.map +1 -1
  157. package/dist/routes/rest/globals/preview.js +11 -2
  158. package/dist/routes/rest/globals/preview.js.map +1 -1
  159. package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -1
  160. package/dist/routes/rest/globals/restoreVersion.js +5 -0
  161. package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
  162. package/dist/routes/rest/globals/update.d.ts.map +1 -1
  163. package/dist/routes/rest/globals/update.js +5 -0
  164. package/dist/routes/rest/globals/update.js.map +1 -1
  165. package/dist/routes/rest/index.d.ts +1 -0
  166. package/dist/routes/rest/index.d.ts.map +1 -1
  167. package/dist/routes/rest/index.js +324 -213
  168. package/dist/routes/rest/index.js.map +1 -1
  169. package/dist/routes/rest/routeError.d.ts +5 -4
  170. package/dist/routes/rest/routeError.d.ts.map +1 -1
  171. package/dist/routes/rest/routeError.js +25 -11
  172. package/dist/routes/rest/routeError.js.map +1 -1
  173. package/dist/routes/rest/types.d.ts +7 -7
  174. package/dist/routes/rest/types.d.ts.map +1 -1
  175. package/dist/routes/rest/types.js.map +1 -1
  176. package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts +9 -0
  177. package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +1 -0
  178. package/dist/routes/rest/utilities/sanitizeCollectionID.js +13 -0
  179. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -0
  180. package/dist/scss/app.scss +2 -3
  181. package/dist/scss/vars.scss +0 -7
  182. package/dist/utilities/addDataAndFileToRequest.d.ts +11 -0
  183. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -0
  184. package/dist/utilities/addDataAndFileToRequest.js +74 -0
  185. package/dist/utilities/addDataAndFileToRequest.js.map +1 -0
  186. package/dist/utilities/addLocalesToRequest.d.ts +20 -0
  187. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -0
  188. package/dist/utilities/addLocalesToRequest.js +44 -0
  189. package/dist/utilities/addLocalesToRequest.js.map +1 -0
  190. package/dist/utilities/buildFieldSchemaMap/index.d.ts +2 -2
  191. package/dist/utilities/buildFieldSchemaMap/index.d.ts.map +1 -1
  192. package/dist/utilities/buildFieldSchemaMap/index.js.map +1 -1
  193. package/dist/utilities/buildFieldSchemaMap/traverseFields.d.ts +1 -1
  194. package/dist/utilities/buildFieldSchemaMap/traverseFields.d.ts.map +1 -1
  195. package/dist/utilities/buildFieldSchemaMap/traverseFields.js +3 -0
  196. package/dist/utilities/buildFieldSchemaMap/traverseFields.js.map +1 -1
  197. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  198. package/dist/utilities/createPayloadRequest.js +15 -28
  199. package/dist/utilities/createPayloadRequest.js.map +1 -1
  200. package/dist/utilities/getDataAndFile.d.ts +2 -2
  201. package/dist/utilities/getDataAndFile.d.ts.map +1 -1
  202. package/dist/utilities/getDataAndFile.js +27 -43
  203. package/dist/utilities/getDataAndFile.js.map +1 -1
  204. package/dist/utilities/getNextRequestI18n.d.ts +1 -1
  205. package/dist/utilities/getNextRequestI18n.js +1 -1
  206. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  207. package/dist/utilities/getPayloadHMR.d.ts +2 -1
  208. package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
  209. package/dist/utilities/getPayloadHMR.js +22 -18
  210. package/dist/utilities/getPayloadHMR.js.map +1 -1
  211. package/dist/utilities/getRequestLanguage.d.ts +1 -1
  212. package/dist/utilities/getRequestLanguage.d.ts.map +1 -1
  213. package/dist/utilities/getRequestLanguage.js +3 -4
  214. package/dist/utilities/getRequestLanguage.js.map +1 -1
  215. package/dist/utilities/headersWithCors.d.ts +8 -0
  216. package/dist/utilities/headersWithCors.d.ts.map +1 -0
  217. package/dist/utilities/headersWithCors.js +17 -0
  218. package/dist/utilities/headersWithCors.js.map +1 -0
  219. package/dist/utilities/initPage/handleAdminPage.d.ts +13 -0
  220. package/dist/utilities/initPage/handleAdminPage.d.ts.map +1 -0
  221. package/dist/utilities/initPage/handleAdminPage.js +35 -0
  222. package/dist/utilities/initPage/handleAdminPage.js.map +1 -0
  223. package/dist/utilities/initPage/handleAuthRedirect.d.ts +9 -0
  224. package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -0
  225. package/dist/utilities/initPage/handleAuthRedirect.js +26 -0
  226. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -0
  227. package/dist/utilities/initPage/index.d.ts +4 -0
  228. package/dist/utilities/initPage/index.d.ts.map +1 -0
  229. package/dist/utilities/{initPage.js → initPage/index.js} +22 -31
  230. package/dist/utilities/initPage/index.js.map +1 -0
  231. package/dist/utilities/initPage/shared.d.ts +4 -0
  232. package/dist/utilities/initPage/shared.d.ts.map +1 -0
  233. package/dist/utilities/initPage/shared.js +17 -0
  234. package/dist/utilities/initPage/shared.js.map +1 -0
  235. package/dist/utilities/initPage/types.d.ts +24 -0
  236. package/dist/utilities/initPage/types.d.ts.map +1 -0
  237. package/dist/utilities/initPage/types.js +3 -0
  238. package/dist/utilities/initPage/types.js.map +1 -0
  239. package/dist/utilities/meta.d.ts.map +1 -1
  240. package/dist/utilities/meta.js +24 -11
  241. package/dist/utilities/meta.js.map +1 -1
  242. package/dist/views/API/RenderJSON/index.js +4 -1
  243. package/dist/views/API/RenderJSON/index.js.map +1 -1
  244. package/dist/views/API/index.client.js +8 -8
  245. package/dist/views/API/index.client.js.map +1 -1
  246. package/dist/views/API/meta.d.ts.map +1 -1
  247. package/dist/views/API/meta.js +1 -3
  248. package/dist/views/API/meta.js.map +1 -1
  249. package/dist/views/Account/index.d.ts.map +1 -1
  250. package/dist/views/Account/index.js +4 -2
  251. package/dist/views/Account/index.js.map +1 -1
  252. package/dist/views/Account/meta.d.ts.map +1 -1
  253. package/dist/views/Account/meta.js +1 -3
  254. package/dist/views/Account/meta.js.map +1 -1
  255. package/dist/views/CreateFirstUser/index.client.d.ts +3 -3
  256. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  257. package/dist/views/CreateFirstUser/index.client.js +48 -6
  258. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  259. package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
  260. package/dist/views/CreateFirstUser/index.js +9 -20
  261. package/dist/views/CreateFirstUser/index.js.map +1 -1
  262. package/dist/views/CreateFirstUser/index.scss +2 -12
  263. package/dist/views/CreateFirstUser/meta.d.ts.map +1 -1
  264. package/dist/views/CreateFirstUser/meta.js +1 -3
  265. package/dist/views/CreateFirstUser/meta.js.map +1 -1
  266. package/dist/views/Dashboard/Default/index.d.ts +2 -1
  267. package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
  268. package/dist/views/Dashboard/Default/index.js +14 -7
  269. package/dist/views/Dashboard/Default/index.js.map +1 -1
  270. package/dist/views/Dashboard/index.d.ts.map +1 -1
  271. package/dist/views/Dashboard/index.js +3 -2
  272. package/dist/views/Dashboard/index.js.map +1 -1
  273. package/dist/views/Dashboard/meta.d.ts.map +1 -1
  274. package/dist/views/Dashboard/meta.js +1 -3
  275. package/dist/views/Dashboard/meta.js.map +1 -1
  276. package/dist/views/Document/index.d.ts.map +1 -1
  277. package/dist/views/Document/index.js +4 -2
  278. package/dist/views/Document/index.js.map +1 -1
  279. package/dist/views/Edit/Default/Auth/APIKey.d.ts +1 -0
  280. package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +1 -1
  281. package/dist/views/Edit/Default/Auth/APIKey.js +13 -6
  282. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  283. package/dist/views/Edit/Default/Auth/index.js +2 -1
  284. package/dist/views/Edit/Default/Auth/index.js.map +1 -1
  285. package/dist/views/Edit/Default/{SetStepNav → SetDocumentStepNav}/index.d.ts +1 -1
  286. package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +1 -0
  287. package/dist/views/Edit/Default/{SetStepNav → SetDocumentStepNav}/index.js +12 -5
  288. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -0
  289. package/dist/views/Edit/Default/index.d.ts.map +1 -1
  290. package/dist/views/Edit/Default/index.js +6 -5
  291. package/dist/views/Edit/Default/index.js.map +1 -1
  292. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts +3 -0
  293. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -0
  294. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +58 -0
  295. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -0
  296. package/dist/views/ForgotPassword/index.d.ts.map +1 -1
  297. package/dist/views/ForgotPassword/index.js +3 -39
  298. package/dist/views/ForgotPassword/index.js.map +1 -1
  299. package/dist/views/ForgotPassword/meta.d.ts.map +1 -1
  300. package/dist/views/ForgotPassword/meta.js +1 -3
  301. package/dist/views/ForgotPassword/meta.js.map +1 -1
  302. package/dist/views/List/index.d.ts.map +1 -1
  303. package/dist/views/List/index.js +4 -3
  304. package/dist/views/List/index.js.map +1 -1
  305. package/dist/views/LivePreview/Preview/index.d.ts.map +1 -1
  306. package/dist/views/LivePreview/Preview/index.js +23 -0
  307. package/dist/views/LivePreview/Preview/index.js.map +1 -1
  308. package/dist/views/LivePreview/Toolbar/Controls/index.d.ts.map +1 -1
  309. package/dist/views/LivePreview/Toolbar/Controls/index.js +6 -4
  310. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  311. package/dist/views/LivePreview/index.client.js +2 -2
  312. package/dist/views/LivePreview/index.client.js.map +1 -1
  313. package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
  314. package/dist/views/Login/LoginForm/index.js +32 -2
  315. package/dist/views/Login/LoginForm/index.js.map +1 -1
  316. package/dist/views/Login/index.d.ts.map +1 -1
  317. package/dist/views/Login/index.js +15 -8
  318. package/dist/views/Login/index.js.map +1 -1
  319. package/dist/views/Login/meta.d.ts.map +1 -1
  320. package/dist/views/Login/meta.js +1 -3
  321. package/dist/views/Login/meta.js.map +1 -1
  322. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  323. package/dist/views/Logout/LogoutClient.js +1 -2
  324. package/dist/views/Logout/LogoutClient.js.map +1 -1
  325. package/dist/views/Logout/meta.d.ts.map +1 -1
  326. package/dist/views/Logout/meta.js +1 -3
  327. package/dist/views/Logout/meta.js.map +1 -1
  328. package/dist/views/NotFound/index.d.ts.map +1 -1
  329. package/dist/views/NotFound/index.js +6 -4
  330. package/dist/views/NotFound/index.js.map +1 -1
  331. package/dist/views/NotFound/meta.d.ts.map +1 -1
  332. package/dist/views/NotFound/meta.js +1 -3
  333. package/dist/views/NotFound/meta.js.map +1 -1
  334. package/dist/views/ResetPassword/index.client.d.ts +7 -0
  335. package/dist/views/ResetPassword/index.client.d.ts.map +1 -0
  336. package/dist/views/ResetPassword/index.client.js +83 -0
  337. package/dist/views/ResetPassword/index.client.js.map +1 -0
  338. package/dist/views/ResetPassword/index.d.ts.map +1 -1
  339. package/dist/views/ResetPassword/index.js +6 -31
  340. package/dist/views/ResetPassword/index.js.map +1 -1
  341. package/dist/views/ResetPassword/index.scss +2 -12
  342. package/dist/views/ResetPassword/meta.d.ts.map +1 -1
  343. package/dist/views/ResetPassword/meta.js +1 -3
  344. package/dist/views/ResetPassword/meta.js.map +1 -1
  345. package/dist/views/Root/getViewFromConfig.d.ts +1 -1
  346. package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
  347. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  348. package/dist/views/Root/index.d.ts.map +1 -1
  349. package/dist/views/Root/index.js +2 -2
  350. package/dist/views/Root/index.js.map +1 -1
  351. package/dist/views/Unauthorized/meta.d.ts.map +1 -1
  352. package/dist/views/Unauthorized/meta.js +1 -3
  353. package/dist/views/Unauthorized/meta.js.map +1 -1
  354. package/dist/views/Verify/index.d.ts.map +1 -1
  355. package/dist/views/Verify/index.js +2 -2
  356. package/dist/views/Verify/index.js.map +1 -1
  357. package/dist/views/Verify/meta.d.ts.map +1 -1
  358. package/dist/views/Verify/meta.js +1 -3
  359. package/dist/views/Verify/meta.js.map +1 -1
  360. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  361. package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts +0 -2
  362. package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
  363. package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts +2 -2
  364. package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.map +1 -1
  365. package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
  366. package/dist/views/Version/RenderFieldsToDiff/types.d.ts +2 -2
  367. package/dist/views/Version/RenderFieldsToDiff/types.d.ts.map +1 -1
  368. package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
  369. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  370. package/dist/views/Version/Restore/index.js +11 -8
  371. package/dist/views/Version/Restore/index.js.map +1 -1
  372. package/dist/views/Version/Restore/index.scss +4 -2
  373. package/dist/views/Versions/index.js +2 -2
  374. package/dist/views/Versions/index.js.map +1 -1
  375. package/dist/withPayload.d.ts.map +1 -1
  376. package/dist/withPayload.js +2 -1
  377. package/dist/withPayload.js.map +1 -1
  378. package/package.json +34 -33
  379. package/dist/next-fileupload/fileFactory.d.ts.map +0 -1
  380. package/dist/next-fileupload/fileFactory.js.map +0 -1
  381. package/dist/next-fileupload/handlers.d.ts.map +0 -1
  382. package/dist/next-fileupload/handlers.js.map +0 -1
  383. package/dist/next-fileupload/index.d.ts.map +0 -1
  384. package/dist/next-fileupload/index.js.map +0 -1
  385. package/dist/next-fileupload/isEligibleRequest.d.ts.map +0 -1
  386. package/dist/next-fileupload/isEligibleRequest.js.map +0 -1
  387. package/dist/next-fileupload/processMultipart.d.ts +0 -8
  388. package/dist/next-fileupload/processMultipart.d.ts.map +0 -1
  389. package/dist/next-fileupload/processMultipart.js.map +0 -1
  390. package/dist/next-fileupload/processNested.d.ts.map +0 -1
  391. package/dist/next-fileupload/processNested.js.map +0 -1
  392. package/dist/next-fileupload/uploadTimer.d.ts.map +0 -1
  393. package/dist/next-fileupload/uploadTimer.js.map +0 -1
  394. package/dist/next-fileupload/utilities.d.ts.map +0 -1
  395. package/dist/next-fileupload/utilities.js.map +0 -1
  396. package/dist/next-stream-file/index.d.ts.map +0 -1
  397. package/dist/next-stream-file/index.js.map +0 -1
  398. package/dist/prod/payload/SuisseIntl-Bold.woff +0 -0
  399. package/dist/prod/payload/SuisseIntl-Bold.woff2 +0 -0
  400. package/dist/prod/payload/SuisseIntl-Medium.woff +0 -0
  401. package/dist/prod/payload/SuisseIntl-Medium.woff2 +0 -0
  402. package/dist/prod/payload/SuisseIntl-SemiBold.woff +0 -0
  403. package/dist/prod/payload/SuisseIntl-SemiBold.woff2 +0 -0
  404. package/dist/prod/payload/SuisseIntl.woff +0 -0
  405. package/dist/prod/payload/SuisseIntl.woff2 +0 -0
  406. package/dist/prod/payload/merriweather-v30-latin-900.woff +0 -0
  407. package/dist/prod/payload/merriweather-v30-latin-900.woff2 +0 -0
  408. package/dist/prod/payload/merriweather-v30-latin-900italic.woff +0 -0
  409. package/dist/prod/payload/merriweather-v30-latin-900italic.woff2 +0 -0
  410. package/dist/prod/payload/merriweather-v30-latin-italic.woff +0 -0
  411. package/dist/prod/payload/merriweather-v30-latin-italic.woff2 +0 -0
  412. package/dist/prod/payload/merriweather-v30-latin-regular.woff +0 -0
  413. package/dist/prod/payload/merriweather-v30-latin-regular.woff2 +0 -0
  414. package/dist/scss/fonts.scss +0 -75
  415. package/dist/utilities/initPage.d.ts +0 -12
  416. package/dist/utilities/initPage.d.ts.map +0 -1
  417. package/dist/utilities/initPage.js.map +0 -1
  418. package/dist/views/Edit/Default/SetStepNav/index.d.ts.map +0 -1
  419. package/dist/views/Edit/Default/SetStepNav/index.js.map +0 -1
  420. package/src/index.js +0 -1
  421. /package/dist/{next-fileupload → fetchAPI-multipart}/fileFactory.js +0 -0
  422. /package/dist/{next-fileupload → fetchAPI-multipart}/handlers.js +0 -0
  423. /package/dist/{next-fileupload → fetchAPI-multipart}/isEligibleRequest.d.ts +0 -0
  424. /package/dist/{next-fileupload → fetchAPI-multipart}/processNested.d.ts +0 -0
  425. /package/dist/{next-fileupload → fetchAPI-multipart}/uploadTimer.d.ts +0 -0
  426. /package/dist/{next-fileupload → fetchAPI-multipart}/uploadTimer.js +0 -0
  427. /package/dist/{next-stream-file → fetchAPI-stream-file}/index.d.ts +0 -0
  428. /package/dist/{next-stream-file → fetchAPI-stream-file}/index.js +0 -0
  429. /package/dist/prod/payload/{favicon.svg → payload-favicon.svg} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/routes/graphql/handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,eAAe,CAAA;AAkDvF,eAAO,MAAM,UAAU,WAAkB,QAAQ,eAAe,CAAC,GAAG,eAAe,iBAyBlF,CAAA;AAED,eAAO,MAAM,IAAI,WACN,QAAQ,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBAiD9E,CAAA"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/routes/graphql/handler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,eAAe,CAAA;AAsDvF,eAAO,MAAM,UAAU,WAAkB,QAAQ,eAAe,CAAC,GAAG,eAAe,iBAyBlF,CAAA;AAED,eAAO,MAAM,IAAI,WACN,QAAQ,eAAe,CAAC,GAAG,eAAe,eAAqB,OAAO,sBAyD9E,CAAA"}
@@ -1,7 +1,10 @@
1
1
  import { configToSchema } from '@payloadcms/graphql';
2
2
  import { createHandler } from 'graphql-http/lib/use/fetch';
3
3
  import httpStatus from 'http-status';
4
+ import { addDataAndFileToRequest } from '../../utilities/addDataAndFileToRequest.js';
5
+ import { addLocalesToRequestFromData } from '../../utilities/addLocalesToRequest.js';
4
6
  import { createPayloadRequest } from '../../utilities/createPayloadRequest.js';
7
+ import { headersWithCors } from '../../utilities/headersWithCors.js';
5
8
  const handleError = async (payload, err, debug, afterErrorHook)=>{
6
9
  const status = err.originalError.status || httpStatus.INTERNAL_SERVER_ERROR;
7
10
  let errorMessage = err.message;
@@ -23,7 +26,7 @@ const handleError = async (payload, err, debug, afterErrorHook)=>{
23
26
  path: err.path
24
27
  };
25
28
  if (afterErrorHook) {
26
- ({ response } = await afterErrorHook(err, response, null, null) || {
29
+ ({ response } = afterErrorHook(err, response, null, null) || {
27
30
  response
28
31
  });
29
32
  }
@@ -48,10 +51,10 @@ export const getGraphql = async (config)=>{
48
51
  return cached.graphql;
49
52
  }
50
53
  if (!cached.promise) {
51
- cached.promise = new Promise(async (resolve)=>{
52
- const resolvedConfig = await config;
53
- const schema = await configToSchema(resolvedConfig);
54
- resolve(schema);
54
+ const resolvedConfig = await config;
55
+ cached.promise = new Promise((resolve)=>{
56
+ const schema = configToSchema(resolvedConfig);
57
+ resolve(cached.graphql || schema);
55
58
  });
56
59
  }
57
60
  try {
@@ -64,18 +67,24 @@ export const getGraphql = async (config)=>{
64
67
  };
65
68
  export const POST = (config)=>async (request)=>{
66
69
  const originalRequest = request.clone();
67
- const req = await createPayloadRequest({
70
+ const basePayloadRequest = await createPayloadRequest({
68
71
  config,
69
72
  request
70
73
  });
74
+ const reqWithData = await addDataAndFileToRequest({
75
+ request: basePayloadRequest
76
+ });
77
+ const payloadRequest = addLocalesToRequestFromData({
78
+ request: reqWithData
79
+ });
71
80
  const { schema, validationRules } = await getGraphql(config);
72
- const { payload } = req;
81
+ const { payload } = payloadRequest;
73
82
  const afterErrorHook = typeof payload.config.hooks.afterError === 'function' ? payload.config.hooks.afterError : null;
74
83
  const headers = {};
75
84
  const apiResponse = await createHandler({
76
85
  context: {
77
86
  headers,
78
- req
87
+ req: payloadRequest
79
88
  },
80
89
  onOperation: async (request, args, result)=>{
81
90
  const response = typeof payload.extensions === 'function' ? await payload.extensions({
@@ -98,12 +107,15 @@ export const POST = (config)=>async (request)=>{
98
107
  schema,
99
108
  validationRules: (request, args, defaultRules)=>defaultRules.concat(validationRules(args))
100
109
  })(originalRequest);
101
- const resHeaders = new Headers(apiResponse.headers);
110
+ const resHeaders = headersWithCors({
111
+ headers: new Headers(apiResponse.headers),
112
+ req: payloadRequest
113
+ });
102
114
  for(const key in headers){
103
115
  resHeaders.append(key, headers[key]);
104
116
  }
105
117
  return new Response(apiResponse.body, {
106
- headers: new Headers(resHeaders),
118
+ headers: resHeaders,
107
119
  status: apiResponse.status
108
120
  });
109
121
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLFormattedError } from 'graphql'\nimport type { GraphQLError } from 'graphql'\nimport type { CollectionAfterErrorHook, Payload, SanitizedConfig } from 'payload/types'\n\nimport { configToSchema } from '@payloadcms/graphql'\nimport { createHandler } from 'graphql-http/lib/use/fetch'\nimport httpStatus from 'http-status'\n\nimport { createPayloadRequest } from '../../utilities/createPayloadRequest.js'\n\nconst handleError = async (\n payload: Payload,\n err: any,\n debug: boolean,\n afterErrorHook: CollectionAfterErrorHook,\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 } = (await afterErrorHook(err, response, null, null)) || { response })\n }\n\n return response\n}\n\nlet cached = global._payload_graphql\n\nif (!cached) {\n // eslint-disable-next-line no-multi-assign\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 cached.promise = new Promise(async (resolve) => {\n const resolvedConfig = await config\n const schema = await configToSchema(resolvedConfig)\n resolve(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 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: (request, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = new Headers(apiResponse.headers)\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: new Headers(resHeaders),\n status: apiResponse.status,\n })\n }\n"],"names":["configToSchema","createHandler","httpStatus","createPayloadRequest","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","Promise","resolve","resolvedConfig","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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
1
+ {"version":3,"sources":["../../../src/routes/graphql/handler.ts"],"sourcesContent":["import type { GraphQLError, GraphQLFormattedError } from 'graphql'\nimport type { CollectionAfterErrorHook, Payload, SanitizedConfig } from 'payload/types'\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'\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 // eslint-disable-next-line no-multi-assign\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 basePayloadRequest = await createPayloadRequest({\n config,\n request,\n })\n\n const reqWithData = await addDataAndFileToRequest({ request: basePayloadRequest })\n const payloadRequest = addLocalesToRequestFromData({ request: reqWithData })\n\n const { schema, validationRules } = await getGraphql(config)\n\n const { payload } = payloadRequest\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: payloadRequest },\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: (request, args, defaultRules) => defaultRules.concat(validationRules(args)),\n })(originalRequest)\n\n const resHeaders = headersWithCors({\n headers: new Headers(apiResponse.headers),\n req: payloadRequest,\n })\n\n for (const key in headers) {\n resHeaders.append(key, headers[key])\n }\n\n return new Response(apiResponse.body, {\n headers: resHeaders,\n status: apiResponse.status,\n })\n }\n"],"names":["configToSchema","createHandler","httpStatus","addDataAndFileToRequest","addLocalesToRequestFromData","createPayloadRequest","headersWithCors","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","basePayloadRequest","reqWithData","payloadRequest","validationRules","hooks","afterError","headers","apiResponse","context","req","onOperation","args","result","errors","all","map","defaultRules","concat","resHeaders","Headers","key","append","Response","body"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"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"}
@@ -1,3 +1,3 @@
1
1
  export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from './graphql/index.js';
2
- export { DELETE as REST_DELETE, GET as REST_GET, PATCH as REST_PATCH, POST as REST_POST, } from './rest/index.js';
2
+ export { DELETE as REST_DELETE, GET as REST_GET, OPTIONS as REST_OPTIONS, PATCH as REST_PATCH, POST as REST_POST, } from './rest/index.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEzE,OAAO,EACL,MAAM,IAAI,WAAW,EACrB,GAAG,IAAI,QAAQ,EACf,KAAK,IAAI,UAAU,EACnB,IAAI,IAAI,SAAS,GAClB,MAAM,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEzE,OAAO,EACL,MAAM,IAAI,WAAW,EACrB,GAAG,IAAI,QAAQ,EACf,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,UAAU,EACnB,IAAI,IAAI,SAAS,GAClB,MAAM,iBAAiB,CAAA"}
@@ -1,4 +1,4 @@
1
1
  export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from './graphql/index.js';
2
- export { DELETE as REST_DELETE, GET as REST_GET, PATCH as REST_PATCH, POST as REST_POST } from './rest/index.js';
2
+ export { DELETE as REST_DELETE, GET as REST_GET, OPTIONS as REST_OPTIONS, PATCH as REST_PATCH, POST as REST_POST } from './rest/index.js';
3
3
 
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/routes/index.ts"],"sourcesContent":["export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from './graphql/index.js'\n\nexport {\n DELETE as REST_DELETE,\n GET as REST_GET,\n PATCH as REST_PATCH,\n POST as REST_POST,\n} from './rest/index.js'\n"],"names":["GRAPHQL_PLAYGROUND_GET","GRAPHQL_POST","DELETE","REST_DELETE","GET","REST_GET","PATCH","REST_PATCH","POST","REST_POST"],"rangeMappings":";","mappings":"AAAA,SAASA,sBAAsB,EAAEC,YAAY,QAAQ,qBAAoB;AAEzE,SACEC,UAAUC,WAAW,EACrBC,OAAOC,QAAQ,EACfC,SAASC,UAAU,EACnBC,QAAQC,SAAS,QACZ,kBAAiB"}
1
+ {"version":3,"sources":["../../src/routes/index.ts"],"sourcesContent":["export { GRAPHQL_PLAYGROUND_GET, GRAPHQL_POST } from './graphql/index.js'\n\nexport {\n DELETE as REST_DELETE,\n GET as REST_GET,\n OPTIONS as REST_OPTIONS,\n PATCH as REST_PATCH,\n POST as REST_POST,\n} from './rest/index.js'\n"],"names":["GRAPHQL_PLAYGROUND_GET","GRAPHQL_POST","DELETE","REST_DELETE","GET","REST_GET","OPTIONS","REST_OPTIONS","PATCH","REST_PATCH","POST","REST_POST"],"rangeMappings":";","mappings":"AAAA,SAASA,sBAAsB,EAAEC,YAAY,QAAQ,qBAAoB;AAEzE,SACEC,UAAUC,WAAW,EACrBC,OAAOC,QAAQ,EACfC,WAAWC,YAAY,EACvBC,SAASC,UAAU,EACnBC,QAAQC,SAAS,QACZ,kBAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/access.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD,eAAO,MAAM,MAAM,EAAE,gBAQpB,CAAA"}
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/access.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,eAAO,MAAM,MAAM,EAAE,gBAYpB,CAAA"}
@@ -1,10 +1,15 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { accessOperation } from 'payload/operations';
3
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
3
4
  export const access = async ({ req })=>{
4
5
  const results = await accessOperation({
5
6
  req
6
7
  });
7
8
  return Response.json(results, {
9
+ headers: headersWithCors({
10
+ headers: new Headers(),
11
+ req
12
+ }),
8
13
  status: httpStatus.OK
9
14
  });
10
15
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/access.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { accessOperation } from 'payload/operations'\n\nimport type { BaseRouteHandler } from '../types.js'\n\nexport const access: BaseRouteHandler = async ({ req }) => {\n const results = await accessOperation({\n req,\n })\n\n return Response.json(results, {\n status: httpStatus.OK,\n })\n}\n"],"names":["httpStatus","accessOperation","access","req","results","Response","json","status","OK"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,eAAe,QAAQ,qBAAoB;AAIpD,OAAO,MAAMC,SAA2B,OAAO,EAAEC,GAAG,EAAE;IACpD,MAAMC,UAAU,MAAMH,gBAAgB;QACpCE;IACF;IAEA,OAAOE,SAASC,IAAI,CAACF,SAAS;QAC5BG,QAAQP,WAAWQ,EAAE;IACvB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/access.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { accessOperation } from 'payload/operations'\n\nimport type { BaseRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const access: BaseRouteHandler = async ({ req }) => {\n const results = await accessOperation({\n req,\n })\n\n return Response.json(results, {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n })\n}\n"],"names":["httpStatus","accessOperation","headersWithCors","access","req","results","Response","json","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,eAAe,QAAQ,qBAAoB;AAIpD,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,SAA2B,OAAO,EAAEC,GAAG,EAAE;IACpD,MAAMC,UAAU,MAAMJ,gBAAgB;QACpCG;IACF;IAEA,OAAOE,SAASC,IAAI,CAACF,SAAS;QAC5BG,SAASN,gBAAgB;YACvBM,SAAS,IAAIC;YACbL;QACF;QACAM,QAAQV,WAAWW,EAAE;IACvB;AACF,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,cAAc,EAAE,sBAoB5B,CAAA"}
1
+ {"version":3,"file":"forgotPassword.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,cAAc,EAAE,sBAwB5B,CAAA"}
@@ -1,6 +1,8 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { forgotPasswordOperation } from 'payload/operations';
3
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
3
4
  export const forgotPassword = async ({ collection, req })=>{
5
+ const { t } = req;
4
6
  await forgotPasswordOperation({
5
7
  collection,
6
8
  data: {
@@ -11,9 +13,12 @@ export const forgotPassword = async ({ collection, req })=>{
11
13
  req
12
14
  });
13
15
  return Response.json({
14
- // TODO(translate)
15
- message: 'Success'
16
+ message: t('general:success')
16
17
  }, {
18
+ headers: headersWithCors({
19
+ headers: new Headers(),
20
+ req
21
+ }),
17
22
  status: httpStatus.OK
18
23
  });
19
24
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { forgotPasswordOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const forgotPassword: CollectionRouteHandler = async ({ collection, req }) => {\n await forgotPasswordOperation({\n collection,\n data: {\n email: req.data.email as string,\n },\n disableEmail: Boolean(req.data?.disableEmail),\n expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,\n req,\n })\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Success',\n },\n {\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","forgotPasswordOperation","forgotPassword","collection","req","data","email","disableEmail","Boolean","expiration","undefined","Response","json","message","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,uBAAuB,QAAQ,qBAAoB;AAI5D,OAAO,MAAMC,iBAAyC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IAC9E,MAAMH,wBAAwB;QAC5BE;QACAE,MAAM;YACJC,OAAOF,IAAIC,IAAI,CAACC,KAAK;QACvB;QACAC,cAAcC,QAAQJ,IAAIC,IAAI,EAAEE;QAChCE,YAAY,OAAOL,IAAIC,IAAI,CAACI,UAAU,KAAK,WAAWL,IAAIC,IAAI,CAACI,UAAU,GAAGC;QAC5EN;IACF;IAEA,OAAOO,SAASC,IAAI,CAClB;QACE,kBAAkB;QAClBC,SAAS;IACX,GACA;QACEC,QAAQd,WAAWe,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/forgotPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { forgotPasswordOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const forgotPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n await forgotPasswordOperation({\n collection,\n data: {\n email: req.data.email as string,\n },\n disableEmail: Boolean(req.data?.disableEmail),\n expiration: typeof req.data.expiration === 'number' ? req.data.expiration : undefined,\n req,\n })\n\n return Response.json(\n {\n message: t('general:success'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","forgotPasswordOperation","headersWithCors","forgotPassword","collection","req","t","data","email","disableEmail","Boolean","expiration","undefined","Response","json","message","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,uBAAuB,QAAQ,qBAAoB;AAI5D,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,iBAAyC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IAC9E,MAAM,EAAEC,CAAC,EAAE,GAAGD;IACd,MAAMJ,wBAAwB;QAC5BG;QACAG,MAAM;YACJC,OAAOH,IAAIE,IAAI,CAACC,KAAK;QACvB;QACAC,cAAcC,QAAQL,IAAIE,IAAI,EAAEE;QAChCE,YAAY,OAAON,IAAIE,IAAI,CAACI,UAAU,KAAK,WAAWN,IAAIE,IAAI,CAACI,UAAU,GAAGC;QAC5EP;IACF;IAEA,OAAOQ,SAASC,IAAI,CAClB;QACEC,SAAST,EAAE;IACb,GACA;QACEU,SAASd,gBAAgB;YACvBc,SAAS,IAAIC;YACbZ;QACF;QACAa,QAAQlB,WAAWmB,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,IAAI,EAAE,sBAOlB,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/init.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,IAAI,EAAE,sBAelB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { initOperation } from 'payload/operations';
2
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
2
3
  export const init = async ({ collection, req })=>{
3
4
  const initialized = await initOperation({
4
5
  collection: collection.config.slug,
@@ -6,6 +7,11 @@ export const init = async ({ collection, req })=>{
6
7
  });
7
8
  return Response.json({
8
9
  initialized
10
+ }, {
11
+ headers: headersWithCors({
12
+ headers: new Headers(),
13
+ req
14
+ })
9
15
  });
10
16
  };
11
17
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/init.ts"],"sourcesContent":["import { initOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const init: CollectionRouteHandler = async ({ collection, req }) => {\n const initialized = await initOperation({\n collection: collection.config.slug,\n req,\n })\n\n return Response.json({ initialized })\n}\n"],"names":["initOperation","init","collection","req","initialized","config","slug","Response","json"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAoB;AAIlD,OAAO,MAAMC,OAA+B,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACpE,MAAMC,cAAc,MAAMJ,cAAc;QACtCE,YAAYA,WAAWG,MAAM,CAACC,IAAI;QAClCH;IACF;IAEA,OAAOI,SAASC,IAAI,CAAC;QAAEJ;IAAY;AACrC,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/init.ts"],"sourcesContent":["import { initOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const init: CollectionRouteHandler = async ({ collection, req }) => {\n const initialized = await initOperation({\n collection: collection.config.slug,\n req,\n })\n\n return Response.json(\n { initialized },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n },\n )\n}\n"],"names":["initOperation","headersWithCors","init","collection","req","initialized","config","slug","Response","json","headers","Headers"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAoB;AAIlD,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,OAA+B,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACpE,MAAMC,cAAc,MAAML,cAAc;QACtCG,YAAYA,WAAWG,MAAM,CAACC,IAAI;QAClCH;IACF;IAEA,OAAOI,SAASC,IAAI,CAClB;QAAEJ;IAAY,GACd;QACEK,SAAST,gBAAgB;YACvBS,SAAS,IAAIC;YACbP;QACF;IACF;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/login.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,KAAK,EAAE,sBAqCnB,CAAA"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/login.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,KAAK,EAAE,sBAuCnB,CAAA"}
@@ -2,8 +2,9 @@ import httpStatus from 'http-status';
2
2
  import { generatePayloadCookie } from 'payload/auth';
3
3
  import { loginOperation } from 'payload/operations';
4
4
  import { isNumber } from 'payload/utilities';
5
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
6
  export const login = async ({ collection, req })=>{
6
- const { searchParams } = req;
7
+ const { searchParams, t } = req;
7
8
  const depth = searchParams.get('depth');
8
9
  const result = await loginOperation({
9
10
  collection,
@@ -23,12 +24,14 @@ export const login = async ({ collection, req })=>{
23
24
  delete result.token;
24
25
  }
25
26
  return Response.json({
26
- // TODO(translate)
27
- message: 'Auth Passed',
27
+ message: t('authentication:passed'),
28
28
  ...result
29
29
  }, {
30
- headers: new Headers({
31
- 'Set-Cookie': cookie
30
+ headers: headersWithCors({
31
+ headers: new Headers({
32
+ 'Set-Cookie': cookie
33
+ }),
34
+ req
32
35
  }),
33
36
  status: httpStatus.OK
34
37
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/login.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { loginOperation } from 'payload/operations'\nimport { isNumber } from 'payload/utilities'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const login: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await loginOperation({\n collection,\n data: {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n },\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.token,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Auth Passed',\n ...result,\n },\n {\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generatePayloadCookie","loginOperation","isNumber","login","collection","req","searchParams","depth","get","result","data","email","password","Number","undefined","cookie","collectionConfig","config","payload","token","auth","removeTokenFromResponses","Response","json","message","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,QAAQ,QAAQ,oBAAmB;AAI5C,OAAO,MAAMC,QAAgC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACrE,MAAM,EAAEC,YAAY,EAAE,GAAGD;IACzB,MAAME,QAAQD,aAAaE,GAAG,CAAC;IAE/B,MAAMC,SAAS,MAAMR,eAAe;QAClCG;QACAM,MAAM;YACJC,OAAO,OAAON,IAAIK,IAAI,EAAEC,UAAU,WAAWN,IAAIK,IAAI,CAACC,KAAK,GAAG;YAC9DC,UAAU,OAAOP,IAAIK,IAAI,EAAEE,aAAa,WAAWP,IAAIK,IAAI,CAACE,QAAQ,GAAG;QACzE;QACAL,OAAOL,SAASK,SAASM,OAAON,SAASO;QACzCT;IACF;IAEA,MAAMU,SAASf,sBAAsB;QACnCgB,kBAAkBZ,WAAWa,MAAM;QACnCC,SAASb,IAAIa,OAAO;QACpBC,OAAOV,OAAOU,KAAK;IACrB;IAEA,IAAIf,WAAWa,MAAM,CAACG,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOZ,OAAOU,KAAK;IACrB;IAEA,OAAOG,SAASC,IAAI,CAClB;QACE,kBAAkB;QAClBC,SAAS;QACT,GAAGf,MAAM;IACX,GACA;QACEgB,SAAS,IAAIC,QAAQ;YACnB,cAAcX;QAChB;QACAY,QAAQ5B,WAAW6B,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/login.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { loginOperation } from 'payload/operations'\nimport { isNumber } from 'payload/utilities'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const login: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams, t } = req\n const depth = searchParams.get('depth')\n\n const result = await loginOperation({\n collection,\n data: {\n email: typeof req.data?.email === 'string' ? req.data.email : '',\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n },\n depth: isNumber(depth) ? Number(depth) : undefined,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.token,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n message: t('authentication:passed'),\n ...result,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generatePayloadCookie","loginOperation","isNumber","headersWithCors","login","collection","req","searchParams","t","depth","get","result","data","email","password","Number","undefined","cookie","collectionConfig","config","payload","token","auth","removeTokenFromResponses","Response","json","message","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,QAAQ,QAAQ,oBAAmB;AAI5C,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,QAAgC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACrE,MAAM,EAAEC,YAAY,EAAEC,CAAC,EAAE,GAAGF;IAC5B,MAAMG,QAAQF,aAAaG,GAAG,CAAC;IAE/B,MAAMC,SAAS,MAAMV,eAAe;QAClCI;QACAO,MAAM;YACJC,OAAO,OAAOP,IAAIM,IAAI,EAAEC,UAAU,WAAWP,IAAIM,IAAI,CAACC,KAAK,GAAG;YAC9DC,UAAU,OAAOR,IAAIM,IAAI,EAAEE,aAAa,WAAWR,IAAIM,IAAI,CAACE,QAAQ,GAAG;QACzE;QACAL,OAAOP,SAASO,SAASM,OAAON,SAASO;QACzCV;IACF;IAEA,MAAMW,SAASjB,sBAAsB;QACnCkB,kBAAkBb,WAAWc,MAAM;QACnCC,SAASd,IAAIc,OAAO;QACpBC,OAAOV,OAAOU,KAAK;IACrB;IAEA,IAAIhB,WAAWc,MAAM,CAACG,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOZ,OAAOU,KAAK;IACrB;IAEA,OAAOG,SAASC,IAAI,CAClB;QACEC,SAASlB,EAAE;QACX,GAAGG,MAAM;IACX,GACA;QACEgB,SAASxB,gBAAgB;YACvBwB,SAAS,IAAIC,QAAQ;gBACnB,cAAcX;YAChB;YACAX;QACF;QACAuB,QAAQ9B,WAAW+B,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/logout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,MAAM,EAAE,sBAkCpB,CAAA"}
1
+ {"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/logout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBAwCpB,CAAA"}
@@ -1,15 +1,22 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { generateExpiredPayloadCookie } from 'payload/auth';
3
3
  import { logoutOperation } from 'payload/operations';
4
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
4
5
  export const logout = async ({ collection, req })=>{
5
- const result = logoutOperation({
6
+ const { t } = req;
7
+ const result = await logoutOperation({
6
8
  collection,
7
9
  req
8
10
  });
11
+ const headers = headersWithCors({
12
+ headers: new Headers(),
13
+ req
14
+ });
9
15
  if (!result) {
10
16
  return Response.json({
11
- message: 'Logout failed.'
17
+ message: t('error:logoutFailed')
12
18
  }, {
19
+ headers,
13
20
  status: httpStatus.BAD_REQUEST
14
21
  });
15
22
  }
@@ -17,13 +24,11 @@ export const logout = async ({ collection, req })=>{
17
24
  collectionConfig: collection.config,
18
25
  payload: req.payload
19
26
  });
27
+ headers.set('Set-Cookie', expiredCookie);
20
28
  return Response.json({
21
- // TODO(translate)
22
- message: 'Logout successful.'
29
+ message: t('authentication:logoutSuccessful')
23
30
  }, {
24
- headers: new Headers({
25
- 'Set-Cookie': expiredCookie
26
- }),
31
+ headers,
27
32
  status: httpStatus.OK
28
33
  });
29
34
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/logout.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generateExpiredPayloadCookie } from 'payload/auth'\nimport { logoutOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const logout: CollectionRouteHandler = async ({ collection, req }) => {\n const result = logoutOperation({\n collection,\n req,\n })\n\n if (!result) {\n return Response.json(\n {\n message: 'Logout failed.',\n },\n {\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n const expiredCookie = generateExpiredPayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n })\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Logout successful.',\n },\n {\n headers: new Headers({\n 'Set-Cookie': expiredCookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generateExpiredPayloadCookie","logoutOperation","logout","collection","req","result","Response","json","message","status","BAD_REQUEST","expiredCookie","collectionConfig","config","payload","headers","Headers","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,4BAA4B,QAAQ,eAAc;AAC3D,SAASC,eAAe,QAAQ,qBAAoB;AAIpD,OAAO,MAAMC,SAAiC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACtE,MAAMC,SAASJ,gBAAgB;QAC7BE;QACAC;IACF;IAEA,IAAI,CAACC,QAAQ;QACX,OAAOC,SAASC,IAAI,CAClB;YACEC,SAAS;QACX,GACA;YACEC,QAAQV,WAAWW,WAAW;QAChC;IAEJ;IAEA,MAAMC,gBAAgBX,6BAA6B;QACjDY,kBAAkBT,WAAWU,MAAM;QACnCC,SAASV,IAAIU,OAAO;IACtB;IAEA,OAAOR,SAASC,IAAI,CAClB;QACE,kBAAkB;QAClBC,SAAS;IACX,GACA;QACEO,SAAS,IAAIC,QAAQ;YACnB,cAAcL;QAChB;QACAF,QAAQV,WAAWkB,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/logout.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generateExpiredPayloadCookie } from 'payload/auth'\nimport { logoutOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const logout: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n const result = await logoutOperation({\n collection,\n req,\n })\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (!result) {\n return Response.json(\n {\n message: t('error:logoutFailed'),\n },\n {\n headers,\n status: httpStatus.BAD_REQUEST,\n },\n )\n }\n\n const expiredCookie = generateExpiredPayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n })\n\n headers.set('Set-Cookie', expiredCookie)\n\n return Response.json(\n {\n message: t('authentication:logoutSuccessful'),\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generateExpiredPayloadCookie","logoutOperation","headersWithCors","logout","collection","req","t","result","headers","Headers","Response","json","message","status","BAD_REQUEST","expiredCookie","collectionConfig","config","payload","set","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,4BAA4B,QAAQ,eAAc;AAC3D,SAASC,eAAe,QAAQ,qBAAoB;AAIpD,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,SAAiC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACtE,MAAM,EAAEC,CAAC,EAAE,GAAGD;IACd,MAAME,SAAS,MAAMN,gBAAgB;QACnCG;QACAC;IACF;IAEA,MAAMG,UAAUN,gBAAgB;QAC9BM,SAAS,IAAIC;QACbJ;IACF;IAEA,IAAI,CAACE,QAAQ;QACX,OAAOG,SAASC,IAAI,CAClB;YACEC,SAASN,EAAE;QACb,GACA;YACEE;YACAK,QAAQd,WAAWe,WAAW;QAChC;IAEJ;IAEA,MAAMC,gBAAgBf,6BAA6B;QACjDgB,kBAAkBZ,WAAWa,MAAM;QACnCC,SAASb,IAAIa,OAAO;IACtB;IAEAV,QAAQW,GAAG,CAAC,cAAcJ;IAE1B,OAAOL,SAASC,IAAI,CAClB;QACEC,SAASN,EAAE;IACb,GACA;QACEE;QACAK,QAAQd,WAAWqB,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/me.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,EAAE,EAAE,sBAsBhB,CAAA"}
1
+ {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/me.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,EAAE,EAAE,sBA0BhB,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { extractJWT } from 'payload/auth';
3
3
  import { meOperation } from 'payload/operations';
4
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
4
5
  export const me = async ({ collection, req })=>{
5
6
  const currentToken = extractJWT(req);
6
7
  const result = await meOperation({
@@ -15,6 +16,10 @@ export const me = async ({ collection, req })=>{
15
16
  ...result,
16
17
  message: req.t('authentication:account')
17
18
  }, {
19
+ headers: headersWithCors({
20
+ headers: new Headers(),
21
+ req
22
+ }),
18
23
  status: httpStatus.OK
19
24
  });
20
25
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/me.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT } from 'payload/auth'\nimport { meOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const me: CollectionRouteHandler = async ({ collection, req }) => {\n const currentToken = extractJWT(req)\n\n const result = await meOperation({\n collection,\n currentToken,\n req,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n ...result,\n message: req.t('authentication:account'),\n },\n {\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","extractJWT","meOperation","me","collection","req","currentToken","result","config","auth","removeTokenFromResponses","token","Response","json","message","t","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,WAAW,QAAQ,qBAAoB;AAIhD,OAAO,MAAMC,KAA6B,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IAClE,MAAMC,eAAeL,WAAWI;IAEhC,MAAME,SAAS,MAAML,YAAY;QAC/BE;QACAE;QACAD;IACF;IAEA,IAAID,WAAWI,MAAM,CAACC,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOH,OAAOI,KAAK;IACrB;IAEA,OAAOC,SAASC,IAAI,CAClB;QACE,GAAGN,MAAM;QACTO,SAAST,IAAIU,CAAC,CAAC;IACjB,GACA;QACEC,QAAQhB,WAAWiB,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/me.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT } from 'payload/auth'\nimport { meOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const me: CollectionRouteHandler = async ({ collection, req }) => {\n const currentToken = extractJWT(req)\n\n const result = await meOperation({\n collection,\n currentToken,\n req,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n ...result,\n message: req.t('authentication:account'),\n },\n {\n headers: headersWithCors({\n headers: new Headers(),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","extractJWT","meOperation","headersWithCors","me","collection","req","currentToken","result","config","auth","removeTokenFromResponses","token","Response","json","message","t","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,WAAW,QAAQ,qBAAoB;AAIhD,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,KAA6B,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IAClE,MAAMC,eAAeN,WAAWK;IAEhC,MAAME,SAAS,MAAMN,YAAY;QAC/BG;QACAE;QACAD;IACF;IAEA,IAAID,WAAWI,MAAM,CAACC,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOH,OAAOI,KAAK;IACrB;IAEA,OAAOC,SAASC,IAAI,CAClB;QACE,GAAGN,MAAM;QACTO,SAAST,IAAIU,CAAC,CAAC;IACjB,GACA;QACEC,SAASd,gBAAgB;YACvBc,SAAS,IAAIC;YACbZ;QACF;QACAa,QAAQnB,WAAWoB,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/refresh.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,OAAO,EAAE,sBA4CrB,CAAA"}
1
+ {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/refresh.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,OAAO,EAAE,sBAiDrB,CAAA"}
@@ -2,13 +2,19 @@ import httpStatus from 'http-status';
2
2
  import { extractJWT } from 'payload/auth';
3
3
  import { generatePayloadCookie } from 'payload/auth';
4
4
  import { refreshOperation } from 'payload/operations';
5
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
5
6
  export const refresh = async ({ collection, req })=>{
7
+ const { t } = req;
6
8
  const token = typeof req.data?.token === 'string' ? req.data.token : extractJWT(req);
9
+ const headers = headersWithCors({
10
+ headers: new Headers(),
11
+ req
12
+ });
7
13
  if (!token) {
8
14
  return Response.json({
9
- // TODO(translate)
10
- message: 'Token not provided.'
15
+ message: t('error:tokenNotProvided')
11
16
  }, {
17
+ headers,
12
18
  status: httpStatus.UNAUTHORIZED
13
19
  });
14
20
  }
@@ -25,14 +31,12 @@ export const refresh = async ({ collection, req })=>{
25
31
  if (collection.config.auth.removeTokenFromResponses) {
26
32
  delete result.refreshedToken;
27
33
  }
34
+ headers.set('Set-Cookie', cookie);
28
35
  return Response.json({
29
- // TODO(translate)
30
- message: 'Token refresh successful',
36
+ message: t('authentication:tokenRefreshSuccessful'),
31
37
  ...result
32
38
  }, {
33
- headers: new Headers({
34
- 'Set-Cookie': cookie
35
- }),
39
+ headers,
36
40
  status: httpStatus.OK
37
41
  });
38
42
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/refresh.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT } from 'payload/auth'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { refreshOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const refresh: CollectionRouteHandler = async ({ collection, req }) => {\n const token = typeof req.data?.token === 'string' ? req.data.token : extractJWT(req)\n\n if (!token) {\n return Response.json(\n {\n // TODO(translate)\n message: 'Token not provided.',\n },\n {\n status: httpStatus.UNAUTHORIZED,\n },\n )\n }\n\n const result = await refreshOperation({\n collection,\n req,\n token,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.refreshedToken,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.refreshedToken\n }\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Token refresh successful',\n ...result,\n },\n {\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","extractJWT","generatePayloadCookie","refreshOperation","refresh","collection","req","token","data","Response","json","message","status","UNAUTHORIZED","result","cookie","collectionConfig","config","payload","refreshedToken","auth","removeTokenFromResponses","headers","Headers","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,gBAAgB,QAAQ,qBAAoB;AAIrD,OAAO,MAAMC,UAAkC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACvE,MAAMC,QAAQ,OAAOD,IAAIE,IAAI,EAAED,UAAU,WAAWD,IAAIE,IAAI,CAACD,KAAK,GAAGN,WAAWK;IAEhF,IAAI,CAACC,OAAO;QACV,OAAOE,SAASC,IAAI,CAClB;YACE,kBAAkB;YAClBC,SAAS;QACX,GACA;YACEC,QAAQZ,WAAWa,YAAY;QACjC;IAEJ;IAEA,MAAMC,SAAS,MAAMX,iBAAiB;QACpCE;QACAC;QACAC;IACF;IAEA,MAAMQ,SAASb,sBAAsB;QACnCc,kBAAkBX,WAAWY,MAAM;QACnCC,SAASZ,IAAIY,OAAO;QACpBX,OAAOO,OAAOK,cAAc;IAC9B;IAEA,IAAId,WAAWY,MAAM,CAACG,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOP,OAAOK,cAAc;IAC9B;IAEA,OAAOV,SAASC,IAAI,CAClB;QACE,kBAAkB;QAClBC,SAAS;QACT,GAAGG,MAAM;IACX,GACA;QACEQ,SAAS,IAAIC,QAAQ;YACnB,cAAcR;QAChB;QACAH,QAAQZ,WAAWwB,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/refresh.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { extractJWT } from 'payload/auth'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { refreshOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const refresh: CollectionRouteHandler = async ({ collection, req }) => {\n const { t } = req\n const token = typeof req.data?.token === 'string' ? req.data.token : extractJWT(req)\n\n const headers = headersWithCors({\n headers: new Headers(),\n req,\n })\n\n if (!token) {\n return Response.json(\n {\n message: t('error:tokenNotProvided'),\n },\n {\n headers,\n status: httpStatus.UNAUTHORIZED,\n },\n )\n }\n\n const result = await refreshOperation({\n collection,\n req,\n token,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.refreshedToken,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.refreshedToken\n }\n\n headers.set('Set-Cookie', cookie)\n\n return Response.json(\n {\n message: t('authentication:tokenRefreshSuccessful'),\n ...result,\n },\n {\n headers,\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","extractJWT","generatePayloadCookie","refreshOperation","headersWithCors","refresh","collection","req","t","token","data","headers","Headers","Response","json","message","status","UNAUTHORIZED","result","cookie","collectionConfig","config","payload","refreshedToken","auth","removeTokenFromResponses","set","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,UAAU,QAAQ,eAAc;AACzC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,gBAAgB,QAAQ,qBAAoB;AAIrD,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,UAAkC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACvE,MAAM,EAAEC,CAAC,EAAE,GAAGD;IACd,MAAME,QAAQ,OAAOF,IAAIG,IAAI,EAAED,UAAU,WAAWF,IAAIG,IAAI,CAACD,KAAK,GAAGR,WAAWM;IAEhF,MAAMI,UAAUP,gBAAgB;QAC9BO,SAAS,IAAIC;QACbL;IACF;IAEA,IAAI,CAACE,OAAO;QACV,OAAOI,SAASC,IAAI,CAClB;YACEC,SAASP,EAAE;QACb,GACA;YACEG;YACAK,QAAQhB,WAAWiB,YAAY;QACjC;IAEJ;IAEA,MAAMC,SAAS,MAAMf,iBAAiB;QACpCG;QACAC;QACAE;IACF;IAEA,MAAMU,SAASjB,sBAAsB;QACnCkB,kBAAkBd,WAAWe,MAAM;QACnCC,SAASf,IAAIe,OAAO;QACpBb,OAAOS,OAAOK,cAAc;IAC9B;IAEA,IAAIjB,WAAWe,MAAM,CAACG,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOP,OAAOK,cAAc;IAC9B;IAEAZ,QAAQe,GAAG,CAAC,cAAcP;IAE1B,OAAON,SAASC,IAAI,CAClB;QACEC,SAASP,EAAE;QACX,GAAGU,MAAM;IACX,GACA;QACEP;QACAK,QAAQhB,WAAW2B,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"registerFirstUser.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/registerFirstUser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,iBAAiB,EAAE,sBAkC/B,CAAA"}
1
+ {"version":3,"file":"registerFirstUser.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/registerFirstUser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,iBAAiB,EAAE,sBAoC/B,CAAA"}
@@ -1,8 +1,9 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { generatePayloadCookie } from 'payload/auth';
3
3
  import { registerFirstUserOperation } from 'payload/operations';
4
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
4
5
  export const registerFirstUser = async ({ collection, req })=>{
5
- const data = req.data;
6
+ const { data, t } = req;
6
7
  const result = await registerFirstUserOperation({
7
8
  collection,
8
9
  data: {
@@ -19,13 +20,15 @@ export const registerFirstUser = async ({ collection, req })=>{
19
20
  });
20
21
  return Response.json({
21
22
  exp: result.exp,
22
- // TODO(translate)
23
- message: 'Successfully registered first user.',
23
+ message: t('authentication:successfullyRegisteredFirstUser'),
24
24
  token: result.token,
25
25
  user: result.user
26
26
  }, {
27
- headers: new Headers({
28
- 'Set-Cookie': cookie
27
+ headers: headersWithCors({
28
+ headers: new Headers({
29
+ 'Set-Cookie': cookie
30
+ }),
31
+ req
29
32
  }),
30
33
  status: httpStatus.OK
31
34
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/registerFirstUser.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { registerFirstUserOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const registerFirstUser: CollectionRouteHandler = async ({ collection, req }) => {\n const data = req.data\n\n const result = await registerFirstUserOperation({\n collection,\n data: {\n ...data,\n email: typeof data?.email === 'string' ? data.email : '',\n password: typeof data?.password === 'string' ? data.password : '',\n },\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.token,\n })\n\n return Response.json(\n {\n exp: result.exp,\n // TODO(translate)\n message: 'Successfully registered first user.',\n token: result.token,\n user: result.user,\n },\n {\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generatePayloadCookie","registerFirstUserOperation","registerFirstUser","collection","req","data","result","email","password","cookie","collectionConfig","config","payload","token","Response","json","exp","message","user","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,0BAA0B,QAAQ,qBAAoB;AAI/D,OAAO,MAAMC,oBAA4C,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACjF,MAAMC,OAAOD,IAAIC,IAAI;IAErB,MAAMC,SAAS,MAAML,2BAA2B;QAC9CE;QACAE,MAAM;YACJ,GAAGA,IAAI;YACPE,OAAO,OAAOF,MAAME,UAAU,WAAWF,KAAKE,KAAK,GAAG;YACtDC,UAAU,OAAOH,MAAMG,aAAa,WAAWH,KAAKG,QAAQ,GAAG;QACjE;QACAJ;IACF;IAEA,MAAMK,SAAST,sBAAsB;QACnCU,kBAAkBP,WAAWQ,MAAM;QACnCC,SAASR,IAAIQ,OAAO;QACpBC,OAAOP,OAAOO,KAAK;IACrB;IAEA,OAAOC,SAASC,IAAI,CAClB;QACEC,KAAKV,OAAOU,GAAG;QACf,kBAAkB;QAClBC,SAAS;QACTJ,OAAOP,OAAOO,KAAK;QACnBK,MAAMZ,OAAOY,IAAI;IACnB,GACA;QACEC,SAAS,IAAIC,QAAQ;YACnB,cAAcX;QAChB;QACAY,QAAQtB,WAAWuB,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/registerFirstUser.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { registerFirstUserOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const registerFirstUser: CollectionRouteHandler = async ({ collection, req }) => {\n const { data, t } = req\n\n const result = await registerFirstUserOperation({\n collection,\n data: {\n ...data,\n email: typeof data?.email === 'string' ? data.email : '',\n password: typeof data?.password === 'string' ? data.password : '',\n },\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.token,\n })\n\n return Response.json(\n {\n exp: result.exp,\n message: t('authentication:successfullyRegisteredFirstUser'),\n token: result.token,\n user: result.user,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generatePayloadCookie","registerFirstUserOperation","headersWithCors","registerFirstUser","collection","req","data","t","result","email","password","cookie","collectionConfig","config","payload","token","Response","json","exp","message","user","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,0BAA0B,QAAQ,qBAAoB;AAI/D,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,oBAA4C,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IACjF,MAAM,EAAEC,IAAI,EAAEC,CAAC,EAAE,GAAGF;IAEpB,MAAMG,SAAS,MAAMP,2BAA2B;QAC9CG;QACAE,MAAM;YACJ,GAAGA,IAAI;YACPG,OAAO,OAAOH,MAAMG,UAAU,WAAWH,KAAKG,KAAK,GAAG;YACtDC,UAAU,OAAOJ,MAAMI,aAAa,WAAWJ,KAAKI,QAAQ,GAAG;QACjE;QACAL;IACF;IAEA,MAAMM,SAASX,sBAAsB;QACnCY,kBAAkBR,WAAWS,MAAM;QACnCC,SAAST,IAAIS,OAAO;QACpBC,OAAOP,OAAOO,KAAK;IACrB;IAEA,OAAOC,SAASC,IAAI,CAClB;QACEC,KAAKV,OAAOU,GAAG;QACfC,SAASZ,EAAE;QACXQ,OAAOP,OAAOO,KAAK;QACnBK,MAAMZ,OAAOY,IAAI;IACnB,GACA;QACEC,SAASnB,gBAAgB;YACvBmB,SAAS,IAAIC,QAAQ;gBACnB,cAAcX;YAChB;YACAN;QACF;QACAkB,QAAQxB,WAAWyB,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resetPassword.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/resetPassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,aAAa,EAAE,sBAqC3B,CAAA"}
1
+ {"version":3,"file":"resetPassword.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/resetPassword.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,aAAa,EAAE,sBAuC3B,CAAA"}
@@ -1,8 +1,9 @@
1
1
  import httpStatus from 'http-status';
2
2
  import { generatePayloadCookie } from 'payload/auth';
3
3
  import { resetPasswordOperation } from 'payload/operations';
4
+ import { headersWithCors } from '../../../utilities/headersWithCors.js';
4
5
  export const resetPassword = async ({ collection, req })=>{
5
- const { searchParams } = req;
6
+ const { searchParams, t } = req;
6
7
  const depth = searchParams.get('depth');
7
8
  const result = await resetPasswordOperation({
8
9
  collection,
@@ -22,12 +23,14 @@ export const resetPassword = async ({ collection, req })=>{
22
23
  delete result.token;
23
24
  }
24
25
  return Response.json({
25
- // TODO(translate)
26
- message: 'Password reset successfully.',
26
+ message: t('authentication:passwordResetSuccessfully'),
27
27
  ...result
28
28
  }, {
29
- headers: new Headers({
30
- 'Set-Cookie': cookie
29
+ headers: headersWithCors({
30
+ headers: new Headers({
31
+ 'Set-Cookie': cookie
32
+ }),
33
+ req
31
34
  }),
32
35
  status: httpStatus.OK
33
36
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/routes/rest/auth/resetPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { resetPasswordOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nexport const resetPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams } = req\n const depth = searchParams.get('depth')\n\n const result = await resetPasswordOperation({\n collection,\n data: {\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n token: typeof req.data?.token === 'string' ? req.data.token : '',\n },\n depth: depth ? Number(depth) : undefined,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.token,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n // TODO(translate)\n message: 'Password reset successfully.',\n ...result,\n },\n {\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generatePayloadCookie","resetPasswordOperation","resetPassword","collection","req","searchParams","depth","get","result","data","password","token","Number","undefined","cookie","collectionConfig","config","payload","auth","removeTokenFromResponses","Response","json","message","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,sBAAsB,QAAQ,qBAAoB;AAI3D,OAAO,MAAMC,gBAAwC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IAC7E,MAAM,EAAEC,YAAY,EAAE,GAAGD;IACzB,MAAME,QAAQD,aAAaE,GAAG,CAAC;IAE/B,MAAMC,SAAS,MAAMP,uBAAuB;QAC1CE;QACAM,MAAM;YACJC,UAAU,OAAON,IAAIK,IAAI,EAAEC,aAAa,WAAWN,IAAIK,IAAI,CAACC,QAAQ,GAAG;YACvEC,OAAO,OAAOP,IAAIK,IAAI,EAAEE,UAAU,WAAWP,IAAIK,IAAI,CAACE,KAAK,GAAG;QAChE;QACAL,OAAOA,QAAQM,OAAON,SAASO;QAC/BT;IACF;IAEA,MAAMU,SAASd,sBAAsB;QACnCe,kBAAkBZ,WAAWa,MAAM;QACnCC,SAASb,IAAIa,OAAO;QACpBN,OAAOH,OAAOG,KAAK;IACrB;IAEA,IAAIR,WAAWa,MAAM,CAACE,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOX,OAAOG,KAAK;IACrB;IAEA,OAAOS,SAASC,IAAI,CAClB;QACE,kBAAkB;QAClBC,SAAS;QACT,GAAGd,MAAM;IACX,GACA;QACEe,SAAS,IAAIC,QAAQ;YACnB,cAAcV;QAChB;QACAW,QAAQ1B,WAAW2B,EAAE;IACvB;AAEJ,EAAC"}
1
+ {"version":3,"sources":["../../../../src/routes/rest/auth/resetPassword.ts"],"sourcesContent":["import httpStatus from 'http-status'\nimport { generatePayloadCookie } from 'payload/auth'\nimport { resetPasswordOperation } from 'payload/operations'\n\nimport type { CollectionRouteHandler } from '../types.js'\n\nimport { headersWithCors } from '../../../utilities/headersWithCors.js'\n\nexport const resetPassword: CollectionRouteHandler = async ({ collection, req }) => {\n const { searchParams, t } = req\n const depth = searchParams.get('depth')\n\n const result = await resetPasswordOperation({\n collection,\n data: {\n password: typeof req.data?.password === 'string' ? req.data.password : '',\n token: typeof req.data?.token === 'string' ? req.data.token : '',\n },\n depth: depth ? Number(depth) : undefined,\n req,\n })\n\n const cookie = generatePayloadCookie({\n collectionConfig: collection.config,\n payload: req.payload,\n token: result.token,\n })\n\n if (collection.config.auth.removeTokenFromResponses) {\n delete result.token\n }\n\n return Response.json(\n {\n message: t('authentication:passwordResetSuccessfully'),\n ...result,\n },\n {\n headers: headersWithCors({\n headers: new Headers({\n 'Set-Cookie': cookie,\n }),\n req,\n }),\n status: httpStatus.OK,\n },\n )\n}\n"],"names":["httpStatus","generatePayloadCookie","resetPasswordOperation","headersWithCors","resetPassword","collection","req","searchParams","t","depth","get","result","data","password","token","Number","undefined","cookie","collectionConfig","config","payload","auth","removeTokenFromResponses","Response","json","message","headers","Headers","status","OK"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,gBAAgB,cAAa;AACpC,SAASC,qBAAqB,QAAQ,eAAc;AACpD,SAASC,sBAAsB,QAAQ,qBAAoB;AAI3D,SAASC,eAAe,QAAQ,wCAAuC;AAEvE,OAAO,MAAMC,gBAAwC,OAAO,EAAEC,UAAU,EAAEC,GAAG,EAAE;IAC7E,MAAM,EAAEC,YAAY,EAAEC,CAAC,EAAE,GAAGF;IAC5B,MAAMG,QAAQF,aAAaG,GAAG,CAAC;IAE/B,MAAMC,SAAS,MAAMT,uBAAuB;QAC1CG;QACAO,MAAM;YACJC,UAAU,OAAOP,IAAIM,IAAI,EAAEC,aAAa,WAAWP,IAAIM,IAAI,CAACC,QAAQ,GAAG;YACvEC,OAAO,OAAOR,IAAIM,IAAI,EAAEE,UAAU,WAAWR,IAAIM,IAAI,CAACE,KAAK,GAAG;QAChE;QACAL,OAAOA,QAAQM,OAAON,SAASO;QAC/BV;IACF;IAEA,MAAMW,SAAShB,sBAAsB;QACnCiB,kBAAkBb,WAAWc,MAAM;QACnCC,SAASd,IAAIc,OAAO;QACpBN,OAAOH,OAAOG,KAAK;IACrB;IAEA,IAAIT,WAAWc,MAAM,CAACE,IAAI,CAACC,wBAAwB,EAAE;QACnD,OAAOX,OAAOG,KAAK;IACrB;IAEA,OAAOS,SAASC,IAAI,CAClB;QACEC,SAASjB,EAAE;QACX,GAAGG,MAAM;IACX,GACA;QACEe,SAASvB,gBAAgB;YACvBuB,SAAS,IAAIC,QAAQ;gBACnB,cAAcV;YAChB;YACAX;QACF;QACAsB,QAAQ5B,WAAW6B,EAAE;IACvB;AAEJ,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/unlock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEzD,eAAO,MAAM,MAAM,EAAE,sBAgBpB,CAAA"}
1
+ {"version":3,"file":"unlock.d.ts","sourceRoot":"","sources":["../../../../src/routes/rest/auth/unlock.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,MAAM,EAAE,sBAqBpB,CAAA"}