@tulip-systems/drive 0.8.1 → 0.8.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/client.d.mts +5 -0
- package/dist/client.mjs +6 -0
- package/dist/components/content.d.mts +14 -0
- package/dist/components/content.d.mts.map +1 -0
- package/dist/components/content.mjs +18 -0
- package/dist/components/content.mjs.map +1 -0
- package/dist/components/context.client.d.mts +14 -0
- package/dist/components/context.client.d.mts.map +1 -0
- package/dist/components/dnd.client.d.mts +17 -0
- package/dist/components/dnd.client.d.mts.map +1 -0
- package/dist/components/dnd.client.mjs +30 -0
- package/dist/components/dnd.client.mjs.map +1 -0
- package/dist/components/grid-card.client.d.mts +43 -0
- package/dist/components/grid-card.client.d.mts.map +1 -0
- package/dist/components/grid-card.client.mjs +173 -0
- package/dist/components/grid-card.client.mjs.map +1 -0
- package/dist/components/grid.client.d.mts +54 -0
- package/dist/components/grid.client.d.mts.map +1 -0
- package/dist/components/grid.client.mjs +54 -0
- package/dist/components/grid.client.mjs.map +1 -0
- package/dist/components/navigation/breadcrumbs.client.d.mts +26 -0
- package/dist/components/navigation/breadcrumbs.client.d.mts.map +1 -0
- package/dist/components/navigation/breadcrumbs.client.mjs +52 -0
- package/dist/components/navigation/breadcrumbs.client.mjs.map +1 -0
- package/dist/components/navigation/header.client.d.mts +28 -0
- package/dist/components/navigation/header.client.d.mts.map +1 -0
- package/dist/components/navigation/header.client.mjs +41 -0
- package/dist/components/navigation/header.client.mjs.map +1 -0
- package/dist/components/navigation/toolbar.client.d.mts +24 -0
- package/dist/components/navigation/toolbar.client.d.mts.map +1 -0
- package/dist/components/navigation/toolbar.client.mjs +35 -0
- package/dist/components/navigation/toolbar.client.mjs.map +1 -0
- package/dist/components/navigation/view-switcher.client.d.mts +10 -0
- package/dist/components/navigation/view-switcher.client.d.mts.map +1 -0
- package/dist/components/navigation/view-switcher.client.mjs +36 -0
- package/dist/components/navigation/view-switcher.client.mjs.map +1 -0
- package/dist/components/selection.client.d.mts +28 -0
- package/dist/components/selection.client.d.mts.map +1 -0
- package/dist/components/selection.client.mjs +39 -0
- package/dist/components/selection.client.mjs.map +1 -0
- package/dist/components/view.client.d.mts +26 -0
- package/dist/components/view.client.d.mts.map +1 -0
- package/dist/components/view.client.mjs +44 -0
- package/dist/components/view.client.mjs.map +1 -0
- package/dist/config/filters.mjs +15 -0
- package/dist/config/filters.mjs.map +1 -0
- package/dist/config/types.mjs +61 -0
- package/dist/config/types.mjs.map +1 -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 +12 -0
- package/dist/lib/constants.d.mts.map +1 -0
- package/dist/lib/constants.mjs +21 -0
- package/dist/lib/constants.mjs.map +1 -0
- package/dist/lib/contracts.d.mts +101 -0
- package/dist/lib/contracts.d.mts.map +1 -0
- package/dist/lib/dto.d.mts +118 -0
- package/dist/lib/dto.d.mts.map +1 -0
- package/dist/lib/dto.mjs +58 -0
- package/dist/lib/dto.mjs.map +1 -0
- package/dist/lib/helpers.d.mts +18 -0
- package/dist/lib/helpers.d.mts.map +1 -0
- package/dist/lib/helpers.mjs +37 -0
- package/dist/lib/helpers.mjs.map +1 -0
- package/dist/lib/helpers.server.d.mts +14 -0
- package/dist/lib/helpers.server.d.mts.map +1 -0
- package/dist/lib/helpers.server.mjs +16 -0
- package/dist/lib/helpers.server.mjs.map +1 -0
- package/dist/lib/search-params.d.mts +9 -0
- package/dist/lib/search-params.d.mts.map +1 -0
- package/dist/lib/search-params.mjs +8 -0
- package/dist/lib/search-params.mjs.map +1 -0
- package/dist/lib/validators.d.mts +158 -0
- package/dist/lib/validators.d.mts.map +1 -0
- package/dist/lib/validators.mjs +66 -0
- package/dist/lib/validators.mjs.map +1 -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 +22 -0
- package/dist/providers/google/components/command-file-update.d.mts.map +1 -0
- package/dist/providers/google/components/command-file-update.mjs +52 -0
- package/dist/providers/google/components/command-file-update.mjs.map +1 -0
- package/dist/providers/google/components/command-folder-create.d.mts +22 -0
- package/dist/providers/google/components/command-folder-create.d.mts.map +1 -0
- package/dist/providers/google/components/command-folder-create.mjs +59 -0
- package/dist/providers/google/components/command-folder-create.mjs.map +1 -0
- package/dist/providers/google/components/command-folder-update.d.mts +22 -0
- package/dist/providers/google/components/command-folder-update.d.mts.map +1 -0
- package/dist/providers/google/components/command-folder-update.mjs +52 -0
- package/dist/providers/google/components/command-folder-update.mjs.map +1 -0
- package/dist/providers/google/components/content.client.d.mts +10 -0
- package/dist/providers/google/components/content.client.d.mts.map +1 -0
- package/dist/providers/google/components/content.client.mjs +11 -0
- package/dist/providers/google/components/content.client.mjs.map +1 -0
- package/dist/providers/google/components/navigation.client.d.mts +16 -0
- package/dist/providers/google/components/navigation.client.d.mts.map +1 -0
- package/dist/providers/google/components/navigation.client.mjs +18 -0
- package/dist/providers/google/components/navigation.client.mjs.map +1 -0
- package/dist/providers/google/components/provider.client.d.mts +33 -0
- package/dist/providers/google/components/provider.client.d.mts.map +1 -0
- package/dist/providers/google/components/provider.client.mjs +43 -0
- package/dist/providers/google/components/provider.client.mjs.map +1 -0
- package/dist/providers/google/components/view.client.d.mts +41 -0
- package/dist/providers/google/components/view.client.d.mts.map +1 -0
- package/dist/providers/google/components/view.client.mjs +98 -0
- package/dist/providers/google/components/view.client.mjs.map +1 -0
- package/dist/providers/google/config/columns-data.d.mts +8 -0
- package/dist/providers/google/config/columns-data.d.mts.map +1 -0
- package/dist/providers/google/config/columns-data.mjs +70 -0
- package/dist/providers/google/config/columns-data.mjs.map +1 -0
- package/dist/providers/google/config/filters.d.mts +16 -0
- package/dist/providers/google/config/filters.d.mts.map +1 -0
- package/dist/providers/google/config/filters.mjs +8 -0
- package/dist/providers/google/config/filters.mjs.map +1 -0
- package/dist/providers/google/lib/constants.mjs +13 -0
- package/dist/providers/google/lib/constants.mjs.map +1 -0
- package/dist/providers/google/lib/dto.d.mts +39 -0
- package/dist/providers/google/lib/dto.d.mts.map +1 -0
- package/dist/providers/google/lib/dto.mjs +66 -0
- package/dist/providers/google/lib/dto.mjs.map +1 -0
- package/dist/providers/google/lib/helpers.mjs +46 -0
- package/dist/providers/google/lib/helpers.mjs.map +1 -0
- package/dist/providers/google/lib/router.server.d.mts +612 -0
- package/dist/providers/google/lib/router.server.d.mts.map +1 -0
- package/dist/providers/google/lib/router.server.mjs +40 -0
- package/dist/providers/google/lib/router.server.mjs.map +1 -0
- package/dist/providers/google/lib/search-params.d.mts +15 -0
- package/dist/providers/google/lib/search-params.d.mts.map +1 -0
- package/dist/providers/google/lib/search-params.mjs +12 -0
- package/dist/providers/google/lib/search-params.mjs.map +1 -0
- package/dist/providers/google/lib/service.server.d.mts +186 -0
- package/dist/providers/google/lib/service.server.d.mts.map +1 -0
- package/dist/providers/google/lib/service.server.mjs +613 -0
- package/dist/providers/google/lib/service.server.mjs.map +1 -0
- package/dist/providers/google/lib/validators.d.mts +303 -0
- package/dist/providers/google/lib/validators.d.mts.map +1 -0
- package/dist/providers/google/lib/validators.mjs +59 -0
- package/dist/providers/google/lib/validators.mjs.map +1 -0
- package/dist/providers/local/components/command-file-update.d.mts +18 -0
- package/dist/providers/local/components/command-file-update.d.mts.map +1 -0
- package/dist/providers/local/components/command-file-update.mjs +48 -0
- package/dist/providers/local/components/command-file-update.mjs.map +1 -0
- package/dist/providers/local/components/command-file-upload.d.mts +11 -0
- package/dist/providers/local/components/command-file-upload.d.mts.map +1 -0
- package/dist/providers/local/components/command-file-upload.mjs +35 -0
- package/dist/providers/local/components/command-file-upload.mjs.map +1 -0
- package/dist/providers/local/components/command-folder-create.d.mts +18 -0
- package/dist/providers/local/components/command-folder-create.d.mts.map +1 -0
- package/dist/providers/local/components/command-folder-create.mjs +55 -0
- package/dist/providers/local/components/command-folder-create.mjs.map +1 -0
- package/dist/providers/local/components/command-folder-update.d.mts +18 -0
- package/dist/providers/local/components/command-folder-update.d.mts.map +1 -0
- package/dist/providers/local/components/command-folder-update.mjs +48 -0
- package/dist/providers/local/components/command-folder-update.mjs.map +1 -0
- package/dist/providers/local/components/content.client.d.mts +7 -0
- package/dist/providers/local/components/content.client.d.mts.map +1 -0
- package/dist/providers/local/components/content.client.mjs +8 -0
- package/dist/providers/local/components/content.client.mjs.map +1 -0
- package/dist/providers/local/components/navigation.client.d.mts +16 -0
- package/dist/providers/local/components/navigation.client.d.mts.map +1 -0
- package/dist/providers/local/components/navigation.client.mjs +18 -0
- package/dist/providers/local/components/navigation.client.mjs.map +1 -0
- package/dist/providers/local/components/provider.client.d.mts +40 -0
- package/dist/providers/local/components/provider.client.d.mts.map +1 -0
- package/dist/providers/local/components/provider.client.mjs +61 -0
- package/dist/providers/local/components/provider.client.mjs.map +1 -0
- package/dist/providers/local/components/upload-zone-context.client.d.mts +38 -0
- package/dist/providers/local/components/upload-zone-context.client.d.mts.map +1 -0
- package/dist/providers/local/components/upload-zone-context.client.mjs +23 -0
- package/dist/providers/local/components/upload-zone-context.client.mjs.map +1 -0
- package/dist/providers/local/components/upload-zone.client.d.mts +30 -0
- package/dist/providers/local/components/upload-zone.client.d.mts.map +1 -0
- package/dist/providers/local/components/upload-zone.client.mjs +147 -0
- package/dist/providers/local/components/upload-zone.client.mjs.map +1 -0
- package/dist/providers/local/components/view.client.d.mts +32 -0
- package/dist/providers/local/components/view.client.d.mts.map +1 -0
- package/dist/providers/local/components/view.client.mjs +91 -0
- package/dist/providers/local/components/view.client.mjs.map +1 -0
- package/dist/providers/local/config/columns-data.d.mts +8 -0
- package/dist/providers/local/config/columns-data.d.mts.map +1 -0
- package/dist/providers/local/config/columns-data.mjs +70 -0
- package/dist/providers/local/config/columns-data.mjs.map +1 -0
- package/dist/providers/local/config/filters.d.mts +26 -0
- package/dist/providers/local/config/filters.d.mts.map +1 -0
- package/dist/providers/local/config/filters.mjs +15 -0
- package/dist/providers/local/config/filters.mjs.map +1 -0
- package/dist/providers/local/lib/constants.d.mts +12 -0
- package/dist/providers/local/lib/constants.d.mts.map +1 -0
- package/dist/providers/local/lib/constants.mjs +29 -0
- package/dist/providers/local/lib/constants.mjs.map +1 -0
- package/dist/providers/local/lib/helpers.d.mts +45 -0
- package/dist/providers/local/lib/helpers.d.mts.map +1 -0
- package/dist/providers/local/lib/helpers.mjs +110 -0
- package/dist/providers/local/lib/helpers.mjs.map +1 -0
- package/dist/providers/local/lib/route-handler.server.d.mts +34 -0
- package/dist/providers/local/lib/route-handler.server.d.mts.map +1 -0
- package/dist/providers/local/lib/route-handler.server.mjs +114 -0
- package/dist/providers/local/lib/route-handler.server.mjs.map +1 -0
- package/dist/providers/local/lib/router.server.d.mts +41648 -0
- package/dist/providers/local/lib/router.server.d.mts.map +1 -0
- package/dist/providers/local/lib/router.server.mjs +52 -0
- package/dist/providers/local/lib/router.server.mjs.map +1 -0
- package/dist/providers/local/lib/schema.d.mts +1113 -0
- package/dist/providers/local/lib/schema.d.mts.map +1 -0
- package/dist/providers/local/lib/schema.mjs +71 -0
- package/dist/providers/local/lib/schema.mjs.map +1 -0
- package/dist/providers/local/lib/search-params.d.mts +14 -0
- package/dist/providers/local/lib/search-params.d.mts.map +1 -0
- package/dist/providers/local/lib/search-params.mjs +9 -0
- package/dist/providers/local/lib/search-params.mjs.map +1 -0
- package/dist/providers/local/lib/service.server.d.mts +489 -0
- package/dist/providers/local/lib/service.server.d.mts.map +1 -0
- package/dist/providers/local/lib/service.server.mjs +668 -0
- package/dist/providers/local/lib/service.server.mjs.map +1 -0
- package/dist/providers/local/lib/upload.client.d.mts +62 -0
- package/dist/providers/local/lib/upload.client.d.mts.map +1 -0
- package/dist/providers/local/lib/upload.client.mjs +100 -0
- package/dist/providers/local/lib/upload.client.mjs.map +1 -0
- package/dist/providers/local/lib/validators.d.mts +454 -0
- package/dist/providers/local/lib/validators.d.mts.map +1 -0
- package/dist/providers/local/lib/validators.mjs +96 -0
- package/dist/providers/local/lib/validators.mjs.map +1 -0
- package/dist/server.d.mts +2 -0
- package/dist/server.mjs +3 -0
- package/package.json +3 -2
- package/src/providers/local/lib/helpers.ts +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { DriveFolderParent, DriveNode, DriveNodeBase, DriveNodeChild, DriveNodeWithChildren } from "./dto.mjs";
|
|
2
|
+
import { CreateDriveFolderInput, GetDriveNodesByParentIdInput, ListDriveTreeInput, PresignDriveFileInput, UpdateDriveNodeInput, UploadDriveFileInput } from "./validators.mjs";
|
|
3
|
+
import { TableQueryResponse } from "@tulip-systems/core/data-tables/server";
|
|
4
|
+
|
|
5
|
+
//#region src/lib/contracts.d.ts
|
|
6
|
+
type DrivePresignedUploadResult<TNode extends DriveNodeBase = DriveNode> = {
|
|
7
|
+
uploadId: string;
|
|
8
|
+
presignedUrl: string;
|
|
9
|
+
node: TNode;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Read-only drive operations every provider should be able to support.
|
|
13
|
+
* This is the base contract for provider-agnostic consumers and intentionally
|
|
14
|
+
* excludes storage, upload, preview generation, readonly, and soft-delete
|
|
15
|
+
* behavior because those are provider capabilities, not universal drive reads.
|
|
16
|
+
*/
|
|
17
|
+
interface DriveReader<TNode extends DriveNodeBase = DriveNodeBase, TNodeWithChildren extends DriveNodeWithChildren<TNode> = DriveNodeWithChildren<TNode>, TNodeChild extends DriveNodeChild<TNode> = DriveNodeChild<TNode>> {
|
|
18
|
+
getNodeById(id: string): Promise<TNode | null>;
|
|
19
|
+
getNodeWithChildren(input: {
|
|
20
|
+
id: string;
|
|
21
|
+
namespace: string;
|
|
22
|
+
}): Promise<TNodeWithChildren | null>;
|
|
23
|
+
getNodesByParentId(input: GetDriveNodesByParentIdInput): Promise<TNode[]>;
|
|
24
|
+
listTree(input: ListDriveTreeInput): Promise<TableQueryResponse<TNode>>;
|
|
25
|
+
getFolderParents(input: {
|
|
26
|
+
id: string | null;
|
|
27
|
+
namespace: string;
|
|
28
|
+
}): Promise<Array<DriveFolderParent<TNode>>>;
|
|
29
|
+
getNodeChildren(ids: string[]): Promise<TNodeChild[]>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Optional capability for providers that can mutate the node tree.
|
|
33
|
+
* Providers that are read-only, remote-index-only, or permission-limited should
|
|
34
|
+
* not implement this contract.
|
|
35
|
+
*/
|
|
36
|
+
interface DriveNodeMutations<TNode extends DriveNodeBase = DriveNodeBase> {
|
|
37
|
+
createFolder(input: CreateDriveFolderInput): Promise<TNode>;
|
|
38
|
+
updateNode(id: string, data: UpdateDriveNodeInput): Promise<TNode>;
|
|
39
|
+
moveNode(input: {
|
|
40
|
+
id: string;
|
|
41
|
+
parentId: string | null;
|
|
42
|
+
}): Promise<TNode>;
|
|
43
|
+
deleteNode(id: string): Promise<void>;
|
|
44
|
+
deleteNodes(ids: string[]): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Optional capability for providers that accept a file body directly.
|
|
48
|
+
* The body type is provider-specific so the base contracts do not depend on any
|
|
49
|
+
* storage package or runtime upload representation.
|
|
50
|
+
*/
|
|
51
|
+
interface DriveDirectUpload<TNode extends DriveNodeBase = DriveNodeBase, TBody = unknown> {
|
|
52
|
+
uploadFile(input: UploadDriveFileInput & {
|
|
53
|
+
body: TBody;
|
|
54
|
+
}): Promise<TNode>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Optional capability for providers that create upload sessions/URLs.
|
|
58
|
+
* The returned metadata is provider-specific; local/object-storage providers can
|
|
59
|
+
* expose asset metadata here without leaking storage concepts into the base Drive
|
|
60
|
+
* contract.
|
|
61
|
+
*/
|
|
62
|
+
interface DrivePresignedUpload<TNode extends DriveNodeBase = DriveNodeBase, TResult extends DrivePresignedUploadResult<TNode> = DrivePresignedUploadResult<TNode>> {
|
|
63
|
+
presignUpload(input: PresignDriveFileInput): Promise<TResult>;
|
|
64
|
+
confirmUpload(uploadId: string): Promise<TNode>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Optional capability for providers that generate and persist preview variants.
|
|
68
|
+
* This is useful for local/object-storage providers. Providers with native
|
|
69
|
+
* previews, such as Google Drive, should not implement this just as a no-op.
|
|
70
|
+
*/
|
|
71
|
+
interface DrivePreviewGenerator {
|
|
72
|
+
generatePreviews(input: {
|
|
73
|
+
id: string;
|
|
74
|
+
}): Promise<void>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Optional capability for providers that can lock/unlock nodes.
|
|
78
|
+
* Google Drive maps this to `contentRestrictions.readOnly`; local drive maps it
|
|
79
|
+
* to its readonly flag. This is intentionally not part of the base reader
|
|
80
|
+
* contract because not every provider can honestly enforce it.
|
|
81
|
+
*/
|
|
82
|
+
interface DriveReadonly<TNode extends DriveNodeBase = DriveNodeBase> {
|
|
83
|
+
setReadonly(ids: string[], readonly: boolean): Promise<TNode[]>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Optional capability for providers that support soft removal.
|
|
87
|
+
* Local drive maps this to archive state; Google Drive maps this to trash.
|
|
88
|
+
*/
|
|
89
|
+
interface DriveArchive<TNode extends DriveNodeBase = DriveNodeBase> {
|
|
90
|
+
archiveNodes(ids: string[]): Promise<TNode[]>;
|
|
91
|
+
restoreNodes(ids: string[]): Promise<TNode[]>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Base provider-agnostic Drive contract.
|
|
95
|
+
* Additional behavior should be composed by intersecting optional capability
|
|
96
|
+
* contracts, for example `Drive<TNode> & DriveNodeMutations<TNode>`.
|
|
97
|
+
*/
|
|
98
|
+
type Drive<TNode extends DriveNodeBase = DriveNodeBase> = DriveReader<TNode>;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { Drive, DriveArchive, DriveDirectUpload, DriveNodeMutations, DrivePresignedUpload, DrivePresignedUploadResult, DrivePreviewGenerator, DriveReader, DriveReadonly };
|
|
101
|
+
//# sourceMappingURL=contracts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.mts","names":[],"sources":["../../src/lib/contracts.ts"],"mappings":";;;;;KAiBY,0BAAA,eAAyC,aAAA,GAAgB,SAAA;EACnE,QAAA;EACA,YAAA;EACA,IAAA,EAAM,KAAA;AAAA;;;;;;;UASS,WAAA,eACD,aAAA,GAAgB,aAAA,4BACJ,qBAAA,CAAsB,KAAA,IAAS,qBAAA,CAAsB,KAAA,sBAC5D,cAAA,CAAe,KAAA,IAAS,cAAA,CAAe,KAAA;EAE1D,WAAA,CAAY,EAAA,WAAa,OAAA,CAAQ,KAAA;EAEjC,mBAAA,CAAoB,KAAA;IAAS,EAAA;IAAY,SAAA;EAAA,IAAsB,OAAA,CAAQ,iBAAA;EAEvE,kBAAA,CAAmB,KAAA,EAAO,4BAAA,GAA+B,OAAA,CAAQ,KAAA;EAEjE,QAAA,CAAS,KAAA,EAAO,kBAAA,GAAqB,OAAA,CAAQ,kBAAA,CAAmB,KAAA;EAEhE,gBAAA,CAAiB,KAAA;IACf,EAAA;IACA,SAAA;EAAA,IACE,OAAA,CAAQ,KAAA,CAAM,iBAAA,CAAkB,KAAA;EAEpC,eAAA,CAAgB,GAAA,aAAgB,OAAA,CAAQ,UAAA;AAAA;;;;;;UAQzB,kBAAA,eAAiC,aAAA,GAAgB,aAAA;EAChE,YAAA,CAAa,KAAA,EAAO,sBAAA,GAAyB,OAAA,CAAQ,KAAA;EACrD,UAAA,CAAW,EAAA,UAAY,IAAA,EAAM,oBAAA,GAAuB,OAAA,CAAQ,KAAA;EAC5D,QAAA,CAAS,KAAA;IAAS,EAAA;IAAY,QAAA;EAAA,IAA4B,OAAA,CAAQ,KAAA;EAClE,UAAA,CAAW,EAAA,WAAa,OAAA;EACxB,WAAA,CAAY,GAAA,aAAgB,OAAA;AAAA;;;;;;UAQb,iBAAA,eAAgC,aAAA,GAAgB,aAAA;EAC/D,UAAA,CAAW,KAAA,EAAO,oBAAA;IAAyB,IAAA,EAAM,KAAA;EAAA,IAAU,OAAA,CAAQ,KAAA;AAAA;;;;;;;UASpD,oBAAA,eACD,aAAA,GAAgB,aAAA,kBACd,0BAAA,CAA2B,KAAA,IAAS,0BAAA,CAA2B,KAAA;EAE/E,aAAA,CAAc,KAAA,EAAO,qBAAA,GAAwB,OAAA,CAAQ,OAAA;EAErD,aAAA,CAAc,QAAA,WAAmB,OAAA,CAAQ,KAAA;AAAA;;;;;;UAQ1B,qBAAA;EACf,gBAAA,CAAiB,KAAA;IAAS,EAAA;EAAA,IAAe,OAAA;AAAA;;;;;;;UAS1B,aAAA,eAA4B,aAAA,GAAgB,aAAA;EAC3D,WAAA,CAAY,GAAA,YAAe,QAAA,YAAoB,OAAA,CAAQ,KAAA;AAAA;;;;;UAOxC,YAAA,eAA2B,aAAA,GAAgB,aAAA;EAC1D,YAAA,CAAa,GAAA,aAAgB,OAAA,CAAQ,KAAA;EACrC,YAAA,CAAa,GAAA,aAAgB,OAAA,CAAQ,KAAA;AAAA;;;;;;KAQ3B,KAAA,eAAoB,aAAA,GAAgB,aAAA,IAAiB,WAAA,CAAY,KAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/dto.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Drive node provider
|
|
6
|
+
*/
|
|
7
|
+
declare const driveNodeProviderSchema: z.ZodEnum<{
|
|
8
|
+
local: "local";
|
|
9
|
+
google: "google";
|
|
10
|
+
}>;
|
|
11
|
+
type DriveNodeProvider = z.infer<typeof driveNodeProviderSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* Drive node type
|
|
14
|
+
*/
|
|
15
|
+
declare const driveNodeTypeSchema: z.ZodEnum<{
|
|
16
|
+
file: "file";
|
|
17
|
+
folder: "folder";
|
|
18
|
+
}>;
|
|
19
|
+
type DriveNodeType = z.infer<typeof driveNodeTypeSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Drive node subtype
|
|
22
|
+
*/
|
|
23
|
+
declare const driveNodeSubtypeSchema: z.ZodEnum<{
|
|
24
|
+
image: "image";
|
|
25
|
+
document: "document";
|
|
26
|
+
spreadsheet: "spreadsheet";
|
|
27
|
+
video: "video";
|
|
28
|
+
audio: "audio";
|
|
29
|
+
archive: "archive";
|
|
30
|
+
other: "other";
|
|
31
|
+
}>;
|
|
32
|
+
type DriveNodeSubtype = z.infer<typeof driveNodeSubtypeSchema>;
|
|
33
|
+
/**
|
|
34
|
+
* Node availability
|
|
35
|
+
*/
|
|
36
|
+
declare const driveNodeAvailabilitySchema: z.ZodEnum<{
|
|
37
|
+
ready: "ready";
|
|
38
|
+
pending: "pending";
|
|
39
|
+
failed: "failed";
|
|
40
|
+
}>;
|
|
41
|
+
type DriveNodeAvailability = z.infer<typeof driveNodeAvailabilitySchema>;
|
|
42
|
+
/**
|
|
43
|
+
* Node links
|
|
44
|
+
*/
|
|
45
|
+
declare const driveNodeLinksSchema: z.ZodObject<{
|
|
46
|
+
view: z.ZodNullable<z.ZodString>;
|
|
47
|
+
download: z.ZodNullable<z.ZodString>;
|
|
48
|
+
preview: z.ZodNullable<z.ZodString>;
|
|
49
|
+
thumbnail: z.ZodNullable<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
type DriveNodeLinks = z.infer<typeof driveNodeLinksSchema>;
|
|
52
|
+
/**
|
|
53
|
+
* Node
|
|
54
|
+
*/
|
|
55
|
+
declare const driveNodeSchema: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
provider: z.ZodEnum<{
|
|
58
|
+
local: "local";
|
|
59
|
+
google: "google";
|
|
60
|
+
}>;
|
|
61
|
+
createdAt: z.ZodDate;
|
|
62
|
+
updatedAt: z.ZodDate;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
namespace: z.ZodString;
|
|
65
|
+
type: z.ZodEnum<{
|
|
66
|
+
file: "file";
|
|
67
|
+
folder: "folder";
|
|
68
|
+
}>;
|
|
69
|
+
subtype: z.ZodEnum<{
|
|
70
|
+
image: "image";
|
|
71
|
+
document: "document";
|
|
72
|
+
spreadsheet: "spreadsheet";
|
|
73
|
+
video: "video";
|
|
74
|
+
audio: "audio";
|
|
75
|
+
archive: "archive";
|
|
76
|
+
other: "other";
|
|
77
|
+
}>;
|
|
78
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
79
|
+
contentType: z.ZodNullable<z.ZodString>;
|
|
80
|
+
readonly: z.ZodBoolean;
|
|
81
|
+
hidden: z.ZodBoolean;
|
|
82
|
+
archivedAt: z.ZodNullable<z.ZodDate>;
|
|
83
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
84
|
+
links: z.ZodObject<{
|
|
85
|
+
view: z.ZodNullable<z.ZodString>;
|
|
86
|
+
download: z.ZodNullable<z.ZodString>;
|
|
87
|
+
preview: z.ZodNullable<z.ZodString>;
|
|
88
|
+
thumbnail: z.ZodNullable<z.ZodString>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
availability: z.ZodEnum<{
|
|
91
|
+
ready: "ready";
|
|
92
|
+
pending: "pending";
|
|
93
|
+
failed: "failed";
|
|
94
|
+
}>;
|
|
95
|
+
}, z.core.$strip>;
|
|
96
|
+
type DriveNode = z.infer<typeof driveNodeSchema>;
|
|
97
|
+
type DriveNodeBase = Omit<DriveNode, "provider">;
|
|
98
|
+
/**
|
|
99
|
+
* Node with children
|
|
100
|
+
*/
|
|
101
|
+
type DriveNodeWithChildren<TNode extends DriveNodeBase = DriveNode> = TNode & {
|
|
102
|
+
children: TNode[];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Node parent and child types
|
|
106
|
+
*/
|
|
107
|
+
type DriveFolderParent<TNode extends DriveNodeBase = DriveNode> = Pick<TNode, "id" | "name" | "parentId"> & {
|
|
108
|
+
depth: number;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Node child type
|
|
112
|
+
*/
|
|
113
|
+
type DriveNodeChild<TNode extends DriveNodeBase = DriveNode> = TNode & {
|
|
114
|
+
depth: number;
|
|
115
|
+
};
|
|
116
|
+
//#endregion
|
|
117
|
+
export { DriveFolderParent, DriveNode, DriveNodeAvailability, DriveNodeBase, DriveNodeChild, DriveNodeLinks, DriveNodeProvider, DriveNodeSubtype, DriveNodeType, DriveNodeWithChildren, driveNodeAvailabilitySchema, driveNodeLinksSchema, driveNodeProviderSchema, driveNodeSchema, driveNodeSubtypeSchema, driveNodeTypeSchema };
|
|
118
|
+
//# sourceMappingURL=dto.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto.d.mts","names":[],"sources":["../../src/lib/dto.ts"],"mappings":";;;;;AAMA;cAAa,uBAAA,EAAuB,CAAA,CAAA,OAAA;;;;KACxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;;cAKlC,mBAAA,EAAmB,CAAA,CAAA,OAAA;;;;KACpB,aAAA,GAAgB,CAAA,CAAE,KAAA,QAAa,mBAAA;;;;cAK9B,sBAAA,EAAsB,CAAA,CAAA,OAAA;;;;;;;;;KACvB,gBAAA,GAAmB,CAAA,CAAE,KAAA,QAAa,sBAAA;;;AAN9C;cAWa,2BAAA,EAA2B,CAAA,CAAA,OAAA;;;;;KAC5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;;;AAPnD;cAYa,oBAAA,EAAoB,CAAA,CAAA,SAAA;;;;;;KAMrB,cAAA,GAAiB,CAAA,CAAE,KAAA,QAAa,oBAAA;;;;cAK/B,eAAA,EAAe,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBhB,SAAA,GAAY,CAAA,CAAE,KAAA,QAAa,eAAA;AAAA,KAC3B,aAAA,GAAgB,IAAA,CAAK,SAAA;;;;KAKrB,qBAAA,eAAoC,aAAA,GAAgB,SAAA,IAAa,KAAA;EAC3E,QAAA,EAAU,KAAA;AAAA;;;;KAMA,iBAAA,eAAgC,aAAA,GAAgB,SAAA,IAAa,IAAA,CACvE,KAAA;EAGA,KAAA;AAAA;;;;KAMU,cAAA,eAA6B,aAAA,GAAgB,SAAA,IAAa,KAAA;EAAU,KAAA;AAAA"}
|
package/dist/lib/dto.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DRIVE_NODE_SUBTYPES, DRIVE_NODE_TYPES, DRIVE_PROVIDERS } from "./constants.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/lib/dto.ts
|
|
5
|
+
/**
|
|
6
|
+
* Drive node provider
|
|
7
|
+
*/
|
|
8
|
+
const driveNodeProviderSchema = z.enum(DRIVE_PROVIDERS);
|
|
9
|
+
/**
|
|
10
|
+
* Drive node type
|
|
11
|
+
*/
|
|
12
|
+
const driveNodeTypeSchema = z.enum(DRIVE_NODE_TYPES);
|
|
13
|
+
/**
|
|
14
|
+
* Drive node subtype
|
|
15
|
+
*/
|
|
16
|
+
const driveNodeSubtypeSchema = z.enum(DRIVE_NODE_SUBTYPES);
|
|
17
|
+
/**
|
|
18
|
+
* Node availability
|
|
19
|
+
*/
|
|
20
|
+
const driveNodeAvailabilitySchema = z.enum([
|
|
21
|
+
"ready",
|
|
22
|
+
"pending",
|
|
23
|
+
"failed"
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Node links
|
|
27
|
+
*/
|
|
28
|
+
const driveNodeLinksSchema = z.object({
|
|
29
|
+
view: z.string().nullable(),
|
|
30
|
+
download: z.string().nullable(),
|
|
31
|
+
preview: z.string().nullable(),
|
|
32
|
+
thumbnail: z.string().nullable()
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Node
|
|
36
|
+
*/
|
|
37
|
+
const driveNodeSchema = z.object({
|
|
38
|
+
id: z.string(),
|
|
39
|
+
provider: driveNodeProviderSchema,
|
|
40
|
+
createdAt: z.date(),
|
|
41
|
+
updatedAt: z.date(),
|
|
42
|
+
name: z.string(),
|
|
43
|
+
namespace: z.string(),
|
|
44
|
+
type: driveNodeTypeSchema,
|
|
45
|
+
subtype: driveNodeSubtypeSchema,
|
|
46
|
+
size: z.number().nullable(),
|
|
47
|
+
contentType: z.string().nullable(),
|
|
48
|
+
readonly: z.boolean(),
|
|
49
|
+
hidden: z.boolean(),
|
|
50
|
+
archivedAt: z.date().nullable(),
|
|
51
|
+
parentId: z.string().nullable(),
|
|
52
|
+
links: driveNodeLinksSchema,
|
|
53
|
+
availability: driveNodeAvailabilitySchema
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { driveNodeAvailabilitySchema, driveNodeLinksSchema, driveNodeProviderSchema, driveNodeSchema, driveNodeSubtypeSchema, driveNodeTypeSchema };
|
|
58
|
+
//# sourceMappingURL=dto.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dto.mjs","names":[],"sources":["../../src/lib/dto.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { DRIVE_NODE_SUBTYPES, DRIVE_NODE_TYPES, DRIVE_PROVIDERS } from \"./constants\";\n\n/**\n * Drive node provider\n */\nexport const driveNodeProviderSchema = z.enum(DRIVE_PROVIDERS);\nexport type DriveNodeProvider = z.infer<typeof driveNodeProviderSchema>;\n\n/**\n * Drive node type\n */\nexport const driveNodeTypeSchema = z.enum(DRIVE_NODE_TYPES);\nexport type DriveNodeType = z.infer<typeof driveNodeTypeSchema>;\n\n/**\n * Drive node subtype\n */\nexport const driveNodeSubtypeSchema = z.enum(DRIVE_NODE_SUBTYPES);\nexport type DriveNodeSubtype = z.infer<typeof driveNodeSubtypeSchema>;\n\n/**\n * Node availability\n */\nexport const driveNodeAvailabilitySchema = z.enum([\"ready\", \"pending\", \"failed\"]);\nexport type DriveNodeAvailability = z.infer<typeof driveNodeAvailabilitySchema>;\n\n/**\n * Node links\n */\nexport const driveNodeLinksSchema = z.object({\n view: z.string().nullable(),\n download: z.string().nullable(),\n preview: z.string().nullable(),\n thumbnail: z.string().nullable(),\n});\nexport type DriveNodeLinks = z.infer<typeof driveNodeLinksSchema>;\n\n/**\n * Node\n */\nexport const driveNodeSchema = z.object({\n id: z.string(),\n provider: driveNodeProviderSchema,\n createdAt: z.date(),\n updatedAt: z.date(),\n name: z.string(),\n namespace: z.string(),\n type: driveNodeTypeSchema,\n subtype: driveNodeSubtypeSchema,\n size: z.number().nullable(),\n contentType: z.string().nullable(),\n readonly: z.boolean(),\n hidden: z.boolean(),\n archivedAt: z.date().nullable(),\n parentId: z.string().nullable(),\n links: driveNodeLinksSchema,\n availability: driveNodeAvailabilitySchema,\n});\nexport type DriveNode = z.infer<typeof driveNodeSchema>;\nexport type DriveNodeBase = Omit<DriveNode, \"provider\">;\n\n/**\n * Node with children\n */\nexport type DriveNodeWithChildren<TNode extends DriveNodeBase = DriveNode> = TNode & {\n children: TNode[];\n};\n\n/**\n * Node parent and child types\n */\nexport type DriveFolderParent<TNode extends DriveNodeBase = DriveNode> = Pick<\n TNode,\n \"id\" | \"name\" | \"parentId\"\n> & {\n depth: number;\n};\n\n/**\n * Node child type\n */\nexport type DriveNodeChild<TNode extends DriveNodeBase = DriveNode> = TNode & { depth: number };\n"],"mappings":";;;;;;;AAMA,MAAa,0BAA0B,EAAE,KAAK,gBAAgB;;;;AAM9D,MAAa,sBAAsB,EAAE,KAAK,iBAAiB;;;;AAM3D,MAAa,yBAAyB,EAAE,KAAK,oBAAoB;;;;AAMjE,MAAa,8BAA8B,EAAE,KAAK;CAAC;CAAS;CAAW;CAAS,CAAC;;;;AAMjF,MAAa,uBAAuB,EAAE,OAAO;CAC3C,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,SAAS,EAAE,QAAQ,CAAC,UAAU;CAC9B,WAAW,EAAE,QAAQ,CAAC,UAAU;CACjC,CAAC;;;;AAMF,MAAa,kBAAkB,EAAE,OAAO;CACtC,IAAI,EAAE,QAAQ;CACd,UAAU;CACV,WAAW,EAAE,MAAM;CACnB,WAAW,EAAE,MAAM;CACnB,MAAM,EAAE,QAAQ;CAChB,WAAW,EAAE,QAAQ;CACrB,MAAM;CACN,SAAS;CACT,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC3B,aAAa,EAAE,QAAQ,CAAC,UAAU;CAClC,UAAU,EAAE,SAAS;CACrB,QAAQ,EAAE,SAAS;CACnB,YAAY,EAAE,MAAM,CAAC,UAAU;CAC/B,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,OAAO;CACP,cAAc;CACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DriveNode } from "./dto.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/helpers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Check if the node is a file
|
|
6
|
+
*/
|
|
7
|
+
declare function isFile(node: Pick<DriveNode, "type">): node is DriveNode;
|
|
8
|
+
/**
|
|
9
|
+
* Check if the node is a folder
|
|
10
|
+
*/
|
|
11
|
+
declare function isFolder(node: Pick<DriveNode, "type">): node is DriveNode;
|
|
12
|
+
/**
|
|
13
|
+
* Render bytes
|
|
14
|
+
*/
|
|
15
|
+
declare function renderBytes(bytes: number): string;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { isFile, isFolder, renderBytes };
|
|
18
|
+
//# sourceMappingURL=helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/lib/helpers.ts"],"mappings":";;;;;AAKA;iBAAgB,MAAA,CAAO,IAAA,EAAM,IAAA,CAAK,SAAA,YAAqB,IAAA,IAAQ,SAAA;;;;iBAO/C,QAAA,CAAS,IAAA,EAAM,IAAA,CAAK,SAAA,YAAqB,IAAA,IAAQ,SAAA;;;;iBAOjD,WAAA,CAAY,KAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 };
|
|
37
|
+
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/lib/helpers.ts"],"sourcesContent":["import type { DriveNode } from \"./dto\";\n\n/**\n * Check if the node is a file\n */\nexport function isFile(node: Pick<DriveNode, \"type\">): node is DriveNode {\n return node.type === \"file\";\n}\n\n/**\n * Check if the node is a folder\n */\nexport function isFolder(node: Pick<DriveNode, \"type\">): node is DriveNode {\n return node.type === \"folder\";\n}\n\n/**\n * Render bytes\n */\nexport function renderBytes(bytes: number) {\n const units = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n\n let size = bytes;\n let unitIndex = 0;\n\n while (size >= 1024 && unitIndex < units.length - 1) {\n size /= 1024;\n unitIndex++;\n }\n\n return `${size.toFixed(2)}${units[unitIndex]}`;\n}\n"],"mappings":";;;;AAKA,SAAgB,OAAO,MAAkD;AACvE,QAAO,KAAK,SAAS;;;;;AAMvB,SAAgB,SAAS,MAAkD;AACzE,QAAO,KAAK,SAAS;;;;;AAMvB,SAAgB,YAAY,OAAe;CACzC,MAAM,QAAQ;EAAC;EAAK;EAAM;EAAM;EAAM;EAAM;EAAK;CAEjD,IAAI,OAAO;CACX,IAAI,YAAY;AAEhB,QAAO,QAAQ,QAAQ,YAAY,MAAM,SAAS,GAAG;AACnD,UAAQ;AACR;;AAGF,QAAO,GAAG,KAAK,QAAQ,EAAE,GAAG,MAAM"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 };
|
|
14
|
+
//# sourceMappingURL=helpers.server.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.server.d.mts","names":[],"sources":["../../src/lib/helpers.server.ts"],"mappings":";;;;;;;AAWA;;;iBAAgB,2BAAA,CAA4B,YAAA,EAAc,OAAA,CAAQ,UAAA,QAAkB,OAAA,KAC7B,aAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 };
|
|
16
|
+
//# sourceMappingURL=helpers.server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.server.mjs","names":[],"sources":["../../src/lib/helpers.server.ts"],"sourcesContent":["import \"server-cli-only\";\n\nimport type { cookies } from \"next/headers\";\nimport type { DriveViewMode } from \"@/components/view.client\";\nimport { DRIVE_VIEW_COOKIE } from \"./constants\";\n\n/**\n * Helper function to get the drive view mode from cookies\n * @param cookiesStore - The cookies store from Next.js headers\n * @returns The drive view mode (\"grid\" or \"list\") or undefined if not set\n */\nexport function getDriveViewModeFromCookies(cookiesStore: Awaited<ReturnType<typeof cookies>>) {\n return cookiesStore.get(DRIVE_VIEW_COOKIE)?.value as DriveViewMode | undefined;\n}\n"],"mappings":";;;;;;;;;AAWA,SAAgB,4BAA4B,cAAmD;AAC7F,QAAO,aAAa,IAAI,kBAAkB,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as nuqs_server0 from "nuqs/server";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/search-params.d.ts
|
|
4
|
+
declare const driveTreeSearchParams: {
|
|
5
|
+
parentId: nuqs_server0.SingleParserBuilder<string>;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { driveTreeSearchParams };
|
|
9
|
+
//# sourceMappingURL=search-params.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-params.d.mts","names":[],"sources":["../../src/lib/search-params.ts"],"mappings":";;;cAEa,qBAAA;YAEZ,YAAA,CAAA,mBAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-params.mjs","names":[],"sources":["../../src/lib/search-params.ts"],"sourcesContent":["import { parseAsString } from \"nuqs/server\";\n\nexport const driveTreeSearchParams = {\n parentId: parseAsString,\n};\n"],"mappings":";;;AAEA,MAAa,wBAAwB,EACnC,UAAU,eACX"}
|
|
@@ -0,0 +1,158 @@
|
|
|
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 };
|
|
158
|
+
//# sourceMappingURL=validators.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.mts","names":[],"sources":["../../src/lib/validators.ts"],"mappings":";;;;;AAQA;;cAAa,4BAAA,EAA4B,CAAA,CAAA,SAAA;;;;;KAK7B,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,4BAAA;AAAA,KACxC,uBAAA,GAA0B,CAAA,CAAE,KAAA,QAAa,4BAAA;;;;cAKxC,0BAAA,EAA0B,CAAA,CAAA,SAAA;;;KAG3B,oBAAA,GAAuB,CAAA,CAAE,KAAA,QAAa,0BAAA;AAAA,KACtC,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,0BAAA;;;;;cAMtC,0BAAA,EAA0B,CAAA,CAAA,SAAA;;;;;;;KAO3B,oBAAA,GAAuB,CAAA,CAAE,KAAA,QAAa,0BAAA;AAAA,KACtC,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,0BAAA;;;AAxBnD;;cA8Ba,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;;;KAQ5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,KACvC,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,2BAAA;;;;cAKvC,uBAAA,EAAuB,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAWxB,iBAAA,GAAoB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;;cAKlC,wBAAA,EAAwB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIzB,kBAAA,GAAqB,CAAA,CAAE,KAAA,QAAa,wBAAA;AAAA,KACpC,mBAAA,GAAsB,CAAA,CAAE,KAAA,QAAa,wBAAA;;;;cAKpC,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAI9B,4BAAA,GAA+B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,KAC9C,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,6BAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 };
|
|
66
|
+
//# sourceMappingURL=validators.mjs.map
|