@tangle-network/sandbox 0.60.3 → 0.60.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/README.md +2 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +5 -5
- package/dist/agent/preview.d.ts +1 -1
- package/dist/agent/preview.js +2 -2
- package/dist/{agent-run-outcome-BDxby7zK.d.ts → agent-run-outcome-B7w8HpoL.d.ts} +1 -1
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +1 -1
- package/dist/{browser-interactive-control-controller-C2qVGzQz.d.ts → browser-interactive-control-controller-C-3MDol8.d.ts} +1 -1
- package/dist/{client-Co3TZfTd.d.ts → client-AXO7ykS7.d.ts} +5 -5
- package/dist/{client-p2T45dAv.js → client-qSyPPokh.js} +84 -355
- package/dist/collaboration/index.d.ts +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/{collaboration-C1JAl5kE.js → collaboration-B7QeBrFQ.js} +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/core.js +3 -3
- package/dist/{errors-CKl_BSlD.js → errors-D1JIX7Jm.js} +13 -1
- package/dist/{index-Numcq5sH.d.ts → index-BPt77jdR.d.ts} +88 -3
- package/dist/index.d.ts +12 -12
- package/dist/index.js +6 -6
- package/dist/intelligence/index.js +1 -1
- package/dist/interactive-control.d.ts +1 -1
- package/dist/{interactive-controller-DV1HT3NR.js → interactive-controller-f_ePJqoh.js} +14 -8
- package/dist/{interactive-controller-Dghv9yMk.d.ts → interactive-controller-iYddZt8b.d.ts} +2 -2
- package/dist/{lines-CRlIO585.d.ts → lines-ggdLY7xy.d.ts} +1 -1
- package/dist/lines.d.ts +1 -1
- package/dist/lines.js +1 -1
- package/dist/{local-cli-auth-CdIM0B6p.js → local-cli-auth-D4T4wi9r.js} +1 -1
- package/dist/{mcp-local-BSvH4yAU.js → mcp-local-DjryqUiY.js} +1 -1
- package/dist/{preview-DlN1ee1K.d.ts → preview-CAiSrOuZ.d.ts} +3 -3
- package/dist/runtime.d.ts +6 -6
- package/dist/runtime.js +2 -2
- package/dist/{sandbox-DeE2MDx9.js → sandbox-DF2Z1lqW.js} +128 -558
- package/dist/{sandbox-fyuaDhc3.d.ts → sandbox-DsJ3ZJdA.d.ts} +5 -5
- package/dist/secp256k1-CyKOxB5J.js +2619 -0
- package/dist/session-gateway/index.d.ts +31 -25
- package/dist/session-gateway/index.js +75 -79
- package/dist/tangle/index.d.ts +2 -2
- package/dist/tangle/index.js +2 -2
- package/dist/tangle-CDtwGZtf.js +2847 -0
- package/dist/{types-C9w6MdZB.d.ts → types-BbgO-4f8.d.ts} +6 -2
- package/dist/utils-ChcSLv53.js +170 -0
- package/package.json +8 -7
- package/dist/tangle-SNShua9T.js +0 -1146
- /package/dist/{cli-auth-bundle-gs7xEnA1.d.ts → cli-auth-bundle-CTia4WWs.d.ts} +0 -0
- /package/dist/{cli-auth-bundle-ChOdvrjd.js → cli-auth-bundle-DzbqR2nA.js} +0 -0
- /package/dist/{errors-C6dll8Qf.d.ts → errors-DS32ViPj.d.ts} +0 -0
- /package/dist/{index-BKhRnV0i.d.ts → index-BXcL8P-U.d.ts} +0 -0
- /package/dist/{index-BSCz2Q0v.d.ts → index-BoQeoNOD.d.ts} +0 -0
- /package/dist/{preview-operations-BLsclF88.js → preview-operations-DqSo-IBm.js} +0 -0
- /package/dist/{terminal-stream-C9jxoB07.d.ts → terminal-stream-BUMu8Oae.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as backendTypeSchema } from "./backend-types-C7b_Gpa0.js";
|
|
2
|
-
import { C as SANDBOX_PROXY_REQUEST_MAX_BYTES, D as parseSSEStream, E as encodeTextForWire, O as applyRequestedModel, T as encodePromptForWire, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, s as requestInteractiveSessionToken } from "./interactive-controller-
|
|
3
|
-
import { _ as parseErrorResponse, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, l as PartialFailureError, p as ServerError, s as NetworkError, t as AuthError } from "./errors-
|
|
2
|
+
import { C as SANDBOX_PROXY_REQUEST_MAX_BYTES, D as parseSSEStream, E as encodeTextForWire, O as applyRequestedModel, T as encodePromptForWire, j as normalizeRuntimeBackendConfig, k as assertCurrentBackendType, s as requestInteractiveSessionToken } from "./interactive-controller-f_ePJqoh.js";
|
|
3
|
+
import { _ as parseErrorResponse, c as NotFoundError, f as SandboxError, g as ValidationError, h as TimeoutError, l as PartialFailureError, p as ServerError, s as NetworkError, t as AuthError, v as parseResponseError, y as readResponseJson } from "./errors-D1JIX7Jm.js";
|
|
4
4
|
import { f as combineAbortSignals } from "./browser-interactive-control-controller-BJf0P_J4.js";
|
|
5
|
-
import { C as normalizeSandboxShape, E as exportTraceBundle, S as normalizeConnection, a as normalizeStartupDiagnostics, i as normalizeSandboxCreateReceipt, n as createSandboxInstanceFromResponse, r as normalizeCaptureProof, w as rewrapResponse } from "./sandbox-
|
|
5
|
+
import { C as normalizeSandboxShape, E as exportTraceBundle, S as normalizeConnection, a as normalizeStartupDiagnostics, i as normalizeSandboxCreateReceipt, n as createSandboxInstanceFromResponse, r as normalizeCaptureProof, w as rewrapResponse } from "./sandbox-DF2Z1lqW.js";
|
|
6
6
|
import { LinesClient } from "./lines.js";
|
|
7
7
|
import { agentProfileSchema } from "@tangle-network/agent-interface";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -1643,10 +1643,7 @@ var SandboxFleet = class {
|
|
|
1643
1643
|
method: "POST",
|
|
1644
1644
|
body: JSON.stringify(execDispatchBody(command, options))
|
|
1645
1645
|
});
|
|
1646
|
-
if (!response.ok)
|
|
1647
|
-
const body = await response.text();
|
|
1648
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1649
|
-
}
|
|
1646
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
1650
1647
|
return await response.json();
|
|
1651
1648
|
}
|
|
1652
1649
|
/**
|
|
@@ -1673,10 +1670,7 @@ var SandboxFleet = class {
|
|
|
1673
1670
|
method: "POST",
|
|
1674
1671
|
body: JSON.stringify(promptDispatchBody(message, options))
|
|
1675
1672
|
});
|
|
1676
|
-
if (!response.ok)
|
|
1677
|
-
const body = await response.text();
|
|
1678
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1679
|
-
}
|
|
1673
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
1680
1674
|
return await response.json();
|
|
1681
1675
|
}
|
|
1682
1676
|
/**
|
|
@@ -1954,10 +1948,7 @@ var SandboxFleet = class {
|
|
|
1954
1948
|
}
|
|
1955
1949
|
async usage() {
|
|
1956
1950
|
const response = await this.client.fetch(`/v1/fleets/${this.fleetId}/usage`);
|
|
1957
|
-
if (!response.ok)
|
|
1958
|
-
const body = await response.text();
|
|
1959
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
1960
|
-
}
|
|
1951
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
1961
1952
|
return await response.json();
|
|
1962
1953
|
}
|
|
1963
1954
|
async trace(options = {}) {
|
|
@@ -2174,18 +2165,12 @@ var SandboxFleetClient = class {
|
|
|
2174
2165
|
}
|
|
2175
2166
|
async capabilities() {
|
|
2176
2167
|
const response = await this.client.fetch("/v1/fleets/capabilities");
|
|
2177
|
-
if (!response.ok)
|
|
2178
|
-
const body = await response.text();
|
|
2179
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2180
|
-
}
|
|
2168
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2181
2169
|
return await response.json();
|
|
2182
2170
|
}
|
|
2183
2171
|
async operations() {
|
|
2184
2172
|
const response = await this.client.fetch("/v1/fleets/operations");
|
|
2185
|
-
if (!response.ok)
|
|
2186
|
-
const body = await response.text();
|
|
2187
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2188
|
-
}
|
|
2173
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2189
2174
|
return await response.json();
|
|
2190
2175
|
}
|
|
2191
2176
|
async reconcile(options) {
|
|
@@ -2193,10 +2178,7 @@ var SandboxFleetClient = class {
|
|
|
2193
2178
|
method: "POST",
|
|
2194
2179
|
body: JSON.stringify(options ?? {})
|
|
2195
2180
|
});
|
|
2196
|
-
if (!response.ok)
|
|
2197
|
-
const body = await response.text();
|
|
2198
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2199
|
-
}
|
|
2181
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2200
2182
|
return await response.json();
|
|
2201
2183
|
}
|
|
2202
2184
|
async estimateCost(options) {
|
|
@@ -2212,10 +2194,7 @@ var SandboxFleetClient = class {
|
|
|
2212
2194
|
maxConcurrentCreates: options.maxConcurrentCreates
|
|
2213
2195
|
})
|
|
2214
2196
|
});
|
|
2215
|
-
if (!response.ok)
|
|
2216
|
-
const body = await response.text();
|
|
2217
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2218
|
-
}
|
|
2197
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2219
2198
|
return (await response.json()).estimate;
|
|
2220
2199
|
}
|
|
2221
2200
|
async create(input) {
|
|
@@ -2373,10 +2352,7 @@ var SandboxFleetClient = class {
|
|
|
2373
2352
|
/** Read a saved profile's definition from the Platform catalog. */
|
|
2374
2353
|
async savedProfile(ref) {
|
|
2375
2354
|
const response = await this.client.platformFetch(`/v1/agent-profiles/${encodeURIComponent(ref.profileId)}`);
|
|
2376
|
-
if (!response.ok)
|
|
2377
|
-
const body = await response.text();
|
|
2378
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2379
|
-
}
|
|
2355
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2380
2356
|
const data = await response.json();
|
|
2381
2357
|
const definition = data.data?.definition;
|
|
2382
2358
|
if (!definition) throw new ValidationError(`Saved profile '${ref.profileId}' returned no definition`, { profile: "invalid" });
|
|
@@ -2459,10 +2435,7 @@ var SandboxFleetClient = class {
|
|
|
2459
2435
|
async children(fleetId) {
|
|
2460
2436
|
assertSafeId(fleetId, "fleetId");
|
|
2461
2437
|
const response = await this.client.fetch("/v1/fleets");
|
|
2462
|
-
if (!response.ok)
|
|
2463
|
-
const body = await response.text();
|
|
2464
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2465
|
-
}
|
|
2438
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2466
2439
|
const children = ((await response.json()).fleets ?? []).filter((fleet) => fleet.parent?.fleetId === fleetId);
|
|
2467
2440
|
return Promise.all(children.map(async (fleet) => this.fromInfo(await this.hydrateServerFleet(fleet, { fleetId: fleet.id }))));
|
|
2468
2441
|
}
|
|
@@ -2490,37 +2463,25 @@ var SandboxFleetClient = class {
|
|
|
2490
2463
|
}))
|
|
2491
2464
|
})
|
|
2492
2465
|
});
|
|
2493
|
-
if (!response.ok)
|
|
2494
|
-
const body = await response.text();
|
|
2495
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2496
|
-
}
|
|
2466
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2497
2467
|
return (await response.json()).fleet;
|
|
2498
2468
|
}
|
|
2499
2469
|
async getServerFleet(fleetId) {
|
|
2500
2470
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}`);
|
|
2501
2471
|
if (response.status === 404) return null;
|
|
2502
|
-
if (!response.ok)
|
|
2503
|
-
const body = await response.text();
|
|
2504
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2505
|
-
}
|
|
2472
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2506
2473
|
return (await response.json()).fleet ?? null;
|
|
2507
2474
|
}
|
|
2508
2475
|
async deleteRecord(fleetId) {
|
|
2509
2476
|
assertSafeId(fleetId, "fleetId");
|
|
2510
2477
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}`, { method: "DELETE" });
|
|
2511
2478
|
if (response.status === 404) return;
|
|
2512
|
-
if (!response.ok)
|
|
2513
|
-
const body = await response.text();
|
|
2514
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2515
|
-
}
|
|
2479
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2516
2480
|
}
|
|
2517
2481
|
async usage(fleetId) {
|
|
2518
2482
|
assertSafeId(fleetId, "fleetId");
|
|
2519
2483
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/usage`);
|
|
2520
|
-
if (!response.ok)
|
|
2521
|
-
const body = await response.text();
|
|
2522
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2523
|
-
}
|
|
2484
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2524
2485
|
return await response.json();
|
|
2525
2486
|
}
|
|
2526
2487
|
async trace(fleetId, options = {}) {
|
|
@@ -2528,10 +2489,7 @@ var SandboxFleetClient = class {
|
|
|
2528
2489
|
const query = new URLSearchParams();
|
|
2529
2490
|
if (options.includeIntelligence === true) query.set("includeIntelligence", "true");
|
|
2530
2491
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/trace${query.size ? `?${query}` : ""}`);
|
|
2531
|
-
if (!response.ok)
|
|
2532
|
-
const body = await response.text();
|
|
2533
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2534
|
-
}
|
|
2492
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2535
2493
|
return await response.json();
|
|
2536
2494
|
}
|
|
2537
2495
|
async intelligence(fleetId) {
|
|
@@ -2564,10 +2522,7 @@ var SandboxFleetClient = class {
|
|
|
2564
2522
|
async cost(fleetId) {
|
|
2565
2523
|
assertSafeId(fleetId, "fleetId");
|
|
2566
2524
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/cost`);
|
|
2567
|
-
if (!response.ok)
|
|
2568
|
-
const body = await response.text();
|
|
2569
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2570
|
-
}
|
|
2525
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2571
2526
|
return (await response.json()).estimate;
|
|
2572
2527
|
}
|
|
2573
2528
|
async createToken(fleetId, options) {
|
|
@@ -2576,19 +2531,13 @@ var SandboxFleetClient = class {
|
|
|
2576
2531
|
method: "POST",
|
|
2577
2532
|
body: JSON.stringify(options ?? {})
|
|
2578
2533
|
});
|
|
2579
|
-
if (!response.ok)
|
|
2580
|
-
const body = await response.text();
|
|
2581
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2582
|
-
}
|
|
2534
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2583
2535
|
return await response.json();
|
|
2584
2536
|
}
|
|
2585
2537
|
async manifest(fleetId) {
|
|
2586
2538
|
assertSafeId(fleetId, "fleetId");
|
|
2587
2539
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/manifest`);
|
|
2588
|
-
if (!response.ok)
|
|
2589
|
-
const body = await response.text();
|
|
2590
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2591
|
-
}
|
|
2540
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2592
2541
|
return await response.json();
|
|
2593
2542
|
}
|
|
2594
2543
|
async attachMachine(fleetId, machine) {
|
|
@@ -2598,30 +2547,21 @@ var SandboxFleetClient = class {
|
|
|
2598
2547
|
method: "POST",
|
|
2599
2548
|
body: JSON.stringify(machine)
|
|
2600
2549
|
});
|
|
2601
|
-
if (!response.ok)
|
|
2602
|
-
const body = await response.text();
|
|
2603
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2604
|
-
}
|
|
2550
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2605
2551
|
return (await response.json()).machine;
|
|
2606
2552
|
}
|
|
2607
2553
|
async detachMachine(fleetId, machineId) {
|
|
2608
2554
|
assertSafeId(fleetId, "fleetId");
|
|
2609
2555
|
assertSafeId(machineId, "machineId");
|
|
2610
2556
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/machines/${encodeURIComponent(machineId)}`, { method: "DELETE" });
|
|
2611
|
-
if (!response.ok)
|
|
2612
|
-
const body = await response.text();
|
|
2613
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2614
|
-
}
|
|
2557
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2615
2558
|
return await response.json();
|
|
2616
2559
|
}
|
|
2617
2560
|
async dispatchResults(fleetId, dispatchId, options) {
|
|
2618
2561
|
assertSafeId(fleetId, "fleetId");
|
|
2619
2562
|
assertSafeId(dispatchId, "dispatchId");
|
|
2620
2563
|
const response = await this.client.fetch(dispatchResultsPath(fleetId, dispatchId, options));
|
|
2621
|
-
if (!response.ok)
|
|
2622
|
-
const body = await response.text();
|
|
2623
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2624
|
-
}
|
|
2564
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2625
2565
|
return await response.json();
|
|
2626
2566
|
}
|
|
2627
2567
|
async cancelDispatch(fleetId, dispatchId, reason) {
|
|
@@ -2631,37 +2571,25 @@ var SandboxFleetClient = class {
|
|
|
2631
2571
|
method: "POST",
|
|
2632
2572
|
body: JSON.stringify(reason ? { reason } : {})
|
|
2633
2573
|
});
|
|
2634
|
-
if (!response.ok)
|
|
2635
|
-
const body = await response.text();
|
|
2636
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2637
|
-
}
|
|
2574
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2638
2575
|
return await response.json();
|
|
2639
2576
|
}
|
|
2640
2577
|
async createWorkspaceSnapshot(fleetId) {
|
|
2641
2578
|
assertSafeId(fleetId, "fleetId");
|
|
2642
2579
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/workspace/snapshots`, { method: "POST" });
|
|
2643
|
-
if (!response.ok)
|
|
2644
|
-
const body = await response.text();
|
|
2645
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2646
|
-
}
|
|
2580
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2647
2581
|
return await response.json();
|
|
2648
2582
|
}
|
|
2649
2583
|
async restoreWorkspaceSnapshot(fleetId, snapshotId) {
|
|
2650
2584
|
assertSafeId(fleetId, "fleetId");
|
|
2651
2585
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/workspace/snapshots/${encodeURIComponent(snapshotId)}/restore`, { method: "POST" });
|
|
2652
|
-
if (!response.ok)
|
|
2653
|
-
const body = await response.text();
|
|
2654
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2655
|
-
}
|
|
2586
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2656
2587
|
return await response.json();
|
|
2657
2588
|
}
|
|
2658
2589
|
async reconcileWorkspace(fleetId) {
|
|
2659
2590
|
assertSafeId(fleetId, "fleetId");
|
|
2660
2591
|
const response = await this.client.fetch(`/v1/fleets/${fleetId}/workspace/reconcile`, { method: "POST" });
|
|
2661
|
-
if (!response.ok)
|
|
2662
|
-
const body = await response.text();
|
|
2663
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2664
|
-
}
|
|
2592
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2665
2593
|
return await response.json();
|
|
2666
2594
|
}
|
|
2667
2595
|
async *dispatchExecStream(fleetId, command, options) {
|
|
@@ -2672,10 +2600,7 @@ var SandboxFleetClient = class {
|
|
|
2672
2600
|
signal: options?.signal,
|
|
2673
2601
|
body: JSON.stringify(execDispatchBody(command, options))
|
|
2674
2602
|
});
|
|
2675
|
-
if (!response.ok)
|
|
2676
|
-
const body = await response.text();
|
|
2677
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2678
|
-
}
|
|
2603
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2679
2604
|
yield* parseSSEStream(response.body, { signal: options?.signal });
|
|
2680
2605
|
}
|
|
2681
2606
|
async *dispatchPromptStream(fleetId, message, options) {
|
|
@@ -2686,10 +2611,7 @@ var SandboxFleetClient = class {
|
|
|
2686
2611
|
signal: options?.signal,
|
|
2687
2612
|
body: JSON.stringify(promptDispatchBody(message, options))
|
|
2688
2613
|
});
|
|
2689
|
-
if (!response.ok)
|
|
2690
|
-
const body = await response.text();
|
|
2691
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2692
|
-
}
|
|
2614
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2693
2615
|
yield* parseSSEStream(response.body, { signal: options?.signal });
|
|
2694
2616
|
}
|
|
2695
2617
|
async reapExpired(options) {
|
|
@@ -2697,10 +2619,7 @@ var SandboxFleetClient = class {
|
|
|
2697
2619
|
method: "POST",
|
|
2698
2620
|
body: JSON.stringify(options ?? {})
|
|
2699
2621
|
});
|
|
2700
|
-
if (!response.ok)
|
|
2701
|
-
const body = await response.text();
|
|
2702
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
2703
|
-
}
|
|
2622
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
2704
2623
|
return await response.json();
|
|
2705
2624
|
}
|
|
2706
2625
|
async hydrateServerFleet(fleet, options) {
|
|
@@ -3618,15 +3537,10 @@ async function materializeProfileFileMounts(box, files, options = {}) {
|
|
|
3618
3537
|
async function broadcastSessionEvent(client, sessionId, event) {
|
|
3619
3538
|
if (!sessionId.trim()) throw new ValidationError("Session ID is required");
|
|
3620
3539
|
if (!event.type.trim()) throw new ValidationError("Session event type is required");
|
|
3621
|
-
const
|
|
3540
|
+
const result = await readResponseJson(await client.fetch(`/v1/session/${encodeURIComponent(sessionId)}/broadcast`, {
|
|
3622
3541
|
method: "POST",
|
|
3623
3542
|
body: JSON.stringify(event)
|
|
3624
|
-
});
|
|
3625
|
-
if (!response.ok) {
|
|
3626
|
-
const body = await response.text();
|
|
3627
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
3628
|
-
}
|
|
3629
|
-
const result = await response.json();
|
|
3543
|
+
}));
|
|
3630
3544
|
return {
|
|
3631
3545
|
success: result.success,
|
|
3632
3546
|
sessionId: result.sessionId
|
|
@@ -3771,11 +3685,11 @@ function withRequestContextHeaders(response, path, method) {
|
|
|
3771
3685
|
return rewrapResponse(response, headers);
|
|
3772
3686
|
}
|
|
3773
3687
|
async function resolveLocalCliAuthFiles(backendType) {
|
|
3774
|
-
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-
|
|
3688
|
+
const { discoverLocalCliAuthFiles } = await import("./local-cli-auth-D4T4wi9r.js");
|
|
3775
3689
|
return discoverLocalCliAuthFiles(backendType);
|
|
3776
3690
|
}
|
|
3777
3691
|
async function describeLocalCliAuthExpectation(backendType) {
|
|
3778
|
-
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-
|
|
3692
|
+
const { describeLocalCliAuthExpectation: describe } = await import("./local-cli-auth-D4T4wi9r.js");
|
|
3779
3693
|
return describe(backendType);
|
|
3780
3694
|
}
|
|
3781
3695
|
async function hydrateLocalCliBackendAuth(backend, baseUrl, trustLocalCliAuth) {
|
|
@@ -4308,12 +4222,7 @@ var Sandbox = class Sandbox {
|
|
|
4308
4222
|
if (options?.scope !== void 0) params.set("scope", options.scope);
|
|
4309
4223
|
const query = params.toString();
|
|
4310
4224
|
const path = query ? `/v1/sandboxes?${query}` : "/v1/sandboxes";
|
|
4311
|
-
const
|
|
4312
|
-
if (!response.ok) {
|
|
4313
|
-
const body = await response.text();
|
|
4314
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4315
|
-
}
|
|
4316
|
-
const data = await response.json();
|
|
4225
|
+
const data = await readResponseJson(await this.fetch(path));
|
|
4317
4226
|
return (Array.isArray(data) ? data : data.sandboxes ?? []).map((item) => createSandboxInstanceFromResponse(this, this.parseInfo(item)));
|
|
4318
4227
|
}
|
|
4319
4228
|
/**
|
|
@@ -4333,11 +4242,7 @@ var Sandbox = class Sandbox {
|
|
|
4333
4242
|
async get(id) {
|
|
4334
4243
|
const response = await this.fetch(`/v1/sandboxes/${encodeURIComponent(id)}`);
|
|
4335
4244
|
if (response.status === 404) return null;
|
|
4336
|
-
|
|
4337
|
-
const body = await response.text();
|
|
4338
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4339
|
-
}
|
|
4340
|
-
const data = await response.json();
|
|
4245
|
+
const data = await readResponseJson(response);
|
|
4341
4246
|
return createSandboxInstanceFromResponse(this, this.parseInfo(data), void 0, data);
|
|
4342
4247
|
}
|
|
4343
4248
|
/**
|
|
@@ -4401,12 +4306,7 @@ var Sandbox = class Sandbox {
|
|
|
4401
4306
|
* ```
|
|
4402
4307
|
*/
|
|
4403
4308
|
async shapes() {
|
|
4404
|
-
const
|
|
4405
|
-
if (!response.ok) {
|
|
4406
|
-
const body = await response.text();
|
|
4407
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4408
|
-
}
|
|
4409
|
-
const data = await response.json();
|
|
4309
|
+
const data = await readResponseJson(await this.fetch("/v1/shapes"));
|
|
4410
4310
|
if (!Array.isArray(data?.presets) || typeof data.default !== "string" || !data.ceiling || typeof data.ceiling.cpuCores !== "number" || typeof data.ceiling.memoryMB !== "number" || typeof data.ceiling.diskGB !== "number") throw new SandboxError("GET /v1/shapes returned no usable shape catalogue", "INVALID_RESPONSE", 502);
|
|
4411
4311
|
return data;
|
|
4412
4312
|
}
|
|
@@ -4417,12 +4317,7 @@ var Sandbox = class Sandbox {
|
|
|
4417
4317
|
* API key a service credential resolves to without exposing the key itself.
|
|
4418
4318
|
*/
|
|
4419
4319
|
async getIdentity() {
|
|
4420
|
-
const
|
|
4421
|
-
if (!response.ok) {
|
|
4422
|
-
const body = await response.text();
|
|
4423
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4424
|
-
}
|
|
4425
|
-
const payload = await response.json();
|
|
4320
|
+
const payload = await readResponseJson(await this.fetch("/v1/me"));
|
|
4426
4321
|
const data = payload.data;
|
|
4427
4322
|
if (payload.success !== true || !data || typeof data !== "object" || Array.isArray(data)) throw new ValidationError("Sandbox API returned an invalid /v1/me response");
|
|
4428
4323
|
const identity = data;
|
|
@@ -4451,12 +4346,7 @@ var Sandbox = class Sandbox {
|
|
|
4451
4346
|
* ```
|
|
4452
4347
|
*/
|
|
4453
4348
|
async usage() {
|
|
4454
|
-
const
|
|
4455
|
-
if (!response.ok) {
|
|
4456
|
-
const body = await response.text();
|
|
4457
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4458
|
-
}
|
|
4459
|
-
const data = await response.json();
|
|
4349
|
+
const data = await readResponseJson(await this.fetch("/usage"));
|
|
4460
4350
|
return {
|
|
4461
4351
|
computeMinutes: data.computeMinutes ?? 0,
|
|
4462
4352
|
gpuSeconds: data.gpuSeconds ?? 0,
|
|
@@ -4481,12 +4371,7 @@ var Sandbox = class Sandbox {
|
|
|
4481
4371
|
* ```
|
|
4482
4372
|
*/
|
|
4483
4373
|
async subscription() {
|
|
4484
|
-
const
|
|
4485
|
-
if (!response.ok) {
|
|
4486
|
-
const body = await response.text();
|
|
4487
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4488
|
-
}
|
|
4489
|
-
const data = await response.json();
|
|
4374
|
+
const data = await readResponseJson(await this.fetch("/subscription"));
|
|
4490
4375
|
return {
|
|
4491
4376
|
plan: data.plan ?? "free",
|
|
4492
4377
|
status: data.status ?? "active",
|
|
@@ -4734,11 +4619,7 @@ var SecretsManagerImpl = class {
|
|
|
4734
4619
|
const body = await response.text();
|
|
4735
4620
|
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4736
4621
|
}
|
|
4737
|
-
|
|
4738
|
-
const body = await response.text();
|
|
4739
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4740
|
-
}
|
|
4741
|
-
const data = await response.json();
|
|
4622
|
+
const data = await readResponseJson(response);
|
|
4742
4623
|
return {
|
|
4743
4624
|
name: data.secret.name,
|
|
4744
4625
|
createdAt: new Date(data.secret.createdAt),
|
|
@@ -4746,12 +4627,7 @@ var SecretsManagerImpl = class {
|
|
|
4746
4627
|
};
|
|
4747
4628
|
}
|
|
4748
4629
|
async list() {
|
|
4749
|
-
|
|
4750
|
-
if (!response.ok) {
|
|
4751
|
-
const body = await response.text();
|
|
4752
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4753
|
-
}
|
|
4754
|
-
return ((await response.json()).secrets ?? []).map((s) => ({
|
|
4630
|
+
return ((await readResponseJson(await this.client.fetch("/v1/secrets"))).secrets ?? []).map((s) => ({
|
|
4755
4631
|
name: s.name,
|
|
4756
4632
|
createdAt: new Date(s.createdAt),
|
|
4757
4633
|
updatedAt: new Date(s.updatedAt ?? s.createdAt)
|
|
@@ -4760,10 +4636,7 @@ var SecretsManagerImpl = class {
|
|
|
4760
4636
|
async delete(name) {
|
|
4761
4637
|
const response = await this.client.fetch(`/v1/secrets/${encodeURIComponent(name)}`, { method: "DELETE" });
|
|
4762
4638
|
if (response.status === 404) throw new NotFoundError("Secret", name);
|
|
4763
|
-
if (!response.ok)
|
|
4764
|
-
const body = await response.text();
|
|
4765
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4766
|
-
}
|
|
4639
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
4767
4640
|
}
|
|
4768
4641
|
};
|
|
4769
4642
|
var SshKeysManagerImpl = class {
|
|
@@ -4771,34 +4644,21 @@ var SshKeysManagerImpl = class {
|
|
|
4771
4644
|
this.client = client;
|
|
4772
4645
|
}
|
|
4773
4646
|
async create(name, publicKey) {
|
|
4774
|
-
|
|
4647
|
+
return toSshKeyInfo((await readResponseJson(await this.client.fetch("/v1/ssh-keys", {
|
|
4775
4648
|
method: "POST",
|
|
4776
4649
|
body: JSON.stringify({
|
|
4777
4650
|
name,
|
|
4778
4651
|
publicKey
|
|
4779
4652
|
})
|
|
4780
|
-
});
|
|
4781
|
-
if (!response.ok) {
|
|
4782
|
-
const body = await response.text();
|
|
4783
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4784
|
-
}
|
|
4785
|
-
return toSshKeyInfo((await response.json()).sshKey);
|
|
4653
|
+
}))).sshKey);
|
|
4786
4654
|
}
|
|
4787
4655
|
async list() {
|
|
4788
|
-
|
|
4789
|
-
if (!response.ok) {
|
|
4790
|
-
const body = await response.text();
|
|
4791
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4792
|
-
}
|
|
4793
|
-
return ((await response.json()).sshKeys ?? []).map(toSshKeyInfo);
|
|
4656
|
+
return ((await readResponseJson(await this.client.fetch("/v1/ssh-keys"))).sshKeys ?? []).map(toSshKeyInfo);
|
|
4794
4657
|
}
|
|
4795
4658
|
async delete(id) {
|
|
4796
4659
|
const response = await this.client.fetch(`/v1/ssh-keys/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
4797
4660
|
if (response.status === 404) throw new NotFoundError("SSH key", id);
|
|
4798
|
-
if (!response.ok)
|
|
4799
|
-
const body = await response.text();
|
|
4800
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4801
|
-
}
|
|
4661
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
4802
4662
|
}
|
|
4803
4663
|
};
|
|
4804
4664
|
function toSshKeyInfo(key) {
|
|
@@ -4919,12 +4779,7 @@ var EnvironmentsClient = class {
|
|
|
4919
4779
|
* ```
|
|
4920
4780
|
*/
|
|
4921
4781
|
async list() {
|
|
4922
|
-
|
|
4923
|
-
if (!response.ok) {
|
|
4924
|
-
const body = await response.text();
|
|
4925
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4926
|
-
}
|
|
4927
|
-
return (await response.json()).environments ?? [];
|
|
4782
|
+
return (await readResponseJson(await this.client.fetch("/v1/environments"))).environments ?? [];
|
|
4928
4783
|
}
|
|
4929
4784
|
/**
|
|
4930
4785
|
* Get details for a specific environment.
|
|
@@ -4947,58 +4802,28 @@ var PublicTemplatesClient = class {
|
|
|
4947
4802
|
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
4948
4803
|
if (options?.offset !== void 0) params.set("offset", String(options.offset));
|
|
4949
4804
|
const suffix = params.toString();
|
|
4950
|
-
|
|
4951
|
-
if (!response.ok) {
|
|
4952
|
-
const body = await response.text();
|
|
4953
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4954
|
-
}
|
|
4955
|
-
return (await response.json()).templates ?? [];
|
|
4805
|
+
return (await readResponseJson(await this.client.fetch(`/v1/public-templates${suffix ? `?${suffix}` : ""}`))).templates ?? [];
|
|
4956
4806
|
}
|
|
4957
4807
|
async featured() {
|
|
4958
|
-
|
|
4959
|
-
if (!response.ok) {
|
|
4960
|
-
const body = await response.text();
|
|
4961
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4962
|
-
}
|
|
4963
|
-
return (await response.json()).templates ?? [];
|
|
4808
|
+
return (await readResponseJson(await this.client.fetch("/v1/public-templates/featured"))).templates ?? [];
|
|
4964
4809
|
}
|
|
4965
4810
|
async get(idOrSlug) {
|
|
4966
|
-
|
|
4967
|
-
if (!response.ok) {
|
|
4968
|
-
const body = await response.text();
|
|
4969
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4970
|
-
}
|
|
4971
|
-
return (await response.json()).template;
|
|
4811
|
+
return (await readResponseJson(await this.client.fetch(`/v1/public-templates/${encodeURIComponent(idOrSlug)}`))).template;
|
|
4972
4812
|
}
|
|
4973
4813
|
async versions(idOrSlug) {
|
|
4974
|
-
|
|
4975
|
-
if (!response.ok) {
|
|
4976
|
-
const body = await response.text();
|
|
4977
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4978
|
-
}
|
|
4979
|
-
return (await response.json()).versions ?? [];
|
|
4814
|
+
return (await readResponseJson(await this.client.fetch(`/v1/public-templates/${encodeURIComponent(idOrSlug)}/versions`))).versions ?? [];
|
|
4980
4815
|
}
|
|
4981
4816
|
async publish(options) {
|
|
4982
|
-
|
|
4817
|
+
return (await readResponseJson(await this.client.fetch("/v1/public-templates", {
|
|
4983
4818
|
method: "POST",
|
|
4984
4819
|
body: JSON.stringify(options)
|
|
4985
|
-
});
|
|
4986
|
-
if (!response.ok) {
|
|
4987
|
-
const body = await response.text();
|
|
4988
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
4989
|
-
}
|
|
4990
|
-
return (await response.json()).template;
|
|
4820
|
+
}))).template;
|
|
4991
4821
|
}
|
|
4992
4822
|
async publishVersion(idOrSlug, options) {
|
|
4993
|
-
|
|
4823
|
+
return (await readResponseJson(await this.client.fetch(`/v1/public-templates/${encodeURIComponent(idOrSlug)}/versions`, {
|
|
4994
4824
|
method: "POST",
|
|
4995
4825
|
body: JSON.stringify(options)
|
|
4996
|
-
});
|
|
4997
|
-
if (!response.ok) {
|
|
4998
|
-
const body = await response.text();
|
|
4999
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5000
|
-
}
|
|
5001
|
-
return (await response.json()).version;
|
|
4826
|
+
}))).version;
|
|
5002
4827
|
}
|
|
5003
4828
|
};
|
|
5004
4829
|
/**
|
|
@@ -5012,179 +4837,91 @@ var TeamsClient = class {
|
|
|
5012
4837
|
this.client = client;
|
|
5013
4838
|
}
|
|
5014
4839
|
async list() {
|
|
5015
|
-
|
|
5016
|
-
if (!response.ok) {
|
|
5017
|
-
const body = await response.text();
|
|
5018
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5019
|
-
}
|
|
5020
|
-
return (await response.json()).teams ?? [];
|
|
4840
|
+
return (await readResponseJson(await this.client.fetch("/v1/teams"))).teams ?? [];
|
|
5021
4841
|
}
|
|
5022
4842
|
async create(options) {
|
|
5023
|
-
|
|
4843
|
+
return (await readResponseJson(await this.client.fetch("/v1/teams", {
|
|
5024
4844
|
method: "POST",
|
|
5025
4845
|
body: JSON.stringify(options)
|
|
5026
|
-
});
|
|
5027
|
-
if (!response.ok) {
|
|
5028
|
-
const body = await response.text();
|
|
5029
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5030
|
-
}
|
|
5031
|
-
return (await response.json()).team;
|
|
4846
|
+
}))).team;
|
|
5032
4847
|
}
|
|
5033
4848
|
async get(teamId) {
|
|
5034
|
-
|
|
5035
|
-
if (!response.ok) {
|
|
5036
|
-
const body = await response.text();
|
|
5037
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5038
|
-
}
|
|
5039
|
-
return (await response.json()).team;
|
|
4849
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}`))).team;
|
|
5040
4850
|
}
|
|
5041
4851
|
async update(teamId, updates) {
|
|
5042
|
-
|
|
4852
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}`, {
|
|
5043
4853
|
method: "PATCH",
|
|
5044
4854
|
body: JSON.stringify(updates)
|
|
5045
|
-
});
|
|
5046
|
-
if (!response.ok) {
|
|
5047
|
-
const body = await response.text();
|
|
5048
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5049
|
-
}
|
|
5050
|
-
return (await response.json()).team;
|
|
4855
|
+
}))).team;
|
|
5051
4856
|
}
|
|
5052
4857
|
async delete(teamId) {
|
|
5053
4858
|
const response = await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}`, { method: "DELETE" });
|
|
5054
|
-
if (!response.ok)
|
|
5055
|
-
const body = await response.text();
|
|
5056
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5057
|
-
}
|
|
4859
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5058
4860
|
}
|
|
5059
4861
|
async leave(teamId) {
|
|
5060
4862
|
const response = await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/leave`, { method: "POST" });
|
|
5061
|
-
if (!response.ok)
|
|
5062
|
-
const body = await response.text();
|
|
5063
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5064
|
-
}
|
|
4863
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5065
4864
|
}
|
|
5066
4865
|
async transferOwnership(teamId, newOwnerCustomerId) {
|
|
5067
4866
|
const response = await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/transfer`, {
|
|
5068
4867
|
method: "POST",
|
|
5069
4868
|
body: JSON.stringify({ newOwnerCustomerId })
|
|
5070
4869
|
});
|
|
5071
|
-
if (!response.ok)
|
|
5072
|
-
const body = await response.text();
|
|
5073
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5074
|
-
}
|
|
4870
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5075
4871
|
}
|
|
5076
4872
|
async listMembers(teamId) {
|
|
5077
|
-
|
|
5078
|
-
if (!response.ok) {
|
|
5079
|
-
const body = await response.text();
|
|
5080
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5081
|
-
}
|
|
5082
|
-
return (await response.json()).members ?? [];
|
|
4873
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/members`))).members ?? [];
|
|
5083
4874
|
}
|
|
5084
4875
|
async updateMember(teamId, memberId, updates) {
|
|
5085
|
-
|
|
4876
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/members/${encodeURIComponent(memberId)}`, {
|
|
5086
4877
|
method: "PATCH",
|
|
5087
4878
|
body: JSON.stringify(updates)
|
|
5088
|
-
});
|
|
5089
|
-
if (!response.ok) {
|
|
5090
|
-
const body = await response.text();
|
|
5091
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5092
|
-
}
|
|
5093
|
-
return (await response.json()).member;
|
|
4879
|
+
}))).member;
|
|
5094
4880
|
}
|
|
5095
4881
|
async removeMember(teamId, memberId) {
|
|
5096
4882
|
const response = await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/members/${encodeURIComponent(memberId)}`, { method: "DELETE" });
|
|
5097
|
-
if (!response.ok)
|
|
5098
|
-
const body = await response.text();
|
|
5099
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5100
|
-
}
|
|
4883
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5101
4884
|
}
|
|
5102
4885
|
async listInvitations(teamId) {
|
|
5103
|
-
|
|
5104
|
-
if (!response.ok) {
|
|
5105
|
-
const body = await response.text();
|
|
5106
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5107
|
-
}
|
|
5108
|
-
return (await response.json()).invitations ?? [];
|
|
4886
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/invitations`))).invitations ?? [];
|
|
5109
4887
|
}
|
|
5110
4888
|
async invite(teamId, options) {
|
|
5111
|
-
|
|
4889
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/invitations`, {
|
|
5112
4890
|
method: "POST",
|
|
5113
4891
|
body: JSON.stringify(options)
|
|
5114
|
-
});
|
|
5115
|
-
if (!response.ok) {
|
|
5116
|
-
const body = await response.text();
|
|
5117
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5118
|
-
}
|
|
5119
|
-
return (await response.json()).invitation;
|
|
4892
|
+
}))).invitation;
|
|
5120
4893
|
}
|
|
5121
4894
|
async revokeInvitation(invitationId) {
|
|
5122
4895
|
const response = await this.client.fetch(`/v1/teams/invitations/${encodeURIComponent(invitationId)}`, { method: "DELETE" });
|
|
5123
|
-
if (!response.ok)
|
|
5124
|
-
const body = await response.text();
|
|
5125
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5126
|
-
}
|
|
4896
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5127
4897
|
}
|
|
5128
4898
|
async acceptInvitation(token) {
|
|
5129
|
-
|
|
5130
|
-
if (!response.ok) {
|
|
5131
|
-
const body = await response.text();
|
|
5132
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5133
|
-
}
|
|
5134
|
-
return (await response.json()).member;
|
|
4899
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/invitations/${encodeURIComponent(token)}/accept`, { method: "POST" }))).member;
|
|
5135
4900
|
}
|
|
5136
4901
|
async getInvitation(token) {
|
|
5137
|
-
|
|
5138
|
-
if (!response.ok) {
|
|
5139
|
-
const body = await response.text();
|
|
5140
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5141
|
-
}
|
|
5142
|
-
return (await response.json()).invitation;
|
|
4902
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/invitations/${encodeURIComponent(token)}`))).invitation;
|
|
5143
4903
|
}
|
|
5144
4904
|
async listSecrets(teamId) {
|
|
5145
|
-
|
|
5146
|
-
if (!response.ok) {
|
|
5147
|
-
const body = await response.text();
|
|
5148
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5149
|
-
}
|
|
5150
|
-
return (await response.json()).secrets ?? [];
|
|
4905
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/secrets`))).secrets ?? [];
|
|
5151
4906
|
}
|
|
5152
4907
|
async upsertSecret(teamId, name, value) {
|
|
5153
|
-
|
|
4908
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/secrets/${encodeURIComponent(name)}`, {
|
|
5154
4909
|
method: "PUT",
|
|
5155
4910
|
body: JSON.stringify({ value })
|
|
5156
|
-
});
|
|
5157
|
-
if (!response.ok) {
|
|
5158
|
-
const body = await response.text();
|
|
5159
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5160
|
-
}
|
|
5161
|
-
return (await response.json()).secret;
|
|
4911
|
+
}))).secret;
|
|
5162
4912
|
}
|
|
5163
4913
|
async deleteSecret(teamId, name) {
|
|
5164
4914
|
const response = await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/secrets/${encodeURIComponent(name)}`, { method: "DELETE" });
|
|
5165
|
-
if (!response.ok)
|
|
5166
|
-
const body = await response.text();
|
|
5167
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5168
|
-
}
|
|
4915
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5169
4916
|
}
|
|
5170
4917
|
async revealSecret(teamId, name) {
|
|
5171
|
-
|
|
5172
|
-
if (!response.ok) {
|
|
5173
|
-
const body = await response.text();
|
|
5174
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5175
|
-
}
|
|
5176
|
-
return await response.json();
|
|
4918
|
+
return await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/secrets/${encodeURIComponent(name)}/reveal`, { method: "POST" }));
|
|
5177
4919
|
}
|
|
5178
4920
|
async listTemplates(teamId) {
|
|
5179
|
-
|
|
5180
|
-
if (!response.ok) {
|
|
5181
|
-
const body = await response.text();
|
|
5182
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5183
|
-
}
|
|
5184
|
-
return (await response.json()).templates ?? [];
|
|
4921
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/templates`))).templates ?? [];
|
|
5185
4922
|
}
|
|
5186
4923
|
async createTemplate(teamId, options) {
|
|
5187
|
-
|
|
4924
|
+
return (await readResponseJson(await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/templates`, {
|
|
5188
4925
|
method: "POST",
|
|
5189
4926
|
body: JSON.stringify({
|
|
5190
4927
|
name: options.name,
|
|
@@ -5193,19 +4930,11 @@ var TeamsClient = class {
|
|
|
5193
4930
|
environment: options.environment,
|
|
5194
4931
|
config: options.config
|
|
5195
4932
|
})
|
|
5196
|
-
});
|
|
5197
|
-
if (!response.ok) {
|
|
5198
|
-
const body = await response.text();
|
|
5199
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5200
|
-
}
|
|
5201
|
-
return (await response.json()).template;
|
|
4933
|
+
}))).template;
|
|
5202
4934
|
}
|
|
5203
4935
|
async deleteTemplate(teamId, templateId) {
|
|
5204
4936
|
const response = await this.client.fetch(`/v1/teams/${encodeURIComponent(teamId)}/templates/${encodeURIComponent(templateId)}`, { method: "DELETE" });
|
|
5205
|
-
if (!response.ok)
|
|
5206
|
-
const body = await response.text();
|
|
5207
|
-
throw parseErrorResponse(response.status, body, void 0, response.headers);
|
|
5208
|
-
}
|
|
4937
|
+
if (!response.ok) throw await parseResponseError(response);
|
|
5209
4938
|
}
|
|
5210
4939
|
};
|
|
5211
4940
|
//#endregion
|