@tulip-systems/core 0.10.0 → 0.10.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.
- package/dist/auth/client.d.mts +11 -11
- package/dist/auth/client.mjs +10 -10
- package/dist/auth/server.d.mts +8 -8
- package/dist/auth/server.mjs +8 -8
- package/dist/auth.d.mts +5 -5
- package/dist/auth.mjs +4 -4
- package/dist/commands/client.d.mts +16 -16
- package/dist/commands/client.mjs +16 -16
- package/dist/commands.d.mts +3 -3
- package/dist/commands.mjs +3 -3
- package/dist/components/client.d.mts +49 -48
- package/dist/components/client.mjs +49 -48
- package/dist/components/editor/extensions/file-handler/extension.d.mts +1 -1
- package/dist/components/editor/extensions/image/extension.d.mts +1 -1
- package/dist/components/editor/extensions/skeleton/extension.mjs +1 -1
- package/dist/components/editor/lib/constants.d.mts +1 -1
- package/dist/components/editor/lib/extensions.d.mts +1 -1
- package/dist/components/editor/lib/helpers.d.mts +5 -1
- package/dist/components/editor/lib/helpers.mjs +8 -1
- package/dist/components/layouts/root-layout.server.d.mts +3 -2
- package/dist/components/layouts/root-layout.server.mjs +1 -3
- package/dist/components/server.d.mts +3 -3
- package/dist/components/server.mjs +2 -2
- package/dist/components/themes/color-theme-provider.client.d.mts +27 -0
- package/dist/components/themes/color-theme-provider.client.mjs +59 -0
- package/dist/components/themes/color-theme.d.mts +29 -0
- package/dist/components/themes/color-theme.mjs +32 -0
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/components.d.mts +41 -40
- package/dist/components.mjs +40 -39
- package/dist/config.d.mts +5 -7
- package/dist/config.mjs +4 -5
- package/dist/data-tables/client.d.mts +21 -21
- package/dist/data-tables/client.mjs +21 -21
- package/dist/data-tables/server.d.mts +7 -7
- package/dist/data-tables/server.mjs +7 -7
- package/dist/data-tables.d.mts +15 -14
- package/dist/data-tables.mjs +14 -13
- package/dist/database/server.d.mts +1 -1
- package/dist/database/server.mjs +1 -1
- package/dist/database.d.mts +2 -2
- package/dist/database.mjs +1 -1
- package/dist/emails/server.d.mts +1 -1
- package/dist/emails/server.mjs +1 -1
- package/dist/inline/client.d.mts +15 -15
- package/dist/inline/client.mjs +15 -15
- package/dist/inline.d.mts +1 -1
- package/dist/inline.mjs +1 -1
- package/dist/lib/client.d.mts +4 -4
- package/dist/lib/client.mjs +4 -4
- package/dist/lib/utils/url.d.mts +15 -4
- package/dist/lib/utils/url.mjs +17 -8
- package/dist/lib.d.mts +7 -7
- package/dist/lib.mjs +6 -6
- package/dist/modules/auth/components/create-first-user-guard.server.d.mts +4 -3
- package/dist/modules/auth/components/guard.server.d.mts +5 -5
- package/dist/modules/auth/components/guard.server.mjs +3 -4
- package/dist/modules/auth/handler/create-client.client.d.mts +28 -6382
- package/dist/modules/auth/handler/create-client.client.mjs +4 -16
- package/dist/modules/auth/handler/proxy.server.d.mts +1 -0
- package/dist/modules/auth/handler/proxy.server.mjs +1 -1
- package/dist/modules/auth/handler/route.server.d.mts +2 -4
- package/dist/modules/auth/handler/route.server.mjs +3 -3
- package/dist/modules/auth/handler/service.server.d.mts +41 -2079
- package/dist/modules/auth/handler/service.server.mjs +40 -60
- package/dist/modules/auth/hooks/use-auth-client.d.mts +5 -6
- package/dist/modules/auth/hooks/use-permission.d.mts +7 -7
- package/dist/modules/auth/hooks/use-permission.mjs +1 -1
- package/dist/modules/auth/hooks/use-session.d.mts +13 -35
- package/dist/modules/auth/hooks/use-session.mjs +3 -0
- package/dist/modules/auth/lib/helpers.server.d.mts +7 -77
- package/dist/modules/auth/lib/helpers.server.mjs +4 -34
- package/dist/modules/auth/lib/permissions.d.mts +22 -3
- package/dist/modules/auth/plugins/admin.d.mts +917 -0
- package/dist/modules/auth/plugins/admin.mjs +18 -0
- package/dist/modules/auth/plugins/email-otp.d.mts +554 -0
- package/dist/modules/auth/plugins/email-otp.mjs +34 -0
- package/dist/modules/config/lib/context.d.mts +5 -4
- package/dist/modules/data-tables/lib/converters/dto.d.mts +12 -1
- package/dist/modules/data-tables/lib/converters/dto.mjs +13 -1
- package/dist/modules/data-tables/lib/converters/filters.d.mts +1 -1
- package/dist/modules/data-tables/server/get-data.server.d.mts +3 -2
- package/dist/modules/inline/lib/variants.d.mts +1 -1
- package/dist/modules/router/handler/init.server.d.mts +43 -51
- package/dist/modules/router/handler/init.server.mjs +24 -41
- package/dist/modules/router/handler/route.server.d.mts +6 -3
- package/dist/modules/router/handler/route.server.mjs +6 -9
- package/dist/modules/router/lib/query-client.server.d.mts +2 -2
- package/dist/modules/router/lib/query-client.server.mjs +3 -3
- package/dist/modules/storage/components/dropzone.client.d.mts +2 -2
- package/dist/modules/storage/lib/router-handlers.server.d.mts +6 -7
- package/dist/modules/storage/lib/router-handlers.server.mjs +2 -2
- package/dist/modules/storage/lib/{procedures.server.d.mts → router.server.d.mts} +42 -19
- package/dist/modules/storage/lib/router.server.mjs +21 -0
- package/dist/modules/storage/lib/service.server.d.mts +19 -19
- package/dist/modules/storage/lib/upload.client.d.mts +9 -10
- package/dist/router/client.d.mts +1 -1
- package/dist/router/client.mjs +1 -1
- package/dist/router/server.d.mts +7 -8
- package/dist/router/server.mjs +7 -8
- package/dist/router.d.mts +2 -2
- package/dist/router.mjs +2 -2
- package/dist/storage/client.d.mts +8 -8
- package/dist/storage/client.mjs +8 -8
- package/dist/storage/server.d.mts +5 -5
- package/dist/storage/server.mjs +5 -5
- package/dist/storage.d.mts +8 -8
- package/dist/storage.mjs +7 -7
- package/package.json +2 -2
- package/src/components/editor/lib/helpers.ts +8 -0
- package/src/components/entry.client.ts +1 -1
- package/src/components/entry.ts +1 -1
- package/src/components/layouts/root-layout.server.tsx +4 -2
- package/src/components/themes/color-theme-provider.client.tsx +82 -0
- package/src/components/themes/color-theme.ts +32 -0
- package/src/lib/utils/url.ts +19 -8
- package/src/modules/auth/components/create-first-user-guard.server.tsx +5 -4
- package/src/modules/auth/components/create-first-user-page.client.tsx +6 -1
- package/src/modules/auth/components/forget-password-page.client.tsx +3 -2
- package/src/modules/auth/components/guard.server.tsx +6 -7
- package/src/modules/auth/components/login-page.client.tsx +3 -1
- package/src/modules/auth/components/reset-password-page.client.tsx +3 -2
- package/src/modules/auth/db/schema.ts +1 -1
- package/src/modules/auth/entry.server.ts +0 -1
- package/src/modules/auth/handler/create-client.client.ts +43 -41
- package/src/modules/auth/handler/proxy.server.ts +4 -2
- package/src/modules/auth/handler/route.server.ts +6 -5
- package/src/modules/auth/handler/service.server.ts +70 -94
- package/src/modules/auth/hooks/use-auth-client.tsx +6 -18
- package/src/modules/auth/hooks/use-permission.ts +23 -9
- package/src/modules/auth/hooks/use-session.ts +18 -5
- package/src/modules/auth/lib/helpers.server.ts +16 -44
- package/src/modules/auth/lib/permissions.ts +35 -2
- package/src/modules/auth/plugins/admin.ts +28 -0
- package/src/modules/auth/plugins/email-otp.ts +43 -0
- package/src/modules/config/entry.ts +0 -3
- package/src/modules/config/lib/context.ts +8 -4
- package/src/modules/data-tables/components/filters/date-range.client.tsx +1 -5
- package/src/modules/data-tables/entry.ts +1 -0
- package/src/modules/data-tables/lib/converters/dto.ts +12 -0
- package/src/modules/data-tables/lib/converters/filters.ts +1 -1
- package/src/modules/data-tables/lib/filters/parsers.ts +1 -2
- package/src/modules/data-tables/server/get-data.server.ts +8 -3
- package/src/modules/inline/components/inputs/combobox-dropdown.client.tsx +1 -3
- package/src/modules/inline/components/inputs/combobox.client.tsx +2 -8
- package/src/modules/inline/components/inputs/date-time.client.tsx +4 -24
- package/src/modules/inline/components/inputs/date.client.tsx +3 -11
- package/src/modules/inline/components/inputs/editor.client.tsx +9 -10
- package/src/modules/inline/components/inputs/input.client.tsx +10 -33
- package/src/modules/inline/components/inputs/select.client.tsx +3 -16
- package/src/modules/inline/components/inputs/switch.client.tsx +3 -16
- package/src/modules/router/entry.server.ts +0 -1
- package/src/modules/router/handler/init.server.ts +58 -62
- package/src/modules/router/handler/route.server.ts +19 -19
- package/src/modules/router/lib/query-client.server.tsx +2 -2
- package/src/modules/storage/entry.server.ts +1 -1
- package/src/modules/storage/lib/router-handlers.server.ts +8 -10
- package/src/modules/storage/lib/router.server.ts +53 -0
- package/src/modules/storage/lib/upload.client.ts +9 -21
- package/src/styles.css +255 -2
- package/dist/dist/config.d.mts +0 -5
- package/dist/dist/modules/auth/handler/service.server.d.mts +0 -8
- package/dist/dist/modules/auth/lib/permissions.d.mts +0 -2
- package/dist/dist/modules/config/lib/context.d.mts +0 -4
- package/dist/dist/modules/config/paths/helpers.d.mts +0 -1
- package/dist/dist/modules/config/paths/types.d.mts +0 -3
- package/dist/dist/modules/database/lib/helpers.d.mts +0 -2
- package/dist/dist/modules/database/lib/service.server.d.mts +0 -2
- package/dist/dist/modules/database/lib/types.d.mts +0 -5
- package/dist/dist/modules/emails/lib/service.server.d.mts +0 -2
- package/dist/dist/modules/storage/lib/schema.d.mts +0 -1
- package/dist/dist/modules/storage/lib/service.server.d.mts +0 -5
- package/dist/dist/modules/storage/lib/validators.d.mts +0 -4
- package/dist/dist/modules/storage/providers/lib/types.d.mts +0 -1
- package/dist/dist/modules/storage/providers/lib/validators.d.mts +0 -2
- package/dist/modules/router/handler/context.server.d.mts +0 -62
- package/dist/modules/router/handler/context.server.mjs +0 -20
- package/dist/modules/storage/lib/procedures.server.mjs +0 -21
- package/dist/src/components/common/icons.d.mts +0 -60
- package/dist/src/components/common/icons.mjs +0 -121
- package/dist/src/components/common/status.d.mts +0 -52
- package/dist/src/components/common/status.mjs +0 -55
- package/dist/src/components/editor/components/content.client.d.mts +0 -6
- package/dist/src/components/editor/components/content.client.mjs +0 -16
- package/dist/src/components/editor/components/editor.client.d.mts +0 -48
- package/dist/src/components/editor/components/editor.client.mjs +0 -55
- package/dist/src/components/editor/components/menu-nodes.client.mjs +0 -92
- package/dist/src/components/editor/components/menu.client.d.mts +0 -9
- package/dist/src/components/editor/components/menu.client.mjs +0 -168
- package/dist/src/components/editor/extensions/file-handler/extension.d.mts +0 -20
- package/dist/src/components/editor/extensions/file-handler/extension.mjs +0 -39
- package/dist/src/components/editor/extensions/file-handler/strategy.d.mts +0 -26
- package/dist/src/components/editor/extensions/file-handler/strategy.mjs +0 -110
- package/dist/src/components/editor/extensions/file-handler/utils.mjs +0 -49
- package/dist/src/components/editor/extensions/image/extension.d.mts +0 -7
- package/dist/src/components/editor/extensions/image/extension.mjs +0 -50
- package/dist/src/components/editor/extensions/skeleton/extension.mjs +0 -40
- package/dist/src/components/editor/extensions/skeleton/renderer.mjs +0 -24
- package/dist/src/components/editor/lib/constants.d.mts +0 -62
- package/dist/src/components/editor/lib/constants.mjs +0 -101
- package/dist/src/components/editor/lib/extensions.d.mts +0 -67
- package/dist/src/components/editor/lib/extensions.mjs +0 -49
- package/dist/src/components/editor/lib/helpers.d.mts +0 -21
- package/dist/src/components/editor/lib/helpers.mjs +0 -68
- package/dist/src/components/editor/lib/types.d.mts +0 -9
- package/dist/src/components/editor/lib/variants.mjs +0 -15
- package/dist/src/components/emails/forget-password-email.mjs +0 -50
- package/dist/src/components/header/back-button.client.d.mts +0 -9
- package/dist/src/components/header/back-button.client.mjs +0 -42
- package/dist/src/components/header/bottom-bar.client.d.mts +0 -28
- package/dist/src/components/header/bottom-bar.client.mjs +0 -37
- package/dist/src/components/header/breadcrumbs.client.d.mts +0 -34
- package/dist/src/components/header/breadcrumbs.client.mjs +0 -63
- package/dist/src/components/header/header.client.d.mts +0 -11
- package/dist/src/components/header/header.client.mjs +0 -14
- package/dist/src/components/header/indicator.client.mjs +0 -24
- package/dist/src/components/header/mobile-nav-switcher.client.d.mts +0 -9
- package/dist/src/components/header/mobile-nav-switcher.client.mjs +0 -18
- package/dist/src/components/header/top-bar.client.d.mts +0 -42
- package/dist/src/components/header/top-bar.client.mjs +0 -47
- package/dist/src/components/layouts/admin-content.client.d.mts +0 -12
- package/dist/src/components/layouts/admin-content.client.mjs +0 -22
- package/dist/src/components/layouts/admin-error-pages.d.mts +0 -22
- package/dist/src/components/layouts/admin-error-pages.mjs +0 -59
- package/dist/src/components/layouts/admin-layout.d.mts +0 -7
- package/dist/src/components/layouts/admin-layout.mjs +0 -13
- package/dist/src/components/layouts/admin-loading.d.mts +0 -7
- package/dist/src/components/layouts/admin-loading.mjs +0 -13
- package/dist/src/components/layouts/empty-page.d.mts +0 -30
- package/dist/src/components/layouts/empty-page.mjs +0 -28
- package/dist/src/components/layouts/error-page.d.mts +0 -47
- package/dist/src/components/layouts/error-page.mjs +0 -53
- package/dist/src/components/layouts/error-sections.d.mts +0 -28
- package/dist/src/components/layouts/error-sections.mjs +0 -46
- package/dist/src/components/layouts/list-layout.d.mts +0 -11
- package/dist/src/components/layouts/list-layout.mjs +0 -14
- package/dist/src/components/layouts/providers.client.d.mts +0 -9
- package/dist/src/components/layouts/providers.client.mjs +0 -31
- package/dist/src/components/layouts/root-error-pages.d.mts +0 -9
- package/dist/src/components/layouts/root-error-pages.mjs +0 -16
- package/dist/src/components/layouts/root-layout.server.d.mts +0 -36
- package/dist/src/components/layouts/root-layout.server.mjs +0 -46
- package/dist/src/components/layouts/root-loading.d.mts +0 -6
- package/dist/src/components/layouts/root-loading.mjs +0 -13
- package/dist/src/components/layouts/tab-layout.d.mts +0 -22
- package/dist/src/components/layouts/tab-layout.mjs +0 -50
- package/dist/src/components/lists/data-list.d.mts +0 -30
- package/dist/src/components/lists/data-list.mjs +0 -35
- package/dist/src/components/lists/data-stack.d.mts +0 -48
- package/dist/src/components/lists/data-stack.mjs +0 -56
- package/dist/src/components/navigation/admin-sidebar-header.client.mjs +0 -92
- package/dist/src/components/navigation/admin-sidebar-paths.client.d.mts +0 -91
- package/dist/src/components/navigation/admin-sidebar-paths.client.mjs +0 -143
- package/dist/src/components/navigation/admin-sidebar-skeleton.mjs +0 -30
- package/dist/src/components/ui/accordion.client.d.mts +0 -25
- package/dist/src/components/ui/accordion.client.mjs +0 -57
- package/dist/src/components/ui/alert-dialog.client.d.mts +0 -60
- package/dist/src/components/ui/alert-dialog.client.mjs +0 -103
- package/dist/src/components/ui/alert.d.mts +0 -28
- package/dist/src/components/ui/alert.mjs +0 -44
- package/dist/src/components/ui/aspect-ratio.client.d.mts +0 -9
- package/dist/src/components/ui/aspect-ratio.client.mjs +0 -15
- package/dist/src/components/ui/avatar.client.d.mts +0 -34
- package/dist/src/components/ui/avatar.client.mjs +0 -53
- package/dist/src/components/ui/badge.d.mts +0 -19
- package/dist/src/components/ui/badge.mjs +0 -28
- package/dist/src/components/ui/breadcrumb.d.mts +0 -37
- package/dist/src/components/ui/breadcrumb.mjs +0 -70
- package/dist/src/components/ui/button-group.d.mts +0 -28
- package/dist/src/components/ui/button-group.mjs +0 -40
- package/dist/src/components/ui/button.d.mts +0 -21
- package/dist/src/components/ui/button.mjs +0 -48
- package/dist/src/components/ui/calendar.client.d.mts +0 -30
- package/dist/src/components/ui/calendar.client.mjs +0 -113
- package/dist/src/components/ui/card.d.mts +0 -37
- package/dist/src/components/ui/card.mjs +0 -57
- package/dist/src/components/ui/carousel.client.d.mts +0 -56
- package/dist/src/components/ui/carousel.client.mjs +0 -135
- package/dist/src/components/ui/chart.client.d.mts +0 -71
- package/dist/src/components/ui/chart.client.mjs +0 -142
- package/dist/src/components/ui/checkbox.client.d.mts +0 -11
- package/dist/src/components/ui/checkbox.client.mjs +0 -23
- package/dist/src/components/ui/collapsible.client.d.mts +0 -15
- package/dist/src/components/ui/collapsible.client.mjs +0 -27
- package/dist/src/components/ui/color-picker.client.d.mts +0 -15
- package/dist/src/components/ui/color-picker.client.mjs +0 -38
- package/dist/src/components/ui/combobox-dropdown.client.d.mts +0 -45
- package/dist/src/components/ui/combobox-dropdown.client.mjs +0 -94
- package/dist/src/components/ui/combobox.client.d.mts +0 -30
- package/dist/src/components/ui/combobox.client.mjs +0 -66
- package/dist/src/components/ui/command.client.d.mts +0 -58
- package/dist/src/components/ui/command.client.mjs +0 -97
- package/dist/src/components/ui/context-menu.client.d.mts +0 -85
- package/dist/src/components/ui/context-menu.client.mjs +0 -127
- package/dist/src/components/ui/date-picker.client.d.mts +0 -20
- package/dist/src/components/ui/date-picker.client.mjs +0 -43
- package/dist/src/components/ui/dialog.client.d.mts +0 -51
- package/dist/src/components/ui/dialog.client.mjs +0 -98
- package/dist/src/components/ui/drawer.client.d.mts +0 -44
- package/dist/src/components/ui/drawer.client.mjs +0 -80
- package/dist/src/components/ui/dropdown-menu.client.d.mts +0 -84
- package/dist/src/components/ui/dropdown-menu.client.mjs +0 -130
- package/dist/src/components/ui/empty.d.mts +0 -35
- package/dist/src/components/ui/empty.mjs +0 -61
- package/dist/src/components/ui/field.client.d.mts +0 -64
- package/dist/src/components/ui/field.client.mjs +0 -113
- package/dist/src/components/ui/form.client.d.mts +0 -47
- package/dist/src/components/ui/form.client.mjs +0 -92
- package/dist/src/components/ui/hover-card.client.d.mts +0 -19
- package/dist/src/components/ui/hover-card.client.mjs +0 -34
- package/dist/src/components/ui/input-date-time.client.d.mts +0 -22
- package/dist/src/components/ui/input-date-time.client.mjs +0 -33
- package/dist/src/components/ui/input-date.d.mts +0 -13
- package/dist/src/components/ui/input-date.mjs +0 -15
- package/dist/src/components/ui/input-group.client.d.mts +0 -58
- package/dist/src/components/ui/input-group.client.mjs +0 -105
- package/dist/src/components/ui/input-recipient.d.mts +0 -26
- package/dist/src/components/ui/input-recipient.mjs +0 -218
- package/dist/src/components/ui/input-time.d.mts +0 -13
- package/dist/src/components/ui/input-time.mjs +0 -15
- package/dist/src/components/ui/input.d.mts +0 -11
- package/dist/src/components/ui/input.mjs +0 -15
- package/dist/src/components/ui/item.d.mts +0 -62
- package/dist/src/components/ui/item.mjs +0 -118
- package/dist/src/components/ui/kbd.d.mts +0 -13
- package/dist/src/components/ui/kbd.mjs +0 -21
- package/dist/src/components/ui/label.d.mts +0 -11
- package/dist/src/components/ui/label.mjs +0 -17
- package/dist/src/components/ui/loader.d.mts +0 -6
- package/dist/src/components/ui/loader.mjs +0 -62
- package/dist/src/components/ui/navigation-menu.d.mts +0 -46
- package/dist/src/components/ui/navigation-menu.mjs +0 -81
- package/dist/src/components/ui/pagination.d.mts +0 -45
- package/dist/src/components/ui/pagination.mjs +0 -87
- package/dist/src/components/ui/popover.client.d.mts +0 -34
- package/dist/src/components/ui/popover.client.mjs +0 -58
- package/dist/src/components/ui/progress.client.d.mts +0 -12
- package/dist/src/components/ui/progress.client.mjs +0 -22
- package/dist/src/components/ui/radio-group.d.mts +0 -15
- package/dist/src/components/ui/radio-group.mjs +0 -29
- package/dist/src/components/ui/resizable.client.d.mts +0 -20
- package/dist/src/components/ui/resizable.client.mjs +0 -31
- package/dist/src/components/ui/scroll-area.d.mts +0 -17
- package/dist/src/components/ui/scroll-area.mjs +0 -39
- package/dist/src/components/ui/select.client.d.mts +0 -53
- package/dist/src/components/ui/select.client.mjs +0 -102
- package/dist/src/components/ui/separator.d.mts +0 -13
- package/dist/src/components/ui/separator.mjs +0 -19
- package/dist/src/components/ui/sheet.client.d.mts +0 -42
- package/dist/src/components/ui/sheet.client.mjs +0 -92
- package/dist/src/components/ui/sidebar.client.d.mts +0 -167
- package/dist/src/components/ui/sidebar.client.mjs +0 -373
- package/dist/src/components/ui/skeleton.d.mts +0 -9
- package/dist/src/components/ui/skeleton.mjs +0 -14
- package/dist/src/components/ui/slider.d.mts +0 -15
- package/dist/src/components/ui/slider.mjs +0 -39
- package/dist/src/components/ui/sonner.client.d.mts +0 -9
- package/dist/src/components/ui/sonner.client.mjs +0 -24
- package/dist/src/components/ui/spinner.d.mts +0 -9
- package/dist/src/components/ui/spinner.mjs +0 -16
- package/dist/src/components/ui/switch.client.d.mts +0 -14
- package/dist/src/components/ui/switch.client.mjs +0 -22
- package/dist/src/components/ui/tabs.client.d.mts +0 -30
- package/dist/src/components/ui/tabs.client.mjs +0 -48
- package/dist/src/components/ui/textarea.d.mts +0 -10
- package/dist/src/components/ui/textarea.mjs +0 -14
- package/dist/src/components/ui/toggle-group.client.d.mts +0 -28
- package/dist/src/components/ui/toggle-group.client.mjs +0 -54
- package/dist/src/components/ui/toggle.client.d.mts +0 -19
- package/dist/src/components/ui/toggle.client.mjs +0 -39
- package/dist/src/components/ui/tooltip.client.d.mts +0 -23
- package/dist/src/components/ui/tooltip.client.mjs +0 -38
- package/dist/src/lib/hooks/use-action.d.mts +0 -16
- package/dist/src/lib/hooks/use-action.mjs +0 -41
- package/dist/src/lib/hooks/use-indicator.d.mts +0 -39
- package/dist/src/lib/hooks/use-indicator.mjs +0 -63
- package/dist/src/lib/hooks/use-mobile.client.d.mts +0 -6
- package/dist/src/lib/hooks/use-mobile.client.mjs +0 -21
- package/dist/src/lib/types/config.d.mts +0 -11
- package/dist/src/lib/utils/array-move.d.mts +0 -10
- package/dist/src/lib/utils/array-move.mjs +0 -12
- package/dist/src/lib/utils/cn.d.mts +0 -6
- package/dist/src/lib/utils/cn.mjs +0 -10
- package/dist/src/lib/utils/fonts.d.mts +0 -7
- package/dist/src/lib/utils/fonts.mjs +0 -11
- package/dist/src/lib/utils/format.d.mts +0 -51
- package/dist/src/lib/utils/format.mjs +0 -113
- package/dist/src/lib/utils/manifest.d.mts +0 -7
- package/dist/src/lib/utils/manifest.mjs +0 -35
- package/dist/src/lib/utils/markdown.d.mts +0 -9
- package/dist/src/lib/utils/markdown.mjs +0 -14
- package/dist/src/lib/utils/url.d.mts +0 -9
- package/dist/src/lib/utils/url.mjs +0 -15
- package/dist/src/lib/utils/user-agent.mjs +0 -74
- package/dist/src/modules/auth/components/allowed.client.d.mts +0 -33
- package/dist/src/modules/auth/components/allowed.client.mjs +0 -19
- package/dist/src/modules/auth/components/auth-layout.server.d.mts +0 -9
- package/dist/src/modules/auth/components/auth-layout.server.mjs +0 -36
- package/dist/src/modules/auth/components/auth-loading.d.mts +0 -6
- package/dist/src/modules/auth/components/auth-loading.mjs +0 -17
- package/dist/src/modules/auth/components/create-first-user-guard.server.d.mts +0 -15
- package/dist/src/modules/auth/components/create-first-user-guard.server.mjs +0 -15
- package/dist/src/modules/auth/components/create-first-user-page.client.d.mts +0 -6
- package/dist/src/modules/auth/components/create-first-user-page.client.mjs +0 -153
- package/dist/src/modules/auth/components/forget-password-page.client.d.mts +0 -6
- package/dist/src/modules/auth/components/forget-password-page.client.mjs +0 -72
- package/dist/src/modules/auth/components/guard.server.d.mts +0 -14
- package/dist/src/modules/auth/components/guard.server.mjs +0 -20
- package/dist/src/modules/auth/components/login-page.client.d.mts +0 -11
- package/dist/src/modules/auth/components/login-page.client.mjs +0 -155
- package/dist/src/modules/auth/components/reset-password-page.client.d.mts +0 -11
- package/dist/src/modules/auth/components/reset-password-page.client.mjs +0 -121
- package/dist/src/modules/auth/components/update-password-command.d.mts +0 -22
- package/dist/src/modules/auth/components/update-password-command.mjs +0 -47
- package/dist/src/modules/auth/db/schema.d.mts +0 -983
- package/dist/src/modules/auth/db/schema.mjs +0 -101
- package/dist/src/modules/auth/handler/create-client.client.d.mts +0 -6393
- package/dist/src/modules/auth/handler/create-client.client.mjs +0 -25
- package/dist/src/modules/auth/handler/proxy.server.d.mts +0 -11
- package/dist/src/modules/auth/handler/proxy.server.mjs +0 -20
- package/dist/src/modules/auth/handler/route.server.d.mts +0 -16
- package/dist/src/modules/auth/handler/route.server.mjs +0 -28
- package/dist/src/modules/auth/handler/service.server.d.mts +0 -2101
- package/dist/src/modules/auth/handler/service.server.mjs +0 -87
- package/dist/src/modules/auth/hooks/use-auth-client.d.mts +0 -23
- package/dist/src/modules/auth/hooks/use-auth-client.mjs +0 -30
- package/dist/src/modules/auth/hooks/use-permission.d.mts +0 -42
- package/dist/src/modules/auth/hooks/use-permission.mjs +0 -57
- package/dist/src/modules/auth/hooks/use-session.d.mts +0 -40
- package/dist/src/modules/auth/hooks/use-session.mjs +0 -22
- package/dist/src/modules/auth/lib/helpers.server.d.mts +0 -84
- package/dist/src/modules/auth/lib/helpers.server.mjs +0 -41
- package/dist/src/modules/auth/lib/permissions.d.mts +0 -17
- package/dist/src/modules/auth/lib/permissions.mjs +0 -14
- package/dist/src/modules/auth/lib/validators.d.mts +0 -299
- package/dist/src/modules/auth/lib/validators.mjs +0 -59
- package/dist/src/modules/commands/components/menus/context-menu.client.d.mts +0 -39
- package/dist/src/modules/commands/components/menus/context-menu.client.mjs +0 -47
- package/dist/src/modules/commands/components/menus/dropdown-menu.client.d.mts +0 -29
- package/dist/src/modules/commands/components/menus/dropdown-menu.client.mjs +0 -58
- package/dist/src/modules/commands/components/menus/floating-menu.client.d.mts +0 -29
- package/dist/src/modules/commands/components/menus/floating-menu.client.mjs +0 -33
- package/dist/src/modules/commands/components/menus/inline-menu.client.d.mts +0 -29
- package/dist/src/modules/commands/components/menus/inline-menu.client.mjs +0 -41
- package/dist/src/modules/commands/components/menus/responsive-menu.client.d.mts +0 -16
- package/dist/src/modules/commands/components/menus/responsive-menu.client.mjs +0 -22
- package/dist/src/modules/commands/components/primitives/alert-dialog-command.client.d.mts +0 -65
- package/dist/src/modules/commands/components/primitives/alert-dialog-command.client.mjs +0 -138
- package/dist/src/modules/commands/components/primitives/click-command.client.d.mts +0 -26
- package/dist/src/modules/commands/components/primitives/click-command.client.mjs +0 -52
- package/dist/src/modules/commands/components/primitives/command-trigger.client.d.mts +0 -17
- package/dist/src/modules/commands/components/primitives/command-trigger.client.mjs +0 -42
- package/dist/src/modules/commands/components/primitives/dialog-command.client.d.mts +0 -53
- package/dist/src/modules/commands/components/primitives/dialog-command.client.mjs +0 -116
- package/dist/src/modules/commands/components/primitives/dropdown-command.client.d.mts +0 -47
- package/dist/src/modules/commands/components/primitives/dropdown-command.client.mjs +0 -131
- package/dist/src/modules/commands/components/primitives/empty-command.client.d.mts +0 -20
- package/dist/src/modules/commands/components/primitives/empty-command.client.mjs +0 -44
- package/dist/src/modules/commands/components/primitives/form-dialog-command.client.d.mts +0 -71
- package/dist/src/modules/commands/components/primitives/form-dialog-command.client.mjs +0 -163
- package/dist/src/modules/commands/components/render-command.mjs +0 -48
- package/dist/src/modules/commands/components/utils/archive-command.client.d.mts +0 -24
- package/dist/src/modules/commands/components/utils/archive-command.client.mjs +0 -29
- package/dist/src/modules/commands/components/utils/delete-command.client.d.mts +0 -20
- package/dist/src/modules/commands/components/utils/delete-command.client.mjs +0 -28
- package/dist/src/modules/commands/hooks/use-command-mutation.client.d.mts +0 -11
- package/dist/src/modules/commands/hooks/use-command-mutation.client.mjs +0 -39
- package/dist/src/modules/commands/hooks/use-command.client.d.mts +0 -31
- package/dist/src/modules/commands/hooks/use-command.client.mjs +0 -45
- package/dist/src/modules/commands/lib/builder.d.mts +0 -135
- package/dist/src/modules/commands/lib/builder.mjs +0 -82
- package/dist/src/modules/commands/lib/registery.d.mts +0 -68
- package/dist/src/modules/commands/lib/registery.mjs +0 -103
- package/dist/src/modules/commands/lib/utils.d.mts +0 -11
- package/dist/src/modules/commands/lib/utils.mjs +0 -14
- package/dist/src/modules/config/lib/config.d.mts +0 -16
- package/dist/src/modules/config/lib/config.mjs +0 -8
- package/dist/src/modules/config/lib/context.d.mts +0 -17
- package/dist/src/modules/config/lib/context.mjs +0 -7
- package/dist/src/modules/config/paths/helpers.d.mts +0 -9
- package/dist/src/modules/config/paths/helpers.mjs +0 -8
- package/dist/src/modules/config/paths/types.d.mts +0 -31
- package/dist/src/modules/data-tables/components/cell/common.client.d.mts +0 -26
- package/dist/src/modules/data-tables/components/cell/common.client.mjs +0 -35
- package/dist/src/modules/data-tables/components/cell/index.client.d.mts +0 -10
- package/dist/src/modules/data-tables/components/cell/index.client.mjs +0 -24
- package/dist/src/modules/data-tables/components/cell/select.client.d.mts +0 -10
- package/dist/src/modules/data-tables/components/cell/select.client.mjs +0 -36
- package/dist/src/modules/data-tables/components/column-header.d.mts +0 -15
- package/dist/src/modules/data-tables/components/column-header.mjs +0 -46
- package/dist/src/modules/data-tables/components/filters/combobox.client.d.mts +0 -27
- package/dist/src/modules/data-tables/components/filters/combobox.client.mjs +0 -97
- package/dist/src/modules/data-tables/components/filters/date-range.client.d.mts +0 -24
- package/dist/src/modules/data-tables/components/filters/date-range.client.mjs +0 -99
- package/dist/src/modules/data-tables/components/filters/search.client.d.mts +0 -17
- package/dist/src/modules/data-tables/components/filters/search.client.mjs +0 -32
- package/dist/src/modules/data-tables/components/filters/slider.client.d.mts +0 -22
- package/dist/src/modules/data-tables/components/filters/slider.client.mjs +0 -128
- package/dist/src/modules/data-tables/components/filters/toggle.client.d.mts +0 -17
- package/dist/src/modules/data-tables/components/filters/toggle.client.mjs +0 -25
- package/dist/src/modules/data-tables/components/footer.mjs +0 -31
- package/dist/src/modules/data-tables/components/header.d.mts +0 -40
- package/dist/src/modules/data-tables/components/header.mjs +0 -43
- package/dist/src/modules/data-tables/components/layout.d.mts +0 -11
- package/dist/src/modules/data-tables/components/layout.mjs +0 -14
- package/dist/src/modules/data-tables/components/search-input.client.d.mts +0 -6
- package/dist/src/modules/data-tables/components/search-input.client.mjs +0 -19
- package/dist/src/modules/data-tables/components/skeleton.d.mts +0 -6
- package/dist/src/modules/data-tables/components/skeleton.mjs +0 -21
- package/dist/src/modules/data-tables/components/table.d.mts +0 -33
- package/dist/src/modules/data-tables/components/table.mjs +0 -55
- package/dist/src/modules/data-tables/components/toolbar.d.mts +0 -22
- package/dist/src/modules/data-tables/components/toolbar.mjs +0 -21
- package/dist/src/modules/data-tables/hooks/use-context.client.d.mts +0 -47
- package/dist/src/modules/data-tables/hooks/use-context.client.mjs +0 -34
- package/dist/src/modules/data-tables/hooks/use-search.client.mjs +0 -39
- package/dist/src/modules/data-tables/hooks/use-selection.client.mjs +0 -44
- package/dist/src/modules/data-tables/hooks/use-table.client.d.mts +0 -10
- package/dist/src/modules/data-tables/hooks/use-table.client.mjs +0 -55
- package/dist/src/modules/data-tables/lib/converters/dto.d.mts +0 -50
- package/dist/src/modules/data-tables/lib/converters/dto.mjs +0 -24
- package/dist/src/modules/data-tables/lib/converters/filters.d.mts +0 -41
- package/dist/src/modules/data-tables/lib/converters/filters.mjs +0 -38
- package/dist/src/modules/data-tables/lib/converters/pagination.d.mts +0 -17
- package/dist/src/modules/data-tables/lib/converters/pagination.mjs +0 -15
- package/dist/src/modules/data-tables/lib/converters/search.d.mts +0 -16
- package/dist/src/modules/data-tables/lib/converters/search.mjs +0 -15
- package/dist/src/modules/data-tables/lib/converters/sorting.d.mts +0 -48
- package/dist/src/modules/data-tables/lib/converters/sorting.mjs +0 -55
- package/dist/src/modules/data-tables/lib/filters/config.d.mts +0 -13
- package/dist/src/modules/data-tables/lib/filters/config.mjs +0 -5
- package/dist/src/modules/data-tables/lib/filters/helpers.d.mts +0 -10
- package/dist/src/modules/data-tables/lib/filters/helpers.mjs +0 -16
- package/dist/src/modules/data-tables/lib/filters/parsers.d.mts +0 -46
- package/dist/src/modules/data-tables/lib/filters/parsers.mjs +0 -47
- package/dist/src/modules/data-tables/lib/filters/resolvers.d.mts +0 -28
- package/dist/src/modules/data-tables/lib/filters/resolvers.mjs +0 -55
- package/dist/src/modules/data-tables/lib/helpers/create-column.mjs +0 -10
- package/dist/src/modules/data-tables/lib/search-params.d.mts +0 -21
- package/dist/src/modules/data-tables/lib/search-params.mjs +0 -16
- package/dist/src/modules/data-tables/lib/types.d.mts +0 -54
- package/dist/src/modules/data-tables/lib/validators.d.mts +0 -19
- package/dist/src/modules/data-tables/lib/validators.mjs +0 -16
- package/dist/src/modules/data-tables/server/get-data.server.d.mts +0 -29
- package/dist/src/modules/data-tables/server/get-data.server.mjs +0 -47
- package/dist/src/modules/data-tables/strategies/helpers/sorting.mjs +0 -37
- package/dist/src/modules/data-tables/strategies/infinite/components.mjs +0 -50
- package/dist/src/modules/data-tables/strategies/infinite/strategy.d.mts +0 -20
- package/dist/src/modules/data-tables/strategies/infinite/strategy.mjs +0 -50
- package/dist/src/modules/data-tables/strategies/local/components.mjs +0 -25
- package/dist/src/modules/data-tables/strategies/local/strategy.d.mts +0 -12
- package/dist/src/modules/data-tables/strategies/local/strategy.mjs +0 -31
- package/dist/src/modules/data-tables/strategies/pagination/components.mjs +0 -131
- package/dist/src/modules/data-tables/strategies/pagination/strategy.d.mts +0 -12
- package/dist/src/modules/data-tables/strategies/pagination/strategy.mjs +0 -45
- package/dist/src/modules/data-tables/tables/data-table/components/body.mjs +0 -32
- package/dist/src/modules/data-tables/tables/data-table/components/header.mjs +0 -12
- package/dist/src/modules/data-tables/tables/data-table/components/row.mjs +0 -13
- package/dist/src/modules/data-tables/tables/data-table/components/table.d.mts +0 -8
- package/dist/src/modules/data-tables/tables/data-table/components/table.mjs +0 -42
- package/dist/src/modules/data-tables/tables/inline-table/components/body.mjs +0 -69
- package/dist/src/modules/data-tables/tables/inline-table/components/cells/common.d.mts +0 -11
- package/dist/src/modules/data-tables/tables/inline-table/components/cells/common.mjs +0 -14
- package/dist/src/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +0 -24
- package/dist/src/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.mjs +0 -38
- package/dist/src/modules/data-tables/tables/inline-table/components/cells/read-only.d.mts +0 -11
- package/dist/src/modules/data-tables/tables/inline-table/components/cells/read-only.mjs +0 -14
- package/dist/src/modules/data-tables/tables/inline-table/components/header.mjs +0 -10
- package/dist/src/modules/data-tables/tables/inline-table/components/row.client.mjs +0 -24
- package/dist/src/modules/data-tables/tables/inline-table/components/table.d.mts +0 -14
- package/dist/src/modules/data-tables/tables/inline-table/components/table.mjs +0 -52
- package/dist/src/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +0 -48
- package/dist/src/modules/data-tables/tables/inline-table/hooks/context.client.mjs +0 -58
- package/dist/src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.d.mts +0 -29
- package/dist/src/modules/data-tables/tables/inline-table/hooks/use-hotkeys.client.mjs +0 -94
- package/dist/src/modules/database/lib/helpers.d.mts +0 -15
- package/dist/src/modules/database/lib/helpers.mjs +0 -16
- package/dist/src/modules/database/lib/service.server.d.mts +0 -33
- package/dist/src/modules/database/lib/service.server.mjs +0 -23
- package/dist/src/modules/database/lib/types.d.mts +0 -4
- package/dist/src/modules/emails/lib/service.server.d.mts +0 -28
- package/dist/src/modules/emails/lib/service.server.mjs +0 -20
- package/dist/src/modules/inline/components/cell.client.d.mts +0 -20
- package/dist/src/modules/inline/components/cell.client.mjs +0 -46
- package/dist/src/modules/inline/components/field.client.d.mts +0 -36
- package/dist/src/modules/inline/components/field.client.mjs +0 -61
- package/dist/src/modules/inline/components/inputs/combobox-dropdown.client.d.mts +0 -28
- package/dist/src/modules/inline/components/inputs/combobox-dropdown.client.mjs +0 -49
- package/dist/src/modules/inline/components/inputs/combobox.client.d.mts +0 -23
- package/dist/src/modules/inline/components/inputs/combobox.client.mjs +0 -45
- package/dist/src/modules/inline/components/inputs/date-time.client.d.mts +0 -25
- package/dist/src/modules/inline/components/inputs/date-time.client.mjs +0 -48
- package/dist/src/modules/inline/components/inputs/date.client.d.mts +0 -66
- package/dist/src/modules/inline/components/inputs/date.client.mjs +0 -175
- package/dist/src/modules/inline/components/inputs/editor.client.d.mts +0 -26
- package/dist/src/modules/inline/components/inputs/editor.client.mjs +0 -51
- package/dist/src/modules/inline/components/inputs/input-recipient.client.d.mts +0 -27
- package/dist/src/modules/inline/components/inputs/input-recipient.client.mjs +0 -48
- package/dist/src/modules/inline/components/inputs/input.client.d.mts +0 -54
- package/dist/src/modules/inline/components/inputs/input.client.mjs +0 -129
- package/dist/src/modules/inline/components/inputs/select.client.d.mts +0 -32
- package/dist/src/modules/inline/components/inputs/select.client.mjs +0 -64
- package/dist/src/modules/inline/components/inputs/switch.client.d.mts +0 -22
- package/dist/src/modules/inline/components/inputs/switch.client.mjs +0 -42
- package/dist/src/modules/inline/components/inputs/toggle.client.d.mts +0 -24
- package/dist/src/modules/inline/components/inputs/toggle.client.mjs +0 -47
- package/dist/src/modules/inline/hooks/inline-provider.d.mts +0 -28
- package/dist/src/modules/inline/hooks/inline-provider.mjs +0 -25
- package/dist/src/modules/inline/hooks/inline-state.client.d.mts +0 -30
- package/dist/src/modules/inline/hooks/inline-state.client.mjs +0 -25
- package/dist/src/modules/inline/hooks/use-inline.client.d.mts +0 -144
- package/dist/src/modules/inline/hooks/use-inline.client.mjs +0 -125
- package/dist/src/modules/inline/lib/validators.d.mts +0 -56
- package/dist/src/modules/inline/lib/validators.mjs +0 -34
- package/dist/src/modules/inline/lib/variants.d.mts +0 -11
- package/dist/src/modules/inline/lib/variants.mjs +0 -21
- package/dist/src/modules/router/handler/caller.client.d.mts +0 -10
- package/dist/src/modules/router/handler/caller.client.mjs +0 -23
- package/dist/src/modules/router/handler/caller.server.d.mts +0 -6
- package/dist/src/modules/router/handler/caller.server.mjs +0 -7
- package/dist/src/modules/router/handler/context.server.d.mts +0 -62
- package/dist/src/modules/router/handler/context.server.mjs +0 -20
- package/dist/src/modules/router/handler/init.server.d.mts +0 -65
- package/dist/src/modules/router/handler/init.server.mjs +0 -55
- package/dist/src/modules/router/handler/register.server.d.mts +0 -8
- package/dist/src/modules/router/handler/register.server.mjs +0 -10
- package/dist/src/modules/router/handler/route.server.d.mts +0 -21
- package/dist/src/modules/router/handler/route.server.mjs +0 -32
- package/dist/src/modules/router/lib/error.server.d.mts +0 -2
- package/dist/src/modules/router/lib/error.server.mjs +0 -3
- package/dist/src/modules/router/lib/helpers.mjs +0 -7
- package/dist/src/modules/router/lib/query-client.d.mts +0 -10
- package/dist/src/modules/router/lib/query-client.mjs +0 -50
- package/dist/src/modules/router/lib/query-client.server.d.mts +0 -17
- package/dist/src/modules/router/lib/query-client.server.mjs +0 -23
- package/dist/src/modules/router/lib/validators.d.mts +0 -12
- package/dist/src/modules/router/lib/validators.mjs +0 -10
- package/dist/src/modules/storage/components/dropzone-context.client.d.mts +0 -18
- package/dist/src/modules/storage/components/dropzone-context.client.mjs +0 -17
- package/dist/src/modules/storage/components/dropzone.client.d.mts +0 -52
- package/dist/src/modules/storage/components/dropzone.client.mjs +0 -110
- package/dist/src/modules/storage/components/image-grid.client.d.mts +0 -32
- package/dist/src/modules/storage/components/image-grid.client.mjs +0 -167
- package/dist/src/modules/storage/components/image.client.d.mts +0 -7
- package/dist/src/modules/storage/components/image.client.mjs +0 -16
- package/dist/src/modules/storage/components/upload-button.client.d.mts +0 -11
- package/dist/src/modules/storage/components/upload-button.client.mjs +0 -33
- package/dist/src/modules/storage/components/upload-zone-context.client.d.mts +0 -30
- package/dist/src/modules/storage/components/upload-zone-context.client.mjs +0 -20
- package/dist/src/modules/storage/components/upload-zone.client.d.mts +0 -27
- package/dist/src/modules/storage/components/upload-zone.client.mjs +0 -111
- package/dist/src/modules/storage/lib/constants.d.mts +0 -5
- package/dist/src/modules/storage/lib/constants.mjs +0 -5
- package/dist/src/modules/storage/lib/helpers.d.mts +0 -29
- package/dist/src/modules/storage/lib/helpers.mjs +0 -49
- package/dist/src/modules/storage/lib/procedures.server.d.mts +0 -1990
- package/dist/src/modules/storage/lib/procedures.server.mjs +0 -21
- package/dist/src/modules/storage/lib/router-handlers.server.d.mts +0 -40
- package/dist/src/modules/storage/lib/router-handlers.server.mjs +0 -123
- package/dist/src/modules/storage/lib/schema.d.mts +0 -291
- package/dist/src/modules/storage/lib/schema.mjs +0 -37
- package/dist/src/modules/storage/lib/service.server.d.mts +0 -2217
- package/dist/src/modules/storage/lib/service.server.mjs +0 -514
- package/dist/src/modules/storage/lib/upload.client.d.mts +0 -57
- package/dist/src/modules/storage/lib/upload.client.mjs +0 -86
- package/dist/src/modules/storage/lib/validators.d.mts +0 -935
- package/dist/src/modules/storage/lib/validators.mjs +0 -52
- package/dist/src/modules/storage/providers/adapters/s3.server.d.mts +0 -18
- package/dist/src/modules/storage/providers/adapters/s3.server.mjs +0 -172
- package/dist/src/modules/storage/providers/lib/constants.d.mts +0 -5
- package/dist/src/modules/storage/providers/lib/constants.mjs +0 -5
- package/dist/src/modules/storage/providers/lib/errors.d.mts +0 -11
- package/dist/src/modules/storage/providers/lib/errors.mjs +0 -12
- package/dist/src/modules/storage/providers/lib/types.d.mts +0 -20
- package/dist/src/modules/storage/providers/lib/validators.d.mts +0 -111
- package/dist/src/modules/storage/providers/lib/validators.mjs +0 -74
- package/src/modules/router/handler/context.server.ts +0 -28
- package/src/modules/storage/lib/procedures.server.ts +0 -60
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
import { ServerError } from "../../router/lib/error.server.mjs";
|
|
2
|
-
import { generateDefaultUUID } from "../../database/lib/helpers.mjs";
|
|
3
|
-
import { storageAssets } from "./schema.mjs";
|
|
4
|
-
import { confirmUploadInputSchema, presignUploadInputSchema, uploadInputSchema } from "./validators.mjs";
|
|
5
|
-
import { StorageAdapterError } from "../providers/lib/errors.mjs";
|
|
6
|
-
import z from "zod";
|
|
7
|
-
import { and, desc, eq, inArray, isNotNull, isNull } from "drizzle-orm";
|
|
8
|
-
|
|
9
|
-
//#region src/modules/storage/lib/service.server.ts
|
|
10
|
-
/**
|
|
11
|
-
* Storage service for working with asset metadata and object storage.
|
|
12
|
-
*
|
|
13
|
-
* Use `Storage.init()` to create a fully configured instance in app code.
|
|
14
|
-
*
|
|
15
|
-
* @param props - Storage configuration, including `db` and `adapter`
|
|
16
|
-
* @returns A ready-to-use `Storage` instance
|
|
17
|
-
* @example
|
|
18
|
-
* const storage = Storage.init({
|
|
19
|
-
* db: drizzle(dbConnection),
|
|
20
|
-
* adapter: new StorageS3Adapter({
|
|
21
|
-
* bucketName: "my-app-uploads",
|
|
22
|
-
* region: "us-east-1",
|
|
23
|
-
* credentials: {
|
|
24
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
25
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
26
|
-
* },
|
|
27
|
-
* }),
|
|
28
|
-
* });
|
|
29
|
-
*/
|
|
30
|
-
var Storage = class Storage {
|
|
31
|
-
#adapter;
|
|
32
|
-
#db;
|
|
33
|
-
prefix;
|
|
34
|
-
constructor({ db, adapter, prefix }) {
|
|
35
|
-
this.#db = db;
|
|
36
|
-
this.#adapter = adapter;
|
|
37
|
-
this.prefix = prefix ?? "uploads";
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Create a storage service instance.
|
|
41
|
-
*
|
|
42
|
-
* This keeps the public API aligned with other Tulip services such as
|
|
43
|
-
* `Database.init()`, `Email.init()`, and `Auth.init()`.
|
|
44
|
-
*
|
|
45
|
-
* @param props - Storage configuration, including `db` and `adapter`
|
|
46
|
-
* @returns A new `Storage` instance
|
|
47
|
-
* @example
|
|
48
|
-
* const storage = Storage.init({
|
|
49
|
-
* db: drizzle(dbConnection),
|
|
50
|
-
* adapter: new StorageS3Adapter({
|
|
51
|
-
* bucketName: "my-app-uploads",
|
|
52
|
-
* region: "us-east-1",
|
|
53
|
-
* credentials: {
|
|
54
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
55
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
56
|
-
* },
|
|
57
|
-
* }),
|
|
58
|
-
* });
|
|
59
|
-
*/
|
|
60
|
-
static init(props) {
|
|
61
|
-
return new Storage(props);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Generates the canonical object key for a storage asset id.
|
|
65
|
-
*
|
|
66
|
-
* This keeps bucket key structure internal to the storage service,
|
|
67
|
-
* so callers only work with asset ids and do not manage object paths.
|
|
68
|
-
*
|
|
69
|
-
* @param input - Storage asset id (UUID)
|
|
70
|
-
* @returns Canonical storage key (e.g. `uploads/<id>`)
|
|
71
|
-
* @example
|
|
72
|
-
* const key = this.#generateKey("019d0051-2c0d-741e-9e3c-e5a5bc4d16a2");
|
|
73
|
-
* // key => "uploads/019d0051-2c0d-741e-9e3c-e5a5bc4d16a2"
|
|
74
|
-
*/
|
|
75
|
-
#generateKey(input) {
|
|
76
|
-
const id = z.uuid().parse(input);
|
|
77
|
-
return `${this.prefix}/${id}`;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Builds a query to fetch a storage asset by its ID and the current adapter's provider.
|
|
81
|
-
* @param id - The asset ID to search for
|
|
82
|
-
* @returns A dynamic Drizzle query for fetching a single asset
|
|
83
|
-
* @example
|
|
84
|
-
* let query = storageService.getAssetByIdQuery("asset-123");
|
|
85
|
-
* query = query.where(eq(storageAssets.contentType, "image/png")); // Add additional conditions if needed
|
|
86
|
-
* const [asset] = await query;
|
|
87
|
-
*/
|
|
88
|
-
getAssetByIdQuery(id) {
|
|
89
|
-
return this.#db.select().from(storageAssets).where(and(eq(storageAssets.id, id), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), isNull(storageAssets.deletedAt))).limit(1).$dynamic();
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Fetches a storage asset by its ID.
|
|
93
|
-
* @param id - The asset ID to retrieve
|
|
94
|
-
* @returns The asset object if found, otherwise null
|
|
95
|
-
* @example
|
|
96
|
-
* const asset = await storageService.getAssetById("asset-123");
|
|
97
|
-
* if (asset) {
|
|
98
|
-
* console.log(asset.key, asset.contentType);
|
|
99
|
-
* }
|
|
100
|
-
*/
|
|
101
|
-
async getAssetById(id) {
|
|
102
|
-
const parsedId = z.uuid().parse(id);
|
|
103
|
-
const [asset] = await this.getAssetByIdQuery(parsedId);
|
|
104
|
-
return asset ?? null;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Builds a query to fetch a single ready storage asset by key
|
|
108
|
-
* within the current adapter provider scope.
|
|
109
|
-
*
|
|
110
|
-
* Notes:
|
|
111
|
-
* - Scoped to `this.#adapter.key` to avoid cross-provider leakage.
|
|
112
|
-
* - Targets ready assets by default.
|
|
113
|
-
* - Uniqueness is expected on `(provider, bucket, key)`.
|
|
114
|
-
*
|
|
115
|
-
* @param key - The object key stored in `storage_assets.key`
|
|
116
|
-
* @returns A dynamic Drizzle query returning max 1 row
|
|
117
|
-
* @example
|
|
118
|
-
* let query = storageService.getAssetByKeyQuery("uploads/abc/main");
|
|
119
|
-
* query = query.leftJoin(otherTable, eq(otherTable.assetId, storageAssets.id));
|
|
120
|
-
* const [asset] = await query;
|
|
121
|
-
*/
|
|
122
|
-
getAssetByKeyQuery(key) {
|
|
123
|
-
return this.#db.select().from(storageAssets).where(and(eq(storageAssets.key, key), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), eq(storageAssets.status, "ready"), isNull(storageAssets.deletedAt))).limit(1).$dynamic();
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Fetches a single ready storage asset by key.
|
|
127
|
-
*
|
|
128
|
-
* This is the convenience wrapper around `getAssetByKeyQuery`.
|
|
129
|
-
* Use this when you only need the result, not query composition.
|
|
130
|
-
*
|
|
131
|
-
* @param key - Asset key to look up
|
|
132
|
-
* @returns The matching asset or `null` if none is found
|
|
133
|
-
* @example
|
|
134
|
-
* const asset = await storageService.getAssetByKey("uploads/abc/main");
|
|
135
|
-
* if (!asset) return;
|
|
136
|
-
*/
|
|
137
|
-
async getAssetByKey(key) {
|
|
138
|
-
const [result] = await this.getAssetByKeyQuery(key);
|
|
139
|
-
return result ?? null;
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Builds a base query for listing storage assets.
|
|
143
|
-
*
|
|
144
|
-
* Scope and defaults:
|
|
145
|
-
* - Scoped to the current adapter provider (`this.#adapter.key`)
|
|
146
|
-
* - Orders by newest first (`createdAt DESC`)
|
|
147
|
-
*
|
|
148
|
-
* This method returns a dynamic query so callers can extend it with
|
|
149
|
-
* custom filters, joins, pagination, and limits.
|
|
150
|
-
*
|
|
151
|
-
* @returns A dynamic Drizzle query for listing assets
|
|
152
|
-
* @example
|
|
153
|
-
* const query = storageService
|
|
154
|
-
* .listAssetsQuery()
|
|
155
|
-
* .limit(50);
|
|
156
|
-
* const assets = await query;
|
|
157
|
-
*/
|
|
158
|
-
listAssetsQuery() {
|
|
159
|
-
return this.#db.select().from(storageAssets).where(and(eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), isNull(storageAssets.deletedAt))).orderBy(desc(storageAssets.createdAt)).$dynamic();
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Lists storage assets using safe default pagination.
|
|
163
|
-
*
|
|
164
|
-
* This is the convenience wrapper around `listAssetsQuery`.
|
|
165
|
-
* Use `listAssetsQuery()` directly when you need custom query composition.
|
|
166
|
-
*
|
|
167
|
-
* @returns Up to 100 storage assets sorted by newest first
|
|
168
|
-
* @example
|
|
169
|
-
* const assets = await storageService.listAssets();
|
|
170
|
-
*/
|
|
171
|
-
async listAssets() {
|
|
172
|
-
return await this.listAssetsQuery().limit(100) ?? [];
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Creates a pending storage asset record and generates a presigned upload URL.
|
|
176
|
-
*
|
|
177
|
-
* Flow:
|
|
178
|
-
* - Validates the input payload
|
|
179
|
-
* - Inserts a `pending` asset in the catalog (`storage_assets`)
|
|
180
|
-
* - Requests a presigned PUT URL from the storage adapter
|
|
181
|
-
* - Marks the asset as `error` if URL generation fails
|
|
182
|
-
*
|
|
183
|
-
* This method is intended for direct-to-storage browser uploads.
|
|
184
|
-
* The upload should be finalized later via a confirm step.
|
|
185
|
-
*
|
|
186
|
-
* @param props - Presign upload input (contentType, size, metadata)
|
|
187
|
-
* @returns The created asset id, key, and presigned URL
|
|
188
|
-
* @throws {ServerError} If intent creation or URL generation fails
|
|
189
|
-
* @example
|
|
190
|
-
* const result = await storageService.presignUpload({
|
|
191
|
-
* contentType: "image/png",
|
|
192
|
-
* size: 120_000,
|
|
193
|
-
* metadata: { uploadToken: crypto.randomUUID() },
|
|
194
|
-
* });
|
|
195
|
-
* // result => { id, uploadId, key, presignedUrl }
|
|
196
|
-
*/
|
|
197
|
-
async presignUpload(props) {
|
|
198
|
-
const input = presignUploadInputSchema.parse(props);
|
|
199
|
-
const id = generateDefaultUUID();
|
|
200
|
-
const uploadId = input.uploadId ?? generateDefaultUUID();
|
|
201
|
-
const key = this.#generateKey(id);
|
|
202
|
-
const { contentType, size, metadata, name, visibility } = input;
|
|
203
|
-
const [record] = await this.#db.insert(storageAssets).values({
|
|
204
|
-
id,
|
|
205
|
-
uploadId,
|
|
206
|
-
key,
|
|
207
|
-
size,
|
|
208
|
-
contentType,
|
|
209
|
-
name,
|
|
210
|
-
visibility,
|
|
211
|
-
provider: this.#adapter.key,
|
|
212
|
-
bucket: this.#adapter.bucketName,
|
|
213
|
-
status: "pending",
|
|
214
|
-
metadata
|
|
215
|
-
}).returning();
|
|
216
|
-
if (!record) throw new ServerError("INTERNAL_SERVER_ERROR", { message: "Failed to create upload intent" });
|
|
217
|
-
try {
|
|
218
|
-
const presignedUrl = await this.#adapter.putObjectURL({
|
|
219
|
-
key,
|
|
220
|
-
contentType,
|
|
221
|
-
size,
|
|
222
|
-
metadata
|
|
223
|
-
});
|
|
224
|
-
return {
|
|
225
|
-
...record,
|
|
226
|
-
presignedUrl
|
|
227
|
-
};
|
|
228
|
-
} catch (error) {
|
|
229
|
-
await this.#db.update(storageAssets).set({ status: "error" }).where(eq(storageAssets.id, record.id));
|
|
230
|
-
throw this.#parseError(error, { fallbackMessage: "Failed to generate upload URL" });
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Confirms a direct-to-storage upload by verifying object existence
|
|
235
|
-
* and transitioning the asset from `pending` to `ready`.
|
|
236
|
-
*
|
|
237
|
-
* Flow:
|
|
238
|
-
* - Validates confirm input
|
|
239
|
-
* - Loads the asset record scoped to the current adapter provider
|
|
240
|
-
* - Returns early if asset is already `ready` (idempotent behavior)
|
|
241
|
-
* - Verifies object existence/metadata via `adapter.headObject`
|
|
242
|
-
* - Marks asset as `error` if verification fails
|
|
243
|
-
* - Updates status to `ready` and stores upload metadata
|
|
244
|
-
*
|
|
245
|
-
* @param props - Confirm upload payload containing the asset uploadId
|
|
246
|
-
* @returns The updated storage asset record
|
|
247
|
-
* @throws {ServerError} If the asset is missing, verification fails, or update fails
|
|
248
|
-
* @example
|
|
249
|
-
* const asset = await storageService.confirmUpload("019d0051-2c0d-741e-9e3c-e5a5bc4d16a2");
|
|
250
|
-
* // asset.status === "ready"
|
|
251
|
-
*/
|
|
252
|
-
async confirmUpload(props) {
|
|
253
|
-
const uploadId = confirmUploadInputSchema.parse(props);
|
|
254
|
-
const [record] = await this.#db.select().from(storageAssets).where(and(eq(storageAssets.uploadId, uploadId), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), isNull(storageAssets.deletedAt))).limit(1);
|
|
255
|
-
if (!record) throw new ServerError("NOT_FOUND", { message: "Storage asset not found" });
|
|
256
|
-
if (record.status === "ready") return record;
|
|
257
|
-
let head;
|
|
258
|
-
try {
|
|
259
|
-
head = await this.#adapter.headObject({ key: record.key });
|
|
260
|
-
} catch (error) {
|
|
261
|
-
await this.#db.update(storageAssets).set({ status: "error" }).where(eq(storageAssets.id, record.id));
|
|
262
|
-
throw this.#parseError(error, { fallbackMessage: "Failed to verify uploaded object" });
|
|
263
|
-
}
|
|
264
|
-
const [updated] = await this.#db.update(storageAssets).set({
|
|
265
|
-
status: "ready",
|
|
266
|
-
uploadedAt: /* @__PURE__ */ new Date(),
|
|
267
|
-
size: head.size ?? record.size,
|
|
268
|
-
contentType: head.contentType ?? record.contentType
|
|
269
|
-
}).where(and(eq(storageAssets.id, record.id), eq(storageAssets.status, "pending"))).returning();
|
|
270
|
-
if (!updated) throw new ServerError("INTERNAL_SERVER_ERROR", { message: "Failed to confirm upload" });
|
|
271
|
-
return updated;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Uploads an asset directly from the server and persists its catalog record.
|
|
275
|
-
*
|
|
276
|
-
* Flow:
|
|
277
|
-
* - Validates upload input
|
|
278
|
-
* - Creates a `pending` asset record in `storage_assets`
|
|
279
|
-
* - Uploads the object bytes through the storage adapter
|
|
280
|
-
* - Marks the record as `ready` and stores upload metadata
|
|
281
|
-
* - Marks the record as `error` if upload fails
|
|
282
|
-
*
|
|
283
|
-
* This method is intended for server-side uploads (non-presigned flow).
|
|
284
|
-
* For browser direct uploads, use `presignUpload` + `confirmUpload`.
|
|
285
|
-
*
|
|
286
|
-
* @param props - Upload payload (body, contentType, size)
|
|
287
|
-
* @returns The finalized storage asset record
|
|
288
|
-
* @throws {ServerError} If record creation, upload, or finalization fails
|
|
289
|
-
* @example
|
|
290
|
-
* const asset = await storageService.upload({
|
|
291
|
-
* body: fileBuffer,
|
|
292
|
-
* contentType: "application/pdf",
|
|
293
|
-
* size: fileBuffer.byteLength,
|
|
294
|
-
* });
|
|
295
|
-
*/
|
|
296
|
-
async upload(props) {
|
|
297
|
-
const { body, contentType, size, metadata, name, visibility } = uploadInputSchema.parse(props);
|
|
298
|
-
const id = generateDefaultUUID();
|
|
299
|
-
const key = this.#generateKey(id);
|
|
300
|
-
const [record] = await this.#db.insert(storageAssets).values({
|
|
301
|
-
id,
|
|
302
|
-
key,
|
|
303
|
-
size,
|
|
304
|
-
contentType,
|
|
305
|
-
name,
|
|
306
|
-
visibility,
|
|
307
|
-
provider: this.#adapter.key,
|
|
308
|
-
bucket: this.#adapter.bucketName,
|
|
309
|
-
status: "pending",
|
|
310
|
-
metadata
|
|
311
|
-
}).returning();
|
|
312
|
-
if (!record) throw new ServerError("INTERNAL_SERVER_ERROR", { message: "Failed to create upload record" });
|
|
313
|
-
try {
|
|
314
|
-
const uploaded = await this.#adapter.putObject({
|
|
315
|
-
key,
|
|
316
|
-
body,
|
|
317
|
-
contentType,
|
|
318
|
-
size,
|
|
319
|
-
metadata
|
|
320
|
-
});
|
|
321
|
-
const [updated] = await this.#db.update(storageAssets).set({
|
|
322
|
-
status: "ready",
|
|
323
|
-
uploadedAt: /* @__PURE__ */ new Date(),
|
|
324
|
-
size: uploaded.size ?? size ?? record.size,
|
|
325
|
-
contentType: uploaded.contentType ?? contentType ?? record.contentType
|
|
326
|
-
}).where(and(eq(storageAssets.id, record.id), eq(storageAssets.status, "pending"))).returning();
|
|
327
|
-
if (!updated) throw new ServerError("INTERNAL_SERVER_ERROR", { message: "Failed to finalize upload" });
|
|
328
|
-
return updated;
|
|
329
|
-
} catch (error) {
|
|
330
|
-
await this.#db.update(storageAssets).set({ status: "error" }).where(and(eq(storageAssets.id, record.id), eq(storageAssets.status, "pending")));
|
|
331
|
-
throw this.#parseError(error, { fallbackMessage: "Failed to upload object" });
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Retrieves the object content for a ready storage asset.
|
|
336
|
-
*
|
|
337
|
-
* Flow:
|
|
338
|
-
* - Looks up the asset record by id, scoped to the current adapter provider
|
|
339
|
-
* - Ensures the asset is in `ready` status
|
|
340
|
-
* - Fetches object content from the storage adapter using the stored key
|
|
341
|
-
*
|
|
342
|
-
* @param id - The storage asset id
|
|
343
|
-
* @returns The adapter object response (stream/body + metadata)
|
|
344
|
-
* @throws {ServerError} If the asset does not exist or is not ready
|
|
345
|
-
* @example
|
|
346
|
-
* const object = await storageService.getObject("asset-123");
|
|
347
|
-
* // object.body can be streamed/consumed by caller
|
|
348
|
-
*/
|
|
349
|
-
async getObject(input) {
|
|
350
|
-
const id = z.uuid().parse(input);
|
|
351
|
-
const [record] = await this.#db.select().from(storageAssets).where(and(eq(storageAssets.id, id), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), eq(storageAssets.status, "ready"), isNull(storageAssets.deletedAt))).limit(1);
|
|
352
|
-
if (!record) throw new ServerError("NOT_FOUND", { message: "Storage asset not found" });
|
|
353
|
-
return this.#adapter.getObject(record.key).catch((error) => {
|
|
354
|
-
throw this.#parseError(error, { fallbackMessage: "Failed to retrieve object" });
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Generates a presigned read URL for a ready storage asset.
|
|
359
|
-
*
|
|
360
|
-
* Flow:
|
|
361
|
-
* - Validates the asset id
|
|
362
|
-
* - Resolves the asset record scoped to the current adapter provider
|
|
363
|
-
* - Ensures the asset is in `ready` status
|
|
364
|
-
* - Delegates URL signing to the storage adapter using the stored key
|
|
365
|
-
*
|
|
366
|
-
* @param input - Storage asset id (UUID)
|
|
367
|
-
* @param options - Optional URL options (for example expiration/disposition)
|
|
368
|
-
* @returns A presigned URL for reading the object
|
|
369
|
-
* @throws {ServerError} If the asset does not exist or is not ready
|
|
370
|
-
* @example
|
|
371
|
-
* const url = await storageService.getObjectURL("019d0051-2c0d-741e-9e3c-e5a5bc4d16a2", {
|
|
372
|
-
* expiresIn: 3600,
|
|
373
|
-
* });
|
|
374
|
-
*/
|
|
375
|
-
async getObjectURL(input, options) {
|
|
376
|
-
const id = z.uuid().parse(input);
|
|
377
|
-
const [record] = await this.#db.select().from(storageAssets).where(and(eq(storageAssets.id, id), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), eq(storageAssets.status, "ready"), isNull(storageAssets.deletedAt))).limit(1);
|
|
378
|
-
if (!record) throw new ServerError("NOT_FOUND", { message: "Storage asset not found" });
|
|
379
|
-
return this.#adapter.getObjectURL(record.key, options).catch((error) => {
|
|
380
|
-
throw this.#parseError(error, { fallbackMessage: "Failed to generate object URL" });
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Soft deletes a single storage asset by id.
|
|
385
|
-
*
|
|
386
|
-
* This is a convenience wrapper around `deleteAssets`.
|
|
387
|
-
*
|
|
388
|
-
* @param input - Storage asset id (UUID)
|
|
389
|
-
* @returns The soft-deleted asset record, or null if not found/already deleted
|
|
390
|
-
*/
|
|
391
|
-
async deleteAsset(input) {
|
|
392
|
-
const id = z.uuid().parse(input);
|
|
393
|
-
const [deleted] = await this.deleteAssets([id]);
|
|
394
|
-
return deleted ?? null;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Soft deletes multiple storage assets by setting `deletedAt`.
|
|
398
|
-
*
|
|
399
|
-
* Flow:
|
|
400
|
-
* - Validates and de-duplicates ids
|
|
401
|
-
* - Resolves provider-scoped active records
|
|
402
|
-
* - Marks matching rows as deleted by setting `deletedAt`
|
|
403
|
-
*
|
|
404
|
-
* @param input - Storage asset ids (UUID[])
|
|
405
|
-
* @returns Soft-deleted asset records
|
|
406
|
-
*/
|
|
407
|
-
async deleteAssets(input) {
|
|
408
|
-
const ids = [...new Set(z.array(z.uuid()).parse(input))];
|
|
409
|
-
if (ids.length === 0) return [];
|
|
410
|
-
return this.#db.update(storageAssets).set({ deletedAt: /* @__PURE__ */ new Date() }).where(and(inArray(storageAssets.id, ids), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), isNull(storageAssets.deletedAt))).returning();
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Restores a single soft-deleted storage asset.
|
|
414
|
-
*
|
|
415
|
-
* This is a convenience wrapper around `restoreAssets`.
|
|
416
|
-
*
|
|
417
|
-
* @param input - Storage asset id (UUID)
|
|
418
|
-
* @returns The restored asset record, or null if not found/not deleted
|
|
419
|
-
*/
|
|
420
|
-
async restoreAsset(input) {
|
|
421
|
-
const id = z.uuid().parse(input);
|
|
422
|
-
const [restored] = await this.restoreAssets([id]);
|
|
423
|
-
return restored ?? null;
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* Restores multiple soft-deleted storage assets by clearing `deletedAt`.
|
|
427
|
-
*
|
|
428
|
-
* @param input - Storage asset ids (UUID[])
|
|
429
|
-
* @returns Restored asset records
|
|
430
|
-
*/
|
|
431
|
-
async restoreAssets(input) {
|
|
432
|
-
const ids = [...new Set(z.array(z.uuid()).parse(input))];
|
|
433
|
-
if (ids.length === 0) return [];
|
|
434
|
-
return this.#db.update(storageAssets).set({ deletedAt: null }).where(and(inArray(storageAssets.id, ids), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName), isNotNull(storageAssets.deletedAt))).returning();
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Hard deletes a single storage asset.
|
|
438
|
-
*
|
|
439
|
-
* This is a convenience wrapper around `purgeAssets`.
|
|
440
|
-
*
|
|
441
|
-
* @param input - Storage asset id (UUID)
|
|
442
|
-
* @returns The purged asset record, or null if not found
|
|
443
|
-
*/
|
|
444
|
-
async purgeAsset(input) {
|
|
445
|
-
const id = z.uuid().parse(input);
|
|
446
|
-
const [deleted] = await this.purgeAssets([id]);
|
|
447
|
-
return deleted ?? null;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Hard deletes multiple storage assets.
|
|
451
|
-
*
|
|
452
|
-
* Flow:
|
|
453
|
-
* - Validates and de-duplicates ids
|
|
454
|
-
* - Resolves provider-scoped records
|
|
455
|
-
* - Deletes physical objects from the adapter by key
|
|
456
|
-
* - Hard deletes DB records
|
|
457
|
-
*
|
|
458
|
-
* @param input - Storage asset ids (UUID[])
|
|
459
|
-
* @returns Purged asset records
|
|
460
|
-
* @throws {ServerError} If provider deletion fails
|
|
461
|
-
*/
|
|
462
|
-
async purgeAssets(input) {
|
|
463
|
-
const ids = [...new Set(z.array(z.uuid()).parse(input))];
|
|
464
|
-
if (ids.length === 0) return [];
|
|
465
|
-
const records = await this.#db.select({
|
|
466
|
-
id: storageAssets.id,
|
|
467
|
-
key: storageAssets.key
|
|
468
|
-
}).from(storageAssets).where(and(inArray(storageAssets.id, ids), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName)));
|
|
469
|
-
if (records.length === 0) return [];
|
|
470
|
-
const keys = records.map((r) => r.key);
|
|
471
|
-
try {
|
|
472
|
-
await this.#adapter.deleteObjects(keys);
|
|
473
|
-
} catch (error) {
|
|
474
|
-
throw this.#parseError(error, { fallbackMessage: "Failed to delete storage objects" });
|
|
475
|
-
}
|
|
476
|
-
const deletedIds = records.map((r) => r.id);
|
|
477
|
-
return await this.#db.delete(storageAssets).where(and(inArray(storageAssets.id, deletedIds), eq(storageAssets.provider, this.#adapter.key), eq(storageAssets.bucket, this.#adapter.bucketName))).returning();
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Normalizes unknown adapter/service errors into a consistent `ServerError`.
|
|
481
|
-
*
|
|
482
|
-
* Behavior:
|
|
483
|
-
* - Returns existing `ServerError` instances unchanged
|
|
484
|
-
* - Maps known storage adapter errors to application-level server errors
|
|
485
|
-
* - Falls back to a generic internal server error for unknown failures
|
|
486
|
-
*
|
|
487
|
-
* This keeps adapter-specific errors inside the storage layer while exposing
|
|
488
|
-
* a stable error contract to route handlers and RPC procedures.
|
|
489
|
-
*
|
|
490
|
-
* @param error - The unknown error to normalize
|
|
491
|
-
* @param options - Optional fallback message for non-specific failures
|
|
492
|
-
* @returns A normalized `ServerError`
|
|
493
|
-
*/
|
|
494
|
-
#parseError(error, options) {
|
|
495
|
-
if (error instanceof ServerError) return error;
|
|
496
|
-
if (error instanceof StorageAdapterError) {
|
|
497
|
-
if (error.code === "OBJECT_NOT_FOUND") return new ServerError("NOT_FOUND", {
|
|
498
|
-
message: "Storage asset not found",
|
|
499
|
-
cause: error
|
|
500
|
-
});
|
|
501
|
-
return new ServerError("INTERNAL_SERVER_ERROR", {
|
|
502
|
-
message: options?.fallbackMessage ?? "Storage adapter error",
|
|
503
|
-
cause: error
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
return new ServerError("INTERNAL_SERVER_ERROR", {
|
|
507
|
-
message: options?.fallbackMessage ?? "Unknown storage error",
|
|
508
|
-
cause: error instanceof Error ? error : void 0
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
//#endregion
|
|
514
|
-
export { Storage };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { PresignUploadInput, PresignUploadOutput, SelectStorageAssetSchema } from "./validators.mjs";
|
|
2
|
-
import { StorageRouterInputs, StorageRouterOutputs } from "./procedures.server.mjs";
|
|
3
|
-
|
|
4
|
-
//#region src/modules/storage/lib/upload.client.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Upload request
|
|
7
|
-
*/
|
|
8
|
-
type UploadFileRequest = PresignUploadInput & {
|
|
9
|
-
file: File;
|
|
10
|
-
};
|
|
11
|
-
type PrepareUploadInput = Omit<UploadFileRequest, "name" | "contentType" | "size">;
|
|
12
|
-
type UploadHooks = {
|
|
13
|
-
beforePresign?: (input: UploadFileRequest) => Promise<void> | void;
|
|
14
|
-
afterPresign?: (presignResult: PresignUploadOutput) => Promise<void> | void;
|
|
15
|
-
beforeConfirm?: (presignResult: PresignUploadOutput) => Promise<void> | void;
|
|
16
|
-
afterConfirm?: (asset: SelectStorageAssetSchema) => Promise<void> | void;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Upload client
|
|
20
|
-
*/
|
|
21
|
-
type UploadClient = {
|
|
22
|
-
prepareUpload: (input: PrepareUploadInput) => UploadFileRequest;
|
|
23
|
-
upload: (input: UploadFileRequest, hooks?: UploadHooks) => Promise<SelectStorageAssetSchema>;
|
|
24
|
-
deleteAsset: (id: string) => Promise<SelectStorageAssetSchema | null>;
|
|
25
|
-
deleteAssets: (ids: string[]) => Promise<SelectStorageAssetSchema[]>;
|
|
26
|
-
restoreAsset: (id: string) => Promise<SelectStorageAssetSchema | null>;
|
|
27
|
-
restoreAssets: (ids: string[]) => Promise<SelectStorageAssetSchema[]>;
|
|
28
|
-
purgeAsset: (id: string) => Promise<SelectStorageAssetSchema | null>;
|
|
29
|
-
purgeAssets: (ids: string[]) => Promise<SelectStorageAssetSchema[]>;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Create upload client props
|
|
33
|
-
*/
|
|
34
|
-
type CreateStorageClientProps = {
|
|
35
|
-
endpoints: {
|
|
36
|
-
presign: (input: StorageRouterInputs["presign"]) => Promise<StorageRouterOutputs["presign"]>;
|
|
37
|
-
confirm: (uploadId: StorageRouterInputs["confirm"]) => Promise<StorageRouterOutputs["confirm"]>;
|
|
38
|
-
deleteAssets: (ids: StorageRouterInputs["deleteAssets"]) => Promise<StorageRouterOutputs["deleteAssets"]>;
|
|
39
|
-
deleteAsset: (id: StorageRouterInputs["deleteAsset"]) => Promise<StorageRouterOutputs["deleteAsset"]>;
|
|
40
|
-
restoreAsset: (id: StorageRouterInputs["restoreAsset"]) => Promise<StorageRouterOutputs["restoreAsset"]>;
|
|
41
|
-
restoreAssets: (ids: StorageRouterInputs["restoreAssets"]) => Promise<StorageRouterOutputs["restoreAssets"]>;
|
|
42
|
-
purgeAsset: (id: StorageRouterInputs["purgeAsset"]) => Promise<StorageRouterOutputs["purgeAsset"]>;
|
|
43
|
-
purgeAssets: (ids: StorageRouterInputs["purgeAssets"]) => Promise<StorageRouterOutputs["purgeAssets"]>;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Creates an upload client for the storage module.
|
|
48
|
-
*
|
|
49
|
-
* Flow:
|
|
50
|
-
* - Prepare upload payload with generated id and resolved key
|
|
51
|
-
* - Request presigned upload URL from server
|
|
52
|
-
* - Upload file bytes directly to object storage
|
|
53
|
-
* - Confirm upload and receive finalized storage asset
|
|
54
|
-
*/
|
|
55
|
-
declare function createUploadClient(props: CreateStorageClientProps): UploadClient;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { PrepareUploadInput, UploadClient, UploadFileRequest, UploadHooks, createUploadClient };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
//#region src/modules/storage/lib/upload.client.ts
|
|
2
|
-
/**
|
|
3
|
-
* Creates an upload client for the storage module.
|
|
4
|
-
*
|
|
5
|
-
* Flow:
|
|
6
|
-
* - Prepare upload payload with generated id and resolved key
|
|
7
|
-
* - Request presigned upload URL from server
|
|
8
|
-
* - Upload file bytes directly to object storage
|
|
9
|
-
* - Confirm upload and receive finalized storage asset
|
|
10
|
-
*/
|
|
11
|
-
function createUploadClient(props) {
|
|
12
|
-
/**
|
|
13
|
-
* Create input schema for the upload method
|
|
14
|
-
* @param {PrepareUploadInput} input
|
|
15
|
-
* @returns {UploadFileRequest}
|
|
16
|
-
*/
|
|
17
|
-
function prepareUpload(input) {
|
|
18
|
-
return {
|
|
19
|
-
...input,
|
|
20
|
-
uploadId: input.uploadId ?? crypto.randomUUID(),
|
|
21
|
-
name: input.file.name,
|
|
22
|
-
size: input.file.size,
|
|
23
|
-
contentType: input.file.type || "application/octet-stream"
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Upload file to the server
|
|
28
|
-
* @param {UploadFileRequest} input
|
|
29
|
-
* @returns {Promise<SelectStorageAssetSchema>}
|
|
30
|
-
*/
|
|
31
|
-
async function upload(input, hooks) {
|
|
32
|
-
let presignResult = null;
|
|
33
|
-
try {
|
|
34
|
-
/**
|
|
35
|
-
* Presign
|
|
36
|
-
*/
|
|
37
|
-
await hooks?.beforePresign?.(input);
|
|
38
|
-
presignResult = await props.endpoints.presign(input);
|
|
39
|
-
await hooks?.afterPresign?.(presignResult);
|
|
40
|
-
/**
|
|
41
|
-
* Upload the file
|
|
42
|
-
*/
|
|
43
|
-
const uploadResponse = await fetch(presignResult.presignedUrl, {
|
|
44
|
-
method: "PUT",
|
|
45
|
-
headers: { "Content-Type": input.contentType || "application/octet-stream" },
|
|
46
|
-
body: input.file
|
|
47
|
-
});
|
|
48
|
-
if (!uploadResponse.ok) {
|
|
49
|
-
const message = await uploadResponse.text();
|
|
50
|
-
throw new Error(`Upload failed: ${message}`);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Confirm
|
|
54
|
-
*/
|
|
55
|
-
await hooks?.beforeConfirm?.(presignResult);
|
|
56
|
-
const asset = await props.endpoints.confirm(presignResult.uploadId);
|
|
57
|
-
await hooks?.afterConfirm?.(asset);
|
|
58
|
-
/**
|
|
59
|
-
* Return
|
|
60
|
-
*/
|
|
61
|
-
return asset;
|
|
62
|
-
} catch (err) {
|
|
63
|
-
console.error("Upload error: ", err);
|
|
64
|
-
/**
|
|
65
|
-
* Delete if upload failed
|
|
66
|
-
* */
|
|
67
|
-
if (presignResult) await props.endpoints.deleteAsset(presignResult.id).catch((deleteErr) => {
|
|
68
|
-
console.error("Failed to delete asset after upload error: ", deleteErr);
|
|
69
|
-
});
|
|
70
|
-
throw err;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
prepareUpload,
|
|
75
|
-
upload,
|
|
76
|
-
deleteAsset: props.endpoints.deleteAsset,
|
|
77
|
-
deleteAssets: props.endpoints.deleteAssets,
|
|
78
|
-
restoreAsset: props.endpoints.restoreAsset,
|
|
79
|
-
restoreAssets: props.endpoints.restoreAssets,
|
|
80
|
-
purgeAsset: props.endpoints.purgeAsset,
|
|
81
|
-
purgeAssets: props.endpoints.purgeAssets
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
//#endregion
|
|
86
|
-
export { createUploadClient };
|