sandbox0 0.2.5 → 0.2.7
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 +3 -1
- package/dist/apispec/src/apis/ApiKeysApi.d.ts +11 -1
- package/dist/apispec/src/apis/ApiKeysApi.d.ts.map +1 -1
- package/dist/apispec/src/apis/ApiKeysApi.js +32 -1
- package/dist/apispec/src/apis/UsersApi.d.ts +31 -1
- package/dist/apispec/src/apis/UsersApi.d.ts.map +1 -1
- package/dist/apispec/src/apis/UsersApi.js +97 -1
- package/dist/apispec/src/models/CreateSSHPublicKeyRequest.d.ts +39 -0
- package/dist/apispec/src/models/CreateSSHPublicKeyRequest.d.ts.map +1 -0
- package/dist/apispec/src/models/CreateSSHPublicKeyRequest.js +47 -0
- package/dist/apispec/src/models/CurrentAPIKeyResponse.d.ts +75 -0
- package/dist/apispec/src/models/CurrentAPIKeyResponse.d.ts.map +1 -0
- package/dist/apispec/src/models/CurrentAPIKeyResponse.js +71 -0
- package/dist/apispec/src/models/PauseSandboxResponse.d.ts +7 -0
- package/dist/apispec/src/models/PauseSandboxResponse.d.ts.map +1 -1
- package/dist/apispec/src/models/PauseSandboxResponse.js +5 -0
- package/dist/apispec/src/models/ResumeSandboxResponse.d.ts +7 -0
- package/dist/apispec/src/models/ResumeSandboxResponse.d.ts.map +1 -1
- package/dist/apispec/src/models/ResumeSandboxResponse.js +5 -0
- package/dist/apispec/src/models/SSHPublicKey.d.ts +75 -0
- package/dist/apispec/src/models/SSHPublicKey.d.ts.map +1 -0
- package/dist/apispec/src/models/SSHPublicKey.js +69 -0
- package/dist/apispec/src/models/Sandbox.d.ts +14 -0
- package/dist/apispec/src/models/Sandbox.d.ts.map +1 -1
- package/dist/apispec/src/models/Sandbox.js +8 -0
- package/dist/apispec/src/models/SandboxPowerState.d.ts +82 -0
- package/dist/apispec/src/models/SandboxPowerState.d.ts.map +1 -0
- package/dist/apispec/src/models/SandboxPowerState.js +81 -0
- package/dist/apispec/src/models/SandboxSSHConnection.d.ts +45 -0
- package/dist/apispec/src/models/SandboxSSHConnection.d.ts.map +1 -0
- package/dist/apispec/src/models/SandboxSSHConnection.js +51 -0
- package/dist/apispec/src/models/SandboxSummary.d.ts +7 -0
- package/dist/apispec/src/models/SandboxSummary.d.ts.map +1 -1
- package/dist/apispec/src/models/SandboxSummary.js +5 -0
- package/dist/apispec/src/models/SandboxTemplateSpec.d.ts +3 -16
- package/dist/apispec/src/models/SandboxTemplateSpec.d.ts.map +1 -1
- package/dist/apispec/src/models/SandboxTemplateSpec.js +3 -8
- package/dist/apispec/src/models/SuccessCurrentAPIKeyResponse.d.ts +40 -0
- package/dist/apispec/src/models/SuccessCurrentAPIKeyResponse.d.ts.map +1 -0
- package/dist/apispec/src/models/SuccessCurrentAPIKeyResponse.js +46 -0
- package/dist/apispec/src/models/SuccessCurrentAPIKeyResponseAllOfData.d.ts +34 -0
- package/dist/apispec/src/models/SuccessCurrentAPIKeyResponseAllOfData.d.ts.map +1 -0
- package/dist/apispec/src/models/SuccessCurrentAPIKeyResponseAllOfData.js +42 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyListResponse.d.ts +40 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyListResponse.d.ts.map +1 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyListResponse.js +46 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyListResponseAllOfData.d.ts +34 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyListResponseAllOfData.d.ts.map +1 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyListResponseAllOfData.js +42 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyResponse.d.ts +40 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyResponse.d.ts.map +1 -0
- package/dist/apispec/src/models/SuccessSSHPublicKeyResponse.js +46 -0
- package/dist/apispec/src/models/WarmProcessSpec.d.ts +67 -0
- package/dist/apispec/src/models/WarmProcessSpec.d.ts.map +1 -0
- package/dist/apispec/src/models/WarmProcessSpec.js +58 -0
- package/dist/apispec/src/models/index.d.ts +11 -3
- package/dist/apispec/src/models/index.d.ts.map +1 -1
- package/dist/apispec/src/models/index.js +11 -3
- package/dist/resources/volumes.js +1 -1
- package/dist/response_normalize.d.ts.map +1 -1
- package/dist/response_normalize.js +1 -2
- package/dist/sandbox.js +1 -1
- package/dist/sandbox_files.js +1 -1
- package/dist/template_helpers.d.ts +7 -20
- package/dist/template_helpers.d.ts.map +1 -1
- package/dist/template_helpers.js +7 -27
- package/dist/ws_client.d.ts +13 -3
- package/dist/ws_client.d.ts.map +1 -1
- package/dist/ws_client.js +145 -28
- package/package.json +1 -1
- package/dist/apispec/src/models/ContainerMountSpec.d.ts +0 -45
- package/dist/apispec/src/models/ContainerMountSpec.d.ts.map +0 -1
- package/dist/apispec/src/models/ContainerMountSpec.js +0 -49
- package/dist/apispec/src/models/SharedVolumeSpec.d.ts +0 -69
- package/dist/apispec/src/models/SharedVolumeSpec.d.ts.map +0 -1
- package/dist/apispec/src/models/SharedVolumeSpec.js +0 -57
- package/dist/apispec/src/models/SidecarContainerSpec.d.ts +0 -91
- package/dist/apispec/src/models/SidecarContainerSpec.d.ts.map +0 -1
- package/dist/apispec/src/models/SidecarContainerSpec.js +0 -69
|
@@ -12,7 +12,6 @@ export * from './ChangeRequest.js';
|
|
|
12
12
|
export * from './ClaimMountRequest.js';
|
|
13
13
|
export * from './ClaimRequest.js';
|
|
14
14
|
export * from './ClaimResponse.js';
|
|
15
|
-
export * from './ContainerMountSpec.js';
|
|
16
15
|
export * from './ContainerSpec.js';
|
|
17
16
|
export * from './ContextExecResponse.js';
|
|
18
17
|
export * from './ContextInputRequest.js';
|
|
@@ -32,6 +31,7 @@ export * from './CreateCMDContextRequest.js';
|
|
|
32
31
|
export * from './CreateContextRequest.js';
|
|
33
32
|
export * from './CreateREPLContextRequest.js';
|
|
34
33
|
export * from './CreateRegionRequest.js';
|
|
34
|
+
export * from './CreateSSHPublicKeyRequest.js';
|
|
35
35
|
export * from './CreateSandboxVolumeRequest.js';
|
|
36
36
|
export * from './CreateSnapshotRequest.js';
|
|
37
37
|
export * from './CreateTeamRequest.js';
|
|
@@ -42,6 +42,7 @@ export * from './CredentialSourceMetadata.js';
|
|
|
42
42
|
export * from './CredentialSourceResolverKind.js';
|
|
43
43
|
export * from './CredentialSourceWriteRequest.js';
|
|
44
44
|
export * from './CredentialSourceWriteSpec.js';
|
|
45
|
+
export * from './CurrentAPIKeyResponse.js';
|
|
45
46
|
export * from './DeviceLoginPollRequest.js';
|
|
46
47
|
export * from './DeviceLoginPollResponse.js';
|
|
47
48
|
export * from './DeviceLoginStartResponse.js';
|
|
@@ -120,11 +121,14 @@ export * from './ResolveVolumeSyncConflictRequest.js';
|
|
|
120
121
|
export * from './ResourceQuota.js';
|
|
121
122
|
export * from './ResourceUsage.js';
|
|
122
123
|
export * from './ResumeSandboxResponse.js';
|
|
124
|
+
export * from './SSHPublicKey.js';
|
|
123
125
|
export * from './Sandbox.js';
|
|
124
126
|
export * from './SandboxConfig.js';
|
|
125
127
|
export * from './SandboxNetworkPolicy.js';
|
|
128
|
+
export * from './SandboxPowerState.js';
|
|
126
129
|
export * from './SandboxRefreshRequest.js';
|
|
127
130
|
export * from './SandboxResourceUsage.js';
|
|
131
|
+
export * from './SandboxSSHConnection.js';
|
|
128
132
|
export * from './SandboxStatus.js';
|
|
129
133
|
export * from './SandboxSummary.js';
|
|
130
134
|
export * from './SandboxTemplate.js';
|
|
@@ -135,8 +139,6 @@ export * from './SandboxUpdateConfig.js';
|
|
|
135
139
|
export * from './SandboxUpdateRequest.js';
|
|
136
140
|
export * from './SandboxVolume.js';
|
|
137
141
|
export * from './SecurityContext.js';
|
|
138
|
-
export * from './SharedVolumeSpec.js';
|
|
139
|
-
export * from './SidecarContainerSpec.js';
|
|
140
142
|
export * from './SignalContextRequest.js';
|
|
141
143
|
export * from './Snapshot.js';
|
|
142
144
|
export * from './StaticHeadersSourceSpec.js';
|
|
@@ -157,6 +159,8 @@ export * from './SuccessCreatedResponse.js';
|
|
|
157
159
|
export * from './SuccessCreatedResponseAllOfData.js';
|
|
158
160
|
export * from './SuccessCredentialSourceListResponse.js';
|
|
159
161
|
export * from './SuccessCredentialSourceResponse.js';
|
|
162
|
+
export * from './SuccessCurrentAPIKeyResponse.js';
|
|
163
|
+
export * from './SuccessCurrentAPIKeyResponseAllOfData.js';
|
|
160
164
|
export * from './SuccessDeletedResponse.js';
|
|
161
165
|
export * from './SuccessDeletedResponseAllOfData.js';
|
|
162
166
|
export * from './SuccessDeviceLoginPollResponse.js';
|
|
@@ -193,6 +197,9 @@ export * from './SuccessResizedResponseAllOfData.js';
|
|
|
193
197
|
export * from './SuccessRestoreResponse.js';
|
|
194
198
|
export * from './SuccessRestoreResponseAllOfData.js';
|
|
195
199
|
export * from './SuccessResumeSandboxResponse.js';
|
|
200
|
+
export * from './SuccessSSHPublicKeyListResponse.js';
|
|
201
|
+
export * from './SuccessSSHPublicKeyListResponseAllOfData.js';
|
|
202
|
+
export * from './SuccessSSHPublicKeyResponse.js';
|
|
196
203
|
export * from './SuccessSandboxListResponse.js';
|
|
197
204
|
export * from './SuccessSandboxListResponseAllOfData.js';
|
|
198
205
|
export * from './SuccessSandboxNetworkPolicyResponse.js';
|
|
@@ -259,6 +266,7 @@ export * from './VolumeSyncReplicaEnvelope.js';
|
|
|
259
266
|
export * from './VolumeSyncReseedRequiredDetails.js';
|
|
260
267
|
export * from './VolumeSyncReseedRequiredErrorEnvelope.js';
|
|
261
268
|
export * from './VolumeSyncReseedRequiredErrorEnvelopeAllOfError.js';
|
|
269
|
+
export * from './WarmProcessSpec.js';
|
|
262
270
|
export * from './WebhookConfig.js';
|
|
263
271
|
export * from './WeightedPodAffinityTerm.js';
|
|
264
272
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/apispec/src/models/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/apispec/src/models/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cA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,CAAC;AAClE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sDAAsD,CAAC;AACrE,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mDAAmD,CAAC;AAClE,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC"}
|
|
@@ -14,7 +14,6 @@ export * from './ChangeRequest.js';
|
|
|
14
14
|
export * from './ClaimMountRequest.js';
|
|
15
15
|
export * from './ClaimRequest.js';
|
|
16
16
|
export * from './ClaimResponse.js';
|
|
17
|
-
export * from './ContainerMountSpec.js';
|
|
18
17
|
export * from './ContainerSpec.js';
|
|
19
18
|
export * from './ContextExecResponse.js';
|
|
20
19
|
export * from './ContextInputRequest.js';
|
|
@@ -34,6 +33,7 @@ export * from './CreateCMDContextRequest.js';
|
|
|
34
33
|
export * from './CreateContextRequest.js';
|
|
35
34
|
export * from './CreateREPLContextRequest.js';
|
|
36
35
|
export * from './CreateRegionRequest.js';
|
|
36
|
+
export * from './CreateSSHPublicKeyRequest.js';
|
|
37
37
|
export * from './CreateSandboxVolumeRequest.js';
|
|
38
38
|
export * from './CreateSnapshotRequest.js';
|
|
39
39
|
export * from './CreateTeamRequest.js';
|
|
@@ -44,6 +44,7 @@ export * from './CredentialSourceMetadata.js';
|
|
|
44
44
|
export * from './CredentialSourceResolverKind.js';
|
|
45
45
|
export * from './CredentialSourceWriteRequest.js';
|
|
46
46
|
export * from './CredentialSourceWriteSpec.js';
|
|
47
|
+
export * from './CurrentAPIKeyResponse.js';
|
|
47
48
|
export * from './DeviceLoginPollRequest.js';
|
|
48
49
|
export * from './DeviceLoginPollResponse.js';
|
|
49
50
|
export * from './DeviceLoginStartResponse.js';
|
|
@@ -122,11 +123,14 @@ export * from './ResolveVolumeSyncConflictRequest.js';
|
|
|
122
123
|
export * from './ResourceQuota.js';
|
|
123
124
|
export * from './ResourceUsage.js';
|
|
124
125
|
export * from './ResumeSandboxResponse.js';
|
|
126
|
+
export * from './SSHPublicKey.js';
|
|
125
127
|
export * from './Sandbox.js';
|
|
126
128
|
export * from './SandboxConfig.js';
|
|
127
129
|
export * from './SandboxNetworkPolicy.js';
|
|
130
|
+
export * from './SandboxPowerState.js';
|
|
128
131
|
export * from './SandboxRefreshRequest.js';
|
|
129
132
|
export * from './SandboxResourceUsage.js';
|
|
133
|
+
export * from './SandboxSSHConnection.js';
|
|
130
134
|
export * from './SandboxStatus.js';
|
|
131
135
|
export * from './SandboxSummary.js';
|
|
132
136
|
export * from './SandboxTemplate.js';
|
|
@@ -137,8 +141,6 @@ export * from './SandboxUpdateConfig.js';
|
|
|
137
141
|
export * from './SandboxUpdateRequest.js';
|
|
138
142
|
export * from './SandboxVolume.js';
|
|
139
143
|
export * from './SecurityContext.js';
|
|
140
|
-
export * from './SharedVolumeSpec.js';
|
|
141
|
-
export * from './SidecarContainerSpec.js';
|
|
142
144
|
export * from './SignalContextRequest.js';
|
|
143
145
|
export * from './Snapshot.js';
|
|
144
146
|
export * from './StaticHeadersSourceSpec.js';
|
|
@@ -159,6 +161,8 @@ export * from './SuccessCreatedResponse.js';
|
|
|
159
161
|
export * from './SuccessCreatedResponseAllOfData.js';
|
|
160
162
|
export * from './SuccessCredentialSourceListResponse.js';
|
|
161
163
|
export * from './SuccessCredentialSourceResponse.js';
|
|
164
|
+
export * from './SuccessCurrentAPIKeyResponse.js';
|
|
165
|
+
export * from './SuccessCurrentAPIKeyResponseAllOfData.js';
|
|
162
166
|
export * from './SuccessDeletedResponse.js';
|
|
163
167
|
export * from './SuccessDeletedResponseAllOfData.js';
|
|
164
168
|
export * from './SuccessDeviceLoginPollResponse.js';
|
|
@@ -195,6 +199,9 @@ export * from './SuccessResizedResponseAllOfData.js';
|
|
|
195
199
|
export * from './SuccessRestoreResponse.js';
|
|
196
200
|
export * from './SuccessRestoreResponseAllOfData.js';
|
|
197
201
|
export * from './SuccessResumeSandboxResponse.js';
|
|
202
|
+
export * from './SuccessSSHPublicKeyListResponse.js';
|
|
203
|
+
export * from './SuccessSSHPublicKeyListResponseAllOfData.js';
|
|
204
|
+
export * from './SuccessSSHPublicKeyResponse.js';
|
|
198
205
|
export * from './SuccessSandboxListResponse.js';
|
|
199
206
|
export * from './SuccessSandboxListResponseAllOfData.js';
|
|
200
207
|
export * from './SuccessSandboxNetworkPolicyResponse.js';
|
|
@@ -261,5 +268,6 @@ export * from './VolumeSyncReplicaEnvelope.js';
|
|
|
261
268
|
export * from './VolumeSyncReseedRequiredDetails.js';
|
|
262
269
|
export * from './VolumeSyncReseedRequiredErrorEnvelope.js';
|
|
263
270
|
export * from './VolumeSyncReseedRequiredErrorEnvelopeAllOfError.js';
|
|
271
|
+
export * from './WarmProcessSpec.js';
|
|
264
272
|
export * from './WebhookConfig.js';
|
|
265
273
|
export * from './WeightedPodAffinityTerm.js';
|
|
@@ -153,7 +153,7 @@ export class Volumes {
|
|
|
153
153
|
async watchFiles(volumeId, path, recursive = false) {
|
|
154
154
|
const wsUrl = this.client.websocketUrl(`/api/v1/sandboxvolumes/${volumeId}/files/watch`);
|
|
155
155
|
const headers = await this.client.wsHeaders();
|
|
156
|
-
const socket =
|
|
156
|
+
const socket = await WebSocketClient.connect(wsUrl, { headers });
|
|
157
157
|
await socket.waitForOpen();
|
|
158
158
|
socket.send(JSON.stringify({ action: "subscribe", path, recursive: !!recursive }));
|
|
159
159
|
const firstRaw = await socket.waitForMessage();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response_normalize.d.ts","sourceRoot":"","sources":["../src/response_normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"response_normalize.d.ts","sourceRoot":"","sources":["../src/response_normalize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,uBAAuB,CAAC;AA+HzE,wBAAgB,0BAA0B,IAAI,UAAU,CAIvD"}
|
|
@@ -36,13 +36,12 @@ const NULL_ARRAY_KEYS = new Set([
|
|
|
36
36
|
"providers",
|
|
37
37
|
"requiredDuringSchedulingIgnoredDuringExecution",
|
|
38
38
|
"roles",
|
|
39
|
-
"sharedVolumes",
|
|
40
|
-
"sidecars",
|
|
41
39
|
"tags",
|
|
42
40
|
"teams",
|
|
43
41
|
"templates",
|
|
44
42
|
"tolerations",
|
|
45
43
|
"values",
|
|
44
|
+
"warmProcesses",
|
|
46
45
|
]);
|
|
47
46
|
function normalizeNullStringMap(value) {
|
|
48
47
|
let changed = false;
|
package/dist/sandbox.js
CHANGED
|
@@ -368,7 +368,7 @@ export class Sandbox {
|
|
|
368
368
|
async connectWsContext(contextId) {
|
|
369
369
|
const wsUrl = this.client.websocketUrl(`/api/v1/sandboxes/${this.id}/contexts/${contextId}/ws`);
|
|
370
370
|
const headers = await this.client.wsHeaders();
|
|
371
|
-
const socket =
|
|
371
|
+
const socket = await WebSocketClient.connect(wsUrl, { headers });
|
|
372
372
|
return new ContextStream(socket, this.id, contextId);
|
|
373
373
|
}
|
|
374
374
|
async ensureReplContext(alias, options) {
|
package/dist/sandbox_files.js
CHANGED
|
@@ -89,7 +89,7 @@ Sandbox.prototype.watchFiles = async function (path, recursive = false) {
|
|
|
89
89
|
const client = getClient(this);
|
|
90
90
|
const wsUrl = client.websocketUrl(`/api/v1/sandboxes/${this.id}/files/watch`);
|
|
91
91
|
const headers = await client.wsHeaders();
|
|
92
|
-
const socket =
|
|
92
|
+
const socket = await WebSocketClient.connect(wsUrl, { headers });
|
|
93
93
|
await socket.waitForOpen();
|
|
94
94
|
socket.send(JSON.stringify({ action: "subscribe", path, recursive: !!recursive }));
|
|
95
95
|
const firstRaw = await socket.waitForMessage();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContainerSpec, EnvVar, LifecyclePolicy, PoolStrategy, ResourceQuota, SandboxNetworkPolicy, SandboxTemplateSpec, TemplateCreateRequest, TemplateUpdateRequest, WarmProcessSpec } from "./apispec/src/models/index.js";
|
|
2
2
|
export interface TemplateSpecInit {
|
|
3
3
|
description?: string;
|
|
4
4
|
displayName?: string;
|
|
5
5
|
tags?: string[];
|
|
6
|
-
|
|
7
|
-
sharedVolumes?: SharedVolumeSpec[];
|
|
6
|
+
warmProcesses?: WarmProcessSpec[];
|
|
8
7
|
pod?: SandboxTemplateSpec["pod"];
|
|
9
8
|
network?: SandboxNetworkPolicy;
|
|
10
9
|
pool?: PoolStrategy;
|
|
@@ -19,27 +18,15 @@ export interface ContainerInit {
|
|
|
19
18
|
env?: EnvVar[];
|
|
20
19
|
securityContext?: ContainerSpec["securityContext"];
|
|
21
20
|
}
|
|
22
|
-
export interface
|
|
21
|
+
export interface WarmProcessInit {
|
|
22
|
+
alias?: string;
|
|
23
23
|
command?: string[];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mounts?: ContainerMountSpec[];
|
|
27
|
-
readinessProbe?: Probe;
|
|
28
|
-
livenessProbe?: Probe;
|
|
29
|
-
startupProbe?: Probe;
|
|
30
|
-
}
|
|
31
|
-
export interface SharedVolumeInit {
|
|
32
|
-
sandboxVolumeId?: string;
|
|
33
|
-
cacheSize?: string;
|
|
34
|
-
prefetch?: number;
|
|
35
|
-
bufferSize?: string;
|
|
36
|
-
writeback?: boolean;
|
|
24
|
+
cwd?: string;
|
|
25
|
+
envVars?: Record<string, string>;
|
|
37
26
|
}
|
|
38
27
|
export declare function resources(cpu: string, memory: string): ResourceQuota;
|
|
39
|
-
export declare function mount(name: string, mountPath: string): ContainerMountSpec;
|
|
40
28
|
export declare function container(image: string, containerResources: ResourceQuota, init?: ContainerInit): ContainerSpec;
|
|
41
|
-
export declare function
|
|
42
|
-
export declare function sharedVolume(name: string, mountPath: string, init?: SharedVolumeInit): SharedVolumeSpec;
|
|
29
|
+
export declare function warmProcess(type: WarmProcessSpec["type"], init?: WarmProcessInit): WarmProcessSpec;
|
|
43
30
|
export declare function templateSpec(mainContainer: ContainerSpec, init?: TemplateSpecInit): SandboxTemplateSpec;
|
|
44
31
|
export declare function templateCreateRequest(templateId: string, spec: SandboxTemplateSpec): TemplateCreateRequest;
|
|
45
32
|
export declare function templateUpdateRequest(spec: SandboxTemplateSpec): TemplateUpdateRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template_helpers.d.ts","sourceRoot":"","sources":["../src/template_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"template_helpers.d.ts","sourceRoot":"","sources":["../src/template_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,eAAe,EACf,YAAY,EACZ,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,gBAAgB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,eAAe,EAAE,CAAC;IAClC,GAAG,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,eAAe,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAEpE;AAED,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EACb,kBAAkB,EAAE,aAAa,EACjC,IAAI,GAAE,aAAkB,GACvB,aAAa,CAQf;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAC7B,IAAI,GAAE,eAAoB,GACzB,eAAe,CAQjB;AAED,wBAAgB,YAAY,CAC1B,aAAa,EAAE,aAAa,EAC5B,IAAI,GAAE,gBAAqB,GAC1B,mBAAmB,CAgBrB;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,mBAAmB,GACxB,qBAAqB,CAEvB;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,mBAAmB,GAAG,qBAAqB,CAEtF"}
|
package/dist/template_helpers.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
export function resources(cpu, memory) {
|
|
2
2
|
return { cpu, memory };
|
|
3
3
|
}
|
|
4
|
-
export function mount(name, mountPath) {
|
|
5
|
-
return { name, mountPath };
|
|
6
|
-
}
|
|
7
4
|
export function container(image, containerResources, init = {}) {
|
|
8
5
|
return {
|
|
9
6
|
image,
|
|
@@ -13,29 +10,13 @@ export function container(image, containerResources, init = {}) {
|
|
|
13
10
|
...(init.securityContext ? { securityContext: init.securityContext } : {}),
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
|
-
export function
|
|
13
|
+
export function warmProcess(type, init = {}) {
|
|
17
14
|
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
resources: sidecarResources,
|
|
15
|
+
type,
|
|
16
|
+
...(init.alias ? { alias: init.alias } : {}),
|
|
21
17
|
...(init.command ? { command: [...init.command] } : {}),
|
|
22
|
-
...(init.
|
|
23
|
-
...(init.
|
|
24
|
-
...(init.mounts ? { mounts: [...init.mounts] } : {}),
|
|
25
|
-
...(init.readinessProbe ? { readinessProbe: init.readinessProbe } : {}),
|
|
26
|
-
...(init.livenessProbe ? { livenessProbe: init.livenessProbe } : {}),
|
|
27
|
-
...(init.startupProbe ? { startupProbe: init.startupProbe } : {}),
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export function sharedVolume(name, mountPath, init = {}) {
|
|
31
|
-
return {
|
|
32
|
-
name,
|
|
33
|
-
mountPath,
|
|
34
|
-
...(init.sandboxVolumeId ? { sandboxVolumeId: init.sandboxVolumeId } : {}),
|
|
35
|
-
...(init.cacheSize ? { cacheSize: init.cacheSize } : {}),
|
|
36
|
-
...(init.prefetch !== undefined ? { prefetch: init.prefetch } : {}),
|
|
37
|
-
...(init.bufferSize ? { bufferSize: init.bufferSize } : {}),
|
|
38
|
-
...(init.writeback !== undefined ? { writeback: init.writeback } : {}),
|
|
18
|
+
...(init.cwd ? { cwd: init.cwd } : {}),
|
|
19
|
+
...(init.envVars ? { envVars: { ...init.envVars } } : {}),
|
|
39
20
|
};
|
|
40
21
|
}
|
|
41
22
|
export function templateSpec(mainContainer, init = {}) {
|
|
@@ -44,14 +25,13 @@ export function templateSpec(mainContainer, init = {}) {
|
|
|
44
25
|
...(init.description ? { description: init.description } : {}),
|
|
45
26
|
...(init.displayName ? { displayName: init.displayName } : {}),
|
|
46
27
|
...(init.tags ? { tags: [...init.tags] } : {}),
|
|
47
|
-
...(init.
|
|
48
|
-
...(init.sharedVolumes ? { sharedVolumes: [...init.sharedVolumes] } : {}),
|
|
28
|
+
...(init.warmProcesses ? { warmProcesses: [...init.warmProcesses] } : {}),
|
|
49
29
|
...(init.pod ? { pod: init.pod } : {}),
|
|
50
30
|
...(init.network ? { network: init.network } : {}),
|
|
51
31
|
...(init.pool ? { pool: init.pool } : {}),
|
|
52
32
|
...(init.lifecycle ? { lifecycle: init.lifecycle } : {}),
|
|
53
33
|
...(init.envVars ? { envVars: { ...init.envVars } } : {}),
|
|
54
|
-
...(init.public !== undefined ? {
|
|
34
|
+
...(init.public !== undefined ? { _public: init.public } : {}),
|
|
55
35
|
...(init.allowedTeams ? { allowedTeams: [...init.allowedTeams] } : {}),
|
|
56
36
|
...(init.clusterId ? { clusterId: init.clusterId } : {}),
|
|
57
37
|
};
|
package/dist/ws_client.d.ts
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type WebSocketRawData =
|
|
1
|
+
import type WebSocketPackage from "ws";
|
|
2
|
+
export type WebSocketRawData = string | ArrayBuffer | Uint8Array | Buffer | Buffer[];
|
|
3
|
+
type WebSocketConstructor = new (url: string, protocolsOrOptions?: unknown) => WebSocketLike;
|
|
4
|
+
type EventTargetSocket = Pick<WebSocket, "readyState" | "send" | "close" | "addEventListener" | "removeEventListener"> & {
|
|
5
|
+
binaryType?: BinaryType;
|
|
6
|
+
};
|
|
7
|
+
type EventEmitterSocket = Pick<WebSocketPackage, "readyState" | "send" | "close" | "on" | "once" | "off"> & {
|
|
8
|
+
binaryType?: BinaryType;
|
|
9
|
+
};
|
|
10
|
+
type WebSocketLike = EventTargetSocket | EventEmitterSocket;
|
|
3
11
|
type WebSocketClientOptions = {
|
|
4
12
|
headers?: Record<string, string>;
|
|
5
13
|
connectTimeoutMs?: number;
|
|
14
|
+
resolveWebSocketConstructor?: (options: WebSocketClientOptions) => Promise<WebSocketConstructor>;
|
|
6
15
|
};
|
|
7
16
|
export declare class WebSocketClient {
|
|
8
17
|
private readonly socket;
|
|
9
18
|
private readonly pendingSends;
|
|
10
19
|
private closePending;
|
|
11
20
|
private readonly connectTimeoutMs;
|
|
12
|
-
|
|
21
|
+
static connect(url: string, options?: WebSocketClientOptions): Promise<WebSocketClient>;
|
|
22
|
+
private constructor();
|
|
13
23
|
get readyState(): number;
|
|
14
24
|
waitForOpen(timeoutMs?: number): Promise<void>;
|
|
15
25
|
onMessage(handler: (data: WebSocketRawData) => void): () => void;
|
package/dist/ws_client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws_client.d.ts","sourceRoot":"","sources":["../src/ws_client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ws_client.d.ts","sourceRoot":"","sources":["../src/ws_client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,IAAI,CAAC;AAEvC,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,WAAW,GACX,UAAU,GACV,MAAM,GACN,MAAM,EAAE,CAAC;AAEb,KAAK,oBAAoB,GAAG,KAAK,GAAG,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,OAAO,KAAK,aAAa,CAAC;AAQ7F,KAAK,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,kBAAkB,GAAG,qBAAqB,CAAC,GAAG;IACvH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,KAAK,kBAAkB,GAAG,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC,GAAG;IAC1G,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,KAAK,aAAa,GAAG,iBAAiB,GAAG,kBAAkB,CAAC;AAS5D,KAAK,sBAAsB,GAAG;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,gBAAgB,C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6
11
|
connectTimeoutMs;
|
|
7
|
-
|
|
12
|
+
static async connect(url, options = {}) {
|
|
13
|
+
const socket = await createWebSocket(url, options);
|
|
14
|
+
return new WebSocketClient(socket, options);
|
|
15
|
+
}
|
|
16
|
+
constructor(socket, options = {}) {
|
|
8
17
|
this.connectTimeoutMs = options.connectTimeoutMs ?? 10000;
|
|
9
|
-
this.socket =
|
|
10
|
-
this.socket
|
|
18
|
+
this.socket = socket;
|
|
19
|
+
addOpenListener(this.socket, () => {
|
|
11
20
|
this.flushPendingSends();
|
|
12
21
|
if (this.closePending) {
|
|
13
22
|
this.closePending = false;
|
|
@@ -20,7 +29,7 @@ export class WebSocketClient {
|
|
|
20
29
|
return this.socket.readyState;
|
|
21
30
|
}
|
|
22
31
|
async waitForOpen(timeoutMs = this.connectTimeoutMs) {
|
|
23
|
-
if (this.socket.readyState ===
|
|
32
|
+
if (this.socket.readyState === READY_STATE.OPEN) {
|
|
24
33
|
return;
|
|
25
34
|
}
|
|
26
35
|
return new Promise((resolve, reject) => {
|
|
@@ -43,33 +52,30 @@ export class WebSocketClient {
|
|
|
43
52
|
};
|
|
44
53
|
const cleanup = () => {
|
|
45
54
|
clearTimeout(timer);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
cleanupOpen();
|
|
56
|
+
cleanupError();
|
|
57
|
+
cleanupClose();
|
|
49
58
|
};
|
|
50
|
-
this.socket
|
|
51
|
-
this.socket
|
|
52
|
-
this.socket
|
|
59
|
+
const cleanupOpen = addOpenListener(this.socket, onOpen, { once: true });
|
|
60
|
+
const cleanupError = addErrorListener(this.socket, onError, { once: true });
|
|
61
|
+
const cleanupClose = addCloseListener(this.socket, onClose, { once: true });
|
|
53
62
|
});
|
|
54
63
|
}
|
|
55
64
|
onMessage(handler) {
|
|
56
|
-
this.socket
|
|
57
|
-
return () => this.socket.off("message", handler);
|
|
65
|
+
return addMessageListener(this.socket, handler);
|
|
58
66
|
}
|
|
59
67
|
onClose(handler) {
|
|
60
|
-
this.socket
|
|
61
|
-
return () => this.socket.off("close", handler);
|
|
68
|
+
return addCloseListener(this.socket, handler);
|
|
62
69
|
}
|
|
63
70
|
onError(handler) {
|
|
64
|
-
this.socket
|
|
65
|
-
return () => this.socket.off("error", handler);
|
|
71
|
+
return addErrorListener(this.socket, handler);
|
|
66
72
|
}
|
|
67
73
|
send(payload) {
|
|
68
|
-
if (this.socket.readyState ===
|
|
74
|
+
if (this.socket.readyState === READY_STATE.OPEN) {
|
|
69
75
|
this.socket.send(payload);
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
72
|
-
if (this.socket.readyState ===
|
|
78
|
+
if (this.socket.readyState === READY_STATE.CONNECTING) {
|
|
73
79
|
this.pendingSends.push(payload);
|
|
74
80
|
return;
|
|
75
81
|
}
|
|
@@ -77,11 +83,11 @@ export class WebSocketClient {
|
|
|
77
83
|
}
|
|
78
84
|
close() {
|
|
79
85
|
this.pendingSends.length = 0;
|
|
80
|
-
if (this.socket.readyState ===
|
|
86
|
+
if (this.socket.readyState === READY_STATE.CONNECTING) {
|
|
81
87
|
this.closePending = true;
|
|
82
88
|
return;
|
|
83
89
|
}
|
|
84
|
-
if (this.socket.readyState ===
|
|
90
|
+
if (this.socket.readyState === READY_STATE.CLOSED) {
|
|
85
91
|
return;
|
|
86
92
|
}
|
|
87
93
|
this.socket.close();
|
|
@@ -107,17 +113,17 @@ export class WebSocketClient {
|
|
|
107
113
|
};
|
|
108
114
|
const cleanup = () => {
|
|
109
115
|
clearTimeout(timer);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
cleanupMessage();
|
|
117
|
+
cleanupError();
|
|
118
|
+
cleanupClose();
|
|
113
119
|
};
|
|
114
|
-
this.socket
|
|
115
|
-
this.socket
|
|
116
|
-
this.socket
|
|
120
|
+
const cleanupMessage = addMessageListener(this.socket, onMessage, { once: true });
|
|
121
|
+
const cleanupError = addErrorListener(this.socket, onError, { once: true });
|
|
122
|
+
const cleanupClose = addCloseListener(this.socket, onClose, { once: true });
|
|
117
123
|
});
|
|
118
124
|
}
|
|
119
125
|
flushPendingSends() {
|
|
120
|
-
while (this.pendingSends.length > 0 && this.socket.readyState ===
|
|
126
|
+
while (this.pendingSends.length > 0 && this.socket.readyState === READY_STATE.OPEN) {
|
|
121
127
|
const payload = this.pendingSends.shift();
|
|
122
128
|
if (payload) {
|
|
123
129
|
this.socket.send(payload);
|
|
@@ -125,3 +131,114 @@ export class WebSocketClient {
|
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
}
|
|
134
|
+
async function createWebSocket(url, options) {
|
|
135
|
+
const resolveConstructor = options.resolveWebSocketConstructor ?? defaultResolveWebSocketConstructor;
|
|
136
|
+
const WebSocketCtor = await resolveConstructor(options);
|
|
137
|
+
const socket = options.headers
|
|
138
|
+
? new WebSocketCtor(url, { headers: options.headers })
|
|
139
|
+
: new WebSocketCtor(url);
|
|
140
|
+
if ("binaryType" in socket) {
|
|
141
|
+
socket.binaryType = "arraybuffer";
|
|
142
|
+
}
|
|
143
|
+
return socket;
|
|
144
|
+
}
|
|
145
|
+
async function defaultResolveWebSocketConstructor(options) {
|
|
146
|
+
if (typeof globalThis.WebSocket === "function" && (!options.headers || isNodeLikeRuntime())) {
|
|
147
|
+
return globalThis.WebSocket;
|
|
148
|
+
}
|
|
149
|
+
const imported = await importWsModule();
|
|
150
|
+
return (imported.default ?? imported.WebSocket);
|
|
151
|
+
}
|
|
152
|
+
async function importWsModule() {
|
|
153
|
+
// Keep the `ws` fallback out of static bundle graphs so SandFunc can rely on
|
|
154
|
+
// runtime-native WebSocket globals without pulling Node socket code.
|
|
155
|
+
const dynamicImport = Function("specifier", "return import(specifier);");
|
|
156
|
+
return dynamicImport("ws");
|
|
157
|
+
}
|
|
158
|
+
function isNodeLikeRuntime() {
|
|
159
|
+
const maybeProcess = globalThis.process;
|
|
160
|
+
return typeof maybeProcess?.versions?.node === "string";
|
|
161
|
+
}
|
|
162
|
+
function isEventTargetSocket(socket) {
|
|
163
|
+
return typeof socket.addEventListener === "function";
|
|
164
|
+
}
|
|
165
|
+
function addOpenListener(socket, handler, options) {
|
|
166
|
+
if (isEventTargetSocket(socket)) {
|
|
167
|
+
const wrapped = () => handler();
|
|
168
|
+
socket.addEventListener("open", wrapped, options?.once ? { once: true } : undefined);
|
|
169
|
+
return () => socket.removeEventListener("open", wrapped);
|
|
170
|
+
}
|
|
171
|
+
if (options?.once) {
|
|
172
|
+
socket.once("open", handler);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
socket.on("open", handler);
|
|
176
|
+
}
|
|
177
|
+
return () => socket.off("open", handler);
|
|
178
|
+
}
|
|
179
|
+
function addMessageListener(socket, handler, options) {
|
|
180
|
+
if (isEventTargetSocket(socket)) {
|
|
181
|
+
const wrapped = (event) => {
|
|
182
|
+
handler(extractMessageData(event));
|
|
183
|
+
};
|
|
184
|
+
socket.addEventListener("message", wrapped, options?.once ? { once: true } : undefined);
|
|
185
|
+
return () => socket.removeEventListener("message", wrapped);
|
|
186
|
+
}
|
|
187
|
+
const wrapped = (data) => {
|
|
188
|
+
handler(data);
|
|
189
|
+
};
|
|
190
|
+
if (options?.once) {
|
|
191
|
+
socket.once("message", wrapped);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
socket.on("message", wrapped);
|
|
195
|
+
}
|
|
196
|
+
return () => socket.off("message", wrapped);
|
|
197
|
+
}
|
|
198
|
+
function addCloseListener(socket, handler, options) {
|
|
199
|
+
if (isEventTargetSocket(socket)) {
|
|
200
|
+
const wrapped = () => handler();
|
|
201
|
+
socket.addEventListener("close", wrapped, options?.once ? { once: true } : undefined);
|
|
202
|
+
return () => socket.removeEventListener("close", wrapped);
|
|
203
|
+
}
|
|
204
|
+
if (options?.once) {
|
|
205
|
+
socket.once("close", handler);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
socket.on("close", handler);
|
|
209
|
+
}
|
|
210
|
+
return () => socket.off("close", handler);
|
|
211
|
+
}
|
|
212
|
+
function addErrorListener(socket, handler, options) {
|
|
213
|
+
if (isEventTargetSocket(socket)) {
|
|
214
|
+
const wrapped = (event) => {
|
|
215
|
+
handler(extractError(event));
|
|
216
|
+
};
|
|
217
|
+
socket.addEventListener("error", wrapped, options?.once ? { once: true } : undefined);
|
|
218
|
+
return () => socket.removeEventListener("error", wrapped);
|
|
219
|
+
}
|
|
220
|
+
const wrapped = (error) => {
|
|
221
|
+
handler(error instanceof Error ? error : new Error("websocket error"));
|
|
222
|
+
};
|
|
223
|
+
if (options?.once) {
|
|
224
|
+
socket.once("error", wrapped);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
socket.on("error", wrapped);
|
|
228
|
+
}
|
|
229
|
+
return () => socket.off("error", wrapped);
|
|
230
|
+
}
|
|
231
|
+
function extractMessageData(event) {
|
|
232
|
+
const candidate = event;
|
|
233
|
+
return candidate.data ?? new Uint8Array();
|
|
234
|
+
}
|
|
235
|
+
function extractError(event) {
|
|
236
|
+
const candidate = event;
|
|
237
|
+
if (candidate.error instanceof Error) {
|
|
238
|
+
return candidate.error;
|
|
239
|
+
}
|
|
240
|
+
if (typeof candidate.message === "string" && candidate.message.trim()) {
|
|
241
|
+
return new Error(candidate.message);
|
|
242
|
+
}
|
|
243
|
+
return new Error("websocket error");
|
|
244
|
+
}
|