@arbidocs/sdk 0.3.49 → 0.3.51
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/browser.cjs +16 -5
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +16 -5
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -3908,16 +3908,17 @@ function formatWorkspaceChoices(wsList) {
|
|
|
3908
3908
|
};
|
|
3909
3909
|
});
|
|
3910
3910
|
}
|
|
3911
|
-
function buildClientOptions(config, store) {
|
|
3911
|
+
function buildClientOptions(config, store, email) {
|
|
3912
3912
|
return {
|
|
3913
3913
|
baseUrl: config.baseUrl,
|
|
3914
3914
|
deploymentDomain: config.deploymentDomain,
|
|
3915
3915
|
credentials: "omit",
|
|
3916
|
-
sessionStorage: store?.getSessionStorageProvider?.()
|
|
3916
|
+
sessionStorage: store?.getSessionStorageProvider?.(),
|
|
3917
|
+
userEmail: email
|
|
3917
3918
|
};
|
|
3918
3919
|
}
|
|
3919
3920
|
async function createAuthenticatedClient(config, creds, store) {
|
|
3920
|
-
const arbi = client.createArbiClient(buildClientOptions(config, store));
|
|
3921
|
+
const arbi = client.createArbiClient(buildClientOptions(config, store, creds.email));
|
|
3921
3922
|
await arbi.crypto.initSodium();
|
|
3922
3923
|
const signingPrivateKey = client.base64ToBytes(creds.signingPrivateKeyBase64);
|
|
3923
3924
|
const loginResult = await arbi.auth.loginWithKey({
|
|
@@ -4083,7 +4084,7 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
4083
4084
|
throw new ArbiError("No workspace selected. Run: arbi workspace select <id>");
|
|
4084
4085
|
}
|
|
4085
4086
|
if (isCachedTokenValid(creds, workspaceId)) {
|
|
4086
|
-
const arbi2 = client.createArbiClient(buildClientOptions(config, store));
|
|
4087
|
+
const arbi2 = client.createArbiClient(buildClientOptions(config, store, creds.email));
|
|
4087
4088
|
await arbi2.crypto.initSodium();
|
|
4088
4089
|
arbi2.session.setUser(creds.email);
|
|
4089
4090
|
arbi2.session.setSelectedWorkspace(workspaceId);
|
|
@@ -5219,7 +5220,17 @@ async function retrieve(options) {
|
|
|
5219
5220
|
};
|
|
5220
5221
|
const { data, error } = await arbi.fetch.POST("/v1/assistant/retrieve", { body });
|
|
5221
5222
|
if (error) {
|
|
5222
|
-
|
|
5223
|
+
const detail = error?.detail;
|
|
5224
|
+
let message;
|
|
5225
|
+
if (typeof detail === "string") {
|
|
5226
|
+
message = detail;
|
|
5227
|
+
} else if (detail && typeof detail === "object") {
|
|
5228
|
+
const d2 = detail;
|
|
5229
|
+
message = typeof d2.hint === "string" && d2.hint || JSON.stringify(detail);
|
|
5230
|
+
} else {
|
|
5231
|
+
message = JSON.stringify(error);
|
|
5232
|
+
}
|
|
5233
|
+
throw new Error(`Retrieve failed: ${message}`);
|
|
5223
5234
|
}
|
|
5224
5235
|
return data;
|
|
5225
5236
|
}
|