@webiny/api-file-manager 6.3.0 → 6.4.0-beta.0

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 (250) hide show
  1. package/contants.js +2 -1
  2. package/contants.js.map +1 -1
  3. package/delivery/AssetDelivery/Asset.js +50 -56
  4. package/delivery/AssetDelivery/Asset.js.map +1 -1
  5. package/delivery/AssetDelivery/AssetDeliveryConfig.js +70 -83
  6. package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +1 -1
  7. package/delivery/AssetDelivery/AssetRequest.js +20 -19
  8. package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
  9. package/delivery/AssetDelivery/FilesAssetRequestResolver.js +19 -25
  10. package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +1 -1
  11. package/delivery/AssetDelivery/NullAssetOutputStrategy.js +5 -4
  12. package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +1 -1
  13. package/delivery/AssetDelivery/NullAssetReply.js +10 -9
  14. package/delivery/AssetDelivery/NullAssetReply.js.map +1 -1
  15. package/delivery/AssetDelivery/NullAssetResolver.js +5 -4
  16. package/delivery/AssetDelivery/NullAssetResolver.js.map +1 -1
  17. package/delivery/AssetDelivery/NullRequestResolver.js +5 -4
  18. package/delivery/AssetDelivery/NullRequestResolver.js.map +1 -1
  19. package/delivery/AssetDelivery/SetCacheControlHeaders.js +11 -14
  20. package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +1 -1
  21. package/delivery/AssetDelivery/SetResponseHeaders.js +16 -15
  22. package/delivery/AssetDelivery/SetResponseHeaders.js.map +1 -1
  23. package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +0 -3
  24. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +0 -3
  25. package/delivery/AssetDelivery/abstractions/AssetProcessor.js +0 -3
  26. package/delivery/AssetDelivery/abstractions/AssetReply.js +28 -27
  27. package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -1
  28. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +0 -3
  29. package/delivery/AssetDelivery/abstractions/AssetResolver.js +0 -3
  30. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +0 -3
  31. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +4 -5
  32. package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -1
  33. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +0 -3
  34. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +15 -14
  35. package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -1
  36. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +5 -4
  37. package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -1
  38. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +14 -16
  39. package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -1
  40. package/delivery/AssetDelivery/privateFiles/PrivateCache.js +18 -17
  41. package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +1 -1
  42. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +21 -25
  43. package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -1
  44. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +44 -51
  45. package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -1
  46. package/delivery/AssetDelivery/privateFiles/PublicCache.js +18 -17
  47. package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +1 -1
  48. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +16 -15
  49. package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -1
  50. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +16 -15
  51. package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -1
  52. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +5 -4
  53. package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +1 -1
  54. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +5 -4
  55. package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -1
  56. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +12 -15
  57. package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +1 -1
  58. package/delivery/index.js +0 -2
  59. package/delivery/setupAssetDelivery.js +70 -101
  60. package/delivery/setupAssetDelivery.js.map +1 -1
  61. package/domain/file/abstractions.js +2 -5
  62. package/domain/file/abstractions.js.map +1 -1
  63. package/domain/file/errors.js +67 -76
  64. package/domain/file/errors.js.map +1 -1
  65. package/domain/file/file.model.js +57 -49
  66. package/domain/file/file.model.js.map +1 -1
  67. package/domain/file/types.js +0 -3
  68. package/domain/identity/Identity.js +9 -8
  69. package/domain/identity/Identity.js.map +1 -1
  70. package/domain/permissionsSchema.js +26 -15
  71. package/domain/permissionsSchema.js.map +1 -1
  72. package/domain/settings/constants.js +2 -1
  73. package/domain/settings/constants.js.map +1 -1
  74. package/domain/settings/errors.js +22 -24
  75. package/domain/settings/errors.js.map +1 -1
  76. package/domain/settings/types.js +0 -3
  77. package/domain/settings/validation.js +18 -27
  78. package/domain/settings/validation.js.map +1 -1
  79. package/exports/api/file-manager/file.js +0 -2
  80. package/exports/api/file-manager/permissions.js +0 -2
  81. package/exports/api/file-manager/settings.js +0 -2
  82. package/features/FileManagerFeature.js +16 -15
  83. package/features/FileManagerFeature.js.map +1 -1
  84. package/features/file/CreateFile/CreateFileRepository.js +20 -18
  85. package/features/file/CreateFile/CreateFileRepository.js.map +1 -1
  86. package/features/file/CreateFile/CreateFileUseCase.js +68 -75
  87. package/features/file/CreateFile/CreateFileUseCase.js.map +1 -1
  88. package/features/file/CreateFile/abstractions.js +3 -14
  89. package/features/file/CreateFile/abstractions.js.map +1 -1
  90. package/features/file/CreateFile/events.js +17 -26
  91. package/features/file/CreateFile/events.js.map +1 -1
  92. package/features/file/CreateFile/feature.js +7 -6
  93. package/features/file/CreateFile/feature.js.map +1 -1
  94. package/features/file/CreateFile/index.js +0 -2
  95. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +15 -17
  96. package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js.map +1 -1
  97. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js +59 -70
  98. package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -1
  99. package/features/file/CreateFilesInBatch/abstractions.js +3 -14
  100. package/features/file/CreateFilesInBatch/abstractions.js.map +1 -1
  101. package/features/file/CreateFilesInBatch/events.js +17 -26
  102. package/features/file/CreateFilesInBatch/events.js.map +1 -1
  103. package/features/file/CreateFilesInBatch/feature.js +7 -6
  104. package/features/file/CreateFilesInBatch/feature.js.map +1 -1
  105. package/features/file/CreateFilesInBatch/index.js +0 -2
  106. package/features/file/DeleteFile/DeleteFileRepository.js +21 -20
  107. package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -1
  108. package/features/file/DeleteFile/DeleteFileUseCase.js +31 -33
  109. package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -1
  110. package/features/file/DeleteFile/abstractions.js +3 -14
  111. package/features/file/DeleteFile/abstractions.js.map +1 -1
  112. package/features/file/DeleteFile/events.js +17 -26
  113. package/features/file/DeleteFile/events.js.map +1 -1
  114. package/features/file/DeleteFile/feature.js +7 -6
  115. package/features/file/DeleteFile/feature.js.map +1 -1
  116. package/features/file/DeleteFile/index.js +1 -3
  117. package/features/file/FileUrlGenerator/abstractions.js +2 -2
  118. package/features/file/FileUrlGenerator/abstractions.js.map +1 -1
  119. package/features/file/GetFile/GetFileRepository.js +22 -22
  120. package/features/file/GetFile/GetFileRepository.js.map +1 -1
  121. package/features/file/GetFile/GetFileUseCase.js +19 -21
  122. package/features/file/GetFile/GetFileUseCase.js.map +1 -1
  123. package/features/file/GetFile/abstractions.js +3 -14
  124. package/features/file/GetFile/abstractions.js.map +1 -1
  125. package/features/file/GetFile/feature.js +7 -6
  126. package/features/file/GetFile/feature.js.map +1 -1
  127. package/features/file/GetFile/index.js +0 -2
  128. package/features/file/GetFileContentsById/abstractions.d.ts +20 -0
  129. package/features/file/GetFileContentsById/abstractions.js +5 -0
  130. package/features/file/GetFileContentsById/abstractions.js.map +1 -0
  131. package/features/file/GetFileContentsById/index.d.ts +1 -0
  132. package/features/file/GetFileContentsById/index.js +1 -0
  133. package/features/file/GetFileContentsByKey/abstractions.d.ts +17 -0
  134. package/features/file/GetFileContentsByKey/abstractions.js +5 -0
  135. package/features/file/GetFileContentsByKey/abstractions.js.map +1 -0
  136. package/features/file/GetFileContentsByKey/index.d.ts +1 -0
  137. package/features/file/GetFileContentsByKey/index.js +1 -0
  138. package/features/file/ListFiles/ListFilesRepository.js +42 -40
  139. package/features/file/ListFiles/ListFilesRepository.js.map +1 -1
  140. package/features/file/ListFiles/ListFilesUseCase.js +33 -34
  141. package/features/file/ListFiles/ListFilesUseCase.js.map +1 -1
  142. package/features/file/ListFiles/abstractions.js +3 -14
  143. package/features/file/ListFiles/abstractions.js.map +1 -1
  144. package/features/file/ListFiles/feature.js +7 -6
  145. package/features/file/ListFiles/feature.js.map +1 -1
  146. package/features/file/ListFiles/index.js +0 -2
  147. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +31 -28
  148. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -1
  149. package/features/file/ListImagesByTagTool/feature.js +6 -5
  150. package/features/file/ListImagesByTagTool/feature.js.map +1 -1
  151. package/features/file/ListTags/ListTagsRepository.js +31 -36
  152. package/features/file/ListTags/ListTagsRepository.js.map +1 -1
  153. package/features/file/ListTags/ListTagsUseCase.js +21 -21
  154. package/features/file/ListTags/ListTagsUseCase.js.map +1 -1
  155. package/features/file/ListTags/abstractions.js +3 -14
  156. package/features/file/ListTags/abstractions.js.map +1 -1
  157. package/features/file/ListTags/feature.js +7 -6
  158. package/features/file/ListTags/feature.js.map +1 -1
  159. package/features/file/ListTags/index.js +0 -2
  160. package/features/file/UpdateFile/UpdateFileRepository.js +26 -28
  161. package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -1
  162. package/features/file/UpdateFile/UpdateFileUseCase.js +57 -65
  163. package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -1
  164. package/features/file/UpdateFile/abstractions.js +3 -14
  165. package/features/file/UpdateFile/abstractions.js.map +1 -1
  166. package/features/file/UpdateFile/events.js +17 -26
  167. package/features/file/UpdateFile/events.js.map +1 -1
  168. package/features/file/UpdateFile/feature.js +7 -6
  169. package/features/file/UpdateFile/feature.js.map +1 -1
  170. package/features/file/UpdateFile/index.js +1 -3
  171. package/features/file/shared/EntryToFileMapper.js +25 -24
  172. package/features/file/shared/EntryToFileMapper.js.map +1 -1
  173. package/features/file/shared/FileInputToEntryInputMapper.js +29 -28
  174. package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -1
  175. package/features/file/shared/FileToEntryMapper.js +28 -27
  176. package/features/file/shared/FileToEntryMapper.js.map +1 -1
  177. package/features/permissions/abstractions.js +2 -1
  178. package/features/permissions/abstractions.js.map +1 -1
  179. package/features/permissions/feature.js +2 -1
  180. package/features/permissions/feature.js.map +1 -1
  181. package/features/settings/GetSettings/GetSettingsUseCase.js +19 -19
  182. package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -1
  183. package/features/settings/GetSettings/abstractions.js +2 -7
  184. package/features/settings/GetSettings/abstractions.js.map +1 -1
  185. package/features/settings/GetSettings/feature.js +6 -5
  186. package/features/settings/GetSettings/feature.js.map +1 -1
  187. package/features/settings/SettingsInstaller/SettingsInstaller.js +25 -24
  188. package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -1
  189. package/features/settings/SettingsInstaller/feature.js +6 -5
  190. package/features/settings/SettingsInstaller/feature.js.map +1 -1
  191. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +41 -48
  192. package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -1
  193. package/features/settings/UpdateSettings/abstractions.js +2 -7
  194. package/features/settings/UpdateSettings/abstractions.js.map +1 -1
  195. package/features/settings/UpdateSettings/events.js +17 -26
  196. package/features/settings/UpdateSettings/events.js.map +1 -1
  197. package/features/settings/UpdateSettings/feature.js +6 -5
  198. package/features/settings/UpdateSettings/feature.js.map +1 -1
  199. package/features/settings/UpdateSettings/index.js +0 -2
  200. package/features/shared/abstractions.js +0 -2
  201. package/graphql/baseSchema.js +30 -33
  202. package/graphql/baseSchema.js.map +1 -1
  203. package/graphql/createFilesTypeDefs.js +49 -57
  204. package/graphql/createFilesTypeDefs.js.map +1 -1
  205. package/graphql/filesSchema.js +79 -99
  206. package/graphql/filesSchema.js.map +1 -1
  207. package/graphql/getFileByUrl.js +45 -53
  208. package/graphql/getFileByUrl.js.map +1 -1
  209. package/graphql/index.js +35 -42
  210. package/graphql/index.js.map +1 -1
  211. package/graphql/utils.js +9 -14
  212. package/graphql/utils.js.map +1 -1
  213. package/index.js +19 -30
  214. package/index.js.map +1 -1
  215. package/modelModifier/CmsModelModifier.js +40 -43
  216. package/modelModifier/CmsModelModifier.js.map +1 -1
  217. package/package.json +17 -20
  218. package/types.js +0 -2
  219. package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +0 -1
  220. package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +0 -1
  221. package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +0 -1
  222. package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +0 -1
  223. package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +0 -1
  224. package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +0 -1
  225. package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +0 -1
  226. package/delivery/index.js.map +0 -1
  227. package/domain/file/types.js.map +0 -1
  228. package/domain/settings/types.js.map +0 -1
  229. package/exports/api/file-manager/file.js.map +0 -1
  230. package/exports/api/file-manager/permissions.js.map +0 -1
  231. package/exports/api/file-manager/settings.js.map +0 -1
  232. package/features/ai/AiImageEnrichmentAfterCreateHandler.d.ts +0 -11
  233. package/features/ai/AiImageEnrichmentAfterCreateHandler.js +0 -28
  234. package/features/ai/AiImageEnrichmentAfterCreateHandler.js.map +0 -1
  235. package/features/ai/AiImageEnrichmentFeature.d.ts +0 -4
  236. package/features/ai/AiImageEnrichmentFeature.js +0 -12
  237. package/features/ai/AiImageEnrichmentFeature.js.map +0 -1
  238. package/features/file/CreateFile/index.js.map +0 -1
  239. package/features/file/CreateFilesInBatch/index.js.map +0 -1
  240. package/features/file/DeleteFile/index.js.map +0 -1
  241. package/features/file/GetFile/index.js.map +0 -1
  242. package/features/file/ListFiles/index.js.map +0 -1
  243. package/features/file/ListTags/index.js.map +0 -1
  244. package/features/file/UpdateFile/index.js.map +0 -1
  245. package/features/settings/UpdateSettings/index.js.map +0 -1
  246. package/features/shared/abstractions.js.map +0 -1
  247. package/tasks/AiImageEnrichmentTask.d.ts +0 -35
  248. package/tasks/AiImageEnrichmentTask.js +0 -136
  249. package/tasks/AiImageEnrichmentTask.js.map +0 -1
  250. package/types.js.map +0 -1
package/contants.js CHANGED
@@ -1,3 +1,4 @@
1
- export const ROOT_FOLDER = "root";
1
+ const ROOT_FOLDER = "root";
2
+ export { ROOT_FOLDER };
2
3
 
3
4
  //# sourceMappingURL=contants.js.map
package/contants.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ROOT_FOLDER"],"sources":["contants.ts"],"sourcesContent":["export const ROOT_FOLDER = \"root\";\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"contants.js","sources":["../src/contants.ts"],"sourcesContent":["export const ROOT_FOLDER = \"root\";\n"],"names":["ROOT_FOLDER"],"mappings":"AAAO,MAAMA,cAAc"}
@@ -1,59 +1,53 @@
1
- export class Asset {
2
- constructor(props) {
3
- this.props = props;
4
- }
5
- clone() {
6
- return this.withProps(structuredClone(this.props));
7
- }
8
- withProps(props) {
9
- const newAsset = new Asset({
10
- ...this.props,
11
- ...props
12
- });
13
- newAsset.contentsReader = this.contentsReader;
14
- newAsset.outputStrategy = this.outputStrategy;
15
- return newAsset;
16
- }
17
- getId() {
18
- return this.props.id;
19
- }
20
- getTenant() {
21
- return this.props.tenant;
22
- }
23
- getKey() {
24
- return this.props.key;
25
- }
26
- getSize() {
27
- return this.props.size;
28
- }
29
- getContentType() {
30
- return this.props.contentType;
31
- }
32
- getExtension() {
33
- return this.getKey().split(".").pop() ?? "";
34
- }
35
- getContents() {
36
- if (!this.contentsReader) {
37
- throw Error(`Asset contents reader was not configured!`);
38
- }
39
- return this.contentsReader.read(this);
40
- }
41
- setContentsReader(reader) {
42
- this.contentsReader = reader;
43
- }
44
- output() {
45
- if (!this.outputStrategy) {
46
- throw Error(`Asset output strategy was not configured!`);
47
- }
48
- return this.outputStrategy.output(this);
49
- }
50
- setOutputStrategy(setter) {
51
- if (typeof setter === "function") {
52
- this.outputStrategy = setter(this.outputStrategy);
53
- } else {
54
- this.outputStrategy = setter;
55
- }
56
- }
1
+ class Asset {
2
+ constructor(props){
3
+ this.props = props;
4
+ }
5
+ clone() {
6
+ return this.withProps(structuredClone(this.props));
7
+ }
8
+ withProps(props) {
9
+ const newAsset = new Asset({
10
+ ...this.props,
11
+ ...props
12
+ });
13
+ newAsset.contentsReader = this.contentsReader;
14
+ newAsset.outputStrategy = this.outputStrategy;
15
+ return newAsset;
16
+ }
17
+ getId() {
18
+ return this.props.id;
19
+ }
20
+ getTenant() {
21
+ return this.props.tenant;
22
+ }
23
+ getKey() {
24
+ return this.props.key;
25
+ }
26
+ getSize() {
27
+ return this.props.size;
28
+ }
29
+ getContentType() {
30
+ return this.props.contentType;
31
+ }
32
+ getExtension() {
33
+ return this.getKey().split(".").pop() ?? "";
34
+ }
35
+ getContents() {
36
+ if (!this.contentsReader) throw Error("Asset contents reader was not configured!");
37
+ return this.contentsReader.read(this);
38
+ }
39
+ setContentsReader(reader) {
40
+ this.contentsReader = reader;
41
+ }
42
+ output() {
43
+ if (!this.outputStrategy) throw Error("Asset output strategy was not configured!");
44
+ return this.outputStrategy.output(this);
45
+ }
46
+ setOutputStrategy(setter) {
47
+ if ("function" == typeof setter) this.outputStrategy = setter(this.outputStrategy);
48
+ else this.outputStrategy = setter;
49
+ }
57
50
  }
51
+ export { Asset };
58
52
 
59
53
  //# sourceMappingURL=Asset.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Asset","constructor","props","clone","withProps","structuredClone","newAsset","contentsReader","outputStrategy","getId","id","getTenant","tenant","getKey","key","getSize","size","getContentType","contentType","getExtension","split","pop","getContents","Error","read","setContentsReader","reader","output","setOutputStrategy","setter"],"sources":["Asset.ts"],"sourcesContent":["import type { AssetContentsReader, AssetOutputStrategy } from \"~/delivery/index.js\";\n\ntype Setter<T> = (arg: T | undefined) => T;\n\nexport interface AssetData {\n id: string;\n tenant: string;\n key: string;\n size: number;\n contentType: string;\n}\n\nexport class Asset {\n protected readonly props: AssetData;\n private outputStrategy: AssetOutputStrategy | undefined;\n private contentsReader: AssetContentsReader | undefined;\n\n constructor(props: AssetData) {\n this.props = props;\n }\n\n clone() {\n return this.withProps(structuredClone(this.props));\n }\n\n withProps(props: Partial<AssetData>) {\n const newAsset = new Asset({ ...this.props, ...props });\n newAsset.contentsReader = this.contentsReader;\n newAsset.outputStrategy = this.outputStrategy;\n return newAsset;\n }\n\n getId() {\n return this.props.id;\n }\n getTenant() {\n return this.props.tenant;\n }\n getKey() {\n return this.props.key;\n }\n getSize() {\n return this.props.size;\n }\n getContentType() {\n return this.props.contentType;\n }\n getExtension() {\n return this.getKey().split(\".\").pop() ?? \"\";\n }\n\n getContents() {\n if (!this.contentsReader) {\n throw Error(`Asset contents reader was not configured!`);\n }\n return this.contentsReader.read(this);\n }\n\n setContentsReader(reader: AssetContentsReader) {\n this.contentsReader = reader;\n }\n\n output() {\n if (!this.outputStrategy) {\n throw Error(`Asset output strategy was not configured!`);\n }\n\n return this.outputStrategy.output(this);\n }\n\n setOutputStrategy(setter: Setter<AssetOutputStrategy> | AssetOutputStrategy) {\n if (typeof setter === \"function\") {\n this.outputStrategy = setter(this.outputStrategy);\n } else {\n this.outputStrategy = setter;\n }\n }\n}\n"],"mappings":"AAYA,OAAO,MAAMA,KAAK,CAAC;EAKfC,WAAWA,CAACC,KAAgB,EAAE;IAC1B,IAAI,CAACA,KAAK,GAAGA,KAAK;EACtB;EAEAC,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACC,SAAS,CAACC,eAAe,CAAC,IAAI,CAACH,KAAK,CAAC,CAAC;EACtD;EAEAE,SAASA,CAACF,KAAyB,EAAE;IACjC,MAAMI,QAAQ,GAAG,IAAIN,KAAK,CAAC;MAAE,GAAG,IAAI,CAACE,KAAK;MAAE,GAAGA;IAAM,CAAC,CAAC;IACvDI,QAAQ,CAACC,cAAc,GAAG,IAAI,CAACA,cAAc;IAC7CD,QAAQ,CAACE,cAAc,GAAG,IAAI,CAACA,cAAc;IAC7C,OAAOF,QAAQ;EACnB;EAEAG,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACP,KAAK,CAACQ,EAAE;EACxB;EACAC,SAASA,CAAA,EAAG;IACR,OAAO,IAAI,CAACT,KAAK,CAACU,MAAM;EAC5B;EACAC,MAAMA,CAAA,EAAG;IACL,OAAO,IAAI,CAACX,KAAK,CAACY,GAAG;EACzB;EACAC,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACb,KAAK,CAACc,IAAI;EAC1B;EACAC,cAAcA,CAAA,EAAG;IACb,OAAO,IAAI,CAACf,KAAK,CAACgB,WAAW;EACjC;EACAC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAI,CAACN,MAAM,CAAC,CAAC,CAACO,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,IAAI,EAAE;EAC/C;EAEAC,WAAWA,CAAA,EAAG;IACV,IAAI,CAAC,IAAI,CAACf,cAAc,EAAE;MACtB,MAAMgB,KAAK,CAAC,2CAA2C,CAAC;IAC5D;IACA,OAAO,IAAI,CAAChB,cAAc,CAACiB,IAAI,CAAC,IAAI,CAAC;EACzC;EAEAC,iBAAiBA,CAACC,MAA2B,EAAE;IAC3C,IAAI,CAACnB,cAAc,GAAGmB,MAAM;EAChC;EAEAC,MAAMA,CAAA,EAAG;IACL,IAAI,CAAC,IAAI,CAACnB,cAAc,EAAE;MACtB,MAAMe,KAAK,CAAC,2CAA2C,CAAC;IAC5D;IAEA,OAAO,IAAI,CAACf,cAAc,CAACmB,MAAM,CAAC,IAAI,CAAC;EAC3C;EAEAC,iBAAiBA,CAACC,MAAyD,EAAE;IACzE,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;MAC9B,IAAI,CAACrB,cAAc,GAAGqB,MAAM,CAAC,IAAI,CAACrB,cAAc,CAAC;IACrD,CAAC,MAAM;MACH,IAAI,CAACA,cAAc,GAAGqB,MAAM;IAChC;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/Asset.js","sources":["../../../src/delivery/AssetDelivery/Asset.ts"],"sourcesContent":["import type { AssetContentsReader, AssetOutputStrategy } from \"~/delivery/index.js\";\n\ntype Setter<T> = (arg: T | undefined) => T;\n\nexport interface AssetData {\n id: string;\n tenant: string;\n key: string;\n size: number;\n contentType: string;\n}\n\nexport class Asset {\n protected readonly props: AssetData;\n private outputStrategy: AssetOutputStrategy | undefined;\n private contentsReader: AssetContentsReader | undefined;\n\n constructor(props: AssetData) {\n this.props = props;\n }\n\n clone() {\n return this.withProps(structuredClone(this.props));\n }\n\n withProps(props: Partial<AssetData>) {\n const newAsset = new Asset({ ...this.props, ...props });\n newAsset.contentsReader = this.contentsReader;\n newAsset.outputStrategy = this.outputStrategy;\n return newAsset;\n }\n\n getId() {\n return this.props.id;\n }\n getTenant() {\n return this.props.tenant;\n }\n getKey() {\n return this.props.key;\n }\n getSize() {\n return this.props.size;\n }\n getContentType() {\n return this.props.contentType;\n }\n getExtension() {\n return this.getKey().split(\".\").pop() ?? \"\";\n }\n\n getContents() {\n if (!this.contentsReader) {\n throw Error(`Asset contents reader was not configured!`);\n }\n return this.contentsReader.read(this);\n }\n\n setContentsReader(reader: AssetContentsReader) {\n this.contentsReader = reader;\n }\n\n output() {\n if (!this.outputStrategy) {\n throw Error(`Asset output strategy was not configured!`);\n }\n\n return this.outputStrategy.output(this);\n }\n\n setOutputStrategy(setter: Setter<AssetOutputStrategy> | AssetOutputStrategy) {\n if (typeof setter === \"function\") {\n this.outputStrategy = setter(this.outputStrategy);\n } else {\n this.outputStrategy = setter;\n }\n }\n}\n"],"names":["Asset","props","structuredClone","newAsset","Error","reader","setter"],"mappings":"AAYO,MAAMA;IAKT,YAAYC,KAAgB,CAAE;QAC1B,IAAI,CAAC,KAAK,GAAGA;IACjB;IAEA,QAAQ;QACJ,OAAO,IAAI,CAAC,SAAS,CAACC,gBAAgB,IAAI,CAAC,KAAK;IACpD;IAEA,UAAUD,KAAyB,EAAE;QACjC,MAAME,WAAW,IAAIH,MAAM;YAAE,GAAG,IAAI,CAAC,KAAK;YAAE,GAAGC,KAAK;QAAC;QACrDE,SAAS,cAAc,GAAG,IAAI,CAAC,cAAc;QAC7CA,SAAS,cAAc,GAAG,IAAI,CAAC,cAAc;QAC7C,OAAOA;IACX;IAEA,QAAQ;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE;IACxB;IACA,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM;IAC5B;IACA,SAAS;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG;IACzB;IACA,UAAU;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI;IAC1B;IACA,iBAAiB;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW;IACjC;IACA,eAAe;QACX,OAAO,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM;IAC7C;IAEA,cAAc;QACV,IAAI,CAAC,IAAI,CAAC,cAAc,EACpB,MAAMC,MAAM;QAEhB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI;IACxC;IAEA,kBAAkBC,MAA2B,EAAE;QAC3C,IAAI,CAAC,cAAc,GAAGA;IAC1B;IAEA,SAAS;QACL,IAAI,CAAC,IAAI,CAAC,cAAc,EACpB,MAAMD,MAAM;QAGhB,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI;IAC1C;IAEA,kBAAkBE,MAAyD,EAAE;QACzE,IAAI,AAAkB,cAAlB,OAAOA,QACP,IAAI,CAAC,cAAc,GAAGA,OAAO,IAAI,CAAC,cAAc;aAEhD,IAAI,CAAC,cAAc,GAAGA;IAE9B;AACJ"}
@@ -5,90 +5,77 @@ import { NullAssetResolver } from "./NullAssetResolver.js";
5
5
  import { NullAssetOutputStrategy } from "./NullAssetOutputStrategy.js";
6
6
  import { TransformationAssetProcessor } from "./transformation/TransformationAssetProcessor.js";
7
7
  import { PassthroughAssetTransformationStrategy } from "./transformation/PassthroughAssetTransformationStrategy.js";
8
- export class AssetDeliveryConfigBuilder {
9
- assetRequestResolverDecorators = [];
10
- assetResolverDecorators = [];
11
- assetProcessorDecorators = [];
12
- assetTransformationStrategyDecorators = [];
13
- assetOutputStrategyDecorators = [];
14
- setResponseHeaders(setter) {
15
- this.decorateAssetOutputStrategy(params => {
16
- return new SetResponseHeaders(setter, params);
17
- });
18
- }
19
- decorateAssetRequestResolver(decorator) {
20
- this.assetRequestResolverDecorators.push(decorator);
21
- }
22
- decorateAssetResolver(decorator) {
23
- this.assetResolverDecorators.push(decorator);
24
- }
25
- decorateAssetProcessor(decorator) {
26
- this.assetProcessorDecorators.push(decorator);
27
- }
28
- decorateAssetTransformationStrategy(decorator) {
29
- this.assetTransformationStrategyDecorators.push(decorator);
30
- }
31
- decorateAssetOutputStrategy(decorator) {
32
- this.assetOutputStrategyDecorators.push(decorator);
33
- }
34
-
35
- /**
36
- * @internal
37
- */
38
- getAssetRequestResolver() {
39
- return this.assetRequestResolverDecorators.reduce((value, decorator) => decorator({
40
- assetRequestResolver: value
41
- }), new NullRequestResolver());
42
- }
43
-
44
- /**
45
- * @internal
46
- */
47
- getAssetResolver(container) {
48
- return this.assetResolverDecorators.reduce((value, decorator) => decorator({
49
- container,
50
- assetResolver: value
51
- }), new NullAssetResolver());
52
- }
53
-
54
- /**
55
- * @internal
56
- */
57
- getAssetProcessor(context) {
58
- return this.assetProcessorDecorators.reduce((value, decorator) => decorator({
59
- assetProcessor: value,
60
- context
61
- }), new TransformationAssetProcessor(this.getAssetTransformationStrategy(context)));
62
- }
63
- getAssetOutputStrategy(context, assetRequest, asset) {
64
- return this.assetOutputStrategyDecorators.reduce((value, decorator) => {
65
- return decorator({
66
- context,
67
- assetRequest,
68
- asset,
69
- assetOutputStrategy: value
70
- });
71
- }, new NullAssetOutputStrategy());
72
- }
73
- getAssetTransformationStrategy(context) {
74
- return this.assetTransformationStrategyDecorators.reduce((value, decorator) => decorator({
75
- context,
76
- assetTransformationStrategy: value
77
- }), new PassthroughAssetTransformationStrategy());
78
- }
8
+ class AssetDeliveryConfigBuilder {
9
+ setResponseHeaders(setter) {
10
+ this.decorateAssetOutputStrategy((params)=>new SetResponseHeaders(setter, params));
11
+ }
12
+ decorateAssetRequestResolver(decorator) {
13
+ this.assetRequestResolverDecorators.push(decorator);
14
+ }
15
+ decorateAssetResolver(decorator) {
16
+ this.assetResolverDecorators.push(decorator);
17
+ }
18
+ decorateAssetProcessor(decorator) {
19
+ this.assetProcessorDecorators.push(decorator);
20
+ }
21
+ decorateAssetTransformationStrategy(decorator) {
22
+ this.assetTransformationStrategyDecorators.push(decorator);
23
+ }
24
+ decorateAssetOutputStrategy(decorator) {
25
+ this.assetOutputStrategyDecorators.push(decorator);
26
+ }
27
+ getAssetRequestResolver() {
28
+ return this.assetRequestResolverDecorators.reduce((value, decorator)=>decorator({
29
+ assetRequestResolver: value
30
+ }), new NullRequestResolver());
31
+ }
32
+ getAssetResolver(container) {
33
+ return this.assetResolverDecorators.reduce((value, decorator)=>decorator({
34
+ container,
35
+ assetResolver: value
36
+ }), new NullAssetResolver());
37
+ }
38
+ getAssetProcessor(context) {
39
+ return this.assetProcessorDecorators.reduce((value, decorator)=>decorator({
40
+ assetProcessor: value,
41
+ context
42
+ }), new TransformationAssetProcessor(this.getAssetTransformationStrategy(context)));
43
+ }
44
+ getAssetOutputStrategy(context, assetRequest, asset) {
45
+ return this.assetOutputStrategyDecorators.reduce((value, decorator)=>decorator({
46
+ context,
47
+ assetRequest,
48
+ asset,
49
+ assetOutputStrategy: value
50
+ }), new NullAssetOutputStrategy());
51
+ }
52
+ getAssetTransformationStrategy(context) {
53
+ return this.assetTransformationStrategyDecorators.reduce((value, decorator)=>decorator({
54
+ context,
55
+ assetTransformationStrategy: value
56
+ }), new PassthroughAssetTransformationStrategy());
57
+ }
58
+ constructor(){
59
+ this.assetRequestResolverDecorators = [];
60
+ this.assetResolverDecorators = [];
61
+ this.assetProcessorDecorators = [];
62
+ this.assetTransformationStrategyDecorators = [];
63
+ this.assetOutputStrategyDecorators = [];
64
+ }
79
65
  }
80
- export class AssetDeliveryConfigModifierPlugin extends Plugin {
81
- static type = "fm.config-modifier";
82
- constructor(cb) {
83
- super();
84
- this.cb = cb;
85
- }
86
- async buildConfig(configBuilder) {
87
- await this.cb(configBuilder);
88
- }
66
+ class AssetDeliveryConfigModifierPlugin extends Plugin {
67
+ static{
68
+ this.type = "fm.config-modifier";
69
+ }
70
+ constructor(cb){
71
+ super();
72
+ this.cb = cb;
73
+ }
74
+ async buildConfig(configBuilder) {
75
+ await this.cb(configBuilder);
76
+ }
89
77
  }
90
- export const createAssetDeliveryConfig = cb => {
91
- return new AssetDeliveryConfigModifierPlugin(cb);
92
- };
78
+ const createAssetDeliveryConfig = (cb)=>new AssetDeliveryConfigModifierPlugin(cb);
79
+ export { AssetDeliveryConfigBuilder, AssetDeliveryConfigModifierPlugin, createAssetDeliveryConfig };
93
80
 
94
81
  //# sourceMappingURL=AssetDeliveryConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","SetResponseHeaders","NullRequestResolver","NullAssetResolver","NullAssetOutputStrategy","TransformationAssetProcessor","PassthroughAssetTransformationStrategy","AssetDeliveryConfigBuilder","assetRequestResolverDecorators","assetResolverDecorators","assetProcessorDecorators","assetTransformationStrategyDecorators","assetOutputStrategyDecorators","setResponseHeaders","setter","decorateAssetOutputStrategy","params","decorateAssetRequestResolver","decorator","push","decorateAssetResolver","decorateAssetProcessor","decorateAssetTransformationStrategy","getAssetRequestResolver","reduce","value","assetRequestResolver","getAssetResolver","container","assetResolver","getAssetProcessor","context","assetProcessor","getAssetTransformationStrategy","getAssetOutputStrategy","assetRequest","asset","assetOutputStrategy","assetTransformationStrategy","AssetDeliveryConfigModifierPlugin","type","constructor","cb","buildConfig","configBuilder","createAssetDeliveryConfig"],"sources":["AssetDeliveryConfig.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type {\n AssetRequestResolver,\n AssetResolver,\n AssetProcessor,\n AssetOutputStrategy,\n AssetRequest,\n Asset,\n AssetTransformationStrategy,\n ResponseHeadersSetter\n} from \"~/delivery/index.js\";\nimport { SetResponseHeaders } from \"~/delivery/index.js\";\nimport { NullRequestResolver } from \"~/delivery/AssetDelivery/NullRequestResolver.js\";\nimport { NullAssetResolver } from \"~/delivery/AssetDelivery/NullAssetResolver.js\";\nimport { NullAssetOutputStrategy } from \"./NullAssetOutputStrategy.js\";\nimport { TransformationAssetProcessor } from \"./transformation/TransformationAssetProcessor.js\";\nimport { PassthroughAssetTransformationStrategy } from \"./transformation/PassthroughAssetTransformationStrategy.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { Container } from \"@webiny/di\";\n\ntype Setter<TParams, TReturn> = (params: TParams) => TReturn;\n\nexport type AssetRequestResolverDecorator = Setter<\n { assetRequestResolver: AssetRequestResolver },\n AssetRequestResolver\n>;\n\nexport type AssetResolverDecorator = Setter<\n { assetResolver: AssetResolver; container: Container },\n AssetResolver\n>;\n\nexport type AssetProcessorDecorator = Setter<\n { context: ApiCoreContext; assetProcessor: AssetProcessor },\n AssetProcessor\n>;\n\nexport type AssetTransformationDecorator = Setter<\n { context: ApiCoreContext; assetTransformationStrategy: AssetTransformationStrategy },\n AssetTransformationStrategy\n>;\n\nexport interface AssetOutputStrategyDecoratorParams {\n context: ApiCoreContext;\n assetRequest: AssetRequest;\n asset: Asset;\n assetOutputStrategy: AssetOutputStrategy;\n}\n\nexport type AssetOutputStrategyDecorator = Setter<\n AssetOutputStrategyDecoratorParams,\n AssetOutputStrategy\n>;\n\nexport class AssetDeliveryConfigBuilder {\n private assetRequestResolverDecorators: AssetRequestResolverDecorator[] = [];\n private assetResolverDecorators: AssetResolverDecorator[] = [];\n private assetProcessorDecorators: AssetProcessorDecorator[] = [];\n private assetTransformationStrategyDecorators: AssetTransformationDecorator[] = [];\n private assetOutputStrategyDecorators: AssetOutputStrategyDecorator[] = [];\n\n setResponseHeaders(setter: ResponseHeadersSetter) {\n this.decorateAssetOutputStrategy(params => {\n return new SetResponseHeaders(setter, params);\n });\n }\n\n decorateAssetRequestResolver(decorator: AssetRequestResolverDecorator) {\n this.assetRequestResolverDecorators.push(decorator);\n }\n\n decorateAssetResolver(decorator: AssetResolverDecorator) {\n this.assetResolverDecorators.push(decorator);\n }\n\n decorateAssetProcessor(decorator: AssetProcessorDecorator) {\n this.assetProcessorDecorators.push(decorator);\n }\n\n decorateAssetTransformationStrategy(decorator: AssetTransformationDecorator) {\n this.assetTransformationStrategyDecorators.push(decorator);\n }\n\n decorateAssetOutputStrategy(decorator: AssetOutputStrategyDecorator) {\n this.assetOutputStrategyDecorators.push(decorator);\n }\n\n /**\n * @internal\n */\n getAssetRequestResolver() {\n return this.assetRequestResolverDecorators.reduce<AssetRequestResolver>(\n (value, decorator) => decorator({ assetRequestResolver: value }),\n new NullRequestResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetResolver(container: Container) {\n return this.assetResolverDecorators.reduce<AssetResolver>(\n (value, decorator) => decorator({ container, assetResolver: value }),\n new NullAssetResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetProcessor(context: ApiCoreContext) {\n return this.assetProcessorDecorators.reduce<AssetProcessor>(\n (value, decorator) => decorator({ assetProcessor: value, context }),\n new TransformationAssetProcessor(this.getAssetTransformationStrategy(context))\n );\n }\n\n getAssetOutputStrategy(context: ApiCoreContext, assetRequest: AssetRequest, asset: Asset) {\n return this.assetOutputStrategyDecorators.reduce<AssetOutputStrategy>(\n (value, decorator) => {\n return decorator({ context, assetRequest, asset, assetOutputStrategy: value });\n },\n new NullAssetOutputStrategy()\n );\n }\n\n getAssetTransformationStrategy(context: ApiCoreContext) {\n return this.assetTransformationStrategyDecorators.reduce<AssetTransformationStrategy>(\n (value, decorator) => decorator({ context, assetTransformationStrategy: value }),\n new PassthroughAssetTransformationStrategy()\n );\n }\n}\n\nexport interface AssetDeliveryConfigModifier {\n (config: AssetDeliveryConfigBuilder): Promise<void> | void;\n}\n\nexport class AssetDeliveryConfigModifierPlugin extends Plugin {\n public static override type = \"fm.config-modifier\";\n private readonly cb: AssetDeliveryConfigModifier;\n\n constructor(cb: AssetDeliveryConfigModifier) {\n super();\n this.cb = cb;\n }\n\n async buildConfig(configBuilder: AssetDeliveryConfigBuilder): Promise<void> {\n await this.cb(configBuilder);\n }\n}\n\nexport const createAssetDeliveryConfig = (cb: AssetDeliveryConfigModifier) => {\n return new AssetDeliveryConfigModifierPlugin(cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAWxC,SAASC,kBAAkB;AAC3B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,4BAA4B;AACrC,SAASC,sCAAsC;AAsC/C,OAAO,MAAMC,0BAA0B,CAAC;EAC5BC,8BAA8B,GAAoC,EAAE;EACpEC,uBAAuB,GAA6B,EAAE;EACtDC,wBAAwB,GAA8B,EAAE;EACxDC,qCAAqC,GAAmC,EAAE;EAC1EC,6BAA6B,GAAmC,EAAE;EAE1EC,kBAAkBA,CAACC,MAA6B,EAAE;IAC9C,IAAI,CAACC,2BAA2B,CAACC,MAAM,IAAI;MACvC,OAAO,IAAIf,kBAAkB,CAACa,MAAM,EAAEE,MAAM,CAAC;IACjD,CAAC,CAAC;EACN;EAEAC,4BAA4BA,CAACC,SAAwC,EAAE;IACnE,IAAI,CAACV,8BAA8B,CAACW,IAAI,CAACD,SAAS,CAAC;EACvD;EAEAE,qBAAqBA,CAACF,SAAiC,EAAE;IACrD,IAAI,CAACT,uBAAuB,CAACU,IAAI,CAACD,SAAS,CAAC;EAChD;EAEAG,sBAAsBA,CAACH,SAAkC,EAAE;IACvD,IAAI,CAACR,wBAAwB,CAACS,IAAI,CAACD,SAAS,CAAC;EACjD;EAEAI,mCAAmCA,CAACJ,SAAuC,EAAE;IACzE,IAAI,CAACP,qCAAqC,CAACQ,IAAI,CAACD,SAAS,CAAC;EAC9D;EAEAH,2BAA2BA,CAACG,SAAuC,EAAE;IACjE,IAAI,CAACN,6BAA6B,CAACO,IAAI,CAACD,SAAS,CAAC;EACtD;;EAEA;AACJ;AACA;EACIK,uBAAuBA,CAAA,EAAG;IACtB,OAAO,IAAI,CAACf,8BAA8B,CAACgB,MAAM,CAC7C,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEQ,oBAAoB,EAAED;IAAM,CAAC,CAAC,EAChE,IAAIvB,mBAAmB,CAAC,CAC5B,CAAC;EACL;;EAEA;AACJ;AACA;EACIyB,gBAAgBA,CAACC,SAAoB,EAAE;IACnC,OAAO,IAAI,CAACnB,uBAAuB,CAACe,MAAM,CACtC,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEU,SAAS;MAAEC,aAAa,EAAEJ;IAAM,CAAC,CAAC,EACpE,IAAItB,iBAAiB,CAAC,CAC1B,CAAC;EACL;;EAEA;AACJ;AACA;EACI2B,iBAAiBA,CAACC,OAAuB,EAAE;IACvC,OAAO,IAAI,CAACrB,wBAAwB,CAACc,MAAM,CACvC,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEc,cAAc,EAAEP,KAAK;MAAEM;IAAQ,CAAC,CAAC,EACnE,IAAI1B,4BAA4B,CAAC,IAAI,CAAC4B,8BAA8B,CAACF,OAAO,CAAC,CACjF,CAAC;EACL;EAEAG,sBAAsBA,CAACH,OAAuB,EAAEI,YAA0B,EAAEC,KAAY,EAAE;IACtF,OAAO,IAAI,CAACxB,6BAA6B,CAACY,MAAM,CAC5C,CAACC,KAAK,EAAEP,SAAS,KAAK;MAClB,OAAOA,SAAS,CAAC;QAAEa,OAAO;QAAEI,YAAY;QAAEC,KAAK;QAAEC,mBAAmB,EAAEZ;MAAM,CAAC,CAAC;IAClF,CAAC,EACD,IAAIrB,uBAAuB,CAAC,CAChC,CAAC;EACL;EAEA6B,8BAA8BA,CAACF,OAAuB,EAAE;IACpD,OAAO,IAAI,CAACpB,qCAAqC,CAACa,MAAM,CACpD,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEa,OAAO;MAAEO,2BAA2B,EAAEb;IAAM,CAAC,CAAC,EAChF,IAAInB,sCAAsC,CAAC,CAC/C,CAAC;EACL;AACJ;AAMA,OAAO,MAAMiC,iCAAiC,SAASvC,MAAM,CAAC;EAC1D,OAAuBwC,IAAI,GAAG,oBAAoB;EAGlDC,WAAWA,CAACC,EAA+B,EAAE;IACzC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAMC,WAAWA,CAACC,aAAyC,EAAiB;IACxE,MAAM,IAAI,CAACF,EAAE,CAACE,aAAa,CAAC;EAChC;AACJ;AAEA,OAAO,MAAMC,yBAAyB,GAAIH,EAA+B,IAAK;EAC1E,OAAO,IAAIH,iCAAiC,CAACG,EAAE,CAAC;AACpD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/AssetDeliveryConfig.js","sources":["../../../src/delivery/AssetDelivery/AssetDeliveryConfig.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type {\n AssetRequestResolver,\n AssetResolver,\n AssetProcessor,\n AssetOutputStrategy,\n AssetRequest,\n Asset,\n AssetTransformationStrategy,\n ResponseHeadersSetter\n} from \"~/delivery/index.js\";\nimport { SetResponseHeaders } from \"~/delivery/index.js\";\nimport { NullRequestResolver } from \"~/delivery/AssetDelivery/NullRequestResolver.js\";\nimport { NullAssetResolver } from \"~/delivery/AssetDelivery/NullAssetResolver.js\";\nimport { NullAssetOutputStrategy } from \"./NullAssetOutputStrategy.js\";\nimport { TransformationAssetProcessor } from \"./transformation/TransformationAssetProcessor.js\";\nimport { PassthroughAssetTransformationStrategy } from \"./transformation/PassthroughAssetTransformationStrategy.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { Container } from \"@webiny/di\";\n\ntype Setter<TParams, TReturn> = (params: TParams) => TReturn;\n\nexport type AssetRequestResolverDecorator = Setter<\n { assetRequestResolver: AssetRequestResolver },\n AssetRequestResolver\n>;\n\nexport type AssetResolverDecorator = Setter<\n { assetResolver: AssetResolver; container: Container },\n AssetResolver\n>;\n\nexport type AssetProcessorDecorator = Setter<\n { context: ApiCoreContext; assetProcessor: AssetProcessor },\n AssetProcessor\n>;\n\nexport type AssetTransformationDecorator = Setter<\n { context: ApiCoreContext; assetTransformationStrategy: AssetTransformationStrategy },\n AssetTransformationStrategy\n>;\n\nexport interface AssetOutputStrategyDecoratorParams {\n context: ApiCoreContext;\n assetRequest: AssetRequest;\n asset: Asset;\n assetOutputStrategy: AssetOutputStrategy;\n}\n\nexport type AssetOutputStrategyDecorator = Setter<\n AssetOutputStrategyDecoratorParams,\n AssetOutputStrategy\n>;\n\nexport class AssetDeliveryConfigBuilder {\n private assetRequestResolverDecorators: AssetRequestResolverDecorator[] = [];\n private assetResolverDecorators: AssetResolverDecorator[] = [];\n private assetProcessorDecorators: AssetProcessorDecorator[] = [];\n private assetTransformationStrategyDecorators: AssetTransformationDecorator[] = [];\n private assetOutputStrategyDecorators: AssetOutputStrategyDecorator[] = [];\n\n setResponseHeaders(setter: ResponseHeadersSetter) {\n this.decorateAssetOutputStrategy(params => {\n return new SetResponseHeaders(setter, params);\n });\n }\n\n decorateAssetRequestResolver(decorator: AssetRequestResolverDecorator) {\n this.assetRequestResolverDecorators.push(decorator);\n }\n\n decorateAssetResolver(decorator: AssetResolverDecorator) {\n this.assetResolverDecorators.push(decorator);\n }\n\n decorateAssetProcessor(decorator: AssetProcessorDecorator) {\n this.assetProcessorDecorators.push(decorator);\n }\n\n decorateAssetTransformationStrategy(decorator: AssetTransformationDecorator) {\n this.assetTransformationStrategyDecorators.push(decorator);\n }\n\n decorateAssetOutputStrategy(decorator: AssetOutputStrategyDecorator) {\n this.assetOutputStrategyDecorators.push(decorator);\n }\n\n /**\n * @internal\n */\n getAssetRequestResolver() {\n return this.assetRequestResolverDecorators.reduce<AssetRequestResolver>(\n (value, decorator) => decorator({ assetRequestResolver: value }),\n new NullRequestResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetResolver(container: Container) {\n return this.assetResolverDecorators.reduce<AssetResolver>(\n (value, decorator) => decorator({ container, assetResolver: value }),\n new NullAssetResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetProcessor(context: ApiCoreContext) {\n return this.assetProcessorDecorators.reduce<AssetProcessor>(\n (value, decorator) => decorator({ assetProcessor: value, context }),\n new TransformationAssetProcessor(this.getAssetTransformationStrategy(context))\n );\n }\n\n getAssetOutputStrategy(context: ApiCoreContext, assetRequest: AssetRequest, asset: Asset) {\n return this.assetOutputStrategyDecorators.reduce<AssetOutputStrategy>(\n (value, decorator) => {\n return decorator({ context, assetRequest, asset, assetOutputStrategy: value });\n },\n new NullAssetOutputStrategy()\n );\n }\n\n getAssetTransformationStrategy(context: ApiCoreContext) {\n return this.assetTransformationStrategyDecorators.reduce<AssetTransformationStrategy>(\n (value, decorator) => decorator({ context, assetTransformationStrategy: value }),\n new PassthroughAssetTransformationStrategy()\n );\n }\n}\n\nexport interface AssetDeliveryConfigModifier {\n (config: AssetDeliveryConfigBuilder): Promise<void> | void;\n}\n\nexport class AssetDeliveryConfigModifierPlugin extends Plugin {\n public static override type = \"fm.config-modifier\";\n private readonly cb: AssetDeliveryConfigModifier;\n\n constructor(cb: AssetDeliveryConfigModifier) {\n super();\n this.cb = cb;\n }\n\n async buildConfig(configBuilder: AssetDeliveryConfigBuilder): Promise<void> {\n await this.cb(configBuilder);\n }\n}\n\nexport const createAssetDeliveryConfig = (cb: AssetDeliveryConfigModifier) => {\n return new AssetDeliveryConfigModifierPlugin(cb);\n};\n"],"names":["AssetDeliveryConfigBuilder","setter","params","SetResponseHeaders","decorator","value","NullRequestResolver","container","NullAssetResolver","context","TransformationAssetProcessor","assetRequest","asset","NullAssetOutputStrategy","PassthroughAssetTransformationStrategy","AssetDeliveryConfigModifierPlugin","Plugin","cb","configBuilder","createAssetDeliveryConfig"],"mappings":";;;;;;;AAsDO,MAAMA;IAOT,mBAAmBC,MAA6B,EAAE;QAC9C,IAAI,CAAC,2BAA2B,CAACC,CAAAA,SACtB,IAAIC,mBAAmBF,QAAQC;IAE9C;IAEA,6BAA6BE,SAAwC,EAAE;QACnE,IAAI,CAAC,8BAA8B,CAAC,IAAI,CAACA;IAC7C;IAEA,sBAAsBA,SAAiC,EAAE;QACrD,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAACA;IACtC;IAEA,uBAAuBA,SAAkC,EAAE;QACvD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAACA;IACvC;IAEA,oCAAoCA,SAAuC,EAAE;QACzE,IAAI,CAAC,qCAAqC,CAAC,IAAI,CAACA;IACpD;IAEA,4BAA4BA,SAAuC,EAAE;QACjE,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAACA;IAC5C;IAKA,0BAA0B;QACtB,OAAO,IAAI,CAAC,8BAA8B,CAAC,MAAM,CAC7C,CAACC,OAAOD,YAAcA,UAAU;gBAAE,sBAAsBC;YAAM,IAC9D,IAAIC;IAEZ;IAKA,iBAAiBC,SAAoB,EAAE;QACnC,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,CACtC,CAACF,OAAOD,YAAcA,UAAU;gBAAEG;gBAAW,eAAeF;YAAM,IAClE,IAAIG;IAEZ;IAKA,kBAAkBC,OAAuB,EAAE;QACvC,OAAO,IAAI,CAAC,wBAAwB,CAAC,MAAM,CACvC,CAACJ,OAAOD,YAAcA,UAAU;gBAAE,gBAAgBC;gBAAOI;YAAQ,IACjE,IAAIC,6BAA6B,IAAI,CAAC,8BAA8B,CAACD;IAE7E;IAEA,uBAAuBA,OAAuB,EAAEE,YAA0B,EAAEC,KAAY,EAAE;QACtF,OAAO,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAC5C,CAACP,OAAOD,YACGA,UAAU;gBAAEK;gBAASE;gBAAcC;gBAAO,qBAAqBP;YAAM,IAEhF,IAAIQ;IAEZ;IAEA,+BAA+BJ,OAAuB,EAAE;QACpD,OAAO,IAAI,CAAC,qCAAqC,CAAC,MAAM,CACpD,CAACJ,OAAOD,YAAcA,UAAU;gBAAEK;gBAAS,6BAA6BJ;YAAM,IAC9E,IAAIS;IAEZ;;aA5EQ,8BAA8B,GAAoC,EAAE;aACpE,uBAAuB,GAA6B,EAAE;aACtD,wBAAwB,GAA8B,EAAE;aACxD,qCAAqC,GAAmC,EAAE;aAC1E,6BAA6B,GAAmC,EAAE;;AAyE9E;AAMO,MAAMC,0CAA0CC;;aAC5B,IAAI,GAAG;;IAG9B,YAAYC,EAA+B,CAAE;QACzC,KAAK;QACL,IAAI,CAAC,EAAE,GAAGA;IACd;IAEA,MAAM,YAAYC,aAAyC,EAAiB;QACxE,MAAM,IAAI,CAAC,EAAE,CAACA;IAClB;AACJ;AAEO,MAAMC,4BAA4B,CAACF,KAC/B,IAAIF,kCAAkCE"}
@@ -1,22 +1,23 @@
1
- export class AssetRequest {
2
- constructor(data) {
3
- this.data = data;
4
- }
5
- getKey() {
6
- return this.data.key;
7
- }
8
- getOptions() {
9
- return this.data.options;
10
- }
11
- setOptions(options) {
12
- this.data.options = options;
13
- }
14
- getContext() {
15
- return this.data.context;
16
- }
17
- getExtension() {
18
- return this.data.key.split(".").pop();
19
- }
1
+ class AssetRequest {
2
+ constructor(data){
3
+ this.data = data;
4
+ }
5
+ getKey() {
6
+ return this.data.key;
7
+ }
8
+ getOptions() {
9
+ return this.data.options;
10
+ }
11
+ setOptions(options) {
12
+ this.data.options = options;
13
+ }
14
+ getContext() {
15
+ return this.data.context;
16
+ }
17
+ getExtension() {
18
+ return this.data.key.split(".").pop();
19
+ }
20
20
  }
21
+ export { AssetRequest };
21
22
 
22
23
  //# sourceMappingURL=AssetRequest.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AssetRequest","constructor","data","getKey","key","getOptions","options","setOptions","getContext","context","getExtension","split","pop"],"sources":["AssetRequest.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface AssetRequestOptions {\n original?: boolean;\n width?: number;\n}\n\nexport type AssetRequestContext<T extends GenericRecord = GenericRecord> = T & {\n /**\n * Asset request URL.\n */\n url: string;\n};\n\nexport interface AssetRequestData<TOptions> {\n key: string;\n context: AssetRequestContext;\n options: TOptions;\n}\n\nexport class AssetRequest<TOptions extends AssetRequestOptions = AssetRequestOptions> {\n private data: AssetRequestData<TOptions>;\n\n constructor(data: AssetRequestData<TOptions>) {\n this.data = data;\n }\n\n getKey() {\n return this.data.key;\n }\n\n getOptions(): TOptions {\n return this.data.options;\n }\n\n setOptions(options: TOptions) {\n this.data.options = options;\n }\n\n getContext<T extends GenericRecord = GenericRecord>() {\n return this.data.context as AssetRequestContext<T>;\n }\n\n getExtension() {\n return this.data.key.split(\".\").pop();\n }\n}\n"],"mappings":"AAoBA,OAAO,MAAMA,YAAY,CAA6D;EAGlFC,WAAWA,CAACC,IAAgC,EAAE;IAC1C,IAAI,CAACA,IAAI,GAAGA,IAAI;EACpB;EAEAC,MAAMA,CAAA,EAAG;IACL,OAAO,IAAI,CAACD,IAAI,CAACE,GAAG;EACxB;EAEAC,UAAUA,CAAA,EAAa;IACnB,OAAO,IAAI,CAACH,IAAI,CAACI,OAAO;EAC5B;EAEAC,UAAUA,CAACD,OAAiB,EAAE;IAC1B,IAAI,CAACJ,IAAI,CAACI,OAAO,GAAGA,OAAO;EAC/B;EAEAE,UAAUA,CAAA,EAA4C;IAClD,OAAO,IAAI,CAACN,IAAI,CAACO,OAAO;EAC5B;EAEAC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAI,CAACR,IAAI,CAACE,GAAG,CAACO,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC;EACzC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/AssetRequest.js","sources":["../../../src/delivery/AssetDelivery/AssetRequest.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface AssetRequestOptions {\n original?: boolean;\n width?: number;\n}\n\nexport type AssetRequestContext<T extends GenericRecord = GenericRecord> = T & {\n /**\n * Asset request URL.\n */\n url: string;\n};\n\nexport interface AssetRequestData<TOptions> {\n key: string;\n context: AssetRequestContext;\n options: TOptions;\n}\n\nexport class AssetRequest<TOptions extends AssetRequestOptions = AssetRequestOptions> {\n private data: AssetRequestData<TOptions>;\n\n constructor(data: AssetRequestData<TOptions>) {\n this.data = data;\n }\n\n getKey() {\n return this.data.key;\n }\n\n getOptions(): TOptions {\n return this.data.options;\n }\n\n setOptions(options: TOptions) {\n this.data.options = options;\n }\n\n getContext<T extends GenericRecord = GenericRecord>() {\n return this.data.context as AssetRequestContext<T>;\n }\n\n getExtension() {\n return this.data.key.split(\".\").pop();\n }\n}\n"],"names":["AssetRequest","data","options"],"mappings":"AAoBO,MAAMA;IAGT,YAAYC,IAAgC,CAAE;QAC1C,IAAI,CAAC,IAAI,GAAGA;IAChB;IAEA,SAAS;QACL,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG;IACxB;IAEA,aAAuB;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO;IAC5B;IAEA,WAAWC,OAAiB,EAAE;QAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,GAAGA;IACxB;IAEA,aAAsD;QAClD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO;IAC5B;IAEA,eAAe;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG;IACvC;AACJ"}
@@ -1,30 +1,24 @@
1
1
  import { AssetRequest } from "./AssetRequest.js";
2
- export class FilesAssetRequestResolver {
3
- async resolve(request) {
4
- // Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300
5
- if (!request.url.startsWith("/files/")) {
6
- return undefined;
2
+ class FilesAssetRequestResolver {
3
+ async resolve(request) {
4
+ if (!request.url.startsWith("/files/")) return;
5
+ const params = request.params ?? {};
6
+ const query = request.query ?? {};
7
+ const path = params["*"];
8
+ const options = {
9
+ ...query,
10
+ original: "original" in query
11
+ };
12
+ if (query.width) options.width = parseInt(query.width);
13
+ return new AssetRequest({
14
+ key: decodeURI(path).replace("/files/", ""),
15
+ context: {
16
+ url: request.url
17
+ },
18
+ options
19
+ });
7
20
  }
8
- const params = request.params ?? {};
9
- const query = request.query ?? {};
10
-
11
- // Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },
12
- const path = params["*"];
13
- const options = {
14
- ...query,
15
- original: "original" in query
16
- };
17
- if (query.width) {
18
- options.width = parseInt(query.width);
19
- }
20
- return new AssetRequest({
21
- key: decodeURI(path).replace("/files/", ""),
22
- context: {
23
- url: request.url
24
- },
25
- options
26
- });
27
- }
28
21
  }
22
+ export { FilesAssetRequestResolver };
29
23
 
30
24
  //# sourceMappingURL=FilesAssetRequestResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AssetRequest","FilesAssetRequestResolver","resolve","request","url","startsWith","undefined","params","query","path","options","original","width","parseInt","key","decodeURI","replace","context"],"sources":["FilesAssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types.js\";\nimport type { AssetRequestResolver } from \"./abstractions/AssetRequestResolver.js\";\nimport type { AssetRequestOptions } from \"./AssetRequest.js\";\nimport { AssetRequest } from \"./AssetRequest.js\";\n\nexport class FilesAssetRequestResolver implements AssetRequestResolver {\n async resolve(request: Request): Promise<AssetRequest | undefined> {\n // Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300\n if (!request.url.startsWith(\"/files/\")) {\n return undefined;\n }\n\n const params = (request.params as Record<string, any>) ?? {};\n const query = (request.query as Record<string, any>) ?? {};\n\n // Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },\n const path = params[\"*\"];\n\n const options: AssetRequestOptions = {\n ...query,\n original: \"original\" in query\n };\n\n if (query.width) {\n options.width = parseInt(query.width);\n }\n\n return new AssetRequest({\n key: decodeURI(path).replace(\"/files/\", \"\"),\n context: {\n url: request.url\n },\n options\n });\n }\n}\n"],"mappings":"AAGA,SAASA,YAAY;AAErB,OAAO,MAAMC,yBAAyB,CAAiC;EACnE,MAAMC,OAAOA,CAACC,OAAgB,EAAqC;IAC/D;IACA,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;MACpC,OAAOC,SAAS;IACpB;IAEA,MAAMC,MAAM,GAAIJ,OAAO,CAACI,MAAM,IAA4B,CAAC,CAAC;IAC5D,MAAMC,KAAK,GAAIL,OAAO,CAACK,KAAK,IAA4B,CAAC,CAAC;;IAE1D;IACA,MAAMC,IAAI,GAAGF,MAAM,CAAC,GAAG,CAAC;IAExB,MAAMG,OAA4B,GAAG;MACjC,GAAGF,KAAK;MACRG,QAAQ,EAAE,UAAU,IAAIH;IAC5B,CAAC;IAED,IAAIA,KAAK,CAACI,KAAK,EAAE;MACbF,OAAO,CAACE,KAAK,GAAGC,QAAQ,CAACL,KAAK,CAACI,KAAK,CAAC;IACzC;IAEA,OAAO,IAAIZ,YAAY,CAAC;MACpBc,GAAG,EAAEC,SAAS,CAACN,IAAI,CAAC,CAACO,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;MAC3CC,OAAO,EAAE;QACLb,GAAG,EAAED,OAAO,CAACC;MACjB,CAAC;MACDM;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/FilesAssetRequestResolver.js","sources":["../../../src/delivery/AssetDelivery/FilesAssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types.js\";\nimport type { AssetRequestResolver } from \"./abstractions/AssetRequestResolver.js\";\nimport type { AssetRequestOptions } from \"./AssetRequest.js\";\nimport { AssetRequest } from \"./AssetRequest.js\";\n\nexport class FilesAssetRequestResolver implements AssetRequestResolver {\n async resolve(request: Request): Promise<AssetRequest | undefined> {\n // Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300\n if (!request.url.startsWith(\"/files/\")) {\n return undefined;\n }\n\n const params = (request.params as Record<string, any>) ?? {};\n const query = (request.query as Record<string, any>) ?? {};\n\n // Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },\n const path = params[\"*\"];\n\n const options: AssetRequestOptions = {\n ...query,\n original: \"original\" in query\n };\n\n if (query.width) {\n options.width = parseInt(query.width);\n }\n\n return new AssetRequest({\n key: decodeURI(path).replace(\"/files/\", \"\"),\n context: {\n url: request.url\n },\n options\n });\n }\n}\n"],"names":["FilesAssetRequestResolver","request","params","query","path","options","parseInt","AssetRequest","decodeURI"],"mappings":";AAKO,MAAMA;IACT,MAAM,QAAQC,OAAgB,EAAqC;QAE/D,IAAI,CAACA,QAAQ,GAAG,CAAC,UAAU,CAAC,YACxB;QAGJ,MAAMC,SAAUD,QAAQ,MAAM,IAA4B,CAAC;QAC3D,MAAME,QAASF,QAAQ,KAAK,IAA4B,CAAC;QAGzD,MAAMG,OAAOF,MAAM,CAAC,IAAI;QAExB,MAAMG,UAA+B;YACjC,GAAGF,KAAK;YACR,UAAU,cAAcA;QAC5B;QAEA,IAAIA,MAAM,KAAK,EACXE,QAAQ,KAAK,GAAGC,SAASH,MAAM,KAAK;QAGxC,OAAO,IAAII,aAAa;YACpB,KAAKC,UAAUJ,MAAM,OAAO,CAAC,WAAW;YACxC,SAAS;gBACL,KAAKH,QAAQ,GAAG;YACpB;YACAI;QACJ;IACJ;AACJ"}
@@ -1,8 +1,9 @@
1
1
  import { NullAssetReply } from "./NullAssetReply.js";
2
- export class NullAssetOutputStrategy {
3
- async output() {
4
- return new NullAssetReply();
5
- }
2
+ class NullAssetOutputStrategy {
3
+ async output() {
4
+ return new NullAssetReply();
5
+ }
6
6
  }
7
+ export { NullAssetOutputStrategy };
7
8
 
8
9
  //# sourceMappingURL=NullAssetOutputStrategy.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NullAssetReply","NullAssetOutputStrategy","output"],"sources":["NullAssetOutputStrategy.ts"],"sourcesContent":["import type { AssetOutputStrategy, AssetReply } from \"~/delivery/index.js\";\nimport { NullAssetReply } from \"./NullAssetReply.js\";\n\nexport class NullAssetOutputStrategy implements AssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NullAssetReply();\n }\n}\n"],"mappings":"AACA,SAASA,cAAc;AAEvB,OAAO,MAAMC,uBAAuB,CAAgC;EAChE,MAAMC,MAAMA,CAAA,EAAwB;IAChC,OAAO,IAAIF,cAAc,CAAC,CAAC;EAC/B;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/NullAssetOutputStrategy.js","sources":["../../../src/delivery/AssetDelivery/NullAssetOutputStrategy.ts"],"sourcesContent":["import type { AssetOutputStrategy, AssetReply } from \"~/delivery/index.js\";\nimport { NullAssetReply } from \"./NullAssetReply.js\";\n\nexport class NullAssetOutputStrategy implements AssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NullAssetReply();\n }\n}\n"],"names":["NullAssetOutputStrategy","NullAssetReply"],"mappings":";AAGO,MAAMA;IACT,MAAM,SAA8B;QAChC,OAAO,IAAIC;IACf;AACJ"}
@@ -1,13 +1,14 @@
1
1
  import { AssetReply } from "./abstractions/AssetReply.js";
2
- export class NullAssetReply extends AssetReply {
3
- constructor() {
4
- super({
5
- code: 404,
6
- body: () => ({
7
- error: "Asset output strategy is not implemented!"
8
- })
9
- });
10
- }
2
+ class NullAssetReply extends AssetReply {
3
+ constructor(){
4
+ super({
5
+ code: 404,
6
+ body: ()=>({
7
+ error: "Asset output strategy is not implemented!"
8
+ })
9
+ });
10
+ }
11
11
  }
12
+ export { NullAssetReply };
12
13
 
13
14
  //# sourceMappingURL=NullAssetReply.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AssetReply","NullAssetReply","constructor","code","body","error"],"sources":["NullAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\n\nexport class NullAssetReply extends AssetReply {\n constructor() {\n super({\n code: 404,\n body: () => ({ error: \"Asset output strategy is not implemented!\" })\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU;AAEnB,OAAO,MAAMC,cAAc,SAASD,UAAU,CAAC;EAC3CE,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC;MACFC,IAAI,EAAE,GAAG;MACTC,IAAI,EAAEA,CAAA,MAAO;QAAEC,KAAK,EAAE;MAA4C,CAAC;IACvE,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/NullAssetReply.js","sources":["../../../src/delivery/AssetDelivery/NullAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\n\nexport class NullAssetReply extends AssetReply {\n constructor() {\n super({\n code: 404,\n body: () => ({ error: \"Asset output strategy is not implemented!\" })\n });\n }\n}\n"],"names":["NullAssetReply","AssetReply"],"mappings":";AAEO,MAAMA,uBAAuBC;IAChC,aAAc;QACV,KAAK,CAAC;YACF,MAAM;YACN,MAAM,IAAO;oBAAE,OAAO;gBAA4C;QACtE;IACJ;AACJ"}
@@ -1,7 +1,8 @@
1
- export class NullAssetResolver {
2
- resolve() {
3
- return Promise.resolve(undefined);
4
- }
1
+ class NullAssetResolver {
2
+ resolve() {
3
+ return Promise.resolve(void 0);
4
+ }
5
5
  }
6
+ export { NullAssetResolver };
6
7
 
7
8
  //# sourceMappingURL=NullAssetResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NullAssetResolver","resolve","Promise","undefined"],"sources":["NullAssetResolver.ts"],"sourcesContent":["import type { AssetResolver } from \"./abstractions/AssetResolver.js\";\nimport type { Asset } from \"./Asset.js\";\n\nexport class NullAssetResolver implements AssetResolver {\n resolve(): Promise<Asset | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAA0B;EACpDC,OAAOA,CAAA,EAA+B;IAClC,OAAOC,OAAO,CAACD,OAAO,CAACE,SAAS,CAAC;EACrC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/NullAssetResolver.js","sources":["../../../src/delivery/AssetDelivery/NullAssetResolver.ts"],"sourcesContent":["import type { AssetResolver } from \"./abstractions/AssetResolver.js\";\nimport type { Asset } from \"./Asset.js\";\n\nexport class NullAssetResolver implements AssetResolver {\n resolve(): Promise<Asset | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"names":["NullAssetResolver","Promise","undefined"],"mappings":"AAGO,MAAMA;IACT,UAAsC;QAClC,OAAOC,QAAQ,OAAO,CAACC;IAC3B;AACJ"}
@@ -1,7 +1,8 @@
1
- export class NullRequestResolver {
2
- resolve() {
3
- return Promise.resolve(undefined);
4
- }
1
+ class NullRequestResolver {
2
+ resolve() {
3
+ return Promise.resolve(void 0);
4
+ }
5
5
  }
6
+ export { NullRequestResolver };
6
7
 
7
8
  //# sourceMappingURL=NullRequestResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NullRequestResolver","resolve","Promise","undefined"],"sources":["NullRequestResolver.ts"],"sourcesContent":["import type { AssetRequest, AssetRequestResolver } from \"~/delivery/index.js\";\n\nexport class NullRequestResolver implements AssetRequestResolver {\n resolve(): Promise<AssetRequest | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,mBAAmB,CAAiC;EAC7DC,OAAOA,CAAA,EAAsC;IACzC,OAAOC,OAAO,CAACD,OAAO,CAACE,SAAS,CAAC;EACrC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"delivery/AssetDelivery/NullRequestResolver.js","sources":["../../../src/delivery/AssetDelivery/NullRequestResolver.ts"],"sourcesContent":["import type { AssetRequest, AssetRequestResolver } from \"~/delivery/index.js\";\n\nexport class NullRequestResolver implements AssetRequestResolver {\n resolve(): Promise<AssetRequest | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"names":["NullRequestResolver","Promise","undefined"],"mappings":"AAEO,MAAMA;IACT,UAA6C;QACzC,OAAOC,QAAQ,OAAO,CAACC;IAC3B;AACJ"}
@@ -1,18 +1,15 @@
1
- export class SetCacheControlHeaders {
2
- constructor(headers, strategy) {
3
- this.headers = headers;
4
- this.strategy = strategy;
5
- }
6
- async output(asset) {
7
- if (!this.strategy) {
8
- throw Error(`No asset output strategy is configured!`);
1
+ class SetCacheControlHeaders {
2
+ constructor(headers, strategy){
3
+ this.headers = headers;
4
+ this.strategy = strategy;
5
+ }
6
+ async output(asset) {
7
+ if (!this.strategy) throw Error("No asset output strategy is configured!");
8
+ const reply = await this.strategy.output(asset);
9
+ reply.setHeaders((headers)=>headers.merge(this.headers));
10
+ return reply;
9
11
  }
10
- const reply = await this.strategy.output(asset);
11
- reply.setHeaders(headers => {
12
- return headers.merge(this.headers);
13
- });
14
- return reply;
15
- }
16
12
  }
13
+ export { SetCacheControlHeaders };
17
14
 
18
15
  //# sourceMappingURL=SetCacheControlHeaders.js.map