@strapi/upload 5.58.0 → 5.59.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 (226) hide show
  1. package/dist/admin/components/MediaLibraryInput/AddAssetMenu.js +141 -0
  2. package/dist/admin/components/MediaLibraryInput/AddAssetMenu.js.map +1 -0
  3. package/dist/admin/components/MediaLibraryInput/AddAssetMenu.mjs +139 -0
  4. package/dist/admin/components/MediaLibraryInput/AddAssetMenu.mjs.map +1 -0
  5. package/dist/admin/components/MediaLibraryInput/AssetDropZone.js +129 -0
  6. package/dist/admin/components/MediaLibraryInput/AssetDropZone.js.map +1 -0
  7. package/dist/admin/components/MediaLibraryInput/AssetDropZone.mjs +127 -0
  8. package/dist/admin/components/MediaLibraryInput/AssetDropZone.mjs.map +1 -0
  9. package/dist/admin/components/MediaLibraryInput/AssetRow.js +144 -0
  10. package/dist/admin/components/MediaLibraryInput/AssetRow.js.map +1 -0
  11. package/dist/admin/components/MediaLibraryInput/AssetRow.mjs +142 -0
  12. package/dist/admin/components/MediaLibraryInput/AssetRow.mjs.map +1 -0
  13. package/dist/admin/components/MediaLibraryInput/MediaLibraryInput.js +397 -0
  14. package/dist/admin/components/MediaLibraryInput/MediaLibraryInput.js.map +1 -0
  15. package/dist/admin/components/MediaLibraryInput/MediaLibraryInput.mjs +395 -0
  16. package/dist/admin/components/MediaLibraryInput/MediaLibraryInput.mjs.map +1 -0
  17. package/dist/admin/components/MediaLibraryInput/NoLibraryAccessDialog.js +45 -0
  18. package/dist/admin/components/MediaLibraryInput/NoLibraryAccessDialog.js.map +1 -0
  19. package/dist/admin/components/MediaLibraryInput/NoLibraryAccessDialog.mjs +43 -0
  20. package/dist/admin/components/MediaLibraryInput/NoLibraryAccessDialog.mjs.map +1 -0
  21. package/dist/admin/hooks/useAIMetadataAvailability.js +5 -1
  22. package/dist/admin/hooks/useAIMetadataAvailability.js.map +1 -1
  23. package/dist/admin/hooks/useAIMetadataAvailability.mjs +5 -1
  24. package/dist/admin/hooks/useAIMetadataAvailability.mjs.map +1 -1
  25. package/dist/admin/hooks/useAIMetadataEnabled.js +7 -1
  26. package/dist/admin/hooks/useAIMetadataEnabled.js.map +1 -1
  27. package/dist/admin/hooks/useAIMetadataEnabled.mjs +7 -1
  28. package/dist/admin/hooks/useAIMetadataEnabled.mjs.map +1 -1
  29. package/dist/admin/hooks/useMediaLibraryPermissions.js +4 -0
  30. package/dist/admin/hooks/useMediaLibraryPermissions.js.map +1 -1
  31. package/dist/admin/hooks/useMediaLibraryPermissions.mjs +4 -0
  32. package/dist/admin/hooks/useMediaLibraryPermissions.mjs.map +1 -1
  33. package/dist/admin/hooks/useTracking.js +5 -1
  34. package/dist/admin/hooks/useTracking.js.map +1 -1
  35. package/dist/admin/hooks/useTracking.mjs +5 -1
  36. package/dist/admin/hooks/useTracking.mjs.map +1 -1
  37. package/dist/admin/index.js +7 -2
  38. package/dist/admin/index.js.map +1 -1
  39. package/dist/admin/index.mjs +7 -2
  40. package/dist/admin/index.mjs.map +1 -1
  41. package/dist/admin/legacy/components/AssetCard/AssetCardBase.js.map +1 -1
  42. package/dist/admin/legacy/components/AssetCard/AssetCardBase.mjs.map +1 -1
  43. package/dist/admin/legacy/components/AssetCard/VideoPreview.js +2 -1
  44. package/dist/admin/legacy/components/AssetCard/VideoPreview.js.map +1 -1
  45. package/dist/admin/legacy/components/AssetCard/VideoPreview.mjs +2 -1
  46. package/dist/admin/legacy/components/AssetCard/VideoPreview.mjs.map +1 -1
  47. package/dist/admin/legacy/components/AssetDialog/AssetDialog.js +3 -1
  48. package/dist/admin/legacy/components/AssetDialog/AssetDialog.js.map +1 -1
  49. package/dist/admin/legacy/components/AssetDialog/AssetDialog.mjs +3 -1
  50. package/dist/admin/legacy/components/AssetDialog/AssetDialog.mjs.map +1 -1
  51. package/dist/admin/legacy/components/AssetDialog/BrowseStep/BrowseStep.js +3 -1
  52. package/dist/admin/legacy/components/AssetDialog/BrowseStep/BrowseStep.js.map +1 -1
  53. package/dist/admin/legacy/components/AssetDialog/BrowseStep/BrowseStep.mjs +3 -1
  54. package/dist/admin/legacy/components/AssetDialog/BrowseStep/BrowseStep.mjs.map +1 -1
  55. package/dist/admin/legacy/components/AssetDialog/BrowseStep/Filters.js.map +1 -1
  56. package/dist/admin/legacy/components/AssetDialog/BrowseStep/Filters.mjs.map +1 -1
  57. package/dist/admin/legacy/components/AssetGridList/AssetGridList.js +7 -6
  58. package/dist/admin/legacy/components/AssetGridList/AssetGridList.js.map +1 -1
  59. package/dist/admin/legacy/components/AssetGridList/AssetGridList.mjs +7 -6
  60. package/dist/admin/legacy/components/AssetGridList/AssetGridList.mjs.map +1 -1
  61. package/dist/admin/legacy/components/Breadcrumbs/CrumbSimpleMenuAsync.js +2 -1
  62. package/dist/admin/legacy/components/Breadcrumbs/CrumbSimpleMenuAsync.js.map +1 -1
  63. package/dist/admin/legacy/components/Breadcrumbs/CrumbSimpleMenuAsync.mjs +2 -1
  64. package/dist/admin/legacy/components/Breadcrumbs/CrumbSimpleMenuAsync.mjs.map +1 -1
  65. package/dist/admin/legacy/components/BulkMoveDialog/BulkMoveDialog.js +2 -1
  66. package/dist/admin/legacy/components/BulkMoveDialog/BulkMoveDialog.js.map +1 -1
  67. package/dist/admin/legacy/components/BulkMoveDialog/BulkMoveDialog.mjs +2 -1
  68. package/dist/admin/legacy/components/BulkMoveDialog/BulkMoveDialog.mjs.map +1 -1
  69. package/dist/admin/legacy/components/EditAssetDialog/EditAssetContent.js +3 -1
  70. package/dist/admin/legacy/components/EditAssetDialog/EditAssetContent.js.map +1 -1
  71. package/dist/admin/legacy/components/EditAssetDialog/EditAssetContent.mjs +3 -1
  72. package/dist/admin/legacy/components/EditAssetDialog/EditAssetContent.mjs.map +1 -1
  73. package/dist/admin/legacy/components/FilterList/FilterList.js.map +1 -1
  74. package/dist/admin/legacy/components/FilterList/FilterList.mjs.map +1 -1
  75. package/dist/admin/legacy/components/FilterPopover/FilterPopover.js.map +1 -1
  76. package/dist/admin/legacy/components/FilterPopover/FilterPopover.mjs.map +1 -1
  77. package/dist/admin/legacy/components/FilterPopover/FilterValueInput.js +2 -1
  78. package/dist/admin/legacy/components/FilterPopover/FilterValueInput.js.map +1 -1
  79. package/dist/admin/legacy/components/FilterPopover/FilterValueInput.mjs +2 -1
  80. package/dist/admin/legacy/components/FilterPopover/FilterValueInput.mjs.map +1 -1
  81. package/dist/admin/legacy/components/MediaLibraryDialog/MediaLibraryDialog.js +4 -2
  82. package/dist/admin/legacy/components/MediaLibraryDialog/MediaLibraryDialog.js.map +1 -1
  83. package/dist/admin/legacy/components/MediaLibraryDialog/MediaLibraryDialog.mjs +4 -2
  84. package/dist/admin/legacy/components/MediaLibraryDialog/MediaLibraryDialog.mjs.map +1 -1
  85. package/dist/admin/legacy/components/MediaLibraryInput/MediaLibraryInput.js +2 -1
  86. package/dist/admin/legacy/components/MediaLibraryInput/MediaLibraryInput.js.map +1 -1
  87. package/dist/admin/legacy/components/MediaLibraryInput/MediaLibraryInput.mjs +2 -1
  88. package/dist/admin/legacy/components/MediaLibraryInput/MediaLibraryInput.mjs.map +1 -1
  89. package/dist/admin/legacy/components/SelectTree/SelectTree.js +3 -1
  90. package/dist/admin/legacy/components/SelectTree/SelectTree.js.map +1 -1
  91. package/dist/admin/legacy/components/SelectTree/SelectTree.mjs +3 -1
  92. package/dist/admin/legacy/components/SelectTree/SelectTree.mjs.map +1 -1
  93. package/dist/admin/legacy/components/TableList/TableList.js +3 -1
  94. package/dist/admin/legacy/components/TableList/TableList.js.map +1 -1
  95. package/dist/admin/legacy/components/TableList/TableList.mjs +3 -1
  96. package/dist/admin/legacy/components/TableList/TableList.mjs.map +1 -1
  97. package/dist/admin/legacy/components/TableList/TableRows.js +3 -1
  98. package/dist/admin/legacy/components/TableList/TableRows.js.map +1 -1
  99. package/dist/admin/legacy/components/TableList/TableRows.mjs +3 -1
  100. package/dist/admin/legacy/components/TableList/TableRows.mjs.map +1 -1
  101. package/dist/admin/legacy/components/UploadAssetDialog/UploadAssetDialog.js +3 -1
  102. package/dist/admin/legacy/components/UploadAssetDialog/UploadAssetDialog.js.map +1 -1
  103. package/dist/admin/legacy/components/UploadAssetDialog/UploadAssetDialog.mjs +3 -1
  104. package/dist/admin/legacy/components/UploadAssetDialog/UploadAssetDialog.mjs.map +1 -1
  105. package/dist/admin/legacy/pages/App/ConfigureTheView/ConfigureTheView.js.map +1 -1
  106. package/dist/admin/legacy/pages/App/ConfigureTheView/ConfigureTheView.mjs.map +1 -1
  107. package/dist/admin/legacy/pages/App/components/BulkActions.js +2 -1
  108. package/dist/admin/legacy/pages/App/components/BulkActions.js.map +1 -1
  109. package/dist/admin/legacy/pages/App/components/BulkActions.mjs +2 -1
  110. package/dist/admin/legacy/pages/App/components/BulkActions.mjs.map +1 -1
  111. package/dist/admin/legacy/pages/App/components/BulkMoveButton.js +2 -1
  112. package/dist/admin/legacy/pages/App/components/BulkMoveButton.js.map +1 -1
  113. package/dist/admin/legacy/pages/App/components/BulkMoveButton.mjs +2 -1
  114. package/dist/admin/legacy/pages/App/components/BulkMoveButton.mjs.map +1 -1
  115. package/dist/admin/pages/Assets/components/AssetsGrid.js +2 -1
  116. package/dist/admin/pages/Assets/components/AssetsGrid.js.map +1 -1
  117. package/dist/admin/pages/Assets/components/AssetsGrid.mjs +2 -1
  118. package/dist/admin/pages/Assets/components/AssetsGrid.mjs.map +1 -1
  119. package/dist/admin/pages/Assets/components/AssetsTable.js +2 -1
  120. package/dist/admin/pages/Assets/components/AssetsTable.js.map +1 -1
  121. package/dist/admin/pages/Assets/components/AssetsTable.mjs +2 -1
  122. package/dist/admin/pages/Assets/components/AssetsTable.mjs.map +1 -1
  123. package/dist/admin/pages/Assets/components/BulkActionsBar.js +3 -1
  124. package/dist/admin/pages/Assets/components/BulkActionsBar.js.map +1 -1
  125. package/dist/admin/pages/Assets/components/BulkActionsBar.mjs +3 -1
  126. package/dist/admin/pages/Assets/components/BulkActionsBar.mjs.map +1 -1
  127. package/dist/admin/pages/Assets/components/DateRangeCalendar.js +10 -7
  128. package/dist/admin/pages/Assets/components/DateRangeCalendar.js.map +1 -1
  129. package/dist/admin/pages/Assets/components/DateRangeCalendar.mjs +10 -7
  130. package/dist/admin/pages/Assets/components/DateRangeCalendar.mjs.map +1 -1
  131. package/dist/admin/pages/Assets/components/DropZone/UploadDropZoneContext.js +4 -2
  132. package/dist/admin/pages/Assets/components/DropZone/UploadDropZoneContext.js.map +1 -1
  133. package/dist/admin/pages/Assets/components/DropZone/UploadDropZoneContext.mjs +5 -3
  134. package/dist/admin/pages/Assets/components/DropZone/UploadDropZoneContext.mjs.map +1 -1
  135. package/dist/admin/pages/Assets/components/FilterBadges.js +32 -3
  136. package/dist/admin/pages/Assets/components/FilterBadges.js.map +1 -1
  137. package/dist/admin/pages/Assets/components/FilterBadges.mjs +33 -4
  138. package/dist/admin/pages/Assets/components/FilterBadges.mjs.map +1 -1
  139. package/dist/admin/services/api.js +15 -5
  140. package/dist/admin/services/api.js.map +1 -1
  141. package/dist/admin/services/api.mjs +15 -5
  142. package/dist/admin/services/api.mjs.map +1 -1
  143. package/dist/admin/src/components/MediaLibraryInput/AddAssetMenu.d.ts +19 -0
  144. package/dist/admin/src/components/MediaLibraryInput/AssetDropZone.d.ts +13 -0
  145. package/dist/admin/src/components/MediaLibraryInput/AssetRow.d.ts +15 -0
  146. package/dist/admin/src/components/MediaLibraryInput/MediaLibraryInput.d.ts +26 -0
  147. package/dist/admin/src/components/MediaLibraryInput/NoLibraryAccessDialog.d.ts +10 -0
  148. package/dist/admin/src/hooks/useMediaLibraryPermissions.d.ts +1 -0
  149. package/dist/admin/src/legacy/components/BulkMoveDialog/BulkMoveDialog.d.ts +1 -1
  150. package/dist/admin/src/legacy/pages/App/components/BulkActions.d.ts +1 -1
  151. package/dist/admin/src/services/api.d.ts +6 -0
  152. package/dist/admin/src/utils/allowedMediaTypes.d.ts +16 -0
  153. package/dist/admin/translations/ca.json.js +3 -3
  154. package/dist/admin/translations/ca.json.mjs +3 -3
  155. package/dist/admin/translations/da.json.js +1 -1
  156. package/dist/admin/translations/da.json.mjs +1 -1
  157. package/dist/admin/translations/de.json.js +1 -1
  158. package/dist/admin/translations/de.json.mjs +1 -1
  159. package/dist/admin/translations/en.json.js +9 -0
  160. package/dist/admin/translations/en.json.js.map +1 -1
  161. package/dist/admin/translations/en.json.mjs +9 -0
  162. package/dist/admin/translations/en.json.mjs.map +1 -1
  163. package/dist/admin/translations/es.json.js +1 -1
  164. package/dist/admin/translations/es.json.mjs +1 -1
  165. package/dist/admin/translations/sk.json.js +2 -2
  166. package/dist/admin/translations/sk.json.mjs +2 -2
  167. package/dist/admin/translations/tr.json.js +2 -2
  168. package/dist/admin/translations/tr.json.mjs +2 -2
  169. package/dist/admin/translations/zh-Hans.json.js +1 -1
  170. package/dist/admin/translations/zh-Hans.json.mjs +1 -1
  171. package/dist/admin/translations/zh.json.js +2 -2
  172. package/dist/admin/translations/zh.json.mjs +2 -2
  173. package/dist/admin/utils/allowedMediaTypes.js +42 -0
  174. package/dist/admin/utils/allowedMediaTypes.js.map +1 -0
  175. package/dist/admin/utils/allowedMediaTypes.mjs +39 -0
  176. package/dist/admin/utils/allowedMediaTypes.mjs.map +1 -0
  177. package/dist/server/config.js +6 -0
  178. package/dist/server/config.js.map +1 -1
  179. package/dist/server/config.mjs +6 -0
  180. package/dist/server/config.mjs.map +1 -1
  181. package/dist/server/controllers/validation/admin/upload.js.map +1 -1
  182. package/dist/server/controllers/validation/admin/upload.mjs.map +1 -1
  183. package/dist/server/controllers/validation/content-api/upload.js.map +1 -1
  184. package/dist/server/controllers/validation/content-api/upload.mjs.map +1 -1
  185. package/dist/server/mcp/ambient-instance.js +7 -5
  186. package/dist/server/mcp/ambient-instance.js.map +1 -1
  187. package/dist/server/mcp/ambient-instance.mjs +7 -5
  188. package/dist/server/mcp/ambient-instance.mjs.map +1 -1
  189. package/dist/server/mcp/handlers/folder-handlers.js +4 -16
  190. package/dist/server/mcp/handlers/folder-handlers.js.map +1 -1
  191. package/dist/server/mcp/handlers/folder-handlers.mjs +5 -17
  192. package/dist/server/mcp/handlers/folder-handlers.mjs.map +1 -1
  193. package/dist/server/mcp/handlers/read-handlers.js +6 -14
  194. package/dist/server/mcp/handlers/read-handlers.js.map +1 -1
  195. package/dist/server/mcp/handlers/read-handlers.mjs +7 -15
  196. package/dist/server/mcp/handlers/read-handlers.mjs.map +1 -1
  197. package/dist/server/mcp/handlers/write-handlers.js +3 -13
  198. package/dist/server/mcp/handlers/write-handlers.js.map +1 -1
  199. package/dist/server/mcp/handlers/write-handlers.mjs +3 -13
  200. package/dist/server/mcp/handlers/write-handlers.mjs.map +1 -1
  201. package/dist/server/mcp/register-upload-mcp-tools.js +215 -195
  202. package/dist/server/mcp/register-upload-mcp-tools.js.map +1 -1
  203. package/dist/server/mcp/register-upload-mcp-tools.mjs +215 -195
  204. package/dist/server/mcp/register-upload-mcp-tools.mjs.map +1 -1
  205. package/dist/server/services/image-manipulation.js +33 -14
  206. package/dist/server/services/image-manipulation.js.map +1 -1
  207. package/dist/server/services/image-manipulation.mjs +33 -14
  208. package/dist/server/services/image-manipulation.mjs.map +1 -1
  209. package/dist/server/src/config.d.ts +3 -0
  210. package/dist/server/src/config.d.ts.map +1 -1
  211. package/dist/server/src/controllers/validation/admin/upload.d.ts.map +1 -1
  212. package/dist/server/src/controllers/validation/content-api/upload.d.ts.map +1 -1
  213. package/dist/server/src/index.d.ts +3 -0
  214. package/dist/server/src/index.d.ts.map +1 -1
  215. package/dist/server/src/mcp/ambient-instance.d.ts +7 -5
  216. package/dist/server/src/mcp/ambient-instance.d.ts.map +1 -1
  217. package/dist/server/src/mcp/handlers/folder-handlers.d.ts.map +1 -1
  218. package/dist/server/src/mcp/handlers/read-handlers.d.ts +3 -2
  219. package/dist/server/src/mcp/handlers/read-handlers.d.ts.map +1 -1
  220. package/dist/server/src/mcp/handlers/write-handlers.d.ts.map +1 -1
  221. package/dist/server/src/mcp/register-upload-mcp-tools.d.ts +9 -14
  222. package/dist/server/src/mcp/register-upload-mcp-tools.d.ts.map +1 -1
  223. package/dist/server/src/services/image-manipulation.d.ts.map +1 -1
  224. package/dist/server/src/types.d.ts +1 -0
  225. package/dist/server/src/types.d.ts.map +1 -1
  226. package/package.json +6 -6
@@ -101,7 +101,7 @@ var sk = {
101
101
  "input.url.label": "URL",
102
102
  "input.url.placeholder": "Prázdne",
103
103
  "input.notification.not-supported": "Tento typ súboru nemôžete nahrať, akceptované sú iba nasledujúce typy – {fileTypes}",
104
- "list.assets.title": "Súbory",
104
+ "list.assets.title": "Súbory ({count})",
105
105
  "list.asset.at.finished": "Načítavanie súbor ukončené.",
106
106
  "list.assets-empty.search": "Žiadne výsledky",
107
107
  "list.assets-empty.subtitle": "Pridať jeden do zoznamu.",
@@ -122,7 +122,7 @@ var sk = {
122
122
  "list.folder.edit": "Upraviť priečinok",
123
123
  "list.folder.select": "Vybrať priečinok {name}",
124
124
  "list.folder.subtitle": "{folderCount, plural, one {# priečinok} few {# priečinky} other {# priečinkov}}, {filesCount, plural, one {# súbor} few {# súbory} other {# súborov}}",
125
- "list.folders.title": "Priečinky",
125
+ "list.folders.title": "Priečinky ({count})",
126
126
  "list.folders.link-label": "Prístup k priečinku",
127
127
  "mediaLibraryInput.actions.nextSlide": "Ďalší slide",
128
128
  "mediaLibraryInput.actions.previousSlide": "Predošlý slide",
@@ -99,7 +99,7 @@ var sk = {
99
99
  "input.url.label": "URL",
100
100
  "input.url.placeholder": "Prázdne",
101
101
  "input.notification.not-supported": "Tento typ súboru nemôžete nahrať, akceptované sú iba nasledujúce typy – {fileTypes}",
102
- "list.assets.title": "Súbory",
102
+ "list.assets.title": "Súbory ({count})",
103
103
  "list.asset.at.finished": "Načítavanie súbor ukončené.",
104
104
  "list.assets-empty.search": "Žiadne výsledky",
105
105
  "list.assets-empty.subtitle": "Pridať jeden do zoznamu.",
@@ -120,7 +120,7 @@ var sk = {
120
120
  "list.folder.edit": "Upraviť priečinok",
121
121
  "list.folder.select": "Vybrať priečinok {name}",
122
122
  "list.folder.subtitle": "{folderCount, plural, one {# priečinok} few {# priečinky} other {# priečinkov}}, {filesCount, plural, one {# súbor} few {# súbory} other {# súborov}}",
123
- "list.folders.title": "Priečinky",
123
+ "list.folders.title": "Priečinky ({count})",
124
124
  "list.folders.link-label": "Prístup k priečinku",
125
125
  "mediaLibraryInput.actions.nextSlide": "Ďalší slide",
126
126
  "mediaLibraryInput.actions.previousSlide": "Predošlý slide",
@@ -40,7 +40,7 @@ var tr = {
40
40
  "input.placeholder.icon": "Dosyayı bu bölgeye bırak",
41
41
  "input.url.description": "URL bağlantıları arasına yeni bir satır ekle.",
42
42
  "input.url.label": "URL",
43
- "list.assets.title": "Dosyalar",
43
+ "list.assets.title": "Dosyalar ({count})",
44
44
  "list.asset.at.finished": "Dosyaların yüklenmesi tamamlandı.",
45
45
  "list.assets-empty.search": "Sonuç bulunamadı",
46
46
  "list.assets-empty.subtitle": "Listeye bir tane ekle.",
@@ -57,7 +57,7 @@ var tr = {
57
57
  "list.assets.to-upload": "{number} yüklenmeye hazır",
58
58
  "list.folder.edit": "Klasörü düzenle",
59
59
  "list.folder.subtitle": "{folderCount} klasör, {filesCount} dosya",
60
- "list.folders.title": "Klasörler",
60
+ "list.folders.title": "Klasörler ({count})",
61
61
  "mediaLibraryInput.actions.nextSlide": "Sonraki slayt",
62
62
  "mediaLibraryInput.actions.previousSlide": "Önceki slayt",
63
63
  "mediaLibraryInput.placeholder": "Dosya yüklemek için tıkla ya da bu alana sürükle ve bırak",
@@ -38,7 +38,7 @@ var tr = {
38
38
  "input.placeholder.icon": "Dosyayı bu bölgeye bırak",
39
39
  "input.url.description": "URL bağlantıları arasına yeni bir satır ekle.",
40
40
  "input.url.label": "URL",
41
- "list.assets.title": "Dosyalar",
41
+ "list.assets.title": "Dosyalar ({count})",
42
42
  "list.asset.at.finished": "Dosyaların yüklenmesi tamamlandı.",
43
43
  "list.assets-empty.search": "Sonuç bulunamadı",
44
44
  "list.assets-empty.subtitle": "Listeye bir tane ekle.",
@@ -55,7 +55,7 @@ var tr = {
55
55
  "list.assets.to-upload": "{number} yüklenmeye hazır",
56
56
  "list.folder.edit": "Klasörü düzenle",
57
57
  "list.folder.subtitle": "{folderCount} klasör, {filesCount} dosya",
58
- "list.folders.title": "Klasörler",
58
+ "list.folders.title": "Klasörler ({count})",
59
59
  "mediaLibraryInput.actions.nextSlide": "Sonraki slayt",
60
60
  "mediaLibraryInput.actions.previousSlide": "Önceki slayt",
61
61
  "mediaLibraryInput.placeholder": "Dosya yüklemek için tıkla ya da bu alana sürükle ve bırak",
@@ -42,7 +42,7 @@ var zhHans = {
42
42
  "list.assets.loading-asset": "正在为媒体加载预览: {path}",
43
43
  "list.assets.not-supported-content": "无可用预览",
44
44
  "list.assets.preview-asset": "预览视频(路径:{path})",
45
- "list.assets.selected": "{number, plural, one {# 个素材} other {# 个素材}}准备上传",
45
+ "list.assets.selected": "{numberFolders, plural, other {# 个文件夹}} - {numberAssets, plural, other {# 个素材}}",
46
46
  "list.assets.type-not-allowed": "文件类型不合法",
47
47
  "list.table.header.actions": "操作",
48
48
  "list.table.header.preview": "预览",
@@ -40,7 +40,7 @@ var zhHans = {
40
40
  "list.assets.loading-asset": "正在为媒体加载预览: {path}",
41
41
  "list.assets.not-supported-content": "无可用预览",
42
42
  "list.assets.preview-asset": "预览视频(路径:{path})",
43
- "list.assets.selected": "{number, plural, one {# 个素材} other {# 个素材}}准备上传",
43
+ "list.assets.selected": "{numberFolders, plural, other {# 个文件夹}} - {numberAssets, plural, other {# 个素材}}",
44
44
  "list.assets.type-not-allowed": "文件类型不合法",
45
45
  "list.table.header.actions": "操作",
46
46
  "list.table.header.preview": "预览",
@@ -43,7 +43,7 @@ var zh = {
43
43
  "input.placeholder.icon": "將素材拖曳至此區域",
44
44
  "input.url.description": "以跳行符號分隔連結",
45
45
  "input.url.label": "連結",
46
- "list.assets.title": "素材",
46
+ "list.assets.title": "素材({count})",
47
47
  "list.asset.at.finished": "素材已完成載入。",
48
48
  "list.assets-empty.search": "找不到結果",
49
49
  "list.assets-empty.subtitle": "從開頭新增",
@@ -60,7 +60,7 @@ var zh = {
60
60
  "list.assets.to-upload": "{number, plural, =0 {沒有} one {1 個} other {# 個}}素材準備上傳",
61
61
  "list.folder.edit": "編輯資料夾",
62
62
  "list.folder.subtitle": "{folderCount, plural, =0 {# 資料夾} one {# 資料夾} other {# 資料夾}}, {filesCount, plural, =0 {# 素材} one {# 素材} other {# 素材}}",
63
- "list.folders.title": "資料夾",
63
+ "list.folders.title": "資料夾({count})",
64
64
  "mediaLibraryInput.actions.nextSlide": "下一張投影片",
65
65
  "mediaLibraryInput.actions.previousSlide": "上一張投影片",
66
66
  "mediaLibraryInput.placeholder": "點擊以新增素材,或拖曳至此區域",
@@ -41,7 +41,7 @@ var zh = {
41
41
  "input.placeholder.icon": "將素材拖曳至此區域",
42
42
  "input.url.description": "以跳行符號分隔連結",
43
43
  "input.url.label": "連結",
44
- "list.assets.title": "素材",
44
+ "list.assets.title": "素材({count})",
45
45
  "list.asset.at.finished": "素材已完成載入。",
46
46
  "list.assets-empty.search": "找不到結果",
47
47
  "list.assets-empty.subtitle": "從開頭新增",
@@ -58,7 +58,7 @@ var zh = {
58
58
  "list.assets.to-upload": "{number, plural, =0 {沒有} one {1 個} other {# 個}}素材準備上傳",
59
59
  "list.folder.edit": "編輯資料夾",
60
60
  "list.folder.subtitle": "{folderCount, plural, =0 {# 資料夾} one {# 資料夾} other {# 資料夾}}, {filesCount, plural, =0 {# 素材} one {# 素材} other {# 素材}}",
61
- "list.folders.title": "資料夾",
61
+ "list.folders.title": "資料夾({count})",
62
62
  "mediaLibraryInput.actions.nextSlide": "下一張投影片",
63
63
  "mediaLibraryInput.actions.previousSlide": "上一張投影片",
64
64
  "mediaLibraryInput.placeholder": "點擊以新增素材,或拖曳至此區域",
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * The `allowedTypes` values a `media` attribute can carry, and the mime prefix
5
+ * each one stands for. `files` is the catch-all: anything that is not an image,
6
+ * video or audio.
7
+ */ const MEDIA_KINDS = [
8
+ 'image',
9
+ 'video',
10
+ 'audio'
11
+ ];
12
+ const SINGULAR = {
13
+ files: 'file',
14
+ images: 'image',
15
+ videos: 'video',
16
+ audios: 'audio'
17
+ };
18
+ /**
19
+ * Whether a mime type satisfies a field's `allowedTypes`.
20
+ *
21
+ * No `allowedTypes` means the field takes anything. A file with no mime is only
22
+ * allowed where `files` is, since nothing places it in one of the three media
23
+ * kinds.
24
+ */ const isMediaTypeAllowed = (allowedTypes, mime)=>{
25
+ if (!allowedTypes || allowedTypes.length === 0) {
26
+ return true;
27
+ }
28
+ const singularTypes = new Set(allowedTypes.map((type)=>SINGULAR[type]).filter((type)=>Boolean(type)));
29
+ const kind = mime?.split('/')[0];
30
+ if (!kind) {
31
+ return singularTypes.has('file');
32
+ }
33
+ if (singularTypes.has('file') && !MEDIA_KINDS.includes(kind)) {
34
+ return true;
35
+ }
36
+ return singularTypes.has(kind);
37
+ };
38
+ /** The subset of `files` this field accepts, in the order they were given. */ const filterAllowedFiles = (allowedTypes, files)=>files.filter((file)=>isMediaTypeAllowed(allowedTypes, file.type));
39
+
40
+ exports.filterAllowedFiles = filterAllowedFiles;
41
+ exports.isMediaTypeAllowed = isMediaTypeAllowed;
42
+ //# sourceMappingURL=allowedMediaTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowedMediaTypes.js","sources":["../../../admin/src/utils/allowedMediaTypes.ts"],"sourcesContent":["/**\n * The `allowedTypes` values a `media` attribute can carry, and the mime prefix\n * each one stands for. `files` is the catch-all: anything that is not an image,\n * video or audio.\n */\nexport type AllowedMediaType = 'files' | 'images' | 'videos' | 'audios';\n\nconst MEDIA_KINDS = ['image', 'video', 'audio'] as const;\n\nconst SINGULAR: Record<AllowedMediaType, string> = {\n files: 'file',\n images: 'image',\n videos: 'video',\n audios: 'audio',\n};\n\n/**\n * Whether a mime type satisfies a field's `allowedTypes`.\n *\n * No `allowedTypes` means the field takes anything. A file with no mime is only\n * allowed where `files` is, since nothing places it in one of the three media\n * kinds.\n */\nexport const isMediaTypeAllowed = (\n allowedTypes: AllowedMediaType[] | null | undefined,\n mime: string | undefined\n): boolean => {\n if (!allowedTypes || allowedTypes.length === 0) {\n return true;\n }\n\n const singularTypes = new Set(\n allowedTypes.map((type) => SINGULAR[type]).filter((type): type is string => Boolean(type))\n );\n const kind = mime?.split('/')[0];\n\n if (!kind) {\n return singularTypes.has('file');\n }\n\n if (singularTypes.has('file') && !MEDIA_KINDS.includes(kind as (typeof MEDIA_KINDS)[number])) {\n return true;\n }\n\n return singularTypes.has(kind);\n};\n\n/** The subset of `files` this field accepts, in the order they were given. */\nexport const filterAllowedFiles = (\n allowedTypes: AllowedMediaType[] | null | undefined,\n files: globalThis.File[]\n): globalThis.File[] => files.filter((file) => isMediaTypeAllowed(allowedTypes, file.type));\n"],"names":["MEDIA_KINDS","SINGULAR","files","images","videos","audios","isMediaTypeAllowed","allowedTypes","mime","length","singularTypes","Set","map","type","filter","Boolean","kind","split","has","includes","filterAllowedFiles","file"],"mappings":";;AAAA;;;;AAIC,IAGD,MAAMA,WAAAA,GAAc;AAAC,IAAA,OAAA;AAAS,IAAA,OAAA;AAAS,IAAA;AAAQ,CAAA;AAE/C,MAAMC,QAAAA,GAA6C;IACjDC,KAAAA,EAAO,MAAA;IACPC,MAAAA,EAAQ,OAAA;IACRC,MAAAA,EAAQ,OAAA;IACRC,MAAAA,EAAQ;AACV,CAAA;AAEA;;;;;;AAMC,IACM,MAAMC,kBAAAA,GAAqB,CAChCC,YAAAA,EACAC,IAAAA,GAAAA;AAEA,IAAA,IAAI,CAACD,YAAAA,IAAgBA,YAAAA,CAAaE,MAAM,KAAK,CAAA,EAAG;QAC9C,OAAO,IAAA;AACT,IAAA;AAEA,IAAA,MAAMC,gBAAgB,IAAIC,GAAAA,CACxBJ,YAAAA,CAAaK,GAAG,CAAC,CAACC,IAAAA,GAASZ,QAAQ,CAACY,KAAK,CAAA,CAAEC,MAAM,CAAC,CAACD,OAAyBE,OAAAA,CAAQF,IAAAA,CAAAA,CAAAA,CAAAA;AAEtF,IAAA,MAAMG,IAAAA,GAAOR,IAAAA,EAAMS,KAAAA,CAAM,GAAA,CAAI,CAAC,CAAA,CAAE;AAEhC,IAAA,IAAI,CAACD,IAAAA,EAAM;QACT,OAAON,aAAAA,CAAcQ,GAAG,CAAC,MAAA,CAAA;AAC3B,IAAA;IAEA,IAAIR,aAAAA,CAAcQ,GAAG,CAAC,MAAA,CAAA,IAAW,CAAClB,WAAAA,CAAYmB,QAAQ,CAACH,IAAAA,CAAAA,EAAuC;QAC5F,OAAO,IAAA;AACT,IAAA;IAEA,OAAON,aAAAA,CAAcQ,GAAG,CAACF,IAAAA,CAAAA;AAC3B;AAEA,+EACO,MAAMI,kBAAAA,GAAqB,CAChCb,cACAL,KAAAA,GACsBA,KAAAA,CAAMY,MAAM,CAAC,CAACO,IAAAA,GAASf,kBAAAA,CAAmBC,YAAAA,EAAcc,IAAAA,CAAKR,IAAI,CAAA;;;;;"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The `allowedTypes` values a `media` attribute can carry, and the mime prefix
3
+ * each one stands for. `files` is the catch-all: anything that is not an image,
4
+ * video or audio.
5
+ */ const MEDIA_KINDS = [
6
+ 'image',
7
+ 'video',
8
+ 'audio'
9
+ ];
10
+ const SINGULAR = {
11
+ files: 'file',
12
+ images: 'image',
13
+ videos: 'video',
14
+ audios: 'audio'
15
+ };
16
+ /**
17
+ * Whether a mime type satisfies a field's `allowedTypes`.
18
+ *
19
+ * No `allowedTypes` means the field takes anything. A file with no mime is only
20
+ * allowed where `files` is, since nothing places it in one of the three media
21
+ * kinds.
22
+ */ const isMediaTypeAllowed = (allowedTypes, mime)=>{
23
+ if (!allowedTypes || allowedTypes.length === 0) {
24
+ return true;
25
+ }
26
+ const singularTypes = new Set(allowedTypes.map((type)=>SINGULAR[type]).filter((type)=>Boolean(type)));
27
+ const kind = mime?.split('/')[0];
28
+ if (!kind) {
29
+ return singularTypes.has('file');
30
+ }
31
+ if (singularTypes.has('file') && !MEDIA_KINDS.includes(kind)) {
32
+ return true;
33
+ }
34
+ return singularTypes.has(kind);
35
+ };
36
+ /** The subset of `files` this field accepts, in the order they were given. */ const filterAllowedFiles = (allowedTypes, files)=>files.filter((file)=>isMediaTypeAllowed(allowedTypes, file.type));
37
+
38
+ export { filterAllowedFiles, isMediaTypeAllowed };
39
+ //# sourceMappingURL=allowedMediaTypes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowedMediaTypes.mjs","sources":["../../../admin/src/utils/allowedMediaTypes.ts"],"sourcesContent":["/**\n * The `allowedTypes` values a `media` attribute can carry, and the mime prefix\n * each one stands for. `files` is the catch-all: anything that is not an image,\n * video or audio.\n */\nexport type AllowedMediaType = 'files' | 'images' | 'videos' | 'audios';\n\nconst MEDIA_KINDS = ['image', 'video', 'audio'] as const;\n\nconst SINGULAR: Record<AllowedMediaType, string> = {\n files: 'file',\n images: 'image',\n videos: 'video',\n audios: 'audio',\n};\n\n/**\n * Whether a mime type satisfies a field's `allowedTypes`.\n *\n * No `allowedTypes` means the field takes anything. A file with no mime is only\n * allowed where `files` is, since nothing places it in one of the three media\n * kinds.\n */\nexport const isMediaTypeAllowed = (\n allowedTypes: AllowedMediaType[] | null | undefined,\n mime: string | undefined\n): boolean => {\n if (!allowedTypes || allowedTypes.length === 0) {\n return true;\n }\n\n const singularTypes = new Set(\n allowedTypes.map((type) => SINGULAR[type]).filter((type): type is string => Boolean(type))\n );\n const kind = mime?.split('/')[0];\n\n if (!kind) {\n return singularTypes.has('file');\n }\n\n if (singularTypes.has('file') && !MEDIA_KINDS.includes(kind as (typeof MEDIA_KINDS)[number])) {\n return true;\n }\n\n return singularTypes.has(kind);\n};\n\n/** The subset of `files` this field accepts, in the order they were given. */\nexport const filterAllowedFiles = (\n allowedTypes: AllowedMediaType[] | null | undefined,\n files: globalThis.File[]\n): globalThis.File[] => files.filter((file) => isMediaTypeAllowed(allowedTypes, file.type));\n"],"names":["MEDIA_KINDS","SINGULAR","files","images","videos","audios","isMediaTypeAllowed","allowedTypes","mime","length","singularTypes","Set","map","type","filter","Boolean","kind","split","has","includes","filterAllowedFiles","file"],"mappings":"AAAA;;;;AAIC,IAGD,MAAMA,WAAAA,GAAc;AAAC,IAAA,OAAA;AAAS,IAAA,OAAA;AAAS,IAAA;AAAQ,CAAA;AAE/C,MAAMC,QAAAA,GAA6C;IACjDC,KAAAA,EAAO,MAAA;IACPC,MAAAA,EAAQ,OAAA;IACRC,MAAAA,EAAQ,OAAA;IACRC,MAAAA,EAAQ;AACV,CAAA;AAEA;;;;;;AAMC,IACM,MAAMC,kBAAAA,GAAqB,CAChCC,YAAAA,EACAC,IAAAA,GAAAA;AAEA,IAAA,IAAI,CAACD,YAAAA,IAAgBA,YAAAA,CAAaE,MAAM,KAAK,CAAA,EAAG;QAC9C,OAAO,IAAA;AACT,IAAA;AAEA,IAAA,MAAMC,gBAAgB,IAAIC,GAAAA,CACxBJ,YAAAA,CAAaK,GAAG,CAAC,CAACC,IAAAA,GAASZ,QAAQ,CAACY,KAAK,CAAA,CAAEC,MAAM,CAAC,CAACD,OAAyBE,OAAAA,CAAQF,IAAAA,CAAAA,CAAAA,CAAAA;AAEtF,IAAA,MAAMG,IAAAA,GAAOR,IAAAA,EAAMS,KAAAA,CAAM,GAAA,CAAI,CAAC,CAAA,CAAE;AAEhC,IAAA,IAAI,CAACD,IAAAA,EAAM;QACT,OAAON,aAAAA,CAAcQ,GAAG,CAAC,MAAA,CAAA;AAC3B,IAAA;IAEA,IAAIR,aAAAA,CAAcQ,GAAG,CAAC,MAAA,CAAA,IAAW,CAAClB,WAAAA,CAAYmB,QAAQ,CAACH,IAAAA,CAAAA,EAAuC;QAC5F,OAAO,IAAA;AACT,IAAA;IAEA,OAAON,aAAAA,CAAcQ,GAAG,CAACF,IAAAA,CAAAA;AAC3B;AAEA,+EACO,MAAMI,kBAAAA,GAAqB,CAChCb,cACAL,KAAAA,GACsBA,KAAAA,CAAMY,MAAM,CAAC,CAACO,IAAAA,GAASf,kBAAAA,CAAmBC,YAAAA,EAAcc,IAAAA,CAAKR,IAAI,CAAA;;;;"}
@@ -26,6 +26,12 @@ const config = {
26
26
  assertPositiveInteger('concurrentUploadSize', config.concurrentUploadSize);
27
27
  // Client-side parallelism: upload requests the admin fires at once.
28
28
  assertPositiveInteger('concurrentUploadRequests', config.concurrentUploadRequests);
29
+ // Sharp throws on anything else at every image call, which the upload flow
30
+ // reads as "not an image" and skips processing silently.
31
+ const limitInputPixels = config.sharp?.limitInputPixels;
32
+ if (limitInputPixels != null && typeof limitInputPixels !== 'boolean' && !(Number.isInteger(limitInputPixels) && limitInputPixels >= 0)) {
33
+ throw new Error('upload plugin config: "sharp.limitInputPixels" must be a boolean or an integer greater than or equal to 0 (use env.int() to read it from the environment)');
34
+ }
29
35
  }
30
36
  };
31
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sources":["../../server/src/config.ts"],"sourcesContent":["export const config = {\n default: {\n enabled: true,\n provider: 'local',\n sizeLimit: 1000000000, // 1GB\n actionOptions: {},\n sharp: {\n cache: false,\n concurrency: 1,\n },\n concurrentUploadSize: 1,\n concurrentUploadRequests: 1,\n },\n validator(config: { concurrentUploadSize?: unknown; concurrentUploadRequests?: unknown }) {\n const assertPositiveInteger = (key: string, value: unknown) => {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1) {\n throw new Error(\n `upload plugin config: \"${key}\" must be an integer greater than or equal to 1`\n );\n }\n };\n\n // Server-side ceiling: files processed in parallel within one request.\n assertPositiveInteger('concurrentUploadSize', config.concurrentUploadSize);\n // Client-side parallelism: upload requests the admin fires at once.\n assertPositiveInteger('concurrentUploadRequests', config.concurrentUploadRequests);\n },\n};\n"],"names":["config","default","enabled","provider","sizeLimit","actionOptions","sharp","cache","concurrency","concurrentUploadSize","concurrentUploadRequests","validator","assertPositiveInteger","key","value","undefined","Number","isInteger","Error"],"mappings":";;MAAaA,MAAAA,GAAS;IACpBC,OAAAA,EAAS;QACPC,OAAAA,EAAS,IAAA;QACTC,QAAAA,EAAU,OAAA;QACVC,SAAAA,EAAW,UAAA;AACXC,QAAAA,aAAAA,EAAe,EAAC;QAChBC,KAAAA,EAAO;YACLC,KAAAA,EAAO,KAAA;YACPC,WAAAA,EAAa;AACf,SAAA;QACAC,oBAAAA,EAAsB,CAAA;QACtBC,wBAAAA,EAA0B;AAC5B,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUX,MAA8E,EAAA;QACtF,MAAMY,qBAAAA,GAAwB,CAACC,GAAAA,EAAaC,KAAAA,GAAAA;AAC1C,YAAA,IAAIA,UAAUC,SAAAA,EAAW;AACvB,gBAAA;AACF,YAAA;YACA,IAAI,OAAOD,UAAU,QAAA,IAAY,CAACE,OAAOC,SAAS,CAACH,KAAAA,CAAAA,IAAUA,KAAAA,GAAQ,CAAA,EAAG;AACtE,gBAAA,MAAM,IAAII,KAAAA,CACR,CAAC,uBAAuB,EAAEL,GAAAA,CAAI,+CAA+C,CAAC,CAAA;AAElF,YAAA;AACF,QAAA,CAAA;;QAGAD,qBAAAA,CAAsB,sBAAA,EAAwBZ,OAAOS,oBAAoB,CAAA;;QAEzEG,qBAAAA,CAAsB,0BAAA,EAA4BZ,OAAOU,wBAAwB,CAAA;AACnF,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"config.js","sources":["../../server/src/config.ts"],"sourcesContent":["export const config = {\n default: {\n enabled: true,\n provider: 'local',\n sizeLimit: 1000000000, // 1GB\n actionOptions: {},\n sharp: {\n cache: false,\n concurrency: 1,\n },\n concurrentUploadSize: 1,\n concurrentUploadRequests: 1,\n },\n validator(config: {\n concurrentUploadSize?: unknown;\n concurrentUploadRequests?: unknown;\n sharp?: { limitInputPixels?: unknown } | null;\n }) {\n const assertPositiveInteger = (key: string, value: unknown) => {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1) {\n throw new Error(\n `upload plugin config: \"${key}\" must be an integer greater than or equal to 1`\n );\n }\n };\n\n // Server-side ceiling: files processed in parallel within one request.\n assertPositiveInteger('concurrentUploadSize', config.concurrentUploadSize);\n // Client-side parallelism: upload requests the admin fires at once.\n assertPositiveInteger('concurrentUploadRequests', config.concurrentUploadRequests);\n\n // Sharp throws on anything else at every image call, which the upload flow\n // reads as \"not an image\" and skips processing silently.\n const limitInputPixels = config.sharp?.limitInputPixels;\n if (\n limitInputPixels != null &&\n typeof limitInputPixels !== 'boolean' &&\n !(Number.isInteger(limitInputPixels) && (limitInputPixels as number) >= 0)\n ) {\n throw new Error(\n 'upload plugin config: \"sharp.limitInputPixels\" must be a boolean or an integer greater than or equal to 0 (use env.int() to read it from the environment)'\n );\n }\n },\n};\n"],"names":["config","default","enabled","provider","sizeLimit","actionOptions","sharp","cache","concurrency","concurrentUploadSize","concurrentUploadRequests","validator","assertPositiveInteger","key","value","undefined","Number","isInteger","Error","limitInputPixels"],"mappings":";;MAAaA,MAAAA,GAAS;IACpBC,OAAAA,EAAS;QACPC,OAAAA,EAAS,IAAA;QACTC,QAAAA,EAAU,OAAA;QACVC,SAAAA,EAAW,UAAA;AACXC,QAAAA,aAAAA,EAAe,EAAC;QAChBC,KAAAA,EAAO;YACLC,KAAAA,EAAO,KAAA;YACPC,WAAAA,EAAa;AACf,SAAA;QACAC,oBAAAA,EAAsB,CAAA;QACtBC,wBAAAA,EAA0B;AAC5B,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUX,MAIT,EAAA;QACC,MAAMY,qBAAAA,GAAwB,CAACC,GAAAA,EAAaC,KAAAA,GAAAA;AAC1C,YAAA,IAAIA,UAAUC,SAAAA,EAAW;AACvB,gBAAA;AACF,YAAA;YACA,IAAI,OAAOD,UAAU,QAAA,IAAY,CAACE,OAAOC,SAAS,CAACH,KAAAA,CAAAA,IAAUA,KAAAA,GAAQ,CAAA,EAAG;AACtE,gBAAA,MAAM,IAAII,KAAAA,CACR,CAAC,uBAAuB,EAAEL,GAAAA,CAAI,+CAA+C,CAAC,CAAA;AAElF,YAAA;AACF,QAAA,CAAA;;QAGAD,qBAAAA,CAAsB,sBAAA,EAAwBZ,OAAOS,oBAAoB,CAAA;;QAEzEG,qBAAAA,CAAsB,0BAAA,EAA4BZ,OAAOU,wBAAwB,CAAA;;;QAIjF,MAAMS,gBAAAA,GAAmBnB,MAAAA,CAAOM,KAAK,EAAEa,gBAAAA;AACvC,QAAA,IACEA,gBAAAA,IAAoB,IAAA,IACpB,OAAOA,gBAAAA,KAAqB,aAC5B,EAAEH,MAAAA,CAAOC,SAAS,CAACE,gBAAAA,CAAAA,IAAqB,gBAACA,IAA+B,CAAA,CAAA,EACxE;AACA,YAAA,MAAM,IAAID,KAAAA,CACR,2JAAA,CAAA;AAEJ,QAAA;AACF,IAAA;AACF;;;;"}
@@ -24,6 +24,12 @@ const config = {
24
24
  assertPositiveInteger('concurrentUploadSize', config.concurrentUploadSize);
25
25
  // Client-side parallelism: upload requests the admin fires at once.
26
26
  assertPositiveInteger('concurrentUploadRequests', config.concurrentUploadRequests);
27
+ // Sharp throws on anything else at every image call, which the upload flow
28
+ // reads as "not an image" and skips processing silently.
29
+ const limitInputPixels = config.sharp?.limitInputPixels;
30
+ if (limitInputPixels != null && typeof limitInputPixels !== 'boolean' && !(Number.isInteger(limitInputPixels) && limitInputPixels >= 0)) {
31
+ throw new Error('upload plugin config: "sharp.limitInputPixels" must be a boolean or an integer greater than or equal to 0 (use env.int() to read it from the environment)');
32
+ }
27
33
  }
28
34
  };
29
35
 
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","sources":["../../server/src/config.ts"],"sourcesContent":["export const config = {\n default: {\n enabled: true,\n provider: 'local',\n sizeLimit: 1000000000, // 1GB\n actionOptions: {},\n sharp: {\n cache: false,\n concurrency: 1,\n },\n concurrentUploadSize: 1,\n concurrentUploadRequests: 1,\n },\n validator(config: { concurrentUploadSize?: unknown; concurrentUploadRequests?: unknown }) {\n const assertPositiveInteger = (key: string, value: unknown) => {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1) {\n throw new Error(\n `upload plugin config: \"${key}\" must be an integer greater than or equal to 1`\n );\n }\n };\n\n // Server-side ceiling: files processed in parallel within one request.\n assertPositiveInteger('concurrentUploadSize', config.concurrentUploadSize);\n // Client-side parallelism: upload requests the admin fires at once.\n assertPositiveInteger('concurrentUploadRequests', config.concurrentUploadRequests);\n },\n};\n"],"names":["config","default","enabled","provider","sizeLimit","actionOptions","sharp","cache","concurrency","concurrentUploadSize","concurrentUploadRequests","validator","assertPositiveInteger","key","value","undefined","Number","isInteger","Error"],"mappings":"MAAaA,MAAAA,GAAS;IACpBC,OAAAA,EAAS;QACPC,OAAAA,EAAS,IAAA;QACTC,QAAAA,EAAU,OAAA;QACVC,SAAAA,EAAW,UAAA;AACXC,QAAAA,aAAAA,EAAe,EAAC;QAChBC,KAAAA,EAAO;YACLC,KAAAA,EAAO,KAAA;YACPC,WAAAA,EAAa;AACf,SAAA;QACAC,oBAAAA,EAAsB,CAAA;QACtBC,wBAAAA,EAA0B;AAC5B,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUX,MAA8E,EAAA;QACtF,MAAMY,qBAAAA,GAAwB,CAACC,GAAAA,EAAaC,KAAAA,GAAAA;AAC1C,YAAA,IAAIA,UAAUC,SAAAA,EAAW;AACvB,gBAAA;AACF,YAAA;YACA,IAAI,OAAOD,UAAU,QAAA,IAAY,CAACE,OAAOC,SAAS,CAACH,KAAAA,CAAAA,IAAUA,KAAAA,GAAQ,CAAA,EAAG;AACtE,gBAAA,MAAM,IAAII,KAAAA,CACR,CAAC,uBAAuB,EAAEL,GAAAA,CAAI,+CAA+C,CAAC,CAAA;AAElF,YAAA;AACF,QAAA,CAAA;;QAGAD,qBAAAA,CAAsB,sBAAA,EAAwBZ,OAAOS,oBAAoB,CAAA;;QAEzEG,qBAAAA,CAAsB,0BAAA,EAA4BZ,OAAOU,wBAAwB,CAAA;AACnF,IAAA;AACF;;;;"}
1
+ {"version":3,"file":"config.mjs","sources":["../../server/src/config.ts"],"sourcesContent":["export const config = {\n default: {\n enabled: true,\n provider: 'local',\n sizeLimit: 1000000000, // 1GB\n actionOptions: {},\n sharp: {\n cache: false,\n concurrency: 1,\n },\n concurrentUploadSize: 1,\n concurrentUploadRequests: 1,\n },\n validator(config: {\n concurrentUploadSize?: unknown;\n concurrentUploadRequests?: unknown;\n sharp?: { limitInputPixels?: unknown } | null;\n }) {\n const assertPositiveInteger = (key: string, value: unknown) => {\n if (value === undefined) {\n return;\n }\n if (typeof value !== 'number' || !Number.isInteger(value) || value < 1) {\n throw new Error(\n `upload plugin config: \"${key}\" must be an integer greater than or equal to 1`\n );\n }\n };\n\n // Server-side ceiling: files processed in parallel within one request.\n assertPositiveInteger('concurrentUploadSize', config.concurrentUploadSize);\n // Client-side parallelism: upload requests the admin fires at once.\n assertPositiveInteger('concurrentUploadRequests', config.concurrentUploadRequests);\n\n // Sharp throws on anything else at every image call, which the upload flow\n // reads as \"not an image\" and skips processing silently.\n const limitInputPixels = config.sharp?.limitInputPixels;\n if (\n limitInputPixels != null &&\n typeof limitInputPixels !== 'boolean' &&\n !(Number.isInteger(limitInputPixels) && (limitInputPixels as number) >= 0)\n ) {\n throw new Error(\n 'upload plugin config: \"sharp.limitInputPixels\" must be a boolean or an integer greater than or equal to 0 (use env.int() to read it from the environment)'\n );\n }\n },\n};\n"],"names":["config","default","enabled","provider","sizeLimit","actionOptions","sharp","cache","concurrency","concurrentUploadSize","concurrentUploadRequests","validator","assertPositiveInteger","key","value","undefined","Number","isInteger","Error","limitInputPixels"],"mappings":"MAAaA,MAAAA,GAAS;IACpBC,OAAAA,EAAS;QACPC,OAAAA,EAAS,IAAA;QACTC,QAAAA,EAAU,OAAA;QACVC,SAAAA,EAAW,UAAA;AACXC,QAAAA,aAAAA,EAAe,EAAC;QAChBC,KAAAA,EAAO;YACLC,KAAAA,EAAO,KAAA;YACPC,WAAAA,EAAa;AACf,SAAA;QACAC,oBAAAA,EAAsB,CAAA;QACtBC,wBAAAA,EAA0B;AAC5B,KAAA;AACAC,IAAAA,SAAAA,CAAAA,CAAUX,MAIT,EAAA;QACC,MAAMY,qBAAAA,GAAwB,CAACC,GAAAA,EAAaC,KAAAA,GAAAA;AAC1C,YAAA,IAAIA,UAAUC,SAAAA,EAAW;AACvB,gBAAA;AACF,YAAA;YACA,IAAI,OAAOD,UAAU,QAAA,IAAY,CAACE,OAAOC,SAAS,CAACH,KAAAA,CAAAA,IAAUA,KAAAA,GAAQ,CAAA,EAAG;AACtE,gBAAA,MAAM,IAAII,KAAAA,CACR,CAAC,uBAAuB,EAAEL,GAAAA,CAAI,+CAA+C,CAAC,CAAA;AAElF,YAAA;AACF,QAAA,CAAA;;QAGAD,qBAAAA,CAAsB,sBAAA,EAAwBZ,OAAOS,oBAAoB,CAAA;;QAEzEG,qBAAAA,CAAsB,0BAAA,EAA4BZ,OAAOU,wBAAwB,CAAA;;;QAIjF,MAAMS,gBAAAA,GAAmBnB,MAAAA,CAAOM,KAAK,EAAEa,gBAAAA;AACvC,QAAA,IACEA,gBAAAA,IAAoB,IAAA,IACpB,OAAOA,gBAAAA,KAAqB,aAC5B,EAAEH,MAAAA,CAAOC,SAAS,CAACE,gBAAAA,CAAAA,IAAqB,gBAACA,IAA+B,CAAA,CAAA,EACxE;AACA,YAAA,MAAM,IAAID,KAAAA,CACR,2JAAA,CAAA;AAEJ,QAAA;AACF,IAAA;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sources":["../../../../../server/src/controllers/validation/admin/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\nimport { getService } from '../../../utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup.object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n folder: yup\n .strapiID()\n .nullable()\n .test('folder-exists', 'the folder does not exist', async (folderId) => {\n if (folderId == null) {\n return true;\n }\n\n const exists = await getService('folder').exists({ id: folderId });\n\n return exists;\n }),\n});\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n | yup.InferType<typeof uploadSchema>\n | yup.InferType<typeof multiUploadSchema>;\n\nconst bulkUpdatesSchema = yup.object({\n updates: yup\n .array()\n .of(\n yup.object({\n id: yup.number().required(),\n fileInfo: fileInfoSchema.required(),\n })\n )\n .min(1)\n .required(),\n});\n\nexport const validateBulkUpdateBody = validateYupSchema(bulkUpdatesSchema);\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","folder","strapiID","test","folderId","exists","getService","id","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict","bulkUpdatesSchema","updates","validateBulkUpdateBody"],"mappings":";;;;;AAGA,MAAMA,gBAAAA,GAAmBC,SAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,SAAAA,CAAIC,MAAM,CAAC;IAChCU,IAAAA,EAAMX,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB,gBAAAA;IACZiB,MAAAA,EAAQhB,SAAAA,CACLiB,QAAQ,EAAA,CACRT,QAAQ,GACRU,IAAI,CAAC,eAAA,EAAiB,2BAAA,EAA6B,OAAOC,QAAAA,GAAAA;AACzD,QAAA,IAAIA,YAAY,IAAA,EAAM;YACpB,OAAO,IAAA;AACT,QAAA;AAEA,QAAA,MAAMC,MAAAA,GAAS,MAAMC,gBAAAA,CAAW,QAAA,CAAA,CAAUD,MAAM,CAAC;YAAEE,EAAAA,EAAIH;AAAS,SAAA,CAAA;QAEhE,OAAOC,MAAAA;AACT,IAAA,CAAA;AACJ,CAAA,CAAA;AAEA,MAAMG,YAAAA,GAAevB,SAAAA,CAAIC,MAAM,CAAC;IAC9BuB,QAAAA,EAAUd;AACZ,CAAA,CAAA;AAEA,MAAMe,iBAAAA,GAAoBzB,SAAAA,CAAIC,MAAM,CAAC;AACnCuB,IAAAA,QAAAA,EAAUxB,SAAAA,CAAI0B,KAAK,EAAA,CAAGC,EAAE,CAACjB,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMkB,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,wBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;AAQA,MAAMK,iBAAAA,GAAoBlC,SAAAA,CAAIC,MAAM,CAAC;AACnCkC,IAAAA,OAAAA,EAASnC,UACN0B,KAAK,EAAA,CACLC,EAAE,CACD3B,SAAAA,CAAIC,MAAM,CAAC;QACTqB,EAAAA,EAAItB,SAAAA,CAAIG,MAAM,EAAA,CAAGG,QAAQ,EAAA;AACzBkB,QAAAA,QAAAA,EAAUd,eAAeJ,QAAQ;KACnC,CAAA,CAAA,CAEDF,GAAG,CAAC,CAAA,CAAA,CACJE,QAAQ;AACb,CAAA,CAAA;AAEO,MAAM8B,sBAAAA,GAAyBJ,uBAAAA,CAAkBE,iBAAAA;;;;;"}
1
+ {"version":3,"file":"upload.js","sources":["../../../../../server/src/controllers/validation/admin/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\nimport { getService } from '../../../utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup.object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n folder: yup\n .strapiID()\n .nullable()\n .test('folder-exists', 'the folder does not exist', async (folderId) => {\n if (folderId == null) {\n return true;\n }\n\n const exists = await getService('folder').exists({ id: folderId });\n\n return exists;\n }),\n});\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n yup.InferType<typeof uploadSchema> | yup.InferType<typeof multiUploadSchema>;\n\nconst bulkUpdatesSchema = yup.object({\n updates: yup\n .array()\n .of(\n yup.object({\n id: yup.number().required(),\n fileInfo: fileInfoSchema.required(),\n })\n )\n .min(1)\n .required(),\n});\n\nexport const validateBulkUpdateBody = validateYupSchema(bulkUpdatesSchema);\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","folder","strapiID","test","folderId","exists","getService","id","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict","bulkUpdatesSchema","updates","validateBulkUpdateBody"],"mappings":";;;;;AAGA,MAAMA,gBAAAA,GAAmBC,SAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,SAAAA,CAAIC,MAAM,CAAC;IAChCU,IAAAA,EAAMX,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB,gBAAAA;IACZiB,MAAAA,EAAQhB,SAAAA,CACLiB,QAAQ,EAAA,CACRT,QAAQ,GACRU,IAAI,CAAC,eAAA,EAAiB,2BAAA,EAA6B,OAAOC,QAAAA,GAAAA;AACzD,QAAA,IAAIA,YAAY,IAAA,EAAM;YACpB,OAAO,IAAA;AACT,QAAA;AAEA,QAAA,MAAMC,MAAAA,GAAS,MAAMC,gBAAAA,CAAW,QAAA,CAAA,CAAUD,MAAM,CAAC;YAAEE,EAAAA,EAAIH;AAAS,SAAA,CAAA;QAEhE,OAAOC,MAAAA;AACT,IAAA,CAAA;AACJ,CAAA,CAAA;AAEA,MAAMG,YAAAA,GAAevB,SAAAA,CAAIC,MAAM,CAAC;IAC9BuB,QAAAA,EAAUd;AACZ,CAAA,CAAA;AAEA,MAAMe,iBAAAA,GAAoBzB,SAAAA,CAAIC,MAAM,CAAC;AACnCuB,IAAAA,QAAAA,EAAUxB,SAAAA,CAAI0B,KAAK,EAAA,CAAGC,EAAE,CAACjB,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMkB,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,wBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;AAOA,MAAMK,iBAAAA,GAAoBlC,SAAAA,CAAIC,MAAM,CAAC;AACnCkC,IAAAA,OAAAA,EAASnC,UACN0B,KAAK,EAAA,CACLC,EAAE,CACD3B,SAAAA,CAAIC,MAAM,CAAC;QACTqB,EAAAA,EAAItB,SAAAA,CAAIG,MAAM,EAAA,CAAGG,QAAQ,EAAA;AACzBkB,QAAAA,QAAAA,EAAUd,eAAeJ,QAAQ;KACnC,CAAA,CAAA,CAEDF,GAAG,CAAC,CAAA,CAAA,CACJE,QAAQ;AACb,CAAA,CAAA;AAEO,MAAM8B,sBAAAA,GAAyBJ,uBAAAA,CAAkBE,iBAAAA;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.mjs","sources":["../../../../../server/src/controllers/validation/admin/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\nimport { getService } from '../../../utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup.object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n folder: yup\n .strapiID()\n .nullable()\n .test('folder-exists', 'the folder does not exist', async (folderId) => {\n if (folderId == null) {\n return true;\n }\n\n const exists = await getService('folder').exists({ id: folderId });\n\n return exists;\n }),\n});\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n | yup.InferType<typeof uploadSchema>\n | yup.InferType<typeof multiUploadSchema>;\n\nconst bulkUpdatesSchema = yup.object({\n updates: yup\n .array()\n .of(\n yup.object({\n id: yup.number().required(),\n fileInfo: fileInfoSchema.required(),\n })\n )\n .min(1)\n .required(),\n});\n\nexport const validateBulkUpdateBody = validateYupSchema(bulkUpdatesSchema);\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","folder","strapiID","test","folderId","exists","getService","id","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict","bulkUpdatesSchema","updates","validateBulkUpdateBody"],"mappings":";;;AAGA,MAAMA,gBAAAA,GAAmBC,GAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,GAAAA,CAAIC,MAAM,CAAC;IAChCU,IAAAA,EAAMX,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB,gBAAAA;IACZiB,MAAAA,EAAQhB,GAAAA,CACLiB,QAAQ,EAAA,CACRT,QAAQ,GACRU,IAAI,CAAC,eAAA,EAAiB,2BAAA,EAA6B,OAAOC,QAAAA,GAAAA;AACzD,QAAA,IAAIA,YAAY,IAAA,EAAM;YACpB,OAAO,IAAA;AACT,QAAA;AAEA,QAAA,MAAMC,MAAAA,GAAS,MAAMC,UAAAA,CAAW,QAAA,CAAA,CAAUD,MAAM,CAAC;YAAEE,EAAAA,EAAIH;AAAS,SAAA,CAAA;QAEhE,OAAOC,MAAAA;AACT,IAAA,CAAA;AACJ,CAAA,CAAA;AAEA,MAAMG,YAAAA,GAAevB,GAAAA,CAAIC,MAAM,CAAC;IAC9BuB,QAAAA,EAAUd;AACZ,CAAA,CAAA;AAEA,MAAMe,iBAAAA,GAAoBzB,GAAAA,CAAIC,MAAM,CAAC;AACnCuB,IAAAA,QAAAA,EAAUxB,GAAAA,CAAI0B,KAAK,EAAA,CAAGC,EAAE,CAACjB,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMkB,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,kBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;AAQA,MAAMK,iBAAAA,GAAoBlC,GAAAA,CAAIC,MAAM,CAAC;AACnCkC,IAAAA,OAAAA,EAASnC,IACN0B,KAAK,EAAA,CACLC,EAAE,CACD3B,GAAAA,CAAIC,MAAM,CAAC;QACTqB,EAAAA,EAAItB,GAAAA,CAAIG,MAAM,EAAA,CAAGG,QAAQ,EAAA;AACzBkB,QAAAA,QAAAA,EAAUd,eAAeJ,QAAQ;KACnC,CAAA,CAAA,CAEDF,GAAG,CAAC,CAAA,CAAA,CACJE,QAAQ;AACb,CAAA,CAAA;AAEO,MAAM8B,sBAAAA,GAAyBJ,iBAAAA,CAAkBE,iBAAAA;;;;"}
1
+ {"version":3,"file":"upload.mjs","sources":["../../../../../server/src/controllers/validation/admin/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\nimport { getService } from '../../../utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup.object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n folder: yup\n .strapiID()\n .nullable()\n .test('folder-exists', 'the folder does not exist', async (folderId) => {\n if (folderId == null) {\n return true;\n }\n\n const exists = await getService('folder').exists({ id: folderId });\n\n return exists;\n }),\n});\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n yup.InferType<typeof uploadSchema> | yup.InferType<typeof multiUploadSchema>;\n\nconst bulkUpdatesSchema = yup.object({\n updates: yup\n .array()\n .of(\n yup.object({\n id: yup.number().required(),\n fileInfo: fileInfoSchema.required(),\n })\n )\n .min(1)\n .required(),\n});\n\nexport const validateBulkUpdateBody = validateYupSchema(bulkUpdatesSchema);\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","folder","strapiID","test","folderId","exists","getService","id","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict","bulkUpdatesSchema","updates","validateBulkUpdateBody"],"mappings":";;;AAGA,MAAMA,gBAAAA,GAAmBC,GAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,GAAAA,CAAIC,MAAM,CAAC;IAChCU,IAAAA,EAAMX,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB,gBAAAA;IACZiB,MAAAA,EAAQhB,GAAAA,CACLiB,QAAQ,EAAA,CACRT,QAAQ,GACRU,IAAI,CAAC,eAAA,EAAiB,2BAAA,EAA6B,OAAOC,QAAAA,GAAAA;AACzD,QAAA,IAAIA,YAAY,IAAA,EAAM;YACpB,OAAO,IAAA;AACT,QAAA;AAEA,QAAA,MAAMC,MAAAA,GAAS,MAAMC,UAAAA,CAAW,QAAA,CAAA,CAAUD,MAAM,CAAC;YAAEE,EAAAA,EAAIH;AAAS,SAAA,CAAA;QAEhE,OAAOC,MAAAA;AACT,IAAA,CAAA;AACJ,CAAA,CAAA;AAEA,MAAMG,YAAAA,GAAevB,GAAAA,CAAIC,MAAM,CAAC;IAC9BuB,QAAAA,EAAUd;AACZ,CAAA,CAAA;AAEA,MAAMe,iBAAAA,GAAoBzB,GAAAA,CAAIC,MAAM,CAAC;AACnCuB,IAAAA,QAAAA,EAAUxB,GAAAA,CAAI0B,KAAK,EAAA,CAAGC,EAAE,CAACjB,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMkB,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,kBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;AAOA,MAAMK,iBAAAA,GAAoBlC,GAAAA,CAAIC,MAAM,CAAC;AACnCkC,IAAAA,OAAAA,EAASnC,IACN0B,KAAK,EAAA,CACLC,EAAE,CACD3B,GAAAA,CAAIC,MAAM,CAAC;QACTqB,EAAAA,EAAItB,GAAAA,CAAIG,MAAM,EAAA,CAAGG,QAAQ,EAAA;AACzBkB,QAAAA,QAAAA,EAAUd,eAAeJ,QAAQ;KACnC,CAAA,CAAA,CAEDF,GAAG,CAAC,CAAA,CAAA,CACJE,QAAQ;AACb,CAAA,CAAA;AAEO,MAAM8B,sBAAAA,GAAyBJ,iBAAAA,CAAkBE,iBAAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sources":["../../../../../server/src/controllers/validation/content-api/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup\n .object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n })\n .noUnknown();\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n | yup.InferType<typeof uploadSchema>\n | yup.InferType<typeof multiUploadSchema>;\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","noUnknown","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict"],"mappings":";;;;AAEA,MAAMA,gBAAAA,GAAmBC,SAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,SAAAA,CACpBC,MAAM,CAAC;IACNU,IAAAA,EAAMX,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB;AACd,CAAA,CAAA,CACCiB,SAAS,EAAA;AAEZ,MAAMC,YAAAA,GAAejB,SAAAA,CAAIC,MAAM,CAAC;IAC9BiB,QAAAA,EAAUR;AACZ,CAAA,CAAA;AAEA,MAAMS,iBAAAA,GAAoBnB,SAAAA,CAAIC,MAAM,CAAC;AACnCiB,IAAAA,QAAAA,EAAUlB,SAAAA,CAAIoB,KAAK,EAAA,CAAGC,EAAE,CAACX,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMY,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,wBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;;;;"}
1
+ {"version":3,"file":"upload.js","sources":["../../../../../server/src/controllers/validation/content-api/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup\n .object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n })\n .noUnknown();\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n yup.InferType<typeof uploadSchema> | yup.InferType<typeof multiUploadSchema>;\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","noUnknown","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict"],"mappings":";;;;AAEA,MAAMA,gBAAAA,GAAmBC,SAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,SAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,SAAAA,CACpBC,MAAM,CAAC;IACNU,IAAAA,EAAMX,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,SAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB;AACd,CAAA,CAAA,CACCiB,SAAS,EAAA;AAEZ,MAAMC,YAAAA,GAAejB,SAAAA,CAAIC,MAAM,CAAC;IAC9BiB,QAAAA,EAAUR;AACZ,CAAA,CAAA;AAEA,MAAMS,iBAAAA,GAAoBnB,SAAAA,CAAIC,MAAM,CAAC;AACnCiB,IAAAA,QAAAA,EAAUlB,SAAAA,CAAIoB,KAAK,EAAA,CAAGC,EAAE,CAACX,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMY,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,wBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.mjs","sources":["../../../../../server/src/controllers/validation/content-api/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup\n .object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n })\n .noUnknown();\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n | yup.InferType<typeof uploadSchema>\n | yup.InferType<typeof multiUploadSchema>;\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","noUnknown","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict"],"mappings":";;AAEA,MAAMA,gBAAAA,GAAmBC,GAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,GAAAA,CACpBC,MAAM,CAAC;IACNU,IAAAA,EAAMX,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB;AACd,CAAA,CAAA,CACCiB,SAAS,EAAA;AAEZ,MAAMC,YAAAA,GAAejB,GAAAA,CAAIC,MAAM,CAAC;IAC9BiB,QAAAA,EAAUR;AACZ,CAAA,CAAA;AAEA,MAAMS,iBAAAA,GAAoBnB,GAAAA,CAAIC,MAAM,CAAC;AACnCiB,IAAAA,QAAAA,EAAUlB,GAAAA,CAAIoB,KAAK,EAAA,CAAGC,EAAE,CAACX,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMY,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,kBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;;;;"}
1
+ {"version":3,"file":"upload.mjs","sources":["../../../../../server/src/controllers/validation/content-api/upload.ts"],"sourcesContent":["import { yup, validateYupSchema } from '@strapi/utils';\n\nconst focalPointSchema = yup\n .object({\n x: yup.number().min(0).max(100).required(),\n y: yup.number().min(0).max(100).required(),\n })\n .nullable()\n .default(null);\n\nconst fileInfoSchema = yup\n .object({\n name: yup.string().nullable(),\n alternativeText: yup.string().nullable(),\n caption: yup.string().nullable(),\n focalPoint: focalPointSchema,\n })\n .noUnknown();\n\nconst uploadSchema = yup.object({\n fileInfo: fileInfoSchema,\n});\n\nconst multiUploadSchema = yup.object({\n fileInfo: yup.array().of(fileInfoSchema),\n});\n\nconst validateUploadBody = (data = {}, isMulti = false) => {\n const schema = isMulti ? multiUploadSchema : uploadSchema;\n\n return validateYupSchema(schema, { strict: false })(data);\n};\n\nexport { validateUploadBody };\n\nexport type UploadBody =\n yup.InferType<typeof uploadSchema> | yup.InferType<typeof multiUploadSchema>;\n"],"names":["focalPointSchema","yup","object","x","number","min","max","required","y","nullable","default","fileInfoSchema","name","string","alternativeText","caption","focalPoint","noUnknown","uploadSchema","fileInfo","multiUploadSchema","array","of","validateUploadBody","data","isMulti","schema","validateYupSchema","strict"],"mappings":";;AAEA,MAAMA,gBAAAA,GAAmBC,GAAAA,CACtBC,MAAM,CAAC;IACNC,CAAAA,EAAGF,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ,EAAA;IACxCC,CAAAA,EAAGP,GAAAA,CAAIG,MAAM,EAAA,CAAGC,GAAG,CAAC,CAAA,CAAA,CAAGC,GAAG,CAAC,GAAA,CAAA,CAAKC,QAAQ;AAC1C,CAAA,CAAA,CACCE,QAAQ,EAAA,CACRC,OAAO,CAAC,IAAA,CAAA;AAEX,MAAMC,cAAAA,GAAiBV,GAAAA,CACpBC,MAAM,CAAC;IACNU,IAAAA,EAAMX,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC3BK,eAAAA,EAAiBb,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IACtCM,OAAAA,EAASd,GAAAA,CAAIY,MAAM,EAAA,CAAGJ,QAAQ,EAAA;IAC9BO,UAAAA,EAAYhB;AACd,CAAA,CAAA,CACCiB,SAAS,EAAA;AAEZ,MAAMC,YAAAA,GAAejB,GAAAA,CAAIC,MAAM,CAAC;IAC9BiB,QAAAA,EAAUR;AACZ,CAAA,CAAA;AAEA,MAAMS,iBAAAA,GAAoBnB,GAAAA,CAAIC,MAAM,CAAC;AACnCiB,IAAAA,QAAAA,EAAUlB,GAAAA,CAAIoB,KAAK,EAAA,CAAGC,EAAE,CAACX,cAAAA;AAC3B,CAAA,CAAA;AAEA,MAAMY,qBAAqB,CAACC,IAAAA,GAAO,EAAE,EAAEC,UAAU,KAAK,GAAA;IACpD,MAAMC,MAAAA,GAASD,UAAUL,iBAAAA,GAAoBF,YAAAA;AAE7C,IAAA,OAAOS,kBAAkBD,MAAAA,EAAQ;QAAEE,MAAAA,EAAQ;KAAM,CAAA,CAAGJ,IAAAA,CAAAA;AACtD;;;;"}
@@ -21,9 +21,11 @@ var index = require('../utils/index.js');
21
21
  * `strapi.getModel`, `update` runs a multi-statement transaction, and every admin controller and
22
22
  * validator already depends on the ambient form.
23
23
  *
24
- * So the dependency is made explicit and asserted instead. Handlers call this in their factory
25
- * body — at handler construction, not per call — so a mismatch fails while the tool is being
26
- * registered rather than surfacing to an agent as tool output mid-conversation.
24
+ * So the dependency is made explicit and asserted instead. `buildUploadMcpToolDefinitions`
25
+ * wraps every tool's `createHandler` in this check, so it applies to the whole media surface by
26
+ * construction rather than by each factory remembering to call it. It runs at handler
27
+ * construction, not per call, so a mismatch fails while the tool is being registered rather
28
+ * than surfacing to an agent as tool output mid-conversation.
27
29
  *
28
30
  * A single-app server is unaffected: `createStrapi` assigns its instance to `global.strapi`, so
29
31
  * the two agree. If they ever diverge — a second Strapi instance in one process — this throws
@@ -37,8 +39,8 @@ var index = require('../utils/index.js');
37
39
  * Resolves the `folder` service for an MCP handler.
38
40
  *
39
41
  * A bare `getService('folder', strapi)` reads as instance-bound but is not — see
40
- * `assertAmbientInstance` for why. Handlers assert the instance once at construction; this keeps
41
- * the resolution behind a named helper so the call sites do not reintroduce the misleading form.
42
+ * `assertAmbientInstance` for why, and for where that is enforced. This keeps the resolution
43
+ * behind a named helper so the call sites do not reintroduce the misleading form.
42
44
  */ const getFolderService = (strapi)=>index.getService('folder', strapi);
43
45
 
44
46
  exports.assertAmbientInstance = assertAmbientInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"ambient-instance.js","sources":["../../../server/src/mcp/ambient-instance.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { getService } from '../utils';\n\n/**\n * Asserts that an MCP handler's Strapi instance is the ambient `global.strapi`.\n *\n * Two of the upload plugin's services — `folder` and `file` — are registered as plain object\n * literals rather than factories (see `services/index.ts`), so their methods close over the\n * module-scope ambient `strapi` and query `global.strapi.db` regardless of which instance is\n * passed to `getService`. Passing an instance therefore selects the right plugin registry but\n * does *not* bind the queries to it.\n *\n * The folder tools reach `folder` directly. The asset write tools reach `file` transitively:\n * `upload.updateFileInfo` resolves it with a bare `getService('file')` (`services/upload.ts`),\n * and `file.getFolderPath` then queries the ambient `strapi.db`. So a handler that looks\n * instance-bound can still mix ambient reads with instance-bound writes.\n *\n * Threading an instance through both services is a broader refactor than the MCP surface should\n * carry: `create`, `update` and `deleteByIds` reach for `strapi.db`, `strapi.eventHub` and\n * `strapi.getModel`, `update` runs a multi-statement transaction, and every admin controller and\n * validator already depends on the ambient form.\n *\n * So the dependency is made explicit and asserted instead. Handlers call this in their factory\n * body — at handler construction, not per call — so a mismatch fails while the tool is being\n * registered rather than surfacing to an agent as tool output mid-conversation.\n *\n * A single-app server is unaffected: `createStrapi` assigns its instance to `global.strapi`, so\n * the two agree. If they ever diverge — a second Strapi instance in one process — this throws\n * rather than silently reading or writing the wrong app's media library.\n */\nexport const assertAmbientInstance = (strapi: Core.Strapi) => {\n if (strapi !== global.strapi) {\n throw new Error(\n 'The upload `folder` and `file` services are bound to the ambient `global.strapi`, but an ' +\n 'MCP handler was constructed with a different Strapi instance. Media queries would run ' +\n 'against the wrong app. Convert those services to factories before serving MCP from a ' +\n 'non-global instance.'\n );\n }\n};\n\n/**\n * Resolves the `folder` service for an MCP handler.\n *\n * A bare `getService('folder', strapi)` reads as instance-bound but is not — see\n * `assertAmbientInstance` for why. Handlers assert the instance once at construction; this keeps\n * the resolution behind a named helper so the call sites do not reintroduce the misleading form.\n */\nexport const getFolderService = (strapi: Core.Strapi) => getService('folder', strapi);\n"],"names":["assertAmbientInstance","strapi","global","Error","getFolderService","getService"],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BO,MAAMA,qBAAAA,GAAwB,CAACC,MAAAA,GAAAA;IACpC,IAAIA,MAAAA,KAAWC,MAAAA,CAAOD,MAAM,EAAE;AAC5B,QAAA,MAAM,IAAIE,KAAAA,CACR,2FAAA,GACE,wFAAA,GACA,uFAAA,GACA,sBAAA,CAAA;AAEN,IAAA;AACF;AAEA;;;;;;AAMC,IACM,MAAMC,gBAAAA,GAAmB,CAACH,MAAAA,GAAwBI,gBAAAA,CAAW,UAAUJ,MAAAA;;;;;"}
1
+ {"version":3,"file":"ambient-instance.js","sources":["../../../server/src/mcp/ambient-instance.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { getService } from '../utils';\n\n/**\n * Asserts that an MCP handler's Strapi instance is the ambient `global.strapi`.\n *\n * Two of the upload plugin's services — `folder` and `file` — are registered as plain object\n * literals rather than factories (see `services/index.ts`), so their methods close over the\n * module-scope ambient `strapi` and query `global.strapi.db` regardless of which instance is\n * passed to `getService`. Passing an instance therefore selects the right plugin registry but\n * does *not* bind the queries to it.\n *\n * The folder tools reach `folder` directly. The asset write tools reach `file` transitively:\n * `upload.updateFileInfo` resolves it with a bare `getService('file')` (`services/upload.ts`),\n * and `file.getFolderPath` then queries the ambient `strapi.db`. So a handler that looks\n * instance-bound can still mix ambient reads with instance-bound writes.\n *\n * Threading an instance through both services is a broader refactor than the MCP surface should\n * carry: `create`, `update` and `deleteByIds` reach for `strapi.db`, `strapi.eventHub` and\n * `strapi.getModel`, `update` runs a multi-statement transaction, and every admin controller and\n * validator already depends on the ambient form.\n *\n * So the dependency is made explicit and asserted instead. `buildUploadMcpToolDefinitions`\n * wraps every tool's `createHandler` in this check, so it applies to the whole media surface by\n * construction rather than by each factory remembering to call it. It runs at handler\n * construction, not per call, so a mismatch fails while the tool is being registered rather\n * than surfacing to an agent as tool output mid-conversation.\n *\n * A single-app server is unaffected: `createStrapi` assigns its instance to `global.strapi`, so\n * the two agree. If they ever diverge — a second Strapi instance in one process — this throws\n * rather than silently reading or writing the wrong app's media library.\n */\nexport const assertAmbientInstance = (strapi: Core.Strapi) => {\n if (strapi !== global.strapi) {\n throw new Error(\n 'The upload `folder` and `file` services are bound to the ambient `global.strapi`, but an ' +\n 'MCP handler was constructed with a different Strapi instance. Media queries would run ' +\n 'against the wrong app. Convert those services to factories before serving MCP from a ' +\n 'non-global instance.'\n );\n }\n};\n\n/**\n * Resolves the `folder` service for an MCP handler.\n *\n * A bare `getService('folder', strapi)` reads as instance-bound but is not — see\n * `assertAmbientInstance` for why, and for where that is enforced. This keeps the resolution\n * behind a named helper so the call sites do not reintroduce the misleading form.\n */\nexport const getFolderService = (strapi: Core.Strapi) => getService('folder', strapi);\n"],"names":["assertAmbientInstance","strapi","global","Error","getFolderService","getService"],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BO,MAAMA,qBAAAA,GAAwB,CAACC,MAAAA,GAAAA;IACpC,IAAIA,MAAAA,KAAWC,MAAAA,CAAOD,MAAM,EAAE;AAC5B,QAAA,MAAM,IAAIE,KAAAA,CACR,2FAAA,GACE,wFAAA,GACA,uFAAA,GACA,sBAAA,CAAA;AAEN,IAAA;AACF;AAEA;;;;;;AAMC,IACM,MAAMC,gBAAAA,GAAmB,CAACH,MAAAA,GAAwBI,gBAAAA,CAAW,UAAUJ,MAAAA;;;;;"}
@@ -19,9 +19,11 @@ import { getService } from '../utils/index.mjs';
19
19
  * `strapi.getModel`, `update` runs a multi-statement transaction, and every admin controller and
20
20
  * validator already depends on the ambient form.
21
21
  *
22
- * So the dependency is made explicit and asserted instead. Handlers call this in their factory
23
- * body — at handler construction, not per call — so a mismatch fails while the tool is being
24
- * registered rather than surfacing to an agent as tool output mid-conversation.
22
+ * So the dependency is made explicit and asserted instead. `buildUploadMcpToolDefinitions`
23
+ * wraps every tool's `createHandler` in this check, so it applies to the whole media surface by
24
+ * construction rather than by each factory remembering to call it. It runs at handler
25
+ * construction, not per call, so a mismatch fails while the tool is being registered rather
26
+ * than surfacing to an agent as tool output mid-conversation.
25
27
  *
26
28
  * A single-app server is unaffected: `createStrapi` assigns its instance to `global.strapi`, so
27
29
  * the two agree. If they ever diverge — a second Strapi instance in one process — this throws
@@ -35,8 +37,8 @@ import { getService } from '../utils/index.mjs';
35
37
  * Resolves the `folder` service for an MCP handler.
36
38
  *
37
39
  * A bare `getService('folder', strapi)` reads as instance-bound but is not — see
38
- * `assertAmbientInstance` for why. Handlers assert the instance once at construction; this keeps
39
- * the resolution behind a named helper so the call sites do not reintroduce the misleading form.
40
+ * `assertAmbientInstance` for why, and for where that is enforced. This keeps the resolution
41
+ * behind a named helper so the call sites do not reintroduce the misleading form.
40
42
  */ const getFolderService = (strapi)=>getService('folder', strapi);
41
43
 
42
44
  export { assertAmbientInstance, getFolderService };
@@ -1 +1 @@
1
- {"version":3,"file":"ambient-instance.mjs","sources":["../../../server/src/mcp/ambient-instance.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { getService } from '../utils';\n\n/**\n * Asserts that an MCP handler's Strapi instance is the ambient `global.strapi`.\n *\n * Two of the upload plugin's services — `folder` and `file` — are registered as plain object\n * literals rather than factories (see `services/index.ts`), so their methods close over the\n * module-scope ambient `strapi` and query `global.strapi.db` regardless of which instance is\n * passed to `getService`. Passing an instance therefore selects the right plugin registry but\n * does *not* bind the queries to it.\n *\n * The folder tools reach `folder` directly. The asset write tools reach `file` transitively:\n * `upload.updateFileInfo` resolves it with a bare `getService('file')` (`services/upload.ts`),\n * and `file.getFolderPath` then queries the ambient `strapi.db`. So a handler that looks\n * instance-bound can still mix ambient reads with instance-bound writes.\n *\n * Threading an instance through both services is a broader refactor than the MCP surface should\n * carry: `create`, `update` and `deleteByIds` reach for `strapi.db`, `strapi.eventHub` and\n * `strapi.getModel`, `update` runs a multi-statement transaction, and every admin controller and\n * validator already depends on the ambient form.\n *\n * So the dependency is made explicit and asserted instead. Handlers call this in their factory\n * body — at handler construction, not per call — so a mismatch fails while the tool is being\n * registered rather than surfacing to an agent as tool output mid-conversation.\n *\n * A single-app server is unaffected: `createStrapi` assigns its instance to `global.strapi`, so\n * the two agree. If they ever diverge — a second Strapi instance in one process — this throws\n * rather than silently reading or writing the wrong app's media library.\n */\nexport const assertAmbientInstance = (strapi: Core.Strapi) => {\n if (strapi !== global.strapi) {\n throw new Error(\n 'The upload `folder` and `file` services are bound to the ambient `global.strapi`, but an ' +\n 'MCP handler was constructed with a different Strapi instance. Media queries would run ' +\n 'against the wrong app. Convert those services to factories before serving MCP from a ' +\n 'non-global instance.'\n );\n }\n};\n\n/**\n * Resolves the `folder` service for an MCP handler.\n *\n * A bare `getService('folder', strapi)` reads as instance-bound but is not — see\n * `assertAmbientInstance` for why. Handlers assert the instance once at construction; this keeps\n * the resolution behind a named helper so the call sites do not reintroduce the misleading form.\n */\nexport const getFolderService = (strapi: Core.Strapi) => getService('folder', strapi);\n"],"names":["assertAmbientInstance","strapi","global","Error","getFolderService","getService"],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BO,MAAMA,qBAAAA,GAAwB,CAACC,MAAAA,GAAAA;IACpC,IAAIA,MAAAA,KAAWC,MAAAA,CAAOD,MAAM,EAAE;AAC5B,QAAA,MAAM,IAAIE,KAAAA,CACR,2FAAA,GACE,wFAAA,GACA,uFAAA,GACA,sBAAA,CAAA;AAEN,IAAA;AACF;AAEA;;;;;;AAMC,IACM,MAAMC,gBAAAA,GAAmB,CAACH,MAAAA,GAAwBI,UAAAA,CAAW,UAAUJ,MAAAA;;;;"}
1
+ {"version":3,"file":"ambient-instance.mjs","sources":["../../../server/src/mcp/ambient-instance.ts"],"sourcesContent":["import type { Core } from '@strapi/types';\n\nimport { getService } from '../utils';\n\n/**\n * Asserts that an MCP handler's Strapi instance is the ambient `global.strapi`.\n *\n * Two of the upload plugin's services — `folder` and `file` — are registered as plain object\n * literals rather than factories (see `services/index.ts`), so their methods close over the\n * module-scope ambient `strapi` and query `global.strapi.db` regardless of which instance is\n * passed to `getService`. Passing an instance therefore selects the right plugin registry but\n * does *not* bind the queries to it.\n *\n * The folder tools reach `folder` directly. The asset write tools reach `file` transitively:\n * `upload.updateFileInfo` resolves it with a bare `getService('file')` (`services/upload.ts`),\n * and `file.getFolderPath` then queries the ambient `strapi.db`. So a handler that looks\n * instance-bound can still mix ambient reads with instance-bound writes.\n *\n * Threading an instance through both services is a broader refactor than the MCP surface should\n * carry: `create`, `update` and `deleteByIds` reach for `strapi.db`, `strapi.eventHub` and\n * `strapi.getModel`, `update` runs a multi-statement transaction, and every admin controller and\n * validator already depends on the ambient form.\n *\n * So the dependency is made explicit and asserted instead. `buildUploadMcpToolDefinitions`\n * wraps every tool's `createHandler` in this check, so it applies to the whole media surface by\n * construction rather than by each factory remembering to call it. It runs at handler\n * construction, not per call, so a mismatch fails while the tool is being registered rather\n * than surfacing to an agent as tool output mid-conversation.\n *\n * A single-app server is unaffected: `createStrapi` assigns its instance to `global.strapi`, so\n * the two agree. If they ever diverge — a second Strapi instance in one process — this throws\n * rather than silently reading or writing the wrong app's media library.\n */\nexport const assertAmbientInstance = (strapi: Core.Strapi) => {\n if (strapi !== global.strapi) {\n throw new Error(\n 'The upload `folder` and `file` services are bound to the ambient `global.strapi`, but an ' +\n 'MCP handler was constructed with a different Strapi instance. Media queries would run ' +\n 'against the wrong app. Convert those services to factories before serving MCP from a ' +\n 'non-global instance.'\n );\n }\n};\n\n/**\n * Resolves the `folder` service for an MCP handler.\n *\n * A bare `getService('folder', strapi)` reads as instance-bound but is not — see\n * `assertAmbientInstance` for why, and for where that is enforced. This keeps the resolution\n * behind a named helper so the call sites do not reintroduce the misleading form.\n */\nexport const getFolderService = (strapi: Core.Strapi) => getService('folder', strapi);\n"],"names":["assertAmbientInstance","strapi","global","Error","getFolderService","getService"],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6BO,MAAMA,qBAAAA,GAAwB,CAACC,MAAAA,GAAAA;IACpC,IAAIA,MAAAA,KAAWC,MAAAA,CAAOD,MAAM,EAAE;AAC5B,QAAA,MAAM,IAAIE,KAAAA,CACR,2FAAA,GACE,wFAAA,GACA,uFAAA,GACA,sBAAA,CAAA;AAEN,IAAA;AACF;AAEA;;;;;;AAMC,IACM,MAAMC,gBAAAA,GAAmB,CAACH,MAAAA,GAAwBI,UAAAA,CAAW,UAAUJ,MAAAA;;;;"}
@@ -152,9 +152,7 @@ var utils = require('../utils.js');
152
152
  *
153
153
  * `create` rather than the `update` the other folder tools use: creating a folder is the one
154
154
  * folder operation whose admin route gates on `assets.create`.
155
- */ const createMediaCreateFolderHandler = (strapi, context)=>{
156
- ambientInstance.assertAmbientInstance(strapi);
157
- return async ({ args })=>{
155
+ */ const createMediaCreateFolderHandler = (strapi, context)=>async ({ args })=>{
158
156
  const { name, parent = null } = args;
159
157
  permissions.assertMediaPermission(strapi, context, constants$1.ACTIONS.create, constants$1.FOLDER_MODEL_UID);
160
158
  await assertParentExists(strapi, parent);
@@ -169,7 +167,6 @@ var utils = require('../utils.js');
169
167
  data: await readFolderForOutput(strapi, created.id, created)
170
168
  });
171
169
  };
172
- };
173
170
  /**
174
171
  * `media_rename_folder` — changes a folder's name and nothing else.
175
172
  *
@@ -177,9 +174,7 @@ var utils = require('../utils.js');
177
174
  * `isUndefined(parent)`, and the name-only branch skips the transaction that rewrites descendant
178
175
  * paths. Passing the folder's existing parent would take the move branch and rewrite the whole
179
176
  * subtree to compute the identical paths.
180
- */ const createMediaRenameFolderHandler = (strapi, context)=>{
181
- ambientInstance.assertAmbientInstance(strapi);
182
- return async ({ args })=>{
177
+ */ const createMediaRenameFolderHandler = (strapi, context)=>async ({ args })=>{
183
178
  const { id, name } = args;
184
179
  permissions.assertMediaPermission(strapi, context, constants$1.ACTIONS.update, constants$1.FOLDER_MODEL_UID);
185
180
  const folder = await findFolderById(strapi, id, {
@@ -205,16 +200,13 @@ var utils = require('../utils.js');
205
200
  })
206
201
  });
207
202
  };
208
- };
209
203
  /**
210
204
  * `media_move_folder` — re-parents a folder, carrying its whole subtree with it.
211
205
  *
212
206
  * `folder.update()` recalculates the materialized `path` of every descendant folder and the
213
207
  * `folderPath` of every contained file inside a transaction, so the move is atomic and no
214
208
  * separate bookkeeping is needed here.
215
- */ const createMediaMoveFolderHandler = (strapi, context)=>{
216
- ambientInstance.assertAmbientInstance(strapi);
217
- return async ({ args })=>{
209
+ */ const createMediaMoveFolderHandler = (strapi, context)=>async ({ args })=>{
218
210
  const { id, parent } = args;
219
211
  permissions.assertMediaPermission(strapi, context, constants$1.ACTIONS.update, constants$1.FOLDER_MODEL_UID);
220
212
  const folder = await findFolderById(strapi, id);
@@ -235,7 +227,6 @@ var utils = require('../utils.js');
235
227
  data: await readFolderForOutput(strapi, id, moved ?? folder)
236
228
  });
237
229
  };
238
- };
239
230
  /**
240
231
  * `media_delete_folder` — previews or performs a cascading folder deletion.
241
232
  *
@@ -245,9 +236,7 @@ var utils = require('../utils.js');
245
236
  *
246
237
  * `dryRun` defaults to true (see the input schema): omitting the flag previews, and deleting
247
238
  * takes an explicit `dryRun: false`.
248
- */ const createMediaDeleteFolderHandler = (strapi, context)=>{
249
- ambientInstance.assertAmbientInstance(strapi);
250
- return async ({ args })=>{
239
+ */ const createMediaDeleteFolderHandler = (strapi, context)=>async ({ args })=>{
251
240
  const { ids, dryRun = true } = args;
252
241
  permissions.assertMediaPermission(strapi, context, constants$1.ACTIONS.update, constants$1.FOLDER_MODEL_UID);
253
242
  const matched = await strapi.db.query(constants$1.FOLDER_MODEL_UID).findMany({
@@ -299,7 +288,6 @@ var utils = require('../utils.js');
299
288
  totalFileNumber
300
289
  });
301
290
  };
302
- };
303
291
 
304
292
  exports.createMediaCreateFolderHandler = createMediaCreateFolderHandler;
305
293
  exports.createMediaDeleteFolderHandler = createMediaDeleteFolderHandler;