@boatdev/sdk 1.9.6 → 1.9.8
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/.openapi-generator/FILES +8 -0
- package/README.md +2 -2
- package/dist/apis/BoatApi.d.ts +76 -0
- package/dist/apis/BoatApi.js +199 -0
- package/dist/boat-helpers.d.ts +23 -0
- package/dist/boat-helpers.js +97 -0
- package/dist/esm/apis/BoatApi.d.ts +76 -0
- package/dist/esm/apis/BoatApi.js +199 -0
- package/dist/esm/boat-helpers.d.ts +23 -0
- package/dist/esm/boat-helpers.js +95 -0
- package/dist/esm/models/CredentialAccount.d.ts +50 -0
- package/dist/esm/models/CredentialAccount.js +53 -0
- package/dist/esm/models/CredentialAccountsResponse.d.ts +64 -0
- package/dist/esm/models/CredentialAccountsResponse.js +65 -0
- package/dist/esm/models/CredentialProfile.d.ts +9 -0
- package/dist/esm/models/CredentialProfile.js +2 -0
- package/dist/esm/models/DeletionOperation.d.ts +1 -3
- package/dist/esm/models/DeletionOperation.js +0 -2
- package/dist/esm/models/LimitsFields.d.ts +7 -0
- package/dist/esm/models/LimitsFields.js +3 -0
- package/dist/esm/models/LimitsFieldsMachineTypesInner.d.ts +54 -0
- package/dist/esm/models/LimitsFieldsMachineTypesInner.js +60 -0
- package/dist/esm/models/LimitsResponse.d.ts +7 -0
- package/dist/esm/models/LimitsResponse.js +3 -0
- package/dist/esm/models/Sandbox.d.ts +15 -2
- package/dist/esm/models/Sandbox.js +5 -0
- package/dist/esm/models/SandboxHydration.d.ts +50 -0
- package/dist/esm/models/SandboxHydration.js +55 -0
- package/dist/esm/models/SetCredentialKeyRequest.d.ts +6 -0
- package/dist/esm/models/SetCredentialKeyRequest.js +2 -0
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.js +4 -0
- package/dist/models/CredentialAccount.d.ts +50 -0
- package/dist/models/CredentialAccount.js +60 -0
- package/dist/models/CredentialAccountsResponse.d.ts +64 -0
- package/dist/models/CredentialAccountsResponse.js +72 -0
- package/dist/models/CredentialProfile.d.ts +9 -0
- package/dist/models/CredentialProfile.js +2 -0
- package/dist/models/DeletionOperation.d.ts +1 -3
- package/dist/models/DeletionOperation.js +0 -2
- package/dist/models/LimitsFields.d.ts +7 -0
- package/dist/models/LimitsFields.js +3 -0
- package/dist/models/LimitsFieldsMachineTypesInner.d.ts +54 -0
- package/dist/models/LimitsFieldsMachineTypesInner.js +68 -0
- package/dist/models/LimitsResponse.d.ts +7 -0
- package/dist/models/LimitsResponse.js +3 -0
- package/dist/models/Sandbox.d.ts +15 -2
- package/dist/models/Sandbox.js +5 -0
- package/dist/models/SandboxHydration.d.ts +50 -0
- package/dist/models/SandboxHydration.js +62 -0
- package/dist/models/SetCredentialKeyRequest.d.ts +6 -0
- package/dist/models/SetCredentialKeyRequest.js +2 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +4 -0
- package/docs/BoatApi.md +325 -0
- package/docs/CredentialAccount.md +39 -0
- package/docs/CredentialAccountsResponse.md +42 -0
- package/docs/CredentialProfile.md +2 -0
- package/docs/LimitsFields.md +2 -0
- package/docs/LimitsFieldsMachineTypesInner.md +36 -0
- package/docs/LimitsResponse.md +2 -0
- package/docs/Sandbox.md +4 -0
- package/docs/SandboxHydration.md +39 -0
- package/docs/SetCredentialKeyRequest.md +2 -0
- package/package.json +2 -2
- package/src/apis/BoatApi.ts +307 -0
- package/src/boat-helpers.ts +109 -0
- package/src/models/CredentialAccount.ts +92 -0
- package/src/models/CredentialAccountsResponse.ts +128 -0
- package/src/models/CredentialProfile.ts +15 -0
- package/src/models/DeletionOperation.ts +1 -3
- package/src/models/LimitsFields.ts +15 -0
- package/src/models/LimitsFieldsMachineTypesInner.ts +97 -0
- package/src/models/LimitsResponse.ts +15 -0
- package/src/models/Sandbox.ts +25 -2
- package/src/models/SandboxHydration.ts +93 -0
- package/src/models/SetCredentialKeyRequest.ts +8 -0
- package/src/models/index.ts +4 -0
package/.openapi-generator/FILES
CHANGED
|
@@ -46,6 +46,8 @@ docs/CreateSandboxRequest.md
|
|
|
46
46
|
docs/CreateSandboxResponse.md
|
|
47
47
|
docs/CreateScopedApiKey503Response.md
|
|
48
48
|
docs/CreateScopedApiKeyRequest.md
|
|
49
|
+
docs/CredentialAccount.md
|
|
50
|
+
docs/CredentialAccountsResponse.md
|
|
49
51
|
docs/CredentialId.md
|
|
50
52
|
docs/CredentialProfile.md
|
|
51
53
|
docs/CredentialProfileDeletedResponse.md
|
|
@@ -75,6 +77,7 @@ docs/HostPortResponse.md
|
|
|
75
77
|
docs/LimitsFields.md
|
|
76
78
|
docs/LimitsFieldsCurrentLimits.md
|
|
77
79
|
docs/LimitsFieldsGiftLimit.md
|
|
80
|
+
docs/LimitsFieldsMachineTypesInner.md
|
|
78
81
|
docs/LimitsFieldsSandboxPlanTiersInner.md
|
|
79
82
|
docs/LimitsFieldsStartLimits.md
|
|
80
83
|
docs/LimitsFieldsStarts.md
|
|
@@ -124,6 +127,7 @@ docs/SandboxEnvironmentListResponse.md
|
|
|
124
127
|
docs/SandboxEnvironmentResponse.md
|
|
125
128
|
docs/SandboxEnvironmentVersionSummary.md
|
|
126
129
|
docs/SandboxEvent.md
|
|
130
|
+
docs/SandboxHydration.md
|
|
127
131
|
docs/SandboxInfoResponse.md
|
|
128
132
|
docs/SandboxListResponse.md
|
|
129
133
|
docs/SandboxProcess.md
|
|
@@ -230,6 +234,8 @@ src/models/CreateSandboxRequest.ts
|
|
|
230
234
|
src/models/CreateSandboxResponse.ts
|
|
231
235
|
src/models/CreateScopedApiKey503Response.ts
|
|
232
236
|
src/models/CreateScopedApiKeyRequest.ts
|
|
237
|
+
src/models/CredentialAccount.ts
|
|
238
|
+
src/models/CredentialAccountsResponse.ts
|
|
233
239
|
src/models/CredentialId.ts
|
|
234
240
|
src/models/CredentialProfile.ts
|
|
235
241
|
src/models/CredentialProfileDeletedResponse.ts
|
|
@@ -259,6 +265,7 @@ src/models/HostPortResponse.ts
|
|
|
259
265
|
src/models/LimitsFields.ts
|
|
260
266
|
src/models/LimitsFieldsCurrentLimits.ts
|
|
261
267
|
src/models/LimitsFieldsGiftLimit.ts
|
|
268
|
+
src/models/LimitsFieldsMachineTypesInner.ts
|
|
262
269
|
src/models/LimitsFieldsSandboxPlanTiersInner.ts
|
|
263
270
|
src/models/LimitsFieldsStartLimits.ts
|
|
264
271
|
src/models/LimitsFieldsStarts.ts
|
|
@@ -308,6 +315,7 @@ src/models/SandboxEnvironmentListResponse.ts
|
|
|
308
315
|
src/models/SandboxEnvironmentResponse.ts
|
|
309
316
|
src/models/SandboxEnvironmentVersionSummary.ts
|
|
310
317
|
src/models/SandboxEvent.ts
|
|
318
|
+
src/models/SandboxHydration.ts
|
|
311
319
|
src/models/SandboxInfoResponse.ts
|
|
312
320
|
src/models/SandboxListResponse.ts
|
|
313
321
|
src/models/SandboxProcess.ts
|
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ npm install @boatdev/sdk
|
|
|
10
10
|
|
|
11
11
|
## Links
|
|
12
12
|
|
|
13
|
-
- SDK docs: https://docs.boat.dev/sdks
|
|
14
|
-
- API reference: https://docs.boat.dev/api/
|
|
13
|
+
- SDK docs: https://docs.boat.dev/sdks/overview
|
|
14
|
+
- API reference: https://docs.boat.dev/api/v1
|
|
15
15
|
- Dashboard: https://boat.dev/dashboard
|
|
16
16
|
- API keys: https://boat.dev/dashboard?tab=api-keys
|
|
17
17
|
|
package/dist/apis/BoatApi.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { type CreateSandboxEnvironmentRequest } from '../models/CreateSandboxEnv
|
|
|
33
33
|
import { type CreateSandboxRequest } from '../models/CreateSandboxRequest';
|
|
34
34
|
import { type CreateSandboxResponse } from '../models/CreateSandboxResponse';
|
|
35
35
|
import { type CreateScopedApiKeyRequest } from '../models/CreateScopedApiKeyRequest';
|
|
36
|
+
import { type CredentialAccountsResponse } from '../models/CredentialAccountsResponse';
|
|
36
37
|
import { type CredentialId } from '../models/CredentialId';
|
|
37
38
|
import { type CredentialProfileDeletedResponse } from '../models/CredentialProfileDeletedResponse';
|
|
38
39
|
import { type CredentialProfileListResponse } from '../models/CredentialProfileListResponse';
|
|
@@ -114,6 +115,11 @@ import { type WebhookListResponse } from '../models/WebhookListResponse';
|
|
|
114
115
|
import { type WebhookResponse } from '../models/WebhookResponse';
|
|
115
116
|
import { type WebhookSecretResponse } from '../models/WebhookSecretResponse';
|
|
116
117
|
import { type WebhookUpdateRequest } from '../models/WebhookUpdateRequest';
|
|
118
|
+
export interface AddCredentialAccountRequest {
|
|
119
|
+
profile: string;
|
|
120
|
+
credential: CredentialId;
|
|
121
|
+
setCredentialKeyRequest: SetCredentialKeyRequest;
|
|
122
|
+
}
|
|
117
123
|
export interface AddEnvironmentRepoOperationRequest {
|
|
118
124
|
environmentId: string;
|
|
119
125
|
addEnvironmentRepoRequest: AddEnvironmentRepoRequest;
|
|
@@ -191,6 +197,11 @@ export interface CreateUploadUrlRequest {
|
|
|
191
197
|
export interface CreateWebhookRequest {
|
|
192
198
|
webhookCreateRequest: WebhookCreateRequest;
|
|
193
199
|
}
|
|
200
|
+
export interface DeleteCredentialAccountRequest {
|
|
201
|
+
profile: string;
|
|
202
|
+
credential: CredentialId;
|
|
203
|
+
account: string;
|
|
204
|
+
}
|
|
194
205
|
export interface DeleteCredentialProfileRequest {
|
|
195
206
|
profile: string;
|
|
196
207
|
}
|
|
@@ -321,6 +332,10 @@ export interface LimitsRequest {
|
|
|
321
332
|
xBoatOrg?: string;
|
|
322
333
|
teamId?: string;
|
|
323
334
|
}
|
|
335
|
+
export interface ListCredentialAccountsRequest {
|
|
336
|
+
profile: string;
|
|
337
|
+
credential: CredentialId;
|
|
338
|
+
}
|
|
324
339
|
export interface ListSandboxSnapshotsRequest {
|
|
325
340
|
sandboxId: string;
|
|
326
341
|
limit?: number;
|
|
@@ -444,6 +459,11 @@ export interface StopCommandRequest {
|
|
|
444
459
|
sandboxId: string;
|
|
445
460
|
processId: number;
|
|
446
461
|
}
|
|
462
|
+
export interface SwitchCredentialAccountRequest {
|
|
463
|
+
profile: string;
|
|
464
|
+
credential: CredentialId;
|
|
465
|
+
account: string;
|
|
466
|
+
}
|
|
447
467
|
export interface UpdateRequest {
|
|
448
468
|
sandboxId: string;
|
|
449
469
|
updateSandboxRequest: UpdateSandboxRequest;
|
|
@@ -490,6 +510,20 @@ export interface WriteFileRequest {
|
|
|
490
510
|
*
|
|
491
511
|
*/
|
|
492
512
|
export declare class BoatApi extends runtime.BaseAPI {
|
|
513
|
+
/**
|
|
514
|
+
* Creates request options for addCredentialAccount without sending the request
|
|
515
|
+
*/
|
|
516
|
+
addCredentialAccountRequestOpts(input: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>): Promise<runtime.RequestOpts>;
|
|
517
|
+
/**
|
|
518
|
+
* Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
|
|
519
|
+
* Add another API key to a credential
|
|
520
|
+
*/
|
|
521
|
+
addCredentialAccountRaw(requestParameters: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
|
|
522
|
+
/**
|
|
523
|
+
* Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
|
|
524
|
+
* Add another API key to a credential
|
|
525
|
+
*/
|
|
526
|
+
addCredentialAccount(requestParameters: AddCredentialAccountRequest | runtime.FlatBody<AddCredentialAccountRequest, 'setCredentialKeyRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
|
|
493
527
|
/**
|
|
494
528
|
* Creates request options for addEnvironmentRepo without sending the request
|
|
495
529
|
*/
|
|
@@ -742,6 +776,20 @@ export declare class BoatApi extends runtime.BaseAPI {
|
|
|
742
776
|
* Create webhook
|
|
743
777
|
*/
|
|
744
778
|
createWebhook(requestParameters: CreateWebhookRequest | runtime.FlatBody<CreateWebhookRequest, 'webhookCreateRequest'>, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WebhookSecretResponse>;
|
|
779
|
+
/**
|
|
780
|
+
* Creates request options for deleteCredentialAccount without sending the request
|
|
781
|
+
*/
|
|
782
|
+
deleteCredentialAccountRequestOpts(requestParameters: DeleteCredentialAccountRequest): Promise<runtime.RequestOpts>;
|
|
783
|
+
/**
|
|
784
|
+
* Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
|
|
785
|
+
* Forget an account of a credential
|
|
786
|
+
*/
|
|
787
|
+
deleteCredentialAccountRaw(requestParameters: DeleteCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
|
|
788
|
+
/**
|
|
789
|
+
* Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
|
|
790
|
+
* Forget an account of a credential
|
|
791
|
+
*/
|
|
792
|
+
deleteCredentialAccount(requestParameters: DeleteCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
|
|
745
793
|
/**
|
|
746
794
|
* Creates request options for deleteCredentialProfile without sending the request
|
|
747
795
|
*/
|
|
@@ -1228,6 +1276,20 @@ export declare class BoatApi extends runtime.BaseAPI {
|
|
|
1228
1276
|
* Get Boat limits
|
|
1229
1277
|
*/
|
|
1230
1278
|
limits(requestParameters?: LimitsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<LimitsResponse>;
|
|
1279
|
+
/**
|
|
1280
|
+
* Creates request options for listCredentialAccounts without sending the request
|
|
1281
|
+
*/
|
|
1282
|
+
listCredentialAccountsRequestOpts(requestParameters: ListCredentialAccountsRequest): Promise<runtime.RequestOpts>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
|
|
1285
|
+
* List the accounts of a credential
|
|
1286
|
+
*/
|
|
1287
|
+
listCredentialAccountsRaw(requestParameters: ListCredentialAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
|
|
1288
|
+
/**
|
|
1289
|
+
* Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
|
|
1290
|
+
* List the accounts of a credential
|
|
1291
|
+
*/
|
|
1292
|
+
listCredentialAccounts(requestParameters: ListCredentialAccountsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
|
|
1231
1293
|
/**
|
|
1232
1294
|
* Creates request options for listCredentialProfiles without sending the request
|
|
1233
1295
|
*/
|
|
@@ -1716,6 +1778,20 @@ export declare class BoatApi extends runtime.BaseAPI {
|
|
|
1716
1778
|
* Stop a detached command
|
|
1717
1779
|
*/
|
|
1718
1780
|
stopCommand(requestParameters: StopCommandRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CommandStopResponse>;
|
|
1781
|
+
/**
|
|
1782
|
+
* Creates request options for switchCredentialAccount without sending the request
|
|
1783
|
+
*/
|
|
1784
|
+
switchCredentialAccountRequestOpts(requestParameters: SwitchCredentialAccountRequest): Promise<runtime.RequestOpts>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
|
|
1787
|
+
* Switch a credential to another account
|
|
1788
|
+
*/
|
|
1789
|
+
switchCredentialAccountRaw(requestParameters: SwitchCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CredentialAccountsResponse>>;
|
|
1790
|
+
/**
|
|
1791
|
+
* Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
|
|
1792
|
+
* Switch a credential to another account
|
|
1793
|
+
*/
|
|
1794
|
+
switchCredentialAccount(requestParameters: SwitchCredentialAccountRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CredentialAccountsResponse>;
|
|
1719
1795
|
/**
|
|
1720
1796
|
* Creates request options for update without sending the request
|
|
1721
1797
|
*/
|
package/dist/apis/BoatApi.js
CHANGED
|
@@ -71,6 +71,7 @@ const CreateSandboxEnvironmentRequest_1 = require("../models/CreateSandboxEnviro
|
|
|
71
71
|
const CreateSandboxRequest_1 = require("../models/CreateSandboxRequest");
|
|
72
72
|
const CreateSandboxResponse_1 = require("../models/CreateSandboxResponse");
|
|
73
73
|
const CreateScopedApiKeyRequest_1 = require("../models/CreateScopedApiKeyRequest");
|
|
74
|
+
const CredentialAccountsResponse_1 = require("../models/CredentialAccountsResponse");
|
|
74
75
|
const CredentialProfileDeletedResponse_1 = require("../models/CredentialProfileDeletedResponse");
|
|
75
76
|
const CredentialProfileListResponse_1 = require("../models/CredentialProfileListResponse");
|
|
76
77
|
const CredentialProfileResponse_1 = require("../models/CredentialProfileResponse");
|
|
@@ -155,6 +156,58 @@ const WebhookUpdateRequest_1 = require("../models/WebhookUpdateRequest");
|
|
|
155
156
|
*
|
|
156
157
|
*/
|
|
157
158
|
class BoatApi extends runtime.BaseAPI {
|
|
159
|
+
/**
|
|
160
|
+
* Creates request options for addCredentialAccount without sending the request
|
|
161
|
+
*/
|
|
162
|
+
async addCredentialAccountRequestOpts(input) {
|
|
163
|
+
const requestParameters = runtime.unflattenBody(input, 'setCredentialKeyRequest', ['profile', 'credential'], []);
|
|
164
|
+
if (requestParameters['profile'] == null) {
|
|
165
|
+
throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling addCredentialAccount().');
|
|
166
|
+
}
|
|
167
|
+
if (requestParameters['credential'] == null) {
|
|
168
|
+
throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling addCredentialAccount().');
|
|
169
|
+
}
|
|
170
|
+
if (requestParameters['setCredentialKeyRequest'] == null) {
|
|
171
|
+
throw new runtime.RequiredError('setCredentialKeyRequest', 'Required parameter "setCredentialKeyRequest" was null or undefined when calling addCredentialAccount().');
|
|
172
|
+
}
|
|
173
|
+
const queryParameters = {};
|
|
174
|
+
const headerParameters = {};
|
|
175
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
176
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
177
|
+
const token = this.configuration.accessToken;
|
|
178
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
179
|
+
if (tokenString) {
|
|
180
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}`;
|
|
184
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
185
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
186
|
+
return {
|
|
187
|
+
path: urlPath,
|
|
188
|
+
method: 'POST',
|
|
189
|
+
headers: headerParameters,
|
|
190
|
+
query: queryParameters,
|
|
191
|
+
body: (0, SetCredentialKeyRequest_1.SetCredentialKeyRequestToJSON)(requestParameters['setCredentialKeyRequest']),
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
|
|
196
|
+
* Add another API key to a credential
|
|
197
|
+
*/
|
|
198
|
+
async addCredentialAccountRaw(requestParameters, initOverrides) {
|
|
199
|
+
const requestOptions = await this.addCredentialAccountRequestOpts(requestParameters);
|
|
200
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
201
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, CredentialAccountsResponse_1.CredentialAccountsResponseFromJSON)(jsonValue));
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Adds an API key as another account of the credential, ready to switch to. The first key of a credential becomes the one in use. A sign-in returns `400 not_an_api_key`; add another sign-in with \"Add another account\" on the dashboard. Needs an API key with `account.admin`.
|
|
205
|
+
* Add another API key to a credential
|
|
206
|
+
*/
|
|
207
|
+
async addCredentialAccount(requestParameters, initOverrides) {
|
|
208
|
+
const response = await this.addCredentialAccountRaw(requestParameters, initOverrides);
|
|
209
|
+
return await response.value();
|
|
210
|
+
}
|
|
158
211
|
/**
|
|
159
212
|
* Creates request options for addEnvironmentRepo without sending the request
|
|
160
213
|
*/
|
|
@@ -1010,6 +1063,56 @@ class BoatApi extends runtime.BaseAPI {
|
|
|
1010
1063
|
const response = await this.createWebhookRaw(requestParameters, initOverrides);
|
|
1011
1064
|
return await response.value();
|
|
1012
1065
|
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Creates request options for deleteCredentialAccount without sending the request
|
|
1068
|
+
*/
|
|
1069
|
+
async deleteCredentialAccountRequestOpts(requestParameters) {
|
|
1070
|
+
if (requestParameters['profile'] == null) {
|
|
1071
|
+
throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling deleteCredentialAccount().');
|
|
1072
|
+
}
|
|
1073
|
+
if (requestParameters['credential'] == null) {
|
|
1074
|
+
throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling deleteCredentialAccount().');
|
|
1075
|
+
}
|
|
1076
|
+
if (requestParameters['account'] == null) {
|
|
1077
|
+
throw new runtime.RequiredError('account', 'Required parameter "account" was null or undefined when calling deleteCredentialAccount().');
|
|
1078
|
+
}
|
|
1079
|
+
const queryParameters = {};
|
|
1080
|
+
const headerParameters = {};
|
|
1081
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
1082
|
+
const token = this.configuration.accessToken;
|
|
1083
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
1084
|
+
if (tokenString) {
|
|
1085
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}/{account}`;
|
|
1089
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
1090
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
1091
|
+
urlPath = urlPath.replace('{account}', encodeURIComponent(String(requestParameters['account'])));
|
|
1092
|
+
return {
|
|
1093
|
+
path: urlPath,
|
|
1094
|
+
method: 'DELETE',
|
|
1095
|
+
headers: headerParameters,
|
|
1096
|
+
query: queryParameters,
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
|
|
1101
|
+
* Forget an account of a credential
|
|
1102
|
+
*/
|
|
1103
|
+
async deleteCredentialAccountRaw(requestParameters, initOverrides) {
|
|
1104
|
+
const requestOptions = await this.deleteCredentialAccountRequestOpts(requestParameters);
|
|
1105
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
1106
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, CredentialAccountsResponse_1.CredentialAccountsResponseFromJSON)(jsonValue));
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Deletes an account. For the account in use, the credential switches to another account first, or is removed when it was the last one. Needs an API key with `account.admin`.
|
|
1110
|
+
* Forget an account of a credential
|
|
1111
|
+
*/
|
|
1112
|
+
async deleteCredentialAccount(requestParameters, initOverrides) {
|
|
1113
|
+
const response = await this.deleteCredentialAccountRaw(requestParameters, initOverrides);
|
|
1114
|
+
return await response.value();
|
|
1115
|
+
}
|
|
1013
1116
|
/**
|
|
1014
1117
|
* Creates request options for deleteCredentialProfile without sending the request
|
|
1015
1118
|
*/
|
|
@@ -2583,6 +2686,52 @@ class BoatApi extends runtime.BaseAPI {
|
|
|
2583
2686
|
const response = await this.limitsRaw(requestParameters, initOverrides);
|
|
2584
2687
|
return await response.value();
|
|
2585
2688
|
}
|
|
2689
|
+
/**
|
|
2690
|
+
* Creates request options for listCredentialAccounts without sending the request
|
|
2691
|
+
*/
|
|
2692
|
+
async listCredentialAccountsRequestOpts(requestParameters) {
|
|
2693
|
+
if (requestParameters['profile'] == null) {
|
|
2694
|
+
throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling listCredentialAccounts().');
|
|
2695
|
+
}
|
|
2696
|
+
if (requestParameters['credential'] == null) {
|
|
2697
|
+
throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling listCredentialAccounts().');
|
|
2698
|
+
}
|
|
2699
|
+
const queryParameters = {};
|
|
2700
|
+
const headerParameters = {};
|
|
2701
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
2702
|
+
const token = this.configuration.accessToken;
|
|
2703
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
2704
|
+
if (tokenString) {
|
|
2705
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}`;
|
|
2709
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
2710
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
2711
|
+
return {
|
|
2712
|
+
path: urlPath,
|
|
2713
|
+
method: 'GET',
|
|
2714
|
+
headers: headerParameters,
|
|
2715
|
+
query: queryParameters,
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
/**
|
|
2719
|
+
* Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
|
|
2720
|
+
* List the accounts of a credential
|
|
2721
|
+
*/
|
|
2722
|
+
async listCredentialAccountsRaw(requestParameters, initOverrides) {
|
|
2723
|
+
const requestOptions = await this.listCredentialAccountsRequestOpts(requestParameters);
|
|
2724
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
2725
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, CredentialAccountsResponse_1.CredentialAccountsResponseFromJSON)(jsonValue));
|
|
2726
|
+
}
|
|
2727
|
+
/**
|
|
2728
|
+
* Every account of one credential (several ChatGPT sign-ins, several OpenAI keys), in the order they were added, the one in use marked. Labels only, never a secret. Needs an API key with `account.admin`, on a profile you manage: an org member who only uses an org profile gets `403`.
|
|
2729
|
+
* List the accounts of a credential
|
|
2730
|
+
*/
|
|
2731
|
+
async listCredentialAccounts(requestParameters, initOverrides) {
|
|
2732
|
+
const response = await this.listCredentialAccountsRaw(requestParameters, initOverrides);
|
|
2733
|
+
return await response.value();
|
|
2734
|
+
}
|
|
2586
2735
|
/**
|
|
2587
2736
|
* Creates request options for listCredentialProfiles without sending the request
|
|
2588
2737
|
*/
|
|
@@ -4173,6 +4322,56 @@ class BoatApi extends runtime.BaseAPI {
|
|
|
4173
4322
|
const response = await this.stopCommandRaw(requestParameters, initOverrides);
|
|
4174
4323
|
return await response.value();
|
|
4175
4324
|
}
|
|
4325
|
+
/**
|
|
4326
|
+
* Creates request options for switchCredentialAccount without sending the request
|
|
4327
|
+
*/
|
|
4328
|
+
async switchCredentialAccountRequestOpts(requestParameters) {
|
|
4329
|
+
if (requestParameters['profile'] == null) {
|
|
4330
|
+
throw new runtime.RequiredError('profile', 'Required parameter "profile" was null or undefined when calling switchCredentialAccount().');
|
|
4331
|
+
}
|
|
4332
|
+
if (requestParameters['credential'] == null) {
|
|
4333
|
+
throw new runtime.RequiredError('credential', 'Required parameter "credential" was null or undefined when calling switchCredentialAccount().');
|
|
4334
|
+
}
|
|
4335
|
+
if (requestParameters['account'] == null) {
|
|
4336
|
+
throw new runtime.RequiredError('account', 'Required parameter "account" was null or undefined when calling switchCredentialAccount().');
|
|
4337
|
+
}
|
|
4338
|
+
const queryParameters = {};
|
|
4339
|
+
const headerParameters = {};
|
|
4340
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
4341
|
+
const token = this.configuration.accessToken;
|
|
4342
|
+
const tokenString = await token("BoatBearerAuth", []);
|
|
4343
|
+
if (tokenString) {
|
|
4344
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
let urlPath = `/credential-profiles/{profile}/accounts/{credential}/{account}/active`;
|
|
4348
|
+
urlPath = urlPath.replace('{profile}', encodeURIComponent(String(requestParameters['profile'])));
|
|
4349
|
+
urlPath = urlPath.replace('{credential}', encodeURIComponent(String(requestParameters['credential'])));
|
|
4350
|
+
urlPath = urlPath.replace('{account}', encodeURIComponent(String(requestParameters['account'])));
|
|
4351
|
+
return {
|
|
4352
|
+
path: urlPath,
|
|
4353
|
+
method: 'PUT',
|
|
4354
|
+
headers: headerParameters,
|
|
4355
|
+
query: queryParameters,
|
|
4356
|
+
};
|
|
4357
|
+
}
|
|
4358
|
+
/**
|
|
4359
|
+
* Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
|
|
4360
|
+
* Switch a credential to another account
|
|
4361
|
+
*/
|
|
4362
|
+
async switchCredentialAccountRaw(requestParameters, initOverrides) {
|
|
4363
|
+
const requestOptions = await this.switchCredentialAccountRequestOpts(requestParameters);
|
|
4364
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
4365
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, CredentialAccountsResponse_1.CredentialAccountsResponseFromJSON)(jsonValue));
|
|
4366
|
+
}
|
|
4367
|
+
/**
|
|
4368
|
+
* Makes this account the one in use; the previous one stays as another account. Switching to the account already in use changes nothing. Every sandbox that uses the profile gets it at once, running ones included, with no restart. Use it when one account runs out of credits. Needs an API key with `account.admin`.
|
|
4369
|
+
* Switch a credential to another account
|
|
4370
|
+
*/
|
|
4371
|
+
async switchCredentialAccount(requestParameters, initOverrides) {
|
|
4372
|
+
const response = await this.switchCredentialAccountRaw(requestParameters, initOverrides);
|
|
4373
|
+
return await response.value();
|
|
4374
|
+
}
|
|
4176
4375
|
/**
|
|
4177
4376
|
* Creates request options for update without sending the request
|
|
4178
4377
|
*/
|
package/dist/boat-helpers.d.ts
CHANGED
|
@@ -76,3 +76,26 @@ export type StreamCommandOptions = {
|
|
|
76
76
|
* sent to a starting sandbox for up to 60 s instead of refusing it.
|
|
77
77
|
*/
|
|
78
78
|
export declare function streamCommand(api: BoatApi, sandboxId: string, command: string, options?: StreamCommandOptions): AsyncGenerator<CommandFrame>;
|
|
79
|
+
export type FollowCommandOptions = {
|
|
80
|
+
signal?: AbortSignal;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Yield a detached command's output from its start until it ends: `stdout`/`stderr`
|
|
84
|
+
* chunks (`frame.data`), then exactly one `exit` (`exitCode`, ...) or `error`
|
|
85
|
+
* (`message`). The server ends each connection after 10 minutes; this reconnects
|
|
86
|
+
* from the same offsets, with no gap and no repeat. A network cut is reconnected
|
|
87
|
+
* the same way for up to 60 s.
|
|
88
|
+
*/
|
|
89
|
+
export declare function followCommand(api: BoatApi, sandboxId: string, processId: number, options?: FollowCommandOptions): AsyncGenerator<CommandFrame>;
|
|
90
|
+
export type RunCommandOptions = FollowCommandOptions & {
|
|
91
|
+
cwd?: string;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Run a command with no time limit and yield its output until it ends.
|
|
95
|
+
*
|
|
96
|
+
* The command runs detached, so it has no 600 s cap and survives a dropped
|
|
97
|
+
* connection. Frames: `{ type: 'started', processId }`, then the frames of
|
|
98
|
+
* `followCommand`. Stopping early leaves the command running: call
|
|
99
|
+
* `stopCommand({ sandboxId, processId })` to stop it.
|
|
100
|
+
*/
|
|
101
|
+
export declare function runCommand(api: BoatApi, sandboxId: string, command: string, options?: RunCommandOptions): AsyncGenerator<CommandFrame>;
|
package/dist/boat-helpers.js
CHANGED
|
@@ -12,6 +12,8 @@ exports.readText = readText;
|
|
|
12
12
|
exports.writeText = writeText;
|
|
13
13
|
exports.execCommand = execCommand;
|
|
14
14
|
exports.streamCommand = streamCommand;
|
|
15
|
+
exports.followCommand = followCommand;
|
|
16
|
+
exports.runCommand = runCommand;
|
|
15
17
|
const terminalPromptStatuses = new Set(['finished', 'failed']);
|
|
16
18
|
function delay(ms) {
|
|
17
19
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -259,3 +261,98 @@ async function* streamCommand(api, sandboxId, command, options) {
|
|
|
259
261
|
await delay(1000);
|
|
260
262
|
}
|
|
261
263
|
}
|
|
264
|
+
// The server sends a heartbeat every 15 s, so 60 s of silence is a dead connection.
|
|
265
|
+
const ATTACH_IDLE_MS = 60000;
|
|
266
|
+
// After the first connection, a failed reconnect is tried again for this long.
|
|
267
|
+
const ATTACH_RETRY_MS = 60000;
|
|
268
|
+
function isNetworkError(e, signal) {
|
|
269
|
+
if ((signal === null || signal === void 0 ? void 0 : signal.aborted) || e instanceof SyntaxError)
|
|
270
|
+
return false;
|
|
271
|
+
return !(e === null || e === void 0 ? void 0 : e.response);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Yield a detached command's output from its start until it ends: `stdout`/`stderr`
|
|
275
|
+
* chunks (`frame.data`), then exactly one `exit` (`exitCode`, ...) or `error`
|
|
276
|
+
* (`message`). The server ends each connection after 10 minutes; this reconnects
|
|
277
|
+
* from the same offsets, with no gap and no repeat. A network cut is reconnected
|
|
278
|
+
* the same way for up to 60 s.
|
|
279
|
+
*/
|
|
280
|
+
async function* followCommand(api, sandboxId, processId, options) {
|
|
281
|
+
var _a, _b, _c;
|
|
282
|
+
var _d, _e, _f, _g;
|
|
283
|
+
const offsets = { stdout: 0, stderr: 0 };
|
|
284
|
+
let connected = false;
|
|
285
|
+
// Set at the first failure after a good connection; any good connection clears it.
|
|
286
|
+
let failingSince;
|
|
287
|
+
for (;;) {
|
|
288
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.signal) === null || _a === void 0 ? void 0 : _a.aborted)
|
|
289
|
+
throw (_d = options.signal.reason) !== null && _d !== void 0 ? _d : new Error('followCommand aborted');
|
|
290
|
+
// One controller per connection: the caller's signal, or 60 s with no line.
|
|
291
|
+
const connection = new AbortController();
|
|
292
|
+
const abort = () => connection.abort();
|
|
293
|
+
(_b = options === null || options === void 0 ? void 0 : options.signal) === null || _b === void 0 ? void 0 : _b.addEventListener('abort', abort);
|
|
294
|
+
let idle;
|
|
295
|
+
const touch = () => {
|
|
296
|
+
clearTimeout(idle);
|
|
297
|
+
idle = setTimeout(abort, ATTACH_IDLE_MS);
|
|
298
|
+
};
|
|
299
|
+
try {
|
|
300
|
+
touch();
|
|
301
|
+
const response = await api.attachCommandRaw({ sandboxId, processId, stdoutOffset: offsets.stdout, stderrOffset: offsets.stderr }, { signal: connection.signal });
|
|
302
|
+
connected = true;
|
|
303
|
+
failingSince = undefined;
|
|
304
|
+
for await (const frame of ndjsonFrames(response.raw)) {
|
|
305
|
+
touch();
|
|
306
|
+
if (frame.type === 'stdout' || frame.type === 'stderr') {
|
|
307
|
+
offsets[frame.type] = (_e = frame.nextOffset) !== null && _e !== void 0 ? _e : offsets[frame.type];
|
|
308
|
+
yield frame;
|
|
309
|
+
}
|
|
310
|
+
else if (frame.type === 'exit' || frame.type === 'error') {
|
|
311
|
+
yield frame;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
// attached, heartbeat, reconnect: ours to handle, never the caller's.
|
|
316
|
+
offsets.stdout = (_f = frame.stdoutOffset) !== null && _f !== void 0 ? _f : offsets.stdout;
|
|
317
|
+
offsets.stderr = (_g = frame.stderrOffset) !== null && _g !== void 0 ? _g : offsets.stderr;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
catch (e) {
|
|
322
|
+
failingSince !== null && failingSince !== void 0 ? failingSince : (failingSince = Date.now());
|
|
323
|
+
if (!isNetworkError(e, options === null || options === void 0 ? void 0 : options.signal) || !connected || Date.now() - failingSince >= ATTACH_RETRY_MS)
|
|
324
|
+
throw e;
|
|
325
|
+
await delay(1000);
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
clearTimeout(idle);
|
|
329
|
+
(_c = options === null || options === void 0 ? void 0 : options.signal) === null || _c === void 0 ? void 0 : _c.removeEventListener('abort', abort);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Run a command with no time limit and yield its output until it ends.
|
|
335
|
+
*
|
|
336
|
+
* The command runs detached, so it has no 600 s cap and survives a dropped
|
|
337
|
+
* connection. Frames: `{ type: 'started', processId }`, then the frames of
|
|
338
|
+
* `followCommand`. Stopping early leaves the command running: call
|
|
339
|
+
* `stopCommand({ sandboxId, processId })` to stop it.
|
|
340
|
+
*/
|
|
341
|
+
async function* runCommand(api, sandboxId, command, options) {
|
|
342
|
+
const deadline = Date.now() + STREAM_RETRY_MS;
|
|
343
|
+
let processId;
|
|
344
|
+
for (;;) {
|
|
345
|
+
try {
|
|
346
|
+
const started = await api.command({ sandboxId, commandRequest: { command, cwd: options === null || options === void 0 ? void 0 : options.cwd, detached: true } });
|
|
347
|
+
processId = started.processId;
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
catch (e) {
|
|
351
|
+
if (Date.now() + 1000 >= deadline || !(await isRetryable(e)))
|
|
352
|
+
throw e;
|
|
353
|
+
}
|
|
354
|
+
await delay(1000);
|
|
355
|
+
}
|
|
356
|
+
yield { type: 'started', processId };
|
|
357
|
+
yield* followCommand(api, sandboxId, processId, options);
|
|
358
|
+
}
|