@finueva/drive 0.1.0

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,2101 @@
1
+ //#region src/generated/openapi.d.ts
2
+ interface operations {
3
+ listFolderChildren: {
4
+ parameters: {
5
+ query?: {
6
+ limit?: number;
7
+ cursor?: string;
8
+ };
9
+ header?: never;
10
+ path: {
11
+ workspaceId: string;
12
+ itemId: string;
13
+ };
14
+ cookie?: never;
15
+ };
16
+ requestBody?: never;
17
+ responses: {
18
+ /** @description At most 50 active children in stable item-ID order. */
19
+ 200: {
20
+ headers: {
21
+ [name: string]: unknown;
22
+ };
23
+ content: {
24
+ "application/json": {
25
+ items: {
26
+ itemId: string;
27
+ /** @enum {string} */
28
+ kind: "file" | "folder";
29
+ /**
30
+ * Format: finueva-safe-filename
31
+ * @description NFC-normalized filename of at most 255 Unicode code points and 255 UTF-8 bytes. Slash, backslash, control characters, U+2028/U+2029, trailing dot/space, dot entries, and Windows reserved base names are forbidden.
32
+ */
33
+ name: string;
34
+ parentItemId: string;
35
+ revision: number;
36
+ /** @enum {string} */
37
+ visibility: "workspace" | "restricted";
38
+ volumeId: string;
39
+ workspaceId: string;
40
+ }[];
41
+ nextCursor: string | null;
42
+ };
43
+ };
44
+ };
45
+ /** @description A valid Drive user bearer credential is required. */
46
+ 401: {
47
+ headers: {
48
+ [name: string]: unknown;
49
+ };
50
+ content: {
51
+ "application/json": {
52
+ error: {
53
+ code: string;
54
+ details: Record<string, never>;
55
+ message: string;
56
+ requestId: string;
57
+ };
58
+ } & {
59
+ error?: {
60
+ /** @enum {string} */
61
+ code?: "authentication_required";
62
+ /** @enum {string} */
63
+ message?: "Authentication is required.";
64
+ };
65
+ };
66
+ };
67
+ };
68
+ /** @description Managed storage is disabled for the canonical workspace entitlement. */
69
+ 403: {
70
+ headers: {
71
+ [name: string]: unknown;
72
+ };
73
+ content: {
74
+ "application/json": {
75
+ error: {
76
+ code: string;
77
+ details: Record<string, never>;
78
+ message: string;
79
+ requestId: string;
80
+ };
81
+ } & {
82
+ error?: {
83
+ /** @enum {string} */
84
+ code?: "permission_denied";
85
+ /** @enum {string} */
86
+ message?: "The requested action is not permitted.";
87
+ };
88
+ };
89
+ };
90
+ };
91
+ /** @description The parent is absent or undiscoverable. */
92
+ 404: {
93
+ headers: {
94
+ [name: string]: unknown;
95
+ };
96
+ content: {
97
+ "application/json": {
98
+ error: {
99
+ /** @enum {string} */
100
+ code: "resource_not_found";
101
+ details: Record<string, never>;
102
+ /** @enum {string} */
103
+ message: "The requested resource was not found.";
104
+ requestId: string;
105
+ };
106
+ };
107
+ };
108
+ };
109
+ /** @description Folder authority changed after preflight. */
110
+ 409: {
111
+ headers: {
112
+ [name: string]: unknown;
113
+ };
114
+ content: {
115
+ "application/json": {
116
+ error: {
117
+ /** @enum {string} */
118
+ code: "precondition_failed";
119
+ details: Record<string, never>;
120
+ /** @enum {string} */
121
+ message: "The request precondition failed.";
122
+ requestId: string;
123
+ };
124
+ };
125
+ };
126
+ };
127
+ /** @description The path, query, or cursor is invalid. */
128
+ 422: {
129
+ headers: {
130
+ [name: string]: unknown;
131
+ };
132
+ content: {
133
+ "application/json": ({
134
+ error: {
135
+ code: string;
136
+ details: Record<string, never>;
137
+ message: string;
138
+ requestId: string;
139
+ };
140
+ } & {
141
+ error?: {
142
+ /** @enum {string} */
143
+ code?: "invalid_request";
144
+ /** @enum {string} */
145
+ message?: "The request is invalid.";
146
+ };
147
+ }) | {
148
+ error: {
149
+ /** @enum {string} */
150
+ code: "invalid_pagination_cursor";
151
+ details: Record<string, never>;
152
+ /** @enum {string} */
153
+ message: "The pagination cursor is invalid.";
154
+ requestId: string;
155
+ };
156
+ };
157
+ };
158
+ };
159
+ /** @description Identity authority, D1, authorization evidence, or required cursor keys are unavailable. */
160
+ 503: {
161
+ headers: {
162
+ [name: string]: unknown;
163
+ };
164
+ content: {
165
+ "application/json": ({
166
+ error: {
167
+ code: string;
168
+ details: Record<string, never>;
169
+ message: string;
170
+ requestId: string;
171
+ };
172
+ } & {
173
+ error?: {
174
+ /** @enum {string} */
175
+ code?: "identity_authority_unavailable";
176
+ /** @enum {string} */
177
+ message?: "Authentication is temporarily unavailable.";
178
+ };
179
+ }) | ({
180
+ error: {
181
+ code: string;
182
+ details: Record<string, never>;
183
+ message: string;
184
+ requestId: string;
185
+ };
186
+ } & {
187
+ error?: {
188
+ /** @enum {string} */
189
+ code?: "service_unavailable";
190
+ /** @enum {string} */
191
+ message?: "The service is temporarily unavailable.";
192
+ };
193
+ });
194
+ };
195
+ };
196
+ };
197
+ };
198
+ createFolder: {
199
+ parameters: {
200
+ query?: never;
201
+ header: {
202
+ "Idempotency-Key": string;
203
+ };
204
+ path: {
205
+ workspaceId: string;
206
+ itemId: string;
207
+ };
208
+ cookie?: never;
209
+ };
210
+ requestBody: {
211
+ content: {
212
+ "application/json": {
213
+ /**
214
+ * Format: finueva-safe-filename
215
+ * @description NFC-normalized filename of at most 255 Unicode code points and 255 UTF-8 bytes. Slash, backslash, control characters, U+2028/U+2029, trailing dot/space, dot entries, and Windows reserved base names are forbidden.
216
+ */
217
+ name: string;
218
+ };
219
+ };
220
+ };
221
+ responses: {
222
+ /** @description The exact committed folder is replayed. */
223
+ 200: {
224
+ headers: {
225
+ [name: string]: unknown;
226
+ };
227
+ content: {
228
+ "application/json": {
229
+ itemId: string;
230
+ /** @enum {string} */
231
+ kind: "file" | "folder";
232
+ /**
233
+ * Format: finueva-safe-filename
234
+ * @description NFC-normalized filename of at most 255 Unicode code points and 255 UTF-8 bytes. Slash, backslash, control characters, U+2028/U+2029, trailing dot/space, dot entries, and Windows reserved base names are forbidden.
235
+ */
236
+ name: string;
237
+ parentItemId: string;
238
+ revision: number;
239
+ /** @enum {string} */
240
+ visibility: "workspace" | "restricted";
241
+ volumeId: string;
242
+ workspaceId: string;
243
+ };
244
+ };
245
+ };
246
+ /** @description The folder is committed. */
247
+ 201: {
248
+ headers: {
249
+ [name: string]: unknown;
250
+ };
251
+ content: {
252
+ "application/json": {
253
+ itemId: string;
254
+ /** @enum {string} */
255
+ kind: "file" | "folder";
256
+ /**
257
+ * Format: finueva-safe-filename
258
+ * @description NFC-normalized filename of at most 255 Unicode code points and 255 UTF-8 bytes. Slash, backslash, control characters, U+2028/U+2029, trailing dot/space, dot entries, and Windows reserved base names are forbidden.
259
+ */
260
+ name: string;
261
+ parentItemId: string;
262
+ revision: number;
263
+ /** @enum {string} */
264
+ visibility: "workspace" | "restricted";
265
+ volumeId: string;
266
+ workspaceId: string;
267
+ };
268
+ };
269
+ };
270
+ /** @description A valid Drive user bearer credential is required. */
271
+ 401: {
272
+ headers: {
273
+ [name: string]: unknown;
274
+ };
275
+ content: {
276
+ "application/json": {
277
+ error: {
278
+ code: string;
279
+ details: Record<string, never>;
280
+ message: string;
281
+ requestId: string;
282
+ };
283
+ } & {
284
+ error?: {
285
+ /** @enum {string} */
286
+ code?: "authentication_required";
287
+ /** @enum {string} */
288
+ message?: "Authentication is required.";
289
+ };
290
+ };
291
+ };
292
+ };
293
+ /** @description The discoverable parent does not permit folder creation. */
294
+ 403: {
295
+ headers: {
296
+ [name: string]: unknown;
297
+ };
298
+ content: {
299
+ "application/json": {
300
+ error: {
301
+ code: string;
302
+ details: Record<string, never>;
303
+ message: string;
304
+ requestId: string;
305
+ };
306
+ } & {
307
+ error?: {
308
+ /** @enum {string} */
309
+ code?: "permission_denied";
310
+ /** @enum {string} */
311
+ message?: "The requested action is not permitted.";
312
+ };
313
+ };
314
+ };
315
+ };
316
+ /** @description The parent is absent or undiscoverable. */
317
+ 404: {
318
+ headers: {
319
+ [name: string]: unknown;
320
+ };
321
+ content: {
322
+ "application/json": {
323
+ error: {
324
+ /** @enum {string} */
325
+ code: "resource_not_found";
326
+ details: Record<string, never>;
327
+ /** @enum {string} */
328
+ message: "The requested resource was not found.";
329
+ requestId: string;
330
+ };
331
+ };
332
+ };
333
+ };
334
+ /** @description The idempotency key conflicts or folder authority changed after preflight. */
335
+ 409: {
336
+ headers: {
337
+ [name: string]: unknown;
338
+ };
339
+ content: {
340
+ "application/json": ({
341
+ error: {
342
+ code: string;
343
+ details: Record<string, never>;
344
+ message: string;
345
+ requestId: string;
346
+ };
347
+ } & {
348
+ error?: {
349
+ /** @enum {string} */
350
+ code?: "idempotency_conflict";
351
+ /** @enum {string} */
352
+ message?: "The idempotency key conflicts with an earlier request.";
353
+ };
354
+ }) | {
355
+ error: {
356
+ /** @enum {string} */
357
+ code: "precondition_failed";
358
+ details: Record<string, never>;
359
+ /** @enum {string} */
360
+ message: "The request precondition failed.";
361
+ requestId: string;
362
+ };
363
+ };
364
+ };
365
+ };
366
+ /** @description The path, idempotency key, body, or name is invalid. */
367
+ 422: {
368
+ headers: {
369
+ [name: string]: unknown;
370
+ };
371
+ content: {
372
+ "application/json": ({
373
+ error: {
374
+ code: string;
375
+ details: Record<string, never>;
376
+ message: string;
377
+ requestId: string;
378
+ };
379
+ } & {
380
+ error?: {
381
+ /** @enum {string} */
382
+ code?: "invalid_request";
383
+ /** @enum {string} */
384
+ message?: "The request is invalid.";
385
+ };
386
+ }) | {
387
+ error: {
388
+ /** @enum {string} */
389
+ code: "invalid_idempotency_key";
390
+ details: Record<string, never>;
391
+ /** @enum {string} */
392
+ message: "The idempotency key is invalid.";
393
+ requestId: string;
394
+ };
395
+ };
396
+ };
397
+ };
398
+ /** @description Identity authority, D1, authorization evidence, or trusted capacity evidence is unavailable. */
399
+ 503: {
400
+ headers: {
401
+ [name: string]: unknown;
402
+ };
403
+ content: {
404
+ "application/json": ({
405
+ error: {
406
+ code: string;
407
+ details: Record<string, never>;
408
+ message: string;
409
+ requestId: string;
410
+ };
411
+ } & {
412
+ error?: {
413
+ /** @enum {string} */
414
+ code?: "identity_authority_unavailable";
415
+ /** @enum {string} */
416
+ message?: "Authentication is temporarily unavailable.";
417
+ };
418
+ }) | ({
419
+ error: {
420
+ code: string;
421
+ details: Record<string, never>;
422
+ message: string;
423
+ requestId: string;
424
+ };
425
+ } & {
426
+ error?: {
427
+ /** @enum {string} */
428
+ code?: "service_unavailable";
429
+ /** @enum {string} */
430
+ message?: "The service is temporarily unavailable.";
431
+ };
432
+ });
433
+ };
434
+ };
435
+ };
436
+ };
437
+ listItemPermissions: {
438
+ parameters: {
439
+ query?: {
440
+ limit?: number;
441
+ cursor?: string;
442
+ };
443
+ header?: never;
444
+ path: {
445
+ workspaceId: string;
446
+ itemId: string;
447
+ };
448
+ cookie?: never;
449
+ };
450
+ requestBody?: never;
451
+ responses: {
452
+ /** @description A stable permission page. */
453
+ 200: {
454
+ headers: {
455
+ /** @description Current direct collection precondition for POST on this item. */
456
+ "Drive-Permission-Collection-ETag"?: string;
457
+ /** @description Strong validator for the exact returned permission-list representation. */
458
+ ETag?: string;
459
+ [name: string]: unknown;
460
+ };
461
+ content: {
462
+ "application/json": {
463
+ collectionEtag: string;
464
+ collectionRevision: number;
465
+ items: {
466
+ actions: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
467
+ /** @enum {string} */
468
+ availability: "active" | "expired" | "revoked";
469
+ etag: string;
470
+ expiresAtEpochMilliseconds: number | null;
471
+ grantId: string;
472
+ grantee: {
473
+ /** @enum {string} */
474
+ type: "user";
475
+ userId: string;
476
+ } | {
477
+ teamId: string;
478
+ /** @enum {string} */
479
+ type: "team";
480
+ };
481
+ revision: number;
482
+ /** @enum {string} */
483
+ source: "direct" | "inherited";
484
+ sourceItemId: string;
485
+ }[];
486
+ nextCursor: string | null;
487
+ };
488
+ };
489
+ };
490
+ /** @description A valid Drive user bearer credential is required. */
491
+ 401: {
492
+ headers: {
493
+ [name: string]: unknown;
494
+ };
495
+ content: {
496
+ "application/json": {
497
+ error: {
498
+ code: string;
499
+ details: Record<string, never>;
500
+ message: string;
501
+ requestId: string;
502
+ };
503
+ } & {
504
+ error?: {
505
+ /** @enum {string} */
506
+ code?: "authentication_required";
507
+ /** @enum {string} */
508
+ message?: "Authentication is required.";
509
+ };
510
+ };
511
+ };
512
+ };
513
+ /** @description The discoverable item does not permit this permission operation. */
514
+ 403: {
515
+ headers: {
516
+ [name: string]: unknown;
517
+ };
518
+ content: {
519
+ "application/json": {
520
+ error: {
521
+ code: string;
522
+ details: Record<string, never>;
523
+ message: string;
524
+ requestId: string;
525
+ };
526
+ } & {
527
+ error?: {
528
+ /** @enum {string} */
529
+ code?: "permission_denied";
530
+ /** @enum {string} */
531
+ message?: "The requested action is not permitted.";
532
+ };
533
+ };
534
+ };
535
+ };
536
+ /** @description The item, principal, or direct grant is absent or undiscoverable. */
537
+ 404: {
538
+ headers: {
539
+ [name: string]: unknown;
540
+ };
541
+ content: {
542
+ "application/json": {
543
+ error: {
544
+ /** @enum {string} */
545
+ code: "resource_not_found";
546
+ details: Record<string, never>;
547
+ /** @enum {string} */
548
+ message: "The requested resource was not found.";
549
+ requestId: string;
550
+ };
551
+ };
552
+ };
553
+ };
554
+ /** @description The supplied revision or post-preflight authority is stale. */
555
+ 412: {
556
+ headers: {
557
+ [name: string]: unknown;
558
+ };
559
+ content: {
560
+ "application/json": {
561
+ error: {
562
+ /** @enum {string} */
563
+ code: "precondition_failed";
564
+ details: Record<string, never>;
565
+ /** @enum {string} */
566
+ message: "The request precondition failed.";
567
+ requestId: string;
568
+ };
569
+ };
570
+ };
571
+ };
572
+ /** @description The path, query, headers, or pagination cursor are invalid. */
573
+ 422: {
574
+ headers: {
575
+ [name: string]: unknown;
576
+ };
577
+ content: {
578
+ "application/json": ({
579
+ error: {
580
+ code: string;
581
+ details: Record<string, never>;
582
+ message: string;
583
+ requestId: string;
584
+ };
585
+ } & {
586
+ error?: {
587
+ /** @enum {string} */
588
+ code?: "invalid_request";
589
+ /** @enum {string} */
590
+ message?: "The request is invalid.";
591
+ };
592
+ }) | {
593
+ error: {
594
+ /** @enum {string} */
595
+ code: "invalid_pagination_cursor";
596
+ details: Record<string, never>;
597
+ /** @enum {string} */
598
+ message: "The pagination cursor is invalid.";
599
+ requestId: string;
600
+ };
601
+ };
602
+ };
603
+ };
604
+ /** @description Identity, D1, authorization, audit, cursor, or capacity authority is unavailable. */
605
+ 503: {
606
+ headers: {
607
+ [name: string]: unknown;
608
+ };
609
+ content: {
610
+ "application/json": ({
611
+ error: {
612
+ code: string;
613
+ details: Record<string, never>;
614
+ message: string;
615
+ requestId: string;
616
+ };
617
+ } & {
618
+ error?: {
619
+ /** @enum {string} */
620
+ code?: "identity_authority_unavailable";
621
+ /** @enum {string} */
622
+ message?: "Authentication is temporarily unavailable.";
623
+ };
624
+ }) | ({
625
+ error: {
626
+ code: string;
627
+ details: Record<string, never>;
628
+ message: string;
629
+ requestId: string;
630
+ };
631
+ } & {
632
+ error?: {
633
+ /** @enum {string} */
634
+ code?: "service_unavailable";
635
+ /** @enum {string} */
636
+ message?: "The service is temporarily unavailable.";
637
+ };
638
+ });
639
+ };
640
+ };
641
+ };
642
+ };
643
+ createItemPermission: {
644
+ parameters: {
645
+ query?: never;
646
+ header: {
647
+ "Idempotency-Key": string;
648
+ "If-Match": string;
649
+ };
650
+ path: {
651
+ workspaceId: string;
652
+ itemId: string;
653
+ };
654
+ cookie?: never;
655
+ };
656
+ requestBody: {
657
+ content: {
658
+ "application/json": {
659
+ actions: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
660
+ expiresAtEpochMilliseconds: number | null;
661
+ grantee: {
662
+ /** @enum {string} */
663
+ type: "user";
664
+ userId: string;
665
+ } | {
666
+ teamId: string;
667
+ /** @enum {string} */
668
+ type: "team";
669
+ };
670
+ };
671
+ };
672
+ };
673
+ responses: {
674
+ /** @description The exact committed result was replayed. */
675
+ 200: {
676
+ headers: {
677
+ /** @description Current direct collection precondition for the next POST. */
678
+ "Drive-Permission-Collection-ETag"?: string;
679
+ /** @description Current direct-grant precondition for PATCH or DELETE; omitted when the current row is not mutable. */
680
+ "Drive-Permission-Grant-ETag"?: string;
681
+ [name: string]: unknown;
682
+ };
683
+ content: {
684
+ "application/json": {
685
+ collectionRevision: number;
686
+ grant: {
687
+ actions: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
688
+ /** @enum {string} */
689
+ availability: "active" | "expired" | "revoked";
690
+ expiresAtEpochMilliseconds: number | null;
691
+ grantId: string;
692
+ grantee: {
693
+ /** @enum {string} */
694
+ type: "user";
695
+ userId: string;
696
+ } | {
697
+ teamId: string;
698
+ /** @enum {string} */
699
+ type: "team";
700
+ };
701
+ revision: number;
702
+ /** @enum {string} */
703
+ source: "direct";
704
+ sourceItemId: string;
705
+ };
706
+ /** @enum {string} */
707
+ outcome: "committed" | "replayed";
708
+ };
709
+ };
710
+ };
711
+ /** @description The direct grant was committed. */
712
+ 201: {
713
+ headers: {
714
+ /** @description Current direct collection precondition for the next POST. */
715
+ "Drive-Permission-Collection-ETag"?: string;
716
+ /** @description Current direct-grant precondition for PATCH or DELETE; omitted when the current row is not mutable. */
717
+ "Drive-Permission-Grant-ETag"?: string;
718
+ [name: string]: unknown;
719
+ };
720
+ content: {
721
+ "application/json": {
722
+ collectionRevision: number;
723
+ grant: {
724
+ actions: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
725
+ /** @enum {string} */
726
+ availability: "active" | "expired" | "revoked";
727
+ expiresAtEpochMilliseconds: number | null;
728
+ grantId: string;
729
+ grantee: {
730
+ /** @enum {string} */
731
+ type: "user";
732
+ userId: string;
733
+ } | {
734
+ teamId: string;
735
+ /** @enum {string} */
736
+ type: "team";
737
+ };
738
+ revision: number;
739
+ /** @enum {string} */
740
+ source: "direct";
741
+ sourceItemId: string;
742
+ };
743
+ /** @enum {string} */
744
+ outcome: "committed" | "replayed";
745
+ };
746
+ };
747
+ };
748
+ /** @description A valid Drive user bearer credential is required. */
749
+ 401: {
750
+ headers: {
751
+ [name: string]: unknown;
752
+ };
753
+ content: {
754
+ "application/json": {
755
+ error: {
756
+ code: string;
757
+ details: Record<string, never>;
758
+ message: string;
759
+ requestId: string;
760
+ };
761
+ } & {
762
+ error?: {
763
+ /** @enum {string} */
764
+ code?: "authentication_required";
765
+ /** @enum {string} */
766
+ message?: "Authentication is required.";
767
+ };
768
+ };
769
+ };
770
+ };
771
+ /** @description The discoverable item does not permit this permission operation. */
772
+ 403: {
773
+ headers: {
774
+ [name: string]: unknown;
775
+ };
776
+ content: {
777
+ "application/json": {
778
+ error: {
779
+ code: string;
780
+ details: Record<string, never>;
781
+ message: string;
782
+ requestId: string;
783
+ };
784
+ } & {
785
+ error?: {
786
+ /** @enum {string} */
787
+ code?: "permission_denied";
788
+ /** @enum {string} */
789
+ message?: "The requested action is not permitted.";
790
+ };
791
+ };
792
+ };
793
+ };
794
+ /** @description The item, principal, or direct grant is absent or undiscoverable. */
795
+ 404: {
796
+ headers: {
797
+ [name: string]: unknown;
798
+ };
799
+ content: {
800
+ "application/json": {
801
+ error: {
802
+ /** @enum {string} */
803
+ code: "resource_not_found";
804
+ details: Record<string, never>;
805
+ /** @enum {string} */
806
+ message: "The requested resource was not found.";
807
+ requestId: string;
808
+ };
809
+ };
810
+ };
811
+ };
812
+ /** @description The idempotency key was reused for a different semantic request. */
813
+ 409: {
814
+ headers: {
815
+ [name: string]: unknown;
816
+ };
817
+ content: {
818
+ "application/json": {
819
+ error: {
820
+ code: string;
821
+ details: Record<string, never>;
822
+ message: string;
823
+ requestId: string;
824
+ };
825
+ } & {
826
+ error?: {
827
+ /** @enum {string} */
828
+ code?: "idempotency_conflict";
829
+ /** @enum {string} */
830
+ message?: "The idempotency key conflicts with an earlier request.";
831
+ };
832
+ };
833
+ };
834
+ };
835
+ /** @description The supplied revision or post-preflight authority is stale. */
836
+ 412: {
837
+ headers: {
838
+ [name: string]: unknown;
839
+ };
840
+ content: {
841
+ "application/json": {
842
+ error: {
843
+ /** @enum {string} */
844
+ code: "precondition_failed";
845
+ details: Record<string, never>;
846
+ /** @enum {string} */
847
+ message: "The request precondition failed.";
848
+ requestId: string;
849
+ };
850
+ };
851
+ };
852
+ };
853
+ /** @description The path, query, headers, idempotency key, or body are invalid. */
854
+ 422: {
855
+ headers: {
856
+ [name: string]: unknown;
857
+ };
858
+ content: {
859
+ "application/json": ({
860
+ error: {
861
+ code: string;
862
+ details: Record<string, never>;
863
+ message: string;
864
+ requestId: string;
865
+ };
866
+ } & {
867
+ error?: {
868
+ /** @enum {string} */
869
+ code?: "invalid_request";
870
+ /** @enum {string} */
871
+ message?: "The request is invalid.";
872
+ };
873
+ }) | {
874
+ error: {
875
+ /** @enum {string} */
876
+ code: "invalid_idempotency_key";
877
+ details: Record<string, never>;
878
+ /** @enum {string} */
879
+ message: "The idempotency key is invalid.";
880
+ requestId: string;
881
+ };
882
+ };
883
+ };
884
+ };
885
+ /** @description Identity, D1, authorization, audit, cursor, or capacity authority is unavailable. */
886
+ 503: {
887
+ headers: {
888
+ [name: string]: unknown;
889
+ };
890
+ content: {
891
+ "application/json": ({
892
+ error: {
893
+ code: string;
894
+ details: Record<string, never>;
895
+ message: string;
896
+ requestId: string;
897
+ };
898
+ } & {
899
+ error?: {
900
+ /** @enum {string} */
901
+ code?: "identity_authority_unavailable";
902
+ /** @enum {string} */
903
+ message?: "Authentication is temporarily unavailable.";
904
+ };
905
+ }) | ({
906
+ error: {
907
+ code: string;
908
+ details: Record<string, never>;
909
+ message: string;
910
+ requestId: string;
911
+ };
912
+ } & {
913
+ error?: {
914
+ /** @enum {string} */
915
+ code?: "service_unavailable";
916
+ /** @enum {string} */
917
+ message?: "The service is temporarily unavailable.";
918
+ };
919
+ });
920
+ };
921
+ };
922
+ };
923
+ };
924
+ readEffectiveItemPermissions: {
925
+ parameters: {
926
+ query?: never;
927
+ header?: never;
928
+ path: {
929
+ workspaceId: string;
930
+ itemId: string;
931
+ };
932
+ cookie?: never;
933
+ };
934
+ requestBody?: never;
935
+ responses: {
936
+ /** @description All seven caller-specific item actions. */
937
+ 200: {
938
+ headers: {
939
+ [name: string]: unknown;
940
+ };
941
+ content: {
942
+ "application/json": {
943
+ actions: {
944
+ /** @enum {string} */
945
+ action: "items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:manage" | "items:permissions:read" | "items:update";
946
+ allowed: boolean;
947
+ basis: ("workspace_visibility" | "restricted_administrator_bypass" | "direct_grant" | "inherited_grant") | null;
948
+ grantId: string | null;
949
+ sourceItemId: string | null;
950
+ }[] & (unknown & unknown & unknown & unknown & unknown & unknown & unknown);
951
+ };
952
+ };
953
+ };
954
+ /** @description A valid Drive user bearer credential is required. */
955
+ 401: {
956
+ headers: {
957
+ [name: string]: unknown;
958
+ };
959
+ content: {
960
+ "application/json": {
961
+ error: {
962
+ code: string;
963
+ details: Record<string, never>;
964
+ message: string;
965
+ requestId: string;
966
+ };
967
+ } & {
968
+ error?: {
969
+ /** @enum {string} */
970
+ code?: "authentication_required";
971
+ /** @enum {string} */
972
+ message?: "Authentication is required.";
973
+ };
974
+ };
975
+ };
976
+ };
977
+ /** @description The discoverable item does not permit this permission operation. */
978
+ 403: {
979
+ headers: {
980
+ [name: string]: unknown;
981
+ };
982
+ content: {
983
+ "application/json": {
984
+ error: {
985
+ code: string;
986
+ details: Record<string, never>;
987
+ message: string;
988
+ requestId: string;
989
+ };
990
+ } & {
991
+ error?: {
992
+ /** @enum {string} */
993
+ code?: "permission_denied";
994
+ /** @enum {string} */
995
+ message?: "The requested action is not permitted.";
996
+ };
997
+ };
998
+ };
999
+ };
1000
+ /** @description The item, principal, or direct grant is absent or undiscoverable. */
1001
+ 404: {
1002
+ headers: {
1003
+ [name: string]: unknown;
1004
+ };
1005
+ content: {
1006
+ "application/json": {
1007
+ error: {
1008
+ /** @enum {string} */
1009
+ code: "resource_not_found";
1010
+ details: Record<string, never>;
1011
+ /** @enum {string} */
1012
+ message: "The requested resource was not found.";
1013
+ requestId: string;
1014
+ };
1015
+ };
1016
+ };
1017
+ };
1018
+ /** @description The supplied revision or post-preflight authority is stale. */
1019
+ 412: {
1020
+ headers: {
1021
+ [name: string]: unknown;
1022
+ };
1023
+ content: {
1024
+ "application/json": {
1025
+ error: {
1026
+ /** @enum {string} */
1027
+ code: "precondition_failed";
1028
+ details: Record<string, never>;
1029
+ /** @enum {string} */
1030
+ message: "The request precondition failed.";
1031
+ requestId: string;
1032
+ };
1033
+ };
1034
+ };
1035
+ };
1036
+ /** @description The path, query, headers, or body are invalid. */
1037
+ 422: {
1038
+ headers: {
1039
+ [name: string]: unknown;
1040
+ };
1041
+ content: {
1042
+ "application/json": {
1043
+ error: {
1044
+ code: string;
1045
+ details: Record<string, never>;
1046
+ message: string;
1047
+ requestId: string;
1048
+ };
1049
+ } & {
1050
+ error?: {
1051
+ /** @enum {string} */
1052
+ code?: "invalid_request";
1053
+ /** @enum {string} */
1054
+ message?: "The request is invalid.";
1055
+ };
1056
+ };
1057
+ };
1058
+ };
1059
+ /** @description Identity, D1, authorization, audit, cursor, or capacity authority is unavailable. */
1060
+ 503: {
1061
+ headers: {
1062
+ [name: string]: unknown;
1063
+ };
1064
+ content: {
1065
+ "application/json": ({
1066
+ error: {
1067
+ code: string;
1068
+ details: Record<string, never>;
1069
+ message: string;
1070
+ requestId: string;
1071
+ };
1072
+ } & {
1073
+ error?: {
1074
+ /** @enum {string} */
1075
+ code?: "identity_authority_unavailable";
1076
+ /** @enum {string} */
1077
+ message?: "Authentication is temporarily unavailable.";
1078
+ };
1079
+ }) | ({
1080
+ error: {
1081
+ code: string;
1082
+ details: Record<string, never>;
1083
+ message: string;
1084
+ requestId: string;
1085
+ };
1086
+ } & {
1087
+ error?: {
1088
+ /** @enum {string} */
1089
+ code?: "service_unavailable";
1090
+ /** @enum {string} */
1091
+ message?: "The service is temporarily unavailable.";
1092
+ };
1093
+ });
1094
+ };
1095
+ };
1096
+ };
1097
+ };
1098
+ revokeItemPermission: {
1099
+ parameters: {
1100
+ query?: never;
1101
+ header: {
1102
+ "Idempotency-Key": string;
1103
+ "If-Match": string;
1104
+ };
1105
+ path: {
1106
+ workspaceId: string;
1107
+ itemId: string;
1108
+ grantId: string;
1109
+ };
1110
+ cookie?: never;
1111
+ };
1112
+ requestBody?: never;
1113
+ responses: {
1114
+ /** @description The retained revoked grant was committed, replayed, or unchanged. */
1115
+ 200: {
1116
+ headers: {
1117
+ /** @description Current direct collection precondition for POST. */
1118
+ "Drive-Permission-Collection-ETag"?: string;
1119
+ [name: string]: unknown;
1120
+ };
1121
+ content: {
1122
+ "application/json": {
1123
+ collectionRevision: number;
1124
+ grant: {
1125
+ actions: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
1126
+ /** @enum {string} */
1127
+ availability: "active" | "expired" | "revoked";
1128
+ expiresAtEpochMilliseconds: number | null;
1129
+ grantId: string;
1130
+ grantee: {
1131
+ /** @enum {string} */
1132
+ type: "user";
1133
+ userId: string;
1134
+ } | {
1135
+ teamId: string;
1136
+ /** @enum {string} */
1137
+ type: "team";
1138
+ };
1139
+ revision: number;
1140
+ /** @enum {string} */
1141
+ source: "direct";
1142
+ sourceItemId: string;
1143
+ };
1144
+ /** @enum {string} */
1145
+ outcome: "committed" | "replayed";
1146
+ };
1147
+ };
1148
+ };
1149
+ /** @description A valid Drive user bearer credential is required. */
1150
+ 401: {
1151
+ headers: {
1152
+ [name: string]: unknown;
1153
+ };
1154
+ content: {
1155
+ "application/json": {
1156
+ error: {
1157
+ code: string;
1158
+ details: Record<string, never>;
1159
+ message: string;
1160
+ requestId: string;
1161
+ };
1162
+ } & {
1163
+ error?: {
1164
+ /** @enum {string} */
1165
+ code?: "authentication_required";
1166
+ /** @enum {string} */
1167
+ message?: "Authentication is required.";
1168
+ };
1169
+ };
1170
+ };
1171
+ };
1172
+ /** @description The discoverable item does not permit this permission operation. */
1173
+ 403: {
1174
+ headers: {
1175
+ [name: string]: unknown;
1176
+ };
1177
+ content: {
1178
+ "application/json": {
1179
+ error: {
1180
+ code: string;
1181
+ details: Record<string, never>;
1182
+ message: string;
1183
+ requestId: string;
1184
+ };
1185
+ } & {
1186
+ error?: {
1187
+ /** @enum {string} */
1188
+ code?: "permission_denied";
1189
+ /** @enum {string} */
1190
+ message?: "The requested action is not permitted.";
1191
+ };
1192
+ };
1193
+ };
1194
+ };
1195
+ /** @description The item, principal, or direct grant is absent or undiscoverable. */
1196
+ 404: {
1197
+ headers: {
1198
+ [name: string]: unknown;
1199
+ };
1200
+ content: {
1201
+ "application/json": {
1202
+ error: {
1203
+ /** @enum {string} */
1204
+ code: "resource_not_found";
1205
+ details: Record<string, never>;
1206
+ /** @enum {string} */
1207
+ message: "The requested resource was not found.";
1208
+ requestId: string;
1209
+ };
1210
+ };
1211
+ };
1212
+ };
1213
+ /** @description The idempotency key was reused for a different semantic request. */
1214
+ 409: {
1215
+ headers: {
1216
+ [name: string]: unknown;
1217
+ };
1218
+ content: {
1219
+ "application/json": {
1220
+ error: {
1221
+ code: string;
1222
+ details: Record<string, never>;
1223
+ message: string;
1224
+ requestId: string;
1225
+ };
1226
+ } & {
1227
+ error?: {
1228
+ /** @enum {string} */
1229
+ code?: "idempotency_conflict";
1230
+ /** @enum {string} */
1231
+ message?: "The idempotency key conflicts with an earlier request.";
1232
+ };
1233
+ };
1234
+ };
1235
+ };
1236
+ /** @description The supplied revision or post-preflight authority is stale. */
1237
+ 412: {
1238
+ headers: {
1239
+ [name: string]: unknown;
1240
+ };
1241
+ content: {
1242
+ "application/json": {
1243
+ error: {
1244
+ /** @enum {string} */
1245
+ code: "precondition_failed";
1246
+ details: Record<string, never>;
1247
+ /** @enum {string} */
1248
+ message: "The request precondition failed.";
1249
+ requestId: string;
1250
+ };
1251
+ };
1252
+ };
1253
+ };
1254
+ /** @description The path, query, headers, idempotency key, or body are invalid. */
1255
+ 422: {
1256
+ headers: {
1257
+ [name: string]: unknown;
1258
+ };
1259
+ content: {
1260
+ "application/json": ({
1261
+ error: {
1262
+ code: string;
1263
+ details: Record<string, never>;
1264
+ message: string;
1265
+ requestId: string;
1266
+ };
1267
+ } & {
1268
+ error?: {
1269
+ /** @enum {string} */
1270
+ code?: "invalid_request";
1271
+ /** @enum {string} */
1272
+ message?: "The request is invalid.";
1273
+ };
1274
+ }) | {
1275
+ error: {
1276
+ /** @enum {string} */
1277
+ code: "invalid_idempotency_key";
1278
+ details: Record<string, never>;
1279
+ /** @enum {string} */
1280
+ message: "The idempotency key is invalid.";
1281
+ requestId: string;
1282
+ };
1283
+ };
1284
+ };
1285
+ };
1286
+ /** @description Identity, D1, authorization, audit, cursor, or capacity authority is unavailable. */
1287
+ 503: {
1288
+ headers: {
1289
+ [name: string]: unknown;
1290
+ };
1291
+ content: {
1292
+ "application/json": ({
1293
+ error: {
1294
+ code: string;
1295
+ details: Record<string, never>;
1296
+ message: string;
1297
+ requestId: string;
1298
+ };
1299
+ } & {
1300
+ error?: {
1301
+ /** @enum {string} */
1302
+ code?: "identity_authority_unavailable";
1303
+ /** @enum {string} */
1304
+ message?: "Authentication is temporarily unavailable.";
1305
+ };
1306
+ }) | ({
1307
+ error: {
1308
+ code: string;
1309
+ details: Record<string, never>;
1310
+ message: string;
1311
+ requestId: string;
1312
+ };
1313
+ } & {
1314
+ error?: {
1315
+ /** @enum {string} */
1316
+ code?: "service_unavailable";
1317
+ /** @enum {string} */
1318
+ message?: "The service is temporarily unavailable.";
1319
+ };
1320
+ });
1321
+ };
1322
+ };
1323
+ };
1324
+ };
1325
+ updateItemPermission: {
1326
+ parameters: {
1327
+ query?: never;
1328
+ header: {
1329
+ "Idempotency-Key": string;
1330
+ "If-Match": string;
1331
+ };
1332
+ path: {
1333
+ workspaceId: string;
1334
+ itemId: string;
1335
+ grantId: string;
1336
+ };
1337
+ cookie?: never;
1338
+ };
1339
+ requestBody: {
1340
+ content: {
1341
+ "application/json": {
1342
+ actions?: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
1343
+ expiresAtEpochMilliseconds?: number | null;
1344
+ };
1345
+ };
1346
+ };
1347
+ responses: {
1348
+ /** @description The direct grant was committed or replayed. */
1349
+ 200: {
1350
+ headers: {
1351
+ /** @description Current direct collection precondition for POST. */
1352
+ "Drive-Permission-Collection-ETag"?: string;
1353
+ /** @description Current direct-grant precondition for the next PATCH or DELETE; omitted when the current row is not mutable. */
1354
+ "Drive-Permission-Grant-ETag"?: string;
1355
+ [name: string]: unknown;
1356
+ };
1357
+ content: {
1358
+ "application/json": {
1359
+ collectionRevision: number;
1360
+ grant: {
1361
+ actions: ("items:content:read" | "items:create" | "items:delete" | "items:metadata:read" | "items:permissions:read" | "items:update")[];
1362
+ /** @enum {string} */
1363
+ availability: "active" | "expired" | "revoked";
1364
+ expiresAtEpochMilliseconds: number | null;
1365
+ grantId: string;
1366
+ grantee: {
1367
+ /** @enum {string} */
1368
+ type: "user";
1369
+ userId: string;
1370
+ } | {
1371
+ teamId: string;
1372
+ /** @enum {string} */
1373
+ type: "team";
1374
+ };
1375
+ revision: number;
1376
+ /** @enum {string} */
1377
+ source: "direct";
1378
+ sourceItemId: string;
1379
+ };
1380
+ /** @enum {string} */
1381
+ outcome: "committed" | "replayed";
1382
+ };
1383
+ };
1384
+ };
1385
+ /** @description A valid Drive user bearer credential is required. */
1386
+ 401: {
1387
+ headers: {
1388
+ [name: string]: unknown;
1389
+ };
1390
+ content: {
1391
+ "application/json": {
1392
+ error: {
1393
+ code: string;
1394
+ details: Record<string, never>;
1395
+ message: string;
1396
+ requestId: string;
1397
+ };
1398
+ } & {
1399
+ error?: {
1400
+ /** @enum {string} */
1401
+ code?: "authentication_required";
1402
+ /** @enum {string} */
1403
+ message?: "Authentication is required.";
1404
+ };
1405
+ };
1406
+ };
1407
+ };
1408
+ /** @description The discoverable item does not permit this permission operation. */
1409
+ 403: {
1410
+ headers: {
1411
+ [name: string]: unknown;
1412
+ };
1413
+ content: {
1414
+ "application/json": {
1415
+ error: {
1416
+ code: string;
1417
+ details: Record<string, never>;
1418
+ message: string;
1419
+ requestId: string;
1420
+ };
1421
+ } & {
1422
+ error?: {
1423
+ /** @enum {string} */
1424
+ code?: "permission_denied";
1425
+ /** @enum {string} */
1426
+ message?: "The requested action is not permitted.";
1427
+ };
1428
+ };
1429
+ };
1430
+ };
1431
+ /** @description The item, principal, or direct grant is absent or undiscoverable. */
1432
+ 404: {
1433
+ headers: {
1434
+ [name: string]: unknown;
1435
+ };
1436
+ content: {
1437
+ "application/json": {
1438
+ error: {
1439
+ /** @enum {string} */
1440
+ code: "resource_not_found";
1441
+ details: Record<string, never>;
1442
+ /** @enum {string} */
1443
+ message: "The requested resource was not found.";
1444
+ requestId: string;
1445
+ };
1446
+ };
1447
+ };
1448
+ };
1449
+ /** @description The idempotency key was reused for a different semantic request. */
1450
+ 409: {
1451
+ headers: {
1452
+ [name: string]: unknown;
1453
+ };
1454
+ content: {
1455
+ "application/json": {
1456
+ error: {
1457
+ code: string;
1458
+ details: Record<string, never>;
1459
+ message: string;
1460
+ requestId: string;
1461
+ };
1462
+ } & {
1463
+ error?: {
1464
+ /** @enum {string} */
1465
+ code?: "idempotency_conflict";
1466
+ /** @enum {string} */
1467
+ message?: "The idempotency key conflicts with an earlier request.";
1468
+ };
1469
+ };
1470
+ };
1471
+ };
1472
+ /** @description The supplied revision or post-preflight authority is stale. */
1473
+ 412: {
1474
+ headers: {
1475
+ [name: string]: unknown;
1476
+ };
1477
+ content: {
1478
+ "application/json": {
1479
+ error: {
1480
+ /** @enum {string} */
1481
+ code: "precondition_failed";
1482
+ details: Record<string, never>;
1483
+ /** @enum {string} */
1484
+ message: "The request precondition failed.";
1485
+ requestId: string;
1486
+ };
1487
+ };
1488
+ };
1489
+ };
1490
+ /** @description The path, query, headers, idempotency key, or body are invalid. */
1491
+ 422: {
1492
+ headers: {
1493
+ [name: string]: unknown;
1494
+ };
1495
+ content: {
1496
+ "application/json": ({
1497
+ error: {
1498
+ code: string;
1499
+ details: Record<string, never>;
1500
+ message: string;
1501
+ requestId: string;
1502
+ };
1503
+ } & {
1504
+ error?: {
1505
+ /** @enum {string} */
1506
+ code?: "invalid_request";
1507
+ /** @enum {string} */
1508
+ message?: "The request is invalid.";
1509
+ };
1510
+ }) | {
1511
+ error: {
1512
+ /** @enum {string} */
1513
+ code: "invalid_idempotency_key";
1514
+ details: Record<string, never>;
1515
+ /** @enum {string} */
1516
+ message: "The idempotency key is invalid.";
1517
+ requestId: string;
1518
+ };
1519
+ };
1520
+ };
1521
+ };
1522
+ /** @description Identity, D1, authorization, audit, cursor, or capacity authority is unavailable. */
1523
+ 503: {
1524
+ headers: {
1525
+ [name: string]: unknown;
1526
+ };
1527
+ content: {
1528
+ "application/json": ({
1529
+ error: {
1530
+ code: string;
1531
+ details: Record<string, never>;
1532
+ message: string;
1533
+ requestId: string;
1534
+ };
1535
+ } & {
1536
+ error?: {
1537
+ /** @enum {string} */
1538
+ code?: "identity_authority_unavailable";
1539
+ /** @enum {string} */
1540
+ message?: "Authentication is temporarily unavailable.";
1541
+ };
1542
+ }) | ({
1543
+ error: {
1544
+ code: string;
1545
+ details: Record<string, never>;
1546
+ message: string;
1547
+ requestId: string;
1548
+ };
1549
+ } & {
1550
+ error?: {
1551
+ /** @enum {string} */
1552
+ code?: "service_unavailable";
1553
+ /** @enum {string} */
1554
+ message?: "The service is temporarily unavailable.";
1555
+ };
1556
+ });
1557
+ };
1558
+ };
1559
+ };
1560
+ };
1561
+ createUpload: {
1562
+ parameters: {
1563
+ query?: never;
1564
+ header: {
1565
+ "Idempotency-Key": string;
1566
+ };
1567
+ path: {
1568
+ workspaceId: string;
1569
+ };
1570
+ cookie?: never;
1571
+ };
1572
+ requestBody: {
1573
+ content: {
1574
+ "application/json": {
1575
+ expectedByteLength: number;
1576
+ parentItemId: string;
1577
+ };
1578
+ };
1579
+ };
1580
+ responses: {
1581
+ /** @description The exact retained reservation is replayed. */
1582
+ 200: {
1583
+ headers: {
1584
+ [name: string]: unknown;
1585
+ };
1586
+ content: {
1587
+ "application/json": {
1588
+ createdAtEpochMilliseconds: number;
1589
+ expectedByteLength: number;
1590
+ expiresAtEpochMilliseconds: number;
1591
+ parentItemId: string;
1592
+ /** @enum {string} */
1593
+ state: "reserved";
1594
+ terminalAtEpochMilliseconds: null;
1595
+ terminalReason: null;
1596
+ uploadId: string;
1597
+ workspaceId: string;
1598
+ };
1599
+ };
1600
+ };
1601
+ /** @description Quota and mandatory D1 capacity are reserved. */
1602
+ 201: {
1603
+ headers: {
1604
+ [name: string]: unknown;
1605
+ };
1606
+ content: {
1607
+ "application/json": {
1608
+ createdAtEpochMilliseconds: number;
1609
+ expectedByteLength: number;
1610
+ expiresAtEpochMilliseconds: number;
1611
+ parentItemId: string;
1612
+ /** @enum {string} */
1613
+ state: "reserved";
1614
+ terminalAtEpochMilliseconds: null;
1615
+ terminalReason: null;
1616
+ uploadId: string;
1617
+ workspaceId: string;
1618
+ };
1619
+ };
1620
+ };
1621
+ /** @description A valid Drive user bearer credential is required. */
1622
+ 401: {
1623
+ headers: {
1624
+ [name: string]: unknown;
1625
+ };
1626
+ content: {
1627
+ "application/json": {
1628
+ error: {
1629
+ code: string;
1630
+ details: Record<string, never>;
1631
+ message: string;
1632
+ requestId: string;
1633
+ };
1634
+ } & {
1635
+ error?: {
1636
+ /** @enum {string} */
1637
+ code?: "authentication_required";
1638
+ /** @enum {string} */
1639
+ message?: "Authentication is required.";
1640
+ };
1641
+ };
1642
+ };
1643
+ };
1644
+ /** @description Managed storage is disabled or the discoverable parent does not permit item creation. */
1645
+ 403: {
1646
+ headers: {
1647
+ [name: string]: unknown;
1648
+ };
1649
+ content: {
1650
+ "application/json": {
1651
+ error: {
1652
+ code: string;
1653
+ details: Record<string, never>;
1654
+ message: string;
1655
+ requestId: string;
1656
+ };
1657
+ } & {
1658
+ error?: {
1659
+ /** @enum {string} */
1660
+ code?: "permission_denied";
1661
+ /** @enum {string} */
1662
+ message?: "The requested action is not permitted.";
1663
+ };
1664
+ };
1665
+ };
1666
+ };
1667
+ /** @description The parent is absent or undiscoverable. */
1668
+ 404: {
1669
+ headers: {
1670
+ [name: string]: unknown;
1671
+ };
1672
+ content: {
1673
+ "application/json": {
1674
+ error: {
1675
+ /** @enum {string} */
1676
+ code: "resource_not_found";
1677
+ details: Record<string, never>;
1678
+ /** @enum {string} */
1679
+ message: "The requested resource was not found.";
1680
+ requestId: string;
1681
+ };
1682
+ };
1683
+ };
1684
+ };
1685
+ /** @description Quota is exceeded, the key conflicts, or authority changed before commit. */
1686
+ 409: {
1687
+ headers: {
1688
+ [name: string]: unknown;
1689
+ };
1690
+ content: {
1691
+ "application/json": Record<string, never> & ({
1692
+ error: {
1693
+ /** @enum {string} */
1694
+ code: "quota_exceeded";
1695
+ details: Record<string, never>;
1696
+ /** @enum {string} */
1697
+ message: "The workspace storage quota would be exceeded.";
1698
+ requestId: string;
1699
+ };
1700
+ } | ({
1701
+ error: {
1702
+ code: string;
1703
+ details: Record<string, never>;
1704
+ message: string;
1705
+ requestId: string;
1706
+ };
1707
+ } & {
1708
+ error?: {
1709
+ /** @enum {string} */
1710
+ code?: "idempotency_conflict";
1711
+ /** @enum {string} */
1712
+ message?: "The idempotency key conflicts with an earlier request.";
1713
+ };
1714
+ }) | {
1715
+ error: {
1716
+ /** @enum {string} */
1717
+ code: "precondition_failed";
1718
+ details: Record<string, never>;
1719
+ /** @enum {string} */
1720
+ message: "The request precondition failed.";
1721
+ requestId: string;
1722
+ };
1723
+ });
1724
+ };
1725
+ };
1726
+ /** @description The path, key, media type, or strict request body is invalid. */
1727
+ 422: {
1728
+ headers: {
1729
+ [name: string]: unknown;
1730
+ };
1731
+ content: {
1732
+ "application/json": Record<string, never> & (({
1733
+ error: {
1734
+ code: string;
1735
+ details: Record<string, never>;
1736
+ message: string;
1737
+ requestId: string;
1738
+ };
1739
+ } & {
1740
+ error?: {
1741
+ /** @enum {string} */
1742
+ code?: "invalid_request";
1743
+ /** @enum {string} */
1744
+ message?: "The request is invalid.";
1745
+ };
1746
+ }) | {
1747
+ error: {
1748
+ /** @enum {string} */
1749
+ code: "invalid_idempotency_key";
1750
+ details: Record<string, never>;
1751
+ /** @enum {string} */
1752
+ message: "The idempotency key is invalid.";
1753
+ requestId: string;
1754
+ };
1755
+ });
1756
+ };
1757
+ };
1758
+ /** @description Identity, D1, authorization, entitlement, or trusted capacity authority is unavailable. */
1759
+ 503: {
1760
+ headers: {
1761
+ [name: string]: unknown;
1762
+ };
1763
+ content: {
1764
+ "application/json": Record<string, never> & (({
1765
+ error: {
1766
+ code: string;
1767
+ details: Record<string, never>;
1768
+ message: string;
1769
+ requestId: string;
1770
+ };
1771
+ } & {
1772
+ error?: {
1773
+ /** @enum {string} */
1774
+ code?: "identity_authority_unavailable";
1775
+ /** @enum {string} */
1776
+ message?: "Authentication is temporarily unavailable.";
1777
+ };
1778
+ }) | ({
1779
+ error: {
1780
+ code: string;
1781
+ details: Record<string, never>;
1782
+ message: string;
1783
+ requestId: string;
1784
+ };
1785
+ } & {
1786
+ error?: {
1787
+ /** @enum {string} */
1788
+ code?: "service_unavailable";
1789
+ /** @enum {string} */
1790
+ message?: "The service is temporarily unavailable.";
1791
+ };
1792
+ }));
1793
+ };
1794
+ };
1795
+ };
1796
+ };
1797
+ abortUpload: {
1798
+ parameters: {
1799
+ query?: never;
1800
+ header?: never;
1801
+ path: {
1802
+ workspaceId: string;
1803
+ uploadId: string;
1804
+ };
1805
+ cookie?: never;
1806
+ };
1807
+ requestBody?: never;
1808
+ responses: {
1809
+ /** @description The reservation is released or its exact abort is replayed. */
1810
+ 200: {
1811
+ headers: {
1812
+ [name: string]: unknown;
1813
+ };
1814
+ content: {
1815
+ "application/json": {
1816
+ createdAtEpochMilliseconds: number;
1817
+ expectedByteLength: number;
1818
+ expiresAtEpochMilliseconds: number;
1819
+ parentItemId: string;
1820
+ /** @enum {string} */
1821
+ state: "released";
1822
+ terminalAtEpochMilliseconds: number;
1823
+ /** @enum {string} */
1824
+ terminalReason: "aborted";
1825
+ uploadId: string;
1826
+ workspaceId: string;
1827
+ };
1828
+ };
1829
+ };
1830
+ /** @description A valid Drive user bearer credential is required. */
1831
+ 401: {
1832
+ headers: {
1833
+ [name: string]: unknown;
1834
+ };
1835
+ content: {
1836
+ "application/json": {
1837
+ error: {
1838
+ code: string;
1839
+ details: Record<string, never>;
1840
+ message: string;
1841
+ requestId: string;
1842
+ };
1843
+ } & {
1844
+ error?: {
1845
+ /** @enum {string} */
1846
+ code?: "authentication_required";
1847
+ /** @enum {string} */
1848
+ message?: "Authentication is required.";
1849
+ };
1850
+ };
1851
+ };
1852
+ };
1853
+ /** @description The retained parent is discoverable but no longer permits item creation. */
1854
+ 403: {
1855
+ headers: {
1856
+ [name: string]: unknown;
1857
+ };
1858
+ content: {
1859
+ "application/json": {
1860
+ error: {
1861
+ code: string;
1862
+ details: Record<string, never>;
1863
+ message: string;
1864
+ requestId: string;
1865
+ };
1866
+ } & {
1867
+ error?: {
1868
+ /** @enum {string} */
1869
+ code?: "permission_denied";
1870
+ /** @enum {string} */
1871
+ message?: "The requested action is not permitted.";
1872
+ };
1873
+ };
1874
+ };
1875
+ };
1876
+ /** @description The upload is unknown, cross-workspace, or its retained parent is undiscoverable. */
1877
+ 404: {
1878
+ headers: {
1879
+ [name: string]: unknown;
1880
+ };
1881
+ content: {
1882
+ "application/json": {
1883
+ error: {
1884
+ /** @enum {string} */
1885
+ code: "resource_not_found";
1886
+ details: Record<string, never>;
1887
+ /** @enum {string} */
1888
+ message: "The requested resource was not found.";
1889
+ requestId: string;
1890
+ };
1891
+ };
1892
+ };
1893
+ };
1894
+ /** @description Another terminal settlement won or parent authority changed before commit. */
1895
+ 409: {
1896
+ headers: {
1897
+ [name: string]: unknown;
1898
+ };
1899
+ content: {
1900
+ "application/json": {
1901
+ error: {
1902
+ /** @enum {string} */
1903
+ code: "precondition_failed";
1904
+ details: Record<string, never>;
1905
+ /** @enum {string} */
1906
+ message: "The request precondition failed.";
1907
+ requestId: string;
1908
+ };
1909
+ };
1910
+ };
1911
+ };
1912
+ /** @description The path, query, or unexpected request body is invalid. */
1913
+ 422: {
1914
+ headers: {
1915
+ [name: string]: unknown;
1916
+ };
1917
+ content: {
1918
+ "application/json": {
1919
+ error: {
1920
+ code: string;
1921
+ details: Record<string, never>;
1922
+ message: string;
1923
+ requestId: string;
1924
+ };
1925
+ } & {
1926
+ error?: {
1927
+ /** @enum {string} */
1928
+ code?: "invalid_request";
1929
+ /** @enum {string} */
1930
+ message?: "The request is invalid.";
1931
+ };
1932
+ };
1933
+ };
1934
+ };
1935
+ /** @description Identity, D1, authorization, or retained capacity authority is unavailable. */
1936
+ 503: {
1937
+ headers: {
1938
+ [name: string]: unknown;
1939
+ };
1940
+ content: {
1941
+ "application/json": Record<string, never> & (({
1942
+ error: {
1943
+ code: string;
1944
+ details: Record<string, never>;
1945
+ message: string;
1946
+ requestId: string;
1947
+ };
1948
+ } & {
1949
+ error?: {
1950
+ /** @enum {string} */
1951
+ code?: "identity_authority_unavailable";
1952
+ /** @enum {string} */
1953
+ message?: "Authentication is temporarily unavailable.";
1954
+ };
1955
+ }) | ({
1956
+ error: {
1957
+ code: string;
1958
+ details: Record<string, never>;
1959
+ message: string;
1960
+ requestId: string;
1961
+ };
1962
+ } & {
1963
+ error?: {
1964
+ /** @enum {string} */
1965
+ code?: "service_unavailable";
1966
+ /** @enum {string} */
1967
+ message?: "The service is temporarily unavailable.";
1968
+ };
1969
+ }));
1970
+ };
1971
+ };
1972
+ };
1973
+ };
1974
+ }
1975
+ //#endregion
1976
+ //#region src/types.d.ts
1977
+ type JsonResponse<Name extends keyof operations, Status extends keyof operations[Name]["responses"]> = operations[Name]["responses"][Status] extends {
1978
+ content: {
1979
+ "application/json": infer Body;
1980
+ };
1981
+ } ? Body : never;
1982
+ type JsonRequest<Name extends keyof operations> = operations[Name] extends {
1983
+ requestBody: {
1984
+ content: {
1985
+ "application/json": infer Body;
1986
+ };
1987
+ };
1988
+ } ? Body : never;
1989
+ type ResourcePath = operations["listFolderChildren"]["parameters"]["path"];
1990
+ type PageQuery = NonNullable<operations["listFolderChildren"]["parameters"]["query"]>;
1991
+ type CreateFolderBody = JsonRequest<"createFolder">;
1992
+ type CreatePermissionBody = JsonRequest<"createItemPermission">;
1993
+ type UpdatePermissionBody = JsonRequest<"updateItemPermission">;
1994
+ type CreateFolderHeaders = operations["createFolder"]["parameters"]["header"];
1995
+ type CreatePermissionHeaders = operations["createItemPermission"]["parameters"]["header"];
1996
+ type GrantMutationPath = operations["updateItemPermission"]["parameters"]["path"];
1997
+ type GrantMutationHeaders = operations["updateItemPermission"]["parameters"]["header"];
1998
+ type CreateUploadPath = operations["createUpload"]["parameters"]["path"];
1999
+ type CreateUploadHeaders = operations["createUpload"]["parameters"]["header"];
2000
+ type CreateUploadBody = JsonRequest<"createUpload">;
2001
+ type AbortUploadPath = operations["abortUpload"]["parameters"]["path"];
2002
+ type FolderItem = Readonly<JsonResponse<"createFolder", 201>>;
2003
+ type ReservedUploadQuota = Readonly<JsonResponse<"createUpload", 201>>;
2004
+ type AbortedUploadQuota = Readonly<JsonResponse<"abortUpload", 200>>;
2005
+ type UploadQuotaReservation = ReservedUploadQuota | AbortedUploadQuota;
2006
+ type PermissionAction = CreatePermissionBody["actions"][number];
2007
+ type PermissionGrantee = Readonly<CreatePermissionBody["grantee"]>;
2008
+ type GeneratedPermissionGrant = JsonResponse<"listItemPermissions", 200>["items"][number];
2009
+ type PermissionGrant = Readonly<Omit<GeneratedPermissionGrant, "actions" | "grantee"> & {
2010
+ readonly actions: readonly PermissionAction[];
2011
+ readonly grantee: PermissionGrantee;
2012
+ }>;
2013
+ type GeneratedPermissionMutation = JsonResponse<"createItemPermission", 201>;
2014
+ type PermissionMutation = Readonly<Omit<GeneratedPermissionMutation, "grant"> & {
2015
+ readonly grant: Readonly<Omit<GeneratedPermissionMutation["grant"], "actions" | "grantee"> & {
2016
+ readonly actions: readonly PermissionAction[];
2017
+ readonly grantee: PermissionGrantee;
2018
+ }>;
2019
+ }>;
2020
+ type GeneratedEffectivePermissionResponse = JsonResponse<"readEffectiveItemPermissions", 200>;
2021
+ type EffectivePermissionAction = Readonly<GeneratedEffectivePermissionResponse["actions"][number]>;
2022
+ type FolderPage = Readonly<Omit<JsonResponse<"listFolderChildren", 200>, "items"> & {
2023
+ readonly items: readonly FolderItem[];
2024
+ }>;
2025
+ type PermissionPage = Readonly<Omit<JsonResponse<"listItemPermissions", 200>, "items"> & {
2026
+ readonly items: readonly PermissionGrant[];
2027
+ }>;
2028
+ type EffectivePermissionResponse = Readonly<Omit<GeneratedEffectivePermissionResponse, "actions"> & {
2029
+ readonly actions: readonly EffectivePermissionAction[];
2030
+ }>;
2031
+ interface DriveCredentialContext {
2032
+ readonly signal: AbortSignal;
2033
+ }
2034
+ type DriveCredentialProvider = (context: DriveCredentialContext) => Promise<string>;
2035
+ interface DriveClientConfig {
2036
+ readonly baseUrl: string;
2037
+ readonly fetch?: typeof globalThis.fetch;
2038
+ readonly getCredential: DriveCredentialProvider;
2039
+ readonly timeoutMilliseconds?: number;
2040
+ }
2041
+ interface DriveServerClientConfig {
2042
+ readonly baseUrl: string;
2043
+ readonly fetch?: typeof globalThis.fetch;
2044
+ readonly credential: string | DriveCredentialProvider;
2045
+ readonly timeoutMilliseconds?: number;
2046
+ }
2047
+ interface DriveResponseValidators {
2048
+ readonly etag?: string;
2049
+ readonly permissionCollectionEtag?: string;
2050
+ readonly permissionGrantEtag?: string;
2051
+ }
2052
+ interface DriveOperationResult<Data, Status extends number = number> {
2053
+ readonly data: Data;
2054
+ readonly status: Status;
2055
+ readonly requestId: string;
2056
+ readonly validators: DriveResponseValidators;
2057
+ }
2058
+ type ResourceInput = Readonly<ResourcePath> & {
2059
+ readonly signal?: AbortSignal;
2060
+ };
2061
+ type PageInput = ResourceInput & Readonly<PageQuery>;
2062
+ type ListFolderChildrenInput = PageInput;
2063
+ type CreateFolderInput = ResourceInput & Readonly<CreateFolderBody> & {
2064
+ readonly idempotencyKey: CreateFolderHeaders["Idempotency-Key"];
2065
+ };
2066
+ type ListItemPermissionsInput = PageInput;
2067
+ type ReadEffectiveItemPermissionsInput = ResourceInput;
2068
+ type CreateItemPermissionInput = ResourceInput & Readonly<Omit<CreatePermissionBody, "actions" | "grantee">> & {
2069
+ readonly actions: readonly PermissionAction[];
2070
+ readonly grantee: PermissionGrantee;
2071
+ readonly ifMatch: CreatePermissionHeaders["If-Match"];
2072
+ readonly idempotencyKey: CreatePermissionHeaders["Idempotency-Key"];
2073
+ };
2074
+ type GrantMutationInput = ResourceInput & Readonly<Pick<GrantMutationPath, "grantId">> & {
2075
+ readonly ifMatch: GrantMutationHeaders["If-Match"];
2076
+ readonly idempotencyKey: GrantMutationHeaders["Idempotency-Key"];
2077
+ };
2078
+ type UpdateItemPermissionInput = GrantMutationInput & Readonly<Omit<UpdatePermissionBody, "actions">> & {
2079
+ readonly actions?: readonly PermissionAction[];
2080
+ };
2081
+ type RevokeItemPermissionInput = GrantMutationInput;
2082
+ type CreateUploadInput = Readonly<CreateUploadPath> & Readonly<CreateUploadBody> & {
2083
+ readonly idempotencyKey: CreateUploadHeaders["Idempotency-Key"];
2084
+ readonly signal?: AbortSignal;
2085
+ };
2086
+ type AbortUploadInput = Readonly<AbortUploadPath> & {
2087
+ readonly signal?: AbortSignal;
2088
+ };
2089
+ interface DriveClient {
2090
+ listFolderChildren(input: ListFolderChildrenInput): Promise<DriveOperationResult<FolderPage, 200>>;
2091
+ createFolder(input: CreateFolderInput): Promise<DriveOperationResult<FolderItem, 200 | 201>>;
2092
+ listItemPermissions(input: ListItemPermissionsInput): Promise<DriveOperationResult<PermissionPage, 200>>;
2093
+ readEffectiveItemPermissions(input: ReadEffectiveItemPermissionsInput): Promise<DriveOperationResult<EffectivePermissionResponse, 200>>;
2094
+ createItemPermission(input: CreateItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200 | 201>>;
2095
+ updateItemPermission(input: UpdateItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200>>;
2096
+ revokeItemPermission(input: RevokeItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200>>;
2097
+ createUpload(input: CreateUploadInput): Promise<DriveOperationResult<ReservedUploadQuota, 200 | 201>>;
2098
+ abortUpload(input: AbortUploadInput): Promise<DriveOperationResult<AbortedUploadQuota, 200>>;
2099
+ }
2100
+ //#endregion
2101
+ export { PermissionPage as C, UpdateItemPermissionInput as D, RevokeItemPermissionInput as E, UploadQuotaReservation as O, PermissionMutation as S, ReservedUploadQuota as T, ListFolderChildrenInput as _, CreateUploadInput as a, PermissionGrant as b, DriveCredentialContext as c, DriveResponseValidators as d, DriveServerClientConfig as f, FolderPage as g, FolderItem as h, CreateItemPermissionInput as i, DriveCredentialProvider as l, EffectivePermissionResponse as m, AbortedUploadQuota as n, DriveClient as o, EffectivePermissionAction as p, CreateFolderInput as r, DriveClientConfig as s, AbortUploadInput as t, DriveOperationResult as u, ListItemPermissionsInput as v, ReadEffectiveItemPermissionsInput as w, PermissionGrantee as x, PermissionAction as y };