@finueva/drive 0.2.0 → 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.
@@ -1510,57 +1510,554 @@ interface operations {
1510
1510
  requestBody: {
1511
1511
  content: {
1512
1512
  "application/json": {
1513
+ /** @description Caller-declared whole-file SHA-256 metadata; it is not archive verification evidence. */
1514
+ callerDeclaredContentDigest: string;
1515
+ displayFilename: string;
1513
1516
  expectedByteLength: number;
1517
+ mediaType: string;
1514
1518
  parentItemId: string;
1519
+ /** @enum {string} */
1520
+ protectionClassification: "ordinary" | "opaque-encrypted";
1515
1521
  };
1516
1522
  };
1517
1523
  };
1518
1524
  responses: {
1519
- /** @description The exact retained reservation is replayed. */
1525
+ /** @description The exact retained transfer session is replayed. */
1520
1526
  200: {
1521
1527
  headers: {
1522
1528
  [name: string]: unknown;
1523
1529
  };
1524
1530
  content: {
1525
1531
  "application/json": {
1526
- createdAtEpochMilliseconds: number;
1527
- expectedByteLength: number;
1528
1532
  expiresAtEpochMilliseconds: number;
1529
- parentItemId: string;
1533
+ itemId: string;
1530
1534
  /** @enum {string} */
1531
- state: "reserved";
1532
- /** @enum {unknown|null} */
1533
- terminalAtEpochMilliseconds: null;
1534
- /** @enum {unknown|null} */
1535
- terminalReason: null;
1535
+ mode: "presigned-multipart" | "server-mediated-zero-byte";
1536
+ /** @enum {number} */
1537
+ partByteLength: 33554432;
1538
+ partCount: number;
1539
+ revision: number;
1536
1540
  uploadId: string;
1537
- workspaceId: string;
1541
+ versionId: string;
1542
+ };
1543
+ };
1544
+ };
1545
+ /** @description The durable direct transfer session is created. */
1546
+ 201: {
1547
+ headers: {
1548
+ [name: string]: unknown;
1549
+ };
1550
+ content: {
1551
+ "application/json": {
1552
+ expiresAtEpochMilliseconds: number;
1553
+ itemId: string;
1554
+ /** @enum {string} */
1555
+ mode: "presigned-multipart" | "server-mediated-zero-byte";
1556
+ /** @enum {number} */
1557
+ partByteLength: 33554432;
1558
+ partCount: number;
1559
+ revision: number;
1560
+ uploadId: string;
1561
+ versionId: string;
1562
+ };
1563
+ };
1564
+ };
1565
+ /** @description A valid Drive user bearer credential is required. */
1566
+ 401: {
1567
+ headers: {
1568
+ [name: string]: unknown;
1569
+ };
1570
+ content: {
1571
+ "application/json": {
1572
+ error: {
1573
+ /** @enum {string} */
1574
+ code: "authentication_required";
1575
+ details: Record<string, never>;
1576
+ /** @enum {string} */
1577
+ message: "Authentication is required.";
1578
+ requestId: string;
1579
+ };
1580
+ };
1581
+ };
1582
+ };
1583
+ /** @description Managed storage is disabled or the discoverable parent does not permit item creation. */
1584
+ 403: {
1585
+ headers: {
1586
+ [name: string]: unknown;
1587
+ };
1588
+ content: {
1589
+ "application/json": {
1590
+ error: {
1591
+ /** @enum {string} */
1592
+ code: "permission_denied";
1593
+ details: Record<string, never>;
1594
+ /** @enum {string} */
1595
+ message: "The requested action is not permitted.";
1596
+ requestId: string;
1597
+ };
1598
+ };
1599
+ };
1600
+ };
1601
+ /** @description The parent is absent or undiscoverable. */
1602
+ 404: {
1603
+ headers: {
1604
+ [name: string]: unknown;
1605
+ };
1606
+ content: {
1607
+ "application/json": {
1608
+ error: {
1609
+ /** @enum {string} */
1610
+ code: "resource_not_found";
1611
+ details: Record<string, never>;
1612
+ /** @enum {string} */
1613
+ message: "The requested resource was not found.";
1614
+ requestId: string;
1615
+ };
1616
+ };
1617
+ };
1618
+ };
1619
+ /** @description Quota is exceeded, the key conflicts, authority changed, or provider-create recovery is required. */
1620
+ 409: {
1621
+ headers: {
1622
+ [name: string]: unknown;
1623
+ };
1624
+ content: {
1625
+ "application/json": {
1626
+ error: {
1627
+ /** @enum {string} */
1628
+ code: "quota_exceeded";
1629
+ details: Record<string, never>;
1630
+ /** @enum {string} */
1631
+ message: "The workspace storage quota would be exceeded.";
1632
+ requestId: string;
1633
+ };
1634
+ } | {
1635
+ error: {
1636
+ /** @enum {string} */
1637
+ code: "idempotency_conflict";
1638
+ details: Record<string, never>;
1639
+ /** @enum {string} */
1640
+ message: "The idempotency key conflicts with an earlier request.";
1641
+ requestId: string;
1642
+ };
1643
+ } | {
1644
+ error: {
1645
+ /** @enum {string} */
1646
+ code: "precondition_failed";
1647
+ details: Record<string, never>;
1648
+ /** @enum {string} */
1649
+ message: "The request precondition failed.";
1650
+ requestId: string;
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
+ };
1661
+ };
1662
+ };
1663
+ };
1664
+ /** @description The path, key, media type, or strict request body is invalid. */
1665
+ 422: {
1666
+ headers: {
1667
+ [name: string]: unknown;
1668
+ };
1669
+ content: {
1670
+ "application/json": {
1671
+ error: {
1672
+ /** @enum {string} */
1673
+ code: "invalid_request";
1674
+ details: Record<string, never>;
1675
+ /** @enum {string} */
1676
+ message: "The request is invalid.";
1677
+ requestId: string;
1678
+ };
1679
+ } | {
1680
+ error: {
1681
+ /** @enum {string} */
1682
+ code: "invalid_idempotency_key";
1683
+ details: Record<string, never>;
1684
+ /** @enum {string} */
1685
+ message: "The idempotency key is invalid.";
1686
+ requestId: string;
1687
+ };
1688
+ };
1689
+ };
1690
+ };
1691
+ /** @description Identity, D1, authorization, entitlement, or trusted capacity authority is unavailable. */
1692
+ 503: {
1693
+ headers: {
1694
+ [name: string]: unknown;
1695
+ };
1696
+ content: {
1697
+ "application/json": {
1698
+ error: {
1699
+ /** @enum {string} */
1700
+ code: "identity_authority_unavailable";
1701
+ details: Record<string, never>;
1702
+ /** @enum {string} */
1703
+ message: "Authentication is temporarily unavailable.";
1704
+ requestId: string;
1705
+ };
1706
+ } | {
1707
+ error: {
1708
+ /** @enum {string} */
1709
+ code: "service_unavailable";
1710
+ details: Record<string, never>;
1711
+ /** @enum {string} */
1712
+ message: "The service is temporarily unavailable.";
1713
+ requestId: string;
1714
+ };
1715
+ };
1716
+ };
1717
+ };
1718
+ };
1719
+ };
1720
+ getUploadStatus: {
1721
+ parameters: {
1722
+ query?: {
1723
+ afterPartNumber?: string;
1724
+ limit?: string;
1725
+ };
1726
+ header?: never;
1727
+ path: {
1728
+ workspaceId: string;
1729
+ uploadId: string;
1730
+ };
1731
+ cookie?: never;
1732
+ };
1733
+ requestBody?: never;
1734
+ responses: {
1735
+ /** @description The current upload lifecycle and one bounded confirmed-part page. */
1736
+ 200: {
1737
+ headers: {
1738
+ [name: string]: unknown;
1739
+ };
1740
+ content: {
1741
+ "application/json": {
1742
+ confirmedParts: {
1743
+ checksumSha256: string;
1744
+ partNumber: number;
1745
+ }[];
1746
+ expiresAtEpochMilliseconds: number;
1747
+ itemId: string;
1748
+ /** @enum {string} */
1749
+ lifecycle: "initiating" | "recovery-required" | "uploading" | "completing" | "provider-completed" | "ready" | "aborting" | "aborted";
1750
+ /** @enum {string} */
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;
1773
+ uploadId: string;
1774
+ versionId: string;
1775
+ };
1776
+ };
1777
+ };
1778
+ /** @description Authentication is required. */
1779
+ 401: {
1780
+ headers: {
1781
+ [name: string]: unknown;
1782
+ };
1783
+ content: {
1784
+ "application/json": {
1785
+ error: {
1786
+ /** @enum {string} */
1787
+ code: "authentication_required";
1788
+ details: Record<string, never>;
1789
+ /** @enum {string} */
1790
+ message: "Authentication is required.";
1791
+ requestId: string;
1792
+ };
1793
+ };
1794
+ };
1795
+ };
1796
+ /** @description Permission is denied. */
1797
+ 403: {
1798
+ headers: {
1799
+ [name: string]: unknown;
1800
+ };
1801
+ content: {
1802
+ "application/json": {
1803
+ error: {
1804
+ /** @enum {string} */
1805
+ code: "permission_denied";
1806
+ details: Record<string, never>;
1807
+ /** @enum {string} */
1808
+ message: "The requested action is not permitted.";
1809
+ requestId: string;
1810
+ };
1811
+ };
1812
+ };
1813
+ };
1814
+ /** @description The upload is not discoverable. */
1815
+ 404: {
1816
+ headers: {
1817
+ [name: string]: unknown;
1818
+ };
1819
+ content: {
1820
+ "application/json": {
1821
+ error: {
1822
+ /** @enum {string} */
1823
+ code: "resource_not_found";
1824
+ details: Record<string, never>;
1825
+ /** @enum {string} */
1826
+ message: "The requested resource was not found.";
1827
+ requestId: string;
1828
+ };
1829
+ };
1830
+ };
1831
+ };
1832
+ /** @description The path, query, or unexpected request body is invalid. */
1833
+ 422: {
1834
+ headers: {
1835
+ [name: string]: unknown;
1836
+ };
1837
+ content: {
1838
+ "application/json": {
1839
+ error: {
1840
+ /** @enum {string} */
1841
+ code: "invalid_request";
1842
+ details: Record<string, never>;
1843
+ /** @enum {string} */
1844
+ message: "The request is invalid.";
1845
+ requestId: string;
1846
+ };
1847
+ };
1848
+ };
1849
+ };
1850
+ /** @description Identity or the service is unavailable. */
1851
+ 503: {
1852
+ headers: {
1853
+ [name: string]: unknown;
1854
+ };
1855
+ content: {
1856
+ "application/json": {
1857
+ error: {
1858
+ /** @enum {string} */
1859
+ code: "identity_authority_unavailable";
1860
+ details: Record<string, never>;
1861
+ /** @enum {string} */
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.";
1872
+ requestId: string;
1873
+ };
1874
+ };
1875
+ };
1876
+ };
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: {
1900
+ headers: {
1901
+ [name: string]: unknown;
1902
+ };
1903
+ content: {
1904
+ "application/json": {
1905
+ error: {
1906
+ /** @enum {string} */
1907
+ code: "authentication_required";
1908
+ details: Record<string, never>;
1909
+ /** @enum {string} */
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.";
1965
+ requestId: string;
1966
+ };
1967
+ } | {
1968
+ error: {
1969
+ /** @enum {string} */
1970
+ code: "upload_recovery_required";
1971
+ details: Record<string, never>;
1972
+ /** @enum {string} */
1973
+ message: "The upload requires recovery before it can continue.";
1974
+ requestId: string;
1975
+ };
1976
+ };
1977
+ };
1978
+ };
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
+ };
1538
1994
  };
1539
1995
  };
1540
1996
  };
1541
- /** @description Quota and mandatory D1 capacity are reserved. */
1542
- 201: {
1997
+ /** @description Identity, D1, authorization, or retained capacity authority is unavailable. */
1998
+ 503: {
1543
1999
  headers: {
1544
2000
  [name: string]: unknown;
1545
2001
  };
1546
2002
  content: {
1547
2003
  "application/json": {
1548
- createdAtEpochMilliseconds: number;
1549
- expectedByteLength: number;
1550
- expiresAtEpochMilliseconds: number;
1551
- parentItemId: string;
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;
1552
2053
  /** @enum {string} */
1553
- state: "reserved";
1554
- /** @enum {unknown|null} */
1555
- terminalAtEpochMilliseconds: null;
1556
- /** @enum {unknown|null} */
1557
- terminalReason: null;
2054
+ state: "ready";
1558
2055
  uploadId: string;
1559
- workspaceId: string;
2056
+ versionId: string;
1560
2057
  };
1561
2058
  };
1562
2059
  };
1563
- /** @description A valid Drive user bearer credential is required. */
2060
+ /** @description Authentication is required. */
1564
2061
  401: {
1565
2062
  headers: {
1566
2063
  [name: string]: unknown;
@@ -1578,7 +2075,7 @@ interface operations {
1578
2075
  };
1579
2076
  };
1580
2077
  };
1581
- /** @description Managed storage is disabled or the discoverable parent does not permit item creation. */
2078
+ /** @description Permission is denied. */
1582
2079
  403: {
1583
2080
  headers: {
1584
2081
  [name: string]: unknown;
@@ -1596,7 +2093,7 @@ interface operations {
1596
2093
  };
1597
2094
  };
1598
2095
  };
1599
- /** @description The parent is absent or undiscoverable. */
2096
+ /** @description The upload is not discoverable. */
1600
2097
  404: {
1601
2098
  headers: {
1602
2099
  [name: string]: unknown;
@@ -1614,7 +2111,7 @@ interface operations {
1614
2111
  };
1615
2112
  };
1616
2113
  };
1617
- /** @description Quota is exceeded, the key conflicts, or authority changed before commit. */
2114
+ /** @description The upload is incomplete, conflicts, or requires recovery. */
1618
2115
  409: {
1619
2116
  headers: {
1620
2117
  [name: string]: unknown;
@@ -1623,34 +2120,25 @@ interface operations {
1623
2120
  "application/json": {
1624
2121
  error: {
1625
2122
  /** @enum {string} */
1626
- code: "quota_exceeded";
1627
- details: Record<string, never>;
1628
- /** @enum {string} */
1629
- message: "The workspace storage quota would be exceeded.";
1630
- requestId: string;
1631
- };
1632
- } | {
1633
- error: {
1634
- /** @enum {string} */
1635
- code: "idempotency_conflict";
2123
+ code: "precondition_failed";
1636
2124
  details: Record<string, never>;
1637
2125
  /** @enum {string} */
1638
- message: "The idempotency key conflicts with an earlier request.";
2126
+ message: "The request precondition failed.";
1639
2127
  requestId: string;
1640
2128
  };
1641
2129
  } | {
1642
2130
  error: {
1643
2131
  /** @enum {string} */
1644
- code: "precondition_failed";
2132
+ code: "upload_recovery_required";
1645
2133
  details: Record<string, never>;
1646
2134
  /** @enum {string} */
1647
- message: "The request precondition failed.";
2135
+ message: "The upload requires recovery before it can continue.";
1648
2136
  requestId: string;
1649
2137
  };
1650
2138
  };
1651
2139
  };
1652
2140
  };
1653
- /** @description The path, key, media type, or strict request body is invalid. */
2141
+ /** @description The request is invalid. */
1654
2142
  422: {
1655
2143
  headers: {
1656
2144
  [name: string]: unknown;
@@ -1677,7 +2165,7 @@ interface operations {
1677
2165
  };
1678
2166
  };
1679
2167
  };
1680
- /** @description Identity, D1, authorization, entitlement, or trusted capacity authority is unavailable. */
2168
+ /** @description Identity or the service is unavailable. */
1681
2169
  503: {
1682
2170
  headers: {
1683
2171
  [name: string]: unknown;
@@ -1706,7 +2194,7 @@ interface operations {
1706
2194
  };
1707
2195
  };
1708
2196
  };
1709
- abortUpload: {
2197
+ createUploadPartDescriptor: {
1710
2198
  parameters: {
1711
2199
  query?: never;
1712
2200
  header?: never;
@@ -1716,30 +2204,36 @@ interface operations {
1716
2204
  };
1717
2205
  cookie?: never;
1718
2206
  };
1719
- requestBody?: never;
2207
+ requestBody: {
2208
+ content: {
2209
+ "application/json": {
2210
+ checksumSha256: string;
2211
+ partNumber: number;
2212
+ };
2213
+ };
2214
+ };
1720
2215
  responses: {
1721
- /** @description The reservation is released or its exact abort is replayed. */
2216
+ /** @description One short-lived exact part capability. */
1722
2217
  200: {
1723
2218
  headers: {
1724
2219
  [name: string]: unknown;
1725
2220
  };
1726
2221
  content: {
1727
2222
  "application/json": {
1728
- createdAtEpochMilliseconds: number;
1729
2223
  expectedByteLength: number;
1730
2224
  expiresAtEpochMilliseconds: number;
1731
- parentItemId: string;
1732
- /** @enum {string} */
1733
- state: "released";
1734
- terminalAtEpochMilliseconds: number;
2225
+ headers: {
2226
+ "x-amz-checksum-sha256": string;
2227
+ };
1735
2228
  /** @enum {string} */
1736
- terminalReason: "aborted";
1737
- uploadId: string;
1738
- workspaceId: string;
2229
+ method: "PUT";
2230
+ partNumber: number;
2231
+ /** Format: uri */
2232
+ url: string;
1739
2233
  };
1740
2234
  };
1741
2235
  };
1742
- /** @description A valid Drive user bearer credential is required. */
2236
+ /** @description Authentication is required. */
1743
2237
  401: {
1744
2238
  headers: {
1745
2239
  [name: string]: unknown;
@@ -1757,7 +2251,7 @@ interface operations {
1757
2251
  };
1758
2252
  };
1759
2253
  };
1760
- /** @description The retained parent is discoverable but no longer permits item creation. */
2254
+ /** @description Permission is denied. */
1761
2255
  403: {
1762
2256
  headers: {
1763
2257
  [name: string]: unknown;
@@ -1775,7 +2269,7 @@ interface operations {
1775
2269
  };
1776
2270
  };
1777
2271
  };
1778
- /** @description The upload is unknown, cross-workspace, or its retained parent is undiscoverable. */
2272
+ /** @description The upload is not discoverable. */
1779
2273
  404: {
1780
2274
  headers: {
1781
2275
  [name: string]: unknown;
@@ -1793,7 +2287,7 @@ interface operations {
1793
2287
  };
1794
2288
  };
1795
2289
  };
1796
- /** @description Another terminal settlement won or parent authority changed before commit. */
2290
+ /** @description The upload or part conflicts or requires recovery. */
1797
2291
  409: {
1798
2292
  headers: {
1799
2293
  [name: string]: unknown;
@@ -1808,10 +2302,19 @@ interface operations {
1808
2302
  message: "The request precondition failed.";
1809
2303
  requestId: string;
1810
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
+ };
1811
2314
  };
1812
2315
  };
1813
2316
  };
1814
- /** @description The path, query, or unexpected request body is invalid. */
2317
+ /** @description The request is invalid. */
1815
2318
  422: {
1816
2319
  headers: {
1817
2320
  [name: string]: unknown;
@@ -1829,7 +2332,169 @@ interface operations {
1829
2332
  };
1830
2333
  };
1831
2334
  };
1832
- /** @description Identity, D1, authorization, or retained capacity authority is unavailable. */
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. */
1833
2498
  503: {
1834
2499
  headers: {
1835
2500
  [name: string]: unknown;
@@ -1885,15 +2550,32 @@ type GrantMutationHeaders = operations["updateItemPermission"]["parameters"]["he
1885
2550
  type CreateUploadPath = operations["createUpload"]["parameters"]["path"];
1886
2551
  type CreateUploadHeaders = operations["createUpload"]["parameters"]["header"];
1887
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"];
1888
2559
  type AbortUploadPath = operations["abortUpload"]["parameters"]["path"];
1889
2560
  type GeneratedCurrentWorkspace = JsonResponse<"getCurrentWorkspace", 200>;
1890
2561
  type CurrentWorkspace = Readonly<Omit<GeneratedCurrentWorkspace, "workspaceReference"> & {
1891
2562
  readonly workspaceReference: Readonly<GeneratedCurrentWorkspace["workspaceReference"]>;
1892
2563
  }>;
1893
2564
  type FolderItem = Readonly<JsonResponse<"createFolder", 201>>;
1894
- type ReservedUploadQuota = Readonly<JsonResponse<"createUpload", 201>>;
1895
- type AbortedUploadQuota = Readonly<JsonResponse<"abortUpload", 200>>;
1896
- 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"];
1897
2579
  type PermissionAction = CreatePermissionBody["actions"][number];
1898
2580
  type PermissionGrantee = Readonly<CreatePermissionBody["grantee"]>;
1899
2581
  type GeneratedPermissionGrant = JsonResponse<"listItemPermissions", 200>["items"][number];
@@ -1974,13 +2656,50 @@ type CreateUploadInput = Readonly<CreateUploadPath> & Readonly<CreateUploadBody>
1974
2656
  readonly idempotencyKey: CreateUploadHeaders["Idempotency-Key"];
1975
2657
  readonly signal?: AbortSignal;
1976
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
+ };
1977
2675
  type AbortUploadInput = Readonly<AbortUploadPath> & {
1978
2676
  readonly signal?: AbortSignal;
1979
2677
  };
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
+ }
1980
2699
  interface GetCurrentWorkspaceInput {
1981
2700
  readonly signal?: AbortSignal;
1982
2701
  }
1983
- interface DriveClient {
2702
+ interface DriveOperations {
1984
2703
  getCurrentWorkspace(input?: GetCurrentWorkspaceInput): Promise<DriveOperationResult<CurrentWorkspace, 200>>;
1985
2704
  listFolderChildren(input: ListFolderChildrenInput): Promise<DriveOperationResult<FolderPage, 200>>;
1986
2705
  createFolder(input: CreateFolderInput): Promise<DriveOperationResult<FolderItem, 200 | 201>>;
@@ -1989,8 +2708,16 @@ interface DriveClient {
1989
2708
  createItemPermission(input: CreateItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200 | 201>>;
1990
2709
  updateItemPermission(input: UpdateItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200>>;
1991
2710
  revokeItemPermission(input: RevokeItemPermissionInput): Promise<DriveOperationResult<PermissionMutation, 200>>;
1992
- createUpload(input: CreateUploadInput): Promise<DriveOperationResult<ReservedUploadQuota, 200 | 201>>;
1993
- 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>>;
1994
2721
  }
1995
2722
  //#endregion
1996
- export { UploadQuotaReservation as A, PermissionGrantee as C, ReservedUploadQuota as D, ReadEffectiveItemPermissionsInput as E, RevokeItemPermissionInput as O, PermissionGrant as S, PermissionPage as T, FolderPage as _, CreateUploadInput as a, ListItemPermissionsInput as b, DriveClientConfig as c, DriveOperationResult as d, DriveResponseValidators as f, FolderItem as g, EffectivePermissionResponse as h, CreateItemPermissionInput as i, UpdateItemPermissionInput as k, DriveCredentialContext as l, EffectivePermissionAction as m, AbortedUploadQuota as n, CurrentWorkspace as o, DriveServerClientConfig as p, CreateFolderInput as r, DriveClient as s, AbortUploadInput as t, DriveCredentialProvider as u, GetCurrentWorkspaceInput as v, PermissionMutation as w, PermissionAction as x, ListFolderChildrenInput 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 };