@webiny/api-file-manager 0.0.0-unstable.78f581c1d2 → 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 (414) hide show
  1. package/README.md +7 -13
  2. package/contants.d.ts +1 -0
  3. package/contants.js +4 -0
  4. package/contants.js.map +1 -0
  5. package/delivery/AssetDelivery/Asset.d.ts +28 -0
  6. package/delivery/AssetDelivery/Asset.js +53 -0
  7. package/delivery/AssetDelivery/Asset.js.map +1 -0
  8. package/delivery/AssetDelivery/AssetRequest.d.ts +25 -0
  9. package/delivery/AssetDelivery/AssetRequest.js +23 -0
  10. package/delivery/AssetDelivery/AssetRequest.js.map +1 -0
  11. package/delivery/AssetDelivery/abstractions/AssetReply.d.ts +25 -0
  12. package/delivery/AssetDelivery/abstractions/AssetReply.js +32 -0
  13. package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -0
  14. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +2 -0
  15. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +7 -0
  16. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -0
  17. package/delivery/index.d.ts +7 -0
  18. package/delivery/index.js +6 -0
  19. package/delivery/setupAssetDelivery.d.ts +1 -0
  20. package/delivery/setupAssetDelivery.js +69 -0
  21. package/delivery/setupAssetDelivery.js.map +1 -0
  22. package/domain/file/abstractions.d.ts +9 -0
  23. package/domain/file/abstractions.js +5 -0
  24. package/domain/file/abstractions.js.map +1 -0
  25. package/domain/file/errors.d.ts +59 -0
  26. package/domain/file/errors.js +80 -0
  27. package/domain/file/errors.js.map +1 -0
  28. package/domain/file/file.model.d.ts +12 -0
  29. package/domain/file/file.model.js +65 -0
  30. package/domain/file/file.model.js.map +1 -0
  31. package/domain/file/types.d.ts +53 -0
  32. package/domain/file/types.js +0 -0
  33. package/domain/identity/Identity.d.ts +9 -0
  34. package/domain/identity/Identity.js +12 -0
  35. package/domain/identity/Identity.js.map +1 -0
  36. package/domain/permissionsSchema.d.ts +16 -0
  37. package/domain/permissionsSchema.js +30 -0
  38. package/domain/permissionsSchema.js.map +1 -0
  39. package/domain/settings/constants.d.ts +1 -0
  40. package/domain/settings/constants.js +4 -0
  41. package/domain/settings/constants.js.map +1 -0
  42. package/domain/settings/errors.d.ts +18 -0
  43. package/domain/settings/errors.js +28 -0
  44. package/domain/settings/errors.js.map +1 -0
  45. package/domain/settings/types.d.ts +10 -0
  46. package/domain/settings/types.js +0 -0
  47. package/domain/settings/validation.d.ts +6 -0
  48. package/domain/settings/validation.js +27 -0
  49. package/domain/settings/validation.js.map +1 -0
  50. package/exports/api/file-manager/file.d.ts +12 -0
  51. package/exports/api/file-manager/file.js +12 -0
  52. package/exports/api/file-manager/permissions.d.ts +1 -0
  53. package/exports/api/file-manager/permissions.js +1 -0
  54. package/exports/api/file-manager/settings.d.ts +3 -0
  55. package/exports/api/file-manager/settings.js +3 -0
  56. package/features/FileManagerFeature.d.ts +4 -0
  57. package/features/FileManagerFeature.js +31 -0
  58. package/features/FileManagerFeature.js.map +1 -0
  59. package/features/assetDelivery/FilesAssetRequestResolver.d.ts +9 -0
  60. package/features/assetDelivery/FilesAssetRequestResolver.js +29 -0
  61. package/features/assetDelivery/FilesAssetRequestResolver.js.map +1 -0
  62. package/features/assetDelivery/NullAssetOutputStrategy.d.ts +8 -0
  63. package/features/assetDelivery/NullAssetOutputStrategy.js +14 -0
  64. package/features/assetDelivery/NullAssetOutputStrategy.js.map +1 -0
  65. package/features/assetDelivery/NullAssetReply.d.ts +4 -0
  66. package/features/assetDelivery/NullAssetReply.js +14 -0
  67. package/features/assetDelivery/NullAssetReply.js.map +1 -0
  68. package/features/assetDelivery/NullAssetResolver.d.ts +8 -0
  69. package/features/assetDelivery/NullAssetResolver.js +13 -0
  70. package/features/assetDelivery/NullAssetResolver.js.map +1 -0
  71. package/features/assetDelivery/abstractions.d.ts +54 -0
  72. package/features/assetDelivery/abstractions.js +11 -0
  73. package/features/assetDelivery/abstractions.js.map +1 -0
  74. package/features/assetDelivery/feature.d.ts +4 -0
  75. package/features/assetDelivery/feature.js +29 -0
  76. package/features/assetDelivery/feature.js.map +1 -0
  77. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +4 -0
  78. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js +20 -0
  79. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -0
  80. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +5 -0
  81. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +9 -0
  82. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -0
  83. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +11 -0
  84. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +26 -0
  85. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -0
  86. package/features/assetDelivery/privateFiles/PrivateCache.d.ts +8 -0
  87. package/features/assetDelivery/privateFiles/PrivateCache.js +22 -0
  88. package/features/assetDelivery/privateFiles/PrivateCache.js.map +1 -0
  89. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +11 -0
  90. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +31 -0
  91. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -0
  92. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +19 -0
  93. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js +65 -0
  94. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -0
  95. package/features/assetDelivery/privateFiles/PublicCache.d.ts +8 -0
  96. package/features/assetDelivery/privateFiles/PublicCache.js +22 -0
  97. package/features/assetDelivery/privateFiles/PublicCache.js.map +1 -0
  98. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +9 -0
  99. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +21 -0
  100. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -0
  101. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +9 -0
  102. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +21 -0
  103. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -0
  104. package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +9 -0
  105. package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js +13 -0
  106. package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -0
  107. package/features/assetDelivery/transformation/TransformationAssetProcessor.d.ts +11 -0
  108. package/features/assetDelivery/transformation/TransformationAssetProcessor.js +23 -0
  109. package/features/assetDelivery/transformation/TransformationAssetProcessor.js.map +1 -0
  110. package/features/file/CreateFile/CreateFileRepository.d.ts +15 -0
  111. package/features/file/CreateFile/CreateFileRepository.js +32 -0
  112. package/features/file/CreateFile/CreateFileRepository.js.map +1 -0
  113. package/features/file/CreateFile/CreateFileUseCase.d.ts +21 -0
  114. package/features/file/CreateFile/CreateFileUseCase.js +83 -0
  115. package/features/file/CreateFile/CreateFileUseCase.js.map +1 -0
  116. package/features/file/CreateFile/abstractions.d.ts +60 -0
  117. package/features/file/CreateFile/abstractions.js +6 -0
  118. package/features/file/CreateFile/abstractions.js.map +1 -0
  119. package/features/file/CreateFile/events.d.ts +31 -0
  120. package/features/file/CreateFile/events.js +23 -0
  121. package/features/file/CreateFile/events.js.map +1 -0
  122. package/features/file/CreateFile/feature.d.ts +4 -0
  123. package/features/file/CreateFile/feature.js +13 -0
  124. package/features/file/CreateFile/feature.js.map +1 -0
  125. package/features/file/CreateFile/index.d.ts +2 -0
  126. package/features/file/CreateFile/index.js +2 -0
  127. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.d.ts +13 -0
  128. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +22 -0
  129. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js.map +1 -0
  130. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.d.ts +19 -0
  131. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js +73 -0
  132. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -0
  133. package/features/file/CreateFilesInBatch/abstractions.d.ts +42 -0
  134. package/features/file/CreateFilesInBatch/abstractions.js +6 -0
  135. package/features/file/CreateFilesInBatch/abstractions.js.map +1 -0
  136. package/features/file/CreateFilesInBatch/events.d.ts +31 -0
  137. package/features/file/CreateFilesInBatch/events.js +23 -0
  138. package/features/file/CreateFilesInBatch/events.js.map +1 -0
  139. package/features/file/CreateFilesInBatch/feature.d.ts +4 -0
  140. package/features/file/CreateFilesInBatch/feature.js +13 -0
  141. package/features/file/CreateFilesInBatch/feature.js.map +1 -0
  142. package/features/file/CreateFilesInBatch/index.d.ts +1 -0
  143. package/features/file/CreateFilesInBatch/index.js +1 -0
  144. package/features/file/DeleteFile/DeleteFileRepository.d.ts +15 -0
  145. package/features/file/DeleteFile/DeleteFileRepository.js +31 -0
  146. package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -0
  147. package/features/file/DeleteFile/DeleteFileUseCase.d.ts +17 -0
  148. package/features/file/DeleteFile/DeleteFileUseCase.js +43 -0
  149. package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -0
  150. package/features/file/DeleteFile/abstractions.d.ts +39 -0
  151. package/features/file/DeleteFile/abstractions.js +6 -0
  152. package/features/file/DeleteFile/abstractions.js.map +1 -0
  153. package/features/file/DeleteFile/events.d.ts +29 -0
  154. package/features/file/DeleteFile/events.js +23 -0
  155. package/features/file/DeleteFile/events.js.map +1 -0
  156. package/features/file/DeleteFile/feature.d.ts +4 -0
  157. package/features/file/DeleteFile/feature.js +13 -0
  158. package/features/file/DeleteFile/feature.js.map +1 -0
  159. package/features/file/DeleteFile/index.d.ts +2 -0
  160. package/features/file/DeleteFile/index.js +2 -0
  161. package/features/file/FileUrlGenerator/abstractions.d.ts +9 -0
  162. package/features/file/FileUrlGenerator/abstractions.js +5 -0
  163. package/features/file/FileUrlGenerator/abstractions.js.map +1 -0
  164. package/features/file/GetFile/GetFileRepository.d.ts +15 -0
  165. package/features/file/GetFile/GetFileRepository.js +33 -0
  166. package/features/file/GetFile/GetFileRepository.js.map +1 -0
  167. package/features/file/GetFile/GetFileUseCase.d.ts +14 -0
  168. package/features/file/GetFile/GetFileUseCase.js +29 -0
  169. package/features/file/GetFile/GetFileUseCase.js.map +1 -0
  170. package/features/file/GetFile/abstractions.d.ts +40 -0
  171. package/features/file/GetFile/abstractions.js +6 -0
  172. package/features/file/GetFile/abstractions.js.map +1 -0
  173. package/features/file/GetFile/feature.d.ts +4 -0
  174. package/features/file/GetFile/feature.js +13 -0
  175. package/features/file/GetFile/feature.js.map +1 -0
  176. package/features/file/GetFile/index.d.ts +1 -0
  177. package/features/file/GetFile/index.js +1 -0
  178. package/features/file/GetFileContentsById/abstractions.d.ts +20 -0
  179. package/features/file/GetFileContentsById/abstractions.js +5 -0
  180. package/features/file/GetFileContentsById/abstractions.js.map +1 -0
  181. package/features/file/GetFileContentsById/index.d.ts +1 -0
  182. package/features/file/GetFileContentsById/index.js +1 -0
  183. package/features/file/GetFileContentsByKey/abstractions.d.ts +17 -0
  184. package/features/file/GetFileContentsByKey/abstractions.js +5 -0
  185. package/features/file/GetFileContentsByKey/abstractions.js.map +1 -0
  186. package/features/file/GetFileContentsByKey/index.d.ts +1 -0
  187. package/features/file/GetFileContentsByKey/index.js +1 -0
  188. package/features/file/ListFiles/ListFilesRepository.d.ts +18 -0
  189. package/features/file/ListFiles/ListFilesRepository.js +53 -0
  190. package/features/file/ListFiles/ListFilesRepository.js.map +1 -0
  191. package/features/file/ListFiles/ListFilesUseCase.d.ts +15 -0
  192. package/features/file/ListFiles/ListFilesUseCase.js +44 -0
  193. package/features/file/ListFiles/ListFilesUseCase.js.map +1 -0
  194. package/features/file/ListFiles/abstractions.d.ts +49 -0
  195. package/features/file/ListFiles/abstractions.js +6 -0
  196. package/features/file/ListFiles/abstractions.js.map +1 -0
  197. package/features/file/ListFiles/feature.d.ts +4 -0
  198. package/features/file/ListFiles/feature.js +13 -0
  199. package/features/file/ListFiles/feature.js.map +1 -0
  200. package/features/file/ListFiles/index.d.ts +1 -0
  201. package/features/file/ListFiles/index.js +1 -0
  202. package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +27 -0
  203. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +42 -0
  204. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -0
  205. package/features/file/ListImagesByTagTool/feature.d.ts +4 -0
  206. package/features/file/ListImagesByTagTool/feature.js +11 -0
  207. package/features/file/ListImagesByTagTool/feature.js.map +1 -0
  208. package/features/file/ListTags/ListTagsRepository.d.ts +16 -0
  209. package/features/file/ListTags/ListTagsRepository.js +42 -0
  210. package/features/file/ListTags/ListTagsRepository.js.map +1 -0
  211. package/features/file/ListTags/ListTagsUseCase.d.ts +13 -0
  212. package/features/file/ListTags/ListTagsUseCase.js +31 -0
  213. package/features/file/ListTags/ListTagsUseCase.js.map +1 -0
  214. package/features/file/ListTags/abstractions.d.ts +45 -0
  215. package/features/file/ListTags/abstractions.js +6 -0
  216. package/features/file/ListTags/abstractions.js.map +1 -0
  217. package/features/file/ListTags/feature.d.ts +4 -0
  218. package/features/file/ListTags/feature.js +13 -0
  219. package/features/file/ListTags/feature.js.map +1 -0
  220. package/features/file/ListTags/index.d.ts +1 -0
  221. package/features/file/ListTags/index.js +1 -0
  222. package/features/file/UpdateFile/UpdateFileRepository.d.ts +15 -0
  223. package/features/file/UpdateFile/UpdateFileRepository.js +37 -0
  224. package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -0
  225. package/features/file/UpdateFile/UpdateFileUseCase.d.ts +20 -0
  226. package/features/file/UpdateFile/UpdateFileUseCase.js +71 -0
  227. package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -0
  228. package/features/file/UpdateFile/abstractions.d.ts +56 -0
  229. package/features/file/UpdateFile/abstractions.js +6 -0
  230. package/features/file/UpdateFile/abstractions.js.map +1 -0
  231. package/features/file/UpdateFile/events.d.ts +34 -0
  232. package/features/file/UpdateFile/events.js +23 -0
  233. package/features/file/UpdateFile/events.js.map +1 -0
  234. package/features/file/UpdateFile/feature.d.ts +4 -0
  235. package/features/file/UpdateFile/feature.js +13 -0
  236. package/features/file/UpdateFile/feature.js.map +1 -0
  237. package/features/file/UpdateFile/index.d.ts +2 -0
  238. package/features/file/UpdateFile/index.js +2 -0
  239. package/features/file/shared/EntryToFileMapper.d.ts +5 -0
  240. package/features/file/shared/EntryToFileMapper.js +28 -0
  241. package/features/file/shared/EntryToFileMapper.js.map +1 -0
  242. package/features/file/shared/FileInputToEntryInputMapper.d.ts +5 -0
  243. package/features/file/shared/FileInputToEntryInputMapper.js +32 -0
  244. package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -0
  245. package/features/file/shared/FileToEntryMapper.d.ts +5 -0
  246. package/features/file/shared/FileToEntryMapper.js +31 -0
  247. package/features/file/shared/FileToEntryMapper.js.map +1 -0
  248. package/features/permissions/abstractions.d.ts +21 -0
  249. package/features/permissions/abstractions.js +6 -0
  250. package/features/permissions/abstractions.js.map +1 -0
  251. package/features/permissions/feature.d.ts +4 -0
  252. package/features/permissions/feature.js +7 -0
  253. package/features/permissions/feature.js.map +1 -0
  254. package/features/settings/GetSettings/GetSettingsUseCase.d.ts +13 -0
  255. package/features/settings/GetSettings/GetSettingsUseCase.js +28 -0
  256. package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -0
  257. package/features/settings/GetSettings/abstractions.d.ts +18 -0
  258. package/features/settings/GetSettings/abstractions.js +5 -0
  259. package/features/settings/GetSettings/abstractions.js.map +1 -0
  260. package/features/settings/GetSettings/feature.d.ts +4 -0
  261. package/features/settings/GetSettings/feature.js +11 -0
  262. package/features/settings/GetSettings/feature.js.map +1 -0
  263. package/features/settings/SettingsInstaller/SettingsInstaller.d.ts +15 -0
  264. package/features/settings/SettingsInstaller/SettingsInstaller.js +36 -0
  265. package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -0
  266. package/features/settings/SettingsInstaller/feature.d.ts +4 -0
  267. package/features/settings/SettingsInstaller/feature.js +11 -0
  268. package/features/settings/SettingsInstaller/feature.js.map +1 -0
  269. package/features/settings/UpdateSettings/UpdateSettingsUseCase.d.ts +18 -0
  270. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +55 -0
  271. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -0
  272. package/features/settings/UpdateSettings/abstractions.d.ts +23 -0
  273. package/features/settings/UpdateSettings/abstractions.js +5 -0
  274. package/features/settings/UpdateSettings/abstractions.js.map +1 -0
  275. package/features/settings/UpdateSettings/events.d.ts +34 -0
  276. package/features/settings/UpdateSettings/events.js +23 -0
  277. package/features/settings/UpdateSettings/events.js.map +1 -0
  278. package/features/settings/UpdateSettings/feature.d.ts +4 -0
  279. package/features/settings/UpdateSettings/feature.js +11 -0
  280. package/features/settings/UpdateSettings/feature.js.map +1 -0
  281. package/features/settings/UpdateSettings/index.d.ts +2 -0
  282. package/features/settings/UpdateSettings/index.js +2 -0
  283. package/features/shared/abstractions.d.ts +1 -0
  284. package/features/shared/abstractions.js +1 -0
  285. package/graphql/baseSchema.d.ts +3 -0
  286. package/graphql/baseSchema.js +100 -0
  287. package/graphql/baseSchema.js.map +1 -0
  288. package/graphql/createFilesTypeDefs.d.ts +8 -0
  289. package/graphql/createFilesTypeDefs.js +191 -0
  290. package/graphql/createFilesTypeDefs.js.map +1 -0
  291. package/graphql/filesSchema.d.ts +4 -0
  292. package/graphql/filesSchema.js +96 -0
  293. package/graphql/filesSchema.js.map +1 -0
  294. package/graphql/getFileByUrl.d.ts +3 -0
  295. package/graphql/getFileByUrl.js +61 -0
  296. package/graphql/getFileByUrl.js.map +1 -0
  297. package/graphql/index.d.ts +4 -0
  298. package/graphql/index.js +47 -0
  299. package/graphql/index.js.map +1 -0
  300. package/graphql/utils.d.ts +11 -0
  301. package/graphql/utils.js +12 -0
  302. package/graphql/utils.js.map +1 -0
  303. package/index.d.ts +7 -0
  304. package/index.js +44 -0
  305. package/index.js.map +1 -0
  306. package/modelModifier/CmsModelModifier.d.ts +26 -0
  307. package/modelModifier/CmsModelModifier.js +51 -0
  308. package/modelModifier/CmsModelModifier.js.map +1 -0
  309. package/package.json +34 -42
  310. package/types.d.ts +2 -356
  311. package/types.js +1 -5
  312. package/handlers/download/index.d.ts +0 -3
  313. package/handlers/download/index.js +0 -132
  314. package/handlers/download/index.js.map +0 -1
  315. package/handlers/manage/index.d.ts +0 -5
  316. package/handlers/manage/index.js +0 -71
  317. package/handlers/manage/index.js.map +0 -1
  318. package/handlers/transform/index.d.ts +0 -2
  319. package/handlers/transform/index.js +0 -91
  320. package/handlers/transform/index.js.map +0 -1
  321. package/handlers/transform/loaders/imageLoader.d.ts +0 -30
  322. package/handlers/transform/loaders/imageLoader.js +0 -105
  323. package/handlers/transform/loaders/imageLoader.js.map +0 -1
  324. package/handlers/transform/loaders/index.d.ts +0 -8
  325. package/handlers/transform/loaders/index.js +0 -13
  326. package/handlers/transform/loaders/index.js.map +0 -1
  327. package/handlers/transform/loaders/sanitizeImageTransformations.d.ts +0 -11
  328. package/handlers/transform/loaders/sanitizeImageTransformations.js +0 -58
  329. package/handlers/transform/loaders/sanitizeImageTransformations.js.map +0 -1
  330. package/handlers/transform/managers/imageManager.d.ts +0 -15
  331. package/handlers/transform/managers/imageManager.js +0 -63
  332. package/handlers/transform/managers/imageManager.js.map +0 -1
  333. package/handlers/transform/managers/index.d.ts +0 -5
  334. package/handlers/transform/managers/index.js +0 -13
  335. package/handlers/transform/managers/index.js.map +0 -1
  336. package/handlers/transform/optimizeImage.d.ts +0 -3
  337. package/handlers/transform/optimizeImage.js +0 -48
  338. package/handlers/transform/optimizeImage.js.map +0 -1
  339. package/handlers/transform/transformImage.d.ts +0 -10
  340. package/handlers/transform/transformImage.js +0 -30
  341. package/handlers/transform/transformImage.js.map +0 -1
  342. package/handlers/transform/utils.d.ts +0 -12
  343. package/handlers/transform/utils.js +0 -46
  344. package/handlers/transform/utils.js.map +0 -1
  345. package/handlers/types.d.ts +0 -8
  346. package/handlers/types.js +0 -5
  347. package/handlers/types.js.map +0 -1
  348. package/handlers/utils/getEnvironment.d.ts +0 -5
  349. package/handlers/utils/getEnvironment.js +0 -13
  350. package/handlers/utils/getEnvironment.js.map +0 -1
  351. package/handlers/utils/getObjectParams.d.ts +0 -9
  352. package/handlers/utils/getObjectParams.js +0 -25
  353. package/handlers/utils/getObjectParams.js.map +0 -1
  354. package/handlers/utils/index.d.ts +0 -2
  355. package/handlers/utils/index.js +0 -23
  356. package/handlers/utils/index.js.map +0 -1
  357. package/plugins/crud/files/validation.d.ts +0 -3
  358. package/plugins/crud/files/validation.js +0 -41
  359. package/plugins/crud/files/validation.js.map +0 -1
  360. package/plugins/crud/files.crud.d.ts +0 -4
  361. package/plugins/crud/files.crud.js +0 -431
  362. package/plugins/crud/files.crud.js.map +0 -1
  363. package/plugins/crud/settings.crud.d.ts +0 -5
  364. package/plugins/crud/settings.crud.js +0 -116
  365. package/plugins/crud/settings.crud.js.map +0 -1
  366. package/plugins/crud/system.crud.d.ts +0 -4
  367. package/plugins/crud/system.crud.js +0 -153
  368. package/plugins/crud/system.crud.js.map +0 -1
  369. package/plugins/crud/utils/checkBasePermissions.d.ts +0 -5
  370. package/plugins/crud/utils/checkBasePermissions.js +0 -33
  371. package/plugins/crud/utils/checkBasePermissions.js.map +0 -1
  372. package/plugins/crud/utils/createFileModel.d.ts +0 -5
  373. package/plugins/crud/utils/createFileModel.js +0 -77
  374. package/plugins/crud/utils/createFileModel.js.map +0 -1
  375. package/plugins/crud/utils/lifecycleEvents.d.ts +0 -6
  376. package/plugins/crud/utils/lifecycleEvents.js +0 -38
  377. package/plugins/crud/utils/lifecycleEvents.js.map +0 -1
  378. package/plugins/definitions/FilePhysicalStoragePlugin.d.ts +0 -21
  379. package/plugins/definitions/FilePhysicalStoragePlugin.js +0 -42
  380. package/plugins/definitions/FilePhysicalStoragePlugin.js.map +0 -1
  381. package/plugins/definitions/FilePlugin.d.ts +0 -136
  382. package/plugins/definitions/FilePlugin.js +0 -70
  383. package/plugins/definitions/FilePlugin.js.map +0 -1
  384. package/plugins/definitions/FileStorageTransformPlugin.d.ts +0 -34
  385. package/plugins/definitions/FileStorageTransformPlugin.js +0 -51
  386. package/plugins/definitions/FileStorageTransformPlugin.js.map +0 -1
  387. package/plugins/definitions/FilesStorageOperationsProviderPlugin.d.ts +0 -9
  388. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +0 -17
  389. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +0 -1
  390. package/plugins/definitions/InstallationPlugin.d.ts +0 -19
  391. package/plugins/definitions/InstallationPlugin.js +0 -42
  392. package/plugins/definitions/InstallationPlugin.js.map +0 -1
  393. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.d.ts +0 -9
  394. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +0 -17
  395. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +0 -1
  396. package/plugins/definitions/SystemStorageOperationsProviderPlugin.d.ts +0 -9
  397. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +0 -17
  398. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +0 -1
  399. package/plugins/graphql.d.ts +0 -4
  400. package/plugins/graphql.js +0 -290
  401. package/plugins/graphql.js.map +0 -1
  402. package/plugins/index.d.ts +0 -2
  403. package/plugins/index.js +0 -24
  404. package/plugins/index.js.map +0 -1
  405. package/plugins/storage/FileStorage.d.ts +0 -30
  406. package/plugins/storage/FileStorage.js +0 -103
  407. package/plugins/storage/FileStorage.js.map +0 -1
  408. package/plugins/storage/index.d.ts +0 -4
  409. package/plugins/storage/index.js +0 -26
  410. package/plugins/storage/index.js.map +0 -1
  411. package/types.js.map +0 -1
  412. package/utils.d.ts +0 -4
  413. package/utils.js +0 -16
  414. package/utils.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
3
+ import { FilesAssetRequestResolverImpl } from "./FilesAssetRequestResolver.js";
4
+ import { NullAssetResolverImpl } from "./NullAssetResolver.js";
5
+ import { NullAssetOutputStrategyImpl } from "./NullAssetOutputStrategy.js";
6
+ import { PassthroughAssetTransformationStrategyImpl } from "./transformation/PassthroughAssetTransformationStrategy.js";
7
+ import { TransformationAssetProcessorImpl } from "./transformation/TransformationAssetProcessor.js";
8
+ import { PrivateFileAssetRequestResolverDecorator } from "./privateFiles/PrivateFileAssetRequestResolver.js";
9
+ import { PrivateAuthenticatedAuthorizerImpl } from "./privateFiles/PrivateAuthenticatedAuthorizer.js";
10
+ import { PrivateFilesAssetProcessorDecorator } from "./privateFiles/PrivateFilesAssetProcessor.js";
11
+ const AssetDeliveryFeature = createFeature({
12
+ name: "AssetDelivery",
13
+ register (container) {
14
+ container.register(FilesAssetRequestResolverImpl);
15
+ container.register(NullAssetResolverImpl);
16
+ container.register(NullAssetOutputStrategyImpl);
17
+ container.register(PassthroughAssetTransformationStrategyImpl);
18
+ container.register(TransformationAssetProcessorImpl);
19
+ container.registerDecorator(PrivateFileAssetRequestResolverDecorator);
20
+ const wcp = container.resolve(WcpContext);
21
+ if (wcp.canUsePrivateFiles()) {
22
+ container.register(PrivateAuthenticatedAuthorizerImpl);
23
+ container.registerDecorator(PrivateFilesAssetProcessorDecorator);
24
+ }
25
+ }
26
+ });
27
+ export { AssetDeliveryFeature };
28
+
29
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/feature.js","sources":["../../../src/features/assetDelivery/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\nimport { FilesAssetRequestResolverImpl } from \"./FilesAssetRequestResolver.js\";\nimport { NullAssetResolverImpl } from \"./NullAssetResolver.js\";\nimport { NullAssetOutputStrategyImpl } from \"./NullAssetOutputStrategy.js\";\nimport { PassthroughAssetTransformationStrategyImpl } from \"./transformation/PassthroughAssetTransformationStrategy.js\";\nimport { TransformationAssetProcessorImpl } from \"./transformation/TransformationAssetProcessor.js\";\nimport { PrivateFileAssetRequestResolverDecorator } from \"./privateFiles/PrivateFileAssetRequestResolver.js\";\nimport { PrivateAuthenticatedAuthorizerImpl } from \"./privateFiles/PrivateAuthenticatedAuthorizer.js\";\nimport { PrivateFilesAssetProcessorDecorator } from \"./privateFiles/PrivateFilesAssetProcessor.js\";\n\nexport const AssetDeliveryFeature = createFeature({\n name: \"AssetDelivery\",\n register(container) {\n container.register(FilesAssetRequestResolverImpl);\n container.register(NullAssetResolverImpl);\n container.register(NullAssetOutputStrategyImpl);\n container.register(PassthroughAssetTransformationStrategyImpl);\n container.register(TransformationAssetProcessorImpl);\n\n container.registerDecorator(PrivateFileAssetRequestResolverDecorator);\n\n const wcp = container.resolve(WcpContext);\n if (wcp.canUsePrivateFiles()) {\n container.register(PrivateAuthenticatedAuthorizerImpl);\n container.registerDecorator(PrivateFilesAssetProcessorDecorator);\n }\n }\n});\n"],"names":["AssetDeliveryFeature","createFeature","container","FilesAssetRequestResolverImpl","NullAssetResolverImpl","NullAssetOutputStrategyImpl","PassthroughAssetTransformationStrategyImpl","TransformationAssetProcessorImpl","PrivateFileAssetRequestResolverDecorator","wcp","WcpContext","PrivateAuthenticatedAuthorizerImpl","PrivateFilesAssetProcessorDecorator"],"mappings":";;;;;;;;;;AAWO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QAEnBL,UAAU,iBAAiB,CAACM;QAE5B,MAAMC,MAAMP,UAAU,OAAO,CAACQ;QAC9B,IAAID,IAAI,kBAAkB,IAAI;YAC1BP,UAAU,QAAQ,CAACS;YACnBT,UAAU,iBAAiB,CAACU;QAChC;IACJ;AACJ"}
@@ -0,0 +1,4 @@
1
+ import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
2
+ export declare class NotAuthorizedAssetReply extends AssetReply {
3
+ constructor();
4
+ }
@@ -0,0 +1,20 @@
1
+ import { ResponseHeaders } from "@webiny/handler";
2
+ import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
3
+ class NotAuthorizedAssetReply extends AssetReply {
4
+ constructor(){
5
+ super({
6
+ code: 403,
7
+ headers: ResponseHeaders.create({
8
+ "cache-control": "no-store",
9
+ "content-type": "application/json; charset=utf-8"
10
+ }),
11
+ body: ()=>({
12
+ error: "Not authorized!",
13
+ code: "NOT_AUTHORIZED"
14
+ })
15
+ });
16
+ }
17
+ }
18
+ export { NotAuthorizedAssetReply };
19
+
20
+ //# sourceMappingURL=NotAuthorizedAssetReply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js","sources":["../../../../src/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.ts"],"sourcesContent":["import { ResponseHeaders } from \"@webiny/handler\";\nimport { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\n\nexport class NotAuthorizedAssetReply extends AssetReply {\n constructor() {\n super({\n code: 403,\n headers: ResponseHeaders.create({\n \"cache-control\": \"no-store\",\n \"content-type\": \"application/json; charset=utf-8\"\n }),\n body: () => ({ error: \"Not authorized!\", code: \"NOT_AUTHORIZED\" })\n });\n }\n}\n"],"names":["NotAuthorizedAssetReply","AssetReply","ResponseHeaders"],"mappings":";;AAGO,MAAMA,gCAAgCC;IACzC,aAAc;QACV,KAAK,CAAC;YACF,MAAM;YACN,SAASC,gBAAgB,MAAM,CAAC;gBAC5B,iBAAiB;gBACjB,gBAAgB;YACpB;YACA,MAAM,IAAO;oBAAE,OAAO;oBAAmB,MAAM;gBAAiB;QACpE;IACJ;AACJ"}
@@ -0,0 +1,5 @@
1
+ import type { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
2
+ import type { IAssetOutputStrategy } from "../abstractions.js";
3
+ export declare class NotAuthorizedOutputStrategy implements IAssetOutputStrategy {
4
+ output(): Promise<AssetReply>;
5
+ }
@@ -0,0 +1,9 @@
1
+ import { NotAuthorizedAssetReply } from "./NotAuthorizedAssetReply.js";
2
+ class NotAuthorizedOutputStrategy {
3
+ async output() {
4
+ return new NotAuthorizedAssetReply();
5
+ }
6
+ }
7
+ export { NotAuthorizedOutputStrategy };
8
+
9
+ //# sourceMappingURL=NotAuthorizedOutputStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js","sources":["../../../../src/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.ts"],"sourcesContent":["import type { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport { NotAuthorizedAssetReply } from \"./NotAuthorizedAssetReply.js\";\nimport type { IAssetOutputStrategy } from \"../abstractions.js\";\n\nexport class NotAuthorizedOutputStrategy implements IAssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NotAuthorizedAssetReply();\n }\n}\n"],"names":["NotAuthorizedOutputStrategy","NotAuthorizedAssetReply"],"mappings":";AAIO,MAAMA;IACT,MAAM,SAA8B;QAChC,OAAO,IAAIC;IACf;AACJ"}
@@ -0,0 +1,11 @@
1
+ import type { File } from "../../../domain/file/types.js";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
3
+ import { type IAssetAuthorizer } from "../abstractions.js";
4
+ export declare class PrivateAuthenticatedAuthorizer implements IAssetAuthorizer {
5
+ private identityContext;
6
+ constructor(identityContext: IdentityContext.Interface);
7
+ authorize(file: File): Promise<void>;
8
+ }
9
+ export declare const PrivateAuthenticatedAuthorizerImpl: typeof PrivateAuthenticatedAuthorizer & {
10
+ __abstraction: import("@webiny/di").Abstraction<IAssetAuthorizer>;
11
+ };
@@ -0,0 +1,26 @@
1
+ import error from "@webiny/error";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
3
+ import { AssetAuthorizer } from "../abstractions.js";
4
+ class PrivateAuthenticatedAuthorizer {
5
+ constructor(identityContext){
6
+ this.identityContext = identityContext;
7
+ }
8
+ async authorize(file) {
9
+ if (file.accessControl && "private-authenticated" === file.accessControl.type) {
10
+ const identity = this.identityContext.getIdentity();
11
+ if (!identity) throw new error({
12
+ code: "NOT_AUTHORIZED",
13
+ message: "You're not authorized to access this asset!"
14
+ });
15
+ }
16
+ }
17
+ }
18
+ const PrivateAuthenticatedAuthorizerImpl = AssetAuthorizer.createImplementation({
19
+ implementation: PrivateAuthenticatedAuthorizer,
20
+ dependencies: [
21
+ IdentityContext
22
+ ]
23
+ });
24
+ export { PrivateAuthenticatedAuthorizer, PrivateAuthenticatedAuthorizerImpl };
25
+
26
+ //# sourceMappingURL=PrivateAuthenticatedAuthorizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js","sources":["../../../../src/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport type { File } from \"~/domain/file/types.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { AssetAuthorizer, type IAssetAuthorizer } from \"../abstractions.js\";\n\nexport class PrivateAuthenticatedAuthorizer implements IAssetAuthorizer {\n private identityContext: IdentityContext.Interface;\n\n constructor(identityContext: IdentityContext.Interface) {\n this.identityContext = identityContext;\n }\n\n async authorize(file: File) {\n if (file.accessControl && file.accessControl.type === \"private-authenticated\") {\n const identity = this.identityContext.getIdentity();\n\n if (!identity) {\n throw new Error({\n code: \"NOT_AUTHORIZED\",\n message: \"You're not authorized to access this asset!\"\n });\n }\n }\n }\n}\n\nexport const PrivateAuthenticatedAuthorizerImpl = AssetAuthorizer.createImplementation({\n implementation: PrivateAuthenticatedAuthorizer,\n dependencies: [IdentityContext]\n});\n"],"names":["PrivateAuthenticatedAuthorizer","identityContext","file","identity","Error","PrivateAuthenticatedAuthorizerImpl","AssetAuthorizer","IdentityContext"],"mappings":";;;AAKO,MAAMA;IAGT,YAAYC,eAA0C,CAAE;QACpD,IAAI,CAAC,eAAe,GAAGA;IAC3B;IAEA,MAAM,UAAUC,IAAU,EAAE;QACxB,IAAIA,KAAK,aAAa,IAAIA,AAA4B,4BAA5BA,KAAK,aAAa,CAAC,IAAI,EAA8B;YAC3E,MAAMC,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;YAEjD,IAAI,CAACA,UACD,MAAM,IAAIC,MAAM;gBACZ,MAAM;gBACN,SAAS;YACb;QAER;IACJ;AACJ;AAEO,MAAMC,qCAAqCC,gBAAgB,oBAAoB,CAAC;IACnF,gBAAgBN;IAChB,cAAc;QAACO;KAAgB;AACnC"}
@@ -0,0 +1,8 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
3
+ import type { IAssetOutputStrategy } from "../abstractions.js";
4
+ export declare class PrivateCache implements IAssetOutputStrategy {
5
+ private strategy;
6
+ constructor(strategy: IAssetOutputStrategy);
7
+ output(asset: Asset): Promise<AssetReply>;
8
+ }
@@ -0,0 +1,22 @@
1
+ import { parse, stringify } from "cache-control-parser";
2
+ class PrivateCache {
3
+ constructor(strategy){
4
+ this.strategy = strategy;
5
+ }
6
+ async output(asset) {
7
+ const reply = await this.strategy.output(asset);
8
+ reply.setHeaders((headers)=>{
9
+ headers.set("cache-control", (value = "")=>{
10
+ const cacheControl = parse(value);
11
+ cacheControl["private"] = true;
12
+ cacheControl["public"] = false;
13
+ return stringify(cacheControl);
14
+ });
15
+ return headers;
16
+ });
17
+ return reply;
18
+ }
19
+ }
20
+ export { PrivateCache };
21
+
22
+ //# sourceMappingURL=PrivateCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/PrivateCache.js","sources":["../../../../src/features/assetDelivery/privateFiles/PrivateCache.ts"],"sourcesContent":["import { parse, stringify } from \"cache-control-parser\";\nimport type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport type { IAssetOutputStrategy } from \"../abstractions.js\";\n\nexport class PrivateCache implements IAssetOutputStrategy {\n private strategy: IAssetOutputStrategy;\n\n constructor(strategy: IAssetOutputStrategy) {\n this.strategy = strategy;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const reply = await this.strategy.output(asset);\n\n reply.setHeaders(headers => {\n headers.set(\"cache-control\", (value = \"\") => {\n const cacheControl = parse(value);\n cacheControl[\"private\"] = true;\n cacheControl[\"public\"] = false;\n return stringify(cacheControl);\n });\n return headers;\n });\n\n return reply;\n }\n}\n"],"names":["PrivateCache","strategy","asset","reply","headers","value","cacheControl","parse","stringify"],"mappings":";AAKO,MAAMA;IAGT,YAAYC,QAA8B,CAAE;QACxC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,OAAOC,KAAY,EAAuB;QAC5C,MAAMC,QAAQ,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAACD;QAEzCC,MAAM,UAAU,CAACC,CAAAA;YACbA,QAAQ,GAAG,CAAC,iBAAiB,CAACC,QAAQ,EAAE;gBACpC,MAAMC,eAAeC,MAAMF;gBAC3BC,YAAY,CAAC,UAAU,GAAG;gBAC1BA,YAAY,CAAC,SAAS,GAAG;gBACzB,OAAOE,UAAUF;YACrB;YACA,OAAOF;QACX;QAEA,OAAOD;IACX;AACJ"}
@@ -0,0 +1,11 @@
1
+ import type { Request } from "@webiny/handler/types.js";
2
+ import { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
3
+ import { type IAssetRequestResolver } from "../abstractions.js";
4
+ export declare class PrivateFileAssetRequestResolver implements IAssetRequestResolver {
5
+ private readonly resolver;
6
+ constructor(resolver: IAssetRequestResolver);
7
+ resolve(request: Request): Promise<AssetRequest | undefined>;
8
+ }
9
+ export declare const PrivateFileAssetRequestResolverDecorator: typeof PrivateFileAssetRequestResolver & {
10
+ __abstraction: import("@webiny/di").Abstraction<IAssetRequestResolver>;
11
+ };
@@ -0,0 +1,31 @@
1
+ import { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
2
+ import { AssetRequestResolver } from "../abstractions.js";
3
+ class PrivateFileAssetRequestResolver {
4
+ constructor(resolver){
5
+ this.resolver = resolver;
6
+ }
7
+ async resolve(request) {
8
+ if (!request.url.startsWith("/private/")) return this.resolver.resolve(request);
9
+ const params = request.params ?? {};
10
+ const query = request.query ?? {};
11
+ const path = params["*"];
12
+ return new AssetRequest({
13
+ key: decodeURI(path).replace("/private/", ""),
14
+ context: {
15
+ url: request.url,
16
+ private: true
17
+ },
18
+ options: {
19
+ ...query,
20
+ width: query.width ? parseInt(query.width) : void 0
21
+ }
22
+ });
23
+ }
24
+ }
25
+ const PrivateFileAssetRequestResolverDecorator = AssetRequestResolver.createDecorator({
26
+ decorator: PrivateFileAssetRequestResolver,
27
+ dependencies: []
28
+ });
29
+ export { PrivateFileAssetRequestResolver, PrivateFileAssetRequestResolverDecorator };
30
+
31
+ //# sourceMappingURL=PrivateFileAssetRequestResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js","sources":["../../../../src/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types.js\";\nimport { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { AssetRequestResolver, type IAssetRequestResolver } from \"../abstractions.js\";\n\nexport class PrivateFileAssetRequestResolver implements IAssetRequestResolver {\n private readonly resolver: IAssetRequestResolver;\n\n constructor(resolver: IAssetRequestResolver) {\n this.resolver = resolver;\n }\n\n async resolve(request: Request): Promise<AssetRequest | undefined> {\n if (!request.url.startsWith(\"/private/\")) {\n return this.resolver.resolve(request);\n }\n\n const params = (request.params ?? {}) as Record<string, any>;\n const query = (request.query ?? {}) as Record<string, any>;\n\n const path = params[\"*\"];\n\n return new AssetRequest({\n key: decodeURI(path).replace(\"/private/\", \"\"),\n context: {\n url: request.url,\n private: true\n },\n options: {\n ...query,\n width: query.width ? parseInt(query.width) : undefined\n }\n });\n }\n}\n\nexport const PrivateFileAssetRequestResolverDecorator = AssetRequestResolver.createDecorator({\n decorator: PrivateFileAssetRequestResolver,\n dependencies: []\n});\n"],"names":["PrivateFileAssetRequestResolver","resolver","request","params","query","path","AssetRequest","decodeURI","parseInt","undefined","PrivateFileAssetRequestResolverDecorator","AssetRequestResolver"],"mappings":";;AAIO,MAAMA;IAGT,YAAYC,QAA+B,CAAE;QACzC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,QAAQC,OAAgB,EAAqC;QAC/D,IAAI,CAACA,QAAQ,GAAG,CAAC,UAAU,CAAC,cACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACA;QAGjC,MAAMC,SAAUD,QAAQ,MAAM,IAAI,CAAC;QACnC,MAAME,QAASF,QAAQ,KAAK,IAAI,CAAC;QAEjC,MAAMG,OAAOF,MAAM,CAAC,IAAI;QAExB,OAAO,IAAIG,aAAa;YACpB,KAAKC,UAAUF,MAAM,OAAO,CAAC,aAAa;YAC1C,SAAS;gBACL,KAAKH,QAAQ,GAAG;gBAChB,SAAS;YACb;YACA,SAAS;gBACL,GAAGE,KAAK;gBACR,OAAOA,MAAM,KAAK,GAAGI,SAASJ,MAAM,KAAK,IAAIK;YACjD;QACJ;IACJ;AACJ;AAEO,MAAMC,2CAA2CC,qBAAqB,eAAe,CAAC;IACzF,WAAWX;IACX,cAAc,EAAE;AACpB"}
@@ -0,0 +1,19 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
3
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
4
+ import { GetFileUseCase } from "../../../features/file/GetFile/index.js";
5
+ import { type IAssetProcessor, type IAssetAuthorizer } from "../abstractions.js";
6
+ export declare class PrivateFilesAssetProcessor implements IAssetProcessor {
7
+ private readonly identityContext;
8
+ private readonly getFile;
9
+ private readonly assetAuthorizer;
10
+ private readonly assetProcessor;
11
+ constructor(identityContext: IdentityContext.Interface, getFile: GetFileUseCase.Interface, assetAuthorizer: IAssetAuthorizer, assetProcessor: IAssetProcessor);
12
+ process(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;
13
+ private isPrivate;
14
+ private requestedViaPrivateEndpoint;
15
+ private requestedViaPublicEndpoint;
16
+ }
17
+ export declare const PrivateFilesAssetProcessorDecorator: typeof PrivateFilesAssetProcessor & {
18
+ __abstraction: import("@webiny/di").Abstraction<IAssetProcessor>;
19
+ };
@@ -0,0 +1,65 @@
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
2
+ import { GetFileUseCase } from "../../file/GetFile/index.js";
3
+ import { NotAuthorizedOutputStrategy } from "./NotAuthorizedOutputStrategy.js";
4
+ import { RedirectToPublicUrlOutputStrategy } from "./RedirectToPublicUrlOutputStrategy.js";
5
+ import { RedirectToPrivateUrlOutputStrategy } from "./RedirectToPrivateUrlOutputStrategy.js";
6
+ import { PrivateCache } from "./PrivateCache.js";
7
+ import { PublicCache } from "./PublicCache.js";
8
+ import { AssetAuthorizer, AssetProcessor } from "../abstractions.js";
9
+ class PrivateFilesAssetProcessor {
10
+ constructor(identityContext, getFile, assetAuthorizer, assetProcessor){
11
+ this.identityContext = identityContext;
12
+ this.getFile = getFile;
13
+ this.assetAuthorizer = assetAuthorizer;
14
+ this.assetProcessor = assetProcessor;
15
+ }
16
+ async process(assetRequest, asset) {
17
+ const id = asset.getId();
18
+ const file = await this.identityContext.withoutAuthorization(async ()=>{
19
+ const fileResult = await this.getFile.execute(id);
20
+ if (fileResult.isFail()) throw fileResult.error;
21
+ return fileResult.value;
22
+ });
23
+ const isPrivateFile = this.isPrivate(file);
24
+ if (!isPrivateFile && this.requestedViaPrivateEndpoint(assetRequest)) {
25
+ asset.setOutputStrategy(new RedirectToPublicUrlOutputStrategy(assetRequest));
26
+ return asset;
27
+ }
28
+ if (isPrivateFile && this.requestedViaPublicEndpoint(assetRequest)) {
29
+ asset.setOutputStrategy(new RedirectToPrivateUrlOutputStrategy(assetRequest));
30
+ return asset;
31
+ }
32
+ try {
33
+ await this.assetAuthorizer.authorize(file);
34
+ } catch {
35
+ asset.setOutputStrategy(new NotAuthorizedOutputStrategy());
36
+ return asset;
37
+ }
38
+ const processedAsset = await this.assetProcessor.process(assetRequest, asset);
39
+ processedAsset.setOutputStrategy((strategy)=>{
40
+ if (!strategy) throw Error("No asset output strategy is configured!");
41
+ return isPrivateFile ? new PrivateCache(strategy) : new PublicCache(strategy);
42
+ });
43
+ return processedAsset;
44
+ }
45
+ isPrivate(file) {
46
+ return file.accessControl && file.accessControl.type.startsWith("private-");
47
+ }
48
+ requestedViaPrivateEndpoint(assetRequest) {
49
+ return assetRequest.getContext().private;
50
+ }
51
+ requestedViaPublicEndpoint(assetRequest) {
52
+ return !this.requestedViaPrivateEndpoint(assetRequest);
53
+ }
54
+ }
55
+ const PrivateFilesAssetProcessorDecorator = AssetProcessor.createDecorator({
56
+ decorator: PrivateFilesAssetProcessor,
57
+ dependencies: [
58
+ IdentityContext,
59
+ GetFileUseCase,
60
+ AssetAuthorizer
61
+ ]
62
+ });
63
+ export { PrivateFilesAssetProcessor, PrivateFilesAssetProcessorDecorator };
64
+
65
+ //# sourceMappingURL=PrivateFilesAssetProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js","sources":["../../../../src/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.ts"],"sourcesContent":["import type { File } from \"~/domain/file/types.js\";\nimport type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { GetFileUseCase } from \"~/features/file/GetFile/index.js\";\nimport { NotAuthorizedOutputStrategy } from \"./NotAuthorizedOutputStrategy.js\";\nimport { RedirectToPublicUrlOutputStrategy } from \"./RedirectToPublicUrlOutputStrategy.js\";\nimport { RedirectToPrivateUrlOutputStrategy } from \"./RedirectToPrivateUrlOutputStrategy.js\";\nimport { PrivateCache } from \"./PrivateCache.js\";\nimport { PublicCache } from \"./PublicCache.js\";\nimport {\n AssetProcessor,\n AssetAuthorizer,\n type IAssetProcessor,\n type IAssetAuthorizer\n} from \"../abstractions.js\";\n\ninterface MaybePrivate {\n private?: boolean;\n}\n\nexport class PrivateFilesAssetProcessor implements IAssetProcessor {\n private readonly identityContext: IdentityContext.Interface;\n private readonly getFile: GetFileUseCase.Interface;\n private readonly assetAuthorizer: IAssetAuthorizer;\n private readonly assetProcessor: IAssetProcessor;\n\n constructor(\n identityContext: IdentityContext.Interface,\n getFile: GetFileUseCase.Interface,\n assetAuthorizer: IAssetAuthorizer,\n assetProcessor: IAssetProcessor\n ) {\n this.identityContext = identityContext;\n this.getFile = getFile;\n this.assetAuthorizer = assetAuthorizer;\n this.assetProcessor = assetProcessor;\n }\n\n async process(assetRequest: AssetRequest, asset: Asset): Promise<Asset> {\n const id = asset.getId();\n\n const file = await this.identityContext.withoutAuthorization(async () => {\n const fileResult = await this.getFile.execute(id);\n if (fileResult.isFail()) {\n throw fileResult.error;\n }\n return fileResult.value;\n });\n\n const isPrivateFile = this.isPrivate(file);\n\n if (!isPrivateFile && this.requestedViaPrivateEndpoint(assetRequest)) {\n asset.setOutputStrategy(new RedirectToPublicUrlOutputStrategy(assetRequest));\n return asset;\n }\n\n if (isPrivateFile && this.requestedViaPublicEndpoint(assetRequest)) {\n asset.setOutputStrategy(new RedirectToPrivateUrlOutputStrategy(assetRequest));\n return asset;\n }\n\n try {\n await this.assetAuthorizer.authorize(file);\n } catch {\n asset.setOutputStrategy(new NotAuthorizedOutputStrategy());\n return asset;\n }\n\n const processedAsset = await this.assetProcessor.process(assetRequest, asset);\n\n processedAsset.setOutputStrategy(strategy => {\n if (!strategy) {\n throw Error(`No asset output strategy is configured!`);\n }\n return isPrivateFile ? new PrivateCache(strategy) : new PublicCache(strategy);\n });\n\n return processedAsset;\n }\n\n private isPrivate(file: File) {\n return file.accessControl && file.accessControl.type.startsWith(\"private-\");\n }\n\n private requestedViaPrivateEndpoint(assetRequest: AssetRequest) {\n return assetRequest.getContext<MaybePrivate>().private;\n }\n\n private requestedViaPublicEndpoint(assetRequest: AssetRequest) {\n return !this.requestedViaPrivateEndpoint(assetRequest);\n }\n}\n\nexport const PrivateFilesAssetProcessorDecorator = AssetProcessor.createDecorator({\n decorator: PrivateFilesAssetProcessor,\n dependencies: [IdentityContext, GetFileUseCase, AssetAuthorizer]\n});\n"],"names":["PrivateFilesAssetProcessor","identityContext","getFile","assetAuthorizer","assetProcessor","assetRequest","asset","id","file","fileResult","isPrivateFile","RedirectToPublicUrlOutputStrategy","RedirectToPrivateUrlOutputStrategy","NotAuthorizedOutputStrategy","processedAsset","strategy","Error","PrivateCache","PublicCache","PrivateFilesAssetProcessorDecorator","AssetProcessor","IdentityContext","GetFileUseCase","AssetAuthorizer"],"mappings":";;;;;;;;AAqBO,MAAMA;IAMT,YACIC,eAA0C,EAC1CC,OAAiC,EACjCC,eAAiC,EACjCC,cAA+B,CACjC;QACE,IAAI,CAAC,eAAe,GAAGH;QACvB,IAAI,CAAC,OAAO,GAAGC;QACf,IAAI,CAAC,eAAe,GAAGC;QACvB,IAAI,CAAC,cAAc,GAAGC;IAC1B;IAEA,MAAM,QAAQC,YAA0B,EAAEC,KAAY,EAAkB;QACpE,MAAMC,KAAKD,MAAM,KAAK;QAEtB,MAAME,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC;YACzD,MAAMC,aAAa,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAACF;YAC9C,IAAIE,WAAW,MAAM,IACjB,MAAMA,WAAW,KAAK;YAE1B,OAAOA,WAAW,KAAK;QAC3B;QAEA,MAAMC,gBAAgB,IAAI,CAAC,SAAS,CAACF;QAErC,IAAI,CAACE,iBAAiB,IAAI,CAAC,2BAA2B,CAACL,eAAe;YAClEC,MAAM,iBAAiB,CAAC,IAAIK,kCAAkCN;YAC9D,OAAOC;QACX;QAEA,IAAII,iBAAiB,IAAI,CAAC,0BAA0B,CAACL,eAAe;YAChEC,MAAM,iBAAiB,CAAC,IAAIM,mCAAmCP;YAC/D,OAAOC;QACX;QAEA,IAAI;YACA,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAACE;QACzC,EAAE,OAAM;YACJF,MAAM,iBAAiB,CAAC,IAAIO;YAC5B,OAAOP;QACX;QAEA,MAAMQ,iBAAiB,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAACT,cAAcC;QAEvEQ,eAAe,iBAAiB,CAACC,CAAAA;YAC7B,IAAI,CAACA,UACD,MAAMC,MAAM;YAEhB,OAAON,gBAAgB,IAAIO,aAAaF,YAAY,IAAIG,YAAYH;QACxE;QAEA,OAAOD;IACX;IAEQ,UAAUN,IAAU,EAAE;QAC1B,OAAOA,KAAK,aAAa,IAAIA,KAAK,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC;IACpE;IAEQ,4BAA4BH,YAA0B,EAAE;QAC5D,OAAOA,aAAa,UAAU,GAAiB,OAAO;IAC1D;IAEQ,2BAA2BA,YAA0B,EAAE;QAC3D,OAAO,CAAC,IAAI,CAAC,2BAA2B,CAACA;IAC7C;AACJ;AAEO,MAAMc,sCAAsCC,eAAe,eAAe,CAAC;IAC9E,WAAWpB;IACX,cAAc;QAACqB;QAAiBC;QAAgBC;KAAgB;AACpE"}
@@ -0,0 +1,8 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
3
+ import type { IAssetOutputStrategy } from "../abstractions.js";
4
+ export declare class PublicCache implements IAssetOutputStrategy {
5
+ private strategy;
6
+ constructor(strategy: IAssetOutputStrategy);
7
+ output(asset: Asset): Promise<AssetReply>;
8
+ }
@@ -0,0 +1,22 @@
1
+ import { parse, stringify } from "cache-control-parser";
2
+ class PublicCache {
3
+ constructor(strategy){
4
+ this.strategy = strategy;
5
+ }
6
+ async output(asset) {
7
+ const reply = await this.strategy.output(asset);
8
+ reply.setHeaders((headers)=>{
9
+ headers.set("cache-control", (value = "")=>{
10
+ const cacheControl = parse(value);
11
+ cacheControl["private"] = false;
12
+ cacheControl["public"] = true;
13
+ return stringify(cacheControl);
14
+ });
15
+ return headers;
16
+ });
17
+ return reply;
18
+ }
19
+ }
20
+ export { PublicCache };
21
+
22
+ //# sourceMappingURL=PublicCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/PublicCache.js","sources":["../../../../src/features/assetDelivery/privateFiles/PublicCache.ts"],"sourcesContent":["import { parse, stringify } from \"cache-control-parser\";\nimport type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport type { IAssetOutputStrategy } from \"../abstractions.js\";\n\nexport class PublicCache implements IAssetOutputStrategy {\n private strategy: IAssetOutputStrategy;\n\n constructor(strategy: IAssetOutputStrategy) {\n this.strategy = strategy;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const reply = await this.strategy.output(asset);\n\n reply.setHeaders(headers => {\n headers.set(\"cache-control\", (value = \"\") => {\n const cacheControl = parse(value);\n cacheControl[\"private\"] = false;\n cacheControl[\"public\"] = true;\n return stringify(cacheControl);\n });\n return headers;\n });\n\n return reply;\n }\n}\n"],"names":["PublicCache","strategy","asset","reply","headers","value","cacheControl","parse","stringify"],"mappings":";AAKO,MAAMA;IAGT,YAAYC,QAA8B,CAAE;QACxC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,OAAOC,KAAY,EAAuB;QAC5C,MAAMC,QAAQ,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAACD;QAEzCC,MAAM,UAAU,CAACC,CAAAA;YACbA,QAAQ,GAAG,CAAC,iBAAiB,CAACC,QAAQ,EAAE;gBACpC,MAAMC,eAAeC,MAAMF;gBAC3BC,YAAY,CAAC,UAAU,GAAG;gBAC1BA,YAAY,CAAC,SAAS,GAAG;gBACzB,OAAOE,UAAUF;YACrB;YACA,OAAOF;QACX;QAEA,OAAOD;IACX;AACJ"}
@@ -0,0 +1,9 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
3
+ import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
4
+ import type { IAssetOutputStrategy } from "../abstractions.js";
5
+ export declare class RedirectToPrivateUrlOutputStrategy implements IAssetOutputStrategy {
6
+ private assetRequest;
7
+ constructor(assetRequest: AssetRequest);
8
+ output(asset: Asset): Promise<AssetReply>;
9
+ }
@@ -0,0 +1,21 @@
1
+ import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
2
+ import { ResponseHeaders } from "@webiny/handler";
3
+ class RedirectToPrivateUrlOutputStrategy {
4
+ constructor(assetRequest){
5
+ this.assetRequest = assetRequest;
6
+ }
7
+ async output(asset) {
8
+ const requestUrl = this.assetRequest.getContext().url;
9
+ return new AssetReply({
10
+ code: 301,
11
+ headers: ResponseHeaders.create({
12
+ location: requestUrl.replace("/files/", "/private/"),
13
+ "content-type": asset.getContentType(),
14
+ "cache-control": "public, max-age=2592000"
15
+ })
16
+ });
17
+ }
18
+ }
19
+ export { RedirectToPrivateUrlOutputStrategy };
20
+
21
+ //# sourceMappingURL=RedirectToPrivateUrlOutputStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js","sources":["../../../../src/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.ts"],"sourcesContent":["import type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport { ResponseHeaders } from \"@webiny/handler\";\nimport type { IAssetOutputStrategy } from \"../abstractions.js\";\n\nexport class RedirectToPrivateUrlOutputStrategy implements IAssetOutputStrategy {\n private assetRequest: AssetRequest;\n\n constructor(assetRequest: AssetRequest) {\n this.assetRequest = assetRequest;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const requestUrl = this.assetRequest.getContext().url;\n\n return new AssetReply({\n code: 301,\n headers: ResponseHeaders.create({\n location: requestUrl.replace(\"/files/\", \"/private/\"),\n \"content-type\": asset.getContentType(),\n \"cache-control\": `public, max-age=${86400 * 30}`\n })\n });\n }\n}\n"],"names":["RedirectToPrivateUrlOutputStrategy","assetRequest","asset","requestUrl","AssetReply","ResponseHeaders"],"mappings":";;AAMO,MAAMA;IAGT,YAAYC,YAA0B,CAAE;QACpC,IAAI,CAAC,YAAY,GAAGA;IACxB;IAEA,MAAM,OAAOC,KAAY,EAAuB;QAC5C,MAAMC,aAAa,IAAI,CAAC,YAAY,CAAC,UAAU,GAAG,GAAG;QAErD,OAAO,IAAIC,WAAW;YAClB,MAAM;YACN,SAASC,gBAAgB,MAAM,CAAC;gBAC5B,UAAUF,WAAW,OAAO,CAAC,WAAW;gBACxC,gBAAgBD,MAAM,cAAc;gBACpC,iBAAiB;YACrB;QACJ;IACJ;AACJ"}
@@ -0,0 +1,9 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
3
+ import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
4
+ import type { IAssetOutputStrategy } from "../abstractions.js";
5
+ export declare class RedirectToPublicUrlOutputStrategy implements IAssetOutputStrategy {
6
+ private assetRequest;
7
+ constructor(assetRequest: AssetRequest);
8
+ output(asset: Asset): Promise<AssetReply>;
9
+ }
@@ -0,0 +1,21 @@
1
+ import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
2
+ import { ResponseHeaders } from "@webiny/handler";
3
+ class RedirectToPublicUrlOutputStrategy {
4
+ constructor(assetRequest){
5
+ this.assetRequest = assetRequest;
6
+ }
7
+ async output(asset) {
8
+ const requestUrl = this.assetRequest.getContext().url;
9
+ return new AssetReply({
10
+ code: 301,
11
+ headers: ResponseHeaders.create({
12
+ location: requestUrl.replace("/private/", "/files/"),
13
+ "content-type": asset.getContentType(),
14
+ "cache-control": "public, max-age=2592000"
15
+ })
16
+ });
17
+ }
18
+ }
19
+ export { RedirectToPublicUrlOutputStrategy };
20
+
21
+ //# sourceMappingURL=RedirectToPublicUrlOutputStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js","sources":["../../../../src/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.ts"],"sourcesContent":["import type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport { ResponseHeaders } from \"@webiny/handler\";\nimport type { IAssetOutputStrategy } from \"../abstractions.js\";\n\nexport class RedirectToPublicUrlOutputStrategy implements IAssetOutputStrategy {\n private assetRequest: AssetRequest;\n\n constructor(assetRequest: AssetRequest) {\n this.assetRequest = assetRequest;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const requestUrl = this.assetRequest.getContext().url;\n\n return new AssetReply({\n code: 301,\n headers: ResponseHeaders.create({\n location: requestUrl.replace(\"/private/\", \"/files/\"),\n \"content-type\": asset.getContentType(),\n \"cache-control\": `public, max-age=${86400 * 30}`\n })\n });\n }\n}\n"],"names":["RedirectToPublicUrlOutputStrategy","assetRequest","asset","requestUrl","AssetReply","ResponseHeaders"],"mappings":";;AAMO,MAAMA;IAGT,YAAYC,YAA0B,CAAE;QACpC,IAAI,CAAC,YAAY,GAAGA;IACxB;IAEA,MAAM,OAAOC,KAAY,EAAuB;QAC5C,MAAMC,aAAa,IAAI,CAAC,YAAY,CAAC,UAAU,GAAG,GAAG;QAErD,OAAO,IAAIC,WAAW;YAClB,MAAM;YACN,SAASC,gBAAgB,MAAM,CAAC;gBAC5B,UAAUF,WAAW,OAAO,CAAC,aAAa;gBAC1C,gBAAgBD,MAAM,cAAc;gBACpC,iBAAiB;YACrB;QACJ;IACJ;AACJ"}
@@ -0,0 +1,9 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
3
+ import { type IAssetTransformationStrategy } from "../abstractions.js";
4
+ export declare class PassthroughAssetTransformationStrategy implements IAssetTransformationStrategy {
5
+ transform(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;
6
+ }
7
+ export declare const PassthroughAssetTransformationStrategyImpl: typeof PassthroughAssetTransformationStrategy & {
8
+ __abstraction: import("@webiny/di").Abstraction<IAssetTransformationStrategy>;
9
+ };
@@ -0,0 +1,13 @@
1
+ import { AssetTransformationStrategy } from "../abstractions.js";
2
+ class PassthroughAssetTransformationStrategy {
3
+ transform(assetRequest, asset) {
4
+ return Promise.resolve(asset);
5
+ }
6
+ }
7
+ const PassthroughAssetTransformationStrategyImpl = AssetTransformationStrategy.createImplementation({
8
+ implementation: PassthroughAssetTransformationStrategy,
9
+ dependencies: []
10
+ });
11
+ export { PassthroughAssetTransformationStrategy, PassthroughAssetTransformationStrategyImpl };
12
+
13
+ //# sourceMappingURL=PassthroughAssetTransformationStrategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js","sources":["../../../../src/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.ts"],"sourcesContent":["import type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { AssetTransformationStrategy, type IAssetTransformationStrategy } from \"../abstractions.js\";\n\nexport class PassthroughAssetTransformationStrategy implements IAssetTransformationStrategy {\n transform(assetRequest: AssetRequest, asset: Asset): Promise<Asset> {\n return Promise.resolve(asset);\n }\n}\n\nexport const PassthroughAssetTransformationStrategyImpl =\n AssetTransformationStrategy.createImplementation({\n implementation: PassthroughAssetTransformationStrategy,\n dependencies: []\n });\n"],"names":["PassthroughAssetTransformationStrategy","assetRequest","asset","Promise","PassthroughAssetTransformationStrategyImpl","AssetTransformationStrategy"],"mappings":";AAIO,MAAMA;IACT,UAAUC,YAA0B,EAAEC,KAAY,EAAkB;QAChE,OAAOC,QAAQ,OAAO,CAACD;IAC3B;AACJ;AAEO,MAAME,6CACTC,4BAA4B,oBAAoB,CAAC;IAC7C,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,11 @@
1
+ import type { Asset } from "../../../delivery/AssetDelivery/Asset.js";
2
+ import type { AssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
3
+ import { type IAssetProcessor, type IAssetTransformationStrategy } from "../abstractions.js";
4
+ export declare class TransformationAssetProcessor implements IAssetProcessor {
5
+ private strategy;
6
+ constructor(strategy: IAssetTransformationStrategy);
7
+ process(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;
8
+ }
9
+ export declare const TransformationAssetProcessorImpl: typeof TransformationAssetProcessor & {
10
+ __abstraction: import("@webiny/di").Abstraction<IAssetProcessor>;
11
+ };
@@ -0,0 +1,23 @@
1
+ import { AssetProcessor, AssetTransformationStrategy } from "../abstractions.js";
2
+ class TransformationAssetProcessor {
3
+ constructor(strategy){
4
+ this.strategy = strategy;
5
+ }
6
+ async process(assetRequest, asset) {
7
+ const { original } = assetRequest.getOptions();
8
+ if (original) {
9
+ console.log("Skip transformations; original asset was requested.");
10
+ return asset;
11
+ }
12
+ return this.strategy.transform(assetRequest, asset);
13
+ }
14
+ }
15
+ const TransformationAssetProcessorImpl = AssetProcessor.createImplementation({
16
+ implementation: TransformationAssetProcessor,
17
+ dependencies: [
18
+ AssetTransformationStrategy
19
+ ]
20
+ });
21
+ export { TransformationAssetProcessor, TransformationAssetProcessorImpl };
22
+
23
+ //# sourceMappingURL=TransformationAssetProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/transformation/TransformationAssetProcessor.js","sources":["../../../../src/features/assetDelivery/transformation/TransformationAssetProcessor.ts"],"sourcesContent":["import type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport {\n AssetProcessor,\n AssetTransformationStrategy,\n type IAssetProcessor,\n type IAssetTransformationStrategy\n} from \"../abstractions.js\";\n\nexport class TransformationAssetProcessor implements IAssetProcessor {\n private strategy: IAssetTransformationStrategy;\n\n constructor(strategy: IAssetTransformationStrategy) {\n this.strategy = strategy;\n }\n\n async process(assetRequest: AssetRequest, asset: Asset): Promise<Asset> {\n const { original } = assetRequest.getOptions();\n\n if (original) {\n console.log(\"Skip transformations; original asset was requested.\");\n return asset;\n }\n\n return this.strategy.transform(assetRequest, asset);\n }\n}\n\nexport const TransformationAssetProcessorImpl = AssetProcessor.createImplementation({\n implementation: TransformationAssetProcessor,\n dependencies: [AssetTransformationStrategy]\n});\n"],"names":["TransformationAssetProcessor","strategy","assetRequest","asset","original","console","TransformationAssetProcessorImpl","AssetProcessor","AssetTransformationStrategy"],"mappings":";AASO,MAAMA;IAGT,YAAYC,QAAsC,CAAE;QAChD,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,QAAQC,YAA0B,EAAEC,KAAY,EAAkB;QACpE,MAAM,EAAEC,QAAQ,EAAE,GAAGF,aAAa,UAAU;QAE5C,IAAIE,UAAU;YACVC,QAAQ,GAAG,CAAC;YACZ,OAAOF;QACX;QAEA,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAACD,cAAcC;IACjD;AACJ;AAEO,MAAMG,mCAAmCC,eAAe,oBAAoB,CAAC;IAChF,gBAAgBP;IAChB,cAAc;QAACQ;KAA4B;AAC/C"}
@@ -0,0 +1,15 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { CreateFileRepository as RepositoryAbstraction } from "./abstractions.js";
3
+ import { CreateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry";
4
+ import { FileModel } from "../../../domain/file/abstractions.js";
5
+ import type { File, FileInput } from "../../../domain/file/types.js";
6
+ declare class CreateFileRepositoryImpl implements RepositoryAbstraction.Interface {
7
+ private createEntry;
8
+ private fileModel;
9
+ constructor(createEntry: CreateEntryUseCase.Interface, fileModel: FileModel.Interface);
10
+ execute(data: FileInput): Promise<Result<File, RepositoryAbstraction.Error>>;
11
+ }
12
+ export declare const CreateFileRepository: typeof CreateFileRepositoryImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICreateFileRepository>;
14
+ };
15
+ export {};
@@ -0,0 +1,32 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { CreateFileRepository } from "./abstractions.js";
3
+ import { CreateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/CreateEntry";
4
+ import { FileModel } from "../../../domain/file/abstractions.js";
5
+ import { EntryToFileMapper } from "../shared/EntryToFileMapper.js";
6
+ import { FileNotAuthorizedError, FilePersistenceError } from "../../../domain/file/errors.js";
7
+ import { FileInputToEntryInputMapper } from "../shared/FileInputToEntryInputMapper.js";
8
+ class CreateFileRepositoryImpl {
9
+ constructor(createEntry, fileModel){
10
+ this.createEntry = createEntry;
11
+ this.fileModel = fileModel;
12
+ }
13
+ async execute(data) {
14
+ const result = await this.createEntry.execute(this.fileModel, FileInputToEntryInputMapper.toEntry(data));
15
+ if (result.isFail()) {
16
+ if ("Cms/Entry/NotAuthorized" === result.error.code) return Result.fail(new FileNotAuthorizedError());
17
+ return Result.fail(new FilePersistenceError(result.error));
18
+ }
19
+ const file = EntryToFileMapper.toFile(result.value);
20
+ return Result.ok(file);
21
+ }
22
+ }
23
+ const CreateFileRepository_CreateFileRepository = CreateFileRepository.createImplementation({
24
+ implementation: CreateFileRepositoryImpl,
25
+ dependencies: [
26
+ CreateEntryUseCase,
27
+ FileModel
28
+ ]
29
+ });
30
+ export { CreateFileRepository_CreateFileRepository as CreateFileRepository };
31
+
32
+ //# sourceMappingURL=CreateFileRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/CreateFile/CreateFileRepository.js","sources":["../../../../src/features/file/CreateFile/CreateFileRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { CreateFileRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { CreateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/CreateEntry\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport type { File, FileInput } from \"~/domain/file/types.js\";\nimport { EntryToFileMapper } from \"../shared/EntryToFileMapper.js\";\nimport { FileNotAuthorizedError, FilePersistenceError } from \"~/domain/file/errors.js\";\nimport { FileInputToEntryInputMapper } from \"~/features/file/shared/FileInputToEntryInputMapper.js\";\n\nclass CreateFileRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private createEntry: CreateEntryUseCase.Interface,\n private fileModel: FileModel.Interface\n ) {}\n\n async execute(data: FileInput): Promise<Result<File, RepositoryAbstraction.Error>> {\n const result = await this.createEntry.execute(\n this.fileModel,\n FileInputToEntryInputMapper.toEntry(data)\n );\n\n if (result.isFail()) {\n if (result.error.code === \"Cms/Entry/NotAuthorized\") {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n const file = EntryToFileMapper.toFile(result.value);\n return Result.ok(file);\n }\n}\n\nexport const CreateFileRepository = RepositoryAbstraction.createImplementation({\n implementation: CreateFileRepositoryImpl,\n dependencies: [CreateEntryUseCase, FileModel]\n});\n"],"names":["CreateFileRepositoryImpl","createEntry","fileModel","data","result","FileInputToEntryInputMapper","Result","FileNotAuthorizedError","FilePersistenceError","file","EntryToFileMapper","CreateFileRepository","RepositoryAbstraction","CreateEntryUseCase","FileModel"],"mappings":";;;;;;;AASA,MAAMA;IACF,YACYC,WAAyC,EACzCC,SAA8B,CACxC;aAFUD,WAAW,GAAXA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,IAAe,EAAsD;QAC/E,MAAMC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CACzC,IAAI,CAAC,SAAS,EACdC,4BAA4B,OAAO,CAACF;QAGxC,IAAIC,OAAO,MAAM,IAAI;YACjB,IAAIA,AAAsB,8BAAtBA,OAAO,KAAK,CAAC,IAAI,EACjB,OAAOE,OAAO,IAAI,CAAC,IAAIC;YAG3B,OAAOD,OAAO,IAAI,CAAC,IAAIE,qBAAqBJ,OAAO,KAAK;QAC5D;QAEA,MAAMK,OAAOC,kBAAkB,MAAM,CAACN,OAAO,KAAK;QAClD,OAAOE,OAAO,EAAE,CAACG;IACrB;AACJ;AAEO,MAAME,4CAAuBC,qBAAAA,oBAA0C,CAAC;IAC3E,gBAAgBZ;IAChB,cAAc;QAACa;QAAoBC;KAAU;AACjD"}
@@ -0,0 +1,21 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { CreateFileUseCase as UseCaseAbstraction, CreateFileInput, CreateFileRepository } from "./abstractions.js";
3
+ import { GetSettingsUseCase } from "../../settings/GetSettings/abstractions.js";
4
+ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.js";
5
+ import type { File } from "../../../domain/file/types.js";
6
+ import { FmPermissions } from "../../../features/shared/abstractions.js";
7
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
8
+ declare class CreateFileUseCaseImpl implements UseCaseAbstraction.Interface {
9
+ private identityContext;
10
+ private permissions;
11
+ private repository;
12
+ private getSettings;
13
+ private eventPublisher;
14
+ constructor(identityContext: IdentityContext.Interface, permissions: FmPermissions.Interface, repository: CreateFileRepository.Interface, getSettings: GetSettingsUseCase.Interface, eventPublisher: EventPublisher.Interface);
15
+ execute(input: CreateFileInput, meta?: Record<string, any>): Promise<Result<File, UseCaseAbstraction.Error>>;
16
+ private validateInput;
17
+ }
18
+ export declare const CreateFileUseCase: typeof CreateFileUseCaseImpl & {
19
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICreateFileUseCase>;
20
+ };
21
+ export {};