@tulip-systems/drive 0.8.1 → 0.8.3
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/client.d.mts +5 -0
- package/dist/client.mjs +6 -0
- package/dist/components/content.d.mts +13 -0
- package/dist/components/content.mjs +17 -0
- package/dist/components/context.client.d.mts +13 -0
- package/dist/components/dnd.client.d.mts +16 -0
- package/dist/components/dnd.client.mjs +29 -0
- package/dist/components/grid-card.client.d.mts +46 -0
- package/dist/components/grid-card.client.mjs +173 -0
- package/dist/components/grid.client.d.mts +53 -0
- package/dist/components/grid.client.mjs +53 -0
- package/dist/components/navigation/breadcrumbs.client.d.mts +25 -0
- package/dist/components/navigation/breadcrumbs.client.mjs +51 -0
- package/dist/components/navigation/header.client.d.mts +27 -0
- package/dist/components/navigation/header.client.mjs +40 -0
- package/dist/components/navigation/toolbar.client.d.mts +23 -0
- package/dist/components/navigation/toolbar.client.mjs +34 -0
- package/dist/components/navigation/view-switcher.client.d.mts +9 -0
- package/dist/components/navigation/view-switcher.client.mjs +35 -0
- package/dist/components/selection.client.d.mts +27 -0
- package/dist/components/selection.client.mjs +36 -0
- package/dist/components/view.client.d.mts +25 -0
- package/dist/components/view.client.mjs +43 -0
- package/dist/config/filters.mjs +14 -0
- package/dist/config/types.mjs +60 -0
- package/dist/google/client.d.mts +8 -0
- package/dist/google/client.mjs +9 -0
- package/dist/google/server.d.mts +3 -0
- package/dist/google/server.mjs +4 -0
- package/dist/google.d.mts +6 -0
- package/dist/google.mjs +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +7 -0
- package/dist/lib/constants.d.mts +11 -0
- package/dist/lib/constants.mjs +20 -0
- package/dist/lib/contracts.d.mts +100 -0
- package/dist/lib/dto.d.mts +117 -0
- package/dist/lib/dto.mjs +57 -0
- package/dist/lib/helpers.d.mts +17 -0
- package/dist/lib/helpers.mjs +36 -0
- package/dist/lib/helpers.server.d.mts +13 -0
- package/dist/lib/helpers.server.mjs +15 -0
- package/dist/lib/search-params.d.mts +8 -0
- package/dist/lib/search-params.mjs +7 -0
- package/dist/lib/validators.d.mts +157 -0
- package/dist/lib/validators.mjs +65 -0
- package/dist/local/client.d.mts +13 -0
- package/dist/local/client.mjs +13 -0
- package/dist/local/server.d.mts +4 -0
- package/dist/local/server.mjs +5 -0
- package/dist/local.d.mts +8 -0
- package/dist/local.mjs +9 -0
- package/dist/providers/google/components/command-file-update.d.mts +21 -0
- package/dist/providers/google/components/command-file-update.mjs +51 -0
- package/dist/providers/google/components/command-folder-create.d.mts +21 -0
- package/dist/providers/google/components/command-folder-create.mjs +58 -0
- package/dist/providers/google/components/command-folder-update.d.mts +21 -0
- package/dist/providers/google/components/command-folder-update.mjs +51 -0
- package/dist/providers/google/components/content.client.d.mts +9 -0
- package/dist/providers/google/components/content.client.mjs +10 -0
- package/dist/providers/google/components/navigation.client.d.mts +15 -0
- package/dist/providers/google/components/navigation.client.mjs +17 -0
- package/dist/providers/google/components/provider.client.d.mts +32 -0
- package/dist/providers/google/components/provider.client.mjs +42 -0
- package/dist/providers/google/components/view.client.d.mts +40 -0
- package/dist/providers/google/components/view.client.mjs +96 -0
- package/dist/providers/google/config/columns-data.d.mts +7 -0
- package/dist/providers/google/config/columns-data.mjs +69 -0
- package/dist/providers/google/config/filters.d.mts +15 -0
- package/dist/providers/google/config/filters.mjs +7 -0
- package/dist/providers/google/lib/constants.mjs +12 -0
- package/dist/providers/google/lib/dto.d.mts +38 -0
- package/dist/providers/google/lib/dto.mjs +65 -0
- package/dist/providers/google/lib/helpers.mjs +38 -0
- package/dist/providers/google/lib/router.server.d.mts +611 -0
- package/dist/providers/google/lib/router.server.mjs +39 -0
- package/dist/providers/google/lib/search-params.d.mts +14 -0
- package/dist/providers/google/lib/search-params.mjs +11 -0
- package/dist/providers/google/lib/service.server.d.mts +185 -0
- package/dist/providers/google/lib/service.server.mjs +610 -0
- package/dist/providers/google/lib/validators.d.mts +302 -0
- package/dist/providers/google/lib/validators.mjs +58 -0
- package/dist/providers/local/components/command-file-update.d.mts +17 -0
- package/dist/providers/local/components/command-file-update.mjs +47 -0
- package/dist/providers/local/components/command-file-upload.d.mts +10 -0
- package/dist/providers/local/components/command-file-upload.mjs +34 -0
- package/dist/providers/local/components/command-folder-create.d.mts +17 -0
- package/dist/providers/local/components/command-folder-create.mjs +54 -0
- package/dist/providers/local/components/command-folder-update.d.mts +17 -0
- package/dist/providers/local/components/command-folder-update.mjs +47 -0
- package/dist/providers/local/components/content.client.d.mts +6 -0
- package/dist/providers/local/components/content.client.mjs +7 -0
- package/dist/providers/local/components/navigation.client.d.mts +15 -0
- package/dist/providers/local/components/navigation.client.mjs +17 -0
- package/dist/providers/local/components/provider.client.d.mts +39 -0
- package/dist/providers/local/components/provider.client.mjs +60 -0
- package/dist/providers/local/components/upload-zone-context.client.d.mts +37 -0
- package/dist/providers/local/components/upload-zone-context.client.mjs +22 -0
- package/dist/providers/local/components/upload-zone.client.d.mts +29 -0
- package/dist/providers/local/components/upload-zone.client.mjs +146 -0
- package/dist/providers/local/components/view.client.d.mts +31 -0
- package/dist/providers/local/components/view.client.mjs +90 -0
- package/dist/providers/local/config/columns-data.d.mts +7 -0
- package/dist/providers/local/config/columns-data.mjs +69 -0
- package/dist/providers/local/config/filters.d.mts +25 -0
- package/dist/providers/local/config/filters.mjs +14 -0
- package/dist/providers/local/lib/constants.d.mts +11 -0
- package/dist/providers/local/lib/constants.mjs +28 -0
- package/dist/providers/local/lib/helpers.d.mts +44 -0
- package/dist/providers/local/lib/helpers.mjs +109 -0
- package/dist/providers/local/lib/route-handler.server.d.mts +33 -0
- package/dist/providers/local/lib/route-handler.server.mjs +113 -0
- package/dist/providers/local/lib/router.server.d.mts +41647 -0
- package/dist/providers/local/lib/router.server.mjs +51 -0
- package/dist/providers/local/lib/schema.d.mts +1112 -0
- package/dist/providers/local/lib/schema.mjs +70 -0
- package/dist/providers/local/lib/search-params.d.mts +13 -0
- package/dist/providers/local/lib/search-params.mjs +8 -0
- package/dist/providers/local/lib/service.server.d.mts +488 -0
- package/dist/providers/local/lib/service.server.mjs +667 -0
- package/dist/providers/local/lib/upload.client.d.mts +61 -0
- package/dist/providers/local/lib/upload.client.mjs +99 -0
- package/dist/providers/local/lib/validators.d.mts +453 -0
- package/dist/providers/local/lib/validators.mjs +95 -0
- package/dist/server.d.mts +2 -0
- package/dist/server.mjs +3 -0
- package/package.json +45 -46
- package/src/components/grid-card.client.tsx +17 -12
- package/src/components/selection.client.tsx +1 -2
- package/src/config/types.tsx +1 -1
- package/src/providers/google/components/command-file-update.tsx +2 -2
- package/src/providers/google/components/command-folder-create.tsx +2 -2
- package/src/providers/google/components/command-folder-update.tsx +2 -2
- package/src/providers/google/components/view.client.tsx +1 -7
- package/src/providers/google/lib/helpers.ts +0 -9
- package/src/providers/google/lib/service.server.ts +1 -3
- package/src/providers/local/components/command-file-update.tsx +2 -2
- package/src/providers/local/components/command-folder-create.tsx +2 -2
- package/src/providers/local/components/command-folder-update.tsx +2 -2
- package/src/providers/local/components/upload-zone.client.tsx +1 -1
- package/src/providers/local/lib/helpers.ts +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/lib/helpers.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if the node is a file
|
|
4
|
+
*/
|
|
5
|
+
function isFile(node) {
|
|
6
|
+
return node.type === "file";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Check if the node is a folder
|
|
10
|
+
*/
|
|
11
|
+
function isFolder(node) {
|
|
12
|
+
return node.type === "folder";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Render bytes
|
|
16
|
+
*/
|
|
17
|
+
function renderBytes(bytes) {
|
|
18
|
+
const units = [
|
|
19
|
+
"B",
|
|
20
|
+
"KB",
|
|
21
|
+
"MB",
|
|
22
|
+
"GB",
|
|
23
|
+
"TB",
|
|
24
|
+
"PB"
|
|
25
|
+
];
|
|
26
|
+
let size = bytes;
|
|
27
|
+
let unitIndex = 0;
|
|
28
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
29
|
+
size /= 1024;
|
|
30
|
+
unitIndex++;
|
|
31
|
+
}
|
|
32
|
+
return `${size.toFixed(2)}${units[unitIndex]}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { isFile, isFolder, renderBytes };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DriveViewMode } from "../components/view.client.mjs";
|
|
2
|
+
import "server-cli-only";
|
|
3
|
+
import { cookies } from "next/headers";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/helpers.server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get the drive view mode from cookies
|
|
8
|
+
* @param cookiesStore - The cookies store from Next.js headers
|
|
9
|
+
* @returns The drive view mode ("grid" or "list") or undefined if not set
|
|
10
|
+
*/
|
|
11
|
+
declare function getDriveViewModeFromCookies(cookiesStore: Awaited<ReturnType<typeof cookies>>): DriveViewMode | undefined;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { getDriveViewModeFromCookies };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DRIVE_VIEW_COOKIE } from "./constants.mjs";
|
|
2
|
+
import "server-cli-only";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/helpers.server.ts
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to get the drive view mode from cookies
|
|
7
|
+
* @param cookiesStore - The cookies store from Next.js headers
|
|
8
|
+
* @returns The drive view mode ("grid" or "list") or undefined if not set
|
|
9
|
+
*/
|
|
10
|
+
function getDriveViewModeFromCookies(cookiesStore) {
|
|
11
|
+
return cookiesStore.get(DRIVE_VIEW_COOKIE)?.value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getDriveViewModeFromCookies };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/validators.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Create drive folder input schema
|
|
6
|
+
* @description zod schema for validating the input of the create drive folder command
|
|
7
|
+
*/
|
|
8
|
+
declare const createDriveFolderInputSchema: z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
namespace: z.ZodString;
|
|
11
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
type CreateDriveFolderInput = z.input<typeof createDriveFolderInputSchema>;
|
|
14
|
+
type CreateDriveFolderSchema = z.infer<typeof createDriveFolderInputSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* Update drive node input schema
|
|
17
|
+
*/
|
|
18
|
+
declare const updateDriveNodeInputSchema: z.ZodObject<{
|
|
19
|
+
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
type UpdateDriveNodeInput = z.input<typeof updateDriveNodeInputSchema>;
|
|
22
|
+
type UpdateDriveNodeSchema = z.infer<typeof updateDriveNodeInputSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* Upload drive file input schema
|
|
25
|
+
* @description zod schema for validating the input of the upload drive file command
|
|
26
|
+
*/
|
|
27
|
+
declare const uploadDriveFileInputSchema: z.ZodObject<{
|
|
28
|
+
name: z.ZodString;
|
|
29
|
+
namespace: z.ZodString;
|
|
30
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
type UploadDriveFileInput = z.input<typeof uploadDriveFileInputSchema>;
|
|
35
|
+
type UploadDriveFileSchema = z.infer<typeof uploadDriveFileInputSchema>;
|
|
36
|
+
/**
|
|
37
|
+
* Presign drive file input schema
|
|
38
|
+
* @description zod schema for validating the input of the presign drive file command
|
|
39
|
+
*/
|
|
40
|
+
declare const presignDriveFileInputSchema: z.ZodObject<{
|
|
41
|
+
name: z.ZodString;
|
|
42
|
+
namespace: z.ZodString;
|
|
43
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
contentType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
45
|
+
size: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
type PresignDriveFileInput = z.input<typeof presignDriveFileInputSchema>;
|
|
48
|
+
type PresignDriveFileSchema = z.infer<typeof presignDriveFileInputSchema>;
|
|
49
|
+
/**
|
|
50
|
+
* Table filters
|
|
51
|
+
*/
|
|
52
|
+
declare const driveTableFiltersSchema: z.ZodPipe<z.ZodObject<{
|
|
53
|
+
types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
54
|
+
file: "file";
|
|
55
|
+
folder: "folder";
|
|
56
|
+
}>>>>;
|
|
57
|
+
contentTypes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
58
|
+
nodeIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
59
|
+
isArchived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
60
|
+
namespace: z.ZodString;
|
|
61
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
63
|
+
isArchived: boolean;
|
|
64
|
+
namespace: string;
|
|
65
|
+
parentId: string | null;
|
|
66
|
+
types?: ("file" | "folder")[] | null | undefined;
|
|
67
|
+
contentTypes?: string[] | null | undefined;
|
|
68
|
+
nodeIds?: string[] | null | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
namespace: string;
|
|
71
|
+
parentId: string | null;
|
|
72
|
+
types?: ("file" | "folder")[] | null | undefined;
|
|
73
|
+
contentTypes?: string[] | null | undefined;
|
|
74
|
+
nodeIds?: string[] | null | undefined;
|
|
75
|
+
isArchived?: boolean | null | undefined;
|
|
76
|
+
}>>;
|
|
77
|
+
type NodesTableFilters = z.infer<typeof driveTableFiltersSchema>;
|
|
78
|
+
/**
|
|
79
|
+
* List tree input schema
|
|
80
|
+
*/
|
|
81
|
+
declare const listDriveTreeInputSchema: z.ZodObject<{
|
|
82
|
+
cursor: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>, z.ZodTransform<number, number>>;
|
|
83
|
+
limit: z.ZodPipe<z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>, z.ZodTransform<number, number>>;
|
|
84
|
+
sort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
+
order: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
86
|
+
asc: "asc";
|
|
87
|
+
desc: "desc";
|
|
88
|
+
}>>>;
|
|
89
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
filters: z.ZodPipe<z.ZodObject<{
|
|
91
|
+
types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
92
|
+
file: "file";
|
|
93
|
+
folder: "folder";
|
|
94
|
+
}>>>>;
|
|
95
|
+
contentTypes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
96
|
+
nodeIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
97
|
+
isArchived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
98
|
+
namespace: z.ZodString;
|
|
99
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
101
|
+
isArchived: boolean;
|
|
102
|
+
namespace: string;
|
|
103
|
+
parentId: string | null;
|
|
104
|
+
types?: ("file" | "folder")[] | null | undefined;
|
|
105
|
+
contentTypes?: string[] | null | undefined;
|
|
106
|
+
nodeIds?: string[] | null | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
namespace: string;
|
|
109
|
+
parentId: string | null;
|
|
110
|
+
types?: ("file" | "folder")[] | null | undefined;
|
|
111
|
+
contentTypes?: string[] | null | undefined;
|
|
112
|
+
nodeIds?: string[] | null | undefined;
|
|
113
|
+
isArchived?: boolean | null | undefined;
|
|
114
|
+
}>>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
type ListDriveTreeInput = z.input<typeof listDriveTreeInputSchema>;
|
|
117
|
+
type ListDriveTreeSchema = z.infer<typeof listDriveTreeInputSchema>;
|
|
118
|
+
/**
|
|
119
|
+
* Get nodes by parent id input schema
|
|
120
|
+
*/
|
|
121
|
+
declare const getNodesByParentIdInputSchema: z.ZodObject<{
|
|
122
|
+
sort: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
123
|
+
search: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
order: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
125
|
+
asc: "asc";
|
|
126
|
+
desc: "desc";
|
|
127
|
+
}>>>;
|
|
128
|
+
filters: z.ZodPipe<z.ZodObject<{
|
|
129
|
+
types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
130
|
+
file: "file";
|
|
131
|
+
folder: "folder";
|
|
132
|
+
}>>>>;
|
|
133
|
+
contentTypes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
134
|
+
nodeIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
135
|
+
isArchived: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
136
|
+
namespace: z.ZodString;
|
|
137
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
139
|
+
isArchived: boolean;
|
|
140
|
+
namespace: string;
|
|
141
|
+
parentId: string | null;
|
|
142
|
+
types?: ("file" | "folder")[] | null | undefined;
|
|
143
|
+
contentTypes?: string[] | null | undefined;
|
|
144
|
+
nodeIds?: string[] | null | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
namespace: string;
|
|
147
|
+
parentId: string | null;
|
|
148
|
+
types?: ("file" | "folder")[] | null | undefined;
|
|
149
|
+
contentTypes?: string[] | null | undefined;
|
|
150
|
+
nodeIds?: string[] | null | undefined;
|
|
151
|
+
isArchived?: boolean | null | undefined;
|
|
152
|
+
}>>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
type GetDriveNodesByParentIdInput = z.input<typeof getNodesByParentIdInputSchema>;
|
|
155
|
+
type GetDriveNodesByParentIdSchema = z.infer<typeof getNodesByParentIdInputSchema>;
|
|
156
|
+
//#endregion
|
|
157
|
+
export { CreateDriveFolderInput, CreateDriveFolderSchema, GetDriveNodesByParentIdInput, GetDriveNodesByParentIdSchema, ListDriveTreeInput, ListDriveTreeSchema, NodesTableFilters, PresignDriveFileInput, PresignDriveFileSchema, UpdateDriveNodeInput, UpdateDriveNodeSchema, UploadDriveFileInput, UploadDriveFileSchema, createDriveFolderInputSchema, driveTableFiltersSchema, getNodesByParentIdInputSchema, listDriveTreeInputSchema, presignDriveFileInputSchema, updateDriveNodeInputSchema, uploadDriveFileInputSchema };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { driveTreeFilters } from "../config/filters.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { resolveFiltersSchema, tableQuerySchema } from "@tulip-systems/core/data-tables";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/validators.ts
|
|
6
|
+
/**
|
|
7
|
+
* Create drive folder input schema
|
|
8
|
+
* @description zod schema for validating the input of the create drive folder command
|
|
9
|
+
*/
|
|
10
|
+
const createDriveFolderInputSchema = z.object({
|
|
11
|
+
name: z.string(),
|
|
12
|
+
namespace: z.string(),
|
|
13
|
+
parentId: z.string().nullable().optional()
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Update drive node input schema
|
|
17
|
+
*/
|
|
18
|
+
const updateDriveNodeInputSchema = z.object({ name: z.string().optional() });
|
|
19
|
+
/**
|
|
20
|
+
* Upload drive file input schema
|
|
21
|
+
* @description zod schema for validating the input of the upload drive file command
|
|
22
|
+
*/
|
|
23
|
+
const uploadDriveFileInputSchema = z.object({
|
|
24
|
+
name: z.string(),
|
|
25
|
+
namespace: z.string(),
|
|
26
|
+
parentId: z.string().nullable().optional(),
|
|
27
|
+
contentType: z.string().nullable().optional(),
|
|
28
|
+
size: z.number().nullable().optional()
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Presign drive file input schema
|
|
32
|
+
* @description zod schema for validating the input of the presign drive file command
|
|
33
|
+
*/
|
|
34
|
+
const presignDriveFileInputSchema = z.object({
|
|
35
|
+
name: z.string(),
|
|
36
|
+
namespace: z.string(),
|
|
37
|
+
parentId: z.string().nullable().optional(),
|
|
38
|
+
contentType: z.string().nullable().optional(),
|
|
39
|
+
size: z.number().nullable().optional()
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Table filters
|
|
43
|
+
*/
|
|
44
|
+
const driveTableFiltersSchema = resolveFiltersSchema(driveTreeFilters).partial().extend({
|
|
45
|
+
namespace: z.string(),
|
|
46
|
+
parentId: z.string().nullable()
|
|
47
|
+
}).transform((input) => ({
|
|
48
|
+
...input,
|
|
49
|
+
isArchived: input?.isArchived ?? false
|
|
50
|
+
}));
|
|
51
|
+
/**
|
|
52
|
+
* List tree input schema
|
|
53
|
+
*/
|
|
54
|
+
const listDriveTreeInputSchema = tableQuerySchema.extend({ filters: driveTableFiltersSchema });
|
|
55
|
+
/**
|
|
56
|
+
* Get nodes by parent id input schema
|
|
57
|
+
*/
|
|
58
|
+
const getNodesByParentIdInputSchema = tableQuerySchema.pick({
|
|
59
|
+
order: true,
|
|
60
|
+
sort: true,
|
|
61
|
+
search: true
|
|
62
|
+
}).extend({ filters: driveTableFiltersSchema });
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { createDriveFolderInputSchema, driveTableFiltersSchema, getNodesByParentIdInputSchema, listDriveTreeInputSchema, presignDriveFileInputSchema, updateDriveNodeInputSchema, uploadDriveFileInputSchema };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DriveBreadcrumb } from "../components/navigation/breadcrumbs.client.mjs";
|
|
2
|
+
import { LocalDriveFileUpdateCommand, LocalDriveFileUpdateCommandProps } from "../providers/local/components/command-file-update.mjs";
|
|
3
|
+
import { LocalDriveFilesUploadCommand } from "../providers/local/components/command-file-upload.mjs";
|
|
4
|
+
import { LocalDriveFoldersCreateCommand, LocalDriveFoldersCreateCommandProps } from "../providers/local/components/command-folder-create.mjs";
|
|
5
|
+
import { LocalDriveFoldersUpdateCommand, LocalDriveFoldersUpdateCommandProps } from "../providers/local/components/command-folder-update.mjs";
|
|
6
|
+
import { LocalDriveContent } from "../providers/local/components/content.client.mjs";
|
|
7
|
+
import { LocalDriveHeader, LocalDriveHeaderBreadcrumbs, LocalDriveHeaderTools, LocalDriveToolbar, LocalDriveToolbarBreadcrumbs, LocalDriveToolbarTools, LocalDriveViewSwitcher } from "../providers/local/components/navigation.client.mjs";
|
|
8
|
+
import { LocalDriveUploadClient, LocalDriveUploadFileRequest, LocalDriveUploadHooks, PrepareLocalDriveUploadInput, createLocalDriveUploadClient } from "../providers/local/lib/upload.client.mjs";
|
|
9
|
+
import { DriveUploadZoneContext, DriveUploadZoneContextValue, LocalDriveUploadZoneContext, LocalDriveUploadZoneContextValue, useDriveUploadZone, useLocalDriveUploadZone } from "../providers/local/components/upload-zone-context.client.mjs";
|
|
10
|
+
import { DriveUploadZone, DriveUploadZoneProps, LocalDriveUploadZone, LocalDriveUploadZoneProps } from "../providers/local/components/upload-zone.client.mjs";
|
|
11
|
+
import { LocalDriveContext, LocalDriveContextValue, LocalDriveProvider, LocalDriveProviderProps, useLocalDriveContext } from "../providers/local/components/provider.client.mjs";
|
|
12
|
+
import { LocalDriveView, LocalDriveViewLoading, LocalDriveViewProvider } from "../providers/local/components/view.client.mjs";
|
|
13
|
+
export { DriveBreadcrumb, DriveUploadZone, DriveUploadZoneContext, DriveUploadZoneContextValue, DriveUploadZoneProps, LocalDriveContent, LocalDriveContext, LocalDriveContextValue, LocalDriveFileUpdateCommand, LocalDriveFileUpdateCommandProps, LocalDriveFilesUploadCommand, LocalDriveFoldersCreateCommand, LocalDriveFoldersCreateCommandProps, LocalDriveFoldersUpdateCommand, LocalDriveFoldersUpdateCommandProps, LocalDriveHeader, LocalDriveHeaderBreadcrumbs, LocalDriveHeaderTools, LocalDriveProvider, LocalDriveProviderProps, LocalDriveToolbar, LocalDriveToolbarBreadcrumbs, LocalDriveToolbarTools, LocalDriveUploadClient, LocalDriveUploadFileRequest, LocalDriveUploadHooks, LocalDriveUploadZone, LocalDriveUploadZoneContext, LocalDriveUploadZoneContextValue, LocalDriveUploadZoneProps, LocalDriveView, LocalDriveViewLoading, LocalDriveViewProvider, LocalDriveViewSwitcher, PrepareLocalDriveUploadInput, createLocalDriveUploadClient, useDriveUploadZone, useLocalDriveContext, useLocalDriveUploadZone };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LocalDriveFileUpdateCommand } from "../providers/local/components/command-file-update.mjs";
|
|
2
|
+
import { DriveUploadZoneContext, LocalDriveUploadZoneContext, useDriveUploadZone, useLocalDriveUploadZone } from "../providers/local/components/upload-zone-context.client.mjs";
|
|
3
|
+
import { LocalDriveFilesUploadCommand } from "../providers/local/components/command-file-upload.mjs";
|
|
4
|
+
import { LocalDriveFoldersCreateCommand } from "../providers/local/components/command-folder-create.mjs";
|
|
5
|
+
import { LocalDriveFoldersUpdateCommand } from "../providers/local/components/command-folder-update.mjs";
|
|
6
|
+
import { LocalDriveContent } from "../providers/local/components/content.client.mjs";
|
|
7
|
+
import { LocalDriveHeader, LocalDriveHeaderBreadcrumbs, LocalDriveHeaderTools, LocalDriveToolbar, LocalDriveToolbarBreadcrumbs, LocalDriveToolbarTools, LocalDriveViewSwitcher } from "../providers/local/components/navigation.client.mjs";
|
|
8
|
+
import { DriveUploadZone, LocalDriveUploadZone } from "../providers/local/components/upload-zone.client.mjs";
|
|
9
|
+
import { LocalDriveContext, LocalDriveProvider, useLocalDriveContext } from "../providers/local/components/provider.client.mjs";
|
|
10
|
+
import { LocalDriveView, LocalDriveViewLoading, LocalDriveViewProvider } from "../providers/local/components/view.client.mjs";
|
|
11
|
+
import { createLocalDriveUploadClient } from "../providers/local/lib/upload.client.mjs";
|
|
12
|
+
|
|
13
|
+
export { DriveUploadZone, DriveUploadZoneContext, LocalDriveContent, LocalDriveContext, LocalDriveFileUpdateCommand, LocalDriveFilesUploadCommand, LocalDriveFoldersCreateCommand, LocalDriveFoldersUpdateCommand, LocalDriveHeader, LocalDriveHeaderBreadcrumbs, LocalDriveHeaderTools, LocalDriveProvider, LocalDriveToolbar, LocalDriveToolbarBreadcrumbs, LocalDriveToolbarTools, LocalDriveUploadZone, LocalDriveUploadZoneContext, LocalDriveView, LocalDriveViewLoading, LocalDriveViewProvider, LocalDriveViewSwitcher, createLocalDriveUploadClient, useDriveUploadZone, useLocalDriveContext, useLocalDriveUploadZone };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LocalDrive, LocalDriveConfig } from "../providers/local/lib/service.server.mjs";
|
|
2
|
+
import { createLocalDriveRouteHandler } from "../providers/local/lib/route-handler.server.mjs";
|
|
3
|
+
import { createLocalDriveProcedures } from "../providers/local/lib/router.server.mjs";
|
|
4
|
+
export { LocalDrive, LocalDriveConfig, createLocalDriveProcedures, createLocalDriveRouteHandler };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createLocalDriveRouteHandler } from "../providers/local/lib/route-handler.server.mjs";
|
|
2
|
+
import { createLocalDriveProcedures } from "../providers/local/lib/router.server.mjs";
|
|
3
|
+
import { LocalDrive } from "../providers/local/lib/service.server.mjs";
|
|
4
|
+
|
|
5
|
+
export { LocalDrive, createLocalDriveProcedures, createLocalDriveRouteHandler };
|
package/dist/local.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DriveSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./providers/local/lib/schema.mjs";
|
|
2
|
+
import { CreateLocalDriveFolderInput, CreateLocalDriveFolderSchema, GetLocalDriveNodesByParentIdInput, GetLocalFileURLSchema, ListLocalDriveFlatSchema, ListLocalDriveTreeInput, ListLocalDriveTreeSchema, LocalDriveFileNode, LocalDriveFolderNode, LocalDriveNode, LocalDriveNodeChild, LocalDriveNodeWithAsset, LocalDriveNodeWithChildren, LocalDriveTableFilters, LocalNode, PresignLocalDriveFileInput, UpdateLocalDriveNodeInput, UploadLocalDriveFileSchema, createLocalDriveFolderInputSchema, getLocalDriveNodesByParentIdInputSchema, getLocalFileURLSchema, getLocalFileURLSchemaDefaults, listLocalDriveFlatInputSchema, listLocalDriveTreeInputSchema, localDriveFlatFiltersSchema, localDriveNodeSchema, localDriveNodeWithChildrenSchema, localDriveTreeFiltersSchema, presignLocalDriveFileInputSchema, updateLocalDriveNodeInputSchema, uploadLocalDriveFileInputSchema } from "./providers/local/lib/validators.mjs";
|
|
3
|
+
import { localDriveColumns } from "./providers/local/config/columns-data.mjs";
|
|
4
|
+
import { localDriveFilters } from "./providers/local/config/filters.mjs";
|
|
5
|
+
import { ImageVariant, deviceSizes, imageSizes, imageVariants, nodeSubtypes } from "./providers/local/lib/constants.mjs";
|
|
6
|
+
import { LocalDriveNodeSubtype, getLocalDriveFileUrl, inferLocalDriveNodeSubtype, isLocalDriveFile, isLocalDriveFolder, localDriveImageLoader, renderBytes, toLocalDriveNode } from "./providers/local/lib/helpers.mjs";
|
|
7
|
+
import { localDriveTreeFilterSearchParams } from "./providers/local/lib/search-params.mjs";
|
|
8
|
+
export { CreateLocalDriveFolderInput, CreateLocalDriveFolderSchema, DriveSchema, GetLocalDriveNodesByParentIdInput, GetLocalFileURLSchema, ImageVariant, ListLocalDriveFlatSchema, ListLocalDriveTreeInput, ListLocalDriveTreeSchema, LocalDriveFileNode, LocalDriveFolderNode, LocalDriveNode, LocalDriveNodeChild, LocalDriveNodeSubtype, LocalDriveNodeWithAsset, LocalDriveNodeWithChildren, LocalDriveTableFilters, LocalNode, PresignLocalDriveFileInput, UpdateLocalDriveNodeInput, UploadLocalDriveFileSchema, createLocalDriveFolderInputSchema, deviceSizes, getLocalDriveFileUrl, getLocalDriveNodesByParentIdInputSchema, getLocalFileURLSchema, getLocalFileURLSchemaDefaults, imageSizes, imageVariants, inferLocalDriveNodeSubtype, isLocalDriveFile, isLocalDriveFolder, listLocalDriveFlatInputSchema, listLocalDriveTreeInputSchema, localDriveColumns, localDriveFilters, localDriveFlatFiltersSchema, localDriveImageLoader, localDriveNodeSchema, localDriveNodeWithChildrenSchema, localDriveTreeFilterSearchParams, localDriveTreeFiltersSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, presignLocalDriveFileInputSchema, renderBytes, toLocalDriveNode, updateLocalDriveNodeInputSchema, uploadLocalDriveFileInputSchema };
|
package/dist/local.mjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { localDriveColumns } from "./providers/local/config/columns-data.mjs";
|
|
2
|
+
import { deviceSizes, imageSizes, imageVariants, nodeSubtypes } from "./providers/local/lib/constants.mjs";
|
|
3
|
+
import { localDriveFilters } from "./providers/local/config/filters.mjs";
|
|
4
|
+
import { getLocalDriveFileUrl, inferLocalDriveNodeSubtype, isLocalDriveFile, isLocalDriveFolder, localDriveImageLoader, renderBytes, toLocalDriveNode } from "./providers/local/lib/helpers.mjs";
|
|
5
|
+
import { nodePresignedUrls, nodePresignedUrlsRelations, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations } from "./providers/local/lib/schema.mjs";
|
|
6
|
+
import { localDriveTreeFilterSearchParams } from "./providers/local/lib/search-params.mjs";
|
|
7
|
+
import { createLocalDriveFolderInputSchema, getLocalDriveNodesByParentIdInputSchema, getLocalFileURLSchema, getLocalFileURLSchemaDefaults, listLocalDriveFlatInputSchema, listLocalDriveTreeInputSchema, localDriveFlatFiltersSchema, localDriveNodeSchema, localDriveNodeWithChildrenSchema, localDriveTreeFiltersSchema, presignLocalDriveFileInputSchema, updateLocalDriveNodeInputSchema, uploadLocalDriveFileInputSchema } from "./providers/local/lib/validators.mjs";
|
|
8
|
+
|
|
9
|
+
export { createLocalDriveFolderInputSchema, deviceSizes, getLocalDriveFileUrl, getLocalDriveNodesByParentIdInputSchema, getLocalFileURLSchema, getLocalFileURLSchemaDefaults, imageSizes, imageVariants, inferLocalDriveNodeSubtype, isLocalDriveFile, isLocalDriveFolder, listLocalDriveFlatInputSchema, listLocalDriveTreeInputSchema, localDriveColumns, localDriveFilters, localDriveFlatFiltersSchema, localDriveImageLoader, localDriveNodeSchema, localDriveNodeWithChildrenSchema, localDriveTreeFilterSearchParams, localDriveTreeFiltersSchema, nodePresignedUrls, nodePresignedUrlsRelations, nodeSubtypes, nodeTypeEnum, nodeVariants, nodeVariantsRelations, nodes, nodesRelations, presignLocalDriveFileInputSchema, renderBytes, toLocalDriveNode, updateLocalDriveNodeInputSchema, uploadLocalDriveFileInputSchema };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UpdateGoogleDriveNodeInput } from "../lib/validators.mjs";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
//#region src/providers/google/components/command-file-update.d.ts
|
|
6
|
+
type GoogleDriveFileUpdateCommandProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = {
|
|
7
|
+
defaultValues: Partial<UpdateGoogleDriveNodeInput>;
|
|
8
|
+
variables: (values: UpdateGoogleDriveNodeInput) => TVariables;
|
|
9
|
+
mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* File update command
|
|
13
|
+
* @description command to update a Google Drive file
|
|
14
|
+
*/
|
|
15
|
+
declare function GoogleDriveFileUpdateCommand<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
|
|
16
|
+
defaultValues,
|
|
17
|
+
variables,
|
|
18
|
+
mutation
|
|
19
|
+
}: GoogleDriveFileUpdateCommandProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { GoogleDriveFileUpdateCommand, GoogleDriveFileUpdateCommandProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { updateGoogleDriveNodeInputSchema } from "../lib/validators.mjs";
|
|
4
|
+
import { Input } from "@tulip-systems/core/components";
|
|
5
|
+
import { CommandFormDialog, CommandFormDialogCancel, CommandFormDialogContent, CommandFormDialogFields, CommandFormDialogFooter, CommandFormDialogHeader, CommandFormDialogSubmit, CommandFormDialogTitle, CommandFormDialogTrigger, CommandLabel } from "@tulip-systems/core/commands/client";
|
|
6
|
+
import { FilePen } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@tulip-systems/core/components/client";
|
|
9
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
10
|
+
import { useForm } from "react-hook-form";
|
|
11
|
+
|
|
12
|
+
//#region src/providers/google/components/command-file-update.tsx
|
|
13
|
+
/**
|
|
14
|
+
* File update command
|
|
15
|
+
* @description command to update a Google Drive file
|
|
16
|
+
*/
|
|
17
|
+
function GoogleDriveFileUpdateCommand({ defaultValues, variables, mutation }) {
|
|
18
|
+
const form = useForm({
|
|
19
|
+
resolver: standardSchemaResolver(updateGoogleDriveNodeInputSchema),
|
|
20
|
+
defaultValues
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx(Form, {
|
|
23
|
+
...form,
|
|
24
|
+
children: /* @__PURE__ */ jsxs(CommandFormDialog, { children: [/* @__PURE__ */ jsxs(CommandFormDialogTrigger, {
|
|
25
|
+
label: "Wijzigen",
|
|
26
|
+
children: [/* @__PURE__ */ jsx(FilePen, { className: "size-4" }), /* @__PURE__ */ jsx(CommandLabel, {})]
|
|
27
|
+
}), /* @__PURE__ */ jsxs(CommandFormDialogContent, {
|
|
28
|
+
variables,
|
|
29
|
+
mutation,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(CommandFormDialogHeader, { children: /* @__PURE__ */ jsx(CommandFormDialogTitle, { children: "Bestand wijzigen" }) }),
|
|
32
|
+
/* @__PURE__ */ jsx(CommandFormDialogFields, { children: /* @__PURE__ */ jsx(FormField, {
|
|
33
|
+
control: form.control,
|
|
34
|
+
name: "name",
|
|
35
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(FormLabel, { children: "Naam" }),
|
|
37
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
|
|
38
|
+
...field,
|
|
39
|
+
value: field.value ?? ""
|
|
40
|
+
}) }),
|
|
41
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
42
|
+
] })
|
|
43
|
+
}) }),
|
|
44
|
+
/* @__PURE__ */ jsxs(CommandFormDialogFooter, { children: [/* @__PURE__ */ jsx(CommandFormDialogCancel, { children: "Annuleren" }), /* @__PURE__ */ jsx(CommandFormDialogSubmit, { children: "Opslaan" })] })
|
|
45
|
+
]
|
|
46
|
+
})] })
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { GoogleDriveFileUpdateCommand };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CreateGoogleDriveFolderInput } from "../lib/validators.mjs";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
//#region src/providers/google/components/command-folder-create.d.ts
|
|
6
|
+
type GoogleDriveFoldersCreateCommandProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = {
|
|
7
|
+
defaultValues?: Partial<CreateGoogleDriveFolderInput>;
|
|
8
|
+
variables: (values: CreateGoogleDriveFolderInput) => TVariables;
|
|
9
|
+
mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Folders create command
|
|
13
|
+
* @description command to create a Google Drive folder
|
|
14
|
+
*/
|
|
15
|
+
declare function GoogleDriveFoldersCreateCommand<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
|
|
16
|
+
defaultValues,
|
|
17
|
+
variables,
|
|
18
|
+
mutation
|
|
19
|
+
}: GoogleDriveFoldersCreateCommandProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { GoogleDriveFoldersCreateCommand, GoogleDriveFoldersCreateCommandProps };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { driveTreeSearchParams } from "../../../lib/search-params.mjs";
|
|
4
|
+
import { createGoogleDriveFolderInputSchema } from "../lib/validators.mjs";
|
|
5
|
+
import { Input } from "@tulip-systems/core/components";
|
|
6
|
+
import { CommandFormDialog, CommandFormDialogCancel, CommandFormDialogContent, CommandFormDialogFields, CommandFormDialogFooter, CommandFormDialogHeader, CommandFormDialogSubmit, CommandFormDialogTitle, CommandFormDialogTrigger, CommandLabel } from "@tulip-systems/core/commands/client";
|
|
7
|
+
import { FolderPlus } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@tulip-systems/core/components/client";
|
|
10
|
+
import { useQueryStates } from "nuqs";
|
|
11
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
12
|
+
import { useForm } from "react-hook-form";
|
|
13
|
+
|
|
14
|
+
//#region src/providers/google/components/command-folder-create.tsx
|
|
15
|
+
/**
|
|
16
|
+
* Folders create command
|
|
17
|
+
* @description command to create a Google Drive folder
|
|
18
|
+
*/
|
|
19
|
+
function GoogleDriveFoldersCreateCommand({ defaultValues, variables, mutation }) {
|
|
20
|
+
const [{ parentId }] = useQueryStates(driveTreeSearchParams);
|
|
21
|
+
const form = useForm({
|
|
22
|
+
resolver: standardSchemaResolver(createGoogleDriveFolderInputSchema),
|
|
23
|
+
defaultValues: {
|
|
24
|
+
...defaultValues,
|
|
25
|
+
parentId
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ jsx(Form, {
|
|
29
|
+
...form,
|
|
30
|
+
children: /* @__PURE__ */ jsxs(CommandFormDialog, { children: [/* @__PURE__ */ jsxs(CommandFormDialogTrigger, {
|
|
31
|
+
label: "Folder toevoegen",
|
|
32
|
+
hotkey: "mod+i",
|
|
33
|
+
children: [/* @__PURE__ */ jsx(FolderPlus, { className: "size-4" }), /* @__PURE__ */ jsx(CommandLabel, {})]
|
|
34
|
+
}), /* @__PURE__ */ jsxs(CommandFormDialogContent, {
|
|
35
|
+
variables,
|
|
36
|
+
mutation,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx(CommandFormDialogHeader, { children: /* @__PURE__ */ jsx(CommandFormDialogTitle, { children: "Folder toevoegen" }) }),
|
|
39
|
+
/* @__PURE__ */ jsx(CommandFormDialogFields, { children: /* @__PURE__ */ jsx(FormField, {
|
|
40
|
+
control: form.control,
|
|
41
|
+
name: "name",
|
|
42
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
43
|
+
/* @__PURE__ */ jsx(FormLabel, { children: "Naam" }),
|
|
44
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
|
|
45
|
+
...field,
|
|
46
|
+
value: field.value ?? ""
|
|
47
|
+
}) }),
|
|
48
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
49
|
+
] })
|
|
50
|
+
}) }),
|
|
51
|
+
/* @__PURE__ */ jsxs(CommandFormDialogFooter, { children: [/* @__PURE__ */ jsx(CommandFormDialogCancel, { children: "Annuleren" }), /* @__PURE__ */ jsx(CommandFormDialogSubmit, { children: "Toevoegen" })] })
|
|
52
|
+
]
|
|
53
|
+
})] })
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { GoogleDriveFoldersCreateCommand };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { UpdateGoogleDriveNodeInput } from "../lib/validators.mjs";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
import { DefaultError, MutationOptions } from "@tanstack/react-query";
|
|
4
|
+
|
|
5
|
+
//#region src/providers/google/components/command-folder-update.d.ts
|
|
6
|
+
type GoogleDriveFoldersUpdateCommandProps<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown> = {
|
|
7
|
+
defaultValues: Partial<UpdateGoogleDriveNodeInput>;
|
|
8
|
+
variables: (values: UpdateGoogleDriveNodeInput) => TVariables;
|
|
9
|
+
mutation: MutationOptions<TData, TError, TVariables, TOnMutateResult>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Folders update command
|
|
13
|
+
* @description command to update a Google Drive folder
|
|
14
|
+
*/
|
|
15
|
+
declare function GoogleDriveFoldersUpdateCommand<TData = unknown, TError = DefaultError, TVariables = unknown, TOnMutateResult = unknown>({
|
|
16
|
+
defaultValues,
|
|
17
|
+
variables,
|
|
18
|
+
mutation
|
|
19
|
+
}: GoogleDriveFoldersUpdateCommandProps<TData, TError, TVariables, TOnMutateResult>): react_jsx_runtime0.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { GoogleDriveFoldersUpdateCommand, GoogleDriveFoldersUpdateCommandProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { updateGoogleDriveNodeInputSchema } from "../lib/validators.mjs";
|
|
4
|
+
import { Input } from "@tulip-systems/core/components";
|
|
5
|
+
import { CommandFormDialog, CommandFormDialogCancel, CommandFormDialogContent, CommandFormDialogFields, CommandFormDialogFooter, CommandFormDialogHeader, CommandFormDialogSubmit, CommandFormDialogTitle, CommandFormDialogTrigger, CommandLabel } from "@tulip-systems/core/commands/client";
|
|
6
|
+
import { FolderPen } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@tulip-systems/core/components/client";
|
|
9
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
10
|
+
import { useForm } from "react-hook-form";
|
|
11
|
+
|
|
12
|
+
//#region src/providers/google/components/command-folder-update.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Folders update command
|
|
15
|
+
* @description command to update a Google Drive folder
|
|
16
|
+
*/
|
|
17
|
+
function GoogleDriveFoldersUpdateCommand({ defaultValues, variables, mutation }) {
|
|
18
|
+
const form = useForm({
|
|
19
|
+
resolver: standardSchemaResolver(updateGoogleDriveNodeInputSchema),
|
|
20
|
+
defaultValues
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsx(Form, {
|
|
23
|
+
...form,
|
|
24
|
+
children: /* @__PURE__ */ jsxs(CommandFormDialog, { children: [/* @__PURE__ */ jsxs(CommandFormDialogTrigger, {
|
|
25
|
+
label: "Wijzigen",
|
|
26
|
+
children: [/* @__PURE__ */ jsx(FolderPen, { className: "size-4" }), /* @__PURE__ */ jsx(CommandLabel, {})]
|
|
27
|
+
}), /* @__PURE__ */ jsxs(CommandFormDialogContent, {
|
|
28
|
+
variables,
|
|
29
|
+
mutation,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(CommandFormDialogHeader, { children: /* @__PURE__ */ jsx(CommandFormDialogTitle, { children: "Folder wijzigen" }) }),
|
|
32
|
+
/* @__PURE__ */ jsx(CommandFormDialogFields, { children: /* @__PURE__ */ jsx(FormField, {
|
|
33
|
+
control: form.control,
|
|
34
|
+
name: "name",
|
|
35
|
+
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(FormLabel, { children: "Naam" }),
|
|
37
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, {
|
|
38
|
+
...field,
|
|
39
|
+
value: field.value ?? ""
|
|
40
|
+
}) }),
|
|
41
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
42
|
+
] })
|
|
43
|
+
}) }),
|
|
44
|
+
/* @__PURE__ */ jsxs(CommandFormDialogFooter, { children: [/* @__PURE__ */ jsx(CommandFormDialogCancel, { children: "Annuleren" }), /* @__PURE__ */ jsx(CommandFormDialogSubmit, { children: "Opslaan" })] })
|
|
45
|
+
]
|
|
46
|
+
})] })
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { GoogleDriveFoldersUpdateCommand };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DriveContent } from "../../../components/content.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/providers/google/components/content.client.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* GoogleDriveContent
|
|
6
|
+
*/
|
|
7
|
+
declare const GoogleDriveContent: typeof DriveContent;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { GoogleDriveContent };
|