@tulip-systems/core 0.5.1 → 0.5.2

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 (236) hide show
  1. package/dist/components/common/icons.d.mts +52 -52
  2. package/dist/components/common/icons.d.mts.map +1 -1
  3. package/dist/components/common/status.d.mts +3 -3
  4. package/dist/components/common/status.d.mts.map +1 -1
  5. package/dist/components/editor/components/content.client.d.mts +2 -2
  6. package/dist/components/editor/components/editor.client.d.mts +4 -4
  7. package/dist/components/editor/components/menu.client.d.mts +3 -3
  8. package/dist/components/header/back-button.client.d.mts +2 -2
  9. package/dist/components/header/bottom-bar.client.d.mts +3 -3
  10. package/dist/components/header/breadcrumbs.client.d.mts +7 -7
  11. package/dist/components/header/header.client.d.mts +2 -2
  12. package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
  13. package/dist/components/header/top-bar.client.d.mts +4 -4
  14. package/dist/components/layouts/admin-content.client.d.mts +2 -2
  15. package/dist/components/layouts/admin-layout.d.mts +2 -2
  16. package/dist/components/layouts/admin-layout.d.mts.map +1 -1
  17. package/dist/components/layouts/admin-loading.d.mts +2 -2
  18. package/dist/components/layouts/admin-loading.d.mts.map +1 -1
  19. package/dist/components/layouts/empty-page.d.mts +4 -4
  20. package/dist/components/layouts/empty-page.d.mts.map +1 -1
  21. package/dist/components/layouts/list-layout.d.mts +2 -2
  22. package/dist/components/layouts/list-layout.d.mts.map +1 -1
  23. package/dist/components/layouts/not-found-page.d.mts +3 -3
  24. package/dist/components/layouts/not-found-page.d.mts.map +1 -1
  25. package/dist/components/layouts/providers.client.d.mts +2 -2
  26. package/dist/components/layouts/root-layout.server.d.mts +2 -2
  27. package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
  28. package/dist/components/layouts/root-loading.d.mts +2 -2
  29. package/dist/components/layouts/root-loading.d.mts.map +1 -1
  30. package/dist/components/layouts/tab-layout.d.mts +2 -2
  31. package/dist/components/layouts/tab-layout.d.mts.map +1 -1
  32. package/dist/components/lists/data-list.d.mts +5 -5
  33. package/dist/components/lists/data-list.d.mts.map +1 -1
  34. package/dist/components/lists/data-stack.d.mts +8 -8
  35. package/dist/components/lists/data-stack.d.mts.map +1 -1
  36. package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
  37. package/dist/components/ui/accordion.d.mts +5 -5
  38. package/dist/components/ui/accordion.d.mts.map +1 -1
  39. package/dist/components/ui/alert-dialog.d.mts +12 -12
  40. package/dist/components/ui/alert-dialog.d.mts.map +1 -1
  41. package/dist/components/ui/alert.d.mts +6 -6
  42. package/dist/components/ui/alert.d.mts.map +1 -1
  43. package/dist/components/ui/aspect-ratio.d.mts +2 -2
  44. package/dist/components/ui/aspect-ratio.d.mts.map +1 -1
  45. package/dist/components/ui/avatar.client.d.mts +4 -4
  46. package/dist/components/ui/badge.d.mts +4 -4
  47. package/dist/components/ui/badge.d.mts.map +1 -1
  48. package/dist/components/ui/breadcrumb.d.mts +8 -8
  49. package/dist/components/ui/button.d.mts +5 -5
  50. package/dist/components/ui/calendar.d.mts +3 -3
  51. package/dist/components/ui/card.d.mts +7 -7
  52. package/dist/components/ui/carousel.d.mts +6 -6
  53. package/dist/components/ui/chart.client.d.mts +5 -5
  54. package/dist/components/ui/checkbox.d.mts +2 -2
  55. package/dist/components/ui/collapsible.client.d.mts +4 -4
  56. package/dist/components/ui/color-picker.client.d.mts +2 -2
  57. package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
  58. package/dist/components/ui/combobox.client.d.mts +2 -2
  59. package/dist/components/ui/command.d.mts +10 -10
  60. package/dist/components/ui/context-menu.d.mts +16 -16
  61. package/dist/components/ui/context-menu.d.mts.map +1 -1
  62. package/dist/components/ui/date-picker.client.d.mts +2 -2
  63. package/dist/components/ui/dialog.client.d.mts +11 -11
  64. package/dist/components/ui/drawer.client.d.mts +11 -11
  65. package/dist/components/ui/dropdown-menu.d.mts +16 -16
  66. package/dist/components/ui/form.client.d.mts +7 -7
  67. package/dist/components/ui/hover-card.client.d.mts +4 -4
  68. package/dist/components/ui/input.d.mts +2 -2
  69. package/dist/components/ui/label.d.mts +2 -2
  70. package/dist/components/ui/navigation-menu.d.mts +11 -11
  71. package/dist/components/ui/pagination.d.mts +8 -8
  72. package/dist/components/ui/popover.d.mts +5 -5
  73. package/dist/components/ui/progress.client.d.mts +2 -2
  74. package/dist/components/ui/radio-group.d.mts +3 -3
  75. package/dist/components/ui/resizable.client.d.mts +4 -4
  76. package/dist/components/ui/scroll-area.d.mts +3 -3
  77. package/dist/components/ui/select.client.d.mts +11 -11
  78. package/dist/components/ui/separator.d.mts +2 -2
  79. package/dist/components/ui/sheet.client.d.mts +9 -9
  80. package/dist/components/ui/sidebar.client.d.mts +24 -24
  81. package/dist/components/ui/skeleton.d.mts +2 -2
  82. package/dist/components/ui/slider.d.mts +2 -2
  83. package/dist/components/ui/sonner.client.d.mts +2 -2
  84. package/dist/components/ui/switch.d.mts +2 -2
  85. package/dist/components/ui/tabs.d.mts +5 -5
  86. package/dist/components/ui/textarea.d.mts +2 -2
  87. package/dist/components/ui/time-input.client.d.mts +2 -2
  88. package/dist/components/ui/toggle-group.client.d.mts +3 -3
  89. package/dist/components/ui/toggle.d.mts +2 -2
  90. package/dist/components/ui/tooltip.client.d.mts +5 -5
  91. package/dist/lib/hooks/use-indicator.d.mts +2 -2
  92. package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
  93. package/dist/modules/auth/components/allowed.client.d.mts +2 -2
  94. package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
  95. package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
  96. package/dist/modules/auth/components/auth-loading.d.mts +2 -2
  97. package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
  98. package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
  99. package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
  100. package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
  101. package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
  102. package/dist/modules/auth/components/guard.server.d.mts +2 -2
  103. package/dist/modules/auth/components/login-page.client.d.mts +2 -2
  104. package/dist/modules/auth/components/login-page.client.d.mts.map +1 -1
  105. package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
  106. package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
  107. package/dist/modules/auth/components/update-password-command.d.mts +2 -2
  108. package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
  109. package/dist/modules/auth/db/schema.d.mts +73 -73
  110. package/dist/modules/auth/db/schema.d.mts.map +1 -1
  111. package/dist/modules/auth/handler/client.client.d.mts +2 -2
  112. package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
  113. package/dist/modules/commands/components/click-command.client.d.mts +2 -2
  114. package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
  115. package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
  116. package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
  117. package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
  118. package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
  119. package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
  120. package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
  121. package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
  122. package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
  123. package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
  124. package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
  125. package/dist/modules/config/db/helpers.d.mts +5 -5
  126. package/dist/modules/config/db/helpers.d.mts.map +1 -1
  127. package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
  128. package/dist/modules/data-tables/components/cell/common.client.d.mts.map +1 -1
  129. package/dist/modules/data-tables/components/column-header.d.mts +2 -2
  130. package/dist/modules/data-tables/components/column-header.d.mts.map +1 -1
  131. package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
  132. package/dist/modules/data-tables/components/filters/combobox.client.d.mts.map +1 -1
  133. package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
  134. package/dist/modules/data-tables/components/filters/slider.client.d.mts.map +1 -1
  135. package/dist/modules/data-tables/components/header.d.mts +4 -4
  136. package/dist/modules/data-tables/components/header.d.mts.map +1 -1
  137. package/dist/modules/data-tables/components/layout.d.mts +2 -2
  138. package/dist/modules/data-tables/components/layout.d.mts.map +1 -1
  139. package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
  140. package/dist/modules/data-tables/components/search-input.client.d.mts.map +1 -1
  141. package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
  142. package/dist/modules/data-tables/components/skeleton.d.mts.map +1 -1
  143. package/dist/modules/data-tables/components/table.d.mts +7 -7
  144. package/dist/modules/data-tables/components/table.d.mts.map +1 -1
  145. package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
  146. package/dist/modules/data-tables/components/toolbar.d.mts.map +1 -1
  147. package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
  148. package/dist/modules/data-tables/hooks/use-context.client.d.mts.map +1 -1
  149. package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
  150. package/dist/modules/data-tables/tables/data-table/components/table.d.mts.map +1 -1
  151. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
  152. package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts.map +1 -1
  153. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
  154. package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts.map +1 -1
  155. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
  156. package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts.map +1 -1
  157. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
  158. package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts.map +1 -1
  159. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
  160. package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts.map +1 -1
  161. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
  162. package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts.map +1 -1
  163. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
  164. package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts.map +1 -1
  165. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
  166. package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
  167. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
  168. package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
  169. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
  170. package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
  171. package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
  172. package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
  173. package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
  174. package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
  175. package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
  176. package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
  177. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts +2 -2
  178. package/dist/modules/inline-edit/components/deprecated-editor.client.d.mts.map +1 -1
  179. package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
  180. package/dist/modules/inline-edit/components/editor.client.d.mts.map +1 -1
  181. package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
  182. package/dist/modules/inline-edit/components/input-recipient.client.d.mts.map +1 -1
  183. package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
  184. package/dist/modules/inline-edit/components/input-toggle.client.d.mts.map +1 -1
  185. package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
  186. package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
  187. package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
  188. package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
  189. package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
  190. package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
  191. package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
  192. package/dist/modules/inline-edit/components/toggle.client.d.mts.map +1 -1
  193. package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
  194. package/dist/modules/inline-edit/hooks/context.client.d.mts.map +1 -1
  195. package/dist/modules/router/lib/query-client.server.d.mts +2 -2
  196. package/dist/modules/router/lib/query-client.server.d.mts.map +1 -1
  197. package/dist/modules/storage/components/dropzone-context.client.d.mts +2 -2
  198. package/dist/modules/storage/components/dropzone-context.client.d.mts.map +1 -1
  199. package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
  200. package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
  201. package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
  202. package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
  203. package/dist/modules/storage/components/upload-zone.client.d.mts +5 -3
  204. package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
  205. package/dist/modules/storage/components/upload-zone.client.mjs +6 -4
  206. package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
  207. package/dist/modules/storage/config/filters.d.mts +1 -0
  208. package/dist/modules/storage/config/filters.d.mts.map +1 -1
  209. package/dist/modules/storage/config/filters.mjs +2 -1
  210. package/dist/modules/storage/config/filters.mjs.map +1 -1
  211. package/dist/modules/storage/lib/helpers.d.mts +2 -2
  212. package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
  213. package/dist/modules/storage/lib/helpers.mjs +1 -0
  214. package/dist/modules/storage/lib/helpers.mjs.map +1 -1
  215. package/dist/modules/storage/lib/router.server.d.mts +3195 -2217
  216. package/dist/modules/storage/lib/schema.d.mts +122 -88
  217. package/dist/modules/storage/lib/schema.d.mts.map +1 -1
  218. package/dist/modules/storage/lib/schema.mjs +1 -0
  219. package/dist/modules/storage/lib/schema.mjs.map +1 -1
  220. package/dist/modules/storage/lib/service.server.d.mts +39 -12
  221. package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
  222. package/dist/modules/storage/lib/service.server.mjs +9 -3
  223. package/dist/modules/storage/lib/service.server.mjs.map +1 -1
  224. package/dist/modules/storage/lib/validators.d.mts +219 -138
  225. package/dist/modules/storage/lib/validators.d.mts.map +1 -1
  226. package/dist/modules/storage/lib/validators.mjs +14 -24
  227. package/dist/modules/storage/lib/validators.mjs.map +1 -1
  228. package/dist/storage.d.mts +2 -2
  229. package/dist/storage.mjs +2 -2
  230. package/package.json +3 -3
  231. package/src/modules/storage/components/upload-zone.client.tsx +5 -2
  232. package/src/modules/storage/config/filters.ts +1 -0
  233. package/src/modules/storage/lib/helpers.ts +3 -2
  234. package/src/modules/storage/lib/schema.ts +1 -0
  235. package/src/modules/storage/lib/service.server.ts +10 -2
  236. package/src/modules/storage/lib/validators.ts +20 -31
@@ -1,6 +1,6 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
2
  import { InlineEditVariantsProps } from "../lib/variants.mjs";
3
- import * as react_jsx_runtime21 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime174 from "react/jsx-runtime";
4
4
  import { SelectContentProps, SelectItemProps, SelectProps, SelectTriggerProps, SelectValueProps } from "@radix-ui/react-select";
5
5
 
6
6
  //#region src/modules/inline-edit/components/select.client.d.ts
@@ -11,19 +11,19 @@ declare function InlineSelect({
11
11
  permission,
12
12
  disabled,
13
13
  ...props
14
- }: InlineSelectProps): react_jsx_runtime21.JSX.Element;
14
+ }: InlineSelectProps): react_jsx_runtime174.JSX.Element;
15
15
  type InlineSelectTriggerProps = SelectTriggerProps;
16
16
  declare function InlineSelectTrigger({
17
17
  variant,
18
18
  className,
19
19
  ...props
20
- }: InlineSelectTriggerProps & InlineEditVariantsProps): react_jsx_runtime21.JSX.Element;
20
+ }: InlineSelectTriggerProps & InlineEditVariantsProps): react_jsx_runtime174.JSX.Element;
21
21
  type InlineSelectContentProps = SelectContentProps;
22
- declare function InlineSelectContent(props: InlineSelectContentProps): react_jsx_runtime21.JSX.Element;
22
+ declare function InlineSelectContent(props: InlineSelectContentProps): react_jsx_runtime174.JSX.Element;
23
23
  type InlineSelectValueProps = SelectValueProps;
24
- declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime21.JSX.Element;
24
+ declare function InlineSelectValue(props: InlineSelectValueProps): react_jsx_runtime174.JSX.Element;
25
25
  type InlineSelectItenProps = SelectItemProps;
26
- declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime21.JSX.Element;
26
+ declare function InlineSelectItem(props: InlineSelectItenProps): react_jsx_runtime174.JSX.Element;
27
27
  //#endregion
28
28
  export { InlineSelect, InlineSelectContent, InlineSelectContentProps, InlineSelectItem, InlineSelectItenProps, InlineSelectProps, InlineSelectTrigger, InlineSelectTriggerProps, InlineSelectValue, InlineSelectValueProps };
29
29
  //# sourceMappingURL=select.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KAoBY,iBAAA,GAAoB,cAAc;iBAE9B,YAAA;;;;;;GAMb,oBAAiB,mBAAA,CAAA,GAAA,CAAA;KAoBR,wBAAA,GAA2B;AA5B3B,iBA8BI,mBAAA,CA9BgB;EAAA,OAAc;EAAA,SAAA;EAAA,GAAA;AAAoB,CAAA,EAkC/D,wBAlC+D,GAkCpC,uBAlCoC,CAAA,EAkCb,mBAAA,CAAA,GAAA,CAAA,OAlCa;AAElD,KAoCJ,wBAAA,GAA2B,kBApCX;AAC1B,iBAqCc,mBAAA,CArCd,KAAA,EAqCyC,wBArCzC,CAAA,EAqCiE,mBAAA,CAAA,GAAA,CAAA,OArCjE;AACA,KAwCU,sBAAA,GAAyB,gBAxCnC;AACA,iBAyCc,iBAAA,CAzCd,KAAA,EAyCuC,sBAzCvC,CAAA,EAyC6D,mBAAA,CAAA,GAAA,CAAA,OAzC7D;AACA,KA4CU,qBAAA,GAAwB,eA5ClC;AAEC,iBA4Ca,gBAAA,CA5Cb,KAAA,EA4CqC,qBA5CrC,CAAA,EA4C0D,mBAAA,CAAA,GAAA,CAAA,OA5C1D"}
1
+ {"version":3,"file":"select.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/select.client.tsx"],"sourcesContent":[],"mappings":";;;;;;KAoBY,iBAAA,GAAoB,cAAc;iBAE9B,YAAA;;;;;;GAMb,oBAAiB,oBAAA,CAAA,GAAA,CAAA;KAoBR,wBAAA,GAA2B;AA5B3B,iBA8BI,mBAAA,CA9BgB;EAAA,OAAc;EAAA,SAAA;EAAA,GAAA;AAAoB,CAAA,EAkC/D,wBAlC+D,GAkCpC,uBAlCoC,CAAA,EAkCb,oBAAA,CAAA,GAAA,CAAA,OAlCa;AAElD,KAoCJ,wBAAA,GAA2B,kBApCX;AAC1B,iBAqCc,mBAAA,CArCd,KAAA,EAqCyC,wBArCzC,CAAA,EAqCiE,oBAAA,CAAA,GAAA,CAAA,OArCjE;AACA,KAwCU,sBAAA,GAAyB,gBAxCnC;AACA,iBAyCc,iBAAA,CAzCd,KAAA,EAyCuC,sBAzCvC,CAAA,EAyC6D,oBAAA,CAAA,GAAA,CAAA,OAzC7D;AACA,KA4CU,qBAAA,GAAwB,eA5ClC;AAEC,iBA4Ca,gBAAA,CA5Cb,KAAA,EA4CqC,qBA5CrC,CAAA,EA4C0D,oBAAA,CAAA,GAAA,CAAA,OA5C1D"}
@@ -1,5 +1,5 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
- import * as react_jsx_runtime26 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime179 from "react/jsx-runtime";
3
3
  import { SwitchProps } from "@radix-ui/react-switch";
4
4
 
5
5
  //#region src/modules/inline-edit/components/switch.client.d.ts
@@ -9,7 +9,7 @@ declare function InlineSwitch({
9
9
  permission,
10
10
  disabled,
11
11
  ...props
12
- }: SwitchProps & useInlineEditOptions<boolean>): react_jsx_runtime26.JSX.Element;
12
+ }: SwitchProps & useInlineEditOptions<boolean>): react_jsx_runtime179.JSX.Element;
13
13
  //#endregion
14
14
  export { InlineSwitch };
15
15
  //# sourceMappingURL=switch.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":[],"mappings":";;;;;iBAMgB,YAAA;;;;;;GAMb,cAAc,gCAA6B,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"switch.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/switch.client.tsx"],"sourcesContent":[],"mappings":";;;;;iBAMgB,YAAA;;;;;;GAMb,cAAc,gCAA6B,oBAAA,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { useInlineEditOptions } from "../hooks/use-inline.client.mjs";
2
- import * as react_jsx_runtime27 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime180 from "react/jsx-runtime";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/modules/inline-edit/components/toggle.client.d.ts
@@ -11,7 +11,7 @@ declare function InlineToggle({
11
11
  permission,
12
12
  className,
13
13
  ...props
14
- }: InlineEditToggleProps): react_jsx_runtime27.JSX.Element;
14
+ }: InlineEditToggleProps): react_jsx_runtime180.JSX.Element;
15
15
  //#endregion
16
16
  export { InlineEditToggleProps, InlineToggle };
17
17
  //# sourceMappingURL=toggle.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAOY,qBAAA,GAAwB,KAAA,CAAM,eAAe,kBACvD;iBAEc,YAAA;;;;;;;GAOb,wBAAqB,mBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"toggle.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/components/toggle.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAOY,qBAAA,GAAwB,KAAA,CAAM,eAAe,kBACvD;iBAEc,YAAA;;;;;;;GAOb,wBAAqB,oBAAA,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { Permission } from "../../auth/lib/permissions.mjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime158 from "react/jsx-runtime";
3
3
  import React from "react";
4
4
 
5
5
  //#region src/modules/inline-edit/hooks/context.client.d.ts
@@ -22,7 +22,7 @@ declare function InlineEditProvider({
22
22
  ...value
23
23
  }: InlineEditContextParams & {
24
24
  children: React.ReactNode;
25
- }): react_jsx_runtime0.JSX.Element;
25
+ }): react_jsx_runtime158.JSX.Element;
26
26
  //#endregion
27
27
  export { InlineEditContextParams, InlineEditProvider, useInlineEditContext };
28
28
  //# sourceMappingURL=context.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/context.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAQY,KAAA,uBAAA,GAAuB;EAMnB,EAAA,EAAA,MAAA;EASA,UAAA,CAAA,EAfiD,UAe/B;CAChC;;;;AAEwD,iBAZ1C,oBAAA,CAAA,CAY0C,EAZtB,uBAYsB;;;;iBAH1C,kBAAA;;;GAGb;YAAsC,KAAA,CAAM;IAAW,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"context.client.d.mts","names":[],"sources":["../../../../src/modules/inline-edit/hooks/context.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAQY,KAAA,uBAAA,GAAuB;EAMnB,EAAA,EAAA,MAAA;EASA,UAAA,CAAA,EAfiD,UAe/B;CAChC;;;;AAEwD,iBAZ1C,oBAAA,CAAA,CAY0C,EAZtB,uBAYsB;;;;iBAH1C,kBAAA;;;GAGb;YAAsC,KAAA,CAAM;IAAW,oBAAA,CAAA,GAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { createQueryClient } from "./query-client.mjs";
2
- import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime157 from "react/jsx-runtime";
3
3
  import "server-cli-only";
4
4
 
5
5
  //#region src/modules/router/lib/query-client.server.d.ts
@@ -12,7 +12,7 @@ declare const getQueryClient: typeof createQueryClient;
12
12
  */
13
13
  declare function HydrateClient(props: {
14
14
  children: React.ReactNode;
15
- }): react_jsx_runtime1.JSX.Element;
15
+ }): react_jsx_runtime157.JSX.Element;
16
16
  //#endregion
17
17
  export { HydrateClient, getQueryClient };
18
18
  //# sourceMappingURL=query-client.server.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-client.server.d.mts","names":[],"sources":["../../../../src/modules/router/lib/query-client.server.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AASa,cAAA,cAAc,EAAA,OAAA,iBAA2B;AAKtD;;;iBAAgB,aAAA;YAAiC,KAAA,CAAM;IAAW,kBAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"query-client.server.d.mts","names":[],"sources":["../../../../src/modules/router/lib/query-client.server.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AASa,cAAA,cAAc,EAAA,OAAA,iBAA2B;AAKtD;;;iBAAgB,aAAA;YAAiC,KAAA,CAAM;IAAW,oBAAA,CAAA,GAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as react0 from "react";
1
+ import * as react97 from "react";
2
2
  import { DropzoneOptions } from "react-dropzone";
3
3
 
4
4
  //#region src/modules/storage/components/dropzone-context.client.d.ts
@@ -9,7 +9,7 @@ type DropzoneContextType = {
9
9
  minSize?: DropzoneOptions["minSize"];
10
10
  maxFiles?: DropzoneOptions["maxFiles"];
11
11
  };
12
- declare const DropzoneContext: react0.Context<DropzoneContextType | undefined>;
12
+ declare const DropzoneContext: react97.Context<DropzoneContextType | undefined>;
13
13
  /**
14
14
  * Dropzone context hook
15
15
  */
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone-context.client.tsx"],"sourcesContent":[],"mappings":";;;;KAKK,mBAAA;QACG;WACG;EAFN,OAAA,CAAA,EAGO,eAHY,CAAA,SAAA,CAAA;EAChB,OAAA,CAAA,EAGI,eAHJ,CAAA,SAAA,CAAA;EACG,QAAA,CAAA,EAGE,eAHF,CAAA,UAAA,CAAA;CACC;AACA,cAIC,eAJD,EAIgB,MAAA,CAAA,OAJhB,CAIgB,mBAJhB,GAAA,SAAA,CAAA;;;AAIZ;AAKgB,iBAAA,kBAAA,CAAA,CAAkB,EAAA,mBAAA"}
1
+ {"version":3,"file":"dropzone-context.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone-context.client.tsx"],"sourcesContent":[],"mappings":";;;;KAKK,mBAAA;QACG;WACG;EAFN,OAAA,CAAA,EAGO,eAHY,CAAA,SAAA,CAAA;EAChB,OAAA,CAAA,EAGI,eAHJ,CAAA,SAAA,CAAA;EACG,QAAA,CAAA,EAGE,eAHF,CAAA,UAAA,CAAA;CACC;AACA,cAIC,eAJD,EAIgB,OAAA,CAAA,OAJhB,CAIgB,mBAJhB,GAAA,SAAA,CAAA;;;AAIZ;AAKgB,iBAAA,kBAAA,CAAA,CAAkB,EAAA,mBAAA"}
@@ -1,5 +1,5 @@
1
- import * as react_jsx_runtime5 from "react/jsx-runtime";
2
- import * as react0 from "react";
1
+ import * as react_jsx_runtime152 from "react/jsx-runtime";
2
+ import * as react98 from "react";
3
3
  import { ReactNode } from "react";
4
4
  import { DropEvent, DropzoneOptions, FileRejection } from "react-dropzone";
5
5
 
@@ -25,7 +25,7 @@ declare function Dropzone({
25
25
  className,
26
26
  children,
27
27
  ...props
28
- }: DropzoneProps): react_jsx_runtime5.JSX.Element;
28
+ }: DropzoneProps): react_jsx_runtime152.JSX.Element;
29
29
  /**
30
30
  * DropzoneContent
31
31
  */
@@ -36,7 +36,7 @@ type DropzoneContentProps = {
36
36
  declare function DropzoneContent({
37
37
  children,
38
38
  className
39
- }: DropzoneContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime5.JSX.Element | null;
39
+ }: DropzoneContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react98.ReactPortal | react98.ReactElement<unknown, string | react98.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime152.JSX.Element | null;
40
40
  /**
41
41
  * DropzoneEmptyState
42
42
  */
@@ -47,7 +47,7 @@ type DropzoneEmptyStateProps = {
47
47
  declare function DropzoneEmptyState({
48
48
  children,
49
49
  className
50
- }: DropzoneEmptyStateProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react0.ReactPortal | react0.ReactElement<unknown, string | react0.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime5.JSX.Element | null;
50
+ }: DropzoneEmptyStateProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react98.ReactPortal | react98.ReactElement<unknown, string | react98.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime152.JSX.Element | null;
51
51
  //#endregion
52
52
  export { Dropzone, DropzoneContent, DropzoneContentProps, DropzoneEmptyState, DropzoneEmptyStateProps, DropzoneProps };
53
53
  //# sourceMappingURL=dropzone.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;K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CAAA,EAoF4C,uBApF5C,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,IAAA,GAoFmE,QApFnE,CAoFmE,SApFnE,CAAA,GAoFmE,OApFnE,CAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAoFmE,MAAA,CAAA,WAAA,GAAA,MAAA,CAAA,YApFnE,CAAA,OAAA,EAAA,MAAA,GAoFmE,MAAA,CAAA,qBApFnE,CAAA,GAAA,CAAA,CAAA,GAoFmE,QApFnE,CAoFmE,SApFnE,CAAA,GAAA,IAAA,GAAA,SAAA,CAAA,GAoFmE,kBAAA,CAAA,GAAA,CAAA,OAAA,GApFnE,IAAA"}
1
+ {"version":3,"file":"dropzone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/dropzone.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;KAcY,aAAA,GAAgB,KAAK;EAArB,GAAA,CAAA,EACJ,IADI,EAAA;EAAqB,SAAA,CAAA,EAAA,MAAA;EAAL,MAAA,CAAA,EAAA,CAAA,aAAA,EAGD,IAHC,EAAA,EAAA,cAAA,EAGuB,aAHvB,EAAA,EAAA,KAAA,EAG+C,SAH/C,EAAA,GAAA,IAAA;EACpB,QAAA,CAAA,EAGK,SAHL;CAEmB;AAAwB,iBAInC,QAAA,CAJmC;EAAA,MAAA;EAAA,QAAA;EAAA,OAAA;EAAA,OAAA;EAAA,MAAA;EAAA,OAAA;EAAA,QAAA;EAAA,GAAA;EAAA,SAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAgBhD,aAhBgD,CAAA,EAgBnC,oBAAA,CAAA,GAAA,CAAA,OAhBmC;;;;AAInC,KAsDJ,oBAAA,GAtDY;EACtB,QAAA,CAAA,EAsDW,SAtDX;EACA,SAAA,CAAA,EAAA,MAAA;CACA;AACA,iBAyDc,eAAA,CAzDd;EAAA,QAAA;EAAA;AAAA,CAAA,EAyDuD,oBAzDvD,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,IAAA,GAyD2E,QAzD3E,CAyD2E,SAzD3E,CAAA,GAyD2E,OAzD3E,CAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAyD2E,OAAA,CAAA,WAAA,GAAA,OAAA,CAAA,YAzD3E,CAAA,OAAA,EAAA,MAAA,GAyD2E,OAAA,CAAA,qBAzD3E,CAAA,GAAA,CAAA,CAAA,GAyD2E,QAzD3E,CAyD2E,SAzD3E,CAAA,GAAA,IAAA,GAAA,SAAA,CAAA,GAyD2E,oBAAA,CAAA,GAAA,CAAA,OAAA,GAzD3E,IAAA;;;;AAIA,KAmFU,uBAAA,GAnFV;EACA,QAAA,CAAA,EAmFW,SAnFX;EACA,SAAA,CAAA,EAAA,MAAA;CAEC;AAAa,iBAoFA,kBAAA,CApFA;EAAA,QAAA;EAAA;AAAA,CAAA,EAoF4C,uBApF5C,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,IAAA,GAoFmE,QApFnE,CAoFmE,SApFnE,CAAA,GAoFmE,OApFnE,CAAA,MAAA,GAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAoFmE,OAAA,CAAA,WAAA,GAAA,OAAA,CAAA,YApFnE,CAAA,OAAA,EAAA,MAAA,GAoFmE,OAAA,CAAA,qBApFnE,CAAA,GAAA,CAAA,CAAA,GAoFmE,QApFnE,CAoFmE,SApFnE,CAAA,GAAA,IAAA,GAAA,SAAA,CAAA,GAoFmE,oBAAA,CAAA,GAAA,CAAA,OAAA,GApFnE,IAAA"}
@@ -1,5 +1,5 @@
1
1
  import { FileNode } from "../lib/validators.mjs";
2
- import * as react_jsx_runtime8 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime155 from "react/jsx-runtime";
3
3
  import { ComponentProps } from "react";
4
4
 
5
5
  //#region src/modules/storage/components/image-grid.client.d.ts
@@ -19,8 +19,8 @@ declare function ImageGrid({
19
19
  moveAction,
20
20
  disabled,
21
21
  ...props
22
- }: ImageGridProps): react_jsx_runtime8.JSX.Element;
23
- declare function ImageGridSkeleton(props: ComponentProps<"div">): react_jsx_runtime8.JSX.Element;
22
+ }: ImageGridProps): react_jsx_runtime155.JSX.Element;
23
+ declare function ImageGridSkeleton(props: ComponentProps<"div">): react_jsx_runtime155.JSX.Element;
24
24
  //#endregion
25
25
  export { ImageGrid, ImageGridSkeleton };
26
26
  //# sourceMappingURL=image-grid.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-grid.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/image-grid.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAuC6C,KAMxC,cAAA,GAAiB,cAAH,CAAA,KAAA,CAAA,GAAA;EAAG,KAAA,EACb,QADa,EAAA;EACb,QAAA,CAAA,EAAA,OAAA;EAEyD,UAAA,EAAA,CAAA,MAAA,EAAA;IAAO,SAAA,EAAA,MAAA;IAGzD,OAAA,EAAS,MAAA;EAAG,CAAA,EAAA,GAHsC,OAGtC,CAAA,IAAA,CAAA;CAAO;AAAY,iBAA/B,SAAA,CAA+B;EAAA,KAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAAsB,cAAtB,CAAA,EAAoC,kBAAA,CAAA,GAAA,CAAA,OAApC;AAAsB,iBAkKrD,iBAAA,CAlKqD,KAAA,EAkK5B,cAlK4B,CAAA,KAAA,CAAA,CAAA,EAkKP,kBAAA,CAAA,GAAA,CAAA,OAlKO"}
1
+ {"version":3,"file":"image-grid.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/image-grid.client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAuC6C,KAMxC,cAAA,GAAiB,cAAH,CAAA,KAAA,CAAA,GAAA;EAAG,KAAA,EACb,QADa,EAAA;EACb,QAAA,CAAA,EAAA,OAAA;EAEyD,UAAA,EAAA,CAAA,MAAA,EAAA;IAAO,SAAA,EAAA,MAAA;IAGzD,OAAA,EAAS,MAAA;EAAG,CAAA,EAAA,GAHsC,OAGtC,CAAA,IAAA,CAAA;CAAO;AAAY,iBAA/B,SAAA,CAA+B;EAAA,KAAA;EAAA,UAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAAsB,cAAtB,CAAA,EAAoC,oBAAA,CAAA,GAAA,CAAA,OAApC;AAAsB,iBAkKrD,iBAAA,CAlKqD,KAAA,EAkK5B,cAlK4B,CAAA,KAAA,CAAA,CAAA,EAkKP,oBAAA,CAAA,GAAA,CAAA,OAlKO"}
@@ -1,11 +1,12 @@
1
- import { Node, PresignFileSchema } from "../lib/validators.mjs";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import { Node, PresignFileSchema, UploadFileSchema } from "../lib/validators.mjs";
2
+ import * as react_jsx_runtime151 from "react/jsx-runtime";
3
3
  import { ComponentProps } from "react";
4
4
 
5
5
  //#region src/modules/storage/components/upload-zone.client.d.ts
6
6
  type UploadZoneProps = ComponentProps<"div"> & {
7
7
  namespace: string;
8
8
  parentId: string | null;
9
+ options?: Pick<UploadFileSchema, "readonly" | "hidden" | "mode">;
9
10
  queryKey: readonly unknown[];
10
11
  presignAction: (params: PresignFileSchema) => Promise<{
11
12
  id: string;
@@ -30,6 +31,7 @@ type UploadZoneProps = ComponentProps<"div"> & {
30
31
  declare function UploadZone({
31
32
  namespace,
32
33
  parentId,
34
+ options,
33
35
  queryKey,
34
36
  presignAction,
35
37
  confirmAction,
@@ -45,7 +47,7 @@ declare function UploadZone({
45
47
  onDragOver,
46
48
  onDragLeave,
47
49
  ...props
48
- }: UploadZoneProps): react_jsx_runtime0.JSX.Element;
50
+ }: UploadZoneProps): react_jsx_runtime151.JSX.Element;
49
51
  //#endregion
50
52
  export { UploadZone, UploadZoneProps };
51
53
  //# sourceMappingURL=upload-zone.client.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone.client.d.mts","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":[],"mappings":";;;;;KAYY,eAAA,GAA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H,EAAA,GAJY,OAIZ,CAAA,IAAA,CAAA,GAAA,IAAA;EACxB,cAAA,CAAA,EAAA,CAAA,KAAA,EAAA,OAAA,EAAA,GAJqC,OAIrC,CAAA,IAAA,CAAA,GAAA,IAAA;CACA;AACA,iBAHc,UAAA,CAGd;EAAA,SAAA;EAAA,QAAA;EAAA,OAAA;EAAA,QAAA;EAAA,aAAA;EAAA,aAAA;EAAA,YAAA;EAAA,gBAAA;EAAA,kBAAA;EAAA,gBAAA;EAAA,kBAAA;EAAA,iBAAA;EAAA,cAAA;EAAA,QAAA;EAAA,SAAA;EAAA,UAAA;EAAA,WAAA;EAAA,GAAA;AAAA,CAAA,EAgBC,eAhBD,CAAA,EAgBgB,oBAAA,CAAA,GAAA,CAAA,OAhBhB"}
@@ -11,7 +11,7 @@ import { useCallback, useState } from "react";
11
11
  import { useQueryClient } from "@tanstack/react-query";
12
12
 
13
13
  //#region src/modules/storage/components/upload-zone.client.tsx
14
- function UploadZone({ namespace, parentId, queryKey, presignAction, confirmAction, deleteAction, onPresignStarted, onPresignCompleted, onConfirmStarted, onConfirmCompleted, onUploadCompleted, onUploadFailed, children, className, onDragOver, onDragLeave, ...props }) {
14
+ function UploadZone({ namespace, parentId, options, queryKey, presignAction, confirmAction, deleteAction, onPresignStarted, onPresignCompleted, onConfirmStarted, onConfirmCompleted, onUploadCompleted, onUploadFailed, children, className, onDragOver, onDragLeave, ...props }) {
15
15
  const queryClient = useQueryClient();
16
16
  const [isDragging, setIsDragging] = useState(false);
17
17
  /**
@@ -128,6 +128,7 @@ function UploadZone({ namespace, parentId, queryKey, presignAction, confirmActio
128
128
  * Send the presign request
129
129
  */
130
130
  const { id, presignedUrl } = await presignMutation.mutateAsync({
131
+ ...options,
131
132
  id: generateDefaultUUID(),
132
133
  name: file.name,
133
134
  size: file.size,
@@ -149,10 +150,11 @@ function UploadZone({ namespace, parentId, queryKey, presignAction, confirmActio
149
150
  return await confirmMutation.mutateAsync({ id });
150
151
  }, [
151
152
  presignMutation,
152
- uploadMutation,
153
- confirmMutation,
153
+ options,
154
154
  namespace,
155
- parentId
155
+ parentId,
156
+ uploadMutation,
157
+ confirmMutation
156
158
  ]);
157
159
  return /* @__PURE__ */ jsxs("div", {
158
160
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"upload-zone.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Input } from \"@/components/ui/input\";\nimport { toast } from \"@/components/ui/sonner.client\";\nimport { cn } from \"@/lib/entry\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { generateDefaultUUID } from \"@/modules/config/entry\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { ComponentProps, useCallback, useState } from \"react\";\nimport { FileNode, Node, PresignFileSchema } from \"../lib/validators\";\nimport { UploadZoneContext } from \"./upload-zone-context.client\";\n\nexport type UploadZoneProps = ComponentProps<\"div\"> & {\n namespace: string;\n parentId: string | null;\n\n queryKey: readonly unknown[];\n\n presignAction: (params: PresignFileSchema) => Promise<{ id: string; presignedUrl: string }>;\n onPresignStarted?: (file: PresignFileSchema) => Promise<void> | void;\n onPresignCompleted?: (data: { id: string; presignedUrl: string }) => Promise<void> | void;\n\n confirmAction: (params: { id: string }) => Promise<Node>;\n onConfirmStarted?: (id: string) => Promise<void> | void;\n onConfirmCompleted?: (node: Node) => Promise<void> | void;\n\n deleteAction: (params: { ids: string[] }) => Promise<unknown>;\n\n onUploadCompleted?: (node: Node) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n};\n\nexport function UploadZone({\n namespace,\n parentId,\n queryKey,\n presignAction,\n confirmAction,\n deleteAction,\n onPresignStarted,\n onPresignCompleted,\n onConfirmStarted,\n onConfirmCompleted,\n onUploadCompleted,\n onUploadFailed,\n children,\n className,\n onDragOver,\n onDragLeave,\n ...props\n}: UploadZoneProps) {\n const queryClient = useQueryClient();\n const [isDragging, setIsDragging] = useState(false);\n\n /**\n * Optimisticly update the data\n */\n const updateData = useCallback(\n async (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => {\n await queryClient.cancelQueries({ queryKey });\n await queryClient.setQueryData(queryKey, newValue);\n },\n [queryClient, queryKey],\n );\n\n /**\n * Invalidate the query\n */\n const invalidateQuery = useCallback(async () => {\n await queryClient.invalidateQueries({ queryKey });\n }, [queryClient, queryKey]);\n\n /**\n * Delete mutation\n */\n const deleteMutation = useAction({\n mutationFn: deleteAction,\n onMutate: async (variables) => {\n await updateData((prev) => prev.filter((node) => !variables.ids.includes(node.id)));\n },\n onSuccess: async () => {\n await invalidateQuery();\n },\n onError: async (error) => {\n await onUploadFailed?.(error);\n console.error(\"Delete failed upload error: \", error);\n },\n });\n\n /**\n * Presign upload mutation\n */\n const presignMutation = useAction({\n mutationFn: async (params: PresignFileSchema) => {\n await onPresignStarted?.(params);\n const data = await presignAction(params);\n await onPresignCompleted?.(data);\n return data;\n },\n onMutate: async (variables) => {\n // Generate a new node\n const newNode = {\n ...variables,\n type: \"file\",\n isPending: true,\n } as FileNode;\n\n await updateData((prev) => [...(prev ?? []), newNode]);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Presign error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync({ ids: [variables.id] });\n },\n });\n\n /**\n * Upload mutation\n */\n const uploadMutation = useAction({\n mutationFn: async (input: { id: string; presignedUrl: string; file: File }) => {\n /**\n * Upload the file\n */\n const uploadResponse = await fetch(input.presignedUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": input.file.type },\n body: input.file,\n });\n\n if (!uploadResponse.ok) {\n const message = await uploadResponse.text();\n throw new Error(`Upload failed: ${message}`);\n }\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Upload error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync({ ids: [variables.id] });\n },\n });\n\n /**\n * Confirm upload mutation\n */\n const confirmMutation = useAction({\n mutationFn: async (params: { id: string }) => {\n await onConfirmStarted?.(params.id);\n const data = await confirmAction(params);\n await onConfirmCompleted?.(data);\n return data;\n },\n onSuccess: async (data) => {\n await onUploadCompleted?.(data);\n toast.success(`Succesvol geupload: ${data.name}`);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Confirm error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync({ ids: [variables.id] });\n },\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey });\n },\n });\n\n /**\n * Upload file handler\n */\n const onUpload = useCallback(\n async (file: File) => {\n /**\n * Send the presign request\n */\n const { id, presignedUrl } = await presignMutation.mutateAsync({\n id: generateDefaultUUID(),\n name: file.name,\n size: file.size,\n contentType: file.type,\n namespace,\n parentId,\n });\n\n /**\n * Uploading the file\n */\n await uploadMutation.mutateAsync({ id, presignedUrl, file });\n\n /**\n * Confirming the upload\n */\n return await confirmMutation.mutateAsync({ id });\n },\n [presignMutation, uploadMutation, confirmMutation, namespace, parentId],\n );\n\n return (\n <div\n {...props}\n className={cn(\"relative z-0 flex-1 space-y-6\", className)}\n onDragOver={(...args) => {\n setIsDragging(true);\n return onDragOver?.(...args);\n }}\n onDragLeave={(...args) => {\n setIsDragging(false);\n return onDragLeave?.(...args);\n }}\n >\n {isDragging && (\n <div className=\"border-primary bg-primary/20 absolute -inset-5 z-10 rounded-md border opacity-70 backdrop-blur-3xl\">\n <Input\n multiple\n type=\"file\"\n className=\"h-full w-full opacity-0\"\n onChange={async (e) => {\n setIsDragging(false);\n\n if (!e.target.files) return;\n\n await Promise.allSettled(Array.from(e.target.files).map(onUpload));\n }}\n />\n </div>\n )}\n <UploadZoneContext\n value={{\n presignMutation: (params) => presignMutation.mutateAsync(params),\n confirmMutation: (params) => confirmMutation.mutateAsync(params),\n deleteMutation: (params) => deleteMutation.mutateAsync(params),\n onUpload,\n updateData,\n invalidateQuery,\n }}\n >\n {children}\n </UploadZoneContext>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAgB,WAAW,EACzB,WACA,UACA,UACA,eACA,eACA,cACA,kBACA,oBACA,kBACA,oBACA,mBACA,gBACA,UACA,WACA,YACA,aACA,GAAG,SACe;CAClB,MAAM,cAAc,gBAAgB;CACpC,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;;;;CAKnD,MAAM,aAAa,YACjB,OAAO,aAAkE;AACvE,QAAM,YAAY,cAAc,EAAE,UAAU,CAAC;AAC7C,QAAM,YAAY,aAAa,UAAU,SAAS;IAEpD,CAAC,aAAa,SAAS,CACxB;;;;CAKD,MAAM,kBAAkB,YAAY,YAAY;AAC9C,QAAM,YAAY,kBAAkB,EAAE,UAAU,CAAC;IAChD,CAAC,aAAa,SAAS,CAAC;;;;CAK3B,MAAM,iBAAiB,UAAU;EAC/B,YAAY;EACZ,UAAU,OAAO,cAAc;AAC7B,SAAM,YAAY,SAAS,KAAK,QAAQ,SAAS,CAAC,UAAU,IAAI,SAAS,KAAK,GAAG,CAAC,CAAC;;EAErF,WAAW,YAAY;AACrB,SAAM,iBAAiB;;EAEzB,SAAS,OAAO,UAAU;AACxB,SAAM,iBAAiB,MAAM;AAC7B,WAAQ,MAAM,gCAAgC,MAAM;;EAEvD,CAAC;;;;CAKF,MAAM,kBAAkB,UAAU;EAChC,YAAY,OAAO,WAA8B;AAC/C,SAAM,mBAAmB,OAAO;GAChC,MAAM,OAAO,MAAM,cAAc,OAAO;AACxC,SAAM,qBAAqB,KAAK;AAChC,UAAO;;EAET,UAAU,OAAO,cAAc;GAE7B,MAAM,UAAU;IACd,GAAG;IACH,MAAM;IACN,WAAW;IACZ;AAED,SAAM,YAAY,SAAS,CAA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EA;IACiB;GAChB"}
1
+ {"version":3,"file":"upload-zone.client.mjs","names":[],"sources":["../../../../src/modules/storage/components/upload-zone.client.tsx"],"sourcesContent":["\"use client\";\n\nimport { Input } from \"@/components/ui/input\";\nimport { toast } from \"@/components/ui/sonner.client\";\nimport { cn } from \"@/lib/entry\";\nimport { useAction } from \"@/lib/hooks/use-action\";\nimport { generateDefaultUUID } from \"@/modules/config/entry\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { ComponentProps, useCallback, useState } from \"react\";\nimport { FileNode, Node, PresignFileSchema, UploadFileSchema } from \"../lib/validators\";\nimport { UploadZoneContext } from \"./upload-zone-context.client\";\n\nexport type UploadZoneProps = ComponentProps<\"div\"> & {\n namespace: string;\n parentId: string | null;\n options?: Pick<UploadFileSchema, \"readonly\" | \"hidden\" | \"mode\">;\n\n queryKey: readonly unknown[];\n\n presignAction: (params: PresignFileSchema) => Promise<{ id: string; presignedUrl: string }>;\n onPresignStarted?: (file: PresignFileSchema) => Promise<void> | void;\n onPresignCompleted?: (data: { id: string; presignedUrl: string }) => Promise<void> | void;\n\n confirmAction: (params: { id: string }) => Promise<Node>;\n onConfirmStarted?: (id: string) => Promise<void> | void;\n onConfirmCompleted?: (node: Node) => Promise<void> | void;\n\n deleteAction: (params: { ids: string[] }) => Promise<unknown>;\n\n onUploadCompleted?: (node: Node) => Promise<void> | void;\n onUploadFailed?: (error: unknown) => Promise<void> | void;\n};\n\nexport function UploadZone({\n namespace,\n parentId,\n options,\n queryKey,\n presignAction,\n confirmAction,\n deleteAction,\n onPresignStarted,\n onPresignCompleted,\n onConfirmStarted,\n onConfirmCompleted,\n onUploadCompleted,\n onUploadFailed,\n children,\n className,\n onDragOver,\n onDragLeave,\n ...props\n}: UploadZoneProps) {\n const queryClient = useQueryClient();\n const [isDragging, setIsDragging] = useState(false);\n\n /**\n * Optimisticly update the data\n */\n const updateData = useCallback(\n async (newValue: FileNode[] | ((oldValue: FileNode[]) => FileNode[])) => {\n await queryClient.cancelQueries({ queryKey });\n await queryClient.setQueryData(queryKey, newValue);\n },\n [queryClient, queryKey],\n );\n\n /**\n * Invalidate the query\n */\n const invalidateQuery = useCallback(async () => {\n await queryClient.invalidateQueries({ queryKey });\n }, [queryClient, queryKey]);\n\n /**\n * Delete mutation\n */\n const deleteMutation = useAction({\n mutationFn: deleteAction,\n onMutate: async (variables) => {\n await updateData((prev) => prev.filter((node) => !variables.ids.includes(node.id)));\n },\n onSuccess: async () => {\n await invalidateQuery();\n },\n onError: async (error) => {\n await onUploadFailed?.(error);\n console.error(\"Delete failed upload error: \", error);\n },\n });\n\n /**\n * Presign upload mutation\n */\n const presignMutation = useAction({\n mutationFn: async (params: PresignFileSchema) => {\n await onPresignStarted?.(params);\n const data = await presignAction(params);\n await onPresignCompleted?.(data);\n return data;\n },\n onMutate: async (variables) => {\n // Generate a new node\n const newNode = {\n ...variables,\n type: \"file\",\n isPending: true,\n } as FileNode;\n\n await updateData((prev) => [...(prev ?? []), newNode]);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Presign error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync({ ids: [variables.id] });\n },\n });\n\n /**\n * Upload mutation\n */\n const uploadMutation = useAction({\n mutationFn: async (input: { id: string; presignedUrl: string; file: File }) => {\n /**\n * Upload the file\n */\n const uploadResponse = await fetch(input.presignedUrl, {\n method: \"PUT\",\n headers: { \"Content-Type\": input.file.type },\n body: input.file,\n });\n\n if (!uploadResponse.ok) {\n const message = await uploadResponse.text();\n throw new Error(`Upload failed: ${message}`);\n }\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Upload error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync({ ids: [variables.id] });\n },\n });\n\n /**\n * Confirm upload mutation\n */\n const confirmMutation = useAction({\n mutationFn: async (params: { id: string }) => {\n await onConfirmStarted?.(params.id);\n const data = await confirmAction(params);\n await onConfirmCompleted?.(data);\n return data;\n },\n onSuccess: async (data) => {\n await onUploadCompleted?.(data);\n toast.success(`Succesvol geupload: ${data.name}`);\n },\n onError: async (error, variables) => {\n await onUploadFailed?.(error);\n\n console.error(\"Confirm error: \", error);\n toast.error(\"Bestand uploaden mislukt\", {\n description: error instanceof Error ? error.message : undefined,\n });\n\n console.info(\"Deleting failed upload\");\n await deleteMutation.mutateAsync({ ids: [variables.id] });\n },\n onSettled: () => {\n queryClient.invalidateQueries({ queryKey });\n },\n });\n\n /**\n * Upload file handler\n */\n const onUpload = useCallback(\n async (file: File) => {\n /**\n * Send the presign request\n */\n const { id, presignedUrl } = await presignMutation.mutateAsync({\n ...options,\n id: generateDefaultUUID(),\n name: file.name,\n size: file.size,\n contentType: file.type,\n namespace,\n parentId,\n });\n\n /**\n * Uploading the file\n */\n await uploadMutation.mutateAsync({ id, presignedUrl, file });\n\n /**\n * Confirming the upload\n */\n return await confirmMutation.mutateAsync({ id });\n },\n [presignMutation, options, namespace, parentId, uploadMutation, confirmMutation],\n );\n\n return (\n <div\n {...props}\n className={cn(\"relative z-0 flex-1 space-y-6\", className)}\n onDragOver={(...args) => {\n setIsDragging(true);\n return onDragOver?.(...args);\n }}\n onDragLeave={(...args) => {\n setIsDragging(false);\n return onDragLeave?.(...args);\n }}\n >\n {isDragging && (\n <div className=\"border-primary bg-primary/20 absolute -inset-5 z-10 rounded-md border opacity-70 backdrop-blur-3xl\">\n <Input\n multiple\n type=\"file\"\n className=\"h-full w-full opacity-0\"\n onChange={async (e) => {\n setIsDragging(false);\n\n if (!e.target.files) return;\n\n await Promise.allSettled(Array.from(e.target.files).map(onUpload));\n }}\n />\n </div>\n )}\n <UploadZoneContext\n value={{\n presignMutation: (params) => presignMutation.mutateAsync(params),\n confirmMutation: (params) => confirmMutation.mutateAsync(params),\n deleteMutation: (params) => deleteMutation.mutateAsync(params),\n onUpload,\n updateData,\n invalidateQuery,\n }}\n >\n {children}\n </UploadZoneContext>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,SAAgB,WAAW,EACzB,WACA,UACA,SACA,UACA,eACA,eACA,cACA,kBACA,oBACA,kBACA,oBACA,mBACA,gBACA,UACA,WACA,YACA,aACA,GAAG,SACe;CAClB,MAAM,cAAc,gBAAgB;CACpC,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;;;;CAKnD,MAAM,aAAa,YACjB,OAAO,aAAkE;AACvE,QAAM,YAAY,cAAc,EAAE,UAAU,CAAC;AAC7C,QAAM,YAAY,aAAa,UAAU,SAAS;IAEpD,CAAC,aAAa,SAAS,CACxB;;;;CAKD,MAAM,kBAAkB,YAAY,YAAY;AAC9C,QAAM,YAAY,kBAAkB,EAAE,UAAU,CAAC;IAChD,CAAC,aAAa,SAAS,CAAC;;;;CAK3B,MAAM,iBAAiB,UAAU;EAC/B,YAAY;EACZ,UAAU,OAAO,cAAc;AAC7B,SAAM,YAAY,SAAS,KAAK,QAAQ,SAAS,CAAC,UAAU,IAAI,SAAS,KAAK,GAAG,CAAC,CAAC;;EAErF,WAAW,YAAY;AACrB,SAAM,iBAAiB;;EAEzB,SAAS,OAAO,UAAU;AACxB,SAAM,iBAAiB,MAAM;AAC7B,WAAQ,MAAM,gCAAgC,MAAM;;EAEvD,CAAC;;;;CAKF,MAAM,kBAAkB,UAAU;EAChC,YAAY,OAAO,WAA8B;AAC/C,SAAM,mBAAmB,OAAO;GAChC,MAAM,OAAO,MAAM,cAAc,OAAO;AACxC,SAAM,qBAAqB,KAAK;AAChC,UAAO;;EAET,UAAU,OAAO,cAAc;GAE7B,MAAM,UAAU;IACd,GAAG;IACH,MAAM;IACN,WAAW;IACZ;AAED,SAAM,YAAY,SAAS,CAAC,GAAI,QAAQ,EAAE,EAAG,QAAQ,CAAC;;EAExD,SAAS,OAAO,OAAO,cAAc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9
9
  }>>>;
10
10
  nodeIds: ParseFilter<z.ZodArray<z.ZodString>>;
11
11
  isDeleted: ParseFilter<z.ZodBoolean>;
12
+ hidden: ParseFilter<z.ZodBoolean>;
12
13
  };
13
14
  //#endregion
14
15
  export { nodesTableFilters };
@@ -1 +1 @@
1
- {"version":3,"file":"filters.d.mts","names":[],"sources":["../../../../src/modules/storage/config/filters.ts"],"sourcesContent":[],"mappings":";;;;cAKa;;;IAAA,MAAA,EAAA,QAIX"}
1
+ {"version":3,"file":"filters.d.mts","names":[],"sources":["../../../../src/modules/storage/config/filters.ts"],"sourcesContent":[],"mappings":";;;;cAKa;;;IAAA,MAAA,EAAA,QAKX"}
@@ -7,7 +7,8 @@ import z from "zod";
7
7
  const nodesTableFilters = createTableFilters({
8
8
  types: parseFilterArray(z.array(z.enum(nodeTypeEnum.enumValues))),
9
9
  nodeIds: parseFilterArray(z.array(z.string())),
10
- isDeleted: parseFilterBoolean(z.boolean())
10
+ isDeleted: parseFilterBoolean(z.boolean()),
11
+ hidden: parseFilterBoolean(z.boolean())
11
12
  });
12
13
 
13
14
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"filters.mjs","names":[],"sources":["../../../../src/modules/storage/config/filters.ts"],"sourcesContent":["import { createTableFilters } from \"@/modules/data-tables/lib/filters/config\";\nimport { parseFilterArray, parseFilterBoolean } from \"@/modules/data-tables/lib/filters/parsers\";\nimport z from \"zod\";\nimport { nodeTypeEnum } from \"../lib/schema\";\n\nexport const nodesTableFilters = createTableFilters({\n types: parseFilterArray(z.array(z.enum(nodeTypeEnum.enumValues))),\n nodeIds: parseFilterArray(z.array(z.string())),\n isDeleted: parseFilterBoolean(z.boolean()),\n});\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,mBAAmB;CAClD,OAAO,iBAAiB,EAAE,MAAM,EAAE,KAAK,aAAa,WAAW,CAAC,CAAC;CACjE,SAAS,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;CAC9C,WAAW,mBAAmB,EAAE,SAAS,CAAC;CAC3C,CAAC"}
1
+ {"version":3,"file":"filters.mjs","names":[],"sources":["../../../../src/modules/storage/config/filters.ts"],"sourcesContent":["import { createTableFilters } from \"@/modules/data-tables/lib/filters/config\";\nimport { parseFilterArray, parseFilterBoolean } from \"@/modules/data-tables/lib/filters/parsers\";\nimport z from \"zod\";\nimport { nodeTypeEnum } from \"../lib/schema\";\n\nexport const nodesTableFilters = createTableFilters({\n types: parseFilterArray(z.array(z.enum(nodeTypeEnum.enumValues))),\n nodeIds: parseFilterArray(z.array(z.string())),\n isDeleted: parseFilterBoolean(z.boolean()),\n hidden: parseFilterBoolean(z.boolean()),\n});\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,mBAAmB;CAClD,OAAO,iBAAiB,EAAE,MAAM,EAAE,KAAK,aAAa,WAAW,CAAC,CAAC;CACjE,SAAS,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;CAC9C,WAAW,mBAAmB,EAAE,SAAS,CAAC;CAC1C,QAAQ,mBAAmB,EAAE,SAAS,CAAC;CACxC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { FileNode, GetFileURLSchema, Node } from "./validators.mjs";
1
+ import { CreateNodeSchema, GetFileURLSchema, Node } from "./validators.mjs";
2
2
  import { ImageVariant } from "./constants.mjs";
3
3
  import { ImageLoaderProps } from "next/image";
4
4
 
@@ -35,7 +35,7 @@ type NodeSubtype = (typeof nodeSubtypes)[number];
35
35
  declare function inferNodeSubtype({
36
36
  name,
37
37
  contentType
38
- }: Pick<FileNode, "name" | "contentType">): NodeSubtype;
38
+ }: Pick<CreateNodeSchema, "name" | "contentType">): NodeSubtype;
39
39
  /**
40
40
  * Render bytes
41
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;;AAOA;AAAkC,iBAAlB,MAAA,CAAkB,IAAA,EAAL,IAA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AAA,OAAA,CAAA,EAOhB,OAPgB,CAOR,gBAPQ,CAAA,CAAA,EAAA,MAAA;AAOhE;AAYA;;AAAmC,iBAAnB,WAAA,CAAmB;EAAA,GAAA;EAAA;AAAA,CAAA,EAAS,gBAAT,CAAA,EAAA,MAAA;;;AASnC;AAOa,iBAPG,iBAAA,CAeN,EAAA,EAAA,MAAA,EAAA,OAAA,EAf6C,YAe7C,CAAA,EAAA,MAAA;AAEV;AAEA;;AAEE,cAdW,YAcX,EAAA,SAAA,CAAA,OAAA,EAAA,UAAA,EAAA,aAAA,EAAA,OAAA,EAAA,OAAA,EAAA,SAAA,EAAA,OAAA,CAAA;AACM,KALI,WAAA,GAKJ,CAAA,OAL0B,YAK1B,CAAA,CAAA,MAAA,CAAA;AAAL,iBAHa,gBAAA,CAGb;EAAA,IAAA;EAAA;AAAA,CAAA,EAAA,IAAA,CAAK,gBAAL,EAAA,MAAA,GAAA,aAAA,CAAA,CAAA,EAAiD,WAAjD;;;AAqBH;iBAAgB,WAAA"}
@@ -48,6 +48,7 @@ const nodeSubtypes = [
48
48
  "other"
49
49
  ];
50
50
  function inferNodeSubtype({ name, contentType }) {
51
+ if (!contentType) return "other";
51
52
  if (contentType?.startsWith("image/")) return "image";
52
53
  if (contentType === "application/pdf") return "document";
53
54
  if (contentType?.includes("spreadsheet")) return "spreadsheet";
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":[],"sources":["../../../../src/modules/storage/lib/helpers.ts"],"sourcesContent":["import { ImageLoaderProps } from \"next/image\";\nimport { ImageVariant } from \"./constants\";\nimport { FileNode, GetFileURLSchema, Node } from \"./validators\";\n\n/**\n * Check if the node is a file\n */\nexport function isFile(node: Pick<Node, \"type\">): node is Node {\n return node.type === \"file\";\n}\n\n/**\n * Check if the node is a folder\n */\nexport function isFolder(node: Pick<Node, \"type\">): node is Node {\n return node.type === \"folder\";\n}\n\n/**\n * Get file url\n */\nexport function getFileUrl(id: string, options: Partial<GetFileURLSchema> = {}) {\n const searchParams = new URLSearchParams();\n searchParams.set(\"id\", id);\n if (options?.variant) searchParams.set(\"variant\", options.variant);\n if (options?.disposition) searchParams.set(\"disposition\", options.disposition);\n\n return `/api/storage/files?${searchParams.toString()}`;\n}\n\n/**\n * Image loader\n */\nexport function imageLoader({ src, width }: ImageLoaderProps) {\n const url = new URL(src, window.location.origin);\n url.searchParams.set(\"variant\", `preview-${width}`);\n return url.toString();\n}\n\n/**\n * Generate object key\n */\nexport function getDriveBucketKey(id: string, variant: ImageVariant) {\n return `storage/${id}/${variant}`;\n}\n\n/**\n * Node subtype\n */\nexport const nodeSubtypes = [\n \"image\",\n \"document\",\n \"spreadsheet\",\n \"video\",\n \"audio\",\n \"archive\",\n \"other\",\n] as const;\n\nexport type NodeSubtype = (typeof nodeSubtypes)[number];\n\nexport function inferNodeSubtype({\n name,\n contentType,\n}: Pick<FileNode, \"name\" | \"contentType\">): NodeSubtype {\n if (contentType?.startsWith(\"image/\")) return \"image\";\n if (contentType === \"application/pdf\") return \"document\";\n if (contentType?.includes(\"spreadsheet\")) return \"spreadsheet\";\n if (contentType?.startsWith(\"video/\")) return \"video\";\n if (contentType?.startsWith(\"audio/\")) return \"audio\";\n if (contentType?.includes(\"zip\") || contentType?.includes(\"archive\")) return \"archive\";\n\n const ext = name.split(\".\").pop()?.toLowerCase();\n if ([\"jpg\", \"jpeg\", \"png\", \"gif\", \"bmp\", \"webp\"].includes(ext ?? \"\")) return \"image\";\n if ([\"pdf\", \"doc\", \"docx\", \"txt\"].includes(ext ?? \"\")) return \"document\";\n if ([\"xls\", \"xlsx\", \"ods\"].includes(ext ?? \"\")) return \"spreadsheet\";\n if ([\"zip\", \"rar\", \"7z\"].includes(ext ?? \"\")) return \"archive\";\n\n return \"other\";\n}\n\n/**\n * Render bytes\n */\nexport function renderBytes(bytes: number) {\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units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7E,KAAI;EAAC;EAAO;EAAO;EAAQ;EAAM,CAAC,SAAS,OAAO,GAAG,CAAE,QAAO;AAC9D,KAAI;EAAC;EAAO;EAAQ;EAAM,CAAC,SAAS,OAAO,GAAG,CAAE,QAAO;AACvD,KAAI;EAAC;EAAO;EAAO;EAAK,CAAC,SAAS,OAAO,GAAG,CAAE,QAAO;AAErD,QAAO;;;;;AAMT,SAAgB,YAAY,OAAe;CACzC,MAAM,QAAQ;EAAC;EAAK;EAAM;EAAM;EAAM;EAAM;EAAK;CAEjD,IAAI,OAAO;CACX,IAAI,YAAY;AAEhB,QAAO,QAAQ,QAAQ,YAAY,MAAM,SAAS,GAAG;AACnD,UAAQ;AACR;;AAGF,QAAO,GAAG,KAAK,QAAQ,EAAE,GAAG,MAAM"}
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":["../../../../src/modules/storage/lib/helpers.ts"],"sourcesContent":["import { ImageLoaderProps } from \"next/image\";\nimport { ImageVariant } from \"./constants\";\nimport { CreateNodeSchema, GetFileURLSchema, Node } from \"./validators\";\n\n/**\n * Check if the node is a file\n */\nexport function isFile(node: Pick<Node, \"type\">): node is Node {\n return node.type === \"file\";\n}\n\n/**\n * Check if the node is a folder\n */\nexport function isFolder(node: Pick<Node, \"type\">): node is Node {\n return node.type === \"folder\";\n}\n\n/**\n * Get file url\n */\nexport function getFileUrl(id: string, options: Partial<GetFileURLSchema> = {}) {\n const searchParams = new URLSearchParams();\n searchParams.set(\"id\", id);\n if (options?.variant) searchParams.set(\"variant\", options.variant);\n if (options?.disposition) searchParams.set(\"disposition\", options.disposition);\n\n return `/api/storage/files?${searchParams.toString()}`;\n}\n\n/**\n * Image loader\n */\nexport function imageLoader({ src, width }: ImageLoaderProps) {\n const url = new URL(src, window.location.origin);\n url.searchParams.set(\"variant\", `preview-${width}`);\n return url.toString();\n}\n\n/**\n * Generate object key\n */\nexport function getDriveBucketKey(id: string, variant: ImageVariant) {\n return `storage/${id}/${variant}`;\n}\n\n/**\n * Node subtype\n */\nexport const nodeSubtypes = [\n \"image\",\n \"document\",\n \"spreadsheet\",\n \"video\",\n \"audio\",\n \"archive\",\n \"other\",\n] as const;\n\nexport type NodeSubtype = (typeof nodeSubtypes)[number];\n\nexport function inferNodeSubtype({\n name,\n contentType,\n}: Pick<CreateNodeSchema, \"name\" | \"contentType\">): NodeSubtype {\n if (!contentType) return \"other\";\n if (contentType?.startsWith(\"image/\")) return \"image\";\n if (contentType === \"application/pdf\") return \"document\";\n if (contentType?.includes(\"spreadsheet\")) return \"spreadsheet\";\n if (contentType?.startsWith(\"video/\")) return \"video\";\n if (contentType?.startsWith(\"audio/\")) return \"audio\";\n if (contentType?.includes(\"zip\") || contentType?.includes(\"archive\")) return \"archive\";\n\n const ext = name.split(\".\").pop()?.toLowerCase();\n if ([\"jpg\", \"jpeg\", \"png\", \"gif\", \"bmp\", \"webp\"].includes(ext ?? \"\")) return \"image\";\n if ([\"pdf\", \"doc\", \"docx\", \"txt\"].includes(ext ?? \"\")) return \"document\";\n if ([\"xls\", \"xlsx\", \"ods\"].includes(ext ?? \"\")) return \"spreadsheet\";\n if ([\"zip\", \"rar\", \"7z\"].includes(ext ?? \"\")) return \"archive\";\n\n return \"other\";\n}\n\n/**\n * Render bytes\n */\nexport function renderBytes(bytes: number) {\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${size.toFixed(2)}${units[unitIndex]}`;\n}\n"],"mappings":";;;;AAOA,SAAgB,OAAO,MAAwC;AAC7D,QAAO,KAAK,SAAS;;;;;AAMvB,SAAgB,SAAS,MAAwC;AAC/D,QAAO,KAAK,SAAS;;;;;AAMvB,SAAgB,WAAW,IAAY,UAAqC,EAAE,EAAE;CAC9E,MAAM,eAAe,IAAI,iBAAiB;AAC1C,cAAa,IAAI,MAAM,GAAG;AAC1B,KAAI,SAAS,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