@webiny/api-file-manager 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9

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 (377) hide show
  1. package/contants.js +2 -1
  2. package/contants.js.map +1 -1
  3. package/delivery/AssetDelivery/Asset.js +50 -56
  4. package/delivery/AssetDelivery/Asset.js.map +1 -1
  5. package/delivery/AssetDelivery/AssetRequest.js +20 -19
  6. package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
  7. package/delivery/AssetDelivery/abstractions/AssetReply.js +28 -27
  8. package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -1
  9. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +4 -5
  10. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -1
  11. package/delivery/index.d.ts +3 -12
  12. package/delivery/index.js +2 -8
  13. package/delivery/setupAssetDelivery.d.ts +1 -2
  14. package/delivery/setupAssetDelivery.js +60 -105
  15. package/delivery/setupAssetDelivery.js.map +1 -1
  16. package/domain/file/abstractions.js +2 -5
  17. package/domain/file/abstractions.js.map +1 -1
  18. package/domain/file/errors.js +67 -76
  19. package/domain/file/errors.js.map +1 -1
  20. package/domain/file/file.model.js +57 -45
  21. package/domain/file/file.model.js.map +1 -1
  22. package/domain/file/types.d.ts +2 -0
  23. package/domain/file/types.js +0 -3
  24. package/domain/identity/Identity.js +9 -8
  25. package/domain/identity/Identity.js.map +1 -1
  26. package/domain/permissionsSchema.d.ts +16 -0
  27. package/domain/permissionsSchema.js +30 -0
  28. package/domain/permissionsSchema.js.map +1 -0
  29. package/domain/settings/constants.js +2 -1
  30. package/domain/settings/constants.js.map +1 -1
  31. package/domain/settings/errors.js +22 -24
  32. package/domain/settings/errors.js.map +1 -1
  33. package/domain/settings/types.js +0 -3
  34. package/domain/settings/validation.d.ts +4 -12
  35. package/domain/settings/validation.js +18 -27
  36. package/domain/settings/validation.js.map +1 -1
  37. package/exports/api/file-manager/file.d.ts +12 -0
  38. package/exports/api/file-manager/file.js +12 -0
  39. package/exports/api/file-manager/permissions.d.ts +1 -0
  40. package/exports/api/file-manager/permissions.js +1 -0
  41. package/exports/api/file-manager/settings.d.ts +3 -0
  42. package/exports/api/file-manager/settings.js +3 -0
  43. package/features/FileManagerFeature.d.ts +4 -1
  44. package/features/FileManagerFeature.js +17 -14
  45. package/features/FileManagerFeature.js.map +1 -1
  46. package/features/assetDelivery/FilesAssetRequestResolver.d.ts +9 -0
  47. package/features/assetDelivery/FilesAssetRequestResolver.js +29 -0
  48. package/features/assetDelivery/FilesAssetRequestResolver.js.map +1 -0
  49. package/features/assetDelivery/NullAssetOutputStrategy.d.ts +8 -0
  50. package/features/assetDelivery/NullAssetOutputStrategy.js +14 -0
  51. package/features/assetDelivery/NullAssetOutputStrategy.js.map +1 -0
  52. package/features/assetDelivery/NullAssetReply.js +14 -0
  53. package/features/assetDelivery/NullAssetReply.js.map +1 -0
  54. package/features/assetDelivery/NullAssetResolver.d.ts +8 -0
  55. package/features/assetDelivery/NullAssetResolver.js +13 -0
  56. package/features/assetDelivery/NullAssetResolver.js.map +1 -0
  57. package/features/assetDelivery/abstractions.d.ts +54 -0
  58. package/features/assetDelivery/abstractions.js +11 -0
  59. package/features/assetDelivery/abstractions.js.map +1 -0
  60. package/features/assetDelivery/feature.d.ts +4 -0
  61. package/features/assetDelivery/feature.js +29 -0
  62. package/features/assetDelivery/feature.js.map +1 -0
  63. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +4 -0
  64. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js +20 -0
  65. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -0
  66. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +5 -0
  67. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +9 -0
  68. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -0
  69. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +11 -0
  70. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +26 -0
  71. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -0
  72. package/features/assetDelivery/privateFiles/PrivateCache.d.ts +8 -0
  73. package/features/assetDelivery/privateFiles/PrivateCache.js +22 -0
  74. package/features/assetDelivery/privateFiles/PrivateCache.js.map +1 -0
  75. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +11 -0
  76. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +31 -0
  77. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -0
  78. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +19 -0
  79. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js +65 -0
  80. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -0
  81. package/features/assetDelivery/privateFiles/PublicCache.d.ts +8 -0
  82. package/features/assetDelivery/privateFiles/PublicCache.js +22 -0
  83. package/features/assetDelivery/privateFiles/PublicCache.js.map +1 -0
  84. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +9 -0
  85. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +21 -0
  86. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -0
  87. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +9 -0
  88. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +21 -0
  89. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -0
  90. package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +9 -0
  91. package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js +13 -0
  92. package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -0
  93. package/features/assetDelivery/transformation/TransformationAssetProcessor.d.ts +11 -0
  94. package/features/assetDelivery/transformation/TransformationAssetProcessor.js +23 -0
  95. package/features/assetDelivery/transformation/TransformationAssetProcessor.js.map +1 -0
  96. package/features/file/CreateFile/CreateFileRepository.js +20 -18
  97. package/features/file/CreateFile/CreateFileRepository.js.map +1 -1
  98. package/features/file/CreateFile/CreateFileUseCase.d.ts +4 -4
  99. package/features/file/CreateFile/CreateFileUseCase.js +70 -78
  100. package/features/file/CreateFile/CreateFileUseCase.js.map +1 -1
  101. package/features/file/CreateFile/abstractions.d.ts +3 -0
  102. package/features/file/CreateFile/abstractions.js +3 -12
  103. package/features/file/CreateFile/abstractions.js.map +1 -1
  104. package/features/file/CreateFile/events.d.ts +8 -6
  105. package/features/file/CreateFile/events.js +18 -23
  106. package/features/file/CreateFile/events.js.map +1 -1
  107. package/features/file/CreateFile/feature.d.ts +4 -1
  108. package/features/file/CreateFile/feature.js +7 -6
  109. package/features/file/CreateFile/feature.js.map +1 -1
  110. package/features/file/CreateFile/index.d.ts +1 -1
  111. package/features/file/CreateFile/index.js +1 -3
  112. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +15 -17
  113. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js.map +1 -1
  114. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.d.ts +4 -4
  115. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js +61 -75
  116. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -1
  117. package/features/file/CreateFilesInBatch/abstractions.d.ts +2 -0
  118. package/features/file/CreateFilesInBatch/abstractions.js +3 -12
  119. package/features/file/CreateFilesInBatch/abstractions.js.map +1 -1
  120. package/features/file/CreateFilesInBatch/events.d.ts +8 -6
  121. package/features/file/CreateFilesInBatch/events.js +18 -23
  122. package/features/file/CreateFilesInBatch/events.js.map +1 -1
  123. package/features/file/CreateFilesInBatch/feature.d.ts +4 -1
  124. package/features/file/CreateFilesInBatch/feature.js +7 -6
  125. package/features/file/CreateFilesInBatch/feature.js.map +1 -1
  126. package/features/file/CreateFilesInBatch/index.js +0 -2
  127. package/features/file/DeleteFile/DeleteFileRepository.js +21 -20
  128. package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -1
  129. package/features/file/DeleteFile/DeleteFileUseCase.d.ts +4 -4
  130. package/features/file/DeleteFile/DeleteFileUseCase.js +33 -38
  131. package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -1
  132. package/features/file/DeleteFile/abstractions.d.ts +2 -0
  133. package/features/file/DeleteFile/abstractions.js +3 -12
  134. package/features/file/DeleteFile/abstractions.js.map +1 -1
  135. package/features/file/DeleteFile/events.d.ts +8 -6
  136. package/features/file/DeleteFile/events.js +18 -23
  137. package/features/file/DeleteFile/events.js.map +1 -1
  138. package/features/file/DeleteFile/feature.d.ts +4 -1
  139. package/features/file/DeleteFile/feature.js +7 -6
  140. package/features/file/DeleteFile/feature.js.map +1 -1
  141. package/features/file/DeleteFile/index.d.ts +1 -1
  142. package/features/file/DeleteFile/index.js +1 -3
  143. package/features/file/FileUrlGenerator/abstractions.d.ts +1 -0
  144. package/features/file/FileUrlGenerator/abstractions.js +2 -1
  145. package/features/file/FileUrlGenerator/abstractions.js.map +1 -1
  146. package/features/file/GetFile/GetFileRepository.js +22 -22
  147. package/features/file/GetFile/GetFileRepository.js.map +1 -1
  148. package/features/file/GetFile/GetFileUseCase.d.ts +3 -3
  149. package/features/file/GetFile/GetFileUseCase.js +20 -30
  150. package/features/file/GetFile/GetFileUseCase.js.map +1 -1
  151. package/features/file/GetFile/abstractions.d.ts +2 -0
  152. package/features/file/GetFile/abstractions.js +3 -12
  153. package/features/file/GetFile/abstractions.js.map +1 -1
  154. package/features/file/GetFile/feature.d.ts +4 -1
  155. package/features/file/GetFile/feature.js +7 -6
  156. package/features/file/GetFile/feature.js.map +1 -1
  157. package/features/file/GetFile/index.js +0 -2
  158. package/features/file/GetFileContentsById/abstractions.d.ts +20 -0
  159. package/features/file/GetFileContentsById/abstractions.js +5 -0
  160. package/features/file/GetFileContentsById/abstractions.js.map +1 -0
  161. package/features/file/GetFileContentsById/index.d.ts +1 -0
  162. package/features/file/GetFileContentsById/index.js +1 -0
  163. package/features/file/GetFileContentsByKey/abstractions.d.ts +17 -0
  164. package/features/file/GetFileContentsByKey/abstractions.js +5 -0
  165. package/features/file/GetFileContentsByKey/abstractions.js.map +1 -0
  166. package/features/file/GetFileContentsByKey/index.d.ts +1 -0
  167. package/features/file/GetFileContentsByKey/index.js +1 -0
  168. package/features/file/ListFiles/ListFilesRepository.d.ts +3 -1
  169. package/features/file/ListFiles/ListFilesRepository.js +42 -34
  170. package/features/file/ListFiles/ListFilesRepository.js.map +1 -1
  171. package/features/file/ListFiles/ListFilesUseCase.d.ts +4 -4
  172. package/features/file/ListFiles/ListFilesUseCase.js +35 -39
  173. package/features/file/ListFiles/ListFilesUseCase.js.map +1 -1
  174. package/features/file/ListFiles/abstractions.d.ts +2 -0
  175. package/features/file/ListFiles/abstractions.js +3 -12
  176. package/features/file/ListFiles/abstractions.js.map +1 -1
  177. package/features/file/ListFiles/feature.d.ts +4 -1
  178. package/features/file/ListFiles/feature.js +7 -6
  179. package/features/file/ListFiles/feature.js.map +1 -1
  180. package/features/file/ListFiles/index.js +0 -2
  181. package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +27 -0
  182. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +42 -0
  183. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -0
  184. package/features/file/ListImagesByTagTool/feature.d.ts +4 -0
  185. package/features/file/ListImagesByTagTool/feature.js +11 -0
  186. package/features/file/ListImagesByTagTool/feature.js.map +1 -0
  187. package/features/file/ListTags/ListTagsRepository.js +31 -36
  188. package/features/file/ListTags/ListTagsRepository.js.map +1 -1
  189. package/features/file/ListTags/ListTagsUseCase.d.ts +3 -3
  190. package/features/file/ListTags/ListTagsUseCase.js +22 -23
  191. package/features/file/ListTags/ListTagsUseCase.js.map +1 -1
  192. package/features/file/ListTags/abstractions.d.ts +2 -0
  193. package/features/file/ListTags/abstractions.js +3 -12
  194. package/features/file/ListTags/abstractions.js.map +1 -1
  195. package/features/file/ListTags/feature.d.ts +4 -1
  196. package/features/file/ListTags/feature.js +7 -6
  197. package/features/file/ListTags/feature.js.map +1 -1
  198. package/features/file/ListTags/index.js +0 -2
  199. package/features/file/UpdateFile/UpdateFileRepository.js +26 -28
  200. package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -1
  201. package/features/file/UpdateFile/UpdateFileUseCase.d.ts +5 -5
  202. package/features/file/UpdateFile/UpdateFileUseCase.js +60 -70
  203. package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -1
  204. package/features/file/UpdateFile/abstractions.d.ts +3 -0
  205. package/features/file/UpdateFile/abstractions.js +3 -12
  206. package/features/file/UpdateFile/abstractions.js.map +1 -1
  207. package/features/file/UpdateFile/events.d.ts +8 -6
  208. package/features/file/UpdateFile/events.js +18 -23
  209. package/features/file/UpdateFile/events.js.map +1 -1
  210. package/features/file/UpdateFile/feature.d.ts +4 -1
  211. package/features/file/UpdateFile/feature.js +7 -6
  212. package/features/file/UpdateFile/feature.js.map +1 -1
  213. package/features/file/UpdateFile/index.d.ts +1 -1
  214. package/features/file/UpdateFile/index.js +1 -3
  215. package/features/file/shared/EntryToFileMapper.js +25 -23
  216. package/features/file/shared/EntryToFileMapper.js.map +1 -1
  217. package/features/file/shared/FileInputToEntryInputMapper.js +29 -27
  218. package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -1
  219. package/features/file/shared/FileToEntryMapper.js +28 -26
  220. package/features/file/shared/FileToEntryMapper.js.map +1 -1
  221. package/features/permissions/abstractions.d.ts +21 -0
  222. package/features/permissions/abstractions.js +6 -0
  223. package/features/permissions/abstractions.js.map +1 -0
  224. package/features/permissions/feature.d.ts +4 -0
  225. package/features/permissions/feature.js +7 -0
  226. package/features/permissions/feature.js.map +1 -0
  227. package/features/settings/GetSettings/GetSettingsUseCase.js +19 -19
  228. package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -1
  229. package/features/settings/GetSettings/abstractions.d.ts +1 -0
  230. package/features/settings/GetSettings/abstractions.js +2 -6
  231. package/features/settings/GetSettings/abstractions.js.map +1 -1
  232. package/features/settings/GetSettings/feature.d.ts +4 -1
  233. package/features/settings/GetSettings/feature.js +6 -5
  234. package/features/settings/GetSettings/feature.js.map +1 -1
  235. package/features/settings/SettingsInstaller/SettingsInstaller.d.ts +1 -1
  236. package/features/settings/SettingsInstaller/SettingsInstaller.js +26 -25
  237. package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -1
  238. package/features/settings/SettingsInstaller/feature.d.ts +4 -1
  239. package/features/settings/SettingsInstaller/feature.js +6 -5
  240. package/features/settings/SettingsInstaller/feature.js.map +1 -1
  241. package/features/settings/UpdateSettings/UpdateSettingsUseCase.d.ts +1 -1
  242. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +42 -49
  243. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -1
  244. package/features/settings/UpdateSettings/abstractions.d.ts +1 -0
  245. package/features/settings/UpdateSettings/abstractions.js +2 -6
  246. package/features/settings/UpdateSettings/abstractions.js.map +1 -1
  247. package/features/settings/UpdateSettings/events.d.ts +8 -6
  248. package/features/settings/UpdateSettings/events.js +18 -23
  249. package/features/settings/UpdateSettings/events.js.map +1 -1
  250. package/features/settings/UpdateSettings/feature.d.ts +4 -1
  251. package/features/settings/UpdateSettings/feature.js +6 -5
  252. package/features/settings/UpdateSettings/feature.js.map +1 -1
  253. package/features/settings/UpdateSettings/index.d.ts +1 -1
  254. package/features/settings/UpdateSettings/index.js +1 -3
  255. package/features/shared/abstractions.d.ts +1 -13
  256. package/features/shared/abstractions.js +1 -5
  257. package/graphql/baseSchema.js +30 -33
  258. package/graphql/baseSchema.js.map +1 -1
  259. package/graphql/createFilesTypeDefs.d.ts +3 -2
  260. package/graphql/createFilesTypeDefs.js +61 -66
  261. package/graphql/createFilesTypeDefs.js.map +1 -1
  262. package/graphql/filesSchema.js +79 -99
  263. package/graphql/filesSchema.js.map +1 -1
  264. package/graphql/getFileByUrl.js +45 -53
  265. package/graphql/getFileByUrl.js.map +1 -1
  266. package/graphql/index.js +37 -43
  267. package/graphql/index.js.map +1 -1
  268. package/graphql/utils.js +9 -14
  269. package/graphql/utils.js.map +1 -1
  270. package/index.d.ts +2 -2
  271. package/index.js +31 -39
  272. package/index.js.map +1 -1
  273. package/modelModifier/CmsModelModifier.js +40 -43
  274. package/modelModifier/CmsModelModifier.js.map +1 -1
  275. package/package.json +28 -23
  276. package/types.d.ts +1 -3
  277. package/types.js +1 -3
  278. package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +0 -65
  279. package/delivery/AssetDelivery/AssetDeliveryConfig.js +0 -94
  280. package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +0 -1
  281. package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +0 -6
  282. package/delivery/AssetDelivery/FilesAssetRequestResolver.js +0 -30
  283. package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +0 -1
  284. package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +0 -4
  285. package/delivery/AssetDelivery/NullAssetOutputStrategy.js +0 -8
  286. package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +0 -1
  287. package/delivery/AssetDelivery/NullAssetReply.js +0 -13
  288. package/delivery/AssetDelivery/NullAssetReply.js.map +0 -1
  289. package/delivery/AssetDelivery/NullAssetResolver.d.ts +0 -5
  290. package/delivery/AssetDelivery/NullAssetResolver.js +0 -7
  291. package/delivery/AssetDelivery/NullAssetResolver.js.map +0 -1
  292. package/delivery/AssetDelivery/NullRequestResolver.d.ts +0 -4
  293. package/delivery/AssetDelivery/NullRequestResolver.js +0 -7
  294. package/delivery/AssetDelivery/NullRequestResolver.js.map +0 -1
  295. package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +0 -8
  296. package/delivery/AssetDelivery/SetCacheControlHeaders.js +0 -18
  297. package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +0 -1
  298. package/delivery/AssetDelivery/SetResponseHeaders.d.ts +0 -18
  299. package/delivery/AssetDelivery/SetResponseHeaders.js +0 -18
  300. package/delivery/AssetDelivery/SetResponseHeaders.js.map +0 -1
  301. package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +0 -4
  302. package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +0 -3
  303. package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +0 -1
  304. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +0 -4
  305. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +0 -3
  306. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +0 -1
  307. package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +0 -4
  308. package/delivery/AssetDelivery/abstractions/AssetProcessor.js +0 -3
  309. package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +0 -1
  310. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +0 -5
  311. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +0 -3
  312. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +0 -1
  313. package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +0 -4
  314. package/delivery/AssetDelivery/abstractions/AssetResolver.js +0 -3
  315. package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +0 -1
  316. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +0 -4
  317. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +0 -3
  318. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +0 -1
  319. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +0 -4
  320. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +0 -3
  321. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +0 -1
  322. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +0 -4
  323. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +0 -19
  324. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +0 -1
  325. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +0 -4
  326. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +0 -8
  327. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +0 -1
  328. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +0 -8
  329. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +0 -20
  330. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +0 -1
  331. package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +0 -6
  332. package/delivery/AssetDelivery/privateFiles/PrivateCache.js +0 -21
  333. package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +0 -1
  334. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +0 -8
  335. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +0 -30
  336. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +0 -1
  337. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +0 -13
  338. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +0 -63
  339. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +0 -1
  340. package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +0 -6
  341. package/delivery/AssetDelivery/privateFiles/PublicCache.js +0 -21
  342. package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +0 -1
  343. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +0 -7
  344. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +0 -20
  345. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +0 -1
  346. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +0 -7
  347. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +0 -20
  348. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +0 -1
  349. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +0 -4
  350. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +0 -7
  351. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +0 -1
  352. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +0 -4
  353. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +0 -7
  354. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +0 -1
  355. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +0 -6
  356. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +0 -19
  357. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +0 -1
  358. package/delivery/index.js.map +0 -1
  359. package/domain/file/types.js.map +0 -1
  360. package/domain/settings/types.js.map +0 -1
  361. package/features/file/CreateFile/index.js.map +0 -1
  362. package/features/file/CreateFilesInBatch/index.js.map +0 -1
  363. package/features/file/DeleteFile/index.js.map +0 -1
  364. package/features/file/GetFile/index.js.map +0 -1
  365. package/features/file/ListFiles/index.js.map +0 -1
  366. package/features/file/ListTags/index.js.map +0 -1
  367. package/features/file/UpdateFile/index.js.map +0 -1
  368. package/features/settings/UpdateSettings/index.js.map +0 -1
  369. package/features/shared/abstractions.js.map +0 -1
  370. package/permissions/FilesPermissions.d.ts +0 -4
  371. package/permissions/FilesPermissions.js +0 -4
  372. package/permissions/FilesPermissions.js.map +0 -1
  373. package/permissions/SettingsPermissions.d.ts +0 -4
  374. package/permissions/SettingsPermissions.js +0 -4
  375. package/permissions/SettingsPermissions.js.map +0 -1
  376. package/types.js.map +0 -1
  377. /package/{delivery/AssetDelivery → features/assetDelivery}/NullAssetReply.d.ts +0 -0
@@ -1,3 +1 @@
1
1
  export { ListFilesUseCase } from "./abstractions.js";
2
-
3
- //# sourceMappingURL=index.js.map
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { type IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
3
+ import { ListFilesUseCase } from "../../../features/file/ListFiles/index.js";
4
+ declare const inputSchema: z.ZodObject<{
5
+ tag: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type Input = z.infer<typeof inputSchema>;
8
+ interface ImageItem {
9
+ id: string;
10
+ name: string;
11
+ type: string;
12
+ tags: string[];
13
+ }
14
+ declare class ListImagesByTagToolImpl implements IAiSdkTool<Input> {
15
+ private listFiles;
16
+ readonly name = "listImagesByTag";
17
+ readonly description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
18
+ readonly inputSchema: z.ZodObject<{
19
+ tag: z.ZodString;
20
+ }, z.core.$strip>;
21
+ constructor(listFiles: ListFilesUseCase.Interface);
22
+ execute(input: Input): Promise<ImageItem[]>;
23
+ }
24
+ export declare const ListImagesByTagTool: typeof ListImagesByTagToolImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
26
+ };
27
+ export {};
@@ -0,0 +1,42 @@
1
+ import { z } from "zod";
2
+ import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
3
+ import { ListFilesUseCase } from "../ListFiles/index.js";
4
+ const inputSchema = z.object({
5
+ tag: z.string().describe("Tag to filter images by")
6
+ });
7
+ class ListImagesByTagToolImpl {
8
+ constructor(listFiles){
9
+ this.listFiles = listFiles;
10
+ this.name = "listImagesByTag";
11
+ this.description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
12
+ this.inputSchema = inputSchema;
13
+ }
14
+ async execute(input) {
15
+ console.log("Call images tool", input);
16
+ const result = await this.listFiles.execute({
17
+ where: {
18
+ type_startsWith: "image/",
19
+ tags_in: [
20
+ input.tag
21
+ ]
22
+ },
23
+ limit: 50
24
+ });
25
+ if (result.isFail()) return [];
26
+ return result.value.items.map((file)=>({
27
+ id: file.id,
28
+ name: file.name,
29
+ type: file.type,
30
+ tags: file.tags
31
+ }));
32
+ }
33
+ }
34
+ const ListImagesByTagTool = AiSdkTool.createImplementation({
35
+ implementation: ListImagesByTagToolImpl,
36
+ dependencies: [
37
+ ListFilesUseCase
38
+ ]
39
+ });
40
+ export { ListImagesByTagTool };
41
+
42
+ //# sourceMappingURL=ListImagesByTagTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/ListImagesByTagTool/ListImagesByTagTool.js","sources":["../../../../src/features/file/ListImagesByTagTool/ListImagesByTagTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool, type IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListFilesUseCase } from \"~/features/file/ListFiles/index.js\";\n\nconst inputSchema = z.object({\n tag: z.string().describe(\"Tag to filter images by\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface ImageItem {\n id: string;\n name: string;\n type: string;\n tags: string[];\n}\n\nclass ListImagesByTagToolImpl implements IAiSdkTool<Input> {\n readonly name = \"listImagesByTag\";\n readonly description =\n \"Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.\";\n readonly inputSchema = inputSchema;\n\n constructor(private listFiles: ListFilesUseCase.Interface) {}\n\n async execute(input: Input): Promise<ImageItem[]> {\n console.log(\"Call images tool\", input);\n const result = await this.listFiles.execute({\n where: {\n type_startsWith: \"image/\",\n tags_in: [input.tag]\n },\n limit: 50\n });\n\n if (result.isFail()) {\n return [];\n }\n\n return result.value.items.map(file => ({\n id: file.id,\n name: file.name,\n type: file.type,\n tags: file.tags\n }));\n }\n}\n\nexport const ListImagesByTagTool = AiSdkTool.createImplementation({\n implementation: ListImagesByTagToolImpl,\n dependencies: [ListFilesUseCase]\n});\n"],"names":["inputSchema","z","ListImagesByTagToolImpl","listFiles","input","console","result","file","ListImagesByTagTool","AiSdkTool","ListFilesUseCase"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,KAAKA,EAAE,MAAM,GAAG,QAAQ,CAAC;AAC7B;AAWA,MAAMC;IAMF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aALX,IAAI,GAAG;aACP,WAAW,GAChB;aACK,WAAW,GAAGH;IAEqC;IAE5D,MAAM,QAAQI,KAAY,EAAwB;QAC9CC,QAAQ,GAAG,CAAC,oBAAoBD;QAChC,MAAME,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YACxC,OAAO;gBACH,iBAAiB;gBACjB,SAAS;oBAACF,MAAM,GAAG;iBAAC;YACxB;YACA,OAAO;QACX;QAEA,IAAIE,OAAO,MAAM,IACb,OAAO,EAAE;QAGb,OAAOA,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAACC,CAAAA,OAAS;gBACnC,IAAIA,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;IACJ;AACJ;AAEO,MAAMC,sBAAsBC,UAAU,oBAAoB,CAAC;IAC9D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
@@ -0,0 +1,4 @@
1
+ export declare const ListImagesByTagToolFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { ListImagesByTagTool } from "./ListImagesByTagTool.js";
3
+ const ListImagesByTagToolFeature = createFeature({
4
+ name: "AiPowerUps/ListImagesByTagTool",
5
+ register (container) {
6
+ container.register(ListImagesByTagTool);
7
+ }
8
+ });
9
+ export { ListImagesByTagToolFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/ListImagesByTagTool/feature.js","sources":["../../../../src/features/file/ListImagesByTagTool/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListImagesByTagTool } from \"./ListImagesByTagTool.js\";\n\nexport const ListImagesByTagToolFeature = createFeature({\n name: \"AiPowerUps/ListImagesByTagTool\",\n register(container) {\n container.register(ListImagesByTagTool);\n }\n});\n"],"names":["ListImagesByTagToolFeature","createFeature","container","ListImagesByTagTool"],"mappings":";;AAGO,MAAMA,6BAA6BC,cAAc;IACpD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,47 +1,42 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { GetUniqueFieldValuesUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetUniqueFieldValues";
3
- import { ListTagsRepository as RepositoryAbstraction } from "./abstractions.js";
3
+ import { ListTagsRepository } from "./abstractions.js";
4
4
  import { FileModel } from "../../../domain/file/abstractions.js";
5
5
  import { FilePersistenceError } from "../../../domain/file/errors.js";
6
6
  import { CmsWhereMapper } from "@webiny/api-headless-cms";
7
7
  class ListTagsRepositoryImpl {
8
- constructor(getUniqueFieldValues, fileModel, cmsWhereMapper) {
9
- this.getUniqueFieldValues = getUniqueFieldValues;
10
- this.fileModel = fileModel;
11
- this.cmsWhereMapper = cmsWhereMapper;
12
- }
13
- async execute(input) {
14
- const result = await this.getUniqueFieldValues.execute(this.fileModel, {
15
- fieldId: "tags",
16
- // TODO fix with proper types
17
- // @ts-expect-error
18
- where: this.cmsWhereMapper.map({
19
- input: {
20
- ...(input.where || {}),
21
- latest: true
22
- },
23
- fields: this.fileModel.fields
24
- })
25
- });
26
- if (result.isFail()) {
27
- return Result.fail(new FilePersistenceError(result.error));
8
+ constructor(getUniqueFieldValues, fileModel, cmsWhereMapper){
9
+ this.getUniqueFieldValues = getUniqueFieldValues;
10
+ this.fileModel = fileModel;
11
+ this.cmsWhereMapper = cmsWhereMapper;
12
+ }
13
+ async execute(input) {
14
+ const result = await this.getUniqueFieldValues.execute(this.fileModel, {
15
+ fieldId: "tags",
16
+ where: this.cmsWhereMapper.map({
17
+ input: {
18
+ ...input.where || {},
19
+ latest: true
20
+ },
21
+ fields: this.fileModel.fields
22
+ })
23
+ });
24
+ if (result.isFail()) return Result.fail(new FilePersistenceError(result.error));
25
+ const tags = result.value.map((uv)=>({
26
+ tag: uv.value,
27
+ count: uv.count
28
+ })).sort((a, b)=>a.tag < b.tag ? -1 : 1).sort((a, b)=>a.count > b.count ? -1 : 1);
29
+ return Result.ok(tags);
28
30
  }
29
-
30
- // Map to TagItem format
31
- const tags = result.value.map(uv => ({
32
- tag: uv.value,
33
- count: uv.count
34
- }))
35
- // Sort by tag name alphabetically
36
- .sort((a, b) => a.tag < b.tag ? -1 : 1)
37
- // Then sort by count descending (most used first)
38
- .sort((a, b) => a.count > b.count ? -1 : 1);
39
- return Result.ok(tags);
40
- }
41
31
  }
42
- export const ListTagsRepository = RepositoryAbstraction.createImplementation({
43
- implementation: ListTagsRepositoryImpl,
44
- dependencies: [GetUniqueFieldValuesUseCase, FileModel, CmsWhereMapper]
32
+ const ListTagsRepository_ListTagsRepository = ListTagsRepository.createImplementation({
33
+ implementation: ListTagsRepositoryImpl,
34
+ dependencies: [
35
+ GetUniqueFieldValuesUseCase,
36
+ FileModel,
37
+ CmsWhereMapper
38
+ ]
45
39
  });
40
+ export { ListTagsRepository_ListTagsRepository as ListTagsRepository };
46
41
 
47
42
  //# sourceMappingURL=ListTagsRepository.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Result","GetUniqueFieldValuesUseCase","ListTagsRepository","RepositoryAbstraction","FileModel","FilePersistenceError","CmsWhereMapper","ListTagsRepositoryImpl","constructor","getUniqueFieldValues","fileModel","cmsWhereMapper","execute","input","result","fieldId","where","map","latest","fields","isFail","fail","error","tags","value","uv","tag","count","sort","a","b","ok","createImplementation","implementation","dependencies"],"sources":["ListTagsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetUniqueFieldValuesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetUniqueFieldValues\";\nimport {\n ListTagsInput,\n ListTagsRepository as RepositoryAbstraction,\n TagItem\n} from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport { FilePersistenceError } from \"~/domain/file/errors.js\";\nimport { CmsWhereMapper } from \"@webiny/api-headless-cms\";\n\nclass ListTagsRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private getUniqueFieldValues: GetUniqueFieldValuesUseCase.Interface,\n private fileModel: FileModel.Interface,\n private cmsWhereMapper: CmsWhereMapper.Interface\n ) {}\n\n async execute(input: ListTagsInput): Promise<Result<TagItem[], RepositoryAbstraction.Error>> {\n const result = await this.getUniqueFieldValues.execute(this.fileModel, {\n fieldId: \"tags\",\n // TODO fix with proper types\n // @ts-expect-error\n where: this.cmsWhereMapper.map({\n input: {\n ...(input.where || {}),\n latest: true\n },\n fields: this.fileModel.fields\n })\n });\n\n if (result.isFail()) {\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n // Map to TagItem format\n const tags: TagItem[] = result.value\n .map(uv => ({\n tag: uv.value as string,\n count: uv.count\n }))\n // Sort by tag name alphabetically\n .sort((a, b) => (a.tag < b.tag ? -1 : 1))\n // Then sort by count descending (most used first)\n .sort((a, b) => (a.count > b.count ? -1 : 1));\n\n return Result.ok(tags);\n }\n}\n\nexport const ListTagsRepository = RepositoryAbstraction.createImplementation({\n implementation: ListTagsRepositoryImpl,\n dependencies: [GetUniqueFieldValuesUseCase, FileModel, CmsWhereMapper]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,2BAA2B,QAAQ,qEAAqE;AACjH,SAEIC,kBAAkB,IAAIC,qBAAqB;AAG/C,SAASC,SAAS;AAClB,SAASC,oBAAoB;AAC7B,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,MAAMC,sBAAsB,CAA4C;EACpEC,WAAWA,CACCC,oBAA2D,EAC3DC,SAA8B,EAC9BC,cAAwC,EAClD;IAAA,KAHUF,oBAA2D,GAA3DA,oBAA2D;IAAA,KAC3DC,SAA8B,GAA9BA,SAA8B;IAAA,KAC9BC,cAAwC,GAAxCA,cAAwC;EACjD;EAEH,MAAMC,OAAOA,CAACC,KAAoB,EAA2D;IACzF,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACL,oBAAoB,CAACG,OAAO,CAAC,IAAI,CAACF,SAAS,EAAE;MACnEK,OAAO,EAAE,MAAM;MACf;MACA;MACAC,KAAK,EAAE,IAAI,CAACL,cAAc,CAACM,GAAG,CAAC;QAC3BJ,KAAK,EAAE;UACH,IAAIA,KAAK,CAACG,KAAK,IAAI,CAAC,CAAC,CAAC;UACtBE,MAAM,EAAE;QACZ,CAAC;QACDC,MAAM,EAAE,IAAI,CAACT,SAAS,CAACS;MAC3B,CAAC;IACL,CAAC,CAAC;IAEF,IAAIL,MAAM,CAACM,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOpB,MAAM,CAACqB,IAAI,CAAC,IAAIhB,oBAAoB,CAACS,MAAM,CAACQ,KAAK,CAAC,CAAC;IAC9D;;IAEA;IACA,MAAMC,IAAe,GAAGT,MAAM,CAACU,KAAK,CAC/BP,GAAG,CAACQ,EAAE,KAAK;MACRC,GAAG,EAAED,EAAE,CAACD,KAAe;MACvBG,KAAK,EAAEF,EAAE,CAACE;IACd,CAAC,CAAC;IACF;IAAA,CACCC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAACH,GAAG,GAAGI,CAAC,CAACJ,GAAG,GAAG,CAAC,CAAC,GAAG,CAAE;IACxC;IAAA,CACCE,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAACF,KAAK,GAAGG,CAAC,CAACH,KAAK,GAAG,CAAC,CAAC,GAAG,CAAE,CAAC;IAEjD,OAAO3B,MAAM,CAAC+B,EAAE,CAACR,IAAI,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMrB,kBAAkB,GAAGC,qBAAqB,CAAC6B,oBAAoB,CAAC;EACzEC,cAAc,EAAE1B,sBAAsB;EACtC2B,YAAY,EAAE,CAACjC,2BAA2B,EAAEG,SAAS,EAAEE,cAAc;AACzE,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/file/ListTags/ListTagsRepository.js","sources":["../../../../src/features/file/ListTags/ListTagsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetUniqueFieldValuesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetUniqueFieldValues\";\nimport {\n ListTagsInput,\n ListTagsRepository as RepositoryAbstraction,\n TagItem\n} from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport { FilePersistenceError } from \"~/domain/file/errors.js\";\nimport { CmsWhereMapper } from \"@webiny/api-headless-cms\";\n\nclass ListTagsRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private getUniqueFieldValues: GetUniqueFieldValuesUseCase.Interface,\n private fileModel: FileModel.Interface,\n private cmsWhereMapper: CmsWhereMapper.Interface\n ) {}\n\n async execute(input: ListTagsInput): Promise<Result<TagItem[], RepositoryAbstraction.Error>> {\n const result = await this.getUniqueFieldValues.execute(this.fileModel, {\n fieldId: \"tags\",\n // TODO fix with proper types\n // @ts-expect-error\n where: this.cmsWhereMapper.map({\n input: {\n ...(input.where || {}),\n latest: true\n },\n fields: this.fileModel.fields\n })\n });\n\n if (result.isFail()) {\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n // Map to TagItem format\n const tags: TagItem[] = result.value\n .map(uv => ({\n tag: uv.value as string,\n count: uv.count\n }))\n // Sort by tag name alphabetically\n .sort((a, b) => (a.tag < b.tag ? -1 : 1))\n // Then sort by count descending (most used first)\n .sort((a, b) => (a.count > b.count ? -1 : 1));\n\n return Result.ok(tags);\n }\n}\n\nexport const ListTagsRepository = RepositoryAbstraction.createImplementation({\n implementation: ListTagsRepositoryImpl,\n dependencies: [GetUniqueFieldValuesUseCase, FileModel, CmsWhereMapper]\n});\n"],"names":["ListTagsRepositoryImpl","getUniqueFieldValues","fileModel","cmsWhereMapper","input","result","Result","FilePersistenceError","tags","uv","a","b","ListTagsRepository","RepositoryAbstraction","GetUniqueFieldValuesUseCase","FileModel","CmsWhereMapper"],"mappings":";;;;;;AAWA,MAAMA;IACF,YACYC,oBAA2D,EAC3DC,SAA8B,EAC9BC,cAAwC,CAClD;aAHUF,oBAAoB,GAApBA;aACAC,SAAS,GAATA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQC,KAAoB,EAA2D;QACzF,MAAMC,SAAS,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE;YACnE,SAAS;YAGT,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;gBAC3B,OAAO;oBACH,GAAID,MAAM,KAAK,IAAI,CAAC,CAAC;oBACrB,QAAQ;gBACZ;gBACA,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM;YACjC;QACJ;QAEA,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAAC,IAAIC,qBAAqBF,OAAO,KAAK;QAI5D,MAAMG,OAAkBH,OAAO,KAAK,CAC/B,GAAG,CAACI,CAAAA,KAAO;gBACR,KAAKA,GAAG,KAAK;gBACb,OAAOA,GAAG,KAAK;YACnB,IAEC,IAAI,CAAC,CAACC,GAAGC,IAAOD,EAAE,GAAG,GAAGC,EAAE,GAAG,GAAG,KAAK,GAErC,IAAI,CAAC,CAACD,GAAGC,IAAOD,EAAE,KAAK,GAAGC,EAAE,KAAK,GAAG,KAAK;QAE9C,OAAOL,OAAO,EAAE,CAACE;IACrB;AACJ;AAEO,MAAMI,wCAAqBC,mBAAAA,oBAA0C,CAAC;IACzE,gBAAgBb;IAChB,cAAc;QAACc;QAA6BC;QAAWC;KAAe;AAC1E"}
@@ -1,10 +1,10 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { ListTagsUseCase as UseCaseAbstraction, ListTagsInput, TagItem, ListTagsRepository } from "./abstractions.js";
3
- import { FilePermissions } from "../../../features/shared/abstractions.js";
3
+ import { FmPermissions } from "../../../features/shared/abstractions.js";
4
4
  declare class ListTagsUseCaseImpl implements UseCaseAbstraction.Interface {
5
- private filePermissions;
5
+ private permissions;
6
6
  private repository;
7
- constructor(filePermissions: FilePermissions.Interface, repository: ListTagsRepository.Interface);
7
+ constructor(permissions: FmPermissions.Interface, repository: ListTagsRepository.Interface);
8
8
  execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseAbstraction.Error>>;
9
9
  }
10
10
  export declare const ListTagsUseCase: typeof ListTagsUseCaseImpl & {
@@ -1,32 +1,31 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { ListTagsUseCase as UseCaseAbstraction, ListTagsRepository } from "./abstractions.js";
2
+ import { ListTagsRepository, ListTagsUseCase } from "./abstractions.js";
3
3
  import { FileNotAuthorizedError } from "../../../domain/file/errors.js";
4
- import { FilePermissions } from "../../shared/abstractions.js";
4
+ import { FmPermissions } from "../../shared/abstractions.js";
5
5
  class ListTagsUseCaseImpl {
6
- constructor(filePermissions, repository) {
7
- this.filePermissions = filePermissions;
8
- this.repository = repository;
9
- }
10
- async execute(input) {
11
- // Check permission (ensure() with no args checks basic access)
12
- const hasPermission = await this.filePermissions.ensure();
13
- if (!hasPermission) {
14
- return Result.fail(new FileNotAuthorizedError());
6
+ constructor(permissions, repository){
7
+ this.permissions = permissions;
8
+ this.repository = repository;
15
9
  }
16
- const enrichedInput = {
17
- ...input,
18
- limit: input.limit || 1000000
19
- };
20
- const result = await this.repository.execute(enrichedInput);
21
- if (result.isFail()) {
22
- return Result.fail(result.error);
10
+ async execute(input) {
11
+ const hasPermission = await this.permissions.canAccess("file");
12
+ if (!hasPermission) return Result.fail(new FileNotAuthorizedError());
13
+ const enrichedInput = {
14
+ ...input,
15
+ limit: input.limit || 1000000
16
+ };
17
+ const result = await this.repository.execute(enrichedInput);
18
+ if (result.isFail()) return Result.fail(result.error);
19
+ return Result.ok(result.value);
23
20
  }
24
- return Result.ok(result.value);
25
- }
26
21
  }
27
- export const ListTagsUseCase = UseCaseAbstraction.createImplementation({
28
- implementation: ListTagsUseCaseImpl,
29
- dependencies: [FilePermissions, ListTagsRepository]
22
+ const ListTagsUseCase_ListTagsUseCase = ListTagsUseCase.createImplementation({
23
+ implementation: ListTagsUseCaseImpl,
24
+ dependencies: [
25
+ FmPermissions,
26
+ ListTagsRepository
27
+ ]
30
28
  });
29
+ export { ListTagsUseCase_ListTagsUseCase as ListTagsUseCase };
31
30
 
32
31
  //# sourceMappingURL=ListTagsUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Result","ListTagsUseCase","UseCaseAbstraction","ListTagsRepository","FileNotAuthorizedError","FilePermissions","ListTagsUseCaseImpl","constructor","filePermissions","repository","execute","input","hasPermission","ensure","fail","enrichedInput","limit","result","isFail","error","ok","value","createImplementation","implementation","dependencies"],"sources":["ListTagsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n ListTagsUseCase as UseCaseAbstraction,\n ListTagsInput,\n TagItem,\n ListTagsRepository\n} from \"./abstractions.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FilePermissions } from \"~/features/shared/abstractions.js\";\n\nclass ListTagsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private filePermissions: FilePermissions.Interface,\n private repository: ListTagsRepository.Interface\n ) {}\n\n async execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseAbstraction.Error>> {\n // Check permission (ensure() with no args checks basic access)\n const hasPermission = await this.filePermissions.ensure();\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const enrichedInput: ListTagsInput = {\n ...input,\n limit: input.limit || 1000000\n };\n\n const result = await this.repository.execute(enrichedInput);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const ListTagsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListTagsUseCaseImpl,\n dependencies: [FilePermissions, ListTagsRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,eAAe,IAAIC,kBAAkB,EAGrCC,kBAAkB;AAEtB,SAASC,sBAAsB;AAC/B,SAASC,eAAe;AAExB,MAAMC,mBAAmB,CAAyC;EAC9DC,WAAWA,CACCC,eAA0C,EAC1CC,UAAwC,EAClD;IAAA,KAFUD,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,UAAwC,GAAxCA,UAAwC;EACjD;EAEH,MAAMC,OAAOA,CAACC,KAAoB,EAAwD;IACtF;IACA,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACJ,eAAe,CAACK,MAAM,CAAC,CAAC;IACzD,IAAI,CAACD,aAAa,EAAE;MAChB,OAAOZ,MAAM,CAACc,IAAI,CAAC,IAAIV,sBAAsB,CAAC,CAAC,CAAC;IACpD;IAEA,MAAMW,aAA4B,GAAG;MACjC,GAAGJ,KAAK;MACRK,KAAK,EAAEL,KAAK,CAACK,KAAK,IAAI;IAC1B,CAAC;IAED,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACR,UAAU,CAACC,OAAO,CAACK,aAAa,CAAC;IAE3D,IAAIE,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOlB,MAAM,CAACc,IAAI,CAACG,MAAM,CAACE,KAAK,CAAC;IACpC;IAEA,OAAOnB,MAAM,CAACoB,EAAE,CAACH,MAAM,CAACI,KAAK,CAAC;EAClC;AACJ;AAEA,OAAO,MAAMpB,eAAe,GAAGC,kBAAkB,CAACoB,oBAAoB,CAAC;EACnEC,cAAc,EAAEjB,mBAAmB;EACnCkB,YAAY,EAAE,CAACnB,eAAe,EAAEF,kBAAkB;AACtD,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/file/ListTags/ListTagsUseCase.js","sources":["../../../../src/features/file/ListTags/ListTagsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n ListTagsUseCase as UseCaseAbstraction,\n ListTagsInput,\n TagItem,\n ListTagsRepository\n} from \"./abstractions.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\n\nclass ListTagsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: FmPermissions.Interface,\n private repository: ListTagsRepository.Interface\n ) {}\n\n async execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canAccess(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const enrichedInput: ListTagsInput = {\n ...input,\n limit: input.limit || 1000000\n };\n\n const result = await this.repository.execute(enrichedInput);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const ListTagsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListTagsUseCaseImpl,\n dependencies: [FmPermissions, ListTagsRepository]\n});\n"],"names":["ListTagsUseCaseImpl","permissions","repository","input","hasPermission","Result","FileNotAuthorizedError","enrichedInput","result","ListTagsUseCase","UseCaseAbstraction","FmPermissions","ListTagsRepository"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAAoC,EACpCC,UAAwC,CAClD;aAFUD,WAAW,GAAXA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QAAQC,KAAoB,EAAwD;QACtF,MAAMC,gBAAgB,MAAM,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;QACvD,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,gBAA+B;YACjC,GAAGJ,KAAK;YACR,OAAOA,MAAM,KAAK,IAAI;QAC1B;QAEA,MAAMK,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAACD;QAE7C,IAAIC,OAAO,MAAM,IACb,OAAOH,OAAO,IAAI,CAACG,OAAO,KAAK;QAGnC,OAAOH,OAAO,EAAE,CAACG,OAAO,KAAK;IACjC;AACJ;AAEO,MAAMC,kCAAkBC,gBAAAA,oBAAuC,CAAC;IACnE,gBAAgBV;IAChB,cAAc;QAACW;QAAeC;KAAmB;AACrD"}
@@ -19,6 +19,7 @@ export interface IListTagsRepositoryErrors {
19
19
  persistence: FilePersistenceError;
20
20
  }
21
21
  type RepositoryError = IListTagsRepositoryErrors[keyof IListTagsRepositoryErrors];
22
+ /** Fetch file tags from storage. */
22
23
  export declare const ListTagsRepository: import("@webiny/di").Abstraction<IListTagsRepository>;
23
24
  export declare namespace ListTagsRepository {
24
25
  type Interface = IListTagsRepository;
@@ -35,6 +36,7 @@ export interface IListTagsUseCaseErrors {
35
36
  persistence: FilePersistenceError;
36
37
  }
37
38
  type UseCaseError = IListTagsUseCaseErrors[keyof IListTagsUseCaseErrors];
39
+ /** List all file tags. */
38
40
  export declare const ListTagsUseCase: import("@webiny/di").Abstraction<IListTagsUseCase>;
39
41
  export declare namespace ListTagsUseCase {
40
42
  type Interface = IListTagsUseCase;
@@ -1,15 +1,6 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
-
3
- /**
4
- * ListTags repository interface
5
- */
6
-
7
- export const ListTagsRepository = createAbstraction("ListTagsRepository");
8
-
9
- /**
10
- * ListTags use case interface
11
- */
12
-
13
- export const ListTagsUseCase = createAbstraction("ListTagsUseCase");
2
+ const ListTagsRepository = createAbstraction("ListTagsRepository");
3
+ const ListTagsUseCase = createAbstraction("ListTagsUseCase");
4
+ export { ListTagsRepository, ListTagsUseCase };
14
5
 
15
6
  //# sourceMappingURL=abstractions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","ListTagsRepository","ListTagsUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport { type FilePersistenceError, FileNotAuthorizedError } from \"~/domain/file/errors.js\";\n\nexport interface ListTagsInput {\n where?: Record<string, any>;\n after?: string | null;\n limit?: number;\n}\n\nexport interface TagItem {\n tag: string;\n count: number;\n}\n\n/**\n * ListTags repository interface\n */\nexport interface IListTagsRepository {\n execute(input: ListTagsInput): Promise<Result<TagItem[], RepositoryError>>;\n}\n\nexport interface IListTagsRepositoryErrors {\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IListTagsRepositoryErrors[keyof IListTagsRepositoryErrors];\n\nexport const ListTagsRepository = createAbstraction<IListTagsRepository>(\"ListTagsRepository\");\n\nexport namespace ListTagsRepository {\n export type Interface = IListTagsRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * ListTags use case interface\n */\nexport interface IListTagsUseCase {\n execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseError>>;\n}\n\nexport interface IListTagsUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IListTagsUseCaseErrors[keyof IListTagsUseCaseErrors];\n\nexport const ListTagsUseCase = createAbstraction<IListTagsUseCase>(\"ListTagsUseCase\");\n\nexport namespace ListTagsUseCase {\n export type Interface = IListTagsUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAevD;AACA;AACA;;AAWA,OAAO,MAAMC,kBAAkB,GAAGD,iBAAiB,CAAsB,oBAAoB,CAAC;;AAO9F;AACA;AACA;;AAYA,OAAO,MAAME,eAAe,GAAGF,iBAAiB,CAAmB,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/file/ListTags/abstractions.js","sources":["../../../../src/features/file/ListTags/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport { type FilePersistenceError, FileNotAuthorizedError } from \"~/domain/file/errors.js\";\n\nexport interface ListTagsInput {\n where?: Record<string, any>;\n after?: string | null;\n limit?: number;\n}\n\nexport interface TagItem {\n tag: string;\n count: number;\n}\n\n/**\n * ListTags repository interface\n */\nexport interface IListTagsRepository {\n execute(input: ListTagsInput): Promise<Result<TagItem[], RepositoryError>>;\n}\n\nexport interface IListTagsRepositoryErrors {\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IListTagsRepositoryErrors[keyof IListTagsRepositoryErrors];\n\n/** Fetch file tags from storage. */\nexport const ListTagsRepository = createAbstraction<IListTagsRepository>(\"ListTagsRepository\");\n\nexport namespace ListTagsRepository {\n export type Interface = IListTagsRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * ListTags use case interface\n */\nexport interface IListTagsUseCase {\n execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseError>>;\n}\n\nexport interface IListTagsUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IListTagsUseCaseErrors[keyof IListTagsUseCaseErrors];\n\n/** List all file tags. */\nexport const ListTagsUseCase = createAbstraction<IListTagsUseCase>(\"ListTagsUseCase\");\n\nexport namespace ListTagsUseCase {\n export type Interface = IListTagsUseCase;\n export type Error = UseCaseError;\n}\n"],"names":["ListTagsRepository","createAbstraction","ListTagsUseCase"],"mappings":";AA6BO,MAAMA,qBAAqBC,kBAAuC;AAsBlE,MAAMC,kBAAkBD,kBAAoC"}
@@ -1 +1,4 @@
1
- export declare const ListTagsFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const ListTagsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1,12 +1,13 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { ListTagsRepository } from "./ListTagsRepository.js";
3
3
  import { ListTagsUseCase } from "./ListTagsUseCase.js";
4
- export const ListTagsFeature = createFeature({
5
- name: "FileManager/ListTags",
6
- register(container) {
7
- container.register(ListTagsUseCase);
8
- container.register(ListTagsRepository).inSingletonScope();
9
- }
4
+ const ListTagsFeature = createFeature({
5
+ name: "FileManager/ListTags",
6
+ register (container) {
7
+ container.register(ListTagsUseCase);
8
+ container.register(ListTagsRepository).inSingletonScope();
9
+ }
10
10
  });
11
+ export { ListTagsFeature };
11
12
 
12
13
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","ListTagsRepository","ListTagsUseCase","ListTagsFeature","name","register","container","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListTagsRepository } from \"./ListTagsRepository.js\";\nimport { ListTagsUseCase } from \"./ListTagsUseCase.js\";\n\nexport const ListTagsFeature = createFeature({\n name: \"FileManager/ListTags\",\n register(container) {\n container.register(ListTagsUseCase);\n container.register(ListTagsRepository).inSingletonScope();\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,kBAAkB;AAC3B,SAASC,eAAe;AAExB,OAAO,MAAMC,eAAe,GAAGH,aAAa,CAAC;EACzCI,IAAI,EAAE,sBAAsB;EAC5BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,eAAe,CAAC;IACnCI,SAAS,CAACD,QAAQ,CAACJ,kBAAkB,CAAC,CAACM,gBAAgB,CAAC,CAAC;EAC7D;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/file/ListTags/feature.js","sources":["../../../../src/features/file/ListTags/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListTagsRepository } from \"./ListTagsRepository.js\";\nimport { ListTagsUseCase } from \"./ListTagsUseCase.js\";\n\nexport const ListTagsFeature = createFeature({\n name: \"FileManager/ListTags\",\n register(container) {\n container.register(ListTagsUseCase);\n container.register(ListTagsRepository).inSingletonScope();\n }\n});\n"],"names":["ListTagsFeature","createFeature","container","ListTagsUseCase","ListTagsRepository"],"mappings":";;;AAIO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,oBAAoB,gBAAgB;IAC3D;AACJ"}
@@ -1,3 +1 @@
1
1
  export { ListTagsUseCase } from "./abstractions.js";
2
-
3
- //# sourceMappingURL=index.js.map
@@ -1,39 +1,37 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry";
3
- import { UpdateFileRepository as RepositoryAbstraction } from "./abstractions.js";
3
+ import { UpdateFileRepository } from "./abstractions.js";
4
4
  import { FileModel } from "../../../domain/file/abstractions.js";
5
5
  import { FileNotAuthorizedError, FileNotFoundError, FilePersistenceError } from "../../../domain/file/errors.js";
6
6
  import { FileToEntryMapper } from "../shared/FileToEntryMapper.js";
7
7
  class UpdateFileRepositoryImpl {
8
- constructor(updateEntry, fileModel) {
9
- this.updateEntry = updateEntry;
10
- this.fileModel = fileModel;
11
- }
12
- async update(file) {
13
- const entry = FileToEntryMapper.toEntry(file);
14
-
15
- // Files are not versioned, so we're always updating the same revision
16
- const id = `${file.id}#0001`;
17
- const result = await this.updateEntry.execute(this.fileModel, id, {
18
- wbyAco_location: file.location,
19
- values: entry.values
20
- });
21
- if (result.isFail()) {
22
- const error = result.error;
23
- if (error.code === "Cms/Entry/NotFound") {
24
- return Result.fail(new FileNotFoundError(id));
25
- }
26
- if (error.code === "Cms/Entry/NotAuthorized") {
27
- return Result.fail(new FileNotAuthorizedError());
28
- }
29
- return Result.fail(new FilePersistenceError(result.error));
8
+ constructor(updateEntry, fileModel){
9
+ this.updateEntry = updateEntry;
10
+ this.fileModel = fileModel;
11
+ }
12
+ async update(file) {
13
+ const entry = FileToEntryMapper.toEntry(file);
14
+ const id = `${file.id}#0001`;
15
+ const result = await this.updateEntry.execute(this.fileModel, id, {
16
+ wbyAco_location: file.location,
17
+ values: entry.values
18
+ });
19
+ if (result.isFail()) {
20
+ const error = result.error;
21
+ if ("Cms/Entry/NotFound" === error.code) return Result.fail(new FileNotFoundError(id));
22
+ if ("Cms/Entry/NotAuthorized" === error.code) return Result.fail(new FileNotAuthorizedError());
23
+ return Result.fail(new FilePersistenceError(result.error));
24
+ }
25
+ return Result.ok();
30
26
  }
31
- return Result.ok();
32
- }
33
27
  }
34
- export const UpdateFileRepository = RepositoryAbstraction.createImplementation({
35
- implementation: UpdateFileRepositoryImpl,
36
- dependencies: [UpdateEntryUseCase, FileModel]
28
+ const UpdateFileRepository_UpdateFileRepository = UpdateFileRepository.createImplementation({
29
+ implementation: UpdateFileRepositoryImpl,
30
+ dependencies: [
31
+ UpdateEntryUseCase,
32
+ FileModel
33
+ ]
37
34
  });
35
+ export { UpdateFileRepository_UpdateFileRepository as UpdateFileRepository };
38
36
 
39
37
  //# sourceMappingURL=UpdateFileRepository.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UpdateEntryUseCase","UpdateFileRepository","RepositoryAbstraction","FileModel","FileNotAuthorizedError","FileNotFoundError","FilePersistenceError","FileToEntryMapper","UpdateFileRepositoryImpl","constructor","updateEntry","fileModel","update","file","entry","toEntry","id","result","execute","wbyAco_location","location","values","isFail","error","code","fail","ok","createImplementation","implementation","dependencies"],"sources":["UpdateFileRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { UpdateFileRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport type { File } from \"~/domain/file/types.js\";\nimport {\n FileNotAuthorizedError,\n FileNotFoundError,\n FilePersistenceError\n} from \"~/domain/file/errors.js\";\nimport { FileToEntryMapper } from \"../shared/FileToEntryMapper.js\";\n\nclass UpdateFileRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private updateEntry: UpdateEntryUseCase.Interface,\n private fileModel: FileModel.Interface\n ) {}\n\n async update(file: File): Promise<Result<void, RepositoryAbstraction.Error>> {\n const entry = FileToEntryMapper.toEntry(file);\n\n // Files are not versioned, so we're always updating the same revision\n const id = `${file.id}#0001`;\n\n const result = await this.updateEntry.execute(this.fileModel, id, {\n wbyAco_location: file.location,\n values: entry.values\n });\n\n if (result.isFail()) {\n const error = result.error;\n if (error.code === \"Cms/Entry/NotFound\") {\n return Result.fail(new FileNotFoundError(id));\n }\n\n if (error.code === \"Cms/Entry/NotAuthorized\") {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n return Result.ok();\n }\n}\n\nexport const UpdateFileRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateFileRepositoryImpl,\n dependencies: [UpdateEntryUseCase, FileModel]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,kBAAkB,QAAQ,4DAA4D;AAC/F,SAASC,oBAAoB,IAAIC,qBAAqB;AACtD,SAASC,SAAS;AAElB,SACIC,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB;AAExB,SAASC,iBAAiB;AAE1B,MAAMC,wBAAwB,CAA4C;EACtEC,WAAWA,CACCC,WAAyC,EACzCC,SAA8B,EACxC;IAAA,KAFUD,WAAyC,GAAzCA,WAAyC;IAAA,KACzCC,SAA8B,GAA9BA,SAA8B;EACvC;EAEH,MAAMC,MAAMA,CAACC,IAAU,EAAsD;IACzE,MAAMC,KAAK,GAAGP,iBAAiB,CAACQ,OAAO,CAACF,IAAI,CAAC;;IAE7C;IACA,MAAMG,EAAE,GAAG,GAAGH,IAAI,CAACG,EAAE,OAAO;IAE5B,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACP,WAAW,CAACQ,OAAO,CAAC,IAAI,CAACP,SAAS,EAAEK,EAAE,EAAE;MAC9DG,eAAe,EAAEN,IAAI,CAACO,QAAQ;MAC9BC,MAAM,EAAEP,KAAK,CAACO;IAClB,CAAC,CAAC;IAEF,IAAIJ,MAAM,CAACK,MAAM,CAAC,CAAC,EAAE;MACjB,MAAMC,KAAK,GAAGN,MAAM,CAACM,KAAK;MAC1B,IAAIA,KAAK,CAACC,IAAI,KAAK,oBAAoB,EAAE;QACrC,OAAOzB,MAAM,CAAC0B,IAAI,CAAC,IAAIpB,iBAAiB,CAACW,EAAE,CAAC,CAAC;MACjD;MAEA,IAAIO,KAAK,CAACC,IAAI,KAAK,yBAAyB,EAAE;QAC1C,OAAOzB,MAAM,CAAC0B,IAAI,CAAC,IAAIrB,sBAAsB,CAAC,CAAC,CAAC;MACpD;MAEA,OAAOL,MAAM,CAAC0B,IAAI,CAAC,IAAInB,oBAAoB,CAACW,MAAM,CAACM,KAAK,CAAC,CAAC;IAC9D;IAEA,OAAOxB,MAAM,CAAC2B,EAAE,CAAC,CAAC;EACtB;AACJ;AAEA,OAAO,MAAMzB,oBAAoB,GAAGC,qBAAqB,CAACyB,oBAAoB,CAAC;EAC3EC,cAAc,EAAEpB,wBAAwB;EACxCqB,YAAY,EAAE,CAAC7B,kBAAkB,EAAEG,SAAS;AAChD,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/file/UpdateFile/UpdateFileRepository.js","sources":["../../../../src/features/file/UpdateFile/UpdateFileRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry\";\nimport { UpdateFileRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport type { File } from \"~/domain/file/types.js\";\nimport {\n FileNotAuthorizedError,\n FileNotFoundError,\n FilePersistenceError\n} from \"~/domain/file/errors.js\";\nimport { FileToEntryMapper } from \"../shared/FileToEntryMapper.js\";\n\nclass UpdateFileRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private updateEntry: UpdateEntryUseCase.Interface,\n private fileModel: FileModel.Interface\n ) {}\n\n async update(file: File): Promise<Result<void, RepositoryAbstraction.Error>> {\n const entry = FileToEntryMapper.toEntry(file);\n\n // Files are not versioned, so we're always updating the same revision\n const id = `${file.id}#0001`;\n\n const result = await this.updateEntry.execute(this.fileModel, id, {\n wbyAco_location: file.location,\n values: entry.values\n });\n\n if (result.isFail()) {\n const error = result.error;\n if (error.code === \"Cms/Entry/NotFound\") {\n return Result.fail(new FileNotFoundError(id));\n }\n\n if (error.code === \"Cms/Entry/NotAuthorized\") {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n return Result.ok();\n }\n}\n\nexport const UpdateFileRepository = RepositoryAbstraction.createImplementation({\n implementation: UpdateFileRepositoryImpl,\n dependencies: [UpdateEntryUseCase, FileModel]\n});\n"],"names":["UpdateFileRepositoryImpl","updateEntry","fileModel","file","entry","FileToEntryMapper","id","result","error","Result","FileNotFoundError","FileNotAuthorizedError","FilePersistenceError","UpdateFileRepository","RepositoryAbstraction","UpdateEntryUseCase","FileModel"],"mappings":";;;;;;AAYA,MAAMA;IACF,YACYC,WAAyC,EACzCC,SAA8B,CACxC;aAFUD,WAAW,GAAXA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,OAAOC,IAAU,EAAsD;QACzE,MAAMC,QAAQC,kBAAkB,OAAO,CAACF;QAGxC,MAAMG,KAAK,GAAGH,KAAK,EAAE,CAAC,KAAK,CAAC;QAE5B,MAAMI,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAED,IAAI;YAC9D,iBAAiBH,KAAK,QAAQ;YAC9B,QAAQC,MAAM,MAAM;QACxB;QAEA,IAAIG,OAAO,MAAM,IAAI;YACjB,MAAMC,QAAQD,OAAO,KAAK;YAC1B,IAAIC,AAAe,yBAAfA,MAAM,IAAI,EACV,OAAOC,OAAO,IAAI,CAAC,IAAIC,kBAAkBJ;YAG7C,IAAIE,AAAe,8BAAfA,MAAM,IAAI,EACV,OAAOC,OAAO,IAAI,CAAC,IAAIE;YAG3B,OAAOF,OAAO,IAAI,CAAC,IAAIG,qBAAqBL,OAAO,KAAK;QAC5D;QAEA,OAAOE,OAAO,EAAE;IACpB;AACJ;AAEO,MAAMI,4CAAuBC,qBAAAA,oBAA0C,CAAC;IAC3E,gBAAgBd;IAChB,cAAc;QAACe;QAAoBC;KAAU;AACjD"}
@@ -1,17 +1,17 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { UpdateFileUseCase as UseCaseAbstraction, UpdateFileInput, UpdateFileRepository } from "./abstractions.js";
3
3
  import { GetFileUseCase } from "../GetFile/abstractions.js";
4
- import { EventPublisher } from "@webiny/api-core/features/EventPublisher";
4
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
5
5
  import type { File } from "../../../domain/file/types.js";
6
- import { FilePermissions } from "../../../features/shared/abstractions.js";
7
- import { IdentityContext } from "@webiny/api-core/features/IdentityContext";
6
+ import { FmPermissions } from "../../../features/shared/abstractions.js";
7
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
8
8
  declare class UpdateFileUseCaseImpl implements UseCaseAbstraction.Interface {
9
9
  private identityContext;
10
- private filePermissions;
10
+ private permissions;
11
11
  private getFile;
12
12
  private repository;
13
13
  private eventPublisher;
14
- constructor(identityContext: IdentityContext.Interface, filePermissions: FilePermissions.Interface, getFile: GetFileUseCase.Interface, repository: UpdateFileRepository.Interface, eventPublisher: EventPublisher.Interface);
14
+ constructor(identityContext: IdentityContext.Interface, permissions: FmPermissions.Interface, getFile: GetFileUseCase.Interface, repository: UpdateFileRepository.Interface, eventPublisher: EventPublisher.Interface);
15
15
  execute(input: UpdateFileInput): Promise<Result<File, UseCaseAbstraction.Error>>;
16
16
  }
17
17
  export declare const UpdateFileUseCase: typeof UpdateFileUseCaseImpl & {