@webiny/api-file-manager 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e

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 (649) hide show
  1. package/FileManagerAppFeature.d.ts +5 -0
  2. package/FileManagerAppFeature.js +21 -0
  3. package/FileManagerAppFeature.js.map +1 -0
  4. package/README.md +7 -13
  5. package/contants.js +2 -7
  6. package/contants.js.map +1 -1
  7. package/delivery/AssetDelivery/Asset.d.ts +3 -7
  8. package/delivery/AssetDelivery/Asset.js +46 -62
  9. package/delivery/AssetDelivery/Asset.js.map +1 -1
  10. package/delivery/AssetDelivery/AssetRequest.d.ts +2 -2
  11. package/delivery/AssetDelivery/AssetRequest.js +19 -25
  12. package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
  13. package/delivery/AssetDelivery/abstractions/AssetReply.js +28 -34
  14. package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -1
  15. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +1 -1
  16. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +4 -12
  17. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -1
  18. package/delivery/AssetDeliveryRoute.d.ts +24 -0
  19. package/delivery/AssetDeliveryRoute.js +69 -0
  20. package/delivery/AssetDeliveryRoute.js.map +1 -0
  21. package/delivery/index.d.ts +7 -17
  22. package/delivery/index.js +6 -194
  23. package/delivery/setupAssetDelivery.d.ts +1 -6
  24. package/delivery/setupAssetDelivery.js +2 -126
  25. package/delivery/setupAssetDelivery.js.map +1 -1
  26. package/domain/file/abstractions.d.ts +17 -0
  27. package/domain/file/abstractions.js +5 -0
  28. package/domain/file/abstractions.js.map +1 -0
  29. package/domain/file/errors.d.ts +59 -0
  30. package/domain/file/errors.js +80 -0
  31. package/domain/file/errors.js.map +1 -0
  32. package/domain/file/file.model.d.ts +12 -0
  33. package/domain/file/file.model.js +70 -0
  34. package/domain/file/file.model.js.map +1 -0
  35. package/domain/file/types.d.ts +53 -0
  36. package/domain/file/types.js +0 -0
  37. package/domain/identity/Identity.d.ts +9 -0
  38. package/domain/identity/Identity.js +12 -0
  39. package/domain/identity/Identity.js.map +1 -0
  40. package/domain/permissionsSchema.d.ts +16 -0
  41. package/domain/permissionsSchema.js +30 -0
  42. package/domain/permissionsSchema.js.map +1 -0
  43. package/domain/settings/constants.d.ts +1 -0
  44. package/domain/settings/constants.js +4 -0
  45. package/domain/settings/constants.js.map +1 -0
  46. package/domain/settings/errors.d.ts +18 -0
  47. package/domain/settings/errors.js +28 -0
  48. package/domain/settings/errors.js.map +1 -0
  49. package/domain/settings/types.d.ts +10 -0
  50. package/domain/settings/types.js +0 -0
  51. package/domain/settings/validation.d.ts +6 -0
  52. package/domain/settings/validation.js +27 -0
  53. package/domain/settings/validation.js.map +1 -0
  54. package/exports/api/file-manager/assetDelivery.d.ts +10 -0
  55. package/exports/api/file-manager/assetDelivery.js +8 -0
  56. package/exports/api/file-manager/file.d.ts +13 -0
  57. package/exports/api/file-manager/file.js +13 -0
  58. package/exports/api/file-manager/permissions.d.ts +1 -0
  59. package/exports/api/file-manager/permissions.js +1 -0
  60. package/exports/api/file-manager/settings.d.ts +3 -0
  61. package/exports/api/file-manager/settings.js +3 -0
  62. package/features/FileManagerFeature.d.ts +4 -0
  63. package/features/FileManagerFeature.js +37 -0
  64. package/features/FileManagerFeature.js.map +1 -0
  65. package/features/assetDelivery/Asset/Asset.d.ts +8 -0
  66. package/features/assetDelivery/Asset/Asset.js +14 -0
  67. package/features/assetDelivery/Asset/Asset.js.map +1 -0
  68. package/features/assetDelivery/Asset/abstractions.d.ts +10 -0
  69. package/features/assetDelivery/Asset/abstractions.js +5 -0
  70. package/features/assetDelivery/Asset/abstractions.js.map +1 -0
  71. package/features/assetDelivery/Asset/index.d.ts +1 -0
  72. package/features/assetDelivery/Asset/index.js +1 -0
  73. package/features/assetDelivery/FilesAssetRequestResolver.d.ts +9 -0
  74. package/features/assetDelivery/FilesAssetRequestResolver.js +29 -0
  75. package/features/assetDelivery/FilesAssetRequestResolver.js.map +1 -0
  76. package/features/assetDelivery/NullAssetOutputStrategy.d.ts +8 -0
  77. package/features/assetDelivery/NullAssetOutputStrategy.js +14 -0
  78. package/features/assetDelivery/NullAssetOutputStrategy.js.map +1 -0
  79. package/features/assetDelivery/NullAssetReply.d.ts +4 -0
  80. package/features/assetDelivery/NullAssetReply.js +14 -0
  81. package/features/assetDelivery/NullAssetReply.js.map +1 -0
  82. package/features/assetDelivery/NullAssetResolver.d.ts +8 -0
  83. package/features/assetDelivery/NullAssetResolver.js +13 -0
  84. package/features/assetDelivery/NullAssetResolver.js.map +1 -0
  85. package/features/assetDelivery/ObjectKey/ObjectKey.d.ts +8 -0
  86. package/features/assetDelivery/ObjectKey/ObjectKey.js +28 -0
  87. package/features/assetDelivery/ObjectKey/ObjectKey.js.map +1 -0
  88. package/features/assetDelivery/ObjectKey/abstractions.d.ts +12 -0
  89. package/features/assetDelivery/ObjectKey/abstractions.js +5 -0
  90. package/features/assetDelivery/ObjectKey/abstractions.js.map +1 -0
  91. package/features/assetDelivery/ObjectKey/index.d.ts +1 -0
  92. package/features/assetDelivery/ObjectKey/index.js +1 -0
  93. package/features/assetDelivery/StreamAssetReply/StreamAssetReply.d.ts +8 -0
  94. package/features/assetDelivery/StreamAssetReply/StreamAssetReply.js +22 -0
  95. package/features/assetDelivery/StreamAssetReply/StreamAssetReply.js.map +1 -0
  96. package/features/assetDelivery/StreamAssetReply/abstractions.d.ts +11 -0
  97. package/features/assetDelivery/StreamAssetReply/abstractions.js +5 -0
  98. package/features/assetDelivery/StreamAssetReply/abstractions.js.map +1 -0
  99. package/features/assetDelivery/StreamAssetReply/index.d.ts +1 -0
  100. package/features/assetDelivery/StreamAssetReply/index.js +1 -0
  101. package/features/assetDelivery/abstractions/AssetType.d.ts +17 -0
  102. package/features/assetDelivery/abstractions/AssetType.js +5 -0
  103. package/features/assetDelivery/abstractions/AssetType.js.map +1 -0
  104. package/features/assetDelivery/abstractions.d.ts +65 -0
  105. package/features/assetDelivery/abstractions.js +11 -0
  106. package/features/assetDelivery/abstractions.js.map +1 -0
  107. package/features/assetDelivery/assetTypes/image/AssetKeyGenerator.d.ts +12 -0
  108. package/features/assetDelivery/assetTypes/image/AssetKeyGenerator.js +30 -0
  109. package/features/assetDelivery/assetTypes/image/AssetKeyGenerator.js.map +1 -0
  110. package/features/assetDelivery/assetTypes/image/ImageAssetType.d.ts +9 -0
  111. package/features/assetDelivery/assetTypes/image/ImageAssetType.js +18 -0
  112. package/features/assetDelivery/assetTypes/image/ImageAssetType.js.map +1 -0
  113. package/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.d.ts +5 -0
  114. package/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.js +5 -0
  115. package/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.js.map +1 -0
  116. package/features/assetDelivery/assetTypes/image/SharpTransformer.d.ts +18 -0
  117. package/features/assetDelivery/assetTypes/image/SharpTransformer.js +47 -0
  118. package/features/assetDelivery/assetTypes/image/SharpTransformer.js.map +1 -0
  119. package/features/assetDelivery/assetTypes/image/WidthCollection.d.ts +8 -0
  120. package/features/assetDelivery/assetTypes/image/WidthCollection.js +22 -0
  121. package/features/assetDelivery/assetTypes/image/WidthCollection.js.map +1 -0
  122. package/features/assetDelivery/assetTypes/image/imageFormat.d.ts +26 -0
  123. package/features/assetDelivery/assetTypes/image/imageFormat.js +51 -0
  124. package/features/assetDelivery/assetTypes/image/imageFormat.js.map +1 -0
  125. package/features/assetDelivery/assetTypes/image/imageTypes.d.ts +39 -0
  126. package/features/assetDelivery/assetTypes/image/imageTypes.js +0 -0
  127. package/features/assetDelivery/assetTypes/image/index.d.ts +5 -0
  128. package/features/assetDelivery/assetTypes/image/index.js +4 -0
  129. package/features/assetDelivery/assetTypes/image/normalizeImageOptions.d.ts +6 -0
  130. package/features/assetDelivery/assetTypes/image/normalizeImageOptions.js +56 -0
  131. package/features/assetDelivery/assetTypes/image/normalizeImageOptions.js.map +1 -0
  132. package/features/assetDelivery/assetTypes/image/transformImage.d.ts +59 -0
  133. package/features/assetDelivery/assetTypes/image/transformImage.js +146 -0
  134. package/features/assetDelivery/assetTypes/image/transformImage.js.map +1 -0
  135. package/features/assetDelivery/assetTypes/image/utils.d.ts +26 -0
  136. package/features/assetDelivery/assetTypes/image/utils.js +47 -0
  137. package/features/assetDelivery/assetTypes/image/utils.js.map +1 -0
  138. package/features/assetDelivery/feature.d.ts +4 -0
  139. package/features/assetDelivery/feature.js +35 -0
  140. package/features/assetDelivery/feature.js.map +1 -0
  141. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +4 -0
  142. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js +20 -0
  143. package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -0
  144. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +5 -0
  145. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +9 -0
  146. package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -0
  147. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +11 -0
  148. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +26 -0
  149. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -0
  150. package/features/assetDelivery/privateFiles/PrivateCache.d.ts +8 -0
  151. package/features/assetDelivery/privateFiles/PrivateCache.js +22 -0
  152. package/features/assetDelivery/privateFiles/PrivateCache.js.map +1 -0
  153. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +11 -0
  154. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +31 -0
  155. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -0
  156. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +19 -0
  157. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js +65 -0
  158. package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -0
  159. package/features/assetDelivery/privateFiles/PublicCache.d.ts +8 -0
  160. package/features/assetDelivery/privateFiles/PublicCache.js +22 -0
  161. package/features/assetDelivery/privateFiles/PublicCache.js.map +1 -0
  162. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +9 -0
  163. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +21 -0
  164. package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -0
  165. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +9 -0
  166. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +21 -0
  167. package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -0
  168. package/features/assetDelivery/transformation/CallableContentsReader.d.ts +11 -0
  169. package/features/assetDelivery/transformation/CallableContentsReader.js +14 -0
  170. package/features/assetDelivery/transformation/CallableContentsReader.js.map +1 -0
  171. package/features/assetDelivery/transformation/TransformationAssetProcessor.d.ts +9 -0
  172. package/features/assetDelivery/transformation/TransformationAssetProcessor.js +25 -0
  173. package/features/assetDelivery/transformation/TransformationAssetProcessor.js.map +1 -0
  174. package/features/assetDelivery/transformation/index.d.ts +5 -0
  175. package/features/assetDelivery/transformation/index.js +4 -0
  176. package/features/extractMetadata/ExtractMetadataHandler.d.ts +11 -0
  177. package/features/extractMetadata/ExtractMetadataHandler.js +25 -0
  178. package/features/extractMetadata/ExtractMetadataHandler.js.map +1 -0
  179. package/features/extractMetadata/ExtractMetadataInput.d.ts +3 -0
  180. package/features/extractMetadata/ExtractMetadataInput.js +0 -0
  181. package/features/file/CreateFile/CreateFileRepository.d.ts +15 -0
  182. package/features/file/CreateFile/CreateFileRepository.js +33 -0
  183. package/features/file/CreateFile/CreateFileRepository.js.map +1 -0
  184. package/features/file/CreateFile/CreateFileUseCase.d.ts +21 -0
  185. package/features/file/CreateFile/CreateFileUseCase.js +83 -0
  186. package/features/file/CreateFile/CreateFileUseCase.js.map +1 -0
  187. package/features/file/CreateFile/abstractions.d.ts +60 -0
  188. package/features/file/CreateFile/abstractions.js +6 -0
  189. package/features/file/CreateFile/abstractions.js.map +1 -0
  190. package/features/file/CreateFile/events.d.ts +31 -0
  191. package/features/file/CreateFile/events.js +23 -0
  192. package/features/file/CreateFile/events.js.map +1 -0
  193. package/features/file/CreateFile/feature.d.ts +4 -0
  194. package/features/file/CreateFile/feature.js +13 -0
  195. package/features/file/CreateFile/feature.js.map +1 -0
  196. package/features/file/CreateFile/index.d.ts +2 -0
  197. package/features/file/CreateFile/index.js +2 -0
  198. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.d.ts +13 -0
  199. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +22 -0
  200. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js.map +1 -0
  201. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.d.ts +19 -0
  202. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js +73 -0
  203. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -0
  204. package/features/file/CreateFilesInBatch/abstractions.d.ts +42 -0
  205. package/features/file/CreateFilesInBatch/abstractions.js +6 -0
  206. package/features/file/CreateFilesInBatch/abstractions.js.map +1 -0
  207. package/features/file/CreateFilesInBatch/events.d.ts +31 -0
  208. package/features/file/CreateFilesInBatch/events.js +23 -0
  209. package/features/file/CreateFilesInBatch/events.js.map +1 -0
  210. package/features/file/CreateFilesInBatch/feature.d.ts +4 -0
  211. package/features/file/CreateFilesInBatch/feature.js +13 -0
  212. package/features/file/CreateFilesInBatch/feature.js.map +1 -0
  213. package/features/file/CreateFilesInBatch/index.d.ts +1 -0
  214. package/features/file/CreateFilesInBatch/index.js +1 -0
  215. package/features/file/DeleteFile/DeleteFileRepository.d.ts +15 -0
  216. package/features/file/DeleteFile/DeleteFileRepository.js +32 -0
  217. package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -0
  218. package/features/file/DeleteFile/DeleteFileUseCase.d.ts +17 -0
  219. package/features/file/DeleteFile/DeleteFileUseCase.js +43 -0
  220. package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -0
  221. package/features/file/DeleteFile/abstractions.d.ts +39 -0
  222. package/features/file/DeleteFile/abstractions.js +6 -0
  223. package/features/file/DeleteFile/abstractions.js.map +1 -0
  224. package/features/file/DeleteFile/events.d.ts +29 -0
  225. package/features/file/DeleteFile/events.js +23 -0
  226. package/features/file/DeleteFile/events.js.map +1 -0
  227. package/features/file/DeleteFile/feature.d.ts +4 -0
  228. package/features/file/DeleteFile/feature.js +13 -0
  229. package/features/file/DeleteFile/feature.js.map +1 -0
  230. package/features/file/DeleteFile/index.d.ts +2 -0
  231. package/features/file/DeleteFile/index.js +2 -0
  232. package/features/file/FileModelProvider.d.ts +31 -0
  233. package/features/file/FileModelProvider.js +22 -0
  234. package/features/file/FileModelProvider.js.map +1 -0
  235. package/features/file/FileUrlGenerator/FileUrlGenerator.d.ts +12 -0
  236. package/features/file/FileUrlGenerator/FileUrlGenerator.js +19 -0
  237. package/features/file/FileUrlGenerator/FileUrlGenerator.js.map +1 -0
  238. package/features/file/FileUrlGenerator/SettingsFileUrlPrefixProvider.d.ts +13 -0
  239. package/features/file/FileUrlGenerator/SettingsFileUrlPrefixProvider.js +28 -0
  240. package/features/file/FileUrlGenerator/SettingsFileUrlPrefixProvider.js.map +1 -0
  241. package/features/file/FileUrlGenerator/abstractions.d.ts +20 -0
  242. package/features/file/FileUrlGenerator/abstractions.js +6 -0
  243. package/features/file/FileUrlGenerator/abstractions.js.map +1 -0
  244. package/features/file/FileUrlGenerator/feature.d.ts +4 -0
  245. package/features/file/FileUrlGenerator/feature.js +13 -0
  246. package/features/file/FileUrlGenerator/feature.js.map +1 -0
  247. package/features/file/FileUrlGenerator/index.d.ts +2 -0
  248. package/features/file/FileUrlGenerator/index.js +1 -0
  249. package/features/file/GetFile/GetFileRepository.d.ts +15 -0
  250. package/features/file/GetFile/GetFileRepository.js +34 -0
  251. package/features/file/GetFile/GetFileRepository.js.map +1 -0
  252. package/features/file/GetFile/GetFileUseCase.d.ts +14 -0
  253. package/features/file/GetFile/GetFileUseCase.js +29 -0
  254. package/features/file/GetFile/GetFileUseCase.js.map +1 -0
  255. package/features/file/GetFile/abstractions.d.ts +40 -0
  256. package/features/file/GetFile/abstractions.js +6 -0
  257. package/features/file/GetFile/abstractions.js.map +1 -0
  258. package/features/file/GetFile/feature.d.ts +4 -0
  259. package/features/file/GetFile/feature.js +13 -0
  260. package/features/file/GetFile/feature.js.map +1 -0
  261. package/features/file/GetFile/index.d.ts +1 -0
  262. package/features/file/GetFile/index.js +1 -0
  263. package/features/file/GetFileByUrl/GetFileByUrlUseCase.d.ts +15 -0
  264. package/features/file/GetFileByUrl/GetFileByUrlUseCase.js +37 -0
  265. package/features/file/GetFileByUrl/GetFileByUrlUseCase.js.map +1 -0
  266. package/features/file/GetFileByUrl/abstractions.d.ts +18 -0
  267. package/features/file/GetFileByUrl/abstractions.js +5 -0
  268. package/features/file/GetFileByUrl/abstractions.js.map +1 -0
  269. package/features/file/GetFileByUrl/feature.d.ts +4 -0
  270. package/features/file/GetFileByUrl/feature.js +11 -0
  271. package/features/file/GetFileByUrl/feature.js.map +1 -0
  272. package/features/file/GetFileByUrl/index.d.ts +1 -0
  273. package/features/file/GetFileByUrl/index.js +1 -0
  274. package/features/file/GetFileContentsById/abstractions.d.ts +20 -0
  275. package/features/file/GetFileContentsById/abstractions.js +5 -0
  276. package/features/file/GetFileContentsById/abstractions.js.map +1 -0
  277. package/features/file/GetFileContentsById/index.d.ts +1 -0
  278. package/features/file/GetFileContentsById/index.js +1 -0
  279. package/features/file/GetFileContentsByKey/abstractions.d.ts +17 -0
  280. package/features/file/GetFileContentsByKey/abstractions.js +5 -0
  281. package/features/file/GetFileContentsByKey/abstractions.js.map +1 -0
  282. package/features/file/GetFileContentsByKey/index.d.ts +1 -0
  283. package/features/file/GetFileContentsByKey/index.js +1 -0
  284. package/features/file/ListFiles/ListFilesRepository.d.ts +18 -0
  285. package/features/file/ListFiles/ListFilesRepository.js +54 -0
  286. package/features/file/ListFiles/ListFilesRepository.js.map +1 -0
  287. package/features/file/ListFiles/ListFilesUseCase.d.ts +15 -0
  288. package/features/file/ListFiles/ListFilesUseCase.js +44 -0
  289. package/features/file/ListFiles/ListFilesUseCase.js.map +1 -0
  290. package/features/file/ListFiles/abstractions.d.ts +49 -0
  291. package/features/file/ListFiles/abstractions.js +6 -0
  292. package/features/file/ListFiles/abstractions.js.map +1 -0
  293. package/features/file/ListFiles/feature.d.ts +4 -0
  294. package/features/file/ListFiles/feature.js +13 -0
  295. package/features/file/ListFiles/feature.js.map +1 -0
  296. package/features/file/ListFiles/index.d.ts +1 -0
  297. package/features/file/ListFiles/index.js +1 -0
  298. package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +37 -0
  299. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +56 -0
  300. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -0
  301. package/features/file/ListImagesByTagTool/feature.d.ts +4 -0
  302. package/features/file/ListImagesByTagTool/feature.js +11 -0
  303. package/features/file/ListImagesByTagTool/feature.js.map +1 -0
  304. package/features/file/ListTags/ListTagsRepository.d.ts +16 -0
  305. package/features/file/ListTags/ListTagsRepository.js +43 -0
  306. package/features/file/ListTags/ListTagsRepository.js.map +1 -0
  307. package/features/file/ListTags/ListTagsUseCase.d.ts +13 -0
  308. package/features/file/ListTags/ListTagsUseCase.js +31 -0
  309. package/features/file/ListTags/ListTagsUseCase.js.map +1 -0
  310. package/features/file/ListTags/abstractions.d.ts +45 -0
  311. package/features/file/ListTags/abstractions.js +6 -0
  312. package/features/file/ListTags/abstractions.js.map +1 -0
  313. package/features/file/ListTags/feature.d.ts +4 -0
  314. package/features/file/ListTags/feature.js +13 -0
  315. package/features/file/ListTags/feature.js.map +1 -0
  316. package/features/file/ListTags/index.d.ts +1 -0
  317. package/features/file/ListTags/index.js +1 -0
  318. package/features/file/UpdateFile/UpdateFileRepository.d.ts +15 -0
  319. package/features/file/UpdateFile/UpdateFileRepository.js +38 -0
  320. package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -0
  321. package/features/file/UpdateFile/UpdateFileUseCase.d.ts +20 -0
  322. package/features/file/UpdateFile/UpdateFileUseCase.js +71 -0
  323. package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -0
  324. package/features/file/UpdateFile/abstractions.d.ts +56 -0
  325. package/features/file/UpdateFile/abstractions.js +6 -0
  326. package/features/file/UpdateFile/abstractions.js.map +1 -0
  327. package/features/file/UpdateFile/events.d.ts +34 -0
  328. package/features/file/UpdateFile/events.js +23 -0
  329. package/features/file/UpdateFile/events.js.map +1 -0
  330. package/features/file/UpdateFile/feature.d.ts +4 -0
  331. package/features/file/UpdateFile/feature.js +13 -0
  332. package/features/file/UpdateFile/feature.js.map +1 -0
  333. package/features/file/UpdateFile/index.d.ts +2 -0
  334. package/features/file/UpdateFile/index.js +2 -0
  335. package/features/file/shared/EntryToFileMapper.d.ts +5 -0
  336. package/features/file/shared/EntryToFileMapper.js +28 -0
  337. package/features/file/shared/EntryToFileMapper.js.map +1 -0
  338. package/features/file/shared/FileInputToEntryInputMapper.d.ts +5 -0
  339. package/features/file/shared/FileInputToEntryInputMapper.js +32 -0
  340. package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -0
  341. package/features/file/shared/FileToEntryMapper.d.ts +5 -0
  342. package/features/file/shared/FileToEntryMapper.js +31 -0
  343. package/features/file/shared/FileToEntryMapper.js.map +1 -0
  344. package/features/permissions/abstractions.d.ts +21 -0
  345. package/features/permissions/abstractions.js +6 -0
  346. package/features/permissions/abstractions.js.map +1 -0
  347. package/features/permissions/feature.d.ts +4 -0
  348. package/features/permissions/feature.js +7 -0
  349. package/features/permissions/feature.js.map +1 -0
  350. package/features/settings/GetSettings/GetSettingsUseCase.d.ts +13 -0
  351. package/features/settings/GetSettings/GetSettingsUseCase.js +28 -0
  352. package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -0
  353. package/features/settings/GetSettings/abstractions.d.ts +18 -0
  354. package/features/settings/GetSettings/abstractions.js +5 -0
  355. package/features/settings/GetSettings/abstractions.js.map +1 -0
  356. package/features/settings/GetSettings/feature.d.ts +4 -0
  357. package/features/settings/GetSettings/feature.js +11 -0
  358. package/features/settings/GetSettings/feature.js.map +1 -0
  359. package/features/settings/SettingsInstaller/SettingsInstaller.d.ts +17 -0
  360. package/features/settings/SettingsInstaller/SettingsInstaller.js +39 -0
  361. package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -0
  362. package/features/settings/SettingsInstaller/feature.d.ts +4 -0
  363. package/features/settings/SettingsInstaller/feature.js +11 -0
  364. package/features/settings/SettingsInstaller/feature.js.map +1 -0
  365. package/features/settings/UpdateSettings/UpdateSettingsUseCase.d.ts +18 -0
  366. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +55 -0
  367. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -0
  368. package/features/settings/UpdateSettings/abstractions.d.ts +23 -0
  369. package/features/settings/UpdateSettings/abstractions.js +5 -0
  370. package/features/settings/UpdateSettings/abstractions.js.map +1 -0
  371. package/features/settings/UpdateSettings/events.d.ts +34 -0
  372. package/features/settings/UpdateSettings/events.js +23 -0
  373. package/features/settings/UpdateSettings/events.js.map +1 -0
  374. package/features/settings/UpdateSettings/feature.d.ts +4 -0
  375. package/features/settings/UpdateSettings/feature.js +11 -0
  376. package/features/settings/UpdateSettings/feature.js.map +1 -0
  377. package/features/settings/UpdateSettings/index.d.ts +2 -0
  378. package/features/settings/UpdateSettings/index.js +2 -0
  379. package/features/shared/abstractions.d.ts +1 -0
  380. package/features/shared/abstractions.js +1 -0
  381. package/features/upload/CompleteMultiPartUpload/abstractions.d.ts +12 -0
  382. package/features/upload/CompleteMultiPartUpload/abstractions.js +5 -0
  383. package/features/upload/CompleteMultiPartUpload/abstractions.js.map +1 -0
  384. package/features/upload/CompleteMultiPartUpload/index.d.ts +1 -0
  385. package/features/upload/CompleteMultiPartUpload/index.js +1 -0
  386. package/features/upload/CreateMultiPartUpload/abstractions.d.ts +14 -0
  387. package/features/upload/CreateMultiPartUpload/abstractions.js +5 -0
  388. package/features/upload/CreateMultiPartUpload/abstractions.js.map +1 -0
  389. package/features/upload/CreateMultiPartUpload/index.d.ts +1 -0
  390. package/features/upload/CreateMultiPartUpload/index.js +1 -0
  391. package/features/upload/GetUploadPayload/abstractions.d.ts +10 -0
  392. package/features/upload/GetUploadPayload/abstractions.js +5 -0
  393. package/features/upload/GetUploadPayload/abstractions.js.map +1 -0
  394. package/features/upload/GetUploadPayload/index.d.ts +1 -0
  395. package/features/upload/GetUploadPayload/index.js +1 -0
  396. package/features/upload/ReadFileMetadata/MetadataReader.d.ts +11 -0
  397. package/features/upload/ReadFileMetadata/MetadataReader.js +21 -0
  398. package/features/upload/ReadFileMetadata/MetadataReader.js.map +1 -0
  399. package/features/upload/ReadFileMetadata/abstractions.d.ts +15 -0
  400. package/features/upload/ReadFileMetadata/abstractions.js +5 -0
  401. package/features/upload/ReadFileMetadata/abstractions.js.map +1 -0
  402. package/features/upload/ReadFileMetadata/feature.d.ts +4 -0
  403. package/features/upload/ReadFileMetadata/feature.js +11 -0
  404. package/features/upload/ReadFileMetadata/feature.js.map +1 -0
  405. package/features/upload/ReadFileMetadata/index.d.ts +1 -0
  406. package/features/upload/ReadFileMetadata/index.js +1 -0
  407. package/features/upload/WriteFileMetadata/MetadataWriter.d.ts +14 -0
  408. package/features/upload/WriteFileMetadata/MetadataWriter.js +36 -0
  409. package/features/upload/WriteFileMetadata/MetadataWriter.js.map +1 -0
  410. package/features/upload/WriteFileMetadata/WriteMetadataAfterBatchCreateHandler.d.ts +11 -0
  411. package/features/upload/WriteFileMetadata/WriteMetadataAfterBatchCreateHandler.js +20 -0
  412. package/features/upload/WriteFileMetadata/WriteMetadataAfterBatchCreateHandler.js.map +1 -0
  413. package/features/upload/WriteFileMetadata/WriteMetadataAfterCreateHandler.d.ts +11 -0
  414. package/features/upload/WriteFileMetadata/WriteMetadataAfterCreateHandler.js +22 -0
  415. package/features/upload/WriteFileMetadata/WriteMetadataAfterCreateHandler.js.map +1 -0
  416. package/features/upload/WriteFileMetadata/WriteMetadataAfterUpdateHandler.d.ts +11 -0
  417. package/features/upload/WriteFileMetadata/WriteMetadataAfterUpdateHandler.js +22 -0
  418. package/features/upload/WriteFileMetadata/WriteMetadataAfterUpdateHandler.js.map +1 -0
  419. package/features/upload/WriteFileMetadata/abstractions.d.ts +9 -0
  420. package/features/upload/WriteFileMetadata/abstractions.js +5 -0
  421. package/features/upload/WriteFileMetadata/abstractions.js.map +1 -0
  422. package/features/upload/WriteFileMetadata/feature.d.ts +4 -0
  423. package/features/upload/WriteFileMetadata/feature.js +17 -0
  424. package/features/upload/WriteFileMetadata/feature.js.map +1 -0
  425. package/features/upload/index.d.ts +17 -0
  426. package/features/upload/index.js +10 -0
  427. package/features/upload/types.d.ts +28 -0
  428. package/features/upload/types.js +0 -0
  429. package/features/upload/utils/FileExtension.d.ts +6 -0
  430. package/features/upload/utils/FileExtension.js +16 -0
  431. package/features/upload/utils/FileExtension.js.map +1 -0
  432. package/features/upload/utils/FileKey.d.ts +11 -0
  433. package/features/upload/utils/FileKey.js +33 -0
  434. package/features/upload/utils/FileKey.js.map +1 -0
  435. package/features/upload/utils/FileNormalizer.d.ts +13 -0
  436. package/features/upload/utils/FileNormalizer.js +41 -0
  437. package/features/upload/utils/FileNormalizer.js.map +1 -0
  438. package/features/upload/utils/FileUploadModifier.d.ts +30 -0
  439. package/features/upload/utils/FileUploadModifier.js +39 -0
  440. package/features/upload/utils/FileUploadModifier.js.map +1 -0
  441. package/features/upload/utils/checkPermissions.d.ts +5 -0
  442. package/features/upload/utils/checkPermissions.js +22 -0
  443. package/features/upload/utils/checkPermissions.js.map +1 -0
  444. package/features/upload/utils/createFileNormalizerFromContext.d.ts +3 -0
  445. package/features/upload/utils/createFileNormalizerFromContext.js +9 -0
  446. package/features/upload/utils/createFileNormalizerFromContext.js.map +1 -0
  447. package/features/upload/utils/mimeTypes.d.ts +1 -0
  448. package/features/upload/utils/mimeTypes.js +9 -0
  449. package/features/upload/utils/mimeTypes.js.map +1 -0
  450. package/graphql/FmGraphQLSchema.d.ts +24 -0
  451. package/graphql/FmGraphQLSchema.js +458 -0
  452. package/graphql/FmGraphQLSchema.js.map +1 -0
  453. package/index.d.ts +4 -10
  454. package/index.js +13 -74
  455. package/index.js.map +1 -1
  456. package/package.json +39 -30
  457. package/types.d.ts +2 -367
  458. package/types.js +1 -29
  459. package/FileManagerContextSetup.d.ts +0 -13
  460. package/FileManagerContextSetup.js +0 -115
  461. package/FileManagerContextSetup.js.map +0 -1
  462. package/cmsFileStorage/CmsFilesStorage.d.ts +0 -27
  463. package/cmsFileStorage/CmsFilesStorage.js +0 -164
  464. package/cmsFileStorage/CmsFilesStorage.js.map +0 -1
  465. package/cmsFileStorage/ListFilesWhereProcessor.d.ts +0 -7
  466. package/cmsFileStorage/ListFilesWhereProcessor.js +0 -33
  467. package/cmsFileStorage/ListFilesWhereProcessor.js.map +0 -1
  468. package/cmsFileStorage/ListTagsWhereProcessor.d.ts +0 -7
  469. package/cmsFileStorage/ListTagsWhereProcessor.js +0 -33
  470. package/cmsFileStorage/ListTagsWhereProcessor.js.map +0 -1
  471. package/cmsFileStorage/file.model.d.ts +0 -6
  472. package/cmsFileStorage/file.model.js +0 -158
  473. package/cmsFileStorage/file.model.js.map +0 -1
  474. package/createFileManager/files.crud.d.ts +0 -3
  475. package/createFileManager/files.crud.js +0 -328
  476. package/createFileManager/files.crud.js.map +0 -1
  477. package/createFileManager/index.d.ts +0 -3
  478. package/createFileManager/index.js +0 -23
  479. package/createFileManager/index.js.map +0 -1
  480. package/createFileManager/permissions/FilesPermissions.d.ts +0 -4
  481. package/createFileManager/permissions/FilesPermissions.js +0 -11
  482. package/createFileManager/permissions/FilesPermissions.js.map +0 -1
  483. package/createFileManager/permissions/SettingsPermissions.d.ts +0 -4
  484. package/createFileManager/permissions/SettingsPermissions.js +0 -11
  485. package/createFileManager/permissions/SettingsPermissions.js.map +0 -1
  486. package/createFileManager/settings.crud.d.ts +0 -3
  487. package/createFileManager/settings.crud.js +0 -117
  488. package/createFileManager/settings.crud.js.map +0 -1
  489. package/createFileManager/system.crud.d.ts +0 -3
  490. package/createFileManager/system.crud.js +0 -88
  491. package/createFileManager/system.crud.js.map +0 -1
  492. package/createFileManager/types.d.ts +0 -16
  493. package/createFileManager/types.js +0 -7
  494. package/createFileManager/types.js.map +0 -1
  495. package/delivery/AssetDelivery/AliasAssetRequestResolver.d.ts +0 -11
  496. package/delivery/AssetDelivery/AliasAssetRequestResolver.js +0 -74
  497. package/delivery/AssetDelivery/AliasAssetRequestResolver.js.map +0 -1
  498. package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +0 -63
  499. package/delivery/AssetDelivery/AssetDeliveryConfig.js +0 -102
  500. package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +0 -1
  501. package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +0 -6
  502. package/delivery/AssetDelivery/FilesAssetRequestResolver.js +0 -37
  503. package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +0 -1
  504. package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +0 -4
  505. package/delivery/AssetDelivery/NullAssetOutputStrategy.js +0 -15
  506. package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +0 -1
  507. package/delivery/AssetDelivery/NullAssetReply.d.ts +0 -4
  508. package/delivery/AssetDelivery/NullAssetReply.js +0 -20
  509. package/delivery/AssetDelivery/NullAssetReply.js.map +0 -1
  510. package/delivery/AssetDelivery/NullAssetResolver.d.ts +0 -5
  511. package/delivery/AssetDelivery/NullAssetResolver.js +0 -14
  512. package/delivery/AssetDelivery/NullAssetResolver.js.map +0 -1
  513. package/delivery/AssetDelivery/NullRequestResolver.d.ts +0 -4
  514. package/delivery/AssetDelivery/NullRequestResolver.js +0 -14
  515. package/delivery/AssetDelivery/NullRequestResolver.js.map +0 -1
  516. package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +0 -8
  517. package/delivery/AssetDelivery/SetCacheControlHeaders.js +0 -25
  518. package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +0 -1
  519. package/delivery/AssetDelivery/SetResponseHeaders.d.ts +0 -18
  520. package/delivery/AssetDelivery/SetResponseHeaders.js +0 -25
  521. package/delivery/AssetDelivery/SetResponseHeaders.js.map +0 -1
  522. package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +0 -6
  523. package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +0 -7
  524. package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +0 -1
  525. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +0 -4
  526. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +0 -7
  527. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +0 -1
  528. package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +0 -4
  529. package/delivery/AssetDelivery/abstractions/AssetProcessor.js +0 -7
  530. package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +0 -1
  531. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +0 -5
  532. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +0 -7
  533. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +0 -1
  534. package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +0 -4
  535. package/delivery/AssetDelivery/abstractions/AssetResolver.js +0 -7
  536. package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +0 -1
  537. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +0 -4
  538. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +0 -7
  539. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +0 -1
  540. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +0 -4
  541. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +0 -7
  542. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +0 -1
  543. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +0 -4
  544. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +0 -26
  545. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +0 -1
  546. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +0 -4
  547. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +0 -15
  548. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +0 -1
  549. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +0 -7
  550. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +0 -28
  551. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +0 -1
  552. package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +0 -6
  553. package/delivery/AssetDelivery/privateFiles/PrivateCache.js +0 -28
  554. package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +0 -1
  555. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +0 -8
  556. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +0 -37
  557. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +0 -1
  558. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +0 -13
  559. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +0 -63
  560. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +0 -1
  561. package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +0 -6
  562. package/delivery/AssetDelivery/privateFiles/PublicCache.js +0 -28
  563. package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +0 -1
  564. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +0 -7
  565. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +0 -27
  566. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +0 -1
  567. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +0 -7
  568. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +0 -27
  569. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +0 -1
  570. package/delivery/AssetDelivery/privateFiles/internalIdentity.d.ts +0 -7
  571. package/delivery/AssetDelivery/privateFiles/internalIdentity.js +0 -18
  572. package/delivery/AssetDelivery/privateFiles/internalIdentity.js.map +0 -1
  573. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +0 -4
  574. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +0 -14
  575. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +0 -1
  576. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +0 -4
  577. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +0 -14
  578. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +0 -1
  579. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +0 -6
  580. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +0 -26
  581. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +0 -1
  582. package/delivery/index.js.map +0 -1
  583. package/enterprise/applyThreatScanning.d.ts +0 -2
  584. package/enterprise/applyThreatScanning.js +0 -20
  585. package/enterprise/applyThreatScanning.js.map +0 -1
  586. package/graphql/baseSchema.d.ts +0 -3
  587. package/graphql/baseSchema.js +0 -121
  588. package/graphql/baseSchema.js.map +0 -1
  589. package/graphql/createFilesTypeDefs.d.ts +0 -7
  590. package/graphql/createFilesTypeDefs.js +0 -184
  591. package/graphql/createFilesTypeDefs.js.map +0 -1
  592. package/graphql/filesSchema.d.ts +0 -4
  593. package/graphql/filesSchema.js +0 -89
  594. package/graphql/filesSchema.js.map +0 -1
  595. package/graphql/getFileByUrl.d.ts +0 -3
  596. package/graphql/getFileByUrl.js +0 -78
  597. package/graphql/getFileByUrl.js.map +0 -1
  598. package/graphql/index.d.ts +0 -4
  599. package/graphql/index.js +0 -55
  600. package/graphql/index.js.map +0 -1
  601. package/graphql/utils.d.ts +0 -11
  602. package/graphql/utils.js +0 -24
  603. package/graphql/utils.js.map +0 -1
  604. package/handlers/manage/imageManager.d.ts +0 -14
  605. package/handlers/manage/imageManager.js +0 -75
  606. package/handlers/manage/imageManager.js.map +0 -1
  607. package/handlers/manage/index.d.ts +0 -5
  608. package/handlers/manage/index.js +0 -59
  609. package/handlers/manage/index.js.map +0 -1
  610. package/handlers/manage/legacyUtils.d.ts +0 -12
  611. package/handlers/manage/legacyUtils.js +0 -34
  612. package/handlers/manage/legacyUtils.js.map +0 -1
  613. package/handlers/manage/utils.d.ts +0 -12
  614. package/handlers/manage/utils.js +0 -34
  615. package/handlers/manage/utils.js.map +0 -1
  616. package/handlers/types.d.ts +0 -8
  617. package/handlers/types.js +0 -7
  618. package/handlers/types.js.map +0 -1
  619. package/handlers/utils/getEnvironment.d.ts +0 -5
  620. package/handlers/utils/getEnvironment.js +0 -13
  621. package/handlers/utils/getEnvironment.js.map +0 -1
  622. package/handlers/utils/getObjectParams.d.ts +0 -9
  623. package/handlers/utils/getObjectParams.js +0 -23
  624. package/handlers/utils/getObjectParams.js.map +0 -1
  625. package/handlers/utils/index.d.ts +0 -2
  626. package/handlers/utils/index.js +0 -22
  627. package/handlers/utils/index.js.map +0 -1
  628. package/modelModifier/CmsModelModifier.d.ts +0 -26
  629. package/modelModifier/CmsModelModifier.js +0 -62
  630. package/modelModifier/CmsModelModifier.js.map +0 -1
  631. package/plugins/FilePhysicalStoragePlugin.d.ts +0 -22
  632. package/plugins/FilePhysicalStoragePlugin.js +0 -31
  633. package/plugins/FilePhysicalStoragePlugin.js.map +0 -1
  634. package/plugins/FileStorageTransformPlugin.d.ts +0 -34
  635. package/plugins/FileStorageTransformPlugin.js +0 -39
  636. package/plugins/FileStorageTransformPlugin.js.map +0 -1
  637. package/plugins/index.d.ts +0 -2
  638. package/plugins/index.js +0 -29
  639. package/plugins/index.js.map +0 -1
  640. package/storage/FileStorage.d.ts +0 -34
  641. package/storage/FileStorage.js +0 -90
  642. package/storage/FileStorage.js.map +0 -1
  643. package/types/file.d.ts +0 -49
  644. package/types/file.js +0 -7
  645. package/types/file.js.map +0 -1
  646. package/types/file.lifecycle.d.ts +0 -44
  647. package/types/file.lifecycle.js +0 -7
  648. package/types/file.lifecycle.js.map +0 -1
  649. package/types.js.map +0 -1
@@ -0,0 +1,6 @@
1
+ import type { ImageRequestOptions } from "./imageTypes.js";
2
+ /**
3
+ * Parse raw query params into typed image request options.
4
+ * Returns a new `ImageRequestOptions` object; does not mutate the input.
5
+ */
6
+ export declare const normalizeImageOptions: (query: Record<string, any>, acceptHeader: string | undefined) => ImageRequestOptions;
@@ -0,0 +1,56 @@
1
+ import { clampQuality, resolveRequestedFormat } from "./imageFormat.js";
2
+ const normalizeImageOptions = (query, acceptHeader)=>{
3
+ const result = {
4
+ original: "original" in query
5
+ };
6
+ const width = query.width ? parseInt(query.width, 10) : 0 / 0;
7
+ if (!Number.isNaN(width) && width > 0) result.width = width;
8
+ const quality = void 0 !== query.quality ? clampQuality(parseInt(query.quality, 10)) : void 0;
9
+ if (void 0 !== quality) result.quality = quality;
10
+ const format = resolveRequestedFormat(query.format, acceptHeader);
11
+ if (format) result.format = format;
12
+ const crop = parseCrop(query.crop);
13
+ if (crop) result.crop = crop;
14
+ const aspectRatio = parseAspectRatio(query.aspectRatio);
15
+ if (aspectRatio) result.aspectRatio = aspectRatio;
16
+ const focal = parseFocal(query.focal);
17
+ if (focal) result.focal = focal;
18
+ return result;
19
+ };
20
+ const parseAspectRatio = (raw)=>{
21
+ if ("string" != typeof raw) return;
22
+ if (raw.includes(":")) {
23
+ const [w, h] = raw.split(":").map((v)=>parseFloat(v));
24
+ return w > 0 && h > 0 ? w / h : void 0;
25
+ }
26
+ const value = parseFloat(raw);
27
+ return !Number.isNaN(value) && value > 0 ? value : void 0;
28
+ };
29
+ const parseFocal = (raw)=>{
30
+ if ("string" != typeof raw) return;
31
+ const parts = raw.split(",").map((v)=>parseFloat(v));
32
+ if (2 !== parts.length || parts.some((n)=>Number.isNaN(n))) return;
33
+ const clamp01 = (n)=>Math.min(1, Math.max(0, n));
34
+ return {
35
+ x: clamp01(parts[0]),
36
+ y: clamp01(parts[1])
37
+ };
38
+ };
39
+ const parseCrop = (raw)=>{
40
+ if ("string" != typeof raw) return;
41
+ const parts = raw.split(",").map((v)=>parseFloat(v));
42
+ if (4 !== parts.length || parts.some((n)=>Number.isNaN(n))) return;
43
+ const clamp01 = (n)=>Math.min(1, Math.max(0, n));
44
+ const [top, left, bottom, right] = parts.map(clamp01);
45
+ if (0 === top && 0 === left && 0 === bottom && 0 === right) return;
46
+ if (top + bottom >= 1 || left + right >= 1) return;
47
+ return {
48
+ top,
49
+ left,
50
+ bottom,
51
+ right
52
+ };
53
+ };
54
+ export { normalizeImageOptions };
55
+
56
+ //# sourceMappingURL=normalizeImageOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/assetTypes/image/normalizeImageOptions.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/normalizeImageOptions.ts"],"sourcesContent":["import type { ImageRequestOptions } from \"./imageTypes.js\";\nimport { clampQuality, resolveRequestedFormat } from \"./imageFormat.js\";\n\n/**\n * Parse raw query params into typed image request options.\n * Returns a new `ImageRequestOptions` object; does not mutate the input.\n */\nexport const normalizeImageOptions = (\n query: Record<string, any>,\n acceptHeader: string | undefined\n): ImageRequestOptions => {\n const result: ImageRequestOptions = {\n original: \"original\" in query\n };\n\n const width = query.width ? parseInt(query.width, 10) : NaN;\n if (!Number.isNaN(width) && width > 0) {\n result.width = width;\n }\n\n const quality =\n query.quality !== undefined ? clampQuality(parseInt(query.quality, 10)) : undefined;\n if (quality !== undefined) {\n result.quality = quality;\n }\n\n const format = resolveRequestedFormat(query.format, acceptHeader);\n if (format) {\n result.format = format;\n }\n\n const crop = parseCrop(query.crop);\n if (crop) {\n result.crop = crop;\n }\n\n const aspectRatio = parseAspectRatio(query.aspectRatio);\n if (aspectRatio) {\n result.aspectRatio = aspectRatio;\n }\n\n const focal = parseFocal(query.focal);\n if (focal) {\n result.focal = focal;\n }\n\n return result;\n};\n\nconst parseAspectRatio = (raw: unknown): number | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n if (raw.includes(\":\")) {\n const [w, h] = raw.split(\":\").map(v => parseFloat(v));\n return w > 0 && h > 0 ? w / h : undefined;\n }\n const value = parseFloat(raw);\n return !Number.isNaN(value) && value > 0 ? value : undefined;\n};\n\nconst parseFocal = (raw: unknown): { x: number; y: number } | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n const parts = raw.split(\",\").map(v => parseFloat(v));\n if (parts.length !== 2 || parts.some(n => Number.isNaN(n))) {\n return undefined;\n }\n const clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n return { x: clamp01(parts[0]), y: clamp01(parts[1]) };\n};\n\nconst parseCrop = (\n raw: unknown\n): { top: number; left: number; bottom: number; right: number } | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n const parts = raw.split(\",\").map(v => parseFloat(v));\n if (parts.length !== 4 || parts.some(n => Number.isNaN(n))) {\n return undefined;\n }\n const clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n const [top, left, bottom, right] = parts.map(clamp01);\n if (top === 0 && left === 0 && bottom === 0 && right === 0) {\n return undefined;\n }\n if (top + bottom >= 1 || left + right >= 1) {\n return undefined;\n }\n return { top, left, bottom, right };\n};\n"],"names":["normalizeImageOptions","query","acceptHeader","result","width","parseInt","NaN","Number","quality","undefined","clampQuality","format","resolveRequestedFormat","crop","parseCrop","aspectRatio","parseAspectRatio","focal","parseFocal","raw","w","h","v","parseFloat","value","parts","n","clamp01","Math","top","left","bottom","right"],"mappings":";AAOO,MAAMA,wBAAwB,CACjCC,OACAC;IAEA,MAAMC,SAA8B;QAChC,UAAU,cAAcF;IAC5B;IAEA,MAAMG,QAAQH,MAAM,KAAK,GAAGI,SAASJ,MAAM,KAAK,EAAE,MAAMK,KAAG;IAC3D,IAAI,CAACC,OAAO,KAAK,CAACH,UAAUA,QAAQ,GAChCD,OAAO,KAAK,GAAGC;IAGnB,MAAMI,UACFP,AAAkBQ,WAAlBR,MAAM,OAAO,GAAiBS,aAAaL,SAASJ,MAAM,OAAO,EAAE,OAAOQ;IAC9E,IAAID,AAAYC,WAAZD,SACAL,OAAO,OAAO,GAAGK;IAGrB,MAAMG,SAASC,uBAAuBX,MAAM,MAAM,EAAEC;IACpD,IAAIS,QACAR,OAAO,MAAM,GAAGQ;IAGpB,MAAME,OAAOC,UAAUb,MAAM,IAAI;IACjC,IAAIY,MACAV,OAAO,IAAI,GAAGU;IAGlB,MAAME,cAAcC,iBAAiBf,MAAM,WAAW;IACtD,IAAIc,aACAZ,OAAO,WAAW,GAAGY;IAGzB,MAAME,QAAQC,WAAWjB,MAAM,KAAK;IACpC,IAAIgB,OACAd,OAAO,KAAK,GAAGc;IAGnB,OAAOd;AACX;AAEA,MAAMa,mBAAmB,CAACG;IACtB,IAAI,AAAe,YAAf,OAAOA,KACP;IAEJ,IAAIA,IAAI,QAAQ,CAAC,MAAM;QACnB,MAAM,CAACC,GAAGC,EAAE,GAAGF,IAAI,KAAK,CAAC,KAAK,GAAG,CAACG,CAAAA,IAAKC,WAAWD;QAClD,OAAOF,IAAI,KAAKC,IAAI,IAAID,IAAIC,IAAIZ;IACpC;IACA,MAAMe,QAAQD,WAAWJ;IACzB,OAAO,CAACZ,OAAO,KAAK,CAACiB,UAAUA,QAAQ,IAAIA,QAAQf;AACvD;AAEA,MAAMS,aAAa,CAACC;IAChB,IAAI,AAAe,YAAf,OAAOA,KACP;IAEJ,MAAMM,QAAQN,IAAI,KAAK,CAAC,KAAK,GAAG,CAACG,CAAAA,IAAKC,WAAWD;IACjD,IAAIG,AAAiB,MAAjBA,MAAM,MAAM,IAAUA,MAAM,IAAI,CAACC,CAAAA,IAAKnB,OAAO,KAAK,CAACmB,KACnD;IAEJ,MAAMC,UAAU,CAACD,IAAcE,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGF;IACvD,OAAO;QAAE,GAAGC,QAAQF,KAAK,CAAC,EAAE;QAAG,GAAGE,QAAQF,KAAK,CAAC,EAAE;IAAE;AACxD;AAEA,MAAMX,YAAY,CACdK;IAEA,IAAI,AAAe,YAAf,OAAOA,KACP;IAEJ,MAAMM,QAAQN,IAAI,KAAK,CAAC,KAAK,GAAG,CAACG,CAAAA,IAAKC,WAAWD;IACjD,IAAIG,AAAiB,MAAjBA,MAAM,MAAM,IAAUA,MAAM,IAAI,CAACC,CAAAA,IAAKnB,OAAO,KAAK,CAACmB,KACnD;IAEJ,MAAMC,UAAU,CAACD,IAAcE,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGF;IACvD,MAAM,CAACG,KAAKC,MAAMC,QAAQC,MAAM,GAAGP,MAAM,GAAG,CAACE;IAC7C,IAAIE,AAAQ,MAARA,OAAaC,AAAS,MAATA,QAAcC,AAAW,MAAXA,UAAgBC,AAAU,MAAVA,OAC3C;IAEJ,IAAIH,MAAME,UAAU,KAAKD,OAAOE,SAAS,GACrC;IAEJ,OAAO;QAAEH;QAAKC;QAAMC;QAAQC;IAAM;AACtC"}
@@ -0,0 +1,59 @@
1
+ import { type ImageFormat } from "./imageFormat.js";
2
+ export interface TransformImageParams {
3
+ buffer: Buffer;
4
+ animated: boolean;
5
+ sourceContentType: string;
6
+ widths: number[];
7
+ options: {
8
+ width?: number;
9
+ format?: ImageFormat;
10
+ quality?: number;
11
+ };
12
+ qualityDefaults?: Record<ImageFormat, number>;
13
+ }
14
+ export interface TransformImageResult {
15
+ buffer: Buffer;
16
+ contentType: string;
17
+ }
18
+ /**
19
+ * Single sharp pipeline shared by the S3 and local transform strategies: optional
20
+ * resize (snapped to the configured width ladder) → optional format conversion +
21
+ * quality. Returns the resulting buffer and its content type.
22
+ */
23
+ interface CropInsets {
24
+ top: number;
25
+ left: number;
26
+ bottom: number;
27
+ right: number;
28
+ }
29
+ /**
30
+ * Extract the crop region (edge insets, 0..1) from an image buffer. Returns the
31
+ * original buffer unchanged if the crop is empty/full or the dimensions are unknown.
32
+ */
33
+ export declare const cropImageBuffer: (buffer: Buffer, crop: CropInsets) => Promise<Buffer>;
34
+ interface NormalizedRect {
35
+ x: number;
36
+ y: number;
37
+ width: number;
38
+ height: number;
39
+ }
40
+ /**
41
+ * The visible region (normalized 0–1) for the given framing. The largest rectangle
42
+ * of `aspectRatio` that fits inside the crop, centered on the focal point.
43
+ */
44
+ export declare const getVisibleRect: (imageWidth: number, imageHeight: number, crop?: CropInsets, focal?: {
45
+ x: number;
46
+ y: number;
47
+ }, aspectRatio?: number) => NormalizedRect;
48
+ export interface Framing {
49
+ crop?: CropInsets;
50
+ focal?: {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ aspectRatio?: number;
55
+ }
56
+ export declare const hasFraming: (framing: Framing) => boolean;
57
+ export declare const extractFramedRegion: (buffer: Buffer, framing: Framing) => Promise<Buffer>;
58
+ export declare const transformImageBuffer: (params: TransformImageParams) => Promise<TransformImageResult>;
59
+ export {};
@@ -0,0 +1,146 @@
1
+ import sharp from "sharp";
2
+ import { WidthCollection } from "./WidthCollection.js";
3
+ import { DEFAULT_IMAGE_QUALITY, contentTypeForFormat, formatFromContentType } from "./imageFormat.js";
4
+ const applyOutputFormat = (pipeline, sourceContentType, options, qualityDefaults)=>{
5
+ const targetFormat = options.format ?? formatFromContentType(sourceContentType);
6
+ if (!targetFormat || !options.format && void 0 === options.quality) return {
7
+ pipeline,
8
+ contentType: sourceContentType
9
+ };
10
+ const quality = options.quality ?? qualityDefaults[targetFormat];
11
+ switch(targetFormat){
12
+ case "jpeg":
13
+ return {
14
+ pipeline: pipeline.jpeg({
15
+ quality
16
+ }),
17
+ contentType: contentTypeForFormat("jpeg")
18
+ };
19
+ case "webp":
20
+ return {
21
+ pipeline: pipeline.webp({
22
+ quality
23
+ }),
24
+ contentType: contentTypeForFormat("webp")
25
+ };
26
+ case "avif":
27
+ return {
28
+ pipeline: pipeline.avif({
29
+ quality
30
+ }),
31
+ contentType: contentTypeForFormat("avif")
32
+ };
33
+ case "png":
34
+ return {
35
+ pipeline: pipeline.png({
36
+ quality,
37
+ compressionLevel: 9,
38
+ adaptiveFiltering: true
39
+ }),
40
+ contentType: contentTypeForFormat("png")
41
+ };
42
+ }
43
+ };
44
+ const clamp01 = (n)=>Math.min(1, Math.max(0, n));
45
+ const cropImageBuffer = async (buffer, crop)=>{
46
+ const image = sharp(buffer);
47
+ const meta = await image.metadata();
48
+ const w = meta.width ?? 0;
49
+ const h = meta.height ?? 0;
50
+ if (!w || !h) return buffer;
51
+ const left = Math.max(0, Math.min(w - 1, Math.round(clamp01(crop.left) * w)));
52
+ const top = Math.max(0, Math.min(h - 1, Math.round(clamp01(crop.top) * h)));
53
+ const width = Math.max(1, Math.min(w - left, Math.round((1 - clamp01(crop.left) - clamp01(crop.right)) * w)));
54
+ const height = Math.max(1, Math.min(h - top, Math.round((1 - clamp01(crop.top) - clamp01(crop.bottom)) * h)));
55
+ if (0 === left && 0 === top && width === w && height === h) return buffer;
56
+ return image.extract({
57
+ left,
58
+ top,
59
+ width,
60
+ height
61
+ }).toBuffer();
62
+ };
63
+ const cropToRect = (crop)=>{
64
+ const left = clamp01(crop?.left ?? 0);
65
+ const top = clamp01(crop?.top ?? 0);
66
+ return {
67
+ x: left,
68
+ y: top,
69
+ width: Math.max(0, 1 - left - clamp01(crop?.right ?? 0)),
70
+ height: Math.max(0, 1 - top - clamp01(crop?.bottom ?? 0))
71
+ };
72
+ };
73
+ const getVisibleRect = (imageWidth, imageHeight, crop, focal, aspectRatio)=>{
74
+ const cr = cropToRect(crop);
75
+ if (void 0 === aspectRatio || aspectRatio <= 0 || cr.width <= 0 || cr.height <= 0) return cr;
76
+ const iw = imageWidth > 0 ? imageWidth : 1;
77
+ const ih = imageHeight > 0 ? imageHeight : 1;
78
+ const cropAR = cr.width * iw / (cr.height * ih);
79
+ let w;
80
+ let h;
81
+ if (aspectRatio > cropAR) {
82
+ w = cr.width;
83
+ h = cr.width * iw / aspectRatio / ih;
84
+ } else {
85
+ h = cr.height;
86
+ w = cr.height * ih * aspectRatio / iw;
87
+ }
88
+ const fx = clamp01(focal?.x ?? 0.5);
89
+ const fy = clamp01(focal?.y ?? 0.5);
90
+ const maxX = cr.x + cr.width - w;
91
+ const maxY = cr.y + cr.height - h;
92
+ const x = Math.min(Math.max(fx - w / 2, cr.x), Math.max(cr.x, maxX));
93
+ const y = Math.min(Math.max(fy - h / 2, cr.y), Math.max(cr.y, maxY));
94
+ return {
95
+ x,
96
+ y,
97
+ width: w,
98
+ height: h
99
+ };
100
+ };
101
+ const hasFraming = (framing)=>{
102
+ const c = framing.crop;
103
+ const cropped = !!c && !(0 === c.top && 0 === c.left && 0 === c.bottom && 0 === c.right);
104
+ return cropped || void 0 !== framing.aspectRatio;
105
+ };
106
+ const extractFramedRegion = async (buffer, framing)=>{
107
+ if (!hasFraming(framing)) return buffer;
108
+ const image = sharp(buffer);
109
+ const meta = await image.metadata();
110
+ const w = meta.width ?? 0;
111
+ const h = meta.height ?? 0;
112
+ if (!w || !h) return buffer;
113
+ const rect = getVisibleRect(w, h, framing.crop, framing.focal, framing.aspectRatio);
114
+ const left = Math.max(0, Math.min(w - 1, Math.round(rect.x * w)));
115
+ const top = Math.max(0, Math.min(h - 1, Math.round(rect.y * h)));
116
+ const width = Math.max(1, Math.min(w - left, Math.round(rect.width * w)));
117
+ const height = Math.max(1, Math.min(h - top, Math.round(rect.height * h)));
118
+ if (0 === left && 0 === top && width === w && height === h) return buffer;
119
+ return image.extract({
120
+ left,
121
+ top,
122
+ width,
123
+ height
124
+ }).toBuffer();
125
+ };
126
+ const transformImageBuffer = async (params)=>{
127
+ let pipeline = sharp(params.buffer, {
128
+ animated: params.animated
129
+ }).withMetadata();
130
+ if (params.options.width) {
131
+ const width = WidthCollection.create(params.widths).getClosestOrMax(params.options.width);
132
+ pipeline = pipeline.resize({
133
+ width,
134
+ withoutEnlargement: true
135
+ });
136
+ }
137
+ const { pipeline: encoded, contentType } = applyOutputFormat(pipeline, params.sourceContentType, params.options, params.qualityDefaults ?? DEFAULT_IMAGE_QUALITY);
138
+ const buffer = await encoded.toBuffer();
139
+ return {
140
+ buffer,
141
+ contentType
142
+ };
143
+ };
144
+ export { cropImageBuffer, extractFramedRegion, getVisibleRect, hasFraming, transformImageBuffer };
145
+
146
+ //# sourceMappingURL=transformImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/assetTypes/image/transformImage.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/transformImage.ts"],"sourcesContent":["/**\n * The sharp-backed image pipeline. This module imports `sharp` (a native module),\n * so it must ONLY be imported by the transform strategies (the image Lambda) —\n * never from the barrel (`index.ts`) or from anything the GraphQL API handler\n * loads. See `imageFormat.ts` for the reasoning.\n */\nimport sharp from \"sharp\";\nimport type { Sharp } from \"sharp\";\nimport { WidthCollection } from \"./WidthCollection.js\";\nimport {\n contentTypeForFormat,\n DEFAULT_IMAGE_QUALITY,\n formatFromContentType,\n type ImageFormat\n} from \"./imageFormat.js\";\n\ninterface ApplyOutputFormatResult {\n pipeline: Sharp;\n contentType: string;\n}\n\n/**\n * Apply the target format + quality to a sharp pipeline. When no `format` is given,\n * re-encodes in the source format only if a `quality` was requested; otherwise the\n * pipeline is left untouched.\n */\nconst applyOutputFormat = (\n pipeline: Sharp,\n sourceContentType: string,\n options: { format?: ImageFormat; quality?: number },\n qualityDefaults: Record<ImageFormat, number>\n): ApplyOutputFormatResult => {\n const targetFormat = options.format ?? formatFromContentType(sourceContentType);\n\n // Nothing to change: unknown source format, or neither a conversion nor a quality.\n if (!targetFormat || (!options.format && options.quality === undefined)) {\n return { pipeline, contentType: sourceContentType };\n }\n\n const quality = options.quality ?? qualityDefaults[targetFormat];\n\n switch (targetFormat) {\n case \"jpeg\":\n return {\n pipeline: pipeline.jpeg({ quality }),\n contentType: contentTypeForFormat(\"jpeg\")\n };\n case \"webp\":\n return {\n pipeline: pipeline.webp({ quality }),\n contentType: contentTypeForFormat(\"webp\")\n };\n case \"avif\":\n return {\n pipeline: pipeline.avif({ quality }),\n contentType: contentTypeForFormat(\"avif\")\n };\n case \"png\":\n return {\n pipeline: pipeline.png({ quality, compressionLevel: 9, adaptiveFiltering: true }),\n contentType: contentTypeForFormat(\"png\")\n };\n }\n};\n\nexport interface TransformImageParams {\n buffer: Buffer;\n animated: boolean;\n sourceContentType: string;\n widths: number[];\n options: { width?: number; format?: ImageFormat; quality?: number };\n qualityDefaults?: Record<ImageFormat, number>;\n}\n\nexport interface TransformImageResult {\n buffer: Buffer;\n contentType: string;\n}\n\n/**\n * Single sharp pipeline shared by the S3 and local transform strategies: optional\n * resize (snapped to the configured width ladder) → optional format conversion +\n * quality. Returns the resulting buffer and its content type.\n */\ninterface CropInsets {\n top: number;\n left: number;\n bottom: number;\n right: number;\n}\n\nconst clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n\n/**\n * Extract the crop region (edge insets, 0..1) from an image buffer. Returns the\n * original buffer unchanged if the crop is empty/full or the dimensions are unknown.\n */\nexport const cropImageBuffer = async (buffer: Buffer, crop: CropInsets): Promise<Buffer> => {\n const image = sharp(buffer);\n const meta = await image.metadata();\n const w = meta.width ?? 0;\n const h = meta.height ?? 0;\n if (!w || !h) {\n return buffer;\n }\n\n const left = Math.max(0, Math.min(w - 1, Math.round(clamp01(crop.left) * w)));\n const top = Math.max(0, Math.min(h - 1, Math.round(clamp01(crop.top) * h)));\n const width = Math.max(\n 1,\n Math.min(w - left, Math.round((1 - clamp01(crop.left) - clamp01(crop.right)) * w))\n );\n const height = Math.max(\n 1,\n Math.min(h - top, Math.round((1 - clamp01(crop.top) - clamp01(crop.bottom)) * h))\n );\n\n if (left === 0 && top === 0 && width === w && height === h) {\n return buffer;\n }\n\n return image.extract({ left, top, width, height }).toBuffer();\n};\n\ninterface NormalizedRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nconst cropToRect = (crop?: CropInsets): NormalizedRect => {\n const left = clamp01(crop?.left ?? 0);\n const top = clamp01(crop?.top ?? 0);\n return {\n x: left,\n y: top,\n width: Math.max(0, 1 - left - clamp01(crop?.right ?? 0)),\n height: Math.max(0, 1 - top - clamp01(crop?.bottom ?? 0))\n };\n};\n\n/**\n * The visible region (normalized 0–1) for the given framing. The largest rectangle\n * of `aspectRatio` that fits inside the crop, centered on the focal point.\n */\nexport const getVisibleRect = (\n imageWidth: number,\n imageHeight: number,\n crop?: CropInsets,\n focal?: { x: number; y: number },\n aspectRatio?: number\n): NormalizedRect => {\n const cr = cropToRect(crop);\n if (aspectRatio === undefined || aspectRatio <= 0 || cr.width <= 0 || cr.height <= 0) {\n return cr;\n }\n const iw = imageWidth > 0 ? imageWidth : 1;\n const ih = imageHeight > 0 ? imageHeight : 1;\n const cropAR = (cr.width * iw) / (cr.height * ih);\n\n let w: number;\n let h: number;\n if (aspectRatio > cropAR) {\n w = cr.width;\n h = (cr.width * iw) / aspectRatio / ih;\n } else {\n h = cr.height;\n w = (cr.height * ih * aspectRatio) / iw;\n }\n\n const fx = clamp01(focal?.x ?? 0.5);\n const fy = clamp01(focal?.y ?? 0.5);\n const maxX = cr.x + cr.width - w;\n const maxY = cr.y + cr.height - h;\n const x = Math.min(Math.max(fx - w / 2, cr.x), Math.max(cr.x, maxX));\n const y = Math.min(Math.max(fy - h / 2, cr.y), Math.max(cr.y, maxY));\n return { x, y, width: w, height: h };\n};\n\nexport interface Framing {\n crop?: CropInsets;\n focal?: { x: number; y: number };\n aspectRatio?: number;\n}\n\nexport const hasFraming = (framing: Framing): boolean => {\n const c = framing.crop;\n const cropped = !!c && !(c.top === 0 && c.left === 0 && c.bottom === 0 && c.right === 0);\n return cropped || framing.aspectRatio !== undefined;\n};\n\nexport const extractFramedRegion = async (buffer: Buffer, framing: Framing): Promise<Buffer> => {\n if (!hasFraming(framing)) {\n return buffer;\n }\n const image = sharp(buffer);\n const meta = await image.metadata();\n const w = meta.width ?? 0;\n const h = meta.height ?? 0;\n if (!w || !h) {\n return buffer;\n }\n\n const rect = getVisibleRect(w, h, framing.crop, framing.focal, framing.aspectRatio);\n const left = Math.max(0, Math.min(w - 1, Math.round(rect.x * w)));\n const top = Math.max(0, Math.min(h - 1, Math.round(rect.y * h)));\n const width = Math.max(1, Math.min(w - left, Math.round(rect.width * w)));\n const height = Math.max(1, Math.min(h - top, Math.round(rect.height * h)));\n\n if (left === 0 && top === 0 && width === w && height === h) {\n return buffer;\n }\n return image.extract({ left, top, width, height }).toBuffer();\n};\n\nexport const transformImageBuffer = async (\n params: TransformImageParams\n): Promise<TransformImageResult> => {\n let pipeline = sharp(params.buffer, { animated: params.animated }).withMetadata();\n\n if (params.options.width) {\n const width = WidthCollection.create(params.widths).getClosestOrMax(params.options.width);\n pipeline = pipeline.resize({ width, withoutEnlargement: true });\n }\n\n const { pipeline: encoded, contentType } = applyOutputFormat(\n pipeline,\n params.sourceContentType,\n params.options,\n params.qualityDefaults ?? DEFAULT_IMAGE_QUALITY\n );\n\n const buffer = await encoded.toBuffer();\n\n return { buffer, contentType };\n};\n"],"names":["applyOutputFormat","pipeline","sourceContentType","options","qualityDefaults","targetFormat","formatFromContentType","undefined","quality","contentTypeForFormat","clamp01","n","Math","cropImageBuffer","buffer","crop","image","sharp","meta","w","h","left","top","width","height","cropToRect","getVisibleRect","imageWidth","imageHeight","focal","aspectRatio","cr","iw","ih","cropAR","fx","fy","maxX","maxY","x","y","hasFraming","framing","c","cropped","extractFramedRegion","rect","transformImageBuffer","params","WidthCollection","encoded","contentType","DEFAULT_IMAGE_QUALITY"],"mappings":";;;AA0BA,MAAMA,oBAAoB,CACtBC,UACAC,mBACAC,SACAC;IAEA,MAAMC,eAAeF,QAAQ,MAAM,IAAIG,sBAAsBJ;IAG7D,IAAI,CAACG,gBAAiB,CAACF,QAAQ,MAAM,IAAIA,AAAoBI,WAApBJ,QAAQ,OAAO,EACpD,OAAO;QAAEF;QAAU,aAAaC;IAAkB;IAGtD,MAAMM,UAAUL,QAAQ,OAAO,IAAIC,eAAe,CAACC,aAAa;IAEhE,OAAQA;QACJ,KAAK;YACD,OAAO;gBACH,UAAUJ,SAAS,IAAI,CAAC;oBAAEO;gBAAQ;gBAClC,aAAaC,qBAAqB;YACtC;QACJ,KAAK;YACD,OAAO;gBACH,UAAUR,SAAS,IAAI,CAAC;oBAAEO;gBAAQ;gBAClC,aAAaC,qBAAqB;YACtC;QACJ,KAAK;YACD,OAAO;gBACH,UAAUR,SAAS,IAAI,CAAC;oBAAEO;gBAAQ;gBAClC,aAAaC,qBAAqB;YACtC;QACJ,KAAK;YACD,OAAO;gBACH,UAAUR,SAAS,GAAG,CAAC;oBAAEO;oBAAS,kBAAkB;oBAAG,mBAAmB;gBAAK;gBAC/E,aAAaC,qBAAqB;YACtC;IACR;AACJ;AA4BA,MAAMC,UAAU,CAACC,IAAcC,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGD;AAMhD,MAAME,kBAAkB,OAAOC,QAAgBC;IAClD,MAAMC,QAAQC,MAAMH;IACpB,MAAMI,OAAO,MAAMF,MAAM,QAAQ;IACjC,MAAMG,IAAID,KAAK,KAAK,IAAI;IACxB,MAAME,IAAIF,KAAK,MAAM,IAAI;IACzB,IAAI,CAACC,KAAK,CAACC,GACP,OAAON;IAGX,MAAMO,OAAOT,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAACO,IAAI,GAAGP,KAAK,KAAK,CAACF,QAAQK,KAAK,IAAI,IAAII;IACzE,MAAMG,MAAMV,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAACQ,IAAI,GAAGR,KAAK,KAAK,CAACF,QAAQK,KAAK,GAAG,IAAIK;IACvE,MAAMG,QAAQX,KAAK,GAAG,CAClB,GACAA,KAAK,GAAG,CAACO,IAAIE,MAAMT,KAAK,KAAK,CAAE,KAAIF,QAAQK,KAAK,IAAI,IAAIL,QAAQK,KAAK,KAAK,KAAKI;IAEnF,MAAMK,SAASZ,KAAK,GAAG,CACnB,GACAA,KAAK,GAAG,CAACQ,IAAIE,KAAKV,KAAK,KAAK,CAAE,KAAIF,QAAQK,KAAK,GAAG,IAAIL,QAAQK,KAAK,MAAM,KAAKK;IAGlF,IAAIC,AAAS,MAATA,QAAcC,AAAQ,MAARA,OAAaC,UAAUJ,KAAKK,WAAWJ,GACrD,OAAON;IAGX,OAAOE,MAAM,OAAO,CAAC;QAAEK;QAAMC;QAAKC;QAAOC;IAAO,GAAG,QAAQ;AAC/D;AASA,MAAMC,aAAa,CAACV;IAChB,MAAMM,OAAOX,QAAQK,MAAM,QAAQ;IACnC,MAAMO,MAAMZ,QAAQK,MAAM,OAAO;IACjC,OAAO;QACH,GAAGM;QACH,GAAGC;QACH,OAAOV,KAAK,GAAG,CAAC,GAAG,IAAIS,OAAOX,QAAQK,MAAM,SAAS;QACrD,QAAQH,KAAK,GAAG,CAAC,GAAG,IAAIU,MAAMZ,QAAQK,MAAM,UAAU;IAC1D;AACJ;AAMO,MAAMW,iBAAiB,CAC1BC,YACAC,aACAb,MACAc,OACAC;IAEA,MAAMC,KAAKN,WAAWV;IACtB,IAAIe,AAAgBvB,WAAhBuB,eAA6BA,eAAe,KAAKC,GAAG,KAAK,IAAI,KAAKA,GAAG,MAAM,IAAI,GAC/E,OAAOA;IAEX,MAAMC,KAAKL,aAAa,IAAIA,aAAa;IACzC,MAAMM,KAAKL,cAAc,IAAIA,cAAc;IAC3C,MAAMM,SAAUH,GAAG,KAAK,GAAGC,KAAOD,CAAAA,GAAG,MAAM,GAAGE,EAAC;IAE/C,IAAId;IACJ,IAAIC;IACJ,IAAIU,cAAcI,QAAQ;QACtBf,IAAIY,GAAG,KAAK;QACZX,IAAKW,GAAG,KAAK,GAAGC,KAAMF,cAAcG;IACxC,OAAO;QACHb,IAAIW,GAAG,MAAM;QACbZ,IAAKY,GAAG,MAAM,GAAGE,KAAKH,cAAeE;IACzC;IAEA,MAAMG,KAAKzB,QAAQmB,OAAO,KAAK;IAC/B,MAAMO,KAAK1B,QAAQmB,OAAO,KAAK;IAC/B,MAAMQ,OAAON,GAAG,CAAC,GAAGA,GAAG,KAAK,GAAGZ;IAC/B,MAAMmB,OAAOP,GAAG,CAAC,GAAGA,GAAG,MAAM,GAAGX;IAChC,MAAMmB,IAAI3B,KAAK,GAAG,CAACA,KAAK,GAAG,CAACuB,KAAKhB,IAAI,GAAGY,GAAG,CAAC,GAAGnB,KAAK,GAAG,CAACmB,GAAG,CAAC,EAAEM;IAC9D,MAAMG,IAAI5B,KAAK,GAAG,CAACA,KAAK,GAAG,CAACwB,KAAKhB,IAAI,GAAGW,GAAG,CAAC,GAAGnB,KAAK,GAAG,CAACmB,GAAG,CAAC,EAAEO;IAC9D,OAAO;QAAEC;QAAGC;QAAG,OAAOrB;QAAG,QAAQC;IAAE;AACvC;AAQO,MAAMqB,aAAa,CAACC;IACvB,MAAMC,IAAID,QAAQ,IAAI;IACtB,MAAME,UAAU,CAAC,CAACD,KAAK,CAAEA,CAAAA,AAAU,MAAVA,EAAE,GAAG,IAAUA,AAAW,MAAXA,EAAE,IAAI,IAAUA,AAAa,MAAbA,EAAE,MAAM,IAAUA,AAAY,MAAZA,EAAE,KAAK,AAAK;IACtF,OAAOC,WAAWF,AAAwBnC,WAAxBmC,QAAQ,WAAW;AACzC;AAEO,MAAMG,sBAAsB,OAAO/B,QAAgB4B;IACtD,IAAI,CAACD,WAAWC,UACZ,OAAO5B;IAEX,MAAME,QAAQC,MAAMH;IACpB,MAAMI,OAAO,MAAMF,MAAM,QAAQ;IACjC,MAAMG,IAAID,KAAK,KAAK,IAAI;IACxB,MAAME,IAAIF,KAAK,MAAM,IAAI;IACzB,IAAI,CAACC,KAAK,CAACC,GACP,OAAON;IAGX,MAAMgC,OAAOpB,eAAeP,GAAGC,GAAGsB,QAAQ,IAAI,EAAEA,QAAQ,KAAK,EAAEA,QAAQ,WAAW;IAClF,MAAMrB,OAAOT,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAACO,IAAI,GAAGP,KAAK,KAAK,CAACkC,KAAK,CAAC,GAAG3B;IAC7D,MAAMG,MAAMV,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAACQ,IAAI,GAAGR,KAAK,KAAK,CAACkC,KAAK,CAAC,GAAG1B;IAC5D,MAAMG,QAAQX,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAACO,IAAIE,MAAMT,KAAK,KAAK,CAACkC,KAAK,KAAK,GAAG3B;IACrE,MAAMK,SAASZ,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAACQ,IAAIE,KAAKV,KAAK,KAAK,CAACkC,KAAK,MAAM,GAAG1B;IAEtE,IAAIC,AAAS,MAATA,QAAcC,AAAQ,MAARA,OAAaC,UAAUJ,KAAKK,WAAWJ,GACrD,OAAON;IAEX,OAAOE,MAAM,OAAO,CAAC;QAAEK;QAAMC;QAAKC;QAAOC;IAAO,GAAG,QAAQ;AAC/D;AAEO,MAAMuB,uBAAuB,OAChCC;IAEA,IAAI/C,WAAWgB,MAAM+B,OAAO,MAAM,EAAE;QAAE,UAAUA,OAAO,QAAQ;IAAC,GAAG,YAAY;IAE/E,IAAIA,OAAO,OAAO,CAAC,KAAK,EAAE;QACtB,MAAMzB,QAAQ0B,gBAAgB,MAAM,CAACD,OAAO,MAAM,EAAE,eAAe,CAACA,OAAO,OAAO,CAAC,KAAK;QACxF/C,WAAWA,SAAS,MAAM,CAAC;YAAEsB;YAAO,oBAAoB;QAAK;IACjE;IAEA,MAAM,EAAE,UAAU2B,OAAO,EAAEC,WAAW,EAAE,GAAGnD,kBACvCC,UACA+C,OAAO,iBAAiB,EACxBA,OAAO,OAAO,EACdA,OAAO,eAAe,IAAII;IAG9B,MAAMtC,SAAS,MAAMoC,QAAQ,QAAQ;IAErC,OAAO;QAAEpC;QAAQqC;IAAY;AACjC"}
@@ -0,0 +1,26 @@
1
+ import type { Framing } from "./imageTypes.js";
2
+ declare const SUPPORTED_TRANSFORMABLE_IMAGES: string[];
3
+ declare const getOptimizedImageKeyPrefix: (key: string, cropSignature?: string) => string;
4
+ declare const getOptimizedTransformedImageKeyPrefix: (key: string, transformationsHash: string, cropSignature?: string) => string;
5
+ interface Crop {
6
+ top: number;
7
+ left: number;
8
+ bottom: number;
9
+ right: number;
10
+ }
11
+ /** Short, stable signature of a crop; `undefined` for no/empty crop (so keys are unchanged). */
12
+ declare const getCropSignature: (crop?: Crop) => string | undefined;
13
+ interface GetImageKeyParams {
14
+ key: string;
15
+ transformations?: any;
16
+ cropSignature?: string;
17
+ }
18
+ declare const getImageKey: ({ key, transformations, cropSignature }: GetImageKeyParams) => string;
19
+ /**
20
+ * Signature for a full framing (crop + focal + aspect ratio) used to namespace
21
+ * cached derivatives. `undefined` when the framing is a no-op. A crop-only framing
22
+ * intentionally hashes to the same value as `getCropSignature`, so existing
23
+ * asset-level-crop derivatives keep their cache keys (backward compatible).
24
+ */
25
+ declare const getFramingSignature: (framing: Framing) => string | undefined;
26
+ export { SUPPORTED_TRANSFORMABLE_IMAGES, getImageKey, getCropSignature, getFramingSignature, getOptimizedImageKeyPrefix, getOptimizedTransformedImageKeyPrefix };
@@ -0,0 +1,47 @@
1
+ import object_hash from "object-hash";
2
+ import node_path from "node:path";
3
+ const SUPPORTED_TRANSFORMABLE_IMAGES = [
4
+ "jpg",
5
+ "jpeg",
6
+ "png",
7
+ "webp"
8
+ ];
9
+ const parseKey = (key)=>{
10
+ const filename = node_path.basename(key);
11
+ const dirname = node_path.dirname(key);
12
+ return {
13
+ filename,
14
+ dirname
15
+ };
16
+ };
17
+ const cropSegment = (cropSignature)=>cropSignature ? `${cropSignature}/` : "";
18
+ const getOptimizedImageKeyPrefix = (key, cropSignature)=>{
19
+ const { filename, dirname } = parseKey(key);
20
+ return `${dirname}/optimized/${cropSegment(cropSignature)}${filename}`;
21
+ };
22
+ const getOptimizedTransformedImageKeyPrefix = (key, transformationsHash, cropSignature)=>{
23
+ const { filename, dirname } = parseKey(key);
24
+ return `${dirname}/optimized/${cropSegment(cropSignature)}${transformationsHash}-${filename}`;
25
+ };
26
+ const getCropSignature = (crop)=>{
27
+ if (!crop || 0 === crop.top && 0 === crop.left && 0 === crop.bottom && 0 === crop.right) return;
28
+ return object_hash(crop).slice(0, 16);
29
+ };
30
+ const getImageKey = ({ key, transformations, cropSignature })=>{
31
+ if (!transformations) return getOptimizedImageKeyPrefix(key, cropSignature);
32
+ return getOptimizedTransformedImageKeyPrefix(key, object_hash(transformations), cropSignature);
33
+ };
34
+ const getFramingSignature = (framing)=>{
35
+ const { crop, focal, aspectRatio } = framing;
36
+ const cropped = !!crop && !(0 === crop.top && 0 === crop.left && 0 === crop.bottom && 0 === crop.right);
37
+ if (!cropped && void 0 === aspectRatio) return;
38
+ if (cropped && void 0 === focal && void 0 === aspectRatio) return object_hash(crop).slice(0, 16);
39
+ return object_hash({
40
+ crop: cropped ? crop : void 0,
41
+ focal,
42
+ aspectRatio
43
+ }).slice(0, 16);
44
+ };
45
+ export { SUPPORTED_TRANSFORMABLE_IMAGES, getCropSignature, getFramingSignature, getImageKey, getOptimizedImageKeyPrefix, getOptimizedTransformedImageKeyPrefix };
46
+
47
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/assetDelivery/assetTypes/image/utils.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/utils.ts"],"sourcesContent":["import objectHash from \"object-hash\";\nimport path from \"node:path\";\nimport type { Framing } from \"./imageTypes.js\";\n\nconst SUPPORTED_TRANSFORMABLE_IMAGES = [\"jpg\", \"jpeg\", \"png\", \"webp\"];\n\nconst parseKey = (key: string) => {\n const filename = path.basename(key);\n const dirname = path.dirname(key);\n\n return { filename, dirname };\n};\n\n// An optional per-file crop signature segment. Keeps un-cropped keys unchanged\n// (backward compatible) while giving cropped files their own cache namespace, so\n// changing a file's crop invalidates its derivatives.\nconst cropSegment = (cropSignature?: string): string => {\n return cropSignature ? `${cropSignature}/` : \"\";\n};\n\nconst getOptimizedImageKeyPrefix = (key: string, cropSignature?: string): string => {\n const { filename, dirname } = parseKey(key);\n\n return `${dirname}/optimized/${cropSegment(cropSignature)}${filename}`;\n};\n\nconst getOptimizedTransformedImageKeyPrefix = (\n key: string,\n transformationsHash: string,\n cropSignature?: string\n): string => {\n const { filename, dirname } = parseKey(key);\n\n return `${dirname}/optimized/${cropSegment(cropSignature)}${transformationsHash}-${filename}`;\n};\n\ninterface Crop {\n top: number;\n left: number;\n bottom: number;\n right: number;\n}\n\n/** Short, stable signature of a crop; `undefined` for no/empty crop (so keys are unchanged). */\nconst getCropSignature = (crop?: Crop): string | undefined => {\n if (!crop || (crop.top === 0 && crop.left === 0 && crop.bottom === 0 && crop.right === 0)) {\n return undefined;\n }\n return objectHash(crop).slice(0, 16);\n};\n\ninterface GetImageKeyParams {\n key: string;\n transformations?: any;\n cropSignature?: string;\n}\n\nconst getImageKey = ({ key, transformations, cropSignature }: GetImageKeyParams): string => {\n if (!transformations) {\n return getOptimizedImageKeyPrefix(key, cropSignature);\n }\n\n return getOptimizedTransformedImageKeyPrefix(key, objectHash(transformations), cropSignature);\n};\n\n/**\n * Signature for a full framing (crop + focal + aspect ratio) used to namespace\n * cached derivatives. `undefined` when the framing is a no-op. A crop-only framing\n * intentionally hashes to the same value as `getCropSignature`, so existing\n * asset-level-crop derivatives keep their cache keys (backward compatible).\n */\nconst getFramingSignature = (framing: Framing): string | undefined => {\n const { crop, focal, aspectRatio } = framing;\n const cropped =\n !!crop && !(crop.top === 0 && crop.left === 0 && crop.bottom === 0 && crop.right === 0);\n\n if (!cropped && aspectRatio === undefined) {\n return undefined;\n }\n if (cropped && focal === undefined && aspectRatio === undefined) {\n return objectHash(crop).slice(0, 16);\n }\n return objectHash({ crop: cropped ? crop : undefined, focal, aspectRatio }).slice(0, 16);\n};\n\nexport {\n SUPPORTED_TRANSFORMABLE_IMAGES,\n getImageKey,\n getCropSignature,\n getFramingSignature,\n getOptimizedImageKeyPrefix,\n getOptimizedTransformedImageKeyPrefix\n};\n"],"names":["SUPPORTED_TRANSFORMABLE_IMAGES","parseKey","key","filename","path","dirname","cropSegment","cropSignature","getOptimizedImageKeyPrefix","getOptimizedTransformedImageKeyPrefix","transformationsHash","getCropSignature","crop","objectHash","getImageKey","transformations","getFramingSignature","framing","focal","aspectRatio","cropped","undefined"],"mappings":";;AAIA,MAAMA,iCAAiC;IAAC;IAAO;IAAQ;IAAO;CAAO;AAErE,MAAMC,WAAW,CAACC;IACd,MAAMC,WAAWC,UAAAA,QAAa,CAACF;IAC/B,MAAMG,UAAUD,UAAAA,OAAY,CAACF;IAE7B,OAAO;QAAEC;QAAUE;IAAQ;AAC/B;AAKA,MAAMC,cAAc,CAACC,gBACVA,gBAAgB,GAAGA,cAAc,CAAC,CAAC,GAAG;AAGjD,MAAMC,6BAA6B,CAACN,KAAaK;IAC7C,MAAM,EAAEJ,QAAQ,EAAEE,OAAO,EAAE,GAAGJ,SAASC;IAEvC,OAAO,GAAGG,QAAQ,WAAW,EAAEC,YAAYC,iBAAiBJ,UAAU;AAC1E;AAEA,MAAMM,wCAAwC,CAC1CP,KACAQ,qBACAH;IAEA,MAAM,EAAEJ,QAAQ,EAAEE,OAAO,EAAE,GAAGJ,SAASC;IAEvC,OAAO,GAAGG,QAAQ,WAAW,EAAEC,YAAYC,iBAAiBG,oBAAoB,CAAC,EAAEP,UAAU;AACjG;AAUA,MAAMQ,mBAAmB,CAACC;IACtB,IAAI,CAACA,QAASA,AAAa,MAAbA,KAAK,GAAG,IAAUA,AAAc,MAAdA,KAAK,IAAI,IAAUA,AAAgB,MAAhBA,KAAK,MAAM,IAAUA,AAAe,MAAfA,KAAK,KAAK,EAC9E;IAEJ,OAAOC,YAAWD,MAAM,KAAK,CAAC,GAAG;AACrC;AAQA,MAAME,cAAc,CAAC,EAAEZ,GAAG,EAAEa,eAAe,EAAER,aAAa,EAAqB;IAC3E,IAAI,CAACQ,iBACD,OAAOP,2BAA2BN,KAAKK;IAG3C,OAAOE,sCAAsCP,KAAKW,YAAWE,kBAAkBR;AACnF;AAQA,MAAMS,sBAAsB,CAACC;IACzB,MAAM,EAAEL,IAAI,EAAEM,KAAK,EAAEC,WAAW,EAAE,GAAGF;IACrC,MAAMG,UACF,CAAC,CAACR,QAAQ,CAAEA,CAAAA,AAAa,MAAbA,KAAK,GAAG,IAAUA,AAAc,MAAdA,KAAK,IAAI,IAAUA,AAAgB,MAAhBA,KAAK,MAAM,IAAUA,AAAe,MAAfA,KAAK,KAAK,AAAK;IAEzF,IAAI,CAACQ,WAAWD,AAAgBE,WAAhBF,aACZ;IAEJ,IAAIC,WAAWF,AAAUG,WAAVH,SAAuBC,AAAgBE,WAAhBF,aAClC,OAAON,YAAWD,MAAM,KAAK,CAAC,GAAG;IAErC,OAAOC,YAAW;QAAE,MAAMO,UAAUR,OAAOS;QAAWH;QAAOC;IAAY,GAAG,KAAK,CAAC,GAAG;AACzF"}
@@ -0,0 +1,4 @@
1
+ export declare const AssetDeliveryFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,35 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
3
+ import { AssetProcessor } from "./abstractions.js";
4
+ import { FilesAssetRequestResolverImpl } from "./FilesAssetRequestResolver.js";
5
+ import { NullAssetResolverImpl } from "./NullAssetResolver.js";
6
+ import { NullAssetOutputStrategyImpl } from "./NullAssetOutputStrategy.js";
7
+ import { AssetFactory } from "./Asset/Asset.js";
8
+ import { ObjectKey } from "./ObjectKey/ObjectKey.js";
9
+ import { StreamAssetReply } from "./StreamAssetReply/StreamAssetReply.js";
10
+ import { TransformationAssetProcessor } from "./transformation/TransformationAssetProcessor.js";
11
+ import { ImageAssetType } from "./assetTypes/image/ImageAssetType.js";
12
+ import { PrivateFileAssetRequestResolverDecorator } from "./privateFiles/PrivateFileAssetRequestResolver.js";
13
+ import { PrivateAuthenticatedAuthorizerImpl } from "./privateFiles/PrivateAuthenticatedAuthorizer.js";
14
+ import { PrivateFilesAssetProcessorDecorator } from "./privateFiles/PrivateFilesAssetProcessor.js";
15
+ const AssetDeliveryFeature = createFeature({
16
+ name: "AssetDelivery",
17
+ register (container) {
18
+ container.register(FilesAssetRequestResolverImpl);
19
+ container.register(NullAssetResolverImpl);
20
+ container.register(NullAssetOutputStrategyImpl);
21
+ container.register(AssetFactory).inSingletonScope();
22
+ container.register(ObjectKey).inSingletonScope();
23
+ container.register(StreamAssetReply).inSingletonScope();
24
+ container.register(ImageAssetType);
25
+ container.registerInstance(AssetProcessor, new TransformationAssetProcessor(container));
26
+ container.registerDecorator(PrivateFileAssetRequestResolverDecorator);
27
+ if (container.resolve(FeatureFlags).get().isEnabled("advancedAccessControlLayer.privateFiles")) {
28
+ container.register(PrivateAuthenticatedAuthorizerImpl);
29
+ container.registerDecorator(PrivateFilesAssetProcessorDecorator);
30
+ }
31
+ }
32
+ });
33
+ export { AssetDeliveryFeature };
34
+
35
+ //# 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 { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { AssetProcessor } from \"./abstractions.js\";\nimport { FilesAssetRequestResolverImpl } from \"./FilesAssetRequestResolver.js\";\nimport { NullAssetResolverImpl } from \"./NullAssetResolver.js\";\nimport { NullAssetOutputStrategyImpl } from \"./NullAssetOutputStrategy.js\";\nimport { AssetFactory } from \"./Asset/Asset.js\";\nimport { ObjectKey } from \"./ObjectKey/ObjectKey.js\";\nimport { StreamAssetReply } from \"./StreamAssetReply/StreamAssetReply.js\";\nimport { TransformationAssetProcessor } from \"./transformation/TransformationAssetProcessor.js\";\nimport { ImageAssetType } from \"./assetTypes/image/ImageAssetType.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(AssetFactory).inSingletonScope();\n container.register(ObjectKey).inSingletonScope();\n container.register(StreamAssetReply).inSingletonScope();\n container.register(ImageAssetType);\n container.registerInstance(AssetProcessor, new TransformationAssetProcessor(container));\n\n container.registerDecorator(PrivateFileAssetRequestResolverDecorator);\n\n // Register-time gate on the effective feature flags (userFlag && live WCP license). Valid at\n // register() time because the license is refreshed PRE-register (WcpLicenseLoader.load in\n // registerApiRequestStack) and FeatureFlags reads that process cache — and it re-evaluates per\n // request since the child re-registers, so a license change takes effect on the next request.\n if (\n container\n .resolve(FeatureFlags)\n .get()\n .isEnabled(\"advancedAccessControlLayer.privateFiles\")\n ) {\n container.register(PrivateAuthenticatedAuthorizerImpl);\n container.registerDecorator(PrivateFilesAssetProcessorDecorator);\n }\n }\n});\n"],"names":["AssetDeliveryFeature","createFeature","container","FilesAssetRequestResolverImpl","NullAssetResolverImpl","NullAssetOutputStrategyImpl","AssetFactory","ObjectKey","StreamAssetReply","ImageAssetType","AssetProcessor","TransformationAssetProcessor","PrivateFileAssetRequestResolverDecorator","FeatureFlags","PrivateAuthenticatedAuthorizerImpl","PrivateFilesAssetProcessorDecorator"],"mappings":";;;;;;;;;;;;;;AAeO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI,cAAc,gBAAgB;QACjDJ,UAAU,QAAQ,CAACK,WAAW,gBAAgB;QAC9CL,UAAU,QAAQ,CAACM,kBAAkB,gBAAgB;QACrDN,UAAU,QAAQ,CAACO;QACnBP,UAAU,gBAAgB,CAACQ,gBAAgB,IAAIC,6BAA6BT;QAE5EA,UAAU,iBAAiB,CAACU;QAM5B,IACIV,UACK,OAAO,CAACW,cACR,GAAG,GACH,SAAS,CAAC,4CACjB;YACEX,UAAU,QAAQ,CAACY;YACnBZ,UAAU,iBAAiB,CAACa;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
+ };