@payloadcms/next 3.0.0-canary.4de9e42 → 3.0.0-canary.4eb1bfc

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 (693) hide show
  1. package/dist/cjs/withPayload.js +111 -0
  2. package/dist/cjs/withPayload.js.map +1 -0
  3. package/dist/config.js +0 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js +15 -9
  6. package/dist/elements/DocumentHeader/Tabs/ShouldRenderTabs.js.map +1 -1
  7. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js +100 -35
  8. package/dist/elements/DocumentHeader/Tabs/Tab/TabLink.js.map +1 -1
  9. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts +3 -1
  10. package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
  11. package/dist/elements/DocumentHeader/Tabs/Tab/index.js +75 -51
  12. package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
  13. package/dist/elements/DocumentHeader/Tabs/Tab/index.scss +7 -5
  14. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js +31 -35
  15. package/dist/elements/DocumentHeader/Tabs/getCustomViews.js.map +1 -1
  16. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js +15 -12
  17. package/dist/elements/DocumentHeader/Tabs/getViewConfig.js.map +1 -1
  18. package/dist/elements/DocumentHeader/Tabs/index.d.ts +2 -2
  19. package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
  20. package/dist/elements/DocumentHeader/Tabs/index.js +95 -72
  21. package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
  22. package/dist/elements/DocumentHeader/Tabs/index.scss +0 -1
  23. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
  24. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js +38 -17
  25. package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
  26. package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts +2 -0
  27. package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
  28. package/dist/elements/DocumentHeader/Tabs/tabs/index.js +60 -52
  29. package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
  30. package/dist/elements/DocumentHeader/index.d.ts +2 -2
  31. package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
  32. package/dist/elements/DocumentHeader/index.js +24 -23
  33. package/dist/elements/DocumentHeader/index.js.map +1 -1
  34. package/dist/elements/DocumentHeader/index.scss +5 -4
  35. package/dist/elements/DocumentLocked/index.d.ts +12 -0
  36. package/dist/elements/DocumentLocked/index.d.ts.map +1 -0
  37. package/dist/elements/DocumentLocked/index.js +142 -0
  38. package/dist/elements/DocumentLocked/index.js.map +1 -0
  39. package/dist/elements/DocumentLocked/index.scss +37 -0
  40. package/dist/elements/DocumentTakeOver/index.d.ts +8 -0
  41. package/dist/elements/DocumentTakeOver/index.d.ts.map +1 -0
  42. package/dist/elements/DocumentTakeOver/index.js +98 -0
  43. package/dist/elements/DocumentTakeOver/index.js.map +1 -0
  44. package/dist/elements/DocumentTakeOver/index.scss +37 -0
  45. package/dist/elements/EmailAndUsername/index.d.ts +14 -0
  46. package/dist/elements/EmailAndUsername/index.d.ts.map +1 -0
  47. package/dist/elements/EmailAndUsername/index.js +121 -0
  48. package/dist/elements/EmailAndUsername/index.js.map +1 -0
  49. package/dist/elements/LeaveWithoutSaving/index.d.ts.map +1 -1
  50. package/dist/elements/LeaveWithoutSaving/index.js +150 -74
  51. package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
  52. package/dist/elements/LeaveWithoutSaving/index.scss +4 -3
  53. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts +2 -1
  54. package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
  55. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +121 -99
  56. package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
  57. package/dist/elements/Logo/index.d.ts.map +1 -1
  58. package/dist/elements/Logo/index.js +37 -19
  59. package/dist/elements/Logo/index.js.map +1 -1
  60. package/dist/elements/Nav/NavHamburger/index.js +41 -13
  61. package/dist/elements/Nav/NavHamburger/index.js.map +1 -1
  62. package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
  63. package/dist/elements/Nav/NavWrapper/index.js +48 -14
  64. package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
  65. package/dist/elements/Nav/NavWrapper/index.scss +9 -1
  66. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  67. package/dist/elements/Nav/index.client.js +151 -75
  68. package/dist/elements/Nav/index.client.js.map +1 -1
  69. package/dist/elements/Nav/index.d.ts.map +1 -1
  70. package/dist/elements/Nav/index.js +57 -57
  71. package/dist/elements/Nav/index.js.map +1 -1
  72. package/dist/elements/Nav/index.scss +26 -16
  73. package/dist/exports/layouts.d.ts +1 -1
  74. package/dist/exports/layouts.d.ts.map +1 -1
  75. package/dist/exports/layouts.js +1 -2
  76. package/dist/exports/layouts.js.map +1 -1
  77. package/dist/exports/routes.js +0 -1
  78. package/dist/exports/routes.js.map +1 -1
  79. package/dist/exports/templates.js +0 -1
  80. package/dist/exports/templates.js.map +1 -1
  81. package/dist/exports/utilities.js +0 -1
  82. package/dist/exports/utilities.js.map +1 -1
  83. package/dist/exports/views.d.ts +1 -1
  84. package/dist/exports/views.d.ts.map +1 -1
  85. package/dist/exports/views.js +1 -2
  86. package/dist/exports/views.js.map +1 -1
  87. package/dist/fetchAPI-multipart/fileFactory.d.ts +2 -1
  88. package/dist/fetchAPI-multipart/fileFactory.d.ts.map +1 -1
  89. package/dist/fetchAPI-multipart/fileFactory.js +35 -34
  90. package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
  91. package/dist/fetchAPI-multipart/handlers.d.ts +1 -1
  92. package/dist/fetchAPI-multipart/handlers.d.ts.map +1 -1
  93. package/dist/fetchAPI-multipart/handlers.js +79 -78
  94. package/dist/fetchAPI-multipart/handlers.js.map +1 -1
  95. package/dist/fetchAPI-multipart/index.d.ts +1 -101
  96. package/dist/fetchAPI-multipart/index.d.ts.map +1 -1
  97. package/dist/fetchAPI-multipart/index.js +33 -31
  98. package/dist/fetchAPI-multipart/index.js.map +1 -1
  99. package/dist/fetchAPI-multipart/isEligibleRequest.js +13 -21
  100. package/dist/fetchAPI-multipart/isEligibleRequest.js.map +1 -1
  101. package/dist/fetchAPI-multipart/processMultipart.d.ts +2 -1
  102. package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
  103. package/dist/fetchAPI-multipart/processMultipart.js +159 -141
  104. package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
  105. package/dist/fetchAPI-multipart/processNested.d.ts.map +1 -1
  106. package/dist/fetchAPI-multipart/processNested.js +26 -20
  107. package/dist/fetchAPI-multipart/processNested.js.map +1 -1
  108. package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +1 -1
  109. package/dist/fetchAPI-multipart/uploadTimer.js +18 -17
  110. package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
  111. package/dist/fetchAPI-multipart/utilities.d.ts +1 -1
  112. package/dist/fetchAPI-multipart/utilities.d.ts.map +1 -1
  113. package/dist/fetchAPI-multipart/utilities.js +185 -165
  114. package/dist/fetchAPI-multipart/utilities.js.map +1 -1
  115. package/dist/fetchAPI-stream-file/index.js +19 -17
  116. package/dist/fetchAPI-stream-file/index.js.map +1 -1
  117. package/dist/index.js +0 -1
  118. package/dist/index.js.map +1 -1
  119. package/dist/layouts/Root/index.d.ts +5 -4
  120. package/dist/layouts/Root/index.d.ts.map +1 -1
  121. package/dist/layouts/Root/index.js +153 -95
  122. package/dist/layouts/Root/index.js.map +1 -1
  123. package/dist/prod/styles.css +1 -1
  124. package/dist/routes/graphql/handler.d.ts.map +1 -1
  125. package/dist/routes/graphql/handler.js +119 -104
  126. package/dist/routes/graphql/handler.js.map +1 -1
  127. package/dist/routes/graphql/index.js +0 -1
  128. package/dist/routes/graphql/index.js.map +1 -1
  129. package/dist/routes/graphql/playground.js +23 -24
  130. package/dist/routes/graphql/playground.js.map +1 -1
  131. package/dist/routes/index.js +0 -1
  132. package/dist/routes/index.js.map +1 -1
  133. package/dist/routes/rest/auth/access.js +22 -21
  134. package/dist/routes/rest/auth/access.js.map +1 -1
  135. package/dist/routes/rest/auth/forgotPassword.js +29 -25
  136. package/dist/routes/rest/auth/forgotPassword.js.map +1 -1
  137. package/dist/routes/rest/auth/init.js +16 -14
  138. package/dist/routes/rest/auth/init.js.map +1 -1
  139. package/dist/routes/rest/auth/login.d.ts.map +1 -1
  140. package/dist/routes/rest/auth/login.js +43 -38
  141. package/dist/routes/rest/auth/login.js.map +1 -1
  142. package/dist/routes/rest/auth/logout.js +31 -27
  143. package/dist/routes/rest/auth/logout.js.map +1 -1
  144. package/dist/routes/rest/auth/me.js +23 -21
  145. package/dist/routes/rest/auth/me.js.map +1 -1
  146. package/dist/routes/rest/auth/refresh.js +31 -27
  147. package/dist/routes/rest/auth/refresh.js.map +1 -1
  148. package/dist/routes/rest/auth/registerFirstUser.js +43 -38
  149. package/dist/routes/rest/auth/registerFirstUser.js.map +1 -1
  150. package/dist/routes/rest/auth/resetPassword.js +38 -33
  151. package/dist/routes/rest/auth/resetPassword.js.map +1 -1
  152. package/dist/routes/rest/auth/unlock.d.ts.map +1 -1
  153. package/dist/routes/rest/auth/unlock.js +27 -23
  154. package/dist/routes/rest/auth/unlock.js.map +1 -1
  155. package/dist/routes/rest/auth/verifyEmail.js +22 -17
  156. package/dist/routes/rest/auth/verifyEmail.js.map +1 -1
  157. package/dist/routes/rest/buildFormState.js +38 -37
  158. package/dist/routes/rest/buildFormState.js.map +1 -1
  159. package/dist/routes/rest/checkEndpoints.js +11 -9
  160. package/dist/routes/rest/checkEndpoints.js.map +1 -1
  161. package/dist/routes/rest/collections/count.js +15 -11
  162. package/dist/routes/rest/collections/count.js.map +1 -1
  163. package/dist/routes/rest/collections/create.js +30 -26
  164. package/dist/routes/rest/collections/create.js.map +1 -1
  165. package/dist/routes/rest/collections/delete.js +40 -35
  166. package/dist/routes/rest/collections/delete.js.map +1 -1
  167. package/dist/routes/rest/collections/deleteByID.js +36 -31
  168. package/dist/routes/rest/collections/deleteByID.js.map +1 -1
  169. package/dist/routes/rest/collections/docAccess.js +17 -14
  170. package/dist/routes/rest/collections/docAccess.js.map +1 -1
  171. package/dist/routes/rest/collections/duplicate.js +36 -31
  172. package/dist/routes/rest/collections/duplicate.js.map +1 -1
  173. package/dist/routes/rest/collections/find.d.ts.map +1 -1
  174. package/dist/routes/rest/collections/find.js +32 -20
  175. package/dist/routes/rest/collections/find.js.map +1 -1
  176. package/dist/routes/rest/collections/findByID.d.ts.map +1 -1
  177. package/dist/routes/rest/collections/findByID.js +30 -23
  178. package/dist/routes/rest/collections/findByID.js.map +1 -1
  179. package/dist/routes/rest/collections/findVersionByID.js +27 -22
  180. package/dist/routes/rest/collections/findVersionByID.js.map +1 -1
  181. package/dist/routes/rest/collections/findVersions.js +27 -19
  182. package/dist/routes/rest/collections/findVersions.js.map +1 -1
  183. package/dist/routes/rest/collections/preview.js +39 -34
  184. package/dist/routes/rest/collections/preview.js.map +1 -1
  185. package/dist/routes/rest/collections/restoreVersion.d.ts.map +1 -1
  186. package/dist/routes/rest/collections/restoreVersion.js +32 -25
  187. package/dist/routes/rest/collections/restoreVersion.js.map +1 -1
  188. package/dist/routes/rest/collections/update.js +43 -37
  189. package/dist/routes/rest/collections/update.js.map +1 -1
  190. package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
  191. package/dist/routes/rest/collections/updateByID.js +44 -33
  192. package/dist/routes/rest/collections/updateByID.js.map +1 -1
  193. package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
  194. package/dist/routes/rest/files/checkFileAccess.js +52 -45
  195. package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
  196. package/dist/routes/rest/files/getFile.d.ts.map +1 -1
  197. package/dist/routes/rest/files/getFile.js +56 -49
  198. package/dist/routes/rest/files/getFile.js.map +1 -1
  199. package/dist/routes/rest/files/getFileTypeFallback.js +16 -17
  200. package/dist/routes/rest/files/getFileTypeFallback.js.map +1 -1
  201. package/dist/routes/rest/globals/docAccess.js +15 -13
  202. package/dist/routes/rest/globals/docAccess.js.map +1 -1
  203. package/dist/routes/rest/globals/findOne.js +22 -18
  204. package/dist/routes/rest/globals/findOne.js.map +1 -1
  205. package/dist/routes/rest/globals/findVersionByID.js +22 -17
  206. package/dist/routes/rest/globals/findVersionByID.js.map +1 -1
  207. package/dist/routes/rest/globals/findVersions.js +27 -19
  208. package/dist/routes/rest/globals/findVersions.js.map +1 -1
  209. package/dist/routes/rest/globals/preview.js +38 -34
  210. package/dist/routes/rest/globals/preview.js.map +1 -1
  211. package/dist/routes/rest/globals/restoreVersion.d.ts.map +1 -1
  212. package/dist/routes/rest/globals/restoreVersion.js +27 -20
  213. package/dist/routes/rest/globals/restoreVersion.js.map +1 -1
  214. package/dist/routes/rest/globals/update.d.ts.map +1 -1
  215. package/dist/routes/rest/globals/update.js +38 -28
  216. package/dist/routes/rest/globals/update.js.map +1 -1
  217. package/dist/routes/rest/index.d.ts +12 -12
  218. package/dist/routes/rest/index.d.ts.map +1 -1
  219. package/dist/routes/rest/index.js +681 -601
  220. package/dist/routes/rest/index.js.map +1 -1
  221. package/dist/routes/rest/og/image.d.ts +2 -1
  222. package/dist/routes/rest/og/image.d.ts.map +1 -1
  223. package/dist/routes/rest/og/image.js +75 -73
  224. package/dist/routes/rest/og/image.js.map +1 -1
  225. package/dist/routes/rest/og/index.d.ts.map +1 -1
  226. package/dist/routes/rest/og/index.js +61 -56
  227. package/dist/routes/rest/og/index.js.map +1 -1
  228. package/dist/routes/rest/routeError.d.ts +2 -7
  229. package/dist/routes/rest/routeError.d.ts.map +1 -1
  230. package/dist/routes/rest/routeError.js +116 -95
  231. package/dist/routes/rest/routeError.js.map +1 -1
  232. package/dist/routes/rest/types.js +1 -2
  233. package/dist/routes/rest/types.js.map +1 -1
  234. package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +1 -1
  235. package/dist/routes/rest/utilities/sanitizeCollectionID.js +18 -11
  236. package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
  237. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts +13 -0
  238. package/dist/routes/rest/utilities/sanitizeJoinParams.d.ts.map +1 -0
  239. package/dist/routes/rest/utilities/sanitizeJoinParams.js +17 -0
  240. package/dist/routes/rest/utilities/sanitizeJoinParams.js.map +1 -0
  241. package/dist/scss/app.scss +13 -18
  242. package/dist/scss/toastify.scss +59 -0
  243. package/dist/scss/toasts.scss +73 -42
  244. package/dist/scss/type.scss +19 -27
  245. package/dist/scss/vars.scss +26 -47
  246. package/dist/templates/Default/NavHamburger/index.js +18 -6
  247. package/dist/templates/Default/NavHamburger/index.js.map +1 -1
  248. package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
  249. package/dist/templates/Default/Wrapper/index.js +42 -11
  250. package/dist/templates/Default/Wrapper/index.js.map +1 -1
  251. package/dist/templates/Default/Wrapper/index.scss +36 -5
  252. package/dist/templates/Default/index.d.ts.map +1 -1
  253. package/dist/templates/Default/index.js +71 -57
  254. package/dist/templates/Default/index.js.map +1 -1
  255. package/dist/templates/Default/index.scss +14 -4
  256. package/dist/templates/Minimal/index.js +16 -16
  257. package/dist/templates/Minimal/index.js.map +1 -1
  258. package/dist/templates/Minimal/index.scss +2 -2
  259. package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
  260. package/dist/utilities/addDataAndFileToRequest.js +40 -35
  261. package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
  262. package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
  263. package/dist/utilities/addLocalesToRequest.js +48 -36
  264. package/dist/utilities/addLocalesToRequest.js.map +1 -1
  265. package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
  266. package/dist/utilities/createPayloadRequest.js +90 -73
  267. package/dist/utilities/createPayloadRequest.js.map +1 -1
  268. package/dist/utilities/getNextRequestI18n.d.ts.map +1 -1
  269. package/dist/utilities/getNextRequestI18n.js +13 -11
  270. package/dist/utilities/getNextRequestI18n.js.map +1 -1
  271. package/dist/utilities/getPayloadHMR.d.ts +2 -2
  272. package/dist/utilities/getPayloadHMR.d.ts.map +1 -1
  273. package/dist/utilities/getPayloadHMR.js +92 -82
  274. package/dist/utilities/getPayloadHMR.js.map +1 -1
  275. package/dist/utilities/getRequestLanguage.js +16 -13
  276. package/dist/utilities/getRequestLanguage.js.map +1 -1
  277. package/dist/utilities/getRequestLocales.js +27 -24
  278. package/dist/utilities/getRequestLocales.js.map +1 -1
  279. package/dist/utilities/getRequestTheme.d.ts.map +1 -1
  280. package/dist/utilities/getRequestTheme.js +19 -16
  281. package/dist/utilities/getRequestTheme.js.map +1 -1
  282. package/dist/utilities/headersWithCors.d.ts.map +1 -1
  283. package/dist/utilities/headersWithCors.js +21 -30
  284. package/dist/utilities/headersWithCors.js.map +1 -1
  285. package/dist/utilities/initPage/handleAdminPage.js +48 -33
  286. package/dist/utilities/initPage/handleAdminPage.js.map +1 -1
  287. package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
  288. package/dist/utilities/initPage/handleAuthRedirect.js +47 -24
  289. package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
  290. package/dist/utilities/initPage/index.d.ts +1 -1
  291. package/dist/utilities/initPage/index.d.ts.map +1 -1
  292. package/dist/utilities/initPage/index.js +140 -121
  293. package/dist/utilities/initPage/index.js.map +1 -1
  294. package/dist/utilities/initPage/shared.d.ts +14 -2
  295. package/dist/utilities/initPage/shared.d.ts.map +1 -1
  296. package/dist/utilities/initPage/shared.js +27 -16
  297. package/dist/utilities/initPage/shared.js.map +1 -1
  298. package/dist/utilities/initPage/types.d.ts +2 -1
  299. package/dist/utilities/initPage/types.d.ts.map +1 -1
  300. package/dist/utilities/initPage/types.js +1 -2
  301. package/dist/utilities/initPage/types.js.map +1 -1
  302. package/dist/utilities/initReq.d.ts +11 -0
  303. package/dist/utilities/initReq.d.ts.map +1 -0
  304. package/dist/utilities/initReq.js +46 -0
  305. package/dist/utilities/initReq.js.map +1 -0
  306. package/dist/utilities/mergeHeaders.d.ts +1 -1
  307. package/dist/utilities/mergeHeaders.d.ts.map +1 -1
  308. package/dist/utilities/mergeHeaders.js +9 -36
  309. package/dist/utilities/mergeHeaders.js.map +1 -1
  310. package/dist/utilities/meta.d.ts.map +1 -1
  311. package/dist/utilities/meta.js +66 -67
  312. package/dist/utilities/meta.js.map +1 -1
  313. package/dist/utilities/timestamp.d.ts.map +1 -1
  314. package/dist/utilities/timestamp.js +6 -5
  315. package/dist/utilities/timestamp.js.map +1 -1
  316. package/dist/views/API/LocaleSelector/index.d.ts +2 -2
  317. package/dist/views/API/LocaleSelector/index.d.ts.map +1 -1
  318. package/dist/views/API/LocaleSelector/index.js +37 -8
  319. package/dist/views/API/LocaleSelector/index.js.map +1 -1
  320. package/dist/views/API/RenderJSON/index.d.ts +1 -1
  321. package/dist/views/API/RenderJSON/index.d.ts.map +1 -1
  322. package/dist/views/API/RenderJSON/index.js +124 -112
  323. package/dist/views/API/RenderJSON/index.js.map +1 -1
  324. package/dist/views/API/index.client.d.ts.map +1 -1
  325. package/dist/views/API/index.client.js +191 -197
  326. package/dist/views/API/index.client.js.map +1 -1
  327. package/dist/views/API/index.d.ts +2 -2
  328. package/dist/views/API/index.d.ts.map +1 -1
  329. package/dist/views/API/index.js +2 -3
  330. package/dist/views/API/index.js.map +1 -1
  331. package/dist/views/API/index.scss +1 -2
  332. package/dist/views/API/meta.d.ts.map +1 -1
  333. package/dist/views/API/meta.js +22 -14
  334. package/dist/views/API/meta.js.map +1 -1
  335. package/dist/views/Account/Settings/LanguageSelector.js +45 -12
  336. package/dist/views/Account/Settings/LanguageSelector.js.map +1 -1
  337. package/dist/views/Account/Settings/index.d.ts +5 -4
  338. package/dist/views/Account/Settings/index.d.ts.map +1 -1
  339. package/dist/views/Account/Settings/index.js +22 -27
  340. package/dist/views/Account/Settings/index.js.map +1 -1
  341. package/dist/views/Account/ToggleTheme/index.d.ts.map +1 -1
  342. package/dist/views/Account/ToggleTheme/index.js +50 -27
  343. package/dist/views/Account/ToggleTheme/index.js.map +1 -1
  344. package/dist/views/Account/index.client.d.ts +3 -0
  345. package/dist/views/Account/index.client.d.ts.map +1 -0
  346. package/dist/views/Account/index.client.js +37 -0
  347. package/dist/views/Account/index.client.js.map +1 -0
  348. package/dist/views/Account/index.d.ts.map +1 -1
  349. package/dist/views/Account/index.js +104 -69
  350. package/dist/views/Account/index.js.map +1 -1
  351. package/dist/views/Account/meta.js +12 -8
  352. package/dist/views/Account/meta.js.map +1 -1
  353. package/dist/views/CreateFirstUser/index.client.d.ts +2 -1
  354. package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
  355. package/dist/views/CreateFirstUser/index.client.js +116 -57
  356. package/dist/views/CreateFirstUser/index.client.js.map +1 -1
  357. package/dist/views/CreateFirstUser/index.d.ts.map +1 -1
  358. package/dist/views/CreateFirstUser/index.js +42 -46
  359. package/dist/views/CreateFirstUser/index.js.map +1 -1
  360. package/dist/views/CreateFirstUser/index.scss +14 -0
  361. package/dist/views/CreateFirstUser/meta.js +12 -8
  362. package/dist/views/CreateFirstUser/meta.js.map +1 -1
  363. package/dist/views/Dashboard/Default/index.d.ts +8 -1
  364. package/dist/views/Dashboard/Default/index.d.ts.map +1 -1
  365. package/dist/views/Dashboard/Default/index.js +147 -124
  366. package/dist/views/Dashboard/Default/index.js.map +1 -1
  367. package/dist/views/Dashboard/Default/index.scss +16 -7
  368. package/dist/views/Dashboard/index.d.ts.map +1 -1
  369. package/dist/views/Dashboard/index.js +77 -57
  370. package/dist/views/Dashboard/index.js.map +1 -1
  371. package/dist/views/Dashboard/meta.js +16 -12
  372. package/dist/views/Dashboard/meta.js.map +1 -1
  373. package/dist/views/Document/getCustomViewByKey.d.ts.map +1 -1
  374. package/dist/views/Document/getCustomViewByKey.js +2 -4
  375. package/dist/views/Document/getCustomViewByKey.js.map +1 -1
  376. package/dist/views/Document/getCustomViewByRoute.d.ts +4 -1
  377. package/dist/views/Document/getCustomViewByRoute.d.ts.map +1 -1
  378. package/dist/views/Document/getCustomViewByRoute.js +30 -17
  379. package/dist/views/Document/getCustomViewByRoute.js.map +1 -1
  380. package/dist/views/Document/getDocumentData.d.ts +6 -2
  381. package/dist/views/Document/getDocumentData.d.ts.map +1 -1
  382. package/dist/views/Document/getDocumentData.js +45 -27
  383. package/dist/views/Document/getDocumentData.js.map +1 -1
  384. package/dist/views/Document/getDocumentPermissions.d.ts.map +1 -1
  385. package/dist/views/Document/getDocumentPermissions.js +86 -74
  386. package/dist/views/Document/getDocumentPermissions.js.map +1 -1
  387. package/dist/views/Document/getMetaBySegment.d.ts +4 -3
  388. package/dist/views/Document/getMetaBySegment.d.ts.map +1 -1
  389. package/dist/views/Document/getMetaBySegment.js +114 -63
  390. package/dist/views/Document/getMetaBySegment.js.map +1 -1
  391. package/dist/views/Document/getViewsFromConfig.d.ts +18 -7
  392. package/dist/views/Document/getViewsFromConfig.d.ts.map +1 -1
  393. package/dist/views/Document/getViewsFromConfig.js +308 -239
  394. package/dist/views/Document/getViewsFromConfig.js.map +1 -1
  395. package/dist/views/Document/index.d.ts.map +1 -1
  396. package/dist/views/Document/index.js +195 -163
  397. package/dist/views/Document/index.js.map +1 -1
  398. package/dist/views/Document/meta.js +1 -2
  399. package/dist/views/Document/meta.js.map +1 -1
  400. package/dist/views/Edit/Default/Auth/APIKey.d.ts +2 -2
  401. package/dist/views/Edit/Default/Auth/APIKey.d.ts.map +1 -1
  402. package/dist/views/Edit/Default/Auth/APIKey.js +120 -105
  403. package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
  404. package/dist/views/Edit/Default/Auth/index.d.ts.map +1 -1
  405. package/dist/views/Edit/Default/Auth/index.js +296 -150
  406. package/dist/views/Edit/Default/Auth/index.js.map +1 -1
  407. package/dist/views/Edit/Default/Auth/types.d.ts +4 -1
  408. package/dist/views/Edit/Default/Auth/types.d.ts.map +1 -1
  409. package/dist/views/Edit/Default/Auth/types.js +1 -2
  410. package/dist/views/Edit/Default/Auth/types.js.map +1 -1
  411. package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +1 -1
  412. package/dist/views/Edit/Default/SetDocumentStepNav/index.js +121 -70
  413. package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
  414. package/dist/views/Edit/Default/SetDocumentTitle/index.js +74 -29
  415. package/dist/views/Edit/Default/SetDocumentTitle/index.js.map +1 -1
  416. package/dist/views/Edit/Default/index.d.ts.map +1 -1
  417. package/dist/views/Edit/Default/index.js +323 -177
  418. package/dist/views/Edit/Default/index.js.map +1 -1
  419. package/dist/views/Edit/Default/index.scss +2 -2
  420. package/dist/views/Edit/Default/types.js +1 -2
  421. package/dist/views/Edit/Default/types.js.map +1 -1
  422. package/dist/views/Edit/index.client.d.ts.map +1 -1
  423. package/dist/views/Edit/index.client.js +47 -18
  424. package/dist/views/Edit/index.client.js.map +1 -1
  425. package/dist/views/Edit/index.d.ts +2 -2
  426. package/dist/views/Edit/index.d.ts.map +1 -1
  427. package/dist/views/Edit/index.js +2 -3
  428. package/dist/views/Edit/index.js.map +1 -1
  429. package/dist/views/Edit/meta.d.ts.map +1 -1
  430. package/dist/views/Edit/meta.js +43 -24
  431. package/dist/views/Edit/meta.js.map +1 -1
  432. package/dist/views/Edit/sanitizeEditViewProps.js +8 -9
  433. package/dist/views/Edit/sanitizeEditViewProps.js.map +1 -1
  434. package/dist/views/ForgotPassword/ForgotPasswordForm/index.d.ts.map +1 -1
  435. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js +154 -90
  436. package/dist/views/ForgotPassword/ForgotPasswordForm/index.js.map +1 -1
  437. package/dist/views/ForgotPassword/index.js +61 -47
  438. package/dist/views/ForgotPassword/index.js.map +1 -1
  439. package/dist/views/ForgotPassword/meta.js +12 -8
  440. package/dist/views/ForgotPassword/meta.js.map +1 -1
  441. package/dist/views/List/Default/index.d.ts.map +1 -1
  442. package/dist/views/List/Default/index.js +374 -187
  443. package/dist/views/List/Default/index.js.map +1 -1
  444. package/dist/views/List/Default/index.scss +9 -27
  445. package/dist/views/List/Default/types.js +1 -2
  446. package/dist/views/List/Default/types.js.map +1 -1
  447. package/dist/views/List/index.d.ts.map +1 -1
  448. package/dist/views/List/index.js +160 -123
  449. package/dist/views/List/index.js.map +1 -1
  450. package/dist/views/List/meta.js +20 -17
  451. package/dist/views/List/meta.js.map +1 -1
  452. package/dist/views/LivePreview/Context/collisionDetection.js +24 -21
  453. package/dist/views/LivePreview/Context/collisionDetection.js.map +1 -1
  454. package/dist/views/LivePreview/Context/context.d.ts +3 -2
  455. package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
  456. package/dist/views/LivePreview/Context/context.js +39 -36
  457. package/dist/views/LivePreview/Context/context.js.map +1 -1
  458. package/dist/views/LivePreview/Context/index.d.ts +3 -3
  459. package/dist/views/LivePreview/Context/index.d.ts.map +1 -1
  460. package/dist/views/LivePreview/Context/index.js +136 -142
  461. package/dist/views/LivePreview/Context/index.js.map +1 -1
  462. package/dist/views/LivePreview/Context/sizeReducer.js +18 -19
  463. package/dist/views/LivePreview/Context/sizeReducer.js.map +1 -1
  464. package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
  465. package/dist/views/LivePreview/Device/index.js +82 -71
  466. package/dist/views/LivePreview/Device/index.js.map +1 -1
  467. package/dist/views/LivePreview/DeviceContainer/index.js +47 -23
  468. package/dist/views/LivePreview/DeviceContainer/index.js.map +1 -1
  469. package/dist/views/LivePreview/IFrame/index.js +21 -16
  470. package/dist/views/LivePreview/IFrame/index.js.map +1 -1
  471. package/dist/views/LivePreview/Preview/index.js +145 -92
  472. package/dist/views/LivePreview/Preview/index.js.map +1 -1
  473. package/dist/views/LivePreview/Toolbar/Controls/index.js +137 -116
  474. package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
  475. package/dist/views/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -1
  476. package/dist/views/LivePreview/Toolbar/SizeInput/index.js +89 -51
  477. package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
  478. package/dist/views/LivePreview/Toolbar/index.js +82 -50
  479. package/dist/views/LivePreview/Toolbar/index.js.map +1 -1
  480. package/dist/views/LivePreview/ToolbarArea/index.js +32 -10
  481. package/dist/views/LivePreview/ToolbarArea/index.js.map +1 -1
  482. package/dist/views/LivePreview/index.client.d.ts +3 -3
  483. package/dist/views/LivePreview/index.client.d.ts.map +1 -1
  484. package/dist/views/LivePreview/index.client.js +336 -175
  485. package/dist/views/LivePreview/index.client.js.map +1 -1
  486. package/dist/views/LivePreview/index.d.ts +2 -2
  487. package/dist/views/LivePreview/index.d.ts.map +1 -1
  488. package/dist/views/LivePreview/index.js +67 -55
  489. package/dist/views/LivePreview/index.js.map +1 -1
  490. package/dist/views/LivePreview/meta.d.ts.map +1 -1
  491. package/dist/views/LivePreview/meta.js +14 -8
  492. package/dist/views/LivePreview/meta.js.map +1 -1
  493. package/dist/views/LivePreview/usePopupWindow.d.ts +2 -1
  494. package/dist/views/LivePreview/usePopupWindow.d.ts.map +1 -1
  495. package/dist/views/LivePreview/usePopupWindow.js +133 -91
  496. package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
  497. package/dist/views/Login/LoginField/index.d.ts +4 -1
  498. package/dist/views/Login/LoginField/index.d.ts.map +1 -1
  499. package/dist/views/Login/LoginField/index.js +84 -92
  500. package/dist/views/Login/LoginField/index.js.map +1 -1
  501. package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
  502. package/dist/views/Login/LoginForm/index.js +147 -82
  503. package/dist/views/Login/LoginForm/index.js.map +1 -1
  504. package/dist/views/Login/index.d.ts.map +1 -1
  505. package/dist/views/Login/index.js +78 -61
  506. package/dist/views/Login/index.js.map +1 -1
  507. package/dist/views/Login/meta.js +12 -8
  508. package/dist/views/Login/meta.js.map +1 -1
  509. package/dist/views/Logout/LogoutClient.d.ts +1 -0
  510. package/dist/views/Logout/LogoutClient.d.ts.map +1 -1
  511. package/dist/views/Logout/LogoutClient.js +86 -38
  512. package/dist/views/Logout/LogoutClient.js.map +1 -1
  513. package/dist/views/Logout/index.d.ts.map +1 -1
  514. package/dist/views/Logout/index.js +29 -16
  515. package/dist/views/Logout/index.js.map +1 -1
  516. package/dist/views/Logout/index.scss +12 -9
  517. package/dist/views/Logout/meta.js +11 -7
  518. package/dist/views/Logout/meta.js.map +1 -1
  519. package/dist/views/NotFound/index.client.d.ts.map +1 -1
  520. package/dist/views/NotFound/index.client.js +81 -39
  521. package/dist/views/NotFound/index.client.js.map +1 -1
  522. package/dist/views/NotFound/index.d.ts +8 -7
  523. package/dist/views/NotFound/index.d.ts.map +1 -1
  524. package/dist/views/NotFound/index.js +51 -47
  525. package/dist/views/NotFound/index.js.map +1 -1
  526. package/dist/views/NotFound/index.scss +18 -0
  527. package/dist/views/NotFound/meta.js +9 -7
  528. package/dist/views/NotFound/meta.js.map +1 -1
  529. package/dist/views/ResetPassword/index.client.d.ts +1 -1
  530. package/dist/views/ResetPassword/index.client.d.ts.map +1 -1
  531. package/dist/views/ResetPassword/index.client.js +102 -74
  532. package/dist/views/ResetPassword/index.client.js.map +1 -1
  533. package/dist/views/ResetPassword/index.d.ts.map +1 -1
  534. package/dist/views/ResetPassword/index.js +65 -56
  535. package/dist/views/ResetPassword/index.js.map +1 -1
  536. package/dist/views/ResetPassword/index.scss +28 -2
  537. package/dist/views/ResetPassword/meta.js +12 -8
  538. package/dist/views/ResetPassword/meta.js.map +1 -1
  539. package/dist/views/Root/generateCustomViewMetadata.d.ts +11 -0
  540. package/dist/views/Root/generateCustomViewMetadata.d.ts.map +1 -0
  541. package/dist/views/Root/generateCustomViewMetadata.js +25 -0
  542. package/dist/views/Root/generateCustomViewMetadata.js.map +1 -0
  543. package/dist/views/Root/getCustomViewByRoute.d.ts +7 -2
  544. package/dist/views/Root/getCustomViewByRoute.d.ts.map +1 -1
  545. package/dist/views/Root/getCustomViewByRoute.js +45 -16
  546. package/dist/views/Root/getCustomViewByRoute.js.map +1 -1
  547. package/dist/views/Root/getViewFromConfig.d.ts +10 -4
  548. package/dist/views/Root/getViewFromConfig.d.ts.map +1 -1
  549. package/dist/views/Root/getViewFromConfig.js +164 -141
  550. package/dist/views/Root/getViewFromConfig.js.map +1 -1
  551. package/dist/views/Root/index.d.ts +8 -7
  552. package/dist/views/Root/index.d.ts.map +1 -1
  553. package/dist/views/Root/index.js +102 -75
  554. package/dist/views/Root/index.js.map +1 -1
  555. package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
  556. package/dist/views/Root/isPathMatchingRoute.js +22 -13
  557. package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
  558. package/dist/views/Root/meta.d.ts +5 -5
  559. package/dist/views/Root/meta.d.ts.map +1 -1
  560. package/dist/views/Root/meta.js +144 -121
  561. package/dist/views/Root/meta.js.map +1 -1
  562. package/dist/views/Unauthorized/index.d.ts +2 -2
  563. package/dist/views/Unauthorized/index.d.ts.map +1 -1
  564. package/dist/views/Unauthorized/index.js +32 -21
  565. package/dist/views/Unauthorized/index.js.map +1 -1
  566. package/dist/views/Unauthorized/meta.js +12 -8
  567. package/dist/views/Unauthorized/meta.js.map +1 -1
  568. package/dist/views/Verify/index.d.ts.map +1 -1
  569. package/dist/views/Verify/index.js +59 -43
  570. package/dist/views/Verify/index.js.map +1 -1
  571. package/dist/views/Verify/meta.js +12 -8
  572. package/dist/views/Verify/meta.js.map +1 -1
  573. package/dist/views/Version/Default/SetStepNav.d.ts +8 -9
  574. package/dist/views/Version/Default/SetStepNav.d.ts.map +1 -1
  575. package/dist/views/Version/Default/SetStepNav.js +148 -104
  576. package/dist/views/Version/Default/SetStepNav.js.map +1 -1
  577. package/dist/views/Version/Default/index.d.ts.map +1 -1
  578. package/dist/views/Version/Default/index.js +201 -118
  579. package/dist/views/Version/Default/index.js.map +1 -1
  580. package/dist/views/Version/Default/types.d.ts +7 -7
  581. package/dist/views/Version/Default/types.d.ts.map +1 -1
  582. package/dist/views/Version/Default/types.js +1 -2
  583. package/dist/views/Version/Default/types.js.map +1 -1
  584. package/dist/views/Version/RenderFieldsToDiff/Label/index.js +6 -5
  585. package/dist/views/Version/RenderFieldsToDiff/Label/index.js.map +1 -1
  586. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts +2 -2
  587. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
  588. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +68 -70
  589. package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
  590. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts +2 -2
  591. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.d.ts.map +1 -1
  592. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +35 -32
  593. package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
  594. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts +3 -2
  595. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.d.ts.map +1 -1
  596. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js +113 -63
  597. package/dist/views/Version/RenderFieldsToDiff/fields/Relationship/index.js.map +1 -1
  598. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js +17 -11
  599. package/dist/views/Version/RenderFieldsToDiff/fields/Select/DiffViewer/index.js.map +1 -1
  600. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts +3 -6
  601. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
  602. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +42 -38
  603. package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
  604. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts +3 -5
  605. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.d.ts.map +1 -1
  606. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js +42 -32
  607. package/dist/views/Version/RenderFieldsToDiff/fields/Tabs/index.js.map +1 -1
  608. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js +17 -11
  609. package/dist/views/Version/RenderFieldsToDiff/fields/Text/DiffViewer/index.js.map +1 -1
  610. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts +3 -2
  611. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
  612. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +39 -30
  613. package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
  614. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js +4 -5
  615. package/dist/views/Version/RenderFieldsToDiff/fields/diffMethods.js.map +1 -1
  616. package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts +21 -28
  617. package/dist/views/Version/RenderFieldsToDiff/fields/index.d.ts.map +1 -1
  618. package/dist/views/Version/RenderFieldsToDiff/fields/index.js +22 -22
  619. package/dist/views/Version/RenderFieldsToDiff/fields/index.js.map +1 -1
  620. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js +23 -24
  621. package/dist/views/Version/RenderFieldsToDiff/fields/styles.js.map +1 -1
  622. package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts +15 -16
  623. package/dist/views/Version/RenderFieldsToDiff/fields/types.d.ts.map +1 -1
  624. package/dist/views/Version/RenderFieldsToDiff/fields/types.js +1 -2
  625. package/dist/views/Version/RenderFieldsToDiff/fields/types.js.map +1 -1
  626. package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
  627. package/dist/views/Version/RenderFieldsToDiff/index.js +107 -94
  628. package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
  629. package/dist/views/Version/RenderFieldsToDiff/types.d.ts +9 -10
  630. package/dist/views/Version/RenderFieldsToDiff/types.d.ts.map +1 -1
  631. package/dist/views/Version/RenderFieldsToDiff/types.js +1 -2
  632. package/dist/views/Version/RenderFieldsToDiff/types.js.map +1 -1
  633. package/dist/views/Version/Restore/index.d.ts.map +1 -1
  634. package/dist/views/Version/Restore/index.js +111 -85
  635. package/dist/views/Version/Restore/index.js.map +1 -1
  636. package/dist/views/Version/Restore/index.scss +57 -10
  637. package/dist/views/Version/Restore/types.d.ts +1 -0
  638. package/dist/views/Version/Restore/types.d.ts.map +1 -1
  639. package/dist/views/Version/Restore/types.js +1 -2
  640. package/dist/views/Version/Restore/types.js.map +1 -1
  641. package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
  642. package/dist/views/Version/SelectComparison/index.js +153 -138
  643. package/dist/views/Version/SelectComparison/index.js.map +1 -1
  644. package/dist/views/Version/SelectComparison/types.d.ts +1 -0
  645. package/dist/views/Version/SelectComparison/types.d.ts.map +1 -1
  646. package/dist/views/Version/SelectComparison/types.js +1 -2
  647. package/dist/views/Version/SelectComparison/types.js.map +1 -1
  648. package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
  649. package/dist/views/Version/SelectLocales/index.js +58 -30
  650. package/dist/views/Version/SelectLocales/index.js.map +1 -1
  651. package/dist/views/Version/SelectLocales/types.js +1 -2
  652. package/dist/views/Version/SelectLocales/types.js.map +1 -1
  653. package/dist/views/Version/index.d.ts +2 -2
  654. package/dist/views/Version/index.d.ts.map +1 -1
  655. package/dist/views/Version/index.js +129 -79
  656. package/dist/views/Version/index.js.map +1 -1
  657. package/dist/views/Version/meta.d.ts.map +1 -1
  658. package/dist/views/Version/meta.js +50 -39
  659. package/dist/views/Version/meta.js.map +1 -1
  660. package/dist/views/Versions/buildColumns.d.ts.map +1 -1
  661. package/dist/views/Versions/buildColumns.js +97 -53
  662. package/dist/views/Versions/buildColumns.js.map +1 -1
  663. package/dist/views/Versions/cells/AutosaveCell/index.d.ts.map +1 -1
  664. package/dist/views/Versions/cells/AutosaveCell/index.js +98 -43
  665. package/dist/views/Versions/cells/AutosaveCell/index.js.map +1 -1
  666. package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
  667. package/dist/views/Versions/cells/CreatedAt/index.js +70 -17
  668. package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
  669. package/dist/views/Versions/cells/ID/index.js +17 -5
  670. package/dist/views/Versions/cells/ID/index.js.map +1 -1
  671. package/dist/views/Versions/getLatestVersion.d.ts +14 -4
  672. package/dist/views/Versions/getLatestVersion.d.ts.map +1 -1
  673. package/dist/views/Versions/getLatestVersion.js +46 -26
  674. package/dist/views/Versions/getLatestVersion.js.map +1 -1
  675. package/dist/views/Versions/index.client.d.ts +4 -4
  676. package/dist/views/Versions/index.client.d.ts.map +1 -1
  677. package/dist/views/Versions/index.client.js +81 -75
  678. package/dist/views/Versions/index.client.js.map +1 -1
  679. package/dist/views/Versions/index.d.ts +2 -2
  680. package/dist/views/Versions/index.d.ts.map +1 -1
  681. package/dist/views/Versions/index.js +170 -106
  682. package/dist/views/Versions/index.js.map +1 -1
  683. package/dist/views/Versions/meta.d.ts.map +1 -1
  684. package/dist/views/Versions/meta.js +44 -33
  685. package/dist/views/Versions/meta.js.map +1 -1
  686. package/dist/views/Versions/types.js +1 -2
  687. package/dist/views/Versions/types.js.map +1 -1
  688. package/dist/withPayload.d.ts.map +1 -1
  689. package/dist/withPayload.js +83 -110
  690. package/dist/withPayload.js.map +1 -1
  691. package/package.json +40 -22
  692. package/dist/cjs/withPayload.cjs +0 -138
  693. package/dist/cjs/withPayload.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/exports/views.ts"],"sourcesContent":["export { DefaultEditView as EditView } from '../views/Edit/Default/index.js'\nexport { DefaultListView as ListView } from '../views/List/Default/index.js'\nexport { NotFoundPage } from '../views/NotFound/index.js'\nexport { type GenerateViewMetadata, RootPage, generatePageMetadata } from '../views/Root/index.js'\n"],"names":["DefaultEditView","EditView","DefaultListView","ListView","NotFoundPage","RootPage","generatePageMetadata"],"mappings":"AAAA,SAASA,mBAAmBC,QAAQ,QAAQ,iCAAgC;AAC5E,SAASC,mBAAmBC,QAAQ,QAAQ,iCAAgC;AAC5E,SAASC,YAAY,QAAQ,6BAA4B;AACzD,SAAoCC,QAAQ,EAAEC,oBAAoB,QAAQ,yBAAwB"}
1
+ {"version":3,"file":"views.js","names":["DefaultEditView","EditView","DefaultListView","ListView","NotFoundPage","generatePageMetadata","RootPage"],"sources":["../../src/exports/views.ts"],"sourcesContent":["export { DefaultEditView as EditView } from '../views/Edit/Default/index.js'\nexport { DefaultListView as ListView } from '../views/List/Default/index.js'\nexport { NotFoundPage } from '../views/NotFound/index.js'\nexport { generatePageMetadata, type GenerateViewMetadata, RootPage } from '../views/Root/index.js'\n"],"mappings":"AAAA,SAASA,eAAA,IAAmBC,QAAQ,QAAQ;AAC5C,SAASC,eAAA,IAAmBC,QAAQ,QAAQ;AAC5C,SAASC,YAAY,QAAQ;AAC7B,SAASC,oBAAoB,EAA6BC,QAAQ,QAAQ","ignoreList":[]}
@@ -1,4 +1,5 @@
1
- import type { FetchAPIFileUploadOptions, FileShape } from './index.js';
1
+ import type { FetchAPIFileUploadOptions } from 'payload';
2
+ import type { FileShape } from './index.js';
2
3
  type FileFactoryOptions = {
3
4
  buffer: Buffer;
4
5
  encoding: string;
@@ -1 +1 @@
1
- {"version":3,"file":"fileFactory.d.ts","sourceRoot":"","sources":["../../src/fetchAPI-multipart/fileFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAmCtE,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AACD,KAAK,WAAW,GAAG,CACjB,OAAO,EAAE,kBAAkB,EAC3B,iBAAiB,EAAE,yBAAyB,KACzC,SAAS,CAAA;AACd,eAAO,MAAM,WAAW,EAAE,WA4BzB,CAAA"}
1
+ {"version":3,"file":"fileFactory.d.ts","sourceRoot":"","sources":["../../src/fetchAPI-multipart/fileFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAmC3C,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AACD,KAAK,WAAW,GAAG,CACjB,OAAO,EAAE,kBAAkB,EAC3B,iBAAiB,EAAE,yBAAyB,KACzC,SAAS,CAAA;AACd,eAAO,MAAM,WAAW,EAAE,WA4BzB,CAAA"}
@@ -2,42 +2,43 @@ import { checkAndMakeDir, debugLog, isFunc, moveFile, promiseCallback, saveBuffe
2
2
  /**
3
3
  * Returns Local function that moves the file to a different location on the filesystem
4
4
  * which takes two function arguments to make it compatible w/ Promise or Callback APIs
5
- */ const moveFromTemp = (filePath, options, fileUploadOptions)=>(resolve, reject)=>{
6
- debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`);
7
- moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject));
8
- };
5
+ */
6
+ const moveFromTemp = (filePath, options, fileUploadOptions) => (resolve, reject) => {
7
+ debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`);
8
+ moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject));
9
+ };
9
10
  /**
10
11
  * Returns Local function that moves the file from buffer to a different location on the filesystem
11
12
  * which takes two function arguments to make it compatible w/ Promise or Callback APIs
12
- */ const moveFromBuffer = (filePath, options, fileUploadOptions)=>(resolve, reject)=>{
13
- debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`);
14
- saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject));
15
- };
16
- export const fileFactory = (options, fileUploadOptions)=>{
17
- // see: https://github.com/richardgirges/express-fileupload/issues/14
18
- // firefox uploads empty file in case of cache miss when f5ing page.
19
- // resulting in unexpected behavior. if there is no file data, the file is invalid.
20
- // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;
21
- // Create and return file object.
22
- return {
23
- name: options.name,
24
- data: options.buffer,
25
- encoding: options.encoding,
26
- md5: options.hash,
27
- mimetype: options.mimetype,
28
- mv: (filePath, callback)=>{
29
- // Define a proper move function.
30
- const moveFunc = fileUploadOptions.useTempFiles ? moveFromTemp(filePath, options, fileUploadOptions) : moveFromBuffer(filePath, options, fileUploadOptions);
31
- // Create a folder for a file.
32
- checkAndMakeDir(fileUploadOptions, filePath);
33
- // If callback is passed in, use the callback API, otherwise return a promise.
34
- const defaultReject = ()=>undefined;
35
- return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc);
36
- },
37
- size: options.size,
38
- tempFilePath: options.tempFilePath,
39
- truncated: options.truncated
40
- };
13
+ */
14
+ const moveFromBuffer = (filePath, options, fileUploadOptions) => (resolve, reject) => {
15
+ debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`);
16
+ saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject));
17
+ };
18
+ export const fileFactory = (options, fileUploadOptions) => {
19
+ // see: https://github.com/richardgirges/express-fileupload/issues/14
20
+ // firefox uploads empty file in case of cache miss when f5ing page.
21
+ // resulting in unexpected behavior. if there is no file data, the file is invalid.
22
+ // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;
23
+ // Create and return file object.
24
+ return {
25
+ name: options.name,
26
+ data: options.buffer,
27
+ encoding: options.encoding,
28
+ md5: options.hash,
29
+ mimetype: options.mimetype,
30
+ mv: (filePath, callback) => {
31
+ // Define a proper move function.
32
+ const moveFunc = fileUploadOptions.useTempFiles ? moveFromTemp(filePath, options, fileUploadOptions) : moveFromBuffer(filePath, options, fileUploadOptions);
33
+ // Create a folder for a file.
34
+ checkAndMakeDir(fileUploadOptions, filePath);
35
+ // If callback is passed in, use the callback API, otherwise return a promise.
36
+ const defaultReject = () => undefined;
37
+ return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc);
38
+ },
39
+ size: options.size,
40
+ tempFilePath: options.tempFilePath,
41
+ truncated: options.truncated
42
+ };
41
43
  };
42
-
43
44
  //# sourceMappingURL=fileFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchAPI-multipart/fileFactory.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions, FileShape } from './index.js'\n\nimport {\n checkAndMakeDir,\n debugLog,\n isFunc,\n moveFile,\n promiseCallback,\n saveBufferToFile,\n} from './utilities.js'\n\ntype MoveFile = (\n filePath: string,\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => (resolve: () => void, reject: () => void) => void\n\n/**\n * Returns Local function that moves the file to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromTemp: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`)\n moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject))\n}\n\n/**\n * Returns Local function that moves the file from buffer to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromBuffer: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`)\n saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject))\n}\n\ntype FileFactoryOptions = {\n buffer: Buffer\n encoding: string\n hash: Buffer | string\n mimetype: string\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\ntype FileFactory = (\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => FileShape\nexport const fileFactory: FileFactory = (options, fileUploadOptions) => {\n // see: https://github.com/richardgirges/express-fileupload/issues/14\n // firefox uploads empty file in case of cache miss when f5ing page.\n // resulting in unexpected behavior. if there is no file data, the file is invalid.\n // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;\n\n // Create and return file object.\n return {\n name: options.name,\n data: options.buffer,\n encoding: options.encoding,\n md5: options.hash,\n mimetype: options.mimetype,\n mv: (filePath: string, callback) => {\n // Define a proper move function.\n const moveFunc = fileUploadOptions.useTempFiles\n ? moveFromTemp(filePath, options, fileUploadOptions)\n : moveFromBuffer(filePath, options, fileUploadOptions)\n // Create a folder for a file.\n checkAndMakeDir(fileUploadOptions, filePath)\n // If callback is passed in, use the callback API, otherwise return a promise.\n const defaultReject = () => undefined\n return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc)\n },\n size: options.size,\n tempFilePath: options.tempFilePath,\n truncated: options.truncated,\n }\n}\n"],"names":["checkAndMakeDir","debugLog","isFunc","moveFile","promiseCallback","saveBufferToFile","moveFromTemp","filePath","options","fileUploadOptions","resolve","reject","tempFilePath","moveFromBuffer","buffer","fileFactory","name","data","encoding","md5","hash","mimetype","mv","callback","moveFunc","useTempFiles","defaultReject","undefined","Promise","size","truncated"],"mappings":"AAEA,SACEA,eAAe,EACfC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,QACX,iBAAgB;AAQvB;;;CAGC,GACD,MAAMC,eAAyB,CAACC,UAAUC,SAASC,oBAAsB,CAACC,SAASC;QACjFV,SAASQ,mBAAmB,CAAC,sBAAsB,EAAED,QAAQI,YAAY,CAAC,IAAI,EAAEL,SAAS,CAAC;QAC1FJ,SAASK,QAAQI,YAAY,EAAEL,UAAUH,gBAAgBM,SAASC;IACpE;AAEA;;;CAGC,GACD,MAAME,iBAA2B,CAACN,UAAUC,SAASC,oBAAsB,CAACC,SAASC;QACnFV,SAASQ,mBAAmB,CAAC,0BAA0B,EAAEF,SAAS,CAAC;QACnEF,iBAAiBG,QAAQM,MAAM,EAAEP,UAAUH,gBAAgBM,SAASC;IACtE;AAgBA,OAAO,MAAMI,cAA2B,CAACP,SAASC;IAChD,qEAAqE;IACrE,oEAAoE;IACpE,mFAAmF;IACnF,yEAAyE;IAEzE,iCAAiC;IACjC,OAAO;QACLO,MAAMR,QAAQQ,IAAI;QAClBC,MAAMT,QAAQM,MAAM;QACpBI,UAAUV,QAAQU,QAAQ;QAC1BC,KAAKX,QAAQY,IAAI;QACjBC,UAAUb,QAAQa,QAAQ;QAC1BC,IAAI,CAACf,UAAkBgB;YACrB,iCAAiC;YACjC,MAAMC,WAAWf,kBAAkBgB,YAAY,GAC3CnB,aAAaC,UAAUC,SAASC,qBAChCI,eAAeN,UAAUC,SAASC;YACtC,8BAA8B;YAC9BT,gBAAgBS,mBAAmBF;YACnC,8EAA8E;YAC9E,MAAMmB,gBAAgB,IAAMC;YAC5B,OAAOzB,OAAOqB,YAAYC,SAASD,UAAUG,iBAAiB,IAAIE,QAAQJ;QAC5E;QACAK,MAAMrB,QAAQqB,IAAI;QAClBjB,cAAcJ,QAAQI,YAAY;QAClCkB,WAAWtB,QAAQsB,SAAS;IAC9B;AACF,EAAC"}
1
+ {"version":3,"file":"fileFactory.js","names":["checkAndMakeDir","debugLog","isFunc","moveFile","promiseCallback","saveBufferToFile","moveFromTemp","filePath","options","fileUploadOptions","resolve","reject","tempFilePath","moveFromBuffer","buffer","fileFactory","name","data","encoding","md5","hash","mimetype","mv","callback","moveFunc","useTempFiles","defaultReject","undefined","Promise","size","truncated"],"sources":["../../src/fetchAPI-multipart/fileFactory.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions } from 'payload'\n\nimport type { FileShape } from './index.js'\n\nimport {\n checkAndMakeDir,\n debugLog,\n isFunc,\n moveFile,\n promiseCallback,\n saveBufferToFile,\n} from './utilities.js'\n\ntype MoveFile = (\n filePath: string,\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => (resolve: () => void, reject: () => void) => void\n\n/**\n * Returns Local function that moves the file to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromTemp: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving temporary file ${options.tempFilePath} to ${filePath}`)\n moveFile(options.tempFilePath, filePath, promiseCallback(resolve, reject))\n}\n\n/**\n * Returns Local function that moves the file from buffer to a different location on the filesystem\n * which takes two function arguments to make it compatible w/ Promise or Callback APIs\n */\nconst moveFromBuffer: MoveFile = (filePath, options, fileUploadOptions) => (resolve, reject) => {\n debugLog(fileUploadOptions, `Moving uploaded buffer to ${filePath}`)\n saveBufferToFile(options.buffer, filePath, promiseCallback(resolve, reject))\n}\n\ntype FileFactoryOptions = {\n buffer: Buffer\n encoding: string\n hash: Buffer | string\n mimetype: string\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\ntype FileFactory = (\n options: FileFactoryOptions,\n fileUploadOptions: FetchAPIFileUploadOptions,\n) => FileShape\nexport const fileFactory: FileFactory = (options, fileUploadOptions) => {\n // see: https://github.com/richardgirges/express-fileupload/issues/14\n // firefox uploads empty file in case of cache miss when f5ing page.\n // resulting in unexpected behavior. if there is no file data, the file is invalid.\n // if (!fileUploadOptions.useTempFiles && !options.buffer.length) return;\n\n // Create and return file object.\n return {\n name: options.name,\n data: options.buffer,\n encoding: options.encoding,\n md5: options.hash,\n mimetype: options.mimetype,\n mv: (filePath: string, callback) => {\n // Define a proper move function.\n const moveFunc = fileUploadOptions.useTempFiles\n ? moveFromTemp(filePath, options, fileUploadOptions)\n : moveFromBuffer(filePath, options, fileUploadOptions)\n // Create a folder for a file.\n checkAndMakeDir(fileUploadOptions, filePath)\n // If callback is passed in, use the callback API, otherwise return a promise.\n const defaultReject = () => undefined\n return isFunc(callback) ? moveFunc(callback, defaultReject) : new Promise(moveFunc)\n },\n size: options.size,\n tempFilePath: options.tempFilePath,\n truncated: options.truncated,\n }\n}\n"],"mappings":"AAIA,SACEA,eAAe,EACfC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,QACX;AAQP;;;;AAIA,MAAMC,YAAA,GAAyBA,CAACC,QAAA,EAAUC,OAAA,EAASC,iBAAA,KAAsB,CAACC,OAAA,EAASC,MAAA;EACjFV,QAAA,CAASQ,iBAAA,EAAmB,yBAAyBD,OAAA,CAAQI,YAAY,OAAOL,QAAA,EAAU;EAC1FJ,QAAA,CAASK,OAAA,CAAQI,YAAY,EAAEL,QAAA,EAAUH,eAAA,CAAgBM,OAAA,EAASC,MAAA;AACpE;AAEA;;;;AAIA,MAAME,cAAA,GAA2BA,CAACN,QAAA,EAAUC,OAAA,EAASC,iBAAA,KAAsB,CAACC,OAAA,EAASC,MAAA;EACnFV,QAAA,CAASQ,iBAAA,EAAmB,6BAA6BF,QAAA,EAAU;EACnEF,gBAAA,CAAiBG,OAAA,CAAQM,MAAM,EAAEP,QAAA,EAAUH,eAAA,CAAgBM,OAAA,EAASC,MAAA;AACtE;AAgBA,OAAO,MAAMI,WAAA,GAA2BA,CAACP,OAAA,EAASC,iBAAA;EAChD;EACA;EACA;EACA;EAEA;EACA,OAAO;IACLO,IAAA,EAAMR,OAAA,CAAQQ,IAAI;IAClBC,IAAA,EAAMT,OAAA,CAAQM,MAAM;IACpBI,QAAA,EAAUV,OAAA,CAAQU,QAAQ;IAC1BC,GAAA,EAAKX,OAAA,CAAQY,IAAI;IACjBC,QAAA,EAAUb,OAAA,CAAQa,QAAQ;IAC1BC,EAAA,EAAIA,CAACf,QAAA,EAAkBgB,QAAA;MACrB;MACA,MAAMC,QAAA,GAAWf,iBAAA,CAAkBgB,YAAY,GAC3CnB,YAAA,CAAaC,QAAA,EAAUC,OAAA,EAASC,iBAAA,IAChCI,cAAA,CAAeN,QAAA,EAAUC,OAAA,EAASC,iBAAA;MACtC;MACAT,eAAA,CAAgBS,iBAAA,EAAmBF,QAAA;MACnC;MACA,MAAMmB,aAAA,GAAgBA,CAAA,KAAMC,SAAA;MAC5B,OAAOzB,MAAA,CAAOqB,QAAA,IAAYC,QAAA,CAASD,QAAA,EAAUG,aAAA,IAAiB,IAAIE,OAAA,CAAQJ,QAAA;IAC5E;IACAK,IAAA,EAAMrB,OAAA,CAAQqB,IAAI;IAClBjB,YAAA,EAAcJ,OAAA,CAAQI,YAAY;IAClCkB,SAAA,EAAWtB,OAAA,CAAQsB;EACrB;AACF","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { FetchAPIFileUploadOptions } from './index.js';
1
+ import type { FetchAPIFileUploadOptions } from 'payload';
2
2
  type Handler = (options: FetchAPIFileUploadOptions, fieldname: string, filename: string) => {
3
3
  cleanup: () => void;
4
4
  complete: () => Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/fetchAPI-multipart/handlers.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAI3D,KAAK,OAAO,GAAG,CACb,OAAO,EAAE,yBAAyB,EAClC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,KACb;IACH,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAsD7B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,OAgCxB,CAAA"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/fetchAPI-multipart/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAQxD,KAAK,OAAO,GAAG,CACb,OAAO,EAAE,yBAAyB,EAClC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,KACb;IACH,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,WAAW,EAAE,MAAM,MAAM,CAAA;IACzB,OAAO,EAAE,MAAM,MAAM,CAAA;IACrB,eAAe,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,OAwD7B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,OAgCxB,CAAA"}
@@ -2,85 +2,86 @@ import crypto from 'crypto';
2
2
  import fs, { WriteStream } from 'fs';
3
3
  import path from 'path';
4
4
  import { checkAndMakeDir, debugLog, deleteFile, getTempFilename } from './utilities.js';
5
- export const tempFileHandler = (options, fieldname, filename)=>{
6
- const dir = path.normalize(options.tempFileDir);
7
- const tempFilePath = path.join(process.cwd(), dir, getTempFilename());
8
- checkAndMakeDir({
9
- createParentPath: true
10
- }, tempFilePath);
11
- debugLog(options, `Temporary file path is ${tempFilePath}`);
12
- const hash = crypto.createHash('md5');
13
- let fileSize = 0;
14
- let completed = false;
15
- debugLog(options, `Opening write stream for ${fieldname}->${filename}...`);
16
- const writeStream = fs.createWriteStream(tempFilePath);
17
- const writePromise = new Promise((resolve, reject)=>{
18
- writeStream.on('finish', ()=>resolve(true));
19
- writeStream.on('error', (err)=>{
20
- debugLog(options, `Error write temp file: ${err}`);
21
- reject(err);
22
- });
5
+ export const tempFileHandler = (options, fieldname, filename) => {
6
+ const dir = path.normalize(options.tempFileDir);
7
+ const tempFilePath = path.join(process.cwd(), dir, getTempFilename());
8
+ checkAndMakeDir({
9
+ createParentPath: true
10
+ }, tempFilePath);
11
+ debugLog(options, `Temporary file path is ${tempFilePath}`);
12
+ const hash = crypto.createHash('md5');
13
+ let fileSize = 0;
14
+ let completed = false;
15
+ debugLog(options, `Opening write stream for ${fieldname}->${filename}...`);
16
+ const writeStream = fs.createWriteStream(tempFilePath);
17
+ const writePromise = new Promise((resolve, reject) => {
18
+ writeStream.on('finish', () => resolve(true));
19
+ writeStream.on('error', err => {
20
+ debugLog(options, `Error write temp file: ${err}`);
21
+ reject(err);
23
22
  });
24
- return {
25
- cleanup: ()=>{
26
- completed = true;
27
- debugLog(options, `Cleaning up temporary file ${tempFilePath}...`);
28
- writeStream.end();
29
- deleteFile(tempFilePath, (err)=>err ? debugLog(options, `Cleaning up temporary file ${tempFilePath} failed: ${err}`) : debugLog(options, `Cleaning up temporary file ${tempFilePath} done.`));
30
- },
31
- complete: ()=>{
32
- completed = true;
33
- debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`);
34
- if (writeStream instanceof WriteStream) writeStream.end();
35
- // Return empty buff since data was uploaded into a temp file.
36
- return Buffer.concat([]);
37
- },
38
- dataHandler: (data)=>{
39
- if (completed === true) {
40
- debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`);
41
- return;
42
- }
43
- writeStream.write(data);
44
- hash.update(data);
45
- fileSize += data.length;
46
- debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`);
47
- },
48
- getFilePath: ()=>tempFilePath,
49
- getFileSize: ()=>fileSize,
50
- getHash: ()=>hash.digest('hex'),
51
- getWritePromise: ()=>writePromise
52
- };
23
+ });
24
+ return {
25
+ cleanup: () => {
26
+ completed = true;
27
+ debugLog(options, `Cleaning up temporary file ${tempFilePath}...`);
28
+ writeStream.end();
29
+ deleteFile(tempFilePath, err => err ? debugLog(options, `Cleaning up temporary file ${tempFilePath} failed: ${err}`) : debugLog(options, `Cleaning up temporary file ${tempFilePath} done.`));
30
+ },
31
+ complete: () => {
32
+ completed = true;
33
+ debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`);
34
+ if (writeStream instanceof WriteStream) {
35
+ writeStream.end();
36
+ }
37
+ // Return empty buff since data was uploaded into a temp file.
38
+ return Buffer.concat([]);
39
+ },
40
+ dataHandler: data => {
41
+ if (completed === true) {
42
+ debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`);
43
+ return;
44
+ }
45
+ writeStream.write(data);
46
+ hash.update(data);
47
+ fileSize += data.length;
48
+ debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`);
49
+ },
50
+ getFilePath: () => tempFilePath,
51
+ getFileSize: () => fileSize,
52
+ getHash: () => hash.digest('hex'),
53
+ getWritePromise: () => writePromise
54
+ };
53
55
  };
54
- export const memHandler = (options, fieldname, filename)=>{
55
- const buffers = [];
56
- const hash = crypto.createHash('md5');
57
- let fileSize = 0;
58
- let completed = false;
59
- const getBuffer = ()=>Buffer.concat(buffers, fileSize);
60
- return {
61
- cleanup: ()=>{
62
- completed = true;
63
- },
64
- complete: ()=>{
65
- debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`);
66
- completed = true;
67
- return getBuffer();
68
- },
69
- dataHandler: (data)=>{
70
- if (completed === true) {
71
- debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`);
72
- return;
73
- }
74
- buffers.push(data);
75
- hash.update(data);
76
- fileSize += data.length;
77
- debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`);
78
- },
79
- getFilePath: ()=>'',
80
- getFileSize: ()=>fileSize,
81
- getHash: ()=>hash.digest('hex'),
82
- getWritePromise: ()=>Promise.resolve(true)
83
- };
56
+ export const memHandler = (options, fieldname, filename) => {
57
+ const buffers = [];
58
+ const hash = crypto.createHash('md5');
59
+ let fileSize = 0;
60
+ let completed = false;
61
+ const getBuffer = () => Buffer.concat(buffers, fileSize);
62
+ return {
63
+ cleanup: () => {
64
+ completed = true;
65
+ },
66
+ complete: () => {
67
+ debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`);
68
+ completed = true;
69
+ return getBuffer();
70
+ },
71
+ dataHandler: data => {
72
+ if (completed === true) {
73
+ debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`);
74
+ return;
75
+ }
76
+ buffers.push(data);
77
+ hash.update(data);
78
+ fileSize += data.length;
79
+ debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`);
80
+ },
81
+ getFilePath: () => '',
82
+ getFileSize: () => fileSize,
83
+ getHash: () => hash.digest('hex'),
84
+ getWritePromise: () => Promise.resolve(true)
85
+ };
84
86
  };
85
-
86
87
  //# sourceMappingURL=handlers.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchAPI-multipart/handlers.ts"],"sourcesContent":["import crypto from 'crypto'\nimport fs, { WriteStream } from 'fs'\nimport path from 'path'\n\nimport type { FetchAPIFileUploadOptions } from './index.js'\n\nimport { checkAndMakeDir, debugLog, deleteFile, getTempFilename } from './utilities.js'\n\ntype Handler = (\n options: FetchAPIFileUploadOptions,\n fieldname: string,\n filename: string,\n) => {\n cleanup: () => void\n complete: () => Buffer\n dataHandler: (data: Buffer) => void\n getFilePath: () => string\n getFileSize: () => number\n getHash: () => string\n getWritePromise: () => Promise<boolean>\n}\n\nexport const tempFileHandler: Handler = (options, fieldname, filename) => {\n const dir = path.normalize(options.tempFileDir)\n const tempFilePath = path.join(process.cwd(), dir, getTempFilename())\n checkAndMakeDir({ createParentPath: true }, tempFilePath)\n\n debugLog(options, `Temporary file path is ${tempFilePath}`)\n\n const hash = crypto.createHash('md5')\n let fileSize = 0\n let completed = false\n\n debugLog(options, `Opening write stream for ${fieldname}->${filename}...`)\n const writeStream = fs.createWriteStream(tempFilePath)\n const writePromise = new Promise<boolean>((resolve, reject) => {\n writeStream.on('finish', () => resolve(true))\n writeStream.on('error', (err) => {\n debugLog(options, `Error write temp file: ${err}`)\n reject(err)\n })\n })\n\n return {\n cleanup: () => {\n completed = true\n debugLog(options, `Cleaning up temporary file ${tempFilePath}...`)\n writeStream.end()\n deleteFile(tempFilePath, (err) =>\n err\n ? debugLog(options, `Cleaning up temporary file ${tempFilePath} failed: ${err}`)\n : debugLog(options, `Cleaning up temporary file ${tempFilePath} done.`),\n )\n },\n complete: () => {\n completed = true\n debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`)\n if (writeStream instanceof WriteStream) writeStream.end()\n // Return empty buff since data was uploaded into a temp file.\n return Buffer.concat([])\n },\n dataHandler: (data) => {\n if (completed === true) {\n debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`)\n return\n }\n writeStream.write(data)\n hash.update(data)\n fileSize += data.length\n debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`)\n },\n getFilePath: () => tempFilePath,\n getFileSize: () => fileSize,\n getHash: () => hash.digest('hex'),\n getWritePromise: () => writePromise,\n }\n}\n\nexport const memHandler: Handler = (options, fieldname, filename) => {\n const buffers: Buffer[] = []\n const hash = crypto.createHash('md5')\n let fileSize = 0\n let completed = false\n\n const getBuffer = () => Buffer.concat(buffers, fileSize)\n\n return {\n cleanup: () => {\n completed = true\n },\n complete: () => {\n debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`)\n completed = true\n return getBuffer()\n },\n dataHandler: (data) => {\n if (completed === true) {\n debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`)\n return\n }\n buffers.push(data)\n hash.update(data)\n fileSize += data.length\n debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`)\n },\n getFilePath: () => '',\n getFileSize: () => fileSize,\n getHash: () => hash.digest('hex'),\n getWritePromise: () => Promise.resolve(true),\n }\n}\n"],"names":["crypto","fs","WriteStream","path","checkAndMakeDir","debugLog","deleteFile","getTempFilename","tempFileHandler","options","fieldname","filename","dir","normalize","tempFileDir","tempFilePath","join","process","cwd","createParentPath","hash","createHash","fileSize","completed","writeStream","createWriteStream","writePromise","Promise","resolve","reject","on","err","cleanup","end","complete","Buffer","concat","dataHandler","data","write","update","length","getFilePath","getFileSize","getHash","digest","getWritePromise","memHandler","buffers","getBuffer","push"],"mappings":"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"}
1
+ {"version":3,"file":"handlers.js","names":["crypto","fs","WriteStream","path","checkAndMakeDir","debugLog","deleteFile","getTempFilename","tempFileHandler","options","fieldname","filename","dir","normalize","tempFileDir","tempFilePath","join","process","cwd","createParentPath","hash","createHash","fileSize","completed","writeStream","createWriteStream","writePromise","Promise","resolve","reject","on","err","cleanup","end","complete","Buffer","concat","dataHandler","data","write","update","length","getFilePath","getFileSize","getHash","digest","getWritePromise","memHandler","buffers","getBuffer","push"],"sources":["../../src/fetchAPI-multipart/handlers.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions } from 'payload'\n\nimport crypto from 'crypto'\nimport fs, { WriteStream } from 'fs'\nimport path from 'path'\n\nimport { checkAndMakeDir, debugLog, deleteFile, getTempFilename } from './utilities.js'\n\ntype Handler = (\n options: FetchAPIFileUploadOptions,\n fieldname: string,\n filename: string,\n) => {\n cleanup: () => void\n complete: () => Buffer\n dataHandler: (data: Buffer) => void\n getFilePath: () => string\n getFileSize: () => number\n getHash: () => string\n getWritePromise: () => Promise<boolean>\n}\n\nexport const tempFileHandler: Handler = (options, fieldname, filename) => {\n const dir = path.normalize(options.tempFileDir)\n const tempFilePath = path.join(process.cwd(), dir, getTempFilename())\n checkAndMakeDir({ createParentPath: true }, tempFilePath)\n\n debugLog(options, `Temporary file path is ${tempFilePath}`)\n\n const hash = crypto.createHash('md5')\n let fileSize = 0\n let completed = false\n\n debugLog(options, `Opening write stream for ${fieldname}->${filename}...`)\n const writeStream = fs.createWriteStream(tempFilePath)\n const writePromise = new Promise<boolean>((resolve, reject) => {\n writeStream.on('finish', () => resolve(true))\n writeStream.on('error', (err) => {\n debugLog(options, `Error write temp file: ${err}`)\n reject(err)\n })\n })\n\n return {\n cleanup: () => {\n completed = true\n debugLog(options, `Cleaning up temporary file ${tempFilePath}...`)\n writeStream.end()\n deleteFile(tempFilePath, (err) =>\n err\n ? debugLog(options, `Cleaning up temporary file ${tempFilePath} failed: ${err}`)\n : debugLog(options, `Cleaning up temporary file ${tempFilePath} done.`),\n )\n },\n complete: () => {\n completed = true\n debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`)\n if (writeStream instanceof WriteStream) {\n writeStream.end()\n }\n // Return empty buff since data was uploaded into a temp file.\n return Buffer.concat([])\n },\n dataHandler: (data) => {\n if (completed === true) {\n debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`)\n return\n }\n writeStream.write(data)\n hash.update(data)\n fileSize += data.length\n debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`)\n },\n getFilePath: () => tempFilePath,\n getFileSize: () => fileSize,\n getHash: () => hash.digest('hex'),\n getWritePromise: () => writePromise,\n }\n}\n\nexport const memHandler: Handler = (options, fieldname, filename) => {\n const buffers: Buffer[] = []\n const hash = crypto.createHash('md5')\n let fileSize = 0\n let completed = false\n\n const getBuffer = () => Buffer.concat(buffers, fileSize)\n\n return {\n cleanup: () => {\n completed = true\n },\n complete: () => {\n debugLog(options, `Upload ${fieldname}->${filename} completed, bytes:${fileSize}.`)\n completed = true\n return getBuffer()\n },\n dataHandler: (data) => {\n if (completed === true) {\n debugLog(options, `Error: got ${fieldname}->${filename} data chunk for completed upload!`)\n return\n }\n buffers.push(data)\n hash.update(data)\n fileSize += data.length\n debugLog(options, `Uploading ${fieldname}->${filename}, bytes:${fileSize}...`)\n },\n getFilePath: () => '',\n getFileSize: () => fileSize,\n getHash: () => hash.digest('hex'),\n getWritePromise: () => Promise.resolve(true),\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { BusboyConfig } from 'busboy';
1
+ import type { FetchAPIFileUploadOptions } from 'payload';
2
2
  import { APIError } from 'payload';
3
3
  export type FileShape = {
4
4
  data: Buffer;
@@ -11,106 +11,6 @@ export type FileShape = {
11
11
  tempFilePath: string;
12
12
  truncated: boolean;
13
13
  };
14
- export type FetchAPIFileUploadOptions = {
15
- /**
16
- * Returns a HTTP 413 when the file is bigger than the size limit if `true`.
17
- * Otherwise, it will add a `truncated = true` to the resulting file structure.
18
- * @default false
19
- */
20
- abortOnLimit?: boolean | undefined;
21
- /**
22
- * Automatically creates the directory path specified in `.mv(filePathName)`
23
- * @default false
24
- */
25
- createParentPath?: boolean | undefined;
26
- /**
27
- * Turn on/off upload process logging. Can be useful for troubleshooting.
28
- * @default false
29
- */
30
- debug?: boolean | undefined;
31
- /**
32
- * User defined limit handler which will be invoked if the file is bigger than configured limits.
33
- * @default false
34
- */
35
- limitHandler?: ((args: {
36
- request: Request;
37
- size: number;
38
- }) => void) | boolean | undefined;
39
- /**
40
- * By default, `req.body` and `req.files` are flattened like this:
41
- * `{'name': 'John', 'hobbies[0]': 'Cinema', 'hobbies[1]': 'Bike'}
42
- *
43
- * When this option is enabled they are parsed in order to be nested like this:
44
- * `{'name': 'John', 'hobbies': ['Cinema', 'Bike']}`
45
- * @default false
46
- */
47
- parseNested?: boolean | undefined;
48
- /**
49
- * Preserves filename extension when using `safeFileNames` option.
50
- * If set to `true`, will default to an extension length of `3`.
51
- * If set to `number`, this will be the max allowable extension length.
52
- * If an extension is smaller than the extension length, it remains untouched. If the extension is longer,
53
- * it is shifted.
54
- * @default false
55
- *
56
- * @example
57
- * // true
58
- * app.use(fileUpload({ safeFileNames: true, preserveExtension: true }));
59
- * // myFileName.ext --> myFileName.ext
60
- *
61
- * @example
62
- * // max extension length 2, extension shifted
63
- * app.use(fileUpload({ safeFileNames: true, preserveExtension: 2 }));
64
- * // myFileName.ext --> myFileNamee.xt
65
- */
66
- preserveExtension?: boolean | number | undefined;
67
- /**
68
- * Response which will be send to client if file size limit exceeded when `abortOnLimit` set to `true`.
69
- * @default 'File size limit has been reached'
70
- */
71
- responseOnLimit?: string | undefined;
72
- /**
73
- * Strips characters from the upload's filename.
74
- * You can use custom regex to determine what to strip.
75
- * If set to `true`, non-alphanumeric characters _except_ dashes and underscores will be stripped.
76
- * This option is off by default.
77
- * @default false
78
- *
79
- * @example
80
- * // strip slashes from file names
81
- * app.use(fileUpload({ safeFileNames: /\\/g }))
82
- *
83
- * @example
84
- * app.use(fileUpload({ safeFileNames: true }))
85
- */
86
- safeFileNames?: RegExp | boolean | undefined;
87
- /**
88
- * Path to store temporary files.
89
- * Used along with the `useTempFiles` option. By default this module uses `'tmp'` folder
90
- * in the current working directory.
91
- * You can use trailing slash, but it is not necessary.
92
- * @default './tmp'
93
- */
94
- tempFileDir?: string | undefined;
95
- /**
96
- * This defines how long to wait for data before aborting. Set to `0` if you want to turn off timeout checks.
97
- * @default 60_000
98
- */
99
- uploadTimeout?: number | undefined;
100
- /**
101
- * Applies uri decoding to file names if set `true`.
102
- * @default false
103
- */
104
- uriDecodeFileNames?: boolean | undefined;
105
- /**
106
- * By default this module uploads files into RAM.
107
- * Setting this option to `true` turns on using temporary files instead of utilising RAM.
108
- * This avoids memory overflow issues when uploading large files or in case of uploading
109
- * lots of files at same time.
110
- * @default false
111
- */
112
- useTempFiles?: boolean | undefined;
113
- } & Partial<BusboyConfig>;
114
14
  type FetchAPIFileUploadResponseFile = {
115
15
  data: Buffer;
116
16
  mimetype: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetchAPI-multipart/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAsBlC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAClC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,OAAO,GAAG,SAAS,CAAA;IACzF;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACjC;;;;;;;;;;;;;;;;;OAiBG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;IAChD;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;IAC5C;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IACxC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACnC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAEzB,KAAK,8BAA8B,GAAG;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAA;CACtD,CAAA;AAED,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE;IAC/B,OAAO,CAAC,EAAE,yBAAyB,CAAA;IACnC,OAAO,EAAE,OAAO,CAAA;CACjB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzC,eAAO,MAAM,kBAAkB,EAAE,kBAYhC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetchAPI-multipart/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAsBlC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,KAAK,8BAA8B,GAAG;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAA;CACtD,CAAA;AAED,KAAK,kBAAkB,GAAG,CAAC,IAAI,EAAE;IAC/B,OAAO,CAAC,EAAE,yBAAyB,CAAA;IACnC,OAAO,EAAE,OAAO,CAAA;CACjB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAA;AACzC,eAAO,MAAM,kBAAkB,EAAE,kBAYhC,CAAA"}
@@ -4,38 +4,40 @@ import { isEligibleRequest } from './isEligibleRequest.js';
4
4
  import { processMultipart } from './processMultipart.js';
5
5
  import { debugLog } from './utilities.js';
6
6
  const DEFAULT_OPTIONS = {
7
- abortOnLimit: false,
8
- createParentPath: false,
9
- debug: false,
10
- fileHandler: false,
11
- limitHandler: false,
12
- parseNested: false,
13
- preserveExtension: false,
14
- responseOnLimit: 'File size limit has been reached',
15
- safeFileNames: false,
16
- tempFileDir: path.join(process.cwd(), 'tmp'),
17
- uploadTimeout: 60000,
18
- uriDecodeFileNames: false,
19
- useTempFiles: false
7
+ abortOnLimit: false,
8
+ createParentPath: false,
9
+ debug: false,
10
+ defParamCharset: 'utf8',
11
+ limitHandler: false,
12
+ parseNested: false,
13
+ preserveExtension: false,
14
+ responseOnLimit: 'File size limit has been reached',
15
+ safeFileNames: false,
16
+ tempFileDir: path.join(process.cwd(), 'tmp'),
17
+ uploadTimeout: 60000,
18
+ uriDecodeFileNames: false,
19
+ useTempFiles: false
20
20
  };
21
- export const fetchAPIFileUpload = async ({ options, request })=>{
22
- const uploadOptions = {
23
- ...DEFAULT_OPTIONS,
24
- ...options
21
+ export const fetchAPIFileUpload = async ({
22
+ options,
23
+ request
24
+ }) => {
25
+ const uploadOptions = {
26
+ ...DEFAULT_OPTIONS,
27
+ ...options
28
+ };
29
+ if (!isEligibleRequest(request)) {
30
+ debugLog(uploadOptions, 'Request is not eligible for file upload!');
31
+ return {
32
+ error: new APIError('Request is not eligible for file upload', 500),
33
+ fields: undefined,
34
+ files: undefined
25
35
  };
26
- if (!isEligibleRequest(request)) {
27
- debugLog(uploadOptions, 'Request is not eligible for file upload!');
28
- return {
29
- error: new APIError('Request is not eligible for file upload', 500),
30
- fields: undefined,
31
- files: undefined
32
- };
33
- } else {
34
- return processMultipart({
35
- options: uploadOptions,
36
- request
37
- });
38
- }
36
+ } else {
37
+ return processMultipart({
38
+ options: uploadOptions,
39
+ request
40
+ });
41
+ }
39
42
  };
40
-
41
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fetchAPI-multipart/index.ts"],"sourcesContent":["import type { BusboyConfig } from 'busboy'\n\nimport path from 'path'\nimport { APIError } from 'payload'\n\nimport { isEligibleRequest } from './isEligibleRequest.js'\nimport { processMultipart } from './processMultipart.js'\nimport { debugLog } from './utilities.js'\n\nconst DEFAULT_OPTIONS = {\n abortOnLimit: false,\n createParentPath: false,\n debug: false,\n fileHandler: false,\n limitHandler: false,\n parseNested: false,\n preserveExtension: false,\n responseOnLimit: 'File size limit has been reached',\n safeFileNames: false,\n tempFileDir: path.join(process.cwd(), 'tmp'),\n uploadTimeout: 60000,\n uriDecodeFileNames: false,\n useTempFiles: false,\n}\n\nexport type FileShape = {\n data: Buffer\n encoding: string\n md5: Buffer | string\n mimetype: string\n mv: (filePath: string, callback: () => void) => Promise<void> | void\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\n\nexport type FetchAPIFileUploadOptions = {\n /**\n * Returns a HTTP 413 when the file is bigger than the size limit if `true`.\n * Otherwise, it will add a `truncated = true` to the resulting file structure.\n * @default false\n */\n abortOnLimit?: boolean | undefined\n /**\n * Automatically creates the directory path specified in `.mv(filePathName)`\n * @default false\n */\n createParentPath?: boolean | undefined\n /**\n * Turn on/off upload process logging. Can be useful for troubleshooting.\n * @default false\n */\n debug?: boolean | undefined\n /**\n * User defined limit handler which will be invoked if the file is bigger than configured limits.\n * @default false\n */\n limitHandler?: ((args: { request: Request; size: number }) => void) | boolean | undefined\n /**\n * By default, `req.body` and `req.files` are flattened like this:\n * `{'name': 'John', 'hobbies[0]': 'Cinema', 'hobbies[1]': 'Bike'}\n *\n * When this option is enabled they are parsed in order to be nested like this:\n * `{'name': 'John', 'hobbies': ['Cinema', 'Bike']}`\n * @default false\n */\n parseNested?: boolean | undefined\n /**\n * Preserves filename extension when using `safeFileNames` option.\n * If set to `true`, will default to an extension length of `3`.\n * If set to `number`, this will be the max allowable extension length.\n * If an extension is smaller than the extension length, it remains untouched. If the extension is longer,\n * it is shifted.\n * @default false\n *\n * @example\n * // true\n * app.use(fileUpload({ safeFileNames: true, preserveExtension: true }));\n * // myFileName.ext --> myFileName.ext\n *\n * @example\n * // max extension length 2, extension shifted\n * app.use(fileUpload({ safeFileNames: true, preserveExtension: 2 }));\n * // myFileName.ext --> myFileNamee.xt\n */\n preserveExtension?: boolean | number | undefined\n /**\n * Response which will be send to client if file size limit exceeded when `abortOnLimit` set to `true`.\n * @default 'File size limit has been reached'\n */\n responseOnLimit?: string | undefined\n /**\n * Strips characters from the upload's filename.\n * You can use custom regex to determine what to strip.\n * If set to `true`, non-alphanumeric characters _except_ dashes and underscores will be stripped.\n * This option is off by default.\n * @default false\n *\n * @example\n * // strip slashes from file names\n * app.use(fileUpload({ safeFileNames: /\\\\/g }))\n *\n * @example\n * app.use(fileUpload({ safeFileNames: true }))\n */\n safeFileNames?: RegExp | boolean | undefined\n /**\n * Path to store temporary files.\n * Used along with the `useTempFiles` option. By default this module uses `'tmp'` folder\n * in the current working directory.\n * You can use trailing slash, but it is not necessary.\n * @default './tmp'\n */\n tempFileDir?: string | undefined\n /**\n * This defines how long to wait for data before aborting. Set to `0` if you want to turn off timeout checks.\n * @default 60_000\n */\n uploadTimeout?: number | undefined\n /**\n * Applies uri decoding to file names if set `true`.\n * @default false\n */\n uriDecodeFileNames?: boolean | undefined\n /**\n * By default this module uploads files into RAM.\n * Setting this option to `true` turns on using temporary files instead of utilising RAM.\n * This avoids memory overflow issues when uploading large files or in case of uploading\n * lots of files at same time.\n * @default false\n */\n useTempFiles?: boolean | undefined\n} & Partial<BusboyConfig>\n\ntype FetchAPIFileUploadResponseFile = {\n data: Buffer\n mimetype: string\n name: string\n size: number\n tempFilePath?: string\n}\n\nexport type FetchAPIFileUploadResponse = {\n error?: APIError\n fields: Record<string, string>\n files: Record<string, FetchAPIFileUploadResponseFile>\n}\n\ntype FetchAPIFileUpload = (args: {\n options?: FetchAPIFileUploadOptions\n request: Request\n}) => Promise<FetchAPIFileUploadResponse>\nexport const fetchAPIFileUpload: FetchAPIFileUpload = async ({ options, request }) => {\n const uploadOptions: FetchAPIFileUploadOptions = { ...DEFAULT_OPTIONS, ...options }\n if (!isEligibleRequest(request)) {\n debugLog(uploadOptions, 'Request is not eligible for file upload!')\n return {\n error: new APIError('Request is not eligible for file upload', 500),\n fields: undefined,\n files: undefined,\n }\n } else {\n return processMultipart({ options: uploadOptions, request })\n }\n}\n"],"names":["path","APIError","isEligibleRequest","processMultipart","debugLog","DEFAULT_OPTIONS","abortOnLimit","createParentPath","debug","fileHandler","limitHandler","parseNested","preserveExtension","responseOnLimit","safeFileNames","tempFileDir","join","process","cwd","uploadTimeout","uriDecodeFileNames","useTempFiles","fetchAPIFileUpload","options","request","uploadOptions","error","fields","undefined","files"],"mappings":"AAEA,OAAOA,UAAU,OAAM;AACvB,SAASC,QAAQ,QAAQ,UAAS;AAElC,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,QAAQ,QAAQ,iBAAgB;AAEzC,MAAMC,kBAAkB;IACtBC,cAAc;IACdC,kBAAkB;IAClBC,OAAO;IACPC,aAAa;IACbC,cAAc;IACdC,aAAa;IACbC,mBAAmB;IACnBC,iBAAiB;IACjBC,eAAe;IACfC,aAAaf,KAAKgB,IAAI,CAACC,QAAQC,GAAG,IAAI;IACtCC,eAAe;IACfC,oBAAoB;IACpBC,cAAc;AAChB;AAkIA,OAAO,MAAMC,qBAAyC,OAAO,EAAEC,OAAO,EAAEC,OAAO,EAAE;IAC/E,MAAMC,gBAA2C;QAAE,GAAGpB,eAAe;QAAE,GAAGkB,OAAO;IAAC;IAClF,IAAI,CAACrB,kBAAkBsB,UAAU;QAC/BpB,SAASqB,eAAe;QACxB,OAAO;YACLC,OAAO,IAAIzB,SAAS,2CAA2C;YAC/D0B,QAAQC;YACRC,OAAOD;QACT;IACF,OAAO;QACL,OAAOzB,iBAAiB;YAAEoB,SAASE;YAAeD;QAAQ;IAC5D;AACF,EAAC"}
1
+ {"version":3,"file":"index.js","names":["path","APIError","isEligibleRequest","processMultipart","debugLog","DEFAULT_OPTIONS","abortOnLimit","createParentPath","debug","defParamCharset","limitHandler","parseNested","preserveExtension","responseOnLimit","safeFileNames","tempFileDir","join","process","cwd","uploadTimeout","uriDecodeFileNames","useTempFiles","fetchAPIFileUpload","options","request","uploadOptions","error","fields","undefined","files"],"sources":["../../src/fetchAPI-multipart/index.ts"],"sourcesContent":["import type { FetchAPIFileUploadOptions } from 'payload'\n\nimport path from 'path'\nimport { APIError } from 'payload'\n\nimport { isEligibleRequest } from './isEligibleRequest.js'\nimport { processMultipart } from './processMultipart.js'\nimport { debugLog } from './utilities.js'\n\nconst DEFAULT_OPTIONS: FetchAPIFileUploadOptions = {\n abortOnLimit: false,\n createParentPath: false,\n debug: false,\n defParamCharset: 'utf8',\n limitHandler: false,\n parseNested: false,\n preserveExtension: false,\n responseOnLimit: 'File size limit has been reached',\n safeFileNames: false,\n tempFileDir: path.join(process.cwd(), 'tmp'),\n uploadTimeout: 60000,\n uriDecodeFileNames: false,\n useTempFiles: false,\n}\n\nexport type FileShape = {\n data: Buffer\n encoding: string\n md5: Buffer | string\n mimetype: string\n mv: (filePath: string, callback: () => void) => Promise<void> | void\n name: string\n size: number\n tempFilePath: string\n truncated: boolean\n}\n\ntype FetchAPIFileUploadResponseFile = {\n data: Buffer\n mimetype: string\n name: string\n size: number\n tempFilePath?: string\n}\n\nexport type FetchAPIFileUploadResponse = {\n error?: APIError\n fields: Record<string, string>\n files: Record<string, FetchAPIFileUploadResponseFile>\n}\n\ntype FetchAPIFileUpload = (args: {\n options?: FetchAPIFileUploadOptions\n request: Request\n}) => Promise<FetchAPIFileUploadResponse>\nexport const fetchAPIFileUpload: FetchAPIFileUpload = async ({ options, request }) => {\n const uploadOptions: FetchAPIFileUploadOptions = { ...DEFAULT_OPTIONS, ...options }\n if (!isEligibleRequest(request)) {\n debugLog(uploadOptions, 'Request is not eligible for file upload!')\n return {\n error: new APIError('Request is not eligible for file upload', 500),\n fields: undefined,\n files: undefined,\n }\n } else {\n return processMultipart({ options: uploadOptions, request })\n }\n}\n"],"mappings":"AAEA,OAAOA,IAAA,MAAU;AACjB,SAASC,QAAQ,QAAQ;AAEzB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,QAAQ,QAAQ;AAEzB,MAAMC,eAAA,GAA6C;EACjDC,YAAA,EAAc;EACdC,gBAAA,EAAkB;EAClBC,KAAA,EAAO;EACPC,eAAA,EAAiB;EACjBC,YAAA,EAAc;EACdC,WAAA,EAAa;EACbC,iBAAA,EAAmB;EACnBC,eAAA,EAAiB;EACjBC,aAAA,EAAe;EACfC,WAAA,EAAaf,IAAA,CAAKgB,IAAI,CAACC,OAAA,CAAQC,GAAG,IAAI;EACtCC,aAAA,EAAe;EACfC,kBAAA,EAAoB;EACpBC,YAAA,EAAc;AAChB;AAgCA,OAAO,MAAMC,kBAAA,GAAyC,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAO,CAAE;EAC/E,MAAMC,aAAA,GAA2C;IAAE,GAAGpB,eAAe;IAAE,GAAGkB;EAAQ;EAClF,IAAI,CAACrB,iBAAA,CAAkBsB,OAAA,GAAU;IAC/BpB,QAAA,CAASqB,aAAA,EAAe;IACxB,OAAO;MACLC,KAAA,EAAO,IAAIzB,QAAA,CAAS,2CAA2C;MAC/D0B,MAAA,EAAQC,SAAA;MACRC,KAAA,EAAOD;IACT;EACF,OAAO;IACL,OAAOzB,gBAAA,CAAiB;MAAEoB,OAAA,EAASE,aAAA;MAAeD;IAAQ;EAC5D;AACF","ignoreList":[]}