@toshicloud/sdk 0.5.0 → 0.6.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 (76) hide show
  1. package/README.md +138 -41
  2. package/dist/client.d.ts +103 -4
  3. package/dist/client.js +43 -4
  4. package/dist/errors.d.ts +74 -22
  5. package/dist/errors.js +99 -27
  6. package/dist/gen/toshi/permission_pb.d.ts +207 -2
  7. package/dist/gen/toshi/permission_pb.js +54 -2
  8. package/dist/gen/toshi/workspace/v1/account_pb.d.ts +590 -0
  9. package/dist/gen/toshi/workspace/v1/account_pb.js +75 -0
  10. package/dist/gen/toshi/workspace/v1/artifacts_pb.d.ts +14 -8
  11. package/dist/gen/toshi/workspace/v1/artifacts_pb.js +9 -7
  12. package/dist/gen/toshi/workspace/v1/audit_events_pb.d.ts +191 -6
  13. package/dist/gen/toshi/workspace/v1/audit_events_pb.js +11 -1
  14. package/dist/gen/toshi/workspace/v1/channels_pb.d.ts +1194 -21
  15. package/dist/gen/toshi/workspace/v1/channels_pb.js +185 -39
  16. package/dist/gen/toshi/workspace/v1/connections_pb.d.ts +1616 -0
  17. package/dist/gen/toshi/workspace/v1/connections_pb.js +224 -0
  18. package/dist/gen/toshi/workspace/v1/discovery_pb.d.ts +291 -43
  19. package/dist/gen/toshi/workspace/v1/discovery_pb.js +79 -30
  20. package/dist/gen/toshi/workspace/v1/display_pb.d.ts +198 -15
  21. package/dist/gen/toshi/workspace/v1/display_pb.js +52 -2
  22. package/dist/gen/toshi/workspace/v1/domains_pb.d.ts +864 -0
  23. package/dist/gen/toshi/workspace/v1/domains_pb.js +152 -0
  24. package/dist/gen/toshi/workspace/v1/fillers_pb.d.ts +12 -4
  25. package/dist/gen/toshi/workspace/v1/fillers_pb.js +1 -1
  26. package/dist/gen/toshi/workspace/v1/grants_pb.d.ts +1297 -0
  27. package/dist/gen/toshi/workspace/v1/grants_pb.js +271 -0
  28. package/dist/gen/toshi/workspace/v1/hostjobs_pb.d.ts +329 -15
  29. package/dist/gen/toshi/workspace/v1/hostjobs_pb.js +10 -5
  30. package/dist/gen/toshi/workspace/v1/hosts_pb.d.ts +196 -7
  31. package/dist/gen/toshi/workspace/v1/hosts_pb.js +12 -7
  32. package/dist/gen/toshi/workspace/v1/images_pb.d.ts +1463 -0
  33. package/dist/gen/toshi/workspace/v1/images_pb.js +263 -0
  34. package/dist/gen/toshi/workspace/v1/products_pb.d.ts +99 -296
  35. package/dist/gen/toshi/workspace/v1/products_pb.js +7 -53
  36. package/dist/gen/toshi/workspace/v1/projects_pb.d.ts +1474 -99
  37. package/dist/gen/toshi/workspace/v1/projects_pb.js +150 -33
  38. package/dist/gen/toshi/workspace/v1/recordings_pb.d.ts +181 -14
  39. package/dist/gen/toshi/workspace/v1/recordings_pb.js +54 -14
  40. package/dist/gen/toshi/workspace/v1/roles_pb.d.ts +1994 -0
  41. package/dist/gen/toshi/workspace/v1/roles_pb.js +355 -0
  42. package/dist/gen/toshi/workspace/v1/secrets_pb.d.ts +314 -8
  43. package/dist/gen/toshi/workspace/v1/secrets_pb.js +42 -18
  44. package/dist/gen/toshi/workspace/v1/storage_providers_pb.d.ts +14 -0
  45. package/dist/gen/toshi/workspace/v1/storage_providers_pb.js +1 -1
  46. package/dist/gen/toshi/workspace/v1/tokens_pb.d.ts +434 -5
  47. package/dist/gen/toshi/workspace/v1/tokens_pb.js +65 -8
  48. package/dist/gen/toshi/workspace/v1/triggers_pb.d.ts +1099 -0
  49. package/dist/gen/toshi/workspace/v1/triggers_pb.js +185 -0
  50. package/dist/gen/toshi/workspace/v1/volumes_pb.d.ts +1052 -33
  51. package/dist/gen/toshi/workspace/v1/volumes_pb.js +169 -11
  52. package/dist/gen/toshi/workspace/v1/webhook_pb.d.ts +66 -8
  53. package/dist/gen/toshi/workspace/v1/webhook_pb.js +4 -4
  54. package/dist/gen/toshi/workspace/v1/workloads_pb.d.ts +2069 -54
  55. package/dist/gen/toshi/workspace/v1/workloads_pb.js +204 -54
  56. package/dist/gen/toshi/workspace/v1/workspace_pb.d.ts +6634 -933
  57. package/dist/gen/toshi/workspace/v1/workspace_pb.js +912 -93
  58. package/dist/gen/toshi/workspace/v1/workspace_service_pb.d.ts +3209 -1378
  59. package/dist/gen/toshi/workspace/v1/workspace_service_pb.js +211 -74
  60. package/dist/index.d.ts +8 -1
  61. package/dist/index.js +8 -1
  62. package/dist/interceptors.d.ts +6 -2
  63. package/dist/interceptors.js +13 -8
  64. package/dist/retry.d.ts +18 -0
  65. package/dist/retry.js +230 -23
  66. package/dist/test/alarms.d.ts +29 -0
  67. package/dist/test/alarms.js +144 -0
  68. package/dist/test/fake.js +31 -0
  69. package/dist/test/index.d.ts +12 -2
  70. package/dist/test/index.js +12 -2
  71. package/dist/test/procedures.js +96 -5
  72. package/dist/version.d.ts +1 -1
  73. package/dist/version.js +1 -1
  74. package/dist/wait.d.ts +4 -0
  75. package/dist/wait.js +24 -1
  76. package/package.json +3 -2
package/README.md CHANGED
@@ -4,7 +4,7 @@ A TypeScript client for the Toshi Workspace API, `toshi.workspace.v1`,
4
4
  published as ES modules with type declarations.
5
5
 
6
6
  ```sh
7
- npm install @toshicloud/sdk @connectrpc/connect
7
+ npm install @toshicloud/sdk @bufbuild/protobuf @connectrpc/connect
8
8
  ```
9
9
 
10
10
  The browser entry needs a transport such as `@connectrpc/connect-web`; the
@@ -68,13 +68,16 @@ entry reads `TOSHI_SERVER`, `TOSHI_TOKEN`, `TOSHI_TOKEN_FILE` and
68
68
  `environment` fields when they are empty. A value in the request wins.
69
69
  `environment` is left empty on a request with `shared: true`.
70
70
  - `retry`: `{ maxAttempts, initialBackoffMs, maxBackoffMs }`, by default
71
- 5, 200 ms and 10 s, with full jitter. `retry: false` turns off retries
72
- and watch reconnects.
71
+ 5, 200 ms and 10 s, with full jitter. Reads, and the calls whose request
72
+ takes a `request_key`, are retried; a stream and every other call is not.
73
+ `retry: false` turns off retries and watch reconnects.
73
74
  - `defaultTimeoutMs`: bounds each unary call except the Wait calls,
74
75
  which their request's timeout bounds; streams ignore it.
75
76
 
76
77
  A call may set `timeoutMs` instead: it bounds the whole call, retries
77
78
  included, and on a watch it bounds the open. It composes with `signal`.
79
+ `ToshiOptions` is the object the client takes, and `CallOptions` the second
80
+ argument of each call, which carries `signal` and `timeoutMs`.
78
81
 
79
82
  ### Node options
80
83
 
@@ -135,15 +138,25 @@ picked up without a new client.
135
138
  The client has one field per Workspace API service: `project`, `secret`,
136
139
  `webhook`, `display`, `channel`, `recording`, `volume`, `artifact`,
137
140
  `artifactUpload`, `workspace`, `hostJob`, `host`, `token`, `auditEvent`,
138
- `filler`, `storageProvider`, `product` and `discovery`, each holding that
139
- service's generated client.
141
+ `filler`, `grant`, `storageProvider`, `product`, `discovery`, `connection`,
142
+ `role`, `trigger`, `account`, `image` and `domain`, each holding that service's
143
+ generated client.
140
144
  `workload` holds `WorkloadService`'s calls, grouped by the type they
141
145
  name: `workload.jobs`, `workload.sandboxes` and `workload.services`, one
142
- method for each call (`create`, `get`, `list`, `update`, `delete`,
143
- `wait`, `watch`, and `cancel` on a job, `execute` on a sandbox, `start`,
144
- `stop`, `setMode`, `listRuns`, `wake`, `hold` and `release` on a service). The calls that
146
+ method for each call (`create`, `get`, `list`, `update`, `delete`, `wait`,
147
+ `watch`, and `cancel` on a job, `execute`, `start` and `stop` on a sandbox,
148
+ `start`, `stop`, `setMode`, `listRuns`, `wake`, `hold`, `release`,
149
+ `listRevisions`, `getRevision`, `rollback` and `listActivations` on a
150
+ service). A service's alarms are `setAlarm`, `getAlarm`, `listAlarms`
151
+ (every alarm in one answer, with no page token), `deleteAlarm`,
152
+ `pauseAlarm`, `resumeAlarm` and `runAlarmNow`, and its sign-ins are
153
+ `startSignIn`, which hands back the sign-in's stream as the server sends
154
+ it, `answerSignIn`, `cancelSignIn` and `getSignInStatus`. The calls that
145
155
  span the three types sit on `workload` itself: `listEvents`, `watchEvents`,
146
- `getOperation` and `waitOperation`. `run` sits at the top of the client, as
156
+ `emitEvent`, `holdWorkload`, `releaseWorkload`, `getOperation` and
157
+ `waitOperation`. `holdWorkload` and `releaseWorkload` are operator-only and
158
+ need the operator's headers, which the caller adds with an interceptor
159
+ (see Operator calls). `run` sits at the top of the client, as
147
160
  `toshi run` sits at the top of the CLI.
148
161
 
149
162
  <!-- examples/client-shape.ts -->
@@ -154,9 +167,53 @@ const { job } = await toshi.workload.jobs.get({ id: jobs[0].id });
154
167
  console.log(job?.id);
155
168
  ```
156
169
 
170
+ ### Operator calls
171
+
172
+ An operator's token sends its reason in `Toshi-Operator-Reason` and the
173
+ workspace it acts on in `Toshi-Workspace` on every Workspace API call; the
174
+ server refuses one without them. Both belong to the client rather than to a
175
+ call, so the caller sets them with an interceptor of its own: the `transport`
176
+ option receives the client's interceptors, and the caller adds the one that
177
+ writes the headers. `workload.holdWorkload` places an operator's hold on a
178
+ sandbox or service, stopping it if it runs, and `workload.releaseWorkload`
179
+ lifts the hold and starts nothing; only an operator may make either call.
180
+
181
+ <!-- examples/operator-reason.ts -->
182
+
183
+ ```ts
184
+ import type { Interceptor } from "@connectrpc/connect";
185
+ import { createConnectTransport } from "@connectrpc/connect-node";
186
+
187
+ import { createToshiClient } from "@toshicloud/sdk/node";
188
+
189
+ const baseUrl = "https://toshi.example.com";
190
+
191
+ // An operator's token, the reason its calls carry and the workspace they
192
+ // act on.
193
+ declare const token: string;
194
+
195
+ const operator: Interceptor = (next) => (req) => {
196
+ req.header.set("Toshi-Operator-Reason", "investigating a report");
197
+ req.header.set("Toshi-Workspace", "acme");
198
+ return next(req);
199
+ };
200
+
201
+ export const toshi = createToshiClient({
202
+ transport: (interceptors) =>
203
+ createConnectTransport({
204
+ baseUrl,
205
+ httpVersion: "2",
206
+ interceptors: [...interceptors, operator],
207
+ }),
208
+ token,
209
+ project: "default",
210
+ });
211
+ ```
212
+
157
213
  ### Lists
158
214
 
159
- `workload.jobs.all`, `workload.sandboxes.all`, `workload.services.all`,
215
+ `workload.jobs.all`, `workload.sandboxes.all`,
216
+ `workload.sandboxes.allPreviewShareLinks`, `workload.services.all`,
160
217
  `workload.services.allRuns` and `workload.allEvents` take the request their
161
218
  `list` method takes and yield every item, one page after another. Each
162
219
  response's `nextPageToken` becomes the next request's `pageToken`, and a
@@ -190,6 +247,9 @@ for await (const project of paginate(
190
247
  fields. Every page is a call of its own, so `opts` goes to each one, and
191
248
  `timeoutMs` bounds a page and not the whole iteration. An error throws once
192
249
  and ends the iteration; leaving the loop sends no further request.
250
+ `PageRequest` is a list request, which may name the page to read first with
251
+ `pageToken`, and `PageResponse` a list response, which names the page after
252
+ it with `nextPageToken`.
193
253
 
194
254
  ### Retries
195
255
 
@@ -199,18 +259,35 @@ connection reset or destroyed stream that `@connectrpc/connect-node`
199
259
  reports, or a stream the server refused before reading it
200
260
  (`REFUSED_STREAM`). A write that takes a request key gets a random one when the
201
261
  request has none, so the server applies a retried write once. Other
202
- writes are never retried. An error the server sends, including
203
- `Aborted`, `InvalidArgument` and `ResourceExhausted`, reaches the caller
204
- unchanged. So does any connection failure the client cannot tell apart
205
- from a server error.
262
+ writes are never retried.
263
+
264
+ A `ResourceExhausted` refusal that names how long to wait, as the API's
265
+ rate limit does, is retried the same way. The wait comes from its
266
+ `google.rpc.RetryInfo` detail, else from its `Retry-After` header. So is an
267
+ HTTP 429 with a `Retry-After`, which reaches the client as `Unavailable`.
268
+ The client waits the longer of that wait and the backoff, never more than
269
+ `maxBackoffMs`, and stops when the call's signal aborts. A
270
+ `ResourceExhausted` that names no wait, such as a plan's limit, reaches the
271
+ caller unchanged, as do every other error the server sends, including
272
+ `Aborted` and `InvalidArgument`, and any connection failure the client
273
+ cannot tell apart from a server error.
274
+
275
+ `RetryPolicy` says how often and how long a call is retried, `maxAttempts`
276
+ counting the first try; `defaultRetryPolicy` is the default — five
277
+ attempts, a 200 ms initial backoff and a 10 s cap.
206
278
 
207
279
  ### Waiting and watching
208
280
 
209
281
  - `workload.jobs.wait(req)`, `workload.sandboxes.wait(req)` and
210
282
  `workload.services.wait(req)` ask again until the workload reaches the
211
- state; `workload.waitOperation(req)` asks until the operation is done.
283
+ state; `workload.waitOperation(req)` asks until the operation is done. A
284
+ call starts at least a second, and at most 1.2 seconds, after the start of
285
+ the one before, and a signal ends a pause with its own error.
212
286
  - `workload.getOperation(req)` returns one operation by id: a call that
213
287
  takes long hands one back, and this asks for it again.
288
+ - An event's payload says what happened: a trigger's `TriggerResult` names
289
+ the key's `reason` and its workload, and with `process_exited` or
290
+ `setup_failed` it carries the sandbox's `exitCode` and `message`.
214
291
  - `workload.listEvents(req)` returns the events after a cursor, oldest
215
292
  first, a page at a time, for a client that polls or catches up after
216
293
  downtime; `workload.watchEvents(req)` is the live form.
@@ -307,44 +384,55 @@ and `workload.jobs.cancel` ends it.
307
384
 
308
385
  ## Products that are off
309
386
 
310
- A call for a product that is off for the workspace, or that turns on an
311
- outside product without accepting the access it asks for, rejects with a
387
+ A call for a product that is off for the workspace rejects with a
312
388
  `ProductError`, `wait`, the watches and `execute` included.
313
389
  `isProductError(err)` tells it apart. It is still a `ConnectError` with the
314
390
  same `code`, and it has the product's ID (`product`), the `reason`
315
- (`ProductReason.NotInstalled`, `Disabled`, `NotEntitled`, `TurnedOff` or
316
- `AccessNotAccepted`), the setting that turns the product on (`feature`,
317
- such as `runners.enabled`), how far a product the deployment disables has
318
- wound down (`state`) and, for `AccessNotAccepted`, the access to accept
319
- (`access`).
391
+ (`ProductReason.Unavailable`), the input that turned the product off
392
+ (`productCause`: `build`, `operator`, `plan` or `workspace`) and, for a
393
+ product the deployment turns off, how far it has wound down (`state`:
394
+ `no_new_work`, `draining` or `stopped`).
320
395
 
321
396
  <!-- examples/product-error.ts -->
322
397
 
323
398
  ```ts
399
+ import { isProductError } from "@toshicloud/sdk";
324
400
 
325
- // Turning an outside product on installs it, and the API asks the caller to
326
- // accept the access it wants first.
327
- const enable = { id: "acme_ci", enabled: true, acceptedAccess: [] as string[] };
401
+ import { toshi } from "./client.js";
402
+
403
+ // Turn a product on for the workspace.
404
+ const enable = { id: "acme_ci", enabled: true };
328
405
  try {
329
- try {
330
- await toshi.product.updateProduct(enable);
331
- } catch (err) {
332
- if (!isProductError(err) || err.reason !== ProductReason.AccessNotAccepted) {
333
- throw err;
334
- }
335
- console.log(err.product, err.reason, err.access);
336
- // Accept exactly the access the product asks for.
337
- await toshi.product.updateProduct({ ...enable, acceptedAccess: err.access });
338
- }
406
+ await toshi.product.updateProduct(enable);
339
407
  } catch (err) {
340
408
  if (!isProductError(err)) {
341
409
  throw err;
342
410
  }
343
- // Off for the workspace: say which product and why.
344
- console.log(err.product, err.reason, err.feature);
411
+ // Off for the workspace: which product, the input that turns it off, and,
412
+ // for the deployment's config, how far it has wound down.
413
+ console.log(err.product, err.productCause, err.state);
345
414
  }
346
415
  ```
347
416
 
417
+ ## Refusals with a reason
418
+
419
+ A refusal that is not a product's rejects with a `RefusalError`;
420
+ `isRefusalError(err)` tells it apart. It is still a `ConnectError` with the
421
+ same `code`, and its `reason` is one of `RefusalReason`:
422
+ `RefusalReason.ImageInUse` when an image a workload or a revision still uses
423
+ cannot be deleted, `RefusalReason.ImageNotReady` when a job, a sandbox or a
424
+ service revision names a workspace image with no ready version,
425
+ `RefusalReason.PlanExcludesImages` when the plan has no images, `RefusalReason.LastIdentity` when the caller's last identity cannot
426
+ be unlinked, and so on for images, volumes, roles and display sessions.
427
+
428
+ `workload.services.rollback` asks the revision's registry whether it still
429
+ serves the revision's image before it selects it, and refuses with
430
+ `RefusalReason.ImageNotServed` when the registry answered that it does not
431
+ serve the image, or `RefusalReason.ImageCheckFailed` when it could not say.
432
+ A revision's `imageCheck` carries the last answer: its `outcome`, the
433
+ registry's `status` and `message`, and when it was asked, `checkedAt`.
434
+ Reading a revision asks no registry.
435
+
348
436
  ## Testing with `@toshicloud/sdk/test`
349
437
 
350
438
  `createFake()` serves the whole Workspace API in memory: no server, no port,
@@ -369,6 +457,10 @@ for await (const chunk of run) {
369
457
  await run.wait();
370
458
  ```
371
459
 
460
+ The fake also keeps a service's alarms: `setAlarm`, `getAlarm`, `listAlarms`,
461
+ `deleteAlarm`, `pauseAlarm`, `resumeAlarm` and `runAlarmNow` answer from its
462
+ state machine.
463
+
372
464
  `fake.on(method, impl)` replaces the state machine for one method with a hook
373
465
  typed by that method: one call for unary, server-stream and bidirectional
374
466
  methods alike. `fake.calls()` returns every call the fake received, oldest
@@ -384,14 +476,18 @@ in `proto/toshi/workspace/v1` of the
384
476
  `proto/toshi/permission.proto`, which they import. The generated code is committed and imports
385
477
  only `@bufbuild/protobuf`, so installing the package needs no generator.
386
478
 
387
- `pin.env` names the toshi-api commit (or, once one exists, the release
388
- tag) the code is generated from. `mise.toml` pins the versions of Node,
389
- pnpm, `buf` and `protoc-gen-es`.
479
+ `pin.env` names the toshi-api commit the code is generated from:
480
+ `5474559e89f7faf4b718fd5f1d64ff7457657477` today, the commit of the
481
+ release tag `v0.5.0`.
482
+ `mise.toml` pins the versions of Node, pnpm and `buf`;
483
+ `package.json` pins `protoc-gen-es` at the same version as the
484
+ `@bufbuild/protobuf` development dependency.
390
485
 
391
486
  To regenerate:
392
487
 
393
488
  ```sh
394
489
  mise install
490
+ pnpm install --frozen-lockfile
395
491
  mise exec -- scripts/generate.sh
396
492
  ```
397
493
 
@@ -405,7 +501,8 @@ and fails if the result differs from what is committed
405
501
  The package's major version follows the API's: `1.x` will serve
406
502
  `toshi.workspace.v1`, and a `toshi.workspace.v2` gets a new major
407
503
  version. Until a Toshi release serves the API, the package stays at
408
- `0.x` and is generated from a pinned commit.
504
+ `0.x` and is generated from a pinned commit. `VERSION` is the package
505
+ version, the one `package.json` carries.
409
506
 
410
507
  ## Publishing
411
508
 
package/dist/client.d.ts CHANGED
@@ -1,26 +1,35 @@
1
1
  import type { MessageInitShape } from "@bufbuild/protobuf";
2
2
  import type { Client, Interceptor, Transport } from "@connectrpc/connect";
3
+ import { AccountService } from "./gen/toshi/workspace/v1/account_pb.js";
3
4
  import { ArtifactService, ArtifactUploadService } from "./gen/toshi/workspace/v1/artifacts_pb.js";
4
5
  import { AuditEventService } from "./gen/toshi/workspace/v1/audit_events_pb.js";
5
6
  import { ChannelService } from "./gen/toshi/workspace/v1/channels_pb.js";
7
+ import { ConnectionService } from "./gen/toshi/workspace/v1/connections_pb.js";
6
8
  import { DiscoveryService } from "./gen/toshi/workspace/v1/discovery_pb.js";
7
9
  import { DisplayService } from "./gen/toshi/workspace/v1/display_pb.js";
10
+ import { DomainService } from "./gen/toshi/workspace/v1/domains_pb.js";
8
11
  import { FillerService } from "./gen/toshi/workspace/v1/fillers_pb.js";
12
+ import { GrantService } from "./gen/toshi/workspace/v1/grants_pb.js";
13
+ import { ImageService } from "./gen/toshi/workspace/v1/images_pb.js";
9
14
  import { HostJobService } from "./gen/toshi/workspace/v1/hostjobs_pb.js";
10
15
  import { HostService } from "./gen/toshi/workspace/v1/hosts_pb.js";
11
16
  import { ProductService } from "./gen/toshi/workspace/v1/products_pb.js";
12
17
  import { ProjectService } from "./gen/toshi/workspace/v1/projects_pb.js";
13
18
  import { RecordingService } from "./gen/toshi/workspace/v1/recordings_pb.js";
19
+ import { RoleService } from "./gen/toshi/workspace/v1/roles_pb.js";
14
20
  import { SecretService } from "./gen/toshi/workspace/v1/secrets_pb.js";
15
21
  import { StorageProviderService } from "./gen/toshi/workspace/v1/storage_providers_pb.js";
16
22
  import { TokenService } from "./gen/toshi/workspace/v1/tokens_pb.js";
23
+ import { TriggerService } from "./gen/toshi/workspace/v1/triggers_pb.js";
17
24
  import { VolumeService } from "./gen/toshi/workspace/v1/volumes_pb.js";
18
25
  import { WebhookService } from "./gen/toshi/workspace/v1/webhook_pb.js";
19
26
  import { WorkspaceService } from "./gen/toshi/workspace/v1/workspace_service_pb.js";
20
- import { CancelJobRequestSchema, CreateJobRequestSchema, CreateSandboxRequestSchema, CreateServiceRequestSchema, DeleteJobRequestSchema, DeleteSandboxRequestSchema, DeleteServiceRequestSchema, GetJobRequestSchema, GetSandboxRequestSchema, GetServiceRequestSchema, ListJobsRequestSchema, ListSandboxesRequestSchema, ListServicesRequestSchema, UpdateJobRequestSchema, UpdateSandboxRequestSchema, UpdateServiceRequestSchema, WaitJobRequestSchema, WaitSandboxRequestSchema, WaitServiceRequestSchema, WatchJobsRequestSchema, WatchSandboxesRequestSchema, WatchServicesRequestSchema } from "./gen/toshi/workspace/v1/workloads_pb.js";
21
- import type { CancelJobResponse, CreateJobResponse, CreateSandboxResponse, CreateServiceResponse, DeleteJobResponse, DeleteSandboxResponse, DeleteServiceResponse, GetJobResponse, GetSandboxResponse, GetServiceResponse, ListJobsResponse, ListSandboxesResponse, ListServicesResponse, UpdateJobResponse, UpdateSandboxResponse, UpdateServiceResponse, WaitJobResponse, WaitSandboxResponse, WaitServiceResponse, WatchJobsResponse, WatchSandboxesResponse, WatchServicesResponse } from "./gen/toshi/workspace/v1/workloads_pb.js";
22
- import { ExecuteStartSchema, GetOperationRequestSchema, HoldServiceRequestSchema, ListEventsRequestSchema, ListServiceRunsRequestSchema, ReleaseServiceRequestSchema, SetServiceModeRequestSchema, StartServiceRequestSchema, StopServiceRequestSchema, WaitOperationRequestSchema, WakeServiceRequestSchema, WatchEventsRequestSchema, WatchOutputRequestSchema } from "./gen/toshi/workspace/v1/workspace_pb.js";
23
- import type { Event, GetOperationResponse, HoldServiceResponse, Job, ListEventsResponse, ListServiceRunsResponse, Operation, ReleaseServiceResponse, Sandbox, Service, ServiceRun, SetServiceModeResponse, StartServiceResponse, StopServiceResponse, WakeServiceResponse, WatchEventsResponse, WatchOutputResponse } from "./gen/toshi/workspace/v1/workspace_pb.js";
27
+ import { CreatePreviewShareLinkRequestSchema, ListPreviewShareLinksRequestSchema, RevokePreviewShareLinkRequestSchema, StartSandboxRequestSchema, StopSandboxRequestSchema } from "./gen/toshi/workspace/v1/workspace_pb.js";
28
+ import type { CreatePreviewShareLinkResponse, ListPreviewShareLinksResponse, RevokePreviewShareLinkResponse, StartSandboxResponse, StopSandboxResponse } from "./gen/toshi/workspace/v1/workspace_pb.js";
29
+ import { CancelJobRequestSchema, CreateJobRequestSchema, CreateSandboxRequestSchema, CreateServiceRequestSchema, DeleteJobRequestSchema, DeleteSandboxRequestSchema, DeleteServiceAlarmRequestSchema, DeleteServiceRequestSchema, EmitWorkloadEventRequestSchema, GetJobRequestSchema, GetSandboxRequestSchema, GetServiceAlarmRequestSchema, GetServiceRequestSchema, ListJobsRequestSchema, ListSandboxesRequestSchema, ListServiceAlarmsRequestSchema, ListServicesRequestSchema, PauseServiceAlarmRequestSchema, ResumeServiceAlarmRequestSchema, RunServiceAlarmNowRequestSchema, SetServiceAlarmRequestSchema, UpdateJobRequestSchema, UpdateSandboxRequestSchema, UpdateServiceRequestSchema, WaitJobRequestSchema, WaitSandboxRequestSchema, WaitServiceRequestSchema, WatchJobsRequestSchema, WatchSandboxesRequestSchema, WatchServicesRequestSchema } from "./gen/toshi/workspace/v1/workloads_pb.js";
30
+ import type { CancelJobResponse, CreateJobResponse, CreateSandboxResponse, CreateServiceResponse, DeleteJobResponse, DeleteSandboxResponse, DeleteServiceAlarmResponse, DeleteServiceResponse, EmitWorkloadEventResponse, GetJobResponse, GetSandboxResponse, GetServiceAlarmResponse, GetServiceResponse, ListJobsResponse, ListSandboxesResponse, ListServiceAlarmsResponse, ListServicesResponse, PauseServiceAlarmResponse, ResumeServiceAlarmResponse, RunServiceAlarmNowResponse, SetServiceAlarmResponse, UpdateJobResponse, UpdateSandboxResponse, UpdateServiceResponse, WaitJobResponse, WaitSandboxResponse, WaitServiceResponse, WatchJobsResponse, WatchSandboxesResponse, WatchServicesResponse } from "./gen/toshi/workspace/v1/workloads_pb.js";
31
+ import { AnswerServiceSignInRequestSchema, CancelServiceSignInRequestSchema, ExecuteStartSchema, GetOperationRequestSchema, GetServiceRevisionRequestSchema, GetServiceSignInStatusRequestSchema, HoldServiceRequestSchema, HoldWorkloadRequestSchema, ListEventsRequestSchema, ListServiceActivationsRequestSchema, ListServiceRevisionsRequestSchema, ListServiceRunsRequestSchema, ReleaseServiceRequestSchema, ReleaseWorkloadRequestSchema, RollbackServiceRequestSchema, SetServiceModeRequestSchema, StartServiceRequestSchema, StartServiceSignInRequestSchema, StopServiceRequestSchema, WaitOperationRequestSchema, WakeServiceRequestSchema, WatchEventsRequestSchema, WatchOutputRequestSchema } from "./gen/toshi/workspace/v1/workspace_pb.js";
32
+ import type { AnswerServiceSignInResponse, CancelServiceSignInResponse, Event, GetOperationResponse, GetServiceRevisionResponse, GetServiceSignInStatusResponse, HoldServiceResponse, HoldWorkloadResponse, Job, ListEventsResponse, ListServiceActivationsResponse, ListServiceRevisionsResponse, ListServiceRunsResponse, Operation, PreviewShareLink, ReleaseServiceResponse, ReleaseWorkloadResponse, RollbackServiceResponse, Sandbox, Service, ServiceRun, SetServiceModeResponse, StartServiceResponse, StartServiceSignInResponse, StopServiceResponse, WakeServiceResponse, WatchEventsResponse, WatchOutputResponse } from "./gen/toshi/workspace/v1/workspace_pb.js";
24
33
  import type { RetryPolicy } from "./retry.js";
25
34
  /** How the client is configured; the caller builds the transport. */
26
35
  export interface ToshiOptions {
@@ -65,9 +74,16 @@ export interface ToshiClient {
65
74
  readonly token: Client<typeof TokenService>;
66
75
  readonly auditEvent: Client<typeof AuditEventService>;
67
76
  readonly filler: Client<typeof FillerService>;
77
+ readonly grant: Client<typeof GrantService>;
68
78
  readonly storageProvider: Client<typeof StorageProviderService>;
69
79
  readonly product: Client<typeof ProductService>;
70
80
  readonly discovery: Client<typeof DiscoveryService>;
81
+ readonly connection: Client<typeof ConnectionService>;
82
+ readonly role: Client<typeof RoleService>;
83
+ readonly trigger: Client<typeof TriggerService>;
84
+ readonly account: Client<typeof AccountService>;
85
+ readonly image: Client<typeof ImageService>;
86
+ readonly domain: Client<typeof DomainService>;
71
87
  run(req: MessageInitShape<typeof CreateJobRequestSchema>, opts?: CallOptions): Promise<JobRun>;
72
88
  }
73
89
  /** WorkloadService's calls, grouped by the type they name. */
@@ -81,6 +97,22 @@ export interface WorkloadClient {
81
97
  /** Yields every event listEvents lists, following the page token from one page to the next. */
82
98
  allEvents(req: MessageInitShape<typeof ListEventsRequestSchema>, opts?: CallOptions): AsyncIterable<Event>;
83
99
  watchEvents(req: MessageInitShape<typeof WatchEventsRequestSchema>, opts?: CallOptions): Promise<EventWatch>;
100
+ /**
101
+ * Appends an event of type EMITTED, with the name and data given, to a job's, sandbox's or
102
+ * service's event log, as its guest emits one, and returns it; the workload need not be running.
103
+ */
104
+ emitEvent(req: MessageInitShape<typeof EmitWorkloadEventRequestSchema>, opts?: CallOptions): Promise<EmitWorkloadEventResponse>;
105
+ /**
106
+ * Places an operator's hold on a sandbox or service, stopping it if it runs. Only an
107
+ * operator may call it; the caller sets the operator's reason in the Toshi-Operator-Reason
108
+ * header with an interceptor, since the client sends none itself.
109
+ */
110
+ holdWorkload(req: MessageInitShape<typeof HoldWorkloadRequestSchema>, opts?: CallOptions): Promise<HoldWorkloadResponse>;
111
+ /**
112
+ * Lifts an operator's hold and starts nothing. Only an operator may call it; the caller
113
+ * sets the operator's reason in the Toshi-Operator-Reason header with an interceptor.
114
+ */
115
+ releaseWorkload(req: MessageInitShape<typeof ReleaseWorkloadRequestSchema>, opts?: CallOptions): Promise<ReleaseWorkloadResponse>;
84
116
  /** Returns one operation: the id a long call hands back, asked for again. */
85
117
  getOperation(req: MessageInitShape<typeof GetOperationRequestSchema>, opts?: CallOptions): Promise<GetOperationResponse>;
86
118
  }
@@ -107,9 +139,16 @@ export interface SandboxesClient {
107
139
  all(req: MessageInitShape<typeof ListSandboxesRequestSchema>, opts?: CallOptions): AsyncIterable<Sandbox>;
108
140
  update(req: MessageInitShape<typeof UpdateSandboxRequestSchema>, opts?: CallOptions): Promise<UpdateSandboxResponse>;
109
141
  delete(req: MessageInitShape<typeof DeleteSandboxRequestSchema>, opts?: CallOptions): Promise<DeleteSandboxResponse>;
142
+ stop(req: MessageInitShape<typeof StopSandboxRequestSchema>, opts?: CallOptions): Promise<StopSandboxResponse>;
143
+ start(req: MessageInitShape<typeof StartSandboxRequestSchema>, opts?: CallOptions): Promise<StartSandboxResponse>;
110
144
  wait(req: MessageInitShape<typeof WaitSandboxRequestSchema>, opts?: CallOptions): Promise<WaitSandboxResponse>;
111
145
  watch(req: MessageInitShape<typeof WatchSandboxesRequestSchema>, opts?: CallOptions): Promise<SandboxWatch>;
112
146
  execute(start: MessageInitShape<typeof ExecuteStartSchema>, opts?: CallOptions): Promise<Process>;
147
+ createPreviewShareLink(req: MessageInitShape<typeof CreatePreviewShareLinkRequestSchema>, opts?: CallOptions): Promise<CreatePreviewShareLinkResponse>;
148
+ listPreviewShareLinks(req: MessageInitShape<typeof ListPreviewShareLinksRequestSchema>, opts?: CallOptions): Promise<ListPreviewShareLinksResponse>;
149
+ /** Yields every share link that matches every filter that is set, following the page token from one page to the next. */
150
+ allPreviewShareLinks(req: MessageInitShape<typeof ListPreviewShareLinksRequestSchema>, opts?: CallOptions): AsyncIterable<PreviewShareLink>;
151
+ revokePreviewShareLink(req: MessageInitShape<typeof RevokePreviewShareLinkRequestSchema>, opts?: CallOptions): Promise<RevokePreviewShareLinkResponse>;
113
152
  }
114
153
  /** A service's calls: one method for each of WorkloadService's service calls. */
115
154
  export interface ServicesClient {
@@ -131,6 +170,66 @@ export interface ServicesClient {
131
170
  listRuns(req: MessageInitShape<typeof ListServiceRunsRequestSchema>, opts?: CallOptions): Promise<ListServiceRunsResponse>;
132
171
  /** Yields every run listRuns returns, the newest first, following the page token from one page to the next. */
133
172
  allRuns(req: MessageInitShape<typeof ListServiceRunsRequestSchema>, opts?: CallOptions): AsyncIterable<ServiceRun>;
173
+ /** Returns a service's revisions, oldest first. */
174
+ listRevisions(req: MessageInitShape<typeof ListServiceRevisionsRequestSchema>, opts?: CallOptions): Promise<ListServiceRevisionsResponse>;
175
+ /** Returns one revision of a service. */
176
+ getRevision(req: MessageInitShape<typeof GetServiceRevisionRequestSchema>, opts?: CallOptions): Promise<GetServiceRevisionResponse>;
177
+ /** Selects a revision the service already has as its current one. */
178
+ rollback(req: MessageInitShape<typeof RollbackServiceRequestSchema>, opts?: CallOptions): Promise<RollbackServiceResponse>;
179
+ /** Returns a service's activations, oldest first. */
180
+ listActivations(req: MessageInitShape<typeof ListServiceActivationsRequestSchema>, opts?: CallOptions): Promise<ListServiceActivationsResponse>;
181
+ /**
182
+ * Creates or replaces the service's alarm with this name and returns it: at each instant of its
183
+ * schedule the alarm publishes its event, with its data, on one of the service's event channels.
184
+ */
185
+ setAlarm(req: MessageInitShape<typeof SetServiceAlarmRequestSchema>, opts?: CallOptions): Promise<SetServiceAlarmResponse>;
186
+ /** Returns one alarm and its most recent occurrences, newest first. */
187
+ getAlarm(req: MessageInitShape<typeof GetServiceAlarmRequestSchema>, opts?: CallOptions): Promise<GetServiceAlarmResponse>;
188
+ /**
189
+ * Returns all of a service's alarms, by name, in one answer: the call has no page token, so
190
+ * there is no `allAlarms`.
191
+ */
192
+ listAlarms(req: MessageInitShape<typeof ListServiceAlarmsRequestSchema>, opts?: CallOptions): Promise<ListServiceAlarmsResponse>;
193
+ /** Removes an alarm and its occurrences; messages it already published stay on the channel. */
194
+ deleteAlarm(req: MessageInitShape<typeof DeleteServiceAlarmRequestSchema>, opts?: CallOptions): Promise<DeleteServiceAlarmResponse>;
195
+ /** Stops an alarm publishing until it is resumed; pausing a paused alarm changes nothing. */
196
+ pauseAlarm(req: MessageInitShape<typeof PauseServiceAlarmRequestSchema>, opts?: CallOptions): Promise<PauseServiceAlarmResponse>;
197
+ /**
198
+ * Starts a paused alarm again from the next instant of its schedule; instants that passed while
199
+ * it was paused are not published.
200
+ */
201
+ resumeAlarm(req: MessageInitShape<typeof ResumeServiceAlarmRequestSchema>, opts?: CallOptions): Promise<ResumeServiceAlarmResponse>;
202
+ /**
203
+ * Publishes the alarm's event once, now, paused or not, and returns the occurrence; it does not
204
+ * move the alarm's next instant. It takes a request key, so a retried call is applied once.
205
+ */
206
+ runAlarmNow(req: MessageInitShape<typeof RunServiceAlarmNowRequestSchema>, opts?: CallOptions): Promise<RunServiceAlarmNowResponse>;
207
+ /**
208
+ * Runs one of the service's recipe's sign_in programs and hands back its stream as the server
209
+ * sends it. The caller reads the started message first, which names the sign-in; then the
210
+ * output messages, the program's standard output and standard error; answers the program with
211
+ * `answerSignIn` or ends it early with `cancelSignIn`; and reads the ended message last, which
212
+ * says how it ended. A sign-in may run for 15 minutes.
213
+ *
214
+ * The stream is not retried or resumed: a sign-in has no cursor. Its stream ending for another
215
+ * reason, as a client that leaves, also ends it, cancelled; the caller starts a new one.
216
+ */
217
+ startSignIn(req: MessageInitShape<typeof StartServiceSignInRequestSchema>, opts?: CallOptions): AsyncIterable<StartServiceSignInResponse>;
218
+ /**
219
+ * Writes one line, of at most 4 KiB and with no newline in it, to a running sign-in's standard
220
+ * input; the sign-in's program reads it.
221
+ */
222
+ answerSignIn(req: MessageInitShape<typeof AnswerServiceSignInRequestSchema>, opts?: CallOptions): Promise<AnswerServiceSignInResponse>;
223
+ /**
224
+ * Ends a running sign-in: its program is cancelled and its stream ends CANCELLED. It returns
225
+ * once the cancel is asked for, not once the sign-in has ended.
226
+ */
227
+ cancelSignIn(req: MessageInitShape<typeof CancelServiceSignInRequestSchema>, opts?: CallOptions): Promise<CancelServiceSignInResponse>;
228
+ /**
229
+ * Runs the status commands of the service's recipe and reports, for each sign_in program,
230
+ * whether it is signed in and what its status command wrote.
231
+ */
232
+ getSignInStatus(req: MessageInitShape<typeof GetServiceSignInStatusRequestSchema>, opts?: CallOptions): Promise<GetServiceSignInStatusResponse>;
134
233
  }
135
234
  /** A live stream of a job's changes. */
136
235
  export interface JobWatch extends AsyncIterable<WatchJobsResponse> {
package/dist/client.js CHANGED
@@ -1,28 +1,36 @@
1
1
  import { create } from "@bufbuild/protobuf";
2
2
  import { createClient } from "@connectrpc/connect";
3
3
  import { executeCommand } from "./execute.js";
4
+ import { AccountService } from "./gen/toshi/workspace/v1/account_pb.js";
4
5
  import { ArtifactService, ArtifactUploadService } from "./gen/toshi/workspace/v1/artifacts_pb.js";
5
6
  import { AuditEventService } from "./gen/toshi/workspace/v1/audit_events_pb.js";
6
7
  import { ChannelService } from "./gen/toshi/workspace/v1/channels_pb.js";
8
+ import { ConnectionService } from "./gen/toshi/workspace/v1/connections_pb.js";
7
9
  import { DiscoveryService } from "./gen/toshi/workspace/v1/discovery_pb.js";
8
10
  import { DisplayService } from "./gen/toshi/workspace/v1/display_pb.js";
11
+ import { DomainService } from "./gen/toshi/workspace/v1/domains_pb.js";
9
12
  import { FillerService } from "./gen/toshi/workspace/v1/fillers_pb.js";
13
+ import { GrantService } from "./gen/toshi/workspace/v1/grants_pb.js";
14
+ import { ImageService } from "./gen/toshi/workspace/v1/images_pb.js";
10
15
  import { HostJobService } from "./gen/toshi/workspace/v1/hostjobs_pb.js";
11
16
  import { HostService } from "./gen/toshi/workspace/v1/hosts_pb.js";
12
17
  import { ProductService } from "./gen/toshi/workspace/v1/products_pb.js";
13
18
  import { ProjectService } from "./gen/toshi/workspace/v1/projects_pb.js";
14
19
  import { RecordingService } from "./gen/toshi/workspace/v1/recordings_pb.js";
20
+ import { RoleService } from "./gen/toshi/workspace/v1/roles_pb.js";
15
21
  import { SecretService } from "./gen/toshi/workspace/v1/secrets_pb.js";
16
22
  import { StorageProviderService } from "./gen/toshi/workspace/v1/storage_providers_pb.js";
17
23
  import { TokenService } from "./gen/toshi/workspace/v1/tokens_pb.js";
24
+ import { TriggerService } from "./gen/toshi/workspace/v1/triggers_pb.js";
18
25
  import { VolumeService } from "./gen/toshi/workspace/v1/volumes_pb.js";
19
26
  import { WebhookService } from "./gen/toshi/workspace/v1/webhook_pb.js";
20
27
  import { WorkspaceService } from "./gen/toshi/workspace/v1/workspace_service_pb.js";
21
- import { CancelJobRequestSchema, CreateJobRequestSchema, CreateSandboxRequestSchema, CreateServiceRequestSchema, DeleteJobRequestSchema, DeleteSandboxRequestSchema, DeleteServiceRequestSchema, GetJobRequestSchema, GetSandboxRequestSchema, GetServiceRequestSchema, ListJobsRequestSchema, ListSandboxesRequestSchema, ListServicesRequestSchema, UpdateJobRequestSchema, UpdateSandboxRequestSchema, UpdateServiceRequestSchema, WaitJobRequestSchema, WaitSandboxRequestSchema, WaitServiceRequestSchema, WatchJobsRequestSchema, WatchSandboxesRequestSchema, WatchServicesRequestSchema, WorkloadService, } from "./gen/toshi/workspace/v1/workloads_pb.js";
22
- import { ExecuteStartSchema, GetOperationRequestSchema, HoldServiceRequestSchema, ListEventsRequestSchema, ListServiceRunsRequestSchema, ReleaseServiceRequestSchema, SetServiceModeRequestSchema, StartServiceRequestSchema, StopServiceRequestSchema, WaitOperationRequestSchema, WakeServiceRequestSchema, WatchEventsRequestSchema, WatchOutputRequestSchema, } from "./gen/toshi/workspace/v1/workspace_pb.js";
28
+ import { CreatePreviewShareLinkRequestSchema, ListPreviewShareLinksRequestSchema, RevokePreviewShareLinkRequestSchema, StartSandboxRequestSchema, StopSandboxRequestSchema, } from "./gen/toshi/workspace/v1/workspace_pb.js";
29
+ import { CancelJobRequestSchema, CreateJobRequestSchema, CreateSandboxRequestSchema, CreateServiceRequestSchema, DeleteJobRequestSchema, DeleteSandboxRequestSchema, DeleteServiceAlarmRequestSchema, DeleteServiceRequestSchema, EmitWorkloadEventRequestSchema, GetJobRequestSchema, GetSandboxRequestSchema, GetServiceAlarmRequestSchema, GetServiceRequestSchema, ListJobsRequestSchema, ListSandboxesRequestSchema, ListServiceAlarmsRequestSchema, ListServicesRequestSchema, PauseServiceAlarmRequestSchema, ResumeServiceAlarmRequestSchema, RunServiceAlarmNowRequestSchema, SetServiceAlarmRequestSchema, UpdateJobRequestSchema, UpdateSandboxRequestSchema, UpdateServiceRequestSchema, WaitJobRequestSchema, WaitSandboxRequestSchema, WaitServiceRequestSchema, WatchJobsRequestSchema, WatchSandboxesRequestSchema, WatchServicesRequestSchema, WorkloadService, } from "./gen/toshi/workspace/v1/workloads_pb.js";
30
+ import { AnswerServiceSignInRequestSchema, CancelServiceSignInRequestSchema, ExecuteStartSchema, GetOperationRequestSchema, GetServiceRevisionRequestSchema, GetServiceSignInStatusRequestSchema, HoldServiceRequestSchema, HoldWorkloadRequestSchema, ListEventsRequestSchema, ListServiceActivationsRequestSchema, ListServiceRevisionsRequestSchema, ListServiceRunsRequestSchema, ReleaseServiceRequestSchema, ReleaseWorkloadRequestSchema, RollbackServiceRequestSchema, SetServiceModeRequestSchema, StartServiceRequestSchema, StartServiceSignInRequestSchema, StopServiceRequestSchema, WaitOperationRequestSchema, WakeServiceRequestSchema, WatchEventsRequestSchema, WatchOutputRequestSchema, } from "./gen/toshi/workspace/v1/workspace_pb.js";
23
31
  import { openOutputWatch } from "./output.js";
24
32
  import { paginate } from "./paginate.js";
25
- import { authInterceptor, keyInterceptor, productInterceptor, retryInterceptor, scopeInterceptor, } from "./interceptors.js";
33
+ import { authInterceptor, keyInterceptor, refusalInterceptor, retryInterceptor, scopeInterceptor, } from "./interceptors.js";
26
34
  import { normalizeRetry } from "./retry.js";
27
35
  import { withDefaultUnaryTimeout } from "./timeout.js";
28
36
  import { openEventWatch, openJobWatch, openSandboxWatch, openServiceWatch } from "./watch.js";
@@ -41,7 +49,7 @@ import { waitJob, waitOperation, waitSandbox, waitService } from "./wait.js";
41
49
  export function createToshiClient(options) {
42
50
  const retry = normalizeRetry(options.retry);
43
51
  const interceptors = [
44
- productInterceptor(),
52
+ refusalInterceptor(),
45
53
  scopeInterceptor(options.project ?? "", options.environment ?? ""),
46
54
  keyInterceptor(),
47
55
  retryInterceptor(retry),
@@ -79,9 +87,15 @@ export function createToshiClient(options) {
79
87
  all: (req, opts) => paginate(req, workloadService.listSandboxes, (resp) => resp.sandboxes, opts),
80
88
  update: (req, opts) => workloadService.updateSandbox(req, opts),
81
89
  delete: (req, opts) => workloadService.deleteSandbox(req, opts),
90
+ stop: (req, opts) => workloadService.stopSandbox(req, opts),
91
+ start: (req, opts) => workloadService.startSandbox(req, opts),
82
92
  wait: (req, opts) => waitSandbox(workloadService, create(WaitSandboxRequestSchema, req), opts),
83
93
  watch: (req, opts) => openSandboxWatch(workloadService, retry, create(WatchSandboxesRequestSchema, req), opts),
84
94
  execute: (start, opts) => executeCommand(workloadService, start, opts),
95
+ createPreviewShareLink: (req, opts) => workloadService.createPreviewShareLink(req, opts),
96
+ listPreviewShareLinks: (req, opts) => workloadService.listPreviewShareLinks(req, opts),
97
+ allPreviewShareLinks: (req, opts) => paginate(req, workloadService.listPreviewShareLinks, (resp) => resp.shareLinks, opts),
98
+ revokePreviewShareLink: (req, opts) => workloadService.revokePreviewShareLink(req, opts),
85
99
  },
86
100
  services: {
87
101
  create: (req, opts) => workloadService.createService(req, opts),
@@ -100,11 +114,29 @@ export function createToshiClient(options) {
100
114
  hold: (req, opts) => workloadService.holdService(req, opts),
101
115
  listRuns: (req, opts) => workloadService.listServiceRuns(req, opts),
102
116
  allRuns: (req, opts) => paginate(req, workloadService.listServiceRuns, (resp) => resp.runs, opts),
117
+ listRevisions: (req, opts) => workloadService.listServiceRevisions(req, opts),
118
+ getRevision: (req, opts) => workloadService.getServiceRevision(req, opts),
119
+ rollback: (req, opts) => workloadService.rollbackService(req, opts),
120
+ listActivations: (req, opts) => workloadService.listServiceActivations(req, opts),
121
+ setAlarm: (req, opts) => workloadService.setServiceAlarm(req, opts),
122
+ getAlarm: (req, opts) => workloadService.getServiceAlarm(req, opts),
123
+ listAlarms: (req, opts) => workloadService.listServiceAlarms(req, opts),
124
+ deleteAlarm: (req, opts) => workloadService.deleteServiceAlarm(req, opts),
125
+ pauseAlarm: (req, opts) => workloadService.pauseServiceAlarm(req, opts),
126
+ resumeAlarm: (req, opts) => workloadService.resumeServiceAlarm(req, opts),
127
+ runAlarmNow: (req, opts) => workloadService.runServiceAlarmNow(req, opts),
128
+ startSignIn: (req, opts) => workloadService.startServiceSignIn(req, opts),
129
+ answerSignIn: (req, opts) => workloadService.answerServiceSignIn(req, opts),
130
+ cancelSignIn: (req, opts) => workloadService.cancelServiceSignIn(req, opts),
131
+ getSignInStatus: (req, opts) => workloadService.getServiceSignInStatus(req, opts),
103
132
  },
104
133
  waitOperation: (req, opts) => waitOperation(workloadService, create(WaitOperationRequestSchema, req), opts),
105
134
  listEvents: (req, opts) => workloadService.listEvents(req, opts),
106
135
  allEvents: (req, opts) => paginate(req, workloadService.listEvents, (resp) => resp.events, opts),
107
136
  watchEvents: (req, opts) => openEventWatch(workloadService, retry, create(WatchEventsRequestSchema, req), opts),
137
+ emitEvent: (req, opts) => workloadService.emitWorkloadEvent(req, opts),
138
+ holdWorkload: (req, opts) => workloadService.holdWorkload(req, opts),
139
+ releaseWorkload: (req, opts) => workloadService.releaseWorkload(req, opts),
108
140
  getOperation: (req, opts) => workloadService.getOperation(req, opts),
109
141
  },
110
142
  run: (req, opts) => runJob(workloadService, retry, create(CreateJobRequestSchema, req), opts),
@@ -114,8 +146,15 @@ export function createToshiClient(options) {
114
146
  token: createClient(TokenService, transport),
115
147
  auditEvent: createClient(AuditEventService, transport),
116
148
  filler: createClient(FillerService, transport),
149
+ grant: createClient(GrantService, transport),
117
150
  storageProvider: createClient(StorageProviderService, transport),
118
151
  product: createClient(ProductService, transport),
119
152
  discovery: createClient(DiscoveryService, transport),
153
+ connection: createClient(ConnectionService, transport),
154
+ role: createClient(RoleService, transport),
155
+ trigger: createClient(TriggerService, transport),
156
+ account: createClient(AccountService, transport),
157
+ image: createClient(ImageService, transport),
158
+ domain: createClient(DomainService, transport),
120
159
  };
121
160
  }