@mgamadeus/ddd-clouddrive 0.0.0-stage → 0.1.0-rc.22

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.
@@ -0,0 +1,787 @@
1
+ import { ApiQueryHook, ApiMutationHook, InjectableBaseApi, StaticQueryFailure, InjectedRequest } from '@mgamadeus/ddd-admin-ui/logic/pure';
2
+
3
+ type DriveNodeType = 'FOLDER' | 'FILE' | 'LINK';
4
+ type DriveSpaceAudience = 'INTERNAL' | 'SHARED';
5
+ /**
6
+ * What a content URL is for (ddd-clouddrive ≥ rc.11 records `INLINE` as "viewed" and `DOWNLOAD` as "downloaded";
7
+ * `THUMBNAIL` is never recorded).
8
+ */
9
+ type DriveContentPurpose = 'DOWNLOAD' | 'INLINE' | 'THUMBNAIL';
10
+ /** Who the drive answers as: staff (`internal`, default) or a partner audience (`shared`, ddd-clouddrive ≥ rc.11). */
11
+ type CloudDriveAudience = 'internal' | 'shared';
12
+ interface DriveSpace {
13
+ id: number;
14
+ title?: string | null;
15
+ spaceKind?: string | null;
16
+ audience?: DriveSpaceAudience | null;
17
+ rootNodeId?: number | null;
18
+ usedBytes?: number | null;
19
+ quotaBytes?: number | null;
20
+ fileCount?: number | null;
21
+ folderCount?: number | null;
22
+ }
23
+ interface DriveNode {
24
+ id: number;
25
+ driveSpaceId: number;
26
+ parentNodeId?: number | null;
27
+ nodeType: DriveNodeType;
28
+ name: string;
29
+ sizeBytes?: number | null;
30
+ contentType?: string | null;
31
+ sha256?: string | null;
32
+ versionNumber?: number | null;
33
+ currentVersionId?: number | null;
34
+ latestVersionId?: number | null;
35
+ tags?: string | null;
36
+ description?: string | null;
37
+ isSystem?: boolean | null;
38
+ isContentUntrusted?: boolean | null;
39
+ childCount?: number | null;
40
+ trashedAt?: string | null;
41
+ changeHistory?: {
42
+ createdTime?: string | null;
43
+ modifiedTime?: string | null;
44
+ } | null;
45
+ }
46
+ interface DriveFileVersion {
47
+ id: number;
48
+ versionNumber: number;
49
+ sizeBytes?: number | null;
50
+ comment?: string | null;
51
+ origin?: string | null;
52
+ changeHistory?: {
53
+ createdTime?: string | null;
54
+ } | null;
55
+ }
56
+ interface DrivePresignedRequest {
57
+ method: 'PUT' | 'GET';
58
+ url: string;
59
+ headers?: Record<string, string>;
60
+ expiresAt?: string | null;
61
+ }
62
+ interface DriveUploadPartRequest {
63
+ partNumber: number;
64
+ request: DrivePresignedRequest;
65
+ }
66
+ interface DriveUploadReservation {
67
+ driveBlobId: number;
68
+ sizeBytes: number;
69
+ uploadRequest?: DrivePresignedRequest | null;
70
+ isMultipart?: boolean;
71
+ partSizeBytes?: number;
72
+ partCount?: number;
73
+ partRequests?: {
74
+ elements?: DriveUploadPartRequest[];
75
+ } | null;
76
+ isContentKnown?: boolean;
77
+ }
78
+ interface DriveContentGrant {
79
+ purpose: string;
80
+ url: string;
81
+ expiresAt?: string | null;
82
+ fileName: string;
83
+ sizeBytes?: number | null;
84
+ contentType?: string | null;
85
+ }
86
+ interface DriveFileCard {
87
+ reference: string;
88
+ driveSpaceId: number;
89
+ name: string;
90
+ path: string;
91
+ isFolder: boolean;
92
+ sizeBytes?: number | null;
93
+ contentType?: string | null;
94
+ modifiedAt?: string | null;
95
+ versionNumber?: number | null;
96
+ childCount?: number | null;
97
+ state?: string | null;
98
+ inlineUrl?: string | null;
99
+ downloadUrl?: string | null;
100
+ thumbnailUrl?: string | null;
101
+ urlsExpireAt?: string | null;
102
+ /** The file's place in the host's drive screen (`CloudDrive.settings.adminLinkTemplate`; ddd-clouddrive ≥ 0.1.0-rc.14). */
103
+ adminLink?: string | null;
104
+ }
105
+ interface DriveSpacesResponse {
106
+ driveSpaces: {
107
+ elements?: DriveSpace[];
108
+ };
109
+ /** The spaces with display name, group, quota and the viewer's rights (ddd-clouddrive ≥ 0.1.0-rc.10). */
110
+ items?: {
111
+ elements?: DriveSpaceListItem[];
112
+ } | null;
113
+ }
114
+ interface DriveNodesResponse {
115
+ driveNodes: {
116
+ elements?: DriveNode[];
117
+ };
118
+ /** The same nodes as list items (ddd-clouddrive ≥ 0.1.0-rc.10). */
119
+ items?: {
120
+ elements?: DriveNodeListItem[];
121
+ } | null;
122
+ nextCursor?: string | null;
123
+ }
124
+ interface DriveNodeResponse {
125
+ driveNode: DriveNode;
126
+ path: string;
127
+ /** The folders above the node, the root first and its own folder last (mgamadeus/ddd-clouddrive ≥ 0.1.0-rc.3). */
128
+ ancestors?: {
129
+ elements?: DriveNode[];
130
+ } | null;
131
+ driveFileVersions?: {
132
+ elements?: DriveFileVersion[];
133
+ } | null;
134
+ /** The node as a list item (ddd-clouddrive ≥ 0.1.0-rc.10). */
135
+ item?: DriveNodeListItem | null;
136
+ isConflict?: boolean | null;
137
+ conflictReason?: string | null;
138
+ }
139
+ interface DriveUploadReservationResponse {
140
+ reservation: DriveUploadReservation;
141
+ }
142
+ interface DriveContentGrantResponse {
143
+ grant: DriveContentGrant;
144
+ }
145
+ interface DriveFileCardsResponse {
146
+ cards: {
147
+ elements?: DriveFileCard[];
148
+ };
149
+ }
150
+ interface DriveChildrenArg extends DriveListFilters {
151
+ driveSpaceId: number;
152
+ folderNodeId?: number | null;
153
+ cursor?: string | null;
154
+ limit?: number;
155
+ includeSystem?: boolean;
156
+ }
157
+ interface DriveSearchArg extends Omit<DriveListFilters, 'query' | 'recursive'> {
158
+ driveSpaceId: number;
159
+ query: string;
160
+ cursor?: string | null;
161
+ limit?: number;
162
+ }
163
+ interface DriveNodeIdArg {
164
+ driveNodeId: number;
165
+ }
166
+ interface DriveFolderCreateArg {
167
+ driveSpaceId: number;
168
+ parentNodeId?: number | null;
169
+ name: string;
170
+ }
171
+ interface DriveUploadReserveArg {
172
+ driveSpaceId: number;
173
+ sizeBytes: number;
174
+ contentType?: string | null;
175
+ contentMd5?: string | null;
176
+ sha256?: string | null;
177
+ idempotencyKey?: string | null;
178
+ }
179
+ interface DriveUploadCompleteArg {
180
+ driveBlobId: number;
181
+ folderNodeId?: number | null;
182
+ name: string;
183
+ comment?: string | null;
184
+ expectedLatestVersionId?: number | null;
185
+ replaceExisting?: boolean;
186
+ }
187
+ interface DriveContentArg {
188
+ driveNodeId: number;
189
+ purpose?: DriveContentPurpose;
190
+ versionId?: number | null;
191
+ }
192
+ interface DriveNodeMoveArg {
193
+ driveNodeId: number;
194
+ targetFolderNodeId?: number | null;
195
+ name?: string | null;
196
+ }
197
+ interface DriveFileCardsArg {
198
+ references: string[];
199
+ }
200
+ /** The file families of the drive (from the content type and the extension). */
201
+ type DriveFileFamily = 'PDF' | 'SPREADSHEET' | 'DOCUMENT' | 'PRESENTATION' | 'TEXT' | 'IMAGE' | 'VECTOR' | 'VIDEO' | 'ARCHIVE';
202
+ /** The scan state a file shows (of its current version, else of its newest one). */
203
+ /** `BLOCKED` (ddd-clouddrive ≥ rc.12): refused by the space's type policy; `INFECTED`: malware. */
204
+ type DriveScanStatus = 'UPLOADING' | 'PENDING' | 'CLEAN' | 'INFECTED' | 'BLOCKED' | 'FAILED' | 'PURGING';
205
+ /** One file or folder as the lists draw it (`DriveNodeListItem`); null values are left out of the JSON. */
206
+ interface DriveNodeListItem {
207
+ id: number;
208
+ driveSpaceId: number;
209
+ parentNodeId?: number | null;
210
+ nodeType: DriveNodeType;
211
+ name: string;
212
+ /** Lower case without the dot; `''` for folders. */
213
+ extension?: string;
214
+ family?: DriveFileFamily | null;
215
+ contentType?: string | null;
216
+ sizeBytes?: number | null;
217
+ versionNumber?: number | null;
218
+ childCount?: number | null;
219
+ description?: string | null;
220
+ tags?: string[];
221
+ scanStatus?: DriveScanStatus | null;
222
+ hasPendingVersion?: boolean;
223
+ /** The newest version while it is not the current one (ddd-clouddrive ≥ rc.12): number, check state, reason. */
224
+ latestVersionNumber?: number | null;
225
+ latestVersionScanStatus?: DriveScanStatus | null;
226
+ latestVersionStateReason?: string | null;
227
+ hasWorkingCopyChanges?: boolean;
228
+ isContentUntrusted?: boolean;
229
+ isSystem?: boolean;
230
+ /** Only for released JPEG, PNG, GIF or WebP. */
231
+ thumbnailUrl?: string | null;
232
+ createdByAccountId?: number | null;
233
+ createdByName?: string | null;
234
+ /** ddd-clouddrive ≥ rc.20: the account the creator acted for (impersonation); null otherwise. */
235
+ createdOnBehalfOfAccountId?: number | null;
236
+ createdOnBehalfOfName?: string | null;
237
+ createdAt?: string | null;
238
+ updatedAt?: string | null;
239
+ trashedAt?: string | null;
240
+ trashedByAccountId?: number | null;
241
+ trashedByName?: string | null;
242
+ purgeAfter?: string | null;
243
+ }
244
+ /** What a space holds and allows (`DriveSpaceQuota`). */
245
+ interface DriveSpaceQuota {
246
+ usedBytes: number;
247
+ quotaBytes: number;
248
+ maxFileSizeBytes: number;
249
+ fileCount: number;
250
+ folderCount: number;
251
+ trashRetentionDays: number;
252
+ keptVersionCount: number;
253
+ versionRetentionDays: number;
254
+ /** The quota that applies (ddd-clouddrive ≥ rc.12; equals `quotaBytes`). */
255
+ effectiveQuotaBytes?: number | null;
256
+ /** The usage split (ddd-clouddrive ≥ rc.12; absent before): current versions, older versions, trash, uploads being checked. */
257
+ currentVersionBytes?: number | null;
258
+ olderVersionBytes?: number | null;
259
+ trashedBytes?: number | null;
260
+ pendingBytes?: number | null;
261
+ }
262
+ /** One space as the picker and the file manager read it (`DriveSpaceListItem`). */
263
+ interface DriveSpaceListItem {
264
+ id: number;
265
+ title?: string | null;
266
+ /** The name to show (the host may set it, e.g. the owning record's name). */
267
+ displayName: string;
268
+ /** The group the picker files the space under; `null` = no group. */
269
+ groupLabel?: string | null;
270
+ /** The group to show (ddd-clouddrive ≥ rc.12; preferred over `groupLabel`). */
271
+ displayGroup?: string | null;
272
+ spaceKind?: string | null;
273
+ audience?: DriveSpaceAudience | null;
274
+ rootNodeId?: number | null;
275
+ quota: DriveSpaceQuota;
276
+ canWrite: boolean;
277
+ canManage: boolean;
278
+ }
279
+ /** One stored version of a file (`DriveFileVersionListItem`), newest first. */
280
+ interface DriveFileVersionListItem {
281
+ id: number;
282
+ driveNodeId: number;
283
+ versionNumber: number;
284
+ sizeBytes?: number | null;
285
+ contentType?: string | null;
286
+ /** Free text; null when the version carries a system note (ddd-clouddrive ≥ rc.19). */
287
+ comment?: string | null;
288
+ /** RESTORED_FROM_VERSION, TRANSFERRED_FROM_SPACE, COPIED_FROM_PATH (ddd-clouddrive ≥ rc.19). */
289
+ commentCode?: string | null;
290
+ commentParameters?: DriveFileVersionCommentParameters | null;
291
+ origin?: string | null;
292
+ authorAccountId?: number | null;
293
+ authorName?: string | null;
294
+ /** ddd-clouddrive ≥ rc.20: the account the author acted for (impersonation); null otherwise. */
295
+ onBehalfOfAccountId?: number | null;
296
+ onBehalfOfName?: string | null;
297
+ createdAt?: string | null;
298
+ scanStatus?: DriveScanStatus | null;
299
+ scanDetail?: string | null;
300
+ isCurrent: boolean;
301
+ isLatest: boolean;
302
+ isRestorable: boolean;
303
+ }
304
+ /** The values of a version's system note (`DriveFileVersionCommentParameters`); staff-only values are null for partners. */
305
+ interface DriveFileVersionCommentParameters {
306
+ versionNumber?: number | null;
307
+ sourceSpaceDisplayName?: string | null;
308
+ sourcePath?: string | null;
309
+ }
310
+ /** One entry of a node's history (`DriveChangeEventListItem`). */
311
+ interface DriveChangeEventListItem {
312
+ id: number;
313
+ eventType: string;
314
+ occurredAt?: string | null;
315
+ actorAccountId?: number | null;
316
+ actorName?: string | null;
317
+ path?: string | null;
318
+ previousPath?: string | null;
319
+ driveFileVersionId?: number | null;
320
+ isFromWorkingCopy?: boolean;
321
+ /** `CHANGE` (a change of the node) or `ACTIVITY` (an access or a host event; ddd-clouddrive ≥ rc.11). */
322
+ eventSource?: string | null;
323
+ onBehalfOfAccountId?: number | null;
324
+ onBehalfOfName?: string | null;
325
+ /** `INTERNAL` or `SHARED` (who acted). */
326
+ audience?: string | null;
327
+ /** What an access opened (`INLINE`, `DOWNLOAD`). */
328
+ contentVariant?: string | null;
329
+ detail?: string | null;
330
+ /** The reader's public address (an access; sent to staff readers only, ddd-clouddrive ≥ rc.13). */
331
+ clientIp?: string | null;
332
+ }
333
+ /** `GET /spaces/{id}/resolve?path=` (ddd-clouddrive ≥ rc.14): where a path or `drive/<id>` leads. */
334
+ interface DriveLocationResolveResponse {
335
+ /** The space of the location (another one than asked for a mount path or a reference). */
336
+ driveSpaceId: number;
337
+ item?: DriveNodeListItem | null;
338
+ ancestors?: {
339
+ elements?: DriveNodeListItem[];
340
+ } | null;
341
+ /** The location inside its space, without a leading slash (`""` = the root). */
342
+ path: string;
343
+ adminLink?: string | null;
344
+ }
345
+ /** The 404 body of the resolve route. */
346
+ interface DriveLocationNotFoundBody {
347
+ error?: string;
348
+ driveSpaceId?: number | null;
349
+ path?: string | null;
350
+ deepestFolder?: DriveNodeListItem | null;
351
+ missingSegment?: string | null;
352
+ }
353
+ interface DriveLocationResolveArg {
354
+ driveSpaceId: number;
355
+ path: string;
356
+ }
357
+ /** What a bulk action did (`DriveNodeBulkResult`); counts include subtrees. */
358
+ interface DriveNodeBulkResult {
359
+ processedCount: number;
360
+ fileCount: number;
361
+ folderCount: number;
362
+ /** `true`: an empty-trash call stopped at its batch; call again. */
363
+ hasMore: boolean;
364
+ skipped?: {
365
+ elements?: {
366
+ driveNodeId: number;
367
+ reason: string;
368
+ }[];
369
+ } | null;
370
+ }
371
+ interface DriveListItemsResponse<TItem> {
372
+ items?: {
373
+ elements?: TItem[];
374
+ } | null;
375
+ }
376
+ interface DriveSpaceResponse {
377
+ driveSpace: DriveSpace;
378
+ item?: DriveSpaceListItem | null;
379
+ }
380
+ interface DriveFoldersResponse {
381
+ items: {
382
+ elements?: DriveNodeListItem[];
383
+ };
384
+ isTruncated: boolean;
385
+ }
386
+ interface DriveNodeBulkResponse {
387
+ result: DriveNodeBulkResult;
388
+ }
389
+ /** The orders of a list. */
390
+ type DriveListOrder = 'name' | 'created' | 'size';
391
+ /** The filters of `children` (and `search`); without any the folder answers as before. */
392
+ interface DriveListFilters {
393
+ /** The whole space instead of one folder (search, filters). */
394
+ recursive?: boolean;
395
+ /** A part of the name. */
396
+ query?: string;
397
+ family?: DriveFileFamily;
398
+ /** `Y-m-d`. */
399
+ createdFrom?: string;
400
+ /** `Y-m-d`. */
401
+ createdTo?: string;
402
+ createdByMe?: boolean;
403
+ orderBy?: DriveListOrder;
404
+ orderDirection?: 'asc' | 'desc';
405
+ }
406
+ interface DriveTrashArg {
407
+ driveSpaceId: number;
408
+ cursor?: string | null;
409
+ limit?: number;
410
+ }
411
+ interface DriveFoldersArg {
412
+ driveSpaceId: number;
413
+ includeSystem?: boolean;
414
+ }
415
+ interface DriveSpaceIdArg {
416
+ driveSpaceId: number;
417
+ }
418
+ interface DriveEventsArg {
419
+ driveNodeId: number;
420
+ limit?: number;
421
+ /** `changes` or `accesses` (ddd-clouddrive ≥ rc.11). */
422
+ eventGroup?: 'changes' | 'accesses';
423
+ /** Comma-separated event types. */
424
+ eventTypes?: string;
425
+ }
426
+ interface DriveVersionRestoreArg {
427
+ driveNodeId: number;
428
+ driveFileVersionId: number;
429
+ }
430
+ interface DriveNodesBulkArg {
431
+ driveSpaceId: number;
432
+ driveNodeIds: number[];
433
+ }
434
+ interface DriveNodesBulkMoveArg extends DriveNodesBulkArg {
435
+ /** Omitted = the space's root. */
436
+ targetFolderNodeId?: number | null;
437
+ }
438
+ interface DriveNodeMetadataArg {
439
+ driveNodeId: number;
440
+ tags?: string[] | null;
441
+ description?: string | null;
442
+ }
443
+
444
+ /** The cache tag type of the cloud drive operations (ids `SPACES`, `NODES`). */
445
+ declare const CLOUD_DRIVE_TAG = "AdminUiCloudDrive";
446
+ /** The hooks `createCloudDriveApi` returns; the drive screen takes them as its `api`. */
447
+ interface CloudDriveApi {
448
+ /** `GET /spaces/list`: the spaces the viewer may read. */
449
+ useDriveSpacesQuery: ApiQueryHook<void, DriveSpacesResponse>;
450
+ /** `GET /spaces/{id}/children?folderNodeId&cursor&limit&includeSystem`: one page of a folder. */
451
+ useDriveChildrenQuery: ApiQueryHook<DriveChildrenArg, DriveNodesResponse>;
452
+ /** `GET /spaces/{id}/search?query&limit`: names containing the query. */
453
+ useDriveSearchQuery: ApiQueryHook<DriveSearchArg, DriveNodesResponse>;
454
+ /** `GET /nodes/{id}`: one file or folder with its path and versions. */
455
+ useDriveNodeQuery: ApiQueryHook<DriveNodeIdArg, DriveNodeResponse>;
456
+ /** `POST /spaces/{id}/folders`. */
457
+ useCreateDriveFolderMutation: ApiMutationHook<DriveFolderCreateArg, DriveNodeResponse>;
458
+ /** `POST /spaces/{id}/uploads`: one presigned PUT or the parts of a multipart upload. */
459
+ useReserveDriveUploadMutation: ApiMutationHook<DriveUploadReserveArg, DriveUploadReservationResponse>;
460
+ /** `POST /uploads/{blobId}/complete`: the file (a conflict answers `isConflict`). */
461
+ useCompleteDriveUploadMutation: ApiMutationHook<DriveUploadCompleteArg, DriveNodeResponse>;
462
+ /** `GET /nodes/{id}/content?purpose&versionId`: a short-lived content URL (not cached). */
463
+ useDriveContentMutation: ApiMutationHook<DriveContentArg, DriveContentGrantResponse>;
464
+ /** `POST /nodes/{id}/move`. */
465
+ useMoveDriveNodeMutation: ApiMutationHook<DriveNodeMoveArg, DriveNodeResponse>;
466
+ /** `POST /nodes/{id}/trash`. */
467
+ useTrashDriveNodeMutation: ApiMutationHook<DriveNodeIdArg, DriveNodeResponse>;
468
+ /** `POST /nodes/{id}/restore`. */
469
+ useRestoreDriveNodeMutation: ApiMutationHook<DriveNodeIdArg, DriveNodeResponse>;
470
+ /** `POST /cards`: file cards with open, download and thumbnail URLs (the `DriveFiles` widget). */
471
+ useDriveFileCardsQuery: ApiQueryHook<DriveFileCardsArg, DriveFileCardsResponse>;
472
+ /** `GET /spaces/{id}`: one space with display name, quota and the viewer's rights. */
473
+ useDriveSpaceQuery: ApiQueryHook<DriveSpaceIdArg, DriveSpaceResponse>;
474
+ /** `GET /spaces/{id}/trash?cursor&limit`: the trashed top-level nodes, newest first. */
475
+ useDriveTrashQuery: ApiQueryHook<DriveTrashArg, DriveNodesResponse>;
476
+ /** `GET /spaces/{id}/folders?includeSystem`: every live folder of the space (root included), flat. */
477
+ useDriveFoldersQuery: ApiQueryHook<DriveFoldersArg, DriveFoldersResponse>;
478
+ /** `GET /nodes/{id}/versions`: the versions of a file, newest first. */
479
+ useDriveVersionsQuery: ApiQueryHook<DriveNodeIdArg, DriveListItemsResponse<DriveFileVersionListItem>>;
480
+ /** `GET /nodes/{id}/events?limit`: the newest changes of a node. */
481
+ useDriveEventsQuery: ApiQueryHook<DriveEventsArg, DriveListItemsResponse<DriveChangeEventListItem>>;
482
+ /** `POST /nodes/{id}/versions/{versionId}/restore`: a new current version with an older version's content. */
483
+ useRestoreDriveVersionMutation: ApiMutationHook<DriveVersionRestoreArg, DriveNodeResponse>;
484
+ /** `POST /nodes/{id}/metadata`: description and tags. */
485
+ useUpdateDriveNodeMetadataMutation: ApiMutationHook<DriveNodeMetadataArg, DriveNodeResponse>;
486
+ /** `POST /spaces/{id}/nodes/move`: up to 200 nodes into one folder (omitted = the root). */
487
+ useMoveDriveNodesMutation: ApiMutationHook<DriveNodesBulkMoveArg, DriveNodeBulkResponse>;
488
+ /** `POST /spaces/{id}/nodes/trash`. */
489
+ useTrashDriveNodesMutation: ApiMutationHook<DriveNodesBulkArg, DriveNodeBulkResponse>;
490
+ /** `POST /spaces/{id}/nodes/restore`. */
491
+ useRestoreDriveNodesMutation: ApiMutationHook<DriveNodesBulkArg, DriveNodeBulkResponse>;
492
+ /** `POST /spaces/{id}/nodes/purge` (manage right): deletes trashed nodes for good. */
493
+ usePurgeDriveNodesMutation: ApiMutationHook<DriveNodesBulkArg, DriveNodeBulkResponse>;
494
+ /** `POST /spaces/{id}/trash/empty` (manage right): one batch; `hasMore` asks for another call. */
495
+ useEmptyDriveTrashMutation: ApiMutationHook<DriveSpaceIdArg, DriveNodeBulkResponse>;
496
+ /** `GET /spaces/{id}/resolve?path=`: where a path, `drive/<id>` or a workspace path leads (not cached; 404 = a miss). */
497
+ useResolveDriveLocationMutation: ApiMutationHook<DriveLocationResolveArg, DriveLocationResolveResponse>;
498
+ /** Who the drive answers as (`createCloudDriveApi({ audience })`); absent = staff. */
499
+ audience?: CloudDriveAudience;
500
+ }
501
+ interface CreateCloudDriveApiOptions {
502
+ /** The host's RTK Query api (`createApi` with the React hooks module). */
503
+ baseApi: InjectableBaseApi;
504
+ /** Where the host mounts `CloudDriveControllerTrait`, without a trailing slash (`/api/admin/common/cloudDrive`). */
505
+ apiPrefix: string;
506
+ /**
507
+ * `shared`: the prefix is a partner mount (`getDriveAudience()` SHARED): the screen shows no staff-only control
508
+ * (purge, empty trash, space settings and maintenance). Default `internal`.
509
+ */
510
+ audience?: CloudDriveAudience;
511
+ }
512
+ /** The request of every operation, on `apiPrefix`. Pure: no RTK runtime. */
513
+ declare const buildCloudDriveRequests: (apiPrefix: string) => {
514
+ spaces: () => InjectedRequest;
515
+ children: ({ driveSpaceId, folderNodeId, cursor, limit, includeSystem, recursive, query, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }: DriveChildrenArg) => InjectedRequest;
516
+ search: ({ driveSpaceId, query, cursor, limit, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }: DriveSearchArg) => InjectedRequest;
517
+ space: ({ driveSpaceId }: DriveSpaceIdArg) => InjectedRequest;
518
+ trashList: ({ driveSpaceId, cursor, limit }: DriveTrashArg) => InjectedRequest;
519
+ folders: ({ driveSpaceId, includeSystem }: DriveFoldersArg) => InjectedRequest;
520
+ versions: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
521
+ events: ({ driveNodeId, limit, eventGroup, eventTypes }: DriveEventsArg) => InjectedRequest;
522
+ resolve: ({ driveSpaceId, path }: DriveLocationResolveArg) => InjectedRequest;
523
+ restoreVersion: ({ driveNodeId, driveFileVersionId }: DriveVersionRestoreArg) => InjectedRequest;
524
+ metadata: ({ driveNodeId, ...body }: DriveNodeMetadataArg) => InjectedRequest;
525
+ bulkMove: ({ driveSpaceId, ...body }: DriveNodesBulkMoveArg) => InjectedRequest;
526
+ bulkTrash: ({ driveSpaceId, ...body }: DriveNodesBulkArg) => InjectedRequest;
527
+ bulkRestore: ({ driveSpaceId, ...body }: DriveNodesBulkArg) => InjectedRequest;
528
+ bulkPurge: ({ driveSpaceId, ...body }: DriveNodesBulkArg) => InjectedRequest;
529
+ emptyTrash: ({ driveSpaceId }: DriveSpaceIdArg) => InjectedRequest;
530
+ node: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
531
+ createFolder: ({ driveSpaceId, ...body }: DriveFolderCreateArg) => InjectedRequest;
532
+ reserveUpload: ({ driveSpaceId, ...body }: DriveUploadReserveArg) => InjectedRequest;
533
+ completeUpload: ({ driveBlobId, ...body }: DriveUploadCompleteArg) => InjectedRequest;
534
+ content: ({ driveNodeId, purpose, versionId }: DriveContentArg) => InjectedRequest;
535
+ move: ({ driveNodeId, ...body }: DriveNodeMoveArg) => InjectedRequest;
536
+ trash: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
537
+ restore: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
538
+ cards: (body: DriveFileCardsArg) => InjectedRequest;
539
+ };
540
+ /** The operations as injected. Every write invalidates `NODES` and `SPACES` (counters); content URLs are never cached. */
541
+ declare const cloudDriveEndpointDefinitions: (apiPrefix: string) => {
542
+ readonly adminUiDriveSpaces: {
543
+ readonly kind: "query";
544
+ readonly request: () => InjectedRequest;
545
+ readonly providesTags: readonly [{
546
+ readonly type: "AdminUiCloudDrive";
547
+ readonly id: "SPACES";
548
+ }];
549
+ };
550
+ readonly adminUiDriveChildren: {
551
+ readonly kind: "query";
552
+ readonly request: ({ driveSpaceId, folderNodeId, cursor, limit, includeSystem, recursive, query, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }: DriveChildrenArg) => InjectedRequest;
553
+ readonly providesTags: readonly [{
554
+ readonly type: "AdminUiCloudDrive";
555
+ readonly id: "NODES";
556
+ }];
557
+ };
558
+ readonly adminUiDriveSearch: {
559
+ readonly kind: "query";
560
+ readonly request: ({ driveSpaceId, query, cursor, limit, family, createdFrom, createdTo, createdByMe, orderBy, orderDirection }: DriveSearchArg) => InjectedRequest;
561
+ readonly providesTags: readonly [{
562
+ readonly type: "AdminUiCloudDrive";
563
+ readonly id: "NODES";
564
+ }];
565
+ };
566
+ readonly adminUiDriveNode: {
567
+ readonly kind: "query";
568
+ readonly request: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
569
+ readonly providesTags: readonly [{
570
+ readonly type: "AdminUiCloudDrive";
571
+ readonly id: "NODES";
572
+ }];
573
+ };
574
+ readonly adminUiDriveFileCards: {
575
+ readonly kind: "query";
576
+ readonly request: (body: DriveFileCardsArg) => InjectedRequest;
577
+ readonly providesTags: readonly [{
578
+ readonly type: "AdminUiCloudDrive";
579
+ readonly id: "NODES";
580
+ }];
581
+ };
582
+ readonly adminUiDriveFolderCreate: {
583
+ readonly kind: "mutation";
584
+ readonly request: ({ driveSpaceId, ...body }: DriveFolderCreateArg) => InjectedRequest;
585
+ readonly invalidatesTags: readonly [{
586
+ readonly type: "AdminUiCloudDrive";
587
+ readonly id: "NODES";
588
+ }, {
589
+ readonly type: "AdminUiCloudDrive";
590
+ readonly id: "SPACES";
591
+ }];
592
+ };
593
+ readonly adminUiDriveUploadReserve: {
594
+ readonly kind: "mutation";
595
+ readonly request: ({ driveSpaceId, ...body }: DriveUploadReserveArg) => InjectedRequest;
596
+ };
597
+ readonly adminUiDriveUploadComplete: {
598
+ readonly kind: "mutation";
599
+ readonly request: ({ driveBlobId, ...body }: DriveUploadCompleteArg) => InjectedRequest;
600
+ readonly invalidatesTags: readonly [{
601
+ readonly type: "AdminUiCloudDrive";
602
+ readonly id: "NODES";
603
+ }, {
604
+ readonly type: "AdminUiCloudDrive";
605
+ readonly id: "SPACES";
606
+ }];
607
+ };
608
+ readonly adminUiDriveContent: {
609
+ readonly kind: "mutation";
610
+ readonly request: ({ driveNodeId, purpose, versionId }: DriveContentArg) => InjectedRequest;
611
+ };
612
+ readonly adminUiDriveNodeMove: {
613
+ readonly kind: "mutation";
614
+ readonly request: ({ driveNodeId, ...body }: DriveNodeMoveArg) => InjectedRequest;
615
+ readonly invalidatesTags: readonly [{
616
+ readonly type: "AdminUiCloudDrive";
617
+ readonly id: "NODES";
618
+ }];
619
+ };
620
+ readonly adminUiDriveNodeTrash: {
621
+ readonly kind: "mutation";
622
+ readonly request: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
623
+ readonly invalidatesTags: readonly [{
624
+ readonly type: "AdminUiCloudDrive";
625
+ readonly id: "NODES";
626
+ }, {
627
+ readonly type: "AdminUiCloudDrive";
628
+ readonly id: "SPACES";
629
+ }];
630
+ };
631
+ readonly adminUiDriveNodeRestore: {
632
+ readonly kind: "mutation";
633
+ readonly request: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
634
+ readonly invalidatesTags: readonly [{
635
+ readonly type: "AdminUiCloudDrive";
636
+ readonly id: "NODES";
637
+ }, {
638
+ readonly type: "AdminUiCloudDrive";
639
+ readonly id: "SPACES";
640
+ }];
641
+ };
642
+ readonly adminUiDriveSpace: {
643
+ readonly kind: "query";
644
+ readonly request: ({ driveSpaceId }: DriveSpaceIdArg) => InjectedRequest;
645
+ readonly providesTags: readonly [{
646
+ readonly type: "AdminUiCloudDrive";
647
+ readonly id: "SPACES";
648
+ }];
649
+ };
650
+ readonly adminUiDriveTrash: {
651
+ readonly kind: "query";
652
+ readonly request: ({ driveSpaceId, cursor, limit }: DriveTrashArg) => InjectedRequest;
653
+ readonly providesTags: readonly [{
654
+ readonly type: "AdminUiCloudDrive";
655
+ readonly id: "NODES";
656
+ }];
657
+ };
658
+ readonly adminUiDriveFolders: {
659
+ readonly kind: "query";
660
+ readonly request: ({ driveSpaceId, includeSystem }: DriveFoldersArg) => InjectedRequest;
661
+ readonly providesTags: readonly [{
662
+ readonly type: "AdminUiCloudDrive";
663
+ readonly id: "NODES";
664
+ }];
665
+ };
666
+ readonly adminUiDriveVersions: {
667
+ readonly kind: "query";
668
+ readonly request: ({ driveNodeId }: DriveNodeIdArg) => InjectedRequest;
669
+ readonly providesTags: readonly [{
670
+ readonly type: "AdminUiCloudDrive";
671
+ readonly id: "NODES";
672
+ }];
673
+ };
674
+ readonly adminUiDriveEvents: {
675
+ readonly kind: "query";
676
+ readonly request: ({ driveNodeId, limit, eventGroup, eventTypes }: DriveEventsArg) => InjectedRequest;
677
+ readonly providesTags: readonly [{
678
+ readonly type: "AdminUiCloudDrive";
679
+ readonly id: "NODES";
680
+ }];
681
+ };
682
+ readonly adminUiDriveVersionRestore: {
683
+ readonly kind: "mutation";
684
+ readonly request: ({ driveNodeId, driveFileVersionId }: DriveVersionRestoreArg) => InjectedRequest;
685
+ readonly invalidatesTags: readonly [{
686
+ readonly type: "AdminUiCloudDrive";
687
+ readonly id: "NODES";
688
+ }, {
689
+ readonly type: "AdminUiCloudDrive";
690
+ readonly id: "SPACES";
691
+ }];
692
+ };
693
+ readonly adminUiDriveNodeMetadata: {
694
+ readonly kind: "mutation";
695
+ readonly request: ({ driveNodeId, ...body }: DriveNodeMetadataArg) => InjectedRequest;
696
+ readonly invalidatesTags: readonly [{
697
+ readonly type: "AdminUiCloudDrive";
698
+ readonly id: "NODES";
699
+ }];
700
+ };
701
+ readonly adminUiDriveNodesMove: {
702
+ readonly kind: "mutation";
703
+ readonly request: ({ driveSpaceId, ...body }: DriveNodesBulkMoveArg) => InjectedRequest;
704
+ readonly invalidatesTags: readonly [{
705
+ readonly type: "AdminUiCloudDrive";
706
+ readonly id: "NODES";
707
+ }, {
708
+ readonly type: "AdminUiCloudDrive";
709
+ readonly id: "SPACES";
710
+ }];
711
+ };
712
+ readonly adminUiDriveNodesTrash: {
713
+ readonly kind: "mutation";
714
+ readonly request: ({ driveSpaceId, ...body }: DriveNodesBulkArg) => InjectedRequest;
715
+ readonly invalidatesTags: readonly [{
716
+ readonly type: "AdminUiCloudDrive";
717
+ readonly id: "NODES";
718
+ }, {
719
+ readonly type: "AdminUiCloudDrive";
720
+ readonly id: "SPACES";
721
+ }];
722
+ };
723
+ readonly adminUiDriveNodesRestore: {
724
+ readonly kind: "mutation";
725
+ readonly request: ({ driveSpaceId, ...body }: DriveNodesBulkArg) => InjectedRequest;
726
+ readonly invalidatesTags: readonly [{
727
+ readonly type: "AdminUiCloudDrive";
728
+ readonly id: "NODES";
729
+ }, {
730
+ readonly type: "AdminUiCloudDrive";
731
+ readonly id: "SPACES";
732
+ }];
733
+ };
734
+ readonly adminUiDriveNodesPurge: {
735
+ readonly kind: "mutation";
736
+ readonly request: ({ driveSpaceId, ...body }: DriveNodesBulkArg) => InjectedRequest;
737
+ readonly invalidatesTags: readonly [{
738
+ readonly type: "AdminUiCloudDrive";
739
+ readonly id: "NODES";
740
+ }, {
741
+ readonly type: "AdminUiCloudDrive";
742
+ readonly id: "SPACES";
743
+ }];
744
+ };
745
+ readonly adminUiDriveTrashEmpty: {
746
+ readonly kind: "mutation";
747
+ readonly request: ({ driveSpaceId }: DriveSpaceIdArg) => InjectedRequest;
748
+ readonly invalidatesTags: readonly [{
749
+ readonly type: "AdminUiCloudDrive";
750
+ readonly id: "NODES";
751
+ }, {
752
+ readonly type: "AdminUiCloudDrive";
753
+ readonly id: "SPACES";
754
+ }];
755
+ };
756
+ readonly adminUiDriveResolve: {
757
+ readonly kind: "mutation";
758
+ readonly request: ({ driveSpaceId, path }: DriveLocationResolveArg) => InjectedRequest;
759
+ };
760
+ };
761
+ /**
762
+ * Injects the cloud drive operations into the host's RTK Query api and returns their hooks. Call it once at module
763
+ * scope: `export const cloudDriveApi = createCloudDriveApi({ baseApi: adminApi, apiPrefix: '/api/admin/common/cloudDrive' });`
764
+ */
765
+ declare const createCloudDriveApi: ({ baseApi, apiPrefix, audience }: CreateCloudDriveApiOptions) => CloudDriveApi;
766
+ /** Fixed answers of a `createStaticCloudDriveApi`; a query without one stays loading. */
767
+ interface StaticCloudDriveData {
768
+ spaces?: DriveSpacesResponse | StaticQueryFailure;
769
+ children?: (arg: DriveChildrenArg) => DriveNodesResponse | StaticQueryFailure | undefined;
770
+ search?: (arg: DriveSearchArg) => DriveNodesResponse | StaticQueryFailure | undefined;
771
+ node?: (arg: DriveNodeIdArg) => DriveNodeResponse | StaticQueryFailure | undefined;
772
+ cards?: (arg: DriveFileCardsArg) => DriveFileCardsResponse | StaticQueryFailure | undefined;
773
+ space?: (arg: DriveSpaceIdArg) => DriveSpaceResponse | StaticQueryFailure | undefined;
774
+ trash?: (arg: DriveTrashArg) => DriveNodesResponse | StaticQueryFailure | undefined;
775
+ folders?: (arg: DriveFoldersArg) => DriveFoldersResponse | StaticQueryFailure | undefined;
776
+ versions?: (arg: DriveNodeIdArg) => DriveListItemsResponse<DriveFileVersionListItem> | StaticQueryFailure | undefined;
777
+ events?: (arg: DriveEventsArg) => DriveListItemsResponse<DriveChangeEventListItem> | StaticQueryFailure | undefined;
778
+ /** The answer of a path lookup; `undefined` = not found. */
779
+ resolve?: (arg: DriveLocationResolveArg) => DriveLocationResolveResponse | undefined;
780
+ /** The audience the static api answers as. */
781
+ audience?: CloudDriveAudience;
782
+ }
783
+ /** A `CloudDriveApi` answering fixed payloads, without a store or a request; writes are refused. */
784
+ declare const createStaticCloudDriveApi: (data: StaticCloudDriveData) => CloudDriveApi;
785
+
786
+ export { CLOUD_DRIVE_TAG, buildCloudDriveRequests, cloudDriveEndpointDefinitions, createCloudDriveApi, createStaticCloudDriveApi };
787
+ export type { CloudDriveApi, CloudDriveAudience, CreateCloudDriveApiOptions, DriveChangeEventListItem, DriveChildrenArg, DriveContentArg, DriveContentGrant, DriveContentGrantResponse, DriveContentPurpose, DriveEventsArg, DriveFileCard, DriveFileCardsArg, DriveFileCardsResponse, DriveFileFamily, DriveFileVersion, DriveFileVersionCommentParameters, DriveFileVersionListItem, DriveFolderCreateArg, DriveFoldersArg, DriveFoldersResponse, DriveListFilters, DriveListItemsResponse, DriveListOrder, DriveLocationNotFoundBody, DriveLocationResolveArg, DriveLocationResolveResponse, DriveNode, DriveNodeBulkResponse, DriveNodeBulkResult, DriveNodeIdArg, DriveNodeListItem, DriveNodeMetadataArg, DriveNodeMoveArg, DriveNodeResponse, DriveNodeType, DriveNodesBulkArg, DriveNodesBulkMoveArg, DriveNodesResponse, DrivePresignedRequest, DriveScanStatus, DriveSearchArg, DriveSpace, DriveSpaceAudience, DriveSpaceIdArg, DriveSpaceListItem, DriveSpaceQuota, DriveSpaceResponse, DriveSpacesResponse, DriveTrashArg, DriveUploadCompleteArg, DriveUploadPartRequest, DriveUploadReservation, DriveUploadReservationResponse, DriveUploadReserveArg, DriveVersionRestoreArg, StaticCloudDriveData };