@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.js
CHANGED
|
@@ -3899,16 +3899,17 @@ function formatWorkspaceChoices(wsList) {
|
|
|
3899
3899
|
};
|
|
3900
3900
|
});
|
|
3901
3901
|
}
|
|
3902
|
-
function buildClientOptions(config, store) {
|
|
3902
|
+
function buildClientOptions(config, store, email) {
|
|
3903
3903
|
return {
|
|
3904
3904
|
baseUrl: config.baseUrl,
|
|
3905
3905
|
deploymentDomain: config.deploymentDomain,
|
|
3906
3906
|
credentials: "omit",
|
|
3907
|
-
sessionStorage: store?.getSessionStorageProvider?.()
|
|
3907
|
+
sessionStorage: store?.getSessionStorageProvider?.(),
|
|
3908
|
+
userEmail: email
|
|
3908
3909
|
};
|
|
3909
3910
|
}
|
|
3910
3911
|
async function createAuthenticatedClient(config, creds, store) {
|
|
3911
|
-
const arbi = createArbiClient(buildClientOptions(config, store));
|
|
3912
|
+
const arbi = createArbiClient(buildClientOptions(config, store, creds.email));
|
|
3912
3913
|
await arbi.crypto.initSodium();
|
|
3913
3914
|
const signingPrivateKey = base64ToBytes(creds.signingPrivateKeyBase64);
|
|
3914
3915
|
const loginResult = await arbi.auth.loginWithKey({
|
|
@@ -4074,7 +4075,7 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
4074
4075
|
throw new ArbiError("No workspace selected. Run: arbi workspace select <id>");
|
|
4075
4076
|
}
|
|
4076
4077
|
if (isCachedTokenValid(creds, workspaceId)) {
|
|
4077
|
-
const arbi2 = createArbiClient(buildClientOptions(config, store));
|
|
4078
|
+
const arbi2 = createArbiClient(buildClientOptions(config, store, creds.email));
|
|
4078
4079
|
await arbi2.crypto.initSodium();
|
|
4079
4080
|
arbi2.session.setUser(creds.email);
|
|
4080
4081
|
arbi2.session.setSelectedWorkspace(workspaceId);
|
|
@@ -5210,7 +5211,17 @@ async function retrieve(options) {
|
|
|
5210
5211
|
};
|
|
5211
5212
|
const { data, error } = await arbi.fetch.POST("/v1/assistant/retrieve", { body });
|
|
5212
5213
|
if (error) {
|
|
5213
|
-
|
|
5214
|
+
const detail = error?.detail;
|
|
5215
|
+
let message;
|
|
5216
|
+
if (typeof detail === "string") {
|
|
5217
|
+
message = detail;
|
|
5218
|
+
} else if (detail && typeof detail === "object") {
|
|
5219
|
+
const d2 = detail;
|
|
5220
|
+
message = typeof d2.hint === "string" && d2.hint || JSON.stringify(detail);
|
|
5221
|
+
} else {
|
|
5222
|
+
message = JSON.stringify(error);
|
|
5223
|
+
}
|
|
5224
|
+
throw new Error(`Retrieve failed: ${message}`);
|
|
5214
5225
|
}
|
|
5215
5226
|
return data;
|
|
5216
5227
|
}
|