@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.
Files changed (141) hide show
  1. package/dist/client.d.mts +5 -0
  2. package/dist/client.mjs +6 -0
  3. package/dist/components/content.d.mts +13 -0
  4. package/dist/components/content.mjs +17 -0
  5. package/dist/components/context.client.d.mts +13 -0
  6. package/dist/components/dnd.client.d.mts +16 -0
  7. package/dist/components/dnd.client.mjs +29 -0
  8. package/dist/components/grid-card.client.d.mts +46 -0
  9. package/dist/components/grid-card.client.mjs +173 -0
  10. package/dist/components/grid.client.d.mts +53 -0
  11. package/dist/components/grid.client.mjs +53 -0
  12. package/dist/components/navigation/breadcrumbs.client.d.mts +25 -0
  13. package/dist/components/navigation/breadcrumbs.client.mjs +51 -0
  14. package/dist/components/navigation/header.client.d.mts +27 -0
  15. package/dist/components/navigation/header.client.mjs +40 -0
  16. package/dist/components/navigation/toolbar.client.d.mts +23 -0
  17. package/dist/components/navigation/toolbar.client.mjs +34 -0
  18. package/dist/components/navigation/view-switcher.client.d.mts +9 -0
  19. package/dist/components/navigation/view-switcher.client.mjs +35 -0
  20. package/dist/components/selection.client.d.mts +27 -0
  21. package/dist/components/selection.client.mjs +36 -0
  22. package/dist/components/view.client.d.mts +25 -0
  23. package/dist/components/view.client.mjs +43 -0
  24. package/dist/config/filters.mjs +14 -0
  25. package/dist/config/types.mjs +60 -0
  26. package/dist/google/client.d.mts +8 -0
  27. package/dist/google/client.mjs +9 -0
  28. package/dist/google/server.d.mts +3 -0
  29. package/dist/google/server.mjs +4 -0
  30. package/dist/google.d.mts +6 -0
  31. package/dist/google.mjs +7 -0
  32. package/dist/index.d.mts +7 -0
  33. package/dist/index.mjs +7 -0
  34. package/dist/lib/constants.d.mts +11 -0
  35. package/dist/lib/constants.mjs +20 -0
  36. package/dist/lib/contracts.d.mts +100 -0
  37. package/dist/lib/dto.d.mts +117 -0
  38. package/dist/lib/dto.mjs +57 -0
  39. package/dist/lib/helpers.d.mts +17 -0
  40. package/dist/lib/helpers.mjs +36 -0
  41. package/dist/lib/helpers.server.d.mts +13 -0
  42. package/dist/lib/helpers.server.mjs +15 -0
  43. package/dist/lib/search-params.d.mts +8 -0
  44. package/dist/lib/search-params.mjs +7 -0
  45. package/dist/lib/validators.d.mts +157 -0
  46. package/dist/lib/validators.mjs +65 -0
  47. package/dist/local/client.d.mts +13 -0
  48. package/dist/local/client.mjs +13 -0
  49. package/dist/local/server.d.mts +4 -0
  50. package/dist/local/server.mjs +5 -0
  51. package/dist/local.d.mts +8 -0
  52. package/dist/local.mjs +9 -0
  53. package/dist/providers/google/components/command-file-update.d.mts +21 -0
  54. package/dist/providers/google/components/command-file-update.mjs +51 -0
  55. package/dist/providers/google/components/command-folder-create.d.mts +21 -0
  56. package/dist/providers/google/components/command-folder-create.mjs +58 -0
  57. package/dist/providers/google/components/command-folder-update.d.mts +21 -0
  58. package/dist/providers/google/components/command-folder-update.mjs +51 -0
  59. package/dist/providers/google/components/content.client.d.mts +9 -0
  60. package/dist/providers/google/components/content.client.mjs +10 -0
  61. package/dist/providers/google/components/navigation.client.d.mts +15 -0
  62. package/dist/providers/google/components/navigation.client.mjs +17 -0
  63. package/dist/providers/google/components/provider.client.d.mts +32 -0
  64. package/dist/providers/google/components/provider.client.mjs +42 -0
  65. package/dist/providers/google/components/view.client.d.mts +40 -0
  66. package/dist/providers/google/components/view.client.mjs +96 -0
  67. package/dist/providers/google/config/columns-data.d.mts +7 -0
  68. package/dist/providers/google/config/columns-data.mjs +69 -0
  69. package/dist/providers/google/config/filters.d.mts +15 -0
  70. package/dist/providers/google/config/filters.mjs +7 -0
  71. package/dist/providers/google/lib/constants.mjs +12 -0
  72. package/dist/providers/google/lib/dto.d.mts +38 -0
  73. package/dist/providers/google/lib/dto.mjs +65 -0
  74. package/dist/providers/google/lib/helpers.mjs +38 -0
  75. package/dist/providers/google/lib/router.server.d.mts +611 -0
  76. package/dist/providers/google/lib/router.server.mjs +39 -0
  77. package/dist/providers/google/lib/search-params.d.mts +14 -0
  78. package/dist/providers/google/lib/search-params.mjs +11 -0
  79. package/dist/providers/google/lib/service.server.d.mts +185 -0
  80. package/dist/providers/google/lib/service.server.mjs +610 -0
  81. package/dist/providers/google/lib/validators.d.mts +302 -0
  82. package/dist/providers/google/lib/validators.mjs +58 -0
  83. package/dist/providers/local/components/command-file-update.d.mts +17 -0
  84. package/dist/providers/local/components/command-file-update.mjs +47 -0
  85. package/dist/providers/local/components/command-file-upload.d.mts +10 -0
  86. package/dist/providers/local/components/command-file-upload.mjs +34 -0
  87. package/dist/providers/local/components/command-folder-create.d.mts +17 -0
  88. package/dist/providers/local/components/command-folder-create.mjs +54 -0
  89. package/dist/providers/local/components/command-folder-update.d.mts +17 -0
  90. package/dist/providers/local/components/command-folder-update.mjs +47 -0
  91. package/dist/providers/local/components/content.client.d.mts +6 -0
  92. package/dist/providers/local/components/content.client.mjs +7 -0
  93. package/dist/providers/local/components/navigation.client.d.mts +15 -0
  94. package/dist/providers/local/components/navigation.client.mjs +17 -0
  95. package/dist/providers/local/components/provider.client.d.mts +39 -0
  96. package/dist/providers/local/components/provider.client.mjs +60 -0
  97. package/dist/providers/local/components/upload-zone-context.client.d.mts +37 -0
  98. package/dist/providers/local/components/upload-zone-context.client.mjs +22 -0
  99. package/dist/providers/local/components/upload-zone.client.d.mts +29 -0
  100. package/dist/providers/local/components/upload-zone.client.mjs +146 -0
  101. package/dist/providers/local/components/view.client.d.mts +31 -0
  102. package/dist/providers/local/components/view.client.mjs +90 -0
  103. package/dist/providers/local/config/columns-data.d.mts +7 -0
  104. package/dist/providers/local/config/columns-data.mjs +69 -0
  105. package/dist/providers/local/config/filters.d.mts +25 -0
  106. package/dist/providers/local/config/filters.mjs +14 -0
  107. package/dist/providers/local/lib/constants.d.mts +11 -0
  108. package/dist/providers/local/lib/constants.mjs +28 -0
  109. package/dist/providers/local/lib/helpers.d.mts +44 -0
  110. package/dist/providers/local/lib/helpers.mjs +109 -0
  111. package/dist/providers/local/lib/route-handler.server.d.mts +33 -0
  112. package/dist/providers/local/lib/route-handler.server.mjs +113 -0
  113. package/dist/providers/local/lib/router.server.d.mts +41647 -0
  114. package/dist/providers/local/lib/router.server.mjs +51 -0
  115. package/dist/providers/local/lib/schema.d.mts +1112 -0
  116. package/dist/providers/local/lib/schema.mjs +70 -0
  117. package/dist/providers/local/lib/search-params.d.mts +13 -0
  118. package/dist/providers/local/lib/search-params.mjs +8 -0
  119. package/dist/providers/local/lib/service.server.d.mts +488 -0
  120. package/dist/providers/local/lib/service.server.mjs +667 -0
  121. package/dist/providers/local/lib/upload.client.d.mts +61 -0
  122. package/dist/providers/local/lib/upload.client.mjs +99 -0
  123. package/dist/providers/local/lib/validators.d.mts +453 -0
  124. package/dist/providers/local/lib/validators.mjs +95 -0
  125. package/dist/server.d.mts +2 -0
  126. package/dist/server.mjs +3 -0
  127. package/package.json +45 -46
  128. package/src/components/grid-card.client.tsx +17 -12
  129. package/src/components/selection.client.tsx +1 -2
  130. package/src/config/types.tsx +1 -1
  131. package/src/providers/google/components/command-file-update.tsx +2 -2
  132. package/src/providers/google/components/command-folder-create.tsx +2 -2
  133. package/src/providers/google/components/command-folder-update.tsx +2 -2
  134. package/src/providers/google/components/view.client.tsx +1 -7
  135. package/src/providers/google/lib/helpers.ts +0 -9
  136. package/src/providers/google/lib/service.server.ts +1 -3
  137. package/src/providers/local/components/command-file-update.tsx +2 -2
  138. package/src/providers/local/components/command-folder-create.tsx +2 -2
  139. package/src/providers/local/components/command-folder-update.tsx +2 -2
  140. package/src/providers/local/components/upload-zone.client.tsx +1 -1
  141. package/src/providers/local/lib/helpers.ts +0 -1
@@ -0,0 +1,185 @@
1
+ import { DriveArchive, DriveDirectUpload, DriveNodeMutations, DriveReader } from "../../../lib/contracts.mjs";
2
+ import { CreateGoogleDriveFolderInput, GetGoogleDriveNodesByParentIdSchema, GoogleDriveNode, GoogleDriveNodeChild, GoogleDriveNodeWithChildren, ListGoogleDriveTreeSchema, UpdateGoogleDriveNodeInput, UploadGoogleDriveFileInput } from "./validators.mjs";
3
+ import { TDatabaseSchema } from "@tulip-systems/core/config";
4
+ import { ObjectBodyInput } from "@tulip-systems/core/storage";
5
+ import { TableQueryResponse } from "@tulip-systems/core/data-tables/server";
6
+ import { drive_v3 } from "googleapis";
7
+ import { Database } from "@tulip-systems/core/database/server";
8
+
9
+ //#region src/providers/google/lib/service.server.d.ts
10
+ /**
11
+ * Drive Service Config
12
+ */
13
+ type GoogleDriveConfig<TSchema extends TDatabaseSchema> = Pick<drive_v3.Options, "auth"> & {
14
+ db: Database<TSchema>;
15
+ };
16
+ /**
17
+ * Google Drive provider.
18
+ *
19
+ * A single service instance can operate on multiple Google shared drives. The
20
+ * shared Drive `namespace` is the Google `driveId`, so namespace is supplied by
21
+ * method inputs rather than by the constructor.
22
+ */
23
+ declare class GoogleDrive<TSchema extends TDatabaseSchema> implements DriveReader<GoogleDriveNode, GoogleDriveNodeWithChildren, GoogleDriveNodeChild>, DriveNodeMutations<GoogleDriveNode>, DriveDirectUpload<GoogleDriveNode, ObjectBodyInput>, DriveArchive<GoogleDriveNode> {
24
+ #private;
25
+ readonly client: drive_v3.Drive;
26
+ constructor(config: GoogleDriveConfig<TSchema>);
27
+ /**
28
+ * Loads a single Google Drive file/folder by its Google file id.
29
+ *
30
+ * Returns `null` when Google reports the file does not exist or is not visible to
31
+ * the authenticated account. Other Google API errors are allowed to bubble up so
32
+ * callers do not accidentally treat permission, quota, or transport failures as
33
+ * missing data.
34
+ *
35
+ * The returned Google metadata is normalized into the shared Drive node shape by
36
+ * `#toNode`, which also validates that Google returned the minimum metadata we
37
+ * need to identify the node and its namespace.
38
+ */
39
+ getNodeById(id: string): Promise<GoogleDriveNode | null>;
40
+ /**
41
+ * Loads a node and its direct children within a namespace.
42
+ *
43
+ * Google Drive does not enforce our provider-neutral `namespace` at `files.get`
44
+ * time, so the node is fetched by id first and then checked against the requested
45
+ * namespace/shared drive. A missing node or namespace mismatch returns
46
+ * `null`, matching the shared Drive reader contract.
47
+ *
48
+ * Only direct children are loaded. Recursive traversal is handled separately by
49
+ * `getNodeChildren`.
50
+ */
51
+ getNodeWithChildren(input: {
52
+ id: string;
53
+ namespace: string;
54
+ }): Promise<GoogleDriveNodeWithChildren | null>;
55
+ /**
56
+ * Lists the direct children of a parent folder.
57
+ *
58
+ * This is the Google Drive implementation of the shared Drive reader method. It
59
+ * delegates to `#listChildren`, which translates the provider-neutral filters,
60
+ * search, and sorting options into a Google Drive `files.list` query.
61
+ *
62
+ * Only immediate children are returned. Recursive traversal is handled by
63
+ * `getNodeChildren`.
64
+ */
65
+ getNodesByParentId(input: GetGoogleDriveNodesByParentIdSchema): Promise<GoogleDriveNode[]>;
66
+ /**
67
+ * Lists one page of Google Drive nodes for a tree/folder view.
68
+ *
69
+ * The public input uses the shared table-query shape: pagination, sorting,
70
+ * search, and drive filters. This method translates that input into the internal
71
+ * Google Drive list request shape used by `#listNodes`.
72
+ *
73
+ * Google Drive does not expose a native tree endpoint. This returns only the
74
+ * direct children for the requested `parentId`; recursive traversal is handled
75
+ * by `getNodeChildren`.
76
+ */
77
+ listTree(input: ListGoogleDriveTreeSchema): Promise<TableQueryResponse<GoogleDriveNode>>;
78
+ /**
79
+ * Resolves the breadcrumb parent chain for a Google Drive node.
80
+ *
81
+ * A `null` id represents the namespace root and therefore has no parent chain.
82
+ * The returned list is ordered from the root-most ancestor to the requested
83
+ * node, matching breadcrumb display order.
84
+ */
85
+ getFolderParents(input: {
86
+ id: string | null;
87
+ namespace: string;
88
+ }): Promise<Array<Pick<GoogleDriveNode, "id" | "name" | "parentId"> & {
89
+ depth: number;
90
+ }>>;
91
+ /**
92
+ * Resolves the subtree for one or more Google Drive nodes.
93
+ */
94
+ getNodeChildren(ids: string[]): Promise<GoogleDriveNodeChild[]>;
95
+ /**
96
+ * Creates a Google Drive folder in the requested parent.
97
+ *
98
+ * Google Drive represents folders as files with the special folder MIME type.
99
+ * Creating a folder therefore uses the same `files.create` endpoint as file
100
+ * uploads, but without a media body.
101
+ *
102
+ * A `null` or missing `parentId` means "create in the namespace root", where the
103
+ * namespace is the shared drive id/root folder used by this provider.
104
+ */
105
+ createFolder(input: CreateGoogleDriveFolderInput): Promise<GoogleDriveNode>;
106
+ /**
107
+ * Uploads a file body to Google Drive and returns the created node.
108
+ *
109
+ * Google Drive creates files through `files.create` with two parts:
110
+ * metadata in `requestBody` and the actual file content in `media.body`.
111
+ *
112
+ * A `null` or missing `parentId` means "upload to the namespace root", where the
113
+ * namespace is the Google shared drive/root id used by this provider.
114
+ *
115
+ * The input body can be a provider-neutral object body type. `toReadable`
116
+ * normalizes it into a Node.js readable stream because the Google API client
117
+ * expects stream-compatible media bodies.
118
+ */
119
+ uploadFile(input: UploadGoogleDriveFileInput & {
120
+ body: ObjectBodyInput;
121
+ }): Promise<GoogleDriveNode>;
122
+ /**
123
+ * Updates mutable Google Drive node metadata.
124
+ *
125
+ * Google Drive uses `files.update` for metadata changes such as renaming and
126
+ * moving a file/folder to or from the trash. The shared Drive API calls this
127
+ * soft-delete state "archived"; Google Drive exposes it as `trashed`, so
128
+ * `data.isArchived` is translated directly to Google's `trashed` field.
129
+ *
130
+ * Parent changes are intentionally not handled here. Moving a node requires
131
+ * Google Drive's `addParents`/`removeParents` API and should go through
132
+ * `moveNode` instead.
133
+ */
134
+ updateNode(id: string, data: UpdateGoogleDriveNodeInput): Promise<GoogleDriveNode>;
135
+ /**
136
+ * Moves a Google Drive node to another parent folder.
137
+ *
138
+ * Google Drive does not allow parent changes through the normal metadata
139
+ * `requestBody`. Moving requires `addParents` and `removeParents` on
140
+ * `files.update`, so this operation is intentionally separate from `updateNode`.
141
+ *
142
+ * A `null` parent means "move to the namespace root". For this provider, the
143
+ * namespace is the Google shared drive/root id.
144
+ */
145
+ moveNode(input: {
146
+ id: string;
147
+ parentId: string | null;
148
+ }): Promise<GoogleDriveNode>;
149
+ /**
150
+ * Moves Google Drive nodes to trash.
151
+ *
152
+ * The shared Drive API calls this "archive", while Google Drive calls the same
153
+ * state `trashed`. This is a soft-delete operation; nodes can be restored with
154
+ * `restoreNodes`.
155
+ */
156
+ archiveNodes(ids: string[]): Promise<GoogleDriveNode[]>;
157
+ /**
158
+ * Restores Google Drive nodes from trash.
159
+ *
160
+ * This reverses `archiveNodes` by setting Google Drive's `trashed` flag back to
161
+ * `false`.
162
+ */
163
+ restoreNodes(ids: string[]): Promise<GoogleDriveNode[]>;
164
+ /**
165
+ * Permanently deletes a Google Drive node.
166
+ *
167
+ * This uses Google Drive `files.delete`, which removes the file/folder rather
168
+ * than moving it to trash. Soft deletion/trashing should go through the archive
169
+ * method instead.
170
+ */
171
+ deleteNode(id: string): Promise<void>;
172
+ /**
173
+ * Permanently deletes multiple Google Drive nodes.
174
+ *
175
+ * Duplicate ids are removed before issuing delete requests so the same Google
176
+ * file is not deleted more than once. Deletions are executed in parallel because
177
+ * Google Drive exposes deletion as one request per file id.
178
+ *
179
+ * This is a hard delete. Soft deletion/trashing should go through the archive
180
+ * method instead.
181
+ */
182
+ deleteNodes(ids: string[]): Promise<void>;
183
+ }
184
+ //#endregion
185
+ export { GoogleDrive, GoogleDriveConfig };