@tulip-systems/core 0.5.3 → 0.5.4
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 +3 -3
- package/dist/auth/client.mjs +2 -2
- package/dist/components/client.d.mts +2 -2
- package/dist/components/common/icons.d.mts +2 -2
- package/dist/components/common/icons.d.mts.map +1 -1
- package/dist/components/common/status.d.mts +3 -3
- package/dist/components/common/status.d.mts.map +1 -1
- package/dist/components/editor/components/content.client.d.mts +2 -2
- package/dist/components/editor/components/content.client.d.mts.map +1 -1
- package/dist/components/editor/components/editor.client.d.mts +6 -6
- package/dist/components/editor/components/editor.client.d.mts.map +1 -1
- package/dist/components/editor/components/menu.client.d.mts +3 -3
- package/dist/components/editor/components/menu.client.d.mts.map +1 -1
- package/dist/components/editor/extensions/file-handler/utils.mjs +1 -1
- package/dist/components/editor/extensions/file-handler/utils.mjs.map +1 -1
- package/dist/components/editor/extensions/image/extension.mjs +0 -1
- package/dist/components/editor/extensions/image/extension.mjs.map +1 -1
- package/dist/components/editor/extensions/skeleton/extension.mjs +1 -1
- package/dist/components/editor/lib/constants.d.mts +29 -29
- package/dist/components/editor/lib/constants.mjs +3 -3
- package/dist/components/editor/lib/extensions.d.mts +3 -3
- package/dist/components/editor/lib/helpers.d.mts.map +1 -1
- package/dist/components/editor/lib/helpers.mjs +38 -3
- package/dist/components/editor/lib/helpers.mjs.map +1 -1
- package/dist/components/header/back-button.client.d.mts +2 -2
- package/dist/components/header/back-button.client.d.mts.map +1 -1
- package/dist/components/header/bottom-bar.client.d.mts +3 -3
- package/dist/components/header/bottom-bar.client.d.mts.map +1 -1
- package/dist/components/header/breadcrumbs.client.d.mts +7 -7
- package/dist/components/header/breadcrumbs.client.d.mts.map +1 -1
- package/dist/components/header/header.client.d.mts +2 -2
- package/dist/components/header/header.client.d.mts.map +1 -1
- package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.mts.map +1 -1
- package/dist/components/header/top-bar.client.d.mts +4 -4
- package/dist/components/header/top-bar.client.d.mts.map +1 -1
- package/dist/components/layouts/admin-content.client.d.mts +2 -2
- package/dist/components/layouts/admin-content.client.d.mts.map +1 -1
- package/dist/components/layouts/admin-layout.d.mts +2 -2
- package/dist/components/layouts/admin-layout.d.mts.map +1 -1
- package/dist/components/layouts/admin-loading.d.mts +2 -2
- package/dist/components/layouts/admin-loading.d.mts.map +1 -1
- package/dist/components/layouts/empty-page.d.mts +4 -4
- package/dist/components/layouts/empty-page.d.mts.map +1 -1
- package/dist/components/layouts/error-page.d.mts +23 -0
- package/dist/components/layouts/error-page.d.mts.map +1 -0
- package/dist/components/layouts/error-page.mjs +58 -0
- package/dist/components/layouts/error-page.mjs.map +1 -0
- package/dist/components/layouts/list-layout.d.mts +2 -2
- package/dist/components/layouts/list-layout.d.mts.map +1 -1
- package/dist/components/layouts/not-allowed-page.d.mts +22 -0
- package/dist/components/layouts/not-allowed-page.d.mts.map +1 -0
- package/dist/components/layouts/not-allowed-page.mjs +25 -0
- package/dist/components/layouts/not-allowed-page.mjs.map +1 -0
- package/dist/components/layouts/not-found-page.d.mts +3 -3
- package/dist/components/layouts/not-found-page.d.mts.map +1 -1
- package/dist/components/layouts/providers.client.d.mts +2 -2
- package/dist/components/layouts/providers.client.d.mts.map +1 -1
- package/dist/components/layouts/root-layout.server.d.mts +2 -2
- package/dist/components/layouts/root-layout.server.d.mts.map +1 -1
- package/dist/components/layouts/root-loading.d.mts +2 -2
- package/dist/components/layouts/root-loading.d.mts.map +1 -1
- package/dist/components/layouts/tab-layout.d.mts +2 -2
- package/dist/components/layouts/tab-layout.d.mts.map +1 -1
- package/dist/components/lists/data-list.d.mts +5 -5
- package/dist/components/lists/data-list.d.mts.map +1 -1
- package/dist/components/lists/data-stack.d.mts +8 -8
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts +21 -11
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts.map +1 -1
- package/dist/components/navigation/admin-sidebar-paths.client.mjs +7 -5
- package/dist/components/navigation/admin-sidebar-paths.client.mjs.map +1 -1
- package/dist/components/ui/accordion.d.mts +5 -5
- package/dist/components/ui/alert-dialog.d.mts +12 -12
- package/dist/components/ui/alert.d.mts +6 -6
- package/dist/components/ui/aspect-ratio.d.mts +2 -2
- package/dist/components/ui/avatar.client.d.mts +4 -4
- package/dist/components/ui/avatar.client.d.mts.map +1 -1
- package/dist/components/ui/badge.d.mts +4 -4
- package/dist/components/ui/breadcrumb.d.mts +8 -8
- package/dist/components/ui/button.d.mts +5 -5
- package/dist/components/ui/calendar.d.mts +3 -3
- package/dist/components/ui/card.d.mts +7 -7
- package/dist/components/ui/carousel.d.mts +6 -6
- package/dist/components/ui/chart.client.d.mts +5 -5
- package/dist/components/ui/chart.client.d.mts.map +1 -1
- package/dist/components/ui/checkbox.d.mts +2 -2
- package/dist/components/ui/collapsible.client.d.mts +4 -4
- package/dist/components/ui/collapsible.client.d.mts.map +1 -1
- package/dist/components/ui/color-picker.client.d.mts +2 -2
- package/dist/components/ui/color-picker.client.d.mts.map +1 -1
- package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.mts.map +1 -1
- package/dist/components/ui/combobox.client.d.mts +2 -2
- package/dist/components/ui/combobox.client.d.mts.map +1 -1
- package/dist/components/ui/command.d.mts +10 -10
- package/dist/components/ui/context-menu.d.mts +16 -16
- package/dist/components/ui/date-picker.client.d.mts +2 -2
- package/dist/components/ui/date-picker.client.d.mts.map +1 -1
- package/dist/components/ui/dialog.client.d.mts +11 -11
- package/dist/components/ui/dialog.client.d.mts.map +1 -1
- package/dist/components/ui/drawer.client.d.mts +11 -11
- package/dist/components/ui/drawer.client.d.mts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.mts +16 -16
- package/dist/components/ui/form.client.d.mts +7 -7
- package/dist/components/ui/form.client.d.mts.map +1 -1
- package/dist/components/ui/hover-card.client.d.mts +4 -4
- package/dist/components/ui/hover-card.client.d.mts.map +1 -1
- package/dist/components/ui/input-recipient.d.mts +2 -2
- package/dist/components/ui/input.d.mts +2 -2
- package/dist/components/ui/label.d.mts +2 -2
- package/dist/components/ui/navigation-menu.d.mts +11 -11
- package/dist/components/ui/pagination.d.mts +8 -8
- package/dist/components/ui/popover.d.mts +5 -5
- package/dist/components/ui/popover.d.mts.map +1 -1
- package/dist/components/ui/progress.client.d.mts +2 -2
- package/dist/components/ui/progress.client.d.mts.map +1 -1
- package/dist/components/ui/radio-group.d.mts +3 -3
- package/dist/components/ui/resizable.client.d.mts +4 -4
- package/dist/components/ui/resizable.client.d.mts.map +1 -1
- package/dist/components/ui/scroll-area.d.mts +3 -3
- package/dist/components/ui/select.client.d.mts +11 -11
- package/dist/components/ui/select.client.d.mts.map +1 -1
- package/dist/components/ui/separator.d.mts +2 -2
- package/dist/components/ui/sheet.client.d.mts +9 -9
- package/dist/components/ui/sheet.client.d.mts.map +1 -1
- package/dist/components/ui/sidebar.client.d.mts +26 -26
- package/dist/components/ui/sidebar.client.d.mts.map +1 -1
- package/dist/components/ui/skeleton.d.mts +2 -2
- package/dist/components/ui/slider.d.mts +2 -2
- package/dist/components/ui/sonner.client.d.mts +2 -2
- package/dist/components/ui/switch.d.mts +2 -2
- package/dist/components/ui/tabs.d.mts +5 -5
- package/dist/components/ui/textarea.d.mts +2 -2
- package/dist/components/ui/time-input.client.d.mts +2 -2
- package/dist/components/ui/toggle-group.client.d.mts +3 -3
- package/dist/components/ui/toggle.d.mts +2 -2
- package/dist/components/ui/toggle.d.mts.map +1 -1
- package/dist/components/ui/tooltip.client.d.mts +5 -5
- package/dist/components/ui/tooltip.client.d.mts.map +1 -1
- package/dist/components/ui/tooltip.client.mjs +1 -1
- package/dist/components/ui/tooltip.client.mjs.map +1 -1
- package/dist/components.d.mts +3 -1
- package/dist/components.mjs +5 -3
- package/dist/lib/hooks/use-indicator.d.mts +2 -2
- package/dist/lib/hooks/use-indicator.d.mts.map +1 -1
- package/dist/modules/auth/components/allowed.client.d.mts +21 -7
- package/dist/modules/auth/components/allowed.client.d.mts.map +1 -1
- package/dist/modules/auth/components/allowed.client.mjs +8 -2
- package/dist/modules/auth/components/allowed.client.mjs.map +1 -1
- package/dist/modules/auth/components/auth-layout.server.d.mts +2 -2
- package/dist/modules/auth/components/auth-loading.d.mts +2 -2
- package/dist/modules/auth/components/auth-loading.d.mts.map +1 -1
- package/dist/modules/auth/components/create-first-user-page.client.d.mts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/guard-first-user.server.d.mts +2 -2
- package/dist/modules/auth/components/guard.server.d.mts +2 -2
- package/dist/modules/auth/components/login-page.client.d.mts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/update-password-command.d.mts +2 -2
- package/dist/modules/auth/db/schema.d.mts +73 -73
- package/dist/modules/auth/db/schema.d.mts.map +1 -1
- package/dist/modules/auth/handler/client.client.d.mts +143 -143
- package/dist/modules/auth/handler/client.client.d.mts.map +1 -1
- package/dist/modules/auth/handler/init.d.mts +131 -131
- package/dist/modules/auth/handler/init.d.mts.map +1 -1
- package/dist/modules/auth/hooks/use-permission.d.mts +48 -4
- package/dist/modules/auth/hooks/use-permission.d.mts.map +1 -1
- package/dist/modules/auth/hooks/use-permission.mjs +51 -4
- package/dist/modules/auth/hooks/use-permission.mjs.map +1 -1
- package/dist/modules/auth/hooks/use-session.d.mts +4 -4
- package/dist/modules/auth/lib/helpers.server.mjs +1 -1
- package/dist/modules/auth/lib/validators.d.mts +2 -2
- package/dist/modules/auth/lib/validators.d.mts.map +1 -1
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/click-command.client.d.mts +2 -2
- package/dist/modules/commands/components/click-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
- package/dist/modules/commands/components/command-trigger.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
- package/dist/modules/commands/components/dropdown-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
- package/dist/modules/commands/components/empty-command.client.d.mts.map +1 -1
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
- package/dist/modules/commands/components/form-dialog-command.client.d.mts.map +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/hooks/use-command-menu.client.mjs +0 -5
- package/dist/modules/commands/hooks/use-command-menu.client.mjs.map +1 -1
- package/dist/modules/commands/hooks/use-command-mutation.client.d.mts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
- package/dist/modules/commands/menus/context-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/inline-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.mts.map +1 -1
- package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.mts.map +1 -1
- package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/delete-command.client.d.mts.map +1 -1
- package/dist/modules/config/db/helpers.d.mts +5 -5
- package/dist/modules/config/db/helpers.d.mts.map +1 -1
- package/dist/modules/data-tables/components/cell/common.client.d.mts +5 -5
- package/dist/modules/data-tables/components/column-header.d.mts +2 -2
- package/dist/modules/data-tables/components/column-header.d.mts.map +1 -1
- package/dist/modules/data-tables/components/filters/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
- package/dist/modules/data-tables/components/header.d.mts +4 -4
- package/dist/modules/data-tables/components/header.d.mts.map +1 -1
- package/dist/modules/data-tables/components/layout.d.mts +2 -2
- package/dist/modules/data-tables/components/layout.d.mts.map +1 -1
- package/dist/modules/data-tables/components/search-input.client.d.mts +2 -2
- package/dist/modules/data-tables/components/skeleton.d.mts +2 -2
- package/dist/modules/data-tables/components/skeleton.d.mts.map +1 -1
- package/dist/modules/data-tables/components/table.d.mts +7 -7
- package/dist/modules/data-tables/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/components/toolbar.d.mts +3 -3
- package/dist/modules/data-tables/components/toolbar.d.mts.map +1 -1
- package/dist/modules/data-tables/hooks/use-context.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/common.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/cells/drag-handle.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/advanced-select.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/combobox.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/input.client.d.mts +3 -3
- package/dist/modules/data-tables/tables/inline-table/components/inputs/read-only.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/inputs/select.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox-dropdown.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/combobox.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/combobox.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-input.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/date-picker.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/date-picker.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/editor.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/editor.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-recipient.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/input-toggle.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/input.client.d.mts +4 -4
- package/dist/modules/inline-edit/components/input.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/select.client.d.mts +6 -6
- package/dist/modules/inline-edit/components/select.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/switch.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/switch.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/components/toggle.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/toggle.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/hooks/context.client.d.mts +2 -2
- package/dist/modules/inline-edit/hooks/context.client.d.mts.map +1 -1
- package/dist/modules/inline-edit/lib/variants.d.mts +1 -1
- package/dist/modules/router/handler/init.server.d.mts +6 -6
- package/dist/modules/router/handler/init.server.d.mts.map +1 -1
- package/dist/modules/router/handler/init.server.mjs +1 -1
- package/dist/modules/router/lib/query-client.server.d.mts +2 -2
- package/dist/modules/router/lib/query-client.server.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +4 -4
- package/dist/modules/storage/components/dropzone.client.mjs +1 -1
- package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
- package/dist/modules/storage/components/image-grid.client.mjs +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +2 -2
- package/dist/modules/storage/lib/router.server.d.mts +2337 -2337
- package/dist/modules/storage/lib/router.server.mjs +1 -1
- package/dist/modules/storage/lib/schema.mjs +1 -1
- package/dist/modules/storage/lib/service.server.d.mts +15 -15
- package/dist/modules/storage/lib/service.server.mjs +2 -2
- package/dist/modules/storage/lib/validators.d.mts +14 -14
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/dist/router/server.mjs +1 -1
- package/package.json +1 -1
- package/src/components/editor/extensions/file-handler/utils.ts +1 -1
- package/src/components/editor/extensions/image/extension.ts +0 -2
- package/src/components/editor/lib/helpers.ts +39 -3
- package/src/components/entry.ts +2 -0
- package/src/components/layouts/error-page.tsx +61 -0
- package/src/components/layouts/not-allowed-page.tsx +1 -1
- package/src/components/navigation/admin-sidebar-paths.client.tsx +18 -2
- package/src/components/ui/tooltip.client.tsx +1 -1
- package/src/modules/auth/components/allowed.client.tsx +35 -7
- package/src/modules/auth/hooks/use-permission.ts +88 -2
- package/src/modules/commands/hooks/use-command-menu.client.tsx +4 -7
- package/dist/modules/auth/lib/utils.mjs +0 -21
- package/dist/modules/auth/lib/utils.mjs.map +0 -1
- package/src/modules/inline-edit/hooks/use-inline.client copy.tsx +0 -97
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isFolder } from "./helpers.mjs";
|
|
2
1
|
import { ServerError } from "../../router/lib/error.server.mjs";
|
|
2
|
+
import { isFolder } from "./helpers.mjs";
|
|
3
3
|
import { bulkActionSchema } from "../../router/lib/validators.mjs";
|
|
4
4
|
import { initRPC } from "../../router/handler/init.server.mjs";
|
|
5
5
|
import { nodes } from "./schema.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nodeSubtypes } from "./helpers.mjs";
|
|
2
1
|
import { baseColumns } from "../../config/db/helpers.mjs";
|
|
3
2
|
import { users } from "../../auth/db/schema.mjs";
|
|
3
|
+
import { nodeSubtypes } from "./helpers.mjs";
|
|
4
4
|
import { imageDispositions, imageVariants } from "./constants.mjs";
|
|
5
5
|
import { boolean, pgEnum, pgTable, unique } from "drizzle-orm/pg-core";
|
|
6
6
|
import { relations } from "drizzle-orm";
|
|
@@ -91,20 +91,20 @@ declare class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
91
91
|
* Upload file to S3 and add it to the database
|
|
92
92
|
**/
|
|
93
93
|
uploadFile(input: UploadFileSchema & Pick<PutObjectInput, "body">): Promise<{
|
|
94
|
+
size: number | null;
|
|
95
|
+
id: string;
|
|
94
96
|
name: string;
|
|
95
|
-
namespace: string;
|
|
96
97
|
type: "file" | "folder" | null;
|
|
98
|
+
hidden: boolean | null;
|
|
97
99
|
mode: "private" | "public" | null;
|
|
100
|
+
isPending: boolean;
|
|
101
|
+
namespace: string;
|
|
98
102
|
subtype: "image" | "document" | "spreadsheet" | "video" | "audio" | "archive" | "other";
|
|
99
|
-
size: number | null;
|
|
100
103
|
contentType: string | null;
|
|
101
104
|
readonly: boolean | null;
|
|
102
|
-
hidden: boolean | null;
|
|
103
|
-
id: string;
|
|
104
105
|
createdAt: Date;
|
|
105
106
|
updatedAt: Date;
|
|
106
107
|
createdBy: string | null;
|
|
107
|
-
isPending: boolean;
|
|
108
108
|
isDeleted: boolean;
|
|
109
109
|
orphanedAt: Date | null;
|
|
110
110
|
parentId: string | null;
|
|
@@ -116,20 +116,20 @@ declare class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
116
116
|
id: string;
|
|
117
117
|
presignedUrl: string;
|
|
118
118
|
node: {
|
|
119
|
+
size: number | null;
|
|
120
|
+
id: string;
|
|
119
121
|
name: string;
|
|
120
|
-
namespace: string;
|
|
121
122
|
type: "file" | "folder" | null;
|
|
123
|
+
hidden: boolean | null;
|
|
122
124
|
mode: "private" | "public" | null;
|
|
125
|
+
isPending: boolean;
|
|
126
|
+
namespace: string;
|
|
123
127
|
subtype: "image" | "document" | "spreadsheet" | "video" | "audio" | "archive" | "other";
|
|
124
|
-
size: number | null;
|
|
125
128
|
contentType: string | null;
|
|
126
129
|
readonly: boolean | null;
|
|
127
|
-
hidden: boolean | null;
|
|
128
|
-
id: string;
|
|
129
130
|
createdAt: Date;
|
|
130
131
|
updatedAt: Date;
|
|
131
132
|
createdBy: string | null;
|
|
132
|
-
isPending: boolean;
|
|
133
133
|
isDeleted: boolean;
|
|
134
134
|
orphanedAt: Date | null;
|
|
135
135
|
parentId: string | null;
|
|
@@ -151,20 +151,20 @@ declare class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
151
151
|
* Create a new folder
|
|
152
152
|
*/
|
|
153
153
|
createFolder(input: CreateFolderNodeSchema): Promise<{
|
|
154
|
+
size: number | null;
|
|
155
|
+
id: string;
|
|
154
156
|
name: string;
|
|
155
|
-
namespace: string;
|
|
156
157
|
type: "file" | "folder" | null;
|
|
158
|
+
hidden: boolean | null;
|
|
157
159
|
mode: "private" | "public" | null;
|
|
160
|
+
isPending: boolean;
|
|
161
|
+
namespace: string;
|
|
158
162
|
subtype: "image" | "document" | "spreadsheet" | "video" | "audio" | "archive" | "other";
|
|
159
|
-
size: number | null;
|
|
160
163
|
contentType: string | null;
|
|
161
164
|
readonly: boolean | null;
|
|
162
|
-
hidden: boolean | null;
|
|
163
|
-
id: string;
|
|
164
165
|
createdAt: Date;
|
|
165
166
|
updatedAt: Date;
|
|
166
167
|
createdBy: string | null;
|
|
167
|
-
isPending: boolean;
|
|
168
168
|
isDeleted: boolean;
|
|
169
169
|
orphanedAt: Date | null;
|
|
170
170
|
parentId: string | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServerError } from "../../router/lib/error.server.mjs";
|
|
2
2
|
import { generateDefaultUUID } from "../../config/db/helpers.mjs";
|
|
3
3
|
import { BUCKET_NAME } from "../../../lib/config/constants.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { getDriveBucketKey, inferNodeSubtype, isFile, isFolder } from "./helpers.mjs";
|
|
5
5
|
import { convertSearchToQueryParams } from "../../data-tables/lib/converters/search.mjs";
|
|
6
6
|
import { convertOrderByToQueryParams } from "../../data-tables/lib/converters/sorting.mjs";
|
|
7
7
|
import { deviceSizes } from "./constants.mjs";
|
|
@@ -1285,19 +1285,19 @@ type NodesTableFilters = z$1.input<typeof nodesTableFiltersSchema>;
|
|
|
1285
1285
|
* Create folder node
|
|
1286
1286
|
*/
|
|
1287
1287
|
declare const createFolderNodeSchema: z$1.ZodObject<{
|
|
1288
|
+
id: z$1.ZodOptional<z$1.ZodUUID>;
|
|
1288
1289
|
name: z$1.ZodString;
|
|
1289
|
-
|
|
1290
|
+
hidden: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1290
1291
|
mode: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
1291
1292
|
private: "private";
|
|
1292
1293
|
public: "public";
|
|
1293
1294
|
}>>>;
|
|
1295
|
+
isPending: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1296
|
+
namespace: z$1.ZodString;
|
|
1294
1297
|
readonly: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1295
|
-
hidden: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1296
|
-
id: z$1.ZodOptional<z$1.ZodUUID>;
|
|
1297
1298
|
createdAt: z$1.ZodOptional<z$1.ZodDate>;
|
|
1298
1299
|
updatedAt: z$1.ZodOptional<z$1.ZodDate>;
|
|
1299
1300
|
createdBy: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUUID>>;
|
|
1300
|
-
isPending: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1301
1301
|
isDeleted: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1302
1302
|
orphanedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
1303
1303
|
parentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUUID>>;
|
|
@@ -1310,12 +1310,16 @@ type CreateFolderNodeSchema = z$1.infer<typeof createFolderNodeSchema>;
|
|
|
1310
1310
|
* Upload file schema
|
|
1311
1311
|
*/
|
|
1312
1312
|
declare const uploadFileSchema: z$1.ZodObject<{
|
|
1313
|
+
size: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodInt>>;
|
|
1314
|
+
id: z$1.ZodOptional<z$1.ZodUUID>;
|
|
1313
1315
|
name: z$1.ZodString;
|
|
1314
|
-
|
|
1316
|
+
hidden: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1315
1317
|
mode: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
1316
1318
|
private: "private";
|
|
1317
1319
|
public: "public";
|
|
1318
1320
|
}>>>;
|
|
1321
|
+
isPending: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1322
|
+
namespace: z$1.ZodString;
|
|
1319
1323
|
subtype: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1320
1324
|
image: "image";
|
|
1321
1325
|
document: "document";
|
|
@@ -1325,15 +1329,11 @@ declare const uploadFileSchema: z$1.ZodObject<{
|
|
|
1325
1329
|
archive: "archive";
|
|
1326
1330
|
other: "other";
|
|
1327
1331
|
}>>;
|
|
1328
|
-
size: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodInt>>;
|
|
1329
1332
|
contentType: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1330
1333
|
readonly: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1331
|
-
hidden: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1332
|
-
id: z$1.ZodOptional<z$1.ZodUUID>;
|
|
1333
1334
|
createdAt: z$1.ZodOptional<z$1.ZodDate>;
|
|
1334
1335
|
updatedAt: z$1.ZodOptional<z$1.ZodDate>;
|
|
1335
1336
|
createdBy: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUUID>>;
|
|
1336
|
-
isPending: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1337
1337
|
isDeleted: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1338
1338
|
orphanedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
1339
1339
|
parentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUUID>>;
|
|
@@ -1346,12 +1346,15 @@ type UploadFileSchema = z$1.infer<typeof uploadFileSchema>;
|
|
|
1346
1346
|
* Presign file schema
|
|
1347
1347
|
*/
|
|
1348
1348
|
declare const presignFileSchema: z$1.ZodObject<{
|
|
1349
|
+
size: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodInt>>;
|
|
1349
1350
|
name: z$1.ZodString;
|
|
1350
|
-
|
|
1351
|
+
hidden: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1351
1352
|
mode: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
1352
1353
|
private: "private";
|
|
1353
1354
|
public: "public";
|
|
1354
1355
|
}>>>;
|
|
1356
|
+
isPending: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1357
|
+
namespace: z$1.ZodString;
|
|
1355
1358
|
subtype: z$1.ZodOptional<z$1.ZodEnum<{
|
|
1356
1359
|
image: "image";
|
|
1357
1360
|
document: "document";
|
|
@@ -1361,14 +1364,11 @@ declare const presignFileSchema: z$1.ZodObject<{
|
|
|
1361
1364
|
archive: "archive";
|
|
1362
1365
|
other: "other";
|
|
1363
1366
|
}>>;
|
|
1364
|
-
size: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodInt>>;
|
|
1365
1367
|
contentType: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1366
1368
|
readonly: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1367
|
-
hidden: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodBoolean>>;
|
|
1368
1369
|
createdAt: z$1.ZodOptional<z$1.ZodDate>;
|
|
1369
1370
|
updatedAt: z$1.ZodOptional<z$1.ZodDate>;
|
|
1370
1371
|
createdBy: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUUID>>;
|
|
1371
|
-
isPending: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1372
1372
|
isDeleted: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
1373
1373
|
orphanedAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
|
|
1374
1374
|
parentId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUUID>>;
|
|
@@ -1401,8 +1401,8 @@ type GetFileURLSchema = z$1.infer<typeof getFileURLSchema>;
|
|
|
1401
1401
|
* Get by parent id input
|
|
1402
1402
|
*/
|
|
1403
1403
|
declare const getNodesByParentIdSchema: z$1.ZodObject<{
|
|
1404
|
-
sort: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1405
1404
|
search: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1405
|
+
sort: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
|
|
1406
1406
|
order: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodEnum<{
|
|
1407
1407
|
asc: "asc";
|
|
1408
1408
|
desc: "desc";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAYY,IAAA,UAAc,KAAA,CAAM;AAApB,KACA,QAAA,
|
|
1
|
+
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAYY,IAAA,UAAc,KAAA,CAAM;AAApB,KACA,QAAA,GADI,OACc,KAAA,CAAM,YADQ,GAAA;EAChC,IAAA,EAAA,MAAQ;AACpB,CAAA;AAKa,KALD,UAAA,GAKiD,OAL7B,KAAA,CAAM,YAKX,GAAA;EACf,IAAA,EAAA,QAAQ;AAKpB,CAAA;;;;cANa,gBAAc,GAAA,CAAA;;;;KACf,QAAA,GAAW,GAAA,CAAE,aAAa;;;;cAKzB,+BAAgB;QAE3B,oBAAA,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AA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAElB,iBAAA,GAAoB,GAAA,CAAE,aAAa;;;;cAKlC;;;;cAEA,kBAAgB,GAAA,CAAA;;;;;;;;;;KAKjB,eAAA,GAAkB,GAAA,CAAE,aAAa;KACjC,gBAAA,GAAmB,GAAA,CAAE,aAAa;;;;cAKjC,0BAAwB,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,uBAAA,GAA0B,GAAA,CAAE,aAAa;;;;cAKxC,iBAAe,GAAA,CAAA;;;;;;;;KAMhB,cAAA,GAAiB,GAAA,CAAE,aAAa;KAChC,eAAA,GAAkB,GAAA,CAAE,aAAa;;;;cAKhC,iBAAe,GAAA,CAAA;;;;;;;;;;;KAShB,cAAA,GAAiB,GAAA,CAAE,aAAa;SACnC;;KAGG,eAAA,GAAkB,GAAA,CAAE,aAAa"}
|
package/dist/router/server.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HydrateClient, getQueryClient } from "../modules/router/lib/query-client.server.mjs";
|
|
2
1
|
import { ServerError } from "../modules/router/lib/error.server.mjs";
|
|
2
|
+
import { HydrateClient, getQueryClient } from "../modules/router/lib/query-client.server.mjs";
|
|
3
3
|
import { createRPCCaller } from "../modules/router/handler/caller.server.mjs";
|
|
4
4
|
import { createRPCContext } from "../modules/router/handler/context.server.mjs";
|
|
5
5
|
import { initRPC } from "../modules/router/handler/init.server.mjs";
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @example
|
|
8
8
|
* const imageCounts = collectImageIds(editorDoc);
|
|
9
9
|
* imageCounts.forEach((count, imageId) => {
|
|
10
|
-
* console.
|
|
10
|
+
* console.info(`Image ${imageId} appears ${count} times`);
|
|
11
11
|
* });
|
|
12
12
|
*/
|
|
13
13
|
export function collectImageIds(doc: any): Map<string, number> {
|
|
@@ -45,8 +45,6 @@ export const Image = TiptapImage.extend<ImageOptions>({
|
|
|
45
45
|
renderHTML({ HTMLAttributes }) {
|
|
46
46
|
const { src: _, ...attrs } = HTMLAttributes;
|
|
47
47
|
|
|
48
|
-
console.log("attrs", attrs);
|
|
49
|
-
|
|
50
48
|
const nodeId = attrs.nodeId as string | null;
|
|
51
49
|
const isPending = Boolean(attrs.isPending);
|
|
52
50
|
|
|
@@ -1,17 +1,53 @@
|
|
|
1
|
+
import Blockquote from "@tiptap/extension-blockquote";
|
|
2
|
+
import Bold from "@tiptap/extension-bold";
|
|
3
|
+
import Document from "@tiptap/extension-document";
|
|
4
|
+
import HardBreak from "@tiptap/extension-hard-break";
|
|
5
|
+
import Heading from "@tiptap/extension-heading";
|
|
6
|
+
import HorizontalRule from "@tiptap/extension-horizontal-rule";
|
|
7
|
+
import Italic from "@tiptap/extension-italic";
|
|
8
|
+
import Link from "@tiptap/extension-link";
|
|
9
|
+
import { BulletList, ListItem, ListKeymap, OrderedList } from "@tiptap/extension-list";
|
|
10
|
+
import Paragraph from "@tiptap/extension-paragraph";
|
|
11
|
+
import Strike from "@tiptap/extension-strike";
|
|
12
|
+
import Text from "@tiptap/extension-text";
|
|
13
|
+
import Underline from "@tiptap/extension-underline";
|
|
14
|
+
import { Dropcursor, Gapcursor, TrailingNode, UndoRedo } from "@tiptap/extensions";
|
|
1
15
|
import { generateHTML, generateJSON } from "@tiptap/html";
|
|
2
|
-
import { EDITOR_EXTENSIONS_VALUES } from "./constants";
|
|
3
16
|
import { EditorJSONContent } from "./types";
|
|
4
17
|
|
|
18
|
+
const EXTENSIONS_FOR_GENERATION = [
|
|
19
|
+
Blockquote,
|
|
20
|
+
BulletList,
|
|
21
|
+
Document,
|
|
22
|
+
HardBreak,
|
|
23
|
+
Heading,
|
|
24
|
+
HorizontalRule,
|
|
25
|
+
ListItem,
|
|
26
|
+
OrderedList,
|
|
27
|
+
Paragraph,
|
|
28
|
+
Text,
|
|
29
|
+
Bold,
|
|
30
|
+
Italic,
|
|
31
|
+
Link,
|
|
32
|
+
Strike,
|
|
33
|
+
Underline,
|
|
34
|
+
Dropcursor,
|
|
35
|
+
Gapcursor,
|
|
36
|
+
UndoRedo,
|
|
37
|
+
ListKeymap,
|
|
38
|
+
TrailingNode,
|
|
39
|
+
];
|
|
40
|
+
|
|
5
41
|
/**
|
|
6
42
|
* Convert text to editor content
|
|
7
43
|
*/
|
|
8
44
|
export function convertHTMLToEditorContent(html: string): EditorJSONContent {
|
|
9
|
-
return generateJSON(html,
|
|
45
|
+
return generateJSON(html, EXTENSIONS_FOR_GENERATION);
|
|
10
46
|
}
|
|
11
47
|
|
|
12
48
|
/**
|
|
13
49
|
* Convert editor content to text
|
|
14
50
|
*/
|
|
15
51
|
export function convertEditorContentToHTML(content: EditorJSONContent): string {
|
|
16
|
-
return generateHTML(content,
|
|
52
|
+
return generateHTML(content, EXTENSIONS_FOR_GENERATION);
|
|
17
53
|
}
|
package/src/components/entry.ts
CHANGED
|
@@ -12,7 +12,9 @@ export * from "./editor/lib/types";
|
|
|
12
12
|
*/
|
|
13
13
|
export * from "./layouts/admin-loading";
|
|
14
14
|
export * from "./layouts/empty-page";
|
|
15
|
+
export * from "./layouts/error-page";
|
|
15
16
|
export * from "./layouts/list-layout";
|
|
17
|
+
export * from "./layouts/not-allowed-page";
|
|
16
18
|
export * from "./layouts/not-found-page";
|
|
17
19
|
export * from "./layouts/root-loading";
|
|
18
20
|
export * from "./layouts/tab-layout";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { cn } from "@/lib/utils/cn";
|
|
2
|
+
import { ServerError } from "@/modules/router/lib/error.server";
|
|
3
|
+
import { CommonORPCErrorCode } from "@orpc/client";
|
|
4
|
+
import { BugIcon } from "lucide-react";
|
|
5
|
+
import { ComponentProps } from "react";
|
|
6
|
+
import { NotAllowedPage } from "./not-allowed-page";
|
|
7
|
+
import { NotFoundSection } from "./not-found-section";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ErrorPage
|
|
11
|
+
*/
|
|
12
|
+
export function ErrorPage({ className, ...props }: ComponentProps<"div">) {
|
|
13
|
+
return (
|
|
14
|
+
<div {...props} className={cn("relative z-0 grid h-dvh w-full place-items-center", className)}>
|
|
15
|
+
<div className="flex flex-col items-center gap-12 text-center">
|
|
16
|
+
<span className="text-destructive flex flex-col items-center gap-2">
|
|
17
|
+
<BugIcon className="size-20 xl:size-32" />
|
|
18
|
+
<h1 className="text-2xl font-bold lg:text-3xl">Oeps, er is iets fout gegaan.</h1>
|
|
19
|
+
</span>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ErrorPage
|
|
27
|
+
* - If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
28
|
+
* - If the error is a ServerError and the code is "NOT_FOUND", show the NotFoundSection
|
|
29
|
+
* - Else show the ErrorPage
|
|
30
|
+
*/
|
|
31
|
+
export function AdminErrorPage(props: { error: Error }) {
|
|
32
|
+
const serverErrorCode: CommonORPCErrorCode =
|
|
33
|
+
props.error instanceof ServerError ? props.error.code : undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
37
|
+
*/
|
|
38
|
+
if (serverErrorCode === "UNAUTHORIZED") {
|
|
39
|
+
return (
|
|
40
|
+
<div className="p-content h-dvh">
|
|
41
|
+
<NotAllowedPage className="h-full" />
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* If the error is a ServerError and the code is "UNAUTHORIZED", show the NotAllowedPage
|
|
48
|
+
*/
|
|
49
|
+
if (serverErrorCode === "NOT_FOUND") {
|
|
50
|
+
return (
|
|
51
|
+
<div className="relative z-0 grid h-dvh w-full place-items-center">
|
|
52
|
+
<NotFoundSection href="/admin" />
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Else show the ErrorPage
|
|
59
|
+
*/
|
|
60
|
+
return <ErrorPage />;
|
|
61
|
+
}
|
|
@@ -51,8 +51,24 @@ export function Paths({ children, ...props }: React.ComponentProps<typeof Sideba
|
|
|
51
51
|
/**
|
|
52
52
|
* Path Group
|
|
53
53
|
*/
|
|
54
|
-
export
|
|
55
|
-
|
|
54
|
+
export type PathGroupProps = React.ComponentProps<"div"> & {
|
|
55
|
+
/**
|
|
56
|
+
* Permission to check with the any strategy for displaying the group
|
|
57
|
+
* @example { project: ["view", "create"], client: ["view"], drive: ["view"] }
|
|
58
|
+
*/
|
|
59
|
+
permission?: Permission[];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export function PathGroup({ permission, ...props }: PathGroupProps) {
|
|
63
|
+
if (!permission) {
|
|
64
|
+
return <SidebarGroup {...props} />;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Allowed permission={permission} strategy="any">
|
|
69
|
+
<SidebarGroup {...props} />
|
|
70
|
+
</Allowed>
|
|
71
|
+
);
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
/**
|
|
@@ -48,7 +48,7 @@ function TooltipContent({
|
|
|
48
48
|
{...props}
|
|
49
49
|
>
|
|
50
50
|
{children}
|
|
51
|
-
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50
|
|
51
|
+
<TooltipPrimitive.Arrow className="bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]" />
|
|
52
52
|
</TooltipPrimitive.Content>
|
|
53
53
|
</TooltipPrimitive.Portal>
|
|
54
54
|
);
|
|
@@ -1,20 +1,48 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { JSX } from "react";
|
|
4
|
-
import { usePermission } from "../hooks/use-permission";
|
|
5
|
-
import { type Permission } from "../lib/permissions";
|
|
4
|
+
import { usePermission, UsePermissionProps } from "../hooks/use-permission";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
|
-
* Allowed
|
|
7
|
+
* Allowed types
|
|
9
8
|
*/
|
|
10
|
-
type
|
|
11
|
-
|
|
9
|
+
export type AllowedStrategy = "all" | "any";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Allowed props
|
|
13
|
+
*/
|
|
14
|
+
export type AllowedProps = UsePermissionProps & {
|
|
15
|
+
// /**
|
|
16
|
+
// * Permission to check
|
|
17
|
+
// * @example { project: ["view", "create"] }
|
|
18
|
+
// */
|
|
19
|
+
// permission: Permission;
|
|
20
|
+
|
|
21
|
+
// /**
|
|
22
|
+
// * Strategy to use when checking multiple permissions
|
|
23
|
+
// * - "all": all permissions must be allowed
|
|
24
|
+
// * - "any": at least one permission must be allowed
|
|
25
|
+
// * @default "all"
|
|
26
|
+
// */
|
|
27
|
+
// strategy?: AllowedStrategy;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Fallback component to render if the user doesn't have the permission
|
|
31
|
+
* @default null
|
|
32
|
+
*/
|
|
12
33
|
fallback?: JSX.Element | string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Children to render if the user has the permission
|
|
37
|
+
*/
|
|
13
38
|
children: React.ReactNode;
|
|
14
39
|
};
|
|
15
40
|
|
|
16
|
-
|
|
17
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Allowed
|
|
43
|
+
*/
|
|
44
|
+
export function Allowed({ permission, strategy, fallback, children }: AllowedProps) {
|
|
45
|
+
const { data } = usePermission({ permission, strategy } as UsePermissionProps);
|
|
18
46
|
|
|
19
47
|
if (data?.success) return <>{children}</>;
|
|
20
48
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { useSuspenseQueries } from "@tanstack/react-query";
|
|
3
|
+
import { useSuspenseQueries, useSuspenseQuery } from "@tanstack/react-query";
|
|
4
4
|
import { authClient } from "../handler/client.client";
|
|
5
5
|
import { type Permission } from "../lib/permissions";
|
|
6
6
|
import { useSession } from "./use-session";
|
|
@@ -8,7 +8,93 @@ import { useSession } from "./use-session";
|
|
|
8
8
|
/**
|
|
9
9
|
* UsePermission
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export type UsePermissionProps =
|
|
12
|
+
| {
|
|
13
|
+
/**
|
|
14
|
+
* Strategy to use when checking multiple permissions
|
|
15
|
+
* - "all": all permissions must be allowed
|
|
16
|
+
* - "any": at least one permission must be allowed
|
|
17
|
+
* @default "all"
|
|
18
|
+
*/
|
|
19
|
+
strategy?: "all";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Permission to check
|
|
23
|
+
* @example { project: ["view", "create"] }
|
|
24
|
+
*/
|
|
25
|
+
permission?: Permission;
|
|
26
|
+
}
|
|
27
|
+
| {
|
|
28
|
+
/**
|
|
29
|
+
* Strategy to use when checking multiple permissions
|
|
30
|
+
* - "all": all permissions must be allowed
|
|
31
|
+
* - "any": at least one permission must be allowed
|
|
32
|
+
* @default "all"
|
|
33
|
+
*/
|
|
34
|
+
strategy?: "any";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Permission to check
|
|
38
|
+
* @example [{ project: ["view", "create"] }, { client: ["view"] }, { drive: ["view"] }]
|
|
39
|
+
*/
|
|
40
|
+
permission?: Permission[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function usePermission({ permission, strategy = "all" }: UsePermissionProps) {
|
|
44
|
+
const sessionQuery = useSession();
|
|
45
|
+
|
|
46
|
+
return useSuspenseQuery({
|
|
47
|
+
queryKey: ["permission", { permission, strategy }],
|
|
48
|
+
queryFn: async () => {
|
|
49
|
+
// If no permission is provided, allow by default
|
|
50
|
+
if (!permission) return { permission, success: true };
|
|
51
|
+
|
|
52
|
+
// If no user is logged in, deny by default
|
|
53
|
+
if (!sessionQuery.data) return { permission, success: false };
|
|
54
|
+
const userId = sessionQuery.data?.user.id;
|
|
55
|
+
if (!userId) return { permission, success: false };
|
|
56
|
+
|
|
57
|
+
// If the strategy is "any", check if the user has any of the permissions
|
|
58
|
+
const permissions = Array.isArray(permission) ? permission : [permission];
|
|
59
|
+
|
|
60
|
+
// Check if the user has the permission
|
|
61
|
+
const results = await Promise.all(
|
|
62
|
+
permissions.map((permission) => authClient.admin.hasPermission({ permission, userId })),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const data = results.map(({ data }) => data).filter((data) => !!data);
|
|
66
|
+
const errors = results.filter(({ error }) => !!error).map(({ error }) => error);
|
|
67
|
+
|
|
68
|
+
// If there is an error, log it and return false
|
|
69
|
+
if (errors.length > 0) {
|
|
70
|
+
console.error(...errors);
|
|
71
|
+
return { permission, success: false };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Determine if the user has the permission based on the strategy
|
|
75
|
+
const success =
|
|
76
|
+
strategy === "all"
|
|
77
|
+
? data.every(({ success }) => success)
|
|
78
|
+
: data.some(({ success }) => success);
|
|
79
|
+
|
|
80
|
+
// Return the result
|
|
81
|
+
return {
|
|
82
|
+
permission,
|
|
83
|
+
success,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Check multiple permissions in parallel
|
|
92
|
+
* @param permission
|
|
93
|
+
* @param strategy
|
|
94
|
+
* @returns
|
|
95
|
+
* @deprecated Use `usePermission` with strategy "any" or "all" instead
|
|
96
|
+
*/
|
|
97
|
+
export function usePermissions(permission?: Permission) {
|
|
12
98
|
const sessionQuery = useSession();
|
|
13
99
|
|
|
14
100
|
const keys = Object.entries(permission ?? {}).flatMap(([resource, permissions]) =>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
-
import { Permission } from "@/modules/auth/entry";
|
|
4
|
-
import { usePermission } from "@/modules/auth/hooks/use-permission";
|
|
5
|
-
import { mergePermissions } from "@/modules/auth/lib/utils";
|
|
6
3
|
import {
|
|
7
4
|
type BulkCommandDefRenderParams,
|
|
8
5
|
type CommandDef,
|
|
@@ -115,8 +112,8 @@ export function useSingleCommandMenu<TData, TMeta>({
|
|
|
115
112
|
commands,
|
|
116
113
|
meta,
|
|
117
114
|
}: SingleCommandMenuProps<TData, TMeta> & { data: TData }) {
|
|
118
|
-
const permissions = commands.map((command) => command.permission).filter(Boolean) as Permission[];
|
|
119
|
-
usePermission(mergePermissions(permissions));
|
|
115
|
+
// const permissions = commands.map((command) => command.permission).filter(Boolean) as Permission[];
|
|
116
|
+
// usePermission(mergePermissions(permissions));
|
|
120
117
|
|
|
121
118
|
// filter out commands that don't have valid conditions
|
|
122
119
|
const validCommands = commands.filter((command) =>
|
|
@@ -142,8 +139,8 @@ export function useBulkCommandMenu<TData, TMeta>({
|
|
|
142
139
|
commands,
|
|
143
140
|
meta,
|
|
144
141
|
}: BulkCommandMenuProps<TData, TMeta>) {
|
|
145
|
-
const permissions = commands.map((command) => command.permission).filter(Boolean) as Permission[];
|
|
146
|
-
usePermission(mergePermissions(permissions));
|
|
142
|
+
// const permissions = commands.map((command) => command.permission).filter(Boolean) as Permission[];
|
|
143
|
+
// usePermission(mergePermissions(permissions));
|
|
147
144
|
|
|
148
145
|
/**
|
|
149
146
|
* Filter out commands that don't have valid conditions
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/modules/auth/lib/utils.ts
|
|
2
|
-
/**
|
|
3
|
-
* mergePermissions
|
|
4
|
-
*/
|
|
5
|
-
function mergePermissions(permissions) {
|
|
6
|
-
return permissions.flatMap(Object.entries).reduce((acc, [key, value]) => {
|
|
7
|
-
const accValue = acc[key];
|
|
8
|
-
if (!accValue) return {
|
|
9
|
-
...acc,
|
|
10
|
-
[key]: [...value]
|
|
11
|
-
};
|
|
12
|
-
return {
|
|
13
|
-
...acc,
|
|
14
|
-
[key]: Array.from(new Set([...accValue, ...value]))
|
|
15
|
-
};
|
|
16
|
-
}, {});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
//#endregion
|
|
20
|
-
export { mergePermissions };
|
|
21
|
-
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../src/modules/auth/lib/utils.ts"],"sourcesContent":["import { Permission } from \"./permissions\";\n\n/**\n * mergePermissions\n */\nexport function mergePermissions(permissions: Permission[]): Permission {\n return permissions.flatMap(Object.entries).reduce((acc, [key, value]) => {\n const accValue = acc[key];\n\n if (!accValue) return { ...acc, [key]: [...value] };\n\n return {\n ...acc,\n [key]: Array.from(new Set([...accValue, ...value])),\n };\n }, {} as Permission);\n}\n"],"mappings":";;;;AAKA,SAAgB,iBAAiB,aAAuC;AACtE,QAAO,YAAY,QAAQ,OAAO,QAAQ,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;EACvE,MAAM,WAAW,IAAI;AAErB,MAAI,CAAC,SAAU,QAAO;GAAE,GAAG;IAAM,MAAM,CAAC,GAAG,MAAM;GAAE;AAEnD,SAAO;GACL,GAAG;IACF,MAAM,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,MAAM,CAAC,CAAC;GACpD;IACA,EAAE,CAAe"}
|