@tulip-systems/core 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/common/icons.d.mts +52 -52
- 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/editor.client.d.mts +4 -4
- package/dist/components/editor/components/menu.client.d.mts +3 -3
- package/dist/components/header/back-button.client.d.mts +2 -2
- package/dist/components/header/bottom-bar.client.d.mts +3 -3
- package/dist/components/header/breadcrumbs.client.d.mts +7 -7
- package/dist/components/header/header.client.d.mts +2 -2
- package/dist/components/header/mobile-nav-switcher.client.d.mts +2 -2
- package/dist/components/header/top-bar.client.d.mts +4 -4
- package/dist/components/layouts/admin-content.client.d.mts +2 -2
- 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/list-layout.d.mts +2 -2
- package/dist/components/layouts/list-layout.d.mts.map +1 -1
- 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/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/lists/data-stack.d.mts.map +1 -1
- package/dist/components/navigation/admin-sidebar-paths.client.d.mts +10 -10
- package/dist/components/ui/accordion.d.mts +5 -5
- package/dist/components/ui/accordion.d.mts.map +1 -1
- package/dist/components/ui/alert-dialog.d.mts +12 -12
- package/dist/components/ui/alert-dialog.d.mts.map +1 -1
- package/dist/components/ui/alert.d.mts +6 -6
- package/dist/components/ui/alert.d.mts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.mts +2 -2
- package/dist/components/ui/aspect-ratio.d.mts.map +1 -1
- package/dist/components/ui/avatar.client.d.mts +4 -4
- package/dist/components/ui/badge.d.mts +4 -4
- package/dist/components/ui/badge.d.mts.map +1 -1
- 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/checkbox.d.mts +2 -2
- package/dist/components/ui/collapsible.client.d.mts +4 -4
- package/dist/components/ui/color-picker.client.d.mts +2 -2
- package/dist/components/ui/combobox-dropdown.client.d.mts +2 -2
- package/dist/components/ui/combobox.client.d.mts +2 -2
- package/dist/components/ui/command.d.mts +10 -10
- package/dist/components/ui/context-menu.d.mts +16 -16
- package/dist/components/ui/context-menu.d.mts.map +1 -1
- package/dist/components/ui/date-picker.client.d.mts +2 -2
- package/dist/components/ui/dialog.client.d.mts +11 -11
- package/dist/components/ui/drawer.client.d.mts +11 -11
- package/dist/components/ui/dropdown-menu.d.mts +16 -16
- package/dist/components/ui/form.client.d.mts +7 -7
- package/dist/components/ui/hover-card.client.d.mts +4 -4
- 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/progress.client.d.mts +2 -2
- package/dist/components/ui/radio-group.d.mts +3 -3
- package/dist/components/ui/resizable.client.d.mts +4 -4
- package/dist/components/ui/scroll-area.d.mts +3 -3
- package/dist/components/ui/select.client.d.mts +11 -11
- package/dist/components/ui/separator.d.mts +2 -2
- package/dist/components/ui/sheet.client.d.mts +9 -9
- package/dist/components/ui/sidebar.client.d.mts +24 -24
- 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/tooltip.client.d.mts +5 -5
- 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 +2 -2
- package/dist/modules/auth/components/allowed.client.d.mts.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/create-first-user-page.client.d.mts +2 -2
- package/dist/modules/auth/components/create-first-user-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/forget-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/forget-password-page.client.d.mts.map +1 -1
- 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/login-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/reset-password-page.client.d.mts +2 -2
- package/dist/modules/auth/components/reset-password-page.client.d.mts.map +1 -1
- package/dist/modules/auth/components/update-password-command.d.mts +2 -2
- package/dist/modules/auth/components/update-password-command.d.mts.map +1 -1
- 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 +2 -2
- package/dist/modules/commands/components/alert-dialog-command.client.d.mts +10 -10
- package/dist/modules/commands/components/click-command.client.d.mts +2 -2
- package/dist/modules/commands/components/command-trigger.client.d.mts +6 -6
- package/dist/modules/commands/components/dialog-command.client.d.mts +8 -8
- package/dist/modules/commands/components/dropdown-command.client.d.mts +5 -5
- package/dist/modules/commands/components/empty-command.client.d.mts +2 -2
- package/dist/modules/commands/components/form-dialog-command.client.d.mts +11 -11
- package/dist/modules/commands/menus/context-menu.client.d.mts +2 -2
- package/dist/modules/commands/menus/dropdown-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/inline-menu.client.d.mts +3 -3
- package/dist/modules/commands/menus/responsive-menu.client.d.mts +3 -3
- package/dist/modules/commands/utils/archive-command.client.d.mts +3 -3
- package/dist/modules/commands/utils/delete-command.client.d.mts +3 -3
- 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/cell/common.client.d.mts.map +1 -1
- 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/combobox.client.d.mts.map +1 -1
- package/dist/modules/data-tables/components/filters/slider.client.d.mts +2 -2
- package/dist/modules/data-tables/components/filters/slider.client.d.mts.map +1 -1
- 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/search-input.client.d.mts.map +1 -1
- 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/hooks/use-context.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/data-table/components/table.d.mts.map +1 -1
- 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/common.d.mts.map +1 -1
- 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/cells/drag-handle.client.d.mts.map +1 -1
- 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/advanced-select.client.d.mts.map +1 -1
- 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/combobox.client.d.mts.map +1 -1
- 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/input.client.d.mts.map +1 -1
- 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/read-only.d.mts.map +1 -1
- 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/inputs/select.client.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/components/table.d.mts.map +1 -1
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts +2 -2
- package/dist/modules/data-tables/tables/inline-table/hooks/context.client.d.mts.map +1 -1
- 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/deprecated-editor.client.d.mts +2 -2
- package/dist/modules/inline-edit/components/deprecated-editor.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/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-context.client.d.mts +2 -2
- package/dist/modules/storage/components/dropzone-context.client.d.mts.map +1 -1
- package/dist/modules/storage/components/dropzone.client.d.mts +5 -5
- package/dist/modules/storage/components/dropzone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/image-grid.client.d.mts +3 -3
- package/dist/modules/storage/components/image-grid.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.d.mts +5 -3
- package/dist/modules/storage/components/upload-zone.client.d.mts.map +1 -1
- package/dist/modules/storage/components/upload-zone.client.mjs +6 -4
- package/dist/modules/storage/components/upload-zone.client.mjs.map +1 -1
- package/dist/modules/storage/config/filters.d.mts +1 -0
- package/dist/modules/storage/config/filters.d.mts.map +1 -1
- package/dist/modules/storage/config/filters.mjs +2 -1
- package/dist/modules/storage/config/filters.mjs.map +1 -1
- package/dist/modules/storage/lib/helpers.d.mts +2 -2
- package/dist/modules/storage/lib/helpers.d.mts.map +1 -1
- package/dist/modules/storage/lib/helpers.mjs +1 -0
- package/dist/modules/storage/lib/helpers.mjs.map +1 -1
- package/dist/modules/storage/lib/router.server.d.mts +3195 -2217
- package/dist/modules/storage/lib/schema.d.mts +122 -88
- package/dist/modules/storage/lib/schema.d.mts.map +1 -1
- package/dist/modules/storage/lib/schema.mjs +1 -0
- package/dist/modules/storage/lib/schema.mjs.map +1 -1
- package/dist/modules/storage/lib/service.server.d.mts +39 -12
- package/dist/modules/storage/lib/service.server.d.mts.map +1 -1
- package/dist/modules/storage/lib/service.server.mjs +9 -3
- package/dist/modules/storage/lib/service.server.mjs.map +1 -1
- package/dist/modules/storage/lib/validators.d.mts +219 -138
- package/dist/modules/storage/lib/validators.d.mts.map +1 -1
- package/dist/modules/storage/lib/validators.mjs +14 -24
- package/dist/modules/storage/lib/validators.mjs.map +1 -1
- package/dist/storage.d.mts +2 -2
- package/dist/storage.mjs +2 -2
- package/package.json +3 -3
- package/src/modules/storage/components/upload-zone.client.tsx +5 -2
- package/src/modules/storage/config/filters.ts +1 -0
- package/src/modules/storage/lib/helpers.ts +3 -2
- package/src/modules/storage/lib/schema.ts +1 -0
- package/src/modules/storage/lib/service.server.ts +10 -2
- package/src/modules/storage/lib/validators.ts +20 -31
|
@@ -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,uBAAA,CAAA;;;;;;;WAF2B,EAAA,IAAA;IAAA,UAAA,EAAA,KAAA;IAIjB,YAAA,EAAe,KAAA;IACf,eAAgB,EAAA,KAAA;IAKf,iBAA4C,EAAA,KAAA;IAAA,UAAA,EAAA,CAAA,MAAA,EAAA,GAAA,MAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;;cAA5B,EAAA,KAAA;IAAA,QAAA,EAAA,SAAA;IAEjB,SAAA,EAAA,SAAe;EACf,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA;EAKC,IAAA,kCAA4C,CAAA;IAAA,IAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;aAA5B,EAAA,OAAA;IAAA,QAAA,EAAA,QAAA;IAChB,UAAA,EAAA,cAAA;;;;;;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
|
@@ -20,19 +20,6 @@ const createNodeSchema = createInsertSchema(nodes, { namespace: z$1.string() });
|
|
|
20
20
|
*/
|
|
21
21
|
const updateNodeSchema = createUpdateSchema(nodes);
|
|
22
22
|
/**
|
|
23
|
-
* Create folder node
|
|
24
|
-
*/
|
|
25
|
-
const createFolderNodeSchema = createNodeSchema.omit({
|
|
26
|
-
type: true,
|
|
27
|
-
contentType: true,
|
|
28
|
-
size: true,
|
|
29
|
-
subtype: true
|
|
30
|
-
});
|
|
31
|
-
/**
|
|
32
|
-
* Create file node
|
|
33
|
-
*/
|
|
34
|
-
const createFileNodeSchema = createNodeSchema.omit({ type: true });
|
|
35
|
-
/**
|
|
36
23
|
* Select node
|
|
37
24
|
*/
|
|
38
25
|
const selectNodeSchema = createSelectSchema(nodes);
|
|
@@ -45,20 +32,23 @@ const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters).partial(
|
|
|
45
32
|
parentId: z$1.string().nullable()
|
|
46
33
|
}).transform((input) => ({
|
|
47
34
|
...input,
|
|
35
|
+
hidden: input?.hidden ?? false,
|
|
48
36
|
isDeleted: input?.isDeleted ?? false
|
|
49
37
|
}));
|
|
50
38
|
/**
|
|
51
|
-
*
|
|
39
|
+
* Create folder node
|
|
52
40
|
*/
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
size: z$1.number().optional().default(0),
|
|
59
|
-
contentType: z$1.string().optional().default("")
|
|
41
|
+
const createFolderNodeSchema = createNodeSchema.omit({
|
|
42
|
+
type: true,
|
|
43
|
+
contentType: true,
|
|
44
|
+
size: true,
|
|
45
|
+
subtype: true
|
|
60
46
|
});
|
|
61
47
|
/**
|
|
48
|
+
* Upload file schema
|
|
49
|
+
*/
|
|
50
|
+
const uploadFileSchema = createNodeSchema.omit({ type: true });
|
|
51
|
+
/**
|
|
62
52
|
* Presign file schema
|
|
63
53
|
*/
|
|
64
54
|
const presignFileSchema = uploadFileSchema.extend({ id: z$1.uuid() });
|
|
@@ -97,10 +87,10 @@ const putObjectSchema = z$1.object({
|
|
|
97
87
|
name: z$1.string().optional().default(""),
|
|
98
88
|
variant: z$1.enum(imageVariants).optional().default("main"),
|
|
99
89
|
body: z$1.any().optional(),
|
|
100
|
-
contentType: z$1.string().
|
|
101
|
-
size: z$1.number().
|
|
90
|
+
contentType: z$1.string().nullable().optional(),
|
|
91
|
+
size: z$1.number().nullable().optional()
|
|
102
92
|
});
|
|
103
93
|
|
|
104
94
|
//#endregion
|
|
105
|
-
export {
|
|
95
|
+
export { createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
|
|
106
96
|
//# sourceMappingURL=validators.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.mjs","names":["z"],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":["import { tableQuerySchema } from \"@/modules/data-tables/entry\";\nimport { resolveFiltersSchema } from \"@/modules/data-tables/lib/filters/resolvers\";\nimport { PutObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { nodesTableFilters } from \"../config/filters\";\nimport { imageDispositions, imageVariants } from \"./constants\";\nimport { nodeModeEnum, nodes } from \"./schema\";\n\n/**\n * Nodes\n */\nexport type Node = typeof nodes.$inferSelect;\nexport type FileNode = typeof nodes.$inferSelect & { type: \"file\" };\nexport type FolderNode = typeof nodes.$inferSelect & { type: \"folder\" };\n\n/**\n * Node mode\n */\nexport const nodeModeSchema = z.enum(nodeModeEnum.enumValues);\nexport type NodeMode = z.infer<typeof nodeModeSchema>;\n\n/**\n * Create node\n */\nexport const createNodeSchema = createInsertSchema(nodes, {\n namespace: z.string(),\n});\n\nexport type CreateNodeInput = z.input<typeof createNodeSchema>;\nexport type CreateNodeSchema = z.infer<typeof createNodeSchema>;\n\n/**\n * Update node\n */\nexport const updateNodeSchema = createUpdateSchema(nodes);\n\nexport type UpdateNodeInput = z.input<typeof updateNodeSchema>;\nexport type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"validators.mjs","names":["z"],"sources":["../../../../src/modules/storage/lib/validators.ts"],"sourcesContent":["import { tableQuerySchema } from \"@/modules/data-tables/entry\";\nimport { resolveFiltersSchema } from \"@/modules/data-tables/lib/filters/resolvers\";\nimport { PutObjectCommandInput } from \"@aws-sdk/client-s3\";\nimport { createInsertSchema, createSelectSchema, createUpdateSchema } from \"drizzle-zod\";\nimport { z } from \"zod\";\nimport { nodesTableFilters } from \"../config/filters\";\nimport { imageDispositions, imageVariants } from \"./constants\";\nimport { nodeModeEnum, nodes } from \"./schema\";\n\n/**\n * Nodes\n */\nexport type Node = typeof nodes.$inferSelect;\nexport type FileNode = typeof nodes.$inferSelect & { type: \"file\" };\nexport type FolderNode = typeof nodes.$inferSelect & { type: \"folder\" };\n\n/**\n * Node mode\n */\nexport const nodeModeSchema = z.enum(nodeModeEnum.enumValues);\nexport type NodeMode = z.infer<typeof nodeModeSchema>;\n\n/**\n * Create node\n */\nexport const createNodeSchema = createInsertSchema(nodes, {\n namespace: z.string(),\n});\n\nexport type CreateNodeInput = z.input<typeof createNodeSchema>;\nexport type CreateNodeSchema = z.infer<typeof createNodeSchema>;\n\n/**\n * Update node\n */\nexport const updateNodeSchema = createUpdateSchema(nodes);\n\nexport type UpdateNodeInput = z.input<typeof updateNodeSchema>;\nexport type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;\n\n/**\n * Select node\n */\nexport const selectNodeSchema = createSelectSchema(nodes);\nexport const selectNodeWithChildrenSchema = selectNodeSchema.extend({\n children: z.array(selectNodeSchema),\n});\n\nexport type SelectNodeSchema = z.infer<typeof selectNodeSchema>;\nexport type SelectNodeWithChildrenSchema = z.infer<typeof selectNodeWithChildrenSchema>;\n\n/**\n * Where input\n */\nexport const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)\n .partial()\n .extend({\n namespace: z.string(),\n parentId: z.string().nullable(),\n })\n .transform((input) => ({\n ...input,\n hidden: input?.hidden ?? false,\n isDeleted: input?.isDeleted ?? false,\n }));\n\nexport type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;\n\n/**\n * Create folder node\n */\nexport const createFolderNodeSchema = createNodeSchema.omit({\n type: true,\n contentType: true,\n size: true,\n subtype: true,\n});\n\nexport type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;\n\n/**\n * Upload file schema\n */\nexport const uploadFileSchema = createNodeSchema.omit({ type: true });\n\nexport type UploadFileSchema = z.infer<typeof uploadFileSchema>;\n\n/**\n * Presign file schema\n */\nexport const presignFileSchema = uploadFileSchema.extend({ id: z.uuid() });\n\nexport type PresignFileSchema = z.infer<typeof presignFileSchema>;\n\n/**\n * Get file url schema\n */\nexport const getFileURLSchemaDefaults = { variant: \"main\", disposition: \"inline\" } as const;\n\nexport const getFileURLSchema = z.object({\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.enum(imageDispositions).optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetFileUrlInput = z.input<typeof getFileURLSchema>;\nexport type GetFileURLSchema = z.infer<typeof getFileURLSchema>;\n\n/**\n * Get by parent id input\n */\nexport const getNodesByParentIdSchema = tableQuerySchema\n .pick({ order: true, sort: true, search: true })\n .extend({ filters: nodesTableFiltersSchema });\n\nexport type GetNodesByParentIdInput = z.input<typeof getNodesByParentIdSchema>;\n\n/**\n * Get object input\n */\nexport const getObjectSchema = z.object({\n id: z.string(),\n variant: z.enum(imageVariants).optional().default(getFileURLSchemaDefaults.variant),\n disposition: z.string().optional().default(getFileURLSchemaDefaults.disposition),\n});\n\nexport type GetObjectInput = z.input<typeof getObjectSchema>;\nexport type GetObjectSchema = z.infer<typeof getObjectSchema>;\n\n/**\n * Put object input\n */\nexport const putObjectSchema = z.object({\n id: z.string(),\n name: z.string().optional().default(\"\"),\n variant: z.enum(imageVariants).optional().default(\"main\"),\n body: z.any().optional(),\n contentType: z.string().nullable().optional(),\n size: z.number().nullable().optional(),\n});\n\nexport type PutObjectInput = z.input<typeof putObjectSchema> & {\n body?: PutObjectCommandInput[\"Body\"];\n};\n\nexport type PutObjectSchema = z.infer<typeof putObjectSchema>;\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAAiBA,IAAE,KAAK,aAAa,WAAW;;;;AAM7D,MAAa,mBAAmB,mBAAmB,OAAO,EACxD,WAAWA,IAAE,QAAQ,EACtB,CAAC;;;;AAQF,MAAa,mBAAmB,mBAAmB,MAAM;;;;AAQzD,MAAa,mBAAmB,mBAAmB,MAAM;AACzD,MAAa,+BAA+B,iBAAiB,OAAO,EAClE,UAAUA,IAAE,MAAM,iBAAiB,EACpC,CAAC;;;;AAQF,MAAa,0BAA0B,qBAAqB,kBAAkB,CAC3E,SAAS,CACT,OAAO;CACN,WAAWA,IAAE,QAAQ;CACrB,UAAUA,IAAE,QAAQ,CAAC,UAAU;CAChC,CAAC,CACD,WAAW,WAAW;CACrB,GAAG;CACH,QAAQ,OAAO,UAAU;CACzB,WAAW,OAAO,aAAa;CAChC,EAAE;;;;AAOL,MAAa,yBAAyB,iBAAiB,KAAK;CAC1D,MAAM;CACN,aAAa;CACb,MAAM;CACN,SAAS;CACV,CAAC;;;;AAOF,MAAa,mBAAmB,iBAAiB,KAAK,EAAE,MAAM,MAAM,CAAC;;;;AAOrE,MAAa,oBAAoB,iBAAiB,OAAO,EAAE,IAAIA,IAAE,MAAM,EAAE,CAAC;;;;AAO1E,MAAa,2BAA2B;CAAE,SAAS;CAAQ,aAAa;CAAU;AAElF,MAAa,mBAAmBA,IAAE,OAAO;CACvC,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,yBAAyB,QAAQ;CACnF,aAAaA,IAAE,KAAK,kBAAkB,CAAC,UAAU,CAAC,QAAQ,yBAAyB,YAAY;CAChG,CAAC;;;;AAQF,MAAa,2BAA2B,iBACrC,KAAK;CAAE,OAAO;CAAM,MAAM;CAAM,QAAQ;CAAM,CAAC,CAC/C,OAAO,EAAE,SAAS,yBAAyB,CAAC;;;;AAO/C,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,yBAAyB,QAAQ;CACnF,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,yBAAyB,YAAY;CACjF,CAAC;;;;AAQF,MAAa,kBAAkBA,IAAE,OAAO;CACtC,IAAIA,IAAE,QAAQ;CACd,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG;CACvC,SAASA,IAAE,KAAK,cAAc,CAAC,UAAU,CAAC,QAAQ,OAAO;CACzD,MAAMA,IAAE,KAAK,CAAC,UAAU;CACxB,aAAaA,IAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CAC7C,MAAMA,IAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;CACvC,CAAC"}
|
package/dist/storage.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DriveSchema, nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, Node, NodeMode, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
|
|
3
3
|
import { nodesTableFilters } from "./modules/storage/config/filters.mjs";
|
|
4
4
|
import { ImageDisposition, ImageVariant, deviceSizes, imageDispositions, imageSizes, imageVariants } from "./modules/storage/lib/constants.mjs";
|
|
5
5
|
import { NodeSubtype, getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes } from "./modules/storage/lib/helpers.mjs";
|
|
6
|
-
export {
|
|
6
|
+
export { CreateFolderNodeSchema, CreateNodeInput, CreateNodeSchema, DriveSchema, FileNode, FolderNode, GetFileURLSchema, GetFileUrlInput, GetNodesByParentIdInput, GetObjectInput, GetObjectSchema, ImageDisposition, ImageVariant, Node, NodeMode, NodeSubtype, NodesTableFilters, PresignFileSchema, PutObjectInput, PutObjectSchema, SelectNodeSchema, SelectNodeWithChildrenSchema, UpdateNodeInput, UpdateNodeSchema, UploadFileSchema, createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
|
package/dist/storage.mjs
CHANGED
|
@@ -2,6 +2,6 @@ import { deviceSizes, imageDispositions, imageSizes, imageVariants } from "./mod
|
|
|
2
2
|
import { getDriveBucketKey, getFileUrl, imageLoader, inferNodeSubtype, isFile, isFolder, nodeSubtypes, renderBytes } from "./modules/storage/lib/helpers.mjs";
|
|
3
3
|
import { nodeModeEnum, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./modules/storage/lib/schema.mjs";
|
|
4
4
|
import { nodesTableFilters } from "./modules/storage/config/filters.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { createFolderNodeSchema, createNodeSchema, getFileURLSchema, getFileURLSchemaDefaults, getNodesByParentIdSchema, getObjectSchema, nodeModeSchema, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema } from "./modules/storage/lib/validators.mjs";
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export { createFolderNodeSchema, createNodeSchema, deviceSizes, getDriveBucketKey, getFileURLSchema, getFileURLSchemaDefaults, getFileUrl, getNodesByParentIdSchema, getObjectSchema, imageDispositions, imageLoader, imageSizes, imageVariants, inferNodeSubtype, isFile, isFolder, nodeModeEnum, nodeModeSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, nodesTableFilters, nodesTableFiltersSchema, presignFileSchema, putObjectSchema, renderBytes, selectNodeSchema, selectNodeWithChildrenSchema, updateNodeSchema, uploadFileSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tulip-systems/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"tw-animate-css": "^1.4.0",
|
|
14
14
|
"typescript": "5.9.3",
|
|
15
15
|
"vite": "^7.2.7",
|
|
16
|
-
"@tulip-systems/
|
|
17
|
-
"@tulip-systems/
|
|
16
|
+
"@tulip-systems/typescript-config": "0.0.0",
|
|
17
|
+
"@tulip-systems/eslint-config": "0.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@aws-sdk/client-s3": "^3.946.0",
|
|
@@ -7,12 +7,13 @@ import { useAction } from "@/lib/hooks/use-action";
|
|
|
7
7
|
import { generateDefaultUUID } from "@/modules/config/entry";
|
|
8
8
|
import { useQueryClient } from "@tanstack/react-query";
|
|
9
9
|
import { ComponentProps, useCallback, useState } from "react";
|
|
10
|
-
import { FileNode, Node, PresignFileSchema } from "../lib/validators";
|
|
10
|
+
import { FileNode, Node, PresignFileSchema, UploadFileSchema } from "../lib/validators";
|
|
11
11
|
import { UploadZoneContext } from "./upload-zone-context.client";
|
|
12
12
|
|
|
13
13
|
export type UploadZoneProps = ComponentProps<"div"> & {
|
|
14
14
|
namespace: string;
|
|
15
15
|
parentId: string | null;
|
|
16
|
+
options?: Pick<UploadFileSchema, "readonly" | "hidden" | "mode">;
|
|
16
17
|
|
|
17
18
|
queryKey: readonly unknown[];
|
|
18
19
|
|
|
@@ -33,6 +34,7 @@ export type UploadZoneProps = ComponentProps<"div"> & {
|
|
|
33
34
|
export function UploadZone({
|
|
34
35
|
namespace,
|
|
35
36
|
parentId,
|
|
37
|
+
options,
|
|
36
38
|
queryKey,
|
|
37
39
|
presignAction,
|
|
38
40
|
confirmAction,
|
|
@@ -191,6 +193,7 @@ export function UploadZone({
|
|
|
191
193
|
* Send the presign request
|
|
192
194
|
*/
|
|
193
195
|
const { id, presignedUrl } = await presignMutation.mutateAsync({
|
|
196
|
+
...options,
|
|
194
197
|
id: generateDefaultUUID(),
|
|
195
198
|
name: file.name,
|
|
196
199
|
size: file.size,
|
|
@@ -209,7 +212,7 @@ export function UploadZone({
|
|
|
209
212
|
*/
|
|
210
213
|
return await confirmMutation.mutateAsync({ id });
|
|
211
214
|
},
|
|
212
|
-
[presignMutation,
|
|
215
|
+
[presignMutation, options, namespace, parentId, uploadMutation, confirmMutation],
|
|
213
216
|
);
|
|
214
217
|
|
|
215
218
|
return (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ImageLoaderProps } from "next/image";
|
|
2
2
|
import { ImageVariant } from "./constants";
|
|
3
|
-
import {
|
|
3
|
+
import { CreateNodeSchema, GetFileURLSchema, Node } from "./validators";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Check if the node is a file
|
|
@@ -62,7 +62,8 @@ export type NodeSubtype = (typeof nodeSubtypes)[number];
|
|
|
62
62
|
export function inferNodeSubtype({
|
|
63
63
|
name,
|
|
64
64
|
contentType,
|
|
65
|
-
}: Pick<
|
|
65
|
+
}: Pick<CreateNodeSchema, "name" | "contentType">): NodeSubtype {
|
|
66
|
+
if (!contentType) return "other";
|
|
66
67
|
if (contentType?.startsWith("image/")) return "image";
|
|
67
68
|
if (contentType === "application/pdf") return "document";
|
|
68
69
|
if (contentType?.includes("spreadsheet")) return "spreadsheet";
|
|
@@ -21,6 +21,7 @@ export const nodes = pgTable("nodes", (t) => ({
|
|
|
21
21
|
size: t.integer().default(0),
|
|
22
22
|
contentType: t.varchar({ length: 255 }),
|
|
23
23
|
readonly: boolean().default(false),
|
|
24
|
+
hidden: boolean().default(false),
|
|
24
25
|
createdBy: t.uuid().references(() => users.id, { onDelete: "set null" }),
|
|
25
26
|
isPending: t.boolean().default(false).notNull(),
|
|
26
27
|
isDeleted: t.boolean().default(false).notNull(),
|
|
@@ -101,8 +101,8 @@ export class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
101
101
|
Bucket: BUCKET_NAME,
|
|
102
102
|
Key: getDriveBucketKey(input.id, input.variant),
|
|
103
103
|
Body: input.body,
|
|
104
|
-
ContentType: input.contentType,
|
|
105
|
-
ContentLength: input.size,
|
|
104
|
+
ContentType: input.contentType ?? "",
|
|
105
|
+
ContentLength: input.size ?? 0,
|
|
106
106
|
Metadata: {
|
|
107
107
|
nodeId: input.id,
|
|
108
108
|
},
|
|
@@ -117,6 +117,13 @@ export class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
117
117
|
return await this.#blob.send(putCommand);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
/**
|
|
121
|
+
* Get node by id
|
|
122
|
+
*/
|
|
123
|
+
async getNodeById(id: string) {
|
|
124
|
+
return this.#db.select().from(nodes).where(eq(nodes.id, id));
|
|
125
|
+
}
|
|
126
|
+
|
|
120
127
|
/**
|
|
121
128
|
* Get nodes by parent id
|
|
122
129
|
*/
|
|
@@ -132,6 +139,7 @@ export class StorageService<TSchema extends TDatabaseSchema> {
|
|
|
132
139
|
filters.nodeIds != null ? inArray(nodes.id, filters.nodeIds) : undefined,
|
|
133
140
|
filters.types != null ? inArray(nodes.type, filters.types) : undefined,
|
|
134
141
|
filters.isDeleted != null ? eq(nodes.isDeleted, filters.isDeleted) : undefined,
|
|
142
|
+
filters.hidden != null ? eq(nodes.hidden, filters.hidden) : undefined,
|
|
135
143
|
filters.parentId ? eq(nodes.parentId, filters.parentId) : isNull(nodes.parentId),
|
|
136
144
|
eq(nodes.namespace, filters.namespace),
|
|
137
145
|
search,
|
|
@@ -38,26 +38,6 @@ export const updateNodeSchema = createUpdateSchema(nodes);
|
|
|
38
38
|
export type UpdateNodeInput = z.input<typeof updateNodeSchema>;
|
|
39
39
|
export type UpdateNodeSchema = z.infer<typeof updateNodeSchema>;
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* Create folder node
|
|
43
|
-
*/
|
|
44
|
-
export const createFolderNodeSchema = createNodeSchema.omit({
|
|
45
|
-
type: true,
|
|
46
|
-
contentType: true,
|
|
47
|
-
size: true,
|
|
48
|
-
subtype: true,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Create file node
|
|
55
|
-
*/
|
|
56
|
-
export const createFileNodeSchema = createNodeSchema.omit({
|
|
57
|
-
type: true,
|
|
58
|
-
});
|
|
59
|
-
export type CreateFileNodeSchema = z.infer<typeof createFileNodeSchema>;
|
|
60
|
-
|
|
61
41
|
/**
|
|
62
42
|
* Select node
|
|
63
43
|
*/
|
|
@@ -78,22 +58,31 @@ export const nodesTableFiltersSchema = resolveFiltersSchema(nodesTableFilters)
|
|
|
78
58
|
namespace: z.string(),
|
|
79
59
|
parentId: z.string().nullable(),
|
|
80
60
|
})
|
|
81
|
-
.transform((input) => ({
|
|
61
|
+
.transform((input) => ({
|
|
62
|
+
...input,
|
|
63
|
+
hidden: input?.hidden ?? false,
|
|
64
|
+
isDeleted: input?.isDeleted ?? false,
|
|
65
|
+
}));
|
|
82
66
|
|
|
83
67
|
export type NodesTableFilters = z.input<typeof nodesTableFiltersSchema>;
|
|
84
68
|
|
|
85
69
|
/**
|
|
86
|
-
*
|
|
70
|
+
* Create folder node
|
|
87
71
|
*/
|
|
88
|
-
export const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
size: z.number().optional().default(0),
|
|
94
|
-
contentType: z.string().optional().default(""),
|
|
72
|
+
export const createFolderNodeSchema = createNodeSchema.omit({
|
|
73
|
+
type: true,
|
|
74
|
+
contentType: true,
|
|
75
|
+
size: true,
|
|
76
|
+
subtype: true,
|
|
95
77
|
});
|
|
96
78
|
|
|
79
|
+
export type CreateFolderNodeSchema = z.infer<typeof createFolderNodeSchema>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Upload file schema
|
|
83
|
+
*/
|
|
84
|
+
export const uploadFileSchema = createNodeSchema.omit({ type: true });
|
|
85
|
+
|
|
97
86
|
export type UploadFileSchema = z.infer<typeof uploadFileSchema>;
|
|
98
87
|
|
|
99
88
|
/**
|
|
@@ -145,8 +134,8 @@ export const putObjectSchema = z.object({
|
|
|
145
134
|
name: z.string().optional().default(""),
|
|
146
135
|
variant: z.enum(imageVariants).optional().default("main"),
|
|
147
136
|
body: z.any().optional(),
|
|
148
|
-
contentType: z.string().
|
|
149
|
-
size: z.number().
|
|
137
|
+
contentType: z.string().nullable().optional(),
|
|
138
|
+
size: z.number().nullable().optional(),
|
|
150
139
|
});
|
|
151
140
|
|
|
152
141
|
export type PutObjectInput = z.input<typeof putObjectSchema> & {
|