@ragable/sdk 0.6.24 → 0.7.6
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/dist/index.d.mts +430 -27
- package/dist/index.d.ts +430 -27
- package/dist/index.js +275 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +274 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +49 -49
package/dist/index.d.ts
CHANGED
|
@@ -74,20 +74,10 @@ type ColumnValue<D extends RagableDatabase, T extends RagableTableNames<D>, C ex
|
|
|
74
74
|
* or the browser throws **Illegal invocation**. Use this for defaults and for `options.fetch`.
|
|
75
75
|
*/
|
|
76
76
|
declare function bindFetch(custom?: typeof fetch): typeof fetch;
|
|
77
|
-
/**
|
|
77
|
+
/** Hosted Ragable HTTP API base (`…/api`) — used by all SDK clients (not configurable). */
|
|
78
78
|
declare const DEFAULT_RAGABLE_API_BASE = "https://ragable-341305259977.asia-southeast1.run.app/api";
|
|
79
|
-
/**
|
|
80
|
-
* Normalize the API base (no trailing slash). Use **`DEFAULT_RAGABLE_API_BASE`** when
|
|
81
|
-
* **`explicitBaseUrl`** is missing or blank.
|
|
82
|
-
*/
|
|
83
|
-
declare function resolveRagableApiBase(explicitBaseUrl?: string | null | undefined): string;
|
|
84
79
|
interface RagableClientOptions {
|
|
85
80
|
apiKey: string;
|
|
86
|
-
/**
|
|
87
|
-
* HTTP API root including the **`/api`** segment, e.g. `https://your-host.com/api`.
|
|
88
|
-
* Defaults to {@link DEFAULT_RAGABLE_API_BASE}.
|
|
89
|
-
*/
|
|
90
|
-
baseUrl?: string;
|
|
91
81
|
fetch?: typeof fetch;
|
|
92
82
|
headers?: HeadersInit;
|
|
93
83
|
}
|
|
@@ -904,8 +894,6 @@ interface AuthOptions {
|
|
|
904
894
|
}
|
|
905
895
|
interface RagableAuthConfig {
|
|
906
896
|
authGroupId: string;
|
|
907
|
-
/** HTTP API root (including `/api`); set from the browser client **`baseUrl`** option. */
|
|
908
|
-
baseUrl?: string;
|
|
909
897
|
fetch?: typeof fetch;
|
|
910
898
|
headers?: HeadersInit;
|
|
911
899
|
auth?: AuthOptions;
|
|
@@ -1110,11 +1098,8 @@ declare class Transport {
|
|
|
1110
1098
|
}
|
|
1111
1099
|
declare function parseTransportResponse<T>(response: Response): Promise<T>;
|
|
1112
1100
|
|
|
1113
|
-
/**
|
|
1114
|
-
|
|
1115
|
-
* {@link resolveRagableApiBase}.
|
|
1116
|
-
*/
|
|
1117
|
-
declare function normalizeBrowserApiBase(explicitBaseUrl?: string): string;
|
|
1101
|
+
/** Canonical browser/server API base (`…/api`, no trailing slash). */
|
|
1102
|
+
declare function normalizeBrowserApiBase(): string;
|
|
1118
1103
|
type BrowserDataAuthMode = "user" | "publicAnon" | "admin";
|
|
1119
1104
|
/**
|
|
1120
1105
|
* Resolves how database requests are authorized. If `dataAuth` is omitted and a
|
|
@@ -1126,12 +1111,6 @@ type BrowserDataAuthMode = "user" | "publicAnon" | "admin";
|
|
|
1126
1111
|
declare function effectiveDataAuth(options: RagableBrowserClientOptions): BrowserDataAuthMode;
|
|
1127
1112
|
interface RagableBrowserClientOptions {
|
|
1128
1113
|
organizationId: string;
|
|
1129
|
-
/**
|
|
1130
|
-
* HTTP API root including **`/api`**, e.g. `https://your-host.com/api` or
|
|
1131
|
-
* `import.meta.env.VITE_RAGABLE_API_BASE`. Trailing slashes are stripped.
|
|
1132
|
-
* When omitted, the package default **`DEFAULT_RAGABLE_API_BASE`** is used.
|
|
1133
|
-
*/
|
|
1134
|
-
baseUrl?: string;
|
|
1135
1114
|
websiteId?: string;
|
|
1136
1115
|
authGroupId?: string;
|
|
1137
1116
|
databaseInstanceId?: string;
|
|
@@ -1439,7 +1418,6 @@ declare class RagableBrowserDatabaseClient<Database extends RagableDatabase = De
|
|
|
1439
1418
|
private readonly options;
|
|
1440
1419
|
private readonly ragableAuth;
|
|
1441
1420
|
private readonly fetchImpl;
|
|
1442
|
-
private readonly apiBase;
|
|
1443
1421
|
private _transport;
|
|
1444
1422
|
readonly collections: BrowserCollections<Database>;
|
|
1445
1423
|
readonly collection: BrowserCollectionFactory<Database>;
|
|
@@ -1542,6 +1520,132 @@ interface BrowserRealtimeSubscription {
|
|
|
1542
1520
|
unsubscribe: () => void;
|
|
1543
1521
|
readonly status: BrowserRealtimeStatus;
|
|
1544
1522
|
}
|
|
1523
|
+
interface BrowserStorageItem {
|
|
1524
|
+
type: "file" | "folder";
|
|
1525
|
+
path: string;
|
|
1526
|
+
name: string;
|
|
1527
|
+
size?: string | null;
|
|
1528
|
+
contentType?: string | null;
|
|
1529
|
+
updated?: string | null;
|
|
1530
|
+
}
|
|
1531
|
+
interface BrowserStorageListResult {
|
|
1532
|
+
bucket: string;
|
|
1533
|
+
prefix: string;
|
|
1534
|
+
items: BrowserStorageItem[];
|
|
1535
|
+
nextPageToken: string | null;
|
|
1536
|
+
}
|
|
1537
|
+
interface BrowserStorageUploadResult {
|
|
1538
|
+
success: true;
|
|
1539
|
+
path: string;
|
|
1540
|
+
size: string | null;
|
|
1541
|
+
contentType: string | null;
|
|
1542
|
+
updated: string | null;
|
|
1543
|
+
}
|
|
1544
|
+
interface BrowserStorageDownloadResult {
|
|
1545
|
+
path: string;
|
|
1546
|
+
size: string | null;
|
|
1547
|
+
contentType: string | null;
|
|
1548
|
+
updated: string | null;
|
|
1549
|
+
encoding: string;
|
|
1550
|
+
contentsBase64: string;
|
|
1551
|
+
text: string | null;
|
|
1552
|
+
textIncluded: boolean;
|
|
1553
|
+
}
|
|
1554
|
+
interface BrowserStorageSignedUrlResult {
|
|
1555
|
+
url: string;
|
|
1556
|
+
method: string;
|
|
1557
|
+
expiresInSeconds: number;
|
|
1558
|
+
objectPath: string;
|
|
1559
|
+
}
|
|
1560
|
+
interface BrowserStorageBulkDeleteResult {
|
|
1561
|
+
success: boolean;
|
|
1562
|
+
totalRequested: number;
|
|
1563
|
+
uniquePaths: number;
|
|
1564
|
+
deleted: string[];
|
|
1565
|
+
errors: Array<{
|
|
1566
|
+
path: string;
|
|
1567
|
+
error: string;
|
|
1568
|
+
}>;
|
|
1569
|
+
}
|
|
1570
|
+
declare class BrowserStorageBucketClient {
|
|
1571
|
+
private readonly options;
|
|
1572
|
+
private readonly fetchImpl;
|
|
1573
|
+
private readonly bucketId;
|
|
1574
|
+
constructor(options: RagableBrowserClientOptions, fetchImpl: typeof fetch, bucketId: string);
|
|
1575
|
+
private get authGroupId();
|
|
1576
|
+
private base;
|
|
1577
|
+
private bearerToken;
|
|
1578
|
+
private req;
|
|
1579
|
+
list(params?: {
|
|
1580
|
+
prefix?: string;
|
|
1581
|
+
delimiter?: string;
|
|
1582
|
+
maxResults?: number;
|
|
1583
|
+
pageToken?: string;
|
|
1584
|
+
}): Promise<BrowserStorageListResult>;
|
|
1585
|
+
upload(params: {
|
|
1586
|
+
objectPath: string;
|
|
1587
|
+
file: Blob | ArrayBuffer | Uint8Array;
|
|
1588
|
+
fileName?: string;
|
|
1589
|
+
contentType?: string;
|
|
1590
|
+
cacheControl?: string;
|
|
1591
|
+
}): Promise<BrowserStorageUploadResult>;
|
|
1592
|
+
download(params: {
|
|
1593
|
+
objectPath: string;
|
|
1594
|
+
asText?: boolean;
|
|
1595
|
+
maxTextBytes?: number;
|
|
1596
|
+
}): Promise<BrowserStorageDownloadResult>;
|
|
1597
|
+
delete(objectPath: string): Promise<{
|
|
1598
|
+
success: true;
|
|
1599
|
+
path: string;
|
|
1600
|
+
}>;
|
|
1601
|
+
bulkDelete(objectPaths: string[]): Promise<BrowserStorageBulkDeleteResult>;
|
|
1602
|
+
getSignedUploadUrl(params: {
|
|
1603
|
+
objectPath: string;
|
|
1604
|
+
contentType?: string;
|
|
1605
|
+
expiresInSeconds?: number;
|
|
1606
|
+
}): Promise<BrowserStorageSignedUrlResult>;
|
|
1607
|
+
getSignedDownloadUrl(params: {
|
|
1608
|
+
objectPath: string;
|
|
1609
|
+
expiresInSeconds?: number;
|
|
1610
|
+
}): Promise<BrowserStorageSignedUrlResult>;
|
|
1611
|
+
copy(params: {
|
|
1612
|
+
sourcePath: string;
|
|
1613
|
+
destinationPath: string;
|
|
1614
|
+
}): Promise<{
|
|
1615
|
+
success: true;
|
|
1616
|
+
sourcePath: string;
|
|
1617
|
+
destinationPath: string;
|
|
1618
|
+
}>;
|
|
1619
|
+
move(params: {
|
|
1620
|
+
sourcePath: string;
|
|
1621
|
+
destinationPath: string;
|
|
1622
|
+
}): Promise<{
|
|
1623
|
+
success: true;
|
|
1624
|
+
sourcePath: string;
|
|
1625
|
+
destinationPath: string;
|
|
1626
|
+
}>;
|
|
1627
|
+
createFolder(folderPath: string): Promise<{
|
|
1628
|
+
success: true;
|
|
1629
|
+
folderPath: string;
|
|
1630
|
+
}>;
|
|
1631
|
+
deleteFolder(folderPath: string): Promise<{
|
|
1632
|
+
success: true;
|
|
1633
|
+
folderPath: string;
|
|
1634
|
+
}>;
|
|
1635
|
+
getMetadata(objectPath: string): Promise<{
|
|
1636
|
+
name: string;
|
|
1637
|
+
contentType: string | null;
|
|
1638
|
+
size: string | null;
|
|
1639
|
+
updated: string | null;
|
|
1640
|
+
metadata?: Record<string, string>;
|
|
1641
|
+
}>;
|
|
1642
|
+
}
|
|
1643
|
+
declare class RagableBrowserStorageClient {
|
|
1644
|
+
private readonly options;
|
|
1645
|
+
private readonly fetchImpl;
|
|
1646
|
+
constructor(options: RagableBrowserClientOptions, fetchImpl: typeof fetch);
|
|
1647
|
+
from(bucketId: string): BrowserStorageBucketClient;
|
|
1648
|
+
}
|
|
1545
1649
|
interface AgentConversationMessage {
|
|
1546
1650
|
role: "user" | "assistant";
|
|
1547
1651
|
content: string;
|
|
@@ -1563,7 +1667,6 @@ interface AgentConversationSubscription {
|
|
|
1563
1667
|
declare class RagableBrowserAgentsClient {
|
|
1564
1668
|
private readonly options;
|
|
1565
1669
|
private readonly fetchImpl;
|
|
1566
|
-
private readonly apiBase;
|
|
1567
1670
|
constructor(options: RagableBrowserClientOptions);
|
|
1568
1671
|
private toUrl;
|
|
1569
1672
|
private requireWebsiteId;
|
|
@@ -1611,6 +1714,7 @@ declare class RagableBrowser<Database extends RagableDatabase = DefaultRagableDa
|
|
|
1611
1714
|
readonly auth: RagableBrowserAuthClient<AuthUser>;
|
|
1612
1715
|
readonly database: RagableBrowserDatabaseClient<Database>;
|
|
1613
1716
|
readonly db: RagableBrowserDatabaseClient<Database>;
|
|
1717
|
+
readonly storage: RagableBrowserStorageClient;
|
|
1614
1718
|
readonly transport: Transport;
|
|
1615
1719
|
private readonly _ragableAuth;
|
|
1616
1720
|
constructor(options: RagableBrowserClientOptions);
|
|
@@ -1684,9 +1788,308 @@ declare function formatRetrievalContext(results: ShiftSearchResult[], options?:
|
|
|
1684
1788
|
*/
|
|
1685
1789
|
declare function createRagPipeline(client: RagClientForPipeline, options: RagPipelineOptions): RagPipeline;
|
|
1686
1790
|
|
|
1791
|
+
interface StorageBucket {
|
|
1792
|
+
id: string;
|
|
1793
|
+
name: string;
|
|
1794
|
+
organizationId: string;
|
|
1795
|
+
status: string;
|
|
1796
|
+
createdAt: string;
|
|
1797
|
+
updatedAt: string;
|
|
1798
|
+
}
|
|
1799
|
+
interface StorageBucketItem {
|
|
1800
|
+
type: "file" | "folder";
|
|
1801
|
+
path: string;
|
|
1802
|
+
name: string;
|
|
1803
|
+
/** File size in bytes (files only). */
|
|
1804
|
+
size?: string | null;
|
|
1805
|
+
contentType?: string | null;
|
|
1806
|
+
updated?: string | null;
|
|
1807
|
+
generation?: string | null;
|
|
1808
|
+
}
|
|
1809
|
+
interface StorageListContentsResult {
|
|
1810
|
+
bucket: string;
|
|
1811
|
+
prefix: string;
|
|
1812
|
+
items: StorageBucketItem[];
|
|
1813
|
+
nextPageToken: string | null;
|
|
1814
|
+
}
|
|
1815
|
+
interface StorageListBucketsParams {
|
|
1816
|
+
/** Filter by name substring. */
|
|
1817
|
+
q?: string;
|
|
1818
|
+
status?: string;
|
|
1819
|
+
sort?: string;
|
|
1820
|
+
}
|
|
1821
|
+
interface StorageListContentsParams {
|
|
1822
|
+
/** Folder prefix to list inside (e.g. `"reports/"`). */
|
|
1823
|
+
prefix?: string;
|
|
1824
|
+
/** Path delimiter — defaults to `"/"` on the server. */
|
|
1825
|
+
delimiter?: string;
|
|
1826
|
+
maxResults?: number;
|
|
1827
|
+
pageToken?: string;
|
|
1828
|
+
}
|
|
1829
|
+
type StorageUploadableFile = Blob | ArrayBuffer | Uint8Array;
|
|
1830
|
+
interface StorageUploadParams {
|
|
1831
|
+
/** Target path inside the bucket (e.g. `"reports/jan.pdf"`). */
|
|
1832
|
+
objectPath: string;
|
|
1833
|
+
file: StorageUploadableFile;
|
|
1834
|
+
/** Optional filename hint for content-type detection. */
|
|
1835
|
+
fileName?: string;
|
|
1836
|
+
contentType?: string;
|
|
1837
|
+
/** HTTP `Cache-Control` header stored with the object. */
|
|
1838
|
+
cacheControl?: string;
|
|
1839
|
+
}
|
|
1840
|
+
interface StorageUploadResult {
|
|
1841
|
+
success: true;
|
|
1842
|
+
path: string;
|
|
1843
|
+
size: string | null;
|
|
1844
|
+
contentType: string | null;
|
|
1845
|
+
generation: string | null;
|
|
1846
|
+
updated: string | null;
|
|
1847
|
+
}
|
|
1848
|
+
interface StorageDownloadParams {
|
|
1849
|
+
objectPath: string;
|
|
1850
|
+
/** When `true`, the response includes `text` if the file fits in `maxTextBytes`. */
|
|
1851
|
+
asText?: boolean;
|
|
1852
|
+
/** Maximum bytes to decode as text (default 1 MB, max 5 MB). */
|
|
1853
|
+
maxTextBytes?: number;
|
|
1854
|
+
}
|
|
1855
|
+
interface StorageDownloadResult {
|
|
1856
|
+
path: string;
|
|
1857
|
+
size: string | null;
|
|
1858
|
+
contentType: string | null;
|
|
1859
|
+
updated: string | null;
|
|
1860
|
+
generation: string | null;
|
|
1861
|
+
/** Always `"base64"`. */
|
|
1862
|
+
encoding: string;
|
|
1863
|
+
/** Full file contents encoded as base64. */
|
|
1864
|
+
contentsBase64: string;
|
|
1865
|
+
/** UTF-8 decoded text when `asText: true` and size ≤ `maxTextBytes`. */
|
|
1866
|
+
text: string | null;
|
|
1867
|
+
textIncluded: boolean;
|
|
1868
|
+
}
|
|
1869
|
+
interface StorageObjectMetadata {
|
|
1870
|
+
name: string;
|
|
1871
|
+
bucket: string;
|
|
1872
|
+
contentType: string | null;
|
|
1873
|
+
size: string | null;
|
|
1874
|
+
updated: string | null;
|
|
1875
|
+
generation: string | null;
|
|
1876
|
+
metadata?: Record<string, string>;
|
|
1877
|
+
[key: string]: unknown;
|
|
1878
|
+
}
|
|
1879
|
+
interface StorageUpdateMetadataParams {
|
|
1880
|
+
objectPath: string;
|
|
1881
|
+
contentType?: string;
|
|
1882
|
+
cacheControl?: string;
|
|
1883
|
+
metadata?: Record<string, string>;
|
|
1884
|
+
}
|
|
1885
|
+
interface StorageCopyMoveParams {
|
|
1886
|
+
sourcePath: string;
|
|
1887
|
+
destinationPath: string;
|
|
1888
|
+
}
|
|
1889
|
+
interface StorageBulkDeleteResult {
|
|
1890
|
+
success: boolean;
|
|
1891
|
+
totalRequested: number;
|
|
1892
|
+
uniquePaths: number;
|
|
1893
|
+
deleted: string[];
|
|
1894
|
+
errors: Array<{
|
|
1895
|
+
path: string;
|
|
1896
|
+
error: string;
|
|
1897
|
+
}>;
|
|
1898
|
+
}
|
|
1899
|
+
interface StorageSignedUploadUrlParams {
|
|
1900
|
+
objectPath: string;
|
|
1901
|
+
/** Expiry in seconds — clamped to [60, 3600] by the server. Default 900. */
|
|
1902
|
+
expiresInSeconds?: number;
|
|
1903
|
+
contentType?: string;
|
|
1904
|
+
}
|
|
1905
|
+
interface StorageSignedUploadUrlResult {
|
|
1906
|
+
url: string;
|
|
1907
|
+
method: string;
|
|
1908
|
+
expiresInSeconds: number;
|
|
1909
|
+
objectPath: string;
|
|
1910
|
+
}
|
|
1911
|
+
interface StorageSignedDownloadUrlParams {
|
|
1912
|
+
objectPath: string;
|
|
1913
|
+
/** Expiry in seconds — clamped to [60, 86400] by the server. Default 900. */
|
|
1914
|
+
expiresInSeconds?: number;
|
|
1915
|
+
}
|
|
1916
|
+
interface StorageSignedDownloadUrlResult {
|
|
1917
|
+
url: string;
|
|
1918
|
+
method: string;
|
|
1919
|
+
expiresInSeconds: number;
|
|
1920
|
+
objectPath: string;
|
|
1921
|
+
}
|
|
1922
|
+
interface StorageBucketCorsEntry {
|
|
1923
|
+
origin?: string[];
|
|
1924
|
+
method?: string[];
|
|
1925
|
+
responseHeader?: string[];
|
|
1926
|
+
maxAgeSeconds?: number;
|
|
1927
|
+
}
|
|
1928
|
+
interface StorageBucketSettings {
|
|
1929
|
+
id: string;
|
|
1930
|
+
logicalName: string;
|
|
1931
|
+
gcpBucketName: string;
|
|
1932
|
+
location: string | null;
|
|
1933
|
+
storageClass: string | null;
|
|
1934
|
+
labels: Record<string, string>;
|
|
1935
|
+
versioningEnabled: boolean;
|
|
1936
|
+
publicAccessPrevention: string | null;
|
|
1937
|
+
uniformBucketLevelAccessEnabled: boolean;
|
|
1938
|
+
cors: StorageBucketCorsEntry[];
|
|
1939
|
+
retentionPolicy: unknown;
|
|
1940
|
+
lifecycleRules: unknown[];
|
|
1941
|
+
updated: string | null;
|
|
1942
|
+
}
|
|
1943
|
+
interface StorageUpdateBucketSettingsParams {
|
|
1944
|
+
labels?: Record<string, string>;
|
|
1945
|
+
storageClass?: string;
|
|
1946
|
+
versioningEnabled?: boolean;
|
|
1947
|
+
publicAccessPrevention?: "inherited" | "enforced";
|
|
1948
|
+
uniformBucketLevelAccessEnabled?: boolean;
|
|
1949
|
+
cors?: StorageBucketCorsEntry[];
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Object/file operations scoped to a single bucket.
|
|
1953
|
+
* Obtained via {@link StorageClient.from}.
|
|
1954
|
+
*
|
|
1955
|
+
* @example
|
|
1956
|
+
* const bucket = ragable.storage.from("bucket-id");
|
|
1957
|
+
*
|
|
1958
|
+
* // Upload a file
|
|
1959
|
+
* await bucket.upload({ objectPath: "data/report.pdf", file: pdfBlob });
|
|
1960
|
+
*
|
|
1961
|
+
* // Download and read as text
|
|
1962
|
+
* const { text } = await bucket.download({ objectPath: "data/notes.txt", asText: true });
|
|
1963
|
+
*
|
|
1964
|
+
* // Generate a short-lived public download link
|
|
1965
|
+
* const { url } = await bucket.getSignedDownloadUrl({ objectPath: "data/report.pdf" });
|
|
1966
|
+
*/
|
|
1967
|
+
interface StorageBucketClient {
|
|
1968
|
+
/** List objects and sub-folders inside this bucket (optionally under a prefix). */
|
|
1969
|
+
list(params?: StorageListContentsParams): Promise<StorageListContentsResult>;
|
|
1970
|
+
/** Create an empty folder placeholder (GCS folder marker). */
|
|
1971
|
+
createFolder(folderPath: string): Promise<{
|
|
1972
|
+
success: true;
|
|
1973
|
+
folderPath: string;
|
|
1974
|
+
}>;
|
|
1975
|
+
/** Delete a folder and all objects under it. */
|
|
1976
|
+
deleteFolder(folderPath: string): Promise<{
|
|
1977
|
+
success: true;
|
|
1978
|
+
folderPath: string;
|
|
1979
|
+
}>;
|
|
1980
|
+
/** Upload a file to the specified `objectPath`. */
|
|
1981
|
+
upload(params: StorageUploadParams): Promise<StorageUploadResult>;
|
|
1982
|
+
/** Delete a single object. */
|
|
1983
|
+
delete(objectPath: string): Promise<{
|
|
1984
|
+
success: true;
|
|
1985
|
+
path: string;
|
|
1986
|
+
}>;
|
|
1987
|
+
/** Delete up to 1 000 objects in one call. */
|
|
1988
|
+
bulkDelete(objectPaths: string[]): Promise<StorageBulkDeleteResult>;
|
|
1989
|
+
/** Retrieve GCS metadata for an object. */
|
|
1990
|
+
getMetadata(objectPath: string): Promise<StorageObjectMetadata>;
|
|
1991
|
+
/** Update `contentType`, `cacheControl`, or custom `metadata` for an object. */
|
|
1992
|
+
updateMetadata(params: StorageUpdateMetadataParams): Promise<StorageObjectMetadata>;
|
|
1993
|
+
/**
|
|
1994
|
+
* Download an object. Contents are always returned as `contentsBase64`.
|
|
1995
|
+
* Pass `asText: true` to also receive a decoded `text` field (≤ maxTextBytes).
|
|
1996
|
+
*/
|
|
1997
|
+
download(params: StorageDownloadParams): Promise<StorageDownloadResult>;
|
|
1998
|
+
/** Copy an object to a new path inside the same bucket. */
|
|
1999
|
+
copy(params: StorageCopyMoveParams): Promise<{
|
|
2000
|
+
success: true;
|
|
2001
|
+
sourcePath: string;
|
|
2002
|
+
destinationPath: string;
|
|
2003
|
+
}>;
|
|
2004
|
+
/** Move (rename) an object inside the same bucket. */
|
|
2005
|
+
move(params: StorageCopyMoveParams): Promise<{
|
|
2006
|
+
success: true;
|
|
2007
|
+
sourcePath: string;
|
|
2008
|
+
destinationPath: string;
|
|
2009
|
+
}>;
|
|
2010
|
+
/**
|
|
2011
|
+
* Generate a signed URL for direct client-side PUT upload (bypasses your server).
|
|
2012
|
+
* Use this when a website needs to upload large files directly to GCS.
|
|
2013
|
+
*/
|
|
2014
|
+
getSignedUploadUrl(params: StorageSignedUploadUrlParams): Promise<StorageSignedUploadUrlResult>;
|
|
2015
|
+
/**
|
|
2016
|
+
* Generate a signed URL for direct client-side download.
|
|
2017
|
+
* Useful for serving private files without proxying through your server.
|
|
2018
|
+
*/
|
|
2019
|
+
getSignedDownloadUrl(params: StorageSignedDownloadUrlParams): Promise<StorageSignedDownloadUrlResult>;
|
|
2020
|
+
/** Retrieve GCS-level settings for this bucket (CORS, versioning, storage class …). */
|
|
2021
|
+
getSettings(): Promise<StorageBucketSettings>;
|
|
2022
|
+
/** Update GCS-level settings for this bucket. */
|
|
2023
|
+
updateSettings(params: StorageUpdateBucketSettingsParams): Promise<StorageBucketSettings>;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Server-side storage client — access via `ragable.storage`.
|
|
2027
|
+
*
|
|
2028
|
+
* Manages GCS-backed storage buckets for your organisation and exposes typed
|
|
2029
|
+
* helpers for every object-storage operation websites need for durable storage.
|
|
2030
|
+
*
|
|
2031
|
+
* ```ts
|
|
2032
|
+
* import { createClient } from "@ragable/sdk";
|
|
2033
|
+
*
|
|
2034
|
+
* const ragable = createClient({ apiKey: process.env.RAGABLE_API_KEY! });
|
|
2035
|
+
*
|
|
2036
|
+
* // ── Bucket management ───────────────────────────────────────────────────
|
|
2037
|
+
* const buckets = await ragable.storage.buckets.list();
|
|
2038
|
+
* const bucket = await ragable.storage.buckets.create("my-website-assets");
|
|
2039
|
+
*
|
|
2040
|
+
* // ── Object operations (via .from()) ─────────────────────────────────────
|
|
2041
|
+
* const b = ragable.storage.from(bucket.id);
|
|
2042
|
+
*
|
|
2043
|
+
* await b.upload({ objectPath: "pages/index.html", file: htmlBlob, contentType: "text/html" });
|
|
2044
|
+
* const { text } = await b.download({ objectPath: "pages/index.html", asText: true });
|
|
2045
|
+
*
|
|
2046
|
+
* // ── Signed URLs for client-side direct upload/download ──────────────────
|
|
2047
|
+
* const { url } = await b.getSignedUploadUrl({ objectPath: "uploads/photo.jpg", contentType: "image/jpeg" });
|
|
2048
|
+
* ```
|
|
2049
|
+
*/
|
|
2050
|
+
declare class StorageClient {
|
|
2051
|
+
private readonly client;
|
|
2052
|
+
/**
|
|
2053
|
+
* Bucket-level CRUD — list, create and delete buckets for this organisation.
|
|
2054
|
+
*/
|
|
2055
|
+
readonly buckets: {
|
|
2056
|
+
/**
|
|
2057
|
+
* List all managed storage buckets.
|
|
2058
|
+
*
|
|
2059
|
+
* @param params Optional filter / sort params (`q`, `status`, `sort`).
|
|
2060
|
+
*/
|
|
2061
|
+
list(params?: StorageListBucketsParams): Promise<StorageBucket[]>;
|
|
2062
|
+
/**
|
|
2063
|
+
* Create a new managed GCS bucket.
|
|
2064
|
+
*
|
|
2065
|
+
* The `name` must be lowercase alphanumeric + dashes, max 63 chars.
|
|
2066
|
+
*/
|
|
2067
|
+
create(name: string): Promise<StorageBucket>;
|
|
2068
|
+
/**
|
|
2069
|
+
* Permanently delete a bucket and **all** its contents.
|
|
2070
|
+
*
|
|
2071
|
+
* @param bucketId The Ragable bucket ID (not the raw GCS bucket name).
|
|
2072
|
+
*/
|
|
2073
|
+
delete(bucketId: string): Promise<{
|
|
2074
|
+
success: true;
|
|
2075
|
+
}>;
|
|
2076
|
+
};
|
|
2077
|
+
constructor(client: RagableRequestClient);
|
|
2078
|
+
/**
|
|
2079
|
+
* Returns a {@link StorageBucketClient} scoped to the given bucket ID.
|
|
2080
|
+
*
|
|
2081
|
+
* All object operations (upload, download, list, copy, move, signed URLs, …)
|
|
2082
|
+
* are performed through the returned client.
|
|
2083
|
+
*
|
|
2084
|
+
* @param bucketId The Ragable bucket ID obtained from `buckets.list()` or `buckets.create()`.
|
|
2085
|
+
*/
|
|
2086
|
+
from(bucketId: string): StorageBucketClient;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
1687
2089
|
declare class Ragable {
|
|
1688
2090
|
readonly shift: ShiftClient;
|
|
1689
2091
|
readonly agents: AgentsClient;
|
|
2092
|
+
readonly storage: StorageClient;
|
|
1690
2093
|
readonly infrastructure: {
|
|
1691
2094
|
shift: ShiftClient;
|
|
1692
2095
|
};
|
|
@@ -1696,4 +2099,4 @@ declare function createClient(options: RagableClientOptions): Ragable;
|
|
|
1696
2099
|
declare function createClient<Database extends RagableDatabase = DefaultRagableDatabase, AuthUser extends object = DefaultAuthUser>(options: RagableBrowserClientOptions): RagableBrowser<Database, AuthUser>;
|
|
1697
2100
|
declare function createRagableServerClient(options: RagableClientOptions): Ragable;
|
|
1698
2101
|
|
|
1699
|
-
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentChatStreamDonePayload, type AgentChatStreamHandlers, type AgentChatStreamResult, type AgentChatStreamUiHandlers, type AgentChatUiAssistantMessage, type AgentChatUiSegment, type AgentChatUiStreamResult, type AgentConversation, type AgentConversationMessage, type AgentConversationSubscription, type AgentPublicChatParams, type AgentStreamAgentInfoEvent, type AgentStreamEvent, type AgentSummary, AgentsClient, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type AuthSignUpCredentials, type AuthUpdateUserAttributes, type AuthUserMetadata, type BrowserAuthSession, type BrowserAuthTokens, BrowserCollectionApi, type BrowserCollectionDefinition, type BrowserCollectionFactory, type BrowserCollectionFindParams, type BrowserCollectionRecord, type BrowserCollections, type BrowserDataAuthMode, type BrowserRealtimeNotification, type BrowserRealtimeStatus, type BrowserRealtimeSubscribeParams, type BrowserRealtimeSubscription, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type CollectionReturnMode, type CollectionRowData, type CollectionRowWithMeta, type CollectionWhere, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultAuthUser, type DefaultRagableDatabase, type FormatContextOptions, type HttpMethod, type Json, LocalStorageAdapter, MemoryStorageAdapter, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, PostgrestInsertSdkErrorReturning, PostgrestInsertSdkErrorRoot, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, type RagableClientOptions, type RagableDatabase, RagableError, RagableNetworkError, RagableRequestClient, type RagableResult, RagableSdkError, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetrieveParams, type RetryOptions, type RunAgentChatStreamOptions, type RunQuery, type SessionStorage, SessionStorageAdapter, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, type SseJsonEvent, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, Transport, type TransportOptions, type TransportRequest, type WhereInput, type WhereOperatorObject, asPostgrestResponse, assertPostgrestSuccess, bindFetch, collectAssistantTextFromUiSegments, collectionRecordToRowWithMeta, collectionRecordsToRowWithMeta, createBrowserClient, createClient, createRagPipeline, createRagableBrowserClient, createRagableServerClient, detectStorage, effectiveDataAuth, extractErrorMessage, finalizeAgentChatUiTurn, foldAgentStreamIntoUiSegments, formatPostgrestError, formatRetrievalContext, formatSdkError, generateIdempotencyKey, isIncompleteAgentStreamError, normalizeBrowserApiBase, parseAgentStreamAgentInfo, parseAgentStreamDone, parseSseDataLine, parseTransportResponse, readSseStream,
|
|
2102
|
+
export { type AgentChatMessage, type AgentChatParams, type AgentChatResult, type AgentChatStreamDonePayload, type AgentChatStreamHandlers, type AgentChatStreamResult, type AgentChatStreamUiHandlers, type AgentChatUiAssistantMessage, type AgentChatUiSegment, type AgentChatUiStreamResult, type AgentConversation, type AgentConversationMessage, type AgentConversationSubscription, type AgentPublicChatParams, type AgentStreamAgentInfoEvent, type AgentStreamEvent, type AgentSummary, AgentsClient, AuthBroadcastChannel, type AuthBroadcastMessage, type AuthChangeEvent, type AuthOptions, type AuthSession, type AuthSignUpCredentials, type AuthUpdateUserAttributes, type AuthUserMetadata, type BrowserAuthSession, type BrowserAuthTokens, BrowserCollectionApi, type BrowserCollectionDefinition, type BrowserCollectionFactory, type BrowserCollectionFindParams, type BrowserCollectionRecord, type BrowserCollections, type BrowserDataAuthMode, type BrowserRealtimeNotification, type BrowserRealtimeStatus, type BrowserRealtimeSubscribeParams, type BrowserRealtimeSubscription, type BrowserSqlExecParams, type BrowserSqlExecResult, type BrowserSqlQueryParams, type BrowserSqlQueryResult, type CollectionReturnMode, type CollectionRowData, type CollectionRowWithMeta, type CollectionWhere, type ColumnName, type ColumnValue, CookieStorageAdapter, DEFAULT_RAGABLE_API_BASE, type DefaultAuthUser, type DefaultRagableDatabase, type FormatContextOptions, type HttpMethod, type Json, LocalStorageAdapter, MemoryStorageAdapter, type PostgRESTFetch, type PostgRESTFetchParams, PostgrestDeleteReturningBuilder, PostgrestDeleteRootBuilder, PostgrestInsertReturningBuilder, PostgrestInsertRootBuilder, PostgrestInsertSdkErrorReturning, PostgrestInsertSdkErrorRoot, type PostgrestResult, PostgrestSelectBuilder, PostgrestTableApi, PostgrestUpdateReturningBuilder, PostgrestUpdateRootBuilder, type PostgrestUpsertOptions, PostgrestUpsertReturningBuilder, PostgrestUpsertRootBuilder, type RagClientForPipeline, type RagPipeline, type RagPipelineOptions, Ragable, RagableAbortError, RagableAuth, type RagableAuthConfig, RagableBrowser, RagableBrowserAgentsClient, RagableBrowserAuthClient, type RagableBrowserClientOptions, RagableBrowserDatabaseClient, type RagableClientOptions, type RagableDatabase, RagableError, RagableNetworkError, RagableRequestClient, type RagableResult, RagableSdkError, type RagableTableDefinition, type RagableTableNames, RagableTimeoutError, type RequestOptions, type RetrieveParams, type RetryOptions, type RunAgentChatStreamOptions, type RunQuery, type SessionStorage, SessionStorageAdapter, type ShiftAddDocumentParams, ShiftClient, type ShiftCreateIndexParams, type ShiftEntry, type ShiftIndex, type ShiftIngestResponse, type ShiftListEntriesParams, type ShiftListEntriesResponse, type ShiftSearchParams, type ShiftSearchResult, type ShiftUpdateIndexParams, type ShiftUploadFileParams, type ShiftUploadableFile, type SseJsonEvent, type StorageBucket, type StorageBucketClient, type StorageBucketCorsEntry, type StorageBucketItem, type StorageBucketSettings, type StorageBulkDeleteResult, StorageClient, type StorageCopyMoveParams, type StorageDownloadParams, type StorageDownloadResult, type StorageListBucketsParams, type StorageListContentsParams, type StorageListContentsResult, type StorageObjectMetadata, type StorageSignedDownloadUrlParams, type StorageSignedDownloadUrlResult, type StorageSignedUploadUrlParams, type StorageSignedUploadUrlResult, type StorageUpdateBucketSettingsParams, type StorageUpdateMetadataParams, type StorageUploadParams, type StorageUploadResult, type StorageUploadableFile, type SupabaseCompatSession, type TableInsertRow, type TableRow, type TableUpdatePatch, type Tables, type TablesInsert, type TablesUpdate, Transport, type TransportOptions, type TransportRequest, type WhereInput, type WhereOperatorObject, asPostgrestResponse, assertPostgrestSuccess, bindFetch, collectAssistantTextFromUiSegments, collectionRecordToRowWithMeta, collectionRecordsToRowWithMeta, createBrowserClient, createClient, createRagPipeline, createRagableBrowserClient, createRagableServerClient, detectStorage, effectiveDataAuth, extractErrorMessage, finalizeAgentChatUiTurn, foldAgentStreamIntoUiSegments, formatPostgrestError, formatRetrievalContext, formatSdkError, generateIdempotencyKey, isIncompleteAgentStreamError, normalizeBrowserApiBase, parseAgentStreamAgentInfo, parseAgentStreamDone, parseSseDataLine, parseTransportResponse, readSseStream, runAgentChatStream, runAgentChatStreamForUi, runAgentChatStreamLenient, toRagableResult, unwrapPostgrest };
|