@amigo-ai/platform-sdk 0.61.1 → 0.63.0
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/core/device-code.js +15 -3
- package/dist/core/device-code.js.map +1 -1
- package/dist/index.cjs +13 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +2 -2
- package/dist/types/core/device-code.d.ts +13 -4
- package/dist/types/core/device-code.d.ts.map +1 -1
- package/dist/types/generated/api.d.ts +1183 -428
- package/dist/types/generated/api.d.ts.map +1 -1
- package/dist/types/resources/context-graphs.d.ts +80 -0
- package/dist/types/resources/context-graphs.d.ts.map +1 -1
- package/dist/types/resources/data-sources.d.ts +5 -15
- package/dist/types/resources/data-sources.d.ts.map +1 -1
- package/dist/types/resources/intake.d.ts.map +1 -1
- package/dist/types/resources/integrations.d.ts +5 -0
- package/dist/types/resources/integrations.d.ts.map +1 -1
- package/dist/types/resources/metrics.d.ts.map +1 -1
- package/dist/types/resources/operators.d.ts.map +1 -1
- package/dist/types/resources/pipeline.d.ts +3 -3
- package/dist/types/resources/services.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/dist/types/resources/surfaces.d.ts.map +1 -1
- package/dist/types/resources/world.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5385,6 +5385,7 @@ async function requestDeviceCode(baseUrl, params, fetchFn) {
|
|
|
5385
5385
|
const body = new URLSearchParams();
|
|
5386
5386
|
if (params.clientDescription) body.set("client_description", params.clientDescription);
|
|
5387
5387
|
if (params.scope) body.set("scope", params.scope);
|
|
5388
|
+
body.set("workspace_id", params.workspaceId);
|
|
5388
5389
|
const res = await identityPost(baseUrl, "/device/code", body, fetchFn);
|
|
5389
5390
|
if (res.status === 429) {
|
|
5390
5391
|
const retryAfter = parseInt(res.headers.get("Retry-After") ?? "", 10);
|
|
@@ -5500,6 +5501,15 @@ async function fetchWorkspaces(baseUrl, accessToken, fetchFn) {
|
|
|
5500
5501
|
}
|
|
5501
5502
|
return [];
|
|
5502
5503
|
}
|
|
5504
|
+
async function pickWorkspace(options, workspaces) {
|
|
5505
|
+
if (!options.onWorkspaceRequired) {
|
|
5506
|
+
throw new AmigoError(
|
|
5507
|
+
`Identity returned multiple workspaces despite workspaceId being set. Supply 'onWorkspaceRequired' as a legacy fallback, or report a server-side issue.`,
|
|
5508
|
+
{ errorCode: "workspace_selection_required" }
|
|
5509
|
+
);
|
|
5510
|
+
}
|
|
5511
|
+
return options.onWorkspaceRequired(workspaces);
|
|
5512
|
+
}
|
|
5503
5513
|
async function resolveWorkspaceFromBootstrap(baseUrl, token, options, fetchFn) {
|
|
5504
5514
|
if (!token.refresh_token) {
|
|
5505
5515
|
throw new AmigoError("Bootstrap token missing refresh_token", { errorCode: "server_error" });
|
|
@@ -5523,7 +5533,7 @@ async function resolveWorkspaceFromBootstrap(baseUrl, token, options, fetchFn) {
|
|
|
5523
5533
|
);
|
|
5524
5534
|
return toAuthResult(scoped2, workspaces[0].workspace_id);
|
|
5525
5535
|
}
|
|
5526
|
-
const workspaceId2 = await options
|
|
5536
|
+
const workspaceId2 = await pickWorkspace(options, workspaces);
|
|
5527
5537
|
const scoped = await doRefreshToken(
|
|
5528
5538
|
baseUrl,
|
|
5529
5539
|
{ refreshToken: token.refresh_token, workspaceId: workspaceId2, scope: options.scope },
|
|
@@ -5537,7 +5547,7 @@ async function resolveWorkspaceFromMulti(baseUrl, multi, options, fetchFn) {
|
|
|
5537
5547
|
errorCode: "server_error"
|
|
5538
5548
|
});
|
|
5539
5549
|
}
|
|
5540
|
-
const workspaceId2 = await options
|
|
5550
|
+
const workspaceId2 = await pickWorkspace(options, multi.workspaces);
|
|
5541
5551
|
const scoped = await doRefreshToken(
|
|
5542
5552
|
baseUrl,
|
|
5543
5553
|
{ refreshToken: multi.refresh_token, workspaceId: workspaceId2, scope: options.scope },
|
|
@@ -5550,7 +5560,7 @@ async function loginWithDeviceCode(options) {
|
|
|
5550
5560
|
const fetchFn = options.fetch ?? globalThis.fetch;
|
|
5551
5561
|
const issuance = await requestDeviceCode(
|
|
5552
5562
|
baseUrl,
|
|
5553
|
-
{ clientDescription: options.clientDescription, scope: options.scope },
|
|
5563
|
+
{ clientDescription: options.clientDescription, scope: options.scope, workspaceId: options.workspaceId },
|
|
5554
5564
|
fetchFn
|
|
5555
5565
|
);
|
|
5556
5566
|
await options.onCode(issuance);
|