@cloudflare/sandbox 0.0.0-fddccfd → 0.0.0-ff2fa91
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/CHANGELOG.md +102 -15
- package/Dockerfile +84 -31
- package/README.md +9 -2
- package/dist/index.d.ts +1889 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3144 -64
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/clients/base-client.ts +39 -24
- package/src/clients/command-client.ts +8 -8
- package/src/clients/file-client.ts +51 -20
- package/src/clients/git-client.ts +3 -4
- package/src/clients/index.ts +12 -15
- package/src/clients/interpreter-client.ts +51 -47
- package/src/clients/port-client.ts +10 -10
- package/src/clients/process-client.ts +11 -8
- package/src/clients/sandbox-client.ts +2 -4
- package/src/clients/types.ts +6 -2
- package/src/clients/utility-client.ts +34 -5
- package/src/errors/adapter.ts +90 -32
- package/src/errors/classes.ts +189 -64
- package/src/errors/index.ts +9 -5
- package/src/file-stream.ts +11 -6
- package/src/index.ts +22 -15
- package/src/interpreter.ts +50 -41
- package/src/request-handler.ts +34 -21
- package/src/sandbox.ts +443 -144
- package/src/security.ts +21 -6
- package/src/sse-parser.ts +4 -3
- package/src/version.ts +6 -0
- package/tests/base-client.test.ts +116 -80
- package/tests/command-client.test.ts +149 -112
- package/tests/file-client.test.ts +373 -185
- package/tests/file-stream.test.ts +24 -20
- package/tests/get-sandbox.test.ts +149 -0
- package/tests/git-client.test.ts +188 -101
- package/tests/port-client.test.ts +100 -108
- package/tests/process-client.test.ts +204 -179
- package/tests/request-handler.test.ts +292 -0
- package/tests/sandbox.test.ts +303 -62
- package/tests/sse-parser.test.ts +17 -16
- package/tests/utility-client.test.ts +129 -56
- package/tests/version.test.ts +16 -0
- package/tsdown.config.ts +12 -0
- package/vitest.config.ts +6 -6
- package/dist/chunk-2P3MDMNJ.js +0 -2367
- package/dist/chunk-2P3MDMNJ.js.map +0 -1
- package/dist/chunk-BFVUNTP4.js +0 -104
- package/dist/chunk-BFVUNTP4.js.map +0 -1
- package/dist/chunk-EKSWCBCA.js +0 -86
- package/dist/chunk-EKSWCBCA.js.map +0 -1
- package/dist/chunk-JXZMAU2C.js +0 -559
- package/dist/chunk-JXZMAU2C.js.map +0 -1
- package/dist/chunk-Z532A7QC.js +0 -78
- package/dist/chunk-Z532A7QC.js.map +0 -1
- package/dist/file-stream.d.ts +0 -43
- package/dist/file-stream.js +0 -9
- package/dist/file-stream.js.map +0 -1
- package/dist/interpreter.d.ts +0 -33
- package/dist/interpreter.js +0 -8
- package/dist/interpreter.js.map +0 -1
- package/dist/request-handler.d.ts +0 -18
- package/dist/request-handler.js +0 -12
- package/dist/request-handler.js.map +0 -1
- package/dist/sandbox-CZTMzV2R.d.ts +0 -587
- package/dist/sandbox.d.ts +0 -4
- package/dist/sandbox.js +0 -12
- package/dist/sandbox.js.map +0 -1
- package/dist/security.d.ts +0 -31
- package/dist/security.js +0 -13
- package/dist/security.js.map +0 -1
- package/dist/sse-parser.d.ts +0 -28
- package/dist/sse-parser.js +0 -11
- package/dist/sse-parser.js.map +0 -1
package/src/errors/adapter.ts
CHANGED
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
* No validation overhead since we control both sides
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type {
|
|
9
9
|
CodeExecutionContext,
|
|
10
10
|
CommandErrorContext,
|
|
11
11
|
CommandNotFoundContext,
|
|
12
|
-
ContextNotFoundContext,
|
|
12
|
+
ContextNotFoundContext,
|
|
13
|
+
ErrorResponse,
|
|
13
14
|
FileExistsContext,
|
|
14
15
|
FileNotFoundContext,
|
|
15
16
|
FileSystemContext,
|
|
@@ -25,7 +26,8 @@ import type {
|
|
|
25
26
|
PortNotExposedContext,
|
|
26
27
|
ProcessErrorContext,
|
|
27
28
|
ProcessNotFoundContext,
|
|
28
|
-
ValidationFailedContext
|
|
29
|
+
ValidationFailedContext
|
|
30
|
+
} from '@repo/shared/errors';
|
|
29
31
|
import { ErrorCode } from '@repo/shared/errors';
|
|
30
32
|
|
|
31
33
|
import {
|
|
@@ -56,7 +58,7 @@ import {
|
|
|
56
58
|
ProcessNotFoundError,
|
|
57
59
|
SandboxError,
|
|
58
60
|
ServiceNotRespondingError,
|
|
59
|
-
ValidationFailedError
|
|
61
|
+
ValidationFailedError
|
|
60
62
|
} from './classes';
|
|
61
63
|
|
|
62
64
|
/**
|
|
@@ -68,13 +70,19 @@ export function createErrorFromResponse(errorResponse: ErrorResponse): Error {
|
|
|
68
70
|
switch (errorResponse.code) {
|
|
69
71
|
// File System Errors
|
|
70
72
|
case ErrorCode.FILE_NOT_FOUND:
|
|
71
|
-
return new FileNotFoundError(
|
|
73
|
+
return new FileNotFoundError(
|
|
74
|
+
errorResponse as unknown as ErrorResponse<FileNotFoundContext>
|
|
75
|
+
);
|
|
72
76
|
|
|
73
77
|
case ErrorCode.FILE_EXISTS:
|
|
74
|
-
return new FileExistsError(
|
|
78
|
+
return new FileExistsError(
|
|
79
|
+
errorResponse as unknown as ErrorResponse<FileExistsContext>
|
|
80
|
+
);
|
|
75
81
|
|
|
76
82
|
case ErrorCode.PERMISSION_DENIED:
|
|
77
|
-
return new PermissionDeniedError(
|
|
83
|
+
return new PermissionDeniedError(
|
|
84
|
+
errorResponse as unknown as ErrorResponse<FileSystemContext>
|
|
85
|
+
);
|
|
78
86
|
|
|
79
87
|
case ErrorCode.IS_DIRECTORY:
|
|
80
88
|
case ErrorCode.NOT_DIRECTORY:
|
|
@@ -85,93 +93,143 @@ export function createErrorFromResponse(errorResponse: ErrorResponse): Error {
|
|
|
85
93
|
case ErrorCode.NAME_TOO_LONG:
|
|
86
94
|
case ErrorCode.TOO_MANY_LINKS:
|
|
87
95
|
case ErrorCode.FILESYSTEM_ERROR:
|
|
88
|
-
return new FileSystemError(
|
|
96
|
+
return new FileSystemError(
|
|
97
|
+
errorResponse as unknown as ErrorResponse<FileSystemContext>
|
|
98
|
+
);
|
|
89
99
|
|
|
90
100
|
// Command Errors
|
|
91
101
|
case ErrorCode.COMMAND_NOT_FOUND:
|
|
92
|
-
return new CommandNotFoundError(
|
|
102
|
+
return new CommandNotFoundError(
|
|
103
|
+
errorResponse as unknown as ErrorResponse<CommandNotFoundContext>
|
|
104
|
+
);
|
|
93
105
|
|
|
94
106
|
case ErrorCode.COMMAND_PERMISSION_DENIED:
|
|
95
107
|
case ErrorCode.COMMAND_EXECUTION_ERROR:
|
|
96
108
|
case ErrorCode.INVALID_COMMAND:
|
|
97
109
|
case ErrorCode.STREAM_START_ERROR:
|
|
98
|
-
return new CommandError(
|
|
110
|
+
return new CommandError(
|
|
111
|
+
errorResponse as unknown as ErrorResponse<CommandErrorContext>
|
|
112
|
+
);
|
|
99
113
|
|
|
100
114
|
// Process Errors
|
|
101
115
|
case ErrorCode.PROCESS_NOT_FOUND:
|
|
102
|
-
return new ProcessNotFoundError(
|
|
116
|
+
return new ProcessNotFoundError(
|
|
117
|
+
errorResponse as unknown as ErrorResponse<ProcessNotFoundContext>
|
|
118
|
+
);
|
|
103
119
|
|
|
104
120
|
case ErrorCode.PROCESS_PERMISSION_DENIED:
|
|
105
121
|
case ErrorCode.PROCESS_ERROR:
|
|
106
|
-
return new ProcessError(
|
|
122
|
+
return new ProcessError(
|
|
123
|
+
errorResponse as unknown as ErrorResponse<ProcessErrorContext>
|
|
124
|
+
);
|
|
107
125
|
|
|
108
126
|
// Port Errors
|
|
109
127
|
case ErrorCode.PORT_ALREADY_EXPOSED:
|
|
110
|
-
return new PortAlreadyExposedError(
|
|
128
|
+
return new PortAlreadyExposedError(
|
|
129
|
+
errorResponse as unknown as ErrorResponse<PortAlreadyExposedContext>
|
|
130
|
+
);
|
|
111
131
|
|
|
112
132
|
case ErrorCode.PORT_NOT_EXPOSED:
|
|
113
|
-
return new PortNotExposedError(
|
|
133
|
+
return new PortNotExposedError(
|
|
134
|
+
errorResponse as unknown as ErrorResponse<PortNotExposedContext>
|
|
135
|
+
);
|
|
114
136
|
|
|
115
137
|
case ErrorCode.INVALID_PORT_NUMBER:
|
|
116
138
|
case ErrorCode.INVALID_PORT:
|
|
117
|
-
return new InvalidPortError(
|
|
139
|
+
return new InvalidPortError(
|
|
140
|
+
errorResponse as unknown as ErrorResponse<InvalidPortContext>
|
|
141
|
+
);
|
|
118
142
|
|
|
119
143
|
case ErrorCode.SERVICE_NOT_RESPONDING:
|
|
120
|
-
return new ServiceNotRespondingError(
|
|
144
|
+
return new ServiceNotRespondingError(
|
|
145
|
+
errorResponse as unknown as ErrorResponse<PortErrorContext>
|
|
146
|
+
);
|
|
121
147
|
|
|
122
148
|
case ErrorCode.PORT_IN_USE:
|
|
123
|
-
return new PortInUseError(
|
|
149
|
+
return new PortInUseError(
|
|
150
|
+
errorResponse as unknown as ErrorResponse<PortErrorContext>
|
|
151
|
+
);
|
|
124
152
|
|
|
125
153
|
case ErrorCode.PORT_OPERATION_ERROR:
|
|
126
|
-
return new PortError(
|
|
154
|
+
return new PortError(
|
|
155
|
+
errorResponse as unknown as ErrorResponse<PortErrorContext>
|
|
156
|
+
);
|
|
127
157
|
|
|
128
158
|
case ErrorCode.CUSTOM_DOMAIN_REQUIRED:
|
|
129
|
-
return new CustomDomainRequiredError(
|
|
159
|
+
return new CustomDomainRequiredError(
|
|
160
|
+
errorResponse as unknown as ErrorResponse<InternalErrorContext>
|
|
161
|
+
);
|
|
130
162
|
|
|
131
163
|
// Git Errors
|
|
132
164
|
case ErrorCode.GIT_REPOSITORY_NOT_FOUND:
|
|
133
|
-
return new GitRepositoryNotFoundError(
|
|
165
|
+
return new GitRepositoryNotFoundError(
|
|
166
|
+
errorResponse as unknown as ErrorResponse<GitRepositoryNotFoundContext>
|
|
167
|
+
);
|
|
134
168
|
|
|
135
169
|
case ErrorCode.GIT_AUTH_FAILED:
|
|
136
|
-
return new GitAuthenticationError(
|
|
170
|
+
return new GitAuthenticationError(
|
|
171
|
+
errorResponse as unknown as ErrorResponse<GitAuthFailedContext>
|
|
172
|
+
);
|
|
137
173
|
|
|
138
174
|
case ErrorCode.GIT_BRANCH_NOT_FOUND:
|
|
139
|
-
return new GitBranchNotFoundError(
|
|
175
|
+
return new GitBranchNotFoundError(
|
|
176
|
+
errorResponse as unknown as ErrorResponse<GitBranchNotFoundContext>
|
|
177
|
+
);
|
|
140
178
|
|
|
141
179
|
case ErrorCode.GIT_NETWORK_ERROR:
|
|
142
|
-
return new GitNetworkError(
|
|
180
|
+
return new GitNetworkError(
|
|
181
|
+
errorResponse as unknown as ErrorResponse<GitErrorContext>
|
|
182
|
+
);
|
|
143
183
|
|
|
144
184
|
case ErrorCode.GIT_CLONE_FAILED:
|
|
145
|
-
return new GitCloneError(
|
|
185
|
+
return new GitCloneError(
|
|
186
|
+
errorResponse as unknown as ErrorResponse<GitErrorContext>
|
|
187
|
+
);
|
|
146
188
|
|
|
147
189
|
case ErrorCode.GIT_CHECKOUT_FAILED:
|
|
148
|
-
return new GitCheckoutError(
|
|
190
|
+
return new GitCheckoutError(
|
|
191
|
+
errorResponse as unknown as ErrorResponse<GitErrorContext>
|
|
192
|
+
);
|
|
149
193
|
|
|
150
194
|
case ErrorCode.INVALID_GIT_URL:
|
|
151
|
-
return new InvalidGitUrlError(
|
|
195
|
+
return new InvalidGitUrlError(
|
|
196
|
+
errorResponse as unknown as ErrorResponse<ValidationFailedContext>
|
|
197
|
+
);
|
|
152
198
|
|
|
153
199
|
case ErrorCode.GIT_OPERATION_FAILED:
|
|
154
|
-
return new GitError(
|
|
200
|
+
return new GitError(
|
|
201
|
+
errorResponse as unknown as ErrorResponse<GitErrorContext>
|
|
202
|
+
);
|
|
155
203
|
|
|
156
204
|
// Code Interpreter Errors
|
|
157
205
|
case ErrorCode.INTERPRETER_NOT_READY:
|
|
158
|
-
return new InterpreterNotReadyError(
|
|
206
|
+
return new InterpreterNotReadyError(
|
|
207
|
+
errorResponse as unknown as ErrorResponse<InterpreterNotReadyContext>
|
|
208
|
+
);
|
|
159
209
|
|
|
160
210
|
case ErrorCode.CONTEXT_NOT_FOUND:
|
|
161
|
-
return new ContextNotFoundError(
|
|
211
|
+
return new ContextNotFoundError(
|
|
212
|
+
errorResponse as unknown as ErrorResponse<ContextNotFoundContext>
|
|
213
|
+
);
|
|
162
214
|
|
|
163
215
|
case ErrorCode.CODE_EXECUTION_ERROR:
|
|
164
|
-
return new CodeExecutionError(
|
|
216
|
+
return new CodeExecutionError(
|
|
217
|
+
errorResponse as unknown as ErrorResponse<CodeExecutionContext>
|
|
218
|
+
);
|
|
165
219
|
|
|
166
220
|
// Validation Errors
|
|
167
221
|
case ErrorCode.VALIDATION_FAILED:
|
|
168
|
-
return new ValidationFailedError(
|
|
222
|
+
return new ValidationFailedError(
|
|
223
|
+
errorResponse as unknown as ErrorResponse<ValidationFailedContext>
|
|
224
|
+
);
|
|
169
225
|
|
|
170
226
|
// Generic Errors
|
|
171
227
|
case ErrorCode.INVALID_JSON_RESPONSE:
|
|
172
228
|
case ErrorCode.UNKNOWN_ERROR:
|
|
173
229
|
case ErrorCode.INTERNAL_ERROR:
|
|
174
|
-
return new SandboxError(
|
|
230
|
+
return new SandboxError(
|
|
231
|
+
errorResponse as unknown as ErrorResponse<InternalErrorContext>
|
|
232
|
+
);
|
|
175
233
|
|
|
176
234
|
default:
|
|
177
235
|
// Fallback for unknown error codes
|
package/src/errors/classes.ts
CHANGED
|
@@ -9,7 +9,8 @@ import type {
|
|
|
9
9
|
CodeExecutionContext,
|
|
10
10
|
CommandErrorContext,
|
|
11
11
|
CommandNotFoundContext,
|
|
12
|
-
ContextNotFoundContext,
|
|
12
|
+
ContextNotFoundContext,
|
|
13
|
+
ErrorResponse,
|
|
13
14
|
FileExistsContext,
|
|
14
15
|
FileNotFoundContext,
|
|
15
16
|
FileSystemContext,
|
|
@@ -25,7 +26,7 @@ import type {
|
|
|
25
26
|
PortNotExposedContext,
|
|
26
27
|
ProcessErrorContext,
|
|
27
28
|
ProcessNotFoundContext,
|
|
28
|
-
ValidationFailedContext
|
|
29
|
+
ValidationFailedContext
|
|
29
30
|
} from '@repo/shared/errors';
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -39,13 +40,27 @@ export class SandboxError<TContext = Record<string, unknown>> extends Error {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
// Convenience accessors
|
|
42
|
-
get code() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
get
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
get
|
|
43
|
+
get code() {
|
|
44
|
+
return this.errorResponse.code;
|
|
45
|
+
}
|
|
46
|
+
get context() {
|
|
47
|
+
return this.errorResponse.context;
|
|
48
|
+
}
|
|
49
|
+
get httpStatus() {
|
|
50
|
+
return this.errorResponse.httpStatus;
|
|
51
|
+
}
|
|
52
|
+
get operation() {
|
|
53
|
+
return this.errorResponse.operation;
|
|
54
|
+
}
|
|
55
|
+
get suggestion() {
|
|
56
|
+
return this.errorResponse.suggestion;
|
|
57
|
+
}
|
|
58
|
+
get timestamp() {
|
|
59
|
+
return this.errorResponse.timestamp;
|
|
60
|
+
}
|
|
61
|
+
get documentation() {
|
|
62
|
+
return this.errorResponse.documentation;
|
|
63
|
+
}
|
|
49
64
|
|
|
50
65
|
// Custom serialization for logging
|
|
51
66
|
toJSON() {
|
|
@@ -78,7 +93,9 @@ export class FileNotFoundError extends SandboxError<FileNotFoundContext> {
|
|
|
78
93
|
}
|
|
79
94
|
|
|
80
95
|
// Type-safe accessors
|
|
81
|
-
get path() {
|
|
96
|
+
get path() {
|
|
97
|
+
return this.context.path;
|
|
98
|
+
}
|
|
82
99
|
}
|
|
83
100
|
|
|
84
101
|
/**
|
|
@@ -91,7 +108,9 @@ export class FileExistsError extends SandboxError<FileExistsContext> {
|
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
// Type-safe accessor
|
|
94
|
-
get path() {
|
|
111
|
+
get path() {
|
|
112
|
+
return this.context.path;
|
|
113
|
+
}
|
|
95
114
|
}
|
|
96
115
|
|
|
97
116
|
/**
|
|
@@ -104,9 +123,15 @@ export class FileSystemError extends SandboxError<FileSystemContext> {
|
|
|
104
123
|
}
|
|
105
124
|
|
|
106
125
|
// Type-safe accessors
|
|
107
|
-
get path() {
|
|
108
|
-
|
|
109
|
-
|
|
126
|
+
get path() {
|
|
127
|
+
return this.context.path;
|
|
128
|
+
}
|
|
129
|
+
get stderr() {
|
|
130
|
+
return this.context.stderr;
|
|
131
|
+
}
|
|
132
|
+
get exitCode() {
|
|
133
|
+
return this.context.exitCode;
|
|
134
|
+
}
|
|
110
135
|
}
|
|
111
136
|
|
|
112
137
|
/**
|
|
@@ -118,7 +143,9 @@ export class PermissionDeniedError extends SandboxError<FileSystemContext> {
|
|
|
118
143
|
this.name = 'PermissionDeniedError';
|
|
119
144
|
}
|
|
120
145
|
|
|
121
|
-
get path() {
|
|
146
|
+
get path() {
|
|
147
|
+
return this.context.path;
|
|
148
|
+
}
|
|
122
149
|
}
|
|
123
150
|
|
|
124
151
|
// ============================================================================
|
|
@@ -135,7 +162,9 @@ export class CommandNotFoundError extends SandboxError<CommandNotFoundContext> {
|
|
|
135
162
|
}
|
|
136
163
|
|
|
137
164
|
// Type-safe accessor
|
|
138
|
-
get command() {
|
|
165
|
+
get command() {
|
|
166
|
+
return this.context.command;
|
|
167
|
+
}
|
|
139
168
|
}
|
|
140
169
|
|
|
141
170
|
/**
|
|
@@ -148,10 +177,18 @@ export class CommandError extends SandboxError<CommandErrorContext> {
|
|
|
148
177
|
}
|
|
149
178
|
|
|
150
179
|
// Type-safe accessors
|
|
151
|
-
get command() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
get
|
|
180
|
+
get command() {
|
|
181
|
+
return this.context.command;
|
|
182
|
+
}
|
|
183
|
+
get exitCode() {
|
|
184
|
+
return this.context.exitCode;
|
|
185
|
+
}
|
|
186
|
+
get stdout() {
|
|
187
|
+
return this.context.stdout;
|
|
188
|
+
}
|
|
189
|
+
get stderr() {
|
|
190
|
+
return this.context.stderr;
|
|
191
|
+
}
|
|
155
192
|
}
|
|
156
193
|
|
|
157
194
|
// ============================================================================
|
|
@@ -168,7 +205,9 @@ export class ProcessNotFoundError extends SandboxError<ProcessNotFoundContext> {
|
|
|
168
205
|
}
|
|
169
206
|
|
|
170
207
|
// Type-safe accessor
|
|
171
|
-
get processId() {
|
|
208
|
+
get processId() {
|
|
209
|
+
return this.context.processId;
|
|
210
|
+
}
|
|
172
211
|
}
|
|
173
212
|
|
|
174
213
|
/**
|
|
@@ -181,10 +220,18 @@ export class ProcessError extends SandboxError<ProcessErrorContext> {
|
|
|
181
220
|
}
|
|
182
221
|
|
|
183
222
|
// Type-safe accessors
|
|
184
|
-
get processId() {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
get
|
|
223
|
+
get processId() {
|
|
224
|
+
return this.context.processId;
|
|
225
|
+
}
|
|
226
|
+
get pid() {
|
|
227
|
+
return this.context.pid;
|
|
228
|
+
}
|
|
229
|
+
get exitCode() {
|
|
230
|
+
return this.context.exitCode;
|
|
231
|
+
}
|
|
232
|
+
get stderr() {
|
|
233
|
+
return this.context.stderr;
|
|
234
|
+
}
|
|
188
235
|
}
|
|
189
236
|
|
|
190
237
|
// ============================================================================
|
|
@@ -201,8 +248,12 @@ export class PortAlreadyExposedError extends SandboxError<PortAlreadyExposedCont
|
|
|
201
248
|
}
|
|
202
249
|
|
|
203
250
|
// Type-safe accessors
|
|
204
|
-
get port() {
|
|
205
|
-
|
|
251
|
+
get port() {
|
|
252
|
+
return this.context.port;
|
|
253
|
+
}
|
|
254
|
+
get portName() {
|
|
255
|
+
return this.context.portName;
|
|
256
|
+
}
|
|
206
257
|
}
|
|
207
258
|
|
|
208
259
|
/**
|
|
@@ -215,7 +266,9 @@ export class PortNotExposedError extends SandboxError<PortNotExposedContext> {
|
|
|
215
266
|
}
|
|
216
267
|
|
|
217
268
|
// Type-safe accessor
|
|
218
|
-
get port() {
|
|
269
|
+
get port() {
|
|
270
|
+
return this.context.port;
|
|
271
|
+
}
|
|
219
272
|
}
|
|
220
273
|
|
|
221
274
|
/**
|
|
@@ -228,8 +281,12 @@ export class InvalidPortError extends SandboxError<InvalidPortContext> {
|
|
|
228
281
|
}
|
|
229
282
|
|
|
230
283
|
// Type-safe accessors
|
|
231
|
-
get port() {
|
|
232
|
-
|
|
284
|
+
get port() {
|
|
285
|
+
return this.context.port;
|
|
286
|
+
}
|
|
287
|
+
get reason() {
|
|
288
|
+
return this.context.reason;
|
|
289
|
+
}
|
|
233
290
|
}
|
|
234
291
|
|
|
235
292
|
/**
|
|
@@ -242,8 +299,12 @@ export class ServiceNotRespondingError extends SandboxError<PortErrorContext> {
|
|
|
242
299
|
}
|
|
243
300
|
|
|
244
301
|
// Type-safe accessors
|
|
245
|
-
get port() {
|
|
246
|
-
|
|
302
|
+
get port() {
|
|
303
|
+
return this.context.port;
|
|
304
|
+
}
|
|
305
|
+
get portName() {
|
|
306
|
+
return this.context.portName;
|
|
307
|
+
}
|
|
247
308
|
}
|
|
248
309
|
|
|
249
310
|
/**
|
|
@@ -256,7 +317,9 @@ export class PortInUseError extends SandboxError<PortErrorContext> {
|
|
|
256
317
|
}
|
|
257
318
|
|
|
258
319
|
// Type-safe accessor
|
|
259
|
-
get port() {
|
|
320
|
+
get port() {
|
|
321
|
+
return this.context.port;
|
|
322
|
+
}
|
|
260
323
|
}
|
|
261
324
|
|
|
262
325
|
/**
|
|
@@ -269,9 +332,15 @@ export class PortError extends SandboxError<PortErrorContext> {
|
|
|
269
332
|
}
|
|
270
333
|
|
|
271
334
|
// Type-safe accessors
|
|
272
|
-
get port() {
|
|
273
|
-
|
|
274
|
-
|
|
335
|
+
get port() {
|
|
336
|
+
return this.context.port;
|
|
337
|
+
}
|
|
338
|
+
get portName() {
|
|
339
|
+
return this.context.portName;
|
|
340
|
+
}
|
|
341
|
+
get stderr() {
|
|
342
|
+
return this.context.stderr;
|
|
343
|
+
}
|
|
275
344
|
}
|
|
276
345
|
|
|
277
346
|
/**
|
|
@@ -298,7 +367,9 @@ export class GitRepositoryNotFoundError extends SandboxError<GitRepositoryNotFou
|
|
|
298
367
|
}
|
|
299
368
|
|
|
300
369
|
// Type-safe accessor
|
|
301
|
-
get repository() {
|
|
370
|
+
get repository() {
|
|
371
|
+
return this.context.repository;
|
|
372
|
+
}
|
|
302
373
|
}
|
|
303
374
|
|
|
304
375
|
/**
|
|
@@ -311,7 +382,9 @@ export class GitAuthenticationError extends SandboxError<GitAuthFailedContext> {
|
|
|
311
382
|
}
|
|
312
383
|
|
|
313
384
|
// Type-safe accessor
|
|
314
|
-
get repository() {
|
|
385
|
+
get repository() {
|
|
386
|
+
return this.context.repository;
|
|
387
|
+
}
|
|
315
388
|
}
|
|
316
389
|
|
|
317
390
|
/**
|
|
@@ -324,8 +397,12 @@ export class GitBranchNotFoundError extends SandboxError<GitBranchNotFoundContex
|
|
|
324
397
|
}
|
|
325
398
|
|
|
326
399
|
// Type-safe accessors
|
|
327
|
-
get branch() {
|
|
328
|
-
|
|
400
|
+
get branch() {
|
|
401
|
+
return this.context.branch;
|
|
402
|
+
}
|
|
403
|
+
get repository() {
|
|
404
|
+
return this.context.repository;
|
|
405
|
+
}
|
|
329
406
|
}
|
|
330
407
|
|
|
331
408
|
/**
|
|
@@ -338,9 +415,15 @@ export class GitNetworkError extends SandboxError<GitErrorContext> {
|
|
|
338
415
|
}
|
|
339
416
|
|
|
340
417
|
// Type-safe accessors
|
|
341
|
-
get repository() {
|
|
342
|
-
|
|
343
|
-
|
|
418
|
+
get repository() {
|
|
419
|
+
return this.context.repository;
|
|
420
|
+
}
|
|
421
|
+
get branch() {
|
|
422
|
+
return this.context.branch;
|
|
423
|
+
}
|
|
424
|
+
get targetDir() {
|
|
425
|
+
return this.context.targetDir;
|
|
426
|
+
}
|
|
344
427
|
}
|
|
345
428
|
|
|
346
429
|
/**
|
|
@@ -353,10 +436,18 @@ export class GitCloneError extends SandboxError<GitErrorContext> {
|
|
|
353
436
|
}
|
|
354
437
|
|
|
355
438
|
// Type-safe accessors
|
|
356
|
-
get repository() {
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
get
|
|
439
|
+
get repository() {
|
|
440
|
+
return this.context.repository;
|
|
441
|
+
}
|
|
442
|
+
get targetDir() {
|
|
443
|
+
return this.context.targetDir;
|
|
444
|
+
}
|
|
445
|
+
get stderr() {
|
|
446
|
+
return this.context.stderr;
|
|
447
|
+
}
|
|
448
|
+
get exitCode() {
|
|
449
|
+
return this.context.exitCode;
|
|
450
|
+
}
|
|
360
451
|
}
|
|
361
452
|
|
|
362
453
|
/**
|
|
@@ -369,9 +460,15 @@ export class GitCheckoutError extends SandboxError<GitErrorContext> {
|
|
|
369
460
|
}
|
|
370
461
|
|
|
371
462
|
// Type-safe accessors
|
|
372
|
-
get branch() {
|
|
373
|
-
|
|
374
|
-
|
|
463
|
+
get branch() {
|
|
464
|
+
return this.context.branch;
|
|
465
|
+
}
|
|
466
|
+
get repository() {
|
|
467
|
+
return this.context.repository;
|
|
468
|
+
}
|
|
469
|
+
get stderr() {
|
|
470
|
+
return this.context.stderr;
|
|
471
|
+
}
|
|
375
472
|
}
|
|
376
473
|
|
|
377
474
|
/**
|
|
@@ -384,7 +481,9 @@ export class InvalidGitUrlError extends SandboxError<ValidationFailedContext> {
|
|
|
384
481
|
}
|
|
385
482
|
|
|
386
483
|
// Type-safe accessor
|
|
387
|
-
get validationErrors() {
|
|
484
|
+
get validationErrors() {
|
|
485
|
+
return this.context.validationErrors;
|
|
486
|
+
}
|
|
388
487
|
}
|
|
389
488
|
|
|
390
489
|
/**
|
|
@@ -397,11 +496,21 @@ export class GitError extends SandboxError<GitErrorContext> {
|
|
|
397
496
|
}
|
|
398
497
|
|
|
399
498
|
// Type-safe accessors
|
|
400
|
-
get repository() {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
get
|
|
404
|
-
|
|
499
|
+
get repository() {
|
|
500
|
+
return this.context.repository;
|
|
501
|
+
}
|
|
502
|
+
get branch() {
|
|
503
|
+
return this.context.branch;
|
|
504
|
+
}
|
|
505
|
+
get targetDir() {
|
|
506
|
+
return this.context.targetDir;
|
|
507
|
+
}
|
|
508
|
+
get stderr() {
|
|
509
|
+
return this.context.stderr;
|
|
510
|
+
}
|
|
511
|
+
get exitCode() {
|
|
512
|
+
return this.context.exitCode;
|
|
513
|
+
}
|
|
405
514
|
}
|
|
406
515
|
|
|
407
516
|
// ============================================================================
|
|
@@ -418,8 +527,12 @@ export class InterpreterNotReadyError extends SandboxError<InterpreterNotReadyCo
|
|
|
418
527
|
}
|
|
419
528
|
|
|
420
529
|
// Type-safe accessors
|
|
421
|
-
get retryAfter() {
|
|
422
|
-
|
|
530
|
+
get retryAfter() {
|
|
531
|
+
return this.context.retryAfter;
|
|
532
|
+
}
|
|
533
|
+
get progress() {
|
|
534
|
+
return this.context.progress;
|
|
535
|
+
}
|
|
423
536
|
}
|
|
424
537
|
|
|
425
538
|
/**
|
|
@@ -432,7 +545,9 @@ export class ContextNotFoundError extends SandboxError<ContextNotFoundContext> {
|
|
|
432
545
|
}
|
|
433
546
|
|
|
434
547
|
// Type-safe accessor
|
|
435
|
-
get contextId() {
|
|
548
|
+
get contextId() {
|
|
549
|
+
return this.context.contextId;
|
|
550
|
+
}
|
|
436
551
|
}
|
|
437
552
|
|
|
438
553
|
/**
|
|
@@ -445,10 +560,18 @@ export class CodeExecutionError extends SandboxError<CodeExecutionContext> {
|
|
|
445
560
|
}
|
|
446
561
|
|
|
447
562
|
// Type-safe accessors
|
|
448
|
-
get contextId() {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
get
|
|
563
|
+
get contextId() {
|
|
564
|
+
return this.context.contextId;
|
|
565
|
+
}
|
|
566
|
+
get ename() {
|
|
567
|
+
return this.context.ename;
|
|
568
|
+
}
|
|
569
|
+
get evalue() {
|
|
570
|
+
return this.context.evalue;
|
|
571
|
+
}
|
|
572
|
+
get traceback() {
|
|
573
|
+
return this.context.traceback;
|
|
574
|
+
}
|
|
452
575
|
}
|
|
453
576
|
|
|
454
577
|
// ============================================================================
|
|
@@ -465,5 +588,7 @@ export class ValidationFailedError extends SandboxError<ValidationFailedContext>
|
|
|
465
588
|
}
|
|
466
589
|
|
|
467
590
|
// Type-safe accessor
|
|
468
|
-
get validationErrors() {
|
|
591
|
+
get validationErrors() {
|
|
592
|
+
return this.context.validationErrors;
|
|
593
|
+
}
|
|
469
594
|
}
|