@webiny/app-trash-bin 5.40.0-beta.3

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 (468) hide show
  1. package/Domain/Models/TrashBinItem/ITrashBinItemMapper.d.ts +4 -0
  2. package/Domain/Models/TrashBinItem/ITrashBinItemMapper.js +7 -0
  3. package/Domain/Models/TrashBinItem/ITrashBinItemMapper.js.map +1 -0
  4. package/Domain/Models/TrashBinItem/TrashBinItem.d.ts +20 -0
  5. package/Domain/Models/TrashBinItem/TrashBinItem.js +28 -0
  6. package/Domain/Models/TrashBinItem/TrashBinItem.js.map +1 -0
  7. package/Domain/Models/TrashBinItem/index.d.ts +2 -0
  8. package/Domain/Models/TrashBinItem/index.js +29 -0
  9. package/Domain/Models/TrashBinItem/index.js.map +1 -0
  10. package/Domain/Models/index.d.ts +1 -0
  11. package/Domain/Models/index.js +18 -0
  12. package/Domain/Models/index.js.map +1 -0
  13. package/Domain/Repositories/Search/ISearchRepository.d.ts +4 -0
  14. package/Domain/Repositories/Search/ISearchRepository.js +7 -0
  15. package/Domain/Repositories/Search/ISearchRepository.js.map +1 -0
  16. package/Domain/Repositories/Search/SearchRepository.d.ts +7 -0
  17. package/Domain/Repositories/Search/SearchRepository.js +31 -0
  18. package/Domain/Repositories/Search/SearchRepository.js.map +1 -0
  19. package/Domain/Repositories/Search/SearchRepositoryFactory.d.ts +7 -0
  20. package/Domain/Repositories/Search/SearchRepositoryFactory.js +35 -0
  21. package/Domain/Repositories/Search/SearchRepositoryFactory.js.map +1 -0
  22. package/Domain/Repositories/Search/index.d.ts +3 -0
  23. package/Domain/Repositories/Search/index.js +40 -0
  24. package/Domain/Repositories/Search/index.js.map +1 -0
  25. package/Domain/Repositories/SelectedItems/ISelectedItemsRepository.d.ts +5 -0
  26. package/Domain/Repositories/SelectedItems/ISelectedItemsRepository.js +7 -0
  27. package/Domain/Repositories/SelectedItems/ISelectedItemsRepository.js.map +1 -0
  28. package/Domain/Repositories/SelectedItems/SelectedItemsRepository.d.ts +8 -0
  29. package/Domain/Repositories/SelectedItems/SelectedItemsRepository.js +31 -0
  30. package/Domain/Repositories/SelectedItems/SelectedItemsRepository.js.map +1 -0
  31. package/Domain/Repositories/SelectedItems/SelectedItemsRepositoryFactory.d.ts +7 -0
  32. package/Domain/Repositories/SelectedItems/SelectedItemsRepositoryFactory.js +35 -0
  33. package/Domain/Repositories/SelectedItems/SelectedItemsRepositoryFactory.js.map +1 -0
  34. package/Domain/Repositories/SelectedItems/index.d.ts +3 -0
  35. package/Domain/Repositories/SelectedItems/index.js +40 -0
  36. package/Domain/Repositories/SelectedItems/index.js.map +1 -0
  37. package/Domain/Repositories/Sorting/SortingRepositoryWithDefaults.d.ts +8 -0
  38. package/Domain/Repositories/Sorting/SortingRepositoryWithDefaults.js +38 -0
  39. package/Domain/Repositories/Sorting/SortingRepositoryWithDefaults.js.map +1 -0
  40. package/Domain/Repositories/Sorting/index.d.ts +1 -0
  41. package/Domain/Repositories/Sorting/index.js +18 -0
  42. package/Domain/Repositories/Sorting/index.js.map +1 -0
  43. package/Domain/Repositories/TrashBinItems/ITrashBinItemsRepository.d.ts +13 -0
  44. package/Domain/Repositories/TrashBinItems/ITrashBinItemsRepository.js +7 -0
  45. package/Domain/Repositories/TrashBinItems/ITrashBinItemsRepository.js.map +1 -0
  46. package/Domain/Repositories/TrashBinItems/TrashBinItemMapper.d.ts +16 -0
  47. package/Domain/Repositories/TrashBinItems/TrashBinItemMapper.js +34 -0
  48. package/Domain/Repositories/TrashBinItems/TrashBinItemMapper.js.map +1 -0
  49. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepository.d.ts +24 -0
  50. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepository.js +131 -0
  51. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepository.js.map +1 -0
  52. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepositoryFactory.d.ts +10 -0
  53. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepositoryFactory.js +35 -0
  54. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepositoryFactory.js.map +1 -0
  55. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepositoryWithLoading.d.ts +16 -0
  56. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepositoryWithLoading.js +62 -0
  57. package/Domain/Repositories/TrashBinItems/TrashBinItemsRepositoryWithLoading.js.map +1 -0
  58. package/Domain/Repositories/TrashBinItems/index.d.ts +5 -0
  59. package/Domain/Repositories/TrashBinItems/index.js +62 -0
  60. package/Domain/Repositories/TrashBinItems/index.js.map +1 -0
  61. package/Domain/Repositories/index.d.ts +5 -0
  62. package/Domain/Repositories/index.js +51 -0
  63. package/Domain/Repositories/index.js.map +1 -0
  64. package/Domain/index.d.ts +2 -0
  65. package/Domain/index.js +29 -0
  66. package/Domain/index.js.map +1 -0
  67. package/Gateways/TrashBinDeleteItem/ITrashBinDeleteItemGateway.d.ts +3 -0
  68. package/Gateways/TrashBinDeleteItem/ITrashBinDeleteItemGateway.js +7 -0
  69. package/Gateways/TrashBinDeleteItem/ITrashBinDeleteItemGateway.js.map +1 -0
  70. package/Gateways/TrashBinDeleteItem/index.d.ts +1 -0
  71. package/Gateways/TrashBinDeleteItem/index.js +18 -0
  72. package/Gateways/TrashBinDeleteItem/index.js.map +1 -0
  73. package/Gateways/TrashBinListItems/ITrashBinListGateway.d.ts +4 -0
  74. package/Gateways/TrashBinListItems/ITrashBinListGateway.js +7 -0
  75. package/Gateways/TrashBinListItems/ITrashBinListGateway.js.map +1 -0
  76. package/Gateways/TrashBinListItems/index.d.ts +1 -0
  77. package/Gateways/TrashBinListItems/index.js +18 -0
  78. package/Gateways/TrashBinListItems/index.js.map +1 -0
  79. package/Gateways/TrashBinRestoreItem/ITrashBinRestoreItemGateway.d.ts +3 -0
  80. package/Gateways/TrashBinRestoreItem/ITrashBinRestoreItemGateway.js +7 -0
  81. package/Gateways/TrashBinRestoreItem/ITrashBinRestoreItemGateway.js.map +1 -0
  82. package/Gateways/TrashBinRestoreItem/index.d.ts +1 -0
  83. package/Gateways/TrashBinRestoreItem/index.js +18 -0
  84. package/Gateways/TrashBinRestoreItem/index.js.map +1 -0
  85. package/Gateways/index.d.ts +3 -0
  86. package/Gateways/index.js +40 -0
  87. package/Gateways/index.js.map +1 -0
  88. package/LICENSE +21 -0
  89. package/Presentation/TrashBin/TrashBin.d.ts +19 -0
  90. package/Presentation/TrashBin/TrashBin.js +56 -0
  91. package/Presentation/TrashBin/TrashBin.js.map +1 -0
  92. package/Presentation/TrashBin/TrashBin.test.d.ts +1 -0
  93. package/Presentation/TrashBin/TrashBin.test.js +656 -0
  94. package/Presentation/TrashBin/TrashBin.test.js.map +1 -0
  95. package/Presentation/TrashBin/TrashBinControllers.d.ts +20 -0
  96. package/Presentation/TrashBin/TrashBinControllers.js +89 -0
  97. package/Presentation/TrashBin/TrashBinControllers.js.map +1 -0
  98. package/Presentation/TrashBin/TrashBinPresenter.d.ts +30 -0
  99. package/Presentation/TrashBin/TrashBinPresenter.js +80 -0
  100. package/Presentation/TrashBin/TrashBinPresenter.js.map +1 -0
  101. package/Presentation/TrashBin/controllers/DeleteItem/DeleteItemController.d.ts +7 -0
  102. package/Presentation/TrashBin/controllers/DeleteItem/DeleteItemController.js +24 -0
  103. package/Presentation/TrashBin/controllers/DeleteItem/DeleteItemController.js.map +1 -0
  104. package/Presentation/TrashBin/controllers/DeleteItem/IDeleteItemController.d.ts +3 -0
  105. package/Presentation/TrashBin/controllers/DeleteItem/IDeleteItemController.js +7 -0
  106. package/Presentation/TrashBin/controllers/DeleteItem/IDeleteItemController.js.map +1 -0
  107. package/Presentation/TrashBin/controllers/DeleteItem/index.d.ts +2 -0
  108. package/Presentation/TrashBin/controllers/DeleteItem/index.js +29 -0
  109. package/Presentation/TrashBin/controllers/DeleteItem/index.js.map +1 -0
  110. package/Presentation/TrashBin/controllers/GetRestoredItemById/GetRestoredItemByIdController.d.ts +20 -0
  111. package/Presentation/TrashBin/controllers/GetRestoredItemById/GetRestoredItemByIdController.js +27 -0
  112. package/Presentation/TrashBin/controllers/GetRestoredItemById/GetRestoredItemByIdController.js.map +1 -0
  113. package/Presentation/TrashBin/controllers/GetRestoredItemById/IGetRestoredItemByIdController.d.ts +4 -0
  114. package/Presentation/TrashBin/controllers/GetRestoredItemById/IGetRestoredItemByIdController.js +7 -0
  115. package/Presentation/TrashBin/controllers/GetRestoredItemById/IGetRestoredItemByIdController.js.map +1 -0
  116. package/Presentation/TrashBin/controllers/GetRestoredItemById/index.d.ts +2 -0
  117. package/Presentation/TrashBin/controllers/GetRestoredItemById/index.js +29 -0
  118. package/Presentation/TrashBin/controllers/GetRestoredItemById/index.js.map +1 -0
  119. package/Presentation/TrashBin/controllers/ListItems/IListItemsController.d.ts +3 -0
  120. package/Presentation/TrashBin/controllers/ListItems/IListItemsController.js +7 -0
  121. package/Presentation/TrashBin/controllers/ListItems/IListItemsController.js.map +1 -0
  122. package/Presentation/TrashBin/controllers/ListItems/ListItemsController.d.ts +7 -0
  123. package/Presentation/TrashBin/controllers/ListItems/ListItemsController.js +24 -0
  124. package/Presentation/TrashBin/controllers/ListItems/ListItemsController.js.map +1 -0
  125. package/Presentation/TrashBin/controllers/ListItems/index.d.ts +2 -0
  126. package/Presentation/TrashBin/controllers/ListItems/index.js +29 -0
  127. package/Presentation/TrashBin/controllers/ListItems/index.js.map +1 -0
  128. package/Presentation/TrashBin/controllers/ListMoreItems/IListMoreItemsController.d.ts +3 -0
  129. package/Presentation/TrashBin/controllers/ListMoreItems/IListMoreItemsController.js +7 -0
  130. package/Presentation/TrashBin/controllers/ListMoreItems/IListMoreItemsController.js.map +1 -0
  131. package/Presentation/TrashBin/controllers/ListMoreItems/ListMoreItemsController.d.ts +7 -0
  132. package/Presentation/TrashBin/controllers/ListMoreItems/ListMoreItemsController.js +24 -0
  133. package/Presentation/TrashBin/controllers/ListMoreItems/ListMoreItemsController.js.map +1 -0
  134. package/Presentation/TrashBin/controllers/ListMoreItems/index.d.ts +2 -0
  135. package/Presentation/TrashBin/controllers/ListMoreItems/index.js +29 -0
  136. package/Presentation/TrashBin/controllers/ListMoreItems/index.js.map +1 -0
  137. package/Presentation/TrashBin/controllers/RestoreItem/IRestoreItemController.d.ts +3 -0
  138. package/Presentation/TrashBin/controllers/RestoreItem/IRestoreItemController.js +7 -0
  139. package/Presentation/TrashBin/controllers/RestoreItem/IRestoreItemController.js.map +1 -0
  140. package/Presentation/TrashBin/controllers/RestoreItem/RestoreItemController.d.ts +7 -0
  141. package/Presentation/TrashBin/controllers/RestoreItem/RestoreItemController.js +24 -0
  142. package/Presentation/TrashBin/controllers/RestoreItem/RestoreItemController.js.map +1 -0
  143. package/Presentation/TrashBin/controllers/RestoreItem/index.d.ts +2 -0
  144. package/Presentation/TrashBin/controllers/RestoreItem/index.js +29 -0
  145. package/Presentation/TrashBin/controllers/RestoreItem/index.js.map +1 -0
  146. package/Presentation/TrashBin/controllers/SearchItems/ISearchItemsController.d.ts +3 -0
  147. package/Presentation/TrashBin/controllers/SearchItems/ISearchItemsController.js +7 -0
  148. package/Presentation/TrashBin/controllers/SearchItems/ISearchItemsController.js.map +1 -0
  149. package/Presentation/TrashBin/controllers/SearchItems/SearchItemsController.d.ts +8 -0
  150. package/Presentation/TrashBin/controllers/SearchItems/SearchItemsController.js +27 -0
  151. package/Presentation/TrashBin/controllers/SearchItems/SearchItemsController.js.map +1 -0
  152. package/Presentation/TrashBin/controllers/SearchItems/index.d.ts +2 -0
  153. package/Presentation/TrashBin/controllers/SearchItems/index.js +29 -0
  154. package/Presentation/TrashBin/controllers/SearchItems/index.js.map +1 -0
  155. package/Presentation/TrashBin/controllers/SelectItems/ISelectItemsController.d.ts +4 -0
  156. package/Presentation/TrashBin/controllers/SelectItems/ISelectItemsController.js +7 -0
  157. package/Presentation/TrashBin/controllers/SelectItems/ISelectItemsController.js.map +1 -0
  158. package/Presentation/TrashBin/controllers/SelectItems/SelectItemsController.d.ts +8 -0
  159. package/Presentation/TrashBin/controllers/SelectItems/SelectItemsController.js +28 -0
  160. package/Presentation/TrashBin/controllers/SelectItems/SelectItemsController.js.map +1 -0
  161. package/Presentation/TrashBin/controllers/SelectItems/index.d.ts +2 -0
  162. package/Presentation/TrashBin/controllers/SelectItems/index.js +29 -0
  163. package/Presentation/TrashBin/controllers/SelectItems/index.js.map +1 -0
  164. package/Presentation/TrashBin/controllers/SortItems/ISortItemsController.d.ts +4 -0
  165. package/Presentation/TrashBin/controllers/SortItems/ISortItemsController.js +7 -0
  166. package/Presentation/TrashBin/controllers/SortItems/ISortItemsController.js.map +1 -0
  167. package/Presentation/TrashBin/controllers/SortItems/SortItemsController.d.ts +9 -0
  168. package/Presentation/TrashBin/controllers/SortItems/SortItemsController.js +31 -0
  169. package/Presentation/TrashBin/controllers/SortItems/SortItemsController.js.map +1 -0
  170. package/Presentation/TrashBin/controllers/SortItems/index.d.ts +2 -0
  171. package/Presentation/TrashBin/controllers/SortItems/index.js +29 -0
  172. package/Presentation/TrashBin/controllers/SortItems/index.js.map +1 -0
  173. package/Presentation/TrashBin/controllers/index.d.ts +8 -0
  174. package/Presentation/TrashBin/controllers/index.js +95 -0
  175. package/Presentation/TrashBin/controllers/index.js.map +1 -0
  176. package/Presentation/TrashBin/index.d.ts +1 -0
  177. package/Presentation/TrashBin/index.js +18 -0
  178. package/Presentation/TrashBin/index.js.map +1 -0
  179. package/Presentation/TrashBinConfigs/TrashBinConfigs.d.ts +2 -0
  180. package/Presentation/TrashBinConfigs/TrashBinConfigs.js +62 -0
  181. package/Presentation/TrashBinConfigs/TrashBinConfigs.js.map +1 -0
  182. package/Presentation/TrashBinConfigs/index.d.ts +1 -0
  183. package/Presentation/TrashBinConfigs/index.js +18 -0
  184. package/Presentation/TrashBinConfigs/index.js.map +1 -0
  185. package/Presentation/TrashBinRenderer/TrashBinRenderer.d.ts +9 -0
  186. package/Presentation/TrashBinRenderer/TrashBinRenderer.js +31 -0
  187. package/Presentation/TrashBinRenderer/TrashBinRenderer.js.map +1 -0
  188. package/Presentation/TrashBinRenderer/index.d.ts +1 -0
  189. package/Presentation/TrashBinRenderer/index.js +18 -0
  190. package/Presentation/TrashBinRenderer/index.js.map +1 -0
  191. package/Presentation/abstractions/ITrashBinControllers.d.ts +11 -0
  192. package/Presentation/abstractions/ITrashBinControllers.js +7 -0
  193. package/Presentation/abstractions/ITrashBinControllers.js.map +1 -0
  194. package/Presentation/abstractions/ITrashBinPresenter.d.ts +20 -0
  195. package/Presentation/abstractions/ITrashBinPresenter.js +7 -0
  196. package/Presentation/abstractions/ITrashBinPresenter.js.map +1 -0
  197. package/Presentation/abstractions/index.d.ts +2 -0
  198. package/Presentation/abstractions/index.js +29 -0
  199. package/Presentation/abstractions/index.js.map +1 -0
  200. package/Presentation/components/Actions/DeleteItem/DeleteItem.d.ts +2 -0
  201. package/Presentation/components/Actions/DeleteItem/DeleteItem.js +27 -0
  202. package/Presentation/components/Actions/DeleteItem/DeleteItem.js.map +1 -0
  203. package/Presentation/components/Actions/DeleteItem/index.d.ts +1 -0
  204. package/Presentation/components/Actions/DeleteItem/index.js +18 -0
  205. package/Presentation/components/Actions/DeleteItem/index.js.map +1 -0
  206. package/Presentation/components/Actions/RestoreItem/RestoreItem.d.ts +2 -0
  207. package/Presentation/components/Actions/RestoreItem/RestoreItem.js +27 -0
  208. package/Presentation/components/Actions/RestoreItem/RestoreItem.js.map +1 -0
  209. package/Presentation/components/Actions/RestoreItem/index.d.ts +1 -0
  210. package/Presentation/components/Actions/RestoreItem/index.js +18 -0
  211. package/Presentation/components/Actions/RestoreItem/index.js.map +1 -0
  212. package/Presentation/components/Actions/index.d.ts +2 -0
  213. package/Presentation/components/Actions/index.js +29 -0
  214. package/Presentation/components/Actions/index.js.map +1 -0
  215. package/Presentation/components/BottomInfoBar/BottomInfoBar.d.ts +2 -0
  216. package/Presentation/components/BottomInfoBar/BottomInfoBar.js +26 -0
  217. package/Presentation/components/BottomInfoBar/BottomInfoBar.js.map +1 -0
  218. package/Presentation/components/BottomInfoBar/BottomInfoBar.styled.d.ts +21 -0
  219. package/Presentation/components/BottomInfoBar/BottomInfoBar.styled.js +81 -0
  220. package/Presentation/components/BottomInfoBar/BottomInfoBar.styled.js.map +1 -0
  221. package/Presentation/components/BottomInfoBar/ListMeta.d.ts +7 -0
  222. package/Presentation/components/BottomInfoBar/ListMeta.js +20 -0
  223. package/Presentation/components/BottomInfoBar/ListMeta.js.map +1 -0
  224. package/Presentation/components/BottomInfoBar/ListStatus.d.ts +5 -0
  225. package/Presentation/components/BottomInfoBar/ListStatus.js +22 -0
  226. package/Presentation/components/BottomInfoBar/ListStatus.js.map +1 -0
  227. package/Presentation/components/BottomInfoBar/index.d.ts +1 -0
  228. package/Presentation/components/BottomInfoBar/index.js +18 -0
  229. package/Presentation/components/BottomInfoBar/index.js.map +1 -0
  230. package/Presentation/components/BulkActions/BulkActions/BulkActions.d.ts +3 -0
  231. package/Presentation/components/BulkActions/BulkActions/BulkActions.js +44 -0
  232. package/Presentation/components/BulkActions/BulkActions/BulkActions.js.map +1 -0
  233. package/Presentation/components/BulkActions/BulkActions/BulkActions.styled.d.ts +13 -0
  234. package/Presentation/components/BulkActions/BulkActions/BulkActions.styled.js +46 -0
  235. package/Presentation/components/BulkActions/BulkActions/BulkActions.styled.js.map +1 -0
  236. package/Presentation/components/BulkActions/BulkActions/index.d.ts +1 -0
  237. package/Presentation/components/BulkActions/BulkActions/index.js +18 -0
  238. package/Presentation/components/BulkActions/BulkActions/index.js.map +1 -0
  239. package/Presentation/components/BulkActions/DeleteItems/DeleteItems.d.ts +4 -0
  240. package/Presentation/components/BulkActions/DeleteItems/DeleteItems.js +69 -0
  241. package/Presentation/components/BulkActions/DeleteItems/DeleteItems.js.map +1 -0
  242. package/Presentation/components/BulkActions/DeleteItems/index.d.ts +1 -0
  243. package/Presentation/components/BulkActions/DeleteItems/index.js +18 -0
  244. package/Presentation/components/BulkActions/DeleteItems/index.js.map +1 -0
  245. package/Presentation/components/BulkActions/RestoreItems/RestoreItems.d.ts +4 -0
  246. package/Presentation/components/BulkActions/RestoreItems/RestoreItems.js +82 -0
  247. package/Presentation/components/BulkActions/RestoreItems/RestoreItems.js.map +1 -0
  248. package/Presentation/components/BulkActions/RestoreItems/RestoreItemsReportMessage.d.ts +5 -0
  249. package/Presentation/components/BulkActions/RestoreItems/RestoreItemsReportMessage.js +18 -0
  250. package/Presentation/components/BulkActions/RestoreItems/RestoreItemsReportMessage.js.map +1 -0
  251. package/Presentation/components/BulkActions/RestoreItems/RestoredItems.styled.d.ts +5 -0
  252. package/Presentation/components/BulkActions/RestoreItems/RestoredItems.styled.js +25 -0
  253. package/Presentation/components/BulkActions/RestoreItems/RestoredItems.styled.js.map +1 -0
  254. package/Presentation/components/BulkActions/RestoreItems/index.d.ts +1 -0
  255. package/Presentation/components/BulkActions/RestoreItems/index.js +18 -0
  256. package/Presentation/components/BulkActions/RestoreItems/index.js.map +1 -0
  257. package/Presentation/components/BulkActions/index.d.ts +3 -0
  258. package/Presentation/components/BulkActions/index.js +40 -0
  259. package/Presentation/components/BulkActions/index.js.map +1 -0
  260. package/Presentation/components/Cells/CellActions/CellActions.d.ts +2 -0
  261. package/Presentation/components/Cells/CellActions/CellActions.js +27 -0
  262. package/Presentation/components/Cells/CellActions/CellActions.js.map +1 -0
  263. package/Presentation/components/Cells/CellActions/index.d.ts +1 -0
  264. package/Presentation/components/Cells/CellActions/index.js +18 -0
  265. package/Presentation/components/Cells/CellActions/index.js.map +1 -0
  266. package/Presentation/components/Cells/CellCreatedBy/CellCreatedBy.d.ts +2 -0
  267. package/Presentation/components/Cells/CellCreatedBy/CellCreatedBy.js +17 -0
  268. package/Presentation/components/Cells/CellCreatedBy/CellCreatedBy.js.map +1 -0
  269. package/Presentation/components/Cells/CellCreatedBy/index.d.ts +1 -0
  270. package/Presentation/components/Cells/CellCreatedBy/index.js +18 -0
  271. package/Presentation/components/Cells/CellCreatedBy/index.js.map +1 -0
  272. package/Presentation/components/Cells/CellDeletedBy/CellDeletedBy.d.ts +2 -0
  273. package/Presentation/components/Cells/CellDeletedBy/CellDeletedBy.js +17 -0
  274. package/Presentation/components/Cells/CellDeletedBy/CellDeletedBy.js.map +1 -0
  275. package/Presentation/components/Cells/CellDeletedBy/index.d.ts +1 -0
  276. package/Presentation/components/Cells/CellDeletedBy/index.js +18 -0
  277. package/Presentation/components/Cells/CellDeletedBy/index.js.map +1 -0
  278. package/Presentation/components/Cells/CellDeletedOn/CellDeletedOn.d.ts +2 -0
  279. package/Presentation/components/Cells/CellDeletedOn/CellDeletedOn.js +20 -0
  280. package/Presentation/components/Cells/CellDeletedOn/CellDeletedOn.js.map +1 -0
  281. package/Presentation/components/Cells/CellDeletedOn/index.d.ts +1 -0
  282. package/Presentation/components/Cells/CellDeletedOn/index.js +18 -0
  283. package/Presentation/components/Cells/CellDeletedOn/index.js.map +1 -0
  284. package/Presentation/components/Cells/CellTitle/CellTitle.d.ts +2 -0
  285. package/Presentation/components/Cells/CellTitle/CellTitle.js +21 -0
  286. package/Presentation/components/Cells/CellTitle/CellTitle.js.map +1 -0
  287. package/Presentation/components/Cells/CellTitle/CellTitle.styled.d.ts +12 -0
  288. package/Presentation/components/Cells/CellTitle/CellTitle.styled.js +54 -0
  289. package/Presentation/components/Cells/CellTitle/CellTitle.styled.js.map +1 -0
  290. package/Presentation/components/Cells/CellTitle/index.d.ts +1 -0
  291. package/Presentation/components/Cells/CellTitle/index.js +18 -0
  292. package/Presentation/components/Cells/CellTitle/index.js.map +1 -0
  293. package/Presentation/components/Cells/index.d.ts +5 -0
  294. package/Presentation/components/Cells/index.js +62 -0
  295. package/Presentation/components/Cells/index.js.map +1 -0
  296. package/Presentation/components/Empty/Empty.d.ts +2 -0
  297. package/Presentation/components/Empty/Empty.js +28 -0
  298. package/Presentation/components/Empty/Empty.js.map +1 -0
  299. package/Presentation/components/Empty/Empty.styled.d.ts +9 -0
  300. package/Presentation/components/Empty/Empty.styled.js +39 -0
  301. package/Presentation/components/Empty/Empty.styled.js.map +1 -0
  302. package/Presentation/components/Empty/index.d.ts +1 -0
  303. package/Presentation/components/Empty/index.js +18 -0
  304. package/Presentation/components/Empty/index.js.map +1 -0
  305. package/Presentation/components/SearchInput/SearchInput.d.ts +2 -0
  306. package/Presentation/components/SearchInput/SearchInput.js +41 -0
  307. package/Presentation/components/SearchInput/SearchInput.js.map +1 -0
  308. package/Presentation/components/SearchInput/SearchInput.styled.d.ts +11 -0
  309. package/Presentation/components/SearchInput/SearchInput.styled.js +55 -0
  310. package/Presentation/components/SearchInput/SearchInput.styled.js.map +1 -0
  311. package/Presentation/components/SearchInput/index.d.ts +1 -0
  312. package/Presentation/components/SearchInput/index.js +18 -0
  313. package/Presentation/components/SearchInput/index.js.map +1 -0
  314. package/Presentation/components/Table/Table.d.ts +2 -0
  315. package/Presentation/components/Table/Table.js +33 -0
  316. package/Presentation/components/Table/Table.js.map +1 -0
  317. package/Presentation/components/Table/index.d.ts +1 -0
  318. package/Presentation/components/Table/index.js +18 -0
  319. package/Presentation/components/Table/index.js.map +1 -0
  320. package/Presentation/components/Title/Title.d.ts +5 -0
  321. package/Presentation/components/Title/Title.js +21 -0
  322. package/Presentation/components/Title/Title.js.map +1 -0
  323. package/Presentation/components/Title/Title.styled.d.ts +4 -0
  324. package/Presentation/components/Title/Title.styled.js +26 -0
  325. package/Presentation/components/Title/Title.styled.js.map +1 -0
  326. package/Presentation/components/Title/index.d.ts +1 -0
  327. package/Presentation/components/Title/index.js +18 -0
  328. package/Presentation/components/Title/index.js.map +1 -0
  329. package/Presentation/components/TrashBinOverlay/TrashBinOverlay.d.ts +7 -0
  330. package/Presentation/components/TrashBinOverlay/TrashBinOverlay.js +44 -0
  331. package/Presentation/components/TrashBinOverlay/TrashBinOverlay.js.map +1 -0
  332. package/Presentation/components/TrashBinOverlay/index.d.ts +1 -0
  333. package/Presentation/components/TrashBinOverlay/index.js +18 -0
  334. package/Presentation/components/TrashBinOverlay/index.js.map +1 -0
  335. package/Presentation/configs/index.d.ts +1 -0
  336. package/Presentation/configs/index.js +18 -0
  337. package/Presentation/configs/index.js.map +1 -0
  338. package/Presentation/configs/list/Browser/BulkAction.d.ts +26 -0
  339. package/Presentation/configs/list/Browser/BulkAction.js +77 -0
  340. package/Presentation/configs/list/Browser/BulkAction.js.map +1 -0
  341. package/Presentation/configs/list/Browser/EntryAction.d.ts +7 -0
  342. package/Presentation/configs/list/Browser/EntryAction.js +27 -0
  343. package/Presentation/configs/list/Browser/EntryAction.js.map +1 -0
  344. package/Presentation/configs/list/Browser/Table/Column.d.ts +9 -0
  345. package/Presentation/configs/list/Browser/Table/Column.js +28 -0
  346. package/Presentation/configs/list/Browser/Table/Column.js.map +1 -0
  347. package/Presentation/configs/list/Browser/Table/Sorting.d.ts +5 -0
  348. package/Presentation/configs/list/Browser/Table/Sorting.js +24 -0
  349. package/Presentation/configs/list/Browser/Table/Sorting.js.map +1 -0
  350. package/Presentation/configs/list/Browser/Table/index.d.ts +14 -0
  351. package/Presentation/configs/list/Browser/Table/index.js +14 -0
  352. package/Presentation/configs/list/Browser/Table/index.js.map +1 -0
  353. package/Presentation/configs/list/Browser/index.d.ts +32 -0
  354. package/Presentation/configs/list/Browser/index.js +16 -0
  355. package/Presentation/configs/list/Browser/index.js.map +1 -0
  356. package/Presentation/configs/list/TrashBinListConfig.d.ts +34 -0
  357. package/Presentation/configs/list/TrashBinListConfig.js +31 -0
  358. package/Presentation/configs/list/TrashBinListConfig.js.map +1 -0
  359. package/Presentation/configs/list/index.d.ts +1 -0
  360. package/Presentation/configs/list/index.js +18 -0
  361. package/Presentation/configs/list/index.js.map +1 -0
  362. package/Presentation/hooks/index.d.ts +4 -0
  363. package/Presentation/hooks/index.js +51 -0
  364. package/Presentation/hooks/index.js.map +1 -0
  365. package/Presentation/hooks/useDeleteTrashBinItem.d.ts +8 -0
  366. package/Presentation/hooks/useDeleteTrashBinItem.js +37 -0
  367. package/Presentation/hooks/useDeleteTrashBinItem.js.map +1 -0
  368. package/Presentation/hooks/useRestoreTrashBinItem.d.ts +8 -0
  369. package/Presentation/hooks/useRestoreTrashBinItem.js +48 -0
  370. package/Presentation/hooks/useRestoreTrashBinItem.js.map +1 -0
  371. package/Presentation/hooks/useTrashBin.d.ts +26 -0
  372. package/Presentation/hooks/useTrashBin.js +69 -0
  373. package/Presentation/hooks/useTrashBin.js.map +1 -0
  374. package/Presentation/hooks/useTrashBinItem.d.ts +12 -0
  375. package/Presentation/hooks/useTrashBinItem.js +14 -0
  376. package/Presentation/hooks/useTrashBinItem.js.map +1 -0
  377. package/Presentation/index.d.ts +23 -0
  378. package/Presentation/index.js +64 -0
  379. package/Presentation/index.js.map +1 -0
  380. package/README.md +17 -0
  381. package/UseCases/DeleteItem/DeleteItemUseCase.d.ts +7 -0
  382. package/UseCases/DeleteItem/DeleteItemUseCase.js +25 -0
  383. package/UseCases/DeleteItem/DeleteItemUseCase.js.map +1 -0
  384. package/UseCases/DeleteItem/IDeleteItemUseCase.d.ts +3 -0
  385. package/UseCases/DeleteItem/IDeleteItemUseCase.js +7 -0
  386. package/UseCases/DeleteItem/IDeleteItemUseCase.js.map +1 -0
  387. package/UseCases/DeleteItem/index.d.ts +2 -0
  388. package/UseCases/DeleteItem/index.js +29 -0
  389. package/UseCases/DeleteItem/index.js.map +1 -0
  390. package/UseCases/GetRestoredItem/GetRestoredItemUseCase.d.ts +7 -0
  391. package/UseCases/GetRestoredItem/GetRestoredItemUseCase.js +28 -0
  392. package/UseCases/GetRestoredItem/GetRestoredItemUseCase.js.map +1 -0
  393. package/UseCases/GetRestoredItem/IGetRestoredItemUseCase.d.ts +4 -0
  394. package/UseCases/GetRestoredItem/IGetRestoredItemUseCase.js +7 -0
  395. package/UseCases/GetRestoredItem/IGetRestoredItemUseCase.js.map +1 -0
  396. package/UseCases/GetRestoredItem/index.d.ts +2 -0
  397. package/UseCases/GetRestoredItem/index.js +29 -0
  398. package/UseCases/GetRestoredItem/index.js.map +1 -0
  399. package/UseCases/ListItems/IListItemsUseCase.d.ts +4 -0
  400. package/UseCases/ListItems/IListItemsUseCase.js +7 -0
  401. package/UseCases/ListItems/IListItemsUseCase.js.map +1 -0
  402. package/UseCases/ListItems/ListItemsUseCase.d.ts +8 -0
  403. package/UseCases/ListItems/ListItemsUseCase.js +26 -0
  404. package/UseCases/ListItems/ListItemsUseCase.js.map +1 -0
  405. package/UseCases/ListItems/ListItemsUseCaseWithSearch.d.ts +9 -0
  406. package/UseCases/ListItems/ListItemsUseCaseWithSearch.js +30 -0
  407. package/UseCases/ListItems/ListItemsUseCaseWithSearch.js.map +1 -0
  408. package/UseCases/ListItems/ListItemsUseCaseWithSorting.d.ts +9 -0
  409. package/UseCases/ListItems/ListItemsUseCaseWithSorting.js +33 -0
  410. package/UseCases/ListItems/ListItemsUseCaseWithSorting.js.map +1 -0
  411. package/UseCases/ListItems/index.d.ts +4 -0
  412. package/UseCases/ListItems/index.js +51 -0
  413. package/UseCases/ListItems/index.js.map +1 -0
  414. package/UseCases/ListMoreItems/IListMoreItemsUseCase.d.ts +3 -0
  415. package/UseCases/ListMoreItems/IListMoreItemsUseCase.js +7 -0
  416. package/UseCases/ListMoreItems/IListMoreItemsUseCase.js.map +1 -0
  417. package/UseCases/ListMoreItems/ListMoreItemsUseCase.d.ts +7 -0
  418. package/UseCases/ListMoreItems/ListMoreItemsUseCase.js +25 -0
  419. package/UseCases/ListMoreItems/ListMoreItemsUseCase.js.map +1 -0
  420. package/UseCases/ListMoreItems/index.d.ts +2 -0
  421. package/UseCases/ListMoreItems/index.js +29 -0
  422. package/UseCases/ListMoreItems/index.js.map +1 -0
  423. package/UseCases/RestoreItem/IRestoreItemUseCase.d.ts +3 -0
  424. package/UseCases/RestoreItem/IRestoreItemUseCase.js +7 -0
  425. package/UseCases/RestoreItem/IRestoreItemUseCase.js.map +1 -0
  426. package/UseCases/RestoreItem/RestoreItemUseCase.d.ts +7 -0
  427. package/UseCases/RestoreItem/RestoreItemUseCase.js +25 -0
  428. package/UseCases/RestoreItem/RestoreItemUseCase.js.map +1 -0
  429. package/UseCases/RestoreItem/index.d.ts +2 -0
  430. package/UseCases/RestoreItem/index.js +29 -0
  431. package/UseCases/RestoreItem/index.js.map +1 -0
  432. package/UseCases/SearchItems/ISearchItemsUseCase.d.ts +3 -0
  433. package/UseCases/SearchItems/ISearchItemsUseCase.js +7 -0
  434. package/UseCases/SearchItems/ISearchItemsUseCase.js.map +1 -0
  435. package/UseCases/SearchItems/SearchItemsUseCase.d.ts +7 -0
  436. package/UseCases/SearchItems/SearchItemsUseCase.js +25 -0
  437. package/UseCases/SearchItems/SearchItemsUseCase.js.map +1 -0
  438. package/UseCases/SearchItems/index.d.ts +2 -0
  439. package/UseCases/SearchItems/index.js +29 -0
  440. package/UseCases/SearchItems/index.js.map +1 -0
  441. package/UseCases/SelectItems/ISelectItemsUseCase.d.ts +4 -0
  442. package/UseCases/SelectItems/ISelectItemsUseCase.js +7 -0
  443. package/UseCases/SelectItems/ISelectItemsUseCase.js.map +1 -0
  444. package/UseCases/SelectItems/SelectItemsUseCase.d.ts +7 -0
  445. package/UseCases/SelectItems/SelectItemsUseCase.js +25 -0
  446. package/UseCases/SelectItems/SelectItemsUseCase.js.map +1 -0
  447. package/UseCases/SelectItems/index.d.ts +2 -0
  448. package/UseCases/SelectItems/index.js +29 -0
  449. package/UseCases/SelectItems/index.js.map +1 -0
  450. package/UseCases/SortItems/ISortItemsUseCase.d.ts +4 -0
  451. package/UseCases/SortItems/ISortItemsUseCase.js +7 -0
  452. package/UseCases/SortItems/ISortItemsUseCase.js.map +1 -0
  453. package/UseCases/SortItems/SortItemsUseCase.d.ts +7 -0
  454. package/UseCases/SortItems/SortItemsUseCase.js +25 -0
  455. package/UseCases/SortItems/SortItemsUseCase.js.map +1 -0
  456. package/UseCases/SortItems/index.d.ts +2 -0
  457. package/UseCases/SortItems/index.js +29 -0
  458. package/UseCases/SortItems/index.js.map +1 -0
  459. package/UseCases/index.d.ts +8 -0
  460. package/UseCases/index.js +95 -0
  461. package/UseCases/index.js.map +1 -0
  462. package/index.d.ts +3 -0
  463. package/index.js +40 -0
  464. package/index.js.map +1 -0
  465. package/package.json +54 -0
  466. package/types.d.ts +28 -0
  467. package/types.js +15 -0
  468. package/types.js.map +1 -0
@@ -0,0 +1,656 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
5
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
6
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
7
+ var _TrashBinPresenter = require("./TrashBinPresenter");
8
+ var _appUtils = require("@webiny/app-utils");
9
+ var _types = require("../../types");
10
+ var _TrashBinControllers = require("./TrashBinControllers");
11
+ var _Search = require("../../Domain/Repositories/Search");
12
+ var _SelectedItems = require("../../Domain/Repositories/SelectedItems");
13
+ var _Sorting = require("../../Domain/Repositories/Sorting");
14
+ var _TrashBinItems = require("../../Domain/Repositories/TrashBinItems");
15
+ var identity1 = {
16
+ id: "1234",
17
+ displayName: "John Doe",
18
+ type: "admin"
19
+ };
20
+ var identity2 = {
21
+ id: "5678",
22
+ displayName: "Jane Doe",
23
+ type: "admin"
24
+ };
25
+ var createBinListGateway = function createBinListGateway(_ref) {
26
+ var execute = _ref.execute;
27
+ return {
28
+ execute: execute
29
+ };
30
+ };
31
+ var createBinDeleteItemGateway = function createBinDeleteItemGateway(_ref2) {
32
+ var execute = _ref2.execute;
33
+ return {
34
+ execute: execute
35
+ };
36
+ };
37
+ var createBinRestoreItemGateway = function createBinRestoreItemGateway(_ref3) {
38
+ var execute = _ref3.execute;
39
+ return {
40
+ execute: execute
41
+ };
42
+ };
43
+ var CustomItemMapper = /*#__PURE__*/function () {
44
+ function CustomItemMapper() {
45
+ (0, _classCallCheck2.default)(this, CustomItemMapper);
46
+ }
47
+ return (0, _createClass2.default)(CustomItemMapper, [{
48
+ key: "toDTO",
49
+ value: function toDTO(data) {
50
+ return {
51
+ id: data.id,
52
+ title: data.title,
53
+ location: data.location,
54
+ createdBy: data.createdBy,
55
+ deletedOn: data.deletedOn,
56
+ deletedBy: data.deletedBy
57
+ };
58
+ }
59
+ }]);
60
+ }();
61
+ var defaultSorting = [{
62
+ field: "deletedOn",
63
+ order: "desc"
64
+ }];
65
+ describe("TrashBin", function () {
66
+ var item1 = {
67
+ id: "item-1",
68
+ title: "Item 1",
69
+ location: {
70
+ folderId: "folder-a"
71
+ },
72
+ createdBy: identity1,
73
+ deletedBy: identity2,
74
+ deletedOn: new Date().toString(),
75
+ custom: "any custom data"
76
+ };
77
+ var item2 = {
78
+ id: "item-2",
79
+ title: "Item 2",
80
+ location: {
81
+ folderId: "folder-a"
82
+ },
83
+ createdBy: identity1,
84
+ deletedBy: identity1,
85
+ deletedOn: new Date().toString(),
86
+ custom: "any custom data"
87
+ };
88
+ var item3 = {
89
+ id: "item-3",
90
+ title: "Item 3",
91
+ location: {
92
+ folderId: "folder-b"
93
+ },
94
+ createdBy: identity2,
95
+ deletedBy: identity2,
96
+ deletedOn: new Date().toString(),
97
+ custom: "any custom data"
98
+ };
99
+ var item4 = {
100
+ id: "item-4",
101
+ title: "Item 4",
102
+ location: {
103
+ folderId: "folder-b"
104
+ },
105
+ createdBy: identity1,
106
+ deletedBy: identity1,
107
+ deletedOn: new Date().toString(),
108
+ custom: "any custom data"
109
+ };
110
+ var listGateway = createBinListGateway({
111
+ execute: jest.fn().mockImplementation(function () {
112
+ return Promise.resolve([[item1, item2, item3], {
113
+ totalCount: 3,
114
+ cursor: null,
115
+ hasMoreItems: false
116
+ }]);
117
+ })
118
+ });
119
+ var deleteItemGateway = createBinDeleteItemGateway({
120
+ execute: jest.fn().mockImplementation(function () {
121
+ return Promise.resolve(true);
122
+ })
123
+ });
124
+ var restoreItemGateway = createBinRestoreItemGateway({
125
+ execute: jest.fn().mockImplementation(function () {
126
+ return Promise.resolve(item1);
127
+ })
128
+ });
129
+ var itemMapper = new CustomItemMapper();
130
+ var init = function init(listGateway, deleteItemGateway, restoreItemGateway) {
131
+ var retentionPeriod = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 90;
132
+ var selectedRepo = new _SelectedItems.SelectedItemsRepository();
133
+ var loadingRepo = new _appUtils.LoadingRepository();
134
+ var sortRepo = new _appUtils.SortingRepository();
135
+ var sortRepoWithDefaults = new _Sorting.SortingRepositoryWithDefaults(defaultSorting, sortRepo);
136
+ var metaRepo = new _appUtils.MetaRepository();
137
+ var searchRepo = new _Search.SearchRepository();
138
+ var trashBinItemsRepo = new _TrashBinItems.TrashBinItemsRepository(metaRepo, listGateway, deleteItemGateway, restoreItemGateway, itemMapper);
139
+ var itemsRepo = new _TrashBinItems.TrashBinItemsRepositoryWithLoading(loadingRepo, trashBinItemsRepo);
140
+ return {
141
+ presenter: new _TrashBinPresenter.TrashBinPresenter(itemsRepo, selectedRepo, sortRepoWithDefaults, searchRepo, retentionPeriod),
142
+ controllers: new _TrashBinControllers.TrashBinControllers(itemsRepo, selectedRepo, sortRepoWithDefaults, searchRepo).getControllers()
143
+ };
144
+ };
145
+ beforeEach(function () {
146
+ jest.clearAllMocks();
147
+ });
148
+ it("should create a presenter and list trash bin entries from the gateway", async function () {
149
+ var _init = init(listGateway, deleteItemGateway, restoreItemGateway),
150
+ presenter = _init.presenter,
151
+ controllers = _init.controllers;
152
+ var listPromise = controllers.listItems.execute();
153
+
154
+ // Let's check the transition to loading state
155
+ expect(presenter.vm).toMatchObject({
156
+ items: [],
157
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.list, true)
158
+ });
159
+ await listPromise;
160
+ expect(listGateway.execute).toHaveBeenCalledTimes(1);
161
+ expect(listGateway.execute).toHaveBeenCalledWith({
162
+ sort: ["deletedOn_DESC"]
163
+ });
164
+ expect(presenter.vm).toMatchObject({
165
+ items: [{
166
+ id: "item-1",
167
+ $selectable: true,
168
+ title: "Item 1",
169
+ createdBy: identity1,
170
+ deletedBy: identity2,
171
+ deletedOn: expect.any(String)
172
+ }, {
173
+ id: "item-2",
174
+ $selectable: true,
175
+ title: "Item 2",
176
+ createdBy: identity1,
177
+ deletedBy: identity1,
178
+ deletedOn: expect.any(String)
179
+ }, {
180
+ id: "item-3",
181
+ $selectable: true,
182
+ title: "Item 3",
183
+ createdBy: identity2,
184
+ deletedBy: identity2,
185
+ deletedOn: expect.any(String)
186
+ }],
187
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.list, false)
188
+ });
189
+ });
190
+ it("should list more items from the gateway", async function () {
191
+ var listGateway = createBinListGateway({
192
+ execute: jest.fn().mockImplementationOnce(function () {
193
+ return Promise.resolve([[item1, item2, item3], {
194
+ totalCount: 4,
195
+ cursor: "IjMi",
196
+ hasMoreItems: true
197
+ }]);
198
+ }).mockImplementationOnce(function () {
199
+ return Promise.resolve([[item4], {
200
+ totalCount: 4,
201
+ cursor: null,
202
+ hasMoreItems: false
203
+ }]);
204
+ })
205
+ });
206
+ var _init2 = init(listGateway, deleteItemGateway, restoreItemGateway),
207
+ presenter = _init2.presenter,
208
+ controllers = _init2.controllers;
209
+
210
+ // Let's list some initial entries
211
+ await controllers.listItems.execute();
212
+ expect(listGateway.execute).toHaveBeenCalledTimes(1);
213
+
214
+ // Let's list more items from the gateway
215
+ var listMorePromise = controllers.listMoreItems.execute();
216
+ expect(presenter.vm).toMatchObject({
217
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.listMore, true)
218
+ });
219
+ await listMorePromise;
220
+ expect(listGateway.execute).toHaveBeenCalledTimes(2);
221
+ expect(listGateway.execute).toHaveBeenCalledWith({
222
+ after: "IjMi",
223
+ search: undefined,
224
+ sort: ["deletedOn_DESC"]
225
+ });
226
+ expect(presenter.vm).toMatchObject({
227
+ items: [{
228
+ id: "item-1",
229
+ $selectable: true,
230
+ title: "Item 1",
231
+ createdBy: identity1,
232
+ deletedBy: identity2,
233
+ deletedOn: expect.any(String)
234
+ }, {
235
+ id: "item-2",
236
+ $selectable: true,
237
+ title: "Item 2",
238
+ createdBy: identity1,
239
+ deletedBy: identity1,
240
+ deletedOn: expect.any(String)
241
+ }, {
242
+ id: "item-3",
243
+ $selectable: true,
244
+ title: "Item 3",
245
+ createdBy: identity2,
246
+ deletedBy: identity2,
247
+ deletedOn: expect.any(String)
248
+ }, {
249
+ id: "item-4",
250
+ $selectable: true,
251
+ title: "Item 4",
252
+ createdBy: identity1,
253
+ deletedBy: identity1,
254
+ deletedOn: expect.any(String)
255
+ }],
256
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.listMore, false)
257
+ });
258
+ });
259
+ it("should be able to sort items", async function () {
260
+ var sortListGateway = createBinListGateway({
261
+ execute: jest.fn().mockImplementationOnce(function () {
262
+ return Promise.resolve([[item1, item2, item3], {
263
+ totalCount: 3,
264
+ cursor: null,
265
+ hasMoreItems: false
266
+ }]);
267
+ }).mockImplementation(function () {
268
+ return Promise.resolve([[item3, item2, item1], {
269
+ totalCount: 3,
270
+ cursor: null,
271
+ hasMoreItems: false
272
+ }]);
273
+ })
274
+ });
275
+ var _init3 = init(sortListGateway, deleteItemGateway, restoreItemGateway),
276
+ presenter = _init3.presenter,
277
+ controllers = _init3.controllers;
278
+
279
+ // let's list some entries from the gateway
280
+ await controllers.listItems.execute();
281
+ expect(sortListGateway.execute).toHaveBeenNthCalledWith(1, {
282
+ sort: ["deletedOn_DESC"]
283
+ });
284
+
285
+ // Let's sort items, it should call back the list gateway to retrieve the items sorted
286
+ await controllers.sortItems.execute(function () {
287
+ return [{
288
+ id: "deletedOn",
289
+ desc: false
290
+ }];
291
+ });
292
+ expect(sortListGateway.execute).toHaveBeenNthCalledWith(2, {
293
+ sort: ["deletedOn_ASC"]
294
+ });
295
+ expect(presenter.vm).toMatchObject({
296
+ items: [{
297
+ id: "item-3",
298
+ $selectable: true,
299
+ title: "Item 3",
300
+ createdBy: identity2,
301
+ deletedBy: identity2,
302
+ deletedOn: expect.any(String)
303
+ }, {
304
+ id: "item-2",
305
+ $selectable: true,
306
+ title: "Item 2",
307
+ createdBy: identity1,
308
+ deletedBy: identity1,
309
+ deletedOn: expect.any(String)
310
+ }, {
311
+ id: "item-1",
312
+ $selectable: true,
313
+ title: "Item 1",
314
+ createdBy: identity1,
315
+ deletedBy: identity2,
316
+ deletedOn: expect.any(String)
317
+ }],
318
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.list, false),
319
+ sorting: [{
320
+ id: "deletedOn",
321
+ desc: false
322
+ }]
323
+ });
324
+ });
325
+ it("should be able to search items", async function () {
326
+ var searchItemsGateway = createBinListGateway({
327
+ execute: jest.fn().mockImplementationOnce(function () {
328
+ return Promise.resolve([[item1, item2, item3], {
329
+ totalCount: 3,
330
+ cursor: null,
331
+ hasMoreItems: false
332
+ }]);
333
+ }).mockImplementationOnce(function () {
334
+ return Promise.resolve([[item1], {
335
+ totalCount: 1,
336
+ cursor: null,
337
+ hasMoreItems: false
338
+ }]);
339
+ }).mockImplementationOnce(function () {
340
+ return Promise.resolve([[], {
341
+ totalCount: 0,
342
+ cursor: null,
343
+ hasMoreItems: false
344
+ }]);
345
+ })
346
+ });
347
+ var _init4 = init(searchItemsGateway, deleteItemGateway, restoreItemGateway),
348
+ presenter = _init4.presenter,
349
+ controllers = _init4.controllers;
350
+
351
+ // let's list some entries from the gateway
352
+ await controllers.listItems.execute();
353
+ expect(searchItemsGateway.execute).toHaveBeenNthCalledWith(1, {
354
+ sort: ["deletedOn_DESC"]
355
+ });
356
+
357
+ // Let's search for items, it should return items from the gateway
358
+ await controllers.searchItems.execute("Item 1");
359
+ expect(searchItemsGateway.execute).toHaveBeenNthCalledWith(2, {
360
+ sort: ["deletedOn_DESC"],
361
+ search: "Item 1"
362
+ });
363
+ expect(presenter.vm).toMatchObject({
364
+ items: [{
365
+ id: "item-1",
366
+ $selectable: true,
367
+ title: "Item 1",
368
+ createdBy: identity1,
369
+ deletedBy: identity2,
370
+ deletedOn: expect.any(String)
371
+ }],
372
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.list, false),
373
+ searchQuery: "Item 1"
374
+ });
375
+
376
+ // Let's search for items, it should return no items from the gateway
377
+ await controllers.searchItems.execute("Not found query");
378
+ expect(searchItemsGateway.execute).toHaveBeenNthCalledWith(3, {
379
+ sort: ["deletedOn_DESC"],
380
+ search: "Not found query"
381
+ });
382
+ expect(presenter.vm).toMatchObject({
383
+ items: [],
384
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.list, false),
385
+ searchQuery: "Not found query",
386
+ isEmptyView: true
387
+ });
388
+ });
389
+ it("should be able to select items", async function () {
390
+ var _init5 = init(listGateway, deleteItemGateway, restoreItemGateway),
391
+ presenter = _init5.presenter,
392
+ controllers = _init5.controllers;
393
+
394
+ // let's list some entries from the gateway
395
+ await controllers.listItems.execute();
396
+
397
+ // No selected items found by default
398
+ expect(presenter.vm).toMatchObject({
399
+ selectedItems: []
400
+ });
401
+
402
+ // Let's select the first Item
403
+ await controllers.selectItems.execute([{
404
+ id: "item-1",
405
+ $selectable: true,
406
+ title: "Item 1",
407
+ location: {
408
+ folderId: "folder-a"
409
+ },
410
+ createdBy: identity1,
411
+ deletedBy: identity2,
412
+ deletedOn: new Date().toString()
413
+ }]);
414
+ expect(presenter.vm).toMatchObject({
415
+ selectedItems: [{
416
+ id: "item-1",
417
+ $selectable: true,
418
+ title: "Item 1",
419
+ location: {
420
+ folderId: "folder-a"
421
+ },
422
+ createdBy: identity1,
423
+ deletedBy: identity2,
424
+ deletedOn: expect.any(String)
425
+ }]
426
+ });
427
+
428
+ // Let's select the second item
429
+ await controllers.selectItems.execute([{
430
+ id: "item-1",
431
+ $selectable: true,
432
+ title: "Item 1",
433
+ location: {
434
+ folderId: "folder-a"
435
+ },
436
+ createdBy: identity1,
437
+ deletedBy: identity2,
438
+ deletedOn: new Date().toString()
439
+ }, {
440
+ id: "item-2",
441
+ $selectable: true,
442
+ title: "Item 2",
443
+ location: {
444
+ folderId: "folder-a"
445
+ },
446
+ createdBy: identity1,
447
+ deletedBy: identity1,
448
+ deletedOn: new Date().toString()
449
+ }]);
450
+ expect(presenter.vm).toMatchObject({
451
+ selectedItems: [{
452
+ id: "item-1",
453
+ $selectable: true,
454
+ title: "Item 1",
455
+ location: {
456
+ folderId: "folder-a"
457
+ },
458
+ createdBy: identity1,
459
+ deletedBy: identity2,
460
+ deletedOn: expect.any(String)
461
+ }, {
462
+ id: "item-2",
463
+ $selectable: true,
464
+ title: "Item 2",
465
+ location: {
466
+ folderId: "folder-a"
467
+ },
468
+ createdBy: identity1,
469
+ deletedBy: identity1,
470
+ deletedOn: expect.any(String)
471
+ }]
472
+ });
473
+ });
474
+ it("should delete an item, removing it from the list", async function () {
475
+ var _init6 = init(listGateway, deleteItemGateway, restoreItemGateway),
476
+ presenter = _init6.presenter,
477
+ controllers = _init6.controllers;
478
+
479
+ // let's list some entries from the gateway
480
+ await controllers.listItems.execute();
481
+ expect(listGateway.execute).toHaveBeenCalledTimes(1);
482
+ expect(presenter.vm).toMatchObject({
483
+ items: [{
484
+ id: "item-1",
485
+ $selectable: true,
486
+ title: "Item 1",
487
+ location: {
488
+ folderId: "folder-a"
489
+ },
490
+ createdBy: identity1,
491
+ deletedBy: identity2,
492
+ deletedOn: expect.any(String)
493
+ }, {
494
+ id: "item-2",
495
+ $selectable: true,
496
+ title: "Item 2",
497
+ location: {
498
+ folderId: "folder-a"
499
+ },
500
+ createdBy: identity1,
501
+ deletedBy: identity1,
502
+ deletedOn: expect.any(String)
503
+ }, {
504
+ id: "item-3",
505
+ $selectable: true,
506
+ title: "Item 3",
507
+ location: {
508
+ folderId: "folder-b"
509
+ },
510
+ createdBy: identity2,
511
+ deletedBy: identity2,
512
+ deletedOn: expect.any(String)
513
+ }]
514
+ });
515
+ var deletePromise = controllers.deleteItem.execute(item1.id);
516
+
517
+ // Let's check the transition to loading state
518
+ expect(presenter.vm).toMatchObject({
519
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.delete, true)
520
+ });
521
+ await deletePromise;
522
+ expect(deleteItemGateway.execute).toHaveBeenCalledTimes(1);
523
+ expect(deleteItemGateway.execute).toHaveBeenCalledWith(item1.id);
524
+ expect(presenter.vm).toMatchObject({
525
+ items: [{
526
+ id: "item-2",
527
+ $selectable: true,
528
+ title: "Item 2",
529
+ location: {
530
+ folderId: "folder-a"
531
+ },
532
+ createdBy: identity1,
533
+ deletedBy: identity1,
534
+ deletedOn: expect.any(String)
535
+ }, {
536
+ id: "item-3",
537
+ $selectable: true,
538
+ title: "Item 3",
539
+ location: {
540
+ folderId: "folder-b"
541
+ },
542
+ createdBy: identity2,
543
+ deletedBy: identity2,
544
+ deletedOn: expect.any(String)
545
+ }]
546
+ });
547
+ });
548
+ it("should restore an item, removing it from the list", async function () {
549
+ var _init7 = init(listGateway, deleteItemGateway, restoreItemGateway),
550
+ presenter = _init7.presenter,
551
+ controllers = _init7.controllers;
552
+
553
+ // let's list some entries from the gateway
554
+ await controllers.listItems.execute();
555
+ expect(listGateway.execute).toHaveBeenCalledTimes(1);
556
+ expect(presenter.vm).toMatchObject({
557
+ items: [{
558
+ id: "item-1",
559
+ $selectable: true,
560
+ title: "Item 1",
561
+ location: {
562
+ folderId: "folder-a"
563
+ },
564
+ createdBy: identity1,
565
+ deletedBy: identity2,
566
+ deletedOn: expect.any(String)
567
+ }, {
568
+ id: "item-2",
569
+ $selectable: true,
570
+ title: "Item 2",
571
+ location: {
572
+ folderId: "folder-a"
573
+ },
574
+ createdBy: identity1,
575
+ deletedBy: identity1,
576
+ deletedOn: expect.any(String)
577
+ }, {
578
+ id: "item-3",
579
+ $selectable: true,
580
+ title: "Item 3",
581
+ location: {
582
+ folderId: "folder-b"
583
+ },
584
+ createdBy: identity2,
585
+ deletedBy: identity2,
586
+ deletedOn: expect.any(String)
587
+ }]
588
+ });
589
+ var restorePromise = controllers.restoreItem.execute(item1.id);
590
+
591
+ // Let's check the transition to loading state
592
+ expect(presenter.vm).toMatchObject({
593
+ loading: (0, _defineProperty2.default)({}, _types.LoadingActions.restore, true)
594
+ });
595
+ await restorePromise;
596
+ expect(restoreItemGateway.execute).toHaveBeenCalledTimes(1);
597
+ expect(restoreItemGateway.execute).toHaveBeenCalledWith(item1.id);
598
+ expect(presenter.vm).toMatchObject({
599
+ items: [{
600
+ id: "item-2",
601
+ $selectable: true,
602
+ title: "Item 2",
603
+ location: {
604
+ folderId: "folder-a"
605
+ },
606
+ createdBy: identity1,
607
+ deletedBy: identity1,
608
+ deletedOn: expect.any(String)
609
+ }, {
610
+ id: "item-3",
611
+ $selectable: true,
612
+ title: "Item 3",
613
+ location: {
614
+ folderId: "folder-b"
615
+ },
616
+ createdBy: identity2,
617
+ deletedBy: identity2,
618
+ deletedOn: expect.any(String)
619
+ }],
620
+ restoredItems: [{
621
+ id: "item-1",
622
+ $selectable: true,
623
+ title: "Item 1",
624
+ location: {
625
+ folderId: "folder-a"
626
+ },
627
+ createdBy: identity1,
628
+ deletedBy: identity2,
629
+ deletedOn: expect.any(String)
630
+ }]
631
+ });
632
+
633
+ // We should be able to get the restored item by id
634
+ var restoredItem = await controllers.getRestoredItemById.execute("item-1");
635
+ expect(restoredItem).toMatchObject({
636
+ id: "item-1",
637
+ $selectable: true,
638
+ title: "Item 1",
639
+ location: {
640
+ folderId: "folder-a"
641
+ },
642
+ createdBy: identity1,
643
+ deletedBy: identity2,
644
+ deletedOn: expect.any(String)
645
+ });
646
+ });
647
+ it.each([[0, "0 days"], [1, "1 day"], [2, "2 days"]])("should set the retention period to `%s` when input is `%i`", function (input, output) {
648
+ var _init8 = init(listGateway, deleteItemGateway, restoreItemGateway, input),
649
+ presenter = _init8.presenter;
650
+ expect(presenter.vm).toMatchObject({
651
+ retentionPeriod: output
652
+ });
653
+ });
654
+ });
655
+
656
+ //# sourceMappingURL=TrashBin.test.js.map