@boatdev/sdk 1.0.1 → 1.2.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.
Files changed (55) hide show
  1. package/.openapi-generator/FILES +2 -0
  2. package/README.md +8 -26
  3. package/dist/apis/BoatApi.d.ts +99 -80
  4. package/dist/apis/BoatApi.js +103 -28
  5. package/dist/esm/apis/BoatApi.d.ts +99 -80
  6. package/dist/esm/apis/BoatApi.js +103 -28
  7. package/dist/esm/models/CreateSandboxRequest.d.ts +6 -0
  8. package/dist/esm/models/CreateSandboxRequest.js +2 -0
  9. package/dist/esm/models/DataRetentionPolicyResponse.d.ts +12 -0
  10. package/dist/esm/models/DataRetentionPolicyResponse.js +4 -0
  11. package/dist/esm/models/DataRetentionUpdateRequest.d.ts +8 -2
  12. package/dist/esm/models/DataRetentionUpdateRequest.js +3 -3
  13. package/dist/esm/models/DeletionOperation.d.ts +24 -0
  14. package/dist/esm/models/DeletionOperation.js +15 -0
  15. package/dist/esm/models/DeletionOperationListResponse.d.ts +52 -0
  16. package/dist/esm/models/DeletionOperationListResponse.js +58 -0
  17. package/dist/esm/models/Sandbox.d.ts +6 -0
  18. package/dist/esm/models/Sandbox.js +2 -0
  19. package/dist/esm/models/index.d.ts +1 -0
  20. package/dist/esm/models/index.js +1 -0
  21. package/dist/esm/runtime.d.ts +8 -0
  22. package/dist/esm/runtime.js +18 -0
  23. package/dist/models/CreateSandboxRequest.d.ts +6 -0
  24. package/dist/models/CreateSandboxRequest.js +2 -0
  25. package/dist/models/DataRetentionPolicyResponse.d.ts +12 -0
  26. package/dist/models/DataRetentionPolicyResponse.js +4 -0
  27. package/dist/models/DataRetentionUpdateRequest.d.ts +8 -2
  28. package/dist/models/DataRetentionUpdateRequest.js +3 -3
  29. package/dist/models/DeletionOperation.d.ts +24 -0
  30. package/dist/models/DeletionOperation.js +16 -1
  31. package/dist/models/DeletionOperationListResponse.d.ts +52 -0
  32. package/dist/models/DeletionOperationListResponse.js +66 -0
  33. package/dist/models/Sandbox.d.ts +6 -0
  34. package/dist/models/Sandbox.js +2 -0
  35. package/dist/models/index.d.ts +1 -0
  36. package/dist/models/index.js +1 -0
  37. package/dist/runtime.d.ts +8 -0
  38. package/dist/runtime.js +19 -0
  39. package/docs/BoatApi.md +80 -1
  40. package/docs/CreateSandboxRequest.md +2 -0
  41. package/docs/DataRetentionPolicyResponse.md +4 -0
  42. package/docs/DataRetentionUpdateRequest.md +3 -0
  43. package/docs/DeletionOperation.md +4 -0
  44. package/docs/DeletionOperationListResponse.md +36 -0
  45. package/docs/Sandbox.md +2 -0
  46. package/package.json +1 -1
  47. package/src/apis/BoatApi.ts +182 -80
  48. package/src/models/CreateSandboxRequest.ts +8 -0
  49. package/src/models/DataRetentionPolicyResponse.ts +16 -0
  50. package/src/models/DataRetentionUpdateRequest.ts +11 -4
  51. package/src/models/DeletionOperation.ts +29 -0
  52. package/src/models/DeletionOperationListResponse.ts +102 -0
  53. package/src/models/Sandbox.ts +8 -0
  54. package/src/models/index.ts +1 -0
  55. package/src/runtime.ts +23 -0
@@ -49,6 +49,12 @@ export interface CreateSandboxRequest {
49
49
  * @memberof CreateSandboxRequest
50
50
  */
51
51
  noEnv?: boolean;
52
+ /**
53
+ * Pass `false` to never snapshot this sandbox. Nothing is captured in the background, so it pays no CPU or memory for it, and stopping it erases its disk the way zero data retention does. It cannot be resumed, forked, or saved as a named snapshot, and if its machine fails there is no backup to rebuild it from.
54
+ * @type {boolean}
55
+ * @memberof CreateSandboxRequest
56
+ */
57
+ snapshots?: boolean;
52
58
  /**
53
59
  * Shell script that runs on the sandbox after it is ready. Ready means "ready to accept the user", not "setup done": the script starts in the background once provisioning completes and never blocks the sandbox becoming usable. It runs as the sandbox user via `bash`, with the sandbox's environment applied, and its output goes to a log file on the sandbox. Observe the outcome as `setupStatus` (pending/running/done/failed) and `setupError` on the sandbox. Rejected with a 400 `invalid_setup_script` error when it is not a string or exceeds 64KB.
54
60
  * @type {string}
@@ -109,6 +115,7 @@ export function CreateSandboxRequestFromJSONTyped(json: any, ignoreDiscriminator
109
115
  'env': json['env'] == null ? undefined : json['env'],
110
116
  'environment': json['environment'] == null ? undefined : json['environment'],
111
117
  'noEnv': json['noEnv'] == null ? undefined : json['noEnv'],
118
+ 'snapshots': json['snapshots'] == null ? undefined : json['snapshots'],
112
119
  'setupScript': json['setupScript'] == null ? undefined : json['setupScript'],
113
120
  'org': json['org'] == null ? undefined : json['org'],
114
121
  'teamId': json['teamId'] == null ? undefined : json['teamId'],
@@ -132,6 +139,7 @@ export function CreateSandboxRequestToJSONTyped(value?: CreateSandboxRequest | n
132
139
  'env': value['env'],
133
140
  'environment': value['environment'],
134
141
  'noEnv': value['noEnv'],
142
+ 'snapshots': value['snapshots'],
135
143
  'setupScript': value['setupScript'],
136
144
  'org': value['org'],
137
145
  'teamId': value['teamId'],
@@ -55,6 +55,18 @@ export interface DataRetentionPolicyResponse {
55
55
  * @memberof DataRetentionPolicyResponse
56
56
  */
57
57
  acceptedDeletionOperationsIrreversible?: boolean;
58
+ /**
59
+ * When true, every new sandbox of this account is created with snapshots off.
60
+ * @type {boolean}
61
+ * @memberof DataRetentionPolicyResponse
62
+ */
63
+ snapshotsOff?: boolean;
64
+ /**
65
+ *
66
+ * @type {Date}
67
+ * @memberof DataRetentionPolicyResponse
68
+ */
69
+ snapshotsOffAt?: Date | null;
58
70
  }
59
71
 
60
72
 
@@ -95,6 +107,8 @@ export function DataRetentionPolicyResponseFromJSONTyped(json: any, ignoreDiscri
95
107
  'enabledAt': (json['enabledAt'] == null ? null : new Date(json['enabledAt'])),
96
108
  'queuedSandboxes': json['queuedSandboxes'] == null ? undefined : json['queuedSandboxes'],
97
109
  'acceptedDeletionOperationsIrreversible': json['acceptedDeletionOperationsIrreversible'] == null ? undefined : json['acceptedDeletionOperationsIrreversible'],
110
+ 'snapshotsOff': json['snapshotsOff'] == null ? undefined : json['snapshotsOff'],
111
+ 'snapshotsOffAt': json['snapshotsOffAt'] == null ? undefined : (new Date(json['snapshotsOffAt'])),
98
112
  };
99
113
  }
100
114
 
@@ -115,6 +129,8 @@ export function DataRetentionPolicyResponseToJSONTyped(value?: DataRetentionPoli
115
129
  'enabledAt': value['enabledAt'] == null ? value['enabledAt'] : value['enabledAt'].toISOString(),
116
130
  'queuedSandboxes': value['queuedSandboxes'],
117
131
  'acceptedDeletionOperationsIrreversible': value['acceptedDeletionOperationsIrreversible'],
132
+ 'snapshotsOff': value['snapshotsOff'],
133
+ 'snapshotsOffAt': value['snapshotsOffAt'] == null ? value['snapshotsOffAt'] : value['snapshotsOffAt'].toISOString(),
118
134
  };
119
135
  }
120
136
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  import { mapValues } from '../runtime';
16
16
  /**
17
- *
17
+ * Pass `enabled` to change zero data retention, or `snapshotsOff` alone to change the account's snapshots-off setting.
18
18
  * @export
19
19
  * @interface DataRetentionUpdateRequest
20
20
  */
@@ -24,7 +24,13 @@ export interface DataRetentionUpdateRequest {
24
24
  * @type {boolean}
25
25
  * @memberof DataRetentionUpdateRequest
26
26
  */
27
- enabled: boolean;
27
+ enabled?: boolean;
28
+ /**
29
+ * Turn snapshots off for every sandbox created from now on. Existing sandboxes keep their setting. While on, a create or fork that passes `snapshots: true` is refused with 409 `snapshots_off_for_account`.
30
+ * @type {boolean}
31
+ * @memberof DataRetentionUpdateRequest
32
+ */
33
+ snapshotsOff?: boolean;
28
34
  /**
29
35
  * Required when enabling and must exactly equal `delete archived sandbox data`.
30
36
  * @type {DataRetentionUpdateRequestConfirmationEnum}
@@ -47,7 +53,6 @@ export type DataRetentionUpdateRequestConfirmationEnum = typeof DataRetentionUpd
47
53
  * Check if a given object implements the DataRetentionUpdateRequest interface.
48
54
  */
49
55
  export function instanceOfDataRetentionUpdateRequest(value: object): value is DataRetentionUpdateRequest {
50
- if (!('enabled' in value) || value['enabled'] === undefined) return false;
51
56
  return true;
52
57
  }
53
58
 
@@ -61,7 +66,8 @@ export function DataRetentionUpdateRequestFromJSONTyped(json: any, ignoreDiscrim
61
66
  }
62
67
  return {
63
68
 
64
- 'enabled': json['enabled'],
69
+ 'enabled': json['enabled'] == null ? undefined : json['enabled'],
70
+ 'snapshotsOff': json['snapshotsOff'] == null ? undefined : json['snapshotsOff'],
65
71
  'confirmation': json['confirmation'] == null ? undefined : json['confirmation'],
66
72
  };
67
73
  }
@@ -78,6 +84,7 @@ export function DataRetentionUpdateRequestToJSONTyped(value?: DataRetentionUpdat
78
84
  return {
79
85
 
80
86
  'enabled': value['enabled'],
87
+ 'snapshotsOff': value['snapshotsOff'],
81
88
  'confirmation': value['confirmation'],
82
89
  };
83
90
  }
@@ -49,6 +49,18 @@ export interface DeletionOperation {
49
49
  * @memberof DeletionOperation
50
50
  */
51
51
  status: DeletionOperationStatusEnum;
52
+ /**
53
+ * What the background purge is doing. The target is already gone from every list, restore and fork once the operation exists. `waiting_for_uploads`: stored data is erased once the last upload URL issued for it expires (`expectedBy`). `kept_for_newer_snapshots`: a newer snapshot you kept is built on this one; its data goes when they go. `waiting_for_restore`: a sandbox is still restoring from it. `retrying`: a transient fault, retried automatically.
54
+ * @type {DeletionOperationStageEnum}
55
+ * @memberof DeletionOperation
56
+ */
57
+ stage?: DeletionOperationStageEnum;
58
+ /**
59
+ * When `waiting_for_uploads` ends.
60
+ * @type {Date}
61
+ * @memberof DeletionOperation
62
+ */
63
+ expectedBy?: Date | null;
52
64
  /**
53
65
  *
54
66
  * @type {number}
@@ -100,6 +112,19 @@ export const DeletionOperationStatusEnum = {
100
112
  } as const;
101
113
  export type DeletionOperationStatusEnum = typeof DeletionOperationStatusEnum[keyof typeof DeletionOperationStatusEnum];
102
114
 
115
+ /**
116
+ * @export
117
+ */
118
+ export const DeletionOperationStageEnum = {
119
+ Removing: 'removing',
120
+ WaitingForUploads: 'waiting_for_uploads',
121
+ KeptForNewerSnapshots: 'kept_for_newer_snapshots',
122
+ WaitingForRestore: 'waiting_for_restore',
123
+ Retrying: 'retrying',
124
+ Completed: 'completed'
125
+ } as const;
126
+ export type DeletionOperationStageEnum = typeof DeletionOperationStageEnum[keyof typeof DeletionOperationStageEnum];
127
+
103
128
 
104
129
  /**
105
130
  * Check if a given object implements the DeletionOperation interface.
@@ -131,6 +156,8 @@ export function DeletionOperationFromJSONTyped(json: any, ignoreDiscriminator: b
131
156
  'targetId': json['targetId'],
132
157
  'reason': json['reason'],
133
158
  'status': json['status'],
159
+ 'stage': json['stage'] == null ? undefined : json['stage'],
160
+ 'expectedBy': json['expectedBy'] == null ? undefined : (new Date(json['expectedBy'])),
134
161
  'attemptCount': json['attemptCount'],
135
162
  'requestedAt': (new Date(json['requestedAt'])),
136
163
  'completedAt': (json['completedAt'] == null ? null : new Date(json['completedAt'])),
@@ -153,6 +180,8 @@ export function DeletionOperationToJSONTyped(value?: DeletionOperation | null, i
153
180
  'targetId': value['targetId'],
154
181
  'reason': value['reason'],
155
182
  'status': value['status'],
183
+ 'stage': value['stage'],
184
+ 'expectedBy': value['expectedBy'] == null ? value['expectedBy'] : value['expectedBy'].toISOString(),
156
185
  'attemptCount': value['attemptCount'],
157
186
  'requestedAt': value['requestedAt'].toISOString(),
158
187
  'completedAt': value['completedAt'] == null ? value['completedAt'] : value['completedAt'].toISOString(),
@@ -0,0 +1,102 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Boat Public API v1
5
+ * Public JSON API for creating, operating, prompting, observing, and exposing sandboxes from backend services, CI jobs, hosted workers, and Boat automation products. The v1 reference intentionally documents the developer integration surface only. Dashboard billing actions are not part of v1.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { DeletionOperation } from './DeletionOperation';
17
+ import {
18
+ DeletionOperationFromJSON,
19
+ DeletionOperationFromJSONTyped,
20
+ DeletionOperationToJSON,
21
+ DeletionOperationToJSONTyped,
22
+ } from './DeletionOperation';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface DeletionOperationListResponse
28
+ */
29
+ export interface DeletionOperationListResponse {
30
+ /**
31
+ *
32
+ * @type {boolean}
33
+ * @memberof DeletionOperationListResponse
34
+ */
35
+ ok: boolean;
36
+ /**
37
+ *
38
+ * @type {DeletionOperationListResponseTypeEnum}
39
+ * @memberof DeletionOperationListResponse
40
+ */
41
+ type: DeletionOperationListResponseTypeEnum;
42
+ /**
43
+ *
44
+ * @type {Array<DeletionOperation>}
45
+ * @memberof DeletionOperationListResponse
46
+ */
47
+ operations: Array<DeletionOperation>;
48
+ }
49
+
50
+
51
+ /**
52
+ * @export
53
+ */
54
+ export const DeletionOperationListResponseTypeEnum = {
55
+ SnapshotDeleting: 'snapshot.deleting'
56
+ } as const;
57
+ export type DeletionOperationListResponseTypeEnum = typeof DeletionOperationListResponseTypeEnum[keyof typeof DeletionOperationListResponseTypeEnum];
58
+
59
+
60
+ /**
61
+ * Check if a given object implements the DeletionOperationListResponse interface.
62
+ */
63
+ export function instanceOfDeletionOperationListResponse(value: object): value is DeletionOperationListResponse {
64
+ if (!('ok' in value) || value['ok'] === undefined) return false;
65
+ if (!('type' in value) || value['type'] === undefined) return false;
66
+ if (!('operations' in value) || value['operations'] === undefined) return false;
67
+ return true;
68
+ }
69
+
70
+ export function DeletionOperationListResponseFromJSON(json: any): DeletionOperationListResponse {
71
+ return DeletionOperationListResponseFromJSONTyped(json, false);
72
+ }
73
+
74
+ export function DeletionOperationListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DeletionOperationListResponse {
75
+ if (json == null) {
76
+ return json;
77
+ }
78
+ return {
79
+
80
+ 'ok': json['ok'],
81
+ 'type': json['type'],
82
+ 'operations': ((json['operations'] as Array<any>).map(DeletionOperationFromJSON)),
83
+ };
84
+ }
85
+
86
+ export function DeletionOperationListResponseToJSON(json: any): DeletionOperationListResponse {
87
+ return DeletionOperationListResponseToJSONTyped(json, false);
88
+ }
89
+
90
+ export function DeletionOperationListResponseToJSONTyped(value?: DeletionOperationListResponse | null, ignoreDiscriminator: boolean = false): any {
91
+ if (value == null) {
92
+ return value;
93
+ }
94
+
95
+ return {
96
+
97
+ 'ok': value['ok'],
98
+ 'type': value['type'],
99
+ 'operations': ((value['operations'] as Array<any>).map(DeletionOperationToJSON)),
100
+ };
101
+ }
102
+
@@ -129,6 +129,12 @@ export interface Sandbox {
129
129
  * @memberof Sandbox
130
130
  */
131
131
  desktopUrl?: string | null;
132
+ /**
133
+ * False when the sandbox was created with snapshots off.
134
+ * @type {boolean}
135
+ * @memberof Sandbox
136
+ */
137
+ snapshots?: boolean;
132
138
  /**
133
139
  *
134
140
  * @type {boolean}
@@ -298,6 +304,7 @@ export function SandboxFromJSONTyped(json: any, ignoreDiscriminator: boolean): S
298
304
  'archiveAfter': json['archiveAfter'] == null ? undefined : (new Date(json['archiveAfter'])),
299
305
  'desktopAvailable': json['desktopAvailable'],
300
306
  'desktopUrl': json['desktopUrl'] == null ? undefined : json['desktopUrl'],
307
+ 'snapshots': json['snapshots'] == null ? undefined : json['snapshots'],
301
308
  'snapshotAvailable': json['snapshotAvailable'],
302
309
  'snapshotCompletedAt': json['snapshotCompletedAt'] == null ? undefined : (new Date(json['snapshotCompletedAt'])),
303
310
  'snapshotVerifiedAt': json['snapshotVerifiedAt'] == null ? undefined : (new Date(json['snapshotVerifiedAt'])),
@@ -340,6 +347,7 @@ export function SandboxToJSONTyped(value?: Sandbox | null, ignoreDiscriminator:
340
347
  'archiveAfter': value['archiveAfter'] == null ? value['archiveAfter'] : value['archiveAfter'].toISOString(),
341
348
  'desktopAvailable': value['desktopAvailable'],
342
349
  'desktopUrl': value['desktopUrl'],
350
+ 'snapshots': value['snapshots'],
343
351
  'snapshotAvailable': value['snapshotAvailable'],
344
352
  'snapshotCompletedAt': value['snapshotCompletedAt'] == null ? value['snapshotCompletedAt'] : value['snapshotCompletedAt'].toISOString(),
345
353
  'snapshotVerifiedAt': value['snapshotVerifiedAt'] == null ? value['snapshotVerifiedAt'] : value['snapshotVerifiedAt'].toISOString(),
@@ -33,6 +33,7 @@ export * from './CreateScopedApiKeyRequest';
33
33
  export * from './DataRetentionPolicyResponse';
34
34
  export * from './DataRetentionUpdateRequest';
35
35
  export * from './DeletionOperation';
36
+ export * from './DeletionOperationListResponse';
36
37
  export * from './DeletionOperationResponse';
37
38
  export * from './DesktopRequest';
38
39
  export * from './DesktopResponse';
package/src/runtime.ts CHANGED
@@ -447,3 +447,26 @@ export class TextApiResponse {
447
447
  return await this.raw.text();
448
448
  };
449
449
  }
450
+
451
+
452
+ /**
453
+ * A body-taking call's parameters with the body's fields inline, next to the
454
+ * path/query/header parameters: `fork({ sandboxId, type: 'small' })` is
455
+ * `fork({ sandboxId, forkRequest: { type: 'small' } })`. Both shapes are accepted.
456
+ */
457
+ export type FlatBody<R, K extends keyof R> = Omit<R, K> & NonNullable<R[K]>;
458
+
459
+ /** Turns either call shape into the wrapped one the generated code sends. */
460
+ export function unflattenBody<R>(input: object, bodyKey: string, paramKeys: string[], sharedKeys: string[]): R {
461
+ if (input == null || bodyKey in input) return input as R;
462
+ const params: any = {};
463
+ const body: any = {};
464
+ for (const [k, v] of Object.entries(input)) {
465
+ const isParam = paramKeys.indexOf(k) !== -1;
466
+ if (isParam) params[k] = v;
467
+ if (!isParam || sharedKeys.indexOf(k) !== -1) body[k] = v;
468
+ }
469
+ // No body field given: send no body, exactly like the wrapped call with the key omitted.
470
+ if (Object.keys(body).length > 0) params[bodyKey] = body;
471
+ return params as R;
472
+ }