@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.js
CHANGED
|
@@ -54,6 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
RagableTimeoutError: () => RagableTimeoutError,
|
|
55
55
|
SessionStorageAdapter: () => SessionStorageAdapter,
|
|
56
56
|
ShiftClient: () => ShiftClient,
|
|
57
|
+
StorageClient: () => StorageClient,
|
|
57
58
|
Transport: () => Transport,
|
|
58
59
|
asPostgrestResponse: () => asPostgrestResponse,
|
|
59
60
|
assertPostgrestSuccess: () => assertPostgrestSuccess,
|
|
@@ -82,7 +83,6 @@ __export(index_exports, {
|
|
|
82
83
|
parseSseDataLine: () => parseSseDataLine,
|
|
83
84
|
parseTransportResponse: () => parseTransportResponse,
|
|
84
85
|
readSseStream: () => readSseStream,
|
|
85
|
-
resolveRagableApiBase: () => resolveRagableApiBase,
|
|
86
86
|
runAgentChatStream: () => runAgentChatStream,
|
|
87
87
|
runAgentChatStreamForUi: () => runAgentChatStreamForUi,
|
|
88
88
|
runAgentChatStreamLenient: () => runAgentChatStreamLenient,
|
|
@@ -99,10 +99,6 @@ function bindFetch(custom) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
var DEFAULT_RAGABLE_API_BASE = "https://ragable-341305259977.asia-southeast1.run.app/api";
|
|
102
|
-
function resolveRagableApiBase(explicitBaseUrl) {
|
|
103
|
-
const raw = typeof explicitBaseUrl === "string" && explicitBaseUrl.trim().length > 0 ? explicitBaseUrl.trim() : DEFAULT_RAGABLE_API_BASE.trim();
|
|
104
|
-
return raw.replace(/\/+$/, "");
|
|
105
|
-
}
|
|
106
102
|
var RagableSdkError = class extends Error {
|
|
107
103
|
constructor(message) {
|
|
108
104
|
super(message);
|
|
@@ -231,7 +227,7 @@ var RagableRequestClient = class {
|
|
|
231
227
|
__publicField(this, "fetchImpl");
|
|
232
228
|
__publicField(this, "defaultHeaders");
|
|
233
229
|
this.apiKey = options.apiKey;
|
|
234
|
-
this.baseUrl =
|
|
230
|
+
this.baseUrl = DEFAULT_RAGABLE_API_BASE.replace(/\/+$/, "");
|
|
235
231
|
this.fetchImpl = bindFetch(options.fetch);
|
|
236
232
|
this.defaultHeaders = options.headers;
|
|
237
233
|
}
|
|
@@ -2255,7 +2251,7 @@ var RagableAuth = class {
|
|
|
2255
2251
|
__publicField(this, "broadcast", null);
|
|
2256
2252
|
__publicField(this, "visibilityHandler", null);
|
|
2257
2253
|
__publicField(this, "initialized", false);
|
|
2258
|
-
this.baseUrl =
|
|
2254
|
+
this.baseUrl = DEFAULT_RAGABLE_API_BASE.replace(/\/+$/, "");
|
|
2259
2255
|
this.authGroupId = config.authGroupId;
|
|
2260
2256
|
this.fetchImpl = bindFetch(config.fetch);
|
|
2261
2257
|
this.defaultHeaders = config.headers;
|
|
@@ -2624,8 +2620,8 @@ function decodeJwtExpiry(jwt) {
|
|
|
2624
2620
|
}
|
|
2625
2621
|
|
|
2626
2622
|
// src/browser.ts
|
|
2627
|
-
function normalizeBrowserApiBase(
|
|
2628
|
-
return
|
|
2623
|
+
function normalizeBrowserApiBase() {
|
|
2624
|
+
return DEFAULT_RAGABLE_API_BASE.replace(/\/+$/, "");
|
|
2629
2625
|
}
|
|
2630
2626
|
function effectiveDataAuth(options) {
|
|
2631
2627
|
if (options.dataAuth) return options.dataAuth;
|
|
@@ -2916,7 +2912,6 @@ var RagableBrowserDatabaseClient = class {
|
|
|
2916
2912
|
this.options = options;
|
|
2917
2913
|
this.ragableAuth = ragableAuth;
|
|
2918
2914
|
__publicField(this, "fetchImpl");
|
|
2919
|
-
__publicField(this, "apiBase");
|
|
2920
2915
|
__publicField(this, "_transport", null);
|
|
2921
2916
|
__publicField(this, "collections");
|
|
2922
2917
|
__publicField(this, "collection");
|
|
@@ -2940,7 +2935,7 @@ var RagableBrowserDatabaseClient = class {
|
|
|
2940
2935
|
}
|
|
2941
2936
|
const gid = requireAuthGroupId(opts);
|
|
2942
2937
|
const token = await resolveDatabaseAuthBearer(opts, ragableAuth);
|
|
2943
|
-
const apiBase =
|
|
2938
|
+
const apiBase = normalizeBrowserApiBase();
|
|
2944
2939
|
const qs = params.searchParams.toString();
|
|
2945
2940
|
const url = `${apiBase}/auth-groups/${gid}/data/rest/${params.table}${qs ? `?${qs}` : ""}`;
|
|
2946
2941
|
const headers = new Headers(opts.headers);
|
|
@@ -3055,7 +3050,6 @@ var RagableBrowserDatabaseClient = class {
|
|
|
3055
3050
|
)
|
|
3056
3051
|
});
|
|
3057
3052
|
this.fetchImpl = bindFetch(options.fetch);
|
|
3058
|
-
this.apiBase = resolveRagableApiBase(options.baseUrl);
|
|
3059
3053
|
this.collections = new Proxy(
|
|
3060
3054
|
{},
|
|
3061
3055
|
{
|
|
@@ -3077,7 +3071,7 @@ var RagableBrowserDatabaseClient = class {
|
|
|
3077
3071
|
this._transport = transport;
|
|
3078
3072
|
}
|
|
3079
3073
|
toUrl(path) {
|
|
3080
|
-
return `${
|
|
3074
|
+
return `${normalizeBrowserApiBase()}${path.startsWith("/") ? path : `/${path}`}`;
|
|
3081
3075
|
}
|
|
3082
3076
|
async _requestCollection(method, path, body, databaseInstanceId) {
|
|
3083
3077
|
const gid = requireAuthGroupId(this.options);
|
|
@@ -3168,7 +3162,7 @@ async function subscribeBrowserRealtime(options, ragableAuth, fetchImpl, params)
|
|
|
3168
3162
|
headers.set("Authorization", `Bearer ${token}`);
|
|
3169
3163
|
headers.set("Content-Type", "application/json");
|
|
3170
3164
|
const response = await fetchImpl(
|
|
3171
|
-
`${
|
|
3165
|
+
`${normalizeBrowserApiBase()}/auth-groups/${gid}/data/realtime/stream`,
|
|
3172
3166
|
{
|
|
3173
3167
|
method: "POST",
|
|
3174
3168
|
headers,
|
|
@@ -3297,16 +3291,121 @@ async function subscribeBrowserRealtime(options, ragableAuth, fetchImpl, params)
|
|
|
3297
3291
|
})();
|
|
3298
3292
|
return subscription;
|
|
3299
3293
|
}
|
|
3294
|
+
var BrowserStorageBucketClient = class {
|
|
3295
|
+
constructor(options, fetchImpl, bucketId) {
|
|
3296
|
+
this.options = options;
|
|
3297
|
+
this.fetchImpl = fetchImpl;
|
|
3298
|
+
this.bucketId = bucketId;
|
|
3299
|
+
}
|
|
3300
|
+
get authGroupId() {
|
|
3301
|
+
const id = this.options.authGroupId?.trim();
|
|
3302
|
+
if (!id) throw new RagableError("authGroupId is required for storage", 400, { code: "SDK_MISSING_AUTH_GROUP_ID" });
|
|
3303
|
+
return id;
|
|
3304
|
+
}
|
|
3305
|
+
base() {
|
|
3306
|
+
return `${normalizeBrowserApiBase()}/auth-groups/${this.authGroupId}/storage/buckets/${encodeURIComponent(this.bucketId)}`;
|
|
3307
|
+
}
|
|
3308
|
+
async bearerToken() {
|
|
3309
|
+
const staticKey = this.options.dataStaticKey?.trim() || (this.options.getDataStaticKey ? await this.options.getDataStaticKey() : null)?.trim() || null;
|
|
3310
|
+
if (staticKey) return staticKey;
|
|
3311
|
+
if (this.options.getAccessToken) {
|
|
3312
|
+
const tok = await this.options.getAccessToken();
|
|
3313
|
+
if (tok?.trim()) return tok.trim();
|
|
3314
|
+
}
|
|
3315
|
+
throw new RagableError("No auth token for storage. Provide dataStaticKey or getAccessToken.", 401, { code: "SDK_NO_ACCESS_TOKEN" });
|
|
3316
|
+
}
|
|
3317
|
+
async req(method, path, body) {
|
|
3318
|
+
const token = await this.bearerToken();
|
|
3319
|
+
const headers = new Headers(this.options.headers);
|
|
3320
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
3321
|
+
if (body !== void 0 && !(body instanceof FormData)) headers.set("Content-Type", "application/json");
|
|
3322
|
+
const res = await this.fetchImpl(`${this.base()}${path}`, {
|
|
3323
|
+
method,
|
|
3324
|
+
headers,
|
|
3325
|
+
body: body instanceof FormData ? body : body !== void 0 ? JSON.stringify(body) : void 0
|
|
3326
|
+
});
|
|
3327
|
+
const payload = await res.json().catch(() => ({}));
|
|
3328
|
+
if (!res.ok) throw new RagableError(payload?.error ?? res.statusText, res.status, payload);
|
|
3329
|
+
return payload;
|
|
3330
|
+
}
|
|
3331
|
+
list(params = {}) {
|
|
3332
|
+
const qs = new URLSearchParams();
|
|
3333
|
+
if (params.prefix) qs.set("prefix", params.prefix);
|
|
3334
|
+
if (params.delimiter) qs.set("delimiter", params.delimiter);
|
|
3335
|
+
if (params.maxResults != null) qs.set("maxResults", String(params.maxResults));
|
|
3336
|
+
if (params.pageToken) qs.set("pageToken", params.pageToken);
|
|
3337
|
+
const q = qs.toString();
|
|
3338
|
+
return this.req("GET", `/contents${q ? `?${q}` : ""}`);
|
|
3339
|
+
}
|
|
3340
|
+
async upload(params) {
|
|
3341
|
+
const token = await this.bearerToken();
|
|
3342
|
+
const headers = new Headers(this.options.headers);
|
|
3343
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
3344
|
+
const form = new FormData();
|
|
3345
|
+
const raw = params.file instanceof Blob ? params.file : new Blob([new Uint8Array(params.file instanceof ArrayBuffer ? params.file : params.file.buffer)], params.contentType ? { type: params.contentType } : {});
|
|
3346
|
+
const blob = raw;
|
|
3347
|
+
form.set("file", blob, params.fileName ?? "upload");
|
|
3348
|
+
form.set("objectPath", params.objectPath);
|
|
3349
|
+
if (params.cacheControl) form.set("cacheControl", params.cacheControl);
|
|
3350
|
+
const res = await this.fetchImpl(`${this.base()}/upload`, { method: "POST", headers, body: form });
|
|
3351
|
+
const payload = await res.json().catch(() => ({}));
|
|
3352
|
+
if (!res.ok) throw new RagableError(payload?.error ?? res.statusText, res.status, payload);
|
|
3353
|
+
return payload;
|
|
3354
|
+
}
|
|
3355
|
+
download(params) {
|
|
3356
|
+
const qs = new URLSearchParams({ objectPath: params.objectPath });
|
|
3357
|
+
if (params.asText != null) qs.set("asText", String(params.asText));
|
|
3358
|
+
if (params.maxTextBytes != null) qs.set("maxTextBytes", String(params.maxTextBytes));
|
|
3359
|
+
return this.req("GET", `/objects/download?${qs}`);
|
|
3360
|
+
}
|
|
3361
|
+
delete(objectPath) {
|
|
3362
|
+
return this.req("DELETE", "/objects", { objectPath });
|
|
3363
|
+
}
|
|
3364
|
+
bulkDelete(objectPaths) {
|
|
3365
|
+
return this.req("POST", "/objects/delete-bulk", { objectPaths });
|
|
3366
|
+
}
|
|
3367
|
+
getSignedUploadUrl(params) {
|
|
3368
|
+
return this.req("POST", "/signed-upload-url", params);
|
|
3369
|
+
}
|
|
3370
|
+
getSignedDownloadUrl(params) {
|
|
3371
|
+
const qs = new URLSearchParams({ objectPath: params.objectPath });
|
|
3372
|
+
if (params.expiresInSeconds != null) qs.set("expiresInSeconds", String(params.expiresInSeconds));
|
|
3373
|
+
return this.req("GET", `/signed-download-url?${qs}`);
|
|
3374
|
+
}
|
|
3375
|
+
copy(params) {
|
|
3376
|
+
return this.req("POST", "/objects/copy", params);
|
|
3377
|
+
}
|
|
3378
|
+
move(params) {
|
|
3379
|
+
return this.req("POST", "/objects/move", params);
|
|
3380
|
+
}
|
|
3381
|
+
createFolder(folderPath) {
|
|
3382
|
+
return this.req("POST", "/folders", { folderPath });
|
|
3383
|
+
}
|
|
3384
|
+
deleteFolder(folderPath) {
|
|
3385
|
+
return this.req("DELETE", "/folders", { folderPath });
|
|
3386
|
+
}
|
|
3387
|
+
getMetadata(objectPath) {
|
|
3388
|
+
const qs = new URLSearchParams({ objectPath });
|
|
3389
|
+
return this.req("GET", `/objects/metadata?${qs}`);
|
|
3390
|
+
}
|
|
3391
|
+
};
|
|
3392
|
+
var RagableBrowserStorageClient = class {
|
|
3393
|
+
constructor(options, fetchImpl) {
|
|
3394
|
+
this.options = options;
|
|
3395
|
+
this.fetchImpl = fetchImpl;
|
|
3396
|
+
}
|
|
3397
|
+
from(bucketId) {
|
|
3398
|
+
return new BrowserStorageBucketClient(this.options, this.fetchImpl, bucketId);
|
|
3399
|
+
}
|
|
3400
|
+
};
|
|
3300
3401
|
var RagableBrowserAgentsClient = class {
|
|
3301
3402
|
constructor(options) {
|
|
3302
3403
|
this.options = options;
|
|
3303
3404
|
__publicField(this, "fetchImpl");
|
|
3304
|
-
__publicField(this, "apiBase");
|
|
3305
3405
|
this.fetchImpl = bindFetch(options.fetch);
|
|
3306
|
-
this.apiBase = resolveRagableApiBase(options.baseUrl);
|
|
3307
3406
|
}
|
|
3308
3407
|
toUrl(path) {
|
|
3309
|
-
return `${
|
|
3408
|
+
return `${normalizeBrowserApiBase()}${path.startsWith("/") ? path : `/${path}`}`;
|
|
3310
3409
|
}
|
|
3311
3410
|
requireWebsiteId() {
|
|
3312
3411
|
const websiteId = this.options.websiteId?.trim();
|
|
@@ -3492,6 +3591,7 @@ var RagableBrowser = class {
|
|
|
3492
3591
|
__publicField(this, "auth");
|
|
3493
3592
|
__publicField(this, "database");
|
|
3494
3593
|
__publicField(this, "db");
|
|
3594
|
+
__publicField(this, "storage");
|
|
3495
3595
|
__publicField(this, "transport");
|
|
3496
3596
|
__publicField(this, "_ragableAuth");
|
|
3497
3597
|
/** Delegates to `database.from()`. Kept for back-compat — prefer `database.from()`. */
|
|
@@ -3506,7 +3606,6 @@ var RagableBrowser = class {
|
|
|
3506
3606
|
if (options.authGroupId) {
|
|
3507
3607
|
this._ragableAuth = new RagableAuth({
|
|
3508
3608
|
authGroupId: options.authGroupId,
|
|
3509
|
-
baseUrl: options.baseUrl,
|
|
3510
3609
|
fetch: options.fetch,
|
|
3511
3610
|
headers: options.headers,
|
|
3512
3611
|
auth: options.auth
|
|
@@ -3530,6 +3629,7 @@ var RagableBrowser = class {
|
|
|
3530
3629
|
);
|
|
3531
3630
|
this.database._setTransport(this.transport);
|
|
3532
3631
|
this.db = this.database;
|
|
3632
|
+
this.storage = new RagableBrowserStorageClient(options, bindFetch(options.fetch));
|
|
3533
3633
|
}
|
|
3534
3634
|
destroy() {
|
|
3535
3635
|
this._ragableAuth?.destroy();
|
|
@@ -3582,15 +3682,171 @@ function createRagPipeline(client, options) {
|
|
|
3582
3682
|
};
|
|
3583
3683
|
}
|
|
3584
3684
|
|
|
3685
|
+
// src/storage.ts
|
|
3686
|
+
function normalizeUploadFile2(file, contentType) {
|
|
3687
|
+
if (file instanceof Blob) return file;
|
|
3688
|
+
const u8 = file instanceof ArrayBuffer ? new Uint8Array(file) : new Uint8Array(file);
|
|
3689
|
+
return new Blob([u8.buffer], contentType ? { type: contentType } : {});
|
|
3690
|
+
}
|
|
3691
|
+
var StorageClient = class {
|
|
3692
|
+
constructor(client) {
|
|
3693
|
+
this.client = client;
|
|
3694
|
+
/**
|
|
3695
|
+
* Bucket-level CRUD — list, create and delete buckets for this organisation.
|
|
3696
|
+
*/
|
|
3697
|
+
__publicField(this, "buckets");
|
|
3698
|
+
this.buckets = {
|
|
3699
|
+
list: async (params) => {
|
|
3700
|
+
const qs = new URLSearchParams();
|
|
3701
|
+
if (params?.q) qs.set("q", params.q);
|
|
3702
|
+
if (params?.status) qs.set("status", params.status);
|
|
3703
|
+
if (params?.sort) qs.set("sort", params.sort);
|
|
3704
|
+
const query = qs.toString();
|
|
3705
|
+
return this.client.request(
|
|
3706
|
+
`/v1/storage/buckets${query ? `?${query}` : ""}`
|
|
3707
|
+
);
|
|
3708
|
+
},
|
|
3709
|
+
create: async (name) => {
|
|
3710
|
+
return this.client.request("/v1/storage/buckets", {
|
|
3711
|
+
method: "POST",
|
|
3712
|
+
body: { name }
|
|
3713
|
+
});
|
|
3714
|
+
},
|
|
3715
|
+
delete: async (bucketId) => {
|
|
3716
|
+
return this.client.request(
|
|
3717
|
+
`/v1/storage/buckets/${encodeURIComponent(bucketId)}`,
|
|
3718
|
+
{ method: "DELETE" }
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
};
|
|
3722
|
+
}
|
|
3723
|
+
/**
|
|
3724
|
+
* Returns a {@link StorageBucketClient} scoped to the given bucket ID.
|
|
3725
|
+
*
|
|
3726
|
+
* All object operations (upload, download, list, copy, move, signed URLs, …)
|
|
3727
|
+
* are performed through the returned client.
|
|
3728
|
+
*
|
|
3729
|
+
* @param bucketId The Ragable bucket ID obtained from `buckets.list()` or `buckets.create()`.
|
|
3730
|
+
*/
|
|
3731
|
+
from(bucketId) {
|
|
3732
|
+
const { client } = this;
|
|
3733
|
+
const base = `/v1/storage/buckets/${encodeURIComponent(bucketId)}`;
|
|
3734
|
+
return {
|
|
3735
|
+
list: async (params) => {
|
|
3736
|
+
const qs = new URLSearchParams();
|
|
3737
|
+
if (params?.prefix) qs.set("prefix", params.prefix);
|
|
3738
|
+
if (params?.delimiter) qs.set("delimiter", params.delimiter);
|
|
3739
|
+
if (params?.maxResults != null)
|
|
3740
|
+
qs.set("maxResults", String(params.maxResults));
|
|
3741
|
+
if (params?.pageToken) qs.set("pageToken", params.pageToken);
|
|
3742
|
+
const query = qs.toString();
|
|
3743
|
+
return client.request(
|
|
3744
|
+
`${base}/contents${query ? `?${query}` : ""}`
|
|
3745
|
+
);
|
|
3746
|
+
},
|
|
3747
|
+
createFolder: async (folderPath) => {
|
|
3748
|
+
return client.request(
|
|
3749
|
+
`${base}/folders`,
|
|
3750
|
+
{ method: "POST", body: { folderPath } }
|
|
3751
|
+
);
|
|
3752
|
+
},
|
|
3753
|
+
deleteFolder: async (folderPath) => {
|
|
3754
|
+
return client.request(
|
|
3755
|
+
`${base}/folders`,
|
|
3756
|
+
{ method: "DELETE", body: { folderPath } }
|
|
3757
|
+
);
|
|
3758
|
+
},
|
|
3759
|
+
upload: async (params) => {
|
|
3760
|
+
const formData = new FormData();
|
|
3761
|
+
const blob = normalizeUploadFile2(params.file, params.contentType);
|
|
3762
|
+
const fileName = params.fileName ?? "upload";
|
|
3763
|
+
formData.set("file", blob, fileName);
|
|
3764
|
+
formData.set("objectPath", params.objectPath);
|
|
3765
|
+
if (params.cacheControl) {
|
|
3766
|
+
formData.set("cacheControl", params.cacheControl);
|
|
3767
|
+
}
|
|
3768
|
+
return client.request(`${base}/upload`, {
|
|
3769
|
+
method: "POST",
|
|
3770
|
+
body: formData
|
|
3771
|
+
});
|
|
3772
|
+
},
|
|
3773
|
+
delete: async (objectPath) => {
|
|
3774
|
+
return client.request(
|
|
3775
|
+
`${base}/objects`,
|
|
3776
|
+
{ method: "DELETE", body: { objectPath } }
|
|
3777
|
+
);
|
|
3778
|
+
},
|
|
3779
|
+
bulkDelete: async (objectPaths) => {
|
|
3780
|
+
return client.request(
|
|
3781
|
+
`${base}/objects/delete-bulk`,
|
|
3782
|
+
{ method: "POST", body: { objectPaths } }
|
|
3783
|
+
);
|
|
3784
|
+
},
|
|
3785
|
+
getMetadata: async (objectPath) => {
|
|
3786
|
+
const qs = new URLSearchParams({ objectPath });
|
|
3787
|
+
return client.request(
|
|
3788
|
+
`${base}/objects/metadata?${qs}`
|
|
3789
|
+
);
|
|
3790
|
+
},
|
|
3791
|
+
updateMetadata: async (params) => {
|
|
3792
|
+
return client.request(
|
|
3793
|
+
`${base}/objects/metadata`,
|
|
3794
|
+
{ method: "PATCH", body: params }
|
|
3795
|
+
);
|
|
3796
|
+
},
|
|
3797
|
+
download: async (params) => {
|
|
3798
|
+
const qs = new URLSearchParams({ objectPath: params.objectPath });
|
|
3799
|
+
if (params.asText != null) qs.set("asText", String(params.asText));
|
|
3800
|
+
if (params.maxTextBytes != null)
|
|
3801
|
+
qs.set("maxTextBytes", String(params.maxTextBytes));
|
|
3802
|
+
return client.request(
|
|
3803
|
+
`${base}/objects/download?${qs}`
|
|
3804
|
+
);
|
|
3805
|
+
},
|
|
3806
|
+
copy: async (params) => {
|
|
3807
|
+
return client.request(`${base}/objects/copy`, { method: "POST", body: params });
|
|
3808
|
+
},
|
|
3809
|
+
move: async (params) => {
|
|
3810
|
+
return client.request(`${base}/objects/move`, { method: "POST", body: params });
|
|
3811
|
+
},
|
|
3812
|
+
getSignedUploadUrl: async (params) => {
|
|
3813
|
+
return client.request(
|
|
3814
|
+
`${base}/signed-upload-url`,
|
|
3815
|
+
{ method: "POST", body: params }
|
|
3816
|
+
);
|
|
3817
|
+
},
|
|
3818
|
+
getSignedDownloadUrl: async (params) => {
|
|
3819
|
+
const qs = new URLSearchParams({ objectPath: params.objectPath });
|
|
3820
|
+
if (params.expiresInSeconds != null)
|
|
3821
|
+
qs.set("expiresInSeconds", String(params.expiresInSeconds));
|
|
3822
|
+
return client.request(
|
|
3823
|
+
`${base}/signed-download-url?${qs}`
|
|
3824
|
+
);
|
|
3825
|
+
},
|
|
3826
|
+
getSettings: async () => {
|
|
3827
|
+
return client.request(`${base}/settings`);
|
|
3828
|
+
},
|
|
3829
|
+
updateSettings: async (params) => {
|
|
3830
|
+
return client.request(`${base}/settings`, {
|
|
3831
|
+
method: "PATCH",
|
|
3832
|
+
body: params
|
|
3833
|
+
});
|
|
3834
|
+
}
|
|
3835
|
+
};
|
|
3836
|
+
}
|
|
3837
|
+
};
|
|
3838
|
+
|
|
3585
3839
|
// src/index.ts
|
|
3586
3840
|
var Ragable = class {
|
|
3587
3841
|
constructor(options) {
|
|
3588
3842
|
__publicField(this, "shift");
|
|
3589
3843
|
__publicField(this, "agents");
|
|
3844
|
+
__publicField(this, "storage");
|
|
3590
3845
|
__publicField(this, "infrastructure");
|
|
3591
3846
|
const client = new RagableRequestClient(options);
|
|
3592
3847
|
this.shift = new ShiftClient(client);
|
|
3593
3848
|
this.agents = new AgentsClient(client);
|
|
3849
|
+
this.storage = new StorageClient(client);
|
|
3594
3850
|
this.infrastructure = {
|
|
3595
3851
|
shift: this.shift
|
|
3596
3852
|
};
|
|
@@ -3654,6 +3910,7 @@ function createRagableServerClient(options) {
|
|
|
3654
3910
|
RagableTimeoutError,
|
|
3655
3911
|
SessionStorageAdapter,
|
|
3656
3912
|
ShiftClient,
|
|
3913
|
+
StorageClient,
|
|
3657
3914
|
Transport,
|
|
3658
3915
|
asPostgrestResponse,
|
|
3659
3916
|
assertPostgrestSuccess,
|
|
@@ -3682,7 +3939,6 @@ function createRagableServerClient(options) {
|
|
|
3682
3939
|
parseSseDataLine,
|
|
3683
3940
|
parseTransportResponse,
|
|
3684
3941
|
readSseStream,
|
|
3685
|
-
resolveRagableApiBase,
|
|
3686
3942
|
runAgentChatStream,
|
|
3687
3943
|
runAgentChatStreamForUi,
|
|
3688
3944
|
runAgentChatStreamLenient,
|