@gigadrive/sdk 0.8.6 → 0.9.1
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.
- package/README.md +81 -0
- package/dist/index.d.mts +1262 -99
- package/dist/index.d.ts +1262 -99
- package/dist/index.js +1274 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1253 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -937,9 +937,16 @@ interface StorageUploadSession {
|
|
|
937
937
|
interface CreateUploadSessionInput {
|
|
938
938
|
/** The object key/path the file will be stored at (e.g. `"images/photo.jpg"`). 1–1024 characters. */
|
|
939
939
|
key: string;
|
|
940
|
-
/**
|
|
940
|
+
/**
|
|
941
|
+
* File size in bytes: an integer, `0` or greater. `0` stores an empty object
|
|
942
|
+
* during the create call (see {@link CreateUploadSessionResponse}).
|
|
943
|
+
*/
|
|
941
944
|
contentLength: number;
|
|
942
|
-
/**
|
|
945
|
+
/**
|
|
946
|
+
* Lowercase hex SHA-256 checksum (64 chars) of the content. Required for
|
|
947
|
+
* server-side verification. For an empty file this must be the digest of
|
|
948
|
+
* empty input, `e3b0c442…b855`.
|
|
949
|
+
*/
|
|
943
950
|
checksumSha256: string;
|
|
944
951
|
/** MIME content type of the file (e.g. `"image/jpeg"`). */
|
|
945
952
|
contentType?: string;
|
|
@@ -952,13 +959,24 @@ interface CreateUploadSessionInput {
|
|
|
952
959
|
interface ListStorageUploadSessionsQuery extends ListQuery, StorageEnvironmentOptions {
|
|
953
960
|
}
|
|
954
961
|
/**
|
|
955
|
-
* Response from creating an upload session. Contains
|
|
956
|
-
*
|
|
962
|
+
* Response from creating an upload session. Contains the session metadata and
|
|
963
|
+
* either the resumable upload instructions (signed URL + headers) or, for an
|
|
964
|
+
* empty file, the object the API already stored.
|
|
965
|
+
*
|
|
966
|
+
* | Field | `contentLength` 0 | `contentLength` > 0 |
|
|
967
|
+
* | --------- | ------------------------------------------ | ------------------------------- |
|
|
968
|
+
* | `session` | `state: "completed"`, `uploadedAt` set | `state: "ready"` |
|
|
969
|
+
* | `upload` | `null` | Signed URL, method and headers |
|
|
970
|
+
* | `object` | The stored object | `null` |
|
|
957
971
|
*/
|
|
958
972
|
interface CreateUploadSessionResponse {
|
|
959
973
|
/** The created upload session. */
|
|
960
974
|
session: StorageUploadSession;
|
|
961
|
-
/**
|
|
975
|
+
/**
|
|
976
|
+
* Resumable upload instructions — use these to send the file data. `null`
|
|
977
|
+
* when `contentLength` was 0: the empty object already exists and there is
|
|
978
|
+
* nothing to send.
|
|
979
|
+
*/
|
|
962
980
|
upload: {
|
|
963
981
|
/** The HTTP method for the byte upload (resumable upload protocol). */
|
|
964
982
|
method: 'PATCH';
|
|
@@ -968,7 +986,18 @@ interface CreateUploadSessionResponse {
|
|
|
968
986
|
headers: Record<string, string>;
|
|
969
987
|
/** The URL where the object will be accessible after upload (CDN URL for public buckets). */
|
|
970
988
|
publicObjectUrl: string;
|
|
971
|
-
};
|
|
989
|
+
} | null;
|
|
990
|
+
/**
|
|
991
|
+
* The stored object when the upload finished during the create call, which
|
|
992
|
+
* happens only for an empty file. `null` while bytes are still expected.
|
|
993
|
+
*/
|
|
994
|
+
object: StorageObject | null;
|
|
995
|
+
/**
|
|
996
|
+
* Canonical object URL for the key, returned for every size (the same value
|
|
997
|
+
* as `upload.publicObjectUrl` when an upload instruction is returned). Older
|
|
998
|
+
* API deployments omit it.
|
|
999
|
+
*/
|
|
1000
|
+
publicObjectUrl?: string;
|
|
972
1001
|
}
|
|
973
1002
|
/** A byte source for uploading directly to a known signed URL. */
|
|
974
1003
|
interface UploadByteSource {
|
|
@@ -1012,6 +1041,8 @@ declare class StorageUploadSessionsResource extends BaseResource {
|
|
|
1012
1041
|
* @param bucketRef - Canonical bucket name or deprecated UUID fallback.
|
|
1013
1042
|
* @param data - Object key, content length, SHA-256 checksum, and optional content type / extra checksums.
|
|
1014
1043
|
* @returns The session and resumable upload instructions (URL, method, headers).
|
|
1044
|
+
* For `contentLength: 0` the session is already `completed`, `upload` is
|
|
1045
|
+
* `null` and `object` holds the stored empty object.
|
|
1015
1046
|
*/
|
|
1016
1047
|
create(bucketRef: StorageBucketReference, data: CreateUploadSessionInput, options?: StorageEnvironmentOptions): Promise<CreateUploadSessionResponse>;
|
|
1017
1048
|
/** @deprecated Prefer the context-bound overload through `client.storage`. */
|
|
@@ -1127,7 +1158,10 @@ interface UploadFileResult {
|
|
|
1127
1158
|
session: StorageUploadSession;
|
|
1128
1159
|
/** The public/CDN URL of the uploaded object. */
|
|
1129
1160
|
url: string;
|
|
1130
|
-
/**
|
|
1161
|
+
/**
|
|
1162
|
+
* The finalized storage object — present when `waitForCompletion` was set,
|
|
1163
|
+
* and always for an empty file, which the API stores during session creation.
|
|
1164
|
+
*/
|
|
1131
1165
|
object?: StorageObject;
|
|
1132
1166
|
}
|
|
1133
1167
|
/** Options for {@link ApplicationStorageResource.uploadBatch | uploadBatch()}. */
|
|
@@ -1196,6 +1230,10 @@ declare class ApplicationStorageResource {
|
|
|
1196
1230
|
* Node filesystem `path`, or a Node readable `stream` (with `contentLength`
|
|
1197
1231
|
* and `checksumSha256`). The content type is inferred from `key` when omitted.
|
|
1198
1232
|
*
|
|
1233
|
+
* Empty (zero-byte) files are supported for every input kind. The API stores
|
|
1234
|
+
* them during session creation, so no bytes are transferred, `onProgress` is
|
|
1235
|
+
* not called, `waitForCompletion` does not poll, and `object` is always set.
|
|
1236
|
+
*
|
|
1199
1237
|
* @param input - What and where to upload, plus optional transfer options.
|
|
1200
1238
|
* @returns The upload session and public object URL (and the finalized object when `waitForCompletion` is set).
|
|
1201
1239
|
* @throws {@link UploadError} if the byte upload fails.
|
|
@@ -1563,14 +1601,381 @@ declare class ApplicationRequestsResource extends BaseResource {
|
|
|
1563
1601
|
get(applicationId: string, requestId: string): Promise<NetworkRequest>;
|
|
1564
1602
|
}
|
|
1565
1603
|
|
|
1566
|
-
/**
|
|
1604
|
+
/**
|
|
1605
|
+
* Base error class for all Gigadrive SDK errors. Every error thrown by the SDK
|
|
1606
|
+
* extends this class, so you can catch all SDK errors with a single check.
|
|
1607
|
+
*
|
|
1608
|
+
* @example
|
|
1609
|
+
* ```ts
|
|
1610
|
+
* try {
|
|
1611
|
+
* await client.organizations.list();
|
|
1612
|
+
* } catch (err) {
|
|
1613
|
+
* if (err instanceof GigadriveError) {
|
|
1614
|
+
* console.error('SDK error:', err.message);
|
|
1615
|
+
* }
|
|
1616
|
+
* }
|
|
1617
|
+
* ```
|
|
1618
|
+
*/
|
|
1619
|
+
declare class GigadriveError extends Error {
|
|
1620
|
+
constructor(message: string);
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Thrown when authentication fails. This includes missing or invalid credentials,
|
|
1624
|
+
* expired tokens, failed token refresh attempts, and failed token exchanges.
|
|
1625
|
+
*
|
|
1626
|
+
* Common causes:
|
|
1627
|
+
* - No credentials provided and no environment variables set
|
|
1628
|
+
* - Invalid `clientId`/`clientSecret` pair
|
|
1629
|
+
* - Expired or revoked refresh token
|
|
1630
|
+
* - API returned 401 even after an automatic token refresh retry
|
|
1631
|
+
*
|
|
1632
|
+
* @example
|
|
1633
|
+
* ```ts
|
|
1634
|
+
* try {
|
|
1635
|
+
* const client = new GigadriveClient(); // no credentials
|
|
1636
|
+
* } catch (err) {
|
|
1637
|
+
* if (err instanceof AuthenticationError) {
|
|
1638
|
+
* console.error('Auth failed:', err.message);
|
|
1639
|
+
* }
|
|
1640
|
+
* }
|
|
1641
|
+
* ```
|
|
1642
|
+
*/
|
|
1643
|
+
declare class AuthenticationError extends GigadriveError {
|
|
1644
|
+
constructor(message: string);
|
|
1645
|
+
}
|
|
1646
|
+
/**
|
|
1647
|
+
* Thrown when an SDK operation requires local configuration that could not be
|
|
1648
|
+
* resolved before making an API request.
|
|
1649
|
+
*
|
|
1650
|
+
* Storage operations use this error when neither an explicit application ID,
|
|
1651
|
+
* `GigadriveClientConfig.applicationId`, nor the workload-provided
|
|
1652
|
+
* `GIGADRIVE_APPLICATION_ID` environment variable is available.
|
|
1653
|
+
*/
|
|
1654
|
+
declare class ConfigurationError extends GigadriveError {
|
|
1655
|
+
constructor(message: string);
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Thrown when the Gigadrive API returns a non-2xx HTTP response.
|
|
1659
|
+
*
|
|
1660
|
+
* Contains the HTTP {@link status} code and an optional machine-readable
|
|
1661
|
+
* {@link code} parsed from the response body.
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* ```ts
|
|
1665
|
+
* try {
|
|
1666
|
+
* await client.deployments.get('non-existent-id');
|
|
1667
|
+
* } catch (err) {
|
|
1668
|
+
* if (err instanceof ApiError) {
|
|
1669
|
+
* console.error(`API error ${err.status}: ${err.message}`);
|
|
1670
|
+
* // err.code may contain a machine-readable error code
|
|
1671
|
+
* }
|
|
1672
|
+
* }
|
|
1673
|
+
* ```
|
|
1674
|
+
*/
|
|
1675
|
+
declare class ApiError extends GigadriveError {
|
|
1676
|
+
/** The HTTP status code of the failed response (e.g. 404, 500). */
|
|
1677
|
+
readonly status: number;
|
|
1678
|
+
/** An optional machine-readable error code from the API response body. */
|
|
1679
|
+
readonly code: string | undefined;
|
|
1680
|
+
/**
|
|
1681
|
+
* An optional finer-grained reason next to {@link code}, for example `daily_add_limit` with
|
|
1682
|
+
* `quota_exceeded`, or `other_organization` with `domain_in_use`.
|
|
1683
|
+
*/
|
|
1684
|
+
readonly reason: string | undefined;
|
|
1685
|
+
constructor(message: string, status: number, code?: string, reason?: string);
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Thrown when a file upload fails. The original cause (e.g. a network error or a
|
|
1689
|
+
* transport-level error from the resumable upload) is preserved on
|
|
1690
|
+
* {@link cause} for inspection.
|
|
1691
|
+
*
|
|
1692
|
+
* @example
|
|
1693
|
+
* ```ts
|
|
1694
|
+
* try {
|
|
1695
|
+
* await client.storage.upload({ bucket: 'assets', key, data });
|
|
1696
|
+
* } catch (err) {
|
|
1697
|
+
* if (err instanceof UploadError) {
|
|
1698
|
+
* console.error('Upload failed:', err.message, err.cause);
|
|
1699
|
+
* }
|
|
1700
|
+
* }
|
|
1701
|
+
* ```
|
|
1702
|
+
*/
|
|
1703
|
+
declare class UploadError extends GigadriveError {
|
|
1704
|
+
/** The underlying error that caused the upload to fail, if any. */
|
|
1705
|
+
readonly cause: unknown;
|
|
1706
|
+
constructor(message: string, cause?: unknown);
|
|
1707
|
+
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Thrown when an upload cannot complete because its session (and the short-lived
|
|
1710
|
+
* upload URL it was issued with) expired. Create a new upload to retry.
|
|
1711
|
+
*
|
|
1712
|
+
* The upload URL is only valid until `session.expiresAt`; very large uploads on
|
|
1713
|
+
* slow connections can exceed that window.
|
|
1714
|
+
*/
|
|
1715
|
+
declare class UploadSessionExpiredError extends UploadError {
|
|
1716
|
+
constructor(message?: string, cause?: unknown);
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
/** Lifecycle state of a custom domain. Only `active` and `degraded` serve traffic. */
|
|
1720
|
+
type CustomDomainState = 'pending_ownership' | 'pending_dns' | 'issuing_certificate' | 'active' | 'degraded' | 'failed' | 'suspended' | 'removing';
|
|
1721
|
+
/** A DNS record to publish for a custom domain. */
|
|
1722
|
+
interface RequiredDnsRecord {
|
|
1723
|
+
/** `ownership` proves control of the domain; `routing` sends traffic to Gigadrive Network. */
|
|
1724
|
+
purpose: 'ownership' | 'routing';
|
|
1725
|
+
/** `ALIAS` stands for the apex record your DNS provider offers (ALIAS, ANAME or CNAME flattening). */
|
|
1726
|
+
type: 'TXT' | 'CNAME' | 'ALIAS';
|
|
1727
|
+
/** Fully qualified record name. */
|
|
1728
|
+
name: string;
|
|
1729
|
+
/** Record name relative to the registrable domain, as DNS dashboards expect it (`@` for the apex). */
|
|
1730
|
+
host: string;
|
|
1731
|
+
/** Record value to publish. */
|
|
1732
|
+
value: string;
|
|
1733
|
+
/** Whether the last check found the record. */
|
|
1734
|
+
status: 'ok' | 'pending' | 'mismatch';
|
|
1735
|
+
}
|
|
1736
|
+
/** What a custom domain serves. */
|
|
1737
|
+
interface CustomDomainTarget {
|
|
1738
|
+
type: 'production' | 'branch' | 'redirect';
|
|
1739
|
+
branchId: string | null;
|
|
1740
|
+
redirectTo: string | null;
|
|
1741
|
+
redirectStatusCode: 301 | 302 | 307 | 308 | null;
|
|
1742
|
+
redirectPreservePath: boolean;
|
|
1743
|
+
}
|
|
1744
|
+
/** A problem that keeps a domain from working, with a stable code and guidance. */
|
|
1745
|
+
interface DomainProblem {
|
|
1746
|
+
/** Stable code, for example `dns_record_missing` or `cert_blocked_caa`. */
|
|
1747
|
+
code: string;
|
|
1748
|
+
/** What is wrong and how to fix it. */
|
|
1749
|
+
message: string;
|
|
1750
|
+
}
|
|
1751
|
+
/** A hostname attached to an application. */
|
|
1752
|
+
interface CustomDomain {
|
|
1753
|
+
id: string;
|
|
1754
|
+
applicationId: string;
|
|
1755
|
+
/** Hostname in ASCII (punycode) form, lowercased. */
|
|
1756
|
+
hostname: string;
|
|
1757
|
+
/** Hostname for display, with international characters. */
|
|
1758
|
+
unicodeHostname: string;
|
|
1759
|
+
/** Registrable domain of the hostname. */
|
|
1760
|
+
apex: string;
|
|
1761
|
+
/** Whether the hostname is the registrable domain itself (needs an ALIAS record). */
|
|
1762
|
+
isApex: boolean;
|
|
1763
|
+
state: CustomDomainState;
|
|
1764
|
+
suspendedReason: 'claimed' | 'admin' | 'plan_limit' | null;
|
|
1765
|
+
target: CustomDomainTarget;
|
|
1766
|
+
/** Whether this is the application's primary URL. */
|
|
1767
|
+
primary: boolean;
|
|
1768
|
+
/** The domain whose verification authorizes this hostname. */
|
|
1769
|
+
ownership: {
|
|
1770
|
+
name: string | null;
|
|
1771
|
+
verified: boolean;
|
|
1772
|
+
};
|
|
1773
|
+
/** DNS records to publish, in the order to add them. */
|
|
1774
|
+
requiredRecords: RequiredDnsRecord[];
|
|
1775
|
+
/** Why the domain is not working yet, or `null`. */
|
|
1776
|
+
error: DomainProblem | null;
|
|
1777
|
+
certificate: {
|
|
1778
|
+
status: 'none' | 'pending' | 'issued' | 'failed' | 'blocked_caa';
|
|
1779
|
+
expiresAt: string | null;
|
|
1780
|
+
};
|
|
1781
|
+
/** What the last DNS check saw, or `null` before the first check. */
|
|
1782
|
+
dns: {
|
|
1783
|
+
checkedAt: string | null;
|
|
1784
|
+
cname: string[];
|
|
1785
|
+
a: string[];
|
|
1786
|
+
aaaa: string[];
|
|
1787
|
+
nameservers: string[];
|
|
1788
|
+
pointsToEdge: boolean;
|
|
1789
|
+
} | null;
|
|
1790
|
+
/** When Gigadrive Network checks the domain next, or `null`. */
|
|
1791
|
+
nextCheckAt: string | null;
|
|
1792
|
+
activatedAt: string | null;
|
|
1793
|
+
createdAt: string;
|
|
1794
|
+
updatedAt: string;
|
|
1795
|
+
}
|
|
1796
|
+
/** What a custom domain should serve. */
|
|
1797
|
+
type CustomDomainTargetInput = {
|
|
1798
|
+
type: 'production';
|
|
1799
|
+
} | {
|
|
1800
|
+
type: 'branch';
|
|
1801
|
+
branchId: string;
|
|
1802
|
+
} | {
|
|
1803
|
+
type: 'redirect';
|
|
1804
|
+
/** Hostname to redirect to. */
|
|
1805
|
+
to: string;
|
|
1806
|
+
/** Defaults to `308`. */
|
|
1807
|
+
statusCode?: 301 | 302 | 307 | 308;
|
|
1808
|
+
/** Keep the path and query string. Defaults to `true`. */
|
|
1809
|
+
preservePath?: boolean;
|
|
1810
|
+
};
|
|
1811
|
+
/** Input for {@link ApplicationDomainsResource.add}. */
|
|
1812
|
+
interface AddCustomDomainInput {
|
|
1813
|
+
/** Hostname such as `shop.example.com` or `example.com`. Normalized by the API. */
|
|
1814
|
+
hostname: string;
|
|
1815
|
+
/** Defaults to production. Redirects are available on paid plans. */
|
|
1816
|
+
target?: CustomDomainTargetInput;
|
|
1817
|
+
}
|
|
1818
|
+
/** Input for {@link ApplicationDomainsResource.update}. */
|
|
1819
|
+
interface UpdateCustomDomainInput {
|
|
1820
|
+
target?: CustomDomainTargetInput;
|
|
1821
|
+
/** Make this the application's primary URL. */
|
|
1822
|
+
primary?: boolean;
|
|
1823
|
+
}
|
|
1824
|
+
/** A domain an organization claimed or verified. */
|
|
1825
|
+
interface DomainOwnership {
|
|
1826
|
+
id: string;
|
|
1827
|
+
organizationId: string;
|
|
1828
|
+
name: string;
|
|
1829
|
+
unicodeName: string;
|
|
1830
|
+
status: 'pending' | 'verified';
|
|
1831
|
+
verificationMethod: 'txt' | 'nameservers' | 'domain_connect' | 'legacy_fqdn_txt' | null;
|
|
1832
|
+
/** The TXT record that proves control of the domain. */
|
|
1833
|
+
record: {
|
|
1834
|
+
type: 'TXT';
|
|
1835
|
+
name: string;
|
|
1836
|
+
host: string;
|
|
1837
|
+
value: string;
|
|
1838
|
+
};
|
|
1839
|
+
error: DomainProblem | null;
|
|
1840
|
+
verifiedAt: string | null;
|
|
1841
|
+
nextCheckAt: string | null;
|
|
1842
|
+
createdAt: string;
|
|
1843
|
+
updatedAt: string;
|
|
1844
|
+
}
|
|
1845
|
+
/** Options for {@link ApplicationDomainsResource.waitUntilActive}. */
|
|
1846
|
+
interface WaitUntilActiveOptions {
|
|
1847
|
+
/** Give up after this long. Defaults to 10 minutes. */
|
|
1848
|
+
timeoutMs?: number;
|
|
1849
|
+
/** Time between checks. Defaults to 5 seconds. */
|
|
1850
|
+
intervalMs?: number;
|
|
1851
|
+
/** Stops waiting when aborted. */
|
|
1852
|
+
signal?: AbortSignal;
|
|
1853
|
+
/** Called with the domain whenever its state changes. */
|
|
1854
|
+
onState?: (domain: CustomDomain) => void;
|
|
1855
|
+
}
|
|
1856
|
+
/** Why {@link ApplicationDomainsResource.waitUntilActive} stopped without an active domain. */
|
|
1857
|
+
type DomainNotActiveReason = 'timeout' | 'failed' | 'suspended' | 'removing';
|
|
1858
|
+
/**
|
|
1859
|
+
* Thrown by {@link ApplicationDomainsResource.waitUntilActive} when the domain did not become active
|
|
1860
|
+
* in time, stopped in a state that needs you to act (`failed` or `suspended`), or was removed.
|
|
1861
|
+
*/
|
|
1862
|
+
declare class DomainNotActiveError extends GigadriveError {
|
|
1863
|
+
/** The domain as of the last successful check. */
|
|
1864
|
+
readonly domain: CustomDomain;
|
|
1865
|
+
/** `timeout` when the wait ran out, `removing` when the domain was removed, otherwise the state that ended it. */
|
|
1866
|
+
readonly reason: DomainNotActiveReason;
|
|
1867
|
+
constructor(domain: CustomDomain, reason: DomainNotActiveReason);
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Custom domains attached to an application. Accessed via `client.applications.domains`.
|
|
1871
|
+
*
|
|
1872
|
+
* Adding a domain returns the DNS records to publish. Gigadrive Network then verifies ownership,
|
|
1873
|
+
* checks DNS, issues the certificate and starts serving on its own; poll {@link get} or use
|
|
1874
|
+
* {@link waitUntilActive}.
|
|
1875
|
+
*/
|
|
1876
|
+
declare class ApplicationDomainsResource extends BaseResource {
|
|
1877
|
+
/**
|
|
1878
|
+
* List the custom domains of an application.
|
|
1879
|
+
*
|
|
1880
|
+
* @example
|
|
1881
|
+
* ```ts
|
|
1882
|
+
* const { items } = await client.applications.domains.list('app-id');
|
|
1883
|
+
* for (const domain of items) console.log(domain.hostname, domain.state);
|
|
1884
|
+
* ```
|
|
1885
|
+
*/
|
|
1886
|
+
list(applicationId: string, query?: ListQuery): Promise<Paginated<CustomDomain>>;
|
|
1887
|
+
/**
|
|
1888
|
+
* Attach a hostname to an application.
|
|
1889
|
+
*
|
|
1890
|
+
* @returns The new domain, including the `requiredRecords` to publish at your DNS provider.
|
|
1891
|
+
*
|
|
1892
|
+
* @example
|
|
1893
|
+
* ```ts
|
|
1894
|
+
* const domain = await client.applications.domains.add('app-id', { hostname: 'shop.example.com' });
|
|
1895
|
+
* for (const record of domain.requiredRecords) console.log(record.type, record.host, record.value);
|
|
1896
|
+
* ```
|
|
1897
|
+
*/
|
|
1898
|
+
add(applicationId: string, data: AddCustomDomainInput): Promise<CustomDomain>;
|
|
1899
|
+
/** Get one custom domain with its current state. */
|
|
1900
|
+
get(applicationId: string, domainId: string, options?: {
|
|
1901
|
+
signal?: AbortSignal;
|
|
1902
|
+
}): Promise<CustomDomain>;
|
|
1903
|
+
/**
|
|
1904
|
+
* Change what a domain serves, or make it the primary domain.
|
|
1905
|
+
*
|
|
1906
|
+
* @example
|
|
1907
|
+
* ```ts
|
|
1908
|
+
* await client.applications.domains.update('app-id', 'domain-id', {
|
|
1909
|
+
* target: { type: 'redirect', to: 'www.example.com' },
|
|
1910
|
+
* });
|
|
1911
|
+
* ```
|
|
1912
|
+
*/
|
|
1913
|
+
update(applicationId: string, domainId: string, data: UpdateCustomDomainInput): Promise<CustomDomain>;
|
|
1914
|
+
/** Check the domain now instead of waiting for the next scheduled check. Rate limited. */
|
|
1915
|
+
refresh(applicationId: string, domainId: string): Promise<CustomDomain>;
|
|
1916
|
+
/** Stop serving the domain and remove it. */
|
|
1917
|
+
remove(applicationId: string, domainId: string): Promise<void>;
|
|
1918
|
+
/**
|
|
1919
|
+
* Move a hostname another organization attached to this application. Verify the domain for your
|
|
1920
|
+
* organization first and keep its TXT record published: the claim checks the record again.
|
|
1921
|
+
*/
|
|
1922
|
+
claim(applicationId: string, hostname: string): Promise<CustomDomain>;
|
|
1923
|
+
/**
|
|
1924
|
+
* Poll a domain until it serves traffic.
|
|
1925
|
+
*
|
|
1926
|
+
* Rate limits, server errors and network failures do not end the wait; the next poll retries until
|
|
1927
|
+
* the timeout. Aborting the signal or reaching the timeout also cancels a request in flight.
|
|
1928
|
+
*
|
|
1929
|
+
* @returns The domain once it is `active` (or `degraded`, which also serves).
|
|
1930
|
+
* @throws {DomainNotActiveError} When it fails, is suspended or removed, or the timeout runs out.
|
|
1931
|
+
*
|
|
1932
|
+
* @example
|
|
1933
|
+
* ```ts
|
|
1934
|
+
* const domain = await client.applications.domains.add('app-id', { hostname: 'shop.example.com' });
|
|
1935
|
+
* await client.applications.domains.waitUntilActive('app-id', domain.id, {
|
|
1936
|
+
* onState: (current) => console.log(current.state),
|
|
1937
|
+
* });
|
|
1938
|
+
* ```
|
|
1939
|
+
*/
|
|
1940
|
+
waitUntilActive(applicationId: string, domainId: string, options?: WaitUntilActiveOptions): Promise<CustomDomain>;
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Domains an organization verified. Accessed via `client.organizations.domains`.
|
|
1944
|
+
*
|
|
1945
|
+
* A verified domain lets every application of the organization attach hostnames at or below it
|
|
1946
|
+
* without another TXT record.
|
|
1947
|
+
*/
|
|
1948
|
+
declare class OrganizationDomainsResource extends BaseResource {
|
|
1949
|
+
/** List the organization's claimed and verified domains. */
|
|
1950
|
+
list(organizationId: string, query?: ListQuery): Promise<Paginated<DomainOwnership>>;
|
|
1951
|
+
/**
|
|
1952
|
+
* Claim a domain for verification.
|
|
1953
|
+
*
|
|
1954
|
+
* @returns The claim, including the TXT `record` to publish.
|
|
1955
|
+
*
|
|
1956
|
+
* @example
|
|
1957
|
+
* ```ts
|
|
1958
|
+
* const claim = await client.organizations.domains.add('org-id', 'example.com');
|
|
1959
|
+
* console.log(claim.record.host, claim.record.value);
|
|
1960
|
+
* ```
|
|
1961
|
+
*/
|
|
1962
|
+
add(organizationId: string, name: string): Promise<DomainOwnership>;
|
|
1963
|
+
/** Get one claimed or verified domain. */
|
|
1964
|
+
get(organizationId: string, domainId: string): Promise<DomainOwnership>;
|
|
1965
|
+
/** Check the TXT record now. Rate limited. */
|
|
1966
|
+
verify(organizationId: string, domainId: string): Promise<DomainOwnership>;
|
|
1967
|
+
/** Remove a domain. Refused while custom domains still rely on it. */
|
|
1968
|
+
remove(organizationId: string, domainId: string): Promise<void>;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
/** A hostname routing to an application or deployment: a `*.gigadrive.app` name or an active custom domain. */
|
|
1567
1972
|
interface Hostname {
|
|
1568
1973
|
/** Unique identifier (UUID). */
|
|
1569
1974
|
id: string;
|
|
1570
1975
|
/** The fully-qualified hostname (e.g. `"my-app.gigadrive.app"`). */
|
|
1571
1976
|
hostname: string;
|
|
1572
|
-
/** The kind of hostname: `"DEPLOYMENT"`, `"BRANCH"`, or `"
|
|
1573
|
-
type: 'DEPLOYMENT' | 'BRANCH' | 'APP';
|
|
1977
|
+
/** The kind of hostname: `"DEPLOYMENT"`, `"BRANCH"`, `"APP"`, or `"CUSTOM"` (an active custom domain). */
|
|
1978
|
+
type: 'DEPLOYMENT' | 'BRANCH' | 'APP' | 'CUSTOM';
|
|
1574
1979
|
/** Whether this hostname currently routes traffic. */
|
|
1575
1980
|
active: boolean;
|
|
1576
1981
|
/** The deployment this hostname points to, if any. */
|
|
@@ -2148,6 +2553,16 @@ declare class OrganizationsResource extends BaseResource {
|
|
|
2148
2553
|
* ```
|
|
2149
2554
|
*/
|
|
2150
2555
|
readonly products: OrganizationProductsResource;
|
|
2556
|
+
/**
|
|
2557
|
+
* Domains the organization verified. A verified domain lets every application attach hostnames
|
|
2558
|
+
* below it without another TXT record.
|
|
2559
|
+
*
|
|
2560
|
+
* @example
|
|
2561
|
+
* ```ts
|
|
2562
|
+
* const claim = await client.organizations.domains.add('org-id', 'example.com');
|
|
2563
|
+
* ```
|
|
2564
|
+
*/
|
|
2565
|
+
readonly domains: OrganizationDomainsResource;
|
|
2151
2566
|
constructor(...args: ConstructorParameters<typeof BaseResource>);
|
|
2152
2567
|
/**
|
|
2153
2568
|
* List organizations the authenticated actor has access to.
|
|
@@ -2300,6 +2715,16 @@ declare class ApplicationsResource extends BaseResource {
|
|
|
2300
2715
|
* ```
|
|
2301
2716
|
*/
|
|
2302
2717
|
readonly requests: ApplicationRequestsResource;
|
|
2718
|
+
/**
|
|
2719
|
+
* Custom domains attached to the application.
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* ```ts
|
|
2723
|
+
* const domain = await client.applications.domains.add('app-id', { hostname: 'shop.example.com' });
|
|
2724
|
+
* await client.applications.domains.waitUntilActive('app-id', domain.id);
|
|
2725
|
+
* ```
|
|
2726
|
+
*/
|
|
2727
|
+
readonly domains: ApplicationDomainsResource;
|
|
2303
2728
|
constructor(httpClient: ConstructorParameters<typeof BaseResource>[0], defaultApplicationId?: string);
|
|
2304
2729
|
/**
|
|
2305
2730
|
* List applications the authenticated actor has access to.
|
|
@@ -2714,6 +3139,654 @@ declare class ImageOptimizationResource extends BaseResource {
|
|
|
2714
3139
|
purge(deploymentId: string, source?: string): Promise<ImageCachePurgeResult>;
|
|
2715
3140
|
}
|
|
2716
3141
|
|
|
3142
|
+
/**
|
|
3143
|
+
* Byte, base64 and duration helpers shared by the queue client, the push
|
|
3144
|
+
* handler and the Workflow adapter. Runtime-neutral: Web APIs only.
|
|
3145
|
+
*
|
|
3146
|
+
* @internal
|
|
3147
|
+
*/
|
|
3148
|
+
/**
|
|
3149
|
+
* A duration as seconds, or a string such as `'500ms'`, `'30s'`, `'10m'`,
|
|
3150
|
+
* `'12h'` or `'7d'`.
|
|
3151
|
+
*/
|
|
3152
|
+
type QueueDuration = number | `${number}${'ms' | 's' | 'm' | 'h' | 'd'}`;
|
|
3153
|
+
/**
|
|
3154
|
+
* Converts a {@link QueueDuration} to whole seconds, rounding up so a
|
|
3155
|
+
* sub-second delay never becomes "now".
|
|
3156
|
+
*
|
|
3157
|
+
* @throws {Error} When the value is negative, not finite, or not a recognised duration string.
|
|
3158
|
+
*/
|
|
3159
|
+
declare const durationToSeconds: (value: QueueDuration) => number;
|
|
3160
|
+
|
|
3161
|
+
/** Headers the platform sets on a push delivery. */
|
|
3162
|
+
declare const QUEUE_DELIVERY_HEADERS: {
|
|
3163
|
+
readonly name: "x-gigadrive-queue-name";
|
|
3164
|
+
readonly messageId: "x-gigadrive-queue-message-id";
|
|
3165
|
+
readonly attempt: "x-gigadrive-queue-attempt";
|
|
3166
|
+
readonly createdAt: "x-gigadrive-queue-created-at";
|
|
3167
|
+
readonly expiresAt: "x-gigadrive-queue-expires-at";
|
|
3168
|
+
readonly deadline: "x-gigadrive-queue-deadline";
|
|
3169
|
+
readonly groupKey: "x-gigadrive-queue-group-key";
|
|
3170
|
+
readonly deduplicationKey: "x-gigadrive-queue-deduplication-key";
|
|
3171
|
+
readonly deploymentId: "x-gigadrive-queue-deployment-id";
|
|
3172
|
+
readonly deploymentFallback: "x-gigadrive-queue-deployment-fallback";
|
|
3173
|
+
readonly signature: "x-gigadrive-queue-signature";
|
|
3174
|
+
};
|
|
3175
|
+
/** Headers a push consumer sets on its response to steer redelivery. */
|
|
3176
|
+
declare const QUEUE_RESPONSE_HEADERS: {
|
|
3177
|
+
/** On a 2xx: deliver again after this many seconds without spending an attempt. */
|
|
3178
|
+
readonly retryAfter: "x-gigadrive-queue-retry-after";
|
|
3179
|
+
/** `dead-letter`: stop retrying now, whatever the status. */
|
|
3180
|
+
readonly action: "x-gigadrive-queue-action";
|
|
3181
|
+
/**
|
|
3182
|
+
* Reason recorded on the message. Read only together with `action:
|
|
3183
|
+
* dead-letter`; for any other failure the platform records `HTTP <status>`
|
|
3184
|
+
* and the first 512 bytes of the response body.
|
|
3185
|
+
*/
|
|
3186
|
+
readonly error: "x-gigadrive-queue-error";
|
|
3187
|
+
};
|
|
3188
|
+
/** Serializes payloads to message bodies and back. */
|
|
3189
|
+
interface QueueCodec<T> {
|
|
3190
|
+
encode(payload: T): {
|
|
3191
|
+
body: string;
|
|
3192
|
+
encoding: 'utf8' | 'base64';
|
|
3193
|
+
contentType: string;
|
|
3194
|
+
};
|
|
3195
|
+
decode(body: Uint8Array, contentType: string): T;
|
|
3196
|
+
}
|
|
3197
|
+
/**
|
|
3198
|
+
* The default codec. `Uint8Array` and `ArrayBuffer` payloads travel as raw
|
|
3199
|
+
* bytes (`application/octet-stream`); everything else as JSON. On the way
|
|
3200
|
+
* back, JSON content types are parsed, `text/*` becomes a string and
|
|
3201
|
+
* anything else a `Uint8Array`.
|
|
3202
|
+
*/
|
|
3203
|
+
declare const defaultQueueCodec: QueueCodec<unknown>;
|
|
3204
|
+
/** Options for a {@link Queue} handle. */
|
|
3205
|
+
interface QueueOptions<T> extends QueueScopeOptions {
|
|
3206
|
+
/** Body serialization. Defaults to {@link defaultQueueCodec}. */
|
|
3207
|
+
codec?: QueueCodec<T>;
|
|
3208
|
+
/**
|
|
3209
|
+
* Validates every decoded payload before your handler sees it, for example
|
|
3210
|
+
* a Zod schema's `parse`. A payload that fails is dead-lettered, since
|
|
3211
|
+
* retrying cannot fix it.
|
|
3212
|
+
*/
|
|
3213
|
+
validate?: (payload: unknown) => T;
|
|
3214
|
+
/** Create a pull queue with default settings on the first send to a new name. Default `true`. */
|
|
3215
|
+
autoCreate?: boolean;
|
|
3216
|
+
/** Push signing secret. Defaults to `GIGADRIVE_QUEUE_SIGNING_SECRET`, which deployments receive. */
|
|
3217
|
+
signingSecret?: string;
|
|
3218
|
+
/**
|
|
3219
|
+
* Accept push deliveries without a valid signature. Only for local
|
|
3220
|
+
* development: anyone who can reach the endpoint could then inject messages.
|
|
3221
|
+
*/
|
|
3222
|
+
allowUnsigned?: boolean;
|
|
3223
|
+
}
|
|
3224
|
+
/** Options for one send. */
|
|
3225
|
+
interface QueueSendOptions {
|
|
3226
|
+
/** Deliver after this delay, such as `'10m'` or `90` seconds. Up to one year. */
|
|
3227
|
+
delay?: QueueDuration;
|
|
3228
|
+
/** Deliver at this time, up to one year ahead. Wins over {@link delay}. */
|
|
3229
|
+
at?: Date | string | number;
|
|
3230
|
+
/** Messages with the same key are delivered one at a time, in send order. */
|
|
3231
|
+
groupKey?: string;
|
|
3232
|
+
/** A repeat of this key within the queue's deduplication window is dropped and returns the first id. */
|
|
3233
|
+
deduplicationKey?: string;
|
|
3234
|
+
/** Deliver to this deployment instead of the environment's current one. */
|
|
3235
|
+
deploymentId?: string;
|
|
3236
|
+
/** Extra headers sent with push deliveries. */
|
|
3237
|
+
headers?: Record<string, string>;
|
|
3238
|
+
}
|
|
3239
|
+
/** A message that was accepted. */
|
|
3240
|
+
interface QueueSent {
|
|
3241
|
+
messageId: string;
|
|
3242
|
+
/** `true` when the deduplication key matched an earlier message, whose id this is. */
|
|
3243
|
+
deduplicated: boolean;
|
|
3244
|
+
/** When the message becomes deliverable. */
|
|
3245
|
+
deliverAt: Date;
|
|
3246
|
+
}
|
|
3247
|
+
/** Per-message outcome of {@link Queue.sendBatch}, in input order. */
|
|
3248
|
+
type QueueBatchSent = (QueueSent & {
|
|
3249
|
+
error?: undefined;
|
|
3250
|
+
}) | {
|
|
3251
|
+
messageId: null;
|
|
3252
|
+
error: ApiError;
|
|
3253
|
+
};
|
|
3254
|
+
/** What a handler knows about the message it is processing. */
|
|
3255
|
+
interface QueueMessageMeta {
|
|
3256
|
+
messageId: string;
|
|
3257
|
+
queue: string;
|
|
3258
|
+
/** 1 on the first delivery. Deferrals with {@link RetryLaterError} do not count. */
|
|
3259
|
+
attempt: number;
|
|
3260
|
+
createdAt: Date | null;
|
|
3261
|
+
groupKey: string | null;
|
|
3262
|
+
deduplicationKey: string | null;
|
|
3263
|
+
/** Push: the deployment serving this delivery. Pull: the deployment the message was pinned to, if any. */
|
|
3264
|
+
deploymentId: string | null;
|
|
3265
|
+
/** Message headers, as sent. */
|
|
3266
|
+
headers: Record<string, string>;
|
|
3267
|
+
}
|
|
3268
|
+
/** A leased message from {@link Queue.receive}. Settle it before its lease ends. */
|
|
3269
|
+
interface ReceivedQueueMessage<T> extends QueueMessageMeta {
|
|
3270
|
+
payload: T;
|
|
3271
|
+
receipt: string;
|
|
3272
|
+
leaseExpiresAt: Date | null;
|
|
3273
|
+
/** Deletes the message: processing succeeded. */
|
|
3274
|
+
ack(): Promise<void>;
|
|
3275
|
+
/** Releases the message for another attempt, after backoff or `delay`. */
|
|
3276
|
+
retry(options?: {
|
|
3277
|
+
delay?: QueueDuration;
|
|
3278
|
+
error?: string;
|
|
3279
|
+
}): Promise<void>;
|
|
3280
|
+
/** Releases the message for later without spending an attempt. */
|
|
3281
|
+
defer(delay: QueueDuration): Promise<void>;
|
|
3282
|
+
/** Moves the message to the dead-letter list now. */
|
|
3283
|
+
deadLetter(reason?: string): Promise<void>;
|
|
3284
|
+
/** Extends the lease to `duration` from now. */
|
|
3285
|
+
extendLease(duration: QueueDuration): Promise<void>;
|
|
3286
|
+
}
|
|
3287
|
+
/** A function that processes one message. Throw to retry. */
|
|
3288
|
+
type QueueMessageHandler<T> = (payload: T, meta: QueueMessageMeta) => unknown;
|
|
3289
|
+
/**
|
|
3290
|
+
* A typed handle on one queue: send messages, receive and process them, or
|
|
3291
|
+
* serve them as a push consumer.
|
|
3292
|
+
*
|
|
3293
|
+
* Get one with the top-level {@link queue} function (zero-config inside a
|
|
3294
|
+
* deployment) or with `client.queues.queue(name)`.
|
|
3295
|
+
*
|
|
3296
|
+
* @typeParam T - The payload type.
|
|
3297
|
+
*/
|
|
3298
|
+
declare class Queue<T = unknown> {
|
|
3299
|
+
/** The queue name. */
|
|
3300
|
+
readonly name: string;
|
|
3301
|
+
private readonly resource;
|
|
3302
|
+
private readonly options;
|
|
3303
|
+
private readonly codec;
|
|
3304
|
+
constructor(
|
|
3305
|
+
/** The queue name. */
|
|
3306
|
+
name: string, resource: () => QueuesResource, options?: QueueOptions<T>);
|
|
3307
|
+
private get scope();
|
|
3308
|
+
private toMessage;
|
|
3309
|
+
private decode;
|
|
3310
|
+
/**
|
|
3311
|
+
* Sends one message.
|
|
3312
|
+
*
|
|
3313
|
+
* @example
|
|
3314
|
+
* ```ts
|
|
3315
|
+
* await emails.send({ to: 'jane@example.com' });
|
|
3316
|
+
* await emails.send({ to: 'jane@example.com' }, { delay: '10m' });
|
|
3317
|
+
* await emails.send(reminder, { at: new Date('2027-01-01T09:00:00Z'), deduplicationKey: `reminder:${id}` });
|
|
3318
|
+
* ```
|
|
3319
|
+
*
|
|
3320
|
+
* @throws {@link ApiError} when the message is refused, for example with
|
|
3321
|
+
* `code: 'backlog_full'` when your organization's queued storage is full.
|
|
3322
|
+
* Its `status` is 429 when sending again later may succeed and 400 when it
|
|
3323
|
+
* will not, so retry logic that keys on the status stays correct.
|
|
3324
|
+
*/
|
|
3325
|
+
send(payload: T, options?: QueueSendOptions): Promise<QueueSent>;
|
|
3326
|
+
/**
|
|
3327
|
+
* Sends many messages, 100 per request. Results come back in input order;
|
|
3328
|
+
* a refused message does not fail the rest; its error carries status 429
|
|
3329
|
+
* when it may be sent again later and 400 when it may not. Chunks are split by count only:
|
|
3330
|
+
* a request whose message bodies exceed 4 MiB in total is refused whole.
|
|
3331
|
+
*/
|
|
3332
|
+
sendBatch(messages: readonly ({
|
|
3333
|
+
payload: T;
|
|
3334
|
+
} & QueueSendOptions)[]): Promise<QueueBatchSent[]>;
|
|
3335
|
+
/** Deletes a message that has not been processed yet, such as a scheduled send. */
|
|
3336
|
+
cancel(messageId: string): Promise<void>;
|
|
3337
|
+
/**
|
|
3338
|
+
* Leases messages from a pull queue. Waits up to `wait` (at most 20
|
|
3339
|
+
* seconds) for the first message, then returns what is available.
|
|
3340
|
+
*/
|
|
3341
|
+
receive(options?: {
|
|
3342
|
+
maxMessages?: number;
|
|
3343
|
+
wait?: QueueDuration;
|
|
3344
|
+
visibilityTimeout?: QueueDuration;
|
|
3345
|
+
signal?: AbortSignal;
|
|
3346
|
+
}): Promise<ReceivedQueueMessage<T>[]>;
|
|
3347
|
+
private toReceived;
|
|
3348
|
+
/**
|
|
3349
|
+
* Receives and processes messages until `signal` aborts, or until the queue
|
|
3350
|
+
* is empty with `stopWhenEmpty`. A handler that returns acknowledges the
|
|
3351
|
+
* message; {@link RetryLaterError} defers it, {@link NonRetryableError}
|
|
3352
|
+
* dead-letters it, and any other error retries it with backoff.
|
|
3353
|
+
*
|
|
3354
|
+
* @example
|
|
3355
|
+
* ```ts
|
|
3356
|
+
* const controller = new AbortController();
|
|
3357
|
+
* await jobs.consume(async (job) => processJob(job), { maxMessages: 10, signal: controller.signal });
|
|
3358
|
+
* ```
|
|
3359
|
+
*/
|
|
3360
|
+
consume(handler: QueueMessageHandler<T>, options?: {
|
|
3361
|
+
maxMessages?: number;
|
|
3362
|
+
wait?: QueueDuration;
|
|
3363
|
+
visibilityTimeout?: QueueDuration;
|
|
3364
|
+
signal?: AbortSignal;
|
|
3365
|
+
stopWhenEmpty?: boolean;
|
|
3366
|
+
/** Called when settling a message fails; the message is then redelivered after its lease. */
|
|
3367
|
+
onError?: (error: unknown) => void;
|
|
3368
|
+
}): Promise<void>;
|
|
3369
|
+
/**
|
|
3370
|
+
* Builds a push consumer: a `(request: Request) => Promise<Response>`
|
|
3371
|
+
* function for the queue's consumer path, such as a Next.js route handler.
|
|
3372
|
+
*
|
|
3373
|
+
* It verifies the delivery signature, decodes the payload and calls
|
|
3374
|
+
* `handler`. Returning acknowledges the message. Throw
|
|
3375
|
+
* {@link RetryLaterError} to defer it without spending an attempt,
|
|
3376
|
+
* {@link NonRetryableError} to dead-letter it, or anything else to retry
|
|
3377
|
+
* with backoff.
|
|
3378
|
+
*
|
|
3379
|
+
* @example
|
|
3380
|
+
* ```ts
|
|
3381
|
+
* // app/api/queues/emails/route.ts
|
|
3382
|
+
* export const POST = emails.handler(async (email, { attempt }) => {
|
|
3383
|
+
* await sendEmail(email);
|
|
3384
|
+
* });
|
|
3385
|
+
* ```
|
|
3386
|
+
*/
|
|
3387
|
+
handler(handler: QueueMessageHandler<T>): (request: Request) => Promise<Response>;
|
|
3388
|
+
/** Creates the queue, or applies `settings` to it. Use it to make a push queue from code. */
|
|
3389
|
+
ensure(settings?: QueueSettings): Promise<QueueInfo>;
|
|
3390
|
+
/** The queue's settings and live depth. */
|
|
3391
|
+
info(): Promise<QueueInfo>;
|
|
3392
|
+
/** Stops deliveries until {@link resume}. Sends are still accepted. */
|
|
3393
|
+
pause(): Promise<void>;
|
|
3394
|
+
resume(): Promise<void>;
|
|
3395
|
+
/** Deletes every message, or only the dead letters. */
|
|
3396
|
+
purge(scope?: 'all' | 'dead'): Promise<number>;
|
|
3397
|
+
/** Moves dead letters back for another round of attempts. */
|
|
3398
|
+
redrive(messageIds?: string[]): Promise<number>;
|
|
3399
|
+
/**
|
|
3400
|
+
* Creates or updates a cron schedule that sends `payload` into this queue.
|
|
3401
|
+
*
|
|
3402
|
+
* @example
|
|
3403
|
+
* ```ts
|
|
3404
|
+
* await digests.schedule('weekday-digest', { cron: '0 8 * * MON-FRI', timezone: 'Europe/Berlin', payload: { kind: 'digest' } });
|
|
3405
|
+
* ```
|
|
3406
|
+
*/
|
|
3407
|
+
schedule(name: string, schedule: {
|
|
3408
|
+
cron: string;
|
|
3409
|
+
timezone?: string;
|
|
3410
|
+
payload?: T;
|
|
3411
|
+
headers?: Record<string, string>;
|
|
3412
|
+
enabled?: boolean;
|
|
3413
|
+
}): Promise<QueueSchedule>;
|
|
3414
|
+
/** Deletes a schedule. */
|
|
3415
|
+
unschedule(name: string): Promise<void>;
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
/** Live depth and lifetime counters of a queue. */
|
|
3419
|
+
interface QueueStats {
|
|
3420
|
+
/** Messages ready for delivery now. */
|
|
3421
|
+
ready: number;
|
|
3422
|
+
/** Messages delayed or scheduled for later. */
|
|
3423
|
+
scheduled: number;
|
|
3424
|
+
/** Messages held behind an earlier message of the same ordering group. */
|
|
3425
|
+
waiting: number;
|
|
3426
|
+
/** Messages being delivered or leased by a consumer. */
|
|
3427
|
+
inflight: number;
|
|
3428
|
+
/** Messages in the dead-letter list. */
|
|
3429
|
+
dead: number;
|
|
3430
|
+
/** Bytes held by the queue, dead letters included. */
|
|
3431
|
+
bytes: number;
|
|
3432
|
+
sent: number;
|
|
3433
|
+
acknowledged: number;
|
|
3434
|
+
failed: number;
|
|
3435
|
+
deadLettered: number;
|
|
3436
|
+
/** ISO 8601 time the oldest ready message became deliverable. */
|
|
3437
|
+
oldestReadyAt: string | null;
|
|
3438
|
+
/** ISO 8601 time of the next scheduled delivery. */
|
|
3439
|
+
nextScheduledAt: string | null;
|
|
3440
|
+
}
|
|
3441
|
+
/** A queue in one application environment. */
|
|
3442
|
+
interface QueueInfo {
|
|
3443
|
+
id: string;
|
|
3444
|
+
name: string;
|
|
3445
|
+
applicationId: string;
|
|
3446
|
+
environmentId: string;
|
|
3447
|
+
/** `push` queues POST each message to {@link consumerPath}; `pull` queues are drained with receive. */
|
|
3448
|
+
mode: 'push' | 'pull';
|
|
3449
|
+
consumerPath: string | null;
|
|
3450
|
+
visibilityTimeoutSeconds: number;
|
|
3451
|
+
retentionSeconds: number;
|
|
3452
|
+
maxAttempts: number;
|
|
3453
|
+
retryBackoffMinSeconds: number;
|
|
3454
|
+
retryBackoffMaxSeconds: number;
|
|
3455
|
+
deduplicationWindowSeconds: number;
|
|
3456
|
+
concurrency: number | null;
|
|
3457
|
+
rateLimit: {
|
|
3458
|
+
count: number;
|
|
3459
|
+
periodSeconds: number;
|
|
3460
|
+
} | null;
|
|
3461
|
+
deadLetter: boolean;
|
|
3462
|
+
paused: boolean;
|
|
3463
|
+
pausedAt: string | null;
|
|
3464
|
+
/** How the queue was created: `config`, `api` or `auto` (first send). */
|
|
3465
|
+
source: string;
|
|
3466
|
+
createdAt: string;
|
|
3467
|
+
updatedAt: string;
|
|
3468
|
+
/** Present on list and get responses. */
|
|
3469
|
+
stats?: QueueStats;
|
|
3470
|
+
}
|
|
3471
|
+
/** Settings accepted when creating or updating a queue. Omitted settings keep their current value or default. */
|
|
3472
|
+
interface QueueSettings {
|
|
3473
|
+
/** Deployment-relative path that receives push deliveries. `null` makes the queue a pull queue. */
|
|
3474
|
+
consumerPath?: string | null;
|
|
3475
|
+
/** Push delivery timeout and default pull lease, 1 to 43,200 seconds. Default 60. */
|
|
3476
|
+
visibilityTimeoutSeconds?: number;
|
|
3477
|
+
/** How long an undelivered message is kept, 60 to 1,209,600 seconds. Default four days. */
|
|
3478
|
+
retentionSeconds?: number;
|
|
3479
|
+
/** Deliveries before a message is dead-lettered, 1 to 100. Default 10. */
|
|
3480
|
+
maxAttempts?: number;
|
|
3481
|
+
/** First retry delay. Default 5 seconds. */
|
|
3482
|
+
retryBackoffMinSeconds?: number;
|
|
3483
|
+
/** Longest retry delay. Default 900 seconds. */
|
|
3484
|
+
retryBackoffMaxSeconds?: number;
|
|
3485
|
+
/** How long a deduplication key is remembered, up to seven days. Default one day. */
|
|
3486
|
+
deduplicationWindowSeconds?: number;
|
|
3487
|
+
/** Most push deliveries in flight at once, 1 to 1,000. `null` restores the default of 100. */
|
|
3488
|
+
concurrency?: number | null;
|
|
3489
|
+
/** Most deliveries started per period. `null` removes the limit. */
|
|
3490
|
+
rateLimit?: {
|
|
3491
|
+
count: number;
|
|
3492
|
+
periodSeconds: number;
|
|
3493
|
+
} | null;
|
|
3494
|
+
/** Keep exhausted messages in the dead-letter list. Default `true`. */
|
|
3495
|
+
deadLetter?: boolean;
|
|
3496
|
+
}
|
|
3497
|
+
/** Scopes a call to an application and environment. */
|
|
3498
|
+
interface QueueScopeOptions {
|
|
3499
|
+
/** Application UUID. Defaults to the client's application, `GIGADRIVE_APPLICATION_ID` in a deployment. */
|
|
3500
|
+
applicationId?: string;
|
|
3501
|
+
/** Environment slug or UUID. Deployed workloads omit it: their credential selects the environment. */
|
|
3502
|
+
environment?: string;
|
|
3503
|
+
}
|
|
3504
|
+
/** One message on the wire. Exactly one of `json` or `body` is sent. */
|
|
3505
|
+
interface QueueMessageInput {
|
|
3506
|
+
/** Any JSON value, sent with content type `application/json`. */
|
|
3507
|
+
json?: unknown;
|
|
3508
|
+
/** A string body, or base64 when {@link encoding} is `base64`. */
|
|
3509
|
+
body?: string;
|
|
3510
|
+
encoding?: 'utf8' | 'base64';
|
|
3511
|
+
contentType?: string;
|
|
3512
|
+
/**
|
|
3513
|
+
* Headers forwarded with push deliveries, up to 32. Reserved and refused:
|
|
3514
|
+
* `host`, `content-length`, `content-type`, `connection`,
|
|
3515
|
+
* `transfer-encoding`, `te`, `upgrade`, `keep-alive`, `proxy-*`,
|
|
3516
|
+
* `authorization`, `cookie`, `x-gigadrive-*`, `x-nebula-*`,
|
|
3517
|
+
* `x-substrate-*`, `x-vercel-*`, `x-forwarded-*`, `x-bunny-*`,
|
|
3518
|
+
* `x-real-ip`, `true-client-ip` and `forwarded`.
|
|
3519
|
+
*/
|
|
3520
|
+
headers?: Record<string, string>;
|
|
3521
|
+
/** Deliver after this many seconds, up to one year. */
|
|
3522
|
+
delaySeconds?: number;
|
|
3523
|
+
/** ISO 8601 time to deliver at, up to one year ahead. Wins over {@link delaySeconds}. */
|
|
3524
|
+
deliverAt?: string;
|
|
3525
|
+
/** Messages with the same key are delivered one at a time, in send order. */
|
|
3526
|
+
groupKey?: string;
|
|
3527
|
+
/** A repeat of this key within the deduplication window is dropped and returns the first message's id. */
|
|
3528
|
+
deduplicationKey?: string;
|
|
3529
|
+
/** Deliver to this deployment instead of the environment's current one. */
|
|
3530
|
+
deploymentId?: string;
|
|
3531
|
+
}
|
|
3532
|
+
/** Outcome of one sent message. */
|
|
3533
|
+
type QueueSendResult = {
|
|
3534
|
+
messageId: string;
|
|
3535
|
+
/** `true` when the deduplication key matched an earlier message, whose id is returned. */
|
|
3536
|
+
deduplicated: boolean;
|
|
3537
|
+
/** ISO 8601 time the message becomes deliverable. */
|
|
3538
|
+
deliverAt: string;
|
|
3539
|
+
error?: undefined;
|
|
3540
|
+
} | {
|
|
3541
|
+
messageId: null;
|
|
3542
|
+
error: string;
|
|
3543
|
+
/** Machine-readable reason, such as `backlog_full`. */
|
|
3544
|
+
code: string;
|
|
3545
|
+
/** Sending again later may succeed. */
|
|
3546
|
+
retryable: boolean;
|
|
3547
|
+
};
|
|
3548
|
+
/** A stored message, as listed, fetched or received. */
|
|
3549
|
+
interface QueueMessageRecord {
|
|
3550
|
+
id: string;
|
|
3551
|
+
state: 'ready' | 'scheduled' | 'waiting' | 'inflight' | 'dead';
|
|
3552
|
+
/** UTF-8 text or base64, per {@link encoding}. Listings cut it to a preview; see {@link bodyTruncated}. */
|
|
3553
|
+
body: string;
|
|
3554
|
+
encoding: 'utf8' | 'base64';
|
|
3555
|
+
bodyTruncated: boolean;
|
|
3556
|
+
contentType: string;
|
|
3557
|
+
headers: Record<string, string>;
|
|
3558
|
+
/** Deliveries made so far. */
|
|
3559
|
+
attempts: number;
|
|
3560
|
+
sizeBytes: number;
|
|
3561
|
+
groupKey: string | null;
|
|
3562
|
+
deduplicationKey: string | null;
|
|
3563
|
+
deploymentId: string | null;
|
|
3564
|
+
/** What sent the message, such as `schedule:daily-digest`. `null` for API sends. */
|
|
3565
|
+
source: string | null;
|
|
3566
|
+
lastError: string | null;
|
|
3567
|
+
createdAt: string;
|
|
3568
|
+
deliverAt: string;
|
|
3569
|
+
expiresAt: string;
|
|
3570
|
+
leaseExpiresAt: string | null;
|
|
3571
|
+
lastDeliveredAt: string | null;
|
|
3572
|
+
deadAt: string | null;
|
|
3573
|
+
/** Lease token, present on received messages. Pass it to ack, nack and extend. */
|
|
3574
|
+
receipt?: string;
|
|
3575
|
+
}
|
|
3576
|
+
/** A recurring send into a queue. */
|
|
3577
|
+
interface QueueSchedule {
|
|
3578
|
+
id: string;
|
|
3579
|
+
name: string;
|
|
3580
|
+
/** Five-field cron expression or macro such as `@hourly`. */
|
|
3581
|
+
cron: string;
|
|
3582
|
+
/** IANA time zone the expression is evaluated in. */
|
|
3583
|
+
timezone: string;
|
|
3584
|
+
body: string;
|
|
3585
|
+
contentType: string;
|
|
3586
|
+
headers: Record<string, string>;
|
|
3587
|
+
enabled: boolean;
|
|
3588
|
+
nextRunAt: string | null;
|
|
3589
|
+
lastRunAt: string | null;
|
|
3590
|
+
lastMessageId: string | null;
|
|
3591
|
+
lastError: string | null;
|
|
3592
|
+
/** `config` for schedules declared in `gigadrive.yaml`, else `api`. */
|
|
3593
|
+
source: string;
|
|
3594
|
+
createdAt: string;
|
|
3595
|
+
updatedAt: string;
|
|
3596
|
+
}
|
|
3597
|
+
/** Fields of a schedule. Use `json` for a JSON body or `body` for text. */
|
|
3598
|
+
interface QueueScheduleInput {
|
|
3599
|
+
cron?: string;
|
|
3600
|
+
timezone?: string;
|
|
3601
|
+
json?: unknown;
|
|
3602
|
+
body?: string;
|
|
3603
|
+
contentType?: string;
|
|
3604
|
+
headers?: Record<string, string>;
|
|
3605
|
+
enabled?: boolean;
|
|
3606
|
+
}
|
|
3607
|
+
/** One message's outcome in a batch acknowledgement. */
|
|
3608
|
+
type QueueAckResult = {
|
|
3609
|
+
messageId: string;
|
|
3610
|
+
acknowledged: true;
|
|
3611
|
+
} | {
|
|
3612
|
+
messageId: string;
|
|
3613
|
+
acknowledged: false;
|
|
3614
|
+
code: 'message_not_found' | 'receipt_mismatch';
|
|
3615
|
+
};
|
|
3616
|
+
/** Outcome of a nack. */
|
|
3617
|
+
type QueueNackResult = {
|
|
3618
|
+
status: 'retrying';
|
|
3619
|
+
deliverAt: string;
|
|
3620
|
+
} | {
|
|
3621
|
+
status: 'dead' | 'dropped';
|
|
3622
|
+
};
|
|
3623
|
+
/**
|
|
3624
|
+
* Network Queues over REST: create and manage queues and schedules, send,
|
|
3625
|
+
* receive and acknowledge messages.
|
|
3626
|
+
*
|
|
3627
|
+
* For typed sending and consuming, prefer {@link QueuesResource.queue}, which
|
|
3628
|
+
* returns a {@link Queue} handle bound to one queue name.
|
|
3629
|
+
*/
|
|
3630
|
+
declare class QueuesResource extends BaseResource {
|
|
3631
|
+
private readonly defaultApplicationId?;
|
|
3632
|
+
constructor(httpClient: HttpClient, defaultApplicationId?: string | undefined);
|
|
3633
|
+
/**
|
|
3634
|
+
* Returns a typed handle for one queue. Nothing is sent until you call a
|
|
3635
|
+
* method on it, and the queue does not need to exist: the first send
|
|
3636
|
+
* creates a pull queue with default settings.
|
|
3637
|
+
*
|
|
3638
|
+
* @typeParam T - The payload type sent and received through this queue.
|
|
3639
|
+
* @param name - Queue name, unique in the environment and case-sensitive.
|
|
3640
|
+
* @param options - Scope, codec and default send options.
|
|
3641
|
+
*/
|
|
3642
|
+
queue<T = unknown>(name: string, options?: QueueOptions<T>): Queue<T>;
|
|
3643
|
+
private base;
|
|
3644
|
+
private path;
|
|
3645
|
+
/** Lists the environment's queues with their live depth. */
|
|
3646
|
+
list(options?: QueueScopeOptions): Promise<{
|
|
3647
|
+
items: QueueInfo[];
|
|
3648
|
+
total: number;
|
|
3649
|
+
}>;
|
|
3650
|
+
/** Fetches one queue with its live depth. */
|
|
3651
|
+
get(name: string, options?: QueueScopeOptions): Promise<QueueInfo>;
|
|
3652
|
+
/**
|
|
3653
|
+
* Creates a queue. Fails with `queue_exists` when the name is taken; use
|
|
3654
|
+
* {@link ensure} for create-or-update.
|
|
3655
|
+
*/
|
|
3656
|
+
create(name: string, settings?: QueueSettings, options?: QueueScopeOptions): Promise<QueueInfo>;
|
|
3657
|
+
/** Creates the queue, or applies `settings` to the existing one. */
|
|
3658
|
+
ensure(name: string, settings?: QueueSettings, options?: QueueScopeOptions): Promise<QueueInfo & {
|
|
3659
|
+
created: boolean;
|
|
3660
|
+
}>;
|
|
3661
|
+
/** Changes a queue's settings. Messages already queued keep flowing. */
|
|
3662
|
+
update(name: string, settings: QueueSettings, options?: QueueScopeOptions): Promise<QueueInfo>;
|
|
3663
|
+
/** Deletes a queue, its messages and its schedules. */
|
|
3664
|
+
delete(name: string, options?: QueueScopeOptions): Promise<{
|
|
3665
|
+
purgedMessages: number;
|
|
3666
|
+
}>;
|
|
3667
|
+
/** Stops deliveries. Sends are still accepted and wait until you resume. */
|
|
3668
|
+
pause(name: string, options?: QueueScopeOptions): Promise<QueueInfo>;
|
|
3669
|
+
/** Restarts deliveries after {@link pause}. */
|
|
3670
|
+
resume(name: string, options?: QueueScopeOptions): Promise<QueueInfo>;
|
|
3671
|
+
/** Deletes every message, or only the dead letters. */
|
|
3672
|
+
purge(name: string, scope?: 'all' | 'dead', options?: QueueScopeOptions): Promise<{
|
|
3673
|
+
purgedMessages: number;
|
|
3674
|
+
}>;
|
|
3675
|
+
/** Moves dead letters back to the queue with fresh attempts: all of them, or the given ids. */
|
|
3676
|
+
redrive(name: string, messageIds?: string[], options?: QueueScopeOptions): Promise<{
|
|
3677
|
+
redrivenMessages: number;
|
|
3678
|
+
}>;
|
|
3679
|
+
/**
|
|
3680
|
+
* Sends one message.
|
|
3681
|
+
*
|
|
3682
|
+
* @param autoCreate - Create a pull queue with default settings when the name is new. Default `true`.
|
|
3683
|
+
*/
|
|
3684
|
+
send(name: string, message: QueueMessageInput, options?: QueueScopeOptions & {
|
|
3685
|
+
autoCreate?: boolean;
|
|
3686
|
+
}): Promise<QueueSendResult>;
|
|
3687
|
+
/**
|
|
3688
|
+
* Sends up to 100 messages in one request. Results come back in input
|
|
3689
|
+
* order; one rejected message does not fail the others.
|
|
3690
|
+
*/
|
|
3691
|
+
sendBatch(name: string, messages: QueueMessageInput[], options?: QueueScopeOptions & {
|
|
3692
|
+
autoCreate?: boolean;
|
|
3693
|
+
}): Promise<QueueSendResult[]>;
|
|
3694
|
+
/** Lists messages in one state without leasing them. Bodies are cut to a preview. */
|
|
3695
|
+
listMessages(name: string, query?: {
|
|
3696
|
+
state?: 'ready' | 'scheduled' | 'inflight' | 'dead';
|
|
3697
|
+
offset?: number;
|
|
3698
|
+
limit?: number;
|
|
3699
|
+
}, options?: QueueScopeOptions): Promise<{
|
|
3700
|
+
items: QueueMessageRecord[];
|
|
3701
|
+
total: number;
|
|
3702
|
+
}>;
|
|
3703
|
+
/** Fetches one message without leasing it. */
|
|
3704
|
+
getMessage(name: string, messageId: string, options?: QueueScopeOptions): Promise<QueueMessageRecord>;
|
|
3705
|
+
/**
|
|
3706
|
+
* Cancels a message that has not been delivered yet, such as a scheduled
|
|
3707
|
+
* send you no longer want. A message being delivered or dead-lettered
|
|
3708
|
+
* answers 400 `invalid_request`; settle it from its consumer, or purge or
|
|
3709
|
+
* redrive dead letters.
|
|
3710
|
+
*/
|
|
3711
|
+
deleteMessage(name: string, messageId: string, options?: QueueScopeOptions): Promise<{
|
|
3712
|
+
deleted: boolean;
|
|
3713
|
+
}>;
|
|
3714
|
+
/**
|
|
3715
|
+
* Leases up to `maxMessages` messages from a pull queue, waiting up to
|
|
3716
|
+
* `waitSeconds` (at most 20) for the first one. Each must be acknowledged
|
|
3717
|
+
* with its receipt before the lease ends, or it is delivered again.
|
|
3718
|
+
*/
|
|
3719
|
+
receive(name: string, request?: {
|
|
3720
|
+
maxMessages?: number;
|
|
3721
|
+
waitSeconds?: number;
|
|
3722
|
+
visibilityTimeoutSeconds?: number;
|
|
3723
|
+
}, options?: QueueScopeOptions & {
|
|
3724
|
+
signal?: AbortSignal;
|
|
3725
|
+
}): Promise<QueueMessageRecord[]>;
|
|
3726
|
+
/** Acknowledges a received message, deleting it. */
|
|
3727
|
+
ack(name: string, messageId: string, receipt: string, options?: QueueScopeOptions): Promise<{
|
|
3728
|
+
acknowledged: boolean;
|
|
3729
|
+
}>;
|
|
3730
|
+
/**
|
|
3731
|
+
* Acknowledges up to 100 received messages in one request. Each settles on
|
|
3732
|
+
* its own: `results` reports, in order, which were acknowledged and why any
|
|
3733
|
+
* were not (`message_not_found`, `receipt_mismatch`). A batch counts one
|
|
3734
|
+
* operation per started ten acknowledged messages.
|
|
3735
|
+
*/
|
|
3736
|
+
ackBatch(name: string, messages: {
|
|
3737
|
+
messageId: string;
|
|
3738
|
+
receipt: string;
|
|
3739
|
+
}[], options?: QueueScopeOptions): Promise<{
|
|
3740
|
+
results: QueueAckResult[];
|
|
3741
|
+
}>;
|
|
3742
|
+
/**
|
|
3743
|
+
* Releases a received message: retry with backoff (or after `delaySeconds`),
|
|
3744
|
+
* or dead-letter it now with `deadLetter: true`. `countAttempt: false`
|
|
3745
|
+
* reschedules without spending an attempt.
|
|
3746
|
+
*/
|
|
3747
|
+
nack(name: string, messageId: string, request: {
|
|
3748
|
+
receipt: string;
|
|
3749
|
+
delaySeconds?: number;
|
|
3750
|
+
deadLetter?: boolean;
|
|
3751
|
+
countAttempt?: boolean;
|
|
3752
|
+
error?: string;
|
|
3753
|
+
}, options?: QueueScopeOptions): Promise<QueueNackResult>;
|
|
3754
|
+
/** Extends a received message's lease to `visibilityTimeoutSeconds` from now. */
|
|
3755
|
+
extend(name: string, messageId: string, receipt: string, visibilityTimeoutSeconds: number, options?: QueueScopeOptions): Promise<{
|
|
3756
|
+
leaseExpiresAt: string;
|
|
3757
|
+
}>;
|
|
3758
|
+
/** Lists a queue's schedules. */
|
|
3759
|
+
listSchedules(name: string, options?: QueueScopeOptions): Promise<{
|
|
3760
|
+
items: QueueSchedule[];
|
|
3761
|
+
total: number;
|
|
3762
|
+
}>;
|
|
3763
|
+
/**
|
|
3764
|
+
* Creates a schedule that sends a message into the queue on a cron.
|
|
3765
|
+
*
|
|
3766
|
+
* @example
|
|
3767
|
+
* ```ts
|
|
3768
|
+
* await client.queues.createSchedule('emails', 'daily-digest', {
|
|
3769
|
+
* cron: '0 8 * * MON-FRI',
|
|
3770
|
+
* timezone: 'Europe/Berlin',
|
|
3771
|
+
* json: { kind: 'digest' },
|
|
3772
|
+
* });
|
|
3773
|
+
* ```
|
|
3774
|
+
*/
|
|
3775
|
+
createSchedule(name: string, schedule: string, input: QueueScheduleInput & {
|
|
3776
|
+
cron: string;
|
|
3777
|
+
}, options?: QueueScopeOptions): Promise<QueueSchedule>;
|
|
3778
|
+
/** Changes a schedule. Its next run is recomputed when the cron or time zone changes. */
|
|
3779
|
+
updateSchedule(name: string, schedule: string, input: QueueScheduleInput, options?: QueueScopeOptions): Promise<QueueSchedule>;
|
|
3780
|
+
/** Deletes a schedule. Messages it already sent stay queued. */
|
|
3781
|
+
deleteSchedule(name: string, schedule: string, options?: QueueScopeOptions): Promise<{
|
|
3782
|
+
deleted: boolean;
|
|
3783
|
+
}>;
|
|
3784
|
+
/** Sends the schedule's message now, outside its cron. */
|
|
3785
|
+
triggerSchedule(name: string, schedule: string, options?: QueueScopeOptions): Promise<{
|
|
3786
|
+
messageId: string;
|
|
3787
|
+
}>;
|
|
3788
|
+
}
|
|
3789
|
+
|
|
2717
3790
|
/** Input for minting a routing-only sticky session URL. */
|
|
2718
3791
|
interface CreateStickySessionUrlInput {
|
|
2719
3792
|
/** Opaque application key shared by callers that must reach the same instance. */
|
|
@@ -2919,137 +3992,227 @@ declare class GigadriveClient {
|
|
|
2919
3992
|
readonly stickySessions: StickySessionsResource;
|
|
2920
3993
|
/** Managed image optimization inspection and cache purge operations. */
|
|
2921
3994
|
readonly imageOptimization: ImageOptimizationResource;
|
|
3995
|
+
/**
|
|
3996
|
+
* Network Queues: manage queues and schedules, send, receive and
|
|
3997
|
+
* acknowledge messages. `client.queues.queue<T>(name)` returns a typed
|
|
3998
|
+
* handle bound to one queue.
|
|
3999
|
+
*/
|
|
4000
|
+
readonly queues: QueuesResource;
|
|
2922
4001
|
constructor(config?: GigadriveClientConfig);
|
|
2923
4002
|
}
|
|
2924
4003
|
|
|
2925
4004
|
/**
|
|
2926
|
-
*
|
|
2927
|
-
*
|
|
4005
|
+
* Lazily iterate every item across all pages of a cursor-paginated endpoint.
|
|
4006
|
+
* Pass a function that fetches one page for a given cursor; iteration stops when
|
|
4007
|
+
* the API stops returning a `nextCursor`.
|
|
4008
|
+
*
|
|
4009
|
+
* @typeParam T - The item type.
|
|
4010
|
+
* @param fetchPage - Fetches a single page for the given cursor (`undefined` for the first page).
|
|
2928
4011
|
*
|
|
2929
4012
|
* @example
|
|
2930
4013
|
* ```ts
|
|
2931
|
-
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2934
|
-
*
|
|
2935
|
-
* console.error('SDK error:', err.message);
|
|
2936
|
-
* }
|
|
4014
|
+
* for await (const object of paginate((cursor) =>
|
|
4015
|
+
* client.applications.storage.objects.list('app-id', 'bucket-id', { cursor }),
|
|
4016
|
+
* )) {
|
|
4017
|
+
* console.log(object.key);
|
|
2937
4018
|
* }
|
|
2938
4019
|
* ```
|
|
2939
4020
|
*/
|
|
2940
|
-
declare
|
|
2941
|
-
|
|
2942
|
-
}
|
|
4021
|
+
declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<Paginated<T>>): AsyncGenerator<T>;
|
|
4022
|
+
|
|
2943
4023
|
/**
|
|
2944
|
-
*
|
|
2945
|
-
* expired tokens, failed token refresh attempts, and failed token exchanges.
|
|
4024
|
+
* Returns a typed handle for a Gigadrive Network queue.
|
|
2946
4025
|
*
|
|
2947
|
-
*
|
|
2948
|
-
*
|
|
2949
|
-
*
|
|
2950
|
-
*
|
|
2951
|
-
*
|
|
4026
|
+
* Inside a deployment this needs no configuration: the platform injects the
|
|
4027
|
+
* credentials and the queue signing secret. Elsewhere, set
|
|
4028
|
+
* `GIGADRIVE_CLIENT_ID`, `GIGADRIVE_CLIENT_SECRET` and
|
|
4029
|
+
* `GIGADRIVE_APPLICATION_ID`, pass `environment`, or use
|
|
4030
|
+
* `client.queues.queue(name)` on a client you configure.
|
|
4031
|
+
*
|
|
4032
|
+
* @typeParam T - The payload type sent and received through this queue.
|
|
4033
|
+
* @param name - Queue name, unique in the environment and case-sensitive.
|
|
2952
4034
|
*
|
|
2953
4035
|
* @example
|
|
2954
4036
|
* ```ts
|
|
2955
|
-
*
|
|
2956
|
-
*
|
|
2957
|
-
*
|
|
2958
|
-
*
|
|
2959
|
-
*
|
|
2960
|
-
*
|
|
2961
|
-
*
|
|
4037
|
+
* import { queue } from '@gigadrive/sdk';
|
|
4038
|
+
*
|
|
4039
|
+
* export const emails = queue<{ to: string }>('emails');
|
|
4040
|
+
*
|
|
4041
|
+
* await emails.send({ to: 'jane@example.com' }, { delay: '10m' });
|
|
4042
|
+
*
|
|
4043
|
+
* // app/api/queues/emails/route.ts
|
|
4044
|
+
* export const POST = emails.handler(async (email) => sendWelcomeEmail(email.to));
|
|
2962
4045
|
* ```
|
|
2963
4046
|
*/
|
|
2964
|
-
declare
|
|
2965
|
-
|
|
2966
|
-
}
|
|
4047
|
+
declare function queue<T = unknown>(name: string, options?: QueueOptions<T> & {
|
|
4048
|
+
client?: GigadriveClient;
|
|
4049
|
+
}): Queue<T>;
|
|
4050
|
+
|
|
2967
4051
|
/**
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
4052
|
+
* Throw from a queue handler to have the message delivered again later
|
|
4053
|
+
* without spending one of its attempts. Use it for "not yet" outcomes, such
|
|
4054
|
+
* as waiting on a dependency or backing off a rate-limited API.
|
|
2970
4055
|
*
|
|
2971
|
-
*
|
|
2972
|
-
*
|
|
2973
|
-
*
|
|
4056
|
+
* @example
|
|
4057
|
+
* ```ts
|
|
4058
|
+
* export const POST = emails.handler(async (email) => {
|
|
4059
|
+
* if (await provider.isThrottled()) throw new RetryLaterError('30s');
|
|
4060
|
+
* await provider.send(email);
|
|
4061
|
+
* });
|
|
4062
|
+
* ```
|
|
2974
4063
|
*/
|
|
2975
|
-
declare class
|
|
4064
|
+
declare class RetryLaterError extends GigadriveError {
|
|
4065
|
+
/** Seconds until the next delivery. */
|
|
4066
|
+
readonly delaySeconds: number;
|
|
4067
|
+
constructor(delay: QueueDuration, message?: string);
|
|
4068
|
+
}
|
|
4069
|
+
/**
|
|
4070
|
+
* Throw from a queue handler when retrying cannot help, such as a payload
|
|
4071
|
+
* that fails validation. The message moves to the dead-letter list straight
|
|
4072
|
+
* away (or is dropped when the queue keeps no dead letters), with this
|
|
4073
|
+
* error's message recorded as the reason.
|
|
4074
|
+
*/
|
|
4075
|
+
declare class NonRetryableError extends GigadriveError {
|
|
2976
4076
|
constructor(message: string);
|
|
2977
4077
|
}
|
|
4078
|
+
|
|
4079
|
+
/** Header carrying the delivery signature: `t=<unix ms>,v1=<hex HMAC-SHA256>`. */
|
|
4080
|
+
declare const QUEUE_SIGNATURE_HEADER = "x-gigadrive-queue-signature";
|
|
4081
|
+
/** How far a delivery's signing time may drift from the receiver's clock. */
|
|
4082
|
+
declare const QUEUE_SIGNATURE_TOLERANCE_MS: number;
|
|
4083
|
+
/** The environment variable the platform injects with the environment's queue signing secret. */
|
|
4084
|
+
declare const QUEUE_SIGNING_SECRET_ENV = "GIGADRIVE_QUEUE_SIGNING_SECRET";
|
|
4085
|
+
/** What a delivery signature covers. */
|
|
4086
|
+
interface QueueSignatureInput {
|
|
4087
|
+
/** The environment's signing secret, `GIGADRIVE_QUEUE_SIGNING_SECRET` in a deployment. */
|
|
4088
|
+
secret: string;
|
|
4089
|
+
/** Queue name from `x-gigadrive-queue-name`. */
|
|
4090
|
+
queue: string;
|
|
4091
|
+
/** Message id from `x-gigadrive-queue-message-id`. */
|
|
4092
|
+
messageId: string;
|
|
4093
|
+
/** Delivery attempt from `x-gigadrive-queue-attempt`. */
|
|
4094
|
+
attempt: number;
|
|
4095
|
+
/** The raw request body, exactly as received. */
|
|
4096
|
+
body: Uint8Array | string;
|
|
4097
|
+
}
|
|
2978
4098
|
/**
|
|
2979
|
-
*
|
|
4099
|
+
* Computes the `x-gigadrive-queue-signature` header value for a delivery.
|
|
2980
4100
|
*
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
4101
|
+
* Gigadrive Network signs every push delivery this way. Use it to build
|
|
4102
|
+
* signed requests when you unit-test a queue handler.
|
|
4103
|
+
*
|
|
4104
|
+
* @param input - Secret and delivery fields to sign.
|
|
4105
|
+
* @param timestamp - Signing time in Unix milliseconds. Defaults to now.
|
|
4106
|
+
* @returns The header value, `t=<ms>,v1=<hex>`.
|
|
2983
4107
|
*
|
|
2984
4108
|
* @example
|
|
2985
4109
|
* ```ts
|
|
2986
|
-
*
|
|
2987
|
-
*
|
|
2988
|
-
* } catch (err) {
|
|
2989
|
-
* if (err instanceof ApiError) {
|
|
2990
|
-
* console.error(`API error ${err.status}: ${err.message}`);
|
|
2991
|
-
* // err.code may contain a machine-readable error code
|
|
2992
|
-
* }
|
|
2993
|
-
* }
|
|
4110
|
+
* const signature = await signQueueDelivery({ secret, queue: 'emails', messageId, attempt: 1, body });
|
|
4111
|
+
* await handler(new Request(url, { method: 'POST', body, headers: { 'x-gigadrive-queue-signature': signature, ... } }));
|
|
2994
4112
|
* ```
|
|
2995
4113
|
*/
|
|
2996
|
-
declare
|
|
2997
|
-
/** The HTTP status code of the failed response (e.g. 404, 500). */
|
|
2998
|
-
readonly status: number;
|
|
2999
|
-
/** An optional machine-readable error code from the API response body. */
|
|
3000
|
-
readonly code: string | undefined;
|
|
3001
|
-
constructor(message: string, status: number, code?: string);
|
|
3002
|
-
}
|
|
4114
|
+
declare function signQueueDelivery(input: QueueSignatureInput, timestamp?: number): Promise<string>;
|
|
3003
4115
|
/**
|
|
3004
|
-
*
|
|
3005
|
-
* transport-level error from the resumable upload) is preserved on
|
|
3006
|
-
* {@link cause} for inspection.
|
|
4116
|
+
* Verifies a push delivery's `x-gigadrive-queue-signature` header.
|
|
3007
4117
|
*
|
|
3008
|
-
*
|
|
3009
|
-
*
|
|
3010
|
-
*
|
|
3011
|
-
*
|
|
3012
|
-
*
|
|
3013
|
-
*
|
|
3014
|
-
*
|
|
3015
|
-
*
|
|
3016
|
-
* }
|
|
3017
|
-
* ```
|
|
4118
|
+
* Rejects a missing or malformed header, a signature made with another
|
|
4119
|
+
* secret or over different fields, and one signed more than five minutes
|
|
4120
|
+
* away from `now`. {@link Queue.handler} calls this for you.
|
|
4121
|
+
*
|
|
4122
|
+
* @param header - The header value, or `null` when absent.
|
|
4123
|
+
* @param input - Secret and the delivery fields the signature must cover.
|
|
4124
|
+
* @param now - The receiver's clock in Unix milliseconds. Defaults to now.
|
|
4125
|
+
* @returns `true` only for a valid, fresh signature.
|
|
3018
4126
|
*/
|
|
3019
|
-
declare
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
4127
|
+
declare function verifyQueueSignature(header: string | null | undefined, input: QueueSignatureInput, now?: number): Promise<boolean>;
|
|
4128
|
+
|
|
4129
|
+
/** Where the Workflow SDK serves its queue handler. */
|
|
4130
|
+
declare const WORKFLOW_CONSUMER_PATH = "/.well-known/workflow/v1/flow";
|
|
4131
|
+
/** Carries the Workflow SDK's queue name, which Gigadrive queue names cannot always hold. */
|
|
4132
|
+
declare const WORKFLOW_QUEUE_NAME_HEADER = "x-workflow-queue-name";
|
|
4133
|
+
/** Options of a Workflow SDK queue send, as the Workflow runtime passes them. */
|
|
4134
|
+
interface WorkflowQueueSendOptions {
|
|
4135
|
+
deploymentId?: string;
|
|
4136
|
+
idempotencyKey?: string;
|
|
4137
|
+
headers?: Record<string, string>;
|
|
4138
|
+
delaySeconds?: number;
|
|
4139
|
+
specVersion?: number;
|
|
4140
|
+
region?: string;
|
|
4141
|
+
}
|
|
4142
|
+
/** What the Workflow runtime's handler learns about a delivery. */
|
|
4143
|
+
interface WorkflowQueueHandlerMeta<TMessageId extends string> {
|
|
4144
|
+
attempt: number;
|
|
4145
|
+
queueName: string;
|
|
4146
|
+
messageId: TMessageId;
|
|
4147
|
+
requestId?: string;
|
|
3023
4148
|
}
|
|
3024
4149
|
/**
|
|
3025
|
-
*
|
|
3026
|
-
*
|
|
3027
|
-
*
|
|
3028
|
-
* The upload URL is only valid until `session.expiresAt`; very large uploads on
|
|
3029
|
-
* slow connections can exceed that window.
|
|
4150
|
+
* The queue half of a Workflow SDK World, backed by Gigadrive Network
|
|
4151
|
+
* queues. It matches the World `Queue` interface of `@workflow/world`.
|
|
3030
4152
|
*/
|
|
3031
|
-
|
|
3032
|
-
|
|
4153
|
+
interface WorkflowQueue<TMessageId extends string = string> {
|
|
4154
|
+
getDeploymentId(): Promise<string>;
|
|
4155
|
+
queue(queueName: string, message: unknown, opts?: WorkflowQueueSendOptions): Promise<{
|
|
4156
|
+
messageId: TMessageId | null;
|
|
4157
|
+
}>;
|
|
4158
|
+
queueBatch(queueName: string, messages: readonly {
|
|
4159
|
+
message: unknown;
|
|
4160
|
+
opts?: WorkflowQueueSendOptions;
|
|
4161
|
+
}[]): Promise<({
|
|
4162
|
+
messageId: TMessageId | null;
|
|
4163
|
+
error?: undefined;
|
|
4164
|
+
} | {
|
|
4165
|
+
messageId: null;
|
|
4166
|
+
error: string;
|
|
4167
|
+
retryable: boolean;
|
|
4168
|
+
})[]>;
|
|
4169
|
+
createQueueHandler(queueNamePrefix: string, handler: (message: unknown, meta: WorkflowQueueHandlerMeta<TMessageId>) => Promise<unknown>): (request: Request) => Promise<Response>;
|
|
4170
|
+
}
|
|
4171
|
+
/** Options for {@link createWorkflowQueue}. */
|
|
4172
|
+
interface WorkflowQueueOptions extends QueueScopeOptions {
|
|
4173
|
+
/** Client for API calls. Defaults to a zero-config client, which works inside a deployment. */
|
|
4174
|
+
client?: GigadriveClient;
|
|
4175
|
+
/** Path of the Workflow handler on your deployment. Default `/.well-known/workflow/v1/flow`. */
|
|
4176
|
+
consumerPath?: string;
|
|
4177
|
+
/** Deployment id the Workflow runtime stamps on runs. Defaults to `GIGADRIVE_DEPLOYMENT_ID`. */
|
|
4178
|
+
deploymentId?: string;
|
|
4179
|
+
/**
|
|
4180
|
+
* Settings for the backing queue. Without them the queue is created once
|
|
4181
|
+
* with 100 attempts (the Workflow runtime gives up earlier on its own) and a
|
|
4182
|
+
* 900 second delivery timeout, and later changes made in the console are
|
|
4183
|
+
* kept. With them, every cold start applies them, so declare them here or
|
|
4184
|
+
* in the console, not both.
|
|
4185
|
+
*/
|
|
4186
|
+
queueSettings?: Omit<QueueSettings, 'consumerPath'>;
|
|
4187
|
+
/** Push signing secret. Defaults to `GIGADRIVE_QUEUE_SIGNING_SECRET`. */
|
|
4188
|
+
signingSecret?: string;
|
|
4189
|
+
/** Accept unsigned deliveries. Local development only. */
|
|
4190
|
+
allowUnsigned?: boolean;
|
|
3033
4191
|
}
|
|
3034
|
-
|
|
3035
4192
|
/**
|
|
3036
|
-
*
|
|
3037
|
-
*
|
|
3038
|
-
*
|
|
4193
|
+
* Runs the [Workflow SDK](https://workflow-sdk.dev) on Gigadrive Network
|
|
4194
|
+
* queues: returns the World `Queue` implementation (`getDeploymentId`,
|
|
4195
|
+
* `queue`, `queueBatch`, `createQueueHandler`).
|
|
3039
4196
|
*
|
|
3040
|
-
*
|
|
3041
|
-
*
|
|
4197
|
+
* Every Workflow queue with the same prefix shares one push queue named
|
|
4198
|
+
* after the prefix (such as `__wkf_workflow_`), created on first use and
|
|
4199
|
+
* delivering to `/.well-known/workflow/v1/flow`. Sleeps and step timeouts
|
|
4200
|
+
* reschedule the message without spending attempts, every message is pinned
|
|
4201
|
+
* to the deployment that sent it (or the one the runtime names), and
|
|
4202
|
+
* idempotency keys become deduplication keys.
|
|
4203
|
+
*
|
|
4204
|
+
* @typeParam TMessageId - Pass the World's `MessageId` type so the result
|
|
4205
|
+
* satisfies `@workflow/world`'s branded message ids.
|
|
3042
4206
|
*
|
|
3043
4207
|
* @example
|
|
3044
4208
|
* ```ts
|
|
3045
|
-
*
|
|
3046
|
-
*
|
|
3047
|
-
*
|
|
3048
|
-
*
|
|
3049
|
-
* }
|
|
4209
|
+
* import type { MessageId, World } from '@workflow/world';
|
|
4210
|
+
* import { createWorkflowQueue } from '@gigadrive/sdk';
|
|
4211
|
+
*
|
|
4212
|
+
* export const world: World = { ...createWorkflowQueue<MessageId>(), ...storage, ...streamer };
|
|
3050
4213
|
* ```
|
|
3051
4214
|
*/
|
|
3052
|
-
declare function
|
|
4215
|
+
declare function createWorkflowQueue<TMessageId extends string = string>(options?: WorkflowQueueOptions): WorkflowQueue<TMessageId>;
|
|
3053
4216
|
|
|
3054
4217
|
/**
|
|
3055
4218
|
* Server-Sent Events (SSE) parsing for streamed API responses (e.g. streamed
|
|
@@ -3068,4 +4231,4 @@ declare function paginate<T>(fetchPage: (cursor: string | undefined) => Promise<
|
|
|
3068
4231
|
*/
|
|
3069
4232
|
declare function parseSSEStream<T = unknown>(response: Response): AsyncGenerator<T>;
|
|
3070
4233
|
|
|
3071
|
-
export { AiGatewayAudioResource, type AiGatewayBudget, type AiGatewayBudgetInput, AiGatewayBudgetsResource, AiGatewayPoliciesResource, type AiGatewayPolicy, type AiGatewayPolicyInput, type AiGatewayProviderAttempt, type AiGatewayRequestEvent, type AiGatewayRequestsQuery, AiGatewayResource, type AiGatewayUsageBreakdown, type AiGatewayUsageQuery, AiGatewayUsageResource, type AiGatewayUsageSummary, AiGatewayVideosResource, type AiModel, type AiModelCapabilities, type AiModelRoutingProvider, ApiError, type ApiKey, ApiKeysResource, type Application, ApplicationEnvVarsResource, type ApplicationHostnameList, ApplicationRequestsResource, ApplicationStorageResource, ApplicationsResource, AuthenticationError, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionContentPart, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionUsage, ConfigurationError, type CreateApiKeyInput, type CreateApiKeyResult, type CreateDeploymentInput, type CreateEnvVarInput, type CreateOrganizationInput, type CreateStickySessionUrlInput, type CreateStickySessionUrlResult, type CreateStorageBucketInput, type CreateUploadSessionInput, type CreateUploadSessionResponse, type Deployment, type DeploymentLog, type DeploymentLogPage, type DeploymentLogType, type DeploymentStatus, DeploymentsResource, type EmptyStorageTrashResult, type EnvVar, type GatewayRequestOptions, type GatewayResult, GigadriveClient, type GigadriveClientConfig, GigadriveError, type Hostname, type HostnameAvailability, type ImageCacheInspection, type ImageCachePurgeResult, ImageOptimizationResource, type ListApiKeysQuery, type ListApplicationsQuery, type ListDeploymentLogsQuery, type ListDeploymentsQuery, type ListQuery, type ListRequestsQuery, type ListStorageBucketsQuery, type ListStorageObjectsQuery, type ListStorageTrashQuery, type ListStorageUploadSessionsQuery, type ManagedImageUrlOptions, type NetworkRequest, type NetworkRequestApplicationRef, type NetworkRequestAssetRef, type NetworkRequestBucketRef, type NetworkRequestDeploymentRef, type NetworkRequestDetails, type NetworkRequestFunctionRef, type NetworkRequestMetrics, type NetworkRequestObjectRef, type NetworkRequestSummary, type NetworkResponseDetails, type NodeReadableLike, type Organization, OrganizationAiGatewayResource, OrganizationEnvVarsResource, type OrganizationMember, OrganizationMembersResource, type OrganizationMembershipRole, type OrganizationProductAccess, type OrganizationProductEntitlement, type OrganizationProductEntitlementCheck, type OrganizationProductSubscription, OrganizationProductsResource, OrganizationsResource, type Paginated, type PresignedUrlResult, type ProductAccessMode, type ProductAccessResolutionSource, type ProductDefaultAccessPolicy, type ProductDefinition, type ProductEntitlementStatus, type ProductPlan, type ProductSubscriptionStatus, type ProviderRouting, type PullEnvVarsQuery, type PullEnvVarsResult, type QueryValue, type ResolvedEnvVar, type ResponsesRequest, type ResponsesResponse, type RunUploadOptions, type SetProductionHostnameResult, type SpeechRequest, type StartUploadResult, StickySessionsResource, type StorageBucket, type StorageBucketReference, StorageBucketsResource, type StorageEnvironmentOptions, type StorageObject, type StorageObjectAccess, type StorageObjectAccessOptions, type StorageObjectList, StorageObjectsResource, type StorageTrashList, StorageTrashResource, type StorageUploadSession, StorageUploadSessionsResource, type TranscriptionRequest, type TranscriptionResponse, type TrashedStorageObject, type UpdateEnvVarInput, type UploadBatchItemResult, type UploadBatchOptions, type UploadByteSource, type UploadData, UploadError, type UploadFileInput, type UploadFileResult, type UploadPart, UploadSessionExpiredError, type UploadUrlStorage, type VideoGenerationRequest, type VideoGenerationResponse, type VideoModelList, type WaitForCompletionOptions, createManagedImageUrl, paginate, parseSSEStream };
|
|
4234
|
+
export { type AddCustomDomainInput, AiGatewayAudioResource, type AiGatewayBudget, type AiGatewayBudgetInput, AiGatewayBudgetsResource, AiGatewayPoliciesResource, type AiGatewayPolicy, type AiGatewayPolicyInput, type AiGatewayProviderAttempt, type AiGatewayRequestEvent, type AiGatewayRequestsQuery, AiGatewayResource, type AiGatewayUsageBreakdown, type AiGatewayUsageQuery, AiGatewayUsageResource, type AiGatewayUsageSummary, AiGatewayVideosResource, type AiModel, type AiModelCapabilities, type AiModelRoutingProvider, ApiError, type ApiKey, ApiKeysResource, type Application, ApplicationDomainsResource, ApplicationEnvVarsResource, type ApplicationHostnameList, ApplicationRequestsResource, ApplicationStorageResource, ApplicationsResource, AuthenticationError, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionContentPart, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionUsage, ConfigurationError, type CreateApiKeyInput, type CreateApiKeyResult, type CreateDeploymentInput, type CreateEnvVarInput, type CreateOrganizationInput, type CreateStickySessionUrlInput, type CreateStickySessionUrlResult, type CreateStorageBucketInput, type CreateUploadSessionInput, type CreateUploadSessionResponse, type CustomDomain, type CustomDomainState, type CustomDomainTarget, type CustomDomainTargetInput, type Deployment, type DeploymentLog, type DeploymentLogPage, type DeploymentLogType, type DeploymentStatus, DeploymentsResource, DomainNotActiveError, type DomainOwnership, type DomainProblem, type EmptyStorageTrashResult, type EnvVar, type GatewayRequestOptions, type GatewayResult, GigadriveClient, type GigadriveClientConfig, GigadriveError, type Hostname, type HostnameAvailability, type ImageCacheInspection, type ImageCachePurgeResult, ImageOptimizationResource, type ListApiKeysQuery, type ListApplicationsQuery, type ListDeploymentLogsQuery, type ListDeploymentsQuery, type ListQuery, type ListRequestsQuery, type ListStorageBucketsQuery, type ListStorageObjectsQuery, type ListStorageTrashQuery, type ListStorageUploadSessionsQuery, type ManagedImageUrlOptions, type NetworkRequest, type NetworkRequestApplicationRef, type NetworkRequestAssetRef, type NetworkRequestBucketRef, type NetworkRequestDeploymentRef, type NetworkRequestDetails, type NetworkRequestFunctionRef, type NetworkRequestMetrics, type NetworkRequestObjectRef, type NetworkRequestSummary, type NetworkResponseDetails, type NodeReadableLike, NonRetryableError, type Organization, OrganizationAiGatewayResource, OrganizationDomainsResource, OrganizationEnvVarsResource, type OrganizationMember, OrganizationMembersResource, type OrganizationMembershipRole, type OrganizationProductAccess, type OrganizationProductEntitlement, type OrganizationProductEntitlementCheck, type OrganizationProductSubscription, OrganizationProductsResource, OrganizationsResource, type Paginated, type PresignedUrlResult, type ProductAccessMode, type ProductAccessResolutionSource, type ProductDefaultAccessPolicy, type ProductDefinition, type ProductEntitlementStatus, type ProductPlan, type ProductSubscriptionStatus, type ProviderRouting, type PullEnvVarsQuery, type PullEnvVarsResult, QUEUE_DELIVERY_HEADERS, QUEUE_RESPONSE_HEADERS, QUEUE_SIGNATURE_HEADER, QUEUE_SIGNATURE_TOLERANCE_MS, QUEUE_SIGNING_SECRET_ENV, type QueryValue, Queue, type QueueAckResult, type QueueBatchSent, type QueueCodec, type QueueDuration, type QueueInfo, type QueueMessageHandler, type QueueMessageInput, type QueueMessageMeta, type QueueMessageRecord, type QueueNackResult, type QueueOptions, type QueueSchedule, type QueueScheduleInput, type QueueScopeOptions, type QueueSendOptions, type QueueSendResult, type QueueSent, type QueueSettings, type QueueSignatureInput, type QueueStats, QueuesResource, type ReceivedQueueMessage, type RequiredDnsRecord, type ResolvedEnvVar, type ResponsesRequest, type ResponsesResponse, RetryLaterError, type RunUploadOptions, type SetProductionHostnameResult, type SpeechRequest, type StartUploadResult, StickySessionsResource, type StorageBucket, type StorageBucketReference, StorageBucketsResource, type StorageEnvironmentOptions, type StorageObject, type StorageObjectAccess, type StorageObjectAccessOptions, type StorageObjectList, StorageObjectsResource, type StorageTrashList, StorageTrashResource, type StorageUploadSession, StorageUploadSessionsResource, type TranscriptionRequest, type TranscriptionResponse, type TrashedStorageObject, type UpdateCustomDomainInput, type UpdateEnvVarInput, type UploadBatchItemResult, type UploadBatchOptions, type UploadByteSource, type UploadData, UploadError, type UploadFileInput, type UploadFileResult, type UploadPart, UploadSessionExpiredError, type UploadUrlStorage, type VideoGenerationRequest, type VideoGenerationResponse, type VideoModelList, WORKFLOW_CONSUMER_PATH, WORKFLOW_QUEUE_NAME_HEADER, type WaitForCompletionOptions, type WaitUntilActiveOptions, type WorkflowQueue, type WorkflowQueueHandlerMeta, type WorkflowQueueOptions, type WorkflowQueueSendOptions, createManagedImageUrl, createWorkflowQueue, defaultQueueCodec, durationToSeconds, paginate, parseSSEStream, queue, signQueueDelivery, verifyQueueSignature };
|