@finueva/drive 0.1.1 → 0.3.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.
@@ -1,5 +1,137 @@
1
1
  //#region src/generated/openapi.d.ts
2
2
  interface operations {
3
+ getCurrentWorkspace: {
4
+ parameters: {
5
+ query?: never;
6
+ header?: never;
7
+ path?: never;
8
+ cookie?: never;
9
+ };
10
+ requestBody?: never;
11
+ responses: {
12
+ /** @description The exact managed workspace and canonical root selected by the Drive credential. */
13
+ 200: {
14
+ headers: {
15
+ [name: string]: unknown;
16
+ };
17
+ content: {
18
+ "application/json": {
19
+ rootItemId: string;
20
+ rootVolumeId: string;
21
+ workspaceId: string;
22
+ workspaceReference: {
23
+ /** @enum {string} */
24
+ type: "personal";
25
+ userId: string;
26
+ } | {
27
+ organizationId: string;
28
+ /** @enum {string} */
29
+ type: "organization";
30
+ };
31
+ };
32
+ };
33
+ };
34
+ /** @description A valid Drive user bearer credential is required. */
35
+ 401: {
36
+ headers: {
37
+ [name: string]: unknown;
38
+ };
39
+ content: {
40
+ "application/json": {
41
+ error: {
42
+ /** @enum {string} */
43
+ code: "authentication_required";
44
+ details: Record<string, never>;
45
+ /** @enum {string} */
46
+ message: "Authentication is required.";
47
+ requestId: string;
48
+ };
49
+ };
50
+ };
51
+ };
52
+ /** @description Managed storage is disabled for the current workspace. */
53
+ 403: {
54
+ headers: {
55
+ [name: string]: unknown;
56
+ };
57
+ content: {
58
+ "application/json": {
59
+ error: {
60
+ /** @enum {string} */
61
+ code: "permission_denied";
62
+ details: Record<string, never>;
63
+ /** @enum {string} */
64
+ message: "The requested action is not permitted.";
65
+ requestId: string;
66
+ };
67
+ };
68
+ };
69
+ };
70
+ /** @description The selected Auth workspace is not provisioned or is not available to this User. */
71
+ 404: {
72
+ headers: {
73
+ [name: string]: unknown;
74
+ };
75
+ content: {
76
+ "application/json": {
77
+ error: {
78
+ /** @enum {string} */
79
+ code: "resource_not_found";
80
+ details: Record<string, never>;
81
+ /** @enum {string} */
82
+ message: "The requested resource was not found.";
83
+ requestId: string;
84
+ };
85
+ };
86
+ };
87
+ };
88
+ /** @description The request contains unsupported query input. */
89
+ 422: {
90
+ headers: {
91
+ [name: string]: unknown;
92
+ };
93
+ content: {
94
+ "application/json": {
95
+ error: {
96
+ /** @enum {string} */
97
+ code: "invalid_request";
98
+ details: Record<string, never>;
99
+ /** @enum {string} */
100
+ message: "The request is invalid.";
101
+ requestId: string;
102
+ };
103
+ };
104
+ };
105
+ };
106
+ /** @description Identity authority, D1, or the canonical managed root is unavailable. */
107
+ 503: {
108
+ headers: {
109
+ [name: string]: unknown;
110
+ };
111
+ content: {
112
+ "application/json": {
113
+ error: {
114
+ /** @enum {string} */
115
+ code: "identity_authority_unavailable";
116
+ details: Record<string, never>;
117
+ /** @enum {string} */
118
+ message: "Authentication is temporarily unavailable.";
119
+ requestId: string;
120
+ };
121
+ } | {
122
+ error: {
123
+ /** @enum {string} */
124
+ code: "service_unavailable";
125
+ details: Record<string, never>;
126
+ /** @enum {string} */
127
+ message: "The service is temporarily unavailable.";
128
+ requestId: string;
129
+ };
130
+ };
131
+ };
132
+ };
133
+ };
134
+ };
3
135
  listFolderChildren: {
4
136
  parameters: {
5
137
  query?: {
@@ -1378,53 +1510,55 @@ interface operations {
1378
1510
  requestBody: {
1379
1511
  content: {
1380
1512
  "application/json": {
1513
+ /** @description Caller-declared whole-file SHA-256 metadata; it is not archive verification evidence. */
1514
+ callerDeclaredContentDigest: string;
1515
+ displayFilename: string;
1381
1516
  expectedByteLength: number;
1517
+ mediaType: string;
1382
1518
  parentItemId: string;
1519
+ /** @enum {string} */
1520
+ protectionClassification: "ordinary" | "opaque-encrypted";
1383
1521
  };
1384
1522
  };
1385
1523
  };
1386
1524
  responses: {
1387
- /** @description The exact retained reservation is replayed. */
1525
+ /** @description The exact retained transfer session is replayed. */
1388
1526
  200: {
1389
1527
  headers: {
1390
1528
  [name: string]: unknown;
1391
1529
  };
1392
1530
  content: {
1393
1531
  "application/json": {
1394
- createdAtEpochMilliseconds: number;
1395
- expectedByteLength: number;
1396
1532
  expiresAtEpochMilliseconds: number;
1397
- parentItemId: string;
1533
+ itemId: string;
1398
1534
  /** @enum {string} */
1399
- state: "reserved";
1400
- /** @enum {unknown|null} */
1401
- terminalAtEpochMilliseconds: null;
1402
- /** @enum {unknown|null} */
1403
- terminalReason: null;
1535
+ mode: "presigned-multipart" | "server-mediated-zero-byte";
1536
+ /** @enum {number} */
1537
+ partByteLength: 33554432;
1538
+ partCount: number;
1539
+ revision: number;
1404
1540
  uploadId: string;
1405
- workspaceId: string;
1541
+ versionId: string;
1406
1542
  };
1407
1543
  };
1408
1544
  };
1409
- /** @description Quota and mandatory D1 capacity are reserved. */
1545
+ /** @description The durable direct transfer session is created. */
1410
1546
  201: {
1411
1547
  headers: {
1412
1548
  [name: string]: unknown;
1413
1549
  };
1414
1550
  content: {
1415
1551
  "application/json": {
1416
- createdAtEpochMilliseconds: number;
1417
- expectedByteLength: number;
1418
1552
  expiresAtEpochMilliseconds: number;
1419
- parentItemId: string;
1553
+ itemId: string;
1420
1554
  /** @enum {string} */
1421
- state: "reserved";
1422
- /** @enum {unknown|null} */
1423
- terminalAtEpochMilliseconds: null;
1424
- /** @enum {unknown|null} */
1425
- terminalReason: null;
1555
+ mode: "presigned-multipart" | "server-mediated-zero-byte";
1556
+ /** @enum {number} */
1557
+ partByteLength: 33554432;
1558
+ partCount: number;
1559
+ revision: number;
1426
1560
  uploadId: string;
1427
- workspaceId: string;
1561
+ versionId: string;
1428
1562
  };
1429
1563
  };
1430
1564
  };
@@ -1482,7 +1616,7 @@ interface operations {
1482
1616
  };
1483
1617
  };
1484
1618
  };
1485
- /** @description Quota is exceeded, the key conflicts, or authority changed before commit. */
1619
+ /** @description Quota is exceeded, the key conflicts, authority changed, or provider-create recovery is required. */
1486
1620
  409: {
1487
1621
  headers: {
1488
1622
  [name: string]: unknown;
@@ -1515,6 +1649,15 @@ interface operations {
1515
1649
  message: "The request precondition failed.";
1516
1650
  requestId: string;
1517
1651
  };
1652
+ } | {
1653
+ error: {
1654
+ /** @enum {string} */
1655
+ code: "upload_recovery_required";
1656
+ details: Record<string, never>;
1657
+ /** @enum {string} */
1658
+ message: "The upload requires recovery before it can continue.";
1659
+ requestId: string;
1660
+ };
1518
1661
  };
1519
1662
  };
1520
1663
  };
@@ -1574,9 +1717,12 @@ interface operations {
1574
1717
  };
1575
1718
  };
1576
1719
  };
1577
- abortUpload: {
1720
+ getUploadStatus: {
1578
1721
  parameters: {
1579
- query?: never;
1722
+ query?: {
1723
+ afterPartNumber?: string;
1724
+ limit?: string;
1725
+ };
1580
1726
  header?: never;
1581
1727
  path: {
1582
1728
  workspaceId: string;
@@ -1586,28 +1732,50 @@ interface operations {
1586
1732
  };
1587
1733
  requestBody?: never;
1588
1734
  responses: {
1589
- /** @description The reservation is released or its exact abort is replayed. */
1735
+ /** @description The current upload lifecycle and one bounded confirmed-part page. */
1590
1736
  200: {
1591
1737
  headers: {
1592
1738
  [name: string]: unknown;
1593
1739
  };
1594
1740
  content: {
1595
1741
  "application/json": {
1596
- createdAtEpochMilliseconds: number;
1597
- expectedByteLength: number;
1742
+ confirmedParts: {
1743
+ checksumSha256: string;
1744
+ partNumber: number;
1745
+ }[];
1598
1746
  expiresAtEpochMilliseconds: number;
1599
- parentItemId: string;
1747
+ itemId: string;
1600
1748
  /** @enum {string} */
1601
- state: "released";
1602
- terminalAtEpochMilliseconds: number;
1749
+ lifecycle: "initiating" | "recovery-required" | "uploading" | "completing" | "provider-completed" | "ready" | "aborting" | "aborted";
1603
1750
  /** @enum {string} */
1604
- terminalReason: "aborted";
1751
+ mode: "presigned-multipart" | "server-mediated-zero-byte";
1752
+ nextAfterPartNumber: number | null;
1753
+ partPolicy: {
1754
+ /** @enum {number} */
1755
+ maxParts: 10000;
1756
+ /** @enum {number} */
1757
+ partByteLength: 33554432;
1758
+ partCount: number;
1759
+ };
1760
+ ready: {
1761
+ byteLength: number;
1762
+ /** @description Caller-declared whole-file SHA-256 metadata; archive publication is gated by provider checksum evidence. */
1763
+ callerDeclaredContentDigest: string;
1764
+ displayFilename: string;
1765
+ itemId: string;
1766
+ mediaType: string;
1767
+ /** @enum {string} */
1768
+ state: "ready";
1769
+ uploadId: string;
1770
+ versionId: string;
1771
+ } | null;
1772
+ revision: number;
1605
1773
  uploadId: string;
1606
- workspaceId: string;
1774
+ versionId: string;
1607
1775
  };
1608
1776
  };
1609
1777
  };
1610
- /** @description A valid Drive user bearer credential is required. */
1778
+ /** @description Authentication is required. */
1611
1779
  401: {
1612
1780
  headers: {
1613
1781
  [name: string]: unknown;
@@ -1625,7 +1793,7 @@ interface operations {
1625
1793
  };
1626
1794
  };
1627
1795
  };
1628
- /** @description The retained parent is discoverable but no longer permits item creation. */
1796
+ /** @description Permission is denied. */
1629
1797
  403: {
1630
1798
  headers: {
1631
1799
  [name: string]: unknown;
@@ -1643,7 +1811,7 @@ interface operations {
1643
1811
  };
1644
1812
  };
1645
1813
  };
1646
- /** @description The upload is unknown, cross-workspace, or its retained parent is undiscoverable. */
1814
+ /** @description The upload is not discoverable. */
1647
1815
  404: {
1648
1816
  headers: {
1649
1817
  [name: string]: unknown;
@@ -1661,8 +1829,8 @@ interface operations {
1661
1829
  };
1662
1830
  };
1663
1831
  };
1664
- /** @description Another terminal settlement won or parent authority changed before commit. */
1665
- 409: {
1832
+ /** @description The path, query, or unexpected request body is invalid. */
1833
+ 422: {
1666
1834
  headers: {
1667
1835
  [name: string]: unknown;
1668
1836
  };
@@ -1670,17 +1838,17 @@ interface operations {
1670
1838
  "application/json": {
1671
1839
  error: {
1672
1840
  /** @enum {string} */
1673
- code: "precondition_failed";
1841
+ code: "invalid_request";
1674
1842
  details: Record<string, never>;
1675
1843
  /** @enum {string} */
1676
- message: "The request precondition failed.";
1844
+ message: "The request is invalid.";
1677
1845
  requestId: string;
1678
1846
  };
1679
1847
  };
1680
1848
  };
1681
1849
  };
1682
- /** @description The path, query, or unexpected request body is invalid. */
1683
- 422: {
1850
+ /** @description Identity or the service is unavailable. */
1851
+ 503: {
1684
1852
  headers: {
1685
1853
  [name: string]: unknown;
1686
1854
  };
@@ -1688,17 +1856,47 @@ interface operations {
1688
1856
  "application/json": {
1689
1857
  error: {
1690
1858
  /** @enum {string} */
1691
- code: "invalid_request";
1859
+ code: "identity_authority_unavailable";
1692
1860
  details: Record<string, never>;
1693
1861
  /** @enum {string} */
1694
- message: "The request is invalid.";
1862
+ message: "Authentication is temporarily unavailable.";
1863
+ requestId: string;
1864
+ };
1865
+ } | {
1866
+ error: {
1867
+ /** @enum {string} */
1868
+ code: "service_unavailable";
1869
+ details: Record<string, never>;
1870
+ /** @enum {string} */
1871
+ message: "The service is temporarily unavailable.";
1695
1872
  requestId: string;
1696
1873
  };
1697
1874
  };
1698
1875
  };
1699
1876
  };
1700
- /** @description Identity, D1, authorization, or retained capacity authority is unavailable. */
1701
- 503: {
1877
+ };
1878
+ };
1879
+ abortUpload: {
1880
+ parameters: {
1881
+ query?: never;
1882
+ header?: never;
1883
+ path: {
1884
+ workspaceId: string;
1885
+ uploadId: string;
1886
+ };
1887
+ cookie?: never;
1888
+ };
1889
+ requestBody?: never;
1890
+ responses: {
1891
+ /** @description The provider upload is absent and the upload is terminal. */
1892
+ 204: {
1893
+ headers: {
1894
+ [name: string]: unknown;
1895
+ };
1896
+ content?: never;
1897
+ };
1898
+ /** @description A valid Drive user bearer credential is required. */
1899
+ 401: {
1702
1900
  headers: {
1703
1901
  [name: string]: unknown;
1704
1902
  };
@@ -1706,27 +1904,626 @@ interface operations {
1706
1904
  "application/json": {
1707
1905
  error: {
1708
1906
  /** @enum {string} */
1709
- code: "identity_authority_unavailable";
1907
+ code: "authentication_required";
1710
1908
  details: Record<string, never>;
1711
1909
  /** @enum {string} */
1712
- message: "Authentication is temporarily unavailable.";
1910
+ message: "Authentication is required.";
1911
+ requestId: string;
1912
+ };
1913
+ };
1914
+ };
1915
+ };
1916
+ /** @description The retained parent is discoverable but no longer permits item creation. */
1917
+ 403: {
1918
+ headers: {
1919
+ [name: string]: unknown;
1920
+ };
1921
+ content: {
1922
+ "application/json": {
1923
+ error: {
1924
+ /** @enum {string} */
1925
+ code: "permission_denied";
1926
+ details: Record<string, never>;
1927
+ /** @enum {string} */
1928
+ message: "The requested action is not permitted.";
1929
+ requestId: string;
1930
+ };
1931
+ };
1932
+ };
1933
+ };
1934
+ /** @description The upload is unknown, cross-workspace, or its retained parent is undiscoverable. */
1935
+ 404: {
1936
+ headers: {
1937
+ [name: string]: unknown;
1938
+ };
1939
+ content: {
1940
+ "application/json": {
1941
+ error: {
1942
+ /** @enum {string} */
1943
+ code: "resource_not_found";
1944
+ details: Record<string, never>;
1945
+ /** @enum {string} */
1946
+ message: "The requested resource was not found.";
1947
+ requestId: string;
1948
+ };
1949
+ };
1950
+ };
1951
+ };
1952
+ /** @description Another terminal settlement won, authority changed, or provider-create recovery is required. */
1953
+ 409: {
1954
+ headers: {
1955
+ [name: string]: unknown;
1956
+ };
1957
+ content: {
1958
+ "application/json": {
1959
+ error: {
1960
+ /** @enum {string} */
1961
+ code: "precondition_failed";
1962
+ details: Record<string, never>;
1963
+ /** @enum {string} */
1964
+ message: "The request precondition failed.";
1713
1965
  requestId: string;
1714
1966
  };
1715
1967
  } | {
1716
1968
  error: {
1717
1969
  /** @enum {string} */
1718
- code: "service_unavailable";
1970
+ code: "upload_recovery_required";
1719
1971
  details: Record<string, never>;
1720
1972
  /** @enum {string} */
1721
- message: "The service is temporarily unavailable.";
1973
+ message: "The upload requires recovery before it can continue.";
1722
1974
  requestId: string;
1723
1975
  };
1724
1976
  };
1725
1977
  };
1726
1978
  };
1727
- };
1728
- };
1729
- }
1979
+ /** @description The path, query, or unexpected request body is invalid. */
1980
+ 422: {
1981
+ headers: {
1982
+ [name: string]: unknown;
1983
+ };
1984
+ content: {
1985
+ "application/json": {
1986
+ error: {
1987
+ /** @enum {string} */
1988
+ code: "invalid_request";
1989
+ details: Record<string, never>;
1990
+ /** @enum {string} */
1991
+ message: "The request is invalid.";
1992
+ requestId: string;
1993
+ };
1994
+ };
1995
+ };
1996
+ };
1997
+ /** @description Identity, D1, authorization, or retained capacity authority is unavailable. */
1998
+ 503: {
1999
+ headers: {
2000
+ [name: string]: unknown;
2001
+ };
2002
+ content: {
2003
+ "application/json": {
2004
+ error: {
2005
+ /** @enum {string} */
2006
+ code: "identity_authority_unavailable";
2007
+ details: Record<string, never>;
2008
+ /** @enum {string} */
2009
+ message: "Authentication is temporarily unavailable.";
2010
+ requestId: string;
2011
+ };
2012
+ } | {
2013
+ error: {
2014
+ /** @enum {string} */
2015
+ code: "service_unavailable";
2016
+ details: Record<string, never>;
2017
+ /** @enum {string} */
2018
+ message: "The service is temporarily unavailable.";
2019
+ requestId: string;
2020
+ };
2021
+ };
2022
+ };
2023
+ };
2024
+ };
2025
+ };
2026
+ completeUpload: {
2027
+ parameters: {
2028
+ query?: never;
2029
+ header: {
2030
+ "Idempotency-Key": string;
2031
+ };
2032
+ path: {
2033
+ workspaceId: string;
2034
+ uploadId: string;
2035
+ };
2036
+ cookie?: never;
2037
+ };
2038
+ requestBody?: never;
2039
+ responses: {
2040
+ /** @description The verified current version is ready. */
2041
+ 200: {
2042
+ headers: {
2043
+ [name: string]: unknown;
2044
+ };
2045
+ content: {
2046
+ "application/json": {
2047
+ byteLength: number;
2048
+ /** @description Caller-declared whole-file SHA-256 metadata; archive publication is gated by provider checksum evidence. */
2049
+ callerDeclaredContentDigest: string;
2050
+ displayFilename: string;
2051
+ itemId: string;
2052
+ mediaType: string;
2053
+ /** @enum {string} */
2054
+ state: "ready";
2055
+ uploadId: string;
2056
+ versionId: string;
2057
+ };
2058
+ };
2059
+ };
2060
+ /** @description Authentication is required. */
2061
+ 401: {
2062
+ headers: {
2063
+ [name: string]: unknown;
2064
+ };
2065
+ content: {
2066
+ "application/json": {
2067
+ error: {
2068
+ /** @enum {string} */
2069
+ code: "authentication_required";
2070
+ details: Record<string, never>;
2071
+ /** @enum {string} */
2072
+ message: "Authentication is required.";
2073
+ requestId: string;
2074
+ };
2075
+ };
2076
+ };
2077
+ };
2078
+ /** @description Permission is denied. */
2079
+ 403: {
2080
+ headers: {
2081
+ [name: string]: unknown;
2082
+ };
2083
+ content: {
2084
+ "application/json": {
2085
+ error: {
2086
+ /** @enum {string} */
2087
+ code: "permission_denied";
2088
+ details: Record<string, never>;
2089
+ /** @enum {string} */
2090
+ message: "The requested action is not permitted.";
2091
+ requestId: string;
2092
+ };
2093
+ };
2094
+ };
2095
+ };
2096
+ /** @description The upload is not discoverable. */
2097
+ 404: {
2098
+ headers: {
2099
+ [name: string]: unknown;
2100
+ };
2101
+ content: {
2102
+ "application/json": {
2103
+ error: {
2104
+ /** @enum {string} */
2105
+ code: "resource_not_found";
2106
+ details: Record<string, never>;
2107
+ /** @enum {string} */
2108
+ message: "The requested resource was not found.";
2109
+ requestId: string;
2110
+ };
2111
+ };
2112
+ };
2113
+ };
2114
+ /** @description The upload is incomplete, conflicts, or requires recovery. */
2115
+ 409: {
2116
+ headers: {
2117
+ [name: string]: unknown;
2118
+ };
2119
+ content: {
2120
+ "application/json": {
2121
+ error: {
2122
+ /** @enum {string} */
2123
+ code: "precondition_failed";
2124
+ details: Record<string, never>;
2125
+ /** @enum {string} */
2126
+ message: "The request precondition failed.";
2127
+ requestId: string;
2128
+ };
2129
+ } | {
2130
+ error: {
2131
+ /** @enum {string} */
2132
+ code: "upload_recovery_required";
2133
+ details: Record<string, never>;
2134
+ /** @enum {string} */
2135
+ message: "The upload requires recovery before it can continue.";
2136
+ requestId: string;
2137
+ };
2138
+ };
2139
+ };
2140
+ };
2141
+ /** @description The request is invalid. */
2142
+ 422: {
2143
+ headers: {
2144
+ [name: string]: unknown;
2145
+ };
2146
+ content: {
2147
+ "application/json": {
2148
+ error: {
2149
+ /** @enum {string} */
2150
+ code: "invalid_request";
2151
+ details: Record<string, never>;
2152
+ /** @enum {string} */
2153
+ message: "The request is invalid.";
2154
+ requestId: string;
2155
+ };
2156
+ } | {
2157
+ error: {
2158
+ /** @enum {string} */
2159
+ code: "invalid_idempotency_key";
2160
+ details: Record<string, never>;
2161
+ /** @enum {string} */
2162
+ message: "The idempotency key is invalid.";
2163
+ requestId: string;
2164
+ };
2165
+ };
2166
+ };
2167
+ };
2168
+ /** @description Identity or the service is unavailable. */
2169
+ 503: {
2170
+ headers: {
2171
+ [name: string]: unknown;
2172
+ };
2173
+ content: {
2174
+ "application/json": {
2175
+ error: {
2176
+ /** @enum {string} */
2177
+ code: "identity_authority_unavailable";
2178
+ details: Record<string, never>;
2179
+ /** @enum {string} */
2180
+ message: "Authentication is temporarily unavailable.";
2181
+ requestId: string;
2182
+ };
2183
+ } | {
2184
+ error: {
2185
+ /** @enum {string} */
2186
+ code: "service_unavailable";
2187
+ details: Record<string, never>;
2188
+ /** @enum {string} */
2189
+ message: "The service is temporarily unavailable.";
2190
+ requestId: string;
2191
+ };
2192
+ };
2193
+ };
2194
+ };
2195
+ };
2196
+ };
2197
+ createUploadPartDescriptor: {
2198
+ parameters: {
2199
+ query?: never;
2200
+ header?: never;
2201
+ path: {
2202
+ workspaceId: string;
2203
+ uploadId: string;
2204
+ };
2205
+ cookie?: never;
2206
+ };
2207
+ requestBody: {
2208
+ content: {
2209
+ "application/json": {
2210
+ checksumSha256: string;
2211
+ partNumber: number;
2212
+ };
2213
+ };
2214
+ };
2215
+ responses: {
2216
+ /** @description One short-lived exact part capability. */
2217
+ 200: {
2218
+ headers: {
2219
+ [name: string]: unknown;
2220
+ };
2221
+ content: {
2222
+ "application/json": {
2223
+ expectedByteLength: number;
2224
+ expiresAtEpochMilliseconds: number;
2225
+ headers: {
2226
+ "x-amz-checksum-sha256": string;
2227
+ };
2228
+ /** @enum {string} */
2229
+ method: "PUT";
2230
+ partNumber: number;
2231
+ /** Format: uri */
2232
+ url: string;
2233
+ };
2234
+ };
2235
+ };
2236
+ /** @description Authentication is required. */
2237
+ 401: {
2238
+ headers: {
2239
+ [name: string]: unknown;
2240
+ };
2241
+ content: {
2242
+ "application/json": {
2243
+ error: {
2244
+ /** @enum {string} */
2245
+ code: "authentication_required";
2246
+ details: Record<string, never>;
2247
+ /** @enum {string} */
2248
+ message: "Authentication is required.";
2249
+ requestId: string;
2250
+ };
2251
+ };
2252
+ };
2253
+ };
2254
+ /** @description Permission is denied. */
2255
+ 403: {
2256
+ headers: {
2257
+ [name: string]: unknown;
2258
+ };
2259
+ content: {
2260
+ "application/json": {
2261
+ error: {
2262
+ /** @enum {string} */
2263
+ code: "permission_denied";
2264
+ details: Record<string, never>;
2265
+ /** @enum {string} */
2266
+ message: "The requested action is not permitted.";
2267
+ requestId: string;
2268
+ };
2269
+ };
2270
+ };
2271
+ };
2272
+ /** @description The upload is not discoverable. */
2273
+ 404: {
2274
+ headers: {
2275
+ [name: string]: unknown;
2276
+ };
2277
+ content: {
2278
+ "application/json": {
2279
+ error: {
2280
+ /** @enum {string} */
2281
+ code: "resource_not_found";
2282
+ details: Record<string, never>;
2283
+ /** @enum {string} */
2284
+ message: "The requested resource was not found.";
2285
+ requestId: string;
2286
+ };
2287
+ };
2288
+ };
2289
+ };
2290
+ /** @description The upload or part conflicts or requires recovery. */
2291
+ 409: {
2292
+ headers: {
2293
+ [name: string]: unknown;
2294
+ };
2295
+ content: {
2296
+ "application/json": {
2297
+ error: {
2298
+ /** @enum {string} */
2299
+ code: "precondition_failed";
2300
+ details: Record<string, never>;
2301
+ /** @enum {string} */
2302
+ message: "The request precondition failed.";
2303
+ requestId: string;
2304
+ };
2305
+ } | {
2306
+ error: {
2307
+ /** @enum {string} */
2308
+ code: "upload_recovery_required";
2309
+ details: Record<string, never>;
2310
+ /** @enum {string} */
2311
+ message: "The upload requires recovery before it can continue.";
2312
+ requestId: string;
2313
+ };
2314
+ };
2315
+ };
2316
+ };
2317
+ /** @description The request is invalid. */
2318
+ 422: {
2319
+ headers: {
2320
+ [name: string]: unknown;
2321
+ };
2322
+ content: {
2323
+ "application/json": {
2324
+ error: {
2325
+ /** @enum {string} */
2326
+ code: "invalid_request";
2327
+ details: Record<string, never>;
2328
+ /** @enum {string} */
2329
+ message: "The request is invalid.";
2330
+ requestId: string;
2331
+ };
2332
+ };
2333
+ };
2334
+ };
2335
+ /** @description Identity or the service is unavailable. */
2336
+ 503: {
2337
+ headers: {
2338
+ [name: string]: unknown;
2339
+ };
2340
+ content: {
2341
+ "application/json": {
2342
+ error: {
2343
+ /** @enum {string} */
2344
+ code: "identity_authority_unavailable";
2345
+ details: Record<string, never>;
2346
+ /** @enum {string} */
2347
+ message: "Authentication is temporarily unavailable.";
2348
+ requestId: string;
2349
+ };
2350
+ } | {
2351
+ error: {
2352
+ /** @enum {string} */
2353
+ code: "service_unavailable";
2354
+ details: Record<string, never>;
2355
+ /** @enum {string} */
2356
+ message: "The service is temporarily unavailable.";
2357
+ requestId: string;
2358
+ };
2359
+ };
2360
+ };
2361
+ };
2362
+ };
2363
+ };
2364
+ recordUploadPart: {
2365
+ parameters: {
2366
+ query?: never;
2367
+ header?: never;
2368
+ path: {
2369
+ workspaceId: string;
2370
+ uploadId: string;
2371
+ partNumber: string;
2372
+ };
2373
+ cookie?: never;
2374
+ };
2375
+ requestBody: {
2376
+ content: {
2377
+ "application/json": {
2378
+ byteLength: number;
2379
+ checksumSha256: string;
2380
+ etag: string;
2381
+ expectedUploadRevision: number;
2382
+ };
2383
+ };
2384
+ };
2385
+ responses: {
2386
+ /** @description The callback is retained or exactly replayed. */
2387
+ 200: {
2388
+ headers: {
2389
+ [name: string]: unknown;
2390
+ };
2391
+ content: {
2392
+ "application/json": {
2393
+ partNumber: number;
2394
+ revision: number;
2395
+ };
2396
+ };
2397
+ };
2398
+ /** @description Authentication is required. */
2399
+ 401: {
2400
+ headers: {
2401
+ [name: string]: unknown;
2402
+ };
2403
+ content: {
2404
+ "application/json": {
2405
+ error: {
2406
+ /** @enum {string} */
2407
+ code: "authentication_required";
2408
+ details: Record<string, never>;
2409
+ /** @enum {string} */
2410
+ message: "Authentication is required.";
2411
+ requestId: string;
2412
+ };
2413
+ };
2414
+ };
2415
+ };
2416
+ /** @description Permission is denied. */
2417
+ 403: {
2418
+ headers: {
2419
+ [name: string]: unknown;
2420
+ };
2421
+ content: {
2422
+ "application/json": {
2423
+ error: {
2424
+ /** @enum {string} */
2425
+ code: "permission_denied";
2426
+ details: Record<string, never>;
2427
+ /** @enum {string} */
2428
+ message: "The requested action is not permitted.";
2429
+ requestId: string;
2430
+ };
2431
+ };
2432
+ };
2433
+ };
2434
+ /** @description The upload is not discoverable. */
2435
+ 404: {
2436
+ headers: {
2437
+ [name: string]: unknown;
2438
+ };
2439
+ content: {
2440
+ "application/json": {
2441
+ error: {
2442
+ /** @enum {string} */
2443
+ code: "resource_not_found";
2444
+ details: Record<string, never>;
2445
+ /** @enum {string} */
2446
+ message: "The requested resource was not found.";
2447
+ requestId: string;
2448
+ };
2449
+ };
2450
+ };
2451
+ };
2452
+ /** @description The callback conflicts or requires recovery. */
2453
+ 409: {
2454
+ headers: {
2455
+ [name: string]: unknown;
2456
+ };
2457
+ content: {
2458
+ "application/json": {
2459
+ error: {
2460
+ /** @enum {string} */
2461
+ code: "precondition_failed";
2462
+ details: Record<string, never>;
2463
+ /** @enum {string} */
2464
+ message: "The request precondition failed.";
2465
+ requestId: string;
2466
+ };
2467
+ } | {
2468
+ error: {
2469
+ /** @enum {string} */
2470
+ code: "upload_recovery_required";
2471
+ details: Record<string, never>;
2472
+ /** @enum {string} */
2473
+ message: "The upload requires recovery before it can continue.";
2474
+ requestId: string;
2475
+ };
2476
+ };
2477
+ };
2478
+ };
2479
+ /** @description The request is invalid. */
2480
+ 422: {
2481
+ headers: {
2482
+ [name: string]: unknown;
2483
+ };
2484
+ content: {
2485
+ "application/json": {
2486
+ error: {
2487
+ /** @enum {string} */
2488
+ code: "invalid_request";
2489
+ details: Record<string, never>;
2490
+ /** @enum {string} */
2491
+ message: "The request is invalid.";
2492
+ requestId: string;
2493
+ };
2494
+ };
2495
+ };
2496
+ };
2497
+ /** @description Identity or the service is unavailable. */
2498
+ 503: {
2499
+ headers: {
2500
+ [name: string]: unknown;
2501
+ };
2502
+ content: {
2503
+ "application/json": {
2504
+ error: {
2505
+ /** @enum {string} */
2506
+ code: "identity_authority_unavailable";
2507
+ details: Record<string, never>;
2508
+ /** @enum {string} */
2509
+ message: "Authentication is temporarily unavailable.";
2510
+ requestId: string;
2511
+ };
2512
+ } | {
2513
+ error: {
2514
+ /** @enum {string} */
2515
+ code: "service_unavailable";
2516
+ details: Record<string, never>;
2517
+ /** @enum {string} */
2518
+ message: "The service is temporarily unavailable.";
2519
+ requestId: string;
2520
+ };
2521
+ };
2522
+ };
2523
+ };
2524
+ };
2525
+ };
2526
+ }
1730
2527
  //#endregion
1731
2528
  //#region src/types.d.ts
1732
2529
  type JsonResponse<Name extends keyof operations, Status extends keyof operations[Name]["responses"]> = operations[Name]["responses"][Status] extends {
@@ -1753,11 +2550,32 @@ type GrantMutationHeaders = operations["updateItemPermission"]["parameters"]["he
1753
2550
  type CreateUploadPath = operations["createUpload"]["parameters"]["path"];
1754
2551
  type CreateUploadHeaders = operations["createUpload"]["parameters"]["header"];
1755
2552
  type CreateUploadBody = JsonRequest<"createUpload">;
2553
+ type UploadPath = operations["abortUpload"]["parameters"]["path"];
2554
+ type UploadStatusPath = operations["getUploadStatus"]["parameters"]["path"];
2555
+ type CreateUploadPartDescriptorBody = JsonRequest<"createUploadPartDescriptor">;
2556
+ type RecordUploadPartPath = operations["recordUploadPart"]["parameters"]["path"];
2557
+ type RecordUploadPartBody = JsonRequest<"recordUploadPart">;
2558
+ type CompleteUploadHeaders = operations["completeUpload"]["parameters"]["header"];
1756
2559
  type AbortUploadPath = operations["abortUpload"]["parameters"]["path"];
2560
+ type GeneratedCurrentWorkspace = JsonResponse<"getCurrentWorkspace", 200>;
2561
+ type CurrentWorkspace = Readonly<Omit<GeneratedCurrentWorkspace, "workspaceReference"> & {
2562
+ readonly workspaceReference: Readonly<GeneratedCurrentWorkspace["workspaceReference"]>;
2563
+ }>;
1757
2564
  type FolderItem = Readonly<JsonResponse<"createFolder", 201>>;
1758
- type ReservedUploadQuota = Readonly<JsonResponse<"createUpload", 201>>;
1759
- type AbortedUploadQuota = Readonly<JsonResponse<"abortUpload", 200>>;
1760
- type UploadQuotaReservation = ReservedUploadQuota | AbortedUploadQuota;
2565
+ type UploadSession = Readonly<JsonResponse<"createUpload", 201>>;
2566
+ type UploadPartDescriptor = Readonly<Omit<JsonResponse<"createUploadPartDescriptor", 200>, "headers"> & {
2567
+ readonly headers: Readonly<JsonResponse<"createUploadPartDescriptor", 200>["headers"]>;
2568
+ }>;
2569
+ type UploadPartResult = Readonly<JsonResponse<"recordUploadPart", 200>>;
2570
+ type ReadyUpload = Readonly<JsonResponse<"completeUpload", 200>>;
2571
+ type GeneratedUploadStatus = JsonResponse<"getUploadStatus", 200>;
2572
+ type UploadConfirmedPart = Readonly<GeneratedUploadStatus["confirmedParts"][number]>;
2573
+ type UploadStatus = Readonly<Omit<GeneratedUploadStatus, "confirmedParts" | "partPolicy" | "ready"> & {
2574
+ readonly confirmedParts: readonly UploadConfirmedPart[];
2575
+ readonly partPolicy: Readonly<GeneratedUploadStatus["partPolicy"]>;
2576
+ readonly ready: ReadyUpload | null;
2577
+ }>;
2578
+ type ProtectionClassification = CreateUploadBody["protectionClassification"];
1761
2579
  type PermissionAction = CreatePermissionBody["actions"][number];
1762
2580
  type PermissionGrantee = Readonly<CreatePermissionBody["grantee"]>;
1763
2581
  type GeneratedPermissionGrant = JsonResponse<"listItemPermissions", 200>["items"][number];
@@ -1838,10 +2656,51 @@ type CreateUploadInput = Readonly<CreateUploadPath> & Readonly<CreateUploadBody>
1838
2656
  readonly idempotencyKey: CreateUploadHeaders["Idempotency-Key"];
1839
2657
  readonly signal?: AbortSignal;
1840
2658
  };
2659
+ type CreateUploadPartDescriptorInput = Readonly<UploadPath> & Readonly<CreateUploadPartDescriptorBody> & {
2660
+ readonly signal?: AbortSignal;
2661
+ };
2662
+ type GetUploadStatusInput = Readonly<UploadStatusPath> & {
2663
+ readonly afterPartNumber?: number;
2664
+ readonly limit?: number;
2665
+ readonly signal?: AbortSignal;
2666
+ };
2667
+ type RecordUploadPartInput = Readonly<Omit<RecordUploadPartPath, "partNumber">> & Readonly<RecordUploadPartBody> & {
2668
+ readonly partNumber: number;
2669
+ readonly signal?: AbortSignal;
2670
+ };
2671
+ type CompleteUploadInput = Readonly<UploadPath> & {
2672
+ readonly idempotencyKey: CompleteUploadHeaders["Idempotency-Key"];
2673
+ readonly signal?: AbortSignal;
2674
+ };
1841
2675
  type AbortUploadInput = Readonly<AbortUploadPath> & {
1842
2676
  readonly signal?: AbortSignal;
1843
2677
  };
1844
- interface DriveClient {
2678
+ type UploadFilePhase = "preparing" | "uploading" | "completing";
2679
+ interface UploadFileProgress {
2680
+ readonly phase: UploadFilePhase;
2681
+ readonly confirmedByteLength: number;
2682
+ readonly totalByteLength: number;
2683
+ readonly confirmedPartCount: number;
2684
+ readonly totalPartCount: number;
2685
+ }
2686
+ type UploadFileProgressCallback = (progress: UploadFileProgress) => void;
2687
+ interface UploadFileInput {
2688
+ readonly workspaceId: string;
2689
+ readonly parentItemId: string;
2690
+ readonly source: Blob;
2691
+ readonly displayFilename: string;
2692
+ readonly mediaType?: string;
2693
+ readonly protectionClassification?: ProtectionClassification;
2694
+ readonly idempotencyKey: string;
2695
+ readonly completionIdempotencyKey: string;
2696
+ readonly signal?: AbortSignal;
2697
+ readonly onProgress?: UploadFileProgressCallback;
2698
+ }
2699
+ interface GetCurrentWorkspaceInput {
2700
+ readonly signal?: AbortSignal;
2701
+ }
2702
+ interface DriveOperations {
2703
+ getCurrentWorkspace(input?: GetCurrentWorkspaceInput): Promise<DriveOperationResult<CurrentWorkspace, 200>>;
1845
2704
  listFolderChildren(input: ListFolderChildrenInput): Promise<DriveOperationResult<FolderPage, 200>>;
1846
2705
  createFolder(input: CreateFolderInput): Promise<DriveOperationResult<FolderItem, 200 | 201>>;
1847
2706
  listItemPermissions(input: ListItemPermissionsInput): Promise<DriveOperationResult<PermissionPage, 200>>;
@@ -1849,8 +2708,16 @@ interface DriveClient {
1849
2708
  createItemPermission(input: CreateItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200 | 201>>;
1850
2709
  updateItemPermission(input: UpdateItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200>>;
1851
2710
  revokeItemPermission(input: RevokeItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200>>;
1852
- createUpload(input: CreateUploadInput): Promise<DriveOperationResult<ReservedUploadQuota, 200 | 201>>;
1853
- abortUpload(input: AbortUploadInput): Promise<DriveOperationResult<AbortedUploadQuota, 200>>;
2711
+ createUpload(input: CreateUploadInput): Promise<DriveOperationResult<UploadSession, 200 | 201>>;
2712
+ getUploadStatus(input: GetUploadStatusInput): Promise<DriveOperationResult<UploadStatus, 200>>;
2713
+ createUploadPartDescriptor(input: CreateUploadPartDescriptorInput): Promise<DriveOperationResult<UploadPartDescriptor, 200>>;
2714
+ recordUploadPart(input: RecordUploadPartInput): Promise<DriveOperationResult<UploadPartResult, 200>>;
2715
+ completeUpload(input: CompleteUploadInput): Promise<DriveOperationResult<ReadyUpload, 200>>;
2716
+ abortUpload(input: AbortUploadInput): Promise<DriveOperationResult<undefined, 204>>;
2717
+ }
2718
+ interface DriveServerClient extends DriveOperations {}
2719
+ interface DriveClient extends DriveOperations {
2720
+ uploadFile(input: UploadFileInput): Promise<DriveOperationResult<ReadyUpload, 200>>;
1854
2721
  }
1855
2722
  //#endregion
1856
- 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 };
2723
+ export { ProtectionClassification as A, UploadFileProgressCallback as B, ListFolderChildrenInput as C, PermissionGrantee as D, PermissionGrant as E, UpdateItemPermissionInput as F, UploadPartResult as H, UploadConfirmedPart as I, UploadFileInput as L, ReadyUpload as M, RecordUploadPartInput as N, PermissionMutation as O, RevokeItemPermissionInput as P, UploadFilePhase as R, GetUploadStatusInput as S, PermissionAction as T, UploadSession as U, UploadPartDescriptor as V, UploadStatus as W, EffectivePermissionAction as _, CreateUploadInput as a, FolderPage as b, DriveClient as c, DriveCredentialProvider as d, DriveOperationResult as f, DriveServerClientConfig as g, DriveServerClient as h, CreateItemPermissionInput as i, ReadEffectiveItemPermissionsInput as j, PermissionPage as k, DriveClientConfig as l, DriveResponseValidators as m, CompleteUploadInput as n, CreateUploadPartDescriptorInput as o, DriveOperations as p, CreateFolderInput as r, CurrentWorkspace as s, AbortUploadInput as t, DriveCredentialContext as u, EffectivePermissionResponse as v, ListItemPermissionsInput as w, GetCurrentWorkspaceInput as x, FolderItem as y, UploadFileProgress as z };