@toshicloud/sdk 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -40
- package/dist/client.d.ts +33 -2
- package/dist/client.js +28 -3
- package/dist/errors.d.ts +74 -22
- package/dist/errors.js +99 -27
- package/dist/gen/toshi/permission_pb.d.ts +207 -2
- package/dist/gen/toshi/permission_pb.js +54 -2
- package/dist/gen/toshi/workspace/v1/account_pb.d.ts +590 -0
- package/dist/gen/toshi/workspace/v1/account_pb.js +75 -0
- package/dist/gen/toshi/workspace/v1/artifacts_pb.d.ts +14 -8
- package/dist/gen/toshi/workspace/v1/artifacts_pb.js +9 -7
- package/dist/gen/toshi/workspace/v1/audit_events_pb.d.ts +191 -6
- package/dist/gen/toshi/workspace/v1/audit_events_pb.js +11 -1
- package/dist/gen/toshi/workspace/v1/channels_pb.d.ts +1194 -21
- package/dist/gen/toshi/workspace/v1/channels_pb.js +185 -39
- package/dist/gen/toshi/workspace/v1/connections_pb.d.ts +1481 -0
- package/dist/gen/toshi/workspace/v1/connections_pb.js +208 -0
- package/dist/gen/toshi/workspace/v1/discovery_pb.d.ts +291 -43
- package/dist/gen/toshi/workspace/v1/discovery_pb.js +79 -30
- package/dist/gen/toshi/workspace/v1/display_pb.d.ts +198 -15
- package/dist/gen/toshi/workspace/v1/display_pb.js +52 -2
- package/dist/gen/toshi/workspace/v1/domains_pb.d.ts +864 -0
- package/dist/gen/toshi/workspace/v1/domains_pb.js +152 -0
- package/dist/gen/toshi/workspace/v1/fillers_pb.d.ts +12 -4
- package/dist/gen/toshi/workspace/v1/fillers_pb.js +1 -1
- package/dist/gen/toshi/workspace/v1/grants_pb.d.ts +1297 -0
- package/dist/gen/toshi/workspace/v1/grants_pb.js +271 -0
- package/dist/gen/toshi/workspace/v1/hostjobs_pb.d.ts +315 -15
- package/dist/gen/toshi/workspace/v1/hostjobs_pb.js +10 -5
- package/dist/gen/toshi/workspace/v1/hosts_pb.d.ts +196 -7
- package/dist/gen/toshi/workspace/v1/hosts_pb.js +12 -7
- package/dist/gen/toshi/workspace/v1/images_pb.d.ts +1463 -0
- package/dist/gen/toshi/workspace/v1/images_pb.js +263 -0
- package/dist/gen/toshi/workspace/v1/products_pb.d.ts +99 -296
- package/dist/gen/toshi/workspace/v1/products_pb.js +7 -53
- package/dist/gen/toshi/workspace/v1/projects_pb.d.ts +1474 -99
- package/dist/gen/toshi/workspace/v1/projects_pb.js +150 -33
- package/dist/gen/toshi/workspace/v1/recordings_pb.d.ts +181 -14
- package/dist/gen/toshi/workspace/v1/recordings_pb.js +54 -14
- package/dist/gen/toshi/workspace/v1/roles_pb.d.ts +1994 -0
- package/dist/gen/toshi/workspace/v1/roles_pb.js +355 -0
- package/dist/gen/toshi/workspace/v1/secrets_pb.d.ts +314 -8
- package/dist/gen/toshi/workspace/v1/secrets_pb.js +42 -18
- package/dist/gen/toshi/workspace/v1/storage_providers_pb.d.ts +14 -0
- package/dist/gen/toshi/workspace/v1/storage_providers_pb.js +1 -1
- package/dist/gen/toshi/workspace/v1/tokens_pb.d.ts +434 -5
- package/dist/gen/toshi/workspace/v1/tokens_pb.js +65 -8
- package/dist/gen/toshi/workspace/v1/triggers_pb.d.ts +1099 -0
- package/dist/gen/toshi/workspace/v1/triggers_pb.js +185 -0
- package/dist/gen/toshi/workspace/v1/volumes_pb.d.ts +1052 -33
- package/dist/gen/toshi/workspace/v1/volumes_pb.js +169 -11
- package/dist/gen/toshi/workspace/v1/webhook_pb.d.ts +66 -8
- package/dist/gen/toshi/workspace/v1/webhook_pb.js +4 -4
- package/dist/gen/toshi/workspace/v1/workloads_pb.d.ts +2043 -54
- package/dist/gen/toshi/workspace/v1/workloads_pb.js +204 -54
- package/dist/gen/toshi/workspace/v1/workspace_pb.d.ts +6290 -937
- package/dist/gen/toshi/workspace/v1/workspace_pb.js +801 -88
- package/dist/gen/toshi/workspace/v1/workspace_service_pb.d.ts +2176 -630
- package/dist/gen/toshi/workspace/v1/workspace_service_pb.js +191 -74
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -1
- package/dist/interceptors.d.ts +6 -2
- package/dist/interceptors.js +13 -8
- package/dist/retry.d.ts +18 -0
- package/dist/retry.js +225 -23
- package/dist/test/procedures.js +100 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wait.d.ts +4 -0
- package/dist/wait.js +24 -1
- package/package.json +3 -2
package/dist/test/procedures.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { AccountService } from "../gen/toshi/workspace/v1/account_pb.js";
|
|
1
2
|
import { ArtifactService, ArtifactUploadService } from "../gen/toshi/workspace/v1/artifacts_pb.js";
|
|
2
3
|
import { AuditEventService } from "../gen/toshi/workspace/v1/audit_events_pb.js";
|
|
3
4
|
import { ChannelService } from "../gen/toshi/workspace/v1/channels_pb.js";
|
|
4
5
|
import { DisplayService } from "../gen/toshi/workspace/v1/display_pb.js";
|
|
6
|
+
import { DomainService } from "../gen/toshi/workspace/v1/domains_pb.js";
|
|
5
7
|
import { FillerService } from "../gen/toshi/workspace/v1/fillers_pb.js";
|
|
8
|
+
import { GrantService } from "../gen/toshi/workspace/v1/grants_pb.js";
|
|
6
9
|
import { HostJobService } from "../gen/toshi/workspace/v1/hostjobs_pb.js";
|
|
7
10
|
import { HostService } from "../gen/toshi/workspace/v1/hosts_pb.js";
|
|
11
|
+
import { ImageService } from "../gen/toshi/workspace/v1/images_pb.js";
|
|
12
|
+
import { ProductService } from "../gen/toshi/workspace/v1/products_pb.js";
|
|
8
13
|
import { ProjectService } from "../gen/toshi/workspace/v1/projects_pb.js";
|
|
9
14
|
import { RecordingService } from "../gen/toshi/workspace/v1/recordings_pb.js";
|
|
10
15
|
import { SecretService } from "../gen/toshi/workspace/v1/secrets_pb.js";
|
|
@@ -30,11 +35,16 @@ export const apiServices = [
|
|
|
30
35
|
ArtifactUploadService,
|
|
31
36
|
AuditEventService,
|
|
32
37
|
FillerService,
|
|
38
|
+
GrantService,
|
|
33
39
|
HostJobService,
|
|
34
40
|
HostService,
|
|
35
41
|
TokenService,
|
|
36
42
|
StorageProviderService,
|
|
37
43
|
WorkspaceService,
|
|
44
|
+
AccountService,
|
|
45
|
+
ImageService,
|
|
46
|
+
ProductService,
|
|
47
|
+
DomainService,
|
|
38
48
|
];
|
|
39
49
|
/** The path a client calls a method by, for example `/toshi.workspace.v1.WorkloadService/CreateJob`. */
|
|
40
50
|
export function procedurePath(method) {
|
|
@@ -62,17 +72,39 @@ export function isApiMethod(method) {
|
|
|
62
72
|
* neither, so a new method is a decision and not a surprise at a caller.
|
|
63
73
|
*/
|
|
64
74
|
export const hookOnly = [
|
|
75
|
+
// AccountService
|
|
76
|
+
AccountService.method.getAccount,
|
|
77
|
+
AccountService.method.listIdentities,
|
|
78
|
+
AccountService.method.unlinkIdentity,
|
|
79
|
+
// ImageService
|
|
80
|
+
ImageService.method.createImage,
|
|
81
|
+
ImageService.method.buildImage,
|
|
82
|
+
ImageService.method.getImage,
|
|
83
|
+
ImageService.method.listImages,
|
|
84
|
+
ImageService.method.deleteImage,
|
|
85
|
+
ImageService.method.updateImage,
|
|
86
|
+
// ProductService
|
|
87
|
+
ProductService.method.listProducts,
|
|
88
|
+
ProductService.method.updateProduct,
|
|
65
89
|
// WorkloadService
|
|
66
90
|
WorkloadService.method.updateJob,
|
|
67
91
|
WorkloadService.method.deleteJob,
|
|
68
92
|
WorkloadService.method.updateSandbox,
|
|
69
93
|
WorkloadService.method.deleteSandbox,
|
|
94
|
+
WorkloadService.method.stopSandbox,
|
|
95
|
+
WorkloadService.method.startSandbox,
|
|
70
96
|
WorkloadService.method.cancelExecution,
|
|
97
|
+
WorkloadService.method.exportEvents,
|
|
71
98
|
WorkloadService.method.watchTelemetry,
|
|
72
99
|
WorkloadService.method.watchGuestLog,
|
|
73
100
|
WorkloadService.method.createPreviewShareLink,
|
|
74
101
|
WorkloadService.method.listPreviewShareLinks,
|
|
75
102
|
WorkloadService.method.revokePreviewShareLink,
|
|
103
|
+
WorkloadService.method.createServiceShareLink,
|
|
104
|
+
WorkloadService.method.listServiceShareLinks,
|
|
105
|
+
WorkloadService.method.revokeServiceShareLink,
|
|
106
|
+
WorkloadService.method.executeCommand,
|
|
107
|
+
WorkloadService.method.answerPrompt,
|
|
76
108
|
WorkloadService.method.createService,
|
|
77
109
|
WorkloadService.method.getService,
|
|
78
110
|
WorkloadService.method.listServices,
|
|
@@ -86,11 +118,31 @@ export const hookOnly = [
|
|
|
86
118
|
WorkloadService.method.wakeService,
|
|
87
119
|
WorkloadService.method.holdService,
|
|
88
120
|
WorkloadService.method.releaseService,
|
|
121
|
+
WorkloadService.method.listServiceRevisions,
|
|
122
|
+
WorkloadService.method.getServiceRevision,
|
|
123
|
+
WorkloadService.method.rollbackService,
|
|
124
|
+
WorkloadService.method.listServiceActivations,
|
|
89
125
|
WorkloadService.method.listServiceRuns,
|
|
90
126
|
WorkloadService.method.listEvents,
|
|
91
127
|
WorkloadService.method.watchEvents,
|
|
92
128
|
WorkloadService.method.getOperation,
|
|
93
129
|
WorkloadService.method.waitOperation,
|
|
130
|
+
// The fake holds no services: their alarms and sign-ins are answered by
|
|
131
|
+
// hooks.
|
|
132
|
+
WorkloadService.method.setServiceAlarm,
|
|
133
|
+
WorkloadService.method.getServiceAlarm,
|
|
134
|
+
WorkloadService.method.listServiceAlarms,
|
|
135
|
+
WorkloadService.method.deleteServiceAlarm,
|
|
136
|
+
WorkloadService.method.pauseServiceAlarm,
|
|
137
|
+
WorkloadService.method.resumeServiceAlarm,
|
|
138
|
+
WorkloadService.method.runServiceAlarmNow,
|
|
139
|
+
WorkloadService.method.startServiceSignIn,
|
|
140
|
+
WorkloadService.method.answerServiceSignIn,
|
|
141
|
+
WorkloadService.method.cancelServiceSignIn,
|
|
142
|
+
WorkloadService.method.getServiceSignInStatus,
|
|
143
|
+
// The fake keeps no event log: listEvents and watchEvents are hook-only, so
|
|
144
|
+
// an emitted event would be one no call can read back.
|
|
145
|
+
WorkloadService.method.emitWorkloadEvent,
|
|
94
146
|
// SecretService
|
|
95
147
|
SecretService.method.createSecretSet,
|
|
96
148
|
SecretService.method.listSecretSets,
|
|
@@ -102,8 +154,11 @@ export const hookOnly = [
|
|
|
102
154
|
SecretService.method.grantSecretSet,
|
|
103
155
|
SecretService.method.revokeSecretSet,
|
|
104
156
|
SecretService.method.listSecretSetGrants,
|
|
157
|
+
// The fake holds no secret sets.
|
|
158
|
+
SecretService.method.updateSecretSet,
|
|
105
159
|
// ProjectService
|
|
106
160
|
ProjectService.method.listProjects,
|
|
161
|
+
ProjectService.method.updateProject,
|
|
107
162
|
ProjectService.method.getProject,
|
|
108
163
|
ProjectService.method.listRepositories,
|
|
109
164
|
ProjectService.method.createProject,
|
|
@@ -115,6 +170,15 @@ export const hookOnly = [
|
|
|
115
170
|
ProjectService.method.createEmbedToken,
|
|
116
171
|
ProjectService.method.listEmbedTokens,
|
|
117
172
|
ProjectService.method.revokeEmbedToken,
|
|
173
|
+
ProjectService.method.getProjectNetwork,
|
|
174
|
+
ProjectService.method.setProjectNetwork,
|
|
175
|
+
ProjectService.method.getEnvironmentNetwork,
|
|
176
|
+
ProjectService.method.setEnvironmentNetwork,
|
|
177
|
+
// The fake holds no projects or environments.
|
|
178
|
+
ProjectService.method.updateEnvironment,
|
|
179
|
+
ProjectService.method.getEnvironmentRetention,
|
|
180
|
+
ProjectService.method.setEnvironmentRetention,
|
|
181
|
+
ProjectService.method.setEnvironmentVolumes,
|
|
118
182
|
// WebhookService
|
|
119
183
|
WebhookService.method.createWebhookEndpoint,
|
|
120
184
|
WebhookService.method.getWebhookEndpoint,
|
|
@@ -147,6 +211,9 @@ export const hookOnly = [
|
|
|
147
211
|
ChannelService.method.deleteChannel,
|
|
148
212
|
ChannelService.method.listForwards,
|
|
149
213
|
ChannelService.method.getLink,
|
|
214
|
+
ChannelService.method.sendChannelMessage,
|
|
215
|
+
ChannelService.method.tailChannelMessages,
|
|
216
|
+
ChannelService.method.replayChannelMessage,
|
|
150
217
|
// RecordingService
|
|
151
218
|
RecordingService.method.listRecordings,
|
|
152
219
|
RecordingService.method.getRecording,
|
|
@@ -155,8 +222,15 @@ export const hookOnly = [
|
|
|
155
222
|
RecordingService.method.revokeRecordingShareLink,
|
|
156
223
|
// VolumeService
|
|
157
224
|
VolumeService.method.listVolumes,
|
|
225
|
+
VolumeService.method.getVolume,
|
|
158
226
|
VolumeService.method.attachVolume,
|
|
159
227
|
VolumeService.method.detachVolume,
|
|
228
|
+
VolumeService.method.listVolumeVersions,
|
|
229
|
+
VolumeService.method.restoreVolume,
|
|
230
|
+
// The fake holds no volumes.
|
|
231
|
+
VolumeService.method.createVolume,
|
|
232
|
+
VolumeService.method.updateVolume,
|
|
233
|
+
VolumeService.method.deleteVolume,
|
|
160
234
|
// ArtifactService
|
|
161
235
|
ArtifactService.method.listArtifacts,
|
|
162
236
|
ArtifactService.method.getArtifact,
|
|
@@ -166,12 +240,22 @@ export const hookOnly = [
|
|
|
166
240
|
ArtifactUploadService.method.completeUpload,
|
|
167
241
|
// AuditEventService
|
|
168
242
|
AuditEventService.method.listAuditEvents,
|
|
243
|
+
AuditEventService.method.exportAuditEvents,
|
|
169
244
|
// FillerService
|
|
170
245
|
FillerService.method.listFillers,
|
|
171
246
|
FillerService.method.putFiller,
|
|
172
247
|
FillerService.method.deleteFiller,
|
|
173
248
|
FillerService.method.setFillerEnabled,
|
|
174
249
|
FillerService.method.listFillerRuns,
|
|
250
|
+
// GrantService
|
|
251
|
+
GrantService.method.createGrant,
|
|
252
|
+
GrantService.method.getGrant,
|
|
253
|
+
GrantService.method.listGrants,
|
|
254
|
+
GrantService.method.acceptGrant,
|
|
255
|
+
GrantService.method.declineGrant,
|
|
256
|
+
GrantService.method.updateGrant,
|
|
257
|
+
GrantService.method.revokeGrant,
|
|
258
|
+
GrantService.method.leaveGrant,
|
|
175
259
|
// HostJobService
|
|
176
260
|
HostJobService.method.listHostJobs,
|
|
177
261
|
HostJobService.method.getHostJob,
|
|
@@ -193,6 +277,8 @@ export const hookOnly = [
|
|
|
193
277
|
TokenService.method.listTokens,
|
|
194
278
|
TokenService.method.createWorkspaceToken,
|
|
195
279
|
TokenService.method.revokeToken,
|
|
280
|
+
TokenService.method.rollWorkspaceToken,
|
|
281
|
+
TokenService.method.updateToken,
|
|
196
282
|
// StorageProviderService
|
|
197
283
|
StorageProviderService.method.listStorageProviders,
|
|
198
284
|
StorageProviderService.method.createStorageProvider,
|
|
@@ -200,14 +286,10 @@ export const hookOnly = [
|
|
|
200
286
|
StorageProviderService.method.deleteStorageProvider,
|
|
201
287
|
// WorkspaceService
|
|
202
288
|
WorkspaceService.method.getWorkspace,
|
|
289
|
+
WorkspaceService.method.updateWorkspace,
|
|
203
290
|
WorkspaceService.method.listWorkspaces,
|
|
204
291
|
WorkspaceService.method.getWorkspaceBilling,
|
|
205
292
|
WorkspaceService.method.getWorkspaceStatement,
|
|
206
|
-
WorkspaceService.method.setWorkspaceOwnHostsOnly,
|
|
207
|
-
WorkspaceService.method.setWorkspaceAllowOverflow,
|
|
208
|
-
WorkspaceService.method.setWorkspaceAllowCacheWarm,
|
|
209
|
-
WorkspaceService.method.setWorkspaceCancelRunOnVmDeath,
|
|
210
|
-
WorkspaceService.method.setWorkspaceSpendLimits,
|
|
211
293
|
WorkspaceService.method.listEgressIPs,
|
|
212
294
|
WorkspaceService.method.getUsage,
|
|
213
295
|
WorkspaceService.method.getQueueTimes,
|
|
@@ -216,4 +298,17 @@ export const hookOnly = [
|
|
|
216
298
|
WorkspaceService.method.createCheckoutSession,
|
|
217
299
|
WorkspaceService.method.createBillingPortalSession,
|
|
218
300
|
WorkspaceService.method.getVersion,
|
|
301
|
+
WorkspaceService.method.listSeats,
|
|
302
|
+
WorkspaceService.method.assignSeat,
|
|
303
|
+
WorkspaceService.method.removeSeat,
|
|
304
|
+
// The fake holds no workspace record: getWorkspace is hook-only too.
|
|
305
|
+
WorkspaceService.method.deleteWorkspace,
|
|
306
|
+
WorkspaceService.method.cancelWorkspaceDeletion,
|
|
307
|
+
// DomainService
|
|
308
|
+
DomainService.method.createDomain,
|
|
309
|
+
DomainService.method.getDomain,
|
|
310
|
+
DomainService.method.listDomains,
|
|
311
|
+
DomainService.method.verifyDomain,
|
|
312
|
+
DomainService.method.issueDomain,
|
|
313
|
+
DomainService.method.deleteDomain,
|
|
219
314
|
];
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The package version; test/node.test.ts keeps it equal to package.json. */
|
|
2
|
-
export declare const VERSION = "0.5.
|
|
2
|
+
export declare const VERSION = "0.5.1";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The package version; test/node.test.ts keeps it equal to package.json. */
|
|
2
|
-
export const VERSION = "0.5.
|
|
2
|
+
export const VERSION = "0.5.1";
|
package/dist/wait.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { CallOptions } from "./client.js";
|
|
|
3
3
|
import type { WorkloadService } from "./gen/toshi/workspace/v1/workloads_pb.js";
|
|
4
4
|
import type { WaitJobRequest, WaitJobResponse, WaitSandboxRequest, WaitSandboxResponse, WaitServiceRequest, WaitServiceResponse } from "./gen/toshi/workspace/v1/workloads_pb.js";
|
|
5
5
|
import type { Operation, WaitOperationRequest } from "./gen/toshi/workspace/v1/workspace_pb.js";
|
|
6
|
+
/** The shortest time between the start of one Wait call and the start of the next, in milliseconds. */
|
|
7
|
+
export declare const waitMinInterval = 1000;
|
|
8
|
+
/** The most added to waitMinInterval, at random and inclusive. */
|
|
9
|
+
export declare const waitMaxJitter: number;
|
|
6
10
|
/** Asks again while the job is not in a state it waits for, and returns the answer when it is. */
|
|
7
11
|
export declare function waitJob(service: Client<typeof WorkloadService>, req: WaitJobRequest, opts?: CallOptions): Promise<WaitJobResponse>;
|
|
8
12
|
/** Asks again while the sandbox is not in a state it waits for. */
|
package/dist/wait.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { abortReason } from "./retry.js";
|
|
1
|
+
import { abortReason, sleep } from "./retry.js";
|
|
2
2
|
import { runWithDeadline } from "./timeout.js";
|
|
3
|
+
// wait.go:13-17: one Wait call starts no sooner than waitMinInterval plus up
|
|
4
|
+
// to waitMaxJitter after the start of the one before.
|
|
5
|
+
/** The shortest time between the start of one Wait call and the start of the next, in milliseconds. */
|
|
6
|
+
export const waitMinInterval = 1_000;
|
|
7
|
+
/** The most added to waitMinInterval, at random and inclusive. */
|
|
8
|
+
export const waitMaxJitter = waitMinInterval / 5;
|
|
3
9
|
/** Asks again while the job is not in a state it waits for, and returns the answer when it is. */
|
|
4
10
|
export function waitJob(service, req, opts) {
|
|
5
11
|
return runWithDeadline(opts, (callOpts) => waitReached((o) => service.waitJob(req, o), callOpts));
|
|
@@ -17,11 +23,13 @@ export function waitOperation(service, req, opts) {
|
|
|
17
23
|
return runWithDeadline(opts, async (callOpts) => {
|
|
18
24
|
for (;;) {
|
|
19
25
|
throwIfAborted(callOpts);
|
|
26
|
+
const started = Date.now();
|
|
20
27
|
const resp = await service.waitOperation(req, callOpts);
|
|
21
28
|
const op = resp.operation;
|
|
22
29
|
if (op !== undefined && op.done) {
|
|
23
30
|
return op;
|
|
24
31
|
}
|
|
32
|
+
await pauseWait(started, callOpts);
|
|
25
33
|
}
|
|
26
34
|
});
|
|
27
35
|
}
|
|
@@ -29,12 +37,27 @@ export function waitOperation(service, req, opts) {
|
|
|
29
37
|
async function waitReached(call, opts) {
|
|
30
38
|
for (;;) {
|
|
31
39
|
throwIfAborted(opts);
|
|
40
|
+
const started = Date.now();
|
|
32
41
|
const resp = await call(opts);
|
|
33
42
|
if (resp.reached) {
|
|
34
43
|
return resp;
|
|
35
44
|
}
|
|
45
|
+
await pauseWait(started, opts);
|
|
36
46
|
}
|
|
37
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Leaves at least waitMinInterval plus up to waitMaxJitter between the start
|
|
50
|
+
* of the call at started and the start of the next one: it pauses for the
|
|
51
|
+
* difference, at once when the call already took that long, and ends with the
|
|
52
|
+
* caller's own error when its signal aborts (wait.go:27-40).
|
|
53
|
+
*/
|
|
54
|
+
async function pauseWait(started, opts) {
|
|
55
|
+
const paused = waitMinInterval + Math.floor(Math.random() * (waitMaxJitter + 1)) - (Date.now() - started);
|
|
56
|
+
if (paused <= 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
await sleep(paused, opts?.signal);
|
|
60
|
+
}
|
|
38
61
|
// wait.go:16-18: the caller's context ends the loop with its own error.
|
|
39
62
|
function throwIfAborted(opts) {
|
|
40
63
|
const signal = opts?.signal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toshicloud/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "TypeScript client for the Toshi Workspace API",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"packageManager": "pnpm@12.15.0+sha512.b3951d6d6ff4a9f13dc7cf56cd28d2b8eb37dbcc9c68e52e1e1191873ea9f82a017287ab50baadc5ccc494f036c67c0e47eb13608c2fa36f47711b61ea128e61",
|
|
@@ -58,7 +58,8 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@bufbuild/protobuf": "
|
|
61
|
+
"@bufbuild/protobuf": "2.16.0",
|
|
62
|
+
"@bufbuild/protoc-gen-es": "2.16.0",
|
|
62
63
|
"@connectrpc/connect": "^2.2.0",
|
|
63
64
|
"@connectrpc/connect-node": "2.2.0",
|
|
64
65
|
"@connectrpc/connect-web": "2.2.0",
|