payload 1.3.0 → 1.3.1

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 (385) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/components/index.js +1 -1
  3. package/components/styles.css +1 -1
  4. package/dist/admin/api.d.ts +1 -1
  5. package/dist/admin/components/elements/ArrayAction/types.d.ts +1 -1
  6. package/dist/admin/components/elements/Autosave/types.d.ts +1 -1
  7. package/dist/admin/components/elements/Banner/types.d.ts +3 -3
  8. package/dist/admin/components/elements/Button/index.js +19 -13
  9. package/dist/admin/components/elements/Button/index.scss +0 -16
  10. package/dist/admin/components/elements/Button/types.d.ts +3 -3
  11. package/dist/admin/components/elements/Card/types.d.ts +1 -1
  12. package/dist/admin/components/elements/Collapsible/index.scss +5 -1
  13. package/dist/admin/components/elements/Collapsible/types.d.ts +1 -1
  14. package/dist/admin/components/elements/ColumnSelector/types.d.ts +1 -1
  15. package/dist/admin/components/elements/CopyToClipboard/index.js +2 -9
  16. package/dist/admin/components/elements/CopyToClipboard/index.scss +0 -14
  17. package/dist/admin/components/elements/CopyToClipboard/types.d.ts +1 -1
  18. package/dist/admin/components/elements/DatePicker/types.d.ts +6 -6
  19. package/dist/admin/components/elements/DeleteDocument/index.js +1 -1
  20. package/dist/admin/components/elements/DeleteDocument/types.d.ts +1 -1
  21. package/dist/admin/components/elements/DocumentDrawer/index.d.ts +6 -0
  22. package/dist/admin/components/elements/DocumentDrawer/index.js +143 -0
  23. package/dist/admin/components/elements/DocumentDrawer/index.scss +36 -0
  24. package/dist/admin/components/elements/DocumentDrawer/types.d.ts +28 -0
  25. package/dist/admin/components/{forms/field-types/Relationship/AddNew/Modal → elements/DocumentDrawer}/types.js +0 -0
  26. package/dist/admin/components/elements/Drawer/index.d.ts +5 -0
  27. package/dist/admin/components/elements/Drawer/index.js +44 -0
  28. package/dist/admin/components/elements/Drawer/index.scss +86 -0
  29. package/dist/admin/components/elements/Drawer/types.d.ts +13 -0
  30. package/dist/admin/components/elements/Drawer/types.js +1 -0
  31. package/dist/admin/components/elements/DuplicateDocument/types.d.ts +1 -1
  32. package/dist/admin/components/elements/Eyebrow/types.d.ts +1 -1
  33. package/dist/admin/components/elements/FileDetails/Meta/types.d.ts +1 -1
  34. package/dist/admin/components/elements/FileDetails/types.d.ts +1 -1
  35. package/dist/admin/components/elements/GenerateConfirmation/types.d.ts +1 -1
  36. package/dist/admin/components/elements/Gutter/index.d.ts +1 -1
  37. package/dist/admin/components/elements/ListControls/types.d.ts +2 -2
  38. package/dist/admin/components/elements/Localizer/types.d.ts +1 -1
  39. package/dist/admin/components/elements/NavGroup/index.d.ts +1 -1
  40. package/dist/admin/components/elements/Paginator/ClickableArrow/types.d.ts +1 -1
  41. package/dist/admin/components/elements/Paginator/Page/types.d.ts +1 -1
  42. package/dist/admin/components/elements/Paginator/types.d.ts +2 -2
  43. package/dist/admin/components/elements/PerPage/index.d.ts +1 -1
  44. package/dist/admin/components/elements/Pill/types.d.ts +2 -2
  45. package/dist/admin/components/elements/Popup/PopupButton/types.d.ts +1 -1
  46. package/dist/admin/components/elements/Popup/types.d.ts +1 -1
  47. package/dist/admin/components/elements/PreviewButton/types.d.ts +1 -1
  48. package/dist/admin/components/elements/Publish/types.d.ts +1 -1
  49. package/dist/admin/components/elements/ReactSelect/ClearIndicator/index.d.ts +5 -0
  50. package/dist/admin/components/elements/ReactSelect/ClearIndicator/index.js +9 -0
  51. package/dist/admin/components/elements/ReactSelect/ClearIndicator/index.scss +5 -0
  52. package/dist/admin/components/elements/ReactSelect/Control/index.d.ts +4 -0
  53. package/dist/admin/components/elements/ReactSelect/Control/index.js +23 -0
  54. package/dist/admin/components/elements/ReactSelect/MultiValue/index.d.ts +5 -0
  55. package/dist/admin/components/elements/ReactSelect/MultiValue/index.js +39 -0
  56. package/dist/admin/components/elements/ReactSelect/MultiValue/index.scss +15 -0
  57. package/dist/admin/components/elements/ReactSelect/MultiValueLabel/index.d.ts +5 -0
  58. package/dist/admin/components/elements/ReactSelect/MultiValueLabel/index.js +12 -0
  59. package/dist/admin/components/elements/ReactSelect/MultiValueLabel/index.scss +15 -0
  60. package/dist/admin/components/elements/ReactSelect/MultiValueRemove/index.d.ts +5 -0
  61. package/dist/admin/components/elements/ReactSelect/MultiValueRemove/index.js +17 -0
  62. package/dist/admin/components/elements/ReactSelect/MultiValueRemove/index.scss +24 -0
  63. package/dist/admin/components/elements/ReactSelect/ValueContainer/index.d.ts +5 -0
  64. package/dist/admin/components/elements/ReactSelect/ValueContainer/index.js +9 -0
  65. package/dist/admin/components/elements/ReactSelect/ValueContainer/index.scss +33 -0
  66. package/dist/admin/components/elements/ReactSelect/index.js +58 -44
  67. package/dist/admin/components/elements/ReactSelect/index.scss +6 -62
  68. package/dist/admin/components/elements/ReactSelect/types.d.ts +14 -3
  69. package/dist/admin/components/elements/RenderTitle/types.d.ts +1 -1
  70. package/dist/admin/components/elements/SearchFilter/types.d.ts +1 -1
  71. package/dist/admin/components/elements/SortColumn/types.d.ts +1 -1
  72. package/dist/admin/components/elements/SortComplex/types.d.ts +1 -1
  73. package/dist/admin/components/elements/Status/types.d.ts +1 -1
  74. package/dist/admin/components/elements/StepNav/index.js +4 -1
  75. package/dist/admin/components/elements/StepNav/types.d.ts +2 -2
  76. package/dist/admin/components/elements/Table/types.d.ts +2 -2
  77. package/dist/admin/components/elements/Thumbnail/types.d.ts +1 -1
  78. package/dist/admin/components/elements/Tooltip/index.js +24 -9
  79. package/dist/admin/components/elements/Tooltip/index.scss +25 -11
  80. package/dist/admin/components/elements/Tooltip/types.d.ts +3 -1
  81. package/dist/admin/components/elements/UploadCard/types.d.ts +1 -1
  82. package/dist/admin/components/elements/UploadGallery/types.d.ts +1 -1
  83. package/dist/admin/components/elements/VersionsCount/types.d.ts +1 -1
  84. package/dist/admin/components/elements/ViewDescription/types.d.ts +4 -4
  85. package/dist/admin/components/elements/WhereBuilder/Condition/Date/types.d.ts +1 -1
  86. package/dist/admin/components/elements/WhereBuilder/Condition/Number/types.d.ts +1 -1
  87. package/dist/admin/components/elements/WhereBuilder/Condition/Relationship/types.d.ts +7 -7
  88. package/dist/admin/components/elements/WhereBuilder/Condition/Text/types.d.ts +1 -1
  89. package/dist/admin/components/elements/WhereBuilder/Condition/types.d.ts +1 -1
  90. package/dist/admin/components/elements/WhereBuilder/types.d.ts +8 -8
  91. package/dist/admin/components/forms/Error/index.js +1 -1
  92. package/dist/admin/components/forms/Error/types.d.ts +1 -1
  93. package/dist/admin/components/forms/FieldDescription/types.d.ts +4 -4
  94. package/dist/admin/components/forms/Form/buildStateFromSchema/addFieldStatePromise.d.ts +1 -1
  95. package/dist/admin/components/forms/Form/buildStateFromSchema/index.d.ts +1 -1
  96. package/dist/admin/components/forms/Form/buildStateFromSchema/iterateFields.d.ts +1 -1
  97. package/dist/admin/components/forms/Form/rows.d.ts +1 -1
  98. package/dist/admin/components/forms/Form/types.d.ts +30 -30
  99. package/dist/admin/components/forms/Label/types.d.ts +1 -1
  100. package/dist/admin/components/forms/RenderFields/types.d.ts +1 -1
  101. package/dist/admin/components/forms/RowLabel/types.d.ts +5 -5
  102. package/dist/admin/components/forms/field-types/Array/index.js +1 -1
  103. package/dist/admin/components/forms/field-types/Array/index.scss +0 -4
  104. package/dist/admin/components/forms/field-types/Array/types.d.ts +1 -1
  105. package/dist/admin/components/forms/field-types/Blocks/BlockSelector/BlockSelection/types.d.ts +1 -1
  106. package/dist/admin/components/forms/field-types/Blocks/BlockSelector/BlocksContainer/types.d.ts +1 -1
  107. package/dist/admin/components/forms/field-types/Blocks/BlockSelector/types.d.ts +1 -1
  108. package/dist/admin/components/forms/field-types/Blocks/SectionTitle/types.d.ts +1 -1
  109. package/dist/admin/components/forms/field-types/Blocks/index.scss +0 -4
  110. package/dist/admin/components/forms/field-types/Blocks/types.d.ts +1 -1
  111. package/dist/admin/components/forms/field-types/Checkbox/types.d.ts +1 -1
  112. package/dist/admin/components/forms/field-types/Code/types.d.ts +1 -1
  113. package/dist/admin/components/forms/field-types/Collapsible/index.scss +0 -4
  114. package/dist/admin/components/forms/field-types/Collapsible/types.d.ts +1 -1
  115. package/dist/admin/components/forms/field-types/DateTime/index.js +4 -1
  116. package/dist/admin/components/forms/field-types/DateTime/types.d.ts +1 -1
  117. package/dist/admin/components/forms/field-types/Email/types.d.ts +1 -1
  118. package/dist/admin/components/forms/field-types/Group/types.d.ts +1 -1
  119. package/dist/admin/components/forms/field-types/HiddenInput/types.d.ts +1 -1
  120. package/dist/admin/components/forms/field-types/Number/types.d.ts +1 -1
  121. package/dist/admin/components/forms/field-types/Password/types.d.ts +1 -1
  122. package/dist/admin/components/forms/field-types/Point/types.d.ts +1 -1
  123. package/dist/admin/components/forms/field-types/RadioGroup/Input.d.ts +1 -1
  124. package/dist/admin/components/forms/field-types/RadioGroup/RadioInput/types.d.ts +1 -1
  125. package/dist/admin/components/forms/field-types/RadioGroup/types.d.ts +2 -2
  126. package/dist/admin/components/forms/field-types/Relationship/AddNew/index.js +55 -35
  127. package/dist/admin/components/forms/field-types/Relationship/AddNew/index.scss +6 -18
  128. package/dist/admin/components/forms/field-types/Relationship/AddNew/types.d.ts +1 -1
  129. package/dist/admin/components/forms/field-types/Relationship/AddNew/useRelatedCollections.js +5 -2
  130. package/dist/admin/components/forms/field-types/Relationship/GetFilterOptions/index.d.ts +1 -1
  131. package/dist/admin/components/forms/field-types/Relationship/createRelationMap.d.ts +2 -2
  132. package/dist/admin/components/forms/field-types/Relationship/findOptionsByValue.d.ts +1 -1
  133. package/dist/admin/components/forms/field-types/Relationship/index.js +11 -1
  134. package/dist/admin/components/forms/field-types/Relationship/select-components/MultiValueLabel/index.d.ts +5 -0
  135. package/dist/admin/components/forms/field-types/Relationship/select-components/MultiValueLabel/index.js +36 -0
  136. package/dist/admin/components/forms/field-types/Relationship/select-components/MultiValueLabel/index.scss +40 -0
  137. package/dist/admin/components/forms/field-types/Relationship/select-components/SingleValue/index.d.ts +5 -0
  138. package/dist/admin/components/forms/field-types/Relationship/select-components/SingleValue/index.js +34 -0
  139. package/dist/admin/components/forms/field-types/Relationship/select-components/SingleValue/index.scss +43 -0
  140. package/dist/admin/components/forms/field-types/Relationship/types.d.ts +10 -10
  141. package/dist/admin/components/forms/field-types/RichText/RichText.d.ts +2 -2
  142. package/dist/admin/components/forms/field-types/RichText/elements/link/Modal/types.d.ts +1 -1
  143. package/dist/admin/components/forms/field-types/RichText/elements/relationship/Element/index.js +3 -2
  144. package/dist/admin/components/forms/field-types/RichText/elements/types.d.ts +1 -1
  145. package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/EditModal/index.d.ts +1 -1
  146. package/dist/admin/components/forms/field-types/RichText/elements/upload/Element/SwapUploadModal/index.d.ts +1 -1
  147. package/dist/admin/components/forms/field-types/RichText/types.d.ts +1 -1
  148. package/dist/admin/components/forms/field-types/Row/types.d.ts +1 -1
  149. package/dist/admin/components/forms/field-types/Select/Input.d.ts +1 -1
  150. package/dist/admin/components/forms/field-types/Select/types.d.ts +1 -1
  151. package/dist/admin/components/forms/field-types/Tabs/types.d.ts +1 -1
  152. package/dist/admin/components/forms/field-types/Text/Input.d.ts +1 -1
  153. package/dist/admin/components/forms/field-types/Text/types.d.ts +1 -1
  154. package/dist/admin/components/forms/field-types/Textarea/Input.d.ts +1 -1
  155. package/dist/admin/components/forms/field-types/Textarea/types.d.ts +1 -1
  156. package/dist/admin/components/forms/field-types/Upload/Add/types.d.ts +1 -1
  157. package/dist/admin/components/forms/field-types/Upload/Input.d.ts +1 -1
  158. package/dist/admin/components/forms/field-types/Upload/SelectExisting/types.d.ts +1 -1
  159. package/dist/admin/components/forms/field-types/Upload/types.d.ts +1 -1
  160. package/dist/admin/components/forms/field-types/index.d.ts +1 -1
  161. package/dist/admin/components/forms/field-types/rowReducer.d.ts +8 -8
  162. package/dist/admin/components/forms/useField/types.d.ts +2 -2
  163. package/dist/admin/components/modals/StayLoggedIn/types.d.ts +1 -1
  164. package/dist/admin/components/templates/Default/types.d.ts +1 -1
  165. package/dist/admin/components/templates/Minimal/types.d.ts +1 -1
  166. package/dist/admin/components/utilities/Auth/index.d.ts +1 -1
  167. package/dist/admin/components/utilities/Auth/types.d.ts +1 -1
  168. package/dist/admin/components/utilities/DocumentInfo/index.d.ts +0 -2
  169. package/dist/admin/components/utilities/DocumentInfo/index.js +30 -1
  170. package/dist/admin/components/utilities/DocumentInfo/types.d.ts +9 -4
  171. package/dist/admin/components/utilities/Meta/types.d.ts +2 -2
  172. package/dist/admin/components/utilities/OperationProvider/index.d.ts +1 -1
  173. package/dist/admin/components/utilities/Preferences/index.d.ts +1 -1
  174. package/dist/admin/components/utilities/RenderCustomComponent/types.d.ts +1 -1
  175. package/dist/admin/components/utilities/Theme/index.d.ts +2 -2
  176. package/dist/admin/components/views/Account/types.d.ts +1 -1
  177. package/dist/admin/components/views/CreateFirstUser/types.d.ts +1 -1
  178. package/dist/admin/components/views/Dashboard/types.d.ts +1 -1
  179. package/dist/admin/components/views/Global/index.js +8 -8
  180. package/dist/admin/components/views/Global/types.d.ts +2 -2
  181. package/dist/admin/components/views/Version/Compare/types.d.ts +5 -5
  182. package/dist/admin/components/views/Version/RenderFieldsToDiff/fields/types.d.ts +2 -2
  183. package/dist/admin/components/views/Version/RenderFieldsToDiff/types.d.ts +1 -1
  184. package/dist/admin/components/views/Version/Restore/types.d.ts +1 -1
  185. package/dist/admin/components/views/Version/SelectLocales/types.d.ts +1 -1
  186. package/dist/admin/components/views/Version/types.d.ts +3 -3
  187. package/dist/admin/components/views/Versions/types.d.ts +1 -1
  188. package/dist/admin/components/views/collections/Edit/Auth/types.d.ts +1 -1
  189. package/dist/admin/components/views/collections/Edit/Upload/types.d.ts +2 -2
  190. package/dist/admin/components/views/collections/Edit/index.js +8 -8
  191. package/dist/admin/components/views/collections/Edit/index.scss +6 -3
  192. package/dist/admin/components/views/collections/Edit/types.d.ts +2 -2
  193. package/dist/admin/components/views/collections/List/Cell/cellTypes.spec.js +11 -2
  194. package/dist/admin/components/views/collections/List/Cell/field-types/Array/index.d.ts +1 -1
  195. package/dist/admin/components/views/collections/List/Cell/field-types/Blocks/index.d.ts +1 -1
  196. package/dist/admin/components/views/collections/List/Cell/field-types/Date/index.d.ts +2 -1
  197. package/dist/admin/components/views/collections/List/Cell/field-types/Date/index.js +4 -2
  198. package/dist/admin/components/views/collections/List/Cell/field-types/Select/index.d.ts +1 -1
  199. package/dist/admin/components/views/collections/List/Cell/field-types/index.d.ts +2 -1
  200. package/dist/admin/components/views/collections/List/Cell/types.d.ts +1 -1
  201. package/dist/admin/components/views/collections/List/RelationshipProvider/index.d.ts +2 -2
  202. package/dist/admin/components/views/collections/List/RelationshipProvider/reducer.d.ts +3 -3
  203. package/dist/admin/components/views/collections/List/types.d.ts +3 -3
  204. package/dist/admin/hooks/useIntersect.d.ts +1 -1
  205. package/dist/admin/hooks/usePayloadAPI.d.ts +3 -3
  206. package/dist/admin/hooks/useThrottledEffect.d.ts +1 -1
  207. package/dist/admin/scss/type.scss +1 -1
  208. package/dist/admin/utilities/groupNavItems.d.ts +2 -2
  209. package/dist/auth/operations/access.d.ts +3 -3
  210. package/dist/auth/operations/access.js +24 -75
  211. package/dist/auth/operations/forgotPassword.d.ts +2 -2
  212. package/dist/auth/operations/local/forgotPassword.d.ts +1 -1
  213. package/dist/auth/operations/local/login.d.ts +1 -1
  214. package/dist/auth/operations/local/resetPassword.d.ts +1 -1
  215. package/dist/auth/operations/local/unlock.d.ts +1 -1
  216. package/dist/auth/operations/local/verifyEmail.d.ts +1 -1
  217. package/dist/auth/operations/login.d.ts +2 -2
  218. package/dist/auth/operations/logout.d.ts +1 -1
  219. package/dist/auth/operations/me.d.ts +2 -2
  220. package/dist/auth/operations/refresh.d.ts +2 -2
  221. package/dist/auth/operations/registerFirstUser.d.ts +2 -2
  222. package/dist/auth/operations/resetPassword.d.ts +2 -2
  223. package/dist/auth/operations/unlock.d.ts +1 -1
  224. package/dist/auth/operations/verifyEmail.d.ts +1 -1
  225. package/dist/auth/sendVerificationEmail.d.ts +1 -1
  226. package/dist/auth/types.d.ts +20 -14
  227. package/dist/auth/types.js +1 -1
  228. package/dist/collections/buildEndpoints.js +7 -1
  229. package/dist/collections/config/types.d.ts +26 -26
  230. package/dist/collections/graphql/init.js +15 -1
  231. package/dist/collections/graphql/resolvers/create.d.ts +1 -1
  232. package/dist/collections/graphql/resolvers/delete.d.ts +1 -1
  233. package/dist/collections/graphql/resolvers/docAccess.d.ts +9 -0
  234. package/dist/collections/graphql/resolvers/docAccess.js +15 -0
  235. package/dist/collections/graphql/resolvers/find.d.ts +1 -1
  236. package/dist/collections/graphql/resolvers/findByID.d.ts +1 -1
  237. package/dist/collections/graphql/resolvers/findVersionByID.d.ts +1 -1
  238. package/dist/collections/graphql/resolvers/findVersions.d.ts +1 -1
  239. package/dist/collections/graphql/resolvers/restoreVersion.d.ts +1 -1
  240. package/dist/collections/graphql/resolvers/update.d.ts +1 -1
  241. package/dist/collections/graphql/types.d.ts +1 -1
  242. package/dist/collections/init.js +2 -1
  243. package/dist/collections/operations/create.d.ts +1 -1
  244. package/dist/collections/operations/delete.d.ts +1 -1
  245. package/dist/collections/operations/docAccess.d.ts +8 -0
  246. package/dist/collections/operations/docAccess.js +26 -0
  247. package/dist/collections/operations/find.d.ts +1 -1
  248. package/dist/collections/operations/findByID.d.ts +1 -1
  249. package/dist/collections/operations/findVersionByID.d.ts +1 -1
  250. package/dist/collections/operations/findVersions.d.ts +1 -1
  251. package/dist/collections/operations/local/create.d.ts +1 -1
  252. package/dist/collections/operations/local/delete.d.ts +1 -1
  253. package/dist/collections/operations/local/find.d.ts +1 -1
  254. package/dist/collections/operations/local/findByID.d.ts +1 -1
  255. package/dist/collections/operations/local/findVersionByID.d.ts +1 -1
  256. package/dist/collections/operations/local/findVersions.d.ts +1 -1
  257. package/dist/collections/operations/local/restoreVersion.d.ts +1 -1
  258. package/dist/collections/operations/local/update.d.ts +1 -1
  259. package/dist/collections/operations/restoreVersion.d.ts +1 -1
  260. package/dist/collections/operations/update.d.ts +1 -1
  261. package/dist/collections/requestHandlers/create.d.ts +1 -1
  262. package/dist/collections/requestHandlers/delete.d.ts +1 -1
  263. package/dist/collections/requestHandlers/docAccess.d.ts +4 -0
  264. package/dist/collections/requestHandlers/docAccess.js +21 -0
  265. package/dist/collections/requestHandlers/findByID.d.ts +1 -1
  266. package/dist/collections/requestHandlers/findVersionByID.d.ts +1 -1
  267. package/dist/collections/requestHandlers/restoreVersion.d.ts +1 -1
  268. package/dist/collections/requestHandlers/update.d.ts +1 -1
  269. package/dist/config/types.d.ts +18 -18
  270. package/dist/email/types.d.ts +3 -3
  271. package/dist/express/middleware/authenticate.d.ts +1 -1
  272. package/dist/express/middleware/errorHandler.d.ts +1 -1
  273. package/dist/express/responses/formatError.d.ts +1 -1
  274. package/dist/fields/config/types.d.ts +58 -57
  275. package/dist/fields/config/types.js +1 -1
  276. package/dist/fields/getDefaultValue.d.ts +1 -1
  277. package/dist/fields/hooks/afterChange/index.d.ts +1 -1
  278. package/dist/fields/hooks/afterChange/promise.d.ts +1 -1
  279. package/dist/fields/hooks/afterChange/traverseFields.d.ts +1 -1
  280. package/dist/fields/hooks/afterRead/index.d.ts +1 -1
  281. package/dist/fields/hooks/afterRead/promise.d.ts +1 -1
  282. package/dist/fields/hooks/afterRead/relationshipPopulationPromise.d.ts +1 -1
  283. package/dist/fields/hooks/afterRead/traverseFields.d.ts +1 -1
  284. package/dist/fields/hooks/beforeChange/index.d.ts +1 -1
  285. package/dist/fields/hooks/beforeChange/promise.d.ts +1 -1
  286. package/dist/fields/hooks/beforeChange/promise.js +1 -7
  287. package/dist/fields/hooks/beforeChange/traverseFields.d.ts +1 -1
  288. package/dist/fields/hooks/beforeValidate/index.d.ts +1 -1
  289. package/dist/fields/hooks/beforeValidate/promise.d.ts +1 -1
  290. package/dist/fields/hooks/beforeValidate/traverseFields.d.ts +1 -1
  291. package/dist/fields/richText/populate.d.ts +1 -1
  292. package/dist/fields/richText/recurseNestedFields.d.ts +1 -1
  293. package/dist/fields/richText/richTextRelationshipPromise.d.ts +2 -2
  294. package/dist/globals/buildEndpoints.js +8 -2
  295. package/dist/globals/config/types.d.ts +11 -11
  296. package/dist/globals/graphql/init.js +12 -1
  297. package/dist/globals/graphql/resolvers/docAccess.d.ts +8 -0
  298. package/dist/globals/graphql/resolvers/docAccess.js +15 -0
  299. package/dist/globals/graphql/resolvers/findVersionByID.d.ts +1 -1
  300. package/dist/globals/graphql/resolvers/findVersions.d.ts +1 -1
  301. package/dist/globals/graphql/resolvers/restoreVersion.d.ts +1 -1
  302. package/dist/globals/graphql/resolvers/update.d.ts +1 -1
  303. package/dist/globals/init.js +2 -1
  304. package/dist/globals/operations/docAccess.d.ts +9 -0
  305. package/dist/globals/operations/docAccess.js +21 -0
  306. package/dist/globals/operations/findOne.d.ts +1 -1
  307. package/dist/globals/operations/findVersionByID.d.ts +1 -1
  308. package/dist/globals/operations/findVersions.d.ts +1 -1
  309. package/dist/globals/operations/local/findOne.d.ts +1 -1
  310. package/dist/globals/operations/local/findVersionByID.d.ts +1 -1
  311. package/dist/globals/operations/local/findVersions.d.ts +1 -1
  312. package/dist/globals/operations/local/restoreVersion.d.ts +1 -1
  313. package/dist/globals/operations/local/update.d.ts +1 -1
  314. package/dist/globals/operations/restoreVersion.d.ts +1 -1
  315. package/dist/globals/operations/update.d.ts +1 -1
  316. package/dist/globals/requestHandlers/docAccess.d.ts +5 -0
  317. package/dist/globals/requestHandlers/docAccess.js +21 -0
  318. package/dist/globals/requestHandlers/findOne.d.ts +2 -2
  319. package/dist/globals/requestHandlers/update.d.ts +2 -2
  320. package/dist/graphql/schema/buildBlockType.d.ts +1 -1
  321. package/dist/graphql/schema/buildMutationInputType.d.ts +1 -1
  322. package/dist/graphql/schema/buildObjectType.d.ts +2 -2
  323. package/dist/graphql/schema/buildPoliciesType.d.ts +28 -0
  324. package/dist/graphql/schema/buildPoliciesType.js +63 -27
  325. package/dist/mongoose/buildSchema.d.ts +1 -1
  326. package/dist/mongoose/buildSchema.js +7 -1
  327. package/dist/mongoose/buildSortParam.d.ts +1 -1
  328. package/dist/mongoose/getLocalizedSortProperty.d.ts +1 -1
  329. package/dist/mongoose/types.d.ts +1 -1
  330. package/dist/preferences/requestHandlers/update.d.ts +2 -2
  331. package/dist/preferences/types.d.ts +8 -8
  332. package/dist/translations/de.json +2 -0
  333. package/dist/translations/en.json +2 -0
  334. package/dist/translations/es.json +2 -0
  335. package/dist/translations/fr.json +2 -0
  336. package/dist/translations/index.d.ts +32 -0
  337. package/dist/translations/it.json +2 -0
  338. package/dist/translations/ja.json +2 -0
  339. package/dist/translations/my.json +2 -0
  340. package/dist/translations/nb.json +2 -0
  341. package/dist/translations/nl.json +2 -0
  342. package/dist/translations/pl.json +2 -0
  343. package/dist/translations/pt.json +2 -0
  344. package/dist/translations/ru.json +2 -0
  345. package/dist/translations/sv.json +2 -0
  346. package/dist/translations/th.json +80 -78
  347. package/dist/translations/tr.json +2 -0
  348. package/dist/translations/type.d.ts +1 -1
  349. package/dist/translations/vi.json +2 -0
  350. package/dist/types/index.d.ts +8 -5
  351. package/dist/types/index.js +1 -1
  352. package/dist/uploads/generateFileData.d.ts +2 -2
  353. package/dist/uploads/getBaseFields.d.ts +1 -1
  354. package/dist/uploads/getImageSize.d.ts +1 -1
  355. package/dist/uploads/imageResizer.d.ts +2 -2
  356. package/dist/uploads/types.d.ts +10 -10
  357. package/dist/utilities/getEntityPolicies.d.ts +19 -0
  358. package/dist/utilities/getEntityPolicies.js +156 -0
  359. package/dist/utilities/logger.d.ts +1 -1
  360. package/dist/utilities/telemetry/events/adminInit.d.ts +1 -1
  361. package/dist/utilities/telemetry/events/serverInit.d.ts +1 -1
  362. package/dist/utilities/telemetry/index.d.ts +4 -4
  363. package/dist/versions/cleanUpFailedVersion.d.ts +1 -1
  364. package/dist/versions/drafts/replaceWithDraftIfAvailable.d.ts +1 -1
  365. package/dist/versions/drafts/saveCollectionDraft.d.ts +1 -1
  366. package/dist/versions/drafts/saveGlobalDraft.d.ts +1 -1
  367. package/dist/versions/enforceMaxVersions.d.ts +1 -1
  368. package/dist/versions/ensurePublishedCollectionVersion.d.ts +1 -1
  369. package/dist/versions/ensurePublishedGlobalVersion.d.ts +1 -1
  370. package/dist/versions/getLatestCollectionVersion.d.ts +1 -1
  371. package/dist/versions/getLatestGlobalVersion.d.ts +1 -1
  372. package/dist/versions/saveCollectionVersion.d.ts +1 -1
  373. package/dist/versions/saveGlobalVersion.d.ts +1 -1
  374. package/dist/versions/shouldIncrementVersionCount.d.ts +1 -1
  375. package/dist/versions/types.d.ts +7 -7
  376. package/docs/admin/hooks.mdx +19 -17
  377. package/docs/authentication/operations.mdx +2 -0
  378. package/docs/graphql/overview.mdx +1 -1
  379. package/package.json +4 -3
  380. package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.d.ts +0 -4
  381. package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.js +0 -69
  382. package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/index.scss +0 -117
  383. package/dist/admin/components/forms/field-types/Relationship/AddNew/Modal/types.d.ts +0 -6
  384. package/dist/utilities/arrayMove.d.ts +0 -1
  385. package/dist/utilities/arrayMove.js +0 -10
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEntityPolicies = void 0;
4
+ const types_1 = require("../fields/config/types");
5
+ function getEntityPolicies(args) {
6
+ const { req, entity, operations, id, type } = args;
7
+ const isLoggedIn = !!(req.user);
8
+ // ---- ---- ---- ---- ---- ---- ---- ---- ----
9
+ // `policies` and `promises` get mutated in
10
+ // the functions below, and return in the end
11
+ // ---- ---- ---- ---- ---- ---- ---- ---- ----
12
+ const policies = {
13
+ fields: {},
14
+ };
15
+ const promises = [];
16
+ let docBeingAccessed;
17
+ async function getEntityDoc({ where } = {}) {
18
+ var _a;
19
+ if (entity.slug) {
20
+ if (type === 'global') {
21
+ return req.payload.findGlobal({
22
+ overrideAccess: true,
23
+ slug: entity.slug,
24
+ });
25
+ }
26
+ if (type === 'collection' && id) {
27
+ if (typeof where === 'object') {
28
+ const paginatedRes = await req.payload.find({
29
+ overrideAccess: true,
30
+ collection: entity.slug,
31
+ where: {
32
+ ...where,
33
+ and: [
34
+ ...where.and || [],
35
+ {
36
+ id: {
37
+ equals: id,
38
+ },
39
+ },
40
+ ],
41
+ },
42
+ limit: 1,
43
+ });
44
+ return ((_a = paginatedRes === null || paginatedRes === void 0 ? void 0 : paginatedRes.docs) === null || _a === void 0 ? void 0 : _a[0]) || undefined;
45
+ }
46
+ return req.payload.findByID({
47
+ overrideAccess: true,
48
+ collection: entity.slug,
49
+ id,
50
+ });
51
+ }
52
+ }
53
+ return undefined;
54
+ }
55
+ const createAccessPromise = async ({ policiesObj, access, operation, disableWhere = false, accessLevel, }) => {
56
+ var _a;
57
+ const mutablePolicies = policiesObj;
58
+ if (accessLevel === 'field' && docBeingAccessed === undefined) {
59
+ docBeingAccessed = await getEntityDoc();
60
+ }
61
+ const accessResult = await access({ req, id, doc: docBeingAccessed });
62
+ if (typeof accessResult === 'object' && !disableWhere) {
63
+ mutablePolicies[operation] = {
64
+ permission: !!(await getEntityDoc({ where: accessResult })),
65
+ where: accessResult,
66
+ };
67
+ }
68
+ else if (((_a = mutablePolicies[operation]) === null || _a === void 0 ? void 0 : _a.permission) !== false) {
69
+ mutablePolicies[operation] = {
70
+ permission: !!(accessResult),
71
+ };
72
+ }
73
+ };
74
+ const executeFieldPolicies = ({ policiesObj = {}, fields, operation, }) => {
75
+ const mutablePolicies = policiesObj;
76
+ fields.forEach((field) => {
77
+ if (field.name) {
78
+ if (!mutablePolicies[field.name])
79
+ mutablePolicies[field.name] = {};
80
+ if (field.access && typeof field.access[operation] === 'function') {
81
+ promises.push(createAccessPromise({
82
+ policiesObj: mutablePolicies[field.name],
83
+ access: field.access[operation],
84
+ operation,
85
+ disableWhere: true,
86
+ accessLevel: 'field',
87
+ }));
88
+ }
89
+ else {
90
+ mutablePolicies[field.name][operation] = {
91
+ permission: isLoggedIn,
92
+ };
93
+ }
94
+ if (field.fields) {
95
+ if (!mutablePolicies[field.name].fields)
96
+ mutablePolicies[field.name].fields = {};
97
+ executeFieldPolicies({
98
+ policiesObj: mutablePolicies[field.name].fields,
99
+ fields: field.fields,
100
+ operation,
101
+ });
102
+ }
103
+ }
104
+ else if (field.fields) {
105
+ executeFieldPolicies({
106
+ policiesObj: mutablePolicies,
107
+ fields: field.fields,
108
+ operation,
109
+ });
110
+ }
111
+ else if (field.type === 'tabs') {
112
+ field.tabs.forEach((tab) => {
113
+ if ((0, types_1.tabHasName)(tab)) {
114
+ if (!mutablePolicies[tab.name])
115
+ mutablePolicies[tab.name] = { fields: {} };
116
+ executeFieldPolicies({
117
+ policiesObj: mutablePolicies[tab.name].fields,
118
+ fields: tab.fields,
119
+ operation,
120
+ });
121
+ }
122
+ else {
123
+ executeFieldPolicies({
124
+ policiesObj: mutablePolicies,
125
+ fields: tab.fields,
126
+ operation,
127
+ });
128
+ }
129
+ });
130
+ }
131
+ });
132
+ };
133
+ operations.forEach((operation) => {
134
+ executeFieldPolicies({
135
+ policiesObj: policies.fields,
136
+ fields: entity.fields,
137
+ operation,
138
+ });
139
+ if (typeof entity.access[operation] === 'function') {
140
+ promises.push(createAccessPromise({
141
+ policiesObj: policies,
142
+ access: entity.access[operation],
143
+ operation,
144
+ accessLevel: 'entity',
145
+ }));
146
+ }
147
+ else {
148
+ policies[operation] = {
149
+ permission: isLoggedIn,
150
+ };
151
+ }
152
+ });
153
+ return [policies, promises];
154
+ }
155
+ exports.getEntityPolicies = getEntityPolicies;
156
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0RW50aXR5UG9saWNpZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbGl0aWVzL2dldEVudGl0eVBvbGljaWVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUVBLGtEQ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TLENBQUM7Z0JBQ2hDLFNBQVM7Z0JBQ1QsV0FBVyxFQUFFLFFBQVE7YUFDdEIsQ0FBQyxDQUFDLENBQUM7U0FDTDthQUFNO1lBQ0wsUUFBUSxDQUFDLFNBQVMsQ0FBQyxHQUFHO2dCQUNwQixVQUFVLEVBQUUsVUFBVTthQUN2QixDQUFDO1NBQ0g7SUFDSCxDQUFDLENBQUMsQ0FBQztJQUVILE9BQU8sQ0FBQyxRQUFRLEVBQUUsUUFBUSxDQUFrQixDQUFDO0FBQy9DLENBQUM7QUFuS0QsOENBbUtDIn0=
@@ -1,4 +1,4 @@
1
1
  import pino from 'pino';
2
- export declare type PayloadLogger = pino.Logger;
2
+ export type PayloadLogger = pino.Logger;
3
3
  declare const _default: import("micro-memoize").MicroMemoize.Memoized<(name?: string, options?: pino.LoggerOptions) => pino.Logger>;
4
4
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import { PayloadRequest } from '../../../express/types';
2
- export declare type AdminInitEvent = {
2
+ export type AdminInitEvent = {
3
3
  type: 'admin-init';
4
4
  domainID?: string;
5
5
  userID?: string;
@@ -1,5 +1,5 @@
1
1
  import { Payload } from '../../..';
2
- export declare type ServerInitEvent = {
2
+ export type ServerInitEvent = {
3
3
  type: 'server-init';
4
4
  };
5
5
  export declare const serverInit: (payload: Payload) => void;
@@ -1,19 +1,19 @@
1
1
  import { Payload } from '../../index';
2
2
  import { ServerInitEvent } from './events/serverInit';
3
3
  import { AdminInitEvent } from './events/adminInit';
4
- export declare type BaseEvent = {
4
+ export type BaseEvent = {
5
5
  envID: string;
6
6
  projectID: string;
7
7
  nodeVersion: string;
8
8
  nodeEnv: string;
9
9
  payloadVersion: string;
10
10
  };
11
- declare type PackageJSON = {
11
+ type PackageJSON = {
12
12
  name: string;
13
13
  dependencies: Record<string, string | undefined>;
14
14
  };
15
- declare type TelemetryEvent = ServerInitEvent | AdminInitEvent;
16
- declare type Args = {
15
+ type TelemetryEvent = ServerInitEvent | AdminInitEvent;
16
+ type Args = {
17
17
  payload: Payload;
18
18
  event: TelemetryEvent;
19
19
  };
@@ -2,7 +2,7 @@ import { Payload } from '..';
2
2
  import { SanitizedCollectionConfig } from '../collections/config/types';
3
3
  import { SanitizedGlobalConfig } from '../globals/config/types';
4
4
  import { TypeWithVersion } from './types';
5
- declare type Args = {
5
+ type Args = {
6
6
  payload: Payload;
7
7
  entityConfig: SanitizedCollectionConfig | SanitizedGlobalConfig;
8
8
  version: TypeWithVersion<any>;
@@ -2,7 +2,7 @@ import { Payload } from '../..';
2
2
  import { AccessResult } from '../../config/types';
3
3
  import { SanitizedCollectionConfig, TypeWithID } from '../../collections/config/types';
4
4
  import { SanitizedGlobalConfig } from '../../globals/config/types';
5
- declare type Arguments<T> = {
5
+ type Arguments<T> = {
6
6
  payload: Payload;
7
7
  entity: SanitizedCollectionConfig | SanitizedGlobalConfig;
8
8
  entityType: 'collection' | 'global';
@@ -1,7 +1,7 @@
1
1
  import { Payload } from '../..';
2
2
  import { SanitizedCollectionConfig } from '../../collections/config/types';
3
3
  import { PayloadRequest } from '../../express/types';
4
- declare type Args = {
4
+ type Args = {
5
5
  payload: Payload;
6
6
  config?: SanitizedCollectionConfig;
7
7
  req: PayloadRequest;
@@ -1,6 +1,6 @@
1
1
  import { Payload } from '../..';
2
2
  import { SanitizedGlobalConfig } from '../../globals/config/types';
3
- declare type Args = {
3
+ type Args = {
4
4
  payload: Payload;
5
5
  config?: SanitizedGlobalConfig;
6
6
  data: any;
@@ -1,6 +1,6 @@
1
1
  import { Payload } from '..';
2
2
  import { CollectionModel } from '../collections/config/types';
3
- declare type Args = {
3
+ type Args = {
4
4
  payload: Payload;
5
5
  Model: CollectionModel;
6
6
  max: number;
@@ -1,7 +1,7 @@
1
1
  import { Payload } from '..';
2
2
  import { SanitizedCollectionConfig } from '../collections/config/types';
3
3
  import { PayloadRequest } from '../express/types';
4
- declare type Args = {
4
+ type Args = {
5
5
  payload: Payload;
6
6
  config?: SanitizedCollectionConfig;
7
7
  req: PayloadRequest;
@@ -1,7 +1,7 @@
1
1
  import { Payload } from '..';
2
2
  import { PayloadRequest } from '../express/types';
3
3
  import { SanitizedGlobalConfig } from '../globals/config/types';
4
- declare type Args = {
4
+ type Args = {
5
5
  payload: Payload;
6
6
  config?: SanitizedGlobalConfig;
7
7
  req: PayloadRequest;
@@ -1,6 +1,6 @@
1
1
  import { Payload } from '..';
2
2
  import { Collection, TypeWithID } from '../collections/config/types';
3
- declare type Args = {
3
+ type Args = {
4
4
  payload: Payload;
5
5
  collection: Collection;
6
6
  query: Record<string, unknown>;
@@ -1,7 +1,7 @@
1
1
  import { Payload } from '..';
2
2
  import { TypeWithID } from '../collections/config/types';
3
3
  import { SanitizedGlobalConfig } from '../globals/config/types';
4
- declare type Args = {
4
+ type Args = {
5
5
  payload: Payload;
6
6
  config: SanitizedGlobalConfig;
7
7
  query: Record<string, unknown>;
@@ -1,7 +1,7 @@
1
1
  import { Payload } from '..';
2
2
  import { SanitizedCollectionConfig } from '../collections/config/types';
3
3
  import { PayloadRequest } from '../express/types';
4
- declare type Args = {
4
+ type Args = {
5
5
  payload: Payload;
6
6
  config?: SanitizedCollectionConfig;
7
7
  req: PayloadRequest;
@@ -1,7 +1,7 @@
1
1
  import { Payload } from '..';
2
2
  import { PayloadRequest } from '../express/types';
3
3
  import { SanitizedGlobalConfig } from '../globals/config/types';
4
- declare type Args = {
4
+ type Args = {
5
5
  payload: Payload;
6
6
  config?: SanitizedGlobalConfig;
7
7
  req: PayloadRequest;
@@ -1,7 +1,7 @@
1
1
  import { SanitizedCollectionConfig } from '../collections/config/types';
2
2
  import { SanitizedGlobalConfig } from '../globals/config/types';
3
3
  import { PaginatedDocs } from '../mongoose/types';
4
- declare type ShouldIncrementVersionCount = (args: {
4
+ type ShouldIncrementVersionCount = (args: {
5
5
  entity: SanitizedGlobalConfig | SanitizedCollectionConfig;
6
6
  versions: PaginatedDocs<{
7
7
  version?: {
@@ -1,13 +1,13 @@
1
- export declare type Autosave = {
1
+ export type Autosave = {
2
2
  interval?: number;
3
3
  };
4
- export declare type IncomingDrafts = {
4
+ export type IncomingDrafts = {
5
5
  autosave?: boolean | Autosave;
6
6
  };
7
- export declare type SanitizedDrafts = {
7
+ export type SanitizedDrafts = {
8
8
  autosave: false | Autosave;
9
9
  };
10
- export declare type IncomingCollectionVersions = {
10
+ export type IncomingCollectionVersions = {
11
11
  maxPerDoc?: number;
12
12
  retainDeleted?: boolean;
13
13
  drafts?: boolean | IncomingDrafts;
@@ -17,15 +17,15 @@ export interface SanitizedCollectionVersions extends Omit<IncomingCollectionVers
17
17
  retainDeleted: boolean;
18
18
  drafts: SanitizedDrafts | false;
19
19
  }
20
- export declare type IncomingGlobalVersions = {
20
+ export type IncomingGlobalVersions = {
21
21
  max?: number;
22
22
  drafts?: boolean | IncomingDrafts;
23
23
  };
24
- export declare type SanitizedGlobalVersions = {
24
+ export type SanitizedGlobalVersions = {
25
25
  max: number;
26
26
  drafts: SanitizedDrafts | false;
27
27
  };
28
- export declare type TypeWithVersion<T> = {
28
+ export type TypeWithVersion<T> = {
29
29
  id: string;
30
30
  parent: string | number;
31
31
  version: T;
@@ -54,10 +54,10 @@ const {
54
54
 
55
55
  ### useFormFields
56
56
 
57
- There are times when a custom field component needs to have access to data from other fields, and you have a few options to do so. The `useFormFields` hook is a powerful and highly performant way to retrieve a form's field state, as well as to retrieve the `dispatchFields` method, which can be helpful for setting other fields' form states from anywhere within a form.
57
+ There are times when a custom field component needs to have access to data from other fields, and you have a few options to do so. The `useFormFields` hook is a powerful and highly performant way to retrieve a form's field state, as well as to retrieve the `dispatchFields` method, which can be helpful for setting other fields' form states from anywhere within a form.
58
58
 
59
59
  <Banner type="success">
60
- <strong>This hook is great for retrieving only certain fields from form state</strong> because it ensures that it will only cause a rerender when the items that you ask for change.
60
+ <strong>This hook is great for retrieving only certain fields from form state</strong> because it ensures that it will only cause a rerender when the items that you ask for change.
61
61
  </Banner>
62
62
 
63
63
  Thanks to the awesome package [`use-context-selector`](https://github.com/dai-shi/use-context-selector), you can retrieve a specific field's state easily. This is ideal because you can ensure you have an up-to-date field state, and your component will only re-render when _that field's state_ changes.
@@ -84,7 +84,7 @@ const MyComponent: React.FC = () => {
84
84
 
85
85
  ### useAllFormFields
86
86
 
87
- **To retrieve more than one field**, you can use the `useAllFormFields` hook. Your component will re-render when _any_ field changes, so use this hook only if you absolutely need to. Unlike the `useFormFields` hook, this hook does not accept a "selector", and it always returns an array with type of `[fields: Fields, dispatch: React.Dispatch<Action>]]`.
87
+ **To retrieve more than one field**, you can use the `useAllFormFields` hook. Your component will re-render when _any_ field changes, so use this hook only if you absolutely need to. Unlike the `useFormFields` hook, this hook does not accept a "selector", and it always returns an array with type of `[fields: Fields, dispatch: React.Dispatch<Action>]]`.
88
88
 
89
89
  You can do lots of powerful stuff by retrieving the full form state, like using built-in helper functions to reduce field state to values only, or to retrieve sibling data by path.
90
90
 
@@ -100,7 +100,7 @@ const ExampleComponent: React.FC = () => {
100
100
  // The result below will reflect the data stored in the form at the given time
101
101
  const formData = reduceFieldsToValues(fields, true);
102
102
 
103
- // Pass in field state and a path,
103
+ // Pass in field state and a path,
104
104
  // and you will be sent all sibling data of the path that you've specified
105
105
  const siblingData = getSiblingData(fields, 'someFieldName');
106
106
 
@@ -135,7 +135,7 @@ The `useForm` hook can be used to interact with the form itself, and sends back
135
135
 
136
136
  <Banner type="warning">
137
137
  <strong>Warning:</strong><br/>
138
- This hook is optimized to avoid causing rerenders when fields change, and as such, its `fields` property will be out of date. You should only leverage this hook if you need to perform actions against the form in response to your users' actions. Do not rely on its returned "fields" as being up-to-date. They will be removed from this hook's response in an upcoming version.
138
+ This hook is optimized to avoid causing rerenders when fields change, and as such, its `fields` property will be out of date. You should only leverage this hook if you need to perform actions against the form in response to your users' actions. Do not rely on its returned "fields" as being up-to-date. They will be removed from this hook's response in an upcoming version.
139
139
  </Banner>
140
140
 
141
141
  The `useForm` hook returns an object with the following properties:
@@ -162,17 +162,19 @@ The `useForm` hook returns an object with the following properties:
162
162
 
163
163
  The `useDocumentInfo` hook provides lots of information about the document currently being edited, including the following:
164
164
 
165
- | Property | Description |
166
- |---------------------------|------------------------------------------------------------------------------------|
167
- | **`collection`** | If the doc is a collection, its collection config will be returned |
168
- | **`global`** | If the doc is a global, its global config will be returned |
169
- | **`type`** | The type of document being edited (collection or global) |
170
- | **`id`** | If the doc is a collection, its ID will be returned |
171
- | **`preferencesKey`** | The `preferences` key to use when interacting with document-level user preferences |
172
- | **`versions`** | Versions of the current doc |
173
- | **`unpublishedVersions`** | Unpublished versions of the current doc |
174
- | **`publishedDoc`** | The currently published version of the doc being edited |
175
- | **`getVersions`** | Method to trigger the retrieval of document versions |
165
+ | Property | Description |
166
+ |---------------------------|--------------------------------------------------------------------------------------------------------------------| |
167
+ | **`collection`** | If the doc is a collection, its collection config will be returned |
168
+ | **`global`** | If the doc is a global, its global config will be returned |
169
+ | **`type`** | The type of document being edited (collection or global) |
170
+ | **`id`** | If the doc is a collection, its ID will be returned |
171
+ | **`preferencesKey`** | The `preferences` key to use when interacting with document-level user preferences |
172
+ | **`versions`** | Versions of the current doc |
173
+ | **`unpublishedVersions`** | Unpublished versions of the current doc |
174
+ | **`publishedDoc`** | The currently published version of the doc being edited |
175
+ | **`getVersions`** | Method to trigger the retrieval of document versions |
176
+ | **`docPermissions`** | The current documents permissions. Collection document permissions fallback when no id is present (i.e. on create) |
177
+ | **`getDocPermissions`** | Method to trigger the retrieval of document level permissions |
176
178
 
177
179
  **Example:**
178
180
 
@@ -250,7 +252,7 @@ const Greeting: React.FC = () => {
250
252
 
251
253
  ### useConfig
252
254
 
253
- Used to easily fetch the full Payload config.
255
+ Used to easily fetch the full Payload config.
254
256
 
255
257
  ```tsx
256
258
  import { useConfig } from 'payload/components/utilities';
@@ -66,6 +66,8 @@ query {
66
66
  }
67
67
  ```
68
68
 
69
+ Document access can also be queried on a collection/global basis. Access on a global can queried like `http://localhost:3000/api/global-slug/access`, Collection document access can be queried like `http://localhost:3000/api/collection-slug/access/:id`.
70
+
69
71
  ### Me
70
72
 
71
73
  Returns either a logged in user with token or null when there is no logged in user.
@@ -116,7 +116,7 @@ You can even log in using the `login[collection-singular-label-here]` mutation t
116
116
 
117
117
  <Banner type="success">
118
118
  <strong>Tip:</strong><br/>
119
- To see more regarding how the above queries and mutations are used, visit your GraphQL playground (by default at <a href="http://localhost:3000/api/graphql-playground">(http://localhost:3000/api/graphql-playground)</a> while your server is running. There, you can use the "Schema" and "Docs" buttons on the right to see a ton of detail about how GraphQL operates within Payload.
119
+ To see more regarding how the above queries and mutations are used, visit your GraphQL playground (by default at <a href="http://localhost:3000/api/graphql-playground">(http://localhost:3000/api/graphql-playground</a>) while your server is running. There, you can use the "Schema" and "Docs" buttons on the right to see a ton of detail about how GraphQL operates within Payload.
120
120
  </Banner>
121
121
 
122
122
  ## Query complexity limits
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Node, React and MongoDB Headless CMS and Application Framework",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -91,6 +91,8 @@
91
91
  "@babel/preset-typescript": "^7.12.1",
92
92
  "@babel/register": "^7.11.5",
93
93
  "@date-io/date-fns": "^2.10.6",
94
+ "@dnd-kit/core": "^6.0.5",
95
+ "@dnd-kit/sortable": "^7.0.1",
94
96
  "@faceless-ui/modal": "^2.0.1",
95
97
  "@faceless-ui/scroll-info": "^1.2.3",
96
98
  "@faceless-ui/window-info": "^2.0.2",
@@ -155,7 +157,7 @@
155
157
  "passport-local-mongoose": "^7.0.0",
156
158
  "path-browserify": "^1.0.1",
157
159
  "pino": "^6.4.1",
158
- "pino-pretty": "^4.3.0",
160
+ "pino-pretty": "^9.1.1",
159
161
  "pluralize": "^8.0.0",
160
162
  "postcss": "^8.4.6",
161
163
  "postcss-loader": "^6.2.1",
@@ -177,7 +179,6 @@
177
179
  "react-router-navigation-prompt": "^1.9.6",
178
180
  "react-select": "^3.0.8",
179
181
  "react-simple-code-editor": "^0.11.0",
180
- "react-sortable-hoc": "^2.0.0",
181
182
  "react-toastify": "^8.2.0",
182
183
  "sanitize-filename": "^1.6.3",
183
184
  "sass": "^1.55.0",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { Props } from './types';
3
- import './index.scss';
4
- export declare const AddNewRelationModal: React.FC<Props>;
@@ -1,69 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { Modal, useModal } from '@faceless-ui/modal';
3
- import { useWindowInfo } from '@faceless-ui/window-info';
4
- import { useTranslation } from 'react-i18next';
5
- import Button from '../../../../../elements/Button';
6
- import { useAuth } from '../../../../../utilities/Auth';
7
- import RenderCustomComponent from '../../../../../utilities/RenderCustomComponent';
8
- import { useLocale } from '../../../../../utilities/Locale';
9
- import { useConfig } from '../../../../../utilities/Config';
10
- import DefaultEdit from '../../../../../views/collections/Edit/Default';
11
- import X from '../../../../../icons/X';
12
- import buildStateFromSchema from '../../../../Form/buildStateFromSchema';
13
- import { EditDepthContext, useEditDepth } from '../../../../../utilities/EditDepth';
14
- import { getTranslation } from '../../../../../../../utilities/getTranslation';
15
- import { DocumentInfoProvider } from '../../../../../utilities/DocumentInfo';
16
- import './index.scss';
17
- const baseClass = 'relationship-add-new-modal';
18
- export const AddNewRelationModal = ({ modalCollection, onSave, modalSlug }) => {
19
- var _a, _b, _c;
20
- const { serverURL, routes: { api } } = useConfig();
21
- const { toggleModal } = useModal();
22
- const { breakpoints: { m: midBreak } } = useWindowInfo();
23
- const locale = useLocale();
24
- const { permissions, user } = useAuth();
25
- const [initialState, setInitialState] = useState();
26
- const [isAnimated, setIsAnimated] = useState(false);
27
- const editDepth = useEditDepth();
28
- const { t, i18n } = useTranslation('fields');
29
- const modalAction = `${serverURL}${api}/${modalCollection.slug}?locale=${locale}&depth=0&fallback-locale=null`;
30
- useEffect(() => {
31
- const buildState = async () => {
32
- const state = await buildStateFromSchema({ fieldSchema: modalCollection.fields, data: {}, user, operation: 'create', locale, t });
33
- setInitialState(state);
34
- };
35
- buildState();
36
- }, [modalCollection, locale, user, t]);
37
- useEffect(() => {
38
- setIsAnimated(true);
39
- }, []);
40
- return (React.createElement(Modal, { slug: modalSlug, className: [
41
- baseClass,
42
- isAnimated && `${baseClass}--animated`,
43
- ].filter(Boolean).join(' ') },
44
- editDepth === 1 && (React.createElement("div", { className: `${baseClass}__blur-bg` })),
45
- React.createElement(DocumentInfoProvider, { collection: modalCollection },
46
- React.createElement(EditDepthContext.Provider, { value: editDepth + 1 },
47
- React.createElement("button", { className: `${baseClass}__close`, type: "button", onClick: () => toggleModal(modalSlug), style: {
48
- width: `calc(${midBreak ? 'var(--gutter-h)' : 'var(--nav-width)'} + ${editDepth - 1} * 25px)`,
49
- } },
50
- React.createElement("span", null, "Close")),
51
- React.createElement(RenderCustomComponent, { DefaultComponent: DefaultEdit, CustomComponent: (_c = (_b = (_a = modalCollection.admin) === null || _a === void 0 ? void 0 : _a.components) === null || _b === void 0 ? void 0 : _b.views) === null || _c === void 0 ? void 0 : _c.Edit, componentProps: {
52
- isLoading: !initialState,
53
- data: {},
54
- collection: modalCollection,
55
- permissions: permissions.collections[modalCollection.slug],
56
- isEditing: false,
57
- onSave,
58
- initialState,
59
- hasSavePermission: true,
60
- action: modalAction,
61
- disableEyebrow: true,
62
- disableActions: true,
63
- disableLeaveWithoutSaving: true,
64
- customHeader: (React.createElement("div", { className: `${baseClass}__header` },
65
- React.createElement("h2", null, t('addNewLabel', { label: getTranslation(modalCollection.labels.singular, i18n) })),
66
- React.createElement(Button, { buttonStyle: "none", className: `${baseClass}__header-close`, onClick: () => toggleModal(modalSlug) },
67
- React.createElement(X, null)))),
68
- } })))));
69
- };