@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/browser.cjs
CHANGED
|
@@ -3572,16 +3572,17 @@ function formatWorkspaceChoices(wsList) {
|
|
|
3572
3572
|
};
|
|
3573
3573
|
});
|
|
3574
3574
|
}
|
|
3575
|
-
function buildClientOptions(config, store) {
|
|
3575
|
+
function buildClientOptions(config, store, email) {
|
|
3576
3576
|
return {
|
|
3577
3577
|
baseUrl: config.baseUrl,
|
|
3578
3578
|
deploymentDomain: config.deploymentDomain,
|
|
3579
3579
|
credentials: "omit",
|
|
3580
|
-
sessionStorage: store?.getSessionStorageProvider?.()
|
|
3580
|
+
sessionStorage: store?.getSessionStorageProvider?.(),
|
|
3581
|
+
userEmail: email
|
|
3581
3582
|
};
|
|
3582
3583
|
}
|
|
3583
3584
|
async function createAuthenticatedClient(config, creds, store) {
|
|
3584
|
-
const arbi = client.createArbiClient(buildClientOptions(config, store));
|
|
3585
|
+
const arbi = client.createArbiClient(buildClientOptions(config, store, creds.email));
|
|
3585
3586
|
await arbi.crypto.initSodium();
|
|
3586
3587
|
const signingPrivateKey = client.base64ToBytes(creds.signingPrivateKeyBase64);
|
|
3587
3588
|
const loginResult = await arbi.auth.loginWithKey({
|
|
@@ -3694,7 +3695,7 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
3694
3695
|
throw new ArbiError("No workspace selected. Run: arbi workspace select <id>");
|
|
3695
3696
|
}
|
|
3696
3697
|
if (isCachedTokenValid(creds, workspaceId)) {
|
|
3697
|
-
const arbi2 = client.createArbiClient(buildClientOptions(config, store));
|
|
3698
|
+
const arbi2 = client.createArbiClient(buildClientOptions(config, store, creds.email));
|
|
3698
3699
|
await arbi2.crypto.initSodium();
|
|
3699
3700
|
arbi2.session.setUser(creds.email);
|
|
3700
3701
|
arbi2.session.setSelectedWorkspace(workspaceId);
|
|
@@ -4686,7 +4687,17 @@ async function retrieve(options) {
|
|
|
4686
4687
|
};
|
|
4687
4688
|
const { data, error } = await arbi.fetch.POST("/v1/assistant/retrieve", { body });
|
|
4688
4689
|
if (error) {
|
|
4689
|
-
|
|
4690
|
+
const detail = error?.detail;
|
|
4691
|
+
let message;
|
|
4692
|
+
if (typeof detail === "string") {
|
|
4693
|
+
message = detail;
|
|
4694
|
+
} else if (detail && typeof detail === "object") {
|
|
4695
|
+
const d2 = detail;
|
|
4696
|
+
message = typeof d2.hint === "string" && d2.hint || JSON.stringify(detail);
|
|
4697
|
+
} else {
|
|
4698
|
+
message = JSON.stringify(error);
|
|
4699
|
+
}
|
|
4700
|
+
throw new Error(`Retrieve failed: ${message}`);
|
|
4690
4701
|
}
|
|
4691
4702
|
return data;
|
|
4692
4703
|
}
|